import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; import { Slot } from "radix-ui"; import { cn } from "../lib/cn"; const buttonVariants = cva( "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-hidden focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-bg disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", { variants: { variant: { // The one filled action per region: the "teal wash" - a quiet tinted // fill, ink text and a 1px tinted edge, no shadow. default: "border border-primary-border bg-primary text-primary-foreground hover:bg-primary-hover", destructive: "bg-destructive-filled text-destructive-foreground hover:bg-destructive-filled/90 focus-visible:ring-destructive/40", outline: "border border-border bg-surface text-fg hover:bg-surface-2", secondary: "bg-secondary text-secondary-foreground hover:bg-surface-3 hover:text-fg", ghost: "hover:bg-hover hover:text-fg", link: "og-link", }, size: { default: "h-9 px-4 py-2 has-[>svg]:px-3", xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3", sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5", lg: "h-10 rounded-md px-6 has-[>svg]:px-4", icon: "size-9", "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3", "icon-sm": "size-8", "icon-lg": "size-10", }, }, defaultVariants: { variant: "default", size: "default", }, }, ); function Button({ className, variant = "default", size = "default", asChild = false, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean | undefined; }) { const Comp = asChild ? Slot.Root : "button"; return ( ); } export { Button, buttonVariants };