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"; /** A tile that stands on its own, and the ceiling of the server's cheap image * VARIANT: a larger side draws `file.url`, because a small copy blown up reads * as a bad source image. */ export declare const THUMBNAIL_SIZE = 96; /** A tile that RIDES A ROW, and the threshold: at or below it a document renders * as a bare badge, above it as a CARD printing the filename. 40 is the * register's identity-mark rung, the number `AVATAR_PX.lg` uses. */ export declare const COMPACT_THUMBNAIL_SIZE = 40; /** The glyph a `MediaCard` plays under; `undefined` for anything that is not * playable media, which falls back to `DocumentCard`. */ export declare function getMediaIcon(mimeType: string): IconName | undefined; /** What every file source converts to before a display component takes it. */ export interface DisplayFile { id: string; filename: string; mimeType: string; url: string; thumbnailUrl?: string; /** A local object URL, for a file still uploading. */ previewUrl?: string; } /** The wire shape of a file cell — what a record read hands back. Structural, * not imported: the kit stays free of platform packages. */ export interface FileCell { id: string; filename: string; mime_type: string; url: string; thumbnail_url?: string; } /** A file cell → the shape every display component takes. A NEW object per call: * an identity cache would grow for the life of the tab. */ export declare function toDisplayFile(f: FileCell): DisplayFile; /** A file still in the upload queue → the shape the tile takes. The empty string * is the absence of a served URL, which an `uploading` tile never follows. */ export declare function pendingFile(upload: { id: string; filename: string; mimeType: string; previewUrl?: string; }): DisplayFile; /** WHERE THE BYTES ARE, when they are not yet on the server. `undefined` is a * finished file; everything here is a tile still in the queue. */ export type UploadStatus = "preparing" | "queued" | "uploading" | "paused_offline" | "retrying" | "error"; /** Overrides for the in-flight words, each falling back to the `fileUpload` * slice. Only a state wanting ATTENTION earns a word. */ export interface UploadStatusLabels { paused?: string; retrying?: string; /** Upload failed but can be retried. */ failed?: string; /** Upload failed and retry is futile (dead file ref / empty bytes — re-pick). */ unavailable?: string; retry?: string; } export interface FileThumbnailProps extends StyleProps { file: DisplayFile; /** Explicit pixel size. When omitted, fills the container at a 1:1 ratio. */ size?: number; onPress?: () => void; /** Render the tile INERT — no press handler, no `button` role, no tab stop. * Without it an `onPress`-less tile still falls back to opening the file. */ disablePress?: boolean; onRemove?: () => void; /** A selection overlay with a checkbox; with `onPress` wired the tile's press * becomes the TOGGLE, announced as `aria-pressed`. */ selected?: boolean; /** THE TILE WHILE THE BYTES ARE STILL GOING UP. It goes INERT for the duration; * `onRemove` stays live through the scrim. */ uploading?: UploadStatus; /** True when retry would hit the same failure on the same input — a dead picker * File reference, or zero bytes — so the reader must re-pick the file. */ staleFile?: boolean; /** Absent, a failed tile states the failure and stops. */ onRetry?: () => void; labels?: UploadStatusLabels; /** Adds a "TMPL" badge (any file type). */ isTemplate?: boolean; /** What pressing the tile DOES, where the raw filename is not the useful name. * Defaults to `file.filename`. */ accessibilityLabel?: string; /** WHAT A PROPOSAL DOES TO THIS TILE — a corner mark, with `removed` fading the * tile BODY while the mark stays at full strength. Ignored on a COMPACT tile * (≤ 40px), where the row carries the change. A grid expresses PAIRING badly, * so a set where documents are REPLACED wants `FileRow`. */ diff?: DiffKind; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** A file as a square thumbnail, 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; } /** The tile's ✕ — a MEMBER of the thumbnail's anatomy wherever it is composed, * so one selector reaches every one of them. */ export declare function RemoveButton(props: RemoveButtonProps): React.ReactElement>;