{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "jsonforms-oneof-radio-group-control",
  "description": "JSONForms radio group renderer for oneOf enum fields. Activated by setting options.format to 'radio' in the UISchema.",
  "dependencies": [
    "@jsonforms/core",
    "@jsonforms/react"
  ],
  "registryDependencies": [
    "https://mksingh.dev/r/typography.json",
    "radio-group",
    "label"
  ],
  "files": [
    {
      "path": "registry/forms/renderers/oneof-radio-group-control.tsx",
      "content": "import { useState } from 'react';\n\nimport { and, isOneOfEnumControl, optionIs, rankWith } from '@jsonforms/core';\nimport { withJsonFormsOneOfEnumProps } from '@jsonforms/react';\n\nimport Typography from '~/components/ui/typography';\nimport { Label } from '~/components/ui/label';\nimport { RadioGroup, RadioGroupItem } from '~/components/ui/radio-group';\nimport { shouldShowError, ShouldValidate } from '~/components/forms/utils';\n\ninterface OneOfRadioGroupProps {\n    label?: string;\n    data: any;\n    handleChange: (path: string, value: any) => void;\n    path: string;\n    visible: boolean;\n    enabled: boolean;\n    options?: { value: any; label: string }[];\n    errors?: string;\n    config?: { shouldValidate?: ShouldValidate };\n}\n\nconst OneOfRadioGroupControlRenderer = (props: OneOfRadioGroupProps) => {\n    const { label, data, handleChange, path, visible, enabled, options = [], errors, config } = props;\n    const [touched, setTouched] = useState(false);\n\n    if (!visible) return null;\n\n    return (\n        <div className=\"flex flex-col gap-2 py-2\" onBlur={() => setTouched(true)}>\n            {label && <Label className=\"text-xs font-medium text-foreground\">{label}</Label>}\n            <RadioGroup\n                value={data !== undefined ? String(data) : ''}\n                onValueChange={value => handleChange(path, value)}\n                disabled={!enabled}\n            >\n                {options.map(opt => (\n                    <div key={String(opt.value)} className=\"flex items-center gap-2\">\n                        <RadioGroupItem value={String(opt.value)} id={`${path}-${opt.value}`} />\n                        <Label htmlFor={`${path}-${opt.value}`} className=\"text-xs cursor-pointer\">\n                            {opt.label}\n                        </Label>\n                    </div>\n                ))}\n            </RadioGroup>\n            {shouldShowError(config, touched) && errors && <Typography variant=\"error\">{errors.split(\"\\n\")[0]}</Typography>}\n        </div>\n    );\n};\n\nexport const oneOfRadioGroupControlTester = rankWith(20, and(isOneOfEnumControl, optionIs('format', 'radio')));\nexport default withJsonFormsOneOfEnumProps(OneOfRadioGroupControlRenderer as any);\n",
      "type": "registry:component",
      "target": "components/forms/renderers/oneof-radio-group-control.tsx"
    }
  ],
  "type": "registry:component"
}