import type { HTMLAttributes, LabelHTMLAttributes } from 'react'; import { cva, type VariantProps } from 'class-variance-authority'; import { cn } from '~/lib/utils'; const textVariants = cva('', { variants: { variant: { // Login showcase headline: 32 → 36 → 44 as the panel widens hero: 'text-3xl font-semibold leading-[1.02] tracking-[-0.035em] text-balance text-text-primary split:text-4xl wide:text-5xl', headline: 'text-2xl font-semibold tracking-[-0.03em] text-text-primary sm:text-3xl', display: 'text-display font-semibold tracking-[-0.02em] text-text-primary', title: 'text-lg font-semibold text-text-primary', heading: 'text-base font-semibold text-text-primary', subheading: 'text-md font-semibold tracking-[-0.01em] text-text-primary', lead: 'text-md leading-[1.55] text-pretty text-text-secondary', 'body-lg': 'text-base leading-normal text-text-secondary', body: 'text-sm text-text-secondary', 'body-strong': 'text-sm font-semibold text-text-primary', label: 'text-sm font-medium text-text-primary', caption: 'text-xs text-text-muted', 'caption-strong': 'text-xs font-semibold text-text-emphasis', meta: 'text-2xs text-text-muted', eyebrow: 'eyebrow', mono: 'font-mono text-xs text-text-secondary', stamp: 'font-mono text-3xs uppercase tracking-[0.06em] text-text-muted', kicker: 'font-mono text-2xs uppercase tracking-[0.12em] text-primary', // No typography of its own: text inside a primitive that already sets it (e.g. a button label) inherit: '', }, tone: { default: '', emphasis: 'text-text-emphasis', secondary: 'text-text-secondary', subtle: 'text-text-subtle', muted: 'text-text-muted', faint: 'text-text-faint', placeholder: 'text-text-placeholder', primary: 'text-primary', danger: 'text-danger', warning: 'text-warning', note: 'text-note-text', ink: 'text-ink', viewer: 'text-viewer-caption', inherit: 'text-inherit', }, truncate: { true: 'truncate', false: '' }, numeric: { true: 'tabular-nums', false: '' }, }, defaultVariants: { variant: 'body', tone: 'default', truncate: false, numeric: false }, }); type TextElement = 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'label' | 'dt' | 'dd'; export type TextProps = HTMLAttributes & Pick, 'htmlFor'> & VariantProps & { as?: TextElement }; export function Text({ as: Element = 'p', variant, tone, truncate, numeric, className, ...props }: TextProps) { return ; }