@connect-soft/react-file-upload
Version:
Component for React - supported drag & drop, upload big files
38 lines (37 loc) • 1.32 kB
TypeScript
import { type ReactElement, ReactNode, type Ref } from 'react';
import { type DropzoneOptions } from 'react-dropzone';
export type ICallable = {
sendFiles: () => void;
};
type ISlots = {
input: ReactElement;
submit: ReactElement;
dialogButton: ReactElement;
};
export type IProps = {
additionalData?: Record<string, string>;
apiPath: string;
config?: Omit<DropzoneOptions, 'disabled' | 'noClick'>;
disabled?: boolean;
innerRef?: Ref<ICallable>;
labelSubmit?: ReactNode;
labelDialogButton?: ReactNode;
maxUploadedSize?: number;
requestHeaders?: Record<string, string>;
slots?: Partial<ISlots>;
titleDropZone?: ReactNode;
titleFiles?: ReactNode;
withButton?: boolean;
withDropZone?: boolean;
onFinished?: (status: 'success' | 'error', uploadedFiles: IFile[]) => void;
onStart?: () => void;
};
type IFile = {
content: File;
uid: string;
percentage: number;
response?: string;
status: 'no' | 'success' | 'error';
};
declare const FileUpload: ({ additionalData, apiPath, config, disabled, innerRef, labelDialogButton, labelSubmit, maxUploadedSize, requestHeaders, slots, titleDropZone, titleFiles, withButton, withDropZone, onFinished, onStart }: IProps) => import("react/jsx-runtime").JSX.Element;
export default FileUpload;