import { PolymorphicComponentProps, getProp } from '@kalink-ui/dibbly'; import { ElementType } from 'react'; import { TypographySize, TypographyVariant, buildTypographyOverrides, getResponsiveBase, typography, type Responsive, } from '../../styles'; import { TextVariants, textEllipsisWrapper } from './text.css'; import { textResponsive } from './text.responsive'; export type TextProps = PolymorphicComponentProps & Omit & { /** * The size of the typography used to render the text. */ size?: Responsive; /** * The typography variant used to render the text. */ variant?: Responsive; align?: Responsive>; wrap?: Responsive>; lineClamp?: Responsive>; }; export function Text(props: TextProps) { const { children, className, truncate, lineClamp, size, use: Comp = 'span', variant, wrap, align, ...rest } = props; const typographyOverrides = buildTypographyOverrides({ variant, size }); const baseVariant = getResponsiveBase(variant) ?? 'body'; const baseSize = getResponsiveBase(size) ?? 'medium'; return ( {truncate ? ( {children} ) : ( children )} ); }