import { SvelteComponentTyped } from "svelte"; import type { HTMLAttributes } from "svelte/elements"; type $RestProps = HTMLAttributes; type $Props = { /** * Specify `"end"` or `"front"`. `"front"` only works when `lines` is `1`. * @default "end" */ clamp?: "end" | "front"; /** * Number of visible lines before truncating. Values above `1` use multiline mode (end clamp only). * @default 1 */ lines?: number; /** * Specify the tag name. * @default "p" */ tag?: keyof HTMLElementTagNameMap; /** * Specify how to reveal clipped text. * `"tooltip"` shows the full text in a tooltip on hover and focus, and makes the text focusable while it is clipped. * `"expand"` adds a button that removes the clamp. * `"none"` only clips. * @default "none" */ reveal?: "none" | "tooltip" | "expand"; /** * Set to `true` to show the full text. * Only applies when `reveal` is `"expand"`. * @default false */ expanded?: boolean; /** * Specify the label of the button that shows the full text. * Only applies when `reveal` is `"expand"`. * @default "View more" */ expandLabel?: string; /** * Specify the label of the button that clamps the text again. * Only applies when `reveal` is `"expand"`. * @default "View less" */ collapseLabel?: string; /** * Set the tooltip placement in floating-ui form: the side, then `start` * or `end` along it, as Popover's `align` takes. Above and below, * `start` and `end` name inline sides, so they swap under `dir="rtl"`. * When set, takes precedence over `tooltipPosition` and `tooltipAlignment`. */ tooltipAlign?: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end" | undefined; /** * Set the position of the tooltip relative to the text. * Only applies when `reveal` is `"tooltip"`. * @deprecated use `tooltipAlign` * @default "top" */ tooltipPosition?: "top" | "right" | "bottom" | "left"; /** * Set the alignment of the tooltip relative to the text. * Only applies when `reveal` is `"tooltip"`. * @deprecated use `tooltipAlign` * @default "center" */ tooltipAlignment?: "start" | "center" | "end"; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type TruncateProps = Omit<$RestProps, keyof $Props> & $Props; export default class Truncate extends SvelteComponentTyped< TruncateProps, Record, { default: Record } > {}