import * as React from "react"; import { FileWithPath } from "file-selector"; export { FileWithPath }; export default function Dropzone( props: DropzoneProps & React.RefAttributes ): JSX.Element; export function useDropzone(options?: DropzoneOptions): DropzoneState; export interface DropzoneProps extends DropzoneOptions { children?(state: DropzoneState): JSX.Element; } export enum ErrorCode { FileInvalidType = "file-invalid-type", FileTooLarge = "file-too-large", FileTooSmall = "file-too-small", TooManyFiles = "too-many-files", } export interface FileError { message: string; code: ErrorCode | string; } export interface FileRejection { file: FileWithPath; errors: readonly FileError[]; } export type DropzoneOptions = Pick, PropTypes> & { 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; }; export type DropEvent = | React.DragEvent | React.ChangeEvent | DragEvent | Event; export type DropzoneState = DropzoneRef & { isFocused: boolean; isDragActive: boolean; isDragAccept: boolean; isDragReject: boolean; isFileDialogActive: boolean; acceptedFiles: readonly FileWithPath[]; fileRejections: readonly FileRejection[]; rootRef: React.RefObject; inputRef: React.RefObject; getRootProps: (props?: T) => T; getInputProps: (props?: T) => T; }; export interface DropzoneRef { open: () => void; } export interface DropzoneRootProps extends React.HTMLAttributes { refKey?: string; [key: string]: any; } export interface DropzoneInputProps extends React.InputHTMLAttributes { refKey?: string; } type PropTypes = "multiple" | "onDragEnter" | "onDragOver" | "onDragLeave"; export interface Accept { [key: string]: readonly string[]; }