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MAAA,EAAO,GAAIA,eAAA,EAAS;AAC5B,EAAA,MAAM,IAAA,GAAO,QAAQ,IAAI,CAAA;AACzB,EAAA,MAAM,QAAA,GAA0B;AAAA,IAC9B,UAAU,IAAA,CAAK,IAAA;AAAA,IACf,UAAA,EAAY,CAAA,EAAG,IAAA,CAAK,UAAU,CAAA,EAAA,CAAA;AAAA,IAC9B,UAAA,EAAY,UAAU,MAAM,CAAA;AAAA,IAC5B,KAAA,EAAO,YAAA,CAAa,KAAA,EAAO,MAAM,CAAA;AAAA,IACjC,WAAW,KAAA,IAAS,MAAA;AAAA,IACpB,GAAI,QAAA,GACA,EAAE,UAAA,EAAY,QAAA,EAAU,QAAA,EAAU,QAAA,EAAU,YAAA,EAAc,UAAA,EAAY,OAAA,EAAS,OAAA,EAAQ,GACvF,IAAA;AAAA,IACJ,GAAG;AAAA,GACL;AACA,EAAA,uBACEC,cAAA,CAAC,aAAU,GAAA,EAAU,SAAA,EAAsB,OAAO,QAAA,EAAW,GAAG,MAC7D,QAAA,EACH,CAAA;AAEJ;AAEO,IAAM,IAAA,GAAOC,iBAAW,QAAQ","file":"text.cjs","sourcesContent":["/**\n * Text (web).\n *\n * Sized via a small scale: xs / sm / md / lg / xl. Weight via the\n * same enum we use on RN. Color resolves the same way Icon does --\n * theme token name (autocomplete) or a raw color.\n */\nimport { forwardRef, type ElementType, type ForwardedRef, type CSSProperties } from \"react\";\nimport { useTheme } from \"@plyxui/styles\";\nimport type { OmniColorTokens, PolymorphicComponentPropsWithRef } from \"@plyxui/core\";\n\ntype ThemeColorKey = keyof OmniColorTokens;\n\nexport type TextSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\nexport type TextWeight = \"regular\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TextAlign = \"start\" | \"center\" | \"end\";\n\nconst sizeMap: Record<TextSize, { size: number; lineHeight: number }> = {\n  xs:   { size: 11, lineHeight: 16 },\n  sm:   { size: 13, lineHeight: 18 },\n  md:   { size: 15, lineHeight: 22 },\n  lg:   { size: 18, lineHeight: 26 },\n  xl:   { size: 22, lineHeight: 30 },\n  \"2xl\":{ size: 28, lineHeight: 36 },\n  \"3xl\":{ size: 36, lineHeight: 44 },\n};\n\nconst weightMap: Record<TextWeight, number> = {\n  regular: 400,\n  medium: 500,\n  semibold: 600,\n  bold: 700,\n};\n\ntype TextOwnProps = {\n  size?: TextSize;\n  weight?: TextWeight;\n  color?: ThemeColorKey | (string & {});\n  align?: TextAlign;\n  truncate?: boolean;\n  className?: string;\n  style?: CSSProperties;\n};\n\nexport type TextProps<C extends ElementType = \"span\"> = PolymorphicComponentPropsWithRef<\n  C,\n  TextOwnProps\n>;\n\nfunction resolveColor(\n  color: TextProps[\"color\"],\n  themeColors: Record<keyof OmniColorTokens, string>,\n): string {\n  if (!color) return themeColors.text;\n  if ((themeColors as Record<string, string>)[color as string] != null) {\n    return (themeColors as Record<string, string>)[color as string]!;\n  }\n  return color as string;\n}\n\nfunction TextImpl<C extends ElementType = \"span\">(\n  { as, size = \"md\", weight = \"regular\", color, align, truncate, className, style, children, ...rest }: TextProps<C>,\n  ref: ForwardedRef<Element>,\n) {\n  const Component = (as ?? \"span\") as ElementType;\n  const { colors } = useTheme();\n  const dims = sizeMap[size];\n  const computed: CSSProperties = {\n    fontSize: dims.size,\n    lineHeight: `${dims.lineHeight}px`,\n    fontWeight: weightMap[weight],\n    color: resolveColor(color, colors),\n    textAlign: align ?? undefined,\n    ...(truncate\n      ? { whiteSpace: \"nowrap\", overflow: \"hidden\", textOverflow: \"ellipsis\", display: \"block\" }\n      : null),\n    ...style,\n  };\n  return (\n    <Component ref={ref} className={className} style={computed} {...rest}>\n      {children}\n    </Component>\n  );\n}\n\nexport const Text = forwardRef(TextImpl) as <C extends ElementType = \"span\">(\n  props: TextProps<C>,\n) => React.ReactElement | null;\n"]}