@swisper.ai/web-chat-ui 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/README.md +9 -12
  2. package/dist/components/canvas-shell/canvas-shell.d.ts +32 -10
  3. package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -1
  4. package/dist/components/canvas-shell/canvas-shell.stories.d.ts +49 -17
  5. package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -1
  6. package/dist/components/chat-card/chat-card.d.ts +1 -0
  7. package/dist/components/chat-card/chat-card.d.ts.map +1 -1
  8. package/dist/components/chat-card/chat-card.stories.d.ts +47 -1
  9. package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -1
  10. package/dist/components/chat-card/components/chat-card-body.d.ts +8 -0
  11. package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -1
  12. package/dist/components/chat-card/components/chat-card-footer.d.ts +8 -0
  13. package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -1
  14. package/dist/components/chat-card/components/chat-card-form.d.ts +15 -2
  15. package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -1
  16. package/dist/components/chat-card/components/chat-card-header.d.ts +23 -2
  17. package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -1
  18. package/dist/components/chat-card/contexts.d.ts +2 -0
  19. package/dist/components/chat-card/contexts.d.ts.map +1 -1
  20. package/dist/components/chat-card/hooks.d.ts +1 -0
  21. package/dist/components/chat-card/hooks.d.ts.map +1 -1
  22. package/dist/components/chat-card/types.d.ts +3 -0
  23. package/dist/components/chat-card/types.d.ts.map +1 -1
  24. package/dist/components/chat-card-container/chat-card-container.d.ts +4 -0
  25. package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -1
  26. package/dist/components/chat-card-container/chat-card-container.stories.d.ts +12 -1
  27. package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -1
  28. package/dist/components/chat-container/chat-container.d.ts.map +1 -1
  29. package/dist/components/chat-container/chat-container.stories.d.ts +36 -11
  30. package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -1
  31. package/dist/components/chat-input/chat-input.d.ts +27 -2
  32. package/dist/components/chat-input/chat-input.d.ts.map +1 -1
  33. package/dist/components/chat-input/chat-input.stories.d.ts +63 -3
  34. package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -1
  35. package/dist/components/chat-list/chat-list-item.d.ts +6 -0
  36. package/dist/components/chat-list/chat-list-item.d.ts.map +1 -1
  37. package/dist/components/chat-list/chat-list-items.d.ts +12 -1
  38. package/dist/components/chat-list/chat-list-items.d.ts.map +1 -1
  39. package/dist/components/chat-list/chat-list.d.ts +36 -2
  40. package/dist/components/chat-list/chat-list.d.ts.map +1 -1
  41. package/dist/components/chat-list/chat-list.stories.d.ts +67 -9
  42. package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -1
  43. package/dist/components/chat-message/chat-message.d.ts +12 -1
  44. package/dist/components/chat-message/chat-message.d.ts.map +1 -1
  45. package/dist/components/chat-message/chat-message.stories.d.ts +31 -0
  46. package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -1
  47. package/dist/components/chat-message/index.d.ts +1 -1
  48. package/dist/components/chat-message/index.d.ts.map +1 -1
  49. package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +3 -0
  50. package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -1
  51. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +25 -5
  52. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -1
  53. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +32 -1
  54. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -1
  55. package/dist/components/chat-message-attachment-card/index.d.ts +2 -2
  56. package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -1
  57. package/dist/components/chat-message-attachment-card/utils.d.ts +1 -0
  58. package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -1
  59. package/dist/components/chat-message-response/chat-message-response.stories.d.ts +13 -0
  60. package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -1
  61. package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +22 -5
  62. package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -1
  63. package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +42 -0
  64. package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -1
  65. package/dist/components/chat-message-toolbar/index.d.ts +1 -1
  66. package/dist/components/chat-message-toolbar/index.d.ts.map +1 -1
  67. package/dist/components/chat-messages/chat-messages.d.ts +34 -2
  68. package/dist/components/chat-messages/chat-messages.d.ts.map +1 -1
  69. package/dist/components/chat-messages/chat-messages.stories.d.ts +33 -2
  70. package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -1
  71. package/dist/components/chat-notification-card/chat-notification-card.d.ts +56 -4
  72. package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -1
  73. package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +50 -1
  74. package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -1
  75. package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +6 -0
  76. package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -1
  77. package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +43 -1
  78. package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -1
  79. package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +37 -17
  80. package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -1
  81. package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +53 -1
  82. package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -1
  83. package/dist/components/chat-reply/chat-reply.d.ts +11 -0
  84. package/dist/components/chat-reply/chat-reply.d.ts.map +1 -1
  85. package/dist/components/chat-reply/chat-reply.stories.d.ts +23 -0
  86. package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -1
  87. package/dist/components/chat-reply/index.d.ts +1 -1
  88. package/dist/components/chat-reply/index.d.ts.map +1 -1
  89. package/dist/components/chat-suggestion/chat-suggestion.d.ts +36 -10
  90. package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -1
  91. package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +66 -2
  92. package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -1
  93. package/dist/components/chat-suggestion/index.d.ts +2 -1
  94. package/dist/components/chat-suggestion/index.d.ts.map +1 -1
  95. package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +26 -1
  96. package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -1
  97. package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +25 -1
  98. package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -1
  99. package/dist/components/chat-thread/chat-thread.d.ts +17 -2
  100. package/dist/components/chat-thread/chat-thread.d.ts.map +1 -1
  101. package/dist/components/chat-thread/chat-thread.stories.d.ts +75 -10
  102. package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -1
  103. package/dist/components/index.d.ts +1 -3
  104. package/dist/components/index.d.ts.map +1 -1
  105. package/dist/components/markdown-viewer/markdown-viewer.d.ts +8 -1
  106. package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -1
  107. package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +18 -1
  108. package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -1
  109. package/dist/components/rich-text-area/rich-text-area.d.ts +17 -0
  110. package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -1
  111. package/dist/components/rich-text-area/rich-text-area.stories.d.ts +52 -0
  112. package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -1
  113. package/dist/components/rich-text-area/styled.d.ts +6 -2
  114. package/dist/components/rich-text-area/styled.d.ts.map +1 -1
  115. package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +9 -2
  116. package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -1
  117. package/dist/components/rich-text-field/components/index.d.ts +5 -5
  118. package/dist/components/rich-text-field/components/index.d.ts.map +1 -1
  119. package/dist/components/rich-text-field/components/text-color-button.d.ts +12 -1
  120. package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -1
  121. package/dist/components/rich-text-field/rich-text-field.d.ts +22 -0
  122. package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -1
  123. package/dist/components/rich-text-field/rich-text-field.stories.d.ts +28 -1
  124. package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -1
  125. package/dist/components/topmenu/index.d.ts +2 -0
  126. package/dist/components/topmenu/index.d.ts.map +1 -0
  127. package/dist/components/topmenu/topmenu.d.ts +22 -0
  128. package/dist/components/topmenu/topmenu.d.ts.map +1 -0
  129. package/dist/components/topmenu/topmenu.stories.d.ts +31 -0
  130. package/dist/components/topmenu/topmenu.stories.d.ts.map +1 -0
  131. package/dist/docs/agent.stories.d.ts.map +1 -1
  132. package/dist/docs/chat-panel.d.ts +7 -5
  133. package/dist/docs/chat-panel.d.ts.map +1 -1
  134. package/dist/docs/chatbot-panel.d.ts.map +1 -1
  135. package/dist/docs/chatbot.stories.d.ts.map +1 -1
  136. package/dist/index.css +1 -1
  137. package/dist/index.es.js +1227 -1260
  138. package/dist/index.es.js.map +1 -1
  139. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +9 -7
  140. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -1
  141. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +37 -9
  142. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -1
  143. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +41 -16
  144. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -1
  145. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +6 -0
  146. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -1
  147. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +22 -1
  148. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -1
  149. package/package.json +15 -9
  150. package/src/__storybook__/parent-block.tsx +21 -0
  151. package/src/components/canvas-shell/__stories__/canvas-panel.tsx +25 -0
  152. package/src/components/canvas-shell/__stories__/document-list.tsx +29 -0
  153. package/src/components/canvas-shell/__stories__/fixtures.ts +222 -0
  154. package/src/components/canvas-shell/__stories__/holdings-table.tsx +56 -0
  155. package/src/components/canvas-shell/__stories__/types.ts +47 -0
  156. package/src/components/canvas-shell/{canvas-shell.test.tsx → __tests__/canvas-shell.spec.tsx} +1 -1
  157. package/src/components/canvas-shell/canvas-shell.json +24 -0
  158. package/src/components/canvas-shell/canvas-shell.stories.tsx +581 -122
  159. package/src/components/canvas-shell/canvas-shell.tsx +44 -17
  160. package/src/components/chat-card/__stories__/fixtures.ts +119 -0
  161. package/src/components/chat-card/__stories__/types.ts +44 -0
  162. package/src/components/chat-card/chat-card.json +67 -3
  163. package/src/components/chat-card/chat-card.stories.tsx +872 -148
  164. package/src/components/chat-card/chat-card.tsx +2 -0
  165. package/src/components/chat-card/components/chat-card-body.tsx +12 -0
  166. package/src/components/chat-card/components/chat-card-footer.tsx +11 -0
  167. package/src/components/chat-card/components/chat-card-form.tsx +21 -2
  168. package/src/components/chat-card/components/chat-card-header.tsx +39 -2
  169. package/src/components/chat-card/contexts.tsx +2 -0
  170. package/src/components/chat-card/hooks.ts +1 -0
  171. package/src/components/chat-card/types.ts +3 -0
  172. package/src/components/chat-card-container/__stories__/fixtures.ts +54 -0
  173. package/src/components/chat-card-container/__stories__/resizable-chat-window.tsx +19 -0
  174. package/src/components/chat-card-container/__stories__/result-card.tsx +31 -0
  175. package/src/components/chat-card-container/__stories__/types.ts +16 -0
  176. package/src/components/chat-card-container/chat-card-container.json +7 -0
  177. package/src/components/chat-card-container/chat-card-container.stories.tsx +209 -56
  178. package/src/components/chat-card-container/chat-card-container.tsx +5 -0
  179. package/src/components/chat-container/__stories__/chat-composer.tsx +67 -0
  180. package/src/components/chat-container/__stories__/fixtures.ts +27 -0
  181. package/src/components/chat-container/__stories__/measure.ts +22 -0
  182. package/src/components/chat-container/__stories__/types.ts +7 -0
  183. package/src/components/chat-container/__stories__/variable-readout.tsx +64 -0
  184. package/src/components/chat-container/chat-container.json +9 -1
  185. package/src/components/chat-container/chat-container.stories.tsx +538 -106
  186. package/src/components/chat-container/chat-container.tsx +3 -0
  187. package/src/components/chat-input/__stories__/fixtures.ts +31 -0
  188. package/src/components/chat-input/chat-input.json +10 -2
  189. package/src/components/chat-input/chat-input.stories.tsx +660 -197
  190. package/src/components/chat-input/chat-input.tsx +32 -2
  191. package/src/components/chat-list/__stories__/chat-row.tsx +41 -0
  192. package/src/components/chat-list/__stories__/fixtures.ts +94 -0
  193. package/src/components/chat-list/__stories__/types.ts +13 -0
  194. package/src/components/chat-list/chat-list-item.tsx +6 -0
  195. package/src/components/chat-list/chat-list-items.tsx +16 -0
  196. package/src/components/chat-list/chat-list.json +24 -2
  197. package/src/components/chat-list/chat-list.stories.tsx +631 -215
  198. package/src/components/chat-list/chat-list.tsx +51 -4
  199. package/src/components/chat-message/__stories__/fixtures.ts +53 -0
  200. package/src/components/chat-message/__stories__/sent-attachment.tsx +22 -0
  201. package/src/components/chat-message/__stories__/tool-steps.tsx +37 -0
  202. package/src/components/chat-message/chat-message.json +10 -1
  203. package/src/components/chat-message/chat-message.stories.tsx +282 -20
  204. package/src/components/chat-message/chat-message.tsx +16 -1
  205. package/src/components/chat-message/index.ts +8 -1
  206. package/src/components/chat-message-attachment-card/__stories__/fixtures.ts +30 -0
  207. package/src/components/chat-message-attachment-card/__stories__/types.ts +14 -0
  208. package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +4 -0
  209. package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +20 -0
  210. package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +266 -51
  211. package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +37 -4
  212. package/src/components/chat-message-attachment-card/index.ts +6 -0
  213. package/src/components/chat-message-attachment-card/utils.ts +1 -0
  214. package/src/components/chat-message-response/__stories__/fixtures.ts +50 -0
  215. package/src/components/chat-message-response/chat-message-response.json +5 -0
  216. package/src/components/chat-message-response/chat-message-response.stories.tsx +135 -26
  217. package/src/components/chat-message-toolbar/chat-message-toolbar.json +21 -3
  218. package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +377 -6
  219. package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +47 -12
  220. package/src/components/chat-message-toolbar/index.ts +4 -0
  221. package/src/components/chat-messages/__stories__/conversation-frame.tsx +25 -0
  222. package/src/components/chat-messages/__stories__/conversation-group.tsx +22 -0
  223. package/src/components/chat-messages/__stories__/fixtures.ts +70 -0
  224. package/src/components/chat-messages/__stories__/types.ts +5 -0
  225. package/src/components/chat-messages/chat-messages.json +30 -12
  226. package/src/components/chat-messages/chat-messages.stories.tsx +439 -212
  227. package/src/components/chat-messages/chat-messages.tsx +46 -3
  228. package/src/components/chat-notification-card/__stories__/fixtures.ts +38 -0
  229. package/src/components/chat-notification-card/__stories__/types.ts +13 -0
  230. package/src/components/chat-notification-card/chat-notification-card.json +52 -2
  231. package/src/components/chat-notification-card/chat-notification-card.stories.tsx +542 -62
  232. package/src/components/chat-notification-card/chat-notification-card.tsx +97 -6
  233. package/src/components/chat-notification-popup/__stories__/fixtures.ts +36 -0
  234. package/src/components/chat-notification-popup/__stories__/notification-item.tsx +93 -0
  235. package/src/components/chat-notification-popup/__stories__/types.ts +14 -0
  236. package/src/components/chat-notification-popup/chat-notification-popup.json +14 -1
  237. package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +467 -17
  238. package/src/components/chat-notification-popup/chat-notification-popup.tsx +18 -3
  239. package/src/components/chat-prompt-box/__stories__/fixtures.ts +16 -0
  240. package/src/components/chat-prompt-box/__stories__/types.ts +8 -0
  241. package/src/components/chat-prompt-box/chat-prompt-box.json +25 -2
  242. package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +535 -43
  243. package/src/components/chat-prompt-box/chat-prompt-box.tsx +73 -19
  244. package/src/components/chat-reply/chat-reply.json +10 -0
  245. package/src/components/chat-reply/chat-reply.stories.tsx +264 -21
  246. package/src/components/chat-reply/chat-reply.tsx +15 -0
  247. package/src/components/chat-reply/index.ts +10 -1
  248. package/src/components/chat-suggestion/__stories__/fixtures.ts +16 -0
  249. package/src/components/chat-suggestion/__tests__/chat-suggestion.spec.tsx +185 -0
  250. package/src/components/chat-suggestion/chat-suggestion.json +62 -20
  251. package/src/components/chat-suggestion/chat-suggestion.stories.tsx +542 -58
  252. package/src/components/chat-suggestion/chat-suggestion.tsx +154 -65
  253. package/src/components/chat-suggestion/index.ts +9 -0
  254. package/src/components/chat-thinking-process/__stories__/fixtures.ts +56 -0
  255. package/src/components/chat-thinking-process/chat-thinking-process.json +28 -3
  256. package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +354 -78
  257. package/src/components/chat-thinking-process/chat-thinking-process.tsx +55 -4
  258. package/src/components/chat-thread/__stories__/fixtures.ts +171 -0
  259. package/src/components/chat-thread/__stories__/scroll-position.ts +9 -0
  260. package/src/components/chat-thread/__stories__/snippets.ts +129 -0
  261. package/src/components/chat-thread/__stories__/thread-frame.tsx +22 -0
  262. package/src/components/chat-thread/__stories__/thread-turns.tsx +35 -0
  263. package/src/components/chat-thread/__stories__/types.ts +12 -0
  264. package/src/components/chat-thread/__stories__/use-turn-stream.ts +78 -0
  265. package/src/components/chat-thread/chat-thread.json +23 -3
  266. package/src/components/chat-thread/chat-thread.stories.tsx +804 -142
  267. package/src/components/chat-thread/chat-thread.tsx +64 -16
  268. package/src/components/index.ts +1 -3
  269. package/src/components/markdown-viewer/__stories__/fixtures.ts +67 -0
  270. package/src/components/markdown-viewer/markdown-viewer.json +7 -1
  271. package/src/components/markdown-viewer/markdown-viewer.stories.tsx +219 -50
  272. package/src/components/markdown-viewer/markdown-viewer.tsx +9 -0
  273. package/src/components/rich-text-area/__stories__/fixtures.ts +30 -0
  274. package/src/components/rich-text-area/rich-text-area.json +6 -4
  275. package/src/components/rich-text-area/rich-text-area.stories.tsx +597 -41
  276. package/src/components/rich-text-area/rich-text-area.tsx +22 -1
  277. package/src/components/rich-text-area/styled.tsx +11 -5
  278. package/src/components/rich-text-field/__stories__/fixtures.ts +29 -0
  279. package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +10 -1
  280. package/src/components/rich-text-field/components/index.ts +8 -5
  281. package/src/components/rich-text-field/components/text-color-button.tsx +16 -2
  282. package/src/components/rich-text-field/rich-text-field.json +3 -1
  283. package/src/components/rich-text-field/rich-text-field.stories.tsx +452 -61
  284. package/src/components/rich-text-field/rich-text-field.tsx +23 -0
  285. package/src/components/topmenu/index.ts +1 -0
  286. package/src/components/topmenu/topmenu.json +107 -0
  287. package/src/components/topmenu/topmenu.stories.tsx +334 -0
  288. package/src/components/topmenu/topmenu.tsx +71 -0
  289. package/src/docs/agent.stories.tsx +16 -16
  290. package/src/docs/chat-panel.tsx +37 -32
  291. package/src/docs/chatbot-panel.tsx +11 -2
  292. package/src/docs/chatbot.mdx +17 -12
  293. package/src/docs/chatbot.stories.tsx +7 -8
  294. package/src/layouts/chat-card-list-layout/__stories__/fixtures.ts +112 -0
  295. package/src/layouts/chat-card-list-layout/__stories__/result-card.tsx +36 -0
  296. package/src/layouts/chat-card-list-layout/__stories__/types.ts +31 -0
  297. package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +14 -1
  298. package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +316 -84
  299. package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +11 -7
  300. package/src/layouts/chat-card-three-column-layout/__stories__/fixtures.ts +117 -0
  301. package/src/layouts/chat-card-three-column-layout/__stories__/resizable-chat-window.tsx +18 -0
  302. package/src/layouts/chat-card-three-column-layout/__stories__/stay-details.tsx +85 -0
  303. package/src/layouts/chat-card-three-column-layout/__stories__/stay-list.tsx +50 -0
  304. package/src/layouts/chat-card-three-column-layout/__stories__/stay-map.tsx +44 -0
  305. package/src/layouts/chat-card-three-column-layout/__stories__/stay-rooms.tsx +61 -0
  306. package/src/layouts/chat-card-three-column-layout/__stories__/types.ts +35 -0
  307. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +16 -0
  308. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +603 -182
  309. package/src/layouts/chat-card-two-column-layout/__stories__/connection-itinerary.tsx +51 -0
  310. package/src/layouts/chat-card-two-column-layout/__stories__/fixtures.ts +83 -0
  311. package/src/layouts/chat-card-two-column-layout/__stories__/route-map.tsx +24 -0
  312. package/src/layouts/chat-card-two-column-layout/__stories__/types.ts +15 -0
  313. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +13 -1
  314. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +368 -67
  315. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +11 -2
  316. package/dist/components/card-item-picker/card-item-picker-context.d.ts +0 -21
  317. package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +0 -1
  318. package/dist/components/card-item-picker/card-item-picker-list.d.ts +0 -24
  319. package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +0 -1
  320. package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +0 -28
  321. package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +0 -1
  322. package/dist/components/card-item-picker/card-item-picker-row.d.ts +0 -12
  323. package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +0 -1
  324. package/dist/components/card-item-picker/card-item-picker.stories.d.ts +0 -19
  325. package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +0 -1
  326. package/dist/components/card-item-picker/index.d.ts +0 -9
  327. package/dist/components/card-item-picker/index.d.ts.map +0 -1
  328. package/dist/components/chat-message-history/chat-message-history.d.ts +0 -48
  329. package/dist/components/chat-message-history/chat-message-history.d.ts.map +0 -1
  330. package/dist/components/chat-message-history/chat-message-history.stories.d.ts +0 -7
  331. package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +0 -1
  332. package/dist/components/chat-message-history/index.d.ts +0 -2
  333. package/dist/components/chat-message-history/index.d.ts.map +0 -1
  334. package/dist/components/spinner/index.d.ts +0 -2
  335. package/dist/components/spinner/index.d.ts.map +0 -1
  336. package/dist/components/spinner/spinner.d.ts +0 -9
  337. package/dist/components/spinner/spinner.d.ts.map +0 -1
  338. package/dist/components/spinner/spinner.stories.d.ts +0 -8
  339. package/dist/components/spinner/spinner.stories.d.ts.map +0 -1
  340. package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +0 -279
  341. package/src/components/card-item-picker/card-item-picker-context.tsx +0 -44
  342. package/src/components/card-item-picker/card-item-picker-list.tsx +0 -95
  343. package/src/components/card-item-picker/card-item-picker-row-parts.tsx +0 -96
  344. package/src/components/card-item-picker/card-item-picker-row.tsx +0 -109
  345. package/src/components/card-item-picker/card-item-picker.json +0 -147
  346. package/src/components/card-item-picker/card-item-picker.stories.tsx +0 -158
  347. package/src/components/card-item-picker/index.ts +0 -24
  348. package/src/components/chat-message-history/chat-message-history.json +0 -99
  349. package/src/components/chat-message-history/chat-message-history.stories.tsx +0 -136
  350. package/src/components/chat-message-history/chat-message-history.tsx +0 -277
  351. package/src/components/chat-message-history/index.ts +0 -13
  352. package/src/components/spinner/index.ts +0 -1
  353. package/src/components/spinner/spinner.json +0 -73
  354. package/src/components/spinner/spinner.stories.tsx +0 -41
  355. package/src/components/spinner/spinner.tsx +0 -32
