@designa8/vibedesign-linear-internal-v1-b737 0.13.1 → 0.13.3
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 +62 -36
- package/dist/index.js +62 -36
- package/dist/styles.css +19 -9
- package/package.json +1 -1
- package/src/organisms/PromptInputBar/PromptInputBar.tsx +67 -31
- package/src/organisms/Sidebar/Sidebar.tsx +2 -0
- package/src/organisms/Sidebar/index.ts +7 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-linear-internal-v1-b737
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.13.
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.13.3**.
|
|
4
4
|
Tokens, atoms, molecules, organisms, and templates — import from the package root;
|
|
5
5
|
never hardcode visual values in consumer code.
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -10953,6 +10953,7 @@ var ROUND = "rounded-full!";
|
|
|
10953
10953
|
var ROW_TRIGGER = "cursor-pointer transition duration-150 ease-out hover:bg-surface-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50";
|
|
10954
10954
|
var MENU_PANEL = "flex w-72 max-w-full flex-col overflow-hidden rounded-lg border border-hairline bg-surface p-xs text-ink shadow-overlay origin-bottom-left transition duration-200 ease-out data-[state=closed]:pointer-events-none data-[state=closed]:translate-y-1 data-[state=closed]:opacity-0 data-[state=open]:translate-y-0 data-[state=open]:opacity-100";
|
|
10955
10955
|
var MENU_ICON_TILE = "flex size-9 shrink-0 items-center justify-center rounded-md bg-surface-soft text-ink";
|
|
10956
|
+
var SEND_IDLE = "disabled:opacity-100";
|
|
10956
10957
|
function ModelRow({
|
|
10957
10958
|
model,
|
|
10958
10959
|
selected,
|
|
@@ -10966,9 +10967,8 @@ function ModelRow({
|
|
|
10966
10967
|
wrap: true,
|
|
10967
10968
|
role: "menuitemradio",
|
|
10968
10969
|
"aria-checked": selected,
|
|
10969
|
-
"aria-disabled":
|
|
10970
|
+
"aria-disabled": available ? void 0 : true,
|
|
10970
10971
|
"data-menu-item": "model",
|
|
10971
|
-
"data-model-id": model.id,
|
|
10972
10972
|
onClick: onSelect,
|
|
10973
10973
|
className: cn69("gap-sm", ROW_TRIGGER),
|
|
10974
10974
|
trailingIcon: selected ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Icon, { name: "check", size: 16, className: "shrink-0 text-primary" }) : void 0,
|
|
@@ -11054,7 +11054,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11054
11054
|
const images = pastedImages !== void 0 ? pastedImages : internalImages;
|
|
11055
11055
|
const suggestOn = suggestDesigns !== void 0 ? suggestDesigns : internalSuggest;
|
|
11056
11056
|
const hasModels = Boolean(models && models.length > 0);
|
|
11057
|
-
const
|
|
11057
|
+
const [pickedModelId, setPickedModelId] = React90.useState(selectedModelId);
|
|
11058
|
+
React90.useEffect(() => {
|
|
11059
|
+
if (selectedModelId !== void 0) setPickedModelId(selectedModelId);
|
|
11060
|
+
}, [selectedModelId]);
|
|
11061
|
+
const activeModelId = pickedModelId ?? internalModelId;
|
|
11058
11062
|
const currentModel = models?.find((m) => m.id === activeModelId) ?? models?.[0];
|
|
11059
11063
|
const prefersReducedMotion = React90.useCallback(
|
|
11060
11064
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
@@ -11163,7 +11167,15 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11163
11167
|
if (menuOpen) {
|
|
11164
11168
|
wasOpen.current = true;
|
|
11165
11169
|
const id = window.requestAnimationFrame(() => {
|
|
11166
|
-
|
|
11170
|
+
const rows = Array.from(
|
|
11171
|
+
menuPanelRef.current?.querySelectorAll(
|
|
11172
|
+
"[data-menu-item]"
|
|
11173
|
+
) ?? []
|
|
11174
|
+
);
|
|
11175
|
+
const checked = rows.find(
|
|
11176
|
+
(row) => row.getAttribute("aria-checked") === "true"
|
|
11177
|
+
);
|
|
11178
|
+
(checked ?? rows[0])?.focus({ preventScroll: true });
|
|
11167
11179
|
});
|
|
11168
11180
|
return () => window.cancelAnimationFrame(id);
|
|
11169
11181
|
}
|
|
@@ -11259,11 +11271,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11259
11271
|
const handleModelSelect = (model) => {
|
|
11260
11272
|
if (model.available === false) {
|
|
11261
11273
|
onUnavailableModelClick?.(model.id);
|
|
11262
|
-
|
|
11263
|
-
if (selectedModelId === void 0) setInternalModelId(model.id);
|
|
11264
|
-
onModelChange?.(model.id);
|
|
11274
|
+
return;
|
|
11265
11275
|
}
|
|
11266
|
-
|
|
11276
|
+
setPickedModelId(model.id);
|
|
11277
|
+
if (selectedModelId === void 0) setInternalModelId(model.id);
|
|
11278
|
+
onModelChange?.(model.id);
|
|
11279
|
+
window.requestAnimationFrame(() => {
|
|
11280
|
+
menuPanelRef.current?.querySelector('[data-menu-item][aria-checked="true"]')?.focus({ preventScroll: true });
|
|
11281
|
+
});
|
|
11267
11282
|
};
|
|
11268
11283
|
const handleMenuKeyDown = (e) => {
|
|
11269
11284
|
if (e.key === "Escape") {
|
|
@@ -11295,15 +11310,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11295
11310
|
selected: m === mode,
|
|
11296
11311
|
onSelect: () => onModeChange?.(m)
|
|
11297
11312
|
}));
|
|
11298
|
-
const
|
|
11299
|
-
const triggerLabel = currentModel ? `Attach or change model. Current model: ${currentModel.name}` : "Add attachment";
|
|
11313
|
+
const triggerLabel = currentModel ? `Change model or add attachment. Current model: ${currentModel.name}` : "Add attachment";
|
|
11300
11314
|
const menuPanel = /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11301
11315
|
"div",
|
|
11302
11316
|
{
|
|
11303
11317
|
ref: menuPanelRef,
|
|
11304
11318
|
id: `${uid}-menu`,
|
|
11305
11319
|
role: "menu",
|
|
11306
|
-
"aria-label":
|
|
11320
|
+
"aria-label": `Prompt options. Current model: ${currentModel?.name ?? "none"}`,
|
|
11307
11321
|
"aria-hidden": menuOpen ? void 0 : true,
|
|
11308
11322
|
"data-state": menuOpen ? "open" : "closed",
|
|
11309
11323
|
inert: !menuOpen,
|
|
@@ -11318,18 +11332,33 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11318
11332
|
},
|
|
11319
11333
|
className: MENU_PANEL,
|
|
11320
11334
|
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain", children: [
|
|
11321
|
-
hasModels ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11335
|
+
hasModels ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
11336
|
+
"div",
|
|
11337
|
+
{
|
|
11338
|
+
role: "group",
|
|
11339
|
+
"aria-label": "Model",
|
|
11340
|
+
className: "flex flex-col gap-xxs",
|
|
11341
|
+
children: [
|
|
11342
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11343
|
+
"span",
|
|
11344
|
+
{
|
|
11345
|
+
"aria-hidden": "true",
|
|
11346
|
+
className: "px-sm pb-xxs pt-xs text-overline text-muted",
|
|
11347
|
+
children: "Model"
|
|
11348
|
+
}
|
|
11349
|
+
),
|
|
11350
|
+
models?.map((m) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11351
|
+
ModelRow,
|
|
11352
|
+
{
|
|
11353
|
+
model: m,
|
|
11354
|
+
selected: m.available !== false && m.id === currentModel?.id,
|
|
11355
|
+
onSelect: () => handleModelSelect(m)
|
|
11356
|
+
},
|
|
11357
|
+
m.id
|
|
11358
|
+
))
|
|
11359
|
+
]
|
|
11360
|
+
}
|
|
11361
|
+
) : null,
|
|
11333
11362
|
hasModels && hasUploadPath ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11334
11363
|
"div",
|
|
11335
11364
|
{
|
|
@@ -11372,7 +11401,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11372
11401
|
"div",
|
|
11373
11402
|
{
|
|
11374
11403
|
className: cn69(
|
|
11375
|
-
"flex w-full min-w-0 flex-col gap-base rounded-
|
|
11404
|
+
"flex w-full min-w-0 flex-col gap-base rounded-3xl border bg-canvas p-base shadow-card transition-colors duration-200 ease-out sm:px-lg sm:pt-lg sm:pb-base",
|
|
11376
11405
|
hasError ? "border-semantic-error" : isRecording ? "border-primary" : "border-hairline"
|
|
11377
11406
|
),
|
|
11378
11407
|
children: [
|
|
@@ -11430,11 +11459,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11430
11459
|
inert: isRecording,
|
|
11431
11460
|
className: ROW_LAYER,
|
|
11432
11461
|
children: [
|
|
11433
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.
|
|
11434
|
-
|
|
11462
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11463
|
+
IconButton,
|
|
11435
11464
|
{
|
|
11436
11465
|
ref: plusRef,
|
|
11437
|
-
|
|
11466
|
+
icon: "plus",
|
|
11438
11467
|
size: "lg",
|
|
11439
11468
|
variant: "soft",
|
|
11440
11469
|
"aria-label": triggerLabel,
|
|
@@ -11448,23 +11477,20 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11448
11477
|
ROUND,
|
|
11449
11478
|
"shrink-0 transition-transform duration-200 ease-out",
|
|
11450
11479
|
menuOpen && "rotate-45"
|
|
11451
|
-
)
|
|
11452
|
-
children: [
|
|
11453
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Icon, { name: "plus", size: 18 }),
|
|
11454
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "sr-only", "data-model-name": currentModel?.id, children: currentModelName })
|
|
11455
|
-
]
|
|
11480
|
+
)
|
|
11456
11481
|
}
|
|
11457
11482
|
),
|
|
11458
11483
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11459
11484
|
Button,
|
|
11460
11485
|
{
|
|
11461
11486
|
variant: "tint",
|
|
11487
|
+
size: "lg",
|
|
11462
11488
|
role: "switch",
|
|
11463
11489
|
"aria-checked": suggestOn,
|
|
11464
11490
|
"aria-label": "Suggest designs",
|
|
11465
11491
|
onClick: toggleSuggest,
|
|
11466
11492
|
disabled: lockInput,
|
|
11467
|
-
className: cn69(ROUND, "min-w-0 shrink"),
|
|
11493
|
+
className: cn69(ROUND, "min-w-0 shrink px-md!"),
|
|
11468
11494
|
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Icon, { name: "sparkles", size: 14 }),
|
|
11469
11495
|
trailingIcon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11470
11496
|
"span",
|
|
@@ -11478,14 +11504,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11478
11504
|
"span",
|
|
11479
11505
|
{
|
|
11480
11506
|
className: cn69(
|
|
11481
|
-
"block size-3 rounded-full bg-
|
|
11507
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
11482
11508
|
suggestOn ? "translate-x-3" : "translate-x-0"
|
|
11483
11509
|
)
|
|
11484
11510
|
}
|
|
11485
11511
|
)
|
|
11486
11512
|
}
|
|
11487
11513
|
),
|
|
11488
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "block min-w-0 truncate", children: "Suggest designs" })
|
|
11514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "block min-w-0 truncate text-body-sm", children: "Suggest designs" })
|
|
11489
11515
|
}
|
|
11490
11516
|
),
|
|
11491
11517
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "ms-auto flex min-w-0 shrink-0 items-center gap-sm", children: [
|
|
@@ -11538,7 +11564,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11538
11564
|
"aria-label": "Send",
|
|
11539
11565
|
disabled: !canSend,
|
|
11540
11566
|
onClick: handleSend,
|
|
11541
|
-
className: ROUND
|
|
11567
|
+
className: cn69(ROUND, SEND_IDLE)
|
|
11542
11568
|
}
|
|
11543
11569
|
)
|
|
11544
11570
|
}
|
package/dist/index.js
CHANGED
|
@@ -10807,6 +10807,7 @@ var ROUND = "rounded-full!";
|
|
|
10807
10807
|
var ROW_TRIGGER = "cursor-pointer transition duration-150 ease-out hover:bg-surface-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50";
|
|
10808
10808
|
var MENU_PANEL = "flex w-72 max-w-full flex-col overflow-hidden rounded-lg border border-hairline bg-surface p-xs text-ink shadow-overlay origin-bottom-left transition duration-200 ease-out data-[state=closed]:pointer-events-none data-[state=closed]:translate-y-1 data-[state=closed]:opacity-0 data-[state=open]:translate-y-0 data-[state=open]:opacity-100";
|
|
10809
10809
|
var MENU_ICON_TILE = "flex size-9 shrink-0 items-center justify-center rounded-md bg-surface-soft text-ink";
|
|
10810
|
+
var SEND_IDLE = "disabled:opacity-100";
|
|
10810
10811
|
function ModelRow({
|
|
10811
10812
|
model,
|
|
10812
10813
|
selected,
|
|
@@ -10820,9 +10821,8 @@ function ModelRow({
|
|
|
10820
10821
|
wrap: true,
|
|
10821
10822
|
role: "menuitemradio",
|
|
10822
10823
|
"aria-checked": selected,
|
|
10823
|
-
"aria-disabled":
|
|
10824
|
+
"aria-disabled": available ? void 0 : true,
|
|
10824
10825
|
"data-menu-item": "model",
|
|
10825
|
-
"data-model-id": model.id,
|
|
10826
10826
|
onClick: onSelect,
|
|
10827
10827
|
className: cn69("gap-sm", ROW_TRIGGER),
|
|
10828
10828
|
trailingIcon: selected ? /* @__PURE__ */ jsx90(Icon, { name: "check", size: 16, className: "shrink-0 text-primary" }) : void 0,
|
|
@@ -10908,7 +10908,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
10908
10908
|
const images = pastedImages !== void 0 ? pastedImages : internalImages;
|
|
10909
10909
|
const suggestOn = suggestDesigns !== void 0 ? suggestDesigns : internalSuggest;
|
|
10910
10910
|
const hasModels = Boolean(models && models.length > 0);
|
|
10911
|
-
const
|
|
10911
|
+
const [pickedModelId, setPickedModelId] = React90.useState(selectedModelId);
|
|
10912
|
+
React90.useEffect(() => {
|
|
10913
|
+
if (selectedModelId !== void 0) setPickedModelId(selectedModelId);
|
|
10914
|
+
}, [selectedModelId]);
|
|
10915
|
+
const activeModelId = pickedModelId ?? internalModelId;
|
|
10912
10916
|
const currentModel = models?.find((m) => m.id === activeModelId) ?? models?.[0];
|
|
10913
10917
|
const prefersReducedMotion = React90.useCallback(
|
|
10914
10918
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
@@ -11017,7 +11021,15 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11017
11021
|
if (menuOpen) {
|
|
11018
11022
|
wasOpen.current = true;
|
|
11019
11023
|
const id = window.requestAnimationFrame(() => {
|
|
11020
|
-
|
|
11024
|
+
const rows = Array.from(
|
|
11025
|
+
menuPanelRef.current?.querySelectorAll(
|
|
11026
|
+
"[data-menu-item]"
|
|
11027
|
+
) ?? []
|
|
11028
|
+
);
|
|
11029
|
+
const checked = rows.find(
|
|
11030
|
+
(row) => row.getAttribute("aria-checked") === "true"
|
|
11031
|
+
);
|
|
11032
|
+
(checked ?? rows[0])?.focus({ preventScroll: true });
|
|
11021
11033
|
});
|
|
11022
11034
|
return () => window.cancelAnimationFrame(id);
|
|
11023
11035
|
}
|
|
@@ -11113,11 +11125,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11113
11125
|
const handleModelSelect = (model) => {
|
|
11114
11126
|
if (model.available === false) {
|
|
11115
11127
|
onUnavailableModelClick?.(model.id);
|
|
11116
|
-
|
|
11117
|
-
if (selectedModelId === void 0) setInternalModelId(model.id);
|
|
11118
|
-
onModelChange?.(model.id);
|
|
11128
|
+
return;
|
|
11119
11129
|
}
|
|
11120
|
-
|
|
11130
|
+
setPickedModelId(model.id);
|
|
11131
|
+
if (selectedModelId === void 0) setInternalModelId(model.id);
|
|
11132
|
+
onModelChange?.(model.id);
|
|
11133
|
+
window.requestAnimationFrame(() => {
|
|
11134
|
+
menuPanelRef.current?.querySelector('[data-menu-item][aria-checked="true"]')?.focus({ preventScroll: true });
|
|
11135
|
+
});
|
|
11121
11136
|
};
|
|
11122
11137
|
const handleMenuKeyDown = (e) => {
|
|
11123
11138
|
if (e.key === "Escape") {
|
|
@@ -11149,15 +11164,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11149
11164
|
selected: m === mode,
|
|
11150
11165
|
onSelect: () => onModeChange?.(m)
|
|
11151
11166
|
}));
|
|
11152
|
-
const
|
|
11153
|
-
const triggerLabel = currentModel ? `Attach or change model. Current model: ${currentModel.name}` : "Add attachment";
|
|
11167
|
+
const triggerLabel = currentModel ? `Change model or add attachment. Current model: ${currentModel.name}` : "Add attachment";
|
|
11154
11168
|
const menuPanel = /* @__PURE__ */ jsx90(
|
|
11155
11169
|
"div",
|
|
11156
11170
|
{
|
|
11157
11171
|
ref: menuPanelRef,
|
|
11158
11172
|
id: `${uid}-menu`,
|
|
11159
11173
|
role: "menu",
|
|
11160
|
-
"aria-label":
|
|
11174
|
+
"aria-label": `Prompt options. Current model: ${currentModel?.name ?? "none"}`,
|
|
11161
11175
|
"aria-hidden": menuOpen ? void 0 : true,
|
|
11162
11176
|
"data-state": menuOpen ? "open" : "closed",
|
|
11163
11177
|
inert: !menuOpen,
|
|
@@ -11172,18 +11186,33 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11172
11186
|
},
|
|
11173
11187
|
className: MENU_PANEL,
|
|
11174
11188
|
children: /* @__PURE__ */ jsxs82("div", { className: "flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain", children: [
|
|
11175
|
-
hasModels ? /* @__PURE__ */ jsxs82(
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11189
|
+
hasModels ? /* @__PURE__ */ jsxs82(
|
|
11190
|
+
"div",
|
|
11191
|
+
{
|
|
11192
|
+
role: "group",
|
|
11193
|
+
"aria-label": "Model",
|
|
11194
|
+
className: "flex flex-col gap-xxs",
|
|
11195
|
+
children: [
|
|
11196
|
+
/* @__PURE__ */ jsx90(
|
|
11197
|
+
"span",
|
|
11198
|
+
{
|
|
11199
|
+
"aria-hidden": "true",
|
|
11200
|
+
className: "px-sm pb-xxs pt-xs text-overline text-muted",
|
|
11201
|
+
children: "Model"
|
|
11202
|
+
}
|
|
11203
|
+
),
|
|
11204
|
+
models?.map((m) => /* @__PURE__ */ jsx90(
|
|
11205
|
+
ModelRow,
|
|
11206
|
+
{
|
|
11207
|
+
model: m,
|
|
11208
|
+
selected: m.available !== false && m.id === currentModel?.id,
|
|
11209
|
+
onSelect: () => handleModelSelect(m)
|
|
11210
|
+
},
|
|
11211
|
+
m.id
|
|
11212
|
+
))
|
|
11213
|
+
]
|
|
11214
|
+
}
|
|
11215
|
+
) : null,
|
|
11187
11216
|
hasModels && hasUploadPath ? /* @__PURE__ */ jsx90(
|
|
11188
11217
|
"div",
|
|
11189
11218
|
{
|
|
@@ -11226,7 +11255,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11226
11255
|
"div",
|
|
11227
11256
|
{
|
|
11228
11257
|
className: cn69(
|
|
11229
|
-
"flex w-full min-w-0 flex-col gap-base rounded-
|
|
11258
|
+
"flex w-full min-w-0 flex-col gap-base rounded-3xl border bg-canvas p-base shadow-card transition-colors duration-200 ease-out sm:px-lg sm:pt-lg sm:pb-base",
|
|
11230
11259
|
hasError ? "border-semantic-error" : isRecording ? "border-primary" : "border-hairline"
|
|
11231
11260
|
),
|
|
11232
11261
|
children: [
|
|
@@ -11284,11 +11313,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11284
11313
|
inert: isRecording,
|
|
11285
11314
|
className: ROW_LAYER,
|
|
11286
11315
|
children: [
|
|
11287
|
-
/* @__PURE__ */
|
|
11288
|
-
|
|
11316
|
+
/* @__PURE__ */ jsx90(
|
|
11317
|
+
IconButton,
|
|
11289
11318
|
{
|
|
11290
11319
|
ref: plusRef,
|
|
11291
|
-
|
|
11320
|
+
icon: "plus",
|
|
11292
11321
|
size: "lg",
|
|
11293
11322
|
variant: "soft",
|
|
11294
11323
|
"aria-label": triggerLabel,
|
|
@@ -11302,23 +11331,20 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11302
11331
|
ROUND,
|
|
11303
11332
|
"shrink-0 transition-transform duration-200 ease-out",
|
|
11304
11333
|
menuOpen && "rotate-45"
|
|
11305
|
-
)
|
|
11306
|
-
children: [
|
|
11307
|
-
/* @__PURE__ */ jsx90(Icon, { name: "plus", size: 18 }),
|
|
11308
|
-
/* @__PURE__ */ jsx90("span", { className: "sr-only", "data-model-name": currentModel?.id, children: currentModelName })
|
|
11309
|
-
]
|
|
11334
|
+
)
|
|
11310
11335
|
}
|
|
11311
11336
|
),
|
|
11312
11337
|
/* @__PURE__ */ jsx90(
|
|
11313
11338
|
Button,
|
|
11314
11339
|
{
|
|
11315
11340
|
variant: "tint",
|
|
11341
|
+
size: "lg",
|
|
11316
11342
|
role: "switch",
|
|
11317
11343
|
"aria-checked": suggestOn,
|
|
11318
11344
|
"aria-label": "Suggest designs",
|
|
11319
11345
|
onClick: toggleSuggest,
|
|
11320
11346
|
disabled: lockInput,
|
|
11321
|
-
className: cn69(ROUND, "min-w-0 shrink"),
|
|
11347
|
+
className: cn69(ROUND, "min-w-0 shrink px-md!"),
|
|
11322
11348
|
leadingIcon: /* @__PURE__ */ jsx90(Icon, { name: "sparkles", size: 14 }),
|
|
11323
11349
|
trailingIcon: /* @__PURE__ */ jsx90(
|
|
11324
11350
|
"span",
|
|
@@ -11332,14 +11358,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11332
11358
|
"span",
|
|
11333
11359
|
{
|
|
11334
11360
|
className: cn69(
|
|
11335
|
-
"block size-3 rounded-full bg-
|
|
11361
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
11336
11362
|
suggestOn ? "translate-x-3" : "translate-x-0"
|
|
11337
11363
|
)
|
|
11338
11364
|
}
|
|
11339
11365
|
)
|
|
11340
11366
|
}
|
|
11341
11367
|
),
|
|
11342
|
-
children: /* @__PURE__ */ jsx90("span", { className: "block min-w-0 truncate", children: "Suggest designs" })
|
|
11368
|
+
children: /* @__PURE__ */ jsx90("span", { className: "block min-w-0 truncate text-body-sm", children: "Suggest designs" })
|
|
11343
11369
|
}
|
|
11344
11370
|
),
|
|
11345
11371
|
/* @__PURE__ */ jsxs82("div", { className: "ms-auto flex min-w-0 shrink-0 items-center gap-sm", children: [
|
|
@@ -11392,7 +11418,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11392
11418
|
"aria-label": "Send",
|
|
11393
11419
|
disabled: !canSend,
|
|
11394
11420
|
onClick: handleSend,
|
|
11395
|
-
className: ROUND
|
|
11421
|
+
className: cn69(ROUND, SEND_IDLE)
|
|
11396
11422
|
}
|
|
11397
11423
|
)
|
|
11398
11424
|
}
|
package/dist/styles.css
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
--radius-md: 8px;
|
|
25
25
|
--radius-lg: 12px;
|
|
26
26
|
--radius-xl: 16px;
|
|
27
|
+
--radius-3xl: 1.5rem;
|
|
27
28
|
--ease-out: cubic-bezier(0, 0, 0.2, 1);
|
|
28
29
|
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
|
|
29
30
|
--animate-spin: spin 1s linear infinite;
|
|
@@ -1312,6 +1313,9 @@
|
|
|
1312
1313
|
.rounded {
|
|
1313
1314
|
border-radius: 0.25rem;
|
|
1314
1315
|
}
|
|
1316
|
+
.rounded-3xl {
|
|
1317
|
+
border-radius: var(--radius-3xl);
|
|
1318
|
+
}
|
|
1315
1319
|
.rounded-full {
|
|
1316
1320
|
border-radius: calc(infinity * 1px);
|
|
1317
1321
|
}
|
|
@@ -1500,6 +1504,9 @@
|
|
|
1500
1504
|
.bg-inverse-canvas {
|
|
1501
1505
|
background-color: var(--color-inverse-canvas);
|
|
1502
1506
|
}
|
|
1507
|
+
.bg-inverse-ink {
|
|
1508
|
+
background-color: var(--color-inverse-ink);
|
|
1509
|
+
}
|
|
1503
1510
|
.bg-inverse-ink\/15 {
|
|
1504
1511
|
background-color: color-mix(in srgb, #F7F8F8 15%, transparent);
|
|
1505
1512
|
@supports (color: color-mix(in lab, red, red)) {
|
|
@@ -1644,6 +1651,9 @@
|
|
|
1644
1651
|
.px-md {
|
|
1645
1652
|
padding-inline: var(--spacing-md);
|
|
1646
1653
|
}
|
|
1654
|
+
.px-md\! {
|
|
1655
|
+
padding-inline: var(--spacing-md) !important;
|
|
1656
|
+
}
|
|
1647
1657
|
.px-sm {
|
|
1648
1658
|
padding-inline: var(--spacing-sm);
|
|
1649
1659
|
}
|
|
@@ -2745,6 +2755,11 @@
|
|
|
2745
2755
|
opacity: 50%;
|
|
2746
2756
|
}
|
|
2747
2757
|
}
|
|
2758
|
+
.disabled\:opacity-100 {
|
|
2759
|
+
&:disabled {
|
|
2760
|
+
opacity: 100%;
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2748
2763
|
.disabled\:shadow-none {
|
|
2749
2764
|
&:disabled {
|
|
2750
2765
|
--tw-shadow: 0 0 #0000;
|
|
@@ -2946,14 +2961,14 @@
|
|
|
2946
2961
|
gap: var(--spacing-lg);
|
|
2947
2962
|
}
|
|
2948
2963
|
}
|
|
2949
|
-
.sm\:
|
|
2964
|
+
.sm\:px-lg {
|
|
2950
2965
|
@media (width >= 640px) {
|
|
2951
|
-
padding-
|
|
2966
|
+
padding-inline: var(--spacing-lg);
|
|
2952
2967
|
}
|
|
2953
2968
|
}
|
|
2954
|
-
.sm\:
|
|
2969
|
+
.sm\:pt-lg {
|
|
2955
2970
|
@media (width >= 640px) {
|
|
2956
|
-
padding-
|
|
2971
|
+
padding-top: var(--spacing-lg);
|
|
2957
2972
|
}
|
|
2958
2973
|
}
|
|
2959
2974
|
.sm\:pb-base {
|
|
@@ -2961,11 +2976,6 @@
|
|
|
2961
2976
|
padding-bottom: var(--spacing-base);
|
|
2962
2977
|
}
|
|
2963
2978
|
}
|
|
2964
|
-
.sm\:pl-lg {
|
|
2965
|
-
@media (width >= 640px) {
|
|
2966
|
-
padding-left: var(--spacing-lg);
|
|
2967
|
-
}
|
|
2968
|
-
}
|
|
2969
2979
|
.md\:block {
|
|
2970
2980
|
@media (width >= 768px) {
|
|
2971
2981
|
display: block;
|
package/package.json
CHANGED
|
@@ -113,6 +113,12 @@ const MENU_PANEL =
|
|
|
113
113
|
const MENU_ICON_TILE =
|
|
114
114
|
"flex size-9 shrink-0 items-center justify-center rounded-md bg-surface-soft text-ink";
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* The send circle keeps its neutral grey fill and solid white glyph even while
|
|
118
|
+
* inert, so an empty composer reads "not yet" rather than a faded brand button.
|
|
119
|
+
*/
|
|
120
|
+
const SEND_IDLE = "disabled:opacity-100";
|
|
121
|
+
|
|
116
122
|
function ModelRow({
|
|
117
123
|
model,
|
|
118
124
|
selected,
|
|
@@ -129,9 +135,8 @@ function ModelRow({
|
|
|
129
135
|
wrap
|
|
130
136
|
role="menuitemradio"
|
|
131
137
|
aria-checked={selected}
|
|
132
|
-
aria-disabled={
|
|
138
|
+
aria-disabled={available ? undefined : true}
|
|
133
139
|
data-menu-item="model"
|
|
134
|
-
data-model-id={model.id}
|
|
135
140
|
onClick={onSelect}
|
|
136
141
|
className={cn("gap-sm", ROW_TRIGGER)}
|
|
137
142
|
trailingIcon={
|
|
@@ -249,8 +254,18 @@ export const PromptInputBar = React.forwardRef<
|
|
|
249
254
|
const suggestOn =
|
|
250
255
|
suggestDesigns !== undefined ? suggestDesigns : internalSuggest;
|
|
251
256
|
const hasModels = Boolean(models && models.length > 0);
|
|
252
|
-
|
|
253
|
-
|
|
257
|
+
|
|
258
|
+
/* The tick has to move the instant a row is picked, even before a controlled
|
|
259
|
+
parent echoes the id back, so the picked id is mirrored locally. */
|
|
260
|
+
const [pickedModelId, setPickedModelId] = React.useState<
|
|
261
|
+
string | undefined
|
|
262
|
+
>(selectedModelId);
|
|
263
|
+
|
|
264
|
+
React.useEffect(() => {
|
|
265
|
+
if (selectedModelId !== undefined) setPickedModelId(selectedModelId);
|
|
266
|
+
}, [selectedModelId]);
|
|
267
|
+
|
|
268
|
+
const activeModelId = pickedModelId ?? internalModelId;
|
|
254
269
|
const currentModel =
|
|
255
270
|
models?.find((m) => m.id === activeModelId) ?? models?.[0];
|
|
256
271
|
|
|
@@ -386,14 +401,20 @@ export const PromptInputBar = React.forwardRef<
|
|
|
386
401
|
};
|
|
387
402
|
}, [menuOpen, placeMenu]);
|
|
388
403
|
|
|
389
|
-
/* Focus the
|
|
404
|
+
/* Focus the current row on open, and hand focus back to the trigger. */
|
|
390
405
|
React.useEffect(() => {
|
|
391
406
|
if (menuOpen) {
|
|
392
407
|
wasOpen.current = true;
|
|
393
408
|
const id = window.requestAnimationFrame(() => {
|
|
394
|
-
|
|
395
|
-
?.
|
|
396
|
-
|
|
409
|
+
const rows = Array.from(
|
|
410
|
+
menuPanelRef.current?.querySelectorAll<HTMLElement>(
|
|
411
|
+
"[data-menu-item]",
|
|
412
|
+
) ?? [],
|
|
413
|
+
);
|
|
414
|
+
const checked = rows.find(
|
|
415
|
+
(row) => row.getAttribute("aria-checked") === "true",
|
|
416
|
+
);
|
|
417
|
+
(checked ?? rows[0])?.focus({ preventScroll: true });
|
|
397
418
|
});
|
|
398
419
|
return () => window.cancelAnimationFrame(id);
|
|
399
420
|
}
|
|
@@ -501,14 +522,21 @@ export const PromptInputBar = React.forwardRef<
|
|
|
501
522
|
onSuggestDesignsChange?.(next);
|
|
502
523
|
};
|
|
503
524
|
|
|
525
|
+
/* A model picker is a radio list: the tick has to be seen to move, so the
|
|
526
|
+
panel stays open on a pick and focus follows the chosen row. */
|
|
504
527
|
const handleModelSelect = (model: PromptInputBarModel) => {
|
|
505
528
|
if (model.available === false) {
|
|
506
529
|
onUnavailableModelClick?.(model.id);
|
|
507
|
-
|
|
508
|
-
if (selectedModelId === undefined) setInternalModelId(model.id);
|
|
509
|
-
onModelChange?.(model.id);
|
|
530
|
+
return;
|
|
510
531
|
}
|
|
511
|
-
|
|
532
|
+
setPickedModelId(model.id);
|
|
533
|
+
if (selectedModelId === undefined) setInternalModelId(model.id);
|
|
534
|
+
onModelChange?.(model.id);
|
|
535
|
+
window.requestAnimationFrame(() => {
|
|
536
|
+
menuPanelRef.current
|
|
537
|
+
?.querySelector<HTMLElement>('[data-menu-item][aria-checked="true"]')
|
|
538
|
+
?.focus({ preventScroll: true });
|
|
539
|
+
});
|
|
512
540
|
};
|
|
513
541
|
|
|
514
542
|
/* Arrow keys walk the rows of the open menu, Escape closes it. */
|
|
@@ -548,9 +576,8 @@ export const PromptInputBar = React.forwardRef<
|
|
|
548
576
|
onSelect: () => onModeChange?.(m),
|
|
549
577
|
}));
|
|
550
578
|
|
|
551
|
-
const currentModelName = currentModel?.name ?? "Attach";
|
|
552
579
|
const triggerLabel = currentModel
|
|
553
|
-
? `
|
|
580
|
+
? `Change model or add attachment. Current model: ${currentModel.name}`
|
|
554
581
|
: "Add attachment";
|
|
555
582
|
|
|
556
583
|
const menuPanel = (
|
|
@@ -558,7 +585,9 @@ export const PromptInputBar = React.forwardRef<
|
|
|
558
585
|
ref={menuPanelRef}
|
|
559
586
|
id={`${uid}-menu`}
|
|
560
587
|
role="menu"
|
|
561
|
-
aria-label=
|
|
588
|
+
aria-label={`Prompt options. Current model: ${
|
|
589
|
+
currentModel?.name ?? "none"
|
|
590
|
+
}`}
|
|
562
591
|
aria-hidden={menuOpen ? undefined : true}
|
|
563
592
|
data-state={menuOpen ? "open" : "closed"}
|
|
564
593
|
inert={!menuOpen}
|
|
@@ -577,8 +606,15 @@ export const PromptInputBar = React.forwardRef<
|
|
|
577
606
|
reaches the browser's back/forward gesture. */}
|
|
578
607
|
<div className="flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain">
|
|
579
608
|
{hasModels ? (
|
|
580
|
-
<div
|
|
581
|
-
|
|
609
|
+
<div
|
|
610
|
+
role="group"
|
|
611
|
+
aria-label="Model"
|
|
612
|
+
className="flex flex-col gap-xxs"
|
|
613
|
+
>
|
|
614
|
+
<span
|
|
615
|
+
aria-hidden="true"
|
|
616
|
+
className="px-sm pb-xxs pt-xs text-overline text-muted"
|
|
617
|
+
>
|
|
582
618
|
Model
|
|
583
619
|
</span>
|
|
584
620
|
{models?.map((m) => (
|
|
@@ -637,10 +673,12 @@ export const PromptInputBar = React.forwardRef<
|
|
|
637
673
|
}}
|
|
638
674
|
>
|
|
639
675
|
{/* One surface owns the stroke: canvas pane, hairline border, card lift.
|
|
640
|
-
|
|
676
|
+
A soft 24px shell stays a single base step on phones; from `sm` it
|
|
677
|
+
opens to a roomy inset (24 left/right, 24 top, 16 bottom) with a
|
|
678
|
+
16px rhythm between the field and the toolbar. */}
|
|
641
679
|
<div
|
|
642
680
|
className={cn(
|
|
643
|
-
"flex w-full min-w-0 flex-col gap-base rounded-
|
|
681
|
+
"flex w-full min-w-0 flex-col gap-base rounded-3xl border bg-canvas p-base shadow-card transition-colors duration-200 ease-out sm:px-lg sm:pt-lg sm:pb-base",
|
|
644
682
|
hasError
|
|
645
683
|
? "border-semantic-error"
|
|
646
684
|
: isRecording
|
|
@@ -708,9 +746,9 @@ export const PromptInputBar = React.forwardRef<
|
|
|
708
746
|
inert={isRecording}
|
|
709
747
|
className={ROW_LAYER}
|
|
710
748
|
>
|
|
711
|
-
<
|
|
749
|
+
<IconButton
|
|
712
750
|
ref={plusRef}
|
|
713
|
-
|
|
751
|
+
icon="plus"
|
|
714
752
|
size="lg"
|
|
715
753
|
variant="soft"
|
|
716
754
|
aria-label={triggerLabel}
|
|
@@ -725,21 +763,17 @@ export const PromptInputBar = React.forwardRef<
|
|
|
725
763
|
"shrink-0 transition-transform duration-200 ease-out",
|
|
726
764
|
menuOpen && "rotate-45",
|
|
727
765
|
)}
|
|
728
|
-
|
|
729
|
-
<Icon name="plus" size={18} />
|
|
730
|
-
<span className="sr-only" data-model-name={currentModel?.id}>
|
|
731
|
-
{currentModelName}
|
|
732
|
-
</span>
|
|
733
|
-
</Button>
|
|
766
|
+
/>
|
|
734
767
|
|
|
735
768
|
<Button
|
|
736
769
|
variant="tint"
|
|
770
|
+
size="lg"
|
|
737
771
|
role="switch"
|
|
738
772
|
aria-checked={suggestOn}
|
|
739
773
|
aria-label="Suggest designs"
|
|
740
774
|
onClick={toggleSuggest}
|
|
741
775
|
disabled={lockInput}
|
|
742
|
-
className={cn(ROUND, "min-w-0 shrink")}
|
|
776
|
+
className={cn(ROUND, "min-w-0 shrink px-md!")}
|
|
743
777
|
leadingIcon={<Icon name="sparkles" size={14} />}
|
|
744
778
|
trailingIcon={
|
|
745
779
|
<span
|
|
@@ -751,14 +785,16 @@ export const PromptInputBar = React.forwardRef<
|
|
|
751
785
|
>
|
|
752
786
|
<span
|
|
753
787
|
className={cn(
|
|
754
|
-
"block size-3 rounded-full bg-
|
|
788
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
755
789
|
suggestOn ? "translate-x-3" : "translate-x-0",
|
|
756
790
|
)}
|
|
757
791
|
/>
|
|
758
792
|
</span>
|
|
759
793
|
}
|
|
760
794
|
>
|
|
761
|
-
<span className="block min-w-0 truncate">
|
|
795
|
+
<span className="block min-w-0 truncate text-body-sm">
|
|
796
|
+
Suggest designs
|
|
797
|
+
</span>
|
|
762
798
|
</Button>
|
|
763
799
|
|
|
764
800
|
<div className="ms-auto flex min-w-0 shrink-0 items-center gap-sm">
|
|
@@ -806,7 +842,7 @@ export const PromptInputBar = React.forwardRef<
|
|
|
806
842
|
aria-label="Send"
|
|
807
843
|
disabled={!canSend}
|
|
808
844
|
onClick={handleSend}
|
|
809
|
-
className={ROUND}
|
|
845
|
+
className={cn(ROUND, SEND_IDLE)}
|
|
810
846
|
/>
|
|
811
847
|
</div>
|
|
812
848
|
<div
|
|
@@ -5,6 +5,8 @@ import { SidebarMobile } from "../SidebarMobile";
|
|
|
5
5
|
import type { IconName } from "../../atoms/Icon";
|
|
6
6
|
import type { DropdownMenuEntry } from "../../molecules/DropdownMenu";
|
|
7
7
|
|
|
8
|
+
export type { SidebarDesktopAnnouncement };
|
|
9
|
+
|
|
8
10
|
export interface SidebarLink {
|
|
9
11
|
id: string;
|
|
10
12
|
label: string;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export { Sidebar } from "./Sidebar";
|
|
2
|
-
export type {
|
|
2
|
+
export type {
|
|
3
|
+
SidebarProps,
|
|
4
|
+
SidebarLink,
|
|
5
|
+
SidebarSection,
|
|
6
|
+
SidebarAnnouncement,
|
|
7
|
+
SidebarDesktopAnnouncement,
|
|
8
|
+
} from "./Sidebar";
|