@vvedantb/ui 0.64.0 → 0.65.0

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 CHANGED
@@ -1847,7 +1847,7 @@ AI surfaces that came from an app, exported from the root. Fills use `surface-se
1847
1847
  - `ActivityQuestionCard` (`questions`, `answers`): the read-only record of a multiple-choice question and its answer.
1848
1848
  - `AgentTrace`, `AgentTraceLine` (`status`: `AgentTraceStatus`, `running | error | pending`), `AgentTraceIcon` (`iconKey` crossfades a swap), `AgentTraceTitle` (`shimmer`), `AgentTraceDescription`, `AgentTraceCollapsible`, `AgentTraceCollapsibleTrigger` (`trailing`: controls beside the trigger), `AgentTraceCollapsibleContent`: one agent step as one line, with an optional fold.
1849
1849
  - `AgentPlan*`, `TestResults*` / `TestSuite*` / `TestResult*` (one test: `TestResult`, `TestResultStatusIndicator`, `TestResultName`, `TestResultDuration`, `TestResultError`, `TestResultErrorMessage`, `TestResultErrorStack`), `WebPreview*` (with `useWebPreview`), `ContextUsage*` (context window usage in a hover card: `ContextUsage`, `ContextUsageTrigger`, `ContextUsageContent`, `ContextUsageContentHeader` / `Body` / `Footer`, `ContextUsageInput`, `ContextUsageOutput`, `ContextUsageCacheRead`, `ContextUsageCacheWrite`, deprecated `ContextUsageCache`).
1850
- - `ModelPicker` (button and popover; `simpleLadder` opens on a discrete slider; the one model picker), `ModelPickerContent` (the searchable model and account list, for menus; pair it with `modelPickerSurfaceClass`), `ModelOption`, `ModelAccount`, `findModelOption`, `formatModelDisplayLabel`, `getProviderLabel`, `ProviderIcon` (`claude`, `codex`, `opencode`, `cursor`).
1850
+ - `ModelPicker` (button and popover; `simpleLadder` opens on a discrete slider; the one model picker). Its `traits` prop is required: the selected model's trait controls (`ModelPickerTraits`, the `TraitsPanel` props). The picker pins them above the list and sums them up on the trigger (`modelPickerTraitSummary`: reasoning level, "1M", "No thinking", and a bolt for Fast). Pass `null` only where runs take no traits. `ModelPickerContent` (the searchable model and account list, for menus; pair it with `modelPickerSurfaceClass`), `ModelOption`, `ModelAccount`, `findModelOption`, `formatModelDisplayLabel`, `getProviderLabel`, `ProviderIcon` (`claude`, `codex`, `opencode`, `cursor`).
1851
1851
  - Deprecated, removed in the next minor release: `ModelSelector*` and `PromptInputModelSelect*` (use `ModelPicker`). Behaviour is unchanged, except `ModelSelectorLogo`: it now renders `ProviderIcon` and fetches nothing (it loaded `https://models.dev/logos/<provider>.svg`). `anthropic`, `google-vertex-anthropic` and `claude` show the Claude mark, `openai` and `codex` the OpenAI mark, `opencode` and `cursor` their marks; any other id shows a neutral CPU glyph. It takes SVG props and `size` (default 12) and keeps the `"<provider> logo"` name. `ModelSelectorLogoGroup` styles `svg` children.
1852
1852
 
1853
1853
  ### App config entries
@@ -7,6 +7,7 @@ import { useCn, useUiConfig } from "../ui/ui-config.js";
7
7
  import { ProviderIcon } from "./provider-icon.js";
8
8
  import { ModelPickerContent, buildPickerInstances, providerInstanceInitials, teamInstanceKey } from "./model-picker-content.js";
9
9
  import { findModelOption, formatModelDisplayLabel, getProviderLabel } from "./model-picker-types.js";
10
+ import { TraitsPanel } from "./prompt-input-traits.js";
10
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
12
  export { findModelOption, formatModelDisplayLabel, getProviderLabel };
12
13
  /** Embeddable picker body — use in menus/submenus; use `ModelPicker` for button triggers. */
@@ -32,13 +33,42 @@ const TRIGGER_CLASS =
32
33
  * sync so trigger vs embed surfaces cannot drift.
33
34
  */
34
35
  export const modelPickerSurfaceClass = "w-100 max-w-[calc(100vw-1rem)] overflow-hidden rounded-menu border-0 bg-transparent p-0 shadow-none";
