import{type PropertyValues,type PropertyDeclaration,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';export{FILE_SIZE_UNIT_KEYS,formatFileSize}from'./file-size.js';export type LyraAttachmentUploadStatus='pending'|'uploading'|'error'|'success';export interface LyraAttachmentIdDetail{attachmentId:string;}export interface LyraAttachmentPreviewRequestDetail extends LyraAttachmentIdDetail{name:string;mimeType:string;src:string;}export interface LyraAttachmentChipEventMap{'lr-remove':CustomEvent;'lr-retry':CustomEvent;'lr-preview-request':CustomEvent;} /** * `` — a compact chip representing one file queued for * (or already part of) a chat message: a composer's pre-send attachment * tray, or a sent message's `attachments` slot (see ``). * * Two independent ways to populate it, matching the two points in a message's * lifecycle this is used at: * - Set `file` to a real `File` (fresh from a picker/drop) — `name`, `bytes`, * `mime-type` and the image thumbnail are all auto-derived from it. * - Set the plain `name`/`bytes`/`mime-type`/`thumbnail-src` props instead, * for reconstructing a chip from server-persisted attachment metadata * (e.g. after a page reload, when no real `File` object exists any more). * * `file` always wins when both are present — see each accessor's own doc. * The image thumbnail for a real `File` is a cached `URL.createObjectURL()` * blob URL, created in the update lifecycle immediately before the thumbnail * renders and revoked automatically once `file` * changes away from the object it was created for, and on disconnect — this * component never leaks a blob URL. * * Identifying *which* attachment a `lr-remove`/`lr-retry`/`lr-preview-request` event is about: * set `attachment-id="..."` when you have a stable server-side attachment identity. The platform * `id` remains available exclusively for DOM identity and idrefs. When `attachmentId` is unset and * `file` is set, a stable attachment identity is * derived from `` `${file.name}:${file.size}:${file.lastModified}` `` — stable * across re-renders of the *same* `File` object without requiring the * consumer to invent one. When neither is available, a generated internal id * is used as a last resort so the event always has *some* id. * * i18n/locale: complete contextual messages (including filename/percentage * placement and punctuation) route through the shared localization registry. * `removeLabel`/`retryLabel`/`uploadingLabel`/`uploadFailedLabel` remain as * simple per-instance copy overrides; use the component's `.strings` map or a * registered locale when a translation needs to reorder the interpolated * values. These are plain properties, not slots — this component still * exposes no slots. * * @customElement lr-attachment-chip * @event lr-remove - The user activated the remove (×) button. `detail: { attachmentId }`. Only rendered while `removable`. * @event lr-retry - The user activated the retry button. `detail: { attachmentId }`. Only rendered while `status="error"`. * @event lr-preview-request - Notification that the preview action was activated. `detail: { attachmentId, name, mimeType, src }`. Not cancelable: the chip never registers or owns a viewer/overlay, so there is nothing local to gate behind `.preventDefault()`; consumers compose the desired preview surface entirely on their own. * @csspart base - The chip's root container. * @csspart thumbnail - The leading image thumbnail / generic file glyph. * @csspart meta - Wrapper around the filename and the formatted file size. * @csspart name - The filename (ellipsis-truncated via CSS; the untruncated name is always available via the native `title` tooltip). * @csspart size - The human-readable formatted file size, from `bytes` (or the `file`'s own byte * count). Hidden when no size is known. * @csspart status-text - The visible text twin of the status accent color — carries uploading/error state in text. Empty/hidden for `pending`/`success`; forced-colors mode retains distinct border patterns for every state. Plain visible text, so it reads normally once a user reaches the chip; the interrupting announcement that a transition *into* `status="error"` makes goes through the shared light-DOM assertive region. * @csspart progress - The numeric upload progress bar (`role="progressbar"`), shown only while `status="uploading"` and `progress` is a meaningful (>0) number. * @csspart progress-fill - The filled portion of `progress`. * @csspart spinner - Decorative (`aria-hidden`) indeterminate upload spinner, shown instead of * `progress` while `status="uploading"` and `progress` is unset/0; the adjacent status text * carries the visible wording, and upload ticks never enter a live region. * @csspart retry-button - The retry affordance, only rendered while `status="error"`. * @csspart preview-button - The preview affordance, rendered when a file or `preview-src` is available. * @csspart remove-button - The remove (×) affordance, only rendered while `removable`. * @cssprop [--lr-attachment-chip-spinner-duration=var(--lr-transition-ambient)] - Duration and * easing of one indeterminate upload-spinner rotation. The ambient loop stops under reduced motion. * @cssprop [--lr-attachment-chip-accent=var(--lr-color-text-quiet)] - Accent color used for the * status text, spinner, and progress fill. Its private default changes per `status` * (`uploading`/`error`/`success`); the public value remains authoritative. * @cssprop [--lr-attachment-chip-bg=var(--lr-color-surface)] - Chip background. Its private * default changes per `status` to that status's `-quiet` tint; the public value still wins. * @cssprop [--lr-attachment-chip-border=var(--lr-color-border)] - Chip border color. Every * non-`pending` `status` changes its private default to `transparent`. * @cssprop [--lr-attachment-chip-compact-thumbnail-size=var(--lr-size-1-75rem)] - Thumbnail size * while `compact`, rethemeable independently of `--lr-icon-button-size`. Retry, preview, and * remove actions retain that shared token's minimum hit-area floor. * @cssprop [--lr-attachment-chip-compact-font-size=var(--lr-font-size-xs)] - Font size of * `[part="base"]` while `compact`. * @cssprop [--lr-attachment-chip-compact-gap=var(--lr-size-0-25rem)] - Gap between the chip's parts * while `compact`. * @cssprop [--lr-attachment-chip-padding=var(--lr-space-xs) var(--lr-space-s)] - Padding of * `[part="base"]` while `compact` is unset. * @cssprop [--lr-attachment-chip-compact-padding=var(--lr-size-0-125rem) var(--lr-space-xs)] - * Padding of `[part="base"]` while `compact`. * @cssprop [--lr-attachment-chip-compact-thumbnail-only-padding=var(--lr-size-0-125rem)] - Padding * of `[part="base"]` while `compact` and `thumbnail-only` together actually hide `[part="meta"]` * (an image-mime attachment only — see `thumbnailOnly`). Reduced from * `--lr-attachment-chip-compact-padding` since the lone thumbnail no longer needs inline padding * sized for a text row. * @status stable * @since 4.0.0 */ export declare class LyraAttachmentChip extends LyraElement{static styles:import("lit").CSSResultGroup[]; /** A real `File`, e.g. fresh from ``'s `lr-files` event. * When set, `name`/`bytes`/`mime-type`/the image thumbnail are all derived * from it, taking precedence over the independent props below. */ file?:File; /** Filename, used only while `file` is unset. */ name:string; /** File size as a raw byte count, used only while `file` is unset. Named for what it holds * rather than `size`, which everywhere else in this library names a size *tier* * (`small`/`medium`/`large`, `xs`...`xl`). `0` is a known empty file and renders `0 B`; only * omission means unknown. Non-finite/negative inputs are treated as unknown. */ private _bytes?;get bytes():number|undefined;set bytes(value:number|undefined); /** Stable domain identity carried by attachment action events. */ /** Stable action identity. Empty or whitespace-only values use the documented fallback. */ attachmentId:string; /** MIME type, used only while `file` is unset. */ mimeType:string; /** Thumbnail image URL, used only while `file` is unset (a real `File`'s * thumbnail always comes from a generated object URL instead — see the * class doc). Unlike the other independent props this one has no * `file`-derived equivalent to defer to for a non-image file; it's simply * rendered whenever present. */ thumbnailSrc:string; /** URL used to preview or download the attachment when `file` is unset. * A real `File` takes precedence and is previewed through a temporary blob URL. */ previewSrc:string; /** Shows the preview action when a `file` or `preview-src` is available. */ previewable:boolean; /** Lifecycle state — drives the accent tint and which of `progress`/`spinner`/`retry-button` renders. * Failures already present on reconnect render silently; new connected failures announce once. */ status:LyraAttachmentUploadStatus; /** Upload completion, 0-100. Only meaningful while `status="uploading"`; * a value of 0 (the default), `NaN`, or negative falls back to the indeterminate spinner * (see `hasNumericProgress`); an oversized value clamps to 100 (see `clampedProgress`). */ progress:number; /** Shows the remove (×) button. */ removable:boolean; /** Renders a smaller, borderless pill presentation instead of the default bordered/chrome-heavy * chip -- for a consumer that wants an icon-only-adjacent, compact attachment affordance (e.g. * a composer's pending-attachment tray) without hand-tuning several `::part()` custom * properties individually. `false` (the default) is visually identical to today. */ compact:boolean; /** When both this and `compact` are set, hides `[part=meta]` (the filename/size text) entirely * for an image-mime attachment, leaving only the thumbnail -- for a consumer wanting a * thumbnail-only density purely through props, with no consumer-side CSS. Has no effect for a * non-image chip (there is no thumbnail to fall back to showing on its own) or when `compact` is * unset. `false` (the default) reproduces today's exact output. */ thumbnailOnly:boolean; /** Verb used in the remove button's accessible name. For complete control over translated * word order and punctuation, override the `removeWithContext` message instead. */ removeLabel?:string; /** Verb used in the retry button's accessible name. For complete control over translated word * order and punctuation, override the `attachmentRetryWithContext` message instead. */ retryLabel?:string; /** Verb used in uploading messages. For complete control over translated word order and * punctuation, override the `attachmentUploadingWithContext`, * `attachmentUploadingProgress`, and `attachmentUploadingIndeterminate` messages instead. */ uploadingLabel?:string; /** Visible status text shown for `status="error"`. Override for * i18n/locale. Defaults to `'Upload failed'`, reproducing today's exact * text byte-for-byte. */ uploadFailedLabel?:string; /** Override for the empty-name fallback shown (and used as the `title` tooltip) when neither * `file` nor `name` supply a filename -- for i18n/locale. Defaults to `'Untitled file'`, * reproducing today's exact hardcoded text byte-for-byte. */ untitledLabel?:string;private objectUrl?;private objectUrlFile?; /** Handle on the shared light-DOM assertive region an upload failure announces through -- a * region rendered inside this shadow root is not reliably announced (JAWS with Firefox ignores * one outright), so `[part="status-text"]` is plain visible text and carries no live role. */ private sink?;private readonly fallbackId;private get effectiveName();private get effectiveSize();private get effectiveMimeType();private get effectivePreviewSrc();private get resolvedId();private get hasNumericProgress();private get clampedProgress();private get effectiveStatus(); /** Returns (creating or reusing as needed) the object URL for `file`'s * image thumbnail. Called from the update lifecycle, never from `render()`, * so rendering stays a pure projection of already-prepared state. */ private ensureObjectUrl;private revokeObjectUrl;private connectedStatusTransition;requestUpdate(name?:PropertyKey,oldValue?:unknown,options?:PropertyDeclaration):void;connectedCallback():void;adoptedCallback():void;private syncAnnouncementSink;private releaseAnnouncementSink;protected willUpdate(changed:PropertyValues):void;disconnectedCallback():void; /** The localized upload-failure message. Same override-wins-verbatim rule as `untitledLabel`; * read both by `render()` and by the failure announcement in `willUpdate()`. */ private get localizedUploadFailedLabel();private onRemoveClick;private onRetryClick;private onPreviewClick;private renderThumbnail;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-attachment-chip':LyraAttachmentChip;}}