@designa8/vibedesign-v6 1.6.7

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.
Files changed (51) hide show
  1. package/README.md +66 -0
  2. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  3. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
  4. package/dist/index.cjs +3231 -0
  5. package/dist/index.js +3201 -0
  6. package/dist/styles.css +1810 -0
  7. package/package.json +109 -0
  8. package/src/atoms/AppLayout/AppLayout.tsx +537 -0
  9. package/src/atoms/AppLayout/index.ts +2 -0
  10. package/src/atoms/AppLayout/preview.tsx +75 -0
  11. package/src/atoms/AppSidebar/AppSidebar.tsx +399 -0
  12. package/src/atoms/AppSidebar/index.ts +2 -0
  13. package/src/atoms/AppSidebar/preview.tsx +214 -0
  14. package/src/atoms/AuthScreen/AuthScreen.tsx +226 -0
  15. package/src/atoms/AuthScreen/index.ts +2 -0
  16. package/src/atoms/AuthScreen/preview.tsx +10 -0
  17. package/src/atoms/Button/Button.tsx +71 -0
  18. package/src/atoms/Button/index.ts +2 -0
  19. package/src/atoms/Button/preview.tsx +71 -0
  20. package/src/atoms/ChatScreen/ChatScreen.tsx +629 -0
  21. package/src/atoms/ChatScreen/index.ts +2 -0
  22. package/src/atoms/ChatScreen/preview.tsx +239 -0
  23. package/src/atoms/Chip/Chip.tsx +121 -0
  24. package/src/atoms/Chip/index.ts +2 -0
  25. package/src/atoms/Chip/preview.tsx +99 -0
  26. package/src/atoms/FilterTabBar/FilterTabBar.tsx +95 -0
  27. package/src/atoms/FilterTabBar/index.ts +2 -0
  28. package/src/atoms/FilterTabBar/preview.tsx +92 -0
  29. package/src/atoms/Input/Input.tsx +139 -0
  30. package/src/atoms/Input/index.ts +2 -0
  31. package/src/atoms/Input/preview.tsx +97 -0
  32. package/src/atoms/Modal/Modal.tsx +144 -0
  33. package/src/atoms/Modal/index.ts +2 -0
  34. package/src/atoms/Modal/preview.tsx +111 -0
  35. package/src/atoms/NavItem/NavItem.tsx +316 -0
  36. package/src/atoms/NavItem/index.ts +2 -0
  37. package/src/atoms/NavItem/preview.tsx +125 -0
  38. package/src/atoms/PromptInputBar/PromptInputBar.tsx +626 -0
  39. package/src/atoms/PromptInputBar/index.ts +2 -0
  40. package/src/atoms/PromptInputBar/preview.tsx +85 -0
  41. package/src/atoms/TopNavbar/TopNavbar.tsx +400 -0
  42. package/src/atoms/TopNavbar/index.ts +2 -0
  43. package/src/atoms/TopNavbar/preview.tsx +117 -0
  44. package/src/atoms/UpgradeCard/UpgradeCard.tsx +65 -0
  45. package/src/atoms/UpgradeCard/index.ts +2 -0
  46. package/src/atoms/UpgradeCard/preview.tsx +25 -0
  47. package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +216 -0
  48. package/src/atoms/WorkspaceMenu/index.ts +2 -0
  49. package/src/atoms/WorkspaceMenu/preview.tsx +44 -0
  50. package/src/index.ts +16 -0
  51. package/src/tokens.css +165 -0
