{
  "$schema": "https://pdfx.akashpise.dev/schema/registry-item.json",
  "name": "text",
  "type": "registry:ui",
  "title": "Text",
  "description": "PDF text component for paragraphs",
  "files": [
    {
      "path": "components/pdfx/text/pdfx-text.tsx",
      "content": "import { Text as PDFText, StyleSheet } from '@react-pdf/renderer';\nimport type { Style } from '@react-pdf/types';\nimport { usePdfxTheme, useSafeMemo } from '../lib/pdfx-theme-context';\nimport type React from 'react';\ntype PdfxTheme = ReturnType<typeof usePdfxTheme>;\n\nexport type TextVariant = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl';\nexport type TextWeight = 'normal' | 'medium' | 'semibold' | 'bold';\nexport type TextDecoration = 'underline' | 'line-through' | 'none';\n\n/**\n * Body text with typography scale, alignment, and decoration options.\n * Props - `variant` | `align` | `color` | `weight` | `italic` | `decoration` | `transform` | `noMargin` | `children` | `style`\n * @see {@link TextProps}\n */\nexport interface TextProps {\n  /** Custom styles to merge with component defaults */\n  style?: Style;\n  /** Content to render */\n  children: React.ReactNode;\n  /**\n   * @default 'base'\n   */\n  variant?: TextVariant;\n  /**\n   * @default 'left'\n   */\n  align?: 'left' | 'center' | 'right' | 'justify';\n  color?: string;\n  /**\n   * @default 'normal'\n   */\n  weight?: TextWeight;\n  /**\n   * @default false\n   */\n  italic?: boolean;\n  /**\n   * @default 'none'\n   */\n  decoration?: TextDecoration;\n  transform?: 'uppercase' | 'lowercase' | 'capitalize';\n  /**\n   * @default false\n   */\n  noMargin?: boolean;\n}\n\nconst THEME_COLOR_KEYS = ['foreground','muted','mutedForeground','primary','primaryForeground','accent','destructive','success','warning','info'] as const;\nfunction resolveColor(value: string, colors: Record<string, string>): string {\n  return THEME_COLOR_KEYS.includes(value as (typeof THEME_COLOR_KEYS)[number]) ? colors[value] : value;\n}\nfunction createTextStyles(t: PdfxTheme) {\n  const { fontWeights, letterSpacing } = t.primitives;\n  const base = {\n    fontFamily: t.typography.body.fontFamily,\n    lineHeight: t.typography.body.lineHeight,\n    color: t.colors.foreground,\n    marginBottom: t.spacing.paragraphGap,\n    marginTop: 0,\n  };\n  return StyleSheet.create({\n    text: { ...base, fontSize: t.typography.body.fontSize },\n    xs: { ...base, fontSize: t.primitives.typography.xs },\n    sm: { ...base, fontSize: t.primitives.typography.sm },\n    base: { ...base, fontSize: t.primitives.typography.base },\n    lg: { ...base, fontSize: t.primitives.typography.lg },\n    xl: { ...base, fontSize: t.primitives.typography.xl },\n    '2xl': { ...base, fontSize: t.primitives.typography['2xl'] },\n    '3xl': { ...base, fontSize: t.primitives.typography['3xl'] },\n    weightNormal: { fontWeight: fontWeights.regular },\n    weightMedium: { fontWeight: fontWeights.medium },\n    weightSemibold: { fontWeight: fontWeights.semibold },\n    weightBold: { fontWeight: fontWeights.bold },\n    italic: { fontStyle: 'italic' },\n    underline: { textDecoration: 'underline' },\n    lineThrough: { textDecoration: 'line-through' },\n    decorationNone: { textDecoration: 'none' },\n    uppercase: { textTransform: 'uppercase', letterSpacing: letterSpacing.wider * 10 },\n    lowercase: { textTransform: 'lowercase' },\n    capitalize: { textTransform: 'capitalize' },\n    noMargin: { marginBottom: 0, marginTop: 0 },\n  });\n}\n\nexport function Text({\n  variant,\n  align,\n  color,\n  weight,\n  italic,\n  decoration,\n  transform,\n  noMargin,\n  children,\n  style,\n}: TextProps) {\n  const theme = usePdfxTheme();\n  const styles = useSafeMemo(() => createTextStyles(theme), [theme]);\n  const weightMap = {\n    normal: styles.weightNormal,\n    medium: styles.weightMedium,\n    semibold: styles.weightSemibold,\n    bold: styles.weightBold,\n  };\n  const decorationMap = {\n    underline: styles.underline,\n    'line-through': styles.lineThrough,\n    none: styles.decorationNone,\n  };\n  const transformMap = {\n    uppercase: styles.uppercase,\n    lowercase: styles.lowercase,\n    capitalize: styles.capitalize,\n  };\n  const styleArray: Style[] = [variant ? styles[variant] : styles.text];\n  if (weight && weight in weightMap) styleArray.push(weightMap[weight]);\n  if (italic) styleArray.push(styles.italic);\n  if (decoration && decoration in decorationMap) styleArray.push(decorationMap[decoration]);\n  if (transform && transform in transformMap) styleArray.push(transformMap[transform]);\n  if (noMargin) styleArray.push(styles.noMargin);\n  const semantic = {} as Style;\n  if (align) semantic.textAlign = align;\n  if (color) semantic.color = resolveColor(color, theme.colors);\n  if (Object.keys(semantic).length > 0) styleArray.push(semantic);\n  if (style) styleArray.push(...[style].flat());\n  return <PDFText style={styleArray}>{children}</PDFText>;\n}\n",
      "type": "registry:component"
    }
  ],
  "dependencies": [
    "@react-pdf/renderer"
  ],
  "registryDependencies": [
    "theme"
  ]
}