@designa8/vibedesign-v6 1.10.6 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,239 +1,68 @@
1
1
  import React from "react";
2
2
  import { ChatScreen, ChatMessage } from "./ChatScreen";
3
- import { Button } from "../Button";
4
- import { Input } from "../Input";
5
3
 
6
- const DEMO_MODELS = [
7
- { id: "gpt-4o", name: "GPT-4o", tier: "Pro", description: "Most capable model" },
8
- { id: "gpt-4o-mini", name: "GPT-4o mini", tier: "Free", description: "Fast and efficient" },
9
- { id: "claude-3-5", name: "Claude 3.5 Sonnet", tier: "Pro", description: "Great for coding" },
10
- ];
11
-
12
- /** A minimal custom footer to demo the renderFooter prop */
13
- const CustomFooter: React.FC = () => (
14
- <div className="w-full px-lg py-md border-t border-hairline-soft bg-surface-soft flex items-center gap-md">
15
- <Input
16
- placeholder="Custom footer input…"
17
- size="sm"
18
- fullWidth
19
- />
20
- <Button size="sm">Send</Button>
21
- </div>
22
- );
23
-
24
- // ─── Messages for the live-agent demo ────────────────────────────────────────
25
-
26
- const LIVE_AGENT_MESSAGES: ChatMessage[] = [
4
+ const messagesWithTimeline: ChatMessage[] = [
27
5
  {
28
6
  id: "1",
29
7
  role: "user",
30
- content: "Build a NavBar organism with logo, links, and a CTA button.",
31
- userInitials: "JD",
8
+ content: "Build a Button atom with primary, secondary, and ghost variants.",
9
+ userInitials: "ME",
32
10
  },
33
11
  {
34
12
  id: "2",
35
13
  role: "ai",
36
- content: "Here's my plan for building the NavBar organism:",
37
- plan: {
38
- title: "Plan",
39
- tasks: [
40
- { id: "p1", label: "Inspect existing Button and NavItem atoms", status: "done" },
41
- {
42
- id: "p2",
43
- label: "Write NavBar.tsx component",
44
- status: "in_progress",
45
- currentTool: "Writing atom",
46
- },
47
- { id: "p3", label: "Write preview.tsx with variants", status: "pending" },
48
- { id: "p4", label: "Verify and fix lint issues", status: "pending" },
49
- ],
50
- },
14
+ content: "I'll build the Button atom now. Tracking progress below:",
15
+ timeline: [
16
+ { id: "t1", kind: "thinking", label: "Planning component API and variants", status: "done" },
17
+ { id: "t2", kind: "read", label: "Reading design tokens", detail: "colors, spacing, rounded", status: "done" },
18
+ { id: "t3", kind: "write", label: "Writing Button.tsx", status: "done" },
19
+ { id: "t4", kind: "write", label: "Writing index.ts", status: "done" },
20
+ { id: "t5", kind: "verify", label: "Verifying atom passes linter", status: "running" },
21
+ ],
51
22
  inFlight: true,
52
- currentToolLabel: "Writing atom",
23
+ currentToolLabel: "Verifying…",
53
24
  },
54
- ];
55
-
56
- // ─── Messages showing all four task statuses ─────────────────────────────────
57
-
58
- const MIXED_STATUS_MESSAGES: ChatMessage[] = [
59
25
  {
60
- id: "1",
26
+ id: "3",
61
27
  role: "user",
62
- content: "Add dark-mode support to the existing design tokens.",
63
- userInitials: "MK",
28
+ content: "Great, also add a destructive variant.",
29
+ userInitials: "ME",
64
30
  },
65
31
  {
66
- id: "2",
32
+ id: "4",
67
33
  role: "ai",
68
- content: "Running through the token update process:",
69
- plan: {
70
- title: "Token update",
71
- tasks: [
72
- { id: "t1", label: "Read current design tokens", status: "done" },
73
- { id: "t2", label: "Patch dark-mode color overrides", status: "done" },
74
- {
75
- id: "t3",
76
- label: "Regenerate theme CSS variables",
77
- status: "failed",
78
- },
79
- { id: "t4", label: "Verify preview renders correctly", status: "pending" },
80
- ],
81
- },
82
- inFlight: false,
34
+ content: "Adding the destructive variant now.",
35
+ timeline: [
36
+ { id: "t6", kind: "read", label: "Reading Button.tsx", status: "done" },
37
+ { id: "t7", kind: "write", label: "Writing updated Button.tsx with destructive variant", status: "done" },
38
+ { id: "t8", kind: "verify", label: "Atom verified successfully", status: "done" },
39
+ ],
40
+ postContent: "The Button atom now has four variants: primary, secondary, ghost, and destructive.",
83
41
  },
84
- ];
85
-
86
- // ─── Messages demonstrating postContent ──────────────────────────────────────
87
-
88
- const POST_CONTENT_MESSAGES: ChatMessage[] = [
89
42
  {
90
- id: "1",
91
- role: "user",
92
- content: "Build a Tabs organism with active-state underline.",
93
- userInitials: "AL",
43
+ id: "5",
44
+ role: "ai",
45
+ content: "Here's a message with only a single timeline step (no expand toggle needed).",
46
+ timeline: [
47
+ { id: "t9", kind: "tool", label: "Called figma_get_design", detail: "node-id: 1234:5678", status: "done" },
48
+ ],
94
49
  },
95
50
  {
96
- id: "2",
51
+ id: "6",
97
52
  role: "ai",
98
- content: "Here's the plan to build the Tabs organism:",
99
- plan: {
100
- title: "Plan",
101
- tasks: [
102
- { id: "s1", label: "Read design tokens and existing atoms", status: "done" },
103
- { id: "s2", label: "Write Tabs.tsx with keyboard navigation", status: "done" },
104
- { id: "s3", label: "Write preview.tsx with three tab variants", status: "done" },
105
- ],
106
- },
107
- postContent:
108
- "All three tasks are complete. The Tabs atom is live in your workspace — open the preview to see the active underline in action and try switching tabs with the arrow keys.",
53
+ content: "And here's an error state in the timeline.",
54
+ timeline: [
55
+ { id: "t10", kind: "thinking", label: "Planning layout structure", status: "done" },
56
+ { id: "t11", kind: "read", label: "Reading reference atom", status: "done" },
57
+ { id: "t12", kind: "write", label: "Writing component file", status: "error" },
58
+ ],
109
59
  },
110
60
  ];
111
61
 
112
- export default function ChatScreenPreview() {
113
- const [modelId, setModelId] = React.useState("gpt-4o");
114
-
62
+ export default function Preview() {
115
63
  return (
116
- <div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
117
-
118
- {/* 0. Empty state — default built-in (messages={[]}) */}
119
- <div>
120
- <p className="text-caption text-muted mb-sm">
121
- Empty state — messages={"{[]}"} shows illustration + default copy
122
- </p>
123
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "420px" }}>
124
- <ChatScreen
125
- messages={[]}
126
- models={DEMO_MODELS}
127
- selectedModelId={modelId}
128
- onModelChange={setModelId}
129
- />
130
- </div>
131
- </div>
132
-
133
- {/* 0b. Empty state — custom title + description */}
134
- <div>
135
- <p className="text-caption text-muted mb-sm">
136
- Empty state — custom emptyTitle + emptyDescription props
137
- </p>
138
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "360px" }}>
139
- <ChatScreen
140
- messages={[]}
141
- emptyTitle="No messages yet"
142
- emptyDescription="Send your first message to get started building your design system."
143
- models={DEMO_MODELS}
144
- selectedModelId={modelId}
145
- onModelChange={setModelId}
146
- />
147
- </div>
148
- </div>
149
-
150
- {/* 0c. Empty state — custom emptyState node */}
151
- <div>
152
- <p className="text-caption text-muted mb-sm">
153
- Empty state — emptyState prop replaces built-in content entirely
154
- </p>
155
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "320px" }}>
156
- <ChatScreen
157
- messages={[]}
158
- emptyState={
159
- <div className="flex flex-col items-center gap-md text-center px-xl">
160
- <span className="text-xxl">🎨</span>
161
- <p className="text-heading-sm font-weight-heading-sm text-ink">Custom empty state</p>
162
- <p className="text-body-sm text-muted">You can pass any React node via the emptyState prop.</p>
163
- </div>
164
- }
165
- models={DEMO_MODELS}
166
- selectedModelId={modelId}
167
- onModelChange={setModelId}
168
- />
169
- </div>
170
- </div>
171
-
172
- {/* 1. Live-agent: inFlight + in_progress task + currentToolLabel */}
173
- <div>
174
- <p className="text-caption text-muted mb-sm">
175
- Live agent — inFlight bubble with spinner + in_progress task row (avatar center-aligned)
176
- </p>
177
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "480px" }}>
178
- <ChatScreen
179
- messages={LIVE_AGENT_MESSAGES}
180
- models={DEMO_MODELS}
181
- selectedModelId={modelId}
182
- onModelChange={setModelId}
183
- />
184
- </div>
185
- </div>
186
-
187
- {/* 2. postContent — text rendered after the plan card */}
188
- <div>
189
- <p className="text-caption text-muted mb-sm">
190
- postContent prop — additional text rendered below the plan card
191
- </p>
192
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "440px" }}>
193
- <ChatScreen
194
- messages={POST_CONTENT_MESSAGES}
195
- models={DEMO_MODELS}
196
- selectedModelId={modelId}
197
- onModelChange={setModelId}
198
- />
199
- </div>
200
- </div>
201
-
202
- {/* 3. Mixed statuses: done, failed, pending-hidden */}
203
- <div>
204
- <p className="text-caption text-muted mb-sm">
205
- Mixed task statuses — done (strikethrough), failed (red ✕), pending hidden
206
- </p>
207
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "400px" }}>
208
- <ChatScreen
209
- messages={MIXED_STATUS_MESSAGES}
210
- models={DEMO_MODELS}
211
- selectedModelId={modelId}
212
- onModelChange={setModelId}
213
- />
214
- </div>
215
- </div>
216
-
217
- {/* 4. Default message list + model selector (userInitials "DU") */}
218
- <div>
219
- <p className="text-caption text-muted mb-sm">Default message list + model selector (userInitials="DU") with postContent after plan card</p>
220
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "520px" }}>
221
- <ChatScreen
222
- models={DEMO_MODELS}
223
- selectedModelId={modelId}
224
- onModelChange={setModelId}
225
- />
226
- </div>
227
- </div>
228
-
229
- {/* 5. renderFooter — replaces the default PromptInputBar section entirely */}
230
- <div>
231
- <p className="text-caption text-muted mb-sm">renderFooter prop replaces the default PromptInputBar</p>
232
- <div className="rounded-xl border border-hairline overflow-hidden" style={{ height: "360px" }}>
233
- <ChatScreen renderFooter={<CustomFooter />} />
234
- </div>
235
- </div>
236
-
64
+ <div className="w-full max-w-3xl mx-auto" style={{ height: 640 }}>
65
+ <ChatScreen messages={messagesWithTimeline} placeholder="Ask anything…" />
237
66
  </div>
