{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "jsonforms-boolean-control",
  "description": "JSONForms checkbox renderer for boolean type fields.",
  "dependencies": [
    "@jsonforms/core",
    "@jsonforms/react"
  ],
  "registryDependencies": [
    "https://mksingh.dev/r/typography.json",
    "checkbox",
    "label"
  ],
  "files": [
    {
      "path": "registry/forms/renderers/boolean-control.tsx",
      "content": "import { useState } from 'react';\n\nimport { ControlProps, isBooleanControl, rankWith } from '@jsonforms/core';\nimport { withJsonFormsControlProps } from '@jsonforms/react';\n\nimport Typography from '~/components/ui/typography';\nimport { Checkbox } from '~/components/ui/checkbox';\nimport { Label } from '~/components/ui/label';\nimport { shouldShowError } from '~/components/forms/utils';\n\nconst BooleanControlRenderer = (props: ControlProps) => {\n    const { label, data, handleChange, path, visible, enabled, id, 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-1 py-2\">\n            <div className=\"flex items-center gap-2\">\n                <Checkbox\n                    id={id}\n                    checked={data ?? false}\n                    onCheckedChange={checked => handleChange(path, checked)}\n                    onBlur={() => setTouched(true)}\n                    disabled={!enabled}\n                />\n                {label && (\n                    <Label htmlFor={id} className=\"text-xs font-medium text-foreground cursor-pointer\">\n                        {label}\n                    </Label>\n                )}\n            </div>\n            {shouldShowError(config, touched) && errors && <Typography variant=\"error\">{errors.split(\"\\n\")[0]}</Typography>}\n        </div>\n    );\n};\n\nexport const booleanControlTester = rankWith(10, isBooleanControl);\nexport default withJsonFormsControlProps(BooleanControlRenderer);\n",
      "type": "registry:component",
      "target": "components/forms/renderers/boolean-control.tsx"
    }
  ],
  "type": "registry:component"
}