示例工程 16-shadcn-ui-component-layer
16-shadcn-ui-component-layer/app/.tsc/src/components/ui/toaster.js
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// vendored from shadcn/ui (base style) — toast
// source: https://ui.shadcn.com/docs/components/toast
// fetched: 2026-11-26 · shadcn CLI 4.23.0 · base-nova
// 本地修改:用 Base UI Toast + useToastManager 重写,样式用 token
import { Toast } from "@base-ui-components/react/toast";
export function Toaster() {
const { toasts } = Toast.useToastManager();
return (_jsx(Toast.Viewport, { className: "fixed bottom-4 right-4 z-[100] flex w-80 flex-col gap-2 outline-none", children: toasts.map((toast) => (_jsxs(Toast.Root, { toast: toast, "data-testid": "toast", className: "rounded-card border border-border bg-surface p-3 text-text shadow-xl", children: [_jsx(Toast.Title, { className: "text-sm font-medium" }), _jsx(Toast.Description, { className: "mt-0.5 text-xs text-muted" }), _jsx(Toast.Close, { className: "absolute right-2 top-2 rounded px-1 text-xs text-muted hover:text-text", "aria-label": "\u5173\u95ED\u901A\u77E5", children: "\u00D7" })] }, toast.id))) }));
}
//# sourceMappingURL=toaster.js.map