import { Button as ButtonPrimitive } from "@kobalte/core/button"; import { cva, type VariantProps } from "class-variance-authority"; import { type ComponentProps, type ValidComponent, splitProps } from "solid-js"; import { cn } from "@/lib/cn"; export const buttonVariants = cva( "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring/75 focus-visible:ring-offset-1 focus-visible:ring-offset-background active:scale-[0.98] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", { variants: { variant: { // Flat (no shadows), neutral fills, subtle hairline outlines. default: "bg-primary text-primary-foreground hover:bg-primary/90", destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", outline: "border border-border/70 bg-transparent hover:border-border hover:bg-muted/60 hover:text-foreground", secondary: "border border-border/60 bg-secondary text-secondary-foreground hover:bg-secondary/80", ghost: "text-foreground/75 hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent", link: "text-primary underline-offset-4 hover:underline active:scale-100", }, size: { default: "h-9 px-4 py-2", sm: "h-8 rounded-md px-3 text-xs", lg: "h-10 rounded-md px-8", icon: "h-9 w-9", }, }, defaultVariants: { variant: "default", size: "default", }, }, ); export type ButtonProps = ComponentProps< typeof ButtonPrimitive > & VariantProps; export function Button(props: ButtonProps) { const [local, rest] = splitProps(props as ButtonProps, ["class", "variant", "size"]); return ( ); }