{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggles-themed",
  "title": "Themed toggles",
  "description": "Styled toggles: the Themed set. 5 decorative toggles variations (DayNightToggle, CheckXToggle, OnOffToggle, EyeToggle, LockToggle) on the ai2 token system, powered by framer-motion, reduced-motion aware and sized sm to xl. Part of the free styled layer.",
  "dependencies": [
    "motion@^12.42.2",
    "lucide-react@^1.23.0"
  ],
  "registryDependencies": [
    "@ai2/tokens"
  ],
  "files": [
    {
      "path": "registry/ai2/styled/toggles-themed.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Check, Eye, EyeOff, Lock, LockOpen, Moon, Sun, X } from \"lucide-react\"\nimport { motion, useReducedMotion } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Themed toggle family: 5 meaningful switches (theme/state). role=\"switch\", keyboard\n   accessible. Color comes ONLY from tokens. There is a lucide icon on the thumb; it\n   slides with the framer-motion `layout` and switches instantly under\n   reduced-motion. Used uncontrolled/controlled. */\n\nexport type StyledSize = \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nconst trackSize: Record<StyledSize, string> = {\n  sm: \"h-5 w-9 p-0.5\",\n  md: \"h-6 w-11 p-0.5\",\n  lg: \"h-7 w-[52px] p-1\",\n  xl: \"h-8 w-[60px] p-1\",\n}\nconst thumbSize: Record<StyledSize, string> = {\n  sm: \"size-4\",\n  md: \"size-5\",\n  lg: \"size-5\",\n  xl: \"size-6\",\n}\n\nconst trackBase =\n  \"relative inline-flex shrink-0 cursor-pointer items-center outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50\"\n\ninterface ToggleProps extends Omit<React.ComponentProps<\"button\">, \"onChange\"> {\n  size?: StyledSize\n  checked?: boolean\n  defaultChecked?: boolean\n  onCheckedChange?: (checked: boolean) => void\n}\n\nfunction useToggle(props: ToggleProps) {\n  const { checked, defaultChecked, onCheckedChange } = props\n  const reduce = useReducedMotion()\n  const [internal, setInternal] = React.useState(defaultChecked ?? false)\n  const on = checked ?? internal\n  const toggle = () => {\n    if (checked === undefined) setInternal((v) => !v)\n    onCheckedChange?.(!on)\n  }\n  const spring = reduce ? { duration: 0 } : ({ type: \"spring\", stiffness: 500, damping: 30 } as const)\n  return { on, toggle, spring }\n}\n\nfunction stripToggleProps(props: ToggleProps) {\n  const { checked, defaultChecked, onCheckedChange, size, className, children, ...rest } = props\n  return rest\n}\n\n/* DayNight: sun/moon; the track color changes with the day/night token. */\nexport function DayNightToggle(props: ToggleProps) {\n  const { on, toggle, spring } = useToggle(props)\n  const size = props.size ?? \"md\"\n  return (\n    <button\n      type=\"button\"\n      role=\"switch\"\n      aria-checked={on}\n      data-slot=\"styled-toggle\"\n      onClick={toggle}\n      className={cn(trackBase, trackSize[size], \"rounded-full transition-colors\", on ? \"justify-end bg-primary\" : \"justify-start bg-info\", props.className)}\n      {...stripToggleProps(props)}\n    >\n      <motion.span\n        layout\n        transition={spring}\n        className={cn(thumbSize[size], \"flex items-center justify-center rounded-full bg-background text-foreground [&_svg]:size-2/3\")}\n      >\n        {on ? <Moon /> : <Sun />}\n      </motion.span>\n    </button>\n  )\n}\n\n/* CheckX: acikken tik, kapaliyken carpi. */\nexport function CheckXToggle(props: ToggleProps) {\n  const { on, toggle, spring } = useToggle(props)\n  const size = props.size ?? \"md\"\n  return (\n    <button\n      type=\"button\"\n      role=\"switch\"\n      aria-checked={on}\n      data-slot=\"styled-toggle\"\n      onClick={toggle}\n      className={cn(trackBase, trackSize[size], \"rounded-full transition-colors\", on ? \"justify-end bg-success\" : \"justify-start bg-input\", props.className)}\n      {...stripToggleProps(props)}\n    >\n      <motion.span\n        layout\n        transition={spring}\n        className={cn(\n          thumbSize[size],\n          \"flex items-center justify-center rounded-full bg-background [&_svg]:size-2/3\",\n          on ? \"text-success\" : \"text-muted-foreground\"\n        )}\n      >\n        {on ? <Check /> : <X />}\n      </motion.span>\n    </button>\n  )\n}\n\n/* OnOff: iz icinde ON/OFF metni, basparmak solda/sagda. */\nexport function OnOffToggle(props: ToggleProps) {\n  const { on, toggle, spring } = useToggle(props)\n  const size = props.size ?? \"lg\"\n  return (\n    <button\n      type=\"button\"\n      role=\"switch\"\n      aria-checked={on}\n      data-slot=\"styled-toggle\"\n      onClick={toggle}\n      className={cn(\n        trackBase,\n        \"h-7 w-[68px] p-1 text-[10px] font-bold tracking-widest\",\n        \"rounded-md transition-colors\",\n        on ? \"justify-end bg-primary text-primary-foreground\" : \"justify-start bg-input text-muted-foreground\",\n        props.className\n      )}\n      {...stripToggleProps(props)}\n    >\n      <span className={cn(\"absolute inset-y-0 flex items-center\", on ? \"left-2.5\" : \"right-2.5\")}>{on ? \"ON\" : \"OFF\"}</span>\n      <motion.span layout transition={spring} className=\"relative size-5 rounded-[3px] bg-background shadow-sm\" />\n    </button>\n  )\n}\n\n/* Eye: gorunurluk anahtari (goz / goz-kapali). */\nexport function EyeToggle(props: ToggleProps) {\n  const { on, toggle, spring } = useToggle(props)\n  const size = props.size ?? \"md\"\n  return (\n    <button\n      type=\"button\"\n      role=\"switch\"\n      aria-checked={on}\n      data-slot=\"styled-toggle\"\n      onClick={toggle}\n      className={cn(trackBase, trackSize[size], \"rounded-full transition-colors\", on ? \"justify-end bg-info\" : \"justify-start bg-input\", props.className)}\n      {...stripToggleProps(props)}\n    >\n      <motion.span\n        layout\n        transition={spring}\n        className={cn(thumbSize[size], \"flex items-center justify-center rounded-full bg-background text-foreground [&_svg]:size-2/3\")}\n      >\n        {on ? <Eye /> : <EyeOff />}\n      </motion.span>\n    </button>\n  )\n}\n\n/* Lock: kilit / kilit-acik durum anahtari. */\nexport function LockToggle(props: ToggleProps) {\n  const { on, toggle, spring } = useToggle(props)\n  const size = props.size ?? \"md\"\n  return (\n    <button\n      type=\"button\"\n      role=\"switch\"\n      aria-checked={on}\n      data-slot=\"styled-toggle\"\n      onClick={toggle}\n      className={cn(trackBase, trackSize[size], \"rounded-full transition-colors\", on ? \"justify-end bg-success\" : \"justify-start bg-input\", props.className)}\n      {...stripToggleProps(props)}\n    >\n      <motion.span\n        layout\n        transition={spring}\n        className={cn(\n          thumbSize[size],\n          \"flex items-center justify-center rounded-full bg-background [&_svg]:size-2/3\",\n          on ? \"text-success\" : \"text-muted-foreground\"\n        )}\n      >\n        {on ? <Lock /> : <LockOpen />}\n      </motion.span>\n    </button>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/ui/toggles-themed.tsx"
    }
  ],
  "categories": [
    "styled",
    "toggles"
  ],
  "type": "registry:component"
}