import { type ComponentProps, type RefObject } from 'react'; /** * Unstyled Carbon for IBM Products `TruncatedText`, the behaviour without a single class: `value` in a `Content` cut * to `lines` lines, and whether it is cut (`overflowing`, measured again as the box resizes): show the whole text in * a tooltip then, or add a `Toggle` ("View more / View less", there only while the text is cut or expanded) that * opens the rest, animating the height (`--ui-duration-moderate`, none with reduced motion; the clamp stays off * until a collapse ends). * * `Content` gets `--truncated-text-lines` (the lines, or `none` while expanded) for your clamp, e.g. Tailwind * `line-clamp-(--truncated-text-lines)`. State shows as data attributes to style on: `data-overflowing` and * `data-expanded` on `Root`, `data-expanded` on `Toggle`. * * ```tsx * * * View more * * ``` */ export interface RootProps extends Omit, 'defaultValue'> { /** The text (measured again when it changes). */ value: string; /** Lines shown before the cut; 0 = all. */ lines?: number; /** Controlled: whether the text shows in full. */ expanded?: boolean; defaultExpanded?: boolean; onExpandedChange?: (expanded: boolean) => void; } interface TruncatedTextContextValue { value: string; contentId: string; content: RefObject; /** The clamped text hides something. */ overflowing: boolean; expanded: boolean; /** A collapse is animating (the clamp stays off until it ends). */ closing: boolean; /** The lines to clamp to, as text: `none` while expanded, closing or with `lines` 0. */ clamp: string; /** Expands or collapses. */ toggle: () => void; } /** The state of the enclosing `TruncatedText.Root` (overflowing, expanded …). */ export declare function useTruncatedTextContext(part?: string): TruncatedTextContextValue; /** The box (a `
`): holds the state and measures whether the text is cut as it resizes. */ export declare function Root({ value, lines, expanded: expandedProp, defaultExpanded, onExpandedChange, ref, children, ...rest }: Readonly): import("react").JSX.Element; /** The text (`value`, unless you give children), with `--truncated-text-lines` for the clamp. */ export declare function Content({ ref, style, children, ...rest }: Readonly, 'id'>>): import("react").JSX.Element; /** "View more / View less": there only while the text is cut or expanded; a press opens or closes the rest. */ export declare function Toggle(props: Readonly, 'type'>>): import("react").JSX.Element | null; export {};