@swisper.ai/web-chat-ui 0.0.2

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 (609) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +251 -0
  3. package/dist/components/canvas-shell/canvas-shell.d.ts +64 -0
  4. package/dist/components/canvas-shell/canvas-shell.d.ts.map +1 -0
  5. package/dist/components/canvas-shell/canvas-shell.stories.d.ts +26 -0
  6. package/dist/components/canvas-shell/canvas-shell.stories.d.ts.map +1 -0
  7. package/dist/components/canvas-shell/index.d.ts +2 -0
  8. package/dist/components/canvas-shell/index.d.ts.map +1 -0
  9. package/dist/components/card-item-picker/card-item-picker-context.d.ts +21 -0
  10. package/dist/components/card-item-picker/card-item-picker-context.d.ts.map +1 -0
  11. package/dist/components/card-item-picker/card-item-picker-list.d.ts +24 -0
  12. package/dist/components/card-item-picker/card-item-picker-list.d.ts.map +1 -0
  13. package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts +28 -0
  14. package/dist/components/card-item-picker/card-item-picker-row-parts.d.ts.map +1 -0
  15. package/dist/components/card-item-picker/card-item-picker-row.d.ts +12 -0
  16. package/dist/components/card-item-picker/card-item-picker-row.d.ts.map +1 -0
  17. package/dist/components/card-item-picker/card-item-picker.stories.d.ts +19 -0
  18. package/dist/components/card-item-picker/card-item-picker.stories.d.ts.map +1 -0
  19. package/dist/components/card-item-picker/index.d.ts +9 -0
  20. package/dist/components/card-item-picker/index.d.ts.map +1 -0
  21. package/dist/components/chat-card/chat-card.d.ts +4 -0
  22. package/dist/components/chat-card/chat-card.d.ts.map +1 -0
  23. package/dist/components/chat-card/chat-card.stories.d.ts +11 -0
  24. package/dist/components/chat-card/chat-card.stories.d.ts.map +1 -0
  25. package/dist/components/chat-card/components/chat-card-body.d.ts +22 -0
  26. package/dist/components/chat-card/components/chat-card-body.d.ts.map +1 -0
  27. package/dist/components/chat-card/components/chat-card-footer.d.ts +20 -0
  28. package/dist/components/chat-card/components/chat-card-footer.d.ts.map +1 -0
  29. package/dist/components/chat-card/components/chat-card-form.d.ts +28 -0
  30. package/dist/components/chat-card/components/chat-card-form.d.ts.map +1 -0
  31. package/dist/components/chat-card/components/chat-card-header.d.ts +36 -0
  32. package/dist/components/chat-card/components/chat-card-header.d.ts.map +1 -0
  33. package/dist/components/chat-card/components/index.d.ts +5 -0
  34. package/dist/components/chat-card/components/index.d.ts.map +1 -0
  35. package/dist/components/chat-card/context.d.ts +13 -0
  36. package/dist/components/chat-card/context.d.ts.map +1 -0
  37. package/dist/components/chat-card/contexts.d.ts +16 -0
  38. package/dist/components/chat-card/contexts.d.ts.map +1 -0
  39. package/dist/components/chat-card/hooks.d.ts +13 -0
  40. package/dist/components/chat-card/hooks.d.ts.map +1 -0
  41. package/dist/components/chat-card/index.d.ts +6 -0
  42. package/dist/components/chat-card/index.d.ts.map +1 -0
  43. package/dist/components/chat-card/types.d.ts +21 -0
  44. package/dist/components/chat-card/types.d.ts.map +1 -0
  45. package/dist/components/chat-card-container/chat-card-container.d.ts +43 -0
  46. package/dist/components/chat-card-container/chat-card-container.d.ts.map +1 -0
  47. package/dist/components/chat-card-container/chat-card-container.stories.d.ts +17 -0
  48. package/dist/components/chat-card-container/chat-card-container.stories.d.ts.map +1 -0
  49. package/dist/components/chat-card-container/index.d.ts +3 -0
  50. package/dist/components/chat-card-container/index.d.ts.map +1 -0
  51. package/dist/components/chat-container/chat-container.d.ts +51 -0
  52. package/dist/components/chat-container/chat-container.d.ts.map +1 -0
  53. package/dist/components/chat-container/chat-container.stories.d.ts +21 -0
  54. package/dist/components/chat-container/chat-container.stories.d.ts.map +1 -0
  55. package/dist/components/chat-container/index.d.ts +3 -0
  56. package/dist/components/chat-container/index.d.ts.map +1 -0
  57. package/dist/components/chat-input/chat-input.d.ts +35 -0
  58. package/dist/components/chat-input/chat-input.d.ts.map +1 -0
  59. package/dist/components/chat-input/chat-input.stories.d.ts +14 -0
  60. package/dist/components/chat-input/chat-input.stories.d.ts.map +1 -0
  61. package/dist/components/chat-input/index.d.ts +3 -0
  62. package/dist/components/chat-input/index.d.ts.map +1 -0
  63. package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts +8 -0
  64. package/dist/components/chat-input/plugins/auto-focus-plugin.d.ts.map +1 -0
  65. package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts +6 -0
  66. package/dist/components/chat-input/plugins/controlled-value-plugin.d.ts.map +1 -0
  67. package/dist/components/chat-input/plugins/disabled-plugin.d.ts +7 -0
  68. package/dist/components/chat-input/plugins/disabled-plugin.d.ts.map +1 -0
  69. package/dist/components/chat-input/plugins/focus-plugin.d.ts +6 -0
  70. package/dist/components/chat-input/plugins/focus-plugin.d.ts.map +1 -0
  71. package/dist/components/chat-input/plugins/has-value-plugin.d.ts +6 -0
  72. package/dist/components/chat-input/plugins/has-value-plugin.d.ts.map +1 -0
  73. package/dist/components/chat-input/plugins/hooks.d.ts +2 -0
  74. package/dist/components/chat-input/plugins/hooks.d.ts.map +1 -0
  75. package/dist/components/chat-input/plugins/index.d.ts +8 -0
  76. package/dist/components/chat-input/plugins/index.d.ts.map +1 -0
  77. package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts +2 -0
  78. package/dist/components/chat-input/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
  79. package/dist/components/chat-input/plugins/utils.d.ts +4 -0
  80. package/dist/components/chat-input/plugins/utils.d.ts.map +1 -0
  81. package/dist/components/chat-input/plugins/value-plugin.d.ts +6 -0
  82. package/dist/components/chat-input/plugins/value-plugin.d.ts.map +1 -0
  83. package/dist/components/chat-input/transformers.d.ts +3 -0
  84. package/dist/components/chat-input/transformers.d.ts.map +1 -0
  85. package/dist/components/chat-list/chat-list-item.d.ts +8 -0
  86. package/dist/components/chat-list/chat-list-item.d.ts.map +1 -0
  87. package/dist/components/chat-list/chat-list-items.d.ts +11 -0
  88. package/dist/components/chat-list/chat-list-items.d.ts.map +1 -0
  89. package/dist/components/chat-list/chat-list.d.ts +63 -0
  90. package/dist/components/chat-list/chat-list.d.ts.map +1 -0
  91. package/dist/components/chat-list/chat-list.stories.d.ts +13 -0
  92. package/dist/components/chat-list/chat-list.stories.d.ts.map +1 -0
  93. package/dist/components/chat-list/index.d.ts +4 -0
  94. package/dist/components/chat-list/index.d.ts.map +1 -0
  95. package/dist/components/chat-message/chat-message.d.ts +17 -0
  96. package/dist/components/chat-message/chat-message.d.ts.map +1 -0
  97. package/dist/components/chat-message/chat-message.stories.d.ts +11 -0
  98. package/dist/components/chat-message/chat-message.stories.d.ts.map +1 -0
  99. package/dist/components/chat-message/index.d.ts +2 -0
  100. package/dist/components/chat-message/index.d.ts.map +1 -0
  101. package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts +9 -0
  102. package/dist/components/chat-message-attachment-card/chat-message-attachment-card-icon.d.ts.map +1 -0
  103. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts +30 -0
  104. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.d.ts.map +1 -0
  105. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts +11 -0
  106. package/dist/components/chat-message-attachment-card/chat-message-attachment-card.stories.d.ts.map +1 -0
  107. package/dist/components/chat-message-attachment-card/index.d.ts +4 -0
  108. package/dist/components/chat-message-attachment-card/index.d.ts.map +1 -0
  109. package/dist/components/chat-message-attachment-card/utils.d.ts +5 -0
  110. package/dist/components/chat-message-attachment-card/utils.d.ts.map +1 -0
  111. package/dist/components/chat-message-history/chat-message-history.d.ts +48 -0
  112. package/dist/components/chat-message-history/chat-message-history.d.ts.map +1 -0
  113. package/dist/components/chat-message-history/chat-message-history.stories.d.ts +7 -0
  114. package/dist/components/chat-message-history/chat-message-history.stories.d.ts.map +1 -0
  115. package/dist/components/chat-message-history/index.d.ts +2 -0
  116. package/dist/components/chat-message-history/index.d.ts.map +1 -0
  117. package/dist/components/chat-message-response/chat-message-response.d.ts +7 -0
  118. package/dist/components/chat-message-response/chat-message-response.d.ts.map +1 -0
  119. package/dist/components/chat-message-response/chat-message-response.stories.d.ts +7 -0
  120. package/dist/components/chat-message-response/chat-message-response.stories.d.ts.map +1 -0
  121. package/dist/components/chat-message-response/index.d.ts +2 -0
  122. package/dist/components/chat-message-response/index.d.ts.map +1 -0
  123. package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts +25 -0
  124. package/dist/components/chat-message-toolbar/chat-message-toolbar.d.ts.map +1 -0
  125. package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts +7 -0
  126. package/dist/components/chat-message-toolbar/chat-message-toolbar.stories.d.ts.map +1 -0
  127. package/dist/components/chat-message-toolbar/index.d.ts +2 -0
  128. package/dist/components/chat-message-toolbar/index.d.ts.map +1 -0
  129. package/dist/components/chat-messages/chat-messages.d.ts +24 -0
  130. package/dist/components/chat-messages/chat-messages.d.ts.map +1 -0
  131. package/dist/components/chat-messages/chat-messages.stories.d.ts +8 -0
  132. package/dist/components/chat-messages/chat-messages.stories.d.ts.map +1 -0
  133. package/dist/components/chat-messages/index.d.ts +2 -0
  134. package/dist/components/chat-messages/index.d.ts.map +1 -0
  135. package/dist/components/chat-notification-card/chat-notification-card.d.ts +114 -0
  136. package/dist/components/chat-notification-card/chat-notification-card.d.ts.map +1 -0
  137. package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts +10 -0
  138. package/dist/components/chat-notification-card/chat-notification-card.stories.d.ts.map +1 -0
  139. package/dist/components/chat-notification-card/index.d.ts +4 -0
  140. package/dist/components/chat-notification-card/index.d.ts.map +1 -0
  141. package/dist/components/chat-notification-card/types.d.ts +2 -0
  142. package/dist/components/chat-notification-card/types.d.ts.map +1 -0
  143. package/dist/components/chat-notification-card/utils.d.ts +3 -0
  144. package/dist/components/chat-notification-card/utils.d.ts.map +1 -0
  145. package/dist/components/chat-notification-popup/chat-notification-popup.d.ts +12 -0
  146. package/dist/components/chat-notification-popup/chat-notification-popup.d.ts.map +1 -0
  147. package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts +8 -0
  148. package/dist/components/chat-notification-popup/chat-notification-popup.stories.d.ts.map +1 -0
  149. package/dist/components/chat-notification-popup/index.d.ts +2 -0
  150. package/dist/components/chat-notification-popup/index.d.ts.map +1 -0
  151. package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts +17 -0
  152. package/dist/components/chat-prompt-box/chat-prompt-box-context.d.ts.map +1 -0
  153. package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts +2 -0
  154. package/dist/components/chat-prompt-box/chat-prompt-box-focus-plugin.d.ts.map +1 -0
  155. package/dist/components/chat-prompt-box/chat-prompt-box.d.ts +27 -0
  156. package/dist/components/chat-prompt-box/chat-prompt-box.d.ts.map +1 -0
  157. package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts +9 -0
  158. package/dist/components/chat-prompt-box/chat-prompt-box.stories.d.ts.map +1 -0
  159. package/dist/components/chat-prompt-box/index.d.ts +3 -0
  160. package/dist/components/chat-prompt-box/index.d.ts.map +1 -0
  161. package/dist/components/chat-reply/chat-reply.d.ts +23 -0
  162. package/dist/components/chat-reply/chat-reply.d.ts.map +1 -0
  163. package/dist/components/chat-reply/chat-reply.stories.d.ts +7 -0
  164. package/dist/components/chat-reply/chat-reply.stories.d.ts.map +1 -0
  165. package/dist/components/chat-reply/index.d.ts +2 -0
  166. package/dist/components/chat-reply/index.d.ts.map +1 -0
  167. package/dist/components/chat-suggestion/chat-suggestion.d.ts +37 -0
  168. package/dist/components/chat-suggestion/chat-suggestion.d.ts.map +1 -0
  169. package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts +9 -0
  170. package/dist/components/chat-suggestion/chat-suggestion.stories.d.ts.map +1 -0
  171. package/dist/components/chat-suggestion/index.d.ts +2 -0
  172. package/dist/components/chat-suggestion/index.d.ts.map +1 -0
  173. package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +47 -0
  174. package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -0
  175. package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +10 -0
  176. package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -0
  177. package/dist/components/chat-thinking-process/index.d.ts +2 -0
  178. package/dist/components/chat-thinking-process/index.d.ts.map +1 -0
  179. package/dist/components/chat-thread/chat-thread.d.ts +78 -0
  180. package/dist/components/chat-thread/chat-thread.d.ts.map +1 -0
  181. package/dist/components/chat-thread/chat-thread.stories.d.ts +14 -0
  182. package/dist/components/chat-thread/chat-thread.stories.d.ts.map +1 -0
  183. package/dist/components/chat-thread/index.d.ts +2 -0
  184. package/dist/components/chat-thread/index.d.ts.map +1 -0
  185. package/dist/components/deprecated-empty-state.d.ts +22 -0
  186. package/dist/components/deprecated-empty-state.d.ts.map +1 -0
  187. package/dist/components/index.d.ts +27 -0
  188. package/dist/components/index.d.ts.map +1 -0
  189. package/dist/components/markdown-viewer/hooks.d.ts +9 -0
  190. package/dist/components/markdown-viewer/hooks.d.ts.map +1 -0
  191. package/dist/components/markdown-viewer/index.d.ts +3 -0
  192. package/dist/components/markdown-viewer/index.d.ts.map +1 -0
  193. package/dist/components/markdown-viewer/markdown-viewer.d.ts +10 -0
  194. package/dist/components/markdown-viewer/markdown-viewer.d.ts.map +1 -0
  195. package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts +9 -0
  196. package/dist/components/markdown-viewer/markdown-viewer.stories.d.ts.map +1 -0
  197. package/dist/components/markdown-viewer/types.d.ts +9 -0
  198. package/dist/components/markdown-viewer/types.d.ts.map +1 -0
  199. package/dist/components/markdown-viewer/utils.d.ts +3 -0
  200. package/dist/components/markdown-viewer/utils.d.ts.map +1 -0
  201. package/dist/components/new-chat-trigger/index.d.ts +2 -0
  202. package/dist/components/new-chat-trigger/index.d.ts.map +1 -0
  203. package/dist/components/new-chat-trigger/new-chat-trigger.d.ts +8 -0
  204. package/dist/components/new-chat-trigger/new-chat-trigger.d.ts.map +1 -0
  205. package/dist/components/rich-text-area/constants/index.d.ts +3 -0
  206. package/dist/components/rich-text-area/constants/index.d.ts.map +1 -0
  207. package/dist/components/rich-text-area/hooks.d.ts +3 -0
  208. package/dist/components/rich-text-area/hooks.d.ts.map +1 -0
  209. package/dist/components/rich-text-area/html-config.d.ts +4 -0
  210. package/dist/components/rich-text-area/html-config.d.ts.map +1 -0
  211. package/dist/components/rich-text-area/index.d.ts +7 -0
  212. package/dist/components/rich-text-area/index.d.ts.map +1 -0
  213. package/dist/components/rich-text-area/nodes/div-block-node.d.ts +18 -0
  214. package/dist/components/rich-text-area/nodes/div-block-node.d.ts.map +1 -0
  215. package/dist/components/rich-text-area/nodes/image-node.d.ts +24 -0
  216. package/dist/components/rich-text-area/nodes/image-node.d.ts.map +1 -0
  217. package/dist/components/rich-text-area/plugins/blur-plugin.d.ts +6 -0
  218. package/dist/components/rich-text-area/plugins/blur-plugin.d.ts.map +1 -0
  219. package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts +7 -0
  220. package/dist/components/rich-text-area/plugins/controlled-plugin.d.ts.map +1 -0
  221. package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts +7 -0
  222. package/dist/components/rich-text-area/plugins/controlled-value-plugin.d.ts.map +1 -0
  223. package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts +6 -0
  224. package/dist/components/rich-text-area/plugins/disabled-plugin.d.ts.map +1 -0
  225. package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts +10 -0
  226. package/dist/components/rich-text-area/plugins/file-attachment-plugin.d.ts.map +1 -0
  227. package/dist/components/rich-text-area/plugins/focus-plugin.d.ts +6 -0
  228. package/dist/components/rich-text-area/plugins/focus-plugin.d.ts.map +1 -0
  229. package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts +19 -0
  230. package/dist/components/rich-text-area/plugins/html-paste-plugin.d.ts.map +1 -0
  231. package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts +12 -0
  232. package/dist/components/rich-text-area/plugins/image-drop-plugin.d.ts.map +1 -0
  233. package/dist/components/rich-text-area/plugins/index.d.ts +11 -0
  234. package/dist/components/rich-text-area/plugins/index.d.ts.map +1 -0
  235. package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts +2 -0
  236. package/dist/components/rich-text-area/plugins/markdown-plain-paste-plugin.d.ts.map +1 -0
  237. package/dist/components/rich-text-area/plugins/value-plugin.d.ts +7 -0
  238. package/dist/components/rich-text-area/plugins/value-plugin.d.ts.map +1 -0
  239. package/dist/components/rich-text-area/rich-text-area.d.ts +20 -0
  240. package/dist/components/rich-text-area/rich-text-area.d.ts.map +1 -0
  241. package/dist/components/rich-text-area/rich-text-area.stories.d.ts +7 -0
  242. package/dist/components/rich-text-area/rich-text-area.stories.d.ts.map +1 -0
  243. package/dist/components/rich-text-area/styled.d.ts +3 -0
  244. package/dist/components/rich-text-area/styled.d.ts.map +1 -0
  245. package/dist/components/rich-text-area/transformers.d.ts +16 -0
  246. package/dist/components/rich-text-area/transformers.d.ts.map +1 -0
  247. package/dist/components/rich-text-area/types.d.ts +8 -0
  248. package/dist/components/rich-text-area/types.d.ts.map +1 -0
  249. package/dist/components/rich-text-area/utils/index.d.ts +6 -0
  250. package/dist/components/rich-text-area/utils/index.d.ts.map +1 -0
  251. package/dist/components/rich-text-field/components/alignment-select.d.ts +5 -0
  252. package/dist/components/rich-text-field/components/alignment-select.d.ts.map +1 -0
  253. package/dist/components/rich-text-field/components/attachment-button.d.ts +3 -0
  254. package/dist/components/rich-text-field/components/attachment-button.d.ts.map +1 -0
  255. package/dist/components/rich-text-field/components/bold-button.d.ts +3 -0
  256. package/dist/components/rich-text-field/components/bold-button.d.ts.map +1 -0
  257. package/dist/components/rich-text-field/components/clean-format-button.d.ts +3 -0
  258. package/dist/components/rich-text-field/components/clean-format-button.d.ts.map +1 -0
  259. package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts +11 -0
  260. package/dist/components/rich-text-field/components/formatting-toolbar-plugin.d.ts.map +1 -0
  261. package/dist/components/rich-text-field/components/image-button.d.ts +3 -0
  262. package/dist/components/rich-text-field/components/image-button.d.ts.map +1 -0
  263. package/dist/components/rich-text-field/components/index.d.ts +14 -0
  264. package/dist/components/rich-text-field/components/index.d.ts.map +1 -0
  265. package/dist/components/rich-text-field/components/italic-button.d.ts +3 -0
  266. package/dist/components/rich-text-field/components/italic-button.d.ts.map +1 -0
  267. package/dist/components/rich-text-field/components/link-button.d.ts +3 -0
  268. package/dist/components/rich-text-field/components/link-button.d.ts.map +1 -0
  269. package/dist/components/rich-text-field/components/size-select.d.ts +5 -0
  270. package/dist/components/rich-text-field/components/size-select.d.ts.map +1 -0
  271. package/dist/components/rich-text-field/components/text-color-button.d.ts +3 -0
  272. package/dist/components/rich-text-field/components/text-color-button.d.ts.map +1 -0
  273. package/dist/components/rich-text-field/components/toolbar-button.d.ts +6 -0
  274. package/dist/components/rich-text-field/components/toolbar-button.d.ts.map +1 -0
  275. package/dist/components/rich-text-field/components/toolbar-select.d.ts +5 -0
  276. package/dist/components/rich-text-field/components/toolbar-select.d.ts.map +1 -0
  277. package/dist/components/rich-text-field/components/typography-select.d.ts +5 -0
  278. package/dist/components/rich-text-field/components/typography-select.d.ts.map +1 -0
  279. package/dist/components/rich-text-field/components/underline-button.d.ts +3 -0
  280. package/dist/components/rich-text-field/components/underline-button.d.ts.map +1 -0
  281. package/dist/components/rich-text-field/constants.d.ts +57 -0
  282. package/dist/components/rich-text-field/constants.d.ts.map +1 -0
  283. package/dist/components/rich-text-field/context.d.ts +26 -0
  284. package/dist/components/rich-text-field/context.d.ts.map +1 -0
  285. package/dist/components/rich-text-field/index.d.ts +3 -0
  286. package/dist/components/rich-text-field/index.d.ts.map +1 -0
  287. package/dist/components/rich-text-field/rich-text-field.d.ts +17 -0
  288. package/dist/components/rich-text-field/rich-text-field.d.ts.map +1 -0
  289. package/dist/components/rich-text-field/rich-text-field.stories.d.ts +10 -0
  290. package/dist/components/rich-text-field/rich-text-field.stories.d.ts.map +1 -0
  291. package/dist/components/rich-text-field/utils.d.ts +1759 -0
  292. package/dist/components/rich-text-field/utils.d.ts.map +1 -0
  293. package/dist/components/spinner/index.d.ts +2 -0
  294. package/dist/components/spinner/index.d.ts.map +1 -0
  295. package/dist/components/spinner/spinner.d.ts +9 -0
  296. package/dist/components/spinner/spinner.d.ts.map +1 -0
  297. package/dist/components/spinner/spinner.stories.d.ts +8 -0
  298. package/dist/components/spinner/spinner.stories.d.ts.map +1 -0
  299. package/dist/contexts/chat-context/chat-context.d.ts +20 -0
  300. package/dist/contexts/chat-context/chat-context.d.ts.map +1 -0
  301. package/dist/contexts/chat-context/index.d.ts +2 -0
  302. package/dist/contexts/chat-context/index.d.ts.map +1 -0
  303. package/dist/contexts/chat-context/utils.d.ts +3 -0
  304. package/dist/contexts/chat-context/utils.d.ts.map +1 -0
  305. package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts +20 -0
  306. package/dist/contexts/chat-conversation-context/chat-conversation-context.d.ts.map +1 -0
  307. package/dist/contexts/chat-conversation-context/index.d.ts +2 -0
  308. package/dist/contexts/chat-conversation-context/index.d.ts.map +1 -0
  309. package/dist/contexts/index.d.ts +3 -0
  310. package/dist/contexts/index.d.ts.map +1 -0
  311. package/dist/docs/agent.stories.d.ts +41 -0
  312. package/dist/docs/agent.stories.d.ts.map +1 -0
  313. package/dist/docs/chat-panel.d.ts +33 -0
  314. package/dist/docs/chat-panel.d.ts.map +1 -0
  315. package/dist/docs/chatbot-panel.d.ts +20 -0
  316. package/dist/docs/chatbot-panel.d.ts.map +1 -0
  317. package/dist/docs/chatbot.stories.d.ts +11 -0
  318. package/dist/docs/chatbot.stories.d.ts.map +1 -0
  319. package/dist/domain/actions/constants.d.ts +2 -0
  320. package/dist/domain/actions/constants.d.ts.map +1 -0
  321. package/dist/domain/actions/hooks/index.d.ts +3 -0
  322. package/dist/domain/actions/hooks/index.d.ts.map +1 -0
  323. package/dist/domain/actions/index.d.ts +5 -0
  324. package/dist/domain/actions/index.d.ts.map +1 -0
  325. package/dist/domain/actions/types.d.ts +7 -0
  326. package/dist/domain/actions/types.d.ts.map +1 -0
  327. package/dist/domain/actions/utils/index.d.ts +11 -0
  328. package/dist/domain/actions/utils/index.d.ts.map +1 -0
  329. package/dist/domain/index.d.ts +2 -0
  330. package/dist/domain/index.d.ts.map +1 -0
  331. package/dist/hooks/index.d.ts +7 -0
  332. package/dist/hooks/index.d.ts.map +1 -0
  333. package/dist/hooks/use-chat-prompt-placeholder.d.ts +6 -0
  334. package/dist/hooks/use-chat-prompt-placeholder.d.ts.map +1 -0
  335. package/dist/hooks/use-chat-stream-message.d.ts +42 -0
  336. package/dist/hooks/use-chat-stream-message.d.ts.map +1 -0
  337. package/dist/hooks/use-current-chat-id.d.ts +2 -0
  338. package/dist/hooks/use-current-chat-id.d.ts.map +1 -0
  339. package/dist/hooks/use-is-current-chat-new.d.ts +2 -0
  340. package/dist/hooks/use-is-current-chat-new.d.ts.map +1 -0
  341. package/dist/hooks/use-loaded-chat-ids.d.ts +9 -0
  342. package/dist/hooks/use-loaded-chat-ids.d.ts.map +1 -0
  343. package/dist/hooks/use-on-chat-changed.d.ts +9 -0
  344. package/dist/hooks/use-on-chat-changed.d.ts.map +1 -0
  345. package/dist/index.css +2 -0
  346. package/dist/index.d.ts +7 -0
  347. package/dist/index.d.ts.map +1 -0
  348. package/dist/index.es.js +4404 -0
  349. package/dist/index.es.js.map +1 -0
  350. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts +95 -0
  351. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.d.ts.map +1 -0
  352. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts +24 -0
  353. package/dist/layouts/chat-card-list-layout/chat-card-list-layout.stories.d.ts.map +1 -0
  354. package/dist/layouts/chat-card-list-layout/index.d.ts +3 -0
  355. package/dist/layouts/chat-card-list-layout/index.d.ts.map +1 -0
  356. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts +84 -0
  357. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.d.ts.map +1 -0
  358. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts +45 -0
  359. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.d.ts.map +1 -0
  360. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts +37 -0
  361. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.d.ts.map +1 -0
  362. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts +81 -0
  363. package/dist/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.d.ts.map +1 -0
  364. package/dist/layouts/chat-card-three-column-layout/index.d.ts +5 -0
  365. package/dist/layouts/chat-card-three-column-layout/index.d.ts.map +1 -0
  366. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts +31 -0
  367. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.d.ts.map +1 -0
  368. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts +12 -0
  369. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.d.ts.map +1 -0
  370. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts +19 -0
  371. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.d.ts.map +1 -0
  372. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts +35 -0
  373. package/dist/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.d.ts.map +1 -0
  374. package/dist/layouts/chat-card-two-column-layout/index.d.ts +4 -0
  375. package/dist/layouts/chat-card-two-column-layout/index.d.ts.map +1 -0
  376. package/dist/layouts/index.d.ts +4 -0
  377. package/dist/layouts/index.d.ts.map +1 -0
  378. package/dist/types.d.ts +22 -0
  379. package/dist/types.d.ts.map +1 -0
  380. package/dist/utils/use-streaming-markdown.d.ts +18 -0
  381. package/dist/utils/use-streaming-markdown.d.ts.map +1 -0
  382. package/package.json +155 -0
  383. package/src/__tests__/setup.ts +5 -0
  384. package/src/components/canvas-shell/canvas-shell.json +126 -0
  385. package/src/components/canvas-shell/canvas-shell.stories.tsx +194 -0
  386. package/src/components/canvas-shell/canvas-shell.test.tsx +205 -0
  387. package/src/components/canvas-shell/canvas-shell.tsx +250 -0
  388. package/src/components/canvas-shell/index.ts +19 -0
  389. package/src/components/card-item-picker/__tests__/card-item-picker.spec.tsx +279 -0
  390. package/src/components/card-item-picker/card-item-picker-context.tsx +44 -0
  391. package/src/components/card-item-picker/card-item-picker-list.tsx +95 -0
  392. package/src/components/card-item-picker/card-item-picker-row-parts.tsx +96 -0
  393. package/src/components/card-item-picker/card-item-picker-row.tsx +109 -0
  394. package/src/components/card-item-picker/card-item-picker.json +147 -0
  395. package/src/components/card-item-picker/card-item-picker.stories.tsx +158 -0
  396. package/src/components/card-item-picker/index.ts +24 -0
  397. package/src/components/chat-card/__tests__/chat-card.spec.tsx +118 -0
  398. package/src/components/chat-card/chat-card.json +162 -0
  399. package/src/components/chat-card/chat-card.stories.tsx +349 -0
  400. package/src/components/chat-card/chat-card.tsx +106 -0
  401. package/src/components/chat-card/components/chat-card-body.tsx +115 -0
  402. package/src/components/chat-card/components/chat-card-footer.tsx +95 -0
  403. package/src/components/chat-card/components/chat-card-form.tsx +120 -0
  404. package/src/components/chat-card/components/chat-card-header.tsx +240 -0
  405. package/src/components/chat-card/components/index.ts +4 -0
  406. package/src/components/chat-card/context.tsx +34 -0
  407. package/src/components/chat-card/contexts.tsx +42 -0
  408. package/src/components/chat-card/hooks.ts +51 -0
  409. package/src/components/chat-card/index.ts +5 -0
  410. package/src/components/chat-card/types.ts +23 -0
  411. package/src/components/chat-card-container/chat-card-container.json +84 -0
  412. package/src/components/chat-card-container/chat-card-container.stories.tsx +149 -0
  413. package/src/components/chat-card-container/chat-card-container.tsx +75 -0
  414. package/src/components/chat-card-container/index.ts +2 -0
  415. package/src/components/chat-container/chat-container.json +93 -0
  416. package/src/components/chat-container/chat-container.stories.tsx +179 -0
  417. package/src/components/chat-container/chat-container.tsx +231 -0
  418. package/src/components/chat-container/index.ts +2 -0
  419. package/src/components/chat-input/chat-input.json +106 -0
  420. package/src/components/chat-input/chat-input.stories.tsx +291 -0
  421. package/src/components/chat-input/chat-input.tsx +220 -0
  422. package/src/components/chat-input/index.ts +2 -0
  423. package/src/components/chat-input/plugins/auto-focus-plugin.tsx +43 -0
  424. package/src/components/chat-input/plugins/controlled-value-plugin.tsx +47 -0
  425. package/src/components/chat-input/plugins/disabled-plugin.tsx +18 -0
  426. package/src/components/chat-input/plugins/focus-plugin.tsx +44 -0
  427. package/src/components/chat-input/plugins/has-value-plugin.tsx +51 -0
  428. package/src/components/chat-input/plugins/hooks.ts +7 -0
  429. package/src/components/chat-input/plugins/index.ts +7 -0
  430. package/src/components/chat-input/plugins/markdown-plain-paste-plugin.tsx +63 -0
  431. package/src/components/chat-input/plugins/utils.ts +48 -0
  432. package/src/components/chat-input/plugins/value-plugin.tsx +35 -0
  433. package/src/components/chat-input/transformers.ts +4 -0
  434. package/src/components/chat-list/chat-list-item.tsx +33 -0
  435. package/src/components/chat-list/chat-list-items.tsx +144 -0
  436. package/src/components/chat-list/chat-list.json +117 -0
  437. package/src/components/chat-list/chat-list.stories.tsx +332 -0
  438. package/src/components/chat-list/chat-list.tsx +278 -0
  439. package/src/components/chat-list/index.ts +18 -0
  440. package/src/components/chat-message/chat-message.json +105 -0
  441. package/src/components/chat-message/chat-message.stories.tsx +95 -0
  442. package/src/components/chat-message/chat-message.tsx +66 -0
  443. package/src/components/chat-message/index.ts +1 -0
  444. package/src/components/chat-message-attachment-card/chat-message-attachment-card-icon.tsx +74 -0
  445. package/src/components/chat-message-attachment-card/chat-message-attachment-card.json +110 -0
  446. package/src/components/chat-message-attachment-card/chat-message-attachment-card.stories.tsx +131 -0
  447. package/src/components/chat-message-attachment-card/chat-message-attachment-card.tsx +142 -0
  448. package/src/components/chat-message-attachment-card/index.ts +12 -0
  449. package/src/components/chat-message-attachment-card/utils.ts +41 -0
  450. package/src/components/chat-message-history/chat-message-history.json +99 -0
  451. package/src/components/chat-message-history/chat-message-history.stories.tsx +136 -0
  452. package/src/components/chat-message-history/chat-message-history.tsx +277 -0
  453. package/src/components/chat-message-history/index.ts +13 -0
  454. package/src/components/chat-message-response/chat-message-response.json +68 -0
  455. package/src/components/chat-message-response/chat-message-response.stories.tsx +63 -0
  456. package/src/components/chat-message-response/chat-message-response.tsx +24 -0
  457. package/src/components/chat-message-response/index.ts +1 -0
  458. package/src/components/chat-message-toolbar/chat-message-toolbar.json +100 -0
  459. package/src/components/chat-message-toolbar/chat-message-toolbar.stories.tsx +62 -0
  460. package/src/components/chat-message-toolbar/chat-message-toolbar.tsx +97 -0
  461. package/src/components/chat-message-toolbar/index.ts +6 -0
  462. package/src/components/chat-messages/chat-messages.json +95 -0
  463. package/src/components/chat-messages/chat-messages.stories.tsx +284 -0
  464. package/src/components/chat-messages/chat-messages.tsx +264 -0
  465. package/src/components/chat-messages/index.ts +10 -0
  466. package/src/components/chat-notification-card/chat-notification-card.json +135 -0
  467. package/src/components/chat-notification-card/chat-notification-card.stories.tsx +290 -0
  468. package/src/components/chat-notification-card/chat-notification-card.tsx +684 -0
  469. package/src/components/chat-notification-card/index.ts +3 -0
  470. package/src/components/chat-notification-card/types.ts +1 -0
  471. package/src/components/chat-notification-card/utils.ts +34 -0
  472. package/src/components/chat-notification-popup/chat-notification-popup.json +97 -0
  473. package/src/components/chat-notification-popup/chat-notification-popup.stories.tsx +80 -0
  474. package/src/components/chat-notification-popup/chat-notification-popup.tsx +36 -0
  475. package/src/components/chat-notification-popup/index.ts +1 -0
  476. package/src/components/chat-prompt-box/chat-prompt-box-context.tsx +62 -0
  477. package/src/components/chat-prompt-box/chat-prompt-box-focus-plugin.tsx +22 -0
  478. package/src/components/chat-prompt-box/chat-prompt-box.json +106 -0
  479. package/src/components/chat-prompt-box/chat-prompt-box.stories.tsx +117 -0
  480. package/src/components/chat-prompt-box/chat-prompt-box.tsx +296 -0
  481. package/src/components/chat-prompt-box/index.ts +16 -0
  482. package/src/components/chat-reply/chat-reply.json +79 -0
  483. package/src/components/chat-reply/chat-reply.stories.tsx +72 -0
  484. package/src/components/chat-reply/chat-reply.tsx +103 -0
  485. package/src/components/chat-reply/index.ts +1 -0
  486. package/src/components/chat-suggestion/chat-suggestion.json +108 -0
  487. package/src/components/chat-suggestion/chat-suggestion.stories.tsx +147 -0
  488. package/src/components/chat-suggestion/chat-suggestion.tsx +184 -0
  489. package/src/components/chat-suggestion/index.ts +8 -0
  490. package/src/components/chat-thinking-process/chat-thinking-process.json +110 -0
  491. package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +202 -0
  492. package/src/components/chat-thinking-process/chat-thinking-process.tsx +268 -0
  493. package/src/components/chat-thinking-process/index.ts +9 -0
  494. package/src/components/chat-thread/__tests__/chat-thread.spec.tsx +385 -0
  495. package/src/components/chat-thread/chat-thread.json +120 -0
  496. package/src/components/chat-thread/chat-thread.stories.tsx +218 -0
  497. package/src/components/chat-thread/chat-thread.tsx +549 -0
  498. package/src/components/chat-thread/index.ts +18 -0
  499. package/src/components/deprecated-empty-state.ts +39 -0
  500. package/src/components/index.ts +26 -0
  501. package/src/components/markdown-viewer/hooks.ts +59 -0
  502. package/src/components/markdown-viewer/index.ts +2 -0
  503. package/src/components/markdown-viewer/markdown-viewer.json +84 -0
  504. package/src/components/markdown-viewer/markdown-viewer.stories.tsx +110 -0
  505. package/src/components/markdown-viewer/markdown-viewer.tsx +95 -0
  506. package/src/components/markdown-viewer/types.ts +10 -0
  507. package/src/components/markdown-viewer/utils.ts +5 -0
  508. package/src/components/new-chat-trigger/index.ts +1 -0
  509. package/src/components/new-chat-trigger/new-chat-trigger.tsx +29 -0
  510. package/src/components/rich-text-area/constants/index.ts +10 -0
  511. package/src/components/rich-text-area/hooks.ts +24 -0
  512. package/src/components/rich-text-area/html-config.ts +195 -0
  513. package/src/components/rich-text-area/index.ts +6 -0
  514. package/src/components/rich-text-area/nodes/div-block-node.tsx +145 -0
  515. package/src/components/rich-text-area/nodes/image-node.tsx +100 -0
  516. package/src/components/rich-text-area/plugins/blur-plugin.tsx +36 -0
  517. package/src/components/rich-text-area/plugins/controlled-plugin.tsx +23 -0
  518. package/src/components/rich-text-area/plugins/controlled-value-plugin.tsx +101 -0
  519. package/src/components/rich-text-area/plugins/disabled-plugin.tsx +17 -0
  520. package/src/components/rich-text-area/plugins/file-attachment-plugin.tsx +57 -0
  521. package/src/components/rich-text-area/plugins/focus-plugin.tsx +44 -0
  522. package/src/components/rich-text-area/plugins/html-paste-plugin.tsx +104 -0
  523. package/src/components/rich-text-area/plugins/image-drop-plugin.tsx +56 -0
  524. package/src/components/rich-text-area/plugins/index.ts +10 -0
  525. package/src/components/rich-text-area/plugins/markdown-plain-paste-plugin.tsx +63 -0
  526. package/src/components/rich-text-area/plugins/value-plugin.tsx +46 -0
  527. package/src/components/rich-text-area/rich-text-area.json +102 -0
  528. package/src/components/rich-text-area/rich-text-area.stories.tsx +140 -0
  529. package/src/components/rich-text-area/rich-text-area.tsx +156 -0
  530. package/src/components/rich-text-area/styled.tsx +20 -0
  531. package/src/components/rich-text-area/transformers.ts +175 -0
  532. package/src/components/rich-text-area/types.ts +8 -0
  533. package/src/components/rich-text-area/utils/index.ts +77 -0
  534. package/src/components/rich-text-field/components/alignment-select.tsx +103 -0
  535. package/src/components/rich-text-field/components/attachment-button.tsx +25 -0
  536. package/src/components/rich-text-field/components/bold-button.tsx +21 -0
  537. package/src/components/rich-text-field/components/clean-format-button.tsx +44 -0
  538. package/src/components/rich-text-field/components/formatting-toolbar-plugin.tsx +69 -0
  539. package/src/components/rich-text-field/components/image-button.tsx +11 -0
  540. package/src/components/rich-text-field/components/index.ts +14 -0
  541. package/src/components/rich-text-field/components/italic-button.tsx +21 -0
  542. package/src/components/rich-text-field/components/link-button.tsx +11 -0
  543. package/src/components/rich-text-field/components/size-select.tsx +27 -0
  544. package/src/components/rich-text-field/components/text-color-button.tsx +41 -0
  545. package/src/components/rich-text-field/components/toolbar-button.tsx +27 -0
  546. package/src/components/rich-text-field/components/toolbar-select.tsx +19 -0
  547. package/src/components/rich-text-field/components/typography-select.tsx +27 -0
  548. package/src/components/rich-text-field/components/underline-button.tsx +21 -0
  549. package/src/components/rich-text-field/constants.ts +33 -0
  550. package/src/components/rich-text-field/context.tsx +251 -0
  551. package/src/components/rich-text-field/index.tsx +6 -0
  552. package/src/components/rich-text-field/rich-text-field.json +118 -0
  553. package/src/components/rich-text-field/rich-text-field.stories.tsx +218 -0
  554. package/src/components/rich-text-field/rich-text-field.tsx +93 -0
  555. package/src/components/rich-text-field/utils.ts +532 -0
  556. package/src/components/spinner/index.ts +1 -0
  557. package/src/components/spinner/spinner.json +73 -0
  558. package/src/components/spinner/spinner.stories.tsx +41 -0
  559. package/src/components/spinner/spinner.tsx +32 -0
  560. package/src/contexts/chat-context/chat-context.tsx +97 -0
  561. package/src/contexts/chat-context/index.ts +1 -0
  562. package/src/contexts/chat-context/utils.ts +7 -0
  563. package/src/contexts/chat-conversation-context/chat-conversation-context.tsx +608 -0
  564. package/src/contexts/chat-conversation-context/index.ts +1 -0
  565. package/src/contexts/index.ts +2 -0
  566. package/src/docs/agent.stories.tsx +567 -0
  567. package/src/docs/chat-panel.tsx +174 -0
  568. package/src/docs/chatbot-panel.tsx +381 -0
  569. package/src/docs/chatbot.mdx +144 -0
  570. package/src/docs/chatbot.stories.tsx +63 -0
  571. package/src/domain/actions/constants.ts +1 -0
  572. package/src/domain/actions/hooks/index.ts +22 -0
  573. package/src/domain/actions/index.ts +4 -0
  574. package/src/domain/actions/types.ts +6 -0
  575. package/src/domain/actions/utils/index.ts +112 -0
  576. package/src/domain/index.ts +1 -0
  577. package/src/hooks/index.tsx +10 -0
  578. package/src/hooks/use-chat-prompt-placeholder.ts +7 -0
  579. package/src/hooks/use-chat-stream-message.ts +189 -0
  580. package/src/hooks/use-current-chat-id.ts +6 -0
  581. package/src/hooks/use-is-current-chat-new.ts +6 -0
  582. package/src/hooks/use-loaded-chat-ids.ts +32 -0
  583. package/src/hooks/use-on-chat-changed.ts +33 -0
  584. package/src/index.css +1 -0
  585. package/src/index.ts +6 -0
  586. package/src/layouts/chat-card-list-layout/__tests__/chat-card-list-layout.spec.tsx +204 -0
  587. package/src/layouts/chat-card-list-layout/chat-card-list-layout.json +116 -0
  588. package/src/layouts/chat-card-list-layout/chat-card-list-layout.stories.tsx +190 -0
  589. package/src/layouts/chat-card-list-layout/chat-card-list-layout.tsx +250 -0
  590. package/src/layouts/chat-card-list-layout/index.ts +11 -0
  591. package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.sizing.test.ts +73 -0
  592. package/src/layouts/chat-card-three-column-layout/__tests__/chat-card-three-column-layout.spec.tsx +282 -0
  593. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.json +131 -0
  594. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.sizing.ts +78 -0
  595. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.stories.tsx +273 -0
  596. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.tsx +291 -0
  597. package/src/layouts/chat-card-three-column-layout/chat-card-three-column-layout.variants.ts +135 -0
  598. package/src/layouts/chat-card-three-column-layout/index.ts +24 -0
  599. package/src/layouts/chat-card-two-column-layout/__tests__/chat-card-two-column-layout.spec.tsx +109 -0
  600. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.json +97 -0
  601. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.sizing.ts +21 -0
  602. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.stories.tsx +138 -0
  603. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.tsx +132 -0
  604. package/src/layouts/chat-card-two-column-layout/chat-card-two-column-layout.variants.ts +65 -0
  605. package/src/layouts/chat-card-two-column-layout/index.ts +17 -0
  606. package/src/layouts/index.ts +3 -0
  607. package/src/types.ts +29 -0
  608. package/src/utils/use-streaming-markdown.ts +113 -0
  609. package/tailwind.css +7 -0
