"use client"; import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; import { Loader2 } from "lucide-react"; import { cn } from "@/lib/utils"; const buttonVariants = cva( "inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium transition-[background-color,color,border-color,box-shadow,transform] duration-150 select-none disabled:pointer-events-none disabled:opacity-50 active:scale-[0.985] [&_svg]:shrink-0 [&_svg]:size-4", { variants: { variant: { primary: "bg-fg text-bg hover:opacity-90 shadow-xs", accent: "bg-accent text-accent-fg hover:bg-accent-strong shadow-xs", secondary: "bg-bg-muted text-fg hover:bg-border", outline: "border border-border bg-bg-elevated text-fg hover:bg-bg-subtle hover:border-border-strong", ghost: "text-fg-muted hover:bg-bg-muted hover:text-fg", danger: "bg-danger text-white hover:opacity-90", "danger-soft": "bg-danger-soft text-danger hover:bg-danger hover:text-white", link: "text-accent underline-offset-4 hover:underline h-auto p-0", }, size: { xs: "tap h-7 px-2 text-xs rounded-sm [&_svg]:size-3.5", sm: "tap h-8 px-2.5 text-[13px]", md: "h-9 px-3.5", lg: "h-11 px-5 text-[15px] rounded-lg", icon: "tap size-8 p-0", "icon-sm": "tap size-7 p-0 rounded-sm [&_svg]:size-3.5", "icon-lg": "size-10 p-0 rounded-lg", }, }, defaultVariants: { variant: "primary", size: "md" }, }, ); export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { asChild?: boolean; loading?: boolean; } export const Button = React.forwardRef(function Button( { className, variant, size, asChild = false, loading = false, children, disabled, ...props }, ref, ) { if (asChild) { return ( {children} ); } return ( ); }); export { buttonVariants };