Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/dropzone] Add onDropAny prop #3010

Merged
merged 1 commit into from Nov 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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