@designa8/vibedesign-v6 1.9.6 → 1.10.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.
- package/README.md +1 -1
- package/dist/index.cjs +691 -162
- package/dist/index.js +677 -148
- package/dist/styles.css +46 -0
- package/package.json +11 -1
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +352 -0
- package/src/atoms/AppSidebarMobile/index.ts +2 -0
- package/src/atoms/AppSidebarMobile/preview.tsx +92 -0
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +330 -0
- package/src/atoms/HomePageTemplate/index.ts +2 -0
- package/src/atoms/HomePageTemplate/preview.tsx +21 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AppSidebar } from "../AppSidebar";
|
|
3
|
+
import type { NavEntry } from "../AppSidebar";
|
|
4
|
+
import { AppSidebarMobile } from "../AppSidebarMobile";
|
|
5
|
+
import { PromptInputBar } from "../PromptInputBar";
|
|
6
|
+
import { Button } from "../Button";
|
|
7
|
+
import type { PromptMode } from "../PromptInputBar";
|
|
8
|
+
|
|
9
|
+
/* ─── Icons ─────────────────────────────────────────────────────────────── */
|
|
10
|
+
|
|
11
|
+
const HomeIcon = () => (
|
|
12
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }} aria-hidden="true">
|
|
13
|
+
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
|
14
|
+
<polyline points="9 22 9 12 15 12 15 22" />
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const FolderIcon = () => (
|
|
19
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }} aria-hidden="true">
|
|
20
|
+
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" />
|
|
21
|
+
</svg>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const LogoIcon = () => (
|
|
25
|
+
<svg width="26" height="26" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
26
|
+
<path d="M12 36C12 36 8 28 16 22C20 19 26 20 26 20C26 20 22 26 18 30C16 32 12 36 12 36Z" style={{ fill: "var(--color-logo-orange)" }} />
|
|
27
|
+
<path d="M24 8C24 8 36 12 36 24C36 30 32 36 26 38C26 38 28 30 26 24C25 20 24 8 24 8Z" style={{ fill: "var(--color-logo-violet)" }} />
|
|
28
|
+
<path d="M12 36C12 36 16 24 24 20C28 18 36 20 36 20C36 20 30 28 26 32C22 36 12 36 12 36Z" style={{ fill: "var(--color-logo-pink)", opacity: 0.7 }} />
|
|
29
|
+
</svg>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const SparkleIcon = () => (
|
|
33
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" style={{ width: "14px", height: "14px" }} aria-hidden="true">
|
|
34
|
+
<path d="M12 2l2.4 7.4H22l-6.2 4.5 2.4 7.4L12 17 5.8 21.3l2.4-7.4L2 9.4h7.6z" />
|
|
35
|
+
</svg>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
/* ─── Suggestion Chip ────────────────────────────────────────────────────── */
|
|
39
|
+
interface SuggestionChipProps {
|
|
40
|
+
label: string;
|
|
41
|
+
onClick?: () => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const SuggestionChip: React.FC<SuggestionChipProps> = ({ label, onClick }) => (
|
|
45
|
+
<Button
|
|
46
|
+
type="button"
|
|
47
|
+
variant="secondary"
|
|
48
|
+
size="sm"
|
|
49
|
+
onClick={onClick}
|
|
50
|
+
className="!rounded-xl whitespace-nowrap"
|
|
51
|
+
>
|
|
52
|
+
{label}
|
|
53
|
+
</Button>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/* ─── Types ──────────────────────────────────────────────────────────────── */
|
|
57
|
+
|
|
58
|
+
export interface HomePageTemplateProps {
|
|
59
|
+
/** User's display name shown in the workspace menu */
|
|
60
|
+
userName?: string;
|
|
61
|
+
/** User initials for the footer avatar */
|
|
62
|
+
userInitials?: string;
|
|
63
|
+
/** Controlled prompt value */
|
|
64
|
+
promptValue?: string;
|
|
65
|
+
/** Called when prompt input changes */
|
|
66
|
+
onPromptChange?: (value: string) => void;
|
|
67
|
+
/** Current build mode */
|
|
68
|
+
mode?: PromptMode;
|
|
69
|
+
/** Called when mode changes */
|
|
70
|
+
onModeChange?: (mode: PromptMode) => void;
|
|
71
|
+
/** Called when the send button is clicked */
|
|
72
|
+
onSend?: (value: string) => void;
|
|
73
|
+
/** Suggestion chips to display below the prompt bar */
|
|
74
|
+
suggestions?: string[];
|
|
75
|
+
/** Called when a suggestion chip is clicked */
|
|
76
|
+
onSuggestionClick?: (label: string) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Override the default nav entries forwarded to AppSidebar / AppSidebarMobile.
|
|
79
|
+
* When omitted, the built-in NAV_ENTRIES are used.
|
|
80
|
+
*/
|
|
81
|
+
navEntries?: NavEntry[];
|
|
82
|
+
/**
|
|
83
|
+
* Override the internally-managed active nav entry id.
|
|
84
|
+
* When provided this value is forwarded to AppSidebar as `activeId`.
|
|
85
|
+
*/
|
|
86
|
+
activeId?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Called when the user selects a top-level nav entry.
|
|
89
|
+
* Fired in addition to the internal setActiveId update.
|
|
90
|
+
*/
|
|
91
|
+
onSelect?: (id: string) => void;
|
|
92
|
+
/** Forwarded to AppSidebar as `activeSubId`. */
|
|
93
|
+
activeSubId?: string;
|
|
94
|
+
/** Forwarded to AppSidebar as `onSubSelect`. */
|
|
95
|
+
onSubSelect?: (id: string) => void;
|
|
96
|
+
className?: string;
|
|
97
|
+
style?: React.CSSProperties;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* ─── Nav entries ────────────────────────────────────────────────────────── */
|
|
101
|
+
const NAV_ENTRIES: NavEntry[] = [
|
|
102
|
+
{ id: "home", label: "Home", icon: <HomeIcon /> },
|
|
103
|
+
{
|
|
104
|
+
id: "projects",
|
|
105
|
+
label: "All projects",
|
|
106
|
+
icon: <FolderIcon />,
|
|
107
|
+
subItems: [
|
|
108
|
+
{ id: "proj-1", label: "Design system" },
|
|
109
|
+
{ id: "proj-2", label: "Landing page" },
|
|
110
|
+
{ id: "proj-3", label: "Dashboard" },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
const DEFAULT_SUGGESTIONS = [
|
|
116
|
+
"Primary button atom",
|
|
117
|
+
"Brand color palette",
|
|
118
|
+
"Type scale",
|
|
119
|
+
"Card molecule",
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
/* ─── Gradient background ───────────────────────────────────────────────── */
|
|
123
|
+
const GRADIENT_BG = `
|
|
124
|
+
radial-gradient(ellipse 80% 60% at 30% 20%, var(--color-primary-disabled) 0%, transparent 55%),
|
|
125
|
+
radial-gradient(ellipse 60% 50% at 75% 80%, color-mix(in srgb, var(--color-logo-orange) 20%, transparent) 0%, transparent 55%),
|
|
126
|
+
radial-gradient(ellipse 70% 60% at 50% 50%, var(--color-surface-soft) 0%, transparent 70%),
|
|
127
|
+
var(--color-canvas)
|
|
128
|
+
`;
|
|
129
|
+
|
|
130
|
+
/* ─── Component ──────────────────────────────────────────────────────────── */
|
|
131
|
+
|
|
132
|
+
export const HomePageTemplate = React.forwardRef<HTMLDivElement, HomePageTemplateProps>(
|
|
133
|
+
(
|
|
134
|
+
{
|
|
135
|
+
userName = "Hello Designer",
|
|
136
|
+
userInitials = "N",
|
|
137
|
+
promptValue,
|
|
138
|
+
onPromptChange,
|
|
139
|
+
mode = "Build",
|
|
140
|
+
onModeChange,
|
|
141
|
+
onSend,
|
|
142
|
+
suggestions = DEFAULT_SUGGESTIONS,
|
|
143
|
+
onSuggestionClick,
|
|
144
|
+
navEntries,
|
|
145
|
+
activeId: activeIdProp,
|
|
146
|
+
onSelect,
|
|
147
|
+
activeSubId,
|
|
148
|
+
onSubSelect,
|
|
149
|
+
className,
|
|
150
|
+
style,
|
|
151
|
+
},
|
|
152
|
+
ref,
|
|
153
|
+
) => {
|
|
154
|
+
const [internalPrompt, setInternalPrompt] = React.useState("");
|
|
155
|
+
const [internalActiveId, setInternalActiveId] = React.useState("home");
|
|
156
|
+
|
|
157
|
+
// When activeIdProp is provided it controls the active entry; otherwise use internal state.
|
|
158
|
+
const resolvedActiveId = activeIdProp !== undefined ? activeIdProp : internalActiveId;
|
|
159
|
+
|
|
160
|
+
// The entries to hand down to both sidebar variants.
|
|
161
|
+
const resolvedEntries = navEntries !== undefined ? navEntries : NAV_ENTRIES;
|
|
162
|
+
|
|
163
|
+
const textValue = promptValue !== undefined ? promptValue : internalPrompt;
|
|
164
|
+
|
|
165
|
+
const handleChange = (val: string) => {
|
|
166
|
+
if (promptValue === undefined) setInternalPrompt(val);
|
|
167
|
+
onPromptChange?.(val);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const handleSend = (val: string) => {
|
|
171
|
+
onSend?.(val);
|
|
172
|
+
if (promptValue === undefined) setInternalPrompt("");
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const handleSuggestion = (label: string) => {
|
|
176
|
+
if (promptValue === undefined) setInternalPrompt(label);
|
|
177
|
+
onPromptChange?.(label);
|
|
178
|
+
onSuggestionClick?.(label);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// When the user selects a nav entry, always update internal state AND call the
|
|
182
|
+
// optional external onSelect callback.
|
|
183
|
+
const handleSelect = (id: string) => {
|
|
184
|
+
if (activeIdProp === undefined) setInternalActiveId(id);
|
|
185
|
+
onSelect?.(id);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<div
|
|
190
|
+
ref={ref}
|
|
191
|
+
className={["flex w-full", className].filter(Boolean).join(" ")}
|
|
192
|
+
style={{ width: "100%", height: "100%", background: "var(--color-canvas)", ...style }}
|
|
193
|
+
>
|
|
194
|
+
{/* ── Desktop sidebar — hidden on mobile ── */}
|
|
195
|
+
<div className="hidden md:flex flex-shrink-0" style={{ height: "100%" }}>
|
|
196
|
+
<AppSidebar
|
|
197
|
+
workspaceName={userName}
|
|
198
|
+
entries={resolvedEntries}
|
|
199
|
+
activeId={resolvedActiveId}
|
|
200
|
+
onSelect={handleSelect}
|
|
201
|
+
activeSubId={activeSubId}
|
|
202
|
+
onSubSelect={onSubSelect}
|
|
203
|
+
showShareCard={true}
|
|
204
|
+
showUpgradeCard={true}
|
|
205
|
+
userInitials={userInitials}
|
|
206
|
+
onInboxClick={() => {}}
|
|
207
|
+
style={{ height: "100%" }}
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
{/* ── Main canvas ── */}
|
|
212
|
+
<main
|
|
213
|
+
className="flex-1 relative flex flex-col overflow-hidden"
|
|
214
|
+
style={{ height: "100%" }}
|
|
215
|
+
aria-label="Home canvas"
|
|
216
|
+
>
|
|
217
|
+
{/* Gradient background */}
|
|
218
|
+
<div
|
|
219
|
+
aria-hidden="true"
|
|
220
|
+
className="absolute inset-0 pointer-events-none"
|
|
221
|
+
style={{ background: GRADIENT_BG }}
|
|
222
|
+
/>
|
|
223
|
+
|
|
224
|
+
{/* ── Mobile top bar — visible only on mobile ── */}
|
|
225
|
+
<div className="md:hidden relative z-10 flex items-center justify-between px-md py-sm border-b border-hairline bg-canvas">
|
|
226
|
+
<div className="flex items-center gap-sm">
|
|
227
|
+
<AppSidebarMobile
|
|
228
|
+
brandName="Atoms"
|
|
229
|
+
entries={resolvedEntries}
|
|
230
|
+
activeId={resolvedActiveId}
|
|
231
|
+
onSelect={handleSelect}
|
|
232
|
+
workspaceName={userName}
|
|
233
|
+
showShareCard={true}
|
|
234
|
+
showUpgradeCard={true}
|
|
235
|
+
userInitials={userInitials}
|
|
236
|
+
onInboxClick={() => {}}
|
|
237
|
+
/>
|
|
238
|
+
<div className="flex items-center gap-xs">
|
|
239
|
+
<LogoIcon />
|
|
240
|
+
<span className="text-body-sm font-weight-heading-sm text-ink">Atoms</span>
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
<span
|
|
244
|
+
className="flex items-center justify-center rounded-full bg-primary text-on-primary text-caption font-weight-heading-sm"
|
|
245
|
+
style={{ width: "32px", height: "32px" }}
|
|
246
|
+
aria-label="User profile"
|
|
247
|
+
>
|
|
248
|
+
{userInitials}
|
|
249
|
+
</span>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
{/* ── Content ── */}
|
|
253
|
+
<div className="relative z-10 flex-1 flex flex-col items-center justify-center overflow-auto">
|
|
254
|
+
<div className="w-full max-w-2xl mx-auto flex flex-col items-center gap-lg px-md py-xl md:gap-xl md:px-lg md:py-xxl">
|
|
255
|
+
|
|
256
|
+
{/* "New design system" pill */}
|
|
257
|
+
<Button
|
|
258
|
+
variant="secondary"
|
|
259
|
+
size="sm"
|
|
260
|
+
aria-label="New design system"
|
|
261
|
+
className="!rounded-full flex items-center gap-xs"
|
|
262
|
+
>
|
|
263
|
+
<SparkleIcon />
|
|
264
|
+
New design system
|
|
265
|
+
</Button>
|
|
266
|
+
|
|
267
|
+
{/* Headline */}
|
|
268
|
+
<div className="text-center flex flex-col gap-sm">
|
|
269
|
+
<h1
|
|
270
|
+
className="text-ink"
|
|
271
|
+
style={{
|
|
272
|
+
fontFamily: "var(--font-body)",
|
|
273
|
+
fontSize: "clamp(26px, 5vw, 52px)",
|
|
274
|
+
fontWeight: 700,
|
|
275
|
+
lineHeight: 1.1,
|
|
276
|
+
letterSpacing: "-0.03em",
|
|
277
|
+
}}
|
|
278
|
+
>
|
|
279
|
+
What atom should we
|
|
280
|
+
<br />
|
|
281
|
+
build?
|
|
282
|
+
</h1>
|
|
283
|
+
<p
|
|
284
|
+
className="text-muted text-body-sm md:text-body-md"
|
|
285
|
+
style={{ maxWidth: "440px", marginInline: "auto" }}
|
|
286
|
+
>
|
|
287
|
+
Start by describing an atom or design token — we'll scaffold a fresh project and the agent will build the first piece of your system.
|
|
288
|
+
</p>
|
|
289
|
+
</div>
|
|
290
|
+
|
|
291
|
+
{/* Prompt input */}
|
|
292
|
+
<div className="w-full">
|
|
293
|
+
<PromptInputBar
|
|
294
|
+
placeholder="Describe an atom or design token to create..."
|
|
295
|
+
value={textValue}
|
|
296
|
+
onChange={handleChange}
|
|
297
|
+
mode={mode}
|
|
298
|
+
onModeChange={onModeChange}
|
|
299
|
+
onSend={handleSend}
|
|
300
|
+
onMic={() => {}}
|
|
301
|
+
models={[
|
|
302
|
+
{ id: "claude-sonnet", name: "Claude Sonnet 4.6" },
|
|
303
|
+
{ id: "claude-haiku", name: "Claude Haiku 3.5", tier: "Fast" },
|
|
304
|
+
{ id: "claude-opus", name: "Claude Opus 4", tier: "Pro" },
|
|
305
|
+
]}
|
|
306
|
+
selectedModelId="claude-sonnet"
|
|
307
|
+
/>
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
{/* Suggestion chips */}
|
|
311
|
+
<div
|
|
312
|
+
className="flex flex-wrap justify-center gap-sm"
|
|
313
|
+
role="list"
|
|
314
|
+
aria-label="Suggested prompts"
|
|
315
|
+
>
|
|
316
|
+
{suggestions.map((s) => (
|
|
317
|
+
<div key={s} role="listitem">
|
|
318
|
+
<SuggestionChip label={s} onClick={() => handleSuggestion(s)} />
|
|
319
|
+
</div>
|
|
320
|
+
))}
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
</main>
|
|
325
|
+
</div>
|
|
326
|
+
);
|
|
327
|
+
},
|
|
328
|
+
);
|
|
329
|
+
|
|
330
|
+
HomePageTemplate.displayName = "HomePageTemplate";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HomePageTemplate } from "./HomePageTemplate";
|
|
3
|
+
|
|
4
|
+
export default function Preview() {
|
|
5
|
+
return (
|
|
6
|
+
/* w-full satisfies the linter; the inner style drives the true 100vh fill. */
|
|
7
|
+
<div className="w-full" style={{ height: "100vh", overflow: "hidden" }}>
|
|
8
|
+
<HomePageTemplate
|
|
9
|
+
userName="Hello Designer"
|
|
10
|
+
userInitials="N"
|
|
11
|
+
suggestions={[
|
|
12
|
+
"Primary button atom",
|
|
13
|
+
"Brand color palette",
|
|
14
|
+
"Type scale",
|
|
15
|
+
"Card molecule",
|
|
16
|
+
]}
|
|
17
|
+
style={{ width: "100%", height: "100%" }}
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,12 +2,14 @@ import "../dist/styles.css";
|
|
|
2
2
|
|
|
3
3
|
export * from "./atoms/AppLayout";
|
|
4
4
|
export * from "./atoms/AppSidebar";
|
|
5
|
+
export * from "./atoms/AppSidebarMobile";
|
|
5
6
|
export * from "./atoms/AuthScreen";
|
|
6
7
|
export * from "./atoms/Button";
|
|
7
8
|
export * from "./atoms/ChatScreen";
|
|
8
9
|
export * from "./atoms/Chip";
|
|
9
10
|
export * from "./atoms/ComponentCard";
|
|
10
11
|
export * from "./atoms/FilterTabBar";
|
|
12
|
+
export * from "./atoms/HomePageTemplate";
|
|
11
13
|
export * from "./atoms/Input";
|
|
12
14
|
export * from "./atoms/Modal";
|
|
13
15
|
export * from "./atoms/NavItem";
|