feat(frontend): add shadcn ui primitives and compatibility bridge

This commit is contained in:
Sagit
2026-02-19 05:14:42 +00:00
parent c5124a01e6
commit 12c50df6a7
43 changed files with 2839 additions and 0 deletions
@@ -0,0 +1,56 @@
import * as React from "react";
import { Badge } from "@/components/ui/badge";
import { cn } from "@/lib/utils";
type ChipColor = "default" | "primary" | "secondary" | "success" | "warning" | "danger";
type ChipVariant = "solid" | "flat" | "light" | "bordered";
type ChipSize = "sm" | "md" | "lg";
export interface ChipProps extends React.ComponentProps<"span"> {
color?: ChipColor;
size?: ChipSize;
variant?: ChipVariant;
}
function colorVariant(color: ChipColor) {
if (color === "danger") {
return "destructive" as const;
}
if (color === "success") {
return "success" as const;
}
if (color === "warning") {
return "warning" as const;
}
if (color === "secondary") {
return "secondary" as const;
}
return "default" as const;
}
export function Chip({
children,
className,
color = "default",
size = "md",
variant = "solid",
...props
}: ChipProps) {
return (
<Badge
className={cn(
variant === "flat" || variant === "light" ? "bg-opacity-15" : "",
variant === "bordered" ? "border-current bg-transparent" : "",
size === "sm" ? "px-2 py-0 text-[10px]" : "",
size === "lg" ? "px-3 py-1 text-sm" : "",
className,
)}
variant={colorVariant(color)}
{...props}
>
{children}
</Badge>
);
}