import { FileWithPath } from "file-selector"; import * as React from "react"; //#region src/utils/index.d.ts /** * A map of accepted MIME types to file extensions, as passed to the `accept` prop. */ interface Accept { [key: string]: readonly string[]; } /** * A file rejection error. */ interface FileError { message: string; code: ErrorCode | string; } declare enum ErrorCode { FileInvalidType = "file-invalid-type", FileTooLarge = "file-too-large", FileTooSmall = "file-too-small", TooManyFiles = "too-many-files" } //#endregion //#region src/index.d.ts interface DropzoneProps extends DropzoneOptions { children?: (state: DropzoneState) => React.ReactElement; } interface FileRejection { file: FileWithPath; errors: readonly FileError[]; } type SharedProps = "multiple" | "onDragEnter" | "onDragOver" | "onDragLeave"; type DropzoneOptions = Pick, SharedProps> & { accept?: Accept; minSize?: number; maxSize?: number; maxFiles?: number; preventDropOnDocument?: boolean; noClick?: boolean; noKeyboard?: boolean; noDrag?: boolean; noDragEventsBubbling?: boolean; disabled?: boolean; onDrop?: (acceptedFiles: T[], fileRejections: FileRejection[], event: DropEvent) => void; onDropAccepted?: (files: T[], event: DropEvent) => void; onDropRejected?: (fileRejections: FileRejection[], event: DropEvent) => void; getFilesFromEvent?: (event: DropEvent) => Promise>; onFileDialogCancel?: () => void; onFileDialogOpen?: () => void; onError?: (err: Error) => void; validator?: (file: T) => FileError | readonly FileError[] | null; useFsAccessApi?: boolean; autoFocus?: boolean; }; type DropEvent = React.DragEvent | React.ChangeEvent | DragEvent | Event | Array; interface DropzoneRef { open: () => void; } type DropzoneState = DropzoneRef & { isFocused: boolean; isDragActive: boolean; isDragAccept: boolean; isDragReject: boolean; isDragGlobal: boolean; isFileDialogActive: boolean; acceptedFiles: readonly FileWithPath[]; fileRejections: readonly FileRejection[]; rootRef: React.RefObject; inputRef: React.RefObject; getRootProps: (props?: T) => T; getInputProps: (props?: T) => T; }; interface DropzoneRootProps extends React.HTMLAttributes { refKey?: string; [key: string]: any; } interface DropzoneInputProps extends React.InputHTMLAttributes { refKey?: string; } /** * Convenience wrapper component for the `useDropzone` hook * * ```jsx * * {({getRootProps, getInputProps}) => ( *
* *

Drag 'n' drop some files here, or click to select files

*
* )} *
* ``` */ declare const Dropzone: React.ForwardRefExoticComponent>; /** * A React hook that creates a drag 'n' drop area. * * ```jsx * function MyDropzone(props) { * const {getRootProps, getInputProps} = useDropzone({ * onDrop: acceptedFiles => { * // do something with the File objects, e.g. upload to some server * } * }); * return ( *
* *

Drag and drop some files here, or click to select files

*
* ) * } * ``` */ declare function useDropzone(props?: DropzoneOptions): DropzoneState; //#endregion export { type Accept, DropEvent, DropzoneInputProps, DropzoneOptions, DropzoneProps, DropzoneRef, DropzoneRootProps, DropzoneState, ErrorCode, type FileError, FileRejection, type FileWithPath, Dropzone as default, useDropzone }; //# sourceMappingURL=index.d.cts.map