import type { EventEmitter } from '../../stencil-public-runtime'; import type { FileItemRemoveDetail, FileItemState, FileItemVariant } from './mud-file-item.types'; import type { LocaleProp } from '../../utils/locale'; /** * File Item — single-file row inside `mud-file-input` (or any file list surface). * * Pattern B (atom, internal DOM): renders filename + meta (size / error message) * + state icon + remove button. The remove button is the only interactive * element; the row itself is not focusable so it cannot trap citizens who tab * past a long list. * * @element mud-file-item * * @slot icon - Override the leading file-type icon. Defaults to `attachment`. */ export declare class MudFileItem { /** * Lifecycle state. Drives leading icon color and border treatment. * Matches Figma's 4-state model: `uploaded` (resting), `uploading`, * `success`, `error`. * @default 'uploaded' */ state: FileItemState; /** * Visual variant. `system` renders the Figma "system-files-item" card: a taller * grey card, a blue document glyph and an info row (`issued-label` `issued-on` • `issuer`) * in place of the size meta. Use it for documents issued by a registry rather than uploaded. * @default 'default' */ variant: FileItemVariant; /** * System variant: render as a selectable list option (Figma "system-files-item-selectable") — * white bordered row, no remove button. The owner handles click / keyboard and sets `selected`. * @default false */ selectable: boolean; /** * Selectable rows: marks the chosen option with the brand border. * @default false */ selected: boolean; /** * Upload variant: progress of an uploading row, 0–100. Left unset, the bar is indeterminate. Ignored in * other states and variants. */ progress?: number; /** System variant: label before the issue date (already localised, e.g. "Emis"). */ issuedLabel?: string; /** System variant: issue date, pre-formatted by the host (e.g. "12.03.2026"). */ issuedOn?: string; /** System variant: issuing authority (e.g. "EVO"). */ issuer?: string; /** * Visible filename. * @default '' */ filename: string; /** Optional file size in bytes — rendered as a human-readable string. */ size?: number; /** * Per-item error message. Replaces the size meta line when `state="error"`. */ errorText?: string; /** * Optional image-preview URL (object URL or data URI). When set, a thumbnail * renders in place of the leading file-type icon (the Figma "image-preview" * variation). Falls back to the icon if the image fails to load. */ previewSrc?: string; /** * Disables the remove button. * @default false */ disabled: boolean; /** * Hide the remove button entirely (e.g. read-only summary lists). * @default false */ noRemove: boolean; /** * Language of the built-in copy. Unset, the component follows the closest ancestor `lang` * (`` included), else `ro-MD`. */ locale?: LocaleProp; /** * Accessible label for the remove button. Overrides the `locale`'s copy when set to a * non-empty string. * @default 'Elimină fișierul' (ro-MD) */ removeLabel?: string; /** * Text announced to assistive technology when the row starts uploading (the state is otherwise only a spinner). * Overrides the `locale`'s copy when set to a non-empty string. * @default 'Se încarcă' (ro-MD) */ uploadingLabel?: string; /** * Text announced when an upload finishes (`success`, or `uploaded` right after `uploading`). * Overrides the `locale`'s copy when set to a non-empty string. * @default 'Încărcat cu succes' (ro-MD) */ successLabel?: string; /** * Text announced when the row turns to `error` and has no `error-text` of its own (with one, the message itself * is announced as an alert). Overrides the `locale`'s copy when set to a non-empty string. * @default 'Eroare la încărcare' (ro-MD) */ errorLabel?: string; private previewFailed; /** What the live region says now: the filename and the new state, set when the state changes. */ private announcement; /** True when the filename is visually clipped, which gates the hover tooltip. */ private isTruncated; host: HTMLMudFileItemElement; /** Fires when the citizen presses the remove control. The host is responsible for splicing the file out of its list. */ mudRemove: EventEmitter; private filenameEl?; private resizeObserver?; private stopLang?; connectedCallback(): void; componentWillLoad(): void; componentDidLoad(): void; componentDidUpdate(): void; disconnectedCallback(): void; /** Built-in strings in the resolved locale, with the override props on top. */ private messages; /** Compare rendered vs content width to know if the name is clipped (tooltip-worthy). */ private measureTruncation; validateState(next: FileItemState): void; /** * The state is drawn as an icon only, so a change of it is also said in a live region: the filename and what * happened. Nothing is announced for the resting row, or for an error that carries its own `error-text` (that is * an alert of its own). */ announceState(next: FileItemState, prev: FileItemState | undefined): void; resetPreviewFailure(): void; /** Hands the clamped progress to the bar through a custom property (no inline style in the template). */ syncProgress(): void; private handlePreviewError; private handleRemove; private handleRemoveKey; private formatSize; render(): any; }