feat(client): UI primitives 基线(E2)

- 引入 Radix Dialog/DropdownMenu/Tabs + CVA
- 新增 Button/Input/Dialog/Tabs/Table/Card 等组件(本地拷贝单向同步)
- 增加 touch-target(44px) 样式基础
这个提交包含在:
2026-02-08 23:17:38 +08:00
父节点 4d4866d10e
当前提交 c7619e55b4
共修改 16 个文件,包含 1329 行新增和 5 行删除
+51
查看文件
@@ -0,0 +1,51 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "../../lib/utils";
const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-lg text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-200 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-white hover:bg-primary-600",
secondary: "border border-slate-200 bg-white text-slate-700 hover:bg-slate-50",
outline: "border border-slate-200 bg-transparent text-slate-900 hover:bg-slate-50",
destructive: "bg-red-600 text-white hover:bg-red-700",
ghost: "bg-transparent text-slate-700 hover:bg-slate-100",
link: "bg-transparent text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-11 px-4",
sm: "h-10 rounded-md px-3 text-xs",
lg: "h-12 rounded-xl px-6 text-base",
icon: "h-11 w-11 p-0",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
},
);
export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean;
};
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
},
);
Button.displayName = "Button";