@adea-ai/ui 0.155.1 → 0.157.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.
Files changed (166) hide show
  1. package/README.md +3 -3
  2. package/dist/NOTICE +27 -0
  3. package/dist/components/composites/model-selector/model-selector.js +45 -53
  4. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  5. package/dist/components/composites/prompt-input/index.d.ts +2 -0
  6. package/dist/components/composites/prompt-input/index.d.ts.map +1 -0
  7. package/dist/components/composites/prompt-input/index.js +1 -0
  8. package/dist/components/composites/prompt-input/prompt-input.d.ts +71 -0
  9. package/dist/components/composites/prompt-input/prompt-input.d.ts.map +1 -0
  10. package/dist/components/composites/prompt-input/prompt-input.js +247 -0
  11. package/dist/components/composites/prompt-input/prompt-input.js.map +1 -0
  12. package/dist/components/conversation/chat-composer.d.ts.map +1 -1
  13. package/dist/components/conversation/chat-composer.js +43 -29
  14. package/dist/components/conversation/chat-composer.js.map +1 -1
  15. package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
  16. package/dist/components/conversation/internal/chat-composer-shell.js +155 -163
  17. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  18. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  19. package/dist/components/conversation/message-composer.js +186 -192
  20. package/dist/components/conversation/message-composer.js.map +1 -1
  21. package/dist/components/conversation/paste-token-editor.js +2 -2
  22. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  23. package/dist/components/theme/theme-document.d.ts +1 -1
  24. package/dist/components/theme/theme-document.js.map +1 -1
  25. package/dist/components/theme/theme-provider-value.d.ts +1 -1
  26. package/dist/components/theme/theme-provider-value.js.map +1 -1
  27. package/dist/components/ui/badge/badge.js +1 -1
  28. package/dist/components/ui/badge/badge.js.map +1 -1
  29. package/dist/components/ui/button/button.d.ts.map +1 -1
  30. package/dist/components/ui/button/button.js +3 -3
  31. package/dist/components/ui/button/button.js.map +1 -1
  32. package/dist/components/ui/input-group/index.d.ts +1 -1
  33. package/dist/components/ui/input-group/index.d.ts.map +1 -1
  34. package/dist/components/ui/input-group/index.js +2 -2
  35. package/dist/components/ui/input-group/input-group.d.ts +34 -9
  36. package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
  37. package/dist/components/ui/input-group/input-group.js +101 -28
  38. package/dist/components/ui/input-group/input-group.js.map +1 -1
  39. package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
  40. package/dist/components/ui/kbd/kbd.js +6 -1
  41. package/dist/components/ui/kbd/kbd.js.map +1 -1
  42. package/dist/components/ui/message/index.d.ts +1 -1
  43. package/dist/components/ui/message/index.d.ts.map +1 -1
  44. package/dist/components/ui/message/index.js +2 -2
  45. package/dist/components/ui/message/message.d.ts +16 -0
  46. package/dist/components/ui/message/message.d.ts.map +1 -1
  47. package/dist/components/ui/message/message.js +52 -1
  48. package/dist/components/ui/message/message.js.map +1 -1
  49. package/dist/components/ui/tooltip/tooltip.js +1 -1
  50. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  51. package/dist/index.d.ts +1 -0
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +4 -3
  54. package/dist/lib/fast-icon.d.ts +2 -1
  55. package/dist/lib/fast-icon.d.ts.map +1 -1
  56. package/dist/lib/fast-icon.js +4 -3
  57. package/dist/lib/fast-icon.js.map +1 -1
  58. package/dist/lib/overlay.d.ts +5 -5
  59. package/dist/lib/overlay.d.ts.map +1 -1
  60. package/dist/lib/overlay.js +5 -5
  61. package/dist/lib/overlay.js.map +1 -1
  62. package/dist/lib/theme-defaults.generated.d.ts.map +1 -1
  63. package/dist/lib/theme-defaults.generated.js +88 -60
  64. package/dist/lib/theme-defaults.generated.js.map +1 -1
  65. package/dist/lib/theme-projection.d.ts +2 -0
  66. package/dist/lib/theme-projection.d.ts.map +1 -1
  67. package/dist/lib/theme-projection.js +2 -2
  68. package/dist/lib/theme-projection.js.map +1 -1
  69. package/dist/lib/theme-types.d.ts +7 -0
  70. package/dist/lib/theme-types.d.ts.map +1 -1
  71. package/dist/lib/theme-types.js +7 -0
  72. package/dist/lib/theme-types.js.map +1 -1
  73. package/dist/r/appearance-editor.json +1 -1
  74. package/dist/r/conversation.json +1 -2
  75. package/dist/r/input-group.json +1 -0
  76. package/dist/r/lib.json +1 -1
  77. package/dist/r/message.json +4 -1
  78. package/dist/r/model-selector.json +1 -1
  79. package/dist/r/prompt-input.json +28 -0
  80. package/dist/r/registry.json +38 -7
  81. package/dist/r/src/components/composites/model-selector/model-selector.tsx +19 -25
  82. package/dist/r/src/components/composites/prompt-input/index.ts +15 -0
  83. package/dist/r/src/components/composites/prompt-input/prompt-input.tsx +267 -0
  84. package/dist/r/src/components/conversation/chat-composer.tsx +4 -2
  85. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
  86. package/dist/r/src/components/conversation/message-composer.tsx +93 -97
  87. package/dist/r/src/components/conversation/paste-token-editor.tsx +2 -2
  88. package/dist/r/src/components/theme/theme-document.ts +1 -1
  89. package/dist/r/src/components/theme/theme-provider-value.ts +1 -1
  90. package/dist/r/src/components/ui/badge/badge.tsx +1 -1
  91. package/dist/r/src/components/ui/button/button.tsx +12 -3
  92. package/dist/r/src/components/ui/input-group/index.ts +3 -0
  93. package/dist/r/src/components/ui/input-group/input-group.tsx +121 -29
  94. package/dist/r/src/components/ui/kbd/kbd.tsx +3 -0
  95. package/dist/r/src/components/ui/message/index.ts +3 -0
  96. package/dist/r/src/components/ui/message/message.tsx +56 -0
  97. package/dist/r/src/components/ui/tooltip/tooltip.tsx +1 -1
  98. package/dist/r/src/lib/fast-icon.ts +11 -4
  99. package/dist/r/src/lib/overlay.ts +5 -6
  100. package/dist/r/src/lib/theme-defaults.generated.ts +88 -60
  101. package/dist/r/src/lib/theme-projection.ts +2 -0
  102. package/dist/r/src/lib/theme-types.ts +7 -0
  103. package/dist/r/src/styles/theme-variants.css +608 -370
  104. package/dist/r/src/styles/theme.css +4 -4
  105. package/dist/r/theming.json +1 -1
  106. package/package.json +2 -2
  107. package/registry.json +38 -7
  108. package/src/components/composites/model-selector/model-selector.tsx +19 -25
  109. package/src/components/composites/prompt-input/index.ts +15 -0
  110. package/src/components/composites/prompt-input/prompt-input.tsx +267 -0
  111. package/src/components/conversation/chat-composer.tsx +4 -2
  112. package/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
  113. package/src/components/conversation/message-composer.tsx +93 -97
  114. package/src/components/conversation/paste-token-editor.tsx +2 -2
  115. package/src/components/theme/theme-document.ts +1 -1
  116. package/src/components/theme/theme-provider-value.ts +1 -1
  117. package/src/components/ui/badge/badge.tsx +1 -1
  118. package/src/components/ui/button/button.tsx +12 -3
  119. package/src/components/ui/input-group/index.ts +3 -0
  120. package/src/components/ui/input-group/input-group.tsx +121 -29
  121. package/src/components/ui/kbd/kbd.tsx +3 -0
  122. package/src/components/ui/message/index.ts +3 -0
  123. package/src/components/ui/message/message.tsx +56 -0
  124. package/src/components/ui/tooltip/tooltip.tsx +1 -1
  125. package/src/index.ts +1 -0
  126. package/src/lib/fast-icon.ts +11 -4
  127. package/src/lib/overlay.ts +5 -6
  128. package/src/lib/theme-defaults.generated.ts +88 -60
  129. package/src/lib/theme-projection.ts +2 -0
  130. package/src/lib/theme-types.ts +7 -0
  131. package/src/styles/theme-variants.css +608 -370
  132. package/src/styles/theme.css +4 -4
  133. package/src/styles/themes/aardvark-blue.css +7 -0
  134. package/src/styles/themes/aardvark-ink.css +7 -0
  135. package/src/styles/themes/adea-dark-colorblind.css +22 -15
  136. package/src/styles/themes/adea-dark-high-contrast.css +22 -15
  137. package/src/styles/themes/adea-dark.css +22 -15
  138. package/src/styles/themes/adea-light-colorblind.css +21 -14
  139. package/src/styles/themes/adea-light-high-contrast.css +21 -14
  140. package/src/styles/themes/adea-light.css +22 -15
  141. package/src/styles/themes/ayu-light.css +20 -13
  142. package/src/styles/themes/ayu-mirage.css +21 -14
  143. package/src/styles/themes/ayu.css +22 -15
  144. package/src/styles/themes/catppuccin-frappe.css +16 -9
  145. package/src/styles/themes/catppuccin-latte.css +15 -8
  146. package/src/styles/themes/catppuccin-macchiato.css +16 -9
  147. package/src/styles/themes/catppuccin-mocha.css +16 -9
  148. package/src/styles/themes/dracula.css +16 -9
  149. package/src/styles/themes/everforest-dark.css +19 -12
  150. package/src/styles/themes/everforest-light.css +21 -14
  151. package/src/styles/themes/gruvbox-dark.css +21 -14
  152. package/src/styles/themes/gruvbox-light.css +20 -13
  153. package/src/styles/themes/kanagawa.css +18 -11
  154. package/src/styles/themes/monokai.css +19 -12
  155. package/src/styles/themes/nord-light.css +7 -0
  156. package/src/styles/themes/nord.css +19 -12
  157. package/src/styles/themes/one-dark.css +16 -9
  158. package/src/styles/themes/rosepine-dawn.css +19 -12
  159. package/src/styles/themes/rosepine-moon.css +20 -13
  160. package/src/styles/themes/rosepine.css +20 -13
  161. package/src/styles/themes/solarized-dark.css +19 -12
  162. package/src/styles/themes/solarized-light.css +19 -12
  163. package/src/styles/themes/tokyonight-day.css +7 -0
  164. package/src/styles/themes/tokyonight-night.css +18 -11
  165. package/src/styles/themes/tokyonight-storm.css +18 -11
  166. package/src/styles/themes/vesper.css +22 -15
