{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "title": "Switch",
  "dependencies": [
    "@base-ui/react"
  ],
  "registryDependencies": [
    "https://ui.hotfix.jobs/r/recipes.json",
    "https://ui.hotfix.jobs/r/tokens.json",
    "https://ui.hotfix.jobs/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/components/ui/switch.tsx",
      "content": "\"use client\";\n\nimport { Switch as SwitchPrimitive } from \"@base-ui/react/switch\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport { selectionFocus, colorTransition } from \"@/lib/recipes\";\n\nexport type SwitchSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface SwitchProps extends SwitchPrimitive.Root.Props {\n  /** Size preset. */\n  size?: SwitchSize;\n  /** Icons rendered inside the thumb, per state. */\n  icon?: {\n    checked?: React.ReactNode;\n    unchecked?: React.ReactNode;\n  };\n}\n\nconst trackBySize: Record<SwitchSize, string> = {\n  sm: \"h-4 w-7\",\n  md: \"h-5 w-9\",\n  lg: \"h-6 w-11\",\n};\n\nconst thumbBySize: Record<SwitchSize, string> = {\n  sm: \"size-3 data-checked:translate-x-3\",\n  md: \"size-[18px] data-checked:translate-x-4\",\n  lg: \"size-5 data-checked:translate-x-5\",\n};\n\nconst iconSizeBySize: Record<SwitchSize, string> = {\n  sm: \"[&_svg]:size-2\",\n  md: \"[&_svg]:size-3\",\n  lg: \"[&_svg]:size-3.5\",\n};\n\nexport function Switch({\n  className,\n  size = \"md\",\n  icon,\n  ...props\n}: SwitchProps): React.ReactElement {\n  return (\n    <SwitchPrimitive.Root\n      className={cn(\n        \"group inline-flex shrink-0 items-center rounded-full p-px\",\n        \"data-unchecked:bg-fill-2 data-unchecked:hover:bg-hairline-strong data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n        \"data-checked:bg-ink data-checked:hover:bg-ink\",\n        trackBySize[size],\n        colorTransition,\n        selectionFocus,\n        className,\n      )}\n      data-slot=\"switch\"\n      {...props}\n    >\n      <SwitchPrimitive.Thumb\n        className={cn(\n          \"relative pointer-events-none rounded-full shadow-[var(--shadow-card)]\",\n          \"transition-[translate,background-color,color] duration-[var(--duration-state)] ease-[var(--ease-standard)]\",\n          \"bg-base dark:data-unchecked:bg-ink-tertiary\",\n          \"[&_svg]:text-ink dark:data-unchecked:[&_svg]:text-base\",\n          \"data-unchecked:translate-x-0\",\n          iconSizeBySize[size],\n          thumbBySize[size],\n        )}\n        data-slot=\"switch-thumb\"\n      >\n        {icon?.unchecked && (\n          <span className=\"absolute inset-0 flex items-center justify-center group-data-checked:hidden\">\n            {icon.unchecked}\n          </span>\n        )}\n        {icon?.checked && (\n          <span className=\"absolute inset-0 hidden items-center justify-center group-data-checked:flex\">\n            {icon.checked}\n          </span>\n        )}\n      </SwitchPrimitive.Thumb>\n    </SwitchPrimitive.Root>\n  );\n}\n\nexport { SwitchPrimitive };\n",
      "type": "registry:ui",
      "target": "components/ui/switch.tsx"
    }
  ],
  "type": "registry:ui"
}