{ "name": "typography", "displayName": "Typography", "type": "component", "files": [ { "name": "Typography.tsx", "content": "import {\n forwardRef,\n type CSSProperties,\n type ElementType,\n type ReactNode,\n} from 'react';\nimport { cn, vc } from '../../utils/cn';\nimport styles from './Typography.module.css';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'body1'\n | 'body2'\n | 'caption'\n | 'overline';\n\nexport type TypographyWeight = 'normal' | 'medium' | 'semibold' | 'bold';\nexport type TypographyAlign = 'left' | 'center' | 'right';\n\nconst variantToElement: Record = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n h6: 'h6',\n body1: 'p',\n body2: 'p',\n caption: 'span',\n overline: 'span',\n};\n\nexport interface TypographyProps {\n variant?: TypographyVariant;\n as?: ElementType;\n color?: string;\n align?: TypographyAlign;\n weight?: TypographyWeight;\n truncate?: boolean;\n maxLines?: number;\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-testid'?: string;\n}\n\nexport const Typography = forwardRef(\n function Typography(\n {\n variant = 'body1',\n as,\n color,\n align,\n weight,\n truncate,\n maxLines,\n className,\n style,\n children,\n 'data-testid': dataTestId = 'tatva-typography',\n },\n ref,\n ) {\n const Component = (as ?? variantToElement[variant]) as ElementType;\n const combinedStyle: CSSProperties = {\n ...(color\n ? { color: color.startsWith('--') ? `var(${color})` : color }\n : {}),\n ...(align ? { textAlign: align } : {}),\n ...(maxLines\n ? {\n display: '-webkit-box',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: maxLines,\n overflow: 'hidden',\n }\n : {}),\n ...style,\n };\n return (\n \n {children}\n \n );\n },\n);\n" }, { "name": "Typography.module.css", "content": ".base {\n font-family: var(--tatva-font-family);\n color: var(--tatva-color-fg);\n margin: 0;\n}\n\n.variantH1 {\n font-size: var(--tatva-font-size-4xl);\n font-weight: var(--tatva-font-weight-bold);\n line-height: var(--tatva-line-height-tight);\n letter-spacing: -0.02em;\n}\n.variantH2 {\n font-size: var(--tatva-font-size-3xl);\n font-weight: var(--tatva-font-weight-bold);\n line-height: var(--tatva-line-height-tight);\n letter-spacing: -0.01em;\n}\n.variantH3 {\n font-size: var(--tatva-font-size-2xl);\n font-weight: var(--tatva-font-weight-semibold);\n line-height: var(--tatva-line-height-tight);\n}\n.variantH4 {\n font-size: var(--tatva-font-size-xl);\n font-weight: var(--tatva-font-weight-semibold);\n line-height: var(--tatva-line-height-tight);\n}\n.variantH5 {\n font-size: var(--tatva-font-size-lg);\n font-weight: var(--tatva-font-weight-semibold);\n line-height: var(--tatva-line-height-normal);\n}\n.variantH6 {\n font-size: var(--tatva-font-size-md);\n font-weight: var(--tatva-font-weight-semibold);\n line-height: var(--tatva-line-height-normal);\n}\n.variantBody1 {\n font-size: var(--tatva-font-size-md);\n line-height: var(--tatva-line-height-normal);\n}\n.variantBody2 {\n font-size: var(--tatva-font-size-sm);\n line-height: var(--tatva-line-height-normal);\n}\n.variantCaption {\n font-size: var(--tatva-font-size-xs);\n color: var(--tatva-color-fg-muted);\n line-height: var(--tatva-line-height-normal);\n}\n.variantOverline {\n font-size: var(--tatva-font-size-xs);\n text-transform: uppercase;\n letter-spacing: 0.1em;\n color: var(--tatva-color-fg-muted);\n}\n\n.weightNormal {\n font-weight: var(--tatva-font-weight-normal);\n}\n.weightMedium {\n font-weight: var(--tatva-font-weight-medium);\n}\n.weightSemibold {\n font-weight: var(--tatva-font-weight-semibold);\n}\n.weightBold {\n font-weight: var(--tatva-font-weight-bold);\n}\n\n.truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n min-width: 0;\n}\n" }, { "name": "index.ts", "content": "export { Typography } from './Typography';\nexport type {\n TypographyProps,\n TypographyVariant,\n TypographyWeight,\n TypographyAlign,\n} from './Typography';\n" } ], "registryDependencies": [], "dependencies": [], "devDependencies": [] }