import "./file_gallery_dialog.css"; import type * as React from "react"; import { type ReactNode } from "react"; import { Dialog as Base } from "@base-ui/react/dialog"; import type { DisplayFile } from "./file_thumbnail"; import { type ImageRotation } from "./use_image_rotation"; import type { GalleryLabels } from "./file_preview"; import { type StyleProps } from "./style_props"; export interface FileGalleryDialogProps extends StyleProps { files: DisplayFile[]; /** Index of the file currently shown. When null, the modal is closed. */ activeIndex: number | null; onIndexChange: (next: number | null) => void; /** Translated chrome + preview strings; English fallback when omitted. */ labels?: Partial; /** Reported when a file fails to render (host wires to its logger). */ onError?: (error: unknown, meta: { fileId: string; mimeType: string; }) => void; /** * Override the toolbar's Download action. Omit ⇒ a built-in default that * fetches and saves the presigned URL — correct for a custom-code app's * same-origin presigned R2 URLs. The host frontend passes * its own, which sends `credentials: "include"` for auth-gated proxy URLs. */ onDownload?: (file: DisplayFile) => void; /** * Open the active file outside the modal (a new browser tab on the frontend, the * SDK's `openExternal` inside a custom-code app — the sandbox can't pop tabs). * When omitted, the action is hidden. */ onOpenExternal?: (file: DisplayFile) => void; /** * Remove the active file. When provided, a Remove action (with a confirm) shows * in the actions menu; the host drops the file from its own state. */ onRemove?: (fileId: string) => void; /** * Optional shared rotation state (from `useImageRotation`) — pass it to keep an * inline gallery and this modal in sync. Omitted ⇒ the modal keeps its own * in-memory rotation. View-only; image files only. */ rotation?: ImageRotation; /** Show 90° rotate controls for image files. Default true. */ rotatable?: boolean; /** * Override how the active file's CONTENT is rendered (the toolbar/nav chrome is * unchanged). Omit ⇒ the built-in `FilePreview`. The host frontend passes this * to route Excel to its live editable workbook while delegating every other * type to `FilePreview`; custom-code apps never set it. `rotation` (degrees) is * forwarded so the override can honor the rotate controls for images. */ renderPreview?: (file: DisplayFile, opts: { rotation: number; }) => ReactNode; /** * Credentials mode for the built-in `FilePreview`'s byte fetches. The host * frontend passes `"include"` so the session cookie rides the cross-origin * fetch to its auth-gated proxy; custom-code apps omit it (presigned URLs). * Ignored when `renderPreview` is set (the override owns its own fetching). */ credentials?: RequestCredentials; /** * Persist the active image's current view-rotation as a new stored file. When * provided and the active image is rotated, a confirm (✓) control appears next * to the rotate buttons. The host bakes the rotation + swaps the file, then * typically closes the modal. View-rotation is reported in degrees (90/180/270). */ onPersistRotation?: (file: DisplayFile, degrees: number) => void; /** Disables the persist control while a rotation save is in flight. */ persisting?: boolean; /** Where the overlay MOUNTS — Base UI's own portal target, `document.body` by default. */ container?: HTMLElement | null; testID?: string; ref?: React.Ref; render?: Base.Popup.Props["render"]; } /** * Full-screen file preview gallery. Renders any previewable MIME type inline via * FilePreview; unknown types show a download placeholder. */ export declare function FileGalleryDialog(props: FileGalleryDialogProps): React.JSX.Element;