import * as React from "react"; import { cva, type VariantProps } from "class-variance-authority"; import { Slot } from "radix-ui"; import { cn } from "../lib/cn"; const badgeVariants = cva( "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3", { variants: { variant: { default: "border-primary-border bg-primary text-primary-foreground [&:is(a)]:hover:bg-primary-hover", secondary: "bg-secondary text-secondary-foreground [&:is(a)]:hover:bg-secondary/90", destructive: "bg-destructive-filled text-destructive-foreground focus-visible:ring-destructive/40 [&:is(a)]:hover:bg-destructive-filled/90", outline: "border-border text-foreground [&:is(a)]:hover:bg-accent [&:is(a)]:hover:text-accent-foreground", ghost: "[&:is(a)]:hover:bg-accent [&:is(a)]:hover:text-accent-foreground", link: "text-brand underline-offset-4 [&:is(a)]:hover:underline", }, }, defaultVariants: { variant: "default", }, }, ); function Badge({ className, variant = "default", asChild = false, ...props }: React.ComponentProps<"span"> & VariantProps & { asChild?: boolean }) { const Comp = asChild ? Slot.Root : "span"; return ( ); } export { Badge, badgeVariants };