@designa8/vibedesign-v6 1.12.9 → 1.12.11
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 +55 -5
- package/dist/index.js +55 -5
- package/dist/styles.css +25 -0
- package/package.json +1 -1
- package/src/atoms/AppSidebar/AppSidebar.tsx +19 -3
- package/src/atoms/ChatScreen/ChatScreen.tsx +78 -2
- package/src/atoms/ChatScreen/preview.tsx +13 -25
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1230,6 +1230,47 @@ var TimelineBlock = ({ items }) => {
|
|
|
1230
1230
|
expanded && hasMore && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "px-md pb-sm pt-xs border-t border-hairline-soft", children: items.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TimelineRow, { item, isLast: idx === items.length - 1 }, item.id)) })
|
|
1231
1231
|
] });
|
|
1232
1232
|
};
|
|
1233
|
+
var AgentConversationIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1234
|
+
"svg",
|
|
1235
|
+
{
|
|
1236
|
+
viewBox: "0 0 24 24",
|
|
1237
|
+
width: "12",
|
|
1238
|
+
height: "12",
|
|
1239
|
+
fill: "none",
|
|
1240
|
+
stroke: "currentColor",
|
|
1241
|
+
strokeWidth: "2",
|
|
1242
|
+
strokeLinecap: "round",
|
|
1243
|
+
strokeLinejoin: "round",
|
|
1244
|
+
className: "flex-shrink-0",
|
|
1245
|
+
"aria-hidden": "true",
|
|
1246
|
+
children: [
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "9", cy: "7", r: "4" }),
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M23 21v-2a4 4 0 0 0-3-3.87" }),
|
|
1250
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
|
|
1251
|
+
]
|
|
1252
|
+
}
|
|
1253
|
+
);
|
|
1254
|
+
var AgentConversationMark = ({ mark, align = "start" }) => {
|
|
1255
|
+
const pillClasses = "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 transition-colors duration-150 whitespace-nowrap";
|
|
1256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: ["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" "), children: mark.href ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("a", { href: mark.href, className: pillClasses, children: [
|
|
1257
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AgentConversationIcon, {}),
|
|
1258
|
+
mark.label
|
|
1259
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1260
|
+
Button,
|
|
1261
|
+
{
|
|
1262
|
+
variant: "ghost",
|
|
1263
|
+
size: "sm",
|
|
1264
|
+
type: "button",
|
|
1265
|
+
onClick: mark.onClick,
|
|
1266
|
+
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",
|
|
1267
|
+
children: [
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AgentConversationIcon, {}),
|
|
1269
|
+
mark.label
|
|
1270
|
+
]
|
|
1271
|
+
}
|
|
1272
|
+
) });
|
|
1273
|
+
};
|
|
1233
1274
|
var AIAvatar = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1234
1275
|
"span",
|
|
1235
1276
|
{
|
|
@@ -1270,11 +1311,15 @@ var AiMessage = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("
|
|
|
1270
1311
|
] }),
|
|
1271
1312
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-sm text-body leading-relaxed", children: message.content }),
|
|
1272
1313
|
message.timeline && message.timeline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TimelineBlock, { items: message.timeline }),
|
|
1314
|
+
message.agentMark && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AgentConversationMark, { mark: message.agentMark, align: "start" }),
|
|
1273
1315
|
message.postContent && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-sm text-body leading-relaxed mt-md", children: message.postContent })
|
|
1274
1316
|
] })
|
|
1275
1317
|
] });
|
|
1276
1318
|
var UserMessage = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start gap-md w-full justify-end", children: [
|
|
1277
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "max-w-[80%] bg-primary-disabled rounded-xl px-lg py-md", children: [
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-sm text-ink", children: message.content }),
|
|
1321
|
+
message.agentMark && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AgentConversationMark, { mark: message.agentMark, align: "end" })
|
|
1322
|
+
] }),
|
|
1278
1323
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UserAvatar, { initials: message.userInitials ?? "U" })
|
|
1279
1324
|
] });
|
|
1280
1325
|
var DEFAULT_EMPTY_TITLE = "Start the conversation";
|
|
@@ -1298,8 +1343,9 @@ var ChatScreen = import_react5.default.forwardRef(
|
|
|
1298
1343
|
{
|
|
1299
1344
|
id: "1",
|
|
1300
1345
|
role: "user",
|
|
1301
|
-
content: "
|
|
1302
|
-
userInitials: "
|
|
1346
|
+
content: "I need help with creating a new atom for our design system.",
|
|
1347
|
+
userInitials: "ME",
|
|
1348
|
+
agentMark: { label: "From Typography Agent", href: "#typography-agent" }
|
|
1303
1349
|
},
|
|
1304
1350
|
{
|
|
1305
1351
|
id: "2",
|
|
@@ -2666,6 +2712,8 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2666
2712
|
// dark mode toggle
|
|
2667
2713
|
darkMode = false,
|
|
2668
2714
|
onDarkModeToggle,
|
|
2715
|
+
// expand state seed
|
|
2716
|
+
defaultExpandedIds,
|
|
2669
2717
|
// legacy compat
|
|
2670
2718
|
activeItem,
|
|
2671
2719
|
collapsed: collapsedProp,
|
|
@@ -2682,7 +2730,9 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2682
2730
|
if (!isControlled) setInternalCollapsed(next);
|
|
2683
2731
|
onCollapsedChange?.(next);
|
|
2684
2732
|
};
|
|
2685
|
-
const [expandedIds, setExpandedIds] = import_react10.default.useState(
|
|
2733
|
+
const [expandedIds, setExpandedIds] = import_react10.default.useState(
|
|
2734
|
+
() => new Set(defaultExpandedIds ?? [])
|
|
2735
|
+
);
|
|
2686
2736
|
const toggleExpanded = (id) => {
|
|
2687
2737
|
setExpandedIds((prev) => {
|
|
2688
2738
|
const next = new Set(prev);
|
|
@@ -2806,7 +2856,7 @@ var AppSidebar = import_react10.default.forwardRef(
|
|
|
2806
2856
|
children: [
|
|
2807
2857
|
showShareCard && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "rounded-xl border border-hairline bg-surface px-md py-sm flex items-center justify-between gap-md", children: [
|
|
2808
2858
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-xxs min-w-0", children: [
|
|
2809
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-body-sm font-weight-heading-sm text-ink", children: "Share
|
|
2859
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-body-sm font-weight-heading-sm text-ink", children: "Share & earn" }),
|
|
2810
2860
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-caption text-muted", children: "100 credits per paid referral" })
|
|
2811
2861
|
] }),
|
|
2812
2862
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
package/dist/index.js
CHANGED
|
@@ -1177,6 +1177,47 @@ var TimelineBlock = ({ items }) => {
|
|
|
1177
1177
|
expanded && hasMore && /* @__PURE__ */ jsx5("div", { className: "px-md pb-sm pt-xs border-t border-hairline-soft", children: items.map((item, idx) => /* @__PURE__ */ jsx5(TimelineRow, { item, isLast: idx === items.length - 1 }, item.id)) })
|
|
1178
1178
|
] });
|
|
1179
1179
|
};
|
|
1180
|
+
var AgentConversationIcon = () => /* @__PURE__ */ jsxs5(
|
|
1181
|
+
"svg",
|
|
1182
|
+
{
|
|
1183
|
+
viewBox: "0 0 24 24",
|
|
1184
|
+
width: "12",
|
|
1185
|
+
height: "12",
|
|
1186
|
+
fill: "none",
|
|
1187
|
+
stroke: "currentColor",
|
|
1188
|
+
strokeWidth: "2",
|
|
1189
|
+
strokeLinecap: "round",
|
|
1190
|
+
strokeLinejoin: "round",
|
|
1191
|
+
className: "flex-shrink-0",
|
|
1192
|
+
"aria-hidden": "true",
|
|
1193
|
+
children: [
|
|
1194
|
+
/* @__PURE__ */ jsx5("path", { d: "M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
|
|
1195
|
+
/* @__PURE__ */ jsx5("circle", { cx: "9", cy: "7", r: "4" }),
|
|
1196
|
+
/* @__PURE__ */ jsx5("path", { d: "M23 21v-2a4 4 0 0 0-3-3.87" }),
|
|
1197
|
+
/* @__PURE__ */ jsx5("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
|
|
1198
|
+
]
|
|
1199
|
+
}
|
|
1200
|
+
);
|
|
1201
|
+
var AgentConversationMark = ({ mark, align = "start" }) => {
|
|
1202
|
+
const pillClasses = "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 transition-colors duration-150 whitespace-nowrap";
|
|
1203
|
+
return /* @__PURE__ */ jsx5("div", { className: ["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" "), children: mark.href ? /* @__PURE__ */ jsxs5("a", { href: mark.href, className: pillClasses, children: [
|
|
1204
|
+
/* @__PURE__ */ jsx5(AgentConversationIcon, {}),
|
|
1205
|
+
mark.label
|
|
1206
|
+
] }) : /* @__PURE__ */ jsxs5(
|
|
1207
|
+
Button,
|
|
1208
|
+
{
|
|
1209
|
+
variant: "ghost",
|
|
1210
|
+
size: "sm",
|
|
1211
|
+
type: "button",
|
|
1212
|
+
onClick: mark.onClick,
|
|
1213
|
+
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",
|
|
1214
|
+
children: [
|
|
1215
|
+
/* @__PURE__ */ jsx5(AgentConversationIcon, {}),
|
|
1216
|
+
mark.label
|
|
1217
|
+
]
|
|
1218
|
+
}
|
|
1219
|
+
) });
|
|
1220
|
+
};
|
|
1180
1221
|
var AIAvatar = () => /* @__PURE__ */ jsx5(
|
|
1181
1222
|
"span",
|
|
1182
1223
|
{
|
|
@@ -1217,11 +1258,15 @@ var AiMessage = ({ message }) => /* @__PURE__ */ jsxs5("div", { className: "flex
|
|
|
1217
1258
|
] }),
|
|
1218
1259
|
/* @__PURE__ */ jsx5("p", { className: "text-body-sm text-body leading-relaxed", children: message.content }),
|
|
1219
1260
|
message.timeline && message.timeline.length > 0 && /* @__PURE__ */ jsx5(TimelineBlock, { items: message.timeline }),
|
|
1261
|
+
message.agentMark && /* @__PURE__ */ jsx5(AgentConversationMark, { mark: message.agentMark, align: "start" }),
|
|
1220
1262
|
message.postContent && /* @__PURE__ */ jsx5("p", { className: "text-body-sm text-body leading-relaxed mt-md", children: message.postContent })
|
|
1221
1263
|
] })
|
|
1222
1264
|
] });
|
|
1223
1265
|
var UserMessage = ({ message }) => /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-md w-full justify-end", children: [
|
|
1224
|
-
/* @__PURE__ */
|
|
1266
|
+
/* @__PURE__ */ jsxs5("div", { className: "max-w-[80%] bg-primary-disabled rounded-xl px-lg py-md", children: [
|
|
1267
|
+
/* @__PURE__ */ jsx5("p", { className: "text-body-sm text-ink", children: message.content }),
|
|
1268
|
+
message.agentMark && /* @__PURE__ */ jsx5(AgentConversationMark, { mark: message.agentMark, align: "end" })
|
|
1269
|
+
] }),
|
|
1225
1270
|
/* @__PURE__ */ jsx5(UserAvatar, { initials: message.userInitials ?? "U" })
|
|
1226
1271
|
] });
|
|
1227
1272
|
var DEFAULT_EMPTY_TITLE = "Start the conversation";
|
|
@@ -1245,8 +1290,9 @@ var ChatScreen = React5.forwardRef(
|
|
|
1245
1290
|
{
|
|
1246
1291
|
id: "1",
|
|
1247
1292
|
role: "user",
|
|
1248
|
-
content: "
|
|
1249
|
-
userInitials: "
|
|
1293
|
+
content: "I need help with creating a new atom for our design system.",
|
|
1294
|
+
userInitials: "ME",
|
|
1295
|
+
agentMark: { label: "From Typography Agent", href: "#typography-agent" }
|
|
1250
1296
|
},
|
|
1251
1297
|
{
|
|
1252
1298
|
id: "2",
|
|
@@ -2613,6 +2659,8 @@ var AppSidebar = React10.forwardRef(
|
|
|
2613
2659
|
// dark mode toggle
|
|
2614
2660
|
darkMode = false,
|
|
2615
2661
|
onDarkModeToggle,
|
|
2662
|
+
// expand state seed
|
|
2663
|
+
defaultExpandedIds,
|
|
2616
2664
|
// legacy compat
|
|
2617
2665
|
activeItem,
|
|
2618
2666
|
collapsed: collapsedProp,
|
|
@@ -2629,7 +2677,9 @@ var AppSidebar = React10.forwardRef(
|
|
|
2629
2677
|
if (!isControlled) setInternalCollapsed(next);
|
|
2630
2678
|
onCollapsedChange?.(next);
|
|
2631
2679
|
};
|
|
2632
|
-
const [expandedIds, setExpandedIds] = React10.useState(
|
|
2680
|
+
const [expandedIds, setExpandedIds] = React10.useState(
|
|
2681
|
+
() => new Set(defaultExpandedIds ?? [])
|
|
2682
|
+
);
|
|
2633
2683
|
const toggleExpanded = (id) => {
|
|
2634
2684
|
setExpandedIds((prev) => {
|
|
2635
2685
|
const next = new Set(prev);
|
|
@@ -2753,7 +2803,7 @@ var AppSidebar = React10.forwardRef(
|
|
|
2753
2803
|
children: [
|
|
2754
2804
|
showShareCard && /* @__PURE__ */ jsxs10("div", { className: "rounded-xl border border-hairline bg-surface px-md py-sm flex items-center justify-between gap-md", children: [
|
|
2755
2805
|
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-xxs min-w-0", children: [
|
|
2756
|
-
/* @__PURE__ */ jsx10("span", { className: "text-body-sm font-weight-heading-sm text-ink", children: "Share
|
|
2806
|
+
/* @__PURE__ */ jsx10("span", { className: "text-body-sm font-weight-heading-sm text-ink", children: "Share & earn" }),
|
|
2757
2807
|
/* @__PURE__ */ jsx10("span", { className: "text-caption text-muted", children: "100 credits per paid referral" })
|
|
2758
2808
|
] }),
|
|
2759
2809
|
/* @__PURE__ */ jsx10(
|
package/dist/styles.css
CHANGED
|
@@ -397,6 +397,9 @@
|
|
|
397
397
|
.mt-md {
|
|
398
398
|
margin-top: var(--spacing-md);
|
|
399
399
|
}
|
|
400
|
+
.mt-sm {
|
|
401
|
+
margin-top: var(--spacing-sm);
|
|
402
|
+
}
|
|
400
403
|
.mt-xl {
|
|
401
404
|
margin-top: var(--spacing-xl);
|
|
402
405
|
}
|
|
@@ -444,6 +447,9 @@
|
|
|
444
447
|
grid-template-columns: var(--grid-template-columns-system, repeat(12, minmax(0, 1fr)));
|
|
445
448
|
gap: var(--spacing-gutter, 1rem);
|
|
446
449
|
}
|
|
450
|
+
.\!inline-flex {
|
|
451
|
+
display: inline-flex !important;
|
|
452
|
+
}
|
|
447
453
|
.block {
|
|
448
454
|
display: block;
|
|
449
455
|
}
|
|
@@ -747,6 +753,9 @@
|
|
|
747
753
|
.flex-wrap {
|
|
748
754
|
flex-wrap: wrap;
|
|
749
755
|
}
|
|
756
|
+
.\!items-center {
|
|
757
|
+
align-items: center !important;
|
|
758
|
+
}
|
|
750
759
|
.items-center {
|
|
751
760
|
align-items: center;
|
|
752
761
|
}
|
|
@@ -783,6 +792,9 @@
|
|
|
783
792
|
.\!gap-sm {
|
|
784
793
|
gap: var(--spacing-sm) !important;
|
|
785
794
|
}
|
|
795
|
+
.\!gap-xs {
|
|
796
|
+
gap: var(--spacing-xs) !important;
|
|
797
|
+
}
|
|
786
798
|
.\!gap-xxs {
|
|
787
799
|
gap: var(--spacing-xxs) !important;
|
|
788
800
|
}
|
|
@@ -994,6 +1006,9 @@
|
|
|
994
1006
|
.border-transparent {
|
|
995
1007
|
border-color: transparent;
|
|
996
1008
|
}
|
|
1009
|
+
.\!bg-canvas {
|
|
1010
|
+
background-color: var(--color-canvas) !important;
|
|
1011
|
+
}
|
|
997
1012
|
.\!bg-primary-disabled {
|
|
998
1013
|
background-color: var(--color-primary-disabled) !important;
|
|
999
1014
|
}
|
|
@@ -1210,6 +1225,12 @@
|
|
|
1210
1225
|
letter-spacing: var(--tw-tracking, var(--text-body-sm--letter-spacing)) !important;
|
|
1211
1226
|
font-weight: var(--tw-font-weight, var(--text-body-sm--font-weight)) !important;
|
|
1212
1227
|
}
|
|
1228
|
+
.\!text-caption {
|
|
1229
|
+
font-size: var(--text-caption) !important;
|
|
1230
|
+
line-height: var(--tw-leading, var(--text-caption--line-height)) !important;
|
|
1231
|
+
letter-spacing: var(--tw-tracking, var(--text-caption--letter-spacing)) !important;
|
|
1232
|
+
font-weight: var(--tw-font-weight, var(--text-caption--font-weight)) !important;
|
|
1233
|
+
}
|
|
1213
1234
|
.text-body-lg {
|
|
1214
1235
|
font-size: var(--text-body-lg);
|
|
1215
1236
|
line-height: var(--tw-leading, var(--text-body-lg--line-height));
|
|
@@ -1367,6 +1388,10 @@
|
|
|
1367
1388
|
.opacity-100 {
|
|
1368
1389
|
opacity: 100%;
|
|
1369
1390
|
}
|
|
1391
|
+
.\!shadow-sm {
|
|
1392
|
+
--tw-shadow: 0 1px 2px 0 var(--tw-shadow-color, rgba(0,0,0,0.05)) !important;
|
|
1393
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow) !important;
|
|
1394
|
+
}
|
|
1370
1395
|
.shadow-card {
|
|
1371
1396
|
--tw-shadow: 0 2px 12px 0 var(--tw-shadow-color, rgba(0,0,0,0.07));
|
|
1372
1397
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
package/package.json
CHANGED
|
@@ -111,7 +111,7 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
111
111
|
workspaceName?: string;
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
* When true, renders the "Share
|
|
114
|
+
* When true, renders the "Share" referral card in the footer.
|
|
115
115
|
* Defaults to false.
|
|
116
116
|
*/
|
|
117
117
|
showShareCard?: boolean;
|
|
@@ -149,6 +149,16 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
149
149
|
*/
|
|
150
150
|
onDarkModeToggle?: () => void;
|
|
151
151
|
|
|
152
|
+
// ── Expand state seed ────────────────────────────────────────────────────
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* IDs of entries whose sub-item lists should be expanded on the initial
|
|
156
|
+
* render. The sidebar continues to manage expand/collapse state internally
|
|
157
|
+
* after mount — this only seeds the initial state and is NOT a controlled
|
|
158
|
+
* prop (changes after mount are ignored).
|
|
159
|
+
*/
|
|
160
|
+
defaultExpandedIds?: string[];
|
|
161
|
+
|
|
152
162
|
// ── Legacy / backwards-compatible props ──────────────────────────────────
|
|
153
163
|
|
|
154
164
|
/** @deprecated Use activeId instead. */
|
|
@@ -184,6 +194,8 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
184
194
|
// dark mode toggle
|
|
185
195
|
darkMode = false,
|
|
186
196
|
onDarkModeToggle,
|
|
197
|
+
// expand state seed
|
|
198
|
+
defaultExpandedIds,
|
|
187
199
|
// legacy compat
|
|
188
200
|
activeItem,
|
|
189
201
|
collapsed: collapsedProp,
|
|
@@ -206,7 +218,11 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
206
218
|
};
|
|
207
219
|
|
|
208
220
|
/* ── Expanded subtree state (managed internally per the spec) ── */
|
|
209
|
-
|
|
221
|
+
// Use a lazy initialiser so defaultExpandedIds seeds the Set only once
|
|
222
|
+
// on mount; subsequent renders ignore it (uncontrolled behaviour).
|
|
223
|
+
const [expandedIds, setExpandedIds] = React.useState<Set<string>>(
|
|
224
|
+
() => new Set(defaultExpandedIds ?? []),
|
|
225
|
+
);
|
|
210
226
|
|
|
211
227
|
const toggleExpanded = (id: string) => {
|
|
212
228
|
setExpandedIds((prev) => {
|
|
@@ -365,7 +381,7 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
|
365
381
|
{showShareCard && (
|
|
366
382
|
<div className="rounded-xl border border-hairline bg-surface px-md py-sm flex items-center justify-between gap-md">
|
|
367
383
|
<div className="flex flex-col gap-xxs min-w-0">
|
|
368
|
-
<span className="text-body-sm font-weight-heading-sm text-ink">Share
|
|
384
|
+
<span className="text-body-sm font-weight-heading-sm text-ink">Share & earn</span>
|
|
369
385
|
<span className="text-caption text-muted">100 credits per paid referral</span>
|
|
370
386
|
</div>
|
|
371
387
|
<span
|
|
@@ -14,6 +14,15 @@ export interface TimelineItem {
|
|
|
14
14
|
status: "running" | "done" | "error";
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export interface AgentConversationMarkData {
|
|
18
|
+
/** Pill label, e.g. "From Typography Agent" */
|
|
19
|
+
label: string;
|
|
20
|
+
/** When set, the mark renders as a real link (<a href>) */
|
|
21
|
+
href?: string;
|
|
22
|
+
/** When set (and href is not), the mark renders as a clickable button */
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
export interface ChatMessage {
|
|
18
27
|
id: string;
|
|
19
28
|
role: MessageRole;
|
|
@@ -26,6 +35,8 @@ export interface ChatMessage {
|
|
|
26
35
|
currentToolLabel?: string;
|
|
27
36
|
/** Optional timeline of agent tool-call steps — renders a collapsible TimelineBlock */
|
|
28
37
|
timeline?: TimelineItem[];
|
|
38
|
+
/** Optional pill marking that this message links to/from another agent conversation */
|
|
39
|
+
agentMark?: AgentConversationMarkData;
|
|
29
40
|
/**
|
|
30
41
|
* Optional text rendered in a separate <p> AFTER the timeline block.
|
|
31
42
|
*/
|
|
@@ -335,6 +346,64 @@ const TimelineBlock: React.FC<{ items: TimelineItem[] }> = ({ items }) => {
|
|
|
335
346
|
);
|
|
336
347
|
};
|
|
337
348
|
|
|
349
|
+
// ─── AgentConversationMark ─────────────────────────────────────────────────────
|
|
350
|
+
|
|
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
|
+
/**
|
|
373
|
+
* Small linkable pill shown on a message to mark that it references or was
|
|
374
|
+
* forked from another agent conversation. Renders as a real <a> when `href`
|
|
375
|
+
* is provided, otherwise as a clickable Button when `onClick` is provided.
|
|
376
|
+
*/
|
|
377
|
+
const AgentConversationMark: React.FC<{
|
|
378
|
+
mark: AgentConversationMarkData;
|
|
379
|
+
align?: "start" | "end";
|
|
380
|
+
}> = ({ mark, align = "start" }) => {
|
|
381
|
+
const pillClasses =
|
|
382
|
+
"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 transition-colors duration-150 whitespace-nowrap";
|
|
383
|
+
|
|
384
|
+
return (
|
|
385
|
+
<div className={["flex mt-sm", align === "end" ? "justify-end" : "justify-start"].join(" ")}>
|
|
386
|
+
{mark.href ? (
|
|
387
|
+
<a href={mark.href} className={pillClasses}>
|
|
388
|
+
<AgentConversationIcon />
|
|
389
|
+
{mark.label}
|
|
390
|
+
</a>
|
|
391
|
+
) : (
|
|
392
|
+
<Button
|
|
393
|
+
variant="ghost"
|
|
394
|
+
size="sm"
|
|
395
|
+
type="button"
|
|
396
|
+
onClick={mark.onClick}
|
|
397
|
+
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
|
+
>
|
|
399
|
+
<AgentConversationIcon />
|
|
400
|
+
{mark.label}
|
|
401
|
+
</Button>
|
|
402
|
+
)}
|
|
403
|
+
</div>
|
|
404
|
+
);
|
|
405
|
+
};
|
|
406
|
+
|
|
338
407
|
// ─── Other Sub-components ─────────────────────────────────────────────────────
|
|
339
408
|
|
|
340
409
|
/** AI avatar — small primary circle with "AI" text */
|
|
@@ -391,6 +460,9 @@ const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
|
391
460
|
{message.timeline && message.timeline.length > 0 && (
|
|
392
461
|
<TimelineBlock items={message.timeline} />
|
|
393
462
|
)}
|
|
463
|
+
{message.agentMark && (
|
|
464
|
+
<AgentConversationMark mark={message.agentMark} align="start" />
|
|
465
|
+
)}
|
|
394
466
|
{message.postContent && (
|
|
395
467
|
<p className="text-body-sm text-body leading-relaxed mt-md">{message.postContent}</p>
|
|
396
468
|
)}
|
|
@@ -403,6 +475,9 @@ const UserMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
|
403
475
|
<div className="flex items-start gap-md w-full justify-end">
|
|
404
476
|
<div className="max-w-[80%] bg-primary-disabled rounded-xl px-lg py-md">
|
|
405
477
|
<p className="text-body-sm text-ink">{message.content}</p>
|
|
478
|
+
{message.agentMark && (
|
|
479
|
+
<AgentConversationMark mark={message.agentMark} align="end" />
|
|
480
|
+
)}
|
|
406
481
|
</div>
|
|
407
482
|
<UserAvatar initials={message.userInitials ?? "U"} />
|
|
408
483
|
</div>
|
|
@@ -436,8 +511,9 @@ export const ChatScreen = React.forwardRef<HTMLDivElement, ChatScreenProps>(
|
|
|
436
511
|
{
|
|
437
512
|
id: "1",
|
|
438
513
|
role: "user",
|
|
439
|
-
content: "
|
|
440
|
-
userInitials: "
|
|
514
|
+
content: "I need help with creating a new atom for our design system.",
|
|
515
|
+
userInitials: "ME",
|
|
516
|
+
agentMark: { label: "From Typography Agent", href: "#typography-agent" },
|
|
441
517
|
},
|
|
442
518
|
{
|
|
443
519
|
id: "2",
|
|
@@ -5,51 +5,39 @@ const messagesWithTimeline: ChatMessage[] = [
|
|
|
5
5
|
{
|
|
6
6
|
id: "1",
|
|
7
7
|
role: "user",
|
|
8
|
-
content: "
|
|
8
|
+
content: "I need help with creating a new atom for our design system.",
|
|
9
9
|
userInitials: "ME",
|
|
10
|
+
agentMark: { label: "From Typography Agent", href: "#typography-agent" },
|
|
10
11
|
},
|
|
11
12
|
{
|
|
12
13
|
id: "2",
|
|
13
14
|
role: "ai",
|
|
14
|
-
content: "I
|
|
15
|
-
timeline: [
|
|
16
|
-
{ id: "t1", kind: "thinking", label: "Planning component API and variants", status: "done" },
|
|
17
|
-
{ id: "t2", kind: "read", label: "Reading design tokens", detail: "colors, spacing, rounded", status: "done" },
|
|
18
|
-
{ id: "t3", kind: "write", label: "Writing Button.tsx", status: "done" },
|
|
19
|
-
{ id: "t4", kind: "write", label: "Writing index.ts", status: "done" },
|
|
20
|
-
{ id: "t5", kind: "verify", label: "Verifying atom passes linter", status: "running" },
|
|
21
|
-
],
|
|
22
|
-
inFlight: true,
|
|
23
|
-
currentToolLabel: "Verifying…",
|
|
15
|
+
content: "I can help you create a new atom. What type of atom would you like to create?",
|
|
24
16
|
},
|
|
25
17
|
{
|
|
26
18
|
id: "3",
|
|
27
19
|
role: "user",
|
|
28
|
-
content: "
|
|
20
|
+
content: "Actually, let me switch to typography first to check our text styles.",
|
|
29
21
|
userInitials: "ME",
|
|
22
|
+
agentMark: { label: "From Typography Agent", onClick: () => console.log("navigate to typography agent") },
|
|
30
23
|
},
|
|
31
24
|
{
|
|
32
25
|
id: "4",
|
|
33
26
|
role: "ai",
|
|
34
|
-
content: "
|
|
27
|
+
content: "I'll build the Button atom now. Tracking progress below:",
|
|
35
28
|
timeline: [
|
|
36
|
-
{ id: "
|
|
37
|
-
{ id: "
|
|
38
|
-
{ id: "
|
|
29
|
+
{ id: "t1", kind: "thinking", label: "Planning component API and variants", status: "done" },
|
|
30
|
+
{ id: "t2", kind: "read", label: "Reading design tokens", detail: "colors, spacing, rounded", status: "done" },
|
|
31
|
+
{ id: "t3", kind: "write", label: "Writing Button.tsx", status: "done" },
|
|
32
|
+
{ id: "t4", kind: "write", label: "Writing index.ts", status: "done" },
|
|
33
|
+
{ id: "t5", kind: "verify", label: "Verifying atom passes linter", status: "running" },
|
|
39
34
|
],
|
|
40
|
-
|
|
35
|
+
inFlight: true,
|
|
36
|
+
currentToolLabel: "Verifying…",
|
|
41
37
|
},
|
|
42
38
|
{
|
|
43
39
|
id: "5",
|
|
44
40
|
role: "ai",
|
|
45
|
-
content: "Here's a message with only a single timeline step (no expand toggle needed).",
|
|
46
|
-
timeline: [
|
|
47
|
-
{ id: "t9", kind: "tool", label: "Called figma_get_design", detail: "node-id: 1234:5678", status: "done" },
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: "6",
|
|
52
|
-
role: "ai",
|
|
53
41
|
content: "And here's an error state in the timeline.",
|
|
54
42
|
timeline: [
|
|
55
43
|
{ id: "t10", kind: "thinking", label: "Planning layout structure", status: "done" },
|