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-1.5 whitespace-nowrap text-sm font-medium transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring 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. // Filled variants carry a transparent 1px border and clip their fill // to the padding box: the box matches an outline button's height, and // the visible fill sits 1px inside it like an outline's hairline, so a // filled pill never reads bigger than the bordered pill next to it. // A filled button never gets a border in its own fill colour. default: "border border-transparent bg-primary bg-clip-padding text-primary-foreground hover:bg-primary/90", destructive: "border border-transparent bg-destructive bg-clip-padding 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-transparent bg-secondary bg-clip-padding 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-text underline-offset-4 hover:underline active:scale-100", }, size: { default: "h-9 rounded-lg px-3 py-2", sm: "h-[26px] gap-1 rounded-md px-2 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 ( ); }