{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "primitives-base-checkbox",
  "title": "Base Checkbox",
  "description": "An easily stylable checkbox component.",
  "dependencies": [
    "motion",
    "@base-ui-components/react"
  ],
  "registryDependencies": [
    "@odysseyui/lib-get-strict-context",
    "@odysseyui/hooks-use-controlled-state"
  ],
  "files": [
    {
      "path": "registry/primitives/base/checkbox/index.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { Checkbox as CheckboxPrimitive } from '@base-ui-components/react/checkbox';\nimport {\n  motion,\n  type HTMLMotionProps,\n  type SVGMotionProps,\n} from 'motion/react';\n\nimport { getStrictContext } from '@/lib/get-strict-context';\nimport { useControlledState } from '@/hooks/use-controlled-state';\n\ntype CheckboxContextType = {\n  isChecked: boolean;\n  setIsChecked: CheckboxProps['onCheckedChange'];\n  isIndeterminate: boolean | undefined;\n};\n\nconst [CheckboxProvider, useCheckbox] =\n  getStrictContext<CheckboxContextType>('CheckboxContext');\n\ntype CheckboxProps = Omit<\n  React.ComponentProps<typeof CheckboxPrimitive.Root>,\n  'render'\n> &\n  HTMLMotionProps<'button'>;\n\nfunction Checkbox({\n  name,\n  checked,\n  defaultChecked,\n  onCheckedChange,\n  indeterminate,\n  value,\n  nativeButton,\n  parent,\n  disabled,\n  readOnly,\n  required,\n  inputRef,\n  id,\n  ...props\n}: CheckboxProps) {\n  const [isChecked, setIsChecked] = useControlledState({\n    value: checked,\n    defaultValue: defaultChecked,\n    onChange: onCheckedChange,\n  });\n\n  return (\n    <CheckboxProvider\n      value={{ isChecked, setIsChecked, isIndeterminate: indeterminate }}\n    >\n      <CheckboxPrimitive.Root\n        name={name}\n        defaultChecked={defaultChecked}\n        checked={checked}\n        onCheckedChange={setIsChecked}\n        indeterminate={indeterminate}\n        value={value}\n        nativeButton={nativeButton}\n        parent={parent}\n        disabled={disabled}\n        readOnly={readOnly}\n        required={required}\n        inputRef={inputRef}\n        id={id}\n        render={\n          <motion.button\n            data-slot=\"checkbox\"\n            whileTap={{ scale: 0.95 }}\n            whileHover={{ scale: 1.05 }}\n            {...props}\n          />\n        }\n      />\n    </CheckboxProvider>\n  );\n}\n\ntype CheckboxIndicatorProps = SVGMotionProps<SVGSVGElement>;\n\nfunction CheckboxIndicator(props: CheckboxIndicatorProps) {\n  const { isChecked, isIndeterminate } = useCheckbox();\n\n  return (\n    <CheckboxPrimitive.Indicator\n      keepMounted\n      render={\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          {isIndeterminate ? (\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      }\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/base/checkbox.tsx"
    }
  ],
  "type": "registry:ui"
}