@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
@@ -1,63 +1,35 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { fn } from 'storybook/test';
2
+ import { expect, fn } from 'storybook/test';
3
3
 
4
- import {
5
- ChatCard,
6
- ChatCardBody,
7
- ChatCardContent,
8
- ChatCardHeader,
9
- ChatCardHeaderContent,
10
- ChatCardTitle,
11
- } from '../../components/chat-card';
4
+ import type { ButtonProps } from '@swisper.ai/ui';
5
+
6
+ import { ParentBlock } from '../../__storybook__/parent-block';
12
7
  import { ChatCardContainer } from '../../components/chat-card-container';
13
8
  import { ChatContainer } from '../../components/chat-container';
9
+ import { ChatMessage, ChatMessageContent } from '../../components/chat-message';
14
10
 
11
+ import { CALENDAR_EVENTS, EMAILS, TRAIN_CONNECTIONS } from './__stories__/fixtures';
12
+ import { ResultCard } from './__stories__/result-card';
15
13
  import {
16
14
  ChatCardListLayout,
17
15
  ChatCardListLayoutItems,
18
16
  ChatCardListLayoutShowMore,
19
17
  useChatCardListLayoutContext,
20
18
  } from './chat-card-list-layout';
21
-
22
- const FLIGHTS = [
23
- 'Zurich → Lisbon, 06:40',
24
- 'Zurich → Lisbon, 09:15',
25
- 'Zurich → Porto, 11:05',
26
- 'Geneva → Lisbon, 12:30',
27
- 'Zurich → Faro, 14:20',
28
- 'Basel → Lisbon, 16:00',
29
- 'Zurich → Lisbon, 18:45',
30
- 'Geneva → Porto, 20:10',
31
- ];
32
-
33
- function FlightCard({ label }: { label: string }) {
34
- return (
35
- <ChatCard fullWidth>
36
- <ChatCardHeader>
37
- <ChatCardHeaderContent>
38
- <ChatCardTitle>{label}</ChatCardTitle>
39
- </ChatCardHeaderContent>
40
- </ChatCardHeader>
41
- <ChatCardBody>
42
- <ChatCardContent>Direct, 3h 05m, from CHF 189.</ChatCardContent>
43
- </ChatCardBody>
44
- </ChatCard>
45
- );
46
- }
47
-
48
- function Message({ children }: { children: React.ReactNode }) {
49
- return (
50
- <ChatContainer className="h-auto py-16">
51
- <ChatCardContainer>{children}</ChatCardContainer>
52
- </ChatContainer>
53
- );
54
- }
19
+ import type { ChatCardListLayoutShowMoreProps } from './chat-card-list-layout';
55
20
 
