@llamaindex/ui
Version:
A comprehensive UI component library built with React, TypeScript, and Tailwind CSS for LlamaIndex applications
62 lines (59 loc) • 2.18 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { ReactNode } from 'react';
import { DropzoneProps } from 'react-dropzone';
import { H as Highlight } from '../file-tool-bar-DXk1QwR5.js';
export { F as FileToolbar } from '../file-tool-bar-DXk1QwR5.js';
type UploadableContent = File | string;
type UploadableItem = {
content: UploadableContent;
fileName?: string | null;
id?: string;
};
type PreviewComponentProps = {
fileName?: string | null;
contentUrl: string;
onRemove?: () => void;
className?: string;
highlights?: Highlight[];
maxPages?: number;
maxPagesWarning?: string;
};
type PreviewComponent = React.ComponentType<PreviewComponentProps>;
type PreviewsMap = {
mimeTypes?: Record<string, PreviewComponent>;
extensions?: Record<string, PreviewComponent>;
};
interface DocumentPreviewBaseProps extends Omit<DocumentPreviewItemProps, "fileName" | "value" | "onRemove"> {
isLoading?: boolean;
heading?: string;
className?: string;
footer?: ReactNode;
accept?: DropzoneProps["accept"];
}
interface DocumentPreviewSingleProps extends DocumentPreviewBaseProps {
allowMultiple?: false;
value: UploadableContent | null;
onChange?: (content: UploadableContent | null) => void;
onRemove?: () => void;
fileName?: string | null;
}
interface DocumentPreviewMultiProps extends DocumentPreviewBaseProps {
allowMultiple: true;
value: UploadableItem[];
onChange?: (items: UploadableItem[]) => void | Promise<void>;
onRemove?: (index: number) => void;
onPreviewChange?: (index: number | null) => void;
}
type DocumentPreviewProps = DocumentPreviewSingleProps | DocumentPreviewMultiProps;
interface DocumentPreviewItemProps {
value: UploadableContent;
fileName?: string | null;
onRemove?: () => void;
allowRemoval?: boolean;
highlights?: Highlight[];
previews?: PreviewsMap;
maxPages?: number;
maxPagesWarning?: string;
}
declare function DocumentPreview(props: DocumentPreviewProps): react_jsx_runtime.JSX.Element;
export { DocumentPreview, type PreviewComponent, type PreviewComponentProps, type PreviewsMap, type UploadableItem };