@@ -5,12 +5,17 @@ import { IconButton, Typography } from '@swisper.ai/ui';
5
5
  import { cn } from '@swisper.ai/web-core';
6
6
 
7
7
  export interface ChatMessageAttachmentCardProps {
8
+ /** Classes merged last onto the card root, e.g. `w-fit max-w-60` to cap the chip's width. */
8
9
  className?: string;
10
+ /** The card parts: an icon or a preview, the content with the file name, and the actions. */
9
11
  children?: ReactNode;
12
+ /** Shrinks the card to a 56px square for an image shown through `ChatMessageAttachmentCardPreview`. */
10
13
  isPreview?: boolean;
14
+ /** Shows a pointer cursor, a hover background and the remove action on hover. Set `false` for a sent message's attachments. */
11
15
  isInteractive?: boolean;
12
16
  }
13
17
 
18
+ /** A compact chip for a file attached to a chat prompt or message. */
14
19
  export function ChatMessageAttachmentCard({
15
20
  className,
16
21
  children,
@@ -20,6 +25,7 @@ export function ChatMessageAttachmentCard({
20
25
  return (
21
26
  <div
22
27
  role="group"
28
+ data-slot="chat-message-attachment-card"
23
29
  data-testid="chat-message-attachment-card"
24
30
  data-preview={isPreview}
25
31
  data-interactive={isInteractive}
@@ -42,16 +48,20 @@ export function ChatMessageAttachmentCard({
42
48
  }
43
49
 
44
50
  export interface ChatMessageAttachmentCardContentProps {
51
+ /** Classes merged last onto the content element. */
45
52
  className?: string;
53
+ /** The file name, usually a `ChatMessageAttachmentCardTitle`. */
46
54
  children?: ReactNode;
47
55
  }
48
56
 
57
+ /** The text area of the card: takes the width left beside the icon and clips what overflows. */
49
58
  export function ChatMessageAttachmentCardContent({
50
59
  className,
51
60
  children,
52
61
  }: ChatMessageAttachmentCardContentProps) {
53
62
  return (
54
63
  <div
64
+ data-slot="chat-message-attachment-card-content"
55
65
  data-testid="chat-message-attachment-card-content"
56
66
  className={cn('flex-1', 'flex items-center', 'overflow-hidden', className)}
57
67
  >
@@ -60,11 +70,14 @@ export function ChatMessageAttachmentCardContent({
60
70
  );
61
71
  }
62
72
 
63
- interface ChatMessageAttachmentCardTitleProps {
73
+ export interface ChatMessageAttachmentCardTitleProps {
74
+ /** Classes merged last onto the title element. */
64
75
  className?: string;
76
+ /** The file name as uploaded, including its extension. */
65
77
  children?: ReactNode;
66
78
  }
67
79
 
80
+ /** The file name, truncated to one line. */
68
81
  export function ChatMessageAttachmentCardTitle({
69
82
  className,
70
83
  children,
@@ -72,6 +85,7 @@ export function ChatMessageAttachmentCardTitle({
72
85
  return (
73
86
  <Typography
74
87
  variant="body-sm"
88
+ data-slot="chat-message-attachment-card-title"
75
89
  data-testid="chat-message-attachment-card-title"
76
90
  className={cn('truncate', className)}
77
91
  >
@@ -80,17 +94,24 @@ export function ChatMessageAttachmentCardTitle({
80
94
  );
81
95
  }
82
96
 
83
- interface ChatMessageAttachmentCardPreviewProps {
97
+ export interface ChatMessageAttachmentCardPreviewProps {
98
+ /** Classes merged last onto the `figure` that covers the card. */
84
99
  className?: string;
100
+ /** Classes merged last onto the image inside the figure, e.g. `object-contain`. */
101
+ imageClassName?: string;
102
+ /** URL of the image, e.g. a data URL read from the attached file. */
85
103
  previewSrc: string;
86
104
  }
87
105
 
106
+ /** An image thumbnail that covers the whole card. Use it on a card with `isPreview`. */
88
107
  export function ChatMessageAttachmentCardPreview({
89
108
  className,
109
+ imageClassName,
90
110
  previewSrc,
91
111
  }: ChatMessageAttachmentCardPreviewProps) {
92
112
  return (
93
113
  <figure
114
+ data-slot="chat-message-attachment-card-preview"
94
115
  data-testid="chat-message-attachment-card-preview"
95
116
  className={cn(
96
117
  'absolute top-0 left-0',
@@ -100,23 +121,35 @@ export function ChatMessageAttachmentCardPreview({
100
121
  className,
101
122
  )}
102
123
  >
103
- <img src={previewSrc} alt="Preview" className="w-full h-full object-cover" />
124
+ <img
125
+ data-slot="chat-message-attachment-card-preview-image"
126
+ src={previewSrc}
127
+ alt="Preview"
128
+ className={cn('w-full h-full object-cover', imageClassName)}
129
+ />
104
130
  </figure>
105
131
  );
106
132
  }
107
133
 
108
134
  export interface ChatMessageAttachmentCardActionsProps {
135
+ /** Classes merged last onto the wrapper pinned to the card's top-right corner. */
109
136
  className?: string;
137
+ /** Classes merged last onto the remove button inside the wrapper. */
138
+ buttonClassName?: string;
139
+ /** Called when the remove button is clicked. The consumer removes the attachment. */
110
140
  onDelete?: () => void;
111
141
  }
112
142
 
143
+ /** The remove button of an interactive card, shown while the card is hovered. */
113
144
  export function ChatMessageAttachmentCardActions({
114
145
  className,
146
+ buttonClassName,
115
147
  onDelete,
116
148
  }: ChatMessageAttachmentCardActionsProps) {
117
149
  return (
118
150
  <div
119
151
  role="group"
152
+ data-slot="chat-message-attachment-card-actions"
120
153
  data-testid="chat-message-attachment-card-actions"
121
154
  className={cn(
122
155
  'absolute top-0 right-0',
@@ -133,7 +166,7 @@ export function ChatMessageAttachmentCardActions({
133
166
  isSemantic={false}
134
167
  onClick={onDelete}
135
168
  size="xs"
136
- className={cn('size-[24px]', 'text-icon-button-tertiary-icon', className)}
169
+ className={cn('size-[24px]', 'text-icon-button-tertiary-icon', buttonClassName)}
137
170
  >
138
171
  <CloseIcon />
139
172
  </IconButton>
@@ -4,9 +4,15 @@ export {
4
4
  ChatMessageAttachmentCardTitle,
5
5
  ChatMessageAttachmentCardPreview,
6
6
  ChatMessageAttachmentCardActions,
7
+ type ChatMessageAttachmentCardProps,
8
+ type ChatMessageAttachmentCardContentProps,
9
+ type ChatMessageAttachmentCardTitleProps,
10
+ type ChatMessageAttachmentCardPreviewProps,
11
+ type ChatMessageAttachmentCardActionsProps,
7
12
  } from './chat-message-attachment-card';
8
13
  export {
9
14
  ChatMessageAttachmentCardIcon,
15
+ type ChatMessageAttachmentCardIconProps,
10
16
  type ChatMessageAttachmentCardIconType,
11
17
  } from './chat-message-attachment-card-icon';
12
18
  export { getAttachmentIcon } from './utils';
@@ -18,6 +18,7 @@ const MIME_TO_ICON: Record<string, IconType> = {
18
18
  'application/vnd.oasis.opendocument.text': 'document',
19
19
  };
20
20
 
21
+ /** Picks the icon type for a file from its name's extension; a file it doesn't recognise is `unknown`. */
21
22
  export function getAttachmentIcon(file: File): IconType {
22
23
  const mimeType = mime.getType(file.name);
23
24
 
@@ -0,0 +1,50 @@
1
+ import type { Markdown } from '../../../types';
2
+
3
+ /** A short answer that quotes its evidence: inline code, a blockquote and a closing sentence. */
4
+ export const MIGRATION_ANSWER: Markdown = `No change. \`alembic\` is the repo's own migration tool. \`apps/backend/README.md\` says:
5
+
6
+ > alembic upgrade head
7
+
8
+ Prestart runs it before the backend starts, so the profile keeps it.`;
9
+
10
+ /** A list answer, the most common shape of a reply in the chat. */
11
+ export const AGENDA_ANSWER: Markdown = `Here's your day at a glance:
12
+
13
+ - **09:30** Stand-up with the product team
14
+ - **12:00** Lunch with Anna at Hiltl
15
+ - **15:00** Quarterly review, *slides still in draft*`;
16
+
17
+ /** The same list cut off in the middle of a bold run, as it looks while the reply arrives. */
18
+ export const AGENDA_ANSWER_PARTIAL: Markdown = `Here's your day at a glance:
19
+
20
+ - **09:30** Stand-up with the product team
21
+ - **12:00** Lunch with Anna at Hiltl
22
+ - **15:00 Quarterly rev`;
23
+
24
+ /** The longest shape a reply takes: heading, paragraph, list, table, code block and a link. */
25
+ export const RELEASE_ANSWER: Markdown = `## Release checklist for 2.4
26
+
27
+ Two checks are still open before the release can go out on Thursday.
28
+
29
+ 1. Run the database migration on staging
30
+ 2. Confirm the billing export with finance
31
+ 3. Publish the changelog
32
+
33
+ | Check | Owner | Status |
34
+ | --- | --- | --- |
35
+ | Migration on staging | Platform | Open |
36
+ | Billing export | Finance | Open |
37
+ | Changelog | Product | Done |
38
+
39
+ \`\`\`bash
40
+ alembic upgrade head
41
+ \`\`\`
42
+
43
+ The full steps are in the [release runbook](https://docs.company.com/runbooks/release).`;
44
+
45
+ /** A reply that carries a \`<swi-reply>\` block, which this component never turns into a widget. */
46
+ export const GREETING_ANSWER_WITH_SUGGESTIONS: Markdown = `Good evening! I'm ready to help with whatever's on your mind.
47
+
48
+ <swi-reply style="display:none" version="0.0.1">
49
+ What can you help me with?|Check my calendar for today|Search for something
50
+ </swi-reply>`;
@@ -2,6 +2,11 @@
2
2
  "$schema": "../../../../int-eslint-config/schemas/component.schema.json",
3
3
  "component": "chat-message-response",
4
4
  "purpose": "Renders an assistant reply's Markdown through MarkdownViewer with no caret and no custom <swi-*> components registered.",
5
+ "anatomy": [
6
+ "import { ChatMessageResponse } from '@swisper.ai/web-chat-ui';",
7
+ "",
8
+ "<ChatMessageResponse />"
9
+ ],
5
10
  "useWhen": [
6
11
  "Rendering a plain Markdown assistant reply where no streaming caret and no <swi-*> widgets are wanted",
7
12
  "Rendering a reply that is still streaming, with isStreaming set while it arrives"
@@ -1,23 +1,21 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { expect } from 'storybook/test';
2
3
 
3
- import { ChatMessageResponse } from './chat-message-response';
4
-
5
- const sampleMarkdown = `Here's a message with both reply options and weather information:
6
-
7
- <swi-reply style="display:none" version="0.0.1">
8
- What can you help me with?|Check my calendar for today|Search for something
9
- </swi-reply>
4
+ import { Typography } from '@swisper.ai/ui';
10
5
 
11
- Here's the weather forecast:
6
+ import { ParentBlock } from '../../__storybook__/parent-block';
12
7
 
13
- <swi-weather style="display:none" version="1.0.0">
14
- location|dayName|conditionIcon|precipitationChance|highTemp|lowTemp
15
- Zurich, Switzerland|Mon|☁️|8%|12|7
16
- Zurich, Switzerland|Tue|🌤️|5%|14|9
17
- </swi-weather>`;
8
+ import {
9
+ AGENDA_ANSWER,
10
+ AGENDA_ANSWER_PARTIAL,
11
+ GREETING_ANSWER_WITH_SUGGESTIONS,
12
+ MIGRATION_ANSWER,
13
+ RELEASE_ANSWER,
14
+ } from './__stories__/fixtures';
15
+ import { ChatMessageResponse } from './chat-message-response';
18
16
 
19
17
  const meta: Meta<typeof ChatMessageResponse> = {
20
- title: 'Chatbot/ChatMessageResponse',
18
+ title: 'Chat/ChatMessageResponse',
21
19
  component: ChatMessageResponse,
22
20
  parameters: {
23
21
  layout: 'padded',
@@ -27,7 +25,7 @@ const meta: Meta<typeof ChatMessageResponse> = {
27
25
  message: {
28
26
  control: 'text',
29
27
  description:
30
- 'Markdown of the assistant reply, including any `<swi-*>` custom blocks such as reply suggestions or weather.',
28
+ 'Markdown of the assistant reply. `<swi-*>` blocks in it are not rendered as widgets; only their text is kept.',
31
29
  },
32
30
  isStreaming: {
33
31
  control: 'boolean',
@@ -37,7 +35,7 @@ const meta: Meta<typeof ChatMessageResponse> = {
37
35
  },
38
36
  },
39
37
  args: {
40
- message: sampleMarkdown,
38
+ message: MIGRATION_ANSWER,
41
39
  isStreaming: false,
42
40
  },
43
41
  };
@@ -45,19 +43,130 @@ const meta: Meta<typeof ChatMessageResponse> = {
45
43
  export default meta;
46
44
  type Story = StoryObj<typeof ChatMessageResponse>;
47
45
 
46
+ /** A finished assistant reply: a short answer that quotes its evidence, rendered as page content. */
48
47
  export const Default: Story = {
49
48
  args: {
50
- message: sampleMarkdown,
49
+ message: MIGRATION_ANSWER,
51
50
  isStreaming: false,
52
51
  },
53
- argTypes: {
54
- message: {
55
- control: 'text',
56
- description: 'Markdown content to render',
57
- },
58
- isStreaming: {
59
- control: 'boolean',
60
- description: 'Whether the content is currently streaming',
61
- },
52
+ };
53
+
54
+ /** A reply that is still arriving: the half-received bold run is closed, and no caret is shown. */
55
+ export const Streaming: Story = {
56
+ args: {
57
+ message: AGENDA_ANSWER_PARTIAL,
58
+ isStreaming: true,
59
+ },
60
+ };
61
+
62
+ /** The reply in each place it's allowed: a message's content, a chat thread and an assistant answer. */
63
+ export const Examples: Story = {
64
+ parameters: { controls: { disable: true } },
65
+ render: () => (
66
+ <div className="flex max-w-160 flex-col gap-24">
67
+ <ParentBlock parent="web-chat-ui/ChatMessageContent">
68
+ <div className="w-fit">
69
+ <ChatMessageResponse message={MIGRATION_ANSWER} />
70
+ </div>
71
+ </ParentBlock>
72
+
73
+ <ParentBlock parent="chat thread">
74
+ <section aria-label="Conversation" className="flex flex-col gap-24">
75
+ <Typography
76
+ variant="body-medium"
77
+ className="w-fit self-end rounded-10 bg-paper-elevation-1 p-16"
78
+ >
79
+ What does my day look like?
80
+ </Typography>
81
+ <ChatMessageResponse message={AGENDA_ANSWER} />
82
+ </section>
83
+ </ParentBlock>
84
+
85
+ <ParentBlock parent="assistant answer">
86
+ <article
87
+ aria-label="Assistant answer"
88
+ className="rounded-10 border border-divider-border-base p-16"
89
+ >
90
+ <ChatMessageResponse message={RELEASE_ANSWER} />
91
+ </article>
92
+ </ParentBlock>
93
+ </div>
94
+ ),
95
+ };
96
+
97
+ /** The Markdown renders as semantic HTML: a heading, a list, a table and a native link. */
98
+ export const RendersSemanticMarkdown: Story = {
99
+ tags: ['e2e', '!autodocs'],
100
+ args: {
101
+ message: RELEASE_ANSWER,
102
+ isStreaming: false,
103
+ },
104
+ play: async ({ canvas, step }) => {
105
+ await step('Headings, lists and tables keep their roles', async () => {
106
+ await expect(
107
+ await canvas.findByRole('heading', { name: 'Release checklist for 2.4' }),
108
+ ).toBeVisible();
109
+ await expect(canvas.getAllByRole('listitem')).toHaveLength(3);
110
+ await expect(canvas.getByRole('table')).toBeVisible();
111
+ await expect(canvas.getByRole('columnheader', { name: 'Owner' })).toBeVisible();
112
+ });
113
+
114
+ await step('A link in the Markdown is a native link', async () => {
115
+ await expect(canvas.getByRole('link', { name: 'release runbook' })).toHaveAttribute(
116
+ 'href',
117
+ 'https://docs.company.com/runbooks/release',
118
+ );
119
+ });
120
+ },
121
+ };
122
+
123
+ /** A half-received bold run is closed while streaming, so no raw `**` reaches the reader. */
124
+ export const StreamingClosesPartialMarkdown: Story = {
125
+ tags: ['e2e', '!autodocs'],
126
+ args: {
127
+ message: AGENDA_ANSWER_PARTIAL,
128
+ isStreaming: true,
129
+ },
130
+ play: async ({ canvas, canvasElement, step }) => {
131
+ await step('The unfinished bold run renders as bold text', async () => {
132
+ const partial = await canvas.findByText('15:00 Quarterly rev');
133
+ await expect(partial).toBeVisible();
134
+ await expect(canvasElement.textContent).not.toContain('**');
135
+ });
136
+
137
+ await step('The finished items above it are unchanged', async () => {
138
+ await expect(canvas.getAllByRole('listitem')).toHaveLength(3);
139
+ await expect(canvas.getByText('Stand-up with the product team')).toBeVisible();
140
+ });
141
+ },
142
+ };
143
+
144
+ /** A `<swi-reply>` block never becomes a widget: the tag is stripped and no suggestion button appears. */
145
+ export const KeepsSwiBlocksAsText: Story = {
146
+ tags: ['e2e', '!autodocs'],
147
+ args: {
148
+ message: GREETING_ANSWER_WITH_SUGGESTIONS,
149
+ isStreaming: false,
150
+ },
151
+ play: async ({ canvas, canvasElement, step }) => {
152
+ await step('The reply text renders', async () => {
153
+ await expect(await canvas.findByText(/Good evening!/)).toBeVisible();
154
+ });
155
+
156
+ await step('No swi element or suggestion button is rendered', async () => {
157
+ await expect(canvasElement.querySelector('swi-reply')).toBeNull();
158
+ await expect(
159
+ canvas.queryByRole('button', { name: 'Check my calendar for today' }),
160
+ ).toBeNull();
161
+ });
162
+ },
163
+ };
164
+
165
+ /** Both props on the Controls panel, starting from the longest reply: heading, list, table, code and a link. */
166
+ export const Playground: Story = {
167
+ tags: ['!autodocs'],
168
+ args: {
169
+ message: RELEASE_ANSWER,
170
+ isStreaming: false,
62
171
  },
63
172
  };
@@ -2,6 +2,21 @@
2
2
  "$schema": "../../../../int-eslint-config/schemas/component.schema.json",
3
3
  "component": "chat-message-toolbar",
4
4
  "purpose": "The row under a chat message holding its timestamp (ChatMessageToolbarTimestamp) and a group of small icon actions such as copy and feedback (ChatMessageToolbarActions, ChatMessageToolbarActionButton).",
5
+ "anatomy": [
6
+ "import {",
7
+ " ChatMessageToolbar,",
8
+ " ChatMessageToolbarTimestamp,",
9
+ " ChatMessageToolbarActions,",
10
+ " ChatMessageToolbarActionButton,",
11
+ "} from '@swisper.ai/web-chat-ui';",
12
+ "",
13
+ "<ChatMessageToolbar>",
14
+ " <ChatMessageToolbarTimestamp />",
15
+ " <ChatMessageToolbarActions>",
16
+ " <ChatMessageToolbarActionButton />",
17
+ " </ChatMessageToolbarActions>",
18
+ "</ChatMessageToolbar>"
19
+ ],
5
20
  "useWhen": [
6
21
  "Showing when an answer was sent together with copy, edit or good/bad-response actions",
7
22
  "Adding per-message actions under the user's own question, with reverse so the actions sit on the left",
@@ -23,8 +38,9 @@
23
38
  "Make the timestamp text understandable on its own (a time or date), since it has no label"
24
39
  ],
25
40
  "keyboard": [
26
- "Each action button is a native button: Tab reaches it, Enter or Space activates it",
27
- "With a tooltip, the tooltip opens when the button receives keyboard focus"
41
+ "Each action button is a span with role=button and tabindex 0, not a native button: Tab reaches it, Enter or Space activates it",
42
+ "With a tooltip, the tooltip opens when the button receives keyboard focus",
43
+ "As the trigger of a ui/menu, the button opens the menu on ArrowDown; Enter and Space do not open it, because ui/icon-button's non-semantic key handler cancels the key before the menu sees it"
28
44
  ],
29
45
  "aria": [
30
46
  "ChatMessageToolbarActions sets role=group on the action buttons; it has no accessible name of its own",
@@ -40,7 +56,9 @@
40
56
  "rules": [
41
57
  "The row puts the timestamp and the actions at opposite ends, 24px tall with a 16px gap",
42
58
  "reverse=true flips the row so the actions come first (left) and the timestamp last (right), for messages aligned to the end",
43
- "ChatMessageToolbarActionButton is a ui/icon-button fixed to the tertiary variant, extra-small size and non-semantic colour; every other IconButton prop (onClick, aria-label, isDisabled…) passes through",
59
+ "ChatMessageToolbarActionButton is a ui/icon-button fixed to the tertiary variant, extra-small size and the non-semantic element (a span with role=button), coloured text-action-active; every other IconButton prop (onClick, aria-label, isDisabled…) passes through",
60
+ "ChatMessageToolbarActionButton forwards its ref to the button, with or without a tooltip, so it can be the asChild trigger of a menu or popover",
61
+ "ChatMessageToolbarActions and ChatMessageToolbarTimestamp pass every other div prop (aria-label, id, data-*) to their element",
44
62
  "ChatMessageToolbarActionButton wraps the button in a ui/tooltip only when tooltip is set",
45
63
  "ChatMessageToolbarTimestamp renders its children as given; format the time before passing it"
46
64
  ]