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

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 (369) 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 +30 -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-input/plugins/controlled-value-plugin.d.ts +4 -1
  36. package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts.map +1 -1
  37. package/dist/components/chat-input/plugins/value-plugin.d.ts +4 -1
  38. package/dist/components/chat-input/plugins/value-plugin.d.ts.map +1 -1
  39. package/dist/components/chat-list/chat-list-item.d.ts +6 -0
  40. package/dist/components/chat-list/chat-list-item.d.ts.map +1 -1
  41. package/dist/components/chat-list/chat-list-items.d.ts +12 -1
  42. package/dist/components/chat-list/chat-list-items.d.ts.map +1 -1
  43. package/dist/components/chat-list/chat-list.d.ts +36 -2
  44. package/dist/components/chat-list/chat-list.d.ts.map +1 -1
  45. package/dist/components/chat-list/chat-list.stories.d.ts +67 -9
  46. package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -1
  47. package/dist/components/chat-message/chat-message.d.ts +12 -1
  48. package/dist/components/chat-message/chat-message.d.ts.map +1 -1
  49. package/dist/components/chat-message/chat-message.stories.d.ts +31 -0
  50. package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -1
  51. package/dist/components/chat-message/index.d.ts +1 -1
  52. package/dist/components/chat-message/index.d.ts.map +1 -1
  53. package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +3 -0
  54. package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -1
  55. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +25 -5
  56. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -1
  57. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +32 -1
  58. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -1
  59. package/dist/components/chat-message-attachment-card/index.d.ts +2 -2
  60. package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -1
  61. package/dist/components/chat-message-attachment-card/utils.d.ts +1 -0
  62. package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -1
  63. package/dist/components/chat-message-response/chat-message-response.stories.d.ts +13 -0
  64. package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -1
  65. package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +22 -5
  66. package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -1
  67. package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +42 -0
  68. package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -1
  69. package/dist/components/chat-message-toolbar/index.d.ts +1 -1
  70. package/dist/components/chat-message-toolbar/index.d.ts.map +1 -1
  71. package/dist/components/chat-messages/chat-messages.d.ts +34 -2
  72. package/dist/components/chat-messages/chat-messages.d.ts.map +1 -1
  73. package/dist/components/chat-messages/chat-messages.stories.d.ts +33 -2
  74. package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -1
  75. package/dist/components/chat-notification-card/chat-notification-card.d.ts +56 -4
  76. package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -1
  77. package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +50 -1
  78. package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -1
  79. package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +6 -0
  80. package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -1
  81. package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +43 -1
  82. package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -1
  83. package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +37 -17
  84. package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -1
  85. package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +53 -1
  86. package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -1
  87. package/dist/components/chat-reply/chat-reply.d.ts +11 -0
  88. package/dist/components/chat-reply/chat-reply.d.ts.map +1 -1
  89. package/dist/components/chat-reply/chat-reply.stories.d.ts +23 -0
  90. package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -1
  91. package/dist/components/chat-reply/index.d.ts +1 -1
  92. package/dist/components/chat-reply/index.d.ts.map +1 -1
  93. package/dist/components/chat-suggestion/chat-suggestion.d.ts +36 -10
  94. package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -1
  95. package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +66 -2
  96. package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -1
  97. package/dist/components/chat-suggestion/index.d.ts +2 -1
  98. package/dist/components/chat-suggestion/index.d.ts.map +1 -1
  99. package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +26 -1
  100. package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -1
  101. package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +25 -1
  102. package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -1
  103. package/dist/components/chat-thread/chat-thread.d.ts +17 -2
  104. package/dist/components/chat-thread/chat-thread.d.ts.map +1 -1
  105. package/dist/components/chat-thread/chat-thread.stories.d.ts +75 -10
  106. package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -1
  107. package/dist/components/index.d.ts +1 -3
  108. package/dist/components/index.d.ts.map +1 -1
  109. package/dist/components/markdown-viewer/markdown-viewer.d.ts +8 -1
  110. package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -1
  111. package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +18 -1
  112. package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -1
  113. package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts +4 -1
  114. package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts.map +1 -1
  115. package/dist/components/rich-text-area/plugins/value-plugin.d.ts +4 -1
  116. package/dist/components/rich-text-area/plugins/value-plugin.d.ts.map +1 -1
  117. package/dist/components/rich-text-area/rich-text-area.d.ts +17 -0
  118. package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -1
  119. package/dist/components/rich-text-area/rich-text-area.stories.d.ts +52 -0
  120. package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -1
  121. package/dist/components/rich-text-area/styled.d.ts +6 -2
  122. package/dist/components/rich-text-area/styled.d.ts.map +1 -1
  123. package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +9 -2
  124. package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -1
  125. package/dist/components/rich-text-field/components/index.d.ts +5 -5
  126. package/dist/components/rich-text-field/components/index.d.ts.map +1 -1
  127. package/dist/components/rich-text-field/components/text-color-button.d.ts +12 -1
  128. package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -1
  129. package/dist/components/rich-text-field/rich-text-field.d.ts +22 -0
  130. package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -1
  131. package/dist/components/rich-text-field/rich-text-field.stories.d.ts +28 -1
  132. package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -1
  133. package/dist/components/topmenu/index.d.ts +2 -0
  134. package/dist/components/topmenu/index.d.ts.map +1 -0
  135. package/dist/components/topmenu/topmenu.d.ts +22 -0
  136. package/dist/components/topmenu/topmenu.d.ts.map +1 -0
  137. package/dist/components/topmenu/topmenu.stories.d.ts +31 -0
  138. package/dist/components/topmenu/topmenu.stories.d.ts.map +1 -0
  139. package/dist/docs/agent.stories.d.ts.map +1 -1
  140. package/dist/docs/chat-panel.d.ts +7 -5
  141. package/dist/docs/chat-panel.d.ts.map +1 -1
  142. package/dist/docs/chatbot-panel.d.ts.map +1 -1
  143. package/dist/docs/chatbot.stories.d.ts.map +1 -1
  144. package/dist/index.css +1 -1
  145. package/dist/index.es.js +1801 -1806
  146. package/dist/index.es.js.map +1 -1
  147. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +9 -7
  148. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -1
  149. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +37 -9
  150. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -1
  151. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +41 -16
  152. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -1
  153. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +6 -0
  154. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -1
  155. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +22 -1
  156. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -1
  157. package/package.json +16 -10
  158. package/src/__storybook__/parent-block.tsx +21 -0
  159. package/src/components/canvas-shell/__stories__/canvas-panel.tsx +25 -0
  160. package/src/components/canvas-shell/__stories__/document-list.tsx +29 -0
  161. package/src/components/canvas-shell/__stories__/fixtures.ts +222 -0
  162. package/src/components/canvas-shell/__stories__/holdings-table.tsx +56 -0
  163. package/src/components/canvas-shell/__stories__/types.ts +47 -0
  164. package/src/components/canvas-shell/{canvas-shell.test.tsx → __tests__/canvas-shell.spec.tsx} +1 -1
  165. package/src/components/canvas-shell/canvas-shell.json +24 -0
  166. package/src/components/canvas-shell/canvas-shell.stories.tsx +581 -122
  167. package/src/components/canvas-shell/canvas-shell.tsx +44 -17
  168. package/src/components/chat-card/__stories__/fixtures.ts +119 -0
  169. package/src/components/chat-card/__stories__/types.ts +44 -0
  170. package/src/components/chat-card/chat-card.json +67 -3
  171. package/src/components/chat-card/chat-card.stories.tsx +872 -148
  172. package/src/components/chat-card/chat-card.tsx +2 -0
  173. package/src/components/chat-card/components/chat-card-body.tsx +12 -0
  174. package/src/components/chat-card/components/chat-card-footer.tsx +11 -0
  175. package/src/components/chat-card/components/chat-card-form.tsx +21 -2
  176. package/src/components/chat-card/components/chat-card-header.tsx +39 -2
  177. package/src/components/chat-card/contexts.tsx +2 -0
  178. package/src/components/chat-card/hooks.ts +1 -0
  179. package/src/components/chat-card/types.ts +3 -0
  180. package/src/components/chat-card-container/__stories__/fixtures.ts +54 -0
  181. package/src/components/chat-card-container/__stories__/resizable-chat-window.tsx +19 -0
  182. package/src/components/chat-card-container/__stories__/result-card.tsx +31 -0
  183. package/src/components/chat-card-container/__stories__/types.ts +16 -0
  184. package/src/components/chat-card-container/chat-card-container.json +7 -0
  185. package/src/components/chat-card-container/chat-card-container.stories.tsx +209 -56
  186. package/src/components/chat-card-container/chat-card-container.tsx +5 -0
  187. package/src/components/chat-container/__stories__/chat-composer.tsx +67 -0
  188. package/src/components/chat-container/__stories__/fixtures.ts +27 -0
  189. package/src/components/chat-container/__stories__/measure.ts +22 -0
  190. package/src/components/chat-container/__stories__/types.ts +7 -0
  191. package/src/components/chat-container/__stories__/variable-readout.tsx +64 -0
  192. package/src/components/chat-container/chat-container.json +9 -1
  193. package/src/components/chat-container/chat-container.stories.tsx +538 -106
  194. package/src/components/chat-container/chat-container.tsx +3 -0
  195. package/src/components/chat-input/__stories__/fixtures.ts +31 -0
  196. package/src/components/chat-input/__tests__/chat-input.spec.tsx +100 -0
  197. package/src/components/chat-input/chat-input.json +11 -2
  198. package/src/components/chat-input/chat-input.stories.tsx +660 -197
  199. package/src/components/chat-input/chat-input.tsx +39 -5
  200. package/src/components/chat-input/plugins/controlled-value-plugin.tsx +16 -3
  201. package/src/components/chat-input/plugins/value-plugin.tsx +19 -4
  202. package/src/components/chat-list/__stories__/chat-row.tsx +41 -0
  203. package/src/components/chat-list/__stories__/fixtures.ts +94 -0
  204. package/src/components/chat-list/__stories__/types.ts +13 -0
  205. package/src/components/chat-list/chat-list-item.tsx +6 -0
  206. package/src/components/chat-list/chat-list-items.tsx +16 -0
  207. package/src/components/chat-list/chat-list.json +24 -2
  208. package/src/components/chat-list/chat-list.stories.tsx +631 -215
  209. package/src/components/chat-list/chat-list.tsx +51 -4
  210. package/src/components/chat-message/__stories__/fixtures.ts +53 -0
  211. package/src/components/chat-message/__stories__/sent-attachment.tsx +22 -0
  212. package/src/components/chat-message/__stories__/tool-steps.tsx +37 -0
  213. package/src/components/chat-message/chat-message.json +10 -1
  214. package/src/components/chat-message/chat-message.stories.tsx +282 -20
  215. package/src/components/chat-message/chat-message.tsx +16 -1
  216. package/src/components/chat-message/index.ts +8 -1
  217. package/src/components/chat-message-attachment-card/__stories__/fixtures.ts +30 -0
  218. package/src/components/chat-message-attachment-card/__stories__/types.ts +14 -0
  219. package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +4 -0
  220. package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +20 -0
  221. package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +266 -51
  222. package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +37 -4
  223. package/src/components/chat-message-attachment-card/index.ts +6 -0
  224. package/src/components/chat-message-attachment-card/utils.ts +1 -0
  225. package/src/components/chat-message-response/__stories__/fixtures.ts +50 -0
  226. package/src/components/chat-message-response/chat-message-response.json +5 -0
  227. package/src/components/chat-message-response/chat-message-response.stories.tsx +135 -26
  228. package/src/components/chat-message-toolbar/chat-message-toolbar.json +21 -3
  229. package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +377 -6
  230. package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +47 -12
  231. package/src/components/chat-message-toolbar/index.ts +4 -0
  232. package/src/components/chat-messages/__stories__/conversation-frame.tsx +25 -0
  233. package/src/components/chat-messages/__stories__/conversation-group.tsx +22 -0
  234. package/src/components/chat-messages/__stories__/fixtures.ts +70 -0
  235. package/src/components/chat-messages/__stories__/types.ts +5 -0
  236. package/src/components/chat-messages/chat-messages.json +30 -12
  237. package/src/components/chat-messages/chat-messages.stories.tsx +439 -212
  238. package/src/components/chat-messages/chat-messages.tsx +46 -3
  239. package/src/components/chat-notification-card/__stories__/fixtures.ts +38 -0
  240. package/src/components/chat-notification-card/__stories__/types.ts +13 -0
  241. package/src/components/chat-notification-card/chat-notification-card.json +52 -2
  242. package/src/components/chat-notification-card/chat-notification-card.stories.tsx +542 -62
  243. package/src/components/chat-notification-card/chat-notification-card.tsx +97 -6
  244. package/src/components/chat-notification-popup/__stories__/fixtures.ts +36 -0
  245. package/src/components/chat-notification-popup/__stories__/notification-item.tsx +93 -0
  246. package/src/components/chat-notification-popup/__stories__/types.ts +14 -0
  247. package/src/components/chat-notification-popup/chat-notification-popup.json +14 -1
  248. package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +467 -17
  249. package/src/components/chat-notification-popup/chat-notification-popup.tsx +18 -3
  250. package/src/components/chat-prompt-box/__stories__/fixtures.ts +16 -0
  251. package/src/components/chat-prompt-box/__stories__/types.ts +8 -0
  252. package/src/components/chat-prompt-box/chat-prompt-box.json +25 -2
  253. package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +535 -43
  254. package/src/components/chat-prompt-box/chat-prompt-box.tsx +73 -19
  255. package/src/components/chat-reply/chat-reply.json +10 -0
  256. package/src/components/chat-reply/chat-reply.stories.tsx +264 -21
  257. package/src/components/chat-reply/chat-reply.tsx +15 -0
  258. package/src/components/chat-reply/index.ts +10 -1
  259. package/src/components/chat-suggestion/__stories__/fixtures.ts +16 -0
  260. package/src/components/chat-suggestion/__tests__/chat-suggestion.spec.tsx +185 -0
  261. package/src/components/chat-suggestion/chat-suggestion.json +62 -20
  262. package/src/components/chat-suggestion/chat-suggestion.stories.tsx +542 -58
  263. package/src/components/chat-suggestion/chat-suggestion.tsx +154 -65
  264. package/src/components/chat-suggestion/index.ts +9 -0
  265. package/src/components/chat-thinking-process/__stories__/fixtures.ts +56 -0
  266. package/src/components/chat-thinking-process/chat-thinking-process.json +28 -3
  267. package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +354 -78
  268. package/src/components/chat-thinking-process/chat-thinking-process.tsx +55 -4
  269. package/src/components/chat-thread/__stories__/fixtures.ts +171 -0
  270. package/src/components/chat-thread/__stories__/scroll-position.ts +9 -0
  271. package/src/components/chat-thread/__stories__/snippets.ts +129 -0
  272. package/src/components/chat-thread/__stories__/thread-frame.tsx +22 -0
  273. package/src/components/chat-thread/__stories__/thread-turns.tsx +35 -0
  274. package/src/components/chat-thread/__stories__/types.ts +12 -0
  275. package/src/components/chat-thread/__stories__/use-turn-stream.ts +78 -0
  276. package/src/components/chat-thread/chat-thread.json +23 -3
  277. package/src/components/chat-thread/chat-thread.stories.tsx +804 -142
  278. package/src/components/chat-thread/chat-thread.tsx +64 -16
  279. package/src/components/index.ts +1 -3
  280. package/src/components/markdown-viewer/__stories__/fixtures.ts +67 -0
  281. package/src/components/markdown-viewer/markdown-viewer.json +7 -1
  282. package/src/components/markdown-viewer/markdown-viewer.stories.tsx +219 -50
  283. package/src/components/markdown-viewer/markdown-viewer.tsx +9 -0
  284. package/src/components/rich-text-area/__stories__/fixtures.ts +30 -0
  285. package/src/components/rich-text-area/__tests__/rich-text-area.spec.tsx +114 -0
  286. package/src/components/rich-text-area/plugins/controlled-value-plugin.tsx +20 -3
  287. package/src/components/rich-text-area/plugins/value-plugin.tsx +16 -3
  288. package/src/components/rich-text-area/rich-text-area.json +7 -4
  289. package/src/components/rich-text-area/rich-text-area.stories.tsx +597 -41
  290. package/src/components/rich-text-area/rich-text-area.tsx +27 -4
  291. package/src/components/rich-text-area/styled.tsx +11 -5
  292. package/src/components/rich-text-field/__stories__/fixtures.ts +29 -0
  293. package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +10 -1
  294. package/src/components/rich-text-field/components/index.ts +8 -5
  295. package/src/components/rich-text-field/components/text-color-button.tsx +16 -2
  296. package/src/components/rich-text-field/rich-text-field.json +3 -1
  297. package/src/components/rich-text-field/rich-text-field.stories.tsx +452 -61
  298. package/src/components/rich-text-field/rich-text-field.tsx +23 -0
  299. package/src/components/topmenu/index.ts +1 -0
  300. package/src/components/topmenu/topmenu.json +107 -0
  301. package/src/components/topmenu/topmenu.stories.tsx +334 -0
  302. package/src/components/topmenu/topmenu.tsx +71 -0
  303. package/src/docs/agent.stories.tsx +16 -16
  304. package/src/docs/chat-panel.tsx +37 -32
  305. package/src/docs/chatbot-panel.tsx +11 -2
  306. package/src/docs/chatbot.mdx +17 -12
  307. package/src/docs/chatbot.stories.tsx +7 -8
  308. package/src/layouts/chat-card-list-layout/__stories__/fixtures.ts +112 -0
  309. package/src/layouts/chat-card-list-layout/__stories__/result-card.tsx +36 -0
  310. package/src/layouts/chat-card-list-layout/__stories__/types.ts +31 -0
  311. package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +14 -1
  312. package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +316 -84
  313. package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +11 -7
  314. package/src/layouts/chat-card-three-column-layout/__stories__/fixtures.ts +117 -0
  315. package/src/layouts/chat-card-three-column-layout/__stories__/resizable-chat-window.tsx +18 -0
  316. package/src/layouts/chat-card-three-column-layout/__stories__/stay-details.tsx +85 -0
  317. package/src/layouts/chat-card-three-column-layout/__stories__/stay-list.tsx +50 -0
  318. package/src/layouts/chat-card-three-column-layout/__stories__/stay-map.tsx +44 -0
  319. package/src/layouts/chat-card-three-column-layout/__stories__/stay-rooms.tsx +61 -0
  320. package/src/layouts/chat-card-three-column-layout/__stories__/types.ts +35 -0
  321. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +16 -0
  322. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +603 -182
  323. package/src/layouts/chat-card-two-column-layout/__stories__/connection-itinerary.tsx +51 -0
  324. package/src/layouts/chat-card-two-column-layout/__stories__/fixtures.ts +83 -0
  325. package/src/layouts/chat-card-two-column-layout/__stories__/route-map.tsx +24 -0
  326. package/src/layouts/chat-card-two-column-layout/__stories__/types.ts +15 -0
  327. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +13 -1
  328. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +368 -67
  329. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +11 -2
  330. package/dist/components/card-item-picker/card-item-picker-context.d.ts +0 -21
  331. package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +0 -1
  332. package/dist/components/card-item-picker/card-item-picker-list.d.ts +0 -24
  333. package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +0 -1
  334. package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +0 -28
  335. package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +0 -1
  336. package/dist/components/card-item-picker/card-item-picker-row.d.ts +0 -12
  337. package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +0 -1
  338. package/dist/components/card-item-picker/card-item-picker.stories.d.ts +0 -19
  339. package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +0 -1
  340. package/dist/components/card-item-picker/index.d.ts +0 -9
  341. package/dist/components/card-item-picker/index.d.ts.map +0 -1
  342. package/dist/components/chat-message-history/chat-message-history.d.ts +0 -48
  343. package/dist/components/chat-message-history/chat-message-history.d.ts.map +0 -1
  344. package/dist/components/chat-message-history/chat-message-history.stories.d.ts +0 -7
  345. package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +0 -1
  346. package/dist/components/chat-message-history/index.d.ts +0 -2
  347. package/dist/components/chat-message-history/index.d.ts.map +0 -1
  348. package/dist/components/spinner/index.d.ts +0 -2
  349. package/dist/components/spinner/index.d.ts.map +0 -1
  350. package/dist/components/spinner/spinner.d.ts +0 -9
  351. package/dist/components/spinner/spinner.d.ts.map +0 -1
  352. package/dist/components/spinner/spinner.stories.d.ts +0 -8
  353. package/dist/components/spinner/spinner.stories.d.ts.map +0 -1
  354. package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +0 -279
  355. package/src/components/card-item-picker/card-item-picker-context.tsx +0 -44
  356. package/src/components/card-item-picker/card-item-picker-list.tsx +0 -95
  357. package/src/components/card-item-picker/card-item-picker-row-parts.tsx +0 -96
  358. package/src/components/card-item-picker/card-item-picker-row.tsx +0 -109
  359. package/src/components/card-item-picker/card-item-picker.json +0 -147
  360. package/src/components/card-item-picker/card-item-picker.stories.tsx +0 -158
  361. package/src/components/card-item-picker/index.ts +0 -24
  362. package/src/components/chat-message-history/chat-message-history.json +0 -99
  363. package/src/components/chat-message-history/chat-message-history.stories.tsx +0 -136
  364. package/src/components/chat-message-history/chat-message-history.tsx +0 -277
  365. package/src/components/chat-message-history/index.ts +0 -13
  366. package/src/components/spinner/index.ts +0 -1
  367. package/src/components/spinner/spinner.json +0 -73
  368. package/src/components/spinner/spinner.stories.tsx +0 -41
  369. package/src/components/spinner/spinner.tsx +0 -32
