import { type PropertyValues } from 'lit'; import type { Placement } from '../../core/position.js'; import type { ExpandedDetail } from '../shared/events.js'; import { UiElement } from '../shared/element.js'; import '../tooltip/tooltip.js'; export type TruncatedTextType = 'tooltip' | 'expand'; declare const UiTruncatedText_base: (new (...args: any[]) => import("../shared/align.ts").AlignAlias) & typeof UiElement; /** * Carbon for IBM Products `TruncatedText` (`c4p-truncated-text`): `value` cut to `lines` lines with an ellipsis. Only * when it doesn't fit: `type="tooltip"` makes it a button that shows the whole text in a tooltip (and is named by it); * `type="expand"` adds a "View more" / "View less" link-coloured toggle under it that opens the rest, animating the * height (110ms, none with reduced motion). The text takes the font of where it sits. * * State on the host for styling: `data-overflowing` while the text doesn't fit its `lines` (kept while expanded). * * @cssstate overflowing - While the text doesn't fit its `lines` (also `[data-overflowing]`) * @fires ui-toggle - detail: { expanded } when the toggle opens or closes the text * @csspart content - The text * @csspart trigger - The button around the text of a truncated `type="tooltip"` * @csspart toggle - The expand / collapse button * @attr align - Carbon's name for `placement` (the tooltip's side) * @cssprop --ui-focus-offset - `outline-offset` of its focus ring (default -2px: inside; Kanok: 2px outside) */ export declare class UiTruncatedText extends UiTruncatedText_base { static hostStates: readonly string[]; static readonly styles: import("lit").CSSResult; /** The text. */ value: string; /** Lines shown before the ellipsis; 0 = all. */ lines: number; /** What a truncated text offers: the whole text in a tooltip, or a toggle that expands it. */ type: TruncatedTextType; /** The tooltip's side. */ placement: Placement; /** The expand toggle's text (default "View more", translated). */ expandLabel: string; /** The collapse toggle's text (default "View less", translated). */ collapseLabel: string; /** Whether an expandable text shows in full. */ expanded: boolean; private overflowing; /** Collapsing: the clamp waits for the height animation, so the text stays visible while it shrinks (Carbon). */ private closing; private readonly content?; private readonly localize; private readonly contentId; private resizeObserver?; private animation?; /** The clamped text's height, the end of the collapse animation. */ private clampedHeight; connectedCallback(): void; disconnectedCallback(): void; protected updated(changed: PropertyValues): void; /** Whether the clamped text hides anything (kept while expanded: the full text no longer tells). */ private measure; private read; /** `measure` for an open text, under a moment's clamp: it started expanded, or its box changed while open. */ private measureOpen; private duration; private toggle; private renderContent; render(): import("lit-html").TemplateResult<1>; } export interface UiTruncatedTextEventMap extends HTMLElementEventMap { 'ui-toggle': CustomEvent; } export interface UiTruncatedText { addEventListener(type: K, listener: (this: UiTruncatedText, event: UiTruncatedTextEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiTruncatedText, event: UiTruncatedTextEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-truncated-text': UiTruncatedText; } } export {};