@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,37 +1,63 @@
1
1
  import { ReactNode } from 'react';
2
+ import { ListItemActionProps, ListItemProps, ListProps } from '@swisper.ai/ui';
2
3
  interface ChatSuggestionContextValue {
3
4
  index?: number;
4
5
  }
5
6
  export declare function useChatSuggestionContext(): ChatSuggestionContextValue;
6
- export interface ChatSuggestionsProps {
7
- children: ReactNode;
8
- className?: string;
9
- onMouseLeave?: () => void;
7
+ export interface ChatSuggestionsProps extends Omit<ListProps, 'asChild'> {
10
8
  }
11
- export declare function ChatSuggestions({ children, className, onMouseLeave }: ChatSuggestionsProps): import('react').JSX.Element;
12
- export interface ChatSuggestionProps {
9
+ /**
10
+ * The numbered list of suggestions, an `<ol>` built on `ui/List`: one Tab stop, arrow keys between
11
+ * suggestions (wrapping at the ends unless `hasLoop={false}`), one highlighted suggestion. Name it
12
+ * with `aria-label` or `aria-labelledby`. It gives each direct child its zero-based `index`.
13
+ */
14
+ export declare const ChatSuggestions: import('react').ForwardRefExoticComponent<ChatSuggestionsProps & import('react').RefAttributes<HTMLOListElement>>;
15
+ export interface ChatSuggestionProps extends Omit<ListItemProps, 'asChild' | 'className' | 'isSelected'> {
16
+ /** Zero-based position in the list. `ChatSuggestions` sets it on its direct children. */
13
17
  index?: number;
14
- children: ReactNode;
15
18
  className?: string;
19
+ /** Classes for the overlay `role="button"` that covers the suggestion. */
20
+ triggerClassName?: string;
21
+ /** The pointer entered the suggestion. Keyboard highlight does not call it. */
16
22
  onHover?: () => void;
17
- onClick?: () => void;
18
23
  }
19
- export declare function ChatSuggestion({ index, children, className, onHover, onClick, }: ChatSuggestionProps): import('react').JSX.Element;
24
+ /**
25
+ * One suggestion: an `<li>` whose whole surface is the selectable element (an overlay
26
+ * `role="button"` named by `ChatSuggestionLabel`). `onSelect` fires on click, Enter and Space.
27
+ * Controls in the row go in `ChatSuggestionAction`, which stacks above the overlay.
28
+ */
29
+ export declare const ChatSuggestion: import('react').ForwardRefExoticComponent<ChatSuggestionProps & import('react').RefAttributes<HTMLLIElement>>;
20
30
  export interface ChatSuggestionLabelIconProps {
21
31
  children?: ReactNode;
22
32
  className?: string;
33
+ /** Classes for the 32px box that holds the number or the icon. */
34
+ innerClassName?: string;
23
35
  }
24
- export declare function ChatSuggestionLabelIcon({ children, className }: ChatSuggestionLabelIconProps): import('react').JSX.Element;
36
+ /** The leading slot: the suggestion's number in an `OrderChip`, or the icon passed as children. */
37
+ export declare function ChatSuggestionLabelIcon({ children, className, innerClassName, }: ChatSuggestionLabelIconProps): import('react').JSX.Element;
25
38
  export interface ChatSuggestionLabelProps {
26
39
  children: ReactNode;
27
40
  className?: string;
28
41
  isMultiline?: boolean;
29
42
  }
43
+ /** The suggestion's text and its accessible name. Up to three lines, or one with `isMultiline={false}`. */
30
44
  export declare function ChatSuggestionLabel({ children, className, isMultiline, }: ChatSuggestionLabelProps): import('react').JSX.Element;
31
45
  export interface ChatSuggestionActionsProps {
32
46
  children: ReactNode;
33
47
  className?: string;
34
48
  }
49
+ /**
50
+ * The trailing slot, shown while the suggestion is highlighted (pointer over it or focus inside
51
+ * it). Holds a hint icon, or controls each wrapped in `ChatSuggestionAction`.
52
+ */
35
53
  export declare function ChatSuggestionActions({ children, className }: ChatSuggestionActionsProps): import('react').JSX.Element;
54
+ export interface ChatSuggestionActionProps extends ListItemActionProps {
55
+ }
56
+ /**
57
+ * Wraps one control in `ChatSuggestionActions` (a dismiss `IconButton`). The control stacks above
58
+ * the suggestion's overlay, never selects the suggestion, and is in the Tab order only in the row
59
+ * that holds the list's Tab stop.
60
+ */
61
+ export declare const ChatSuggestionAction: import('react').ForwardRefExoticComponent<ChatSuggestionActionProps & import('react').RefAttributes<HTMLElement>>;
36
62
  export {};
37
63
  //# sourceMappingURL=chat-suggestion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-suggestion.d.ts","sourceRoot":"","sources":["../../../src/components/chat-suggestion/chat-suggestion.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,UAAU,0B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+BAmBxF"}
1
+ {"version":3,"file":"chat-suggestion.d.ts","sourceRoot":"","sources":["../../../src/components/chat-suggestion/chat-suggestion.tsx"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EASL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAGxB,UAAU,0BAA0B;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,wBAAgB,wBAAwB,+BAQvC;AAMD,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;CAAG;AAE3E;;;;GAIG;AACH,eAAO,MAAM,eAAe,mHAoB3B,CAAC;AAQF,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,YAAY,CACvC;IACC,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,+GAgC1B,CAAC;AAQF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,mGAAmG;AACnG,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,SAAS,EACT,cAAc,GACf,EAAE,4BAA4B,+BAiC9B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,2GAA2G;AAC3G,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EACT,WAAkB,GACnB,EAAE,wBAAwB,+BAkB1B;AAMD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,0BAA0B,+BAqBxF;AAED,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;CAAG;AAEzE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,mHAQhC,CAAC"}
@@ -1,9 +1,73 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ReactNode } from 'react';
2
3
  import { ChatSuggestion, ChatSuggestions } from './chat-suggestion';
3
4
  declare const meta: Meta<typeof ChatSuggestion>;
4
5
  export default meta;
5
6
  type Story = StoryObj<typeof ChatSuggestion>;
7
+ type ListStory = StoryObj<typeof ChatSuggestions>;
8
+ /** One follow-up question under a finished answer; selecting it sends it as the next message. */
6
9
  export declare const Default: Story;
7
- export declare const List: StoryObj<typeof ChatSuggestions>;
8
- export declare const WithActions: StoryObj<typeof ChatSuggestion>;
10
+ interface ListArgs {
11
+ onSend: (text: string) => void;
12
+ onMouseLeave: () => void;
13
+ }
14
+ /**
15
+ * Follow-up questions after an answer, numbered by the list; the longest wraps to a second line.
16
+ * Selecting one calls `onSelect`, logged in the Actions panel as `onSend` with its text.
17
+ */
18
+ export declare const List: StoryObj<ListArgs>;
19
+ /** Clicking a follow-up sends its text once. */
20
+ export declare const ListSelect: StoryObj<ListArgs>;
21
+ /** A disabled suggestion ignores clicks and the arrow keys skip it. */
22
+ export declare const DisabledSuggestion: StoryObj<ListArgs>;
23
+ /** Quick replies to a question the assistant asked: confirming the address before an email is sent. */
24
+ export declare const QuickReplies: ListStory;
25
+ /** In a narrow panel, `isMultiline={false}` keeps each suggestion to one truncated line. */
26
+ export declare const Truncated: ListStory;
27
+ /** Conversation starters with an icon in place of the number, one per kind of task. */
28
+ export declare const WithIcons: ListStory;
29
+ interface WithActionsArgs {
30
+ onSend: () => void;
31
+ onDismiss: () => void;
32
+ }
33
+ /** A dismiss button in the actions, wrapped in `ChatSuggestionAction` so dismissing doesn't also send the suggestion. */
34
+ export declare const WithActions: StoryObj<WithActionsArgs>;
35
+ /** Dismissing a suggestion does not send it; clicking the rest of the row does. */
36
+ export declare const WithActionsDismiss: StoryObj<WithActionsArgs>;
37
+ interface KeyboardArgs {
38
+ onSend: (text: string) => void;
39
+ }
40
+ /** Tab reaches the list once, the arrow keys move between suggestions and wrap, Enter sends. */
41
+ export declare const Keyboard: StoryObj<KeyboardArgs>;
42
+ /** Tab lands on the first suggestion, the arrows move and wrap, Enter sends the focused one. */
43
+ export declare const KeyboardNavigation: StoryObj<KeyboardArgs>;
44
+ interface PointerPreviewArgs {
45
+ onHover: (text: string) => void;
46
+ onMouseLeave: () => void;
47
+ }
48
+ /**
49
+ * The pointer callbacks driving a preview that repeats the hovered suggestion's text: `onHover` on
50
+ * a suggestion fires when the pointer enters it, `onMouseLeave` on the list when it leaves the
51
+ * list. Keyboard highlight calls neither.
52
+ */
53
+ export declare const PointerPreview: StoryObj<PointerPreviewArgs>;
54
+ /** Hovering a suggestion shows its text in the preview; leaving the list clears it. */
55
+ export declare const PointerPreviewHover: StoryObj<PointerPreviewArgs>;
56
+ /** The suggestions in each place they're allowed: a canvas footer, a chat footer and an empty conversation. */
57
+ export declare const Examples: Story;
58
+ interface ChatSuggestionPlaygroundProps {
59
+ label: string;
60
+ isMultiline: boolean;
61
+ icon: ReactNode;
62
+ hasActions: boolean;
63
+ action: 'Enter hint' | 'Dismiss button';
64
+ isDisabled: boolean;
65
+ hasLoop: boolean;
66
+ onSelect: (text: string) => void;
67
+ onHover: () => void;
68
+ onDismiss: () => void;
69
+ }
70
+ declare function ChatSuggestionPlayground({ label, isMultiline, icon, hasActions, action, isDisabled, hasLoop, onSelect, onHover, onDismiss, }: ChatSuggestionPlaygroundProps): import('react').JSX.Element;
71
+ /** Every part of a suggestion at once; the controls drive the first one, the other two make the list navigable. */
72
+ export declare const Playground: StoryObj<typeof ChatSuggestionPlayground>;
9
73
  //# sourceMappingURL=chat-suggestion.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-suggestion.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-suggestion/chat-suggestion.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,EACL,cAAc,EAId,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAkDrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,QAAQ,CAAC,OAAO,eAAe,CAiDjD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,OAAO,cAAc,CAcvD,CAAC"}
1
+ {"version":3,"file":"chat-suggestion.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-suggestion/chat-suggestion.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAyBjD,OAAO,EACL,cAAc,EAKd,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CA0DrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAC7C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YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AA0CD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,kBAAkB,CAGvD,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,kBAAkB,CAiB5D,CAAC;AAkBF,+GAA+G;AAC/G,eAAO,MAAM,QAAQ,EAAE,KA0DtB,CAAC;AAEF,UAAU,6BAA6B;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,YAAY,GAAG,gBAAgB,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,iBAAS,wBAAwB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,IAAI,EACJ,UAAU,EACV,MAAM,EACN,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,6BAA6B,+BAoC/B;AAED,mHAAmH;AACnH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,wBAAwB,CA8DhE,CAAC"}
@@ -1,2 +1,3 @@
1
- export { ChatSuggestions, ChatSuggestion, ChatSuggestionLabelIcon, ChatSuggestionLabel, ChatSuggestionActions, useChatSuggestionContext, } from './chat-suggestion';
1
+ export { ChatSuggestions, ChatSuggestion, ChatSuggestionLabelIcon, ChatSuggestionLabel, ChatSuggestionActions, ChatSuggestionAction, useChatSuggestionContext, } from './chat-suggestion';
2
+ export type { ChatSuggestionsProps, ChatSuggestionProps, ChatSuggestionLabelIconProps, ChatSuggestionLabelProps, ChatSuggestionActionsProps, ChatSuggestionActionProps, } from './chat-suggestion';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chat-suggestion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/chat-suggestion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,EAC5B,wBAAwB,EACxB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC"}
@@ -3,36 +3,60 @@ import { CollapsibleProps } from '@swisper.ai/ui';
3
3
  export interface ChatThinkingProcessProps extends Omit<CollapsibleProps, 'isDisabled'> {
4
4
  children: ReactNode;
5
5
  className?: string;
6
+ /** The model is still thinking: the label shimmers and, while collapsed, the last step is previewed. */
6
7
  isStreaming?: boolean;
7
8
  }
9
+ /**
10
+ * Collapsible disclosure of the assistant's reasoning or tool steps. Collapsed by default; exposes
11
+ * `data-state` (`open` / `closed`) and `data-streaming` for its parts to style from.
12
+ */
8
13
  export declare const ChatThinkingProcess: React.ForwardRefExoticComponent<ChatThinkingProcessProps & React.RefAttributes<HTMLDivElement>>;
9
14
  export interface ChatThinkingProcessTriggerProps extends ComponentProps<'button'> {
10
15
  children: ReactNode;
11
16
  className?: string;
12
17
  isLoading?: boolean;
13
18
  }
19
+ /** The button that expands and collapses the steps; holds the icon, the label and the arrow. */
14
20
  export declare function ChatThinkingProcessTrigger({ children, className, ...rest }: ChatThinkingProcessTriggerProps): React.JSX.Element;
15
21
  export interface ChatThinkingProcessTriggerIconProps extends ComponentProps<'span'> {
16
22
  children: ReactNode;
17
23
  className?: string;
18
24
  }
25
+ /** The icon before the label: what kind of work the process is. */
19
26
  export declare function ChatThinkingProcessTriggerIcon({ children, className, ...rest }: ChatThinkingProcessTriggerIconProps): React.JSX.Element;
20
27
  export interface ChatThinkingProcessTriggerLabelProps extends ComponentProps<'span'> {
21
28
  children: ReactNode;
22
29
  className?: string;
23
30
  }
31
+ /** The trigger's text and accessible name; shimmers while the root is streaming. */
24
32
  export declare function ChatThinkingProcessTriggerLabel({ children, className, ...rest }: ChatThinkingProcessTriggerLabelProps): React.JSX.Element;
25
33
  export interface ChatThinkingProcessTriggerArrowProps extends ComponentProps<'span'> {
26
34
  className?: string;
27
35
  }
36
+ /** The chevron after the label; points up while the steps are expanded. Hidden from assistive tech. */
28
37
  export declare function ChatThinkingProcessTriggerArrow({ className, ...rest }: ChatThinkingProcessTriggerArrowProps): React.JSX.Element;
29
38
  export interface ChatThinkingProcessContentProps extends ComponentProps<'div'> {
30
39
  children: ReactNode;
40
+ /** Classes for the outer wrapper, which holds the preview and the list of steps. */
31
41
  className?: string;
42
+ /** Classes for the expanded list of steps. */
32
43
  itemsClassName?: string;
44
+ /** Classes for each timeline row: the marker column and the step beside it. */
45
+ rowClassName?: string;
46
+ /** Classes for the dot that marks each step. */
47
+ markerClassName?: string;
48
+ /** Classes for the line that joins a step's dot to the next one. */
49
+ connectorClassName?: string;
50
+ /** Classes for the faded preview of the last step. */
51
+ previewClassName?: string;
52
+ /** Previews the last step while the root is streaming and collapsed. */
33
53
  hasLastMessagePreview?: boolean;
34
54
  }
35
- export declare function ChatThinkingProcessContent({ children, className, itemsClassName, hasLastMessagePreview, ...rest }: ChatThinkingProcessContentProps): React.JSX.Element;
55
+ /**
56
+ * The steps. Each child becomes a timeline row in the expanded list, and the last child is
57
+ * previewed while the root is streaming and collapsed.
58
+ */
59
+ export declare function ChatThinkingProcessContent({ children, className, itemsClassName, rowClassName, markerClassName, connectorClassName, previewClassName, hasLastMessagePreview, ...rest }: ChatThinkingProcessContentProps): React.JSX.Element;
36
60
  export interface ChatThinkingProcessContentPreviewProps {
37
61
  children: ReactNode;
38
62
  className?: string;
@@ -43,5 +67,6 @@ export interface ChatThinkingProcessContentItemProps extends ComponentProps<'div
43
67
  children: ReactNode;
44
68
  className?: string;
45
69
  }
70
+ /** One step of the process: text, or any node such as streamed Markdown. */
46
71
  export declare function ChatThinkingProcessContentItem({ children, className, ...rest }: ChatThinkingProcessContentItemProps): React.JSX.Element;
47
72
  //# sourceMappingURL=chat-thinking-process.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-thinking-process.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAGxF,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,mBAAmB,iGAkB/B,CAAC;AAIF,MAAM,WAAW,+BAAgC,SAAQ,cAAc,CAAC,QAAQ,CAAC;IAC/E,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,+BAA+B,qBAoBjC;AAED,MAAM,WAAW,mCAAoC,SAAQ,cAAc,CAAC,MAAM,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,C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,8BAA8B,CAAC,EAC7C,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,mCAAmC,qBAUrC"}
1
+ {"version":3,"file":"chat-thinking-process.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAGxF,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,YAAY,CAAC;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wGAAwG;IACxG,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,iGAmB/B,CAAC;AAIF,MAAM,WAAW,+BAAgC,SAAQ,cAAc,CAAC,QAAQ,CAAC;IAC/E,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,gGAAgG;AAChG,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,+BAA+B,qBAqBjC;AAED,MAAM,WAAW,mCAAoC,SAAQ,cAAc,CAAC,MAAM,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mEAAmE;AACnE,wBAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,mCAAmC,qBAWrC;AAED,MAAM,WAAW,oCAAqC,SAAQ,cAAc,CAAC,MAAM,CAAC;IAClF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACp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AK,CAAC;IAChF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4EAA4E;AAC5E,wBAAgB,8BAA8B,CAAC,EAC7C,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,mCAAmC,qBAWrC"}
@@ -1,10 +1,34 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-vite';
2
- import { ChatThinkingProcess } from './chat-thinking-process';
2
+ import { ReactNode } from 'react';
3
+ import { ChatThinkingProcess, ChatThinkingProcessContentProps, ChatThinkingProcessProps } from './chat-thinking-process';
3
4
  declare const meta: Meta<typeof ChatThinkingProcess>;
4
5
  export default meta;
5
6
  type Story = StoryObj<typeof ChatThinkingProcess>;
7
+ /** A finished process above an answer: collapsed, with a label that sums up what was done. */
6
8
  export declare const Default: Story;
9
+ /** Still thinking with the preview switched off: the label shimmers, and the steps show only once expanded. */
7
10
  export declare const WithoutPreview: Story;
11
+ /** Still thinking: the label shimmers and the latest step is previewed under the collapsed trigger. */
8
12
  export declare const Streaming: Story;
13
+ /** A step whose text grows as it streams in; the label changes to a summary once the stream ends. */
9
14
  export declare const StreamingWithContent: Story;
15
+ /** Expands and collapses the finished process with the mouse, checking the trigger's expanded state. */
16
+ export declare const DefaultOpenAndClose: Story;
17
+ /** Focuses the trigger with Tab, expands the steps with Enter and collapses them with Space. */
18
+ export declare const DefaultKeyboard: Story;
19
+ /** While streaming, the collapsed process previews its last step and drops the preview once expanded. */
20
+ export declare const StreamingPreview: Story;
21
+ /** With the preview off, a streaming process shows no step until it is expanded. */
22
+ export declare const WithoutPreviewHidesSteps: Story;
23
+ /** The process in each place it's allowed: in a chat message while thinking, and above the answer in a thread. */
24
+ export declare const Examples: Story;
25
+ interface ChatThinkingProcessPlaygroundProps extends Omit<ChatThinkingProcessProps, 'children'>, Pick<ChatThinkingProcessContentProps, 'itemsClassName' | 'rowClassName' | 'markerClassName' | 'connectorClassName' | 'previewClassName' | 'hasLastMessagePreview'> {
26
+ label: string;
27
+ icon: ReactNode;
28
+ stepCount: number;
29
+ hasArrow: boolean;
30
+ }
31
+ declare function ChatThinkingProcessPlayground({ label, icon, stepCount, itemsClassName, rowClassName, markerClassName, connectorClassName, previewClassName, defaultOpen, hasArrow, hasLastMessagePreview, ...rest }: ChatThinkingProcessPlaygroundProps): import('react').JSX.Element;
32
+ /** Every part at once, with each part and prop of the root and the content on the Controls panel. */
33
+ export declare const Playground: StoryObj<typeof ChatThinkingProcessPlayground>;
10
34
  //# sourceMappingURL=chat-thinking-process.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-thinking-process.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAO5D,OAAO,EACL,mBAAmB,EAOpB,MAAM,yBAAyB,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,mBAAmB,CAgE1C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAElD,eAAO,MAAM,OAAO,EAAE,KAiBrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAiB5B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAiBvB,CAAC;AAwCF,eAAO,MAAM,oBAAoB,EAAE,KAoBlC,CAAC"}
1
+ {"version":3,"file":"chat-thinking-process.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thinking-process/chat-thinking-process.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBvC,OAAO,EACL,mBAAmB,EAOnB,KAAK,+BAA+B,EACpC,KA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AAE,kCAAkC,+BAwBpC;AAED,qGAAqG;AACrG,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,6BAA6B,CA+DrE,CAAC"}
@@ -16,7 +16,7 @@ export declare function useChatThread(): ChatThreadCommands;
16
16
  */
17
17
  export type ChatThreadScrollMode = 'anchor' | 'follow';
18
18
  type ScrollerProviderProps = ComponentProps<typeof MessageScrollerPrimitive.Provider>;
19
- export type ChatThreadProviderProps = ScrollerProviderProps & {
19
+ export interface ChatThreadProviderProps extends ScrollerProviderProps {
20
20
  /** Identity of the conversation; changing it resets the thread so the new conversation opens at the end */
21
21
  conversationId?: string | null;
22
22
  /** Ids of the rendered groups, matching each `ChatThreadGroup`'s `groupId` */
@@ -31,16 +31,25 @@ export type ChatThreadProviderProps = ScrollerProviderProps & {
31
31
  * drags the view down; in `follow` mode it defaults to always following.
32
32
  */
33
33
  autoScroll?: boolean;
34
- };
34
+ }
35
+ /**
36
+ * Holds the scroll session of one conversation: which groups are history and which are new, the scroll
37
+ * mode, and the scroll commands `useChatThread` returns. Renders no element; wrap `ChatThread` and
38
+ * anything that scrolls it.
39
+ */
35
40
  export declare function ChatThreadProvider({ children, conversationId, groupIds, isStreaming, scrollMode, autoScroll, defaultScrollPosition, scrollPreviousItemPeek, scrollMargin, ...rest }: ChatThreadProviderProps): import('react').JSX.Element;
36
41
  export type ChatThreadError = Error | string;
37
42
  export interface ChatThreadProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
38
43
  children?: ReactNode;
44
+ /** Classes on the scrolling viewport, the element between the root and the content */
45
+ viewportClassName?: string;
46
+ /** Classes on the scrolled content: its padding and the gap between groups */
39
47
  contentClassName?: string;
40
48
  viewportRef?: Ref<HTMLDivElement>;
41
49
  contentRef?: Ref<HTMLDivElement>;
42
50
  /** Renders the scroll-to-latest button */
43
51
  scrollButton?: boolean;
52
+ /** Classes on the wrapper that positions the scroll-to-latest button */
44
53
  scrollButtonClassName?: string;
45
54
  scrollButtonTooltip?: string;
46
55
  isLoading?: boolean;
@@ -49,6 +58,10 @@ export interface ChatThreadProps extends Omit<ComponentPropsWithoutRef<'div'>, '
49
58
  /** Replaces the built-in error message */
50
59
  renderError?: (error?: ChatThreadError) => ReactNode;
51
60
  }
61
+ /**
62
+ * The scroller of a conversation: a viewport that scrolls the groups, the scroll-to-latest button and
63
+ * the error state. Fills its parent, so the parent needs a definite height.
64
+ */
52
65
  export declare const ChatThread: import('react').ForwardRefExoticComponent<ChatThreadProps & import('react').RefAttributes<HTMLDivElement>>;
53
66
  export interface ChatThreadGroupProps extends ComponentPropsWithoutRef<'div'> {
54
67
  groupId: string;
@@ -62,7 +75,9 @@ export declare const ChatThreadGroup: import('react').ForwardRefExoticComponent<
62
75
  export interface ChatThreadMessageProps extends ComponentPropsWithoutRef<'div'> {
63
76
  messageId: string;
64
77
  }
78
+ /** Marks the question of a group with its message id. Adds no styling. */
65
79
  export declare const ChatThreadQuestion: import('react').ForwardRefExoticComponent<ChatThreadMessageProps & import('react').RefAttributes<HTMLDivElement>>;
80
+ /** Marks the answer of a group with its message id. Adds no styling. */
66
81
  export declare const ChatThreadAnswer: import('react').ForwardRefExoticComponent<ChatThreadMessageProps & import('react').RefAttributes<HTMLDivElement>>;
67
82
  export interface ChatThreadErrorStateProps {
68
83
  children?: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-thread.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thread/chat-thread.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,IAAI,wBAAwB,EAC3C,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EASL,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAG7B,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAiDf,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAUvE;;;GAGG;AACH,wBAAgB,aAAa,IAAI,kBAAk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M,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,eAAe,KAAK,SAAS,CAAC;CACtD;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,4GAqGrB,CAAC;AAmDH,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAC3E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,iHAoB3B,CAAC;AAIF,MAAM,WAAW,sBAAuB,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IAC7E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,mHAc9B,CAAC;AAIF,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,mHAc5B,CAAC;AA0DF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,yBAAyB,+BAiB7F;AAED,OAAO,EAAE,4BAA4B,IAAI,uBAAuB,EAAE,CAAC"}
@@ -1,14 +1,79 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-vite';
2
- import { ChatThreadProviderProps } from './chat-thread';
3
- type TranscriptProps = Omit<ChatThreadProviderProps, 'conversationId' | 'groupIds'> & {
4
- initialTurns?: number;
5
- scrollButton?: boolean;
6
- hasError?: boolean;
7
- };
8
- declare function Transcript({ initialTurns, scrollButton, hasError, ...providerProps }: TranscriptProps): import('react').JSX.Element;
9
- declare const meta: Meta<typeof Transcript>;
2
+ import { ChatThread, ChatThreadProviderProps, ChatThreadScrollMode } from './chat-thread';
3
+ declare const meta: Meta<typeof ChatThread>;
10
4
  export default meta;
11
- type Story = StoryObj<typeof Transcript>;
5
+ type Story = StoryObj<typeof ChatThread>;
6
+ /** A loaded conversation: it opens at the latest message, and every group it opens with counts as history. */
12
7
  export declare const Default: Story;
13
- export declare const Playground: Story;
8
+ /**
9
+ * The default `anchor` mode. Ask a question: it settles at the top of the thread and its answer
10
+ * streams in below without the scroll position moving, so the answer reads from its start.
11
+ */
12
+ export declare const Streaming: Story;
13
+ /** Asks the next question and checks that it settles at the top while its answer streams in below. */
14
+ export declare const StreamingAnchorsQuestion: Story;
15
+ /**
16
+ * `scrollMode="follow"` for an agent run. Run a step: new output is added at the bottom and the
17
+ * view stays on it, like a terminal. Scroll up while it runs and the view stops following.
18
+ */
19
+ export declare const FollowMode: Story;
20
+ /** Runs the next step and checks that the view stays on the newest output as lines arrive. */
21
+ export declare const FollowModeFollowsOutput: Story;
22
+ /**
23
+ * The scroll-to-latest button, visible here because the conversation opens at its start
24
+ * (`defaultScrollPosition="start"`). It shows only while there is content below the viewport.
25
+ */
26
+ export declare const ScrollButton: Story;
27
+ /** Clicks the scroll-to-latest button and checks that the thread reaches its end and the button goes. */
28
+ export declare const ScrollButtonReturnsToLatest: Story;
29
+ /**
30
+ * Changing `conversationId` starts a new session: the other conversation's groups count as history
31
+ * and it opens at its latest message, instead of its groups being treated as new questions.
32
+ */
33
+ export declare const SwitchConversation: Story;
34
+ /** Opens the other conversation and checks that it loads as history, at its latest message. */
35
+ export declare const SwitchConversationOpensAtEnd: Story;
36
+ /**
37
+ * `useChatThread` gives any component inside the provider the scroll commands: to the start, to
38
+ * one group, or to the latest message.
39
+ */
40
+ export declare const ScrollCommands: Story;
41
+ /** Drives the three scroll commands from outside the thread: the start, one group, the latest. */
42
+ export declare const ScrollCommandsMoveTheThread: Story;
43
+ /** The built-in error state: `hasError` covers the thread with the `error` text, announced as an alert. */
44
+ export declare const ErrorState: Story;
45
+ interface RecoverableThreadProps {
46
+ onRetry: () => void;
47
+ }
48
+ declare function RecoverableThread({ onRetry }: RecoverableThreadProps): import('react').JSX.Element;
49
+ /**
50
+ * `renderError` replaces the error text with an error banner that says what failed and offers a
51
+ * way forward. "Try again" loads the conversation.
52
+ */
53
+ export declare const CustomError: StoryObj<typeof RecoverableThread>;
54
+ /** Retries from the error banner and checks that the alert goes and the conversation loads. */
55
+ export declare const CustomErrorRetry: StoryObj<typeof RecoverableThread>;
56
+ /** The thread in each place it's allowed: a canvas shell, a side panel, a chat page and an agent panel. */
57
+ export declare const Examples: Story;
58
+ interface ChatThreadPlaygroundProps {
59
+ turnCount: number;
60
+ scrollMode: ChatThreadScrollMode;
61
+ isStreaming: boolean;
62
+ autoScroll?: boolean;
63
+ defaultScrollPosition: NonNullable<ChatThreadProviderProps['defaultScrollPosition']>;
64
+ scrollMargin: number;
65
+ scrollPreviousItemPeek: number;
66
+ scrollEdgeThreshold: number;
67
+ scrollButton: boolean;
68
+ scrollButtonTooltip: string;
69
+ isLoading: boolean;
70
+ hasError: boolean;
71
+ error: string;
72
+ }
73
+ declare function ChatThreadPlayground({ turnCount, scrollButton, scrollButtonTooltip, isLoading, hasError, error, ...providerProps }: ChatThreadPlaygroundProps): import('react').JSX.Element;
74
+ /**
75
+ * Every scroll setting on the controls panel. Send a question, then add to its answer one chunk at
76
+ * a time with `isStreaming` on or off, to see what each setting does to the scroll position.
77
+ */
78
+ export declare const Playground: StoryObj<typeof ChatThreadPlayground>;
14
79
  //# sourceMappingURL=chat-thread.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-thread.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chat-thread/chat-thread.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAML,KAAK,uBAAuB,EAC7B,MAAM,eAAe,CAAC;AAuBvB,KAAK,eA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AAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,aAAa,EACjB,EAAE,yBAAyB,+BAwE3B;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,oBAAoB,CAiF5D,CAAC"}
@@ -8,7 +8,6 @@ export * from './chat-message';
8
8
  export * from './chat-messages';
9
9
  export * from './chat-message-attachment-card';
10
10
  export * from './chat-message-response';
11
- export * from './chat-message-history';
12
11
  export * from './chat-message-toolbar';
13
12
  export * from './chat-notification-card';
14
13
  export * from './chat-notification-popup';
@@ -16,12 +15,11 @@ export * from './chat-reply';
16
15
  export * from './chat-suggestion';
17
16
  export * from './chat-thread';
18
17
  export * from './canvas-shell';
19
- export * from './card-item-picker';
20
18
  export * from './new-chat-trigger';
21
19
  export * from './chat-thinking-process';
22
20
  export * from './deprecated-empty-state';
23
21
  export * from './markdown-viewer';
24
22
  export * from './rich-text-area';
25
23
  export * from './rich-text-field';
26
- export * from './spinner';
24
+ export * from './topmenu';
27
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
@@ -1,10 +1,17 @@
1
1
  import { Markdown } from '../../types';
2
2
  import { CustomMarkdownViewerComponents } from './types';
3
3
  export interface MarkdownViewerProps {
4
+ /** The full markdown received so far: GFM, math and `<swi-*>` tags. */
4
5
  markdown: Markdown;
6
+ /** Classes merged last onto the root element, e.g. `text-text-secondary` or a different block gap. */
7
+ className?: string;
8
+ /** Set while the text is still arriving: animates the last block and shows the caret. */
5
9
  isStreaming?: boolean;
10
+ /** Shows a block caret after the last character while `isStreaming` is true. */
6
11
  hasCaret?: boolean;
12
+ /** Renderers keyed by tag name: `<swi-*>` tags, or overrides for standard markdown elements. */
7
13
  customComponents?: CustomMarkdownViewerComponents;
8
14
  }
9
- export declare function MarkdownViewer({ markdown, isStreaming, hasCaret, customComponents, }: MarkdownViewerProps): import('react').JSX.Element;
15
+ /** Renders markdown through Streamdown, repairing half-received syntax and `<swi-*>` tags as it streams. */
16
+ export declare function MarkdownViewer({ markdown, className, isStreaming, hasCaret, customComponents, }: MarkdownViewerProps): import('react').JSX.Element;
10
17
  //# sourceMappingURL=markdown-viewer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-viewer.d.ts","sourceRoot":"","sources":["../../../src/components/markdown-viewer/markdown-viewer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,0BAA0B,CAAC;AAElC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;CACnD;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,WAAmB,EACnB,QAAgB,EAChB,gBAAqB,GACtB,EAAE,mBAAmB,+BAwBrB"}
1
+ {"version":3,"file":"markdown-viewer.d.ts","sourceRoot":"","sources":["../../../src/components/markdown-viewer/markdown-viewer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,0BAA0B,CAAC;AAElC,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,QAAQ,EAAE,QAAQ,CAAC;IACnB,sGAAsG;IACtG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gGAAgG;IAChG,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;CACnD;AAED,4GAA4G;AAC5G,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAS,EACT,WAAmB,EACnB,QAAgB,EAChB,gBAAqB,GACtB,EAAE,mBAAmB,+BAyBrB"}
@@ -1,9 +1,26 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-vite';
2
- import { MarkdownViewer } from './markdown-viewer';
2
+ import { MarkdownViewer, MarkdownViewerProps } from './markdown-viewer';
3
3
  declare const meta: Meta<typeof MarkdownViewer>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof MarkdownViewer>;
6
+ /** A finished assistant answer: a lead-in line and a list with inline emphasis. */
6
7
  export declare const Default: Story;
8
+ /** A `<swi-reply>` tag rendered by the app's own component, and an unknown `<swi-*>` tag reduced to its text. */
7
9
  export declare const CustomComponents: Story;
10
+ /** The greeting arriving character by character, with the caret after the last one until the stream ends. */
8
11
  export declare const Streaming: Story;
12
+ /** The viewer where it is allowed: the content of an assistant message, alone and in a chat thread. */
13
+ export declare const Examples: Story;
14
+ /** A stream cut off inside a `<swi-reply>` tag still renders the suggestions received so far. */
15
+ export declare const StreamCutInsideTag: Story;
16
+ /** A stream cut off inside the opening `<swi-reply` tag prints none of the half-received tag. */
17
+ export declare const StreamCutInsideOpeningTag: Story;
18
+ /** A `swisper:` link survives sanitising and renders as a plain link, like a web link. */
19
+ export declare const AppLink: Story;
20
+ interface MarkdownViewerPlaygroundProps extends Omit<MarkdownViewerProps, 'customComponents'> {
21
+ hasReplySuggestions: boolean;
22
+ }
23
+ declare function MarkdownViewerPlayground({ hasReplySuggestions, ...viewerProps }: MarkdownViewerPlaygroundProps): import('react').JSX.Element;
24
+ /** Every prop on the Controls panel, starting from a long answer that ends in reply suggestions. */
25
+ export declare const Playground: StoryObj<typeof MarkdownViewerPlayground>;
9
26
  //# sourceMappingURL=markdown-viewer.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-viewer.stories.d.ts","sourceRoot":"","sources":["../../../src/components/markdown-viewer/markdown-viewer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAqCrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAU7C,eAAO,MAAM,OAAO,EAAE,KAerB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KA2B9B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAMvB,CAAC"}
1
+ {"version":3,"file":"markdown-viewer.stories.d.ts","sourceRoot":"","sources":["../../../src/components/markdown-viewer/markdown-viewer.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAoB5D,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAG7E,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAyCrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,mFAAmF;AACnF,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AA0CjC,iHAAiH;AACjH,eAAO,MAAM,gBAAgB,EAAE,KAsB9B,CAAC;AAEF,6GAA6G;AAC7G,eAAO,MAAM,SAAS,EAAE,KAcvB,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,kBAAkB,EAAE,KAoBhC,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,yBAAyB,EAAE,KAevC,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,OAAO,EAAE,KAiBrB,CAAC;AAEF,UAAU,6BAA8B,SAAQ,IAAI,CAAC,mBAAmB,EAAE,kBAAkB,CAAC;IAC3F,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,iBAAS,wBAAwB,CAAC,EAChC,mBAAmB,EACnB,GAAG,WAAW,EACf,EAAE,6BAA6B,+BAO/B;AAED,oGAAoG;AACpG,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,OAAO,wBAAwB,CAiBhE,CAAC"}
@@ -2,19 +2,36 @@ import { InitialConfigType } from '@lexical/react/LexicalComposer';
2
2
  import { KeyboardEvent, ReactNode } from 'react';
3
3
  export declare const INITIAL_CONFIG: InitialConfigType;
4
4
  export interface RichTextAreaProps {
5
+ /** Extra Lexical plugins. They render inside the composer, after the built-in ones. */
5
6
  children?: ReactNode;
7
+ /** Written to the editable element as `data-name`. It does not create a form field. */
6
8
  name?: string;
9
+ /** Controlled content, in the format `source` sets. `''` clears the editor. */
7
10
  value?: string;
11
+ /** Format of `value` and of what `onChange` returns. Defaults to `markdown`. */
8
12
  source?: 'html' | 'markdown';
13
+ /** Classes for the editable element (`data-slot="rich-text-area-editable"`), not the root. */
9
14
  className?: string;
15
+ /** Classes for the root wrapper (`data-slot="rich-text-area"`). */
10
16
  containerClassName?: string;
17
+ /** Classes for the placeholder (`data-slot="rich-text-area-placeholder"`). */
11
18
  placeholderClassName?: string;
19
+ /** Hint shown while the editor is empty. It is not the editor's accessible name. */
12
20
  placeholder?: string;
21
+ /** Makes the editor non-editable and dims it; the root gets `data-disabled="true"`. */
13
22
  isDisabled?: boolean;
23
+ /** Called with the whole content, serialised as `source`, on every edit. */
14
24
  onChange?: (value: string) => void;
25
+ /** Called when focus leaves the editable element. */
15
26
  onBlur?: () => void;
27
+ /** Runs in the capture phase, before Lexical handles the key, so it can prevent `Enter`. */
16
28
  onKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => void;
29
+ /** Called with `true` when the editable element gains focus and `false` when it loses it. */
17
30
  onFocusChange?: (isFocused: boolean) => void;
18
31
  }
32
+ /**
33
+ * Toolbar-less Lexical editor whose value is Markdown or HTML. The ref exposes only `focus()`.
34
+ * Pass extra Lexical plugins as children.
35
+ */
19
36
  export declare const RichTextArea: import('react').ForwardRefExoticComponent<RichTextAreaProps & import('react').RefAttributes<HTMLInputElement>>;
20
37
  //# sourceMappingURL=rich-text-area.d.ts.map