@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
@@ -37,6 +37,10 @@ interface ChatInputContextValue {
37
37
 
38
38
  const ChatInputContext = createContext<ChatInputContextValue>(null!);
39
39
 
40
+ /**
41
+ * The editor state `ChatInput` tracks (`isFocused`, `hasValue`, `hasError`) and its setters.
42
+ * Throws when called outside a `ChatInput`.
43
+ */
40
44
  export function useChatInputContext() {
41
45
  const context = useContext(ChatInputContext);
42
46
 
@@ -65,9 +69,14 @@ export const DEFAULT_CONFIG: ChatInputConfig = {
65
69
  };
66
70
 
67
71
  export interface ChatInputProps extends ComponentPropsWithoutRef<'div'> {
72
+ /** Lexical composer config, read once on mount. Override only to add nodes or retheme. */
68
73
  initialConfig?: ChatInputConfig;
69
74
  }
70
75
 
76
+ /**
77
+ * Root of the composer: holds the Lexical editor and puts its state on the wrapper as
78
+ * `data-focused`, `data-empty` and `data-error`. Ships unstyled.
79
+ */
71
80
  export const ChatInput = forwardRef<HTMLDivElement, ChatInputProps>(function ChatInput(
72
81
  { className, children, initialConfig = DEFAULT_CONFIG, ...rest },
73
82
  ref,
@@ -93,6 +102,7 @@ export const ChatInput = forwardRef<HTMLDivElement, ChatInputProps>(function Cha
93
102
  <LexicalComposer initialConfig={initialConfig}>
94
103
  <div
95
104
  ref={ref}
105
+ data-slot="chat-input"
96
106
  data-testid="chat-input"
97
107
  data-focused={isFocused}
98
108
  data-empty={!hasValue}
@@ -110,7 +120,7 @@ export const ChatInput = forwardRef<HTMLDivElement, ChatInputProps>(function Cha
110
120
 
111
121
  ChatInput.displayName = 'ChatInput';
112
122
 
113
- export type ChatInputPlaceholderProps = ComponentPropsWithoutRef<'span'>;
123
+ export interface ChatInputPlaceholderProps extends ComponentPropsWithoutRef<'span'> {}
114
124
 
115
125
  export const ChatInputPlaceholder = forwardRef<HTMLSpanElement, ChatInputPlaceholderProps>(
116
126
  function ChatInputPlaceholder({ className, children, ...rest }, ref) {
@@ -124,9 +134,11 @@ export const ChatInputPlaceholder = forwardRef<HTMLSpanElement, ChatInputPlaceho
124
134
  'text-text-tertiary',
125
135
  className,
126
136
  )}
137
+ asChild
127
138
  {...rest}
128
139
  >
129
- {children}
140
+ {/* Typography stamps its own data-slot unless it renders as its child. */}
141
+ <p data-slot="chat-input-placeholder">{children}</p>
130
142
  </Typography>
131
143
  );
132
144
  },
@@ -135,19 +147,34 @@ export const ChatInputPlaceholder = forwardRef<HTMLSpanElement, ChatInputPlaceho
135
147
  ChatInputPlaceholder.displayName = 'ChatInputPlaceholder';
136
148
 
137
149
  export interface ChatInputTextareaProps {
150
+ /** Classes for the editable element (`data-slot="chat-input-editable"`), not its wrapper. */
138
151
  className?: string;
152
+ /** Inline styles for the wrapper around the editable element. */
139
153
  style?: CSSProperties | undefined;
154
+ /** Classes for the placeholder (`data-slot="chat-input-placeholder"`). */
140
155
  placeholderClassName?: string;
156
+ /** Shown while the editor is empty; also the editable's `aria-placeholder`. */
141
157
  placeholder?: string;
158
+ /** Custom Lexical plugins; rendered inside the composer, after the built-in ones. */
142
159
  children?: ReactNode;
160
+ /** Content as Markdown. When it differs from the editor's, it replaces the content. */
143
161
  value?: string;
162
+ /** Focuses the editor on mount, caret at the end. Skipped when disabled or read-only. */
144
163
  autoFocus?: boolean;
164
+ /** Blocks editing and selection and dims the wrapper (`data-disabled`). */
145
165
  isDisabled?: boolean;
166
+ /** Blocks editing but keeps the text selectable (`data-readonly`). */
146
167
  isReadOnly?: boolean;
168
+ /** Called with the content as Markdown on every edit. */
147
169
  onChange?: (value: string) => void;
170
+ /** Key handler on the editable element; implement send-on-Enter here. */
148
171
  onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => void;
149
172
  }
150
173
 
174
+ /**
175
+ * The editable area of a `ChatInput`. Its value is a Markdown string; paste inserts plain
176
+ * text. Must be rendered inside a `ChatInput`.
177
+ */
151
178
  export const ChatInputTextarea = forwardRef<HTMLDivElement, ChatInputTextareaProps>(
152
179
  function ChatInputTextarea(
153
180
  {
@@ -171,8 +198,10 @@ export const ChatInputTextarea = forwardRef<HTMLDivElement, ChatInputTextareaPro
171
198
 
172
199
  return (
173
200
  <div
201
+ data-slot="chat-input-textarea"
174
202
  data-testid="chat-input-textarea"
175
203
  data-disabled={isDisabled}
204
+ data-readonly={isReadOnlyState}
176
205
  aria-disabled={isDisabled}
177
206
  aria-readonly={isReadOnlyState}
178
207
  className={cn(
@@ -188,6 +217,7 @@ export const ChatInputTextarea = forwardRef<HTMLDivElement, ChatInputTextareaPro
188
217
  contentEditable={
189
218
  <ContentEditable
190
219
  ref={ref}
220
+ data-slot="chat-input-editable"
191
221
  className={cn('min-h-[26px]!', 'overflow-y-auto text-wrap outline-none', className)}
192
222
  aria-label="Chat input"
193
223
  aria-placeholder={placeholder}
@@ -0,0 +1,41 @@
1
+ import { Typography } from '@swisper.ai/ui';
2
+
3
+ import { ChatListItem } from '../chat-list-item';
4
+
5
+ import type { Chat } from './types';
6
+
7
+ export interface ChatRowProps {
8
+ chat: Chat;
9
+ isSelected: boolean;
10
+ onOpen: (chatId: string) => void;
11
+ }
12
+
13
+ /** One row of the list: a link to the chat with its title, when it was last updated, and a preview. */
14
+ export function ChatRow({ chat, isSelected, onOpen }: ChatRowProps) {
15
+ return (
16
+ <ChatListItem isSelected={isSelected} asChild>
17
+ <a
18
+ href={`/chat/${chat.chatId}`}
19
+ aria-current={isSelected ? 'page' : undefined}
20
+ className="flex min-w-0 flex-col gap-4 rounded-sm px-12 py-8 hover:bg-secondary-states-hover focus-visible:ring-2 focus-visible:ring-primary-focus-visible focus-visible:ring-inset data-[selected=true]:bg-menuitem-background-active-level1"
21
+ onClick={(event) => {
22
+ // A story has no router: the consumer keeps the open chat in state instead.
23
+ event.preventDefault();
24
+ onOpen(chat.chatId);
25
+ }}
26
+ >
27
+ <span className="flex items-baseline gap-8">
28
+ <Typography variant="body-small-high" className="min-w-0 flex-1 truncate" asChild>
29
+ <span>{chat.title}</span>
30
+ </Typography>
31
+ <Typography variant="caption-md" className="shrink-0 text-text-secondary" asChild>
32
+ <span>{chat.updatedAt}</span>
33
+ </Typography>
34
+ </span>
35
+ <Typography variant="caption-md" className="truncate text-text-secondary" asChild>
36
+ <span>{chat.preview}</span>
37
+ </Typography>
38
+ </a>
39
+ </ChatListItem>
40
+ );
41
+ }
@@ -0,0 +1,94 @@
1
+ import type { Chat, ChatPage } from './types';
2
+
3
+ /** Page size of the sidebar's chats request. */
4
+ export const CHAT_PAGE_SIZE = 12;
5
+
6
+ const CHAT_TOPICS: Pick<Chat, 'title' | 'preview'>[] = [
7
+ { title: 'Train to Zurich on Friday', preview: 'The 07:32 from Bern gets you there by 08:28.' },
8
+ { title: 'Reply to the landlord', preview: 'Here is a shorter version of the second paragraph.' },
9
+ {
10
+ title:
11
+ 'Summary of the quarterly board deck, with the open questions for finance and the follow-ups for the product leads',
12
+ preview: 'Revenue is up 8% on the previous quarter; three questions are still open.',
13
+ },
14
+ { title: 'Dinner ideas for six', preview: 'A lemon risotto works if two guests are vegetarian.' },
15
+ { title: 'Lisbon trip in May', preview: 'I found four direct flights that leave after 17:00.' },
16
+ {
17
+ title: 'Unread email from this morning',
18
+ preview: 'You have 14 unread emails; 3 need a reply.',
19
+ },
20
+ {
21
+ title: 'Birthday present for Nora',
22
+ preview: 'A ceramics course is CHF 180 for four evenings.',
23
+ },
24
+ {
25
+ title: 'Notes from the kickoff call',
26
+ preview: 'Actions: send the timeline, book the workshop.',
27
+ },
28
+ { title: 'Translate the offer to French', preview: 'Voici la traduction de la première page.' },
29
+ { title: 'Health insurance comparison', preview: 'The second model saves about CHF 40 a month.' },
30
+ {
31
+ title: 'Weekend hike near Lucerne',
32
+ preview: 'The Rigi panorama trail takes about three hours.',
33
+ },
34
+ {
35
+ title: 'Agenda for the team offsite',
36
+ preview: 'Day one opens with the roadmap review at 09:00.',
37
+ },
38
+ {
39
+ title: 'Explain a rent reduction request',
40
+ preview: 'You can ask once the reference rate drops.',
41
+ },
42
+ { title: 'Packing list for a ski week', preview: 'Added sunscreen, a spare pair of gloves and…' },
43
+ {
44
+ title: 'Rewrite my LinkedIn summary',
45
+ preview: 'This version leads with the migration project.',
46
+ },
47
+ {
48
+ title: 'Tax deductions for commuting',
49
+ preview: 'Public transport passes are deductible in full.',
50
+ },
51
+ { title: 'Book a table for Thursday', preview: 'The 19:30 slot for four is still free.' },
52
+ { title: 'Compare two phone plans', preview: 'The cheaper plan has no roaming outside Europe.' },
53
+ {
54
+ title: 'Parent-teacher meeting questions',
55
+ preview: 'Start with how the reading group is going.',
56
+ },
57
+ { title: 'Fix the spreadsheet formula', preview: 'The range in column D stops one row short.' },
58
+ ];
59
+
60
+ // The first five chats were updated today and show a time; older ones show day and month.
61
+ const TODAY_TIMES = ['16:42', '14:05', '11:30', '09:12', '08:47'];
62
+ const TODAY = new Date(2026, 9, 3);
63
+
64
+ function formatUpdatedAt(index: number) {
65
+ if (index < TODAY_TIMES.length) {
66
+ return TODAY_TIMES[index];
67
+ }
68
+
69
+ const date = new Date(TODAY);
70
+ date.setDate(TODAY.getDate() - (index - TODAY_TIMES.length + 1));
71
+
72
+ return `${String(date.getDate()).padStart(2, '0')}/${String(date.getMonth() + 1).padStart(2, '0')}`;
73
+ }
74
+
75
+ /** Every chat on the server, newest first: the topics repeat, the ids and dates do not. */
76
+ export const CHATS: Chat[] = Array.from({ length: CHAT_TOPICS.length * 4 }, (_, index) => ({
77
+ ...CHAT_TOPICS[index % CHAT_TOPICS.length],
78
+ chatId: `chat_${String(index + 1).padStart(3, '0')}`,
79
+ updatedAt: formatUpdatedAt(index),
80
+ }));
81
+
82
+ /** What the chats endpoint returns for one page. */
83
+ export function getChatPage(offset: number, limit: number): ChatPage {
84
+ return { chats: CHATS.slice(offset, offset + limit), count: CHATS.length };
85
+ }
86
+
87
+ export const FIRST_CHAT_PAGE: ChatPage = getChatPage(0, CHAT_PAGE_SIZE);
88
+
89
+ /** A page small enough to leave room under it, so the load-more row is in view. */
90
+ export const SHORT_CHAT_PAGE: ChatPage = getChatPage(0, 6);
91
+
92
+ export const ALL_CHATS_PAGE: ChatPage = getChatPage(0, CHATS.length);
93
+
94
+ export const NO_CHATS_PAGE: ChatPage = { chats: [], count: 0 };
@@ -0,0 +1,13 @@
1
+ /** One conversation as the sidebar lists it. `updatedAt` is already formatted the way the row shows it. */
2
+ export interface Chat {
3
+ chatId: string;
4
+ title: string;
5
+ preview: string;
6
+ updatedAt: string;
7
+ }
8
+
9
+ /** One page of the chats endpoint: its rows and the number of chats on the server. */
10
+ export interface ChatPage {
11
+ chats: Chat[];
12
+ count: number;
13
+ }
@@ -5,10 +5,16 @@ import { cn } from '@swisper.ai/web-core';
5
5
 
6
6
  export interface ChatListItemProps extends ComponentPropsWithoutRef<'div'> {
7
7
  children?: ReactNode;
8
+ /** Merges the item's props onto its only child, e.g. a link or a button, without adding a `div`. */
8
9
  asChild?: boolean;
10
+ /** Marks the open conversation: sets `data-selected` and `aria-selected`. */
9
11
  isSelected?: boolean;
10
12
  }
11
13
 
14
+ /**
15
+ * One row's content, returned from the `ChatListItems` render function. It has no role, tab stop or
16
+ * look of its own: render it `asChild` over a link or button and style that from `data-selected`.
17
+ */
12
18
  export const ChatListItem = forwardRef<HTMLDivElement, ChatListItemProps>(function ChatListItem(
13
19
  { children, className, asChild = false, isSelected = false, ...rest },
14
20
  ref,
@@ -9,18 +9,30 @@ import { useChatListContext } from './chat-list';
9
9
  const LOAD_MORE_KEY = 'chat-list-load-more';
10
10
 
11
11
  export interface ChatListItemsProps {
12
+ /** Render function called with each loaded row's index; return a `ChatListItem`. */
12
13
  children: (index: number) => ReactNode;
13
14
  className?: string;
15
+ /** Classes for the `ul` that holds the rows; merged after its defaults. */
14
16
  listClassName?: string;
17
+ /** Classes for every `li`, the load-more row included; merged after its defaults. */
18
+ rowClassName?: string;
19
+ /** First guess of a row's height in pixels; rows are measured after they render. */
15
20
  estimateSize?: number;
21
+ /** Rows rendered beyond the visible ones, above and below. */
16
22
  overscan?: number;
23
+ /** Space between rows, in pixels. */
17
24
  gap?: number;
18
25
  }
19
26
 
27
+ /**
28
+ * The scrolling, virtualised rows of a `ChatList`. While `hasMore` is true it appends one row with
29
+ * the `ChatListLoadMore` content and calls `onLoadMore` when that row comes into range.
30
+ */
20
31
  export const ChatListItems = memo(function ChatListItems({
21
32
  children,
22
33
  className,
23
34
  listClassName,
35
+ rowClassName,
24
36
  estimateSize = 54,
25
37
  overscan = 6,
26
38
  gap = 4,
@@ -104,6 +116,7 @@ export const ChatListItems = memo(function ChatListItems({
104
116
  className={cn('min-h-0 flex-1', 'overflow-auto', className)}
105
117
  >
106
118
  <ul
119
+ data-slot="chat-list-items-list"
107
120
  role="list"
108
121
  aria-label="Chats"
109
122
  className={cn(
@@ -121,11 +134,14 @@ export const ChatListItems = memo(function ChatListItems({
121
134
  return (
122
135
  <li
123
136
  key={virtualItem.key}
137
+ data-slot="chat-list-items-row"
124
138
  data-index={virtualItem.index}
139
+ data-load-more={isLoaderRow}
125
140
  ref={virtualizer.measureElement}
126
141
  role={isLoaderRow ? 'status' : 'listitem'}
127
142
  aria-live={isLoaderRow ? 'polite' : undefined}
128
143
  aria-busy={isLoaderRow ? isLoadingMore : undefined}
144
+ className={rowClassName}
129
145
  style={{
130
146
  position: 'absolute',
131
147
  top: 0,
@@ -2,6 +2,27 @@
2
2
  "$schema": "../../../../int-eslint-config/schemas/component.schema.json",
3
3
  "component": "chat-list",
4
4
  "purpose": "Virtualised, paginated list of the user's conversations for a navigation sidebar, with infinite loading and built-in slots for the first-page skeleton, the load-more row, the empty state and the error state.",
5
+ "anatomy": [
6
+ "import {",
7
+ " ChatList,",
8
+ " ChatListItems,",
9
+ " ChatListItem,",
10
+ " ChatListSkeleton,",
11
+ " ChatListLoadMore,",
12
+ " ChatListEmptyState,",
13
+ " ChatListError,",
14
+ "} from '@swisper.ai/web-chat-ui';",
15
+ "",
16
+ "<ChatList>",
17
+ " <ChatListItems>",
18
+ " <ChatListItem />",
19
+ " </ChatListItems>",
20
+ " <ChatListSkeleton />",
21
+ " <ChatListLoadMore />",
22
+ " <ChatListEmptyState />",
23
+ " <ChatListError />",
24
+ "</ChatList>"
25
+ ],
5
26
  "useWhen": [
6
27
  "A sidebar or drawer lists past conversations to switch between",
7
28
  "The list is long or paginated and loads more pages as the user scrolls",
@@ -47,14 +68,15 @@
47
68
  "getItemKey returns a stable key per index (the chat id), so rows keep their identity as pages load",
48
69
  "hasMore defaults to loadedCount < totalCount, and to false when totalCount is unknown; pass hasMore when the server only says whether another page exists",
49
70
  "While hasMore is true, ChatListItems appends one extra row at the end holding the ChatListLoadMore content",
50
- "onLoadMore fires when the last rendered row reaches the end of the loaded rows, hasMore is true and isLoadingMore is false; set isLoadingMore as soon as the request starts so it isn't called twice",
71
+ "onLoadMore fires when the last rendered row reaches the end of the loaded rows, hasMore is true and isLoadingMore is false; set isLoadingMore as soon as the request starts, and make the handler ignore a call while a request is in flight, because it can fire again before isLoadingMore reaches the list",
51
72
  "isLoading with no loaded rows shows ChatListSkeleton in place of the rows; ChatListSkeleton draws into a container that ChatListItems provides, so both must be rendered",
52
73
  "ChatListSkeleton renders rows default Skeleton rows (title and preview) unless you pass your own children; rows past the list's height are clipped",
53
74
  "ChatListEmptyState shows only when nothing is loaded, nothing is loading and there is no error",
54
75
  "ChatListError shows only when hasError is true and no rows are loaded; a failed later page leaves the loaded rows on screen without an error",
55
76
  "ChatListError renders children, or else the error's message, or \"An error occurred\"",
56
77
  "ChatListLoadMore renders nothing in place; it registers its children as the content of the load-more row",
57
- "Rows are measured after render, so items may vary in height; estimateSize is only the first guess, and gap is the space between rows"
78
+ "Rows are measured after render, so items may vary in height; estimateSize is only the first guess, and gap is the space between rows",
79
+ "Inner elements take their own class props, merged after the defaults: listClassName (the ul) and rowClassName (every li; the load-more row has data-load-more=true) on ChatListItems, rowClassName on ChatListSkeleton's default rows, messageClassName on ChatListError's default message"
58
80
  ]
59
81
  },
60
82
  "composition": {