{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "switch",
  "title": "Switch",
  "description": "A switch whose thumb stretches toward the other side while it is pressed, then slides across as the setting turns on or off.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/choice.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/switch.tsx",
      "content": "'use client'\n\nimport { choiceClassName, choicePressHandlers } from '@/registry/lib/choice'\nimport {\n  Switch as SwitchPrimitive,\n  SwitchThumb as SwitchThumbPrimitive,\n} from '@ui-sdk/react/switch'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport type { ComponentProps } from 'react'\n\nimport { cn } from '@/lib/utils'\n\nconst switchVariants = cva(\n  [\n    choiceClassName,\n    'group/switch p-0.5',\n    '[--switch-thumb:calc(var(--switch-height)-4px)] [--switch-travel:calc(var(--switch-width)-var(--switch-height))] [--switch-stretch:calc(var(--switch-thumb)*0.3)] [--switch-radius:min(var(--control-radius-xs),calc(var(--switch-height)/2))]',\n    'h-(--switch-height) w-(--switch-width) rounded-(--switch-radius)',\n    'bg-muted-foreground/80 dark:bg-muted-foreground/60 data-checked:bg-primary dark:data-checked:bg-primary',\n    'transition-[background-color,box-shadow] duration-(--motion-press-duration) ease-(--motion-press-fade-easing)',\n    'not-data-checked:not-data-disabled:not-data-readonly:hover:bg-muted-foreground dark:not-data-checked:not-data-disabled:not-data-readonly:hover:bg-muted-foreground/75',\n    'forced-colors:border forced-colors:border-[CanvasText] forced-colors:data-checked:bg-[Highlight]! forced-colors:[--switch-travel:calc(var(--switch-width)-var(--switch-height)-2px)]',\n  ],\n  {\n    variants: {\n      size: {\n        default: '[--switch-height:1.25rem] [--switch-width:2.25rem]',\n        sm: '[--switch-height:1rem] [--switch-width:1.75rem]',\n      },\n    },\n    defaultVariants: { size: 'default' },\n  },\n)\n\nfunction Switch({\n  className,\n  size = 'default',\n  onKeyDown,\n  onKeyUp,\n  onBlur,\n  ...props\n}: Omit<ComponentProps<typeof SwitchPrimitive>, 'className' | 'children'> &\n  VariantProps<typeof switchVariants> & {\n    className?: string\n  }) {\n  return (\n    <SwitchPrimitive\n      data-size={size}\n      className={cn(switchVariants({ size }), className)}\n      {...choicePressHandlers({ onKeyDown, onKeyUp, onBlur })}\n      {...props}\n    >\n      {/*\n       * The thumb is as wide as it gets when stretched, and a clip shows one\n       * round thumb of it, on the side it sits on. A press opens the clip\n       * toward the other side. The drop shadow is on the outer element, so it\n       * follows what the clip leaves.\n       */}\n      <SwitchThumbPrimitive\n        className={cn(\n          'pointer-events-none flex h-(--switch-thumb) w-[calc(var(--switch-thumb)+var(--switch-stretch))] drop-shadow-sm',\n          'transition-[translate] duration-(--motion-layout-duration) ease-(--motion-layout-easing) motion-reduce:transition-none',\n          'data-checked:translate-x-[calc(var(--switch-travel)-var(--switch-stretch))] rtl:data-checked:-translate-x-[calc(var(--switch-travel)-var(--switch-stretch))]',\n        )}\n      >\n        <span\n          aria-hidden\n          className={cn(\n            'bg-background dark:bg-foreground dark:group-data-checked/switch:bg-primary-foreground size-full rounded-[max(0px,calc(var(--switch-radius)-2px))] forced-colors:bg-[CanvasText]! forced-colors:group-data-checked/switch:bg-[HighlightText]!',\n            '[--switch-clip-round:round_max(0px,calc(var(--switch-radius)-2px))]',\n            '[transition:clip-path_var(--motion-layout-duration)_var(--motion-layout-easing),background-color_var(--motion-press-duration)_var(--motion-press-fade-easing)] motion-reduce:[transition:background-color_var(--motion-press-duration)_var(--motion-press-fade-easing)]',\n            '[clip-path:inset(0_var(--switch-stretch)_0_0_var(--switch-clip-round))] rtl:[clip-path:inset(0_0_0_var(--switch-stretch)_var(--switch-clip-round))]',\n            'group-data-checked/switch:[clip-path:inset(0_0_0_var(--switch-stretch)_var(--switch-clip-round))]! rtl:group-data-checked/switch:[clip-path:inset(0_var(--switch-stretch)_0_0_var(--switch-clip-round))]!',\n            // Pressed: on the switch, on the label around it, on its Field's label, or Space held down.\n            '[[data-slot=switch]:active:not([data-disabled],[data-readonly])_&]:[clip-path:inset(0_0_0_0_var(--switch-clip-round))]! [label:active:not(:has([data-disabled],[data-readonly]))_&]:[clip-path:inset(0_0_0_0_var(--switch-clip-round))]! [[data-slot=switch][data-pressing]:not([data-disabled],[data-readonly])_&]:[clip-path:inset(0_0_0_0_var(--switch-clip-round))]! [[data-slot=field]:has(>[data-slot=field-label]:active):not(:has([data-disabled],[data-readonly]))_&]:[clip-path:inset(0_0_0_0_var(--switch-clip-round))]!',\n            '[[data-slot=switch]:active_&]:duration-(--motion-press-duration) [[data-slot=switch]:active_&]:ease-(--motion-press-easing) [label:active_&]:duration-(--motion-press-duration) [label:active_&]:ease-(--motion-press-easing) [[data-slot=switch][data-pressing]_&]:duration-(--motion-press-duration) [[data-slot=switch][data-pressing]_&]:ease-(--motion-press-easing) [[data-slot=field]:has(>[data-slot=field-label]:active)_&]:duration-(--motion-press-duration) [[data-slot=field]:has(>[data-slot=field-label]:active)_&]:ease-(--motion-press-easing)',\n          )}\n        />\n      </SwitchThumbPrimitive>\n    </SwitchPrimitive>\n  )\n}\n\nexport { Switch, switchVariants }\n",
      "type": "registry:component",
      "target": "@components/kino/switch.tsx"
    }
  ],
  "type": "registry:component"
}