{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle",
  "title": "Toggle",
  "dependencies": [
    "solid-js@^1.9.15",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "@audiocn-solid/core"
  ],
  "files": [
    {
      "path": "components/ui/toggle.tsx",
      "content": "import { cva } from \"class-variance-authority\";\nimport { createSignal } from \"solid-js\";\n\nimport type { ButtonDOMProps } from \"@/lib/solid/jsx-types\";\nimport { omitProps } from \"@/lib/solid/props\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ToggleProps extends Omit<\n  ButtonDOMProps,\n  \"onClick\" | \"disabled\"\n> {\n  pressed?: boolean;\n  defaultPressed?: boolean;\n  onPressedChange?: (pressed: boolean) => void;\n  disabled?: boolean;\n  onClick?: (event: MouseEvent) => void;\n  size?: \"sm\" | \"default\" | \"lg\";\n  variant?: \"default\" | \"outline\";\n  className?: string;\n}\n\nexport const toggleVariants = cva(\n  \"group/toggle hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted dark:aria-invalid:ring-destructive/40 inline-flex items-center justify-center gap-1 rounded-2xl text-sm font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n  {\n    defaultVariants: { size: \"default\", variant: \"default\" },\n    variants: {\n      size: {\n        default:\n          \"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        lg: \"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        sm: \"h-7 min-w-7 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5\",\n      },\n      variant: {\n        default: \"bg-transparent\",\n        outline: \"border-input hover:bg-muted border bg-transparent\",\n      },\n    },\n  }\n);\n\nexport const Toggle = (props: ToggleProps) => {\n  const [uncontrolled, setUncontrolled] = createSignal(\n    props.defaultPressed ?? false\n  );\n\n  const pressed = () => props.pressed ?? uncontrolled();\n\n  const rest = omitProps(props, [\n    \"class\",\n    \"className\",\n    \"pressed\",\n    \"defaultPressed\",\n    \"onPressedChange\",\n    \"onClick\",\n    \"size\",\n    \"variant\",\n  ]);\n\n  return (\n    <button\n      type=\"button\"\n      data-slot=\"toggle\"\n      aria-pressed={pressed() ? \"true\" : \"false\"}\n      class={cn(\n        toggleVariants({\n          size: props.size ?? \"default\",\n          variant: props.variant ?? \"default\",\n        }),\n        props.class,\n        props.className\n      )}\n      {...rest}\n      onClick={(event: MouseEvent) => {\n        props.onClick?.(event);\n\n        if (event.defaultPrevented || props.disabled) return;\n        const next = !pressed();\n\n        if (props.pressed === undefined) setUncontrolled(next);\n        props.onPressedChange?.(next);\n      }}\n    />\n  );\n};\n",
      "type": "registry:ui"
    },
    {
      "path": "lib/audiocn-license.txt",
      "content": "Audio component source adapted from https://github.com/audiocn/ui.\nMIT License — Copyright (c) 2026 OrcDev\n\nRegular SVG icon geometry adapted from @phosphor-icons/react 2.1.10.\nMIT License — Copyright (c) 2020 Phosphor Icons\n\nThe following permission and warranty terms apply to both notices.\nRetain this file with copies or substantial portions of the source.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
      "type": "registry:file",
      "target": "@lib/audiocn-license.txt"
    }
  ],
  "type": "registry:ui"
}
