UNPKG

@szum-tech/design-system

Version:

Szum-Tech design system with tailwindcss support

55 lines (52 loc) 2.43 kB
import { cn } from './chunk-ZD2QRAOX.js'; import { Slot } from 'radix-ui'; import { cva } from 'class-variance-authority'; import { jsx } from 'react/jsx-runtime'; var badgeVariants = cva( "border-border focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded border px-2 py-0.5 text-xs font-medium transition-[color,box-shadow] focus-visible:ring [&>svg]:pointer-events-none [&>svg]:size-3", { variants: { variant: { primary: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent", secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent", outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground", success: "bg-success text-success-foreground [a&]:hover:bg-success/90 focus-visible:ring-success/20 border-transparent", warning: "bg-warning text-warning-foreground [a&]:hover:bg-warning/90 focus-visible:ring-warning/20 border-transparent", error: "bg-error [a&]:hover:bg-error/90 focus-visible:ring-error/20 dark:focus-visible:ring-error/40 dark:bg-error/60 text-error-foreground border-transparent" } }, defaultVariants: { variant: "primary" } } ); function Badge({ className, variant = "primary", asChild = false, ...props }) { const Comp = asChild ? Slot.Slot : "span"; return /* @__PURE__ */ jsx(Comp, { "data-slot": "badge", className: cn(badgeVariants({ variant }), className), ...props }); } function BadgeButton({ className, asChild = false, ...props }) { const Comp = asChild ? Slot.Slot : "span"; return /* @__PURE__ */ jsx( Comp, { "data-slot": "badge-button", className: cn( "-me-0.5 inline-flex size-3.5 cursor-pointer items-center justify-center rounded-md p-0 leading-none opacity-60 transition-all hover:opacity-100 [&>svg]:size-3.5! [&>svg]:opacity-100!", className ), role: "button", ...props } ); } function BadgeDot({ className, ...props }) { return /* @__PURE__ */ jsx( "span", { "data-slot": "badge-dot", className: cn("size-1.5 rounded-full bg-[currentColor] opacity-75", className), ...props } ); } export { Badge, BadgeButton, BadgeDot };