{"version":3,"file":"Typography.cjs","sources":["../../../../src/components/foundation/typography/Typography.tsx"],"sourcesContent":["import { TYPOGRAPHY_STYLES } from '@components/foundation/typography/styles/Typography.css.ts'\r\nimport { TYPOGRAPHY_ELEMENT_MAP } from '@components/foundation/typography/constants'\r\nimport type { TypographyProps } from '@components/foundation/typography/types/Typography.props.ts'\r\nimport type { TypographyVariant } from '@components/foundation/typography/types/Typography.types.ts'\r\nimport { cn } from '@utils/cn.ts'\r\nimport { vars } from '@theme/contract.css.ts'\r\nimport { memo, type CSSProperties, type FC } from 'react'\r\n\r\nconst isTypographyVariant = (value: string): value is TypographyVariant =>\r\n    Object.prototype.hasOwnProperty.call(TYPOGRAPHY_ELEMENT_MAP, value)\r\n\r\n/**\r\n * Renders text with the library's semantic element, typography scale, and theme tokens.\r\n *\r\n * The rendered element defaults to the element associated with `variant` and can\r\n * be overridden with `as` when a different HTML semantic is required. When\r\n * `variant` is omitted, a known typography element passed to `as` also selects\r\n * its matching visual variant.\r\n *\r\n * @example\r\n * ```tsx\r\n * <Typography variant=\"h1\" fontSize=\"4xl\" fontWeight=\"bold\">\r\n *   Welcome\r\n * </Typography>\r\n * ```\r\n */\r\nconst Typography: FC<TypographyProps> = memo(({\r\n    as,\r\n    variant,\r\n    fontSize,\r\n    fontWeight,\r\n    color,\r\n    textTransform,\r\n    display,\r\n    margin,\r\n    width,\r\n    minWidth,\r\n    maxWidth,\r\n    opacity,\r\n    flex,\r\n    flexGrow,\r\n    flexShrink,\r\n    letterSpacing,\r\n    ellipsis,\r\n    maxLines,\r\n    className,\r\n    style,\r\n    ref,\r\n    ...props\r\n}) => {\r\n    const inferredVariant = typeof as === 'string' && isTypographyVariant(as) ? as : undefined\r\n    const resolvedVariant = variant ?? inferredVariant ?? 'span'\r\n    const Element = as ?? TYPOGRAPHY_ELEMENT_MAP[resolvedVariant]\r\n\r\n    const computedStyle: CSSProperties = {\r\n        textTransform,\r\n        display,\r\n        width,\r\n        minWidth,\r\n        maxWidth,\r\n        opacity,\r\n        flex,\r\n        flexGrow,\r\n        flexShrink,\r\n        letterSpacing: letterSpacing ? vars.letterSpacing[letterSpacing] : undefined,\r\n        ...style,\r\n    }\r\n\r\n    return (\r\n        <Element\r\n            ref={ref}\r\n            className={cn(TYPOGRAPHY_STYLES.recipe({ variant: resolvedVariant, fontSize, fontWeight, margin, ellipsis, maxLines, color }), className)}\r\n            style={computedStyle}\r\n            {...props}\r\n        />\r\n    )\r\n})\r\n\r\nTypography.displayName = 'Typography'\r\n\r\nexport default Typography\r\n"],"names":["isTypographyVariant","value","TYPOGRAPHY_ELEMENT_MAP","Typography","memo","as","variant","fontSize","fontWeight","color","textTransform","display","margin","width","minWidth","maxWidth","opacity","flex","flexGrow","flexShrink","letterSpacing","ellipsis","maxLines","className","style","ref","props","inferredVariant","resolvedVariant","Element","computedStyle","vars","jsx","cn","TYPOGRAPHY_STYLES"],"mappings":"iOAQMA,EAAuBC,GACzB,OAAO,UAAU,eAAe,KAAKC,EAAAA,uBAAwBD,CAAK,EAiBhEE,EAAkCC,EAAAA,KAAK,CAAC,CAC1C,GAAAC,EACA,QAAAC,EACA,SAAAC,EACA,WAAAC,EACA,MAAAC,EACA,cAAAC,EACA,QAAAC,EACA,OAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,KAAAC,EACA,SAAAC,EACA,WAAAC,EACA,cAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,IAAAC,EACA,GAAGC,CACP,IAAM,CACF,MAAMC,EAAkB,OAAOtB,GAAO,UAAYL,EAAoBK,CAAE,EAAIA,EAAK,OAC3EuB,EAAkBtB,GAAWqB,GAAmB,OAChDE,EAAUxB,GAAMH,EAAAA,uBAAuB0B,CAAe,EAEtDE,EAA+B,CACjC,cAAApB,EACA,QAAAC,EACA,MAAAE,EACA,SAAAC,EACA,SAAAC,EACA,QAAAC,EACA,KAAAC,EACA,SAAAC,EACA,WAAAC,EACA,cAAeC,EAAgBW,EAAAA,KAAK,cAAcX,CAAa,EAAI,OACnE,GAAGI,CAAA,EAGP,OACIQ,EAAAA,IAACH,EAAA,CACG,IAAAJ,EACA,UAAWQ,EAAAA,GAAGC,EAAAA,kBAAkB,OAAO,CAAE,QAASN,EAAiB,SAAArB,EAAU,WAAAC,EAAY,OAAAI,EAAQ,SAAAS,EAAU,SAAAC,EAAU,MAAAb,CAAA,CAAO,EAAGc,CAAS,EACxI,MAAOO,EACN,GAAGJ,CAAA,CAAA,CAGhB,CAAC,EAEDvB,EAAW,YAAc"}