import { Slot } from '@radix-ui/react-slot' import { cva, type VariantProps } from 'class-variance-authority' import type * as React from 'react' import { cn } from '#shared/lib/utils' export const buttonVariants = cva( "touch-target inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap outline-none transition-[background-color,border-color,color,filter,opacity,transform] duration-[var(--dur-fast)] ease-[var(--ease-out)] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40 active:translate-y-px disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { variants: { variant: { default: 'bg-primary text-primary-foreground shadow-xs hover:brightness-105', destructive: 'bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90', outline: 'border border-border bg-card shadow-xs hover:bg-muted hover:text-foreground', secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80', ghost: 'text-muted-foreground hover:bg-muted hover:text-foreground', link: 'text-primary underline-offset-4 hover:underline', }, size: { default: 'h-9 px-4 py-2 has-[>svg]:px-3 max-md:min-h-11 max-md:min-w-11', sm: 'h-8 gap-1.5 px-3 has-[>svg]:px-2.5 max-md:min-h-11 max-md:min-w-11', lg: 'h-10 px-6 has-[>svg]:px-4 max-md:min-h-11 max-md:min-w-11', icon: 'size-9 max-md:size-11', }, }, defaultVariants: { variant: 'default', size: 'default' }, }, ) export function Button({ className, variant, size, asChild = false, ...props }: React.ComponentProps<'button'> & VariantProps & { asChild?: boolean }) { const Comp = asChild ? Slot : 'button' return }