import type { ButtonHTMLAttributes, ReactNode } from "react"; import { cn } from "../lib/cn.js"; import { Spinner } from "./Spinner.js"; import type { SpinnerSize } from "./Spinner.js"; const variantClasses = { primary: "bg-primary text-primary-foreground hover:bg-primary-hover", secondary: "border border-border-strong bg-surface text-foreground hover:bg-surface-hover", ghost: "text-foreground hover:bg-surface-hover", destructive: "bg-destructive text-destructive-foreground hover:bg-destructive-hover", } as const; const sizeClasses = { sm: "h-8 gap-1.5 rounded-sm px-3 text-[0.6875rem]", md: "h-10 gap-2 rounded-md px-4 text-xs", lg: "h-12 gap-2.5 rounded-lg px-6 text-sm", } as const; const spinnerBySize: Record = { sm: "xs", md: "sm", lg: "md", }; export type ButtonVariant = keyof typeof variantClasses; export type ButtonSize = keyof typeof sizeClasses; export interface ButtonProps extends ButtonHTMLAttributes { variant?: ButtonVariant; size?: ButtonSize; isLoading?: boolean; showTextWhileLoading?: boolean; iconLeading?: ReactNode; iconTrailing?: ReactNode; fullWidth?: boolean; } export const Button = ({ variant = "primary", size = "md", isLoading = false, showTextWhileLoading = true, iconLeading, iconTrailing, fullWidth = false, disabled, type = "button", className, children, ...props }: ButtonProps) => ( );