import { cva, type VariantProps } from 'class-variance-authority';

export { default as ToggleGroup } from './ToggleGroup.vue';
export { default as ToggleGroupItem } from './ToggleGroupItem.vue';
export { toggleGroupContextKey, type ToggleGroupContext } from './context';

export const toggleGroupVariants = cva(
  'inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-background-surface-muted-subtle outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
  {
    variants: {
      variant: {
        default:
          'bg-transparent data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
        outline:
          'border border-input bg-transparent shadow-sm focus-visible:border-ring data-[state=on]:bg-accent-default data-[state=on]:text-accent-default-foreground data-[state=on]:hover:bg-accent-default data-[state=on]:hover:text-accent-default-foreground data-[state=open]:bg-accent-default data-[state=open]:text-accent-default-foreground data-[state=open]:hover:bg-accent-default data-[state=open]:hover:text-accent-default-foreground aria-pressed:bg-accent-default aria-pressed:text-accent-default-foreground aria-pressed:hover:bg-accent-default aria-pressed:hover:text-accent-default-foreground',
        soft: 'bg-transparent data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:border data-[state=on]:border-accent-default data-[state=on]:hover:bg-accent data-[state=on]:hover:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:border data-[state=open]:border-accent-default data-[state=open]:hover:bg-accent data-[state=open]:hover:text-accent-foreground aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:border aria-pressed:border-accent-default aria-pressed:hover:bg-accent aria-pressed:hover:text-accent-foreground',
      },
      size: {
        default: 'h-9 px-2 min-w-9',
        sm: 'h-8 px-1.5 min-w-8',
        lg: 'h-10 px-2.5 min-w-10',
      },
    },
    defaultVariants: {
      variant: 'default',
      size: 'default',
    },
  },
);

export type ToggleGroupVariants = VariantProps<typeof toggleGroupVariants>;