@@ -140,7 +140,7 @@
140
140
  * dark one's and nearly none at all on the palest accent.
141
141
  *
142
142
  * Both values come from @adea-ai/themes, so the accent blocks below are the same
143
- * rule rather than a matching one, which is what they were not, before.
143
+ * rule rather than a matching one — which is what they were not, before.
144
144
  */
145
145
  --primary-hover: oklch(0.4643 0.1668 301.69);
146
146
  /*
@@ -153,7 +153,7 @@
153
153
  --chrome: var(--surface);
154
154
  /*
155
155
  * Below the canvas: a code well, an inset panel. Not a catalogue role, because
156
- * the catalogue's ladder only goes *up* from the canvas, the four rungs it
156
+ * the catalogue's ladder only goes *up* from the canvas — the four rungs it
157
157
  * derives are all surfaces something sits on. This is the one value in the
158
158
  * ladder that runs the other way, so it is computed rather than mapped.
159
159
  *
@@ -284,7 +284,7 @@
284
284
  * dark one's and nearly none at all on the palest accent.
285
285
  *
286
286
  * Both values come from @adea-ai/themes, so the accent blocks below are the same
287
- * rule rather than a matching one, which is what they were not, before.
287
+ * rule rather than a matching one — which is what they were not, before.
288
288
  */
