mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
Upstream sync from shadcn-ui/ui (1686 commits since last merge base). Key changes: - packages/shadcn upgraded to 4.1.0 (CLI font transformers, scaffold from github, chart colors) - apps/v4 replaces apps/www as the primary docs/registry app - Font system: 25+ heading font registries, font markers utility, @supports override - Chart improvements: recharts v3 compat, radial chart fixes - templates/ updated with monorepo variants (astro, vite, react-router, start) - skills/shadcn AI skill definitions added - deprecated/ removed (auth, auth-firebase, cli, www) Preserved Hanzo-only paths: app/, pkg/, demo/, docs/, template/next/
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { mergeProps } from "@base-ui/react/merge-props"
|
|
import { useRender } from "@base-ui/react/use-render"
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
|
|
import { cn } from "@/registry/bases/base/lib/utils"
|
|
|
|
const badgeVariants = cva(
|
|
"cn-badge group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap 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",
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: "cn-badge-variant-default",
|
|
secondary: "cn-badge-variant-secondary",
|
|
destructive: "cn-badge-variant-destructive",
|
|
outline: "cn-badge-variant-outline",
|
|
ghost: "cn-badge-variant-ghost",
|
|
link: "cn-badge-variant-link",
|
|
},
|
|
},
|
|
defaultVariants: {
|
|
variant: "default",
|
|
},
|
|
}
|
|
)
|
|
|
|
function Badge({
|
|
className,
|
|
variant = "default",
|
|
render,
|
|
...props
|
|
}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
|
|
return useRender({
|
|
defaultTagName: "span",
|
|
props: mergeProps<"span">(
|
|
{
|
|
className: cn(badgeVariants({ variant }), className),
|
|
},
|
|
props
|
|
),
|
|
render,
|
|
state: {
|
|
slot: "badge",
|
|
variant,
|
|
},
|
|
})
|
|
}
|
|
|
|
export { Badge, badgeVariants }
|