"use client"; 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"; const button = cva( "inline-flex items-center justify-center gap-1.5 font-semibold cursor-pointer " + "select-none whitespace-nowrap focus-ring " + "transition-[background,border-color,color,transform,box-shadow] " + "duration-150 ease-out active:scale-[0.97] " + "disabled:opacity-40 disabled:cursor-default disabled:pointer-events-none " + "disabled:active:scale-100", { variants: { variant: { // The accent is fixed now, not sampled from artwork, so a solid button // has a known contrast ratio and can carry a plain white label. It // used to be near-black text on a colour taken from the album cover, // which only worked because colour.ts clamped the luminance. primary: "bg-accent text-[var(--accent-ink)] shadow-[var(--e1)] hover:brightness-110", secondary: "bg-[var(--surface-3)] text-ink border border-edge hover:border-edge-hi " + "hover:bg-[var(--surface-2)]", outline: "bg-transparent border border-edge-hi text-ink " + "hover:border-accent-line hover:bg-accent-soft hover:text-accent", quiet: "bg-transparent text-dim hover:text-ink hover:bg-[var(--faint)]", danger: "bg-transparent border border-err/45 text-err hover:bg-err/10", }, size: { xs: "text-caption px-2.5 py-1 rounded-control gap-1", sm: "text-callout px-3 py-1.5 rounded-control", md: "text-callout px-4 py-2 rounded-control", lg: "text-body px-5 py-2.5 rounded-control font-semibold", icon: "h-8 w-8 rounded-control", pill: "text-callout px-4 py-1.5 rounded-pill", }, }, defaultVariants: { variant: "primary", size: "md" }, }, ); export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { asChild?: boolean; } export const Button = React.forwardRef( ({ className, variant, size, asChild, ...props }, ref) => { const Comp = asChild ? Slot : "button"; return ; }, ); Button.displayName = "Button";