{
  "$schema": "https://pdfx.akashpise.dev/schema/registry-item.json",
  "name": "section",
  "type": "registry:ui",
  "title": "Section",
  "description": "Logical section with theme-based spacing",
  "files": [
    {
      "path": "components/pdfx/section/pdfx-section.tsx",
      "content": "import { StyleSheet, View } 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 SectionSpacing = 'none' | 'sm' | 'md' | 'lg' | 'xl';\nexport type SectionPadding = 'none' | 'sm' | 'md' | 'lg';\nexport type SectionVariant = 'default' | 'callout' | 'highlight' | 'card';\n\n/**\n * Layout container with spacing, padding, and visual style variants.\n * Props - `spacing` | `padding` | `background` | `border` | `variant` | `accentColor` | `noWrap` | `children` | `style`\n * @see {@link SectionProps}\n */\nexport interface SectionProps {\n  /** Custom styles to merge with component defaults */\n  style?: Style;\n  /** Content to render */\n  children: React.ReactNode;\n  /**\n   * @default 'md'\n   */\n  spacing?: SectionSpacing;\n  padding?: SectionPadding;\n  background?: string;\n  /**\n   * @default false\n   */\n  border?: boolean;\n  /**\n   * @default 'default'\n   */\n  variant?: SectionVariant;\n  accentColor?: string;\n  /**\n   * @default false\n   */\n  noWrap?: 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 createSectionStyles(t: PdfxTheme) {\n  const { spacing, borderRadius } = t.primitives;\n  return StyleSheet.create({\n    base: { flexDirection: 'column' },\n    spacingNone: { marginVertical: spacing[0] },\n    spacingSm: { marginVertical: spacing[4] },\n    spacingMd: { marginVertical: t.spacing.sectionGap },\n    spacingLg: { marginVertical: spacing[8] },\n    spacingXl: { marginVertical: spacing[12] },\n    paddingNone: { padding: spacing[0] },\n    paddingSm: { padding: spacing[3] },\n    paddingMd: { padding: spacing[4] },\n    paddingLg: { padding: spacing[6] },\n    border: {\n      borderWidth: spacing[0.5],\n      borderColor: t.colors.border,\n      borderStyle: 'solid',\n      borderRadius: borderRadius.md,\n    },\n    callout: {\n      borderLeftWidth: spacing[1],\n      borderLeftColor: t.colors.primary,\n      borderLeftStyle: 'solid',\n      paddingLeft: spacing[4],\n      paddingVertical: spacing[2],\n    },\n    highlight: {\n      backgroundColor: t.colors.muted,\n      borderLeftWidth: spacing[1],\n      borderLeftColor: t.colors.primary,\n      borderLeftStyle: 'solid',\n      padding: spacing[4],\n    },\n    card: {\n      borderWidth: spacing[0.5],\n      borderColor: t.colors.border,\n      borderStyle: 'solid',\n      borderRadius: borderRadius.md,\n      padding: spacing[4],\n    },\n  });\n}\n\nexport function Section({\n  spacing = 'md',\n  padding,\n  background,\n  border,\n  variant = 'default',\n  accentColor,\n  noWrap = false,\n  children,\n  style,\n}: SectionProps) {\n  const theme = usePdfxTheme();\n  const styles = useSafeMemo(() => createSectionStyles(theme), [theme]);\n  const spacingMap = {\n    none: styles.spacingNone,\n    sm: styles.spacingSm,\n    md: styles.spacingMd,\n    lg: styles.spacingLg,\n    xl: styles.spacingXl,\n  };\n  const paddingMap = {\n    none: styles.paddingNone,\n    sm: styles.paddingSm,\n    md: styles.paddingMd,\n    lg: styles.paddingLg,\n  };\n  const variantMap: Record<SectionVariant, Style | null> = {\n    default: null,\n    callout: styles.callout,\n    highlight: styles.highlight,\n    card: styles.card,\n  };\n  const styleArray: Style[] = [styles.base, spacingMap[spacing]];\n  const variantStyle = variantMap[variant];\n  if (variantStyle) styleArray.push(variantStyle);\n  if (accentColor && (variant === 'callout' || variant === 'highlight')) {\n    styleArray.push({ borderLeftColor: resolveColor(accentColor, theme.colors) });\n  }\n  if (padding && padding in paddingMap) styleArray.push(paddingMap[padding]);\n  if (border && variant === 'default') styleArray.push(styles.border);\n  if (background) styleArray.push({ backgroundColor: resolveColor(background, theme.colors) });\n  if (style) styleArray.push(...[style].flat());\n  return (\n    <View wrap={noWrap ? false : undefined} style={styleArray}>\n      {children}\n    </View>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "dependencies": [
    "@react-pdf/renderer"
  ],
  "registryDependencies": [
    "theme"
  ]
}