36
+
37
+ /**
38
+ * The selected model's trait controls (reasoning, thinking, context window,
39
+ * Fast). `ModelPicker` pins them above the model list and sums them up on the
40
+ * trigger, so every picker shows traits the same way.
41
+ */
42
+
43
+ /**
44
+ * What the trigger shows after the model name: the reasoning level, "1M" when
45
+ * the 1M context is on, "No thinking" when thinking is off, joined by " · ",
46
+ * and whether Fast is on (the bolt). Only traits the model supports count.
47
+ */
48
+ export function modelPickerTraitSummary(traits) {
49
+ const {
50
+ config
51
+ } = traits;
52
+ const parts = [];
53
+ if (config.reasoning) {
54
+ parts.push(traits.getLevelLabel(traits.effortLevel ?? config.reasoning.default));
55
+ }
56
+ if (config.contextWindow1m && traits.use1mContext) parts.push("1M");
57
+ if (config.thinkingToggle && !traits.thinkingEnabled) {
58
+ parts.push("No thinking");
59
+ }
60
+ return {
61
+ suffix: parts.length > 0 ? parts.join(" · ") : undefined,
62
+ fast: Boolean(config.fastMode && traits.fastMode)
63
+ };
64
+ }
35
65
  /**
36
66
  * Button + popover model picker (create modal, composers, toolbars).
37
67
  * For context/dropdown menus, embed `ModelPickerContent` with
38
68
  * `modelPickerSurfaceClass` instead of nesting this popover.
39
69
  */
