feat: add Badge and Alert components

This commit is contained in:
maoyingjie
2026-10-21 21:32:40 +08:00
parent 3515a47f5e
commit 4f43789f60
41 changed files with 2422 additions and 17 deletions
+105
View File
@@ -393,3 +393,108 @@ export const chipVariants = tv({
});
export type ChipVariants = VariantProps<typeof chipVariants>;
export const badgeVariants = tv({
defaultVariants: {
color: "default",
placement: "top-right",
size: "md",
variant: "primary",
},
slots: {
anchor: "hv-badge-anchor",
base: "hv-badge",
label: "hv-badge__label",
},
variants: {
color: {
accent: {
base: "hv-badge--accent",
},
danger: {
base: "hv-badge--danger",
},
default: {
base: "hv-badge--default",
},
success: {
base: "hv-badge--success",
},
warning: {
base: "hv-badge--warning",
},
},
placement: {
"bottom-left": {
base: "hv-badge--bottom-left",
},
"bottom-right": {
base: "hv-badge--bottom-right",
},
"top-left": {
base: "hv-badge--top-left",
},
"top-right": {
base: "hv-badge--top-right",
},
},
size: {
lg: {
base: "hv-badge--lg",
},
md: {
base: "hv-badge--md",
},
sm: {
base: "hv-badge--sm",
},
},
variant: {
primary: {
base: "hv-badge--primary",
},
secondary: {
base: "hv-badge--secondary",
},
soft: {
base: "hv-badge--soft",
},
},
},
});
export type BadgeVariants = VariantProps<typeof badgeVariants>;
export const alertVariants = tv({
defaultVariants: {
status: "default",
},
slots: {
base: "hv-alert",
content: "hv-alert__content",
description: "hv-alert__description",
indicator: "hv-alert__indicator",
title: "hv-alert__title",
},
variants: {
status: {
accent: {
base: "hv-alert--accent",
},
danger: {
base: "hv-alert--danger",
},
default: {
base: "hv-alert--default",
},
success: {
base: "hv-alert--success",
},
warning: {
base: "hv-alert--warning",
},
},
},
});
export type AlertVariants = VariantProps<typeof alertVariants>;