@rpldy/upload-drop-zone
Version:
drop zone (container) component to initiate file and folder content uploads
33 lines (23 loc) • 1.08 kB
TypeScript
import * as React from "react";
import { UploadOptions } from "@rpldy/shared";
type DropResult = FileList | unknown[]
export type GetFilesMethod = () => Promise<File[]>;
export type DropHandlerMethod = (e: DragEvent, getFiles: GetFilesMethod) => DropResult | Promise<DropResult>;
export type ShouldRemoveDragOverMethod = (e: DragEvent) => boolean;
export type ShouldHandleDragMethod = (e: DragEvent) => boolean;
export type ShouldHandleDrag = boolean | ShouldHandleDragMethod;
export interface UploadDropZoneProps extends UploadOptions {
className?: string;
id?: string;
onDragOverClassName?: string;
dropHandler?: DropHandlerMethod;
htmlDirContentParams?: Record<string, unknown>;
shouldRemoveDragOver?: ShouldRemoveDragOverMethod;
shouldHandleDrag?: ShouldHandleDrag;
enableOnContains?: boolean;
noContainCheckForDrag?: boolean;
extraProps?: Record<string, unknown>;
children?: React.JSX.Element | React.JSX.Element[];
}
export const UploadDropZone: React.ComponentType<UploadDropZoneProps>;
export default UploadDropZone;