{"version":3,"file":"TruncateText.cjs","names":[],"sources":["../../../src/components/TruncateText/TruncateText.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./TruncateText.module.css\";\n\nexport interface TruncateTextProps extends HTMLAttributes<HTMLDivElement> {\n    /** Maximum number of lines to show before clamping. Defaults to 1. */\n    lines?: number;\n    /** Content to clamp. */\n    children: ReactNode;\n}\n\n/**\n * Clamp text to a fixed number of lines using a CSS line-clamp, adding an\n * ellipsis on overflow. The line count is driven by the\n * `--tempest-clamp-lines` custom property.\n *\n * @example\n * <TruncateText lines={2}>{longDescription}</TruncateText>\n */\nexport function TruncateText({\n    lines = 1,\n    className,\n    style,\n    children,\n    ...props\n}: TruncateTextProps) {\n    const mergedStyle = {\n        ...style,\n        \"--tempest-clamp-lines\": lines,\n    } as CSSProperties;\n\n    return (\n        <div className={cn(styles.clamp, className)} style={mergedStyle} {...props}>\n            {children}\n        </div>\n    );\n}\n"],"mappings":"gHAmBA,SAAgB,EAAa,CACzB,QAAQ,EACR,YACA,QACA,WACA,GAAG,GACe,CAClB,IAAM,EAAc,CAChB,GAAG,EACH,wBAAyB,CAC7B,EAEA,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,EAAA,QAAO,MAAO,CAAS,EAAG,MAAO,EAAa,GAAI,EAChE,UACA,CAAA,CAEb"}