@designa8/vibedesign-linear-internal-v1-b737 0.13.2 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +58 -29
- package/dist/index.js +58 -29
- package/dist/styles.css +10 -0
- package/package.json +1 -1
- package/src/organisms/PromptInputBar/PromptInputBar.tsx +54 -25
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.4**.
|
|
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),
|
|
@@ -11029,7 +11029,6 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11029
11029
|
const [internalImages, setInternalImages] = React90.useState(
|
|
11030
11030
|
[]
|
|
11031
11031
|
);
|
|
11032
|
-
const [internalModelId, setInternalModelId] = React90.useState(void 0);
|
|
11033
11032
|
const [menuOpen, setMenuOpen] = React90.useState(false);
|
|
11034
11033
|
const [menuPos, setMenuPos] = React90.useState(null);
|
|
11035
11034
|
const [mounted, setMounted] = React90.useState(false);
|
|
@@ -11054,8 +11053,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11054
11053
|
const images = pastedImages !== void 0 ? pastedImages : internalImages;
|
|
11055
11054
|
const suggestOn = suggestDesigns !== void 0 ? suggestDesigns : internalSuggest;
|
|
11056
11055
|
const hasModels = Boolean(models && models.length > 0);
|
|
11057
|
-
const
|
|
11058
|
-
|
|
11056
|
+
const [pickedModelId, setPickedModelId] = React90.useState(selectedModelId);
|
|
11057
|
+
React90.useEffect(() => {
|
|
11058
|
+
if (selectedModelId !== void 0) setPickedModelId(selectedModelId);
|
|
11059
|
+
}, [selectedModelId]);
|
|
11060
|
+
const currentModel = models?.find((m) => m.id === pickedModelId) ?? models?.[0];
|
|
11059
11061
|
const prefersReducedMotion = React90.useCallback(
|
|
11060
11062
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
11061
11063
|
[]
|
|
@@ -11163,7 +11165,15 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11163
11165
|
if (menuOpen) {
|
|
11164
11166
|
wasOpen.current = true;
|
|
11165
11167
|
const id = window.requestAnimationFrame(() => {
|
|
11166
|
-
|
|
11168
|
+
const rows = Array.from(
|
|
11169
|
+
menuPanelRef.current?.querySelectorAll(
|
|
11170
|
+
"[data-menu-item]"
|
|
11171
|
+
) ?? []
|
|
11172
|
+
);
|
|
11173
|
+
const checked = rows.find(
|
|
11174
|
+
(row) => row.getAttribute("aria-checked") === "true"
|
|
11175
|
+
);
|
|
11176
|
+
(checked ?? rows[0])?.focus({ preventScroll: true });
|
|
11167
11177
|
});
|
|
11168
11178
|
return () => window.cancelAnimationFrame(id);
|
|
11169
11179
|
}
|
|
@@ -11259,10 +11269,10 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11259
11269
|
const handleModelSelect = (model) => {
|
|
11260
11270
|
if (model.available === false) {
|
|
11261
11271
|
onUnavailableModelClick?.(model.id);
|
|
11262
|
-
|
|
11263
|
-
if (selectedModelId === void 0) setInternalModelId(model.id);
|
|
11264
|
-
onModelChange?.(model.id);
|
|
11272
|
+
return;
|
|
11265
11273
|
}
|
|
11274
|
+
setPickedModelId(model.id);
|
|
11275
|
+
onModelChange?.(model.id);
|
|
11266
11276
|
closeMenu();
|
|
11267
11277
|
};
|
|
11268
11278
|
const handleMenuKeyDown = (e) => {
|
|
@@ -11317,18 +11327,33 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11317
11327
|
},
|
|
11318
11328
|
className: MENU_PANEL,
|
|
11319
11329
|
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
|
-
|
|
11330
|
+
hasModels ? /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
11331
|
+
"div",
|
|
11332
|
+
{
|
|
11333
|
+
role: "group",
|
|
11334
|
+
"aria-label": "Model",
|
|
11335
|
+
className: "flex flex-col gap-xxs",
|
|
11336
|
+
children: [
|
|
11337
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11338
|
+
"span",
|
|
11339
|
+
{
|
|
11340
|
+
"aria-hidden": "true",
|
|
11341
|
+
className: "px-sm pb-xxs pt-xs text-overline text-muted",
|
|
11342
|
+
children: "Model"
|
|
11343
|
+
}
|
|
11344
|
+
),
|
|
11345
|
+
models?.map((m) => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11346
|
+
ModelRow,
|
|
11347
|
+
{
|
|
11348
|
+
model: m,
|
|
11349
|
+
selected: m.available !== false && m.id === currentModel?.id,
|
|
11350
|
+
onSelect: () => handleModelSelect(m)
|
|
11351
|
+
},
|
|
11352
|
+
m.id
|
|
11353
|
+
))
|
|
11354
|
+
]
|
|
11355
|
+
}
|
|
11356
|
+
) : null,
|
|
11332
11357
|
hasModels && hasUploadPath ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11333
11358
|
"div",
|
|
11334
11359
|
{
|
|
@@ -11371,7 +11396,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11371
11396
|
"div",
|
|
11372
11397
|
{
|
|
11373
11398
|
className: cn69(
|
|
11374
|
-
"flex w-full min-w-0 flex-col gap-base rounded-
|
|
11399
|
+
"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
11400
|
hasError ? "border-semantic-error" : isRecording ? "border-primary" : "border-hairline"
|
|
11376
11401
|
),
|
|
11377
11402
|
children: [
|
|
@@ -11429,13 +11454,13 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11429
11454
|
inert: isRecording,
|
|
11430
11455
|
className: ROW_LAYER,
|
|
11431
11456
|
children: [
|
|
11432
|
-
/* @__PURE__ */ (0, import_jsx_runtime90.
|
|
11433
|
-
|
|
11457
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
11458
|
+
Button,
|
|
11434
11459
|
{
|
|
11435
11460
|
ref: plusRef,
|
|
11436
|
-
|
|
11437
|
-
size: "lg",
|
|
11461
|
+
iconOnly: true,
|
|
11438
11462
|
variant: "soft",
|
|
11463
|
+
size: "lg",
|
|
11439
11464
|
"aria-label": triggerLabel,
|
|
11440
11465
|
"aria-haspopup": "menu",
|
|
11441
11466
|
"aria-expanded": menuOpen,
|
|
@@ -11447,7 +11472,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11447
11472
|
ROUND,
|
|
11448
11473
|
"shrink-0 transition-transform duration-200 ease-out",
|
|
11449
11474
|
menuOpen && "rotate-45"
|
|
11450
|
-
)
|
|
11475
|
+
),
|
|
11476
|
+
children: [
|
|
11477
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Icon, { name: "plus", size: 18 }),
|
|
11478
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "sr-only", children: currentModel?.name ?? "" })
|
|
11479
|
+
]
|
|
11451
11480
|
}
|
|
11452
11481
|
),
|
|
11453
11482
|
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
@@ -11460,7 +11489,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11460
11489
|
"aria-label": "Suggest designs",
|
|
11461
11490
|
onClick: toggleSuggest,
|
|
11462
11491
|
disabled: lockInput,
|
|
11463
|
-
className: cn69(ROUND, "min-w-0 shrink"),
|
|
11492
|
+
className: cn69(ROUND, "min-w-0 shrink px-md!"),
|
|
11464
11493
|
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Icon, { name: "sparkles", size: 14 }),
|
|
11465
11494
|
trailingIcon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
11466
11495
|
"span",
|
|
@@ -11474,14 +11503,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11474
11503
|
"span",
|
|
11475
11504
|
{
|
|
11476
11505
|
className: cn69(
|
|
11477
|
-
"block size-3 rounded-full bg-
|
|
11506
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
11478
11507
|
suggestOn ? "translate-x-3" : "translate-x-0"
|
|
11479
11508
|
)
|
|
11480
11509
|
}
|
|
11481
11510
|
)
|
|
11482
11511
|
}
|
|
11483
11512
|
),
|
|
11484
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "block min-w-0 truncate", children: "Suggest designs" })
|
|
11513
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "block min-w-0 truncate text-body-sm", children: "Suggest designs" })
|
|
11485
11514
|
}
|
|
11486
11515
|
),
|
|
11487
11516
|
/* @__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),
|
|
@@ -10883,7 +10883,6 @@ var PromptInputBar = React90.forwardRef(
|
|
|
10883
10883
|
const [internalImages, setInternalImages] = React90.useState(
|
|
10884
10884
|
[]
|
|
10885
10885
|
);
|
|
10886
|
-
const [internalModelId, setInternalModelId] = React90.useState(void 0);
|
|
10887
10886
|
const [menuOpen, setMenuOpen] = React90.useState(false);
|
|
10888
10887
|
const [menuPos, setMenuPos] = React90.useState(null);
|
|
10889
10888
|
const [mounted, setMounted] = React90.useState(false);
|
|
@@ -10908,8 +10907,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
10908
10907
|
const images = pastedImages !== void 0 ? pastedImages : internalImages;
|
|
10909
10908
|
const suggestOn = suggestDesigns !== void 0 ? suggestDesigns : internalSuggest;
|
|
10910
10909
|
const hasModels = Boolean(models && models.length > 0);
|
|
10911
|
-
const
|
|
10912
|
-
|
|
10910
|
+
const [pickedModelId, setPickedModelId] = React90.useState(selectedModelId);
|
|
10911
|
+
React90.useEffect(() => {
|
|
10912
|
+
if (selectedModelId !== void 0) setPickedModelId(selectedModelId);
|
|
10913
|
+
}, [selectedModelId]);
|
|
10914
|
+
const currentModel = models?.find((m) => m.id === pickedModelId) ?? models?.[0];
|
|
10913
10915
|
const prefersReducedMotion = React90.useCallback(
|
|
10914
10916
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
10915
10917
|
[]
|
|
@@ -11017,7 +11019,15 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11017
11019
|
if (menuOpen) {
|
|
11018
11020
|
wasOpen.current = true;
|
|
11019
11021
|
const id = window.requestAnimationFrame(() => {
|
|
11020
|
-
|
|
11022
|
+
const rows = Array.from(
|
|
11023
|
+
menuPanelRef.current?.querySelectorAll(
|
|
11024
|
+
"[data-menu-item]"
|
|
11025
|
+
) ?? []
|
|
11026
|
+
);
|
|
11027
|
+
const checked = rows.find(
|
|
11028
|
+
(row) => row.getAttribute("aria-checked") === "true"
|
|
11029
|
+
);
|
|
11030
|
+
(checked ?? rows[0])?.focus({ preventScroll: true });
|
|
11021
11031
|
});
|
|
11022
11032
|
return () => window.cancelAnimationFrame(id);
|
|
11023
11033
|
}
|
|
@@ -11113,10 +11123,10 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11113
11123
|
const handleModelSelect = (model) => {
|
|
11114
11124
|
if (model.available === false) {
|
|
11115
11125
|
onUnavailableModelClick?.(model.id);
|
|
11116
|
-
|
|
11117
|
-
if (selectedModelId === void 0) setInternalModelId(model.id);
|
|
11118
|
-
onModelChange?.(model.id);
|
|
11126
|
+
return;
|
|
11119
11127
|
}
|
|
11128
|
+
setPickedModelId(model.id);
|
|
11129
|
+
onModelChange?.(model.id);
|
|
11120
11130
|
closeMenu();
|
|
11121
11131
|
};
|
|
11122
11132
|
const handleMenuKeyDown = (e) => {
|
|
@@ -11171,18 +11181,33 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11171
11181
|
},
|
|
11172
11182
|
className: MENU_PANEL,
|
|
11173
11183
|
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
|
-
|
|
11184
|
+
hasModels ? /* @__PURE__ */ jsxs82(
|
|
11185
|
+
"div",
|
|
11186
|
+
{
|
|
11187
|
+
role: "group",
|
|
11188
|
+
"aria-label": "Model",
|
|
11189
|
+
className: "flex flex-col gap-xxs",
|
|
11190
|
+
children: [
|
|
11191
|
+
/* @__PURE__ */ jsx90(
|
|
11192
|
+
"span",
|
|
11193
|
+
{
|
|
11194
|
+
"aria-hidden": "true",
|
|
11195
|
+
className: "px-sm pb-xxs pt-xs text-overline text-muted",
|
|
11196
|
+
children: "Model"
|
|
11197
|
+
}
|
|
11198
|
+
),
|
|
11199
|
+
models?.map((m) => /* @__PURE__ */ jsx90(
|
|
11200
|
+
ModelRow,
|
|
11201
|
+
{
|
|
11202
|
+
model: m,
|
|
11203
|
+
selected: m.available !== false && m.id === currentModel?.id,
|
|
11204
|
+
onSelect: () => handleModelSelect(m)
|
|
11205
|
+
},
|
|
11206
|
+
m.id
|
|
11207
|
+
))
|
|
11208
|
+
]
|
|
11209
|
+
}
|
|
11210
|
+
) : null,
|
|
11186
11211
|
hasModels && hasUploadPath ? /* @__PURE__ */ jsx90(
|
|
11187
11212
|
"div",
|
|
11188
11213
|
{
|
|
@@ -11225,7 +11250,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11225
11250
|
"div",
|
|
11226
11251
|
{
|
|
11227
11252
|
className: cn69(
|
|
11228
|
-
"flex w-full min-w-0 flex-col gap-base rounded-
|
|
11253
|
+
"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
11254
|
hasError ? "border-semantic-error" : isRecording ? "border-primary" : "border-hairline"
|
|
11230
11255
|
),
|
|
11231
11256
|
children: [
|
|
@@ -11283,13 +11308,13 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11283
11308
|
inert: isRecording,
|
|
11284
11309
|
className: ROW_LAYER,
|
|
11285
11310
|
children: [
|
|
11286
|
-
/* @__PURE__ */
|
|
11287
|
-
|
|
11311
|
+
/* @__PURE__ */ jsxs82(
|
|
11312
|
+
Button,
|
|
11288
11313
|
{
|
|
11289
11314
|
ref: plusRef,
|
|
11290
|
-
|
|
11291
|
-
size: "lg",
|
|
11315
|
+
iconOnly: true,
|
|
11292
11316
|
variant: "soft",
|
|
11317
|
+
size: "lg",
|
|
11293
11318
|
"aria-label": triggerLabel,
|
|
11294
11319
|
"aria-haspopup": "menu",
|
|
11295
11320
|
"aria-expanded": menuOpen,
|
|
@@ -11301,7 +11326,11 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11301
11326
|
ROUND,
|
|
11302
11327
|
"shrink-0 transition-transform duration-200 ease-out",
|
|
11303
11328
|
menuOpen && "rotate-45"
|
|
11304
|
-
)
|
|
11329
|
+
),
|
|
11330
|
+
children: [
|
|
11331
|
+
/* @__PURE__ */ jsx90(Icon, { name: "plus", size: 18 }),
|
|
11332
|
+
/* @__PURE__ */ jsx90("span", { className: "sr-only", children: currentModel?.name ?? "" })
|
|
11333
|
+
]
|
|
11305
11334
|
}
|
|
11306
11335
|
),
|
|
11307
11336
|
/* @__PURE__ */ jsx90(
|
|
@@ -11314,7 +11343,7 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11314
11343
|
"aria-label": "Suggest designs",
|
|
11315
11344
|
onClick: toggleSuggest,
|
|
11316
11345
|
disabled: lockInput,
|
|
11317
|
-
className: cn69(ROUND, "min-w-0 shrink"),
|
|
11346
|
+
className: cn69(ROUND, "min-w-0 shrink px-md!"),
|
|
11318
11347
|
leadingIcon: /* @__PURE__ */ jsx90(Icon, { name: "sparkles", size: 14 }),
|
|
11319
11348
|
trailingIcon: /* @__PURE__ */ jsx90(
|
|
11320
11349
|
"span",
|
|
@@ -11328,14 +11357,14 @@ var PromptInputBar = React90.forwardRef(
|
|
|
11328
11357
|
"span",
|
|
11329
11358
|
{
|
|
11330
11359
|
className: cn69(
|
|
11331
|
-
"block size-3 rounded-full bg-
|
|
11360
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
11332
11361
|
suggestOn ? "translate-x-3" : "translate-x-0"
|
|
11333
11362
|
)
|
|
11334
11363
|
}
|
|
11335
11364
|
)
|
|
11336
11365
|
}
|
|
11337
11366
|
),
|
|
11338
|
-
children: /* @__PURE__ */ jsx90("span", { className: "block min-w-0 truncate", children: "Suggest designs" })
|
|
11367
|
+
children: /* @__PURE__ */ jsx90("span", { className: "block min-w-0 truncate text-body-sm", children: "Suggest designs" })
|
|
11339
11368
|
}
|
|
11340
11369
|
),
|
|
11341
11370
|
/* @__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)}
|
|
@@ -216,9 +216,6 @@ export const PromptInputBar = React.forwardRef<
|
|
|
216
216
|
const [internalImages, setInternalImages] = React.useState<PastedImage[]>(
|
|
217
217
|
[],
|
|
218
218
|
);
|
|
219
|
-
const [internalModelId, setInternalModelId] = React.useState<
|
|
220
|
-
string | undefined
|
|
221
|
-
>(undefined);
|
|
222
219
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
223
220
|
const [menuPos, setMenuPos] = React.useState<{
|
|
224
221
|
top: number;
|
|
@@ -254,10 +251,19 @@ export const PromptInputBar = React.forwardRef<
|
|
|
254
251
|
const suggestOn =
|
|
255
252
|
suggestDesigns !== undefined ? suggestDesigns : internalSuggest;
|
|
256
253
|
const hasModels = Boolean(models && models.length > 0);
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
|
|
255
|
+
/* The pick has to read back on the trigger the instant a row is chosen, even
|
|
256
|
+
before a controlled parent echoes the id, so it is mirrored locally. */
|
|
257
|
+
const [pickedModelId, setPickedModelId] = React.useState<
|
|
258
|
+
string | undefined
|
|
259
|
+
>(selectedModelId);
|
|
260
|
+
|
|
261
|
+
React.useEffect(() => {
|
|
262
|
+
if (selectedModelId !== undefined) setPickedModelId(selectedModelId);
|
|
263
|
+
}, [selectedModelId]);
|
|
264
|
+
|
|
259
265
|
const currentModel =
|
|
260
|
-
models?.find((m) => m.id ===
|
|
266
|
+
models?.find((m) => m.id === pickedModelId) ?? models?.[0];
|
|
261
267
|
|
|
262
268
|
const prefersReducedMotion = React.useCallback(
|
|
263
269
|
() =>
|
|
@@ -391,14 +397,20 @@ export const PromptInputBar = React.forwardRef<
|
|
|
391
397
|
};
|
|
392
398
|
}, [menuOpen, placeMenu]);
|
|
393
399
|
|
|
394
|
-
/* Focus the
|
|
400
|
+
/* Focus the current row on open, and hand focus back to the trigger. */
|
|
395
401
|
React.useEffect(() => {
|
|
396
402
|
if (menuOpen) {
|
|
397
403
|
wasOpen.current = true;
|
|
398
404
|
const id = window.requestAnimationFrame(() => {
|
|
399
|
-
|
|
400
|
-
?.
|
|
401
|
-
|
|
405
|
+
const rows = Array.from(
|
|
406
|
+
menuPanelRef.current?.querySelectorAll<HTMLElement>(
|
|
407
|
+
"[data-menu-item]",
|
|
408
|
+
) ?? [],
|
|
409
|
+
);
|
|
410
|
+
const checked = rows.find(
|
|
411
|
+
(row) => row.getAttribute("aria-checked") === "true",
|
|
412
|
+
);
|
|
413
|
+
(checked ?? rows[0])?.focus({ preventScroll: true });
|
|
402
414
|
});
|
|
403
415
|
return () => window.cancelAnimationFrame(id);
|
|
404
416
|
}
|
|
@@ -509,10 +521,10 @@ export const PromptInputBar = React.forwardRef<
|
|
|
509
521
|
const handleModelSelect = (model: PromptInputBarModel) => {
|
|
510
522
|
if (model.available === false) {
|
|
511
523
|
onUnavailableModelClick?.(model.id);
|
|
512
|
-
|
|
513
|
-
if (selectedModelId === undefined) setInternalModelId(model.id);
|
|
514
|
-
onModelChange?.(model.id);
|
|
524
|
+
return;
|
|
515
525
|
}
|
|
526
|
+
setPickedModelId(model.id);
|
|
527
|
+
onModelChange?.(model.id);
|
|
516
528
|
closeMenu();
|
|
517
529
|
};
|
|
518
530
|
|
|
@@ -581,8 +593,15 @@ export const PromptInputBar = React.forwardRef<
|
|
|
581
593
|
reaches the browser's back/forward gesture. */}
|
|
582
594
|
<div className="flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain">
|
|
583
595
|
{hasModels ? (
|
|
584
|
-
<div
|
|
585
|
-
|
|
596
|
+
<div
|
|
597
|
+
role="group"
|
|
598
|
+
aria-label="Model"
|
|
599
|
+
className="flex flex-col gap-xxs"
|
|
600
|
+
>
|
|
601
|
+
<span
|
|
602
|
+
aria-hidden="true"
|
|
603
|
+
className="px-sm pb-xxs pt-xs text-overline text-muted"
|
|
604
|
+
>
|
|
586
605
|
Model
|
|
587
606
|
</span>
|
|
588
607
|
{models?.map((m) => (
|
|
@@ -641,10 +660,12 @@ export const PromptInputBar = React.forwardRef<
|
|
|
641
660
|
}}
|
|
642
661
|
>
|
|
643
662
|
{/* One surface owns the stroke: canvas pane, hairline border, card lift.
|
|
644
|
-
|
|
663
|
+
A soft 24px shell stays a single base step on phones; from `sm` it
|
|
664
|
+
opens to a roomy inset (24 left/right, 24 top, 16 bottom) with a
|
|
665
|
+
16px rhythm between the field and the toolbar. */}
|
|
645
666
|
<div
|
|
646
667
|
className={cn(
|
|
647
|
-
"flex w-full min-w-0 flex-col gap-base rounded-
|
|
668
|
+
"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
669
|
hasError
|
|
649
670
|
? "border-semantic-error"
|
|
650
671
|
: isRecording
|
|
@@ -712,11 +733,14 @@ export const PromptInputBar = React.forwardRef<
|
|
|
712
733
|
inert={isRecording}
|
|
713
734
|
className={ROW_LAYER}
|
|
714
735
|
>
|
|
715
|
-
|
|
736
|
+
{/* One 36px circle: soft fill, inset hairline ring, ink glyph. The
|
|
737
|
+
model name lives in its label and its hidden text, so a pick
|
|
738
|
+
reads back on the trigger itself. */}
|
|
739
|
+
<Button
|
|
716
740
|
ref={plusRef}
|
|
717
|
-
|
|
718
|
-
size="lg"
|
|
741
|
+
iconOnly
|
|
719
742
|
variant="soft"
|
|
743
|
+
size="lg"
|
|
720
744
|
aria-label={triggerLabel}
|
|
721
745
|
aria-haspopup="menu"
|
|
722
746
|
aria-expanded={menuOpen}
|
|
@@ -729,7 +753,10 @@ export const PromptInputBar = React.forwardRef<
|
|
|
729
753
|
"shrink-0 transition-transform duration-200 ease-out",
|
|
730
754
|
menuOpen && "rotate-45",
|
|
731
755
|
)}
|
|
732
|
-
|
|
756
|
+
>
|
|
757
|
+
<Icon name="plus" size={18} />
|
|
758
|
+
<span className="sr-only">{currentModel?.name ?? ""}</span>
|
|
759
|
+
</Button>
|
|
733
760
|
|
|
734
761
|
<Button
|
|
735
762
|
variant="tint"
|
|
@@ -739,7 +766,7 @@ export const PromptInputBar = React.forwardRef<
|
|
|
739
766
|
aria-label="Suggest designs"
|
|
740
767
|
onClick={toggleSuggest}
|
|
741
768
|
disabled={lockInput}
|
|
742
|
-
className={cn(ROUND, "min-w-0 shrink")}
|
|
769
|
+
className={cn(ROUND, "min-w-0 shrink px-md!")}
|
|
743
770
|
leadingIcon={<Icon name="sparkles" size={14} />}
|
|
744
771
|
trailingIcon={
|
|
745
772
|
<span
|
|
@@ -751,14 +778,16 @@ export const PromptInputBar = React.forwardRef<
|
|
|
751
778
|
>
|
|
752
779
|
<span
|
|
753
780
|
className={cn(
|
|
754
|
-
"block size-3 rounded-full bg-
|
|
781
|
+
"block size-3 rounded-full bg-inverse-ink shadow-sm transition-transform duration-150 ease-out",
|
|
755
782
|
suggestOn ? "translate-x-3" : "translate-x-0",
|
|
756
783
|
)}
|
|
757
784
|
/>
|
|
758
785
|
</span>
|
|
759
786
|
}
|
|
760
787
|
>
|
|
761
|
-
<span className="block min-w-0 truncate">
|
|
788
|
+
<span className="block min-w-0 truncate text-body-sm">
|
|
789
|
+
Suggest designs
|
|
790
|
+
</span>
|
|
762
791
|
</Button>
|
|
763
792
|
|
|
764
793
|
<div className="ms-auto flex min-w-0 shrink-0 items-center gap-sm">
|