40
70
  export function ModelPicker(t0) {
41
- const $ = _c(100);
71
+ const $ = _c(105);
42
72
  const {
43
73
  value,
44
74
  onValueChange,
@@ -50,9 +80,7 @@ export function ModelPicker(t0) {
50
80
  onAccountChange,
51
81
  onSelectionChange,
52
82
  canSelectTeamWhilePersonal: t2,
53
- triggerSuffix,
54
- header,
55
- showFastIcon,
83
+ traits,
56
84
  simpleLadder,
57
85
  simpleLadderSnap
58
86
  } = t0;
@@ -60,6 +88,29 @@ export function ModelPicker(t0) {
60
88
  const canSelectTeamWhilePersonal = t2 === undefined ? true : t2;
61
89
  const merge = useCn();
62
90
  const config = useUiConfig("ModelPicker");
91
+ let t3;
92
+ if ($[0] !== traits) {
93
+ t3 = traits === null ? null : modelPickerTraitSummary(traits);
94
+ $[0] = traits;
95
+ $[1] = t3;
96
+ } else {
97
+ t3 = $[1];
98
+ }
99
+ const summary = t3;
100
+ const triggerSuffix = summary?.suffix;
101
+ let t4;
102
+ if ($[2] !== disabled || $[3] !== traits) {
103
+ t4 = traits === null ? undefined : /*#__PURE__*/_jsx(TraitsPanel, {
104
+ ...traits,
105
+ disabled: disabled
106
+ });
107
+ $[2] = disabled;
108
+ $[3] = traits;
109
+ $[4] = t4;
110
+ } else {
111
+ t4 = $[4];
112
+ }
113
+ const header = t4;
63
114
  const [open, setOpen] = useState(false);
64
115
  const [advanced, setAdvanced] = useState(false);
65
116
  const [previewId, setPreviewId] = useState(null);
@@ -75,17 +126,17 @@ export function ModelPicker(t0) {
75
126
  let t11;
76
127
  let t12;
77
128
  let t13;
78
- let t3;
79
- let t4;
129
+ let t14;
130
+ let t15;
80
131
  let t5;
81
132
  let t6;
82
133
  let t7;
83
134
  let t8;
84
135
  let t9;
85
136
  let triggerLabel;
86
- if ($[0] !== accountId || $[1] !== accounts || $[2] !== advanced || $[3] !== className || $[4] !== config?.badgeRing?.trigger || $[5] !== config?.classes?.trigger || $[6] !== disabled || $[7] !== displayValue || $[8] !== merge || $[9] !== onAccountChange || $[10] !== onSelectionChange || $[11] !== onValueChange || $[12] !== open || $[13] !== options || $[14] !== showFastIcon || $[15] !== simpleLadder || $[16] !== simpleLadderSnap || $[17] !== value) {
137
+ if ($[5] !== accountId || $[6] !== accounts || $[7] !== advanced || $[8] !== className || $[9] !== config?.badgeRing?.trigger || $[10] !== config?.classes?.trigger || $[11] !== disabled || $[12] !== displayValue || $[13] !== merge || $[14] !== onAccountChange || $[15] !== onSelectionChange || $[16] !== onValueChange || $[17] !== open || $[18] !== options || $[19] !== simpleLadder || $[20] !== simpleLadderSnap || $[21] !== summary?.fast || $[22] !== value) {
87
138
  const selectedModel = findModelOption(displayValue, options);
88
- if ($[37] !== options || $[38] !== simpleLadder) {
139
+ if ($[42] !== options || $[43] !== simpleLadder) {
89
140
  ladderSteps = [];
90
141
  if (simpleLadder) {
91
142
  for (const id of simpleLadder) {
@@ -95,16 +146,16 @@ export function ModelPicker(t0) {
95
146
  }
96
147
  }
97
148
  }
98
- $[37] = options;
99
- $[38] = simpleLadder;
100
- $[39] = ladderSteps;
149
+ $[42] = options;
150
+ $[43] = simpleLadder;
151
+ $[44] = ladderSteps;
101
152
  } else {
102
- ladderSteps = $[39];
153
+ ladderSteps = $[44];
103
154
  }
104
155
  showLadder = ladderSteps.length >= 2 && !advanced;
105
156
  const preferredSnap = simpleLadderSnap ?? value;
106
157
  snappedAmong = ladderSteps[0]?.id ?? value;
107
- if ($[40] !== ladderSteps || $[41] !== preferredSnap || $[42] !== value) {
158
+ if ($[45] !== ladderSteps || $[46] !== preferredSnap || $[47] !== value) {
108
159
  for (const step of ladderSteps) {
109
160
  if (step.id === value || step.id === preferredSnap) {
110
161
  snappedAmong = step.id;
@@ -113,21 +164,21 @@ export function ModelPicker(t0) {
113
164
  }
114
165
  }
115
166
  }
116
- $[40] = ladderSteps;
117
- $[41] = preferredSnap;
118
- $[42] = value;
119
- $[43] = snappedAmong;
167
+ $[45] = ladderSteps;
168
+ $[46] = preferredSnap;
169
+ $[47] = value;
170
+ $[48] = snappedAmong;
120
171
  } else {
121
- snappedAmong = $[43];
172
+ snappedAmong = $[48];
122
173
  }
123
174
  triggerLabel = selectedModel ? selectedModel.label : "Select model";
124
175
  const instances = buildPickerInstances(options, accounts);
125
176
  const selectedAccount = accountId ? accounts?.find(account => account.id === accountId) : undefined;
126
177
  const activeInstance = (selectedAccount ? instances.find(instance_0 => instance_0.key === selectedAccount.id) : undefined) ?? (selectedModel ? instances.find(instance => instance.key === teamInstanceKey(selectedModel.provider)) : undefined) ?? instances[0];
127
178
  const showAccountBadge = Boolean(selectedAccount && instances.filter(instance_1 => instance_1.provider === selectedAccount.provider).length > 1);
128
- let t14;
129
- if ($[44] !== onAccountChange || $[45] !== onSelectionChange || $[46] !== onValueChange) {
130
- t14 = (modelId, nextAccountId) => {
179
+ let t16;
180
+ if ($[49] !== onAccountChange || $[50] !== onSelectionChange || $[51] !== onValueChange) {
181
+ t16 = (modelId, nextAccountId) => {
131
182
  if (onSelectionChange) {
132
183
  onSelectionChange(modelId, nextAccountId);
133
184
  } else {
@@ -135,14 +186,14 @@ export function ModelPicker(t0) {
135
186
  onAccountChange?.(nextAccountId);
136
187
  }
137
188
  };
138
- $[44] = onAccountChange;
139
- $[45] = onSelectionChange;
140
- $[46] = onValueChange;
141
- $[47] = t14;
189
+ $[49] = onAccountChange;
190
+ $[50] = onSelectionChange;
191
+ $[51] = onValueChange;
192
+ $[52] = t16;
142
193
  } else {
143
- t14 = $[47];
194
+ t16 = $[52];
144
195
  }
145
- commit = t14;
196
+ commit = t16;
146
197
  accountForModel = modelId_0 => {
147
198
  const option_0 = options.find(entry_0 => entry_0.id === modelId_0);
148
199
  if (!option_0) {
@@ -154,38 +205,38 @@ export function ModelPicker(t0) {
154
205
  return null;
155
206
  };
156
207
  T1 = Popover;
157
- t12 = open;
158
- if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
159
- t13 = next => {
208
+ t14 = open;
209
+ if ($[53] === Symbol.for("react.memo_cache_sentinel")) {
210
+ t15 = next => {
160
211
  setOpen(next);
161
212
  if (!next) {
162
213
  setAdvanced(false);
163
214
  setPreviewId(null);
164
215
  }
165
216
  };
166
- $[48] = t13;
217
+ $[53] = t15;
167
218
  } else {
168
- t13 = $[48];
219
+ t15 = $[53];
169
220
  }
170
221
  T0 = PopoverTrigger;
171
- t11 = true;
172
- t3 = "button";
173
- t4 = "combobox";
174
- t5 = open;
175
- t6 = "select-trigger";
176
- const t15 = config?.classes?.trigger ?? TRIGGER_CLASS;
177
- if ($[49] !== className || $[50] !== merge || $[51] !== t15) {
178
- t7 = merge(t15, className);
179
- $[49] = className;
180
- $[50] = merge;
181
- $[51] = t15;
182
- $[52] = t7;
222
+ t13 = true;
223
+ t5 = "button";
224
+ t6 = "combobox";
225
+ t7 = open;
226
+ t8 = "select-trigger";
227
+ const t17 = config?.classes?.trigger ?? TRIGGER_CLASS;
228
+ if ($[54] !== className || $[55] !== merge || $[56] !== t17) {
229
+ t9 = merge(t17, className);
230
+ $[54] = className;
231
+ $[55] = merge;
232
+ $[56] = t17;
233
+ $[57] = t9;
183
234
  } else {
184
- t7 = $[52];
235
+ t9 = $[57];
185
236
  }
186
- t8 = disabled;
187
- if ($[53] !== showFastIcon) {
188
- t9 = showFastIcon ? /*#__PURE__*/_jsx("span", {
237
+ t10 = disabled;
238
+ if ($[58] !== summary?.fast) {
239
+ t11 = summary?.fast ? /*#__PURE__*/_jsx("span", {
189
240
  title: "Fast",
190
241
  className: "inline-flex shrink-0",
191
242
  children: /*#__PURE__*/_jsx(IconBolt, {
@@ -193,12 +244,12 @@ export function ModelPicker(t0) {
193
244
  "aria-hidden": true
194
245
  })
195
246
  }) : null;
196
- $[53] = showFastIcon;
197
- $[54] = t9;
247
+ $[58] = summary?.fast;
248
+ $[59] = t11;
198
249
  } else {
199
- t9 = $[54];
250
+ t11 = $[59];
200
251
  }
201
- t10 = activeInstance && selectedAccount && showAccountBadge ? /*#__PURE__*/_jsxs("span", {
252
+ t12 = activeInstance && selectedAccount && showAccountBadge ? /*#__PURE__*/_jsxs("span", {
202
253
  className: "relative isolate inline-flex size-4 shrink-0 items-center justify-center",
203
254
  children: [/*#__PURE__*/_jsx(ProviderIcon, {
204
255
  provider: selectedModel?.provider ?? "claude",
@@ -215,152 +266,152 @@ export function ModelPicker(t0) {
215
266
  provider: selectedModel?.provider ?? "claude",
216
267
  size: 14
217
268
  });
218
- $[0] = accountId;
219
- $[1] = accounts;
220
- $[2] = advanced;
221
- $[3] = className;
222
- $[4] = config?.badgeRing?.trigger;
223
- $[5] = config?.classes?.trigger;
224
- $[6] = disabled;
225
- $[7] = displayValue;
226
- $[8] = merge;
227
- $[9] = onAccountChange;
228
- $[10] = onSelectionChange;
229
- $[11] = onValueChange;
230
- $[12] = open;
231
- $[13] = options;
232
- $[14] = showFastIcon;
233
- $[15] = simpleLadder;
234
- $[16] = simpleLadderSnap;
235
- $[17] = value;
236
- $[18] = T0;
237
- $[19] = T1;
238
- $[20] = accountForModel;
239
- $[21] = commit;
240
- $[22] = ladderSteps;
241
- $[23] = showLadder;
242
- $[24] = snappedAmong;
243
- $[25] = t10;
244
- $[26] = t11;
245
- $[27] = t12;
246
- $[28] = t13;
247
- $[29] = t3;
248
- $[30] = t4;
249
- $[31] = t5;
250
- $[32] = t6;
251
- $[33] = t7;
252
- $[34] = t8;
253
- $[35] = t9;
254
- $[36] = triggerLabel;
269
+ $[5] = accountId;
270
+ $[6] = accounts;
271
+ $[7] = advanced;
272
+ $[8] = className;
273
+ $[9] = config?.badgeRing?.trigger;
274
+ $[10] = config?.classes?.trigger;
275
+ $[11] = disabled;
276
+ $[12] = displayValue;
277
+ $[13] = merge;
278
+ $[14] = onAccountChange;
279
+ $[15] = onSelectionChange;
280
+ $[16] = onValueChange;
281
+ $[17] = open;
282
+ $[18] = options;
283
+ $[19] = simpleLadder;
284
+ $[20] = simpleLadderSnap;
285
+ $[21] = summary?.fast;
286
+ $[22] = value;
287
+ $[23] = T0;
288
+ $[24] = T1;
289
+ $[25] = accountForModel;
290
+ $[26] = commit;
291
+ $[27] = ladderSteps;
292
+ $[28] = showLadder;
293
+ $[29] = snappedAmong;
294
+ $[30] = t10;
295
+ $[31] = t11;
296
+ $[32] = t12;
297
+ $[33] = t13;
298
+ $[34] = t14;
299
+ $[35] = t15;
300
+ $[36] = t5;
301
+ $[37] = t6;
302
+ $[38] = t7;
303
+ $[39] = t8;
304
+ $[40] = t9;
305
+ $[41] = triggerLabel;
255
306
  } else {
256
- T0 = $[18];
257
- T1 = $[19];
258
- accountForModel = $[20];
259
- commit = $[21];
260
- ladderSteps = $[22];
261
- showLadder = $[23];
262
- snappedAmong = $[24];
263
- t10 = $[25];
264
- t11 = $[26];
265
- t12 = $[27];
266
- t13 = $[28];
267
- t3 = $[29];
268
- t4 = $[30];
269
- t5 = $[31];
270
- t6 = $[32];
271
- t7 = $[33];
272
- t8 = $[34];
273
- t9 = $[35];
274
- triggerLabel = $[36];
307
+ T0 = $[23];
308
+ T1 = $[24];
309
+ accountForModel = $[25];
310
+ commit = $[26];
311
+ ladderSteps = $[27];
312
+ showLadder = $[28];
313
+ snappedAmong = $[29];
314
+ t10 = $[30];
315
+ t11 = $[31];
316
+ t12 = $[32];
317
+ t13 = $[33];
318
+ t14 = $[34];
319
+ t15 = $[35];
320
+ t5 = $[36];
321
+ t6 = $[37];
322
+ t7 = $[38];
323
+ t8 = $[39];
324
+ t9 = $[40];
325
+ triggerLabel = $[41];
275
326
  }
276
- let t14;
277
- if ($[55] !== triggerSuffix) {
278
- t14 = triggerSuffix ? /*#__PURE__*/_jsxs("span", {
327
+ let t16;
328
+ if ($[60] !== triggerSuffix) {
329
+ t16 = triggerSuffix ? /*#__PURE__*/_jsxs("span", {
279
330
  className: "text-muted-foreground/70",
280
331
  children: [" \xB7 ", triggerSuffix]
281
332
  }) : null;
282
- $[55] = triggerSuffix;
283
- $[56] = t14;
333
+ $[60] = triggerSuffix;
334
+ $[61] = t16;
284
335
  } else {
285
- t14 = $[56];
336
+ t16 = $[61];
286
337
  }
287
- let t15;
288
- if ($[57] !== t14 || $[58] !== triggerLabel) {
289
- t15 = /*#__PURE__*/_jsxs("span", {
338
+ let t17;
339
+ if ($[62] !== t16 || $[63] !== triggerLabel) {
340
+ t17 = /*#__PURE__*/_jsxs("span", {
290
341
  className: "whitespace-nowrap text-left max-sm:min-w-0 max-sm:truncate",
291
- children: [triggerLabel, t14]
342
+ children: [triggerLabel, t16]
292
343
  });
293
- $[57] = t14;
294
- $[58] = triggerLabel;
295
- $[59] = t15;
344
+ $[62] = t16;
345
+ $[63] = triggerLabel;
346
+ $[64] = t17;
296
347
  } else {
297
- t15 = $[59];
348
+ t17 = $[64];
298
349
  }
299
- let t16;
300
- if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
301
- t16 = /*#__PURE__*/_jsx(IconChevronDown, {
350
+ let t18;
351
+ if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
352
+ t18 = /*#__PURE__*/_jsx(IconChevronDown, {
302
353
  size: 12,
303
354
  className: "shrink-0 opacity-60",
304
355
  "aria-hidden": true
305
356
  });
306
- $[60] = t16;
357
+ $[65] = t18;
307
358
  } else {
308
- t16 = $[60];
359
+ t18 = $[65];
309
360
  }
310
- let t17;
311
- if ($[61] !== t10 || $[62] !== t15 || $[63] !== t3 || $[64] !== t4 || $[65] !== t5 || $[66] !== t6 || $[67] !== t7 || $[68] !== t8 || $[69] !== t9) {
312
- t17 = /*#__PURE__*/_jsxs("button", {
313
- type: t3,
314
- role: t4,
315
- "aria-expanded": t5,
316
- "data-slot": t6,
317
- className: t7,
318
- disabled: t8,
319
- children: [t9, t10, t15, t16]
361
+ let t19;
362
+ if ($[66] !== t10 || $[67] !== t11 || $[68] !== t12 || $[69] !== t17 || $[70] !== t5 || $[71] !== t6 || $[72] !== t7 || $[73] !== t8 || $[74] !== t9) {
363
+ t19 = /*#__PURE__*/_jsxs("button", {
364
+ type: t5,
365
+ role: t6,
366
+ "aria-expanded": t7,
367
+ "data-slot": t8,
368
+ className: t9,
369
+ disabled: t10,
370
+ children: [t11, t12, t17, t18]
320
371
  });
321
- $[61] = t10;
322
- $[62] = t15;
323
- $[63] = t3;
324
- $[64] = t4;
325
- $[65] = t5;
326
- $[66] = t6;
327
- $[67] = t7;
328
- $[68] = t8;
329
- $[69] = t9;
330
- $[70] = t17;
372
+ $[66] = t10;
373
+ $[67] = t11;
374
+ $[68] = t12;
375
+ $[69] = t17;
376
+ $[70] = t5;
377
+ $[71] = t6;
378
+ $[72] = t7;
379
+ $[73] = t8;
380
+ $[74] = t9;
381
+ $[75] = t19;
331
382
  } else {
332
- t17 = $[70];
383
+ t19 = $[75];
333
384
  }
334
- let t18;
335
- if ($[71] !== T0 || $[72] !== t11 || $[73] !== t17) {
336
- t18 = /*#__PURE__*/_jsx(T0, {
337
- asChild: t11,
338
- children: t17
385
+ let t20;
386
+ if ($[76] !== T0 || $[77] !== t13 || $[78] !== t19) {
387
+ t20 = /*#__PURE__*/_jsx(T0, {
388
+ asChild: t13,
389
+ children: t19
339
390
  });
340
- $[71] = T0;
341
- $[72] = t11;
342
- $[73] = t17;
343
- $[74] = t18;
391
+ $[76] = T0;
392
+ $[77] = t13;
393
+ $[78] = t19;
394
+ $[79] = t20;
344
395
  } else {
345
- t18 = $[74];
396
+ t20 = $[79];
346
397
  }
347
- const t19 = showLadder ? "w-56 p-3" : modelPickerSurfaceClass;
348
- let t20;
349
- if ($[75] !== showLadder) {
350
- t20 = event => {
398
+ const t21 = showLadder ? "w-56 p-3" : modelPickerSurfaceClass;
399
+ let t22;
400
+ if ($[80] !== showLadder) {
401
+ t22 = event => {
351
402
  if (showLadder) {
352
403
  return;
353
404
  }
354
405
  event.preventDefault();
355
406
  };
356
- $[75] = showLadder;
357
- $[76] = t20;
407
+ $[80] = showLadder;
408
+ $[81] = t22;
358
409
  } else {
359
- t20 = $[76];
410
+ t22 = $[81];
360
411
  }
361
- let t21;
362
- if ($[77] !== accountForModel || $[78] !== accountId || $[79] !== accounts || $[80] !== canSelectTeamWhilePersonal || $[81] !== commit || $[82] !== disabled || $[83] !== displayValue || $[84] !== header || $[85] !== ladderSteps || $[86] !== options || $[87] !== showLadder || $[88] !== snappedAmong) {
363
- t21 = showLadder ? /*#__PURE__*/_jsx(SimpleModelLadder, {
412
+ let t23;
413
+ if ($[82] !== accountForModel || $[83] !== accountId || $[84] !== accounts || $[85] !== canSelectTeamWhilePersonal || $[86] !== commit || $[87] !== disabled || $[88] !== displayValue || $[89] !== header || $[90] !== ladderSteps || $[91] !== options || $[92] !== showLadder || $[93] !== snappedAmong) {
414
+ t23 = showLadder ? /*#__PURE__*/_jsx(SimpleModelLadder, {
364
415
  value: displayValue,
365
416
  steps: ladderSteps,
366
417
  snappedId: snappedAmong,
@@ -382,52 +433,52 @@ export function ModelPicker(t0) {
382
433
  },
383
434
  header: header
384
435
  });
385
- $[77] = accountForModel;
386
- $[78] = accountId;
387
- $[79] = accounts;
388
- $[80] = canSelectTeamWhilePersonal;
389
- $[81] = commit;
390
- $[82] = disabled;
391
- $[83] = displayValue;
392
- $[84] = header;
393
- $[85] = ladderSteps;
394
- $[86] = options;
395
- $[87] = showLadder;
396
- $[88] = snappedAmong;
397
- $[89] = t21;
436
+ $[82] = accountForModel;
437
+ $[83] = accountId;
438
+ $[84] = accounts;
439
+ $[85] = canSelectTeamWhilePersonal;
440
+ $[86] = commit;
441
+ $[87] = disabled;
442
+ $[88] = displayValue;
443
+ $[89] = header;
444
+ $[90] = ladderSteps;
445
+ $[91] = options;
446
+ $[92] = showLadder;
447
+ $[93] = snappedAmong;
448
+ $[94] = t23;
398
449
  } else {
399
- t21 = $[89];
450
+ t23 = $[94];
400
451
  }
401
- let t22;
402
- if ($[90] !== t19 || $[91] !== t20 || $[92] !== t21) {
403
- t22 = /*#__PURE__*/_jsx(PopoverContent, {
452
+ let t24;
453
+ if ($[95] !== t21 || $[96] !== t22 || $[97] !== t23) {
454
+ t24 = /*#__PURE__*/_jsx(PopoverContent, {
404
455
  align: "start",
405
- className: t19,
406
- onOpenAutoFocus: t20,
407
- children: t21
456
+ className: t21,
457
+ onOpenAutoFocus: t22,
458
+ children: t23
408
459
  });
409
- $[90] = t19;
410
- $[91] = t20;
411
- $[92] = t21;
412
- $[93] = t22;
460
+ $[95] = t21;
461
+ $[96] = t22;
462
+ $[97] = t23;
463
+ $[98] = t24;
413
464
  } else {
414
- t22 = $[93];
465
+ t24 = $[98];
415
466
  }
416
- let t23;
417
- if ($[94] !== T1 || $[95] !== t12 || $[96] !== t13 || $[97] !== t18 || $[98] !== t22) {
418
- t23 = /*#__PURE__*/_jsxs(T1, {
419
- open: t12,
420
- onOpenChange: t13,
421
- children: [t18, t22]
467
+ let t25;
468
+ if ($[99] !== T1 || $[100] !== t14 || $[101] !== t15 || $[102] !== t20 || $[103] !== t24) {
469
+ t25 = /*#__PURE__*/_jsxs(T1, {
470
+ open: t14,
471
+ onOpenChange: t15,
472
+ children: [t20, t24]
422
473
  });
423
- $[94] = T1;
424
- $[95] = t12;
425
- $[96] = t13;
426
- $[97] = t18;
427
- $[98] = t22;
428
- $[99] = t23;
474
+ $[99] = T1;
475
+ $[100] = t14;
476
+ $[101] = t15;
477
+ $[102] = t20;
478
+ $[103] = t24;
479
+ $[104] = t25;
429
480
  } else {
430
- t23 = $[99];
481
+ t25 = $[104];
431
482
  }
432
- return t23;
483
+ return t25;
433
484
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/ui",
3
- "version": "0.64.0",
3
+ "version": "0.65.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
6
6
  "type": "module",
@@ -1,4 +1,4 @@
1
- import { useState, type ReactNode } from "react";
1
+ import { useState } from "react";
2
2
  import { IconBolt, IconChevronDown } from "@tabler/icons-react";
3
3
  import { SimpleModelLadder } from "./simple-model-ladder";
4
4
  import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
@@ -17,6 +17,7 @@ import {
17
17
  formatModelDisplayLabel,
18
18
  getProviderLabel,
19
19
  } from "./model-picker-types";
20
+ import { TraitsPanel, type TraitsMenuProps } from "./prompt-input-traits";
20
21
 
21
22
  export type { ModelAccount, ModelOption };
22
23
  export { findModelOption, formatModelDisplayLabel, getProviderLabel };
@@ -49,6 +50,39 @@ const TRIGGER_CLASS =
49
50
  export const modelPickerSurfaceClass =
50
51
  "w-100 max-w-[calc(100vw-1rem)] overflow-hidden rounded-menu border-0 bg-transparent p-0 shadow-none";
51
52
 
53
+ /**
54
+ * The selected model's trait controls (reasoning, thinking, context window,
55
+ * Fast). `ModelPicker` pins them above the model list and sums them up on the
56
+ * trigger, so every picker shows traits the same way.
57
+ */
58
+ export type ModelPickerTraits = Omit<TraitsMenuProps, "className" | "disabled">;
59
+
60
+ /**
61
+ * What the trigger shows after the model name: the reasoning level, "1M" when
62
+ * the 1M context is on, "No thinking" when thinking is off, joined by " · ",
63
+ * and whether Fast is on (the bolt). Only traits the model supports count.
64
+ */
65
+ export function modelPickerTraitSummary(traits: ModelPickerTraits): {
66
+ suffix: string | undefined;
67
+ fast: boolean;
68
+ } {
69
+ const { config } = traits;
70
+ const parts: string[] = [];
71
+ if (config.reasoning) {
72
+ parts.push(
73
+ traits.getLevelLabel(traits.effortLevel ?? config.reasoning.default),
74
+ );
75
+ }
76
+ if (config.contextWindow1m && traits.use1mContext) parts.push("1M");
77
+ if (config.thinkingToggle && !traits.thinkingEnabled) {
78
+ parts.push("No thinking");
79
+ }
80
+ return {
81
+ suffix: parts.length > 0 ? parts.join(" · ") : undefined,
82
+ fast: Boolean(config.fastMode && traits.fastMode),
83
+ };
84
+ }
85
+
52
86
  export interface ModelPickerProps<TModel extends string = string> {
53
87
  value: TModel;
54
88
  onValueChange: (model: TModel) => void;
@@ -77,14 +111,10 @@ export interface ModelPickerProps<TModel extends string = string> {
77
111
  */
78
112
  canSelectTeamWhilePersonal?: boolean;
79
113
  /**
80
- * Compact label after the model name on the trigger (e.g. the active
81
- * reasoning level).
114
+ * The selected model's traits. Required so no picker drops them by
115
+ * accident: pass `null` only where runs take no traits.
82
116
  */
83
- triggerSuffix?: string;
84
- /** Pinned above the model list — typically trait controls. */
85
- header?: ReactNode;
86
- /** Bolt before the provider icon when Fast mode is on. */
87
- showFastIcon?: boolean;
117
+ traits: ModelPickerTraits | null;
88
118
  /**
89
119
  * Simple-view capability ladder (cheapest → strongest). When at least two of
90
120
  * these ids are in `options`, the popover opens on a discrete slider;
@@ -111,14 +141,18 @@ export function ModelPicker<TModel extends string>({
111
141
  onAccountChange,
112
142
  onSelectionChange,
113
143
  canSelectTeamWhilePersonal = true,
114
- triggerSuffix,
115
- header,
116
- showFastIcon,
144
+ traits,
117
145
  simpleLadder,
118
146
  simpleLadderSnap,
119
147
  }: ModelPickerProps<TModel>) {
120
148
  const merge = useCn();
121
149
  const config = useUiConfig("ModelPicker");
150
+ const summary = traits === null ? null : modelPickerTraitSummary(traits);
151
+ const triggerSuffix = summary?.suffix;
152
+ const header =
153
+ traits === null ? undefined : (
154
+ <TraitsPanel {...traits} disabled={disabled} />
155
+ );
122
156
  const [open, setOpen] = useState(false);
123
157
  const [advanced, setAdvanced] = useState(false);
124
158
  const [previewId, setPreviewId] = useState<TModel | null>(null);
@@ -208,7 +242,7 @@ export function ModelPicker<TModel extends string>({
208
242
  )}
209
243
  disabled={disabled}
210
244
  >
211
- {showFastIcon ? (
245
+ {summary?.fast ? (
212
246
  <span title="Fast" className="inline-flex shrink-0">
213
247
  <IconBolt size={12} aria-hidden />
214
248
  </span>