289
289
  --primary-hover: oklch(0.7823 0.1668 301.69);
290
290
  /*
@@ -297,7 +297,7 @@
297
297
  --chrome: var(--surface);
298
298
  /*
299
299
  * Below the canvas: a code well, an inset panel. Not a catalogue role, because
300
- * the catalogue's ladder only goes *up* from the canvas, the four rungs it
300
+ * the catalogue's ladder only goes *up* from the canvas — the four rungs it
301
301
  * derives are all surfaces something sits on. This is the one value in the
302
302
  * ladder that runs the other way, so it is computed rather than mapped.
303
303
  *
@@ -4,7 +4,7 @@
4
4
  "title": "Theming",
5
5
  "description": "",
6
6
  "dependencies": [
7
- "@adea-ai/themes@>0.11.7 <0.12.0",
7
+ "@adea-ai/themes@>=0.12.0 <0.13.0",
8
8
  "@kobalte/core@^0.13.14",
9
9
  "lucide-solid@^1.71.0"
10
10
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/ui",
3
- "version": "0.155.1",
3
+ "version": "0.157.0",
4
4
  "description": "The Adea design system: Kobalte-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
5
5
  "keywords": [
6
6
  "adea",
@@ -171,7 +171,7 @@
171
171
  "check:packed": "bun scripts/check-packed.ts"
172
172
  },
173
173
  "dependencies": {
174
- "@adea-ai/themes": ">0.11.7 <0.12.0",
174
+ "@adea-ai/themes": ">=0.12.0 <0.13.0",
175
175
  "@corvu/calendar": "^0.1.2",
176
176
  "@corvu/drawer": "^0.2.4",
177
177
  "@corvu/otp-field": "^0.1.4",
package/registry.json CHANGED
@@ -880,6 +880,7 @@
880
880
  "dependencies": [],
881
881
  "registryDependencies": [
882
882
  "@adea-ai/ui/action-button",
883
+ "@adea-ai/ui/button",
883
884
  "lib"
884
885
  ],
885
886
  "files": [
@@ -1047,8 +1048,11 @@
1047
1048
  "type": "registry:ui",
1048
1049
  "title": "Message",
1049
1050
  "description": "",
1050
- "dependencies": [],
1051
+ "dependencies": [
1052
+ "lucide-solid@^1.71.0"
1053
+ ],
1051
1054
  "registryDependencies": [
1055
+ "@adea-ai/ui/action-button",
1052
1056
  "@adea-ai/ui/code-block",
1053
1057
  "lib"
1054
1058
  ],
@@ -2351,7 +2355,7 @@
2351
2355
  "title": "Appearance Editor",
2352
2356
  "description": "",
2353
2357
  "dependencies": [
2354
- "@adea-ai/themes@>0.11.7 <0.12.0",
2358
+ "@adea-ai/themes@>=0.12.0 <0.13.0",
2355
2359
  "@kobalte/core@^0.13.14",
2356
2360
  "lucide-solid@^1.71.0"
2357
2361
  ],
@@ -2807,10 +2811,10 @@
2807
2811
  "lucide-solid@^1.71.0"
2808
2812
  ],
2809
2813
  "registryDependencies": [
2810
- "@adea-ai/ui/button",
2811
2814
  "@adea-ai/ui/command",
2812
2815
  "@adea-ai/ui/dropdown-menu",
2813
2816
  "@adea-ai/ui/popover",
2817
+ "@adea-ai/ui/prompt-input",
2814
2818
  "@adea-ai/ui/tabs",
2815
2819
  "lib"
2816
2820
  ],
@@ -2859,6 +2863,34 @@
2859
2863
  }
2860
2864
  ]
2861
2865
  },
2866
+ {
2867
+ "name": "prompt-input",
2868
+ "type": "registry:ui",
2869
+ "title": "Prompt Input",
2870
+ "description": "",
2871
+ "dependencies": [
2872
+ "lucide-solid@^1.71.0"
2873
+ ],
2874
+ "registryDependencies": [
2875
+ "@adea-ai/ui/action-button",
2876
+ "@adea-ai/ui/button",
2877
+ "@adea-ai/ui/input-group",
2878
+ "@adea-ai/ui/spinner",
2879
+ "lib"
2880
+ ],
2881
+ "files": [
2882
+ {
2883
+ "path": "src/components/composites/prompt-input/index.ts",
2884
+ "type": "registry:ui",
2885
+ "target": "components/composites/prompt-input/index.ts"
2886
+ },
2887
+ {
2888
+ "path": "src/components/composites/prompt-input/prompt-input.tsx",
2889
+ "type": "registry:ui",
2890
+ "target": "components/composites/prompt-input/prompt-input.tsx"
2891
+ }
2892
+ ]
2893
+ },
2862
2894
  {
2863
2895
  "name": "queue",
2864
2896
  "type": "registry:ui",
@@ -3392,8 +3424,7 @@
3392
3424
  "@adea-ai/ui/dropdown-menu",
3393
3425
  "@adea-ai/ui/kbd",
3394
3426
  "@adea-ai/ui/message",
3395
- "@adea-ai/ui/spinner",
3396
- "@adea-ai/ui/textarea",
3427
+ "@adea-ai/ui/prompt-input",
3397
3428
  "@adea-ai/ui/tooltip",
3398
3429
  "lib"
3399
3430
  ],
@@ -3516,7 +3547,7 @@
3516
3547
  "title": "Theming",
3517
3548
  "description": "",
3518
3549
  "dependencies": [
3519
- "@adea-ai/themes@>0.11.7 <0.12.0",
3550
+ "@adea-ai/themes@>=0.12.0 <0.13.0",
3520
3551
  "@kobalte/core@^0.13.14",
3521
3552
  "lucide-solid@^1.71.0"
3522
3553
  ],
@@ -3701,7 +3732,7 @@
3701
3732
  "title": "Class-name and token helpers",
3702
3733
  "description": "The private helpers the components import: the class-name merge, the variant recipes, the token manifest and the theme bridge. Installed automatically as a peer of any component that needs it.",
3703
3734
  "dependencies": [
3704
- "@adea-ai/themes@>0.11.7 <0.12.0",
3735
+ "@adea-ai/themes@>=0.12.0 <0.13.0",
3705
3736
  "class-variance-authority@^0.7.1",
3706
3737
  "cn@^0.5.2"
3707
3738
  ],
@@ -14,7 +14,7 @@ import {
14
14
  type JSX,
15
15
  } from 'solid-js'
16
16
  import { cn } from '#lib/utils'
17
- import { Button } from '../../ui/button'
17
+ import { PromptInputControl } from '../prompt-input'
18
18
  import {
19
19
  Command,
20
20
  CommandEmpty,
@@ -236,19 +236,21 @@ function triggerText(props: { selected?: ModelOption; value?: string }): string
236
236
  }
237
237
 
238
238
  function ModelOptionBody(props: { model: ModelOption }) {
239
+ // One line per row: the name, then the reason it is unavailable or its
240
+ // description, muted and truncated; the full text is the row's title.
241
+ const secondary = () => props.model.disabledReason ?? props.model.description
239
242
  return (
240
- <span class="flex min-w-0 flex-col">
241
- <span class="[overflow-wrap:anywhere]">{boundText(props.model.label, 60)}</span>
242
- <Show when={props.model.description}>
243
- <span class="text-xs text-muted-foreground [overflow-wrap:anywhere]">
244
- {boundText(props.model.description ?? '', 160)}
245
- </span>
246
- </Show>
247
- <Show when={props.model.disabledReason}>
248
- <span class="text-xs text-muted-foreground [overflow-wrap:anywhere]">
249
- <span class="visually-hidden">Unavailable: </span>
250
- {boundText(props.model.disabledReason ?? '', 160)}
251
- </span>
243
+ <span class="flex min-w-0 items-baseline gap-2" title={secondary()}>
244
+ <span class="shrink-0 truncate">{boundText(props.model.label, 60)}</span>
245
+ <Show when={secondary()}>
246
+ {(text) => (
247
+ <span class="min-w-0 truncate text-xs text-muted-foreground">
248
+ <Show when={props.model.disabledReason}>
249
+ <span class="visually-hidden">Unavailable: </span>
250
+ </Show>
251
+ {boundText(text(), 160)}
252
+ </span>
253
+ )}
252
254
  </Show>
253
255
  </span>
254
256
  )
@@ -291,9 +293,7 @@ function ModelMenu(props: PickerProps) {
291
293
  gutter={6}
292
294
  >
293
295
  <DropdownMenuTrigger
294
- as={Button}
295
- variant="ghost"
296
- size="sm"
296
+ as={PromptInputControl}
297
297
  aria-label={`Model: ${props.models.length === 0 ? 'No models available' : triggerText(props)}`}
298
298
  aria-disabled={inert() || undefined}
299
299
  aria-describedby={props.describedBy}
@@ -354,9 +354,7 @@ function ModelSearch(props: PickerProps) {
354
354
  gutter={6}
355
355
  >
356
356
  <PopoverTrigger
357
- as={Button}
358
- variant="ghost"
359
- size="sm"
357
+ as={PromptInputControl}
360
358
  aria-label={`Model: ${triggerText(props)}`}
361
359
  aria-disabled={props.blocked || undefined}
362
360
  aria-describedby={props.describedBy}
@@ -456,9 +454,7 @@ function ModelTabs(props: PickerProps & { providerIcon?: (provider: string) => J
456
454
  gutter={6}
457
455
  >
458
456
  <PopoverTrigger
459
- as={Button}
460
- variant="ghost"
461
- size="sm"
457
+ as={PromptInputControl}
462
458
  aria-label={`Model: ${props.models.length === 0 ? 'No models available' : triggerText(props)}`}
463
459
  aria-disabled={inert() || undefined}
464
460
  aria-describedby={props.describedBy}
@@ -569,9 +565,7 @@ function EffortMenu(props: {
569
565
  gutter={6}
570
566
  >
571
567
  <DropdownMenuTrigger
572
- as={Button}
573
- variant="ghost"
574
- size="sm"
568
+ as={PromptInputControl}
575
569
  aria-label={`Thinking effort: ${label() ?? 'not set'}`}
576
570
  aria-disabled={props.blocked || undefined}
577
571
  aria-describedby={props.describedBy}
@@ -0,0 +1,15 @@
1
+ export {
2
+ PromptInput,
3
+ PromptInputBody,
4
+ PromptInputButton,
5
+ PromptInputControl,
6
+ PromptInputFooter,
7
+ PromptInputHeader,
8
+ PromptInputSubmit,
9
+ PromptInputTextarea,
10
+ PromptInputTools,
11
+ type PromptInputProps,
12
+ type PromptInputStatus,
13
+ type PromptInputSubmitProps,
14
+ type PromptInputTextareaProps,
15
+ } from './prompt-input'
@@ -0,0 +1,267 @@
1
+ /*
2
+ * Part structure and names ported from Vercel AI Elements prompt-input.tsx
3
+ * (https://elements.ai-sdk.dev, Apache-2.0). The control pill is ported from
4
+ * T3 Code apps/web/src/components/chat/ComposerControl.tsx and the card from
5
+ * ComposerSurface.tsx at ff7aa5ace3 (MIT, Copyright (c) T3 Tools Inc.).
6
+ * Translated from React to Solid onto this library's InputGroup, Button and
7
+ * ActionButton. See NOTICE.
8
+ */
9
+ import { ArrowUp, Square, X } from 'lucide-solid'
10
+ import {
11
+ Show,
12
+ children as resolveChildren,
13
+ splitProps,
14
+ type ComponentProps,
15
+ type JSX,
16
+ type ValidComponent,
17
+ } from 'solid-js'
18
+ import { callHandler } from '#lib/events'
19
+ import { cn } from '#lib/utils'
20
+ import { Button, type ButtonProps } from '../../ui/button'
21
+ import { InputGroup, InputGroupAddon, InputGroupTextarea } from '../../ui/input-group'
22
+ import { Spinner } from '../../ui/spinner'
23
+ import { ActionButton, type ActionButtonProps } from '../action-button'
24
+
25
+ /**
26
+ * PromptInput.
27
+ *
28
+ * The one box a person writes to an agent in. It is shadcn's InputGroup in its
29
+ * column form: an optional header row (attachments, a reply strip), the field,
30
+ * and a footer row of tools on the left and the submit control on the right.
31
+ * Every chat surface draws this box, so the agent view, the dev chat and a new
32
+ * thread page cannot drift apart in radius, focus ring or button placement.
33
+ *
34
+ * It knows nothing about drafts, sending or keys beyond Enter. The composers in
35
+ * `conversation/` own those and render their chrome through these parts.
36
+ */
37
+ export type PromptInputProps = Omit<ComponentProps<'form'>, 'onSubmit'> & {
38
+ onSubmit?: JSX.EventHandlerUnion<HTMLFormElement, SubmitEvent>
39
+ /** Classes for the box itself; `class` lands on the form. */
40
+ groupClass?: string
41
+ /** Dims the box. The field and buttons carry their own disabled state. */
42
+ disabled?: boolean
43
+ /** Rendered inside the form above the box: a mention menu, a reply strip. */
44
+ before?: JSX.Element
45
+ /** Rendered inside the form under the box: a hint, a live status region. */
46
+ after?: JSX.Element
47
+ }
48
+
49
+ export function PromptInput(props: PromptInputProps) {
50
+ const [local, rest] = splitProps(props, [
51
+ 'class',
52
+ 'groupClass',
53
+ 'children',
54
+ 'onSubmit',
55
+ 'disabled',
56
+ 'before',
57
+ 'after',
58
+ ])
59
+
60
+ return (
61
+ <form
62
+ data-slot="prompt-input"
63
+ class={cn('flex w-full flex-col gap-2', local.class)}
64
+ onSubmit={(event) => {
65
+ event.preventDefault()
66
+ callHandler(local.onSubmit, event)
67
+ }}
68
+ {...rest}
69
+ >
70
+ {local.before}
71
+ <InputGroup
72
+ data-disabled={local.disabled ? '' : undefined}
73
+ class={cn(
74
+ 'bg-card h-auto gap-0 overflow-hidden rounded-2xl px-0 shadow-xs',
75
+ 'data-[disabled]:opacity-50',
76
+ local.groupClass
77
+ )}
78
+ >
79
+ {local.children}
80
+ </InputGroup>
81
+ {local.after}
82
+ </form>
83
+ )
84
+ }
85
+
86
+ /** A row above the field: staged attachments, a reply target, a context chip. */
87
+ export function PromptInputHeader(props: ComponentProps<'div'>) {
88
+ const [local, rest] = splitProps(props, ['class'])
89
+ return (
90
+ <InputGroupAddon
91
+ align="block-start"
92
+ data-slot="prompt-input-header"
93
+ class={cn('flex-wrap gap-1 px-3', local.class)}
94
+ {...rest}
95
+ />
96
+ )
97
+ }
98
+
99
+ /** Wraps a custom field (a token editor) so it spans the box like the textarea. */
100
+ export function PromptInputBody(props: ComponentProps<'div'>) {
101
+ const [local, rest] = splitProps(props, ['class'])
102
+ return <div data-slot="prompt-input-body" class={cn('w-full min-w-0', local.class)} {...rest} />
103
+ }
104
+
105
+ export type PromptInputTextareaProps = ComponentProps<'textarea'> & {
106
+ /**
107
+ * Enter submits the form and Shift+Enter breaks the line, unless an IME is
108
+ * composing. A composer that runs its own key policy passes false.
109
+ */
110
+ submitOnEnter?: boolean
111
+ }
112
+
113
+ export function PromptInputTextarea(props: PromptInputTextareaProps) {
114
+ const [local, rest] = splitProps(props, ['class', 'submitOnEnter', 'onKeyDown'])
115
+ return (
116
+ <InputGroupTextarea
117
+ data-slot="prompt-input-textarea"
118
+ placeholder="Write a message…"
119
+ class={cn('min-h-11 px-3 pt-3', local.class)}
120
+ onKeyDown={(event) => {
121
+ callHandler(local.onKeyDown, event)
122
+ if (local.submitOnEnter === false || event.defaultPrevented) return
123
+ if (event.key !== 'Enter' || event.shiftKey || event.isComposing) return
124
+ event.preventDefault()
125
+ event.currentTarget.form?.requestSubmit()
126
+ }}
127
+ {...rest}
128
+ />
129
+ )
130
+ }
131
+
132
+ /** The row under the field: tools on the start edge, submit on the end. */
133
+ export function PromptInputFooter(props: ComponentProps<'div'>) {
134
+ const [local, rest] = splitProps(props, ['class'])
135
+ return (
136
+ <InputGroupAddon
137
+ align="block-end"
138
+ data-slot="prompt-input-footer"
139
+ class={cn('justify-between gap-2 px-2', local.class)}
140
+ {...rest}
141
+ />
142
+ )
143
+ }
144
+
145
+ /** A group of tools in the footer, kept on one line. */
146
+ export function PromptInputTools(props: ComponentProps<'div'>) {
147
+ const [local, rest] = splitProps(props, ['class'])
148
+ return (
149
+ <div
150
+ data-slot="prompt-input-tools"
151
+ class={cn('flex min-w-0 items-center gap-1', local.class)}
152
+ {...rest}
153
+ />
154
+ )
155
+ }
156
+
157
+ /**
158
+ * An icon tool in the footer (attach, dictate, mention). Always carries a
159
+ * tooltip, because an icon alone does not say what it does.
160
+ */
161
+ export function PromptInputButton<T extends ValidComponent = 'button'>(
162
+ props: ActionButtonProps<T>
163
+ ) {
164
+ return (
165
+ <ActionButton
166
+ type="button"
167
+ variant="ghost"
168
+ size="icon-sm"
169
+ data-slot="prompt-input-button"
170
+ tooltipSide="top"
171
+ {...(props as ActionButtonProps)}
172
+ />
173
+ )
174
+ }
175
+
176
+ /**
177
+ * A labelled control in the footer: a model, an effort, a mode, a location.
178
+ * T3's ComposerControl: a ghost pill in muted text that brightens on hover and
179
+ * holds the accent tint while its menu is open. Use it as a menu trigger with
180
+ * `as={PromptInputControl}`, or directly as a toggle with `aria-pressed`.
181
+ */
182
+ export function PromptInputControl<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {
183
+ const [local, rest] = splitProps(props as ButtonProps, ['class'])
184
+ return (
185
+ <Button
186
+ variant="toolbar"
187
+ size="sm"
188
+ data-slot="prompt-input-control"
189
+ class={cn(
190
+ 'text-muted-foreground hover:text-foreground min-w-0 font-normal',
191
+ 'aria-pressed:bg-primary-subtle aria-pressed:text-primary',
192
+ '[&_[data-control-label]]:truncate',
193
+ local.class
194
+ )}
195
+ {...rest}
196
+ />
197
+ )
198
+ }
199
+
200
+ export type PromptInputStatus = 'ready' | 'submitted' | 'streaming' | 'error'
201
+
202
+ export type PromptInputSubmitProps = Omit<ActionButtonProps, 'children' | 'tooltip'> & {
203
+ /** Drives the glyph: arrow, spinner, stop square, or a cross after a failure. */
204
+ status?: PromptInputStatus
205
+ /** While streaming, the button stops the turn instead of submitting. */
206
+ onStop?: () => void
207
+ /** The action's name. Defaults to "Send message", or "Stop" while streaming. */
208
+ label?: string
209
+ children?: JSX.Element
210
+ }
211
+
212
+ /**
213
+ * The send control. A filled circle at the end of the footer, as in T3 and
214
+ * AI Elements; while a turn streams and `onStop` is given it becomes Stop.
215
+ */
216
+ export function PromptInputSubmit(props: PromptInputSubmitProps) {
217
+ const [local, rest] = splitProps(props, [
218
+ 'status',
219
+ 'onStop',
220
+ 'label',
221
+ 'children',
222
+ 'class',
223
+ 'onClick',
224
+ ])
225
+ const custom = resolveChildren(() => local.children)
226
+ const stopping = () => local.status === 'streaming' && local.onStop !== undefined
227
+ const label = () => local.label ?? (stopping() ? 'Stop' : 'Send message')
228
+
229
+ return (
230
+ <ActionButton
231
+ type={stopping() ? 'button' : 'submit'}
232
+ variant="default"
233
+ size="icon-sm"
234
+ data-slot="prompt-input-submit"
235
+ data-status={local.status ?? 'ready'}
236
+ aria-label={label()}
237
+ tooltip={label()}
238
+ tooltipSide="top"
239
+ class={cn('rounded-full', local.class)}
240
+ onClick={(event: MouseEvent & { currentTarget: HTMLButtonElement; target: Element }) => {
241
+ if (stopping()) {
242
+ event.preventDefault()
243
+ local.onStop?.()
244
+ return
245
+ }
246
+ callHandler(local.onClick as JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>, event)
247
+ }}
248
+ {...(rest as ActionButtonProps)}
249
+ >
250
+ <Show when={custom()} fallback={<SubmitGlyph status={local.status} stop={stopping()} />}>
251
+ {custom()}
252
+ </Show>
253
+ </ActionButton>
254
+ )
255
+ }
256
+
257
+ function SubmitGlyph(props: { status?: PromptInputStatus; stop: boolean }) {
258
+ return (
259
+ <Show when={!props.stop} fallback={<Square class="fill-current" />}>
260
+ <Show when={props.status !== 'submitted'} fallback={<Spinner size="sm" label={false} />}>
261
+ <Show when={props.status !== 'error'} fallback={<X />}>
262
+ <ArrowUp />
263
+ </Show>
264
+ </Show>
265
+ </Show>
266
+ )
267
+ }
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import type { JSX } from 'solid-js'
8
8
  import type { BusySendButtonProps, BusySendMode } from './busy-send-button'
9
+ import { PromptInputTextarea } from '../composites/prompt-input'
9
10
  import { ChatComposerShell } from './internal/chat-composer-shell'
10
11
 
11
12
  export type ChatComposerControl = {
@@ -63,11 +64,12 @@ export function ChatComposer(props: ChatComposerProps) {
63
64
  {...props}
64
65
  createSubmitExtra={() => ({})}
65
66
  renderInput={(input) => (
66
- <textarea
67
+ <PromptInputTextarea
67
68
  ref={input.ref}
68
69
  data-slot="composer-input"
70
+ submitOnEnter={false}
69
71
  aria-label={input.inputLabel()}
70
- class="field-sizing-content text-foreground placeholder:text-muted-foreground min-h-11 max-h-36 w-full resize-none border-0 bg-transparent px-4 py-3 text-sm outline-none disabled:opacity-50"
72
+ class="max-h-36 py-3"
71
73
  value={input.value()}
72
74
  onInput={(event) => props.onValueChange(event.currentTarget.value)}
73
75
  disabled={input.disabled()}