{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "segmented-control",
  "title": "Segmented Control",
  "description": "Default and inset-outline style recipes for radio choices, navigation links, and pressed buttons.",
  "dependencies": [
    "class-variance-authority"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "packages/ui/src/lib/segmented-control.ts",
      "content": "// Style recipe adapted from Coss UI - https://coss.com/ui/docs/components/segmented-control#about\n\nimport { cva } from 'class-variance-authority'\n\nexport type SegmentedControlSize = 'default' | 'lg' | 'sm'\n\nexport const segmentedControlItemSizeClassNames: Record<\n    SegmentedControlSize,\n    string\n> = {\n    default: 'h-8.5 px-[calc(--spacing(2.5)-1px)] sm:h-7.5',\n    lg: 'h-9.5 px-[calc(--spacing(3)-1px)] sm:h-8.5',\n    sm: 'h-7.5 px-[calc(--spacing(2)-1px)] sm:h-6.5',\n}\n\nexport const segmentedControlRootVariants = cva(\n    'relative z-0 flex w-fit flex-row items-center justify-center gap-0.5 p-0.5',\n    {\n        variants: {\n            variant: {\n                default: 'bg-muted rounded-lg',\n                'inset-outline': 'bg-secondary rounded-full',\n            },\n        },\n        defaultVariants: { variant: 'default' },\n    },\n)\n\nexport const segmentedControlRootClassName = segmentedControlRootVariants()\n\nexport const segmentedControlItemLayoutClassName =\n    \"gap-1.5 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0\"\n\nexport const segmentedControlItemVariants = cva(\n    [\n        'text-muted-foreground/72 hover:text-muted-foreground focus-visible:outline-ring relative inline-flex shrink-0 cursor-pointer items-center justify-center border border-transparent text-base font-medium whitespace-nowrap outline-2 outline-transparent transition-[outline-color] select-none hover:bg-transparent disabled:pointer-events-none disabled:opacity-64 data-disabled:pointer-events-none data-disabled:opacity-64 sm:text-sm',\n        segmentedControlItemLayoutClassName,\n    ],\n    {\n        defaultVariants: {\n            size: 'default',\n            variant: 'default',\n        },\n        variants: {\n            size: segmentedControlItemSizeClassNames,\n            variant: {\n                default: 'rounded-md',\n                'inset-outline': 'rounded-full',\n            },\n            /**\n             * The state that will determine the active state of the item. Only applies when the item is checked, current, or pressed.\n             */\n            state: {\n                checked: 'aria-checked:text-foreground',\n                current: 'aria-[current=page]:text-foreground',\n                pressed:\n                    'aria-pressed:text-foreground aria-selected:text-foreground',\n            },\n        },\n        compoundVariants: [\n            {\n                variant: 'default',\n                state: 'checked',\n                class: 'aria-checked:bg-background dark:aria-checked:bg-input aria-checked:shadow-sm/5',\n            },\n            {\n                variant: 'default',\n                state: 'current',\n                class: 'aria-[current=page]:bg-background dark:aria-[current=page]:bg-input aria-[current=page]:shadow-sm/5',\n            },\n            {\n                variant: 'default',\n                state: 'pressed',\n                class: 'aria-pressed:bg-background dark:aria-pressed:bg-input aria-selected:bg-background dark:aria-selected:bg-input aria-pressed:shadow-sm/5 aria-selected:shadow-sm/5',\n            },\n            {\n                variant: 'inset-outline',\n                state: 'checked',\n                class: 'aria-checked:bg-card aria-checked:ring-foreground/8 dark:aria-checked:ring-foreground/12 aria-checked:shadow-xs aria-checked:ring-1',\n            },\n            {\n                variant: 'inset-outline',\n                state: 'current',\n                class: 'aria-[current=page]:bg-card aria-[current=page]:ring-foreground/8 dark:aria-[current=page]:ring-foreground/12 aria-[current=page]:shadow-xs aria-[current=page]:ring-1',\n            },\n            {\n                variant: 'inset-outline',\n                state: 'pressed',\n                class: '[[aria-pressed=true],[aria-selected=true]]:bg-card [[aria-pressed=true],[aria-selected=true]]:ring-foreground/8 dark:[[aria-pressed=true],[aria-selected=true]]:ring-foreground/12 [[aria-pressed=true],[aria-selected=true]]:shadow-xs [[aria-pressed=true],[aria-selected=true]]:ring-1',\n            },\n        ],\n    },\n)\n",
      "type": "registry:file",
      "target": "~/src/lib/segmented-control.ts"
    }
  ],
  "meta": {
    "framework": "astro",
    "source": "@gnostic/ui",
    "testedDependencies": {
      "class-variance-authority": "^0.7.1"
    }
  },
  "docs": "https://gnosticai.com/ui/components/segmented-control",
  "type": "registry:lib"
}
