Skip to content

Commit

Permalink
[@mantine/dropzone] Add onDropAny prop to capture both accepted and…
Browse files Browse the repository at this point in the history
… rejected files (#3010)
  • Loading branch information
nicolassanmar committed Nov 23, 2022
1 parent df73e33 commit ed8c8cf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/mantine-dropzone/src/Dropzone.tsx
Expand Up @@ -32,7 +32,10 @@ export interface DropzoneProps
/** Disable files capturing */
disabled?: boolean;

/** Called when files are dropped into dropzone */
/** Called when any files are dropped into dropzone */
onDropAny?(files: FileWithPath[], fileRejections: FileRejection[]): void;

/** Called when valid files are dropped into dropzone */
onDrop(files: FileWithPath[]): void;

/** Called when selected files don't meet file restrictions */
Expand Down Expand Up @@ -122,6 +125,7 @@ export function _Dropzone(props: DropzoneProps) {
maxSize,
accept,
children,
onDropAny,
onDrop,
onReject,
openRef,
Expand Down Expand Up @@ -149,6 +153,7 @@ export function _Dropzone(props: DropzoneProps) {
);

const { getRootProps, getInputProps, isDragAccept, isDragReject, open } = useDropzone({
onDrop: onDropAny,
onDropAccepted: onDrop,
onDropRejected: onReject,
disabled: disabled || loading,
Expand Down

0 comments on commit ed8c8cf

Please sign in to comment.