import * as React from "react"; /** A managed file entry for async upload workflows (e.g. presigned URL uploads) */ export interface ManagedFileEntry { /** Unique identifier for this file (e.g. temp attachment ID from backend) */ id: string; /** Display file name */ fileName: string; /** File size in bytes */ fileSize: number; /** Upload status */ status: "uploading" | "uploaded" | "error"; /** Error message when status is "error" */ error?: string; } /** * The metadata this component needs to validate and list a file. A browser * `File` satisfies it structurally, and so can a host's own file handle: a * native shell's OS picker hands back a path plus metadata and never a `File`, * because the bytes deliberately stay outside the WebView. See `pickFiles`. */ export interface FileUploadCandidate { name: string; size: number; type: string; } /** * A file this component can hand back. Dropping, and the built-in * ``, always produce browser `File`s no matter what * `pickFiles` returns — so `File` is part of the contract even when `T` is a * host's own handle type. Collapses to plain `File` in the default case. */ export type FileUploadValue = T | File; export interface FileUploadProps { /** Currently selected file(s) — use for simple, synchronous file handling */ value?: FileUploadValue | FileUploadValue[]; /** Callback when files change — used with `value` for simple mode */ onChange: (files: FileUploadValue | FileUploadValue[] | undefined) => void; /** * Managed file entries for async upload workflows. * When provided, the file list renders from these entries instead of `value`. * The dropzone still triggers `onChange` with new `File` objects so the consumer can upload them. */ managedFiles?: ManagedFileEntry[]; /** Callback to remove a managed file by its id. Required when `managedFiles` is provided. */ onRemoveManagedFile?: (id: string) => void; /** When provided, an uploaded managed file shows a download action that calls this with its id. */ onDownloadManagedFile?: (id: string) => void; /** Accepted MIME types (e.g., "image/*", ".pdf,.doc") */ accept?: string; /** Maximum file size in bytes. Default: 10MB */ maxSize?: number; /** Maximum number of files (only used when multiple=true). Default: 10 */ maxFiles?: number; /** Allow multiple file selection. Default: false */ multiple?: boolean; /** Primary label text. Default: "Upload Files" */ label?: string; /** Description text below label. Default: "(Click Here or Drag and Drop)" */ description?: string; /** Field label above the component */ fieldLabel?: string; /** Whether the component is disabled */ disabled?: boolean; /** Error message */ error?: string; /** Additional className */ className?: string; /** Custom icon element */ icon?: React.ReactNode; /** Max height for the file list area (e.g., 200 or "200px"). When set, the file list scrolls independently. */ maxListHeight?: number | string; /** * When true, files dropped anywhere in the window are routed to this component, * and the browser's default file-open behavior is suppressed. Use on screens/modals * where this is the only drop target. Default: false. */ acceptWindowDrops?: boolean; /** * Replaces the built-in `` as the source of files. When set, * clicking the dropzone calls this instead of opening the input, and whatever it * resolves with runs through the same accept/size/count validation before * reaching `onChange`. Resolve with an empty array when the user cancels; a * rejection surfaces in this component's own error slot. * * For hosts whose picker a WebView cannot provide — a native shell's OS picker * returns file handles rather than `File` objects, which is what widens `T`. * Leave unset on the web, where the built-in input is the right answer. */ pickFiles?: () => Promise; } export declare function FileUpload({ value, onChange, managedFiles, onRemoveManagedFile, onDownloadManagedFile, accept, maxSize, maxFiles, multiple, label, description, fieldLabel, disabled, error, className, icon, maxListHeight, acceptWindowDrops, pickFiles, }: FileUploadProps): React.JSX.Element; //# sourceMappingURL=file-upload.d.ts.map