UNPKG

react-filezone

Version:

filezone: A Robust, Flexible React File Upload Library with Advanced Features and Seamless User Experience

56 lines (55 loc) 1.9 kB
interface getRootFileZoneProps { onDrop: (event: React.DragEvent<HTMLDivElement>) => void; onDragEnter: (event: React.DragEvent<HTMLDivElement>) => void; onDragLeave: (event: React.DragEvent<HTMLDivElement>) => void; onDragOver: (event: React.DragEvent<HTMLDivElement>) => void; onClick: () => void; } interface getInputFileZoneProps { type: string; multiple: boolean; accept: string; max: string; onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; } interface FileState { id: string; file: File; previewUrl?: string; videoPreviewUrl?: string; state: { status: "pending" | "uploading" | "paused" | "completed" | "error" | "cancelled" | "restarted" | "idle"; progress: number; errors: string[]; }; metadata?: Record<string, any>; } interface UseUploadProps { action: string; globalConfig?: { maxConcurrentUploads?: number; maxFiles?: number; mode?: "single" | "multiple"; maxFileSize?: number; allowedFileTypes?: string[]; disabled?: boolean; }; metadata?: Record<string, any>; onUploadStart?: (files: FileState[]) => void; onUploadComplete?: (data: any) => void; onError?: (error: Error, file: FileState) => void; headers?: Record<string, string>; } export declare const useUpload: ({ action, globalConfig, metadata, onUploadStart, onUploadComplete, onError, headers, }: UseUploadProps) => { acceptedFiles: FileState[]; errors: string[]; getRootProps: () => getRootFileZoneProps; getInputProps: () => getInputFileZoneProps; removeFile: (fileId: string) => void; uploadFile: (fileId: string) => Promise<import("axios").AxiosResponse<any, any> | undefined>; isDragActive: boolean; isValidatingFiles: boolean; restartUpload: (fileId: string) => void; disabled: boolean; }; export {};