{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "channel-toggle",
  "title": "Channel Toggle",
  "description": "Audio channel toggle buttons with neutral, mute, solo, and monitor tones plus inherited disabled state.",
  "dependencies": [
    "solid-js@^1.9.15",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "@audiocn-solid/core",
    "@audiocn-solid/use-audio-config"
  ],
  "files": [
    {
      "path": "components/ui/channel-toggle.tsx",
      "content": "import { cva } from \"class-variance-authority\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { createSignal } from \"solid-js\";\n\nimport { useAudioConfig } from \"@/hooks/use-audio-config\";\nimport type { ButtonDOMProps } from \"@/lib/solid/jsx-types\";\nimport { omitProps } from \"@/lib/solid/props\";\nimport { cn } from \"@/lib/utils\";\n\nconst channelToggleVariants = cva(\n  \"group/channel-toggle focus-visible:ring-ring/30 inline-flex shrink-0 items-center justify-center gap-1 rounded-lg text-xs font-semibold whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5\",\n  {\n    defaultVariants: {\n      size: \"default\",\n      tone: \"neutral\",\n      variant: \"default\",\n    },\n    variants: {\n      size: {\n        default: \"h-7 min-w-7 px-1.5\",\n        icon: \"size-7\",\n        lg: \"h-8 min-w-8 px-2\",\n        sm: \"h-6 min-w-6 px-1\",\n      },\n      tone: {\n        monitor:\n          \"data-pressed:border-channel-monitor/40 data-pressed:bg-channel-monitor/15 data-pressed:text-channel-monitor-foreground\",\n        mute: \"data-pressed:border-channel-mute/40 data-pressed:bg-channel-mute/15 data-pressed:text-channel-mute-foreground\",\n        neutral: \"data-pressed:bg-foreground data-pressed:text-background\",\n        solo: \"data-pressed:border-channel-solo/50 data-pressed:bg-channel-solo/20 data-pressed:text-channel-solo-foreground\",\n      },\n      variant: {\n        default: \"bg-muted text-muted-foreground hover:text-foreground\",\n        ghost: \"text-muted-foreground hover:bg-muted hover:text-foreground\",\n        outline:\n          \"border-border text-muted-foreground hover:bg-muted hover:text-foreground border bg-transparent\",\n      },\n    },\n  }\n);\n\ntype ToggleVariants = VariantProps<typeof channelToggleVariants>;\n\nexport interface ChannelToggleProps\n  extends\n    Omit<\n      ButtonDOMProps,\n      \"children\" | \"class\" | \"className\" | \"disabled\" | \"onClick\" | \"type\"\n    >,\n    ToggleVariants {\n  children?: ButtonDOMProps[\"children\"];\n  class?: string;\n  className?: string;\n  defaultPressed?: boolean;\n  disabled?: boolean;\n  onClick?: (event: MouseEvent) => void;\n  onPressedChange?: (pressed: boolean, event: MouseEvent) => void;\n  pressed?: boolean;\n  type?: \"button\" | \"submit\" | \"reset\";\n}\n\nconst CHANNEL_TOGGLE_OWN = [\n  \"children\",\n  \"class\",\n  \"className\",\n  \"defaultPressed\",\n  \"disabled\",\n  \"onClick\",\n  \"onPressedChange\",\n  \"pressed\",\n  \"size\",\n  \"tone\",\n  \"type\",\n  \"variant\",\n] as const;\n\nexport const ChannelToggle = (props: ChannelToggleProps) => {\n  const rest = omitProps(props, CHANNEL_TOGGLE_OWN);\n\n  const config = useAudioConfig();\n\n  const [uncontrolled, setUncontrolled] = createSignal(\n    props.defaultPressed ?? false\n  );\n\n  const pressed = () => props.pressed ?? uncontrolled();\n\n  const disabled = () => props.disabled ?? config.disabled ?? false;\n\n  const tone = () => props.tone ?? \"neutral\";\n\n  const size = () => props.size ?? \"default\";\n\n  const variant = () => props.variant ?? \"default\";\n\n  return (\n    <button\n      aria-pressed={pressed() ? \"true\" : \"false\"}\n      class={cn(\n        channelToggleVariants({\n          size: size(),\n          tone: tone(),\n          variant: variant(),\n        }),\n        props.class,\n        props.className\n      )}\n      data-pressed={pressed() ? \"\" : undefined}\n      data-slot=\"channel-toggle\"\n      data-tone={tone()}\n      disabled={disabled()}\n      onClick={(event) => {\n        props.onClick?.(event);\n\n        if (event.defaultPrevented || disabled()) {\n          return;\n        }\n\n        const next = !pressed();\n\n        if (props.pressed === undefined) {\n          setUncontrolled(next);\n        }\n\n        props.onPressedChange?.(next, event);\n      }}\n      type={props.type ?? \"button\"}\n      {...rest}\n    >\n      {props.children}\n    </button>\n  );\n};\n\nexport type ChannelTogglePresetProps = Omit<ChannelToggleProps, \"tone\">;\n\nexport const MuteToggle = (props: ChannelTogglePresetProps) => (\n  <ChannelToggle\n    aria-label=\"Mute\"\n    data-slot=\"mute-toggle\"\n    tone=\"mute\"\n    {...props}\n  />\n);\n\nexport const SoloToggle = (props: ChannelTogglePresetProps) => (\n  <ChannelToggle\n    aria-label=\"Solo\"\n    data-slot=\"solo-toggle\"\n    tone=\"solo\"\n    {...props}\n  />\n);\n\nexport const MonitorToggle = (props: ChannelTogglePresetProps) => (\n  <ChannelToggle\n    aria-label=\"Monitor\"\n    data-slot=\"monitor-toggle\"\n    tone=\"monitor\"\n    {...props}\n  />\n);\n\nexport { channelToggleVariants };\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"
}
