@justanarthur/modo-ui-ai 0.0.0-stage → 0.2.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 (343) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.fluid-functionalism +21 -0
  3. package/README.md +105 -2
  4. package/blocks/conversation/agent-prompt/examples.mdx +44 -0
  5. package/blocks/conversation/agent-prompt/index.tsx +114 -0
  6. package/blocks/conversation/composer/draft.css +25 -0
  7. package/blocks/conversation/composer/draft.tsx +589 -0
  8. package/blocks/conversation/composer/examples.mdx +114 -0
  9. package/blocks/conversation/composer/file-preview-tile.tsx +59 -0
  10. package/blocks/conversation/composer/file-thumbnail.tsx +146 -0
  11. package/blocks/conversation/composer/index.tsx +517 -0
  12. package/blocks/conversation/composer/queued-row.tsx +102 -0
  13. package/blocks/conversation/composer/shared.ts +38 -0
  14. package/blocks/conversation/composer/suggestion-row.tsx +64 -0
  15. package/blocks/conversation/composer/use-composer-files.ts +142 -0
  16. package/blocks/conversation/composer/use-history-nav.ts +60 -0
  17. package/blocks/conversation/composer/use-message-queue.ts +108 -0
  18. package/blocks/conversation/composer/use-region-height.ts +34 -0
  19. package/blocks/conversation/failure-states/examples.mdx +58 -0
  20. package/blocks/conversation/failure-states/index.tsx +274 -0
  21. package/blocks/conversation/transcript/examples.mdx +43 -0
  22. package/blocks/conversation/transcript/index.tsx +204 -0
  23. package/blocks/conversation/transcript-search/examples.mdx +50 -0
  24. package/blocks/conversation/transcript-search/index.tsx +469 -0
  25. package/blocks/dialogs/command-palette/examples.mdx +33 -0
  26. package/blocks/dialogs/command-palette/index.tsx +232 -0
  27. package/blocks/dialogs/hook-dialog/examples.mdx +44 -0
  28. package/blocks/dialogs/hook-dialog/index.tsx +286 -0
  29. package/blocks/dialogs/mcp-server-dialog/examples.mdx +57 -0
  30. package/blocks/dialogs/mcp-server-dialog/index.tsx +415 -0
  31. package/blocks/dialogs/shortcuts-sheet/examples.mdx +36 -0
  32. package/blocks/dialogs/shortcuts-sheet/index.tsx +186 -0
  33. package/blocks/panes/artifacts-pane/examples.mdx +23 -0
  34. package/blocks/panes/artifacts-pane/index.tsx +82 -0
  35. package/blocks/panes/changes-pane/examples.mdx +23 -0
  36. package/blocks/panes/changes-pane/index.tsx +248 -0
  37. package/blocks/panes/file-pane/examples.mdx +13 -0
  38. package/blocks/panes/file-pane/index.tsx +102 -0
  39. package/blocks/panes/pr-pane/examples.mdx +13 -0
  40. package/blocks/panes/pr-pane/index.tsx +191 -0
  41. package/blocks/panes/side-pane/examples.mdx +58 -0
  42. package/blocks/panes/side-pane/index.tsx +187 -0
  43. package/blocks/panes/tasks-pane/examples.mdx +23 -0
  44. package/blocks/panes/tasks-pane/index.tsx +127 -0
  45. package/blocks/panes/terminal-pane/examples.mdx +13 -0
  46. package/blocks/panes/terminal-pane/index.tsx +99 -0
  47. package/blocks/panes/usage-pane/examples.mdx +13 -0
  48. package/blocks/panes/usage-pane/index.tsx +75 -0
  49. package/blocks/profiles/profile-onboarding/examples.mdx +80 -0
  50. package/blocks/profiles/profile-onboarding/index.tsx +580 -0
  51. package/blocks/profiles/profile-switcher/examples.mdx +18 -0
  52. package/blocks/profiles/profile-switcher/index.tsx +197 -0
  53. package/blocks/profiles/profile-usage/examples.mdx +21 -0
  54. package/blocks/profiles/profile-usage/index.tsx +127 -0
  55. package/blocks/sessions/inbox/examples.mdx +35 -0
  56. package/blocks/sessions/inbox/index.tsx +372 -0
  57. package/blocks/sessions/session-board/examples.mdx +34 -0
  58. package/blocks/sessions/session-board/index.tsx +570 -0
  59. package/blocks/sessions/session-sidebar/examples.mdx +43 -0
  60. package/blocks/sessions/session-sidebar/index.tsx +442 -0
  61. package/blocks/settings/extensions/examples.mdx +10 -0
  62. package/blocks/settings/extensions/index.tsx +72 -0
  63. package/blocks/settings/hooks/examples.mdx +16 -0
  64. package/blocks/settings/hooks/index.tsx +127 -0
  65. package/blocks/settings/mcp-servers/examples.mdx +26 -0
  66. package/blocks/settings/mcp-servers/index.tsx +204 -0
  67. package/blocks/settings/memory/examples.mdx +22 -0
  68. package/blocks/settings/memory/index.tsx +113 -0
  69. package/blocks/settings/notifications/examples.mdx +8 -0
  70. package/blocks/settings/notifications/index.tsx +63 -0
  71. package/blocks/settings/permission-rules/examples.mdx +37 -0
  72. package/blocks/settings/permission-rules/index.tsx +317 -0
  73. package/blocks/settings/plugin-catalog/examples.mdx +52 -0
  74. package/blocks/settings/plugin-catalog/index.tsx +407 -0
  75. package/blocks/settings/plugins/examples.mdx +10 -0
  76. package/blocks/settings/plugins/index.tsx +72 -0
  77. package/blocks/settings/settings-window/examples.mdx +40 -0
  78. package/blocks/settings/settings-window/index.tsx +188 -0
  79. package/blocks/settings/worktrees/examples.mdx +17 -0
  80. package/blocks/settings/worktrees/index.tsx +145 -0
  81. package/components/conversation/agent-run/examples.mdx +30 -0
  82. package/components/conversation/agent-run/index.tsx +82 -0
  83. package/components/conversation/chapter-nav/examples.mdx +30 -0
  84. package/components/conversation/chapter-nav/index.tsx +123 -0
  85. package/components/conversation/message/examples.mdx +53 -0
  86. package/components/conversation/message/index.tsx +128 -0
  87. package/components/conversation/message/working.tsx +102 -0
  88. package/components/conversation/reasoning/examples.mdx +22 -0
  89. package/components/conversation/reasoning/index.tsx +54 -0
  90. package/components/conversation/recap/examples.mdx +21 -0
  91. package/components/conversation/recap/index.tsx +67 -0
  92. package/components/conversation/todo-list/examples.mdx +32 -0
  93. package/components/conversation/todo-list/index.tsx +106 -0
  94. package/components/conversation/tool-call/examples.mdx +48 -0
  95. package/components/conversation/tool-call/index.tsx +142 -0
  96. package/components/conversation/work-summary/examples.mdx +50 -0
  97. package/components/conversation/work-summary/index.tsx +87 -0
  98. package/components/prompts/permission-request/examples.mdx +32 -0
  99. package/components/prompts/permission-request/index.tsx +74 -0
  100. package/components/prompts/plan-approval/examples.mdx +37 -0
  101. package/components/prompts/plan-approval/index.tsx +76 -0
  102. package/components/prompts/prompt-card/examples.mdx +31 -0
  103. package/components/prompts/prompt-card/index.tsx +82 -0
  104. package/components/prompts/question-prompt/examples.mdx +46 -0
  105. package/components/prompts/question-prompt/index.tsx +118 -0
  106. package/dist/blocks/conversation/agent-prompt/index.d.ts +7 -0
  107. package/dist/blocks/conversation/agent-prompt/index.js +13 -0
  108. package/dist/blocks/conversation/composer/index.d.ts +4 -0
  109. package/dist/blocks/conversation/composer/index.js +15 -0
  110. package/dist/blocks/conversation/failure-states/index.d.ts +4 -0
  111. package/dist/blocks/conversation/failure-states/index.js +8 -0
  112. package/dist/blocks/conversation/transcript/index.d.ts +50 -0
  113. package/dist/blocks/conversation/transcript/index.js +17 -0
  114. package/dist/blocks/conversation/transcript-search/index.d.ts +4 -0
  115. package/dist/blocks/conversation/transcript-search/index.js +11 -0
  116. package/dist/blocks/dialogs/command-palette/index.d.ts +5 -0
  117. package/dist/blocks/dialogs/command-palette/index.js +20 -0
  118. package/dist/blocks/dialogs/hook-dialog/index.d.ts +3 -0
  119. package/dist/blocks/dialogs/hook-dialog/index.js +12 -0
  120. package/dist/blocks/dialogs/mcp-server-dialog/index.d.ts +5 -0
  121. package/dist/blocks/dialogs/mcp-server-dialog/index.js +12 -0
  122. package/dist/blocks/dialogs/shortcuts-sheet/index.d.ts +2 -0
  123. package/dist/blocks/dialogs/shortcuts-sheet/index.js +11 -0
  124. package/dist/blocks/panes/artifacts-pane/index.d.ts +3 -0
  125. package/dist/blocks/panes/artifacts-pane/index.js +9 -0
  126. package/dist/blocks/panes/changes-pane/index.d.ts +3 -0
  127. package/dist/blocks/panes/changes-pane/index.js +9 -0
  128. package/dist/blocks/panes/file-pane/index.d.ts +3 -0
  129. package/dist/blocks/panes/file-pane/index.js +9 -0
  130. package/dist/blocks/panes/pr-pane/index.d.ts +3 -0
  131. package/dist/blocks/panes/pr-pane/index.js +10 -0
  132. package/dist/blocks/panes/side-pane/index.d.ts +5 -0
  133. package/dist/blocks/panes/side-pane/index.js +21 -0
  134. package/dist/blocks/panes/tasks-pane/index.d.ts +3 -0
  135. package/dist/blocks/panes/tasks-pane/index.js +10 -0
  136. package/dist/blocks/panes/terminal-pane/index.d.ts +3 -0
  137. package/dist/blocks/panes/terminal-pane/index.js +9 -0
  138. package/dist/blocks/panes/usage-pane/index.d.ts +4 -0
  139. package/dist/blocks/panes/usage-pane/index.js +11 -0
  140. package/dist/blocks/profiles/profile-onboarding/index.d.ts +4 -0
  141. package/dist/blocks/profiles/profile-onboarding/index.js +11 -0
  142. package/dist/blocks/profiles/profile-switcher/index.d.ts +4 -0
  143. package/dist/blocks/profiles/profile-switcher/index.js +11 -0
  144. package/dist/blocks/profiles/profile-usage/index.d.ts +4 -0
  145. package/dist/blocks/profiles/profile-usage/index.js +10 -0
  146. package/dist/blocks/sessions/inbox/index.d.ts +2 -0
  147. package/dist/blocks/sessions/inbox/index.js +11 -0
  148. package/dist/blocks/sessions/session-board/index.d.ts +4 -0
  149. package/dist/blocks/sessions/session-board/index.js +26 -0
  150. package/dist/blocks/sessions/session-sidebar/index.d.ts +5 -0
  151. package/dist/blocks/sessions/session-sidebar/index.js +15 -0
  152. package/dist/blocks/settings/extensions/index.d.ts +2 -0
  153. package/dist/blocks/settings/extensions/index.js +9 -0
  154. package/dist/blocks/settings/hooks/index.d.ts +4 -0
  155. package/dist/blocks/settings/hooks/index.js +9 -0
  156. package/dist/blocks/settings/mcp-servers/index.d.ts +4 -0
  157. package/dist/blocks/settings/mcp-servers/index.js +9 -0
  158. package/dist/blocks/settings/memory/index.d.ts +4 -0
  159. package/dist/blocks/settings/memory/index.js +8 -0
  160. package/dist/blocks/settings/notifications/index.d.ts +2 -0
  161. package/dist/blocks/settings/notifications/index.js +8 -0
  162. package/dist/blocks/settings/permission-rules/index.d.ts +3 -0
  163. package/dist/blocks/settings/permission-rules/index.js +10 -0
  164. package/dist/blocks/settings/plugin-catalog/index.d.ts +2 -0
  165. package/dist/blocks/settings/plugin-catalog/index.js +11 -0
  166. package/dist/blocks/settings/plugins/index.d.ts +4 -0
  167. package/dist/blocks/settings/plugins/index.js +9 -0
  168. package/dist/blocks/settings/settings-window/index.d.ts +4 -0
  169. package/dist/blocks/settings/settings-window/index.js +8 -0
  170. package/dist/blocks/settings/worktrees/index.d.ts +4 -0
  171. package/dist/blocks/settings/worktrees/index.js +9 -0
  172. package/dist/components/conversation/agent-run/index.d.ts +3 -0
  173. package/dist/components/conversation/agent-run/index.js +10 -0
  174. package/dist/components/conversation/chapter-nav/index.d.ts +2 -0
  175. package/dist/components/conversation/chapter-nav/index.js +11 -0
  176. package/dist/components/conversation/message/index.d.ts +2 -0
  177. package/dist/components/conversation/message/index.js +15 -0
  178. package/dist/components/conversation/reasoning/index.d.ts +2 -0
  179. package/dist/components/conversation/reasoning/index.js +8 -0
  180. package/dist/components/conversation/recap/index.d.ts +2 -0
  181. package/dist/components/conversation/recap/index.js +9 -0
  182. package/dist/components/conversation/todo-list/index.d.ts +2 -0
  183. package/dist/components/conversation/todo-list/index.js +9 -0
  184. package/dist/components/conversation/tool-call/index.d.ts +3 -0
  185. package/dist/components/conversation/tool-call/index.js +13 -0
  186. package/dist/components/conversation/work-summary/index.d.ts +2 -0
  187. package/dist/components/conversation/work-summary/index.js +10 -0
  188. package/dist/components/prompts/permission-request/index.d.ts +2 -0
  189. package/dist/components/prompts/permission-request/index.js +9 -0
  190. package/dist/components/prompts/plan-approval/index.d.ts +2 -0
  191. package/dist/components/prompts/plan-approval/index.js +9 -0
  192. package/dist/components/prompts/prompt-card/index.d.ts +3 -0
  193. package/dist/components/prompts/prompt-card/index.js +8 -0
  194. package/dist/components/prompts/question-prompt/index.d.ts +2 -0
  195. package/dist/components/prompts/question-prompt/index.js +9 -0
  196. package/dist/index.d.ts +50 -0
  197. package/dist/index.js +231 -0
  198. package/dist/lib/config-parts.d.ts +2 -0
  199. package/dist/lib/config-parts.js +16 -0
  200. package/dist/lib/icons.d.ts +2 -0
  201. package/dist/lib/icons.js +10 -0
  202. package/dist/lib/pace-bar.d.ts +11 -0
  203. package/dist/lib/pace-bar.js +6 -0
  204. package/dist/lib/pace.d.ts +4 -0
  205. package/dist/lib/pace.js +12 -0
  206. package/dist/lib/pane-parts.d.ts +25 -0
  207. package/dist/lib/pane-parts.js +11 -0
  208. package/dist/lib/row-trigger.d.ts +5 -0
  209. package/dist/lib/row-trigger.js +7 -0
  210. package/dist/lib/settings-parts.d.ts +70 -0
  211. package/dist/lib/settings-parts.js +24 -0
  212. package/dist/lib/side-pane-types.d.ts +2 -0
  213. package/dist/lib/side-pane-types.js +1 -0
  214. package/dist/lib/status-glyph.d.ts +8 -0
  215. package/dist/lib/status-glyph.js +12 -0
  216. package/dist/lib/types.d.ts +3 -0
  217. package/dist/lib/types.js +1 -0
  218. package/dist/shared/chunk-04a497rr.js +21 -0
  219. package/dist/shared/chunk-13yf0mza.d.ts +70 -0
  220. package/dist/shared/chunk-1aq2xzv5.js +558 -0
  221. package/dist/shared/chunk-1f96cz69.js +45 -0
  222. package/dist/shared/chunk-1yt061np.d.ts +64 -0
  223. package/dist/shared/chunk-218qabm5.js +250 -0
  224. package/dist/shared/chunk-2fk5aq60.js +313 -0
  225. package/dist/shared/chunk-4248zvmh.js +177 -0
  226. package/dist/shared/chunk-45rqgey6.d.ts +25 -0
  227. package/dist/shared/chunk-4n0v64qx.js +179 -0
  228. package/dist/shared/chunk-4zvhpf2x.js +55 -0
  229. package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
  230. package/dist/shared/chunk-58qvny6a.d.ts +29 -0
  231. package/dist/shared/chunk-5fhkkn39.js +130 -0
  232. package/dist/shared/chunk-5hw0525a.d.ts +33 -0
  233. package/dist/shared/chunk-5k6xwqfj.d.ts +68 -0
  234. package/dist/shared/chunk-5meda998.js +238 -0
  235. package/dist/shared/chunk-5pqksw7z.js +91 -0
  236. package/dist/shared/chunk-6220dy5n.js +70 -0
  237. package/dist/shared/chunk-64bnh22t.d.ts +59 -0
  238. package/dist/shared/chunk-66sh633m.d.ts +60 -0
  239. package/dist/shared/chunk-6cmf27g3.d.ts +81 -0
  240. package/dist/shared/chunk-6g4970a6.d.ts +20 -0
  241. package/dist/shared/chunk-75zwypyr.d.ts +43 -0
  242. package/dist/shared/chunk-7rzjmcnh.d.ts +30 -0
  243. package/dist/shared/chunk-7zvb39cf.d.ts +26 -0
  244. package/dist/shared/chunk-8mecznyr.js +357 -0
  245. package/dist/shared/chunk-8pag6vmd.js +255 -0
  246. package/dist/shared/chunk-8xg5gwwy.js +38 -0
  247. package/dist/shared/chunk-9kw6m047.d.ts +32 -0
  248. package/dist/shared/chunk-a4s440b6.js +79 -0
  249. package/dist/shared/chunk-at0jje23.d.ts +110 -0
  250. package/dist/shared/chunk-awd573h9.js +34 -0
  251. package/dist/shared/chunk-b171wjge.d.ts +25 -0
  252. package/dist/shared/chunk-bh2b5d1z.js +98 -0
  253. package/dist/shared/chunk-bzs6amnv.js +187 -0
  254. package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
  255. package/dist/shared/chunk-c8wp058j.js +153 -0
  256. package/dist/shared/chunk-cd4f87as.d.ts +28 -0
  257. package/dist/shared/chunk-cmwby8f9.js +467 -0
  258. package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
  259. package/dist/shared/chunk-dh3qy5fj.js +49 -0
  260. package/dist/shared/chunk-e46apgve.d.ts +40 -0
  261. package/dist/shared/chunk-ejtknc0w.js +21 -0
  262. package/dist/shared/chunk-eqajdxn8.js +82 -0
  263. package/dist/shared/chunk-fbn0h7cr.js +123 -0
  264. package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
  265. package/dist/shared/chunk-g28hweee.d.ts +35 -0
  266. package/dist/shared/chunk-g88hweqh.d.ts +70 -0
  267. package/dist/shared/chunk-gewnsgza.js +61 -0
  268. package/dist/shared/chunk-gkyk663q.d.ts +53 -0
  269. package/dist/shared/chunk-hd4gtj5z.d.ts +23 -0
  270. package/dist/shared/chunk-hxjgey30.d.ts +36 -0
  271. package/dist/shared/chunk-jkkdq1mh.d.ts +213 -0
  272. package/dist/shared/chunk-jpq101w3.js +91 -0
  273. package/dist/shared/chunk-k3bv9k1v.d.ts +56 -0
  274. package/dist/shared/chunk-k5zegxje.d.ts +81 -0
  275. package/dist/shared/chunk-kreypnzp.d.ts +34 -0
  276. package/dist/shared/chunk-kw9npka5.js +224 -0
  277. package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
  278. package/dist/shared/chunk-n1qq2wp9.js +6 -0
  279. package/dist/shared/chunk-n4742y54.js +39 -0
  280. package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
  281. package/dist/shared/chunk-nk4578dr.js +73 -0
  282. package/dist/shared/chunk-paezqfg1.js +106 -0
  283. package/dist/shared/chunk-qemm9e3r.d.ts +21 -0
  284. package/dist/shared/chunk-qhxz1etk.js +96 -0
  285. package/dist/shared/chunk-qj5ev9ak.js +531 -0
  286. package/dist/shared/chunk-qnwggvjy.js +150 -0
  287. package/dist/shared/chunk-r5hz78pb.js +129 -0
  288. package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
  289. package/dist/shared/chunk-rjfwje37.d.ts +234 -0
  290. package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
  291. package/dist/shared/chunk-rzajcn44.d.ts +49 -0
  292. package/dist/shared/chunk-s3r759ec.js +80 -0
  293. package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
  294. package/dist/shared/chunk-sfqvyzcs.d.ts +68 -0
  295. package/dist/shared/chunk-skg3m9m0.js +56 -0
  296. package/dist/shared/chunk-szkvrqg1.d.ts +54 -0
  297. package/dist/shared/chunk-t21t9x7e.js +188 -0
  298. package/dist/shared/chunk-tc75ng2c.js +235 -0
  299. package/dist/shared/chunk-tkx1krwc.js +88 -0
  300. package/dist/shared/chunk-tprdqtb1.d.ts +30 -0
  301. package/dist/shared/chunk-tv9a1sek.js +137 -0
  302. package/dist/shared/chunk-tvbd27hg.d.ts +43 -0
  303. package/dist/shared/chunk-v6yevw62.d.ts +28 -0
  304. package/dist/shared/chunk-v9q38p0x.js +258 -0
  305. package/dist/shared/chunk-vd59gzzd.js +86 -0
  306. package/dist/shared/chunk-vgh4f3sv.js +118 -0
  307. package/dist/shared/chunk-vjht1zn1.js +391 -0
  308. package/dist/shared/chunk-vsrkb0sp.d.ts +21 -0
  309. package/dist/shared/chunk-w5z8qnf8.js +175 -0
  310. package/dist/shared/chunk-wgvzavx1.js +1488 -0
  311. package/dist/shared/chunk-whsx7yp9.d.ts +37 -0
  312. package/dist/shared/chunk-x7az5x1y.d.ts +57 -0
  313. package/dist/shared/chunk-x9jf26yb.js +318 -0
  314. package/dist/shared/chunk-xbrrt07s.d.ts +23 -0
  315. package/dist/shared/chunk-xkchhs2z.js +129 -0
  316. package/dist/shared/chunk-xzfrskd7.js +202 -0
  317. package/dist/shared/chunk-y4cj4y54.js +423 -0
  318. package/dist/shared/chunk-y934at6m.js +7 -0
  319. package/dist/shared/chunk-zbpwhpjy.d.ts +75 -0
  320. package/dist/shared/chunk-zfhmbb7n.js +63 -0
  321. package/dist/shared/chunk-zk0t4vq5.js +71 -0
  322. package/dist/shared/chunk-znp9gna7.d.ts +23 -0
  323. package/dist/styles.css +467 -0
  324. package/index.ts +49 -0
  325. package/lib/config-parts.tsx +97 -0
  326. package/lib/icons.tsx +149 -0
  327. package/lib/pace-bar.tsx +24 -0
  328. package/lib/pace.ts +74 -0
  329. package/lib/pane-parts.tsx +76 -0
  330. package/lib/row-trigger.tsx +44 -0
  331. package/lib/settings-parts.tsx +232 -0
  332. package/lib/side-pane-types.ts +75 -0
  333. package/lib/status-glyph.tsx +25 -0
  334. package/lib/types.ts +204 -0
  335. package/mock/demo-reply.tsx +33 -0
  336. package/mock/demo-session.tsx +150 -0
  337. package/mock/mock-config.ts +173 -0
  338. package/mock/mock-extras.ts +288 -0
  339. package/mock/mock-panes.ts +190 -0
  340. package/mock/mock-settings.ts +92 -0
  341. package/mock/mock.ts +548 -0
  342. package/mock/screen-frame.tsx +49 -0
  343. package/package.json +114 -4
