export interface UseFileUploadProps { /** Maximum number of files allowed. @default 1 */ maxFiles?: number; /** Maximum file size in bytes. @default 5MB */ maxSize?: number; /** Called with the current accepted file list whenever it changes. */ onFilesChange?: (files: File[]) => void; /** Called when files are rejected due to size or count limits. */ onError?: (rejectedFiles: File[], reason: 'size' | 'count') => void; /** Whether the upload area is disabled. */ disabled?: boolean; /** * Error shown when one or more files exceed `maxSize`. `{count}` and `{size}` * are replaced with the rejected file count and the limit in MB. * @default "{count} file(s) exceed the {size}MB limit and were not added." */ sizeErrorLabel?: string; /** * Error shown when more files are selected than `maxFiles` allows. `{max}` * and `{count}` are replaced with the file limit and the rejected count. * @default "Only {max} file(s) allowed. {count} file(s) were not added." */ countErrorLabel?: string; } export interface UseFileUploadReturn { /** Currently accepted files. */ files: File[]; /** Whether a drag operation is currently active over the drop zone. */ dragActive: boolean; /** Inline error message, or `null` when there is no error. */ errorMessage: string | null; /** Attach to the hidden `` element. */ inputRef: React.RefObject; /** Process a `FileList` from any source (input change, drop, paste, etc.). */ handleFiles: (newFiles: FileList | null) => void; /** Drag enter / over / leave handler — attach to all three events. */ handleDrag: (e: React.DragEvent) => void; /** Drop handler — attach to the drop zone element. */ handleDrop: (e: React.DragEvent) => void; /** Input `onChange` handler — attach to the hidden ``. */ handleChange: (e: React.ChangeEvent) => void; /** Remove a file by its index in the `files` array. */ removeFile: (index: number) => void; /** Programmatically open the native file picker dialog. */ openFileDialog: () => void; } /** * Headless hook for drag-and-drop file upload logic. * * @description * Encapsulates all stateful behaviour for a file upload area: file validation * (size and count limits), drag-active tracking, error messaging, and the * hidden-input ref. Pair with any custom drop-zone UI. * * @example * ```tsx * const { files, dragActive, errorMessage, inputRef, handleDrag, handleDrop, handleChange, removeFile, openFileDialog } = * useFileUpload({ maxFiles: 3, maxSize: 10 * 1024 * 1024 }); * ``` */ export declare function useFileUpload({ maxFiles, maxSize, onFilesChange, onError, disabled, sizeErrorLabel, countErrorLabel, }?: UseFileUploadProps): UseFileUploadReturn;