56
21
  const meta: Meta<typeof ChatCardListLayout> = {
57
- title: 'Chatbot/ChatCardListLayout',
22
+ title: 'Chat/ChatCardListLayout',
58
23
  component: ChatCardListLayout,
59
24
  tags: ['autodocs'],
60
25
  parameters: { layout: 'padded' },
26
+ decorators: [
27
+ (Story) => (
28
+ <ChatContainer className="h-auto py-16">
29
+ <Story />
30
+ </ChatContainer>
31
+ ),
32
+ ],
61
33
  argTypes: {
62
34
  visibleCount: {
63
35
  control: { type: 'number', min: 0 },
@@ -92,7 +64,7 @@ const meta: Meta<typeof ChatCardListLayout> = {
92
64
  className: {
93
65
  control: 'text',
94
66
  description:
95
- 'Direction, gap and alignment of the list. The layout adds no visual styling of its own.',
67
+ 'Direction, gap and alignment of the list, merged last. Without it the cards stack in a left-aligned column with an 8px gap.',
96
68
  },
97
69
  },
98
70
  args: {
@@ -107,84 +79,344 @@ export default meta;
107
79
  type Story = StoryObj<typeof ChatCardListLayout>;
108
80
 
109
81
  /**
110
- * Eight cards, three shown. The stacking and the gap come from the `className` on the
111
- * layout — it contributes no spacing of its own — and the five hidden cards are not in
112
- * the DOM until the button is clicked.
82
+ * Six emails, three shown. The other three are not in the DOM until the button is clicked, and
83
+ * the button removes itself once they are.
113
84
  */
114
85
  export const Default: Story = {
115
- render: () => (
116
- <Message>
117
- <ChatCardListLayout visibleCount={3} className="flex flex-col items-start gap-8">
86
+ render: (args) => (
87
+ <ChatCardContainer variant="fixed">
88
+ <ChatCardListLayout {...args}>
118
89
  <ChatCardListLayoutItems>
119
- {FLIGHTS.map((flight) => (
120
- <FlightCard key={flight} label={flight} />
90
+ {EMAILS.map((email) => (
91
+ <ResultCard
92
+ key={email.id}
93
+ title={email.subject}
94
+ subTitle={`${email.from}, ${email.date}`}
95
+ >
96
+ {email.preview}
97
+ </ResultCard>
121
98
  ))}
122
99
  </ChatCardListLayoutItems>
123
100
  <ChatCardListLayoutShowMore>Show more</ChatCardListLayoutShowMore>
124
101
  </ChatCardListLayout>
125
- </Message>
102
+ </ChatCardContainer>
126
103
  ),
127
104
  };
128
105
 
106
+ /** Checks that only the visible slice mounts, and that the button reveals the rest from the keyboard and then removes itself. */
107
+ export const ShowMoreRevealsCards: Story = {
108
+ ...Default,
109
+ tags: ['e2e', '!autodocs'],
110
+ play: async ({ args, canvas, userEvent, step }) => {
111
+ const showMore = canvas.getByRole('button', { name: 'Show more' });
112
+ // TODO(echo-ds): the root is a plain div with no role or name, so it is found by its slot.
113
+ const root = showMore.closest<HTMLElement>('[data-slot="chat-card-list-layout"]');
114
+
115
+ await step('Mounts only the first three cards', async () => {
116
+ await expect(canvas.getByText(EMAILS[2].subject)).toBeVisible();
117
+ await expect(canvas.queryByText(EMAILS[3].subject)).not.toBeInTheDocument();
118
+ await expect(root).toHaveAttribute('data-expanded', 'false');
119
+ await expect(showMore).toHaveAttribute('data-slot', 'chat-card-list-layout-show-more');
120
+ });
121
+
122
+ await step('Reveals the rest with Enter and removes the button', async () => {
123
+ showMore.focus();
124
+ await userEvent.keyboard('{Enter}');
125
+
126
+ await expect(canvas.getByText(EMAILS[5].subject)).toBeVisible();
127
+ await expect(canvas.queryByRole('button', { name: 'Show more' })).not.toBeInTheDocument();
128
+ await expect(root).toHaveAttribute('data-expanded', 'true');
129
+ await expect(args.onExpandedChange).toHaveBeenCalledWith(true);
130
+ });
131
+ },
132
+ };
133
+
129
134
  /**
130
- * Two cards under a limit of three. The button is never rendered, so a short list carries
131
- * no dead affordance.
135
+ * Two events under the default limit of three. The button is never rendered, so a short list
136
+ * carries no dead affordance.
132
137
  */
133
138
  export const ShorterThanLimit: Story = {
139
+ parameters: { controls: { disable: true } },
134
140
  render: () => (
135
- <Message>
136
- <ChatCardListLayout visibleCount={3}>
141
+ <ChatCardContainer>
142
+ <ChatCardListLayout>
137
143
  <ChatCardListLayoutItems>
138
- {FLIGHTS.slice(0, 2).map((flight) => (
139
- <FlightCard key={flight} label={flight} />
144
+ {CALENDAR_EVENTS.map((event) => (
145
+ <ResultCard key={event.id} title={event.title} subTitle={event.time}>
146
+ {event.location}
147
+ </ResultCard>
140
148
  ))}
141
149
  </ChatCardListLayoutItems>
142
150
  <ChatCardListLayoutShowMore>Show more</ChatCardListLayoutShowMore>
143
151
  </ChatCardListLayout>
144
- </Message>
152
+ </ChatCardContainer>
145
153
  ),
146
154
  };
147
155
 
148
- function ShowRemaining() {
156
+ /** Checks that a list shorter than the limit mounts every card and no button. */
157
+ export const ShorterThanLimitHasNoButton: Story = {
158
+ ...ShorterThanLimit,
159
+ tags: ['e2e', '!autodocs'],
160
+ play: async ({ canvas }) => {
161
+ await expect(canvas.getByText(CALENDAR_EVENTS[0].title)).toBeVisible();
162
+ await expect(canvas.getByText(CALENDAR_EVENTS[1].title)).toBeVisible();
163
+ await expect(canvas.queryByRole('button', { name: 'Show more' })).not.toBeInTheDocument();
164
+ },
165
+ };
166
+
167
+ /**
168
+ * A list that starts expanded, as in a message restored from history that the reader had already
169
+ * expanded: every card is mounted and there is no button.
170
+ */
171
+ export const Expanded: Story = {
172
+ ...Default,
173
+ args: { defaultExpanded: true },
174
+ };
175
+
176
+ /** A show-more trigger that reads how many cards are hidden and says so in its label. */
177
+ function ShowRemaining(props: Omit<ChatCardListLayoutShowMoreProps, 'children'>) {
149
178
  const { hiddenCount } = useChatCardListLayoutContext();
150
179
 
151
180
  return (
152
- <ChatCardListLayoutShowMore variant="tertiary">{`Show ${hiddenCount} more`}</ChatCardListLayoutShowMore>
181
+ <ChatCardListLayoutShowMore {...props}>{`Show ${hiddenCount} more`}</ChatCardListLayoutShowMore>
153
182
  );
154
183
  }
155
184
 
156
185
  /**
157
- * The label is a required child rather than a built-in string, so it can be translated
158
- * and can carry the count. `useChatCardListLayoutContext` publishes `hiddenCount` for
159
- * exactly this; `variant` is forwarded straight to the design system's `Button`.
186
+ * The label is a required child rather than a built-in string, so it can be translated and can
187
+ * carry the count: `useChatCardListLayoutContext` publishes `hiddenCount` for exactly this.
160
188
  */
161
189
  export const CountInLabel: Story = {
190
+ parameters: { controls: { disable: true } },
162
191
  render: () => (
163
- <Message>
164
- <ChatCardListLayout visibleCount={3} className="flex flex-col items-start gap-8">
192
+ <ChatCardContainer variant="full">
193
+ <ChatCardListLayout>
165
194
  <ChatCardListLayoutItems>
166
- {FLIGHTS.map((flight) => (
167
- <FlightCard key={flight} label={flight} />
195
+ {TRAIN_CONNECTIONS.map((connection) => (
196
+ <ResultCard
197
+ key={connection.id}
198
+ title={`${connection.line}, ${connection.route}`}
199
+ subTitle={`${connection.departure} to ${connection.arrival}, ${connection.duration}`}
200
+ >
201
+ {connection.transfers === 0 ? 'Direct' : `${connection.transfers} transfer`}
202
+ </ResultCard>
168
203
  ))}
169
204
  </ChatCardListLayoutItems>
170
205
  <ShowRemaining />
171
206
  </ChatCardListLayout>
172
- </Message>
207
+ </ChatCardContainer>
173
208
  ),
174
209
  };
175
210
 
176
- export const Playground: Story = {
177
- args: { visibleCount: 3, defaultExpanded: false },
178
- render: (args) => (
179
- <Message>
180
- <ChatCardListLayout {...args} className="flex flex-col items-start gap-8">
181
- <ChatCardListLayoutItems>
182
- {FLIGHTS.map((flight) => (
183
- <FlightCard key={flight} label={flight} />
184
- ))}
185
- </ChatCardListLayoutItems>
186
- <ChatCardListLayoutShowMore>Show more</ChatCardListLayoutShowMore>
187
- </ChatCardListLayout>
188
- </Message>
211
+ /** Checks that the label counts the hidden cards and that a click reveals them. */
212
+ export const CountInLabelCountsHiddenCards: Story = {
213
+ ...CountInLabel,
214
+ tags: ['e2e', '!autodocs'],
215
+ play: async ({ canvas, userEvent, step }) => {
216
+ await step('Counts the two connections past the limit', async () => {
217
+ await expect(canvas.getByRole('button', { name: 'Show 2 more' })).toBeVisible();
218
+ await expect(canvas.queryByText(/^IR 15.*Geneva$/)).toBeInTheDocument();
219
+ await expect(canvas.queryByText('09:32 to 12:16, 2h 44m')).not.toBeInTheDocument();
220
+ });
221
+
222
+ await step('Reveals them on click', async () => {
223
+ await userEvent.click(canvas.getByRole('button', { name: 'Show 2 more' }));
224
+
225
+ await expect(canvas.getByText('09:32 to 12:16, 2h 44m')).toBeVisible();
226
+ await expect(canvas.queryByRole('button', { name: /^Show/ })).not.toBeInTheDocument();
227
+ });
228
+ },
229
+ };
230
+
231
+ /** The list in the parent it's allowed in, then in a chat thread and in an assistant message. */
232
+ export const Examples: Story = {
233
+ parameters: { controls: { disable: true } },
234
+ render: () => (
235
+ <div className="flex flex-col gap-24">
236
+ <ParentBlock parent="web-chat-ui/chat-card-container">
237
+ <ChatCardContainer variant="full">
238
+ <ChatCardListLayout>
239
+ <ChatCardListLayoutItems>
240
+ {TRAIN_CONNECTIONS.map((connection) => (
241
+ <ResultCard
242
+ key={connection.id}
243
+ title={`${connection.line}, ${connection.route}`}
244
+ subTitle={`${connection.departure} to ${connection.arrival}, ${connection.duration}`}
245
+ >
246
+ {connection.transfers === 0 ? 'Direct' : `${connection.transfers} transfer`}
247
+ </ResultCard>
248
+ ))}
249
+ </ChatCardListLayoutItems>
250
+ <ChatCardListLayoutShowMore>Show more</ChatCardListLayoutShowMore>
251
+ </ChatCardListLayout>
252
+ </ChatCardContainer>
253
+ </ParentBlock>
254
+
255
+ <ParentBlock parent="chat thread">
256
+ <section aria-label="Chat thread" className="flex flex-col gap-16">
257
+ <ChatMessage isQuestion className="px-message">
258
+ <ChatMessageContent>Which emails came in since Friday?</ChatMessageContent>
259
+ </ChatMessage>
260
+ <ChatCardContainer variant="fixed">
261
+ <ChatCardListLayout>
262
+ <ChatCardListLayoutItems>
263
+ {EMAILS.map((email) => (
264
+ <ResultCard
265
+ key={email.id}
266
+ title={email.subject}
267
+ subTitle={`${email.from}, ${email.date}`}
268
+ >
269
+ {email.preview}
270
+ </ResultCard>
271
+ ))}
272
+ </ChatCardListLayoutItems>
273
+ <ChatCardListLayoutShowMore>Show more</ChatCardListLayoutShowMore>
274
+ </ChatCardListLayout>
275
+ </ChatCardContainer>
276
+ </section>
277
+ </ParentBlock>
278
+
279
+ <ParentBlock parent="assistant message">
280
+ <div role="group" aria-label="Assistant message" className="flex flex-col gap-8">
281
+ <p className="px-message text-text-secondary">
282
+ You have two meetings tomorrow. Neither overlaps with your train to Geneva.
283
+ </p>
284
+ <ChatCardContainer inline>
285
+ <ChatCardListLayout>
286
+ <ChatCardListLayoutItems>
287
+ {CALENDAR_EVENTS.map((event) => (
288
+ <ResultCard key={event.id} title={event.title} subTitle={event.time}>
289
+ {event.location}
290
+ </ResultCard>
291
+ ))}
292
+ </ChatCardListLayoutItems>
293
+ <ChatCardListLayoutShowMore>Show more</ChatCardListLayoutShowMore>
294
+ </ChatCardListLayout>
295
+ </ChatCardContainer>
296
+ </div>
297
+ </ParentBlock>
298
+ </div>
189
299
  ),
190
300
  };
301
+
302
+ interface ChatCardListLayoutPlaygroundProps {
303
+ visibleCount: number;
304
+ defaultExpanded: boolean;
305
+ expanded?: boolean;
306
+ asChild: boolean;
307
+ className: string;
308
+ itemCount: number;
309
+ label: string;
310
+ variant: ButtonProps['variant'];
311
+ size: ButtonProps['size'];
312
+ hasCountInLabel: boolean;
313
+ onExpandedChange: (expanded: boolean) => void;
314
+ onClick: () => void;
315
+ }
316
+
317
+ function ChatCardListLayoutPlayground({
318
+ visibleCount,
319
+ defaultExpanded,
320
+ expanded,
321
+ asChild,
322
+ className,
323
+ itemCount,
324
+ label,
325
+ variant,
326
+ size,
327
+ hasCountInLabel,
328
+ onExpandedChange,
329
+ onClick,
330
+ }: ChatCardListLayoutPlaygroundProps) {
331
+ const parts = (
332
+ <>
333
+ <ChatCardListLayoutItems>
334
+ {EMAILS.slice(0, itemCount).map((email) => (
335
+ <ResultCard
336
+ key={email.id}
337
+ title={email.subject}
338
+ subTitle={`${email.from}, ${email.date}`}
339
+ >
340
+ {email.preview}
341
+ </ResultCard>
342
+ ))}
343
+ </ChatCardListLayoutItems>
344
+ {hasCountInLabel ? (
345
+ <ShowRemaining variant={variant} size={size} onClick={onClick} />
346
+ ) : (
347
+ <ChatCardListLayoutShowMore variant={variant} size={size} onClick={onClick}>
348
+ {label}
349
+ </ChatCardListLayoutShowMore>
350
+ )}
351
+ </>
352
+ );
353
+
354
+ return (
355
+ <ChatCardContainer variant="fixed">
356
+ {/* `defaultExpanded` is read once, so the key remounts the layout when the control flips it. */}
357
+ <ChatCardListLayout
358
+ key={String(defaultExpanded)}
359
+ visibleCount={visibleCount}
360
+ defaultExpanded={defaultExpanded}
361
+ expanded={expanded}
362
+ asChild={asChild}
363
+ className={className}
364
+ onExpandedChange={onExpandedChange}
365
+ >
366
+ {asChild ? <section aria-label="Emails">{parts}</section> : parts}
367
+ </ChatCardListLayout>
368
+ </ChatCardContainer>
369
+ );
370
+ }
371
+
372
+ /** Every part of the list at once, with each prop, the card count and both kinds of trigger on the Controls panel. */
373
+ export const Playground: StoryObj<typeof ChatCardListLayoutPlayground> = {
374
+ tags: ['!autodocs'],
375
+ args: {
376
+ visibleCount: 3,
377
+ defaultExpanded: false,
378
+ asChild: false,
379
+ className: '',
380
+ itemCount: EMAILS.length,
381
+ label: 'Show more',
382
+ variant: 'tertiary',
383
+ size: 'sm',
384
+ hasCountInLabel: true,
385
+ onExpandedChange: fn(),
386
+ onClick: fn(),
387
+ },
388
+ argTypes: {
389
+ asChild: {
390
+ control: 'boolean',
391
+ description:
392
+ '`asChild` on the root: the layout renders as the `<section>` the story passes it instead of a `<div>`.',
393
+ },
394
+ itemCount: {
395
+ control: { type: 'number', min: 0, max: EMAILS.length },
396
+ description: 'Number of cards in `ChatCardListLayoutItems`.',
397
+ },
398
+ label: {
399
+ control: 'text',
400
+ description: 'Text of `ChatCardListLayoutShowMore`, used when `hasCountInLabel` is off.',
401
+ },
402
+ variant: {
403
+ control: 'select',
404
+ options: ['primary', 'prominent', 'secondary', 'tertiary', 'danger', 'danger-subtle'],
405
+ description: '`variant` on `ChatCardListLayoutShowMore`, forwarded to the button.',
406
+ },
407
+ size: {
408
+ control: 'select',
409
+ options: ['sm', 'md', 'lg'],
410
+ description: '`size` on `ChatCardListLayoutShowMore`, forwarded to the button.',
411
+ },
412
+ hasCountInLabel: {
413
+ control: 'boolean',
414
+ description:
415
+ 'Swaps the button for a custom trigger that reads `hiddenCount` from `useChatCardListLayoutContext`.',
416
+ },
417
+ onClick: {
418
+ description: '`onClick` on `ChatCardListLayoutShowMore`; runs as well as expanding.',
419
+ },
420
+ },
421
+ render: (args) => <ChatCardListLayoutPlayground {...args} />,
422
+ };
@@ -84,11 +84,12 @@ export interface ChatCardListLayoutProps extends ComponentProps<'div'> {
84
84
  /**
85
85
  * Holds a list of chat cards and reveals the overflow behind a one-way "show more".
86
86
  *
87
- * Structure and state only — the sole class it emits is the `group/chat-card-list-layout`
88
- * marker, which paints nothing and exists so descendants can react to the expanded state
89
- * with `group-data-[expanded=true]/chat-card-list-layout:…`. Direction, gap and every
90
- * other visual decision come from the consumer's `className`, so the same layout serves
91
- * a stacked card list and a horizontal strip without a variant prop.
87
+ * Structure and state only. By default the root stacks its children in a left-aligned
88
+ * column with an 8px gap; `className` is merged last, so the consumer's direction, gap and
89
+ * alignment replace those and the same layout serves a stacked card list and a horizontal
90
+ * strip without a variant prop. The `group/chat-card-list-layout` marker paints nothing
91
+ * and exists so descendants can react to the expanded state with
92
+ * `group-data-[expanded=true]/chat-card-list-layout:…`.
92
93
  *
93
94
  * The three parts exist because the pieces of information live in different places: only
94
95
  * `ChatCardListLayoutItems` knows how many children there are, only
@@ -140,6 +141,7 @@ export const ChatCardListLayout = forwardRef<HTMLDivElement, ChatCardListLayoutP
140
141
  <ChatCardListLayoutContext.Provider value={contextValue}>
141
142
  <Component
142
143
  ref={ref}
144
+ data-slot="chat-card-list-layout"
143
145
  data-testid="chat-card-list-layout"
144
146
  data-expanded={isExpanded}
145
147
  className={cn(
@@ -211,8 +213,9 @@ export interface ChatCardListLayoutShowMoreProps extends Omit<ButtonProps, 'chil
211
213
  * list is expanded, or it never overflowed — which is what makes the button a one-shot
212
214
  * affordance rather than a toggle.
213
215
  *
214
- * It sets no `variant`, `size` or `className` of its own so the design system's `Button`
215
- * defaults apply untouched and a consumer's props are not fighting ours.
216
+ * By default it is a small tertiary `Button` centred under the cards. Every `Button` prop
217
+ * is forwarded after those defaults and `className` is merged last, so a consumer's
218
+ * `variant`, `size` or classes win.
216
219
  */
217
220
  export const ChatCardListLayoutShowMore = forwardRef<
218
221
  // The same element union `Button` forwards: it renders a `span` when `isSemantic` is
@@ -237,6 +240,7 @@ export const ChatCardListLayoutShowMore = forwardRef<
237
240
  ref={ref}
238
241
  variant="tertiary"
239
242
  size="sm"
243
+ data-slot="chat-card-list-layout-show-more"
240
244
  data-testid="chat-card-list-layout-show-more"
241
245
  onClick={handleClick}
242
246
  className={cn('mx-auto', className)}
@@ -0,0 +1,117 @@
1
+ import type { RoomRate, Stay } from './types';
2
+
3
+ // The first result of the search: the one a single-property card shows.
4
+ export const FEATURED_STAY: Stay = {
5
+ id: 'limmatblick',
6
+ name: 'Hotel Limmatblick',
7
+ area: 'Altstadt · 0.4 km from Zurich HB',
8
+ pricePerNight: 'CHF 240',
9
+ total: 'CHF 720',
10
+ nights: 3,
11
+ description:
12
+ 'A riverside townhouse with 42 rooms, a breakfast room over the Limmat and the old town at the door.',
13
+ amenities: ['Free Wi-Fi', 'Breakfast', 'Air conditioning', 'Lift'],
14
+ checkIn: '15:00',
15
+ checkOut: '11:00',
16
+ room: 'Double room · 1 queen bed · breakfast included',
17
+ cancellation: 'Free cancellation until 10 Nov',
18
+ pin: { left: 46, top: 38 },
19
+ };
20
+
21
+ // Results of one search: a name that runs long, a rate that can't be refunded, and a property
22
+ // without a map location, which gets a row but no pin.
23
+ export const STAYS: Stay[] = [
24
+ FEATURED_STAY,
25
+ {
26
+ id: 'goldener-anker',
27
+ name: 'Pension Zum Goldenen Anker am Lindenhof, Altstadt Suites and Apartments',
28
+ area: 'Lindenhof · 0.7 km from Zurich HB',
29
+ pricePerNight: 'CHF 189',
30
+ total: 'CHF 567',
31
+ nights: 3,
32
+ description: 'Six apartments above a courtyard, each with a kitchenette and a washing machine.',
33
+ amenities: ['Kitchenette', 'Free Wi-Fi', 'Washing machine'],
34
+ checkIn: '16:00',
35
+ checkOut: '10:00',
36
+ room: 'Studio apartment · 1 double bed',
37
+ cancellation: 'Non-refundable',
38
+ pin: { left: 34, top: 52 },
39
+ },
40
+ {
41
+ id: 'seefeld-garden',
42
+ name: 'Seefeld Garden Hotel',
43
+ area: 'Seefeld · 2.1 km from Zurich HB',
44
+ pricePerNight: 'CHF 275',
45
+ total: 'CHF 825',
46
+ nights: 3,
47
+ description: 'A garden hotel two streets from the lake, with a sauna and bicycles to borrow.',
48
+ amenities: ['Sauna', 'Breakfast', 'Bicycles', 'Free Wi-Fi', 'Garden'],
49
+ checkIn: '15:00',
50
+ checkOut: '12:00',
51
+ room: 'Superior double · 1 king bed · breakfast included',
52
+ cancellation: 'Free cancellation until 11 Nov',
53
+ pin: { left: 68, top: 70 },
54
+ },
55
+ {
56
+ id: 'wiedikon-loft',
57
+ name: 'Wiedikon Loft House',
58
+ area: 'Wiedikon · 2.8 km from Zurich HB',
59
+ pricePerNight: 'CHF 162',
60
+ total: 'CHF 486',
61
+ nights: 3,
62
+ description:
63
+ 'Self check-in lofts in a converted print shop, ten minutes by tram from the centre.',
64
+ amenities: ['Self check-in', 'Free Wi-Fi'],
65
+ checkIn: '15:00',
66
+ checkOut: '11:00',
67
+ room: 'Loft · 2 single beds',
68
+ cancellation: 'Free cancellation until 8 Nov',
69
+ pin: { left: 18, top: 66 },
70
+ },
71
+ {
72
+ id: 'uetliberg',
73
+ name: 'Gasthaus Uetliblick',
74
+ area: 'Uetliberg · 6.4 km from Zurich HB',
75
+ pricePerNight: 'CHF 205',
76
+ total: 'CHF 615',
77
+ nights: 3,
78
+ description: 'A hilltop guesthouse above the city, reached by the S10 and a ten-minute walk.',
79
+ amenities: ['Restaurant', 'Terrace', 'Breakfast'],
80
+ checkIn: '14:00',
81
+ checkOut: '11:00',
82
+ room: 'Twin room · 2 single beds · breakfast included',
83
+ cancellation: 'Free cancellation until 9 Nov',
84
+ pin: null,
85
+ },
86
+ ];
87
+
88
+ // The rates of the featured stay, cheapest first; the suite does not say how many are left.
89
+ export const ROOM_RATES: RoomRate[] = [
90
+ {
91
+ id: 'rate_01',
92
+ room: 'Double room',
93
+ bedding: '1 queen bed · breakfast included',
94
+ cancellation: 'Free cancellation until 10 Nov',
95
+ pricePerNight: 'CHF 240',
96
+ total: 'CHF 720',
97
+ roomsLeft: 3,
98
+ },
99
+ {
100
+ id: 'rate_02',
101
+ room: 'Double room with river view',
102
+ bedding: '1 queen bed · breakfast included',
103
+ cancellation: 'Non-refundable',
104
+ pricePerNight: 'CHF 262',
105
+ total: 'CHF 786',
106
+ roomsLeft: 1,
107
+ },
108
+ {
109
+ id: 'rate_03',
110
+ room: 'Junior suite',
111
+ bedding: '1 king bed and 1 sofa bed · breakfast included',
112
+ cancellation: 'Free cancellation until 10 Nov',
113
+ pricePerNight: 'CHF 318',
114
+ total: 'CHF 954',
115
+ roomsLeft: null,
116
+ },
117
+ ];
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface ResizableChatWindowProps {
4
+ children: ReactNode;
5
+ }
6
+
7
+ /** A dashed box that starts 900px wide and resizes from its right edge, standing in for a chat window. */
8
+ export function ResizableChatWindow({ children }: ResizableChatWindowProps) {
9
+ return (
10
+ <div
11
+ role="group"
12
+ aria-label="Resizable chat window"
13
+ className="w-225 max-w-full min-w-90 resize-x overflow-auto border border-dashed border-card-border-base"
14
+ >
15
+ {children}
16
+ </div>
17
+ );
18
+ }