@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
@@ -0,0 +1,185 @@
1
+ /**
2
+ * ChatSuggestion's wiring onto ui/List. The list behaviour itself (roving focus, highlight) is
3
+ * tested in ui; these tests cover what this compound adds: the overlay button and its name, the
4
+ * numbering, the looping default, and that an action never sends the suggestion.
5
+ */
6
+ import { cleanup, fireEvent, render, waitFor } from '@testing-library/react';
7
+ import { afterEach, describe, expect, test, vi } from 'vitest';
8
+
9
+ import {
10
+ ChatSuggestion,
11
+ ChatSuggestionAction,
12
+ ChatSuggestionActions,
13
+ ChatSuggestionLabel,
14
+ ChatSuggestionLabelIcon,
15
+ ChatSuggestions,
16
+ } from '../chat-suggestion';
17
+
18
+ const QUESTIONS = ['Check my calendar', 'Summarise my emails', 'Find the slides'];
19
+
20
+ interface SuggestionsOptions {
21
+ onSelect?: (text: string) => void;
22
+ onDismiss?: () => void;
23
+ onHover?: () => void;
24
+ onMouseLeave?: () => void;
25
+ }
26
+
27
+ /** The three follow-up questions, each with a dismiss button in its actions. */
28
+ function suggestions({ onSelect, onDismiss, onHover, onMouseLeave }: SuggestionsOptions = {}) {
29
+ return (
30
+ <ChatSuggestions aria-label="Suggested questions" onMouseLeave={onMouseLeave}>
31
+ {QUESTIONS.map((text) => (
32
+ <ChatSuggestion key={text} onSelect={() => onSelect?.(text)} onHover={onHover}>
33
+ <ChatSuggestionLabelIcon />
34
+ <ChatSuggestionLabel>{text}</ChatSuggestionLabel>
35
+ <ChatSuggestionActions>
36
+ <ChatSuggestionAction>
37
+ <button type="button" aria-label={`Dismiss ${text}`} onClick={onDismiss} />
38
+ </ChatSuggestionAction>
39
+ </ChatSuggestionActions>
40
+ </ChatSuggestion>
41
+ ))}
42
+ </ChatSuggestions>
43
+ );
44
+ }
45
+
46
+ afterEach(() => {
47
+ cleanup();
48
+ vi.restoreAllMocks();
49
+ });
50
+
51
+ describe('structure', () => {
52
+ test('renders a named ordered list with one item per suggestion', () => {
53
+ const { getByRole, getAllByRole } = render(suggestions());
54
+
55
+ const list = getByRole('list', { name: 'Suggested questions' });
56
+
57
+ expect(list.tagName).toBe('OL');
58
+ expect(getAllByRole('listitem').length).toBe(3);
59
+ });
60
+
61
+ // The overlay button is empty; without the label wired as its name it would be unnamed.
62
+ test('names each suggestion button by its label', () => {
63
+ const { getByRole } = render(suggestions());
64
+
65
+ for (const text of QUESTIONS) {
66
+ expect(getByRole('button', { name: text }), `no button named: ${text}`).not.toBeNull();
67
+ }
68
+ });
69
+
70
+ test('numbers the suggestions from 1', () => {
71
+ const { getAllByRole } = render(suggestions());
72
+
73
+ const numbers = getAllByRole('listitem').map((item) => item.textContent?.charAt(0));
74
+
75
+ expect(numbers).toEqual(['1', '2', '3']);
76
+ });
77
+ });
78
+
79
+ describe('selecting', () => {
80
+ test('calls onSelect when the suggestion is clicked', () => {
81
+ const onSelect = vi.fn();
82
+ const { getByRole } = render(suggestions({ onSelect }));
83
+
84
+ fireEvent.click(getByRole('button', { name: QUESTIONS[1] }));
85
+
86
+ expect(onSelect).toHaveBeenCalledTimes(1);
87
+ expect(onSelect).toHaveBeenCalledWith(QUESTIONS[1]);
88
+ });
89
+
90
+ // The old div had no key handler, so a keyboard user could not send a suggestion at all.
91
+ test('calls onSelect on Enter and on Space', () => {
92
+ const onSelect = vi.fn();
93
+ const { getByRole } = render(suggestions({ onSelect }));
94
+ const button = getByRole('button', { name: QUESTIONS[0] });
95
+
96
+ fireEvent.keyDown(button, { key: 'Enter' });
97
+ fireEvent.keyDown(button, { key: ' ' });
98
+
99
+ expect(onSelect).toHaveBeenCalledTimes(2);
100
+ });
101
+
102
+ // Dismissing used to need stopPropagation in the consumer, or it also sent the suggestion.
103
+ test('does not select when a ChatSuggestionAction control is clicked', () => {
104
+ const onSelect = vi.fn();
105
+ const onDismiss = vi.fn();
106
+ const { getByRole } = render(suggestions({ onSelect, onDismiss }));
107
+
108
+ fireEvent.click(getByRole('button', { name: `Dismiss ${QUESTIONS[0]}` }));
109
+
110
+ expect(onDismiss).toHaveBeenCalledTimes(1);
111
+ expect(onSelect).not.toHaveBeenCalled();
112
+ });
113
+
114
+ test('does not select a disabled suggestion', () => {
115
+ const onSelect = vi.fn();
116
+ const { getByRole } = render(
117
+ <ChatSuggestions aria-label="Suggested questions">
118
+ <ChatSuggestion isDisabled onSelect={onSelect}>
119
+ <ChatSuggestionLabel>{QUESTIONS[0]}</ChatSuggestionLabel>
120
+ </ChatSuggestion>
121
+ </ChatSuggestions>,
122
+ );
123
+ const button = getByRole('button', { name: QUESTIONS[0] });
124
+
125
+ fireEvent.click(button);
126
+ fireEvent.keyDown(button, { key: 'Enter' });
127
+
128
+ expect(onSelect).not.toHaveBeenCalled();
129
+ expect(button.getAttribute('aria-disabled')).toBe('true');
130
+ });
131
+ });
132
+
133
+ describe('keyboard navigation', () => {
134
+ test('keeps one suggestion in the Tab order', async () => {
135
+ const { getByRole } = render(suggestions());
136
+
137
+ getByRole('button', { name: QUESTIONS[0] }).focus();
138
+
139
+ await waitFor(() => {
140
+ const tabStops = QUESTIONS.filter(
141
+ (text) => getByRole('button', { name: text }).getAttribute('tabindex') === '0',
142
+ );
143
+ expect(tabStops).toEqual([QUESTIONS[0]]);
144
+ });
145
+ });
146
+
147
+ test('moves focus to the next suggestion on ArrowDown', async () => {
148
+ const { getByRole } = render(suggestions());
149
+ const first = getByRole('button', { name: QUESTIONS[0] });
150
+
151
+ first.focus();
152
+ fireEvent.keyDown(first, { key: 'ArrowDown' });
153
+
154
+ await waitFor(() => {
155
+ expect(document.activeElement).toBe(getByRole('button', { name: QUESTIONS[1] }));
156
+ });
157
+ });
158
+
159
+ // ChatSuggestions turns hasLoop on, unlike ui/List: a short list above the input wraps.
160
+ test('wraps from the first suggestion to the last on ArrowUp', async () => {
161
+ const { getByRole } = render(suggestions());
162
+ const first = getByRole('button', { name: QUESTIONS[0] });
163
+
164
+ first.focus();
165
+ fireEvent.keyDown(first, { key: 'ArrowUp' });
166
+
167
+ await waitFor(() => {
168
+ expect(document.activeElement).toBe(getByRole('button', { name: QUESTIONS[2] }));
169
+ });
170
+ });
171
+ });
172
+
173
+ describe('pointer callbacks', () => {
174
+ test('calls onHover when the pointer enters a suggestion and onMouseLeave when it leaves the list', () => {
175
+ const onHover = vi.fn();
176
+ const onMouseLeave = vi.fn();
177
+ const { getByRole, getAllByRole } = render(suggestions({ onHover, onMouseLeave }));
178
+
179
+ fireEvent.mouseEnter(getAllByRole('listitem')[0]);
180
+ fireEvent.mouseLeave(getByRole('list'));
181
+
182
+ expect(onHover).toHaveBeenCalledTimes(1);
183
+ expect(onMouseLeave).toHaveBeenCalledTimes(1);
184
+ });
185
+ });
@@ -1,7 +1,27 @@
1
1
  {
2
2
  "$schema": "../../../../int-eslint-config/schemas/component.schema.json",
3
3
  "component": "chat-suggestion",
4
- "purpose": "Numbered list of follow-up questions or quick replies above the chat input; picking one sends it.",
4
+ "purpose": "Numbered list of follow-up questions or quick replies above the chat input; picking one sends it. Built on ui/list: ChatSuggestions (ol, one roving Tab stop), ChatSuggestion (li with an overlay role=button), ChatSuggestionLabelIcon, ChatSuggestionLabel (the accessible name), ChatSuggestionActions and ChatSuggestionAction (one control in the actions).",
5
+ "anatomy": [
6
+ "import {",
7
+ " ChatSuggestions,",
8
+ " ChatSuggestion,",
9
+ " ChatSuggestionLabelIcon,",
10
+ " ChatSuggestionLabel,",
11
+ " ChatSuggestionActions,",
12
+ " ChatSuggestionAction,",
13
+ "} from '@swisper.ai/web-chat-ui';",
14
+ "",
15
+ "<ChatSuggestions>",
16
+ " <ChatSuggestion>",
17
+ " <ChatSuggestionLabelIcon />",
18
+ " <ChatSuggestionLabel />",
19
+ " <ChatSuggestionActions>",
20
+ " <ChatSuggestionAction />",
21
+ " </ChatSuggestionActions>",
22
+ " </ChatSuggestion>",
23
+ "</ChatSuggestions>"
24
+ ],
5
25
  "useWhen": [
6
26
  "Offering follow-up questions after an answer has finished streaming",
7
27
  "Starting an empty conversation with a few example questions",
@@ -10,7 +30,7 @@
10
30
  "avoidWhen": [
11
31
  "Commands that change data or navigate — use ui/button or ui/contextual-menu instead",
12
32
  "Filters or selected values — use ui/chip instead",
13
- "Choosing one item from a card's collection — use web-chat-ui/card-item-picker instead"
33
+ "Choosing one item from a card's collection — use cards-ui/list instead"
14
34
  ],
15
35
  "uxPrinciples": [
16
36
  "Suggestions are shortcuts for what the user could type; the input stays the primary way to ask.",
@@ -19,32 +39,44 @@
19
39
  ],
20
40
  "accessibility": {
21
41
  "required": [
22
- "ChatSuggestion is a div with onClick and no tabIndex or key handler, and it accepts no props to add them — it cannot be reached or activated by keyboard, so keep ChatInput available so keyboard users can type the same question",
23
- "ChatSuggestionLabelIcon is aria-hidden; the label text must carry the full meaning",
24
- "A button placed in ChatSuggestionActions needs an aria-label"
42
+ "Name the list: aria-label on ChatSuggestions ('Suggested questions'), or aria-labelledby when a visible heading sits above it",
43
+ "Every ChatSuggestion has a ChatSuggestionLabel; it is the accessible name of the suggestion's button, so the label text must carry the full meaning",
44
+ "A control in ChatSuggestionActions is wrapped in ChatSuggestionAction and has an aria-label",
45
+ "After a suggestion is selected and the list unmounts, move focus to ChatInput; otherwise a keyboard user's focus falls to the page body"
25
46
  ],
26
47
  "keyboard": [
27
- "No keyboard interaction on the suggestion itself",
28
- "Buttons inside ChatSuggestionActions follow standard button behaviour"
48
+ "Tab enters the list once: on the last focused suggestion, else the first enabled one",
49
+ "ArrowDown/ArrowUp move between enabled suggestions and wrap at the ends (hasLoop defaults to true); Home and End jump to the first and last",
50
+ "Enter or Space on a suggestion calls its onSelect",
51
+ "Tab from a suggestion reaches that suggestion's ChatSuggestionAction controls, then leaves the list"
29
52
  ],
30
53
  "aria": [
31
- "ChatSuggestions renders role=list and each ChatSuggestion role=listitem",
54
+ "ChatSuggestions renders an ol with role=list; each ChatSuggestion is a native li",
55
+ "Each suggestion holds a div with role=button covering the row, with aria-labelledby pointing at ChatSuggestionLabel",
56
+ "aria-disabled=\"true\" on the button of a suggestion with isDisabled",
32
57
  "ChatSuggestionLabelIcon is aria-hidden",
33
58
  "ChatSuggestionActions renders role=group"
34
59
  ],
35
60
  "focus": [
36
- "The suggestion is not a tab stop; it has a focus-visible style, but with no tabIndex it never receives focus"
61
+ "Only one suggestion per list is in the Tab order (roving tabindex); a ChatSuggestionAction control has tabIndex 0 only in that suggestion",
62
+ "A keyboard-focused suggestion shows a ring-secondary-focus-visible ring on the row and its actions"
37
63
  ]
38
64
  },
39
65
  "behaviour": {
40
- "states": ["default", "hover (background highlight, actions revealed)"],
66
+ "states": ["default", "highlighted (background, actions revealed)", "disabled"],
41
67
  "rules": [
42
- "ChatSuggestions passes each direct child its zero-based index; ChatSuggestionLabelIcon shows index + 1 unless it is given an icon as children",
43
- "onClick fires on a click anywhere in the suggestion, usually to send its text as the next message",
44
- "onHover fires when the pointer enters a suggestion; ChatSuggestions.onMouseLeave fires when it leaves the list, so the pair can drive a preview or highlight",
68
+ "ChatSuggestions passes each direct child its zero-based index; ChatSuggestionLabelIcon shows index + 1 in a ui/OrderChip unless it is given an icon as children",
69
+ "A ChatSuggestion only renders inside ChatSuggestions, also when there is one suggestion; on its own it throws",
70
+ "onSelect fires on a click anywhere in the suggestion and on Enter or Space, usually to send its text as the next message",
71
+ "Highlighted means the pointer is over the suggestion or focus is inside it; exactly one suggestion is highlighted at a time, and hovering never pulls focus out of ChatInput",
72
+ "onHover fires when the pointer enters a suggestion; ChatSuggestions.onMouseLeave fires when it leaves the list, so the pair can drive a preview. Neither fires for keyboard highlight",
45
73
  "ChatSuggestionLabel wraps up to three lines by default; isMultiline=false truncates it to one line",
46
- "ChatSuggestionActions is invisible until the suggestion is hovered; it holds a hint icon (EnterIcon) or small buttons",
47
- "Clicks in ChatSuggestionActions bubble to the suggestion's onClick; stop propagation in an action that should not also send the suggestion"
74
+ "ChatSuggestionActions is invisible until the suggestion is highlighted; it holds a hint icon (EnterIcon), or controls each wrapped in ChatSuggestionAction",
75
+ "A click on the hint icon selects the suggestion; a click or key press on a ChatSuggestionAction control never does",
76
+ "isDisabled makes a suggestion unfocusable, unhighlightable and unselectable, at half opacity. There is no selected state",
77
+ "ChatSuggestions and ChatSuggestion pass other props through to ui/List and ui/ListItem (hasLoop, orientation, DOM attributes and handlers)",
78
+ "Every part takes className, merged last. Two inner elements have their own prop: triggerClassName on ChatSuggestion styles the overlay button, innerClassName on ChatSuggestionLabelIcon the 32px box around the number or icon",
79
+ "Each part sets data-slot: chat-suggestions, chat-suggestion, chat-suggestion-label-icon, chat-suggestion-label, chat-suggestion-actions. The overlay button keeps ui/List's list-item-trigger, and a ChatSuggestionAction control list-item-action"
48
80
  ]
49
81
  },
50
82
  "composition": {
@@ -54,13 +86,16 @@
54
86
  "web-chat-ui/ChatSuggestionLabelIcon",
55
87
  "web-chat-ui/ChatSuggestionLabel",
56
88
  "web-chat-ui/ChatSuggestionActions",
89
+ "web-chat-ui/ChatSuggestionAction",
57
90
  "ui/icon-button",
91
+ "ui/order-chip",
58
92
  "icon"
59
93
  ],
60
94
  "avoidCombinations": [
61
95
  "Wrapping each ChatSuggestion in another element inside ChatSuggestions — the index goes to the wrapper, so unless the wrapper forwards it every number shows 1",
96
+ "A ChatSuggestion outside ChatSuggestions — it needs the list for its keyboard and highlight state",
62
97
  "Showing suggestions while an answer streams — hide them until it finishes",
63
- "Interactive controls in ChatSuggestionActions that don't stop propagation — they also send the suggestion"
98
+ "A button in ChatSuggestionActions without ChatSuggestionAction — it sits under the suggestion's overlay and can't be clicked"
64
99
  ],
65
100
  "contexts": ["chat footer, above ChatInput", "empty conversation"]
66
101
  },
@@ -75,7 +110,7 @@
75
110
  "aiDecisionRules": [
76
111
  {
77
112
  "condition": "Rendering follow-up questions in a chat panel",
78
- "decision": "Put ChatSuggestions in CanvasShellFooter above ChatInput, one ChatSuggestion per question with ChatSuggestionLabelIcon, ChatSuggestionLabel and ChatSuggestionActions holding EnterIcon",
113
+ "decision": "Put ChatSuggestions with an aria-label in CanvasShellFooter above ChatInput, one ChatSuggestion per question with onSelect, ChatSuggestionLabelIcon, ChatSuggestionLabel and ChatSuggestionActions holding EnterIcon",
79
114
  "reason": "This is the chatbot overview composition; picking a suggestion sends it like typing it"
80
115
  },
81
116
  {
@@ -85,11 +120,17 @@
85
120
  },
86
121
  {
87
122
  "condition": "A suggestion needs a secondary action such as dismiss",
88
- "decision": "Put a small IconButton with an aria-label in ChatSuggestionActions and stop click propagation in its handler",
89
- "reason": "Otherwise the click also triggers the suggestion's onClick"
123
+ "decision": "Put a small IconButton with an aria-label inside ChatSuggestionAction, inside ChatSuggestionActions",
124
+ "reason": "ChatSuggestionAction lifts the button above the suggestion's overlay and keeps its clicks and keys from selecting the suggestion"
125
+ },
126
+ {
127
+ "condition": "A suggestion was selected and the list is about to unmount while the answer streams",
128
+ "decision": "Focus ChatInput in the same onSelect handler",
129
+ "reason": "The focused suggestion disappears, and without this a keyboard user's focus drops to the page body"
90
130
  }
91
131
  ],
92
132
  "relatedComponents": [
133
+ "ui/list",
93
134
  "web-chat-ui/chat-input",
94
135
  "web-chat-ui/canvas-shell",
95
136
  "web-chat-ui/chat-thread",
@@ -101,7 +142,8 @@
101
142
  "categories": [
102
143
  "typography-text-secondary",
103
144
  "layout-accent-low-background-hover-default",
104
- "secondary-main"
145
+ "secondary-main",
146
+ "secondary-focus-visible"
105
147
  ],
106
148
  "rule": "Use the tokens the parts already apply; override with token utilities through className only."
107
149
  }