238
67
  );
239
68
  }
@@ -0,0 +1,322 @@
1
+ import React, { useState } from "react";
2
+ import { Modal } from "../Modal";
3
+ import { Button } from "../Button";
4
+ import { Chip } from "../Chip";
5
+ import { Typography } from "../Typography";
6
+
7
+ export type ExportDesignMdSource = "production" | "local";
8
+
9
+ export interface ExportDesignMdLine {
10
+ /** Raw text of this line (may be empty for a blank line) */
11
+ text: string;
12
+ /** Visual emphasis for the line */
13
+ tone?: "heading" | "default";
14
+ }
15
+
16
+ export interface ExportDesignMdModalProps {
17
+ /** Controls whether the modal is visible */
18
+ isOpen: boolean;
19
+ /** Called when the user dismisses the modal (backdrop, Esc, close, Cancel) */
20
+ onClose: () => void;
21
+ /** Called when the user confirms the export */
22
+ onExport?: () => void;
23
+ /** Called when the user downloads the .md file */
24
+ onDownload?: () => void;
25
+ /** Called when the user copies the preview to the clipboard */
26
+ onCopy?: () => void;
27
+ /** Name of the design system shown in the generated heading */
28
+ designSystemName?: string;
29
+ /** Which source tab is selected by default */
30
+ defaultSource?: ExportDesignMdSource;
31
+ /** Lines rendered in the code preview panel */
32
+ lines?: ExportDesignMdLine[];
33
+ }
34
+
35
+ // Note: token values below are written out as literal strings on purpose —
36
+ // this is a *documentation preview* of the project's own DESIGN.md export,
37
+ // so it must show the raw token names/values a consumer agent would read,
38
+ // not live-bound `var(--color-*)` references. Not a design-system violation.
39
+ const defaultLines: ExportDesignMdLine[] = [
40
+ { text: "# Design System", tone: "heading" },
41
+ { text: "" },
42
+ { text: "Design system generated by Atoms Design." },
43
+ { text: "Consume it via the npm registry." },
44
+ { text: "" },
45
+ {
46
+ text: "IMPORTANT: Read this skill file in full BEFORE editing any file in the consumer app.",
47
+ },
48
+ { text: "" },
49
+ {
50
+ text: "Use this skill whenever the user wants to add, change, fix, restyle, resize,",
51
+ },
52
+ { text: "extend, or audit UI in their app." },
53
+ { text: "" },
54
+ { text: "## 1. Colors", tone: "heading" },
55
+ { text: "" },
56
+ { text: "primary: {colors.primary}" },
57
+ { text: "on-primary: {colors.on-primary}" },
58
+ { text: "primary-hover: {colors.primary-hover}" },
59
+ { text: "primary-active: {colors.primary-active}" },
60
+ { text: "canvas: {colors.canvas}" },
61
+ { text: "surface: {colors.surface}" },
62
+ { text: "ink: {colors.ink}" },
63
+ { text: "body: {colors.body}" },
64
+ { text: "muted: {colors.muted}" },
65
+ { text: "hairline: {colors.hairline}" },
66
+ ];
67
+
68
+ const CloudIcon = () => (
69
+ <svg
70
+ viewBox="0 0 24 24"
71
+ width="16"
72
+ height="16"
73
+ fill="none"
74
+ stroke="currentColor"
75
+ strokeWidth="2"
76
+ strokeLinecap="round"
77
+ strokeLinejoin="round"
78
+ aria-hidden="true"
79
+ >
80
+ <path d="M17.5 19a4.5 4.5 0 0 0 0-9 5.5 5.5 0 0 0-10.8-1.5A4 4 0 0 0 6.5 16" />
81
+ <path d="M8 19h9.5" />
82
+ </svg>
83
+ );
84
+
85
+ const LinkIcon = () => (
86
+ <svg
87
+ viewBox="0 0 24 24"
88
+ width="16"
89
+ height="16"
90
+ fill="none"
91
+ stroke="currentColor"
92
+ strokeWidth="2"
93
+ strokeLinecap="round"
94
+ strokeLinejoin="round"
95
+ aria-hidden="true"
96
+ >
97
+ <path d="M9 17H7A5 5 0 0 1 7 7h2" />
98
+ <path d="M15 7h2a5 5 0 1 1 0 10h-2" />
99
+ <line x1="8" y1="12" x2="16" y2="12" />
100
+ </svg>
101
+ );
102
+
103
+ const CopyIcon = () => (
104
+ <svg
105
+ viewBox="0 0 24 24"
106
+ width="14"
107
+ height="14"
108
+ fill="none"
109
+ stroke="currentColor"
110
+ strokeWidth="2"
111
+ strokeLinecap="round"
112
+ strokeLinejoin="round"
113
+ aria-hidden="true"
114
+ >
115
+ <rect x="9" y="9" width="11" height="11" rx="2" />
116
+ <path d="M5 15V5a2 2 0 0 1 2-2h10" />
117
+ </svg>
118
+ );
119
+
120
+ const DownloadIcon = () => (
121
+ <svg
122
+ viewBox="0 0 24 24"
123
+ width="14"
124
+ height="14"
125
+ fill="none"
126
+ stroke="currentColor"
127
+ strokeWidth="2"
128
+ strokeLinecap="round"
129
+ strokeLinejoin="round"
130
+ aria-hidden="true"
131
+ >
132
+ <path d="M12 3v12" />
133
+ <path d="M7 10l5 5 5-5" />
134
+ <path d="M5 21h14" />
135
+ </svg>
136
+ );
137
+
138
+ export const ExportDesignMdModal = React.forwardRef<
139
+ HTMLDivElement,
140
+ ExportDesignMdModalProps
141
+ >(
142
+ (
143
+ {
144
+ isOpen,
145
+ onClose,
146
+ onExport,
147
+ onDownload,
148
+ onCopy,
149
+ designSystemName = "Design System",
150
+ defaultSource = "production",
151
+ lines = defaultLines,
152
+ },
153
+ ref
154
+ ) => {
155
+ const [source, setSource] = useState<ExportDesignMdSource>(defaultSource);
156
+
157
+ const handleCopy = () => {
158
+ const text = lines.map((l) => l.text).join("\n");
159
+ if (typeof navigator !== "undefined" && navigator.clipboard) {
160
+ navigator.clipboard.writeText(text).catch(() => {});
161
+ }
162
+ onCopy?.();
163
+ };
164
+
165
+ return (
166
+ <Modal
167
+ ref={ref}
168
+ isOpen={isOpen}
169
+ onClose={onClose}
170
+ title="Export DESIGN.md"
171
+ size="xl"
172
+ footer={
173
+ <div className="flex w-full items-center justify-between">
174
+ <Button variant="secondary" size="sm" onClick={onDownload}>
175
+ <DownloadIcon />
176
+ Download .md
177
+ </Button>
178
+ <div className="flex items-center gap-sm">
179
+ <Button variant="secondary" onClick={onClose}>
180
+ Cancel
181
+ </Button>
182
+ <Button variant="primary" onClick={onExport}>
183
+ Export
184
+ </Button>
185
+ </div>
186
+ </div>
187
+ }
188
+ >
189
+ <div className="w-full space-y-lg">
190
+ <Typography role="body-md" color="muted">
191
+ Generate and export the DESIGN.md file for handoff to AI coding
192
+ agents or your team.
193
+ </Typography>
194
+
195
+ {/* Source tabs */}
196
+ <div className="flex flex-wrap items-center justify-between gap-md">
197
+ <div className="inline-flex items-center gap-xs p-xxs bg-surface-soft border border-hairline rounded-md">
198
+ <Button
199
+ variant={source === "production" ? "primary" : "ghost"}
200
+ size="sm"
201
+ onClick={() => setSource("production")}
202
+ >
203
+ <CloudIcon />
204
+ Production
205
+ </Button>
206
+ <Button
207
+ variant={source === "local" ? "primary" : "ghost"}
208
+ size="sm"
209
+ onClick={() => setSource("local")}
210
+ >
211
+ <LinkIcon />
212
+ Local (npm link)
213
+ </Button>
214
+ </div>
215
+ <Typography role="body-sm" color="muted" className="flex-1 min-w-[16rem]">
216
+ {source === "production"
217
+ ? "Consumer apps install from the public npm registry ('npm install')."
218
+ : "Consumer apps resolve the package via a local 'npm link' during development."}
219
+ </Typography>
220
+ </div>
221
+
222
+ {/* Preview */}
223
+ <div>
224
+ <Typography
225
+ role="caption"
226
+ color="muted"
227
+ uppercase
228
+ className="mb-xs block"
229
+ >
230
+ Preview
231
+ </Typography>
232
+ <div className="relative w-full bg-canvas border border-hairline rounded-md overflow-hidden">
233
+ <Button
234
+ variant="secondary"
235
+ size="sm"
236
+ onClick={handleCopy}
237
+ className="absolute top-sm right-sm"
238
+ >
239
+ <CopyIcon />
240
+ Copy
241
+ </Button>
242
+ <div className="max-h-64 overflow-y-auto px-md py-sm font-mono text-body-sm">
243
+ {lines.map((line, i) => (
244
+ <div key={i} className="flex gap-md">
245
+ <span className="w-6 flex-shrink-0 text-right text-muted-soft select-none">
246
+ {i + 1}
247
+ </span>
248
+ <span
249
+ className={
250
+ line.tone === "heading"
251
+ ? "text-primary font-weight-heading-sm"
252
+ : "text-body"
253
+ }
254
+ >
255
+ {line.text.replace("Design System", designSystemName) ||
256
+ "\u00A0"}
257
+ </span>
258
+ </div>
259
+ ))}
260
+ </div>
261
+ </div>
262
+ </div>
263
+
264
+ {/* Storage options */}
265
+ <div className="w-full space-y-sm">
266
+ <div className="flex w-full items-center gap-md p-md bg-surface-soft border border-hairline rounded-md">
267
+ <span className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-sm bg-surface border border-hairline text-primary">
268
+ <CloudIcon />
269
+ </span>
270
+ <div className="min-w-0 flex-1">
271
+ <Typography role="body-md" color="ink" className="font-weight-heading-sm">
272
+ Production (npm install)
273
+ </Typography>
274
+ <Typography role="body-sm" color="muted">
275
+ Generated for public npm registry consumption.
276
+ </Typography>
277
+ </div>
278
+ {source === "production" ? (
279
+ <Chip label="Active" variant="primary" size="sm" />
280
+ ) : (
281
+ <Button
282
+ variant="secondary"
283
+ size="sm"
284
+ onClick={() => setSource("production")}
285
+ >
286
+ Switch
287
+ </Button>
288
+ )}
289
+ </div>
290
+
291
+ <div className="flex w-full items-center gap-md p-md bg-surface-soft border border-hairline rounded-md">
292
+ <span className="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-sm bg-surface border border-hairline text-muted">
293
+ <LinkIcon />
294
+ </span>
295
+ <div className="min-w-0 flex-1">
296
+ <Typography role="body-md" color="ink" className="font-weight-heading-sm">
297
+ Local (npm link)
298
+ </Typography>
299
+ <Typography role="body-sm" color="muted">
300
+ Generated for local development with npm link.
301
+ </Typography>
302
+ </div>
303
+ {source === "local" ? (
304
+ <Chip label="Active" variant="primary" size="sm" />
305
+ ) : (
306
+ <Button
307
+ variant="secondary"
308
+ size="sm"
309
+ onClick={() => setSource("local")}
310
+ >
311
+ Switch
312
+ </Button>
313
+ )}
314
+ </div>
315
+ </div>
316
+ </div>
317
+ </Modal>
318
+ );
319
+ }
320
+ );
321
+
322
+ ExportDesignMdModal.displayName = "ExportDesignMdModal";
@@ -0,0 +1,6 @@
1
+ export { ExportDesignMdModal } from "./ExportDesignMdModal";
2
+ export type {
3
+ ExportDesignMdModalProps,
4
+ ExportDesignMdSource,
5
+ ExportDesignMdLine,
6
+ } from "./ExportDesignMdModal";
@@ -0,0 +1,30 @@
1
+ import React, { useState } from "react";
2
+ import { ExportDesignMdModal } from "./ExportDesignMdModal";
3
+ import { Button } from "../Button";
4
+
5
+ export default function ExportDesignMdModalPreview() {
6
+ const [open, setOpen] = useState(false);
7
+
8
+ return (
9
+ <div className="w-full max-w-3xl mx-auto p-lg space-y-md">
10
+ <div>
11
+ <h2 className="text-heading-md text-ink">Export DESIGN.md</h2>
12
+ <p className="text-body-md text-muted mt-xs">
13
+ Opens a dialog for handing off the design system's token file to an
14
+ AI coding agent or teammate, with a source toggle and live preview.
15
+ </p>
16
+ </div>
17
+
18
+ <Button variant="primary" onClick={() => setOpen(true)}>
19
+ Export DESIGN.md
20
+ </Button>
21
+
22
+ <ExportDesignMdModal
23
+ isOpen={open}
24
+ onClose={() => setOpen(false)}
25
+ onExport={() => setOpen(false)}
26
+ onDownload={() => {}}
27
+ />
28
+ </div>
29
+ );
30
+ }
@@ -13,13 +13,14 @@ export interface ModalProps {
13
13
  /** Optional footer actions */
14
14
  footer?: React.ReactNode;
15
15
  /** Max-width variant */
16
- size?: "sm" | "md" | "lg";
16
+ size?: "sm" | "md" | "lg" | "xl";
17
17
  }
