import { type ReactNode } from "react"; import { type FileUploadSize } from "./variants.js"; export * from "./variants.js"; export { FileUploadPreview, type FileUploadPreviewProps } from "./preview.js"; export type FileUploadRejection = { file: File; reason: "size" | "type"; }; export type FileUploadVariant = "dropzone" | "button"; type FileUploadCommonProps = { /** Native `accept` filter (extensions and/or MIME types, comma-separated). */ accept?: string; /** Allow selecting more than one file. Default `false`. */ multiple?: boolean; disabled?: boolean; /** Files larger than this are rejected with reason `"size"`. */ maxSizeBytes?: number; /** Receives the files that failed `accept`/`maxSizeBytes` validation. */ onInvalidFiles?: (rejections: FileUploadRejection[]) => void; /** Trigger label. Defaults to "Upload a file" ("Upload files" when `multiple`). */ label?: ReactNode; /** * Secondary hint under the label (dropzone variant only). Defaults to a * summary derived from `accept`/`maxSizeBytes` when either is set. */ description?: ReactNode; /** Shows a progress affordance and suspends the input. */ busy?: boolean; /** `dropzone` = bordered drop target; `button` = compact button trigger. */ variant?: FileUploadVariant; size?: FileUploadSize; /** Accessible name of the selection preview list. Default "Selected files". */ selectedListLabel?: string; /** Builds the accessible name of a preview row's remove button. Default `Remove ${fileName}`. */ removeFileLabel?: (fileName: string) => string; /** Preview clear-all action label. Default "Clear all". */ clearAllLabel?: ReactNode; /** Builds the accessible name of a preview row's open-lightbox trigger. Default `Preview ${fileName}`. */ previewFileLabel?: (fileName: string) => string; /** Accessible name of the lightbox close button. Default "Close". */ previewCloseLabel?: string; /** Accessible name of the lightbox previous-file button. Default "Previous file". */ previewPreviousLabel?: string; /** Accessible name of the lightbox next-file button. Default "Next file". */ previewNextLabel?: string; /** Builds the lightbox "n of m" position readout. Default `${position} of ${total}`. */ previewPositionLabel?: (position: number, total: number) => string; /** Lightbox fallback for formats with no inline preview. Default "Preview not available". */ previewUnavailableLabel?: ReactNode; }; export type FileUploadProps = FileUploadCommonProps & ({ /** * Fire-and-forget mode: receives each batch of files that passed * validation; the component keeps no selection state. */ onFilesSelected: (files: File[]) => void; files?: undefined; onFilesChange?: undefined; } | { /** * Controlled selection mode: the app owns the file list and a * confirmation preview renders under the trigger. New selections * replace the list in single mode and accumulate (skipping duplicate * files) when `multiple`. */ files: File[]; /** Receives the full next list after every select, remove, or clear. */ onFilesChange: (files: File[]) => void; /** Optional in this mode: still receives each newly accepted batch. */ onFilesSelected?: (files: File[]) => void; }); export declare function FileUpload(props: FileUploadProps): import("react").JSX.Element; //# sourceMappingURL=index.d.ts.map