| 1 | import * as React from "react"; |
| 2 | import { cva, type |
| 3 | import { cn } |
| 4 | import { Slot } |
| 5 | |
| 6 | const badgeVariants = cva |
| 7 | "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", |
| 8 | { |
| 9 | variants: { |
| 10 | variant: { |
| 11 | default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", |
| 12 | secondary: |
| 13 | "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80", |
| 14 | destructive: |
| 15 | "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20", |
| 16 | outline: |
| 17 | "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground", |
| 18 | ghost: |
| 19 | "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50", |
| 20 | link: "text-primary underline-offset-4 hover:underline", |
| 21 | }, |
| 22 | }, |
| 23 | defaultVariants: { |
| 24 | variant: "default", |
| 25 | }, |
| 26 | }, |
| 27 | ); |
| 28 | |
| 29 | function Badge({ |
| 30 | className, |
| 31 | variant = "default" |
| 32 | asChild = false, |
| 33 | ...props |
| 34 | }: React. |
| 35 | VariantProps<typeof |
| 36 | const Comp = |
| 37 | |
| 38 | return ( |
| 39 | <Comp |
| 40 | data-slot="badge" |
| 41 | data-variant={variant} |
| 42 | className={cn(badgeVariants |
| 43 | {...props} |
| 44 | /> |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | export { Badge, badgeVariants |