@designa8/vibedesign-linear-internal-v1-b737 0.13.2 → 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 +54 -24
- package/dist/index.js +54 -24
- package/dist/styles.css +10 -0
- package/package.json +1 -1
- package/src/organisms/PromptInputBar/PromptInputBar.tsx +55 -19
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
|
@@ -10967,7 +10967,7 @@ function ModelRow({
|
|
|
10967
10967
|
wrap: true,
|
|
10968
10968
|
role: "menuitemradio",
|
|
10969
10969
|
"aria-checked": selected,
|
|
10970
|
-
"aria-disabled":
|
|
10970
|
+
"aria-disabled": available ? void 0 : true,
|
|
10971
10971
|
"data-menu-item": "model",
|
|
10972
10972
|
onClick: onSelect,
|
|
10973
10973
|
className: cn69("gap-sm", ROW_TRIGGER),
|
|
@@ -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") {
|
|
@@ -11302,7 +11317,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11302
11317
|
ref: menuPanelRef,
|
|
11303
11318
|
id: `${uid}-menu`,
|
|
11304
11319
|
role: "menu",
|
|
11305
|
-
"aria-label":
|
|
11320
|
+
"aria-label": `Prompt options. Current model: ${currentModel?.name ?? "none"}`,
|
|
11306
11321
|
"aria-hidden": menuOpen ? void 0 : true,
|
|
11307
11322
|
"data-state": menuOpen ? "open" : "closed",
|
|
11308
11323
|
inert: !menuOpen,
|
|
@@ -11317,18 +11332,33 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11317
11332
|
},
|
|
11318
11333
|
className: MENU_PANEL,
|
|
11319
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: [
|
|
11320
|
-
hasModels ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
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,
|
|
11332
11362
|
hasModels && hasUploadPath ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11333
11363
|
"div",
|
|
11334
11364
|
{
|
|
@@ -11371,7 +11401,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11371
11401
|
"div",
|
|
11372
11402
|
{
|
|
11373
11403
|
className: cn69(
|
|
11374
|
-
"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",
|
|
11375
11405
|
hasError ? "border-semantic-error" : isRecording ? "border-primary" : "border-hairline"
|
|
11376
11406
|
),
|
|
11377
11407
|
children: [
|
|
@@ -11460,7 +11490,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11460
11490
|
"aria-label": "Suggest designs",
|
|
11461
11491
|
onClick: toggleSuggest,
|
|
11462
11492
|
disabled: lockInput,
|
|
11463
|
-
className: cn69(ROUND, "min-w-0 shrink"),
|
|
11493
|
+
className: cn69(ROUND, "min-w-0 shrink px-md!"),
|
|
11464
11494
|
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Icon, { name: "sparkles", size: 14 }),
|
|
11465
11495
|
trailingIcon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11466
11496
|
"span",
|
|
@@ -11474,14 +11504,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11474
11504
|
"span",
|
|
11475
11505
|
{
|
|
11476
11506
|
className: cn69(
|
|
11477
|
-
"block size-3 rounded-full bg-
|
|
11507
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
11478
11508
|
suggestOn ? "translate-x-3" : "translate-x-0"
|
|
11479
11509
|
)
|
|
11480
11510
|
}
|
|
11481
11511
|
)
|
|
11482
11512
|
}
|
|
11483
11513
|
),
|
|
11484
|
-
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" })
|
|
11485
11515
|
}
|
|
11486
11516
|
),
|
|
11487
11517
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "ms-auto flex min-w-0 shrink-0 items-center gap-sm", children: [
|
package/dist/index.js
CHANGED
|
@@ -10821,7 +10821,7 @@ function ModelRow({
|
|
|
10821
10821
|
wrap: true,
|
|
10822
10822
|
role: "menuitemradio",
|
|
10823
10823
|
"aria-checked": selected,
|
|
10824
|
-
"aria-disabled":
|
|
10824
|
+
"aria-disabled": available ? void 0 : true,
|
|
10825
10825
|
"data-menu-item": "model",
|
|
10826
10826
|
onClick: onSelect,
|
|
10827
10827
|
className: cn69("gap-sm", ROW_TRIGGER),
|
|
@@ -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") {
|
|
@@ -11156,7 +11171,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11156
11171
|
ref: menuPanelRef,
|
|
11157
11172
|
id: `${uid}-menu`,
|
|
11158
11173
|
role: "menu",
|
|
11159
|
-
"aria-label":
|
|
11174
|
+
"aria-label": `Prompt options. Current model: ${currentModel?.name ?? "none"}`,
|
|
11160
11175
|
"aria-hidden": menuOpen ? void 0 : true,
|
|
11161
11176
|
"data-state": menuOpen ? "open" : "closed",
|
|
11162
11177
|
inert: !menuOpen,
|
|
@@ -11171,18 +11186,33 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11171
11186
|
},
|
|
11172
11187
|
className: MENU_PANEL,
|
|
11173
11188
|
children: /* @__PURE__ */ jsxs82("div", { className: "flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain", children: [
|
|
11174
|
-
hasModels ? /* @__PURE__ */ jsxs82(
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
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,
|
|
11186
11216
|
hasModels && hasUploadPath ? /* @__PURE__ */ jsx90(
|
|
11187
11217
|
"div",
|
|
11188
11218
|
{
|
|
@@ -11225,7 +11255,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11225
11255
|
"div",
|
|
11226
11256
|
{
|
|
11227
11257
|
className: cn69(
|
|
11228
|
-
"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",
|
|
11229
11259
|
hasError ? "border-semantic-error" : isRecording ? "border-primary" : "border-hairline"
|
|
11230
11260
|
),
|
|
11231
11261
|
children: [
|
|
@@ -11314,7 +11344,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11314
11344
|
"aria-label": "Suggest designs",
|
|
11315
11345
|
onClick: toggleSuggest,
|
|
11316
11346
|
disabled: lockInput,
|
|
11317
|
-
className: cn69(ROUND, "min-w-0 shrink"),
|
|
11347
|
+
className: cn69(ROUND, "min-w-0 shrink px-md!"),
|
|
11318
11348
|
leadingIcon: /* @__PURE__ */ jsx90(Icon, { name: "sparkles", size: 14 }),
|
|
11319
11349
|
trailingIcon: /* @__PURE__ */ jsx90(
|
|
11320
11350
|
"span",
|
|
@@ -11328,14 +11358,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11328
11358
|
"span",
|
|
11329
11359
|
{
|
|
11330
11360
|
className: cn69(
|
|
11331
|
-
"block size-3 rounded-full bg-
|
|
11361
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
11332
11362
|
suggestOn ? "translate-x-3" : "translate-x-0"
|
|
11333
11363
|
)
|
|
11334
11364
|
}
|
|
11335
11365
|
)
|
|
11336
11366
|
}
|
|
11337
11367
|
),
|
|
11338
|
-
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" })
|
|
11339
11369
|
}
|
|
11340
11370
|
),
|
|
11341
11371
|
/* @__PURE__ */ jsxs82("div", { className: "ms-auto flex min-w-0 shrink-0 items-center gap-sm", children: [
|
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
|
}
|
package/package.json
CHANGED
|
@@ -135,7 +135,7 @@ function ModelRow({
|
|
|
135
135
|
wrap
|
|
136
136
|
role="menuitemradio"
|
|
137
137
|
aria-checked={selected}
|
|
138
|
-
aria-disabled={
|
|
138
|
+
aria-disabled={available ? undefined : true}
|
|
139
139
|
data-menu-item="model"
|
|
140
140
|
onClick={onSelect}
|
|
141
141
|
className={cn("gap-sm", ROW_TRIGGER)}
|
|
@@ -254,8 +254,18 @@ export const PromptInputBar = React.forwardRef<
|
|
|
254
254
|
const suggestOn =
|
|
255
255
|
suggestDesigns !== undefined ? suggestDesigns : internalSuggest;
|
|
256
256
|
const hasModels = Boolean(models && models.length > 0);
|
|
257
|
-
|
|
258
|
-
|
|
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;
|
|
259
269
|
const currentModel =
|
|
260
270
|
models?.find((m) => m.id === activeModelId) ?? models?.[0];
|
|
261
271
|
|
|
@@ -391,14 +401,20 @@ export const PromptInputBar = React.forwardRef<
|
|
|
391
401
|
};
|
|
392
402
|
}, [menuOpen, placeMenu]);
|
|
393
403
|
|
|
394
|
-
/* Focus the
|
|
404
|
+
/* Focus the current row on open, and hand focus back to the trigger. */
|
|
395
405
|
React.useEffect(() => {
|
|
396
406
|
if (menuOpen) {
|
|
397
407
|
wasOpen.current = true;
|
|
398
408
|
const id = window.requestAnimationFrame(() => {
|
|
399
|
-
|
|
400
|
-
?.
|
|
401
|
-
|
|
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 });
|
|
402
418
|
});
|
|
403
419
|
return () => window.cancelAnimationFrame(id);
|
|
404
420
|
}
|
|
@@ -506,14 +522,21 @@ export const PromptInputBar = React.forwardRef<
|
|
|
506
522
|
onSuggestDesignsChange?.(next);
|
|
507
523
|
};
|
|
508
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. */
|
|
509
527
|
const handleModelSelect = (model: PromptInputBarModel) => {
|
|
510
528
|
if (model.available === false) {
|
|
511
529
|
onUnavailableModelClick?.(model.id);
|
|
512
|
-
|
|
513
|
-
if (selectedModelId === undefined) setInternalModelId(model.id);
|
|
514
|
-
onModelChange?.(model.id);
|
|
530
|
+
return;
|
|
515
531
|
}
|
|
516
|
-
|
|
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
|
+
});
|
|
517
540
|
};
|
|
518
541
|
|
|
519
542
|
/* Arrow keys walk the rows of the open menu, Escape closes it. */
|
|
@@ -562,7 +585,9 @@ export const PromptInputBar = React.forwardRef<
|
|
|
562
585
|
ref={menuPanelRef}
|
|
563
586
|
id={`${uid}-menu`}
|
|
564
587
|
role="menu"
|
|
565
|
-
aria-label=
|
|
588
|
+
aria-label={`Prompt options. Current model: ${
|
|
589
|
+
currentModel?.name ?? "none"
|
|
590
|
+
}`}
|
|
566
591
|
aria-hidden={menuOpen ? undefined : true}
|
|
567
592
|
data-state={menuOpen ? "open" : "closed"}
|
|
568
593
|
inert={!menuOpen}
|
|
@@ -581,8 +606,15 @@ export const PromptInputBar = React.forwardRef<
|
|
|
581
606
|
reaches the browser's back/forward gesture. */}
|
|
582
607
|
<div className="flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain">
|
|
583
608
|
{hasModels ? (
|
|
584
|
-
<div
|
|
585
|
-
|
|
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
|
+
>
|
|
586
618
|
Model
|
|
587
619
|
</span>
|
|
588
620
|
{models?.map((m) => (
|
|
@@ -641,10 +673,12 @@ export const PromptInputBar = React.forwardRef<
|
|
|
641
673
|
}}
|
|
642
674
|
>
|
|
643
675
|
{/* One surface owns the stroke: canvas pane, hairline border, card lift.
|
|
644
|
-
|
|
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. */}
|
|
645
679
|
<div
|
|
646
680
|
className={cn(
|
|
647
|
-
"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",
|
|
648
682
|
hasError
|
|
649
683
|
? "border-semantic-error"
|
|
650
684
|
: isRecording
|
|
@@ -739,7 +773,7 @@ export const PromptInputBar = React.forwardRef<
|
|
|
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">
|