import type { HTMLAttributes, InputHTMLAttributes, RefObject } from 'react';
export type FileRejectionCode = 'file-too-large' | 'file-too-small' | 'file-invalid-type' | 'too-many-files';
export interface FileError {
code: FileRejectionCode;
message: string;
}
export interface FileRejection {
file: File;
errors: FileError[];
}
/** Accept as a comma string, a list, or a `{ mime: ext[] }` map (react-dropzone shape). */
export type AcceptProp = string | string[] | Record;
export interface UseFileDropOptions {
accept?: AcceptProp;
/** Max size in bytes. */
maxSize?: number;
/** Min size in bytes. */
minSize?: number;
/** Allow more than one file. Default `false`. */
multiple?: boolean;
/** Cap the number of files (only meaningful with `multiple`). */
maxFiles?: number;
disabled?: boolean;
/** Fired with `(accepted, rejected)` after each drop or browse. */
onDrop?: (accepted: File[], rejected: FileRejection[]) => void;
onDropAccepted?: (accepted: File[]) => void;
onDropRejected?: (rejected: FileRejection[]) => void;
}
export interface UseFileDropReturn {
getRootProps: (extra?: HTMLAttributes) => HTMLAttributes;
getInputProps: (extra?: InputHTMLAttributes) => InputHTMLAttributes & {
ref: RefObject;
};
open: () => void;
isDragActive: boolean;
inputRef: RefObject;
processFiles: (files: File[]) => void;
}
export declare function useFileDrop(options?: UseFileDropOptions): UseFileDropReturn;