{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "primitives-radix-checkbox",
  "title": "Radix Checkbox",
  "description": "A control that allows the user to toggle between checked and not checked.",
  "dependencies": [
    "motion",
    "radix-ui"
  ],
  "registryDependencies": [
    "@odysseyui/hooks-use-controlled-state",
    "@odysseyui/lib-get-strict-context"
  ],
  "files": [
    {
      "path": "registry/primitives/radix/checkbox/index.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport { motion, SVGMotionProps, type HTMLMotionProps } from 'motion/react';\n\nimport { getStrictContext } from '@/lib/get-strict-context';\nimport { useControlledState } from '@/hooks/use-controlled-state';\n\ntype CheckboxContextType = {\n  isChecked: boolean | 'indeterminate';\n  setIsChecked: (checked: boolean | 'indeterminate') => void;\n};\n\nconst [CheckboxProvider, useCheckbox] =\n  getStrictContext<CheckboxContextType>('CheckboxContext');\n\ntype CheckboxProps = HTMLMotionProps<'button'> &\n  Omit<React.ComponentProps<typeof CheckboxPrimitive.Root>, 'asChild'>;\n\nfunction Checkbox({\n  defaultChecked,\n  checked,\n  onCheckedChange,\n  disabled,\n  required,\n  name,\n  value,\n  ...props\n}: CheckboxProps) {\n  const [isChecked, setIsChecked] = useControlledState({\n    value: checked,\n    defaultValue: defaultChecked,\n    onChange: onCheckedChange,\n  });\n\n  return (\n    <CheckboxProvider value={{ isChecked, setIsChecked }}>\n      <CheckboxPrimitive.Root\n        defaultChecked={defaultChecked}\n        checked={checked}\n        onCheckedChange={setIsChecked}\n        disabled={disabled}\n        required={required}\n        name={name}\n        value={value}\n        asChild\n      >\n        <motion.button\n          data-slot=\"checkbox\"\n          whileTap={{ scale: 0.95 }}\n          whileHover={{ scale: 1.05 }}\n          {...props}\n        />\n      </CheckboxPrimitive.Root>\n    </CheckboxProvider>\n  );\n}\n\ntype CheckboxIndicatorProps = SVGMotionProps<SVGSVGElement>;\n\nfunction CheckboxIndicator(props: CheckboxIndicatorProps) {\n  const { isChecked } = useCheckbox();\n\n  return (\n    <CheckboxPrimitive.Indicator forceMount asChild>\n      <motion.svg\n        data-slot=\"checkbox-indicator\"\n        xmlns=\"http://www.w3.org/2000/svg\"\n        fill=\"none\"\n        viewBox=\"0 0 24 24\"\n        strokeWidth=\"3.5\"\n        stroke=\"currentColor\"\n        initial=\"unchecked\"\n        animate={isChecked ? 'checked' : 'unchecked'}\n        {...props}\n      >\n        {isChecked === 'indeterminate' ? (\n          <motion.line\n            x1=\"5\"\n            y1=\"12\"\n            x2=\"19\"\n            y2=\"12\"\n            strokeLinecap=\"round\"\n            initial={{ pathLength: 0, opacity: 0 }}\n            animate={{\n              pathLength: 1,\n              opacity: 1,\n              transition: { duration: 0.2 },\n            }}\n          />\n        ) : (\n          <motion.path\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            d=\"M4.5 12.75l6 6 9-13.5\"\n            variants={{\n              checked: {\n                pathLength: 1,\n                opacity: 1,\n                transition: {\n                  duration: 0.2,\n                  delay: 0.2,\n                },\n              },\n              unchecked: {\n                pathLength: 0,\n                opacity: 0,\n                transition: {\n                  duration: 0.2,\n                },\n              },\n            }}\n          />\n        )}\n      </motion.svg>\n    </CheckboxPrimitive.Indicator>\n  );\n}\n\nexport {\n  Checkbox,\n  CheckboxIndicator,\n  useCheckbox,\n  type CheckboxProps,\n  type CheckboxIndicatorProps,\n  type CheckboxContextType,\n};\n",
      "type": "registry:ui",
      "target": "components/odysseyui/primitives/radix/checkbox.tsx"
    }
  ],
  "type": "registry:ui"
}