{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "text",
  "title": "Text",
  "description": "Body copy on the type scale, in three sizes.",
  "dependencies": [
    "@base-ui/react",
    "@stylexjs/stylex"
  ],
  "registryDependencies": [
    "https://constella.aayush.cv/r/base.json"
  ],
  "files": [
    {
      "path": "src/components/typography/text.tsx",
      "content": "import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport * as stylex from \"@stylexjs/stylex\";\n\nimport type { Sx, TextColor, TextWeight } from \"@/lib/constella/styles\";\nimport {\n  textColorStyles,\n  textWeightStyles,\n  typeStyles,\n} from \"@/lib/constella/styles\";\n\nconst textSizes = [\"sm\", \"base\", \"lg\"] as const;\nconst textTruncates = [1, 2, 3] as const;\n\ntype TextSize = (typeof textSizes)[number];\ntype TextTruncate = (typeof textTruncates)[number];\n\ntype TextProps = Omit<useRender.ComponentProps<\"p\">, \"className\" | \"style\"> & {\n  color?: TextColor;\n  size?: TextSize;\n  sx?: Sx;\n  tabularNums?: boolean;\n  /** Lines to show before an ellipsis; `true` is one. */\n  truncate?: boolean | TextTruncate;\n  weight?: TextWeight;\n};\n\nconst styles = stylex.create({\n  // Inherit, not the user agent's, when rendered as a heading.\n  base: {\n    fontSize: \"inherit\",\n    fontWeight: \"inherit\",\n    lineHeight: \"inherit\",\n    marginBlock: 0,\n    textWrap: \"pretty\",\n  },\n  tabularNums: {\n    fontVariantNumeric: \"tabular-nums\",\n  },\n  // `textWrap`, not `whiteSpace`, so it replaces base's `pretty` instead of racing it.\n  line: {\n    minWidth: 0,\n    overflow: \"hidden\",\n    textOverflow: \"ellipsis\",\n    textWrap: \"nowrap\",\n  },\n  clamp: {\n    display: \"-webkit-box\",\n    minWidth: 0,\n    overflow: \"hidden\",\n    overflowWrap: \"anywhere\",\n    WebkitBoxOrient: \"vertical\",\n  },\n  clamp2: {\n    WebkitLineClamp: 2,\n  },\n  clamp3: {\n    WebkitLineClamp: 3,\n  },\n});\n\nconst sizeStyles = {\n  sm: typeStyles.textSm,\n  base: typeStyles.textBase,\n  lg: typeStyles.textLg,\n} satisfies Record<TextSize, stylex.StyleXStyles>;\n\nconst truncateStyles = {\n  1: styles.line,\n  2: [styles.clamp, styles.clamp2],\n  3: [styles.clamp, styles.clamp3],\n} satisfies Record<TextTruncate, stylex.StyleXStyles>;\n\nfunction Text({\n  color,\n  render,\n  size,\n  sx,\n  tabularNums = false,\n  truncate = false,\n  weight,\n  ...props\n}: TextProps) {\n  const lines = truncate === true ? 1 : truncate;\n\n  return useRender({\n    defaultTagName: \"p\",\n    props: mergeProps<\"p\">(\n      props,\n      stylex.props(\n        styles.base,\n        size && sizeStyles[size],\n        weight && textWeightStyles[weight],\n        color && textColorStyles[color],\n        tabularNums && styles.tabularNums,\n        lines !== false && truncateStyles[lines],\n        sx\n      )\n    ),\n    render,\n    state: { color, size, slot: \"text\", truncate: lines, weight },\n  });\n}\n\nexport { Text, textSizes, textTruncates };\nexport type { TextProps, TextSize, TextTruncate };\n",
      "type": "registry:component"
    }
  ],
  "docs": "Usage: https://constella.aayush.cv/docs/components/text/index.md",
  "type": "registry:ui"
}