@szum-tech/design-system
Version:
Szum-Tech design system with tailwindcss support
59 lines (55 loc) • 2.66 kB
JavaScript
;
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
var radixUi = require('radix-ui');
var classVarianceAuthority = require('class-variance-authority');
var jsxRuntime = require('react/jsx-runtime');
var badgeVariants = classVarianceAuthority.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 ? radixUi.Slot.Slot : "span";
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { "data-slot": "badge", className: chunkH2BWO3SI_cjs.cn(badgeVariants({ variant }), className), ...props });
}
function BadgeButton({ className, asChild = false, ...props }) {
const Comp = asChild ? radixUi.Slot.Slot : "span";
return /* @__PURE__ */ jsxRuntime.jsx(
Comp,
{
"data-slot": "badge-button",
className: chunkH2BWO3SI_cjs.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__ */ jsxRuntime.jsx(
"span",
{
"data-slot": "badge-dot",
className: chunkH2BWO3SI_cjs.cn("size-1.5 rounded-full bg-[currentColor] opacity-75", className),
...props
}
);
}
exports.Badge = Badge;
exports.BadgeButton = BadgeButton;
exports.BadgeDot = BadgeDot;