@@ -0,0 +1,85 @@
1
+ import React from "react";
2
+ import { PromptInputBar, PastedImage } from "./PromptInputBar";
3
+
4
+ // Stable placeholder images from picsum so the preview looks realistic
5
+ const SAMPLE_IMAGES: PastedImage[] = [
6
+ {
7
+ id: "img-1",
8
+ url: "https://picsum.photos/seed/ui1/160/160",
9
+ name: "screenshot.png",
10
+ },
11
+ {
12
+ id: "img-2",
13
+ url: "https://picsum.photos/seed/ui2/160/160",
14
+ name: "design-ref.jpg",
15
+ },
16
+ ];
17
+
18
+ const MODELS = [
19
+ { id: "gpt4o", name: "GPT-4o", tier: "Pro" },
20
+ { id: "claude", name: "Claude 3.5", tier: "Pro", description: "Best for long context" },
21
+ { id: "gemini", name: "Gemini 1.5" },
22
+ ];
23
+
24
+ /** Interactive demo: paste handling shown via pre-seeded images */
25
+ const WithImages = () => {
26
+ const [images, setImages] = React.useState<PastedImage[]>(SAMPLE_IMAGES);
27
+ const [text, setText] = React.useState("Can you update the hero section to match these screenshots?");
28
+
29
+ return (
30
+ <PromptInputBar
31
+ value={text}
32
+ onChange={setText}
33
+ pastedImages={images}
34
+ onImagesChange={setImages}
35
+ models={MODELS}
36
+ selectedModelId="gpt4o"
37
+ placeholder="Ask Lovable…"
38
+ />
39
+ );
40
+ };
41
+
42
+ /** Empty state — no images yet */
43
+ const Empty = () => (
44
+ <PromptInputBar
45
+ placeholder="Paste an image or type your prompt…"
46
+ models={MODELS}
47
+ selectedModelId="claude"
48
+ />
49
+ );
50
+
51
+ /** Streaming state with one image attached */
52
+ const Streaming = () => (
53
+ <PromptInputBar
54
+ value="Make the background gradient go from purple to pink"
55
+ pastedImages={[SAMPLE_IMAGES[0]]}
56
+ isStreaming
57
+ onStop={() => {}}
58
+ models={MODELS}
59
+ selectedModelId="gemini"
60
+ />
61
+ );
62
+
63
+ export default function Preview() {
64
+ return (
65
+ <div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
66
+ {/* Label + demo */}
67
+ <div className="space-y-sm">
68
+ <p className="text-body-sm text-muted">
69
+ With pasted images — hover a thumbnail to reveal the remove ×
70
+ </p>
71
+ <WithImages />
72
+ </div>
73
+
74
+ <div className="space-y-sm">
75
+ <p className="text-body-sm text-muted">Empty state — paste an image to try it</p>
76
+ <Empty />
77
+ </div>
78
+
79
+ <div className="space-y-sm">
80
+ <p className="text-body-sm text-muted">Streaming with an attached image</p>
81
+ <Streaming />
82
+ </div>
83
+ </div>
84
+ );
85
+ }
@@ -0,0 +1,400 @@
1
+ import React from "react";
2
+ import { Button } from "../Button";
3
+ import { WorkspaceMenu } from "../WorkspaceMenu";
4
+
5
+ // ---------------------------------------------------------------------------
6
+ // Version entry type — plain string OR rich object with optional metadata
7
+ // ---------------------------------------------------------------------------
8
+
9
+ export interface VersionEntry {
10
+ version: string;
11
+ publishedAt?: string; // ISO 8601 date string, e.g. "2024-01-15T10:30:00Z"
12
+ publishedBy?: string; // e.g. "Manual" | "Agent" | any label
13
+ }
14
+
15
+ /** Accepted shape for each version item: plain string or rich object */
16
+ export type VersionItem = string | VersionEntry;
17
+
18
+ // ---------------------------------------------------------------------------
19
+ // Relative-time helper — inline, no external library
20
+ // ---------------------------------------------------------------------------
21
+
22
+ function relativeTime(isoDate: string): string {
23
+ const then = new Date(isoDate).getTime();
24
+ if (isNaN(then)) return isoDate;
25
+ const diffMs = Date.now() - then;
26
+ const diffSec = Math.round(diffMs / 1000);
27
+ if (diffSec < 45) return "just now";
28
+ const diffMin = Math.round(diffSec / 60);
29
+ if (diffMin < 60) return diffMin === 1 ? "1 minute ago" : `${diffMin} minutes ago`;
30
+ const diffHr = Math.round(diffMin / 60);
31
+ if (diffHr < 24) return diffHr === 1 ? "1 hour ago" : `${diffHr} hours ago`;
32
+ const diffDay = Math.round(diffHr / 24);
33
+ if (diffDay < 30) return diffDay === 1 ? "1 day ago" : `${diffDay} days ago`;
34
+ const diffMonth = Math.round(diffDay / 30);
35
+ if (diffMonth < 12) return diffMonth === 1 ? "1 month ago" : `${diffMonth} months ago`;
36
+ const diffYear = Math.round(diffMonth / 12);
37
+ return diffYear === 1 ? "1 year ago" : `${diffYear} years ago`;
38
+ }
39
+
40
+ /** Extract the plain version label from a VersionItem */
41
+ function getVersionLabel(item: VersionItem): string {
42
+ return typeof item === "string" ? item : item.version;
43
+ }
44
+
45
+ // ---------------------------------------------------------------------------
46
+ // Shared icon sub-components (inline SVGs, matching WorkspaceMenu's style)
47
+ // ---------------------------------------------------------------------------
48
+
49
+ const ChevronIcon = ({ open }: { open: boolean }) => (
50
+ <svg
51
+ aria-hidden="true"
52
+ viewBox="0 0 24 24"
53
+ fill="none"
54
+ stroke="currentColor"
55
+ strokeWidth="2.5"
56
+ strokeLinecap="round"
57
+ strokeLinejoin="round"
58
+ style={{
59
+ width: "13px",
60
+ height: "13px",
61
+ flexShrink: 0,
62
+ transition: "transform 150ms ease",
63
+ transform: open ? "rotate(180deg)" : "rotate(0deg)",
64
+ }}
65
+ >
66
+ <polyline points="6 9 12 15 18 9" />
67
+ </svg>
68
+ );
69
+
70
+ // Sun icon — shown when dark mode is active (click to switch to light)
71
+ const SunIcon = () => (
72
+ <svg
73
+ aria-hidden="true"
74
+ viewBox="0 0 24 24"
75
+ fill="none"
76
+ stroke="currentColor"
77
+ strokeWidth="2"
78
+ strokeLinecap="round"
79
+ strokeLinejoin="round"
80
+ width="16"
81
+ height="16"
82
+ >
83
+ <circle cx="12" cy="12" r="5" />
84
+ <line x1="12" y1="1" x2="12" y2="3" />
85
+ <line x1="12" y1="21" x2="12" y2="23" />
86
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64" />
87
+ <line x1="18.36" y1="18.36" x2="19.78" y2="19.78" />
88
+ <line x1="1" y1="12" x2="3" y2="12" />
89
+ <line x1="21" y1="12" x2="23" y2="12" />
90
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36" />
91
+ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22" />
92
+ </svg>
93
+ );
94
+
95
+ // Moon icon — shown when dark mode is inactive (click to switch to dark)
96
+ const MoonIcon = () => (
97
+ <svg
98
+ aria-hidden="true"
99
+ viewBox="0 0 24 24"
100
+ fill="none"
101
+ stroke="currentColor"
102
+ strokeWidth="2"
103
+ strokeLinecap="round"
104
+ strokeLinejoin="round"
105
+ width="16"
106
+ height="16"
107
+ >
108
+ <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
109
+ </svg>
110
+ );
111
+
112
+ // ---------------------------------------------------------------------------
113
+ // VersionDropdown — styled & structured to match WorkspaceMenu's anatomy
114
+ // ---------------------------------------------------------------------------
115
+
116
+ interface VersionDropdownProps {
117
+ versions: VersionItem[];
118
+ selected: string;
119
+ onSelect: (v: string) => void;
120
+ }
121
+
122
+ const VersionDropdown: React.FC<VersionDropdownProps> = ({
123
+ versions,
124
+ selected,
125
+ onSelect,
126
+ }) => {
127
+ const [open, setOpen] = React.useState(false);
128
+ const containerRef = React.useRef<HTMLDivElement>(null);
129
+
130
+ // Close on outside click — mirrors WorkspaceMenu
131
+ React.useEffect(() => {
132
+ if (!open) return;
133
+ const handler = (e: MouseEvent) => {
134
+ if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
135
+ setOpen(false);
136
+ }
137
+ };
138
+ document.addEventListener("mousedown", handler);
139
+ return () => document.removeEventListener("mousedown", handler);
140
+ }, [open]);
141
+
142
+ // Close on Escape — mirrors WorkspaceMenu
143
+ React.useEffect(() => {
144
+ if (!open) return;
145
+ const handler = (e: KeyboardEvent) => {
146
+ if (e.key === "Escape") setOpen(false);
147
+ };
148
+ document.addEventListener("keydown", handler);
149
+ return () => document.removeEventListener("keydown", handler);
150
+ }, [open]);
151
+
152
+ return (
153
+ <div ref={containerRef} className="relative inline-block" style={{ zIndex: 50 }}>
154
+ {/* Trigger — matches WorkspaceMenu trigger shape */}
155
+ <Button
156
+ type="button"
157
+ variant="secondary"
158
+ size="sm"
159
+ aria-haspopup="listbox"
160
+ aria-expanded={open}
161
+ aria-label={`Select version: ${selected}`}
162
+ onClick={() => setOpen((v) => !v)}
163
+ className="!gap-sm !pr-sm"
164
+ style={{ minWidth: "120px" }}
165
+ >
166
+ <span className="flex-1 text-left truncate text-body-sm font-weight-heading-sm">
167
+ {selected}
168
+ </span>
169
+ <ChevronIcon open={open} />
170
+ </Button>
171
+
172
+ {/* Dropdown panel — matches WorkspaceMenu panel styling */}
173
+ {open && (
174
+ <ul
175
+ role="listbox"
176
+ aria-label="Select version"
177
+ className={[
178
+ "absolute right-0 mt-xs rounded-xl",
179
+ "bg-surface border border-hairline-soft shadow-card",
180
+ "py-xs overflow-y-auto overflow-x-hidden",
181
+ "z-50",
182
+ ].join(" ")}
183
+ style={{ minWidth: "220px", maxHeight: "350px" }}
184
+ >
185
+ {versions.map((item) => {
186
+ const label = getVersionLabel(item);
187
+ const entry = typeof item === "object" ? item : null;
188
+ const hasMetadata = entry && (entry.publishedAt || entry.publishedBy);
189
+
190
+ let metaLine: string | null = null;
191
+ if (hasMetadata) {
192
+ const parts: string[] = [];
193
+ if (entry.publishedAt) parts.push(relativeTime(entry.publishedAt));
194
+ if (entry.publishedBy) parts.push(entry.publishedBy);
195
+ metaLine = parts.join(" · ");
196
+ }
197
+
198
+ const isSelected = label === selected;
199
+
200
+ return (
201
+ <li
202
+ key={label}
203
+ role="option"
204
+ aria-selected={isSelected}
205
+ tabIndex={0}
206
+ onClick={() => { onSelect(label); setOpen(false); }}
207
+ onKeyDown={(e) => {
208
+ if (e.key === "Enter" || e.key === " ") { onSelect(label); setOpen(false); }
209
+ }}
210
+ className={[
211
+ "flex flex-col px-md cursor-pointer select-none",
212
+ "transition-colors duration-100",
213
+ metaLine ? "py-sm" : "py-xs",
214
+ isSelected
215
+ ? "bg-surface-soft text-primary"
216
+ : "text-ink hover:bg-surface-soft",
217
+ ].join(" ")}
218
+ >
219
+ <span className={["text-body-sm", isSelected ? "font-weight-heading-sm" : ""].join(" ").trim()}>
220
+ {label}
221
+ </span>
222
+ {metaLine && (
223
+ <span className="text-caption text-muted mt-xxs">{metaLine}</span>
224
+ )}
225
+ </li>
226
+ );
227
+ })}
228
+ </ul>
229
+ )}
230
+ </div>
231
+ );
232
+ };
233
+
234
+ // ---------------------------------------------------------------------------
235
+ // TopNavbar
236
+ // ---------------------------------------------------------------------------
237
+
238
+ export interface TopNavbarProps extends React.HTMLAttributes<HTMLElement> {
239
+ /** Initials shown in the avatar bubble */
240
+ avatarInitials?: string;
241
+ /** Current version label shown in the version pill */
242
+ version?: string;
243
+ /**
244
+ * Available versions for the dropdown.
245
+ * Each entry is either a plain string (backward-compatible) or a rich
246
+ * VersionEntry object with optional `publishedAt` and `publishedBy` metadata.
247
+ */
248
+ versions?: VersionItem[];
249
+ /** Called when "Export DESIGN.md" is clicked — button is only rendered when provided */
250
+ onExport?: () => void;
251
+ /** Called when "Publish" is clicked — button is only rendered when provided */
252
+ onPublish?: () => void;
253
+ /** Called when "Share" is clicked — button is only rendered when provided */
254
+ onShare?: () => void;
255
+ /** Called when a version is selected */
256
+ onVersionChange?: (v: string) => void;
257
+ /** Whether dark mode is currently active — controls which icon is shown (sun vs moon) */
258
+ darkMode?: boolean;
259
+ /**
260
+ * Callback fired when the dark mode toggle button is clicked.
261
+ * When omitted, the toggle button is not rendered.
262
+ */
263
+ onToggleDarkMode?: () => void;
264
+ }
265
+
266
+ export const TopNavbar = React.forwardRef<HTMLElement, TopNavbarProps>(
267
+ (
268
+ {
269
+ avatarInitials = "DU",
270
+ version = "Latest",
271
+ versions = ["Latest", "v1.2", "v1.1", "v1.0"],
272
+ onExport,
273
+ onPublish,
274
+ onShare,
275
+ onVersionChange,
276
+ darkMode = false,
277
+ onToggleDarkMode,
278
+ className,
279
+ ...rest
280
+ },
281
+ ref,
282
+ ) => {
283
+ const [selected, setSelected] = React.useState(version);
284
+
285
+ return (
286
+ <header
287
+ ref={ref}
288
+ className={[
289
+ "w-full bg-canvas border-b border-hairline",
290
+ "flex items-center justify-end gap-sm px-lg py-sm",
291
+ className,
292
+ ]
293
+ .filter(Boolean)
294
+ .join(" ")}
295
+ {...rest}
296
+ >
297
+ {/* Export DESIGN.md — only rendered when onExport is provided */}
298
+ {onExport && (
299
+ <Button variant="secondary" size="sm" onClick={onExport} aria-label="Export DESIGN.md">
300
+ <svg
301
+ aria-hidden="true"
302
+ width="15"
303
+ height="15"
304
+ viewBox="0 0 24 24"
305
+ fill="none"
306
+ stroke="currentColor"
307
+ strokeWidth="2"
308
+ strokeLinecap="round"
309
+ strokeLinejoin="round"
310
+ className="shrink-0"
311
+ >
312
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
313
+ <polyline points="14 2 14 8 20 8" />
314
+ <line x1="16" y1="13" x2="8" y2="13" />
315
+ <line x1="16" y1="17" x2="8" y2="17" />
316
+ </svg>
317
+ Export DESIGN.md
318
+ </Button>
319
+ )}
320
+
321
+ {/* Publish — only rendered when onPublish is provided */}
322
+ {onPublish && (
323
+ <Button variant="secondary" size="sm" onClick={onPublish} aria-label="Publish">
324
+ <svg
325
+ aria-hidden="true"
326
+ width="15"
327
+ height="15"
328
+ viewBox="0 0 24 24"
329
+ fill="none"
330
+ stroke="currentColor"
331
+ strokeWidth="2"
332
+ strokeLinecap="round"
333
+ strokeLinejoin="round"
334
+ className="shrink-0"
335
+ >
336
+ <polyline points="16 16 12 12 8 16" />
337
+ <line x1="12" y1="12" x2="12" y2="21" />
338
+ <path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" />
339
+ </svg>
340
+ Publish
341
+ </Button>
342
+ )}
343
+
344
+ {/* Version picker — WorkspaceMenu-aligned dropdown */}
345
+ <VersionDropdown
346
+ versions={versions}
347
+ selected={selected}
348
+ onSelect={(v) => {
349
+ setSelected(v);
350
+ onVersionChange?.(v);
351
+ }}
352
+ />
353
+
354
+ {/* Dark mode toggle — only rendered when onToggleDarkMode is provided */}
355
+ {onToggleDarkMode && (
356
+ <Button
357
+ type="button"
358
+ variant="ghost"
359
+ size="sm"
360
+ onClick={onToggleDarkMode}
361
+ aria-label={darkMode ? "Switch to light mode" : "Switch to dark mode"}
362
+ aria-pressed={darkMode}
363
+ className="!px-xs !py-xs"
364
+ >
365
+ {darkMode ? <SunIcon /> : <MoonIcon />}
366
+ </Button>
367
+ )}
368
+
369
+ {/* Share — only rendered when onShare is provided */}
370
+ {onShare && (
371
+ <Button variant="primary" size="sm" onClick={onShare}>
372
+ Share
373
+ </Button>
374
+ )}
375
+
376
+ {/* User avatar — circular identity trigger */}
377
+ <span
378
+ role="button"
379
+ tabIndex={0}
380
+ aria-label={`User menu — ${avatarInitials}`}
381
+ onKeyDown={(e) => {
382
+ if (e.key === "Enter" || e.key === " ") e.currentTarget.click();
383
+ }}
384
+ className={[
385
+ "inline-flex items-center justify-center shrink-0 cursor-pointer select-none",
386
+ "size-8 rounded-full bg-primary text-on-primary",
387
+ "text-caption font-weight-heading-sm uppercase",
388
+ "hover:bg-primary-hover active:bg-primary-active",
389
+ "transition-colors duration-150",
390
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-focus focus-visible:ring-offset-2",
391
+ ].join(" ")}
392
+ >
393
+ {avatarInitials.slice(0, 2)}
394
+ </span>
395
+ </header>
396
+ );
397
+ },
398
+ );
399
+
400
+ TopNavbar.displayName = "TopNavbar";
@@ -0,0 +1,2 @@
1
+ export { TopNavbar } from "./TopNavbar";
2
+ export type { TopNavbarProps } from "./TopNavbar";
@@ -0,0 +1,117 @@
1
+ import React from "react";
2
+ import { TopNavbar } from "./TopNavbar";
3
+
4
+ // Rich version entries — enough entries to trigger scrolling (> 350px list height)
5
+ const manyVersions = [
6
+ { version: "Latest", publishedAt: new Date(Date.now() - 1000 * 25).toISOString(), publishedBy: "Agent" },
7
+ { version: "v2.0", publishedAt: new Date(Date.now() - 1000 * 60 * 8).toISOString(), publishedBy: "Manual" },
8
+ { version: "v1.9", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 2).toISOString(), publishedBy: "Agent" },
9
+ { version: "v1.8", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 1).toISOString(), publishedBy: "Manual" },
10
+ { version: "v1.7", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 3).toISOString(), publishedBy: "Agent" },
11
+ { version: "v1.6", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 7).toISOString(), publishedBy: "Manual" },
12
+ { version: "v1.5", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 14).toISOString(), publishedBy: "Agent" },
13
+ { version: "v1.4", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 30).toISOString(), publishedBy: "Manual" },
14
+ { version: "v1.3", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 60).toISOString(), publishedBy: "Agent" },
15
+ { version: "v1.2", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 90).toISOString(), publishedBy: "Manual" },
16
+ { version: "v1.1", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 180).toISOString(), publishedBy: "Agent" },
17
+ { version: "v1.0", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 365).toISOString(), publishedBy: "Manual" },
18
+ ];
19
+
20
+ // Plain string versions — backward compat
21
+ const plainVersions = ["Latest", "v1.2", "v1.1", "v1.0"];
22
+
23
+ export default function TopNavbarPreview() {
24
+ const [published, setPublished] = React.useState(false);
25
+ const [darkMode, setDarkMode] = React.useState(false);
26
+
27
+ return (
28
+ <div className="w-full max-w-5xl mx-auto bg-surface-soft flex flex-col gap-xxl py-lg">
29
+
30
+ {/* 1. All actions + dark mode toggle (interactive) */}
31
+ <section className="flex flex-col gap-sm">
32
+ <p className="px-lg text-caption text-muted uppercase">
33
+ All actions · dark mode toggle · click the moon/sun icon
34
+ </p>
35
+ <TopNavbar
36
+ avatarInitials="DU"
37
+ version="Latest"
38
+ versions={manyVersions}
39
+ onExport={() => undefined}
40
+ onPublish={() => setPublished((p) => !p)}
41
+ onShare={() => undefined}
42
+ darkMode={darkMode}
43
+ onToggleDarkMode={() => setDarkMode((d) => !d)}
44
+ />
45
+ {published && (
46
+ <p className="px-lg text-body-sm text-semantic-success">Published!</p>
47
+ )}
48
+ <p className="px-lg text-caption text-muted">
49
+ Current mode: <span className="text-ink font-weight-heading-sm">{darkMode ? "Dark" : "Light"}</span>
50
+ </p>
51
+ </section>
52
+
53
+ {/* 2. Toggle shows sun (dark mode active) */}
54
+ <section className="flex flex-col gap-sm">
55
+ <p className="px-lg text-caption text-muted uppercase">
56
+ Dark mode active — sun icon shown
57
+ </p>
58
+ <TopNavbar
59
+ avatarInitials="DM"
60
+ version="v2.0"
61
+ versions={manyVersions}
62
+ onShare={() => undefined}
63
+ darkMode={true}
64
+ onToggleDarkMode={() => undefined}
65
+ />
66
+ </section>
67
+
68
+ {/* 3. Toggle shows moon (light mode active) */}
69
+ <section className="flex flex-col gap-sm">
70
+ <p className="px-lg text-caption text-muted uppercase">
71
+ Light mode active — moon icon shown
72
+ </p>
73
+ <TopNavbar
74
+ avatarInitials="LM"
75
+ version="v1.9"
76
+ versions={manyVersions}
77
+ onShare={() => undefined}
78
+ darkMode={false}
79
+ onToggleDarkMode={() => undefined}
80
+ />
81
+ </section>
82
+
83
+ {/* 4. No toggle (onToggleDarkMode omitted — button hidden) */}
84
+ <section className="flex flex-col gap-sm">
85
+ <p className="px-lg text-caption text-muted uppercase">
86
+ No dark mode toggle — onToggleDarkMode omitted
87
+ </p>
88
+ <TopNavbar
89
+ avatarInitials="RO"
90
+ version="v1.0"
91
+ versions={plainVersions}
92
+ />
93
+ </section>
94
+
95
+ {/* 5. Mixed — some entries have metadata, some are plain strings */}
96
+ <section className="flex flex-col gap-sm">
97
+ <p className="px-lg text-caption text-muted uppercase">
98
+ Mixed entries — rich objects + plain strings (backward compat)
99
+ </p>
100
+ <TopNavbar
101
+ avatarInitials="AB"
102
+ version="v1.1"
103
+ versions={[
104
+ { version: "Latest", publishedAt: new Date(Date.now() - 1000 * 30).toISOString(), publishedBy: "Agent" },
105
+ "v1.2",
106
+ { version: "v1.1", publishedAt: new Date(Date.now() - 1000 * 60 * 60 * 48).toISOString(), publishedBy: "Manual" },
107
+ "v1.0",
108
+ ]}
109
+ onShare={() => undefined}
110
+ darkMode={false}
111
+ onToggleDarkMode={() => undefined}
112
+ />
113
+ </section>
114
+
115
+ </div>
116
+ );
117
+ }
@@ -0,0 +1,65 @@
1
+ import React from "react";
2
+
3
+ export interface UpgradeCardProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ /** Small eyebrow label above the title */
5
+ eyebrow?: string;
6
+ /** Bold headline text */
7
+ title?: string;
8
+ /** Muted supporting text beneath the title */
9
+ subtitle?: string;
10
+ }
11
+
12
+ export const UpgradeCard = React.forwardRef<HTMLDivElement, UpgradeCardProps>(
13
+ (
14
+ {
15
+ eyebrow = "Card – Upgrade",
16
+ title = "Upgrade to Pro",
17
+ subtitle = "Unlock more features",
18
+ className,
19
+ ...rest
20
+ },
21
+ ref,
22
+ ) => (
23
+ <div
24
+ ref={ref}
25
+ className={["w-full", className].filter(Boolean).join(" ")}
26
+ {...rest}
27
+ >
28
+ {eyebrow && (
29
+ <p className="text-caption text-muted mb-md">{eyebrow}</p>
30
+ )}
31
+ <div className="rounded-xl bg-surface shadow-card px-md py-sm flex items-center justify-between gap-sm">
32
+ {/* Text block */}
33
+ <div className="flex flex-col gap-xxs min-w-0">
34
+ <span className="text-body-sm font-weight-heading-sm text-ink truncate">
35
+ {title}
36
+ </span>
37
+ <span className="text-caption text-muted truncate">{subtitle}</span>
38
+ </div>
39
+
40
+ {/* Icon chip — circular pale-violet with filled lightning bolt */}
41
+ <span
42
+ aria-hidden="true"
43
+ className="flex-shrink-0 flex items-center justify-center rounded-full"
44
+ style={{
45
+ width: "40px",
46
+ height: "40px",
47
+ backgroundColor: "color-mix(in srgb, var(--color-primary) 15%, transparent)",
48
+ }}
49
+ >
50
+ <svg
51
+ xmlns="http://www.w3.org/2000/svg"
52
+ viewBox="0 0 24 24"
53
+ fill="currentColor"
54
+ aria-hidden="true"
55
+ style={{ width: "18px", height: "18px", color: "var(--color-ink)" }}
56
+ >
57
+ <path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z" />
58
+ </svg>
59
+ </span>
60
+ </div>
61
+ </div>
62
+ ),
63
+ );
64
+
65
+ UpgradeCard.displayName = "UpgradeCard";
@@ -0,0 +1,2 @@
1
+ export { UpgradeCard } from "./UpgradeCard";
2
+ export type { UpgradeCardProps } from "./UpgradeCard";