@@ -0,0 +1,589 @@
1
+ /*!
2
+ * Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
3
+ * `registry/default/input-message.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
4
+ * MIT License © 2026 Micka Touillaud (notice: LICENSE.fluid-functionalism). Local changes: see ui/PORTING.md.
5
+ */
6
+
7
+ 'use client'
8
+
9
+ import { SurfaceProvider, useAutosizeTextarea, useReduceMotion, useTouchPrimary } from '@justanarthur/modo-ui'
10
+ import { Button } from '@justanarthur/modo-ui/components/actions/button'
11
+ import { useIcon } from '@justanarthur/modo-ui/lib/icon-context'
12
+ import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
13
+ import { type SizeVariant, useSize } from '@justanarthur/modo-ui/lib/size-context'
14
+ import { spring } from '@justanarthur/modo-ui/lib/springs'
15
+ import { surfaceClasses } from '@justanarthur/modo-ui/lib/surface-classes'
16
+ import { useControllableState } from '@justanarthur/modo-ui/lib/use-controllable-state'
17
+ import { cn } from '@justanarthur/modo-ui/lib/utils'
18
+ import { FluidHoverHighlight, useFluidHover } from '@justanarthur/modo-ui/primitives/systems/fluid-hover'
19
+ import { SizeScope } from '@justanarthur/modo-ui/primitives/systems/sizes'
20
+ import { AnimatePresence, motion, Reorder } from 'motion/react'
21
+ import {
22
+ forwardRef,
23
+ type HTMLAttributes,
24
+ type KeyboardEvent as ReactKeyboardEvent,
25
+ type MouseEvent as ReactMouseEvent,
26
+ type TextareaHTMLAttributes,
27
+ useCallback,
28
+ useEffect,
29
+ useId,
30
+ useMemo,
31
+ useRef,
32
+ } from 'react'
33
+ import { FilePreviewTile } from './file-preview-tile'
34
+ import { QueuedRow } from './queued-row'
35
+ import { caretToEnd, type DraftSlot, type DraftSlotContext, type DraftStatus, type QueuedMessage } from './shared'
36
+ import { SuggestionRow } from './suggestion-row'
37
+ import { useComposerFiles } from './use-composer-files'
38
+ import { useHistoryNav } from './use-history-nav'
39
+ import { useMessageQueue } from './use-message-queue'
40
+ import { useRegionHeight } from './use-region-height'
41
+
42
+ const DEFAULT_ACCEPT = 'image/png,image/jpeg,application/pdf'
43
+ const NO_STRINGS: string[] = []
44
+ const REGION_SPRING = { ...spring.moderate, bounce: 0 }
45
+
46
+ interface ComposerDraftProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
47
+ /** Step on the size ladder (see Sizes). Wins over the surrounding SizeProvider and propagates to the composer's rows, buttons and queued messages. */
48
+ size?: SizeVariant
49
+ /** Controlled textarea value. Pair with `onValueChange`; omit both for an uncontrolled composer. */
50
+ value?: string
51
+ /** Initial textarea value for an uncontrolled composer. Defaults to `""`. */
52
+ defaultValue?: string
53
+ /** Called with the new value on every textarea change. */
54
+ onValueChange?: (value: string) => void
55
+ /** Fires on Enter (without Shift) or send-button click, and when a queued message auto-dispatches. Receives the trimmed value, the attached files, and — for auto-dispatched queue items — `meta.queuedId`. Skipped when the value is empty and no files are attached. */
56
+ onSend?: (value: string, files: File[], meta?: { queuedId?: string }) => void
57
+ /** Placeholder shown when the value is empty. While a file is dragged over the component (and attachments are enabled) it swaps to "Drop files here to add to chat". Defaults to `"Ask me anything…"`. */
58
+ placeholder?: string
59
+ /** Content rendered in the bottom-left action area. May be a render-fn that receives `{ openFilePicker, files }` — `openFilePicker(acceptOverride?)` opens the native file picker. */
60
+ leftSlot?: DraftSlot
61
+ /** Content rendered in the bottom-right action area, before the built-in send button. Same render-fn shape as `leftSlot`. */
62
+ rightSlot?: DraftSlot
63
+ /** Disables the textarea, send button, and drag-and-drop. Defaults to `false`. */
64
+ disabled?: boolean
65
+ /** Minimum visible rows before the textarea grows. Defaults to 1. */
66
+ minRows?: number
67
+ /** Maximum visible rows before the textarea starts to scroll. Defaults to 8. */
68
+ maxRows?: number
69
+ /** When true, clicking anywhere on the surrounding container (outside of buttons / links / inputs) focuses the textarea. Defaults to `true`. */
70
+ clickToFocus?: boolean
71
+ /** Accessible label for the send button. Defaults to `"Send"`. */
72
+ sendLabel?: string
73
+ /** Controlled list of attached files. Pair with `onFilesChange` to enable drag-and-drop and the file-picker slot helper. */
74
+ files?: File[]
75
+ /** Initial attachments for an uncontrolled composer. Providing it (even as `[]`) enables attachment behavior on its own. */
76
+ defaultFiles?: File[]
77
+ /** Called when files are added (drag-drop or picker) or removed via the preview tile's × button. Duplicate drops of the same file (same name + size + lastModified) are silently de-duplicated. */
78
+ onFilesChange?: (files: File[]) => void
79
+ /** Accepted MIME types as a comma-separated string. Used by both the file picker and the drag-and-drop filter. Defaults to `"image/png,image/jpeg,application/pdf"`. */
80
+ accept?: string
81
+ /** Maximum number of attached files. Extra files beyond this limit are dropped. */
82
+ maxFiles?: number
83
+ /** Side length (in pixels) of each preview tile. Images use object-cover; PDFs render the first page via pdfjs (an optional peer: without `pdfjs-dist` they show the file icon); other types fall back to a centered icon. Defaults to 80. */
84
+ filePreviewSize?: number
85
+ /** Extra props forwarded to the underlying textarea (value, onChange, onKeyDown, disabled and placeholder are controlled by the component). */
86
+ textareaProps?: Omit<
87
+ TextareaHTMLAttributes<HTMLTextAreaElement>,
88
+ 'value' | 'onChange' | 'onKeyDown' | 'disabled' | 'placeholder'
89
+ >
90
+ /** Assistant response state. When `"streaming"`, the send button becomes a Stop control (empty draft) or a Queue action (non-empty draft). On the streaming→idle edge the next queued message auto-dispatches via `onSend`. Leave it and `defaultStatus` undefined for the send-immediately behavior. */
91
+ status?: DraftStatus
92
+ /** Initial status for an uncontrolled composer — the component then owns the streaming flag, and Stop flips it to `"idle"` itself. */
93
+ defaultStatus?: DraftStatus
94
+ /** Called whenever the status changes while it is uncontrolled (currently: the Stop control). */
95
+ onStatusChange?: (status: DraftStatus) => void
96
+ /** Fires when the Stop control is pressed (streaming + empty draft). Halt the current response and set status to `"idle"` — that edge immediately dispatches the next queued message. */
97
+ onStop?: () => void
98
+ /** Controlled queue of pending messages, rendered as reorderable rows above the textarea. Double-click (or Enter/F2) edits a row back into the composer; the × (or Delete) removes it; drag — or Alt+↑/↓ — reorders. Requires a status. */
99
+ queue?: QueuedMessage[]
100
+ /** Initial queue for an uncontrolled composer. Providing it (even as `[]`) enables the queue on its own, alongside `status` or `defaultStatus`. */
101
+ defaultQueue?: QueuedMessage[]
102
+ /** Called whenever the queue changes — enqueue, edit, delete, reorder, or auto-dispatch. Each QueuedMessage is `{ id, text, files }`. */
103
+ onQueueChange?: (queue: QueuedMessage[]) => void
104
+ /** Render the built-in reorderable queue rows above the textarea. Set to false to suppress them and render the queue yourself — enqueue and auto-dispatch still run. Defaults to `true`. */
105
+ showQueue?: boolean
106
+ /** Previously-sent messages, oldest first. With the textarea focused, ArrowUp (caret on the first line) recalls the previous message and walks backward; ArrowDown (caret on the last line) walks forward toward the in-progress draft. Editing or sending exits history mode. Defaults to `[]`. */
107
+ history?: string[]
108
+ /** Suggested prompt rendered as the placeholder (with a Tab keycap) while the draft is empty. Pressing Tab fills it into the composer — it doesn't send. Takes precedence over `placeholder`. */
109
+ placeholderSuggestion?: string
110
+ /** Suggested prompts listed under the action bar while the draft is empty. ArrowDown moves a highlight into the list (focus stays in the textarea), ArrowUp walks back up and out, Enter or click fills the highlighted prompt. Escape drops the highlight; typing collapses the list. */
111
+ suggestions?: string[]
112
+ /** Extra classes for the composer surface. */
113
+ className?: string
114
+ }
115
+
116
+ const isPlain = (e: ReactKeyboardEvent) => !e.shiftKey && !e.altKey && !e.metaKey && !e.ctrlKey
117
+
118
+ /**
119
+ * The composer's draft on its own (Fluid Functionalism's InputMessage): the
120
+ * textarea, its attachments, queue, history and suggestions, and the send /
121
+ * queue / stop button, on a Surface-2 substrate. `Composer` documents it.
122
+ */
123
+ const ComposerDraft = forwardRef<HTMLDivElement, ComposerDraftProps>(
124
+ (
125
+ {
126
+ size,
127
+ value: valueProp,
128
+ defaultValue,
129
+ onValueChange,
130
+ onSend,
131
+ placeholder = 'Ask me anything…',
132
+ leftSlot,
133
+ rightSlot,
134
+ disabled,
135
+ minRows = 1,
136
+ maxRows = 8,
137
+ clickToFocus = true,
138
+ sendLabel = 'Send',
139
+ files,
140
+ defaultFiles,
141
+ onFilesChange,
142
+ accept = DEFAULT_ACCEPT,
143
+ maxFiles,
144
+ filePreviewSize = 80,
145
+ textareaProps,
146
+ status,
147
+ defaultStatus,
148
+ onStatusChange,
149
+ onStop,
150
+ queue,
151
+ defaultQueue,
152
+ onQueueChange,
153
+ showQueue = true,
154
+ history = NO_STRINGS,
155
+ placeholderSuggestion,
156
+ suggestions,
157
+ className,
158
+ ...props
159
+ },
160
+ ref,
161
+ ) => {
162
+ const shape = useShape()
163
+ const compactStep = useSize(size).variant === 'compact'
164
+ const ArrowUpIcon = useIcon('arrow-up')
165
+ const reduceMotion = useReduceMotion()
166
+ const isTouch = useTouchPrimary()
167
+ const textareaRef = useRef<HTMLTextAreaElement>(null)
168
+ const {
169
+ onBlur: textareaOnBlur,
170
+ 'aria-describedby': textareaDescribedBy,
171
+ ...restTextareaProps
172
+ } = textareaProps ?? {}
173
+
174
+ const valueControlled = valueProp !== undefined
175
+ const [value, setValue] = useControllableState<string>(valueProp, defaultValue ?? '', onValueChange)
176
+ const attachments = useComposerFiles({ files, defaultFiles, onFilesChange, accept, maxFiles, disabled })
177
+ const messages = useMessageQueue({
178
+ status,
179
+ defaultStatus,
180
+ onStatusChange,
181
+ onStop,
182
+ queue,
183
+ defaultQueue,
184
+ onQueueChange,
185
+ onSend,
186
+ })
187
+ const recall = useHistoryNav(history, value, setValue, textareaRef)
188
+
189
+ useAutosizeTextarea(textareaRef, { minRows, maxRows }, [value, compactStep])
190
+
191
+ // The list shows while the draft is empty; focus stays in the textarea
192
+ // (aria-activedescendant), and pointer and keyboard drive one fluid-hover highlight.
193
+ const suggestionList = suggestions ?? NO_STRINGS
194
+ const suggestionsOpen = suggestionList.length > 0 && value === ''
195
+ const suggestionListRef = useRef<HTMLDivElement | null>(null)
196
+ const suggestionHover = useFluidHover(suggestionListRef)
197
+ const {
198
+ activeIndex: activeSuggestion,
199
+ setActiveIndex: setActiveSuggestion,
200
+ handlers: suggestionHandlers,
201
+ registerItem: registerSuggestion,
202
+ remeasure,
203
+ } = suggestionHover
204
+ const suggestionListId = useId()
205
+ const ghostHintId = useId()
206
+ const showGhost = !!placeholderSuggestion && value === '' && !attachments.dragging
207
+
208
+ const [filesRegionRef, filesRegionHeight] = useRegionHeight()
209
+ const [queueRegionRef, queueRegionHeight] = useRegionHeight()
210
+ const [suggestionsRegionRef, suggestionsRegionHeight] = useRegionHeight()
211
+
212
+ // Closed rows keep their registration with stale rects: remeasure on open.
213
+ useEffect(() => {
214
+ if (suggestionsOpen) remeasure()
215
+ else setActiveSuggestion(null)
216
+ }, [suggestionsOpen, remeasure, setActiveSuggestion])
217
+
218
+ const acceptSuggestion = useCallback(
219
+ (text: string) => {
220
+ setActiveSuggestion(null)
221
+ recall.exit()
222
+ setValue(text)
223
+ caretToEnd(textareaRef)
224
+ },
225
+ [setValue, setActiveSuggestion, recall.exit],
226
+ )
227
+
228
+ const trimmed = value.trim()
229
+ const canSend = !disabled && (trimmed.length > 0 || attachments.files.length > 0)
230
+
231
+ const handleSend = () => {
232
+ if (!canSend) return
233
+ recall.exit()
234
+ if (messages.streaming && messages.supported) {
235
+ messages.enqueue(trimmed, attachments.files)
236
+ setValue('')
237
+ attachments.replace([])
238
+ caretToEnd(textareaRef)
239
+ return
240
+ }
241
+ onSend?.(trimmed, attachments.files)
242
+ if (!valueControlled) setValue('')
243
+ if (!attachments.controlled) attachments.replace([])
244
+ }
245
+
246
+ const editQueued = (item: QueuedMessage) => {
247
+ recall.exit()
248
+ setValue(item.text)
249
+ attachments.replace(item.files)
250
+ messages.remove(item)
251
+ caretToEnd(textareaRef)
252
+ }
253
+
254
+ const buttonMode: 'send' | 'queue' | 'stop' = !messages.streaming
255
+ ? 'send'
256
+ : canSend && messages.supported
257
+ ? 'queue'
258
+ : messages.canStop
259
+ ? 'stop'
260
+ : 'send'
261
+ const buttonLabel = buttonMode === 'stop' ? 'Stop' : buttonMode === 'queue' ? 'Queue message' : sendLabel
262
+
263
+ const handleKeyDown = (e: ReactKeyboardEvent<HTMLTextAreaElement>) => {
264
+ if (e.nativeEvent.isComposing) return
265
+
266
+ if (suggestionsOpen && isPlain(e)) {
267
+ if (e.key === 'ArrowDown') {
268
+ e.preventDefault()
269
+ setActiveSuggestion(prev => (prev == null ? 0 : Math.min(prev + 1, suggestionList.length - 1)))
270
+ return
271
+ }
272
+ if (activeSuggestion != null) {
273
+ if (e.key === 'ArrowUp') {
274
+ e.preventDefault()
275
+ setActiveSuggestion(activeSuggestion === 0 ? null : activeSuggestion - 1)
276
+ return
277
+ }
278
+ if (e.key === 'Enter') {
279
+ e.preventDefault()
280
+ const picked = suggestionList[activeSuggestion]
281
+ if (picked !== undefined) acceptSuggestion(picked)
282
+ return
283
+ }
284
+ if (e.key === 'Escape') {
285
+ e.preventDefault()
286
+ setActiveSuggestion(null)
287
+ return
288
+ }
289
+ }
290
+ }
291
+
292
+ // Shift+Tab, and Tab once there is a draft, still move focus.
293
+ if (e.key === 'Tab' && !e.shiftKey && placeholderSuggestion && value === '') {
294
+ e.preventDefault()
295
+ acceptSuggestion(placeholderSuggestion)
296
+ return
297
+ }
298
+
299
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
300
+ recall.onKeyDown(e)
301
+ return
302
+ }
303
+
304
+ if (e.key === 'Enter' && !e.shiftKey) {
305
+ e.preventDefault()
306
+ handleSend()
307
+ }
308
+ }
309
+
310
+ const handleContainerMouseDown = (e: ReactMouseEvent<HTMLDivElement>) => {
311
+ if (!clickToFocus || disabled) return
312
+ const target = e.target as HTMLElement
313
+ if (target === textareaRef.current) return
314
+ if (target.closest('button, a, input, select, textarea, [contenteditable], [role="button"], [data-draft-queue]'))
315
+ return
316
+ e.preventDefault()
317
+ textareaRef.current?.focus()
318
+ }
319
+
320
+ const slotCtx = useMemo<DraftSlotContext>(
321
+ () => ({ openFilePicker: attachments.openPicker, files: attachments.files }),
322
+ [attachments.openPicker, attachments.files],
323
+ )
324
+ const leftContent = typeof leftSlot === 'function' ? leftSlot(slotCtx) : leftSlot
325
+ const rightContent = typeof rightSlot === 'function' ? rightSlot(slotCtx) : rightSlot
326
+ const textStep = compactStep
327
+ ? 'text-subtitle-compact leading-4.5 px-1.5 py-1.5'
328
+ : 'text-subtitle leading-5 px-2 py-2'
329
+
330
+ return (
331
+ <SizeScope size={size}>
332
+ {/* biome-ignore lint/a11y/noStaticElementInteractions: the textarea is the control; the panel forwards pointer focus and takes drops. */}
333
+ <div
334
+ ref={ref}
335
+ data-composer-draft=""
336
+ data-click-to-focus={clickToFocus && !disabled ? '' : undefined}
337
+ data-drag-over={attachments.dragging ? '' : undefined}
338
+ onMouseDown={handleContainerMouseDown}
339
+ {...attachments.dropHandlers}
340
+ className={cn(
341
+ 'flex flex-col gap-1 p-2 transition-[box-shadow,color] duration-fast',
342
+ surfaceClasses(2, 2),
343
+ shape.container,
344
+ clickToFocus && !disabled && 'cursor-text',
345
+ disabled && 'opacity-50 pointer-events-none',
346
+ className,
347
+ )}
348
+ {...props}
349
+ >
350
+ <SurfaceProvider value={2}>
351
+ {attachments.supported && (
352
+ <input {...attachments.inputProps} className="hidden" aria-hidden="true" tabIndex={-1} />
353
+ )}
354
+
355
+ {/* popLayout pulls a leaving tile out of flow so its siblings slide in;
356
+ keys are file identity, so removing one never remounts the rest. */}
357
+ <AnimatePresence initial={false}>
358
+ {attachments.files.length > 0 && (
359
+ <motion.div
360
+ key="preview-row"
361
+ initial={{ height: 0, opacity: 0 }}
362
+ animate={{ height: filesRegionHeight ?? 0, opacity: 1 }}
363
+ exit={{ height: 0, opacity: 0 }}
364
+ transition={REGION_SPRING}
365
+ className="overflow-hidden"
366
+ >
367
+ <div ref={filesRegionRef} className="flex flex-wrap gap-2 pb-1">
368
+ <AnimatePresence initial={false} mode="popLayout">
369
+ {attachments.files.map((file, i) => (
370
+ <FilePreviewTile
371
+ key={`${file.name}-${file.size}-${file.lastModified}`}
372
+ file={file}
373
+ onRemove={() => attachments.remove(i)}
374
+ size={filePreviewSize}
375
+ />
376
+ ))}
377
+ </AnimatePresence>
378
+ </div>
379
+ </motion.div>
380
+ )}
381
+ </AnimatePresence>
382
+
383
+ {messages.supported && showQueue && (
384
+ <AnimatePresence initial={false}>
385
+ {messages.queue.length > 0 && (
386
+ <motion.div
387
+ key="queue-row"
388
+ initial={{ height: 0, opacity: 0 }}
389
+ animate={{ height: queueRegionHeight ?? 0, opacity: 1 }}
390
+ exit={{ height: 0, opacity: 0 }}
391
+ transition={REGION_SPRING}
392
+ className="overflow-hidden"
393
+ >
394
+ <Reorder.Group
395
+ ref={queueRegionRef}
396
+ axis="y"
397
+ values={messages.queue}
398
+ onReorder={messages.setQueue}
399
+ data-draft-queue
400
+ className="flex flex-col gap-1 pb-1"
401
+ >
402
+ <AnimatePresence initial={false}>
403
+ {messages.queue.map((item, i) => (
404
+ <QueuedRow
405
+ key={item.id}
406
+ item={item}
407
+ index={i}
408
+ total={messages.queue.length}
409
+ reduceMotion={reduceMotion}
410
+ isTouch={isTouch}
411
+ onEdit={editQueued}
412
+ onRemove={messages.remove}
413
+ onMove={messages.move}
414
+ />
415
+ ))}
416
+ </AnimatePresence>
417
+ </Reorder.Group>
418
+ </motion.div>
419
+ )}
420
+ </AnimatePresence>
421
+ )}
422
+
423
+ <div className="relative">
424
+ <textarea
425
+ ref={textareaRef}
426
+ value={value}
427
+ onChange={e => {
428
+ recall.exit()
429
+ setActiveSuggestion(null)
430
+ setValue(e.target.value)
431
+ }}
432
+ onKeyDown={handleKeyDown}
433
+ onBlur={e => {
434
+ setActiveSuggestion(null)
435
+ textareaOnBlur?.(e)
436
+ }}
437
+ placeholder={
438
+ attachments.dragging
439
+ ? 'Drop files here to add to chat'
440
+ : placeholderSuggestion
441
+ ? undefined // the ghost below renders it
442
+ : placeholder
443
+ }
444
+ disabled={disabled}
445
+ rows={minRows}
446
+ aria-label={textareaProps?.['aria-label'] ?? 'Message'}
447
+ aria-describedby={
448
+ [showGhost ? ghostHintId : null, textareaDescribedBy].filter(Boolean).join(' ') || undefined
449
+ }
450
+ aria-activedescendant={activeSuggestion != null ? `${suggestionListId}-${activeSuggestion}` : undefined}
451
+ className={cn(
452
+ 'w-full resize-none rounded-none bg-transparent outline-none',
453
+ 'text-foreground placeholder:text-muted-foreground',
454
+ textStep,
455
+ 'weight-normal',
456
+ )}
457
+ {...restTextareaProps}
458
+ />
459
+ {/* An overlay rather than the native placeholder, so the Tab keycap can sit inline. */}
460
+ {showGhost && (
461
+ <div
462
+ aria-hidden="true"
463
+ className={cn(
464
+ 'pointer-events-none absolute inset-0 overflow-hidden text-muted-foreground',
465
+ textStep,
466
+ 'weight-normal',
467
+ )}
468
+ >
469
+ <span className="flex max-w-full items-center gap-1.5">
470
+ <span className="min-w-0 truncate">{placeholderSuggestion}</span>
471
+ <kbd
472
+ className={cn(
473
+ 'inline-flex shrink-0 -translate-y-px items-center rounded-box border border-border bg-background px-1 font-sans text-muted-foreground',
474
+ compactStep ? 'h-4 text-micro-compact' : 'h-[18px] text-micro',
475
+ )}
476
+ >
477
+ Tab
478
+ </kbd>
479
+ </span>
480
+ </div>
481
+ )}
482
+ {showGhost && (
483
+ <span id={ghostHintId} className="sr-only">
484
+ Suggested prompt: {placeholderSuggestion}. Press Tab to fill the composer with it.
485
+ </span>
486
+ )}
487
+ </div>
488
+ <div
489
+ className={cn(
490
+ 'flex items-center justify-between',
491
+ // Slot buttons are the consumer's: the compact step scales every one, send included.
492
+ compactStep ? 'gap-1.5 [&_button]:h-6 [&_button.w-7]:w-6 [&_button]:text-caption-compact' : 'gap-2',
493
+ )}
494
+ >
495
+ <div className="flex items-center gap-1.5 min-w-0">{leftContent}</div>
496
+ <div className="flex items-center gap-1.5 shrink-0">
497
+ {rightContent}
498
+ <Button
499
+ type="button"
500
+ variant="primary"
501
+ size="icon-compact"
502
+ onClick={buttonMode === 'stop' ? messages.stop : handleSend}
503
+ disabled={buttonMode === 'stop' ? disabled : !canSend}
504
+ aria-label={buttonLabel}
505
+ >
506
+ <AnimatePresence mode="wait" initial={false}>
507
+ <motion.span
508
+ key={buttonMode === 'stop' ? 'stop' : 'arrow'}
509
+ initial={reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6 }}
510
+ animate={{ opacity: 1, scale: 1 }}
511
+ exit={reduceMotion ? { opacity: 0 } : { opacity: 0, scale: 0.6, transition: spring.fast.exit }}
512
+ transition={spring.fast}
513
+ className="flex items-center justify-center leading-none"
514
+ >
515
+ {buttonMode === 'stop' ? (
516
+ <span className="h-3 w-3 rounded-glyph bg-current" />
517
+ ) : (
518
+ // A touch larger than icon-compact's 14px svg.
519
+ <ArrowUpIcon
520
+ size={compactStep ? 15 : 19}
521
+ className={cn('block', compactStep ? '!h-[15px] !w-[15px]' : '!h-[19px] !w-[19px]')}
522
+ />
523
+ )}
524
+ </motion.span>
525
+ </AnimatePresence>
526
+ </Button>
527
+ </div>
528
+ </div>
529
+
530
+ {suggestionList.length > 0 && (
531
+ <AnimatePresence initial={false}>
532
+ {suggestionsOpen && (
533
+ <motion.div
534
+ key="suggestions"
535
+ initial={{ height: 0, opacity: 0 }}
536
+ animate={{ height: suggestionsRegionHeight ?? 0, opacity: 1 }}
537
+ // Height only: a fade would drop the divider before the space closes.
538
+ exit={{ height: 0 }}
539
+ transition={REGION_SPRING}
540
+ // -mt-1 / mt-2 move the gap inside the collapsing region; -mx-2 runs the divider full width.
541
+ className="-mx-2 -mt-1 overflow-hidden"
542
+ >
543
+ {/* biome-ignore lint/a11y/useKeyWithClickEvents: the textarea drives the list by keyboard (aria-activedescendant). */}
544
+ <div
545
+ ref={el => {
546
+ suggestionListRef.current = el
547
+ suggestionsRegionRef(el)
548
+ }}
549
+ role="listbox"
550
+ id={suggestionListId}
551
+ aria-label="Suggested prompts"
552
+ onMouseEnter={suggestionHandlers.onMouseEnter}
553
+ onMouseMove={suggestionHandlers.onMouseMove}
554
+ onMouseLeave={suggestionHandlers.onMouseLeave}
555
+ onClick={suggestionHandlers.onClick}
556
+ className="relative mt-2 flex flex-col border-t border-border/60 px-1.5 pt-1.5"
557
+ >
558
+ <FluidHoverHighlight hover={suggestionHover} className={shape.bg} />
559
+ {suggestionList.map((s, i) => (
560
+ <SuggestionRow
561
+ key={`${s}-${i}`}
562
+ text={s}
563
+ index={i}
564
+ active={i === activeSuggestion}
565
+ keyHint={i === 0 && activeSuggestion == null}
566
+ optionId={`${suggestionListId}-${i}`}
567
+ registerItem={registerSuggestion}
568
+ onSelect={() => acceptSuggestion(s)}
569
+ />
570
+ ))}
571
+ </div>
572
+ </motion.div>
573
+ )}
574
+ </AnimatePresence>
575
+ )}
576
+ <span className="sr-only" role="status" aria-live="polite">
577
+ {messages.announcement}
578
+ </span>
579
+ </SurfaceProvider>
580
+ </div>
581
+ </SizeScope>
582
+ )
583
+ },
584
+ )
585
+
586
+ ComposerDraft.displayName = 'Composer.Draft'
587
+
588
+ export type { ComposerDraftProps, DraftSlot, DraftSlotContext, DraftStatus, QueuedMessage }
589
+ export { ComposerDraft }