{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle",
  "title": "Toggle",
  "description": "Astro pressed-state buttons for local on/off actions.",
  "dependencies": [
    "@data-slot/toggle",
    "class-variance-authority",
    "cn"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "packages/ui/src/components/ui/toggle/index.ts",
      "content": "export { default as Toggle } from './toggle.astro'\nexport { toggleVariants } from './toggle-variants'\nexport type { ToggleVariantProps } from './toggle-variants'\nexport type { ToggleProps } from './types.ts'\n",
      "type": "registry:file",
      "target": "~/src/components/ui/toggle/index.ts"
    },
    {
      "path": "packages/ui/src/components/ui/toggle/toggle-variants.ts",
      "content": "import { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from 'cn'\n\n/** Shared layout, type, and pressed styles for Toggle and Toggle Group items. */\nexport const toggleBaseClass = \"text-foreground hover:bg-accent focus-visible:ring-ring focus-visible:ring-offset-background aria-pressed:bg-input/64 aria-pressed:text-accent-foreground relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg border text-base font-medium whitespace-nowrap transition-shadow outline-none select-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-64 sm:text-sm pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 group/toggle\"\n\n/** Height and padding for each Toggle size. */\nexport const toggleSizeClass = {\n    default: \"h-9 min-w-9 px-[calc(--spacing(2)-1px)] sm:h-8 sm:min-w-8\",\n    lg: \"h-10 min-w-10 px-[calc(--spacing(2.5)-1px)] sm:h-9 sm:min-w-9\",\n    sm: \"h-8 min-w-8 px-[calc(--spacing(1.5)-1px)] sm:h-7 sm:min-w-7\",\n} as const\n\n/** Border and surface treatment for each Toggle variant. */\nexport const toggleVariantClass = {\n    default: \"border-transparent\",\n    outline: \"border-input bg-background dark:bg-input/32 dark:aria-pressed:bg-input dark:hover:bg-input/64 shadow-xs/5 not-dark:bg-clip-padding not-disabled:not-active:not-aria-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:not-disabled:not-aria-pressed:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-aria-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[aria-pressed=true]]:shadow-none\",\n} as const\n\nconst toggleStyles = cva(toggleBaseClass, {\n    defaultVariants: {\n        size: 'default',\n        variant: 'default',\n    },\n    variants: {\n        size: toggleSizeClass,\n        variant: toggleVariantClass,\n    },\n})\n\nexport const toggleVariants = (...args: Parameters<typeof toggleStyles>) =>\n    cn(toggleStyles(...args))\n\nexport type ToggleVariantProps = VariantProps<typeof toggleVariants>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/toggle/toggle-variants.ts"
    },
    {
      "path": "packages/ui/src/components/ui/toggle/toggle.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\nimport { toggleVariants } from \"./toggle-variants\"\nimport type { ToggleProps } from \"./types.ts\"\n\ntype Props = HTMLAttributes<\"button\"> & ToggleProps\n\nconst {\n  class: className,\n  variant = \"default\",\n  size = \"default\",\n  defaultPressed,\n  disabled,\n  type = \"button\",\n  ...props\n} = Astro.props\n---\n\n<button\n  data-slot=\"toggle\"\n  data-size={size}\n  data-variant={variant}\n  data-default-pressed={defaultPressed}\n  data-disabled={disabled}\n  type={type}\n  disabled={disabled}\n  aria-pressed={defaultPressed === true ? \"true\" : \"false\"}\n  class={cn(toggleVariants({ variant, size }), className)}\n  {...props}\n>\n  <slot />\n</button>\n\n<script>\n  import { create } from \"@data-slot/toggle\"\n  import type { ToggleController } from \"@data-slot/toggle\"\n  // Destroy bindings before a view transition so the next page-load binds once.\n  const controllers: ToggleController[] = []\n  const initialize = () => controllers.push(...create())\n  initialize()\n  document.addEventListener(\"astro:page-load\", initialize)\n  document.addEventListener(\"astro:before-swap\", () => {\n    for (const controller of controllers) controller.destroy()\n    controllers.length = 0\n  })\n</script>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/toggle/toggle.astro"
    },
    {
      "path": "packages/ui/src/components/ui/toggle/types.ts",
      "content": "import type { ToggleOptions } from '@data-slot/toggle'\n\nimport type { ToggleVariantProps } from './toggle-variants.ts'\n\n/**\n * Toggle initial state, visual variant, and size. Button attributes pass through.\n */\nexport type ToggleProps = Pick<ToggleOptions, 'defaultPressed'> &\n    ToggleVariantProps\n",
      "type": "registry:file",
      "target": "~/src/components/ui/toggle/types.ts"
    }
  ],
  "meta": {
    "framework": "astro",
    "source": "@gnostic/ui",
    "testedDependencies": {
      "@data-slot/toggle": "^1.1.2",
      "class-variance-authority": "^0.7.1",
      "cn": "0.5.2"
    }
  },
  "docs": "https://ui.gnosticai.com/components/toggle",
  "categories": [
    "ui"
  ],
  "type": "registry:ui"
}
