UNPKG

@llamaindex/ui

Version:

A comprehensive UI component library built with React, TypeScript, and Tailwind CSS for LlamaIndex applications

114 lines (103 loc) 4.55 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { TypedAgentData, FilterOperation, ExtractedData } from 'llama-cloud-services/beta/agent'; import { ReactNode } from 'react'; type SortDirection = "asc" | "desc" | null; interface SortState { column: string; direction: SortDirection; } interface PaginationState { page: number; size: number; } interface ItemGridHooks { deleteItem?: (itemId: string) => Promise<{ success: boolean; error?: string; }>; } interface Column<T = unknown> { key: string; header: string; getValue: (item: TypedAgentData<T>) => unknown; renderCell?: (value: unknown, hooks?: ItemGridHooks) => ReactNode; sortable?: boolean; sortKey?: string; filterable?: boolean; filterOptions?: string[]; } interface BuiltInColumnConfig<T = unknown> { fileName?: boolean | Partial<Column<T>>; status?: boolean | Partial<Column<T>>; createdAt?: boolean | Partial<Column<T>>; itemsToReview?: boolean | Partial<Column<T>>; actions?: boolean | Partial<Column<T>>; } interface BusinessConfig { columns: Column[]; filterFields: Record<string, FilterOperation>; defaultPageSize: number; } interface ItemGridProp<T = unknown> { customColumns?: Column<T>[]; onRowClick?: (item: TypedAgentData<T>) => void; defaultPageSize?: number; } declare function ItemGrid<T = unknown>({ customColumns, onRowClick, defaultPageSize, }: ItemGridProp<T>): react_jsx_runtime.JSX.Element; interface ExtractedDataItemGridProps<T> { customColumns?: Column<ExtractedData<T>>[]; builtInColumns?: BuiltInColumnConfig<ExtractedData<T>>; onRowClick?: (item: TypedAgentData<ExtractedData<T>>) => void; defaultPageSize?: number; } declare function ExtractedDataItemGrid<T>({ customColumns, builtInColumns, onRowClick, defaultPageSize, }: ExtractedDataItemGridProps<T>): react_jsx_runtime.JSX.Element; declare const STATUS_OPTIONS: readonly [{ readonly value: "pending_review"; readonly label: "In Review"; }, { readonly value: "approved"; readonly label: "Accepted"; }, { readonly value: "rejected"; readonly label: "Rejected"; }]; declare const EXTRACTED_DATA_COLUMN_NAMES: readonly ["fileName", "status", "itemsToReview", "createdAt", "actions"]; type ExtractedDataColumnName = (typeof EXTRACTED_DATA_COLUMN_NAMES)[number]; declare function getExtractedDataItemsToReviewCount<T>(item: TypedAgentData<ExtractedData<T>>, confidenceThreshold?: number): number; declare function createExtractedDataColumn<T>(columnName: ExtractedDataColumnName, config: boolean | Partial<Column<ExtractedData<T>>>, confidenceThreshold?: number): Column<ExtractedData<T>>; declare function ReviewStatusBadge({ value }: { value: string; }): react_jsx_runtime.JSX.Element; declare function SyncedIcon({ value }: { value: boolean; }): react_jsx_runtime.JSX.Element; declare function FormattedDate({ value }: { value: string; }): react_jsx_runtime.JSX.Element; declare function ColumnHeader<T = unknown>({ column, sortState, onSort, filterOptions, selectedFilters, onFilterChange, }: { column: Column<T>; sortState?: SortState; onSort?: (columnKey: string) => void; filterOptions?: string[]; selectedFilters?: string[]; onFilterChange?: (columnKey: string, values: string[]) => void; }): react_jsx_runtime.JSX.Element; interface PaginationControlsProps { paginationState: PaginationState; totalSize: number; onPaginationChange: (state: PaginationState) => void; } declare function PaginationControls({ paginationState, totalSize, onPaginationChange, }: PaginationControlsProps): react_jsx_runtime.JSX.Element; type UseItemGridHandler<T = unknown> = { data: TypedAgentData<T>[]; loading: boolean; error: string | null; totalSize: number; deleteItem: (itemId: string) => Promise<{ success: boolean; error?: string; }>; fetchData: () => Promise<void>; }; declare function useItemGridData<T = unknown>(paginationState: PaginationState, filterFields?: Record<string, FilterOperation>, sortSpec?: string | undefined): UseItemGridHandler<T>; export { type BuiltInColumnConfig, type BusinessConfig, type Column, ColumnHeader, EXTRACTED_DATA_COLUMN_NAMES, ExtractedDataItemGrid, FormattedDate, ItemGrid, PaginationControls, type PaginationState, ReviewStatusBadge, STATUS_OPTIONS, type SortDirection, type SortState, SyncedIcon, createExtractedDataColumn, getExtractedDataItemsToReviewCount as getItemsToReviewCount, useItemGridData };