{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "Switch",
  "dependencies": [
    "@base-ui/react",
    "cn",
    "rescript-base-ui"
  ],
  "files": [
    {
      "path": "registry/base/ui/Switch.res",
      "content": "@@directive(\"'use client'\")\n\n@module(\"cn\")\nexternal cn: (string, option<string>) => string = \"cn\"\n\nmodule Size = {\n  @unboxed\n  type t =\n    | @as(\"default\") Default\n    | @as(\"sm\") Sm\n}\n\ntype props = {...BaseUi.Switch.Root.props, size?: Size.t}\n\nlet toBaseUiProps: props => BaseUi.Switch.Root.props = %raw(`({className, size, ...props}) => props`)\n\n@react.componentWithProps(props)\nlet make = (props: props) => {\n  let dataSlot = props.dataSlot->Option.getOr(\"switch\")\n  let size = props.size->Option.getOr(Size.Default)\n  <BaseUi.Switch.Root\n    {...toBaseUiProps(props)}\n    dataSlot\n    dataSize={(size :> string)}\n    className={cn(\n      \"data-checked:bg-primary data-unchecked:bg-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-3 aria-invalid:ring-3 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:border-transparent data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n      props.className,\n    )}\n  >\n    <BaseUi.Switch.Thumb\n      dataSlot=\"switch-thumb\"\n      className=\"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform\"\n    />\n  </BaseUi.Switch.Root>\n}\n",
      "type": "registry:file",
      "target": "@ui/Switch.res"
    }
  ],
  "type": "registry:ui"
}