@designa8/vibedesign-v6 1.15.3 → 1.20.13
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 +6 -32
- package/dist/index.cjs +3232 -2143
- package/dist/index.js +3242 -2153
- package/dist/styles.css +266 -28
- package/package.json +52 -2
- package/src/atoms/AppLayout/AppLayout.tsx +401 -395
- package/src/atoms/AppLayout/preview.tsx +29 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +182 -94
- package/src/atoms/AppSidebar/preview.tsx +20 -59
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +27 -73
- package/src/atoms/AppSidebarMobile/preview.tsx +18 -18
- package/src/atoms/AuthLogin/AuthLogin.tsx +200 -0
- package/src/atoms/AuthLogin/index.ts +2 -0
- package/src/atoms/AuthLogin/preview.tsx +22 -0
- package/src/atoms/AuthScreen/AuthScreen.tsx +7 -7
- package/src/atoms/AuthSignUp/AuthSignUp.tsx +243 -0
- package/src/atoms/AuthSignUp/index.ts +2 -0
- package/src/atoms/AuthSignUp/preview.tsx +22 -0
- package/src/atoms/BillingToggle/BillingToggle.tsx +65 -0
- package/src/atoms/BillingToggle/index.ts +2 -0
- package/src/atoms/BillingToggle/preview.tsx +23 -0
- package/src/atoms/Button/Button.tsx +33 -17
- package/src/atoms/Button/preview.tsx +16 -0
- package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +370 -0
- package/src/atoms/ChatHistorySidebar/index.ts +2 -0
- package/src/atoms/ChatHistorySidebar/preview.tsx +60 -0
- package/src/atoms/ChatScreen/ChatScreen.tsx +331 -134
- package/src/atoms/ChatScreen/preview.tsx +123 -2
- package/src/atoms/Checkbox/Checkbox.tsx +89 -0
- package/src/atoms/Checkbox/index.ts +2 -0
- package/src/atoms/Checkbox/preview.tsx +60 -0
- package/src/atoms/Dropdown/Dropdown.tsx +195 -0
- package/src/atoms/Dropdown/index.ts +2 -0
- package/src/atoms/Dropdown/preview.tsx +56 -0
- package/src/atoms/ExportDesignMdModal/ExportDesignMdModal.tsx +46 -185
- package/src/atoms/ExportDesignMdModal/preview.tsx +24 -8
- package/src/atoms/FaqAccordionItem/FaqAccordionItem.tsx +60 -0
- package/src/atoms/FaqAccordionItem/index.ts +2 -0
- package/src/atoms/FaqAccordionItem/preview.tsx +26 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +8 -22
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +20 -33
- package/src/atoms/HomePageTemplate/preview.tsx +2 -2
- package/src/atoms/Icon/Icon.tsx +7 -5
- package/src/atoms/Icon/icons.data.ts +53 -0
- package/src/atoms/Input/Input.tsx +17 -9
- package/src/atoms/Input/preview.tsx +24 -25
- package/src/atoms/Menu/Menu.tsx +320 -0
- package/src/atoms/Menu/index.ts +2 -0
- package/src/atoms/Menu/preview.tsx +63 -0
- package/src/atoms/Modal/Modal.tsx +43 -37
- package/src/atoms/Modal/preview.tsx +13 -0
- package/src/atoms/NavItem/NavItem.tsx +33 -45
- package/src/atoms/NavItem/preview.tsx +21 -26
- package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +144 -192
- package/src/atoms/PreviewToolbar/preview.tsx +24 -4
- package/src/atoms/PricingCard/PricingCard.tsx +164 -0
- package/src/atoms/PricingCard/index.ts +2 -0
- package/src/atoms/PricingCard/preview.tsx +45 -0
- package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +219 -0
- package/src/atoms/PricingPageTemplate/index.ts +2 -0
- package/src/atoms/PricingPageTemplate/preview.tsx +10 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +117 -158
- package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +41 -167
- package/src/index.ts +10 -0
- package/src/tokens.css +5 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PromptInputBar, PromptMode, PromptInputBarModel } from "../PromptInputBar";
|
|
3
3
|
import { Button } from "../Button";
|
|
4
|
+
import { Icon } from "../Icon";
|
|
5
|
+
import { Modal } from "../Modal";
|
|
4
6
|
|
|
5
7
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
6
8
|
|
|
@@ -23,6 +25,30 @@ export interface AgentConversationMarkData {
|
|
|
23
25
|
onClick?: () => void;
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
export interface ChatMessageImage {
|
|
29
|
+
src: string;
|
|
30
|
+
alt?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ChatMessageSuggestedImageOption {
|
|
34
|
+
id: string;
|
|
35
|
+
src: string;
|
|
36
|
+
label: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ChatMessageSuggestedImage {
|
|
40
|
+
src: string;
|
|
41
|
+
alt?: string;
|
|
42
|
+
/** Label for the primary CTA button (single-design mockup case) */
|
|
43
|
+
ctaLabel: string;
|
|
44
|
+
/** Called when the primary CTA is clicked (single-design mockup case) */
|
|
45
|
+
onCta?: () => void;
|
|
46
|
+
/** When 2+ options are provided, renders a compact option strip + a selectable board in the lightbox */
|
|
47
|
+
options?: ChatMessageSuggestedImageOption[];
|
|
48
|
+
/** Called with the selected option's id when the user confirms "Create this design" */
|
|
49
|
+
onSelectOption?: (id: string) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
26
52
|
export interface ChatMessage {
|
|
27
53
|
id: string;
|
|
28
54
|
role: MessageRole;
|
|
@@ -41,6 +67,10 @@ export interface ChatMessage {
|
|
|
41
67
|
* Optional text rendered in a separate <p> AFTER the timeline block.
|
|
42
68
|
*/
|
|
43
69
|
postContent?: string;
|
|
70
|
+
/** Optional attached images — renders as a row of small thumbnails with a click-to-open lightbox */
|
|
71
|
+
images?: ChatMessageImage[];
|
|
72
|
+
/** Optional design-suggestion widget — a larger thumbnail (or option strip) that opens a fullscreen lightbox */
|
|
73
|
+
suggestedImage?: ChatMessageSuggestedImage;
|
|
44
74
|
}
|
|
45
75
|
|
|
46
76
|
export interface ChatScreenProps {
|
|
@@ -70,6 +100,11 @@ export interface ChatScreenProps {
|
|
|
70
100
|
onModelChange?: (modelId: string) => void;
|
|
71
101
|
className?: string;
|
|
72
102
|
|
|
103
|
+
/** Whether the "Suggest Designs" switch in the default footer's PromptInputBar is on. Unused when renderFooter is provided. */
|
|
104
|
+
suggestDesigns?: boolean;
|
|
105
|
+
/** Called when the "Suggest Designs" switch is toggled in the default footer. Unused when renderFooter is provided. */
|
|
106
|
+
onSuggestDesignsChange?: (on: boolean) => void;
|
|
107
|
+
|
|
73
108
|
// ── Empty-state props ──────────────────────────────────────────────────────
|
|
74
109
|
/** Title shown in the built-in empty state. Default: "Start the conversation" */
|
|
75
110
|
emptyTitle?: string;
|
|
@@ -90,16 +125,9 @@ const ChatEmptyIllustration: React.FC = () => (
|
|
|
90
125
|
aria-hidden="true"
|
|
91
126
|
style={{ width: 112 }}
|
|
92
127
|
>
|
|
93
|
-
<
|
|
94
|
-
viewBox="0 0 160 140"
|
|
95
|
-
|
|
96
|
-
height="98"
|
|
97
|
-
className="text-primary"
|
|
98
|
-
fill="currentColor"
|
|
99
|
-
style={{ opacity: 0.15, display: "block" }}
|
|
100
|
-
>
|
|
101
|
-
<path d="M78 8c28-6 52 10 58 34 6 24-6 44-4 62 2 16-14 30-36 32-26 2-48-8-62-28-12-18-22-42-10-58C36 30 52 14 78 8z" />
|
|
102
|
-
</svg>
|
|
128
|
+
<span className="text-primary" style={{ opacity: 0.15, display: "block" }}>
|
|
129
|
+
<Icon name="soft-organic-blob-decorative-background-" size={112} viewBox="0 0 160 140" style={{ width: 112, height: 98 }} />
|
|
130
|
+
</span>
|
|
103
131
|
|
|
104
132
|
<div className="absolute inset-0 flex items-center justify-center">
|
|
105
133
|
<div
|
|
@@ -130,18 +158,18 @@ const ChatEmptyIllustration: React.FC = () => (
|
|
|
130
158
|
</div>
|
|
131
159
|
</div>
|
|
132
160
|
|
|
133
|
-
<
|
|
134
|
-
<
|
|
135
|
-
</
|
|
136
|
-
<
|
|
137
|
-
<
|
|
138
|
-
</
|
|
139
|
-
<
|
|
140
|
-
<
|
|
141
|
-
</
|
|
142
|
-
<
|
|
143
|
-
<
|
|
144
|
-
</
|
|
161
|
+
<span className="absolute text-primary" style={{ left: 8, top: 16 }}>
|
|
162
|
+
<Icon name="sparkle" size={12} />
|
|
163
|
+
</span>
|
|
164
|
+
<span className="absolute text-primary" style={{ right: 12, top: 32 }}>
|
|
165
|
+
<Icon name="sparkle" size={10} />
|
|
166
|
+
</span>
|
|
167
|
+
<span className="absolute text-primary" style={{ left: 24, bottom: 24 }}>
|
|
168
|
+
<Icon name="sparkle" size={8} />
|
|
169
|
+
</span>
|
|
170
|
+
<span className="absolute text-primary" style={{ right: 8, bottom: 32 }}>
|
|
171
|
+
<Icon name="sparkle" size={14} />
|
|
172
|
+
</span>
|
|
145
173
|
</div>
|
|
146
174
|
);
|
|
147
175
|
|
|
@@ -160,7 +188,7 @@ const ChatEmptyStateContent: React.FC<{ title: string; description: string }> =
|
|
|
160
188
|
|
|
161
189
|
// ─── Timeline Sub-components ──────────────────────────────────────────────────
|
|
162
190
|
|
|
163
|
-
/** Returns a small
|
|
191
|
+
/** Returns a small icon for each TimelineItem kind */
|
|
164
192
|
const TimelineKindIcon: React.FC<{ kind: TimelineItem["kind"]; status: TimelineItem["status"] }> = ({
|
|
165
193
|
kind,
|
|
166
194
|
status,
|
|
@@ -172,43 +200,18 @@ const TimelineKindIcon: React.FC<{ kind: TimelineItem["kind"]; status: TimelineI
|
|
|
172
200
|
? "text-primary"
|
|
173
201
|
: "text-semantic-success";
|
|
174
202
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
<path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" />
|
|
188
|
-
</svg>
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
if (kind === "write") {
|
|
192
|
-
return (
|
|
193
|
-
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
194
|
-
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
195
|
-
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
|
|
196
|
-
</svg>
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
if (kind === "verify") {
|
|
200
|
-
return (
|
|
201
|
-
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
202
|
-
<polyline points="20 6 9 17 4 12" />
|
|
203
|
-
</svg>
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
// tool (default)
|
|
207
|
-
return (
|
|
208
|
-
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
209
|
-
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" />
|
|
210
|
-
</svg>
|
|
211
|
-
);
|
|
203
|
+
const iconName =
|
|
204
|
+
kind === "thinking"
|
|
205
|
+
? "clock-thinking"
|
|
206
|
+
: kind === "read"
|
|
207
|
+
? "read-open-book-document"
|
|
208
|
+
: kind === "write"
|
|
209
|
+
? "pencil-edit"
|
|
210
|
+
: kind === "verify"
|
|
211
|
+
? "check-checkmark"
|
|
212
|
+
: "wrench-tool";
|
|
213
|
+
|
|
214
|
+
return <Icon name={iconName} size={14} className={colorClass} />;
|
|
212
215
|
};
|
|
213
216
|
|
|
214
217
|
/** Left-border vertical line for a timeline row */
|
|
@@ -237,9 +240,7 @@ const TimelineRow: React.FC<{
|
|
|
237
240
|
style={{ width: 20, height: 20 }}
|
|
238
241
|
>
|
|
239
242
|
{item.status === "running" ? (
|
|
240
|
-
<
|
|
241
|
-
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
242
|
-
</svg>
|
|
243
|
+
<Icon name="loading-spinner" size={10} strokeWidth={2.5} className="text-primary animate-spin" />
|
|
243
244
|
) : (
|
|
244
245
|
<TimelineKindIcon kind={item.kind} status={item.status} />
|
|
245
246
|
)}
|
|
@@ -296,9 +297,7 @@ const TimelineBlock: React.FC<{ items: TimelineItem[] }> = ({ items }) => {
|
|
|
296
297
|
{/* Latest item icon */}
|
|
297
298
|
<span className="flex-shrink-0 flex items-center justify-center" style={{ width: 20, height: 20 }}>
|
|
298
299
|
{latestItem.status === "running" ? (
|
|
299
|
-
<
|
|
300
|
-
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
301
|
-
</svg>
|
|
300
|
+
<Icon name="loading-spinner" size={12} strokeWidth={2.5} className="text-primary animate-spin" />
|
|
302
301
|
) : (
|
|
303
302
|
<TimelineKindIcon kind={latestItem.kind} status={latestItem.status} />
|
|
304
303
|
)}
|
|
@@ -316,21 +315,12 @@ const TimelineBlock: React.FC<{ items: TimelineItem[] }> = ({ items }) => {
|
|
|
316
315
|
|
|
317
316
|
{/* Chevron */}
|
|
318
317
|
{hasMore && (
|
|
319
|
-
<
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
height="14"
|
|
323
|
-
fill="none"
|
|
324
|
-
stroke="currentColor"
|
|
325
|
-
strokeWidth="2"
|
|
326
|
-
strokeLinecap="round"
|
|
327
|
-
strokeLinejoin="round"
|
|
318
|
+
<Icon
|
|
319
|
+
name="chevron-down"
|
|
320
|
+
size={14}
|
|
328
321
|
className="text-muted flex-shrink-0 transition-transform duration-200"
|
|
329
322
|
style={{ transform: expanded ? "rotate(180deg)" : "rotate(0deg)" }}
|
|
330
|
-
|
|
331
|
-
>
|
|
332
|
-
<polyline points="6 9 12 15 18 9" />
|
|
333
|
-
</svg>
|
|
323
|
+
/>
|
|
334
324
|
)}
|
|
335
325
|
</Button>
|
|
336
326
|
|
|
@@ -348,27 +338,6 @@ const TimelineBlock: React.FC<{ items: TimelineItem[] }> = ({ items }) => {
|
|
|
348
338
|
|
|
349
339
|
// ─── AgentConversationMark ─────────────────────────────────────────────────────
|
|
350
340
|
|
|
351
|
-
/** Two-person icon used inside the AgentConversationMark pill */
|
|
352
|
-
const AgentConversationIcon: React.FC = () => (
|
|
353
|
-
<svg
|
|
354
|
-
viewBox="0 0 24 24"
|
|
355
|
-
width="12"
|
|
356
|
-
height="12"
|
|
357
|
-
fill="none"
|
|
358
|
-
stroke="currentColor"
|
|
359
|
-
strokeWidth="2"
|
|
360
|
-
strokeLinecap="round"
|
|
361
|
-
strokeLinejoin="round"
|
|
362
|
-
className="flex-shrink-0"
|
|
363
|
-
aria-hidden="true"
|
|
364
|
-
>
|
|
365
|
-
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" />
|
|
366
|
-
<circle cx="9" cy="7" r="4" />
|
|
367
|
-
<path d="M23 21v-2a4 4 0 0 0-3-3.87" />
|
|
368
|
-
<path d="M16 3.13a4 4 0 0 1 0 7.75" />
|
|
369
|
-
</svg>
|
|
370
|
-
);
|
|
371
|
-
|
|
372
341
|
/**
|
|
373
342
|
* Small linkable pill shown on a message to mark that it references or was
|
|
374
343
|
* forked from another agent conversation. Renders as a real <a> when `href`
|
|
@@ -385,7 +354,7 @@ const AgentConversationMark: React.FC<{
|
|
|
385
354
|
<div className={["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" ")}>
|
|
386
355
|
{mark.href ? (
|
|
387
356
|
<a href={mark.href} className={pillClasses}>
|
|
388
|
-
<
|
|
357
|
+
<Icon name="two-people-users-group" size={12} />
|
|
389
358
|
{mark.label}
|
|
390
359
|
</a>
|
|
391
360
|
) : (
|
|
@@ -396,7 +365,7 @@ const AgentConversationMark: React.FC<{
|
|
|
396
365
|
onClick={mark.onClick}
|
|
397
366
|
className="!inline-flex !items-center !gap-xs !rounded-full !bg-canvas !px-sm !py-xxs !text-caption !font-weight-heading-sm !text-primary !shadow-sm hover:!bg-surface-soft"
|
|
398
367
|
>
|
|
399
|
-
<
|
|
368
|
+
<Icon name="two-people-users-group" size={12} />
|
|
400
369
|
{mark.label}
|
|
401
370
|
</Button>
|
|
402
371
|
)}
|
|
@@ -404,6 +373,229 @@ const AgentConversationMark: React.FC<{
|
|
|
404
373
|
);
|
|
405
374
|
};
|
|
406
375
|
|
|
376
|
+
// ─── Message image thumbnail row + lightbox ───────────────────────────────────
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Renders a message's attached images as a compact, wrapping row of small
|
|
380
|
+
* square thumbnails — sits OUTSIDE any text bubble, as a sibling belonging
|
|
381
|
+
* to the same message. Each thumbnail is a Button that opens a shared
|
|
382
|
+
* lightbox Modal showing the full image.
|
|
383
|
+
*/
|
|
384
|
+
const MessageImageGallery: React.FC<{ images: ChatMessageImage[]; align?: "start" | "end" }> = ({
|
|
385
|
+
images,
|
|
386
|
+
align = "start",
|
|
387
|
+
}) => {
|
|
388
|
+
const [lightboxIndex, setLightboxIndex] = React.useState<number | null>(null);
|
|
389
|
+
|
|
390
|
+
return (
|
|
391
|
+
<div
|
|
392
|
+
className={[
|
|
393
|
+
"flex flex-wrap gap-xs mt-sm",
|
|
394
|
+
align === "end" ? "justify-end" : "justify-start",
|
|
395
|
+
].join(" ")}
|
|
396
|
+
>
|
|
397
|
+
{images.map((image, index) => (
|
|
398
|
+
<Button
|
|
399
|
+
key={index}
|
|
400
|
+
type="button"
|
|
401
|
+
variant="ghost"
|
|
402
|
+
pushEffect={false}
|
|
403
|
+
className="group relative block !p-0 h-16 w-16 min-h-16 min-w-16 flex-shrink-0 overflow-hidden rounded-sm bg-surface-strong border-0"
|
|
404
|
+
onClick={() => setLightboxIndex(index)}
|
|
405
|
+
aria-label={image.alt ?? `Open image ${index + 1}`}
|
|
406
|
+
>
|
|
407
|
+
<img
|
|
408
|
+
src={image.src}
|
|
409
|
+
alt={image.alt ?? ""}
|
|
410
|
+
className="w-full h-full object-cover transition-transform duration-150 group-hover:scale-105"
|
|
411
|
+
/>
|
|
412
|
+
</Button>
|
|
413
|
+
))}
|
|
414
|
+
|
|
415
|
+
<Modal
|
|
416
|
+
isOpen={lightboxIndex !== null}
|
|
417
|
+
onClose={() => setLightboxIndex(null)}
|
|
418
|
+
size="lg"
|
|
419
|
+
>
|
|
420
|
+
{lightboxIndex !== null && (
|
|
421
|
+
<img
|
|
422
|
+
src={images[lightboxIndex].src}
|
|
423
|
+
alt={images[lightboxIndex].alt ?? ""}
|
|
424
|
+
className="w-full h-full object-contain rounded-sm mx-auto"
|
|
425
|
+
style={{ maxHeight: "min(70vh, 32rem)" }}
|
|
426
|
+
/>
|
|
427
|
+
)}
|
|
428
|
+
</Modal>
|
|
429
|
+
</div>
|
|
430
|
+
);
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// ─── Suggested-design widget (larger thumbnail → fullscreen lightbox) ─────────
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Renders a design-suggestion widget in an AI bubble: a larger thumbnail
|
|
437
|
+
* (single mockup or a compact option strip when 2+ options are supplied)
|
|
438
|
+
* that opens a full-viewport Modal lightbox.
|
|
439
|
+
*
|
|
440
|
+
* Single-mockup case (0–1 options): full image + primary CTA under the
|
|
441
|
+
* thumbnail and again in the modal footer (existing ctaLabel/onCta).
|
|
442
|
+
*
|
|
443
|
+
* Multi-option case (2+ options): the modal shows a "Pick a design" title
|
|
444
|
+
* with an explanatory subtitle, three equal-width columns (each filling the
|
|
445
|
+
* full body height) — one per option — with no caption/label under the
|
|
446
|
+
* image. Nothing is selected when the modal opens; picking a card highlights
|
|
447
|
+
* it with a primary-colored border and enables the "Create this design"
|
|
448
|
+
* footer button, which calls onSelectOption with the chosen id and closes.
|
|
449
|
+
* "Not now" always closes without selecting.
|
|
450
|
+
*/
|
|
451
|
+
const SuggestedImageWidget: React.FC<{ suggestedImage: ChatMessageSuggestedImage }> = ({
|
|
452
|
+
suggestedImage,
|
|
453
|
+
}) => {
|
|
454
|
+
const { src, alt, ctaLabel, onCta, options, onSelectOption } = suggestedImage;
|
|
455
|
+
const hasOptions = !!options && options.length >= 2;
|
|
456
|
+
|
|
457
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
458
|
+
const [selectedId, setSelectedId] = React.useState<string | undefined>(undefined);
|
|
459
|
+
|
|
460
|
+
const handleClose = () => {
|
|
461
|
+
setIsOpen(false);
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
const handleConfirm = () => {
|
|
465
|
+
if (selectedId) {
|
|
466
|
+
onSelectOption?.(selectedId);
|
|
467
|
+
}
|
|
468
|
+
setIsOpen(false);
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
// Reset the selection each time the widget is reopened so a previous pick
|
|
472
|
+
// doesn't linger across sessions.
|
|
473
|
+
const handleOpen = () => {
|
|
474
|
+
setSelectedId(undefined);
|
|
475
|
+
setIsOpen(true);
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
return (
|
|
479
|
+
<div className="mt-md">
|
|
480
|
+
{/* Trigger thumbnail — a small chat-bubble attachment, capped so it
|
|
481
|
+
doesn't overtake the whole message column. This wrapper sits nested
|
|
482
|
+
well inside the always-w-full ChatScreen root, so it is not the
|
|
483
|
+
composed root the width linter cares about. */}
|
|
484
|
+
<Button
|
|
485
|
+
type="button"
|
|
486
|
+
variant="ghost"
|
|
487
|
+
pushEffect={false}
|
|
488
|
+
onClick={handleOpen}
|
|
489
|
+
className="group relative block !p-0 max-w-full overflow-hidden rounded-lg bg-surface-strong border border-hairline"
|
|
490
|
+
style={{ maxHeight: "14rem", width: "20rem" }}
|
|
491
|
+
aria-label={alt ?? "Open design suggestion"}
|
|
492
|
+
>
|
|
493
|
+
<img
|
|
494
|
+
src={src}
|
|
495
|
+
alt={alt ?? ""}
|
|
496
|
+
className="w-full object-cover transition-transform duration-150 group-hover:scale-[1.02]"
|
|
497
|
+
style={{ maxHeight: "14rem" }}
|
|
498
|
+
/>
|
|
499
|
+
{hasOptions && (
|
|
500
|
+
<div className="flex gap-xs p-xs bg-canvas border-t border-hairline">
|
|
501
|
+
{options!.slice(0, 3).map((opt) => (
|
|
502
|
+
<img
|
|
503
|
+
key={opt.id}
|
|
504
|
+
src={opt.src}
|
|
505
|
+
alt={opt.label}
|
|
506
|
+
className="h-10 w-10 flex-shrink-0 rounded-sm object-cover border border-hairline"
|
|
507
|
+
/>
|
|
508
|
+
))}
|
|
509
|
+
</div>
|
|
510
|
+
)}
|
|
511
|
+
</Button>
|
|
512
|
+
|
|
513
|
+
{!hasOptions && (
|
|
514
|
+
<div className="mt-sm">
|
|
515
|
+
<Button type="button" variant="primary" size="sm" onClick={onCta}>
|
|
516
|
+
{ctaLabel}
|
|
517
|
+
</Button>
|
|
518
|
+
</div>
|
|
519
|
+
)}
|
|
520
|
+
|
|
521
|
+
<Modal
|
|
522
|
+
isOpen={isOpen}
|
|
523
|
+
onClose={handleClose}
|
|
524
|
+
size="full"
|
|
525
|
+
title={hasOptions ? "Pick a design" : undefined}
|
|
526
|
+
footer={
|
|
527
|
+
hasOptions ? (
|
|
528
|
+
<>
|
|
529
|
+
<Button type="button" variant="ghost" onClick={handleClose}>
|
|
530
|
+
Not now
|
|
531
|
+
</Button>
|
|
532
|
+
<Button
|
|
533
|
+
type="button"
|
|
534
|
+
variant="primary"
|
|
535
|
+
onClick={handleConfirm}
|
|
536
|
+
disabled={!selectedId}
|
|
537
|
+
>
|
|
538
|
+
Create this design
|
|
539
|
+
</Button>
|
|
540
|
+
</>
|
|
541
|
+
) : (
|
|
542
|
+
<Button
|
|
543
|
+
type="button"
|
|
544
|
+
variant="primary"
|
|
545
|
+
onClick={() => {
|
|
546
|
+
onCta?.();
|
|
547
|
+
setIsOpen(false);
|
|
548
|
+
}}
|
|
549
|
+
>
|
|
550
|
+
{ctaLabel}
|
|
551
|
+
</Button>
|
|
552
|
+
)
|
|
553
|
+
}
|
|
554
|
+
>
|
|
555
|
+
{hasOptions ? (
|
|
556
|
+
<div className="flex flex-col h-full min-h-0 gap-md">
|
|
557
|
+
<p className="text-body-sm text-muted flex-shrink-0">
|
|
558
|
+
Select the look you want. We'll build the component from that image.
|
|
559
|
+
</p>
|
|
560
|
+
<div className="flex-1 min-h-0 flex flex-row gap-md">
|
|
561
|
+
{options!.map((opt) => {
|
|
562
|
+
const isSelected = opt.id === selectedId;
|
|
563
|
+
return (
|
|
564
|
+
<Button
|
|
565
|
+
key={opt.id}
|
|
566
|
+
type="button"
|
|
567
|
+
variant="ghost"
|
|
568
|
+
pushEffect={false}
|
|
569
|
+
onClick={() => setSelectedId(opt.id)}
|
|
570
|
+
className={[
|
|
571
|
+
"flex-1 min-h-0 h-full !p-0 overflow-hidden rounded-lg bg-surface-strong border-2",
|
|
572
|
+
isSelected ? "border-primary" : "border-hairline",
|
|
573
|
+
].join(" ")}
|
|
574
|
+
aria-label={opt.label}
|
|
575
|
+
aria-pressed={isSelected}
|
|
576
|
+
>
|
|
577
|
+
<img
|
|
578
|
+
src={opt.src}
|
|
579
|
+
alt={opt.label}
|
|
580
|
+
className="h-full w-full object-contain"
|
|
581
|
+
/>
|
|
582
|
+
</Button>
|
|
583
|
+
);
|
|
584
|
+
})}
|
|
585
|
+
</div>
|
|
586
|
+
</div>
|
|
587
|
+
) : (
|
|
588
|
+
<img
|
|
589
|
+
src={src}
|
|
590
|
+
alt={alt ?? ""}
|
|
591
|
+
className="h-full w-full object-contain"
|
|
592
|
+
/>
|
|
593
|
+
)}
|
|
594
|
+
</Modal>
|
|
595
|
+
</div>
|
|
596
|
+
);
|
|
597
|
+
};
|
|
598
|
+
|
|
407
599
|
// ─── Other Sub-components ─────────────────────────────────────────────────────
|
|
408
600
|
|
|
409
601
|
/** AI avatar — small primary circle with "AI" text */
|
|
@@ -426,23 +618,6 @@ const UserAvatar: React.FC<{ initials?: string }> = ({ initials = "U" }) => (
|
|
|
426
618
|
</span>
|
|
427
619
|
);
|
|
428
620
|
|
|
429
|
-
/** Spinning circle icon for the live-activity row */
|
|
430
|
-
const SpinnerIcon: React.FC = () => (
|
|
431
|
-
<svg
|
|
432
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
433
|
-
viewBox="0 0 24 24"
|
|
434
|
-
fill="none"
|
|
435
|
-
stroke="currentColor"
|
|
436
|
-
strokeWidth="2.5"
|
|
437
|
-
strokeLinecap="round"
|
|
438
|
-
strokeLinejoin="round"
|
|
439
|
-
className="size-4 text-primary animate-spin flex-shrink-0"
|
|
440
|
-
aria-hidden="true"
|
|
441
|
-
>
|
|
442
|
-
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
443
|
-
</svg>
|
|
444
|
-
);
|
|
445
|
-
|
|
446
621
|
/** AI message bubble */
|
|
447
622
|
const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
448
623
|
<div className="flex items-start gap-md w-full">
|
|
@@ -450,13 +625,19 @@ const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
|
450
625
|
<div className="flex-1 min-w-0">
|
|
451
626
|
{message.inFlight && (
|
|
452
627
|
<div className="flex items-center gap-xs mb-sm min-h-8" role="status" aria-live="polite">
|
|
453
|
-
<
|
|
628
|
+
<Icon name="loading-spinner" size={16} strokeWidth={2.5} className="text-primary animate-spin flex-shrink-0" />
|
|
454
629
|
<span className="text-body-sm text-primary">
|
|
455
630
|
{message.currentToolLabel ?? "Working…"}
|
|
456
631
|
</span>
|
|
457
632
|
</div>
|
|
458
633
|
)}
|
|
459
634
|
<p className="text-body-sm text-body leading-relaxed">{message.content}</p>
|
|
635
|
+
{message.images && message.images.length > 0 && (
|
|
636
|
+
<MessageImageGallery images={message.images} align="start" />
|
|
637
|
+
)}
|
|
638
|
+
{message.suggestedImage && (
|
|
639
|
+
<SuggestedImageWidget suggestedImage={message.suggestedImage} />
|
|
640
|
+
)}
|
|
460
641
|
{message.timeline && message.timeline.length > 0 && (
|
|
461
642
|
<TimelineBlock items={message.timeline} />
|
|
462
643
|
)}
|
|
@@ -470,18 +651,32 @@ const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
|
470
651
|
</div>
|
|
471
652
|
);
|
|
472
653
|
|
|
473
|
-
/** User message bubble — right-aligned
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
654
|
+
/** User message bubble — right-aligned. Text lives in the bubble; attached
|
|
655
|
+
* images render as a small thumbnail row BELOW the bubble (not inside it). */
|
|
656
|
+
const UserMessage: React.FC<{ message: ChatMessage }> = ({ message }) => {
|
|
657
|
+
const hasText = message.content.trim().length > 0;
|
|
658
|
+
const hasImages = !!message.images && message.images.length > 0;
|
|
659
|
+
|
|
660
|
+
return (
|
|
661
|
+
<div className="flex items-start gap-md w-full justify-end">
|
|
662
|
+
<div className="flex max-w-[80%] flex-col items-end">
|
|
663
|
+
{hasText && (
|
|
664
|
+
<div className="bg-primary-disabled rounded-xl px-lg py-md">
|
|
665
|
+
<p className="text-body-sm text-ink">{message.content}</p>
|
|
666
|
+
{message.agentMark && (
|
|
667
|
+
<AgentConversationMark mark={message.agentMark} align="end" />
|
|
668
|
+
)}
|
|
669
|
+
</div>
|
|
670
|
+
)}
|
|
671
|
+
{!hasText && message.agentMark && (
|
|
672
|
+
<AgentConversationMark mark={message.agentMark} align="end" />
|
|
673
|
+
)}
|
|
674
|
+
{hasImages && <MessageImageGallery images={message.images!} align="end" />}
|
|
675
|
+
</div>
|
|
676
|
+
<UserAvatar initials={message.userInitials ?? "U"} />
|
|
481
677
|
</div>
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
);
|
|
678
|
+
);
|
|
679
|
+
};
|
|
485
680
|
|
|
486
681
|
// ─── Main Component ───────────────────────────────────────────────────────────
|
|
487
682
|
|
|
@@ -501,6 +696,8 @@ export const ChatScreen = React.forwardRef<HTMLDivElement, ChatScreenProps>(
|
|
|
501
696
|
selectedModelId,
|
|
502
697
|
onModelChange,
|
|
503
698
|
className,
|
|
699
|
+
suggestDesigns,
|
|
700
|
+
onSuggestDesignsChange,
|
|
504
701
|
emptyTitle = DEFAULT_EMPTY_TITLE,
|
|
505
702
|
emptyDescription = DEFAULT_EMPTY_DESCRIPTION,
|
|
506
703
|
emptyState,
|
|
@@ -541,7 +738,6 @@ export const ChatScreen = React.forwardRef<HTMLDivElement, ChatScreenProps>(
|
|
|
541
738
|
const [messages, setMessages] = React.useState<ChatMessage[]>(
|
|
542
739
|
initialMessages !== undefined ? initialMessages : defaultMessages,
|
|
543
740
|
);
|
|
544
|
-
const [mode, setMode] = React.useState<PromptMode>("Build");
|
|
545
741
|
const threadRef = React.useRef<HTMLDivElement>(null);
|
|
546
742
|
const lastMessageCountRef = React.useRef(messages.length);
|
|
547
743
|
|
|
@@ -629,12 +825,13 @@ export const ChatScreen = React.forwardRef<HTMLDivElement, ChatScreenProps>(
|
|
|
629
825
|
<div className="w-full max-w-2xl mx-auto">
|
|
630
826
|
<PromptInputBar
|
|
631
827
|
placeholder={placeholder}
|
|
632
|
-
|
|
633
|
-
onModeChange={setMode}
|
|
828
|
+
showModeSelector={false}
|
|
634
829
|
onSend={handleSend}
|
|
635
830
|
models={models}
|
|
636
831
|
selectedModelId={selectedModelId}
|
|
637
832
|
onModelChange={onModelChange}
|
|
833
|
+
suggestDesigns={suggestDesigns}
|
|
834
|
+
onSuggestDesignsChange={onSuggestDesignsChange}
|
|
638
835
|
/>
|
|
639
836
|
</div>
|
|
640
837
|
</div>
|