{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle-switch",
  "type": "registry:item",
  "title": "Toggle Switch",
  "description": "An on/off switch with a label and a description. A form control (submits \"on\" when checked), switched off by `disabled` or a disabled fieldset.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "input"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/toggle-switch.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/toggle-switch.js",
      "content": "// Generated by zubra from toggle-switch.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { effect, host } from '@zubra/runtime';\n\nexport const tag = \"toggle-switch\";\n\nexport default $define(tag, {\n  props: {\n    \"checked\": { attribute: \"checked\", default: false, required: false, model: true },\n    \"disabled\": { attribute: \"disabled\", default: false, required: false },\n    \"label\": { attribute: \"label\", default: \"\", required: false },\n    \"description\": { attribute: \"description\", default: \"\", required: false },\n    \"extra\": { attribute: \"extra\", default: \"\", required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: true,\n  slots: [],\n  events: [\"checkedchange\"],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (toggle-switch) to ([data-zb-slotted=\\\"toggle-switch\\\"]) {\\n  :scope { display: block; }\\n  button { display: flex; align-items: center; gap: 0.9rem; width: 100%; padding: 0.75rem 0.9rem; border: 1px solid var(--border, #dde); border-radius: calc(var(--radius, 0.625rem) * 1.28); background: var(--card, #fff); color: inherit; font: inherit; text-align: left; cursor: pointer; }\\n  button:disabled { opacity: 0.55; cursor: not-allowed; }\\n  .track { flex: none; width: 2.6rem; height: 1.5rem; border-radius: 999px; background: var(--border, #ccd); position: relative; transition: background var(--duration-normal, 200ms); }\\n  .track::after { content: \\\"\\\"; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: white; box-shadow: 0 1px 2px #0003; transition: transform var(--duration-normal, 200ms); }\\n  [aria-checked=true] .track { background: var(--primary, #36c); }\\n  [aria-checked=true] .track::after { transform: translateX(1.1rem); }\\n  .text { display: grid; flex: 1; }\\n  small { color: var(--muted-foreground, #667); }\\n  .extra { font-weight: 700; white-space: nowrap; }\\n  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; } }\\n}\\n}\\n\",\n  template: \"\\n  <button type=\\\"button\\\" role=\\\"switch\\\">\\n    <span class=\\\"track\\\"></span>\\n    <span class=\\\"text\\\"><span class=\\\"label\\\"></span><small></small></span>\\n    <span class=\\\"extra\\\"></span>\\n  </button>\\n\",\n  setup($p, $emit) {\n                                               \n\n  // `disabled` set from code (el.disabled = true) also goes on the element as the attribute, which\n  // is where the browser looks: it leaves a disabled control out of the form. A disabled\n  // <fieldset> needs nothing here; the browser disables the button inside it too.\n  const element = host()\n  effect(() => element.toggleAttribute('disabled', $p.disabled))\n\n  function toggle() {\n    $p.checked = !$p.checked\n  }\n    return [\n      { path: [0], attribute: \"aria-checked\", value: () => ($p.checked ? \"true\" : \"false\") },\n      { path: [0], attribute: \"disabled\", boolean: true, value: () => $p.disabled },\n      { path: [0], on: \"click\", handler: () => $r(toggle) },\n      { path: [0, 1, 0], text: () => $t($p.label) },\n      { path: [0, 1, 1], text: () => $t($p.description) },\n      { path: [0, 2], text: () => $t($p.extra) },\n    ];\n  },\n});\n"
    }
  ]
}
