import { default as React } from 'react'; export declare enum UploadState { IDLE = "idle", UPLOADING = "uploading", SUCCESS = "success", ERROR = "error" } export type FileRejection = { file: File; errors: Array<{ code: string; message: string; }>; }; export type UploadFile = { file: File; progress: number; status: UploadState; id: string; error?: string; }; export type UploadedFileWithStatus = { file: File; id: string; status: 'success' | 'error'; error?: string; }; /** * Form value type for Upload component * - Single file: File | null * - Multiple files: File[] * Users can extract filenames and filemimes from File objects: * - filenames: files.map(f => f.name) * - filemimes: files.map(f => f.type) */ export type UploadFormValue = File | File[] | null; export type UploadProps = { multiple?: boolean; accept?: string[]; maxSize?: number; maxFiles?: number; disabled?: boolean; required?: boolean; label?: string; subLabel?: string; helpIconHintText?: string; children?: React.ReactNode; description?: string; className?: string; errorText?: string; state?: UploadState; uploadingFiles?: UploadFile[]; uploadedFiles?: UploadedFileWithStatus[]; failedFiles?: UploadedFileWithStatus[]; enforceFileTypeConsistency?: boolean; progressSpeed?: number; value?: UploadFormValue; onChange?: (value: UploadFormValue) => void; onDrop?: (acceptedFiles: File[], fileRejections: FileRejection[]) => void; onDropAccepted?: (files: File[]) => void; onDropRejected?: (fileRejections: FileRejection[]) => void; onFileRemove?: (fileId: string) => void; onReplaceFile?: () => void; /** * Callback that provides the current upload state information. * Useful for controlling external submit buttons based on error/success state. * @param stateInfo - Object containing current state, hasError, hasSuccess, etc. */ onStateChange?: (stateInfo: { state: UploadState; hasError: boolean; hasSuccess: boolean; hasUploading: boolean; errorFiles: UploadedFileWithStatus[]; successfulFiles: UploadedFileWithStatus[]; }) => void; isDragActive?: boolean; isDragAccept?: boolean; isDragReject?: boolean; validator?: (file: File) => FileRejection['errors'][0] | null; actionSlot?: React.ReactNode; } & Omit, 'onDrop' | 'onDragOver' | 'onDragLeave' | 'onChange'>;