@designa8/vibedesign-v6 1.8.4 → 1.9.4
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 +453 -141
- package/dist/index.js +452 -140
- package/dist/styles.css +101 -9
- package/package.json +6 -1
- package/src/atoms/AppLayout/AppLayout.tsx +219 -31
- package/src/atoms/ComponentCard/ComponentCard.tsx +150 -0
- package/src/atoms/ComponentCard/index.ts +2 -0
- package/src/atoms/ComponentCard/preview.tsx +111 -0
- package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +81 -67
- package/src/atoms/PreviewToolbar/preview.tsx +42 -16
- package/src/index.ts +1 -0
- package/src/tokens.css +12 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export type ComponentKind = "Atom" | "Molecule" | "Organism" | "Template";
|
|
4
|
+
|
|
5
|
+
const kindColors: Record<ComponentKind, string> = {
|
|
6
|
+
Atom: "bg-[var(--color-kind-atom-bg)] text-[var(--color-kind-atom-text)] border-[var(--color-kind-atom-border)]",
|
|
7
|
+
Molecule: "bg-[var(--color-kind-molecule-bg)] text-[var(--color-kind-molecule-text)] border-[var(--color-kind-molecule-border)]",
|
|
8
|
+
Organism: "bg-[var(--color-kind-organism-bg)] text-[var(--color-kind-organism-text)] border-[var(--color-kind-organism-border)]",
|
|
9
|
+
Template: "bg-[var(--color-kind-template-bg)] text-[var(--color-kind-template-text)] border-[var(--color-kind-template-border)]",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const iconBg: Record<ComponentKind, string> = {
|
|
13
|
+
Atom: "bg-[var(--color-kind-atom-bg)] text-[var(--color-kind-atom-text)]",
|
|
14
|
+
Molecule: "bg-primary text-on-primary",
|
|
15
|
+
Organism: "bg-primary text-on-primary",
|
|
16
|
+
Template: "bg-[var(--color-kind-template-bg)] text-[var(--color-kind-template-text)]",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export interface ComponentCardProps
|
|
20
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
/** Component display name */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Kind label shown in the badge */
|
|
24
|
+
kind?: ComponentKind;
|
|
25
|
+
/** Short description below the name */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Content rendered in the thumbnail preview area */
|
|
28
|
+
thumbnailContent?: React.ReactNode;
|
|
29
|
+
/** Override thumbnail background class */
|
|
30
|
+
thumbnailBg?: string;
|
|
31
|
+
/** Whether the card is in a selected/active state */
|
|
32
|
+
selected?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const ComponentCard = React.forwardRef<
|
|
36
|
+
HTMLDivElement,
|
|
37
|
+
ComponentCardProps
|
|
38
|
+
>(
|
|
39
|
+
(
|
|
40
|
+
{
|
|
41
|
+
name,
|
|
42
|
+
kind = "Organism",
|
|
43
|
+
description,
|
|
44
|
+
thumbnailContent,
|
|
45
|
+
thumbnailBg,
|
|
46
|
+
selected = false,
|
|
47
|
+
className,
|
|
48
|
+
...rest
|
|
49
|
+
},
|
|
50
|
+
ref,
|
|
51
|
+
) => {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
ref={ref}
|
|
55
|
+
className={[
|
|
56
|
+
"group relative flex flex-col rounded-xl bg-surface overflow-hidden",
|
|
57
|
+
"border border-hairline-soft",
|
|
58
|
+
"shadow-card",
|
|
59
|
+
"transition-all duration-200",
|
|
60
|
+
"hover:shadow-md hover:-translate-y-0.5 cursor-pointer",
|
|
61
|
+
selected ? "ring-2 ring-primary" : "",
|
|
62
|
+
className,
|
|
63
|
+
]
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.join(" ")}
|
|
66
|
+
{...rest}
|
|
67
|
+
>
|
|
68
|
+
{/* Thumbnail */}
|
|
69
|
+
<div
|
|
70
|
+
className={[
|
|
71
|
+
"relative flex items-center justify-center",
|
|
72
|
+
"w-full aspect-[4/3] overflow-hidden",
|
|
73
|
+
thumbnailBg ?? "bg-surface-soft",
|
|
74
|
+
].join(" ")}
|
|
75
|
+
>
|
|
76
|
+
{thumbnailContent ?? <DefaultThumbnail kind={kind} />}
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
{/* Footer */}
|
|
80
|
+
<div className="flex items-center justify-between px-md py-sm border-t border-hairline-soft bg-canvas">
|
|
81
|
+
<div className="flex flex-col gap-xxs min-w-0">
|
|
82
|
+
<span className="text-body-sm font-weight-heading-sm text-ink truncate">
|
|
83
|
+
{name}
|
|
84
|
+
</span>
|
|
85
|
+
<span className="text-caption text-muted truncate">
|
|
86
|
+
{description ?? `${kind} \u2022 Generated`}
|
|
87
|
+
</span>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<span
|
|
91
|
+
className={[
|
|
92
|
+
"ml-sm shrink-0 inline-flex items-center px-sm py-xs",
|
|
93
|
+
"rounded-md text-caption font-weight-heading-sm tracking-wide uppercase",
|
|
94
|
+
"border",
|
|
95
|
+
kindColors[kind],
|
|
96
|
+
].join(" ")}
|
|
97
|
+
>
|
|
98
|
+
{kind}
|
|
99
|
+
</span>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
ComponentCard.displayName = "ComponentCard";
|
|
107
|
+
|
|
108
|
+
/* ── Internal default thumbnail ── */
|
|
109
|
+
function DefaultThumbnail({ kind }: { kind: ComponentKind }) {
|
|
110
|
+
const icons: Record<ComponentKind, React.ReactNode> = {
|
|
111
|
+
Atom: (
|
|
112
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
113
|
+
<circle cx="12" cy="12" r="1" />
|
|
114
|
+
<path d="M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z" />
|
|
115
|
+
<path d="M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z" />
|
|
116
|
+
</svg>
|
|
117
|
+
),
|
|
118
|
+
Molecule: (
|
|
119
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
120
|
+
<rect x="2" y="2" width="8" height="8" rx="2" />
|
|
121
|
+
<rect x="14" y="2" width="8" height="8" rx="2" />
|
|
122
|
+
<rect x="2" y="14" width="8" height="8" rx="2" />
|
|
123
|
+
</svg>
|
|
124
|
+
),
|
|
125
|
+
Organism: (
|
|
126
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
127
|
+
<path d="M12 2L2 7l10 5 10-5-10-5z" />
|
|
128
|
+
<path d="M2 17l10 5 10-5" />
|
|
129
|
+
<path d="M2 12l10 5 10-5" />
|
|
130
|
+
</svg>
|
|
131
|
+
),
|
|
132
|
+
Template: (
|
|
133
|
+
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
134
|
+
<rect x="3" y="3" width="18" height="18" rx="2" />
|
|
135
|
+
<path d="M3 9h18M9 21V9" />
|
|
136
|
+
</svg>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<div
|
|
142
|
+
className={[
|
|
143
|
+
"flex items-center justify-center w-16 h-16 rounded-xl",
|
|
144
|
+
iconBg[kind],
|
|
145
|
+
].join(" ")}
|
|
146
|
+
>
|
|
147
|
+
{icons[kind]}
|
|
148
|
+
</div>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentCard } from "./ComponentCard";
|
|
3
|
+
|
|
4
|
+
/* A minimal mock thumbnail that resembles an auth screen preview */
|
|
5
|
+
function AuthThumbnail() {
|
|
6
|
+
return (
|
|
7
|
+
<div className="w-full h-full flex flex-col items-center justify-center gap-sm p-lg bg-surface-soft">
|
|
8
|
+
{/* Simulated card inside thumbnail */}
|
|
9
|
+
<div className="w-4/5 bg-canvas rounded-xl shadow-card flex flex-col items-center py-lg px-md gap-sm">
|
|
10
|
+
<div className="w-12 h-14 rounded-xl bg-primary flex items-center justify-center">
|
|
11
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="white" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
|
|
12
|
+
<path d="M12 2L2 7l10 5 10-5-10-5z" />
|
|
13
|
+
<path d="M2 17l10 5 10-5" />
|
|
14
|
+
<path d="M2 12l10 5 10-5" />
|
|
15
|
+
</svg>
|
|
16
|
+
</div>
|
|
17
|
+
<div className="w-3/4 h-2 rounded-xs bg-ink opacity-20" />
|
|
18
|
+
<div className="w-1/2 h-2 rounded-xs bg-muted opacity-30" />
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function InputThumbnail() {
|
|
25
|
+
return (
|
|
26
|
+
<div className="w-full h-full flex items-center justify-center bg-surface-soft p-lg">
|
|
27
|
+
<div className="w-4/5 flex flex-col gap-sm">
|
|
28
|
+
<div className="h-10 rounded-md bg-canvas border border-hairline flex items-center px-sm gap-sm">
|
|
29
|
+
<div className="w-3 h-3 rounded-xs bg-muted opacity-40" />
|
|
30
|
+
<div className="flex-1 h-2 rounded-xs bg-muted opacity-30" />
|
|
31
|
+
</div>
|
|
32
|
+
<div className="h-10 rounded-md bg-canvas border-2 border-primary flex items-center px-sm gap-sm">
|
|
33
|
+
<div className="flex-1 h-2 rounded-xs bg-ink opacity-40" />
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function ButtonThumbnail() {
|
|
41
|
+
return (
|
|
42
|
+
<div className="w-full h-full flex items-center justify-center gap-md bg-surface-soft p-lg flex-wrap">
|
|
43
|
+
<div className="h-9 px-md rounded-md bg-primary flex items-center">
|
|
44
|
+
<div className="w-16 h-2 rounded-xs bg-on-primary opacity-80" />
|
|
45
|
+
</div>
|
|
46
|
+
<div className="h-9 px-md rounded-md bg-canvas border border-hairline flex items-center">
|
|
47
|
+
<div className="w-12 h-2 rounded-xs bg-ink opacity-30" />
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function DashboardThumbnail() {
|
|
54
|
+
return (
|
|
55
|
+
<div className="w-full h-full flex bg-surface-soft overflow-hidden">
|
|
56
|
+
{/* Sidebar */}
|
|
57
|
+
<div className="w-1/4 bg-surface-strong h-full flex flex-col gap-xs p-sm">
|
|
58
|
+
{[1,2,3,4].map(i => (
|
|
59
|
+
<div key={i} className="h-2 rounded-xs bg-muted opacity-30" />
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
{/* Main */}
|
|
63
|
+
<div className="flex-1 p-sm flex flex-col gap-xs">
|
|
64
|
+
<div className="h-3 w-3/4 rounded-xs bg-ink opacity-20 mb-xs" />
|
|
65
|
+
<div className="flex gap-xs flex-1">
|
|
66
|
+
{[1,2,3].map(i => (
|
|
67
|
+
<div key={i} className="flex-1 rounded-md bg-canvas shadow-sm border border-hairline-soft" />
|
|
68
|
+
))}
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default function ComponentCardPreview() {
|
|
76
|
+
return (
|
|
77
|
+
<div className="w-full max-w-3xl mx-auto p-lg">
|
|
78
|
+
<p className="text-caption text-muted uppercase tracking-wide mb-lg">
|
|
79
|
+
Component Card — All kinds
|
|
80
|
+
</p>
|
|
81
|
+
|
|
82
|
+
<div className="grid grid-cols-2 gap-md">
|
|
83
|
+
<ComponentCard
|
|
84
|
+
name="Auth Screen"
|
|
85
|
+
kind="Organism"
|
|
86
|
+
description="Organism • Generated"
|
|
87
|
+
thumbnailContent={<AuthThumbnail />}
|
|
88
|
+
/>
|
|
89
|
+
<ComponentCard
|
|
90
|
+
name="Input"
|
|
91
|
+
kind="Atom"
|
|
92
|
+
description="Atom • Generated"
|
|
93
|
+
thumbnailContent={<InputThumbnail />}
|
|
94
|
+
/>
|
|
95
|
+
<ComponentCard
|
|
96
|
+
name="Prompt Input Bar"
|
|
97
|
+
kind="Molecule"
|
|
98
|
+
description="Molecule • Generated"
|
|
99
|
+
thumbnailContent={<ButtonThumbnail />}
|
|
100
|
+
/>
|
|
101
|
+
<ComponentCard
|
|
102
|
+
name="App Layout"
|
|
103
|
+
kind="Template"
|
|
104
|
+
description="Template • Generated"
|
|
105
|
+
thumbnailContent={<DashboardThumbnail />}
|
|
106
|
+
selected
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
@@ -97,6 +97,12 @@ export interface PreviewToolbarProps {
|
|
|
97
97
|
onInspectTokens?: () => void;
|
|
98
98
|
onFullscreen?: () => void;
|
|
99
99
|
onExpand?: () => void;
|
|
100
|
+
/**
|
|
101
|
+
* When true, the expand/arrows button renders with variant=primary and
|
|
102
|
+
* aria-pressed=true. None of the three viewport buttons appear active while
|
|
103
|
+
* expanded is true — only one selection indicator is shown at a time.
|
|
104
|
+
*/
|
|
105
|
+
expanded?: boolean;
|
|
100
106
|
/** Model name shown as a chip, e.g. "Sonnet 4.6" */
|
|
101
107
|
modelLabel?: string;
|
|
102
108
|
/** Component kind shown as a chip, e.g. "ATOM" */
|
|
@@ -140,6 +146,7 @@ export const PreviewToolbar = React.forwardRef<HTMLDivElement, PreviewToolbarPro
|
|
|
140
146
|
onInspectTokens,
|
|
141
147
|
onFullscreen,
|
|
142
148
|
onExpand,
|
|
149
|
+
expanded = false,
|
|
143
150
|
modelLabel = "Sonnet 4.6",
|
|
144
151
|
kindLabel = "ATOM",
|
|
145
152
|
onOverflow,
|
|
@@ -152,100 +159,107 @@ export const PreviewToolbar = React.forwardRef<HTMLDivElement, PreviewToolbarPro
|
|
|
152
159
|
role="toolbar"
|
|
153
160
|
aria-label="Preview toolbar"
|
|
154
161
|
className={[
|
|
155
|
-
|
|
162
|
+
// On mobile: flex column direction with wrapping rows; on md+: single inline-flex row
|
|
163
|
+
"flex flex-wrap items-center gap-sm px-sm py-xs",
|
|
164
|
+
"md:inline-flex md:flex-nowrap",
|
|
156
165
|
"bg-canvas border border-hairline rounded-xl shadow-md",
|
|
157
166
|
className,
|
|
158
167
|
].filter(Boolean).join(" ")}
|
|
159
168
|
>
|
|
160
|
-
{/* ── Viewport toggles ── */}
|
|
169
|
+
{/* ── Viewport toggles — own row on mobile ── */}
|
|
161
170
|
<div
|
|
162
171
|
role="group"
|
|
163
172
|
aria-label="Viewport size"
|
|
164
|
-
className="inline-flex items-center gap-xxs bg-surface-soft rounded-lg p-xxs"
|
|
173
|
+
className="inline-flex items-center gap-xxs bg-surface-soft rounded-lg p-xxs w-full md:w-auto"
|
|
165
174
|
>
|
|
166
175
|
{VIEWPORT_OPTIONS.map(({ id, Icon, label }) => (
|
|
167
176
|
<ViewportBtn
|
|
168
177
|
key={id}
|
|
169
178
|
label={label}
|
|
170
|
-
active={viewport === id}
|
|
179
|
+
active={!expanded && viewport === id}
|
|
171
180
|
onClick={() => onViewportChange?.(id)}
|
|
172
181
|
>
|
|
173
182
|
<Icon />
|
|
174
183
|
</ViewportBtn>
|
|
175
184
|
))}
|
|
176
185
|
|
|
177
|
-
<div className="w-px h-4 bg-hairline mx-xxs" aria-hidden />
|
|
178
|
-
|
|
179
186
|
<Button
|
|
180
|
-
variant="ghost"
|
|
187
|
+
variant={expanded ? "primary" : "ghost"}
|
|
181
188
|
size="sm"
|
|
182
189
|
aria-label="Expand preview"
|
|
190
|
+
aria-pressed={expanded}
|
|
183
191
|
onClick={onExpand}
|
|
184
|
-
className=
|
|
192
|
+
className={[
|
|
193
|
+
"!w-8 !h-8 !p-0 rounded-sm shrink-0",
|
|
194
|
+
expanded ? "" : "text-muted",
|
|
195
|
+
].join(" ")}
|
|
185
196
|
>
|
|
186
197
|
<ExpandIcon />
|
|
187
198
|
</Button>
|
|
188
199
|
</div>
|
|
189
200
|
|
|
190
|
-
{/* ──
|
|
191
|
-
<
|
|
192
|
-
variant
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
201
|
+
{/* ── Action buttons — wrap as a group below viewport row on mobile ── */}
|
|
202
|
+
<div className="flex flex-wrap items-center gap-sm">
|
|
203
|
+
{/* ── Inspect tokens button — variant and label driven by `inspecting` prop ── */}
|
|
204
|
+
<Button
|
|
205
|
+
variant={inspecting ? "primary" : "secondary"}
|
|
206
|
+
size="sm"
|
|
207
|
+
aria-pressed={inspecting}
|
|
208
|
+
onClick={onInspectTokens}
|
|
209
|
+
className="gap-xs rounded-xl"
|
|
210
|
+
>
|
|
211
|
+
<InspectIcon />
|
|
212
|
+
{inspecting ? "Exit inspect" : "Inspect tokens"}
|
|
213
|
+
</Button>
|
|
214
|
+
|
|
215
|
+
<Button
|
|
216
|
+
variant={darkMode ? "primary" : "secondary"}
|
|
217
|
+
size="sm"
|
|
218
|
+
aria-pressed={darkMode}
|
|
219
|
+
onClick={onDarkToggle}
|
|
220
|
+
className="gap-xs rounded-xl"
|
|
221
|
+
>
|
|
222
|
+
<MoonIcon />
|
|
223
|
+
Dark
|
|
224
|
+
</Button>
|
|
225
|
+
|
|
226
|
+
<Button
|
|
227
|
+
variant="secondary"
|
|
228
|
+
size="sm"
|
|
229
|
+
onClick={onFullscreen}
|
|
230
|
+
className="gap-xs rounded-xl"
|
|
231
|
+
>
|
|
232
|
+
<FullscreenIcon />
|
|
233
|
+
Fullscreen
|
|
234
|
+
</Button>
|
|
235
|
+
|
|
236
|
+
{/* ── Model chip (outlined primary style) ── */}
|
|
237
|
+
<Chip
|
|
238
|
+
label={modelLabel ?? ""}
|
|
239
|
+
variant="default"
|
|
240
|
+
size="md"
|
|
241
|
+
className="border-primary text-primary bg-canvas cursor-default select-none"
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
{/* ── Kind chip (filled soft primary) ── */}
|
|
245
|
+
<Chip
|
|
246
|
+
label={kindLabel ?? ""}
|
|
247
|
+
variant="default"
|
|
248
|
+
size="md"
|
|
249
|
+
className="bg-primary-disabled border-primary-disabled text-primary cursor-default select-none"
|
|
250
|
+
/>
|
|
251
|
+
|
|
252
|
+
{/* ── Overflow ── */}
|
|
253
|
+
<Button
|
|
254
|
+
variant="ghost"
|
|
255
|
+
size="sm"
|
|
256
|
+
aria-label="More options"
|
|
257
|
+
onClick={onOverflow}
|
|
258
|
+
className="!w-8 !h-8 !p-0 rounded-sm text-muted shrink-0"
|
|
259
|
+
>
|
|
260
|
+
<DotsIcon />
|
|
261
|
+
</Button>
|
|
262
|
+
</div>
|
|
249
263
|
</div>
|
|
250
264
|
),
|
|
251
265
|
);
|
|
@@ -5,6 +5,7 @@ export default function PreviewToolbarPreview() {
|
|
|
5
5
|
const [viewport, setViewport] = useState<Viewport>("desktop");
|
|
6
6
|
const [darkMode, setDarkMode] = useState(false);
|
|
7
7
|
const [inspecting, setInspecting] = useState(false);
|
|
8
|
+
const [expanded, setExpanded] = useState(false);
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
11
|
<div className="w-full max-w-5xl mx-auto p-lg space-y-xl">
|
|
@@ -12,13 +13,13 @@ export default function PreviewToolbarPreview() {
|
|
|
12
13
|
<div className="space-y-xxs">
|
|
13
14
|
<p className="text-body-sm text-muted uppercase tracking-wide">Preview toolbar</p>
|
|
14
15
|
<p className="text-body-sm text-muted">
|
|
15
|
-
Interactive — click the viewport icons, toggle Dark mode, and
|
|
16
|
+
Interactive — click the viewport icons, toggle Dark mode, Inspect tokens, and the Expand button.
|
|
16
17
|
</p>
|
|
17
18
|
</div>
|
|
18
19
|
|
|
19
20
|
{/* ── Interactive demo ─────────────────────────── */}
|
|
20
|
-
<div className="flex flex-col
|
|
21
|
-
<div className="flex items-
|
|
21
|
+
<div className="flex flex-col gap-lg">
|
|
22
|
+
<div className="flex items-start justify-center w-full bg-surface-soft rounded-xl p-xl border border-hairline">
|
|
22
23
|
<PreviewToolbar
|
|
23
24
|
viewport={viewport}
|
|
24
25
|
onViewportChange={setViewport}
|
|
@@ -26,8 +27,9 @@ export default function PreviewToolbarPreview() {
|
|
|
26
27
|
onDarkToggle={() => setDarkMode((d) => !d)}
|
|
27
28
|
inspecting={inspecting}
|
|
28
29
|
onInspectTokens={() => setInspecting((i) => !i)}
|
|
30
|
+
expanded={expanded}
|
|
31
|
+
onExpand={() => setExpanded((e) => !e)}
|
|
29
32
|
onFullscreen={() => {}}
|
|
30
|
-
onExpand={() => {}}
|
|
31
33
|
onOverflow={() => {}}
|
|
32
34
|
/>
|
|
33
35
|
</div>
|
|
@@ -35,31 +37,55 @@ export default function PreviewToolbarPreview() {
|
|
|
35
37
|
<p className="text-body-sm text-muted text-center">
|
|
36
38
|
Active viewport: <strong className="text-ink">{viewport}</strong> ·
|
|
37
39
|
Dark mode: <strong className="text-ink">{darkMode ? "on" : "off"}</strong> ·
|
|
38
|
-
Inspecting: <strong className="text-ink">{inspecting ? "on" : "off"}</strong>
|
|
40
|
+
Inspecting: <strong className="text-ink">{inspecting ? "on" : "off"}</strong> ·
|
|
41
|
+
Expanded: <strong className="text-ink">{expanded ? "on" : "off"}</strong>
|
|
39
42
|
</p>
|
|
40
43
|
</div>
|
|
41
44
|
|
|
42
|
-
{/* ──
|
|
45
|
+
{/* ── Mobile-wrap demo ─────────────────────────── */}
|
|
43
46
|
<div className="space-y-sm">
|
|
44
|
-
<p className="text-body-sm text-muted font-weight-heading-sm">
|
|
45
|
-
<
|
|
47
|
+
<p className="text-body-sm text-muted font-weight-heading-sm">Responsive wrap — narrow container (simulates mobile)</p>
|
|
48
|
+
<p className="text-body-sm text-muted-soft">
|
|
49
|
+
At widths below md/768px the viewport toggle group sits on its own row and the action buttons wrap below it.
|
|
50
|
+
</p>
|
|
51
|
+
{/* Full-width outer frame. The toolbar itself has className="w-full" so it fills its parent. */}
|
|
52
|
+
<div className="w-full max-w-3xl mx-auto p-lg bg-surface-soft rounded-xl border border-hairline flex justify-start">
|
|
53
|
+
{/* Inner phone-width frame to force wrapping in the preview */}
|
|
54
|
+
<div className="w-72 bg-canvas rounded-lg p-sm border border-hairline-soft">
|
|
55
|
+
<PreviewToolbar
|
|
56
|
+
viewport="mobile"
|
|
57
|
+
darkMode
|
|
58
|
+
inspecting
|
|
59
|
+
modelLabel="Sonnet 4.6"
|
|
60
|
+
kindLabel="ATOM"
|
|
61
|
+
className="w-full"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
{/* ── Variant: expanded=true ───────────────────── */}
|
|
68
|
+
<div className="space-y-sm">
|
|
69
|
+
<p className="text-body-sm text-muted font-weight-heading-sm">Expanded active (expanded=true) — viewport buttons deselected</p>
|
|
70
|
+
<div className="flex items-start justify-center w-full bg-canvas rounded-xl p-xl border border-hairline">
|
|
46
71
|
<PreviewToolbar
|
|
47
72
|
viewport="desktop"
|
|
48
|
-
|
|
73
|
+
expanded
|
|
49
74
|
modelLabel="Sonnet 4.6"
|
|
50
75
|
kindLabel="ATOM"
|
|
51
76
|
/>
|
|
52
77
|
</div>
|
|
53
78
|
</div>
|
|
54
79
|
|
|
55
|
-
{/* ── Variant:
|
|
80
|
+
{/* ── Variant: inspecting=true ─────────────────── */}
|
|
56
81
|
<div className="space-y-sm">
|
|
57
|
-
<p className="text-body-sm text-muted font-weight-heading-sm">
|
|
58
|
-
<div className="flex items-
|
|
82
|
+
<p className="text-body-sm text-muted font-weight-heading-sm">Inspecting active (inspecting=true)</p>
|
|
83
|
+
<div className="flex items-start justify-center w-full bg-canvas rounded-xl p-xl border border-hairline">
|
|
59
84
|
<PreviewToolbar
|
|
60
|
-
viewport="
|
|
61
|
-
|
|
62
|
-
|
|
85
|
+
viewport="desktop"
|
|
86
|
+
inspecting
|
|
87
|
+
modelLabel="Sonnet 4.6"
|
|
88
|
+
kindLabel="ATOM"
|
|
63
89
|
/>
|
|
64
90
|
</div>
|
|
65
91
|
</div>
|
|
@@ -67,7 +93,7 @@ export default function PreviewToolbarPreview() {
|
|
|
67
93
|
{/* ── Variant: dark mode on ───────────────────── */}
|
|
68
94
|
<div className="space-y-sm">
|
|
69
95
|
<p className="text-body-sm text-muted font-weight-heading-sm">Dark mode active</p>
|
|
70
|
-
<div className="flex items-
|
|
96
|
+
<div className="flex items-start justify-center w-full bg-canvas rounded-xl p-xl border border-hairline">
|
|
71
97
|
<PreviewToolbar
|
|
72
98
|
viewport="sidebar"
|
|
73
99
|
darkMode
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./atoms/AuthScreen";
|
|
|
6
6
|
export * from "./atoms/Button";
|
|
7
7
|
export * from "./atoms/ChatScreen";
|
|
8
8
|
export * from "./atoms/Chip";
|
|
9
|
+
export * from "./atoms/ComponentCard";
|
|
9
10
|
export * from "./atoms/FilterTabBar";
|
|
10
11
|
export * from "./atoms/Input";
|
|
11
12
|
export * from "./atoms/Modal";
|
package/src/tokens.css
CHANGED
|
@@ -36,6 +36,18 @@
|
|
|
36
36
|
--color-semantic-success-soft: #dcfce7;
|
|
37
37
|
--color-semantic-warning-soft: #fef9c3;
|
|
38
38
|
--color-semantic-error-soft: #fee2e2;
|
|
39
|
+
--color-kind-atom-bg: #E8F4FD;
|
|
40
|
+
--color-kind-atom-text: #2878C0;
|
|
41
|
+
--color-kind-atom-border: #B8D9F0;
|
|
42
|
+
--color-kind-molecule-bg: #F0EEFF;
|
|
43
|
+
--color-kind-molecule-text: #6B63D6;
|
|
44
|
+
--color-kind-molecule-border: #C8C3F5;
|
|
45
|
+
--color-kind-organism-bg: #E9F9EF;
|
|
46
|
+
--color-kind-organism-text: #15803D;
|
|
47
|
+
--color-kind-organism-border: #A7E0BE;
|
|
48
|
+
--color-kind-template-bg: #FEF3C7;
|
|
49
|
+
--color-kind-template-text: #B45309;
|
|
50
|
+
--color-kind-template-border: #FBD98A;
|
|
39
51
|
--font-body: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
40
52
|
--font-heading: var(--font-body);
|
|
41
53
|
--font-display-lg: var(--font-body);
|