package/package.json ADDED
@@ -0,0 +1,155 @@
1
+ {
2
+ "name": "@swisper.ai/web-chat-ui",
3
+ "version": "0.0.2",
4
+ "description": "React components for the Swisper chat: messages, composer and cards",
5
+ "keywords": [
6
+ "react",
7
+ "chat",
8
+ "components",
9
+ "design-system"
10
+ ],
11
+ "license": "Apache-2.0",
12
+ "author": "Fintama AG",
13
+ "homepage": "https://fintama.github.io/fintama/",
14
+ "type": "module",
15
+ "main": "./dist/index.es.js",
16
+ "module": "./dist/index.es.js",
17
+ "types": "./dist/index.d.ts",
18
+ "source": "./src/index.ts",
19
+ "style": "./dist/index.css",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "source": "./src/index.ts",
24
+ "style": "./dist/index.css",
25
+ "import": "./dist/index.es.js",
26
+ "require": "./dist/index.es.js"
27
+ },
28
+ "./hooks": {
29
+ "types": "./dist/hooks/index.d.ts",
30
+ "source": "./src/hooks/index.ts",
31
+ "import": "./dist/hooks/index.es.js",
32
+ "require": "./dist/hooks/index.es.js"
33
+ },
34
+ "./index.css": {
35
+ "style": "./dist/index.css",
36
+ "import": "./dist/index.css",
37
+ "require": "./dist/index.css"
38
+ },
39
+ "./tailwind.css": {
40
+ "style": "./tailwind.css",
41
+ "import": "./tailwind.css",
42
+ "require": "./tailwind.css"
43
+ }
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "src",
48
+ "tailwind.css"
49
+ ],
50
+ "dependencies": {
51
+ "@lexical/code": "^0.46.0",
52
+ "@lexical/html": "^0.46.0",
53
+ "@lexical/link": "^0.46.0",
54
+ "@lexical/list": "^0.46.0",
55
+ "@lexical/markdown": "^0.46.0",
56
+ "@lexical/react": "^0.46.0",
57
+ "@lexical/rich-text": "^0.46.0",
58
+ "@lexical/selection": "^0.46.0",
59
+ "@lexical/table": "^0.46.0",
60
+ "@lexical/utils": "^0.46.0",
61
+ "@lottiefiles/dotlottie-react": "^0.18.1",
62
+ "@lottiefiles/react-lottie-player": "^3.6.0",
63
+ "@mui/material": "7.0.2",
64
+ "@radix-ui/react-collapsible": "^1.1.2",
65
+ "@radix-ui/react-roving-focus": "^1.1.11",
66
+ "@radix-ui/react-scroll-area": "^1.2.10",
67
+ "@radix-ui/react-slot": "^1.1.0",
68
+ "@shadcn/react": "^0.3.1",
69
+ "@swisper.ai/design-system": "0.0.2",
70
+ "@swisper.ai/icons": "0.0.2",
71
+ "@swisper.ai/tailwind-config": "0.0.2",
72
+ "@swisper.ai/ui": "0.0.2",
73
+ "@swisper.ai/web-core": "0.0.2",
74
+ "@tanstack/react-virtual": "^3.14.5",
75
+ "chroma-js": "^3.2.0",
76
+ "class-variance-authority": "^0.7.1",
77
+ "clsx": "^2.1.1",
78
+ "date-fns": "4.1.0",
79
+ "date-fns-tz": "^3.2.0",
80
+ "eventsource-parser": "^3.1.0",
81
+ "inline-style-parser": "^0.2.7",
82
+ "katex": "^0.16.22",
83
+ "lexical": "^0.46.0",
84
+ "mdast": "^3.0.0",
85
+ "mime": "^4.1.0",
86
+ "motion": "^12.23.22",
87
+ "nanoid": "^5.1.16",
88
+ "react-intersection-observer": "9.16.0",
89
+ "rehype-sanitize": "^6.0.0",
90
+ "remark-gfm": "4.0.1",
91
+ "remark-parse": "^11.0.0",
92
+ "sanitize-html": "2.17.1",
93
+ "streamdown": "^2.1.0",
94
+ "tailwind-merge": "^3.4.0",
95
+ "unified": "^11.0.5",
96
+ "unist-util-visit": "^5.0.0",
97
+ "use-stick-to-bottom": "^1.1.6",
98
+ "zod": "^4.1.12",
99
+ "zustand": "^5.0.5"
100
+ },
101
+ "devDependencies": {
102
+ "@fintama/vite-config": "0.1.1",
103
+ "@fintama/vitest-config": "0.1.1",
104
+ "@storybook/react-vite": "10.6.0",
105
+ "@swisper.ai/int-eslint-config": "0.0.1",
106
+ "@swisper.ai/int-typescript-config": "0.0.1",
107
+ "@tailwindcss/cli": "4.3.3",
108
+ "@tailwindcss/vite": "4.3.3",
109
+ "@testing-library/dom": "10.4.1",
110
+ "@testing-library/react": "16.3.3",
111
+ "@types/chroma-js": "^3.1.2",
112
+ "@types/hast": "3.0.4",
113
+ "@types/katex": "^0.16.7",
114
+ "@types/node": "24.19.0",
115
+ "@types/react": "18.3.31",
116
+ "@types/react-dom": "18.3.7",
117
+ "@types/sanitize-html": "2.16.1",
118
+ "@typescript/typescript6": "6.0.2",
119
+ "concurrently": "^9.1.2",
120
+ "csstype": "^3.2.3",
121
+ "eslint": "10.9.1",
122
+ "jsdom": "30.1.1",
123
+ "react": "18.3.1",
124
+ "react-dom": "18.3.1",
125
+ "rimraf": "^6.0.1",
126
+ "rollup-plugin-visualizer": "7.1.1",
127
+ "storybook": "10.6.0",
128
+ "tailwindcss": "4.3.3",
129
+ "typescript": "7.0.2",
130
+ "vite": "8.3.1",
131
+ "vite-plugin-dts": "5.1.1",
132
+ "vitest": "4.1.11"
133
+ },
134
+ "peerDependencies": {
135
+ "@llm-ui/react": "^0.13.3",
136
+ "react": ">=18.0.0",
137
+ "react-dom": ">=18.0.0"
138
+ },
139
+ "publishConfig": {
140
+ "access": "public"
141
+ },
142
+ "scripts": {
143
+ "build": "pnpm run clean && pnpm run build:ts && pnpm run build:css",
144
+ "analyze": "ANALYZE=true vite build --mode production",
145
+ "build:ts": "vite build --mode production",
146
+ "build:css": "tailwindcss -i ./src/index.css -o ./dist/index.css --minify",
147
+ "clean": "rimraf dist",
148
+ "dev": "concurrently \"pnpm run dev:css\" \"pnpm run dev:ts\"",
149
+ "lint": "eslint . --max-warnings=0",
150
+ "test": "vitest run",
151
+ "typecheck": "tsc --noEmit",
152
+ "dev:ts": "vite build --mode development --watch",
153
+ "dev:css": "tailwindcss -i ./src/index.css -o ./dist/index.css --watch"
154
+ }
155
+ }
@@ -0,0 +1,5 @@
1
+ import { configure } from '@testing-library/react';
2
+
3
+ // Under a parallel `turbo run test` a render can land seconds after the event that caused it,
4
+ // past the 1s default. A wait that holds returns at once, so only a real failure takes longer.
5
+ configure({ asyncUtilTimeout: 5_000 });
@@ -0,0 +1,126 @@
1
+ {
2
+ "$schema": "../../../../int-eslint-config/schemas/component.schema.json",
3
+ "component": "canvas-shell",
4
+ "purpose": "Frame for a side-panel canvas next to the chat: a full-height, three-row grid with a static header (title, options, full-screen and close buttons), a content region that scrolls or clips, and an optional static footer. Parts: CanvasShellHeader, CanvasShellTitle, CanvasShellOptionsButton, CanvasShellFullScreenTrigger, CanvasShellCloseTrigger, CanvasShellContent, CanvasShellFooter.",
5
+ "useWhen": [
6
+ "Building the side panel (canvas) that opens beside the chat to show one artifact, list or conversation under a title",
7
+ "Content must scroll inside a fixed-height panel while the title, panel actions and footer stay in place",
8
+ "The panel needs a close button and, on desktop, a full-screen toggle whose state the host owns"
9
+ ],
10
+ "avoidWhen": [
11
+ "A blocking task that must be finished before returning to the page — use ui/dialog",
12
+ "A bounded block of content inside the chat thread or a page — use web-chat-ui/chat-card or ui/card",
13
+ "The parent has no defined height — the shell fills its parent's height, so size the parent first or use a plain layout"
14
+ ],
15
+ "uxPrinciples": [
16
+ "Only the content region moves: the title, the panel actions and the footer are always reachable, however long the content.",
17
+ "The shell draws the controls, the host owns the state: closing and full screen mean whatever the host does in onClick.",
18
+ "Keep the header to the title and a few icon actions; secondary canvas actions go in the options menu."
19
+ ],
20
+ "accessibility": {
21
+ "required": [
22
+ "CanvasShell renders an unnamed <section>; give it (or the aside around it) an aria-label, or aria-labelledby pointing at the title, when the panel should be exposed as a named region",
23
+ "The header buttons have English default names ('Close panel', 'More options', 'Full screen' / 'Exit full screen'); pass aria-label to CanvasShellCloseTrigger and CanvasShellOptionsButton and labels={{ enter, exit }} to CanvasShellFullScreenTrigger to translate them or make them specific ('Close portfolio')",
24
+ "Items inside CanvasShellOptionsButton must be menu items (ui/DropdownMenuListItem) so the menu keeps its keyboard and screen-reader behaviour"
25
+ ],
26
+ "keyboard": [
27
+ "Tab reaches the header buttons in order; Enter or Space activates them",
28
+ "On the options button, Enter, Space or ArrowDown opens the menu; arrow keys move between items, Enter picks one, Escape closes it and returns focus to the button"
29
+ ],
30
+ "aria": [
31
+ "Landmarks: <section> for the shell, <header> for the header row, <footer> for the footer row",
32
+ "CanvasShellFullScreenTrigger sets aria-pressed from isFullScreen and swaps its aria-label between the enter and exit labels",
33
+ "CanvasShellCloseTrigger defaults to aria-label='Close panel'; CanvasShellOptionsButton to aria-label='More options' and exposes the menu through the Radix dropdown trigger attributes"
34
+ ],
35
+ "focus": [
36
+ "The shell does not move or trap focus: when the panel opens or closes, the host decides where focus goes",
37
+ "The options menu is non-modal: the rest of the page stays interactive while it is open",
38
+ "The scrolling content region is not a tab stop; keyboard users reach its content through its focusable children"
39
+ ]
40
+ },
41
+ "behaviour": {
42
+ "states": [
43
+ "default",
44
+ "content overflowing (scrolls or clips)",
45
+ "full screen (host-controlled)",
46
+ "options menu open"
47
+ ],
48
+ "rules": [
49
+ "CanvasShell is h-full with overflow hidden and a grid of auto / minmax(0,1fr) / auto rows: it takes its parent's height, and long content never grows the middle row past it",
50
+ "CanvasShellHeader.hasBorder draws a bottom separator under the header; set it to false for a header that blends into the content",
51
+ "CanvasShellTitle takes the free width of the header and truncates to one line, so a long title never pushes the buttons out",
52
+ "CanvasShellFullScreenTrigger is controlled: the host passes isFullScreen and flips it in onClick, then widens the panel itself; the shell does not resize. The button is hidden below the md breakpoint, where the canvas already spans the screen",
53
+ "CanvasShellCloseTrigger only calls onClick; the host decides what closing means",
54
+ "CanvasShellOptionsButton opens a dropdown of its children (a ui/DropdownMenuList), shows its active style while open and reports open state through onOpenChange; menuClassName styles the dropdown panel",
55
+ "CanvasShellContent.hasScroll=true scrolls overflowing children on both axes; false clips them, for children that scroll themselves",
56
+ "CanvasShellContent.hasPadding=false drops the horizontal padding for edge-to-edge children; the vertical padding stays. canvasShellContentPadding exports those horizontal padding classes to align a custom scroll area with the shell",
57
+ "CanvasShellFooter lines its children up at the end of a row; override className (e.g. flex-col items-stretch) to stack a composer or full-width controls",
58
+ "Header and footer pad 12px on mobile and 16px from md up"
59
+ ]
60
+ },
61
+ "composition": {
62
+ "allowedParents": [],
63
+ "allowedChildren": [
64
+ "web-chat-ui/CanvasShellHeader",
65
+ "web-chat-ui/CanvasShellTitle",
66
+ "web-chat-ui/CanvasShellOptionsButton",
67
+ "web-chat-ui/CanvasShellFullScreenTrigger",
68
+ "web-chat-ui/CanvasShellCloseTrigger",
69
+ "web-chat-ui/CanvasShellContent",
70
+ "web-chat-ui/CanvasShellFooter",
71
+ "web-chat-ui/chat-thread",
72
+ "web-chat-ui/chat-input",
73
+ "web-chat-ui/chat-suggestion",
74
+ "ui/DropdownMenuList"
75
+ ],
76
+ "avoidCombinations": [
77
+ "A child that scrolls itself (web-chat-ui/chat-thread, ui/scroll-area, an iframe preview, a virtualised list) in CanvasShellContent with hasScroll=true — set hasScroll={false} to avoid nested scroll containers",
78
+ "Extra icon buttons in the header for secondary actions — put them in CanvasShellOptionsButton instead",
79
+ "CanvasShellFullScreenTrigger without a host that actually changes the panel width — the button would toggle aria-pressed with no visible effect"
80
+ ],
81
+ "contexts": ["side panel beside the chat", "full-height aside"]
82
+ },
83
+ "content": {
84
+ "labelRules": [
85
+ "CanvasShellTitle: a short noun phrase naming what the canvas shows ('Portfolio overview'); it is cut to one line",
86
+ "Options menu items: verb-first labels with an icon ('Download', 'Rename')",
87
+ "Footer buttons: verb-first, outcome-describing labels, the primary action last ('Cancel', 'Save changes')"
88
+ ],
89
+ "helperTextRules": [],
90
+ "errorRules": []
91
+ },
92
+ "aiDecisionRules": [
93
+ {
94
+ "condition": "The canvas content scrolls itself (web-chat-ui/chat-thread, a framed file preview, a virtualised list)",
95
+ "decision": "Render it in CanvasShellContent with hasScroll={false}, and hasPadding={false} when it pads itself",
96
+ "reason": "Two nested scroll containers fight over the wheel and show double scrollbars"
97
+ },
98
+ {
99
+ "condition": "The app is not in English, or the panel holds a specific object",
100
+ "decision": "Pass aria-label to CanvasShellCloseTrigger and CanvasShellOptionsButton and labels={{ enter, exit }} to CanvasShellFullScreenTrigger",
101
+ "reason": "The defaults are fixed English strings"
102
+ },
103
+ {
104
+ "condition": "The canvas has actions besides close and full screen (download, rename, share)",
105
+ "decision": "Put them as ui/DropdownMenuListItem entries inside CanvasShellOptionsButton",
106
+ "reason": "Keeps the header to a title and a few icons, so the title stays readable on a narrow panel"
107
+ },
108
+ {
109
+ "condition": "A custom scroll area inside CanvasShellContent uses hasPadding={false} but must line up with the header",
110
+ "decision": "Apply canvasShellContentPadding to the scroll area's inner content",
111
+ "reason": "It is the same responsive horizontal padding the header and content use"
112
+ }
113
+ ],
114
+ "relatedComponents": [
115
+ "ui/dialog",
116
+ "web-chat-ui/chat-thread",
117
+ "ui/scroll-area",
118
+ "ui/menu",
119
+ "ui/icon-button"
120
+ ],
121
+ "tokenReferences": {
122
+ "source": "packages/design-system/src/tailwind.css",
123
+ "categories": ["border-brand-secondary-*"],
124
+ "rule": "The header separator uses border-brand-secondary-700; style overrides through className with theme utilities, never raw colours."
125
+ }
126
+ }
@@ -0,0 +1,194 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { useState } from 'react';
3
+ import { fn } from 'storybook/test';
4
+
5
+ import { DownloadIcon, EditIcon } from '@swisper.ai/icons';
6
+ import {
7
+ Button,
8
+ DropdownMenuList,
9
+ DropdownMenuListItem,
10
+ MenuItemIcon,
11
+ MenuItemLabel,
12
+ Typography,
13
+ cn,
14
+ } from '@swisper.ai/ui';
15
+
16
+ import {
17
+ CanvasShell,
18
+ CanvasShellCloseTrigger,
19
+ CanvasShellContent,
20
+ CanvasShellFullScreenTrigger,
21
+ CanvasShellFooter,
22
+ CanvasShellHeader,
23
+ CanvasShellOptionsButton,
24
+ CanvasShellTitle,
25
+ } from './canvas-shell';
26
+
27
+ interface CanvasShellStoryArgs {
28
+ title: string;
29
+ itemCount: number;
30
+ hasScroll: boolean;
31
+ hasWideContent: boolean;
32
+ hasFooter: boolean;
33
+ hasOptions: boolean;
34
+ onClose: () => void;
35
+ onOption: (option: string) => void;
36
+ }
37
+
38
+ function CanvasShellStory({
39
+ title,
40
+ itemCount,
41
+ hasScroll,
42
+ hasWideContent,
43
+ hasFooter,
44
+ hasOptions,
45
+ onClose,
46
+ onOption,
47
+ }: CanvasShellStoryArgs) {
48
+ const [isFullScreen, setIsFullScreen] = useState(false);
49
+
50
+ return (
51
+ <CanvasShell>
52
+ <CanvasShellHeader>
53
+ <CanvasShellTitle>{title}</CanvasShellTitle>
54
+ {hasOptions && (
55
+ <CanvasShellOptionsButton>
56
+ <DropdownMenuList>
57
+ <DropdownMenuListItem onClick={() => onOption('download')}>
58
+ <MenuItemIcon>
59
+ <DownloadIcon fontSize="small" className="size-[20px]" />
60
+ </MenuItemIcon>
61
+ <MenuItemLabel>Download</MenuItemLabel>
62
+ </DropdownMenuListItem>
63
+ <DropdownMenuListItem onClick={() => onOption('rename')}>
64
+ <MenuItemIcon>
65
+ <EditIcon fontSize="small" className="size-[20px]" />
66
+ </MenuItemIcon>
67
+ <MenuItemLabel>Rename</MenuItemLabel>
68
+ </DropdownMenuListItem>
69
+ </DropdownMenuList>
70
+ </CanvasShellOptionsButton>
71
+ )}
72
+ <CanvasShellFullScreenTrigger
73
+ isFullScreen={isFullScreen}
74
+ onClick={() => setIsFullScreen((current) => !current)}
75
+ />
76
+ <CanvasShellCloseTrigger onClick={onClose} />
77
+ </CanvasShellHeader>
78
+
79
+ <CanvasShellContent hasScroll={hasScroll}>
80
+ <ul className={cn('flex flex-col gap-10 pb-20', hasWideContent && 'w-[900px]')}>
81
+ {Array.from({ length: itemCount }, (_, index) => (
82
+ <li key={index}>
83
+ <Typography variant="body-small-high">Item {index + 1}</Typography>
84
+ </li>
85
+ ))}
86
+ </ul>
87
+ </CanvasShellContent>
88
+
89
+ {hasFooter && (
90
+ <CanvasShellFooter>
91
+ <Button variant="secondary">Cancel</Button>
92
+ <Button>Save changes</Button>
93
+ </CanvasShellFooter>
94
+ )}
95
+ </CanvasShell>
96
+ );
97
+ }
98
+
99
+ const meta: Meta<typeof CanvasShellStory> = {
100
+ title: 'Chatbot/CanvasShell',
101
+ component: CanvasShellStory,
102
+ parameters: {
103
+ layout: 'fullscreen',
104
+ },
105
+ tags: ['autodocs'],
106
+ decorators: [
107
+ (Story) => (
108
+ <div className="max-w-[420px] mx-auto h-[600px]">
109
+ <Story />
110
+ </div>
111
+ ),
112
+ ],
113
+ args: {
114
+ title: 'Portfolio overview',
115
+ itemCount: 50,
116
+ hasScroll: true,
117
+ hasWideContent: false,
118
+ hasFooter: true,
119
+ hasOptions: false,
120
+ onClose: fn(),
121
+ onOption: fn(),
122
+ },
123
+ argTypes: {
124
+ title: {
125
+ control: 'text',
126
+ description: 'Title shown in the static header. Truncates when too long.',
127
+ },
128
+ itemCount: {
129
+ control: { type: 'number', min: 0, max: 200 },
130
+ description: 'Number of list items rendered in the content region.',
131
+ },
132
+ hasScroll: {
133
+ control: 'boolean',
134
+ description:
135
+ 'Scroll content that overflows the region, on either axis. When off, content is clipped to the fixed-height region.',
136
+ table: { defaultValue: { summary: 'true' } },
137
+ },
138
+ hasWideContent: {
139
+ control: 'boolean',
140
+ description: 'Make the content wider than the shell to show horizontal scrolling.',
141
+ },
142
+ hasFooter: {
143
+ control: 'boolean',
144
+ description: 'Render the static footer.',
145
+ },
146
+ hasOptions: {
147
+ control: 'boolean',
148
+ description: 'Render the options (⋯) button with a dropdown of actions.',
149
+ },
150
+ onOption: {
151
+ action: 'option',
152
+ description: 'Called with the id of the picked dropdown option.',
153
+ },
154
+ onClose: {
155
+ action: 'close',
156
+ description: 'Called when the close button is pressed.',
157
+ },
158
+ },
159
+ };
160
+
161
+ export default meta;
162
+ type Story = StoryObj<typeof CanvasShellStory>;
163
+
164
+ export const Default: Story = {};
165
+
166
+ /** A title longer than the header: it truncates instead of pushing the close button out. */
167
+ export const LongTitle: Story = {
168
+ args: {
169
+ title: 'A very long canvas title that does not fit in the header on a narrow panel',
170
+ },
171
+ };
172
+
173
+ /** No footer: the content region extends to the bottom of the shell. */
174
+ export const WithoutFooter: Story = {
175
+ args: {
176
+ hasFooter: false,
177
+ },
178
+ };
179
+
180
+ /** Content wider and taller than the shell: it scrolls on both axes instead of growing the shell. */
181
+ export const WideContent: Story = {
182
+ args: {
183
+ hasWideContent: true,
184
+ },
185
+ };
186
+
187
+ /** Options button in the header: opens a dropdown of canvas actions. */
188
+ export const WithOptions: Story = {
189
+ args: {
190
+ hasOptions: true,
191
+ },
192
+ };
193
+
194
+ export const Playground: Story = {};
@@ -0,0 +1,205 @@
1
+ import { cleanup, fireEvent, render, screen } from '@testing-library/react';
2
+ import { useState } from 'react';
3
+ import { afterEach, describe, expect, test, vi } from 'vitest';
4
+
5
+ import { DropdownMenuList, DropdownMenuListItem, MenuItemLabel } from '@swisper.ai/ui';
6
+
7
+ import {
8
+ CanvasShell,
9
+ CanvasShellCloseTrigger,
10
+ CanvasShellContent,
11
+ CanvasShellFooter,
12
+ CanvasShellFullScreenTrigger,
13
+ CanvasShellHeader,
14
+ CanvasShellOptionsButton,
15
+ CanvasShellTitle,
16
+ } from './canvas-shell';
17
+
18
+ /** Full-screen state lives in the host; this stands in for it. */
19
+ function FullScreenHost({ labels }: { labels?: { enter?: string; exit?: string } }) {
20
+ const [isFullScreen, setIsFullScreen] = useState(false);
21
+
22
+ return (
23
+ <CanvasShellFullScreenTrigger
24
+ isFullScreen={isFullScreen}
25
+ labels={labels}
26
+ onClick={() => setIsFullScreen((current) => !current)}
27
+ />
28
+ );
29
+ }
30
+
31
+ /** A fully composed shell, the way a canvas author writes it. */
32
+ function renderShell({ hasScroll = true, onClose = vi.fn() } = {}) {
33
+ return render(
34
+ <CanvasShell>
35
+ <CanvasShellHeader>
36
+ <CanvasShellTitle>Portfolio</CanvasShellTitle>
37
+ <FullScreenHost />
38
+ <CanvasShellCloseTrigger onClick={onClose} />
39
+ </CanvasShellHeader>
40
+ <CanvasShellContent hasScroll={hasScroll}>
41
+ <p>Holdings list</p>
42
+ </CanvasShellContent>
43
+ <CanvasShellFooter>
44
+ <p>Footer actions</p>
45
+ </CanvasShellFooter>
46
+ </CanvasShell>,
47
+ );
48
+ }
49
+
50
+ afterEach(() => {
51
+ cleanup();
52
+ vi.restoreAllMocks();
53
+ });
54
+
55
+ describe('composition', () => {
56
+ test('renders each part with its children', () => {
57
+ const { container } = renderShell();
58
+
59
+ expect(container.querySelector('[data-slot="canvas-shell-header"]')?.textContent).toContain(
60
+ 'Portfolio',
61
+ );
62
+ expect(container.querySelector('[data-slot="canvas-shell-content"]')?.textContent).toBe(
63
+ 'Holdings list',
64
+ );
65
+ expect(container.querySelector('[data-slot="canvas-shell-footer"]')?.textContent).toBe(
66
+ 'Footer actions',
67
+ );
68
+ });
69
+
70
+ test('renders the title', () => {
71
+ renderShell();
72
+
73
+ expect(screen.getByText('Portfolio')).not.toBeNull();
74
+ });
75
+ });
76
+
77
+ describe('the close button', () => {
78
+ // Icon-only control: without a default accessible name every canvas would have to remember one.
79
+ test('has an accessible name by default', () => {
80
+ renderShell();
81
+
82
+ expect(screen.getByRole('button', { name: 'Close panel' })).not.toBeNull();
83
+ });
84
+
85
+ test('lets the author override the accessible name', () => {
86
+ render(<CanvasShellCloseTrigger aria-label="Close portfolio" />);
87
+
88
+ expect(screen.getByRole('button', { name: 'Close portfolio' })).not.toBeNull();
89
+ });
90
+
91
+ test('calls onClick when pressed', () => {
92
+ const onClose = vi.fn();
93
+ renderShell({ onClose });
94
+
95
+ fireEvent.click(screen.getByRole('button', { name: 'Close panel' }));
96
+
97
+ expect(onClose).toHaveBeenCalledTimes(1);
98
+ });
99
+ });
100
+
101
+ describe('the full-screen button', () => {
102
+ test('is off by default', () => {
103
+ renderShell();
104
+
105
+ const button = screen.getByRole('button', { name: 'Full screen' });
106
+
107
+ expect(button.getAttribute('aria-pressed')).toBe('false');
108
+ });
109
+
110
+ test('toggles full screen and its accessible name', () => {
111
+ renderShell();
112
+
113
+ fireEvent.click(screen.getByRole('button', { name: 'Full screen' }));
114
+
115
+ const button = screen.getByRole('button', { name: 'Exit full screen' });
116
+ expect(button.getAttribute('aria-pressed')).toBe('true');
117
+
118
+ fireEvent.click(button);
119
+
120
+ expect(screen.getByRole('button', { name: 'Full screen' }).getAttribute('aria-pressed')).toBe(
121
+ 'false',
122
+ );
123
+ });
124
+ });
125
+
126
+ describe('the full-screen button labels', () => {
127
+ test('lets the author translate both states', () => {
128
+ render(<FullScreenHost labels={{ enter: 'Plein écran', exit: 'Quitter' }} />);
129
+
130
+ fireEvent.click(screen.getByRole('button', { name: 'Plein écran' }));
131
+
132
+ expect(screen.getByRole('button', { name: 'Quitter' })).not.toBeNull();
133
+ });
134
+ });
135
+
136
+ describe('the options button', () => {
137
+ function renderOptions({ onDownload = vi.fn(), onOpenChange = vi.fn() } = {}) {
138
+ render(
139
+ <CanvasShellOptionsButton onOpenChange={onOpenChange}>
140
+ <DropdownMenuList>
141
+ <DropdownMenuListItem onClick={onDownload}>
142
+ <MenuItemLabel>Download</MenuItemLabel>
143
+ </DropdownMenuListItem>
144
+ </DropdownMenuList>
145
+ </CanvasShellOptionsButton>,
146
+ );
147
+
148
+ return { onDownload, onOpenChange };
149
+ }
150
+
151
+ /** Radix opens on pointerdown, which jsdom cannot dispatch faithfully; Enter takes the same path. */
152
+ function openMenu() {
153
+ fireEvent.keyDown(screen.getByRole('button', { name: 'More options' }), {
154
+ key: 'Enter',
155
+ });
156
+ }
157
+
158
+ test('has an accessible name and keeps its menu closed by default', () => {
159
+ renderOptions();
160
+
161
+ expect(screen.getByRole('button', { name: 'More options' })).not.toBeNull();
162
+ expect(screen.queryByText('Download')).toBeNull();
163
+ });
164
+
165
+ test('opens the menu with the passed items', () => {
166
+ const { onOpenChange } = renderOptions();
167
+
168
+ openMenu();
169
+
170
+ expect(screen.getByText('Download')).not.toBeNull();
171
+ expect(onOpenChange).toHaveBeenCalledWith(true);
172
+ });
173
+
174
+ test('runs the item handler when an item is picked', () => {
175
+ const { onDownload } = renderOptions();
176
+
177
+ openMenu();
178
+ fireEvent.click(screen.getByText('Download'));
179
+
180
+ expect(onDownload).toHaveBeenCalledTimes(1);
181
+ });
182
+ });
183
+
184
+ describe('content scrolling', () => {
185
+ function getBody(container: HTMLElement) {
186
+ return container.querySelector('[data-slot="canvas-shell-content-body"]');
187
+ }
188
+
189
+ // Wide or tall children scroll inside the region instead of growing past the canvas.
190
+ test('scrolls overflowing children by default', () => {
191
+ const { container } = renderShell();
192
+
193
+ expect(getBody(container)?.classList).toContain('overflow-auto');
194
+ expect(getBody(container)?.textContent).toBe('Holdings list');
195
+ });
196
+
197
+ // Children that scroll themselves (framed previews, virtualised lists) must not get a second scroll container.
198
+ test('clips instead of scrolling when hasScroll is false', () => {
199
+ const { container } = renderShell({ hasScroll: false });
200
+
201
+ expect(getBody(container)?.classList).toContain('overflow-hidden');
202
+ expect(getBody(container)?.classList).not.toContain('overflow-auto');
203
+ expect(screen.getByText('Holdings list')).not.toBeNull();
204
+ });
205
+ });