@@ -1,4 +1,4 @@
1
- import { useState, type ReactNode } from 'react';
1
+ import { useState, type ReactNode, type Ref } from 'react';
2
2
 
3
3
  import { ArrowUpwardAltIcon, StopIcon } from '@swisper.ai/icons';
4
4
  import { Button, IconButton } from '@swisper.ai/ui';
@@ -13,7 +13,12 @@ import {
13
13
  CanvasShellHeader,
14
14
  CanvasShellTitle,
15
15
  } from '../components/canvas-shell';
16
- import { ChatInput, ChatInputTextarea } from '../components/chat-input';
16
+ import {
17
+ ChatPromptBox,
18
+ ChatPromptBoxActionsRight,
19
+ ChatPromptBoxContent,
20
+ ChatPromptBoxInput,
21
+ } from '../components/chat-prompt-box';
17
22
 
18
23
  export interface ChatComposerProps {
19
24
  draft: string;
@@ -23,10 +28,12 @@ export interface ChatComposerProps {
23
28
  /** While a reply is in progress: sending is disabled, or replaced by Stop when `onStop` is given */
24
29
  isBusy: boolean;
25
30
  onStop?: () => void;
31
+ /** The editable element, e.g. to return focus to it after a suggestion is sent */
32
+ inputRef?: Ref<HTMLDivElement>;
26
33
  className?: string;
27
34
  }
28
35
 
29
- /** The message input with its send button, which becomes Stop while busy when `onStop` is given. */
36
+ /** The prompt box with its send button, which becomes Stop while busy when `onStop` is given. */
30
37
  export function ChatComposer({
31
38
  draft,
32
39
  onDraftChange,
@@ -34,24 +41,18 @@ export function ChatComposer({
34
41
  placeholder,
35
42
  isBusy,
36
43
  onStop,
44
+ inputRef,
37
45
  className,
38
46
  }: ChatComposerProps) {
39
47
  return (
40
- <div className={cn('flex items-end gap-8', className)}>
41
- <ChatInput
42
- className={cn(
43
- 'max-h-[120px] min-h-[40px] w-full overflow-y-auto',
44
- 'rounded-[20px] border border-solid border-transparent bg-paper-elevation-2',
45
- 'px-12 py-7 outline-none transition-[border-color] duration-150',
46
- 'data-[focused=true]:border-primary-main',
47
- )}
48
- >
49
- <ChatInputTextarea
48
+ <ChatPromptBox className={className}>
49
+ <ChatPromptBoxContent>
50
+ <ChatPromptBoxInput
51
+ ref={inputRef}
50
52
  value={draft}
51
53
  onChange={onDraftChange}
52
54
  autoFocus={false}
53
55
  placeholder={placeholder}
54
- className="text-text-primary"
55
56
  onKeyDown={(event) => {
56
57
  if (event.key === 'Enter' && !event.shiftKey) {
57
58
  event.preventDefault();
@@ -59,24 +60,26 @@ export function ChatComposer({
59
60
  }
60
61
  }}
61
62
  />
62
- </ChatInput>
63
63
 
64
- {isBusy && onStop ? (
65
- <IconButton variant="secondary" size="md" aria-label="Stop" onClick={onStop}>
66
- <StopIcon />
67
- </IconButton>
68
- ) : (
69
- <IconButton
70
- variant="primary"
71
- size="md"
72
- aria-label="Send message"
73
- isDisabled={!draft.trim() || isBusy}
74
- onClick={onSend}
75
- >
76
- <ArrowUpwardAltIcon />
77
- </IconButton>
78
- )}
79
- </div>
64
+ <ChatPromptBoxActionsRight>
65
+ {isBusy && onStop ? (
66
+ <IconButton variant="secondary" size="md" aria-label="Stop" onClick={onStop}>
67
+ <StopIcon />
68
+ </IconButton>
69
+ ) : (
70
+ <IconButton
71
+ variant="primary"
72
+ size="md"
73
+ aria-label="Send message"
74
+ isDisabled={!draft.trim() || isBusy}
75
+ onClick={onSend}
76
+ >
77
+ <ArrowUpwardAltIcon />
78
+ </IconButton>
79
+ )}
80
+ </ChatPromptBoxActionsRight>
81
+ </ChatPromptBoxContent>
82
+ </ChatPromptBox>
80
83
  );
81
84
  }
82
85
 
@@ -96,7 +99,7 @@ export interface ChatPanelFrameProps extends Omit<ChatComposerProps, 'className'
96
99
 
97
100
  /**
98
101
  * The right-hand side panel the Chatbot docs stories share: a CanvasShell with a header (full screen, close),
99
- * the conversation, and a footer with the message input and its send button. It fills its parent, so give
102
+ * the conversation, and a footer with the prompt box and its send button. It fills its parent, so give
100
103
  * the story a sized parent.
101
104
  */
102
105
  export function ChatPanelFrame({
@@ -111,6 +114,7 @@ export function ChatPanelFrame({
111
114
  placeholder,
112
115
  isBusy,
113
116
  onStop,
117
+ inputRef,
114
118
  onClose,
115
119
  }: ChatPanelFrameProps) {
116
120
  const [isOpen, setIsOpen] = useState(true);
@@ -164,6 +168,7 @@ export function ChatPanelFrame({
164
168
  placeholder={placeholder}
165
169
  isBusy={isBusy}
166
170
  onStop={onStop}
171
+ inputRef={inputRef}
167
172
  />
168
173
  </CanvasShellFooter>
169
174
  </CanvasShell>
@@ -192,6 +192,7 @@ export function ChatbotPanel({ initialTurns, initialQuestion, onClose }: Chatbot
192
192
  const [pending, setPending] = useState<PendingReply | null>(null);
193
193
  const [draft, setDraft] = useState('');
194
194
  const hasSentInitialQuestion = useRef(false);
195
+ const inputRef = useRef<HTMLDivElement>(null);
195
196
 
196
197
  const isStreaming = pending !== null;
197
198
  const suggestions = SUGGESTIONS.filter((text) => !turns.some((turn) => turn.question === text));
@@ -249,13 +250,21 @@ export function ChatbotPanel({ initialTurns, initialQuestion, onClose }: Chatbot
249
250
  onSend={() => send(draft)}
250
251
  placeholder="Ask about your finances"
251
252
  isBusy={isStreaming}
253
+ inputRef={inputRef}
252
254
  onClose={onClose}
253
255
  footerTop={
254
256
  !isStreaming &&
255
257
  suggestions.length > 0 && (
256
- <ChatSuggestions>
258
+ <ChatSuggestions aria-label="Suggested questions">
257
259
  {suggestions.map((text) => (
258
- <ChatSuggestion key={text} onClick={() => send(text)}>
260
+ <ChatSuggestion
261
+ key={text}
262
+ onSelect={() => {
263
+ send(text);
264
+ // The suggestions unmount while the reply streams; keep focus in the panel.
265
+ inputRef.current?.focus();
266
+ }}
267
+ >
259
268
  <ChatSuggestionLabelIcon />
260
269
  <ChatSuggestionLabel isMultiline={false}>{text}</ChatSuggestionLabel>
261
270
  <ChatSuggestionActions>
@@ -5,7 +5,7 @@ import * as AgentStories from './agent.stories';
5
5
 
6
6
  {/* Standalone, not attached to a story file: attaching it would turn that story into a folder */}
7
7
 
8
- <Meta title="Chatbot/Overview" />
8
+ <Meta title="Chat/Overview" />
9
9
 
10
10
  <Title>Chatbot</Title>
11
11
  <Subtitle>An assistant chat in a right-hand panel, assembled from the Chatbot parts</Subtitle>
@@ -54,8 +54,12 @@ stream in.
54
54
  <CanvasShellFooter>
55
55
  <ChatSuggestions />
56
56
  {/* follow-up questions */}
57
- <ChatInput />
58
- {/* with a send IconButton next to it */}
57
+ <ChatPromptBox>
58
+ <ChatPromptBoxContent>
59
+ <ChatPromptBoxInput />
60
+ <ChatPromptBoxActionsRight>{/* the send IconButton */}</ChatPromptBoxActionsRight>
61
+ </ChatPromptBoxContent>
62
+ </ChatPromptBox>
59
63
  </CanvasShellFooter>
60
64
  </CanvasShell>
61
65
  ```
@@ -72,7 +76,8 @@ stream in.
72
76
  - **`ChatMessageToolbar`**: timestamp and actions under an answer, shown on hover through
73
77
  `ChatMessageActions`.
74
78
  - **`ChatSuggestions`**: follow-up questions; picking one sends it.
75
- - **`ChatInput`**: the rich-text editor; Enter sends, Shift+Enter adds a line.
79
+ - **`ChatPromptBox`**: the composer box around the rich-text editor, with the send button in its
80
+ trailing slot; Enter sends, Shift+Enter adds a line.
76
81
 
77
82
  ## Composition rules
78
83
 
@@ -134,11 +139,11 @@ transcript fills the height and the composer sits under it.
134
139
 
135
140
  ## Parts
136
141
 
137
- - [CanvasShell](?path=/docs/chatbot-canvasshell--docs)
138
- - [ChatThread](?path=/docs/chatbot-chatthread--docs)
139
- - [ChatMessage](?path=/docs/chatbot-chatmessage--docs)
140
- - [ChatThinkingProcess](?path=/docs/chatbot-chatthinkingprocess--docs)
141
- - [ChatMessageToolbar](?path=/docs/chatbot-chatmessagetoolbar--docs)
142
- - [MarkdownViewer](?path=/docs/chatbot-markdownviewer--docs)
143
- - [ChatSuggestion](?path=/docs/chatbot-chatsuggestion--docs)
144
- - [ChatInput](?path=/docs/chatbot-chatinput--docs)
142
+ - [CanvasShell](?path=/docs/chat-canvasshell--docs)
143
+ - [ChatThread](?path=/docs/chat-chatthread--docs)
144
+ - [ChatMessage](?path=/docs/chat-chatmessage--docs)
145
+ - [ChatThinkingProcess](?path=/docs/chat-chatthinkingprocess--docs)
146
+ - [ChatMessageToolbar](?path=/docs/chat-chatmessagetoolbar--docs)
147
+ - [MarkdownViewer](?path=/docs/chat-markdownviewer--docs)
148
+ - [ChatSuggestion](?path=/docs/chat-chatsuggestion--docs)
149
+ - [ChatPromptBox](?path=/docs/chat-chatpromptbox--docs)
@@ -1,14 +1,14 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { expect, fn, userEvent, within } from 'storybook/test';
3
3
 
4
- import { TooltipProvider } from '@swisper.ai/ui';
4
+ import { withTooltip } from '@swisper.ai/ui';
5
5
 
6
6
  import { ChatbotPanel, SUGGESTIONS } from './chatbot-panel';
7
7
 
8
8
  // One story whose name matches the title's last segment, so the sidebar shows a single entry
9
9
  // instead of a folder
10
10
  const meta: Meta<typeof ChatbotPanel> = {
11
- title: 'Chatbot/Chatbot',
11
+ title: 'Chat/Chatbot',
12
12
  component: ChatbotPanel,
13
13
  parameters: {
14
14
  layout: 'fullscreen',
@@ -16,12 +16,11 @@ const meta: Meta<typeof ChatbotPanel> = {
16
16
  },
17
17
  decorators: [
18
18
  (Story) => (
19
- <TooltipProvider>
20
- <div className="h-dvh">
21
- <Story />
22
- </div>
23
- </TooltipProvider>
19
+ <div className="h-dvh">
20
+ <Story />
21
+ </div>
24
22
  ),
23
+ withTooltip,
25
24
  ],
26
25
  args: {
27
26
  initialTurns: [],
@@ -55,7 +54,7 @@ export const Chatbot: Story = {
55
54
  play: async ({ canvasElement }) => {
56
55
  const canvas = within(canvasElement);
57
56
 
58
- await userEvent.click(canvas.getByText(SUGGESTIONS[0]));
57
+ await userEvent.click(canvas.getByRole('button', { name: SUGGESTIONS[0] }));
59
58
 
60
59
  const thread = await canvas.findByLabelText('Chat message history');
61
60
  await expect(await within(thread).findByText(SUGGESTIONS[0])).toBeVisible();
@@ -0,0 +1,112 @@
1
+ import type { CalendarEvent, EmailSummary, TrainConnection } from './types';
2
+
3
+ // Shaped like the rows an inbox search returns: one long subject, one message without a text body.
4
+ export const EMAILS: EmailSummary[] = [
5
+ {
6
+ id: 'email_01',
7
+ subject: 'Agenda for the offsite on 14 November',
8
+ from: 'mara.keller@company.com',
9
+ date: 'Oct 27, 14:00',
10
+ preview: 'Here is the draft agenda. Tell me by Friday if a session is missing.',
11
+ },
12
+ {
13
+ id: 'email_02',
14
+ subject: 'Invoice 2026-1043 is ready',
15
+ from: 'billing@company.com',
16
+ date: 'Oct 27, 09:12',
17
+ preview: null,
18
+ },
19
+ {
20
+ id: 'email_03',
21
+ subject: 'Re: Re: Fwd: Updated seating plan for the quarterly review, with the room change',
22
+ from: 'jonas.frei@company.com',
23
+ date: 'Oct 26, 17:48',
24
+ preview: 'The review moves to the large room on the third floor. Seats are as before.',
25
+ },
26
+ {
27
+ id: 'email_04',
28
+ subject: 'Your train ticket to Geneva',
29
+ from: 'tickets@company.com',
30
+ date: 'Oct 26, 08:03',
31
+ preview: 'Your ticket for 28 October is attached. Show it together with your half-fare card.',
32
+ },
33
+ {
34
+ id: 'email_05',
35
+ subject: 'Feedback on the onboarding draft',
36
+ from: 'lea.baumann@company.com',
37
+ date: 'Oct 24, 16:20',
38
+ preview: 'Two comments on the second section, the rest reads well.',
39
+ },
40
+ {
41
+ id: 'email_06',
42
+ subject: 'Lunch on Thursday?',
43
+ from: 'noah.meier@company.com',
44
+ date: 'Oct 24, 11:35',
45
+ preview: 'The place by the river has a table at 12:15 if you are in.',
46
+ },
47
+ ];
48
+
49
+ // Two events: fewer than the default limit of three.
50
+ export const CALENDAR_EVENTS: CalendarEvent[] = [
51
+ {
52
+ id: 'event_01',
53
+ title: 'Quarterly review',
54
+ time: 'Tue, Oct 28, 10:00 to 11:30',
55
+ location: 'Room Säntis, third floor',
56
+ },
57
+ {
58
+ id: 'event_02',
59
+ title: 'Call with the onboarding team',
60
+ time: 'Tue, Oct 28, 14:00 to 14:30',
61
+ location: null,
62
+ },
63
+ ];
64
+
65
+ // Shaped like the connections a transport search returns; the third one has the long route.
66
+ export const TRAIN_CONNECTIONS: TrainConnection[] = [
67
+ {
68
+ id: 'conn_01',
69
+ line: 'IC 1',
70
+ route: 'Zurich HB → Geneva Airport',
71
+ departure: '08:02',
72
+ arrival: '10:57',
73
+ duration: '2h 55m',
74
+ transfers: 0,
75
+ },
76
+ {
77
+ id: 'conn_02',
78
+ line: 'IR 15',
79
+ route: 'Zurich HB → Geneva',
80
+ departure: '08:32',
81
+ arrival: '11:16',
82
+ duration: '2h 44m',
83
+ transfers: 0,
84
+ },
85
+ {
86
+ id: 'conn_03',
87
+ line: 'IC 5',
88
+ route: 'Zurich HB → Geneva Airport via Biel/Bienne and Neuchâtel',
89
+ departure: '09:03',
90
+ arrival: '11:58',
91
+ duration: '2h 55m',
92
+ transfers: 1,
93
+ },
94
+ {
95
+ id: 'conn_04',
96
+ line: 'IC 1',
97
+ route: 'Zurich HB → Geneva Airport',
98
+ departure: '09:02',
99
+ arrival: '11:57',
100
+ duration: '2h 55m',
101
+ transfers: 0,
102
+ },
103
+ {
104
+ id: 'conn_05',
105
+ line: 'IR 15',
106
+ route: 'Zurich HB → Geneva',
107
+ departure: '09:32',
108
+ arrival: '12:16',
109
+ duration: '2h 44m',
110
+ transfers: 0,
111
+ },
112
+ ];
@@ -0,0 +1,36 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ import {
4
+ ChatCard,
5
+ ChatCardBody,
6
+ ChatCardContent,
7
+ ChatCardHeader,
8
+ ChatCardHeaderContent,
9
+ ChatCardSubTitle,
10
+ ChatCardTitle,
11
+ } from '../../../components/chat-card';
12
+
13
+ export interface ResultCardProps {
14
+ title: string;
15
+ subTitle: string;
16
+ children?: ReactNode;
17
+ }
18
+
19
+ /** One card of a result list: a title, a line under it and, when there is one, a body. */
20
+ export function ResultCard({ title, subTitle, children }: ResultCardProps) {
21
+ return (
22
+ <ChatCard fullWidth>
23
+ <ChatCardHeader>
24
+ <ChatCardHeaderContent>
25
+ <ChatCardTitle>{title}</ChatCardTitle>
26
+ <ChatCardSubTitle>{subTitle}</ChatCardSubTitle>
27
+ </ChatCardHeaderContent>
28
+ </ChatCardHeader>
29
+ {children ? (
30
+ <ChatCardBody>
31
+ <ChatCardContent>{children}</ChatCardContent>
32
+ </ChatCardBody>
33
+ ) : null}
34
+ </ChatCard>
35
+ );
36
+ }
@@ -0,0 +1,31 @@
1
+ /** An email as the list shows it: the header fields and a one-line preview. */
2
+ export interface EmailSummary {
3
+ id: string;
4
+ subject: string;
5
+ from: string;
6
+ /** Pre-formatted the way the card header shows it. */
7
+ date: string;
8
+ /** `null` when the message has no text body, only attachments. */
9
+ preview: string | null;
10
+ }
11
+
12
+ /** A calendar event as the list shows it. */
13
+ export interface CalendarEvent {
14
+ id: string;
15
+ title: string;
16
+ /** Pre-formatted the way the card header shows it. */
17
+ time: string;
18
+ /** `null` for an event without a room or an address. */
19
+ location: string | null;
20
+ }
21
+
22
+ /** One connection of a transport search. */
23
+ export interface TrainConnection {
24
+ id: string;
25
+ line: string;
26
+ route: string;
27
+ departure: string;
28
+ arrival: string;
29
+ duration: string;
30
+ transfers: number;
31
+ }
@@ -2,6 +2,18 @@
2
2
  "$schema": "../../../../int-eslint-config/schemas/component.schema.json",
3
3
  "component": "chat-card-list-layout",
4
4
  "purpose": "Holds a list of chat cards in a message and shows only the first few, revealing the rest behind a one-way \"show more\" button. Parts: ChatCardListLayout (root and state), ChatCardListLayoutItems (the visible slice), ChatCardListLayoutShowMore (the reveal button), plus useChatCardListLayoutContext for custom triggers.",
5
+ "anatomy": [
6
+ "import {",
7
+ " ChatCardListLayout,",
8
+ " ChatCardListLayoutItems,",
9
+ " ChatCardListLayoutShowMore,",
10
+ "} from '@swisper.ai/web-chat-ui';",
11
+ "",
12
+ "<ChatCardListLayout>",
13
+ " <ChatCardListLayoutItems />",
14
+ " <ChatCardListLayoutShowMore />",
15
+ "</ChatCardListLayout>"
16
+ ],
5
17
  "useWhen": [
6
18
  "An assistant message returns more cards than fit at a glance (flight options, search results, places) and the rest should stay one click away",
7
19
  "A long list of cards would push the reply taller than a phone viewport",
@@ -52,7 +64,8 @@
52
64
  "Controlled (expanded) the layout does not expand on its own: clicking reports onExpandedChange(true) and the owner sets expanded; setting expanded back to false re-collapses the list and brings the button back",
53
65
  "onExpandedChange is called with true on every show-more click, controlled or not",
54
66
  "By default the root stacks its children in a column, left-aligned, with an 8px gap; a className on the root replaces direction, gap and alignment (merged with tailwind-merge), so the same layout serves a horizontal strip",
55
- "The root carries data-expanded and the group/chat-card-list-layout marker, so descendants can style on group-data-[expanded=true]/chat-card-list-layout",
67
+ "The root carries data-slot=chat-card-list-layout, data-expanded and the group/chat-card-list-layout marker, so descendants can style on group-data-[expanded=true]/chat-card-list-layout",
68
+ "ChatCardListLayoutShowMore carries data-slot=chat-card-list-layout-show-more on the button it renders, in place of the button's own data-slot=button",
56
69
  "ChatCardListLayoutShowMore forwards every ui/button prop; by default it is a small tertiary button centred under the cards, and variant, size or className passed to it win",
57
70
  "useChatCardListLayoutContext returns visibleCount, isExpanded, expand and hiddenCount; hiddenCount is 0 on the first render and correct before the first paint",
58
71
  "Every part and useChatCardListLayoutContext throw \"[web-chat-ui] … must be used within a ChatCardListLayout\" when rendered outside the root",