import { FormError } from '../../types'; import { IFileWithStatus } from './interfaces'; /** * Props for FileUpload component * @interface IFileUploadProps */ export default interface IFileUploadProps extends FormError { /** * Accepted file types for upload */ acceptedFileType?: string; /** * Maximum file size in megabytes * @default 5 */ maxSize?: number; /** * Allow multiple file uploads * @default false */ allowMultiple?: boolean; /** * Current files with their status */ value?: IFileWithStatus[]; /** * Optional callback will be called when files are dragged and dropped into the upload area * @param info.newFiles new files that are being added to the list * @param info.fileList current list of files */ onChange?: (info: { newFiles: IFileWithStatus[]; fileList: IFileWithStatus[]; }) => void; /** * Optional callback when a file needs to be downloaded */ onDownload?: (file: IFileWithStatus) => void; /** * Optional callback when a file needs to be removed */ onRemove?: (file: IFileWithStatus) => void; /** * Optional callback when a file needs to be uploaded */ onUpload?: (file: IFileWithStatus, setProgress: (progress: number) => void) => Promise | void; }