import React from "react"; import { type ButtonProps } from "../../../button/__next__"; import { type IconType } from "../../../icon"; interface SharedStatusProps { /** * Name shown on the status card and used in action labels and * announcements. */ filename: string; /** * Stable unique id. Use it when filenames can repeat, so each file keeps its * card and completion announcements match the right file. */ id?: string; /** * Replaces the default status text ("Uploading…", "File uploaded" or "Error * details"). Previously uploaded files have no default text. For failed * files, the text is also announced. Include the file's state in a custom * message (for example "Uploading… 2.4 MB of 10 MB"), as it is the only * text that tells screen reader users the state. */ message?: string; /** * Icon for the file. Shown before the filename when there is no thumbnail * column (uploading files show the loader instead), and in the thumbnail * column for failed files or when the image fails to load. Defaults to * `error` for failed files and a generic file icon otherwise. */ iconType?: IconType; /** * Adds a thumbnail column. Completed and previously uploaded files show this * image, or the icon if it fails to load. Uploading files show the loader, * and failed files show the error icon. */ thumbnailSrc?: string; } interface DeprecatedPrimaryAction { /** * @deprecated Use `onCancel`, `onDelete` or `onRemove`, depending on * `status`. */ onAction: () => void; } interface CancelAction { /** Cancels the upload. Adds a Cancel button to the status card. */ onCancel: () => void; } interface DeleteAction { /** Deletes the uploaded file. Adds a Delete button to the status card. */ onDelete: () => void; } interface RemoveAction { /** Removes the failed file. Adds a Remove button to the status card. */ onRemove: () => void; } type PrimaryAction = (DeprecatedPrimaryAction & Partial) | ({ onAction?: never; } & Action); type StatusUploadingProps = SharedStatusProps & PrimaryAction & { /** Upload state. `"previously"` is a file uploaded before this session. */ status: "uploading"; /** * Upload progress from 0 to 100, exposed to assistive technology. The * spinner does not yet show the value visually. Omit when unknown. */ progress?: number; }; type StatusCompletedProps = SharedStatusProps & Omit & PrimaryAction & { /** Upload state. `"previously"` is a file uploaded before this session. */ status: "completed"; /** URL of the file. Adds a Preview link to the status card. */ href?: string; }; type StatusPreviouslyProps = SharedStatusProps & Omit & { /** Upload state. `"previously"` is a file uploaded before this session. */ status: "previously"; /** URL of the file. Adds a Preview link to the status card. */ href?: string; /** * Deletes the file. Single-file mode only; previously uploaded files are * read-only in multiple-file mode. */ onDelete?: () => void; /** @deprecated Use `onDelete`. */ onAction?: () => void; }; type StatusErrorProps = SharedStatusProps & PrimaryAction & { /** Upload state. `"previously"` is a file uploaded before this session. */ status: "error"; /** Adds a Retry button to the status card. */ onRetry?: () => void; }; export type FileUploadStatusProps = StatusUploadingProps | StatusCompletedProps | StatusPreviouslyProps | StatusErrorProps; interface InternalProps { /** @ignore @private */ moveFocusAfterAction?: (element: HTMLElement, removalAnnouncement?: string) => void; /** @ignore @private */ isInMultiItemList?: boolean; /** @ignore @private */ maxHeight?: string; /** @ignore @private */ minHeight?: string; /** @ignore @private */ multiple?: boolean; /** @ignore @private */ removalAnnouncementId?: string; /** @ignore @private */ onPreviewActivate?: () => void; /** * @ignore @private * Whether an error present when this status mounts should be announced. * False for statuses rendered with the field, so page load stays silent. */ announceInitialError?: boolean; } export declare const FileUploadStatus: (props: FileUploadStatusProps & InternalProps) => React.JSX.Element; export default FileUploadStatus;