import "./files_editor.css"; import type * as React from "react"; import { type ReactNode } from "react"; import { useRender } from "@base-ui/react/use-render"; import { type FileUpload } from "./thumbnail_grid"; import type { GalleryLabels } from "./file_preview"; import { type DisplayFile } from "./file_thumbnail"; import { type StyleProps } from "./style_props"; /** Resolving prop → `LoticsLocale`. A host verb is a plain `Button` and names itself. */ export interface FilesEditorLabels { upload: string; select: string; selectAll: string; deselectAll: string; done: string; downloadAll: string; /** Given the count. */ downloadSelected: (n: number) => string; /** Verb and noun, also the confirm's commit. */ remove: string; /** By name for one file, by count above. */ removeQuestion: (names: readonly string[]) => string; } /** * For a host verb: a plain `Button` in the bar that reads the picked files and stands down * afterwards. */ export declare function useFilesEditorSelection(): { /** In grid order; empty outside select mode. */ selected: DisplayFile[]; selectedIds: string[]; files: DisplayFile[]; selectMode: boolean; /** Stays in select mode. */ clear: () => void; /** And leaves select mode. */ exit: () => void; }; export interface FilesEditorProps extends StyleProps { files: DisplayFile[]; /** In-flight uploads, each where it will land: a picture a tile in the grid, a document a row. */ uploads?: FileUpload[]; /** The host uploads and appends. Empty, the set is its drop zone — a well, or a one-line row where `compact`; * holding files, the set takes a drop and its add stands at the end of its head line (`addAt`), and the bar's * `upload` shows. Omit for a set nobody adds to. */ onAdd?: (files: File[]) => void; /** Where the add stands once the set holds files: `head` (default), its field's acts (`FormFieldActs`) — the end * of the label's line over the set, else of the set's own first line; `host`, a heading or toolbar the host * draws (`FileAddButton`, the bar's `upload`). */ addAt?: "head" | "host"; /** Rename on each file's ⋯: the whole new name, its extension the file's own; a throw keeps the dialog open. */ onRename?: (id: string, filename: string) => void | Promise; /** Replace on each file's ⋯: the file picked to stand in its place. */ onReplace?: (id: string, picked: File) => void | Promise; /** The set's name, which the drop zone takes. */ accessibilityLabel?: string; /** The drop zone is the one-line row even while the set is empty: a set standing among others, where * empty wells would stack. */ compact?: boolean; /** Replaces the picker with a native document picker. */ onUpload?: () => void; /** Remove on each file's ⋯ and the bar's `remove`, each confirmed; omit for a set nobody removes from. */ onRemove?: (id: string) => void; /** With `uploads`. */ onUploadRemove?: (id: string) => void; onRetry?: (id: string) => void; onRetryAll?: () => void; /** Default `downloadFileFromUrl`. */ onDownload?: (file: DisplayFile) => void; accept?: string; itemSize?: number; minItemWidth?: number; columns?: number; /** The grid scrolls and the bar pins below; omit where the page scrolls. */ gridMaxHeight?: number; /** Falls back to the active `LoticsLocale`. */ labels?: Partial; /** See `FilePreviewProps`. */ credentials?: RequestCredentials; galleryLabels?: Partial; /** Omit for a grid that only previews. */ children?: ReactNode; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** * The attachment surface, the width of the value it stands in: owns batch selection, the gallery and the * confirmed remove. Its pictures — images and clips, which have a frame to show — are the grid of tiles; its * documents are rows under it, each its badge, its filename and a line of its size and the day it was stored, * since a document is known by its name. Every file has its ⋯ — Open and Download always, Rename, Replace and * Remove where the host passes them. An upload stands in its kind's place, uploading. What can be done to many * files at once is the bar's `verbs`. */ export declare function FilesEditor(props: FilesEditorProps): React.JSX.Element; export interface FileAddButtonProps { onAdd: (files: File[]) => void; /** The picker's filter. */ accept?: string; /** Default the locale's `filesEditor.upload`. */ title?: string; } /** * A SET'S ADD, where a heading the host draws carries it (`FilesEditor`'s `addAt="host"`): the files picked, handed * over. Secondary, as every add in a heading is. */ export declare function FileAddButton({ onAdd, accept, title }: FileAddButtonProps): React.JSX.Element; /** * Each renders nothing where unavailable, so a read-only surface is the same list without handlers. * `spacer` pushes right. */ export type FilesEditorVerb = "upload" | "select" | "select_all" | "spacer" | "download" | "remove"; export interface FilesEditorBarProps extends StyleProps { /** * Left to right. A string is an editor act; an element is a host verb reading * `useFilesEditorSelection()`. */ verbs: readonly (FilesEditorVerb | React.ReactElement)[]; ref?: React.Ref; render?: useRender.RenderProp; } export declare function FilesEditorBar(props: FilesEditorBarProps): React.ReactElement>;