18
18
 
19
19
  const sizeMap: Record<NonNullable<ModalProps["size"]>, string> = {
20
20
  sm: "max-w-sm",
21
21
  md: "max-w-lg",
22
22
  lg: "max-w-2xl",
23
+ xl: "max-w-4xl",
23
24
  };
24
25
 
25
26
  export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
@@ -72,17 +73,23 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
72
73
  onClick={handleBackdropClick}
73
74
  className={[
74
75
  "fixed inset-0 flex items-center justify-center p-base",
75
- "bg-[var(--color-scrim)]/50",
76
+ "bg-[var(--color-scrim)]/60",
76
77
  "transition-opacity duration-250 ease-in-out",
77
78
  visible ? "opacity-100" : "opacity-0",
78
79
  ].join(" ")}
79
80
  style={{ zIndex: "var(--z-modal, 1000)" }}
80
81
  >
81
- {/* Panel */}
82
+ {/* Panel — bg-surface (not bg-canvas) so the panel visibly separates
83
+ from the page behind the scrim, especially in dark mode where
84
+ canvas and scrim are both near-black. A hairline border adds a
85
+ crisp edge since box-shadow alone reads as nearly invisible on
86
+ dark backgrounds. max-h-[90vh] caps the panel so content-heavy
87
+ modals never overflow the viewport — the body's overflow-y-auto
88
+ below lets long content scroll within that capped height. */}
82
89
  <div
83
90
  ref={ref}
84
91
  className={[
85
- "relative w-full bg-canvas rounded-lg",
92
+ "relative w-full max-h-[90vh] bg-surface border border-hairline rounded-lg",
86
93
  "shadow-[0_8px_40px_0_rgba(0,0,0,0.18)]",
87
94
  "flex flex-col overflow-hidden",
88
95
  sizeMap[size],