{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"switch","type":"registry:ui","title":"Switch","description":"A switch whose thumb springs across when toggled and stretches while pressed.","dependencies":["@radix-ui/react-switch@^1.3.7","motion@^14.0.0"],"files":[{"path":"components/ui/switch.tsx","type":"registry:ui","content":"\"use client\";\n\nimport * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport { motion } from \"motion/react\";\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nfunction Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {\n  const [pressed, setPressed] = React.useState(false);\n\n  return (\n    <SwitchPrimitive.Root\n      data-slot=\"switch\"\n      onPointerDown={() => setPressed(true)}\n      onPointerUp={() => setPressed(false)}\n      onPointerLeave={() => setPressed(false)}\n      onPointerCancel={() => setPressed(false)}\n      className={cn(\n        \"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80 inline-flex h-5 w-9 shrink-0 items-center rounded-full p-0.5 shadow-[inset_0_1px_2px_rgb(0_0_0/0.12)] transition-colors outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-foreground aria-invalid:focus-visible:outline-destructive disabled:cursor-not-allowed disabled:opacity-50\",\n        \"justify-start data-[state=checked]:justify-end\",\n        className,\n      )}\n      {...props}\n    >\n      <SwitchPrimitive.Thumb asChild>\n        <motion.span\n          data-slot=\"switch-thumb\"\n          layout\n          initial={false}\n          animate={{ width: pressed ? 20 : 16 }}\n          transition={{ type: \"spring\", stiffness: 700, damping: 35 }}\n          className=\"bg-background dark:data-[state=checked]:bg-primary-foreground pointer-events-none block h-4 rounded-full shadow-[0_1px_2px_rgb(0_0_0/0.25)]\"\n        />\n      </SwitchPrimitive.Thumb>\n    </SwitchPrimitive.Root>\n  );\n}\n\nexport { Switch };\n"}]}