- 材质统一边光:slab / float / pill / pill-selected / seg-thumb / chrome-side 改为左上亮右下暗的 1px 边光 + 外侧暗线;新增 lens / field / chip 参数与 pg-float-modal - 主按钮:转动光谱环改为静态左上光谱高光,悬停沿边扫过一小段;次按钮同为 lens 玻璃 - Input / Textarea / SelectTrigger 挂 .field-glass,原生下拉与实体选择器同步;对话框按钮行 gap-3 - 提示条改 pg-float(状态色只在图标、展开不叠放);新增 GlassTooltip 接管 title 提示 - 触屏判断 input-modality.ts、touch / hover 自定义变体;animate-pg-pop 改 backwards;scroll-fade-end - 控制台外壳:侧栏无硬分隔线、折叠开关进标志行;顶栏去磨砂,右侧控件收进玻璃胶囊 - 登录页居中单卡 auth-card;详情头图「订阅」改回普通主按钮,删除 pill-solid;发现页海报角标改 glass-chip-media - 引入 simple-liquid-glass(liquid-surface.tsx);更新 docs/design 三份规范与 CHANGELOG Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
161 lines
5.2 KiB
TypeScript
161 lines
5.2 KiB
TypeScript
import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
|
|
import type * as React from "react";
|
|
import { Button } from "~/components/ui/button.tsx";
|
|
import { cn } from "~/lib/utils.ts";
|
|
|
|
function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
|
|
}
|
|
|
|
function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
|
return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />;
|
|
}
|
|
|
|
function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />;
|
|
}
|
|
|
|
function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
|
return (
|
|
<AlertDialogPrimitive.Overlay
|
|
data-slot="alert-dialog-overlay"
|
|
className={cn(
|
|
"fixed inset-0 z-50 bg-scrim/45 backdrop-blur-[2px] data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AlertDialogContent({
|
|
className,
|
|
size = "default",
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
|
|
size?: "default" | "sm";
|
|
}) {
|
|
return (
|
|
<AlertDialogPortal>
|
|
<AlertDialogOverlay />
|
|
<AlertDialogPrimitive.Content
|
|
data-slot="alert-dialog-content"
|
|
data-size={size}
|
|
className={cn(
|
|
"group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-3xl pg-float pg-float-modal p-6 duration-base data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
</AlertDialogPortal>
|
|
);
|
|
}
|
|
|
|
function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="alert-dialog-header"
|
|
className={cn(
|
|
"grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="alert-dialog-footer"
|
|
className={cn(
|
|
"flex flex-col-reverse gap-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
return (
|
|
<AlertDialogPrimitive.Title
|
|
data-slot="alert-dialog-title"
|
|
className={cn(
|
|
"text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AlertDialogDescription({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
return (
|
|
<AlertDialogPrimitive.Description
|
|
data-slot="alert-dialog-description"
|
|
className={cn("text-sm text-muted-foreground", className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AlertDialogMedia({ className, ...props }: React.ComponentProps<"div">) {
|
|
return (
|
|
<div
|
|
data-slot="alert-dialog-media"
|
|
className={cn(
|
|
"mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function AlertDialogAction({
|
|
className,
|
|
variant = "default",
|
|
size = "default",
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
|
|
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
|
return (
|
|
<Button variant={variant} size={size} asChild>
|
|
<AlertDialogPrimitive.Action data-slot="alert-dialog-action" className={cn(className)} {...props} />
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
function AlertDialogCancel({
|
|
className,
|
|
variant = "outline",
|
|
size = "default",
|
|
...props
|
|
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
|
|
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
|
return (
|
|
<Button variant={variant} size={size} asChild>
|
|
<AlertDialogPrimitive.Cancel data-slot="alert-dialog-cancel" className={cn(className)} {...props} />
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
export {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogMedia,
|
|
AlertDialogOverlay,
|
|
AlertDialogPortal,
|
|
AlertDialogTitle,
|
|
AlertDialogTrigger,
|
|
};
|