{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/checkbox-19","type":"registry:component","title":"Checkbox 19","description":"Checkbox with confetti animation effect when checked","dependencies":["motion"],"registryDependencies":["checkbox","label"],"files":[{"path":"src/registry/new-york/components/checkbox/checkbox-19.tsx","content":"'use client'\n\nimport { useId, useState } from 'react'\n\nimport { motion, AnimatePresence, easeOut } from 'motion/react'\n\nimport { Checkbox } from '@/registry/new-york/ui/checkbox'\nimport { Label } from '@/registry/new-york/ui/label'\n\nconst particleAnimation = (index: number) => {\n  const angle = Math.random() * Math.PI * 2\n  const distance = 30 + Math.random() * 20\n\n  return {\n    initial: { x: '50%', y: '50%', scale: 0, opacity: 0 },\n    animate: {\n      x: `calc(50% + ${Math.cos(angle) * distance}px)`,\n      y: `calc(50% + ${Math.sin(angle) * distance}px)`,\n      scale: [0, 1, 0],\n      opacity: [0, 1, 0]\n    },\n    transition: { duration: 0.4, delay: index * 0.05, ease: easeOut }\n  }\n}\n\nconst ConfettiPiece = ({ index }: { index: number }) => {\n  const colors = ['#FF0000', '#00FF00', '#0000FF', '#FFFF00', '#FF00FF', '#00FFFF']\n  const color = colors[index % colors.length]\n\n  return (\n    <motion.div\n      className='absolute size-1 rounded-full'\n      style={{ backgroundColor: color }}\n      {...particleAnimation(index)}\n    />\n  )\n}\n\nconst CheckboxConfettiDemo = () => {\n  const [showConfetti, setShowConfetti] = useState(false)\n\n  const id = useId()\n\n  const handleCheckedChange = (checked: boolean) => {\n    if (checked) {\n      setShowConfetti(true)\n      setTimeout(() => setShowConfetti(false), 800)\n    }\n  }\n\n  return (\n    <div className='relative flex items-center gap-2'>\n      <Checkbox id={id} onCheckedChange={handleCheckedChange} />\n      <Label htmlFor={id}>Check to see magic</Label>\n      <AnimatePresence>\n        {showConfetti && (\n          <div className='pointer-events-none absolute inset-0'>\n            {[...Array(12)].map((_, i) => (\n              <ConfettiPiece key={i} index={i} />\n            ))}\n          </div>\n        )}\n      </AnimatePresence>\n    </div>\n  )\n}\n\nexport default CheckboxConfettiDemo\n","type":"registry:component","target":"components/shadcn-studio/checkbox/checkbox-19.tsx"}]}