import "./file_thumbnail.css"; import { type IconName } from "./icon"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type DiffKind } from "./diff_mark"; import { type StyleProps } from "./style_props"; /** * Also the variant's ceiling: larger tiles draw `file.url`, since an upscaled copy reads as a bad * source. */ export declare const THUMBNAIL_SIZE = 96; /** * At or below it a document is its badge's tile, above a card printing the filename: a row's picture rung * (`MARK_PX.xl`), whose row already names the file. */ export declare const COMPACT_THUMBNAIL_SIZE: number; /** `undefined` falls back to `DocumentCard`. */ export declare function getMediaIcon(mimeType: string): IconName | undefined; /** What every file source converts to. */ export interface DisplayFile { id: string; filename: string; mimeType: string; url: string; thumbnailUrl?: string; /** For a file still uploading. */ previewUrl?: string; /** What the viewer names it by where that is not its filename — the record it is the picture of. A download * keeps the filename. */ title?: string; /** Bytes, which a document's row states beside its date; absent where the source never measured it. */ size?: number; /** When it was stored (ISO), which a document's row states. */ createdAt?: string; } /** Structural, keeping the kit free of platform packages. */ export interface FileCell { id: string; filename: string; mime_type: string; url: string; thumbnail_url?: string; size?: number | null; created_at?: string; } /** A new object per call: an identity cache would grow for the tab's life. */ export declare function toDisplayFile(f: FileCell): DisplayFile; /** `""` is the absent URL, which an uploading tile never follows. */ export declare function pendingFile(upload: { id: string; filename: string; mimeType: string; previewUrl?: string; }): DisplayFile; /** `undefined` is a finished file. */ export type UploadStatus = "preparing" | "queued" | "uploading" | "paused_offline" | "retrying" | "error"; /** Each falls back to the `fileUpload` slice; only states wanting attention get a word. */ export interface UploadStatusLabels { paused?: string; retrying?: string; failed?: string; /** Retry is futile (dead ref, empty bytes); re-pick. */ unavailable?: string; retry?: string; } export interface FileThumbnailProps extends StyleProps { file: DisplayFile; /** Omitted, fills the container at 1:1. */ size?: number; onPress?: () => void; /** Inert: no press, role or tab stop. Without it a press-less tile opens the file. */ disablePress?: boolean; onRemove?: () => void; /** The file's own ⋯ in the tile's corner, where a stored file is worked on (`FileThumbnailGrid`'s `fileActs`); * `onRemove`'s ✕ is an upload's. */ actions?: React.ReactNode; /** With `onPress`, the press toggles, announced as `aria-pressed`. */ selected?: boolean; /** Inert meanwhile; `onRemove` stays live through the scrim. */ uploading?: UploadStatus; /** Retry would fail the same way (dead File ref, zero bytes); the reader must re-pick. */ staleFile?: boolean; /** Absent, a failed tile states the failure and stops. */ onRetry?: () => void; labels?: UploadStatusLabels; /** Any file type. */ isTemplate?: boolean; /** Defaults to `file.filename`. */ accessibilityLabel?: string; /** * A corner mark; `removed` fades the body, not the mark. Ignored on compact tiles, where the row * carries it. Replacements pair better in `FileRow`. */ diff?: DiffKind; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** From any source via `DisplayFile`. */ export declare function FileThumbnail(props: FileThumbnailProps): React.ReactElement>; export interface RemoveButtonProps extends StyleProps { onPress: () => void; label?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** One selector reaches every tile's ✕. */ export declare function RemoveButton(props: RemoveButtonProps): React.ReactElement>;