import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; import { FormButton } from "./form-button"; const buttonVariants = cva( "inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border border-transparent text-sm font-medium transition-colors outline-none hover:no-underline focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer", { variants: { variant: { default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90", destructive: "border-destructive/40 bg-destructive/10 text-destructive hover:bg-destructive/20", outline: "border-border bg-card text-foreground shadow-xs hover:bg-accent", secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: "bg-transparent text-foreground hover:bg-accent", link: "h-auto border-0 bg-transparent p-0 text-primary underline-offset-4 hover:underline", }, size: { default: "h-9 px-4 py-2", sm: "h-8 gap-1.5 px-3 text-[13px]", xs: "h-7 gap-1 rounded-md px-2 text-xs", lg: "h-10 px-6", icon: "size-9", "icon-sm": "size-8", }, }, defaultVariants: { variant: "outline", size: "default" }, }, ); function Button({ className, variant, size, asChild = false, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean }) { const Comp = asChild ? Slot : FormButton; return ; } export { Button, buttonVariants };