@patternfly/chatbot 6.3.0-prerelease.2 → 6.3.0-prerelease.21

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 (586) hide show
  1. package/dist/cjs/AttachMenu/AttachMenu.d.ts +2 -2
  2. package/dist/cjs/AttachMenu/AttachMenu.js +2 -12
  3. package/dist/cjs/AttachmentEdit/AttachmentEdit.d.ts +14 -2
  4. package/dist/cjs/AttachmentEdit/AttachmentEdit.js +3 -6
  5. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +1 -1
  6. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +33 -8
  7. package/dist/cjs/Chatbot/Chatbot.d.ts +3 -2
  8. package/dist/cjs/Chatbot/Chatbot.js +5 -10
  9. package/dist/cjs/Chatbot/Chatbot.test.js +13 -9
  10. package/dist/cjs/ChatbotAlert/ChatbotAlert.d.ts +2 -2
  11. package/dist/cjs/ChatbotAlert/ChatbotAlert.js +4 -8
  12. package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +10 -10
  13. package/dist/cjs/ChatbotContent/ChatbotContent.d.ts +3 -3
  14. package/dist/cjs/ChatbotContent/ChatbotContent.js +2 -8
  15. package/dist/cjs/ChatbotContent/ChatbotContent.test.js +5 -5
  16. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +2 -2
  17. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +7 -11
  18. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +31 -33
  19. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +4 -2
  20. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +17 -34
  21. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +58 -62
  22. package/dist/cjs/ChatbotConversationHistoryNav/EmptyState.d.ts +2 -2
  23. package/dist/cjs/ChatbotConversationHistoryNav/EmptyState.js +2 -9
  24. package/dist/cjs/ChatbotConversationHistoryNav/LoadingState.d.ts +2 -2
  25. package/dist/cjs/ChatbotConversationHistoryNav/LoadingState.js +2 -25
  26. package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +4 -3
  27. package/dist/cjs/ChatbotFooter/ChatbotFooter.js +3 -16
  28. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
  29. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +10 -5
  30. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +28 -28
  31. package/dist/cjs/ChatbotFooter/ChatbotFootnote.d.ts +3 -3
  32. package/dist/cjs/ChatbotFooter/ChatbotFootnote.js +10 -23
  33. package/dist/cjs/ChatbotHeader/ChatbotHeader.d.ts +3 -3
  34. package/dist/cjs/ChatbotHeader/ChatbotHeader.js +2 -7
  35. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +5 -5
  36. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.d.ts +2 -2
  37. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.js +2 -5
  38. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +5 -5
  39. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +5 -4
  40. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +19 -10
  41. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
  42. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +10 -8
  43. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.d.ts +2 -2
  44. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +2 -5
  45. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +5 -5
  46. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +5 -4
  47. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +20 -8
  48. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
  49. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +10 -8
  50. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +7 -3
  51. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
  52. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
  53. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +22 -19
  54. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +9 -3
  55. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -12
  56. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
  57. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +20 -17
  58. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.d.ts +2 -2
  59. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.js +2 -5
  60. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +23 -23
  61. package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +5 -2
  62. package/dist/cjs/ChatbotModal/ChatbotModal.js +4 -10
  63. package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +1 -0
  64. package/dist/cjs/ChatbotModal/ChatbotModal.test.js +16 -0
  65. package/dist/cjs/ChatbotPopover/ChatbotPopover.d.ts +2 -2
  66. package/dist/cjs/ChatbotPopover/ChatbotPopover.js +2 -8
  67. package/dist/cjs/ChatbotToggle/ChatbotToggle.d.ts +1 -2
  68. package/dist/cjs/ChatbotToggle/ChatbotToggle.js +8 -13
  69. package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +25 -25
  70. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +3 -2
  71. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +7 -21
  72. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +18 -14
  73. package/dist/cjs/CodeModal/CodeModal.d.ts +10 -2
  74. package/dist/cjs/CodeModal/CodeModal.js +8 -20
  75. package/dist/cjs/CodeModal/CodeModal.test.d.ts +1 -0
  76. package/dist/cjs/CodeModal/CodeModal.test.js +34 -0
  77. package/dist/cjs/Compare/Compare.d.ts +2 -2
  78. package/dist/cjs/Compare/Compare.js +7 -16
  79. package/dist/cjs/Compare/Compare.test.js +7 -9
  80. package/dist/cjs/FileDetails/FileDetails.d.ts +2 -2
  81. package/dist/cjs/FileDetails/FileDetails.js +2 -15
  82. package/dist/cjs/FileDetails/FileDetails.test.js +10 -10
  83. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.d.ts +2 -2
  84. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.js +2 -5
  85. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +21 -21
  86. package/dist/cjs/FileDropZone/FileDropZone.d.ts +9 -2
  87. package/dist/cjs/FileDropZone/FileDropZone.js +6 -9
  88. package/dist/cjs/FileDropZone/FileDropZone.test.js +31 -5
  89. package/dist/cjs/LoadingMessage/LoadingMessage.d.ts +2 -2
  90. package/dist/cjs/LoadingMessage/LoadingMessage.js +2 -10
  91. package/dist/cjs/LoadingMessage/LoadingMessage.test.js +6 -6
  92. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +20 -3
  93. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +22 -16
  94. package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
  95. package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +136 -0
  96. package/dist/cjs/Message/ErrorMessage/ErrorMessage.d.ts +1 -2
  97. package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +5 -8
  98. package/dist/cjs/Message/ImageMessage/ImageMessage.d.ts +1 -2
  99. package/dist/cjs/Message/ImageMessage/ImageMessage.js +2 -8
  100. package/dist/cjs/Message/LinkMessage/LinkMessage.d.ts +1 -2
  101. package/dist/cjs/Message/LinkMessage/LinkMessage.js +6 -9
  102. package/dist/cjs/Message/ListMessage/ListItemMessage.d.ts +1 -2
  103. package/dist/cjs/Message/ListMessage/ListItemMessage.js +2 -8
  104. package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +1 -2
  105. package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -9
  106. package/dist/cjs/Message/ListMessage/UnorderedListMessage.d.ts +1 -2
  107. package/dist/cjs/Message/ListMessage/UnorderedListMessage.js +2 -9
  108. package/dist/cjs/Message/Message.d.ts +26 -8
  109. package/dist/cjs/Message/Message.js +50 -72
  110. package/dist/cjs/Message/Message.test.js +123 -81
  111. package/dist/cjs/Message/MessageInput.d.ts +2 -2
  112. package/dist/cjs/Message/MessageInput.js +5 -14
  113. package/dist/cjs/Message/MessageLoading.d.ts +1 -2
  114. package/dist/cjs/Message/MessageLoading.js +3 -8
  115. package/dist/cjs/Message/Plugins/rehypeMoveImagesOutOfParagraphs.d.ts +2 -0
  116. package/dist/cjs/Message/Plugins/rehypeMoveImagesOutOfParagraphs.js +47 -0
  117. package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +4 -2
  118. package/dist/cjs/Message/QuickResponse/QuickResponse.js +8 -10
  119. package/dist/cjs/Message/QuickStarts/FallbackImg.d.ts +2 -2
  120. package/dist/cjs/Message/QuickStarts/FallbackImg.js +5 -27
  121. package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +4 -2
  122. package/dist/cjs/Message/QuickStarts/QuickStartTile.js +8 -44
  123. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.d.ts +2 -2
  124. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +9 -38
  125. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +16 -16
  126. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.d.ts +2 -2
  127. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.js +2 -26
  128. package/dist/cjs/Message/QuickStarts/types.d.ts +4 -3
  129. package/dist/cjs/Message/TableMessage/TableMessage.d.ts +1 -2
  130. package/dist/cjs/Message/TableMessage/TableMessage.js +8 -10
  131. package/dist/cjs/Message/TableMessage/TbodyMessage.d.ts +2 -3
  132. package/dist/cjs/Message/TableMessage/TbodyMessage.js +7 -9
  133. package/dist/cjs/Message/TableMessage/TdMessage.d.ts +1 -2
  134. package/dist/cjs/Message/TableMessage/TdMessage.js +2 -8
  135. package/dist/cjs/Message/TableMessage/ThMessage.d.ts +1 -2
  136. package/dist/cjs/Message/TableMessage/ThMessage.js +2 -8
  137. package/dist/cjs/Message/TableMessage/TheadMessage.d.ts +1 -2
  138. package/dist/cjs/Message/TableMessage/TheadMessage.js +2 -8
  139. package/dist/cjs/Message/TableMessage/TrMessage.d.ts +2 -3
  140. package/dist/cjs/Message/TableMessage/TrMessage.js +8 -10
  141. package/dist/cjs/Message/TextMessage/TextMessage.d.ts +1 -2
  142. package/dist/cjs/Message/TextMessage/TextMessage.js +2 -9
  143. package/dist/cjs/Message/UserFeedback/CloseButton.d.ts +2 -2
  144. package/dist/cjs/Message/UserFeedback/CloseButton.js +2 -8
  145. package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +2 -2
  146. package/dist/cjs/Message/UserFeedback/UserFeedback.js +13 -24
  147. package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +55 -51
  148. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
  149. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +21 -45
  150. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +83 -89
  151. package/dist/cjs/MessageBar/AttachButton.d.ts +9 -2
  152. package/dist/cjs/MessageBar/AttachButton.js +9 -17
  153. package/dist/cjs/MessageBar/AttachButton.test.js +50 -22
  154. package/dist/cjs/MessageBar/MessageBar.d.ts +16 -3
  155. package/dist/cjs/MessageBar/MessageBar.js +36 -37
  156. package/dist/cjs/MessageBar/MessageBar.test.js +122 -108
  157. package/dist/cjs/MessageBar/MicrophoneButton.d.ts +3 -2
  158. package/dist/cjs/MessageBar/MicrophoneButton.js +8 -15
  159. package/dist/cjs/MessageBar/SendButton.d.ts +4 -2
  160. package/dist/cjs/MessageBar/SendButton.js +4 -12
  161. package/dist/cjs/MessageBar/SendButton.test.js +18 -14
  162. package/dist/cjs/MessageBar/StopButton.d.ts +4 -2
  163. package/dist/cjs/MessageBar/StopButton.js +4 -13
  164. package/dist/cjs/MessageBar/StopButton.test.js +18 -14
  165. package/dist/cjs/MessageBox/JumpButton.d.ts +2 -2
  166. package/dist/cjs/MessageBox/JumpButton.js +2 -10
  167. package/dist/cjs/MessageBox/JumpButton.test.js +10 -10
  168. package/dist/cjs/MessageBox/MessageBox.d.ts +21 -5
  169. package/dist/cjs/MessageBox/MessageBox.js +181 -44
  170. package/dist/cjs/MessageBox/MessageBox.test.js +219 -6
  171. package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +14 -2
  172. package/dist/cjs/PreviewAttachment/PreviewAttachment.js +3 -6
  173. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +1 -1
  174. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +34 -12
  175. package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +5 -5
  176. package/dist/cjs/ResponseActions/ResponseActionButton.js +5 -8
  177. package/dist/cjs/ResponseActions/ResponseActionButton.test.js +19 -19
  178. package/dist/cjs/ResponseActions/ResponseActions.d.ts +7 -3
  179. package/dist/cjs/ResponseActions/ResponseActions.js +12 -16
  180. package/dist/cjs/ResponseActions/ResponseActions.test.js +60 -41
  181. package/dist/cjs/Settings/SettingsForm.d.ts +4 -2
  182. package/dist/cjs/Settings/SettingsForm.js +3 -9
  183. package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -1
  184. package/dist/cjs/Settings/SettingsForm.test.js +18 -9
  185. package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +2 -2
  186. package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.js +2 -11
  187. package/dist/cjs/SourcesCard/SourcesCard.d.ts +2 -2
  188. package/dist/cjs/SourcesCard/SourcesCard.js +17 -43
  189. package/dist/cjs/SourcesCard/SourcesCard.test.js +60 -60
  190. package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +5 -3
  191. package/dist/cjs/TermsOfUse/TermsOfUse.js +5 -17
  192. package/dist/cjs/TermsOfUse/TermsOfUse.test.js +31 -33
  193. package/dist/css/main.css +228 -15
  194. package/dist/css/main.css.map +1 -1
  195. package/dist/esm/AttachMenu/AttachMenu.d.ts +2 -2
  196. package/dist/esm/AttachMenu/AttachMenu.js +2 -9
  197. package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +14 -2
  198. package/dist/esm/AttachmentEdit/AttachmentEdit.js +3 -6
  199. package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +1 -1
  200. package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +30 -5
  201. package/dist/esm/Chatbot/Chatbot.d.ts +3 -2
  202. package/dist/esm/Chatbot/Chatbot.js +5 -7
  203. package/dist/esm/Chatbot/Chatbot.test.js +9 -5
  204. package/dist/esm/ChatbotAlert/ChatbotAlert.d.ts +2 -2
  205. package/dist/esm/ChatbotAlert/ChatbotAlert.js +4 -5
  206. package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +4 -4
  207. package/dist/esm/ChatbotContent/ChatbotContent.d.ts +3 -3
  208. package/dist/esm/ChatbotContent/ChatbotContent.js +2 -5
  209. package/dist/esm/ChatbotContent/ChatbotContent.test.js +3 -3
  210. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +2 -2
  211. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +7 -11
  212. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +8 -10
  213. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +4 -2
  214. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +17 -34
  215. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +29 -33
  216. package/dist/esm/ChatbotConversationHistoryNav/EmptyState.d.ts +2 -2
  217. package/dist/esm/ChatbotConversationHistoryNav/EmptyState.js +2 -6
  218. package/dist/esm/ChatbotConversationHistoryNav/LoadingState.d.ts +2 -2
  219. package/dist/esm/ChatbotConversationHistoryNav/LoadingState.js +2 -22
  220. package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +4 -3
  221. package/dist/esm/ChatbotFooter/ChatbotFooter.js +3 -13
  222. package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
  223. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +8 -3
  224. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +5 -5
  225. package/dist/esm/ChatbotFooter/ChatbotFootnote.d.ts +3 -3
  226. package/dist/esm/ChatbotFooter/ChatbotFootnote.js +10 -23
  227. package/dist/esm/ChatbotHeader/ChatbotHeader.d.ts +3 -3
  228. package/dist/esm/ChatbotHeader/ChatbotHeader.js +2 -4
  229. package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +3 -3
  230. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.d.ts +2 -2
  231. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.js +2 -2
  232. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +3 -3
  233. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +5 -4
  234. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -8
  235. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
  236. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +8 -3
  237. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.d.ts +2 -2
  238. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +2 -2
  239. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +3 -3
  240. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +5 -4
  241. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +20 -8
  242. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
  243. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +8 -3
  244. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +7 -3
  245. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
  246. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
  247. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +13 -7
  248. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +9 -3
  249. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -9
  250. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
  251. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +13 -7
  252. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.d.ts +2 -2
  253. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.js +2 -2
  254. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +12 -12
  255. package/dist/esm/ChatbotModal/ChatbotModal.d.ts +5 -2
  256. package/dist/esm/ChatbotModal/ChatbotModal.js +4 -7
  257. package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +1 -0
  258. package/dist/esm/ChatbotModal/ChatbotModal.test.js +11 -0
  259. package/dist/esm/ChatbotPopover/ChatbotPopover.d.ts +2 -2
  260. package/dist/esm/ChatbotPopover/ChatbotPopover.js +2 -5
  261. package/dist/esm/ChatbotToggle/ChatbotToggle.d.ts +1 -2
  262. package/dist/esm/ChatbotToggle/ChatbotToggle.js +8 -13
  263. package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +8 -8
  264. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +3 -2
  265. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +7 -18
  266. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +11 -7
  267. package/dist/esm/CodeModal/CodeModal.d.ts +10 -2
  268. package/dist/esm/CodeModal/CodeModal.js +8 -20
  269. package/dist/esm/CodeModal/CodeModal.test.d.ts +1 -0
  270. package/dist/esm/CodeModal/CodeModal.test.js +29 -0
  271. package/dist/esm/Compare/Compare.d.ts +2 -2
  272. package/dist/esm/Compare/Compare.js +7 -13
  273. package/dist/esm/Compare/Compare.test.js +4 -6
  274. package/dist/esm/FileDetails/FileDetails.d.ts +2 -2
  275. package/dist/esm/FileDetails/FileDetails.js +2 -15
  276. package/dist/esm/FileDetails/FileDetails.test.js +4 -4
  277. package/dist/esm/FileDetailsLabel/FileDetailsLabel.d.ts +2 -2
  278. package/dist/esm/FileDetailsLabel/FileDetailsLabel.js +2 -5
  279. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +9 -9
  280. package/dist/esm/FileDropZone/FileDropZone.d.ts +9 -2
  281. package/dist/esm/FileDropZone/FileDropZone.js +6 -6
  282. package/dist/esm/FileDropZone/FileDropZone.test.js +29 -3
  283. package/dist/esm/LoadingMessage/LoadingMessage.d.ts +2 -2
  284. package/dist/esm/LoadingMessage/LoadingMessage.js +2 -10
  285. package/dist/esm/LoadingMessage/LoadingMessage.test.js +3 -3
  286. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +20 -3
  287. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +23 -17
  288. package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
  289. package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +130 -0
  290. package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +1 -2
  291. package/dist/esm/Message/ErrorMessage/ErrorMessage.js +5 -5
  292. package/dist/esm/Message/ImageMessage/ImageMessage.d.ts +1 -2
  293. package/dist/esm/Message/ImageMessage/ImageMessage.js +2 -5
  294. package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +1 -2
  295. package/dist/esm/Message/LinkMessage/LinkMessage.js +6 -6
  296. package/dist/esm/Message/ListMessage/ListItemMessage.d.ts +1 -2
  297. package/dist/esm/Message/ListMessage/ListItemMessage.js +2 -5
  298. package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +1 -2
  299. package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -6
  300. package/dist/esm/Message/ListMessage/UnorderedListMessage.d.ts +1 -2
  301. package/dist/esm/Message/ListMessage/UnorderedListMessage.js +2 -6
  302. package/dist/esm/Message/Message.d.ts +26 -8
  303. package/dist/esm/Message/Message.js +50 -72
  304. package/dist/esm/Message/Message.test.js +123 -81
  305. package/dist/esm/Message/MessageInput.d.ts +2 -2
  306. package/dist/esm/Message/MessageInput.js +5 -11
  307. package/dist/esm/Message/MessageLoading.d.ts +1 -2
  308. package/dist/esm/Message/MessageLoading.js +2 -4
  309. package/dist/esm/Message/Plugins/rehypeMoveImagesOutOfParagraphs.d.ts +2 -0
  310. package/dist/esm/Message/Plugins/rehypeMoveImagesOutOfParagraphs.js +43 -0
  311. package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +4 -2
  312. package/dist/esm/Message/QuickResponse/QuickResponse.js +8 -7
  313. package/dist/esm/Message/QuickStarts/FallbackImg.d.ts +2 -2
  314. package/dist/esm/Message/QuickStarts/FallbackImg.js +5 -4
  315. package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +4 -2
  316. package/dist/esm/Message/QuickStarts/QuickStartTile.js +8 -21
  317. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.d.ts +2 -2
  318. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +9 -15
  319. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +5 -5
  320. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.d.ts +2 -2
  321. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.js +2 -3
  322. package/dist/esm/Message/QuickStarts/types.d.ts +4 -3
  323. package/dist/esm/Message/TableMessage/TableMessage.d.ts +1 -2
  324. package/dist/esm/Message/TableMessage/TableMessage.js +8 -7
  325. package/dist/esm/Message/TableMessage/TbodyMessage.d.ts +2 -3
  326. package/dist/esm/Message/TableMessage/TbodyMessage.js +7 -6
  327. package/dist/esm/Message/TableMessage/TdMessage.d.ts +1 -2
  328. package/dist/esm/Message/TableMessage/TdMessage.js +2 -5
  329. package/dist/esm/Message/TableMessage/ThMessage.d.ts +1 -2
  330. package/dist/esm/Message/TableMessage/ThMessage.js +2 -5
  331. package/dist/esm/Message/TableMessage/TheadMessage.d.ts +1 -2
  332. package/dist/esm/Message/TableMessage/TheadMessage.js +2 -5
  333. package/dist/esm/Message/TableMessage/TrMessage.d.ts +2 -3
  334. package/dist/esm/Message/TableMessage/TrMessage.js +8 -7
  335. package/dist/esm/Message/TextMessage/TextMessage.d.ts +1 -2
  336. package/dist/esm/Message/TextMessage/TextMessage.js +2 -6
  337. package/dist/esm/Message/UserFeedback/CloseButton.d.ts +2 -2
  338. package/dist/esm/Message/UserFeedback/CloseButton.js +2 -5
  339. package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +2 -2
  340. package/dist/esm/Message/UserFeedback/UserFeedback.js +13 -24
  341. package/dist/esm/Message/UserFeedback/UserFeedback.test.js +24 -20
  342. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
  343. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +21 -45
  344. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +29 -35
  345. package/dist/esm/MessageBar/AttachButton.d.ts +9 -2
  346. package/dist/esm/MessageBar/AttachButton.js +9 -14
  347. package/dist/esm/MessageBar/AttachButton.test.js +44 -16
  348. package/dist/esm/MessageBar/MessageBar.d.ts +16 -3
  349. package/dist/esm/MessageBar/MessageBar.js +34 -35
  350. package/dist/esm/MessageBar/MessageBar.test.js +87 -73
  351. package/dist/esm/MessageBar/MicrophoneButton.d.ts +3 -2
  352. package/dist/esm/MessageBar/MicrophoneButton.js +8 -12
  353. package/dist/esm/MessageBar/SendButton.d.ts +4 -2
  354. package/dist/esm/MessageBar/SendButton.js +4 -9
  355. package/dist/esm/MessageBar/SendButton.test.js +13 -9
  356. package/dist/esm/MessageBar/StopButton.d.ts +4 -2
  357. package/dist/esm/MessageBar/StopButton.js +4 -10
  358. package/dist/esm/MessageBar/StopButton.test.js +13 -9
  359. package/dist/esm/MessageBox/JumpButton.d.ts +2 -2
  360. package/dist/esm/MessageBox/JumpButton.js +2 -7
  361. package/dist/esm/MessageBox/JumpButton.test.js +9 -9
  362. package/dist/esm/MessageBox/MessageBox.d.ts +21 -5
  363. package/dist/esm/MessageBox/MessageBox.js +181 -44
  364. package/dist/esm/MessageBox/MessageBox.test.js +220 -7
  365. package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +14 -2
  366. package/dist/esm/PreviewAttachment/PreviewAttachment.js +3 -6
  367. package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +1 -1
  368. package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +30 -5
  369. package/dist/esm/ResponseActions/ResponseActionButton.d.ts +5 -5
  370. package/dist/esm/ResponseActions/ResponseActionButton.js +5 -5
  371. package/dist/esm/ResponseActions/ResponseActionButton.test.js +7 -7
  372. package/dist/esm/ResponseActions/ResponseActions.d.ts +7 -3
  373. package/dist/esm/ResponseActions/ResponseActions.js +13 -17
  374. package/dist/esm/ResponseActions/ResponseActions.test.js +35 -16
  375. package/dist/esm/Settings/SettingsForm.d.ts +4 -2
  376. package/dist/esm/Settings/SettingsForm.js +3 -6
  377. package/dist/esm/Settings/SettingsForm.test.d.ts +1 -1
  378. package/dist/esm/Settings/SettingsForm.test.js +16 -4
  379. package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +2 -2
  380. package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.js +2 -8
  381. package/dist/esm/SourcesCard/SourcesCard.d.ts +2 -2
  382. package/dist/esm/SourcesCard/SourcesCard.js +17 -40
  383. package/dist/esm/SourcesCard/SourcesCard.test.js +19 -19
  384. package/dist/esm/TermsOfUse/TermsOfUse.d.ts +5 -3
  385. package/dist/esm/TermsOfUse/TermsOfUse.js +5 -17
  386. package/dist/esm/TermsOfUse/TermsOfUse.test.js +10 -12
  387. package/dist/tsconfig.tsbuildinfo +1 -1
  388. package/package.json +5 -6
  389. package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +10 -0
  390. package/patternfly-docs/content/extensions/chatbot/examples/Customizing Messages/Customizing Messages.md +51 -0
  391. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachMenu.tsx +9 -9
  392. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +14 -5
  393. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +2 -2
  394. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +19 -20
  395. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetails.tsx +2 -2
  396. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +9 -9
  397. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDropZone.tsx +4 -4
  398. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithAttachment.tsx +7 -7
  399. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +2 -12
  400. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +37 -4
  401. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedbackTimeout.tsx +3 -3
  402. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +26 -2
  403. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +13 -2
  404. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +3 -3
  405. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +24 -3
  406. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +1 -0
  407. package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +14 -5
  408. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +20 -14
  409. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +4 -4
  410. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotContainer.tsx +59 -36
  411. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +2 -2
  412. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +2 -2
  413. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +10 -13
  414. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +18 -9
  415. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerNavigation.tsx +5 -5
  416. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +5 -5
  417. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +14 -5
  418. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +17 -8
  419. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderTitle.tsx +59 -34
  420. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBar.tsx +2 -2
  421. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +9 -9
  422. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx +3 -3
  423. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarLanguage.tsx +2 -2
  424. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarStop.tsx +2 -2
  425. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotModal.tsx +74 -37
  426. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotToggleBasic.tsx +3 -3
  427. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomeInteraction.tsx +8 -8
  428. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomePrompt.tsx +3 -3
  429. package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +282 -0
  430. package/patternfly-docs/content/extensions/chatbot/examples/UI/CustomClosedIcon.tsx +3 -3
  431. package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +16 -23
  432. package/patternfly-docs/content/extensions/chatbot/examples/UI/SkipToContent.tsx +5 -5
  433. package/patternfly-docs/content/extensions/chatbot/examples/UI/SquareChatbotToggle.tsx +3 -3
  434. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +91 -48
  435. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUseCompact.tsx +179 -0
  436. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +17 -0
  437. package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +37 -0
  438. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +9 -1
  439. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +19 -25
  440. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +23 -14
  441. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +14 -14
  442. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +475 -0
  443. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +17 -22
  444. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotScrolling.tsx +536 -0
  445. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +17 -22
  446. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +13 -13
  447. package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +7 -7
  448. package/patternfly-docs/content/extensions/chatbot/img/quick-response-confirmation.svg +67 -0
  449. package/src/AttachMenu/AttachMenu.tsx +2 -2
  450. package/src/AttachmentEdit/AttachmentEdit.test.tsx +46 -2
  451. package/src/AttachmentEdit/AttachmentEdit.tsx +29 -7
  452. package/src/Chatbot/Chatbot.scss +7 -0
  453. package/src/Chatbot/Chatbot.test.tsx +9 -1
  454. package/src/Chatbot/Chatbot.tsx +9 -4
  455. package/src/ChatbotAlert/ChatbotAlert.test.tsx +0 -1
  456. package/src/ChatbotAlert/ChatbotAlert.tsx +2 -2
  457. package/src/ChatbotContent/ChatbotContent.test.tsx +0 -1
  458. package/src/ChatbotContent/ChatbotContent.tsx +3 -3
  459. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx +0 -1
  460. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +6 -4
  461. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +38 -3
  462. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +21 -3
  463. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +17 -8
  464. package/src/ChatbotConversationHistoryNav/EmptyState.tsx +2 -2
  465. package/src/ChatbotConversationHistoryNav/LoadingState.tsx +2 -2
  466. package/src/ChatbotFooter/ChatbotFooter.scss +5 -0
  467. package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -1
  468. package/src/ChatbotFooter/ChatbotFooter.tsx +6 -4
  469. package/src/ChatbotFooter/ChatbotFooternote.test.tsx +0 -1
  470. package/src/ChatbotFooter/ChatbotFootnote.tsx +6 -4
  471. package/src/ChatbotHeader/ChatbotHeader.scss +25 -0
  472. package/src/ChatbotHeader/ChatbotHeader.test.tsx +0 -1
  473. package/src/ChatbotHeader/ChatbotHeader.tsx +4 -7
  474. package/src/ChatbotHeader/ChatbotHeaderActions.test.tsx +0 -1
  475. package/src/ChatbotHeader/ChatbotHeaderActions.tsx +2 -2
  476. package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +6 -1
  477. package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +17 -10
  478. package/src/ChatbotHeader/ChatbotHeaderMain.test.tsx +0 -1
  479. package/src/ChatbotHeader/ChatbotHeaderMain.tsx +5 -3
  480. package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +8 -1
  481. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +17 -12
  482. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +15 -1
  483. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +17 -7
  484. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +19 -1
  485. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +30 -6
  486. package/src/ChatbotHeader/ChatbotHeaderTitle.test.tsx +0 -1
  487. package/src/ChatbotHeader/ChatbotHeaderTitle.tsx +2 -2
  488. package/src/ChatbotModal/ChatbotModal.scss +15 -4
  489. package/src/ChatbotModal/ChatbotModal.test.tsx +58 -0
  490. package/src/ChatbotModal/ChatbotModal.tsx +7 -3
  491. package/src/ChatbotPopover/ChatbotPopover.scss +9 -5
  492. package/src/ChatbotPopover/ChatbotPopover.tsx +2 -2
  493. package/src/ChatbotToggle/ChatbotToggle.test.tsx +0 -1
  494. package/src/ChatbotToggle/ChatbotToggle.tsx +5 -3
  495. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -1
  496. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +13 -1
  497. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +15 -4
  498. package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
  499. package/src/CodeModal/CodeModal.scss +11 -3
  500. package/src/CodeModal/CodeModal.test.tsx +51 -0
  501. package/src/CodeModal/CodeModal.tsx +24 -10
  502. package/src/Compare/Compare.test.tsx +0 -1
  503. package/src/Compare/Compare.tsx +7 -6
  504. package/src/FileDetails/FileDetails.test.tsx +0 -1
  505. package/src/FileDetails/FileDetails.tsx +2 -2
  506. package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +1 -1
  507. package/src/FileDetailsLabel/FileDetailsLabel.test.tsx +0 -1
  508. package/src/FileDetailsLabel/FileDetailsLabel.tsx +1 -1
  509. package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +1 -1
  510. package/src/FileDropZone/FileDropZone.test.tsx +29 -1
  511. package/src/FileDropZone/FileDropZone.tsx +13 -3
  512. package/src/LoadingMessage/LoadingMessage.test.tsx +0 -1
  513. package/src/LoadingMessage/LoadingMessage.tsx +2 -2
  514. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +7 -0
  515. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +105 -18
  516. package/src/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.tsx +220 -0
  517. package/src/Message/ErrorMessage/ErrorMessage.tsx +0 -1
  518. package/src/Message/ImageMessage/ImageMessage.tsx +1 -2
  519. package/src/Message/LinkMessage/LinkMessage.tsx +0 -1
  520. package/src/Message/ListMessage/ListItemMessage.tsx +0 -1
  521. package/src/Message/ListMessage/OrderedListMessage.tsx +0 -1
  522. package/src/Message/ListMessage/UnorderedListMessage.tsx +0 -1
  523. package/src/Message/Message.scss +27 -0
  524. package/src/Message/Message.test.tsx +70 -6
  525. package/src/Message/Message.tsx +41 -17
  526. package/src/Message/MessageInput.tsx +5 -5
  527. package/src/Message/MessageLoading.tsx +0 -2
  528. package/src/Message/Plugins/rehypeMoveImagesOutOfParagraphs.ts +53 -0
  529. package/src/Message/QuickResponse/QuickResponse.tsx +9 -4
  530. package/src/Message/QuickStarts/FallbackImg.tsx +4 -3
  531. package/src/Message/QuickStarts/QuickStartTile.tsx +8 -4
  532. package/src/Message/QuickStarts/QuickStartTileDescription.test.tsx +0 -1
  533. package/src/Message/QuickStarts/QuickStartTileDescription.tsx +4 -3
  534. package/src/Message/QuickStarts/QuickStartTileHeader.tsx +2 -2
  535. package/src/Message/QuickStarts/types.ts +4 -3
  536. package/src/Message/TableMessage/TableMessage.tsx +4 -4
  537. package/src/Message/TableMessage/TbodyMessage.tsx +3 -3
  538. package/src/Message/TableMessage/TdMessage.tsx +1 -2
  539. package/src/Message/TableMessage/ThMessage.tsx +1 -2
  540. package/src/Message/TableMessage/TheadMessage.tsx +3 -2
  541. package/src/Message/TableMessage/TrMessage.tsx +4 -4
  542. package/src/Message/TextMessage/TextMessage.scss +25 -0
  543. package/src/Message/TextMessage/TextMessage.tsx +1 -2
  544. package/src/Message/UserFeedback/CloseButton.tsx +2 -2
  545. package/src/Message/UserFeedback/UserFeedback.scss +24 -3
  546. package/src/Message/UserFeedback/UserFeedback.test.tsx +13 -1
  547. package/src/Message/UserFeedback/UserFeedback.tsx +12 -8
  548. package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +4 -1
  549. package/src/Message/UserFeedback/UserFeedbackComplete.tsx +26 -16
  550. package/src/MessageBar/AttachButton.scss +10 -0
  551. package/src/MessageBar/AttachButton.test.tsx +56 -8
  552. package/src/MessageBar/AttachButton.tsx +21 -8
  553. package/src/MessageBar/MessageBar.scss +17 -0
  554. package/src/MessageBar/MessageBar.test.tsx +81 -30
  555. package/src/MessageBar/MessageBar.tsx +60 -25
  556. package/src/MessageBar/MicrophoneButton.scss +10 -0
  557. package/src/MessageBar/MicrophoneButton.tsx +15 -9
  558. package/src/MessageBar/SendButton.scss +10 -0
  559. package/src/MessageBar/SendButton.test.tsx +10 -7
  560. package/src/MessageBar/SendButton.tsx +9 -5
  561. package/src/MessageBar/StopButton.scss +10 -0
  562. package/src/MessageBar/StopButton.test.tsx +10 -7
  563. package/src/MessageBar/StopButton.tsx +9 -5
  564. package/src/MessageBox/JumpButton.test.tsx +4 -5
  565. package/src/MessageBox/JumpButton.tsx +3 -3
  566. package/src/MessageBox/MessageBox.scss +6 -0
  567. package/src/MessageBox/MessageBox.test.tsx +295 -5
  568. package/src/MessageBox/MessageBox.tsx +301 -82
  569. package/src/PreviewAttachment/PreviewAttachment.test.tsx +44 -2
  570. package/src/PreviewAttachment/PreviewAttachment.tsx +29 -7
  571. package/src/ResponseActions/ResponseActionButton.test.tsx +0 -1
  572. package/src/ResponseActions/ResponseActionButton.tsx +6 -5
  573. package/src/ResponseActions/ResponseActions.test.tsx +23 -3
  574. package/src/ResponseActions/ResponseActions.tsx +40 -10
  575. package/src/Settings/Settings.scss +11 -0
  576. package/src/Settings/SettingsForm.test.tsx +17 -1
  577. package/src/Settings/SettingsForm.tsx +8 -3
  578. package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx +2 -2
  579. package/src/SourcesCard/SourcesCard.scss +8 -0
  580. package/src/SourcesCard/SourcesCard.test.tsx +0 -1
  581. package/src/SourcesCard/SourcesCard.tsx +9 -8
  582. package/src/TermsOfUse/TermsOfUse.scss +20 -0
  583. package/src/TermsOfUse/TermsOfUse.test.tsx +0 -1
  584. package/src/TermsOfUse/TermsOfUse.tsx +15 -9
  585. package/tsconfig.cjs.json +0 -1
  586. package/tsconfig.json +3 -3
@@ -1,12 +1,7 @@
1
- // ============================================================================
2
- // Chatbot Main - Messages - Jump to Top
3
- // ============================================================================
4
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
5
2
  // Import PatternFly components
6
3
  import { Button, Tooltip, Icon } from '@patternfly/react-core';
7
4
  import { ArrowUpIcon } from '@patternfly/react-icons/dist/esm/icons/arrow-up-icon';
8
5
  import { ArrowDownIcon } from '@patternfly/react-icons/dist/esm/icons/arrow-down-icon';
9
- const JumpButton = ({ position, isHidden, onClick }) => isHidden ? null : (React.createElement(Tooltip, { id: `pf-chatbot__tooltip--jump-${position}`, content: `Back to ${position}`, position: "top" },
10
- React.createElement(Button, { variant: "plain", className: `pf-chatbot__jump pf-chatbot__jump--${position}`, "aria-label": `Jump ${position} button`, onClick: onClick },
11
- React.createElement(Icon, { iconSize: "lg", isInline: true }, position === 'top' ? React.createElement(ArrowUpIcon, null) : React.createElement(ArrowDownIcon, null)))));
6
+ const JumpButton = ({ position, isHidden, onClick }) => isHidden ? null : (_jsx(Tooltip, { id: `pf-chatbot__tooltip--jump-${position}`, content: `Back to ${position}`, position: "top", children: _jsx(Button, { variant: "plain", className: `pf-chatbot__jump pf-chatbot__jump--${position}`, "aria-label": `Jump ${position}`, onClick: onClick, children: _jsx(Icon, { iconSize: "lg", isInline: true, children: position === 'top' ? _jsx(ArrowUpIcon, {}) : _jsx(ArrowDownIcon, {}) }) }) }));
12
7
  export default JumpButton;
@@ -7,28 +7,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import React from 'react';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  import { render, screen } from '@testing-library/react';
12
12
  import '@testing-library/jest-dom';
13
13
  import JumpButton from './JumpButton';
14
14
  import userEvent from '@testing-library/user-event';
15
15
  describe('JumpButton', () => {
16
16
  it('should render top button correctly', () => {
17
- render(React.createElement(JumpButton, { position: "top", onClick: jest.fn() }));
18
- expect(screen.getByRole('button', { name: /Jump top button/i })).toBeTruthy();
17
+ render(_jsx(JumpButton, { position: "top", onClick: jest.fn() }));
18
+ expect(screen.getByRole('button', { name: /Jump top/i })).toBeTruthy();
19
19
  });
20
20
  it('should render bottom button correctly', () => {
21
- render(React.createElement(JumpButton, { position: "bottom", onClick: jest.fn() }));
22
- expect(screen.getByRole('button', { name: /Jump bottom button/i })).toBeTruthy();
21
+ render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn() }));
22
+ expect(screen.getByRole('button', { name: /Jump bottom/i })).toBeTruthy();
23
23
  });
24
24
  it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
25
25
  const spy = jest.fn();
26
- render(React.createElement(JumpButton, { position: "bottom", onClick: spy }));
27
- yield userEvent.click(screen.getByRole('button', { name: /Jump bottom button/i }));
26
+ render(_jsx(JumpButton, { position: "bottom", onClick: spy }));
27
+ yield userEvent.click(screen.getByRole('button', { name: /Jump bottom/i }));
28
28
  expect(spy).toHaveBeenCalledTimes(1);
29
29
  }));
30
30
  it('should be hidden if isHidden prop is used', () => __awaiter(void 0, void 0, void 0, function* () {
31
- render(React.createElement(JumpButton, { position: "bottom", onClick: jest.fn(), isHidden: true }));
32
- expect(screen.queryByRole('button', { name: /Jump bottom button/i })).toBeFalsy();
31
+ render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn(), isHidden: true }));
32
+ expect(screen.queryByRole('button', { name: /Jump bottom/i })).toBeFalsy();
33
33
  }));
34
34
  });
@@ -1,17 +1,33 @@
1
- import React from 'react';
2
- export interface MessageBoxProps extends React.HTMLProps<HTMLDivElement> {
1
+ import { HTMLProps, ReactNode } from 'react';
2
+ export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
3
3
  /** Content that can be announced, such as a new message, for screen readers */
4
4
  announcement?: string;
5
5
  /** Custom aria-label for scrollable portion of message box */
6
6
  ariaLabel?: string;
7
7
  /** Content to be displayed in the message box */
8
- children: React.ReactNode;
8
+ children: ReactNode;
9
9
  /** Custom classname for the MessageBox component */
10
10
  className?: string;
11
- /** Ref applied to message box */
11
+ /** @deprecated innerRef has been deprecated. Use ref instead. Ref applied to message box */
12
12
  innerRef?: React.Ref<HTMLDivElement>;
13
13
  /** Modifier that controls how content in MessageBox is positioned within the container */
14
14
  position?: 'top' | 'bottom';
15
+ /** Click handler for additional logic for when scroll to top jump button is clicked */
16
+ onScrollToTopClick?: () => void;
17
+ /** Click handler for additional logic for when scroll to bottom jump button is clicked */
18
+ onScrollToBottomClick?: () => void;
19
+ /** Flag to enable automatic scrolling when new messages are added */
20
+ enableSmartScroll?: boolean;
15
21
  }
16
- export declare const MessageBox: React.ForwardRefExoticComponent<Omit<MessageBoxProps, "ref"> & React.RefAttributes<any>>;
22
+ export interface MessageBoxHandle extends HTMLDivElement {
23
+ /** Scrolls to the top of the message box */
24
+ scrollToTop: (options?: ScrollOptions) => void;
25
+ /** Scrolls to the bottom of the message box */
26
+ scrollToBottom: (options?: {
27
+ resumeSmartScroll?: boolean;
28
+ } & ScrollOptions) => void;
29
+ /** Returns whether the smart scroll feature is currently active */
30
+ isSmartScrollActive: () => boolean;
31
+ }
32
+ export declare const MessageBox: import("react").ForwardRefExoticComponent<Omit<MessageBoxProps, "ref"> & import("react").RefAttributes<MessageBoxHandle | null>>;
17
33
  export default MessageBox;
@@ -1,68 +1,205 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
13
  // ============================================================================
2
14
  // Chatbot Main - Messages
3
15
  // ============================================================================
4
- import React from 'react';
16
+ import { useState, useRef, useCallback, useEffect, forwardRef, useImperativeHandle } from 'react';
5
17
  import JumpButton from './JumpButton';
6
- const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top' }) => {
7
- const [atTop, setAtTop] = React.useState(false);
8
- const [atBottom, setAtBottom] = React.useState(true);
9
- const [isOverflowing, setIsOverflowing] = React.useState(false);
10
- const defaultRef = React.useRef(null);
11
- let messageBoxRef;
12
- if (innerRef) {
13
- messageBoxRef = innerRef;
14
- }
15
- else {
16
- messageBoxRef = defaultRef;
17
- }
18
+ export const MessageBox = forwardRef((_a, ref) => {
19
+ var { announcement, ariaLabel = 'Scrollable message log', children, className, position = 'top', onScrollToTopClick, onScrollToBottomClick, enableSmartScroll = false } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "className", "position", "onScrollToTopClick", "onScrollToBottomClick", "enableSmartScroll"]);
20
+ const [atTop, setAtTop] = useState(false);
21
+ const [atBottom, setAtBottom] = useState(true);
22
+ const [isOverflowing, setIsOverflowing] = useState(false);
23
+ const [autoScroll, setAutoScroll] = useState(true);
24
+ const lastScrollTop = useRef(0);
25
+ const animationFrame = useRef(null);
26
+ const debounceTimeout = useRef(null);
27
+ const pauseAutoScrollRef = useRef(false);
28
+ const messageBoxRef = useRef(null);
29
+ const scrollQueued = useRef(false);
30
+ const resetUserScrollIntentTimeout = useRef();
18
31
  // Configure handlers
19
- const handleScroll = React.useCallback(() => {
32
+ const handleScroll = useCallback(() => {
20
33
  const element = messageBoxRef.current;
21
- if (element) {
22
- const { scrollTop, scrollHeight, clientHeight } = element;
23
- setAtTop(scrollTop === 0);
24
- setAtBottom(Math.round(scrollTop) + Math.round(clientHeight) >= Math.round(scrollHeight) - 1); // rounding means it could be within a pixel of the bottom
34
+ if (!element) {
35
+ return;
36
+ }
37
+ const { scrollTop, scrollHeight, clientHeight } = element;
38
+ const roundedScrollTop = Math.round(scrollTop);
39
+ const roundedClientHeight = Math.round(clientHeight);
40
+ const roundedScrollHeight = Math.round(scrollHeight);
41
+ const distanceFromBottom = roundedScrollHeight - roundedScrollTop - roundedClientHeight;
42
+ const isScrollingDown = roundedScrollTop > lastScrollTop.current;
43
+ const DELTA_UP = 10;
44
+ const DELTA_DOWN = 50;
45
+ const DEBOUNCE_DELAY = 200;
46
+ const delta = isScrollingDown ? DELTA_DOWN : DELTA_UP;
47
+ const isAtBottom = distanceFromBottom <= delta;
48
+ setAtTop(roundedScrollTop === 0);
49
+ setAtBottom(roundedScrollTop + roundedClientHeight >= roundedScrollHeight - 1); // rounding means it could be within a pixel of the bottom
50
+ if (!enableSmartScroll || scrollQueued.current) {
51
+ return;
52
+ }
53
+ if (roundedScrollTop === 0) {
54
+ pauseAutoScrollRef.current = false;
55
+ }
56
+ if (debounceTimeout.current) {
57
+ clearTimeout(debounceTimeout.current);
25
58
  }
59
+ if (!isAtBottom && !pauseAutoScrollRef.current) {
60
+ setAutoScroll(false);
61
+ }
62
+ // User is near bottom and scrolling down - debounce re-enabling auto-scroll
63
+ if (isAtBottom && isScrollingDown && !pauseAutoScrollRef.current) {
64
+ debounceTimeout.current = setTimeout(() => {
65
+ setAutoScroll(true);
66
+ }, DEBOUNCE_DELAY);
67
+ }
68
+ lastScrollTop.current = roundedScrollTop;
26
69
  }, [messageBoxRef]);
27
- const checkOverflow = React.useCallback(() => {
70
+ const checkOverflow = useCallback(() => {
28
71
  const element = messageBoxRef.current;
29
72
  if (element) {
30
73
  const { scrollHeight, clientHeight } = element;
31
74
  setIsOverflowing(scrollHeight >= clientHeight);
32
75
  }
33
76
  }, [messageBoxRef]);
34
- const scrollToTop = React.useCallback(() => {
77
+ const resumeAutoScroll = useCallback(() => {
78
+ if (!enableSmartScroll) {
79
+ return;
80
+ }
81
+ pauseAutoScrollRef.current = false;
82
+ setAutoScroll(true);
83
+ }, [enableSmartScroll]);
84
+ const pauseAutoScroll = useCallback(() => {
85
+ if (!enableSmartScroll) {
86
+ return;
87
+ }
88
+ pauseAutoScrollRef.current = true;
89
+ setAutoScroll(false);
90
+ }, [enableSmartScroll]);
91
+ /**
92
+ * Scrolls to the top of the message box.
93
+ *
94
+ */
95
+ const scrollToTop = useCallback((options) => {
96
+ const { behavior = 'smooth' } = options || {};
35
97
  const element = messageBoxRef.current;
36
- if (element) {
37
- element.scrollTo({ top: 0, behavior: 'smooth' });
98
+ if (!element || scrollQueued.current) {
99
+ return;
38
100
  }
101
+ scrollQueued.current = true;
102
+ pauseAutoScroll();
103
+ if (animationFrame.current) {
104
+ cancelAnimationFrame(animationFrame.current);
105
+ animationFrame.current = null;
106
+ }
107
+ animationFrame.current = requestAnimationFrame(() => {
108
+ element.scrollTo({ top: 0, behavior });
109
+ scrollQueued.current = false;
110
+ });
111
+ onScrollToTopClick && onScrollToTopClick();
39
112
  }, [messageBoxRef]);
40
- const scrollToBottom = React.useCallback(() => {
113
+ /**
114
+ * Scrolls to the bottom of the message box.
115
+ *
116
+ * @param options.resumeSmartScroll - If true, resumes smart scroll behavior;
117
+ * if false or omitted, scrolls without resuming auto-scroll.
118
+ * @param options.scrollOptions - Additional scroll options. behavior can be 'smooth' or 'auto'.
119
+ */
120
+ const scrollToBottom = useCallback((options) => {
121
+ const { behavior = 'smooth', resumeSmartScroll = false } = options || {};
122
+ resumeSmartScroll && resumeAutoScroll();
41
123
  const element = messageBoxRef.current;
42
- if (element) {
43
- element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
124
+ if (!element || pauseAutoScrollRef.current || scrollQueued.current) {
125
+ return;
44
126
  }
45
- }, [messageBoxRef]);
127
+ scrollQueued.current = true;
128
+ if (animationFrame.current) {
129
+ cancelAnimationFrame(animationFrame.current);
130
+ }
131
+ animationFrame.current = requestAnimationFrame(() => {
132
+ element.scrollTo({ top: element.scrollHeight, behavior });
133
+ resumeAutoScroll();
134
+ scrollQueued.current = false;
135
+ });
136
+ onScrollToBottomClick && onScrollToBottomClick();
137
+ }, [messageBoxRef, enableSmartScroll]);
46
138
  // Detect scroll position
47
- React.useEffect(() => {
139
+ useEffect(() => {
48
140
  const element = messageBoxRef.current;
49
- if (element) {
50
- // Listen for scroll events
51
- element.addEventListener('scroll', handleScroll);
52
- // Check initial position and overflow
53
- handleScroll();
54
- checkOverflow();
55
- return () => {
56
- element.removeEventListener('scroll', handleScroll);
57
- };
141
+ if (!element) {
142
+ return;
58
143
  }
144
+ // Listen for scroll events
145
+ element.addEventListener('scroll', handleScroll);
146
+ // Check initial position and overflow
147
+ handleScroll();
148
+ checkOverflow();
149
+ return () => {
150
+ element.removeEventListener('scroll', handleScroll);
151
+ };
59
152
  }, [checkOverflow, handleScroll, messageBoxRef]);
60
- return (React.createElement(React.Fragment, null,
61
- React.createElement(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }),
62
- React.createElement("div", { role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef },
63
- children,
64
- React.createElement("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite" }, announcement)),
65
- React.createElement(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })));
66
- };
67
- export const MessageBox = React.forwardRef((props, ref) => (React.createElement(MessageBoxBase, Object.assign({ innerRef: ref }, props))));
153
+ useImperativeHandle(ref, () => {
154
+ const node = messageBoxRef.current;
155
+ // Attach custom methods to the element
156
+ node.scrollToTop = scrollToTop;
157
+ node.scrollToBottom = scrollToBottom;
158
+ node.isSmartScrollActive = () => enableSmartScroll && autoScroll;
159
+ return node;
160
+ });
161
+ let lastTouchY = null;
162
+ const onTouchEnd = (event) => {
163
+ lastTouchY = null;
164
+ props.onTouchEnd && props.onTouchEnd(event);
165
+ };
166
+ const handleUserScroll = (isScrollingDown) => {
167
+ const container = messageBoxRef.current;
168
+ if (!enableSmartScroll || !container) {
169
+ return;
170
+ }
171
+ if (!isScrollingDown) {
172
+ pauseAutoScrollRef.current = true;
173
+ clearTimeout(resetUserScrollIntentTimeout.current);
174
+ return;
175
+ }
176
+ const { scrollTop, scrollHeight, clientHeight } = container;
177
+ const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
178
+ if (distanceFromBottom < 100) {
179
+ pauseAutoScrollRef.current = false;
180
+ setAutoScroll(true);
181
+ }
182
+ };
183
+ const onWheel = (event) => {
184
+ const isScrollingDown = event.deltaY > 0;
185
+ handleUserScroll(isScrollingDown);
186
+ props.onWheel && props.onWheel(event);
187
+ };
188
+ const onTouchMove = (event) => {
189
+ const currentTouchY = event.touches[0].clientY;
190
+ let isScrollingDown = false;
191
+ if (lastTouchY !== null) {
192
+ isScrollingDown = currentTouchY < lastTouchY;
193
+ }
194
+ lastTouchY = currentTouchY;
195
+ handleUserScroll(isScrollingDown);
196
+ props.onTouchMove && props.onTouchMove(event);
197
+ };
198
+ const smartScrollHandlers = {
199
+ onWheel,
200
+ onTouchMove,
201
+ onTouchEnd
202
+ };
203
+ return (_jsxs(_Fragment, { children: [_jsx(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }), _jsxs("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: messageBoxRef }, props, (enableSmartScroll ? Object.assign({}, smartScrollHandlers) : {}), { children: [children, _jsx("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite", children: announcement })] })), _jsx(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: () => scrollToBottom({ resumeSmartScroll: true }) })] }));
204
+ });
68
205
  export default MessageBox;
@@ -1,17 +1,230 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
11
+ import { createRef } from 'react';
12
+ import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
3
13
  import { MessageBox } from './MessageBox';
14
+ import userEvent from '@testing-library/user-event';
4
15
  describe('MessageBox', () => {
16
+ beforeEach(() => {
17
+ jest.spyOn(window, 'requestAnimationFrame').mockImplementation((cb) => {
18
+ cb(0); // Immediately call the callback
19
+ return 0;
20
+ });
21
+ });
22
+ afterEach(() => {
23
+ jest.restoreAllMocks();
24
+ });
5
25
  it('should render Message box', () => {
6
- render(React.createElement(MessageBox, null,
7
- React.createElement(React.Fragment, null, "Chatbot Messages")));
26
+ render(_jsx(MessageBox, { children: _jsx(_Fragment, { children: "Chatbot Messages" }) }));
8
27
  expect(screen.getByText('Chatbot Messages')).toBeTruthy();
9
28
  });
10
29
  it('should assign ref to Message box', () => {
11
- const ref = React.createRef();
12
- render(React.createElement(MessageBox, { ref: ref },
13
- React.createElement("div", null, "Test message content")));
30
+ var _a, _b, _c, _d;
31
+ const ref = createRef();
32
+ render(_jsx(MessageBox, { "data-testid": "message-box", ref: ref, children: _jsx("div", { children: "Test message content" }) }));
33
+ screen.getByText('Test message content');
14
34
  expect(ref.current).not.toBeNull();
35
+ // should contain custom methods exposed by the ref
36
+ expect(typeof ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive)).toBe('function');
37
+ expect(typeof ((_b = ref.current) === null || _b === void 0 ? void 0 : _b.scrollToTop)).toBe('function');
38
+ expect(typeof ((_c = ref.current) === null || _c === void 0 ? void 0 : _c.scrollToBottom)).toBe('function');
39
+ expect((_d = ref.current) === null || _d === void 0 ? void 0 : _d.isSmartScrollActive()).toBe(false);
15
40
  expect(ref.current).toBeInstanceOf(HTMLDivElement);
16
41
  });
42
+ it('should call onScrollToBottomClick when scroll to bottom button is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
43
+ const spy = jest.fn();
44
+ render(_jsx(MessageBox, { onScrollToBottomClick: spy, children: _jsx("div", { children: "Test message content" }) }));
45
+ // this forces button to show
46
+ const region = screen.getByRole('region');
47
+ Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
48
+ Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
49
+ Object.defineProperty(region, 'scrollTop', { configurable: true, value: 0 });
50
+ act(() => {
51
+ region.dispatchEvent(new Event('scroll'));
52
+ });
53
+ yield waitFor(() => {
54
+ userEvent.click(screen.getByRole('button', { name: /Jump bottom/i }));
55
+ expect(spy).toHaveBeenCalled();
56
+ });
57
+ }));
58
+ it('should call onScrollToTopClick when scroll to top button is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
59
+ const spy = jest.fn();
60
+ render(_jsx(MessageBox, { onScrollToTopClick: spy, children: _jsx("div", { children: "Test message content" }) }));
61
+ // this forces button to show
62
+ const region = screen.getByRole('region');
63
+ Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
64
+ Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
65
+ Object.defineProperty(region, 'scrollTop', {
66
+ configurable: true,
67
+ value: 500
68
+ });
69
+ act(() => {
70
+ region.dispatchEvent(new Event('scroll'));
71
+ });
72
+ yield waitFor(() => {
73
+ userEvent.click(screen.getByRole('button', { name: /Jump top/i }));
74
+ expect(spy).toHaveBeenCalled();
75
+ });
76
+ }));
77
+ it('should call user defined onWheel, onTouchMove and onTouchEnd handlers', () => __awaiter(void 0, void 0, void 0, function* () {
78
+ const ref = createRef();
79
+ const onWheel = jest.fn();
80
+ const onTouchMove = jest.fn();
81
+ const onTouchEnd = jest.fn();
82
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, onWheel: onWheel, onTouchMove: onTouchMove, onTouchEnd: onTouchEnd, children: _jsx("div", { children: "Test message content" }) }));
83
+ const element = ref.current;
84
+ act(() => {
85
+ fireEvent.wheel(element, { deltaY: 10 });
86
+ fireEvent.touchMove(element, { touches: [{ clientY: 700 }] });
87
+ fireEvent.touchEnd(element);
88
+ });
89
+ expect(onWheel).toHaveBeenCalled();
90
+ expect(onTouchMove).toHaveBeenCalled();
91
+ expect(onTouchEnd).toHaveBeenCalled();
92
+ }));
93
+ it('should scroll to the bottom when the method is called ', () => __awaiter(void 0, void 0, void 0, function* () {
94
+ var _a;
95
+ const ref = createRef();
96
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, children: _jsx("div", { children: "Test message content" }) }));
97
+ const element = ref.current;
98
+ const scrollSpy = jest.spyOn(element, 'scrollTo');
99
+ act(() => {
100
+ var _a, _b, _c;
101
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollToBottom();
102
+ (_b = ref.current) === null || _b === void 0 ? void 0 : _b.scrollToBottom();
103
+ (_c = ref.current) === null || _c === void 0 ? void 0 : _c.scrollToBottom();
104
+ });
105
+ expect(scrollSpy).toHaveBeenCalledWith({ top: element.scrollHeight, behavior: 'smooth' });
106
+ expect((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive()).toBe(true);
107
+ }));
108
+ it('should scroll to the top when the method is called ', () => __awaiter(void 0, void 0, void 0, function* () {
109
+ var _a;
110
+ const ref = createRef();
111
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, children: _jsx("div", { children: "Test message content" }) }));
112
+ const element = ref.current;
113
+ const scrollSpy = jest.spyOn(element, 'scrollTo');
114
+ act(() => {
115
+ var _a;
116
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollToTop();
117
+ });
118
+ expect(scrollSpy).toHaveBeenCalledWith({ top: 0, behavior: 'smooth' });
119
+ expect((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive()).toBe(false);
120
+ }));
121
+ it('should pause automatic scrolling when user scrolls up ', () => __awaiter(void 0, void 0, void 0, function* () {
122
+ var _a, _b;
123
+ const ref = createRef();
124
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, children: _jsx("div", { children: "Test message content" }) }));
125
+ expect((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive()).toBe(true);
126
+ const element = ref.current;
127
+ // Manually set scrollHeight and clientHeight for calculations
128
+ Object.defineProperty(element, 'scrollHeight', { configurable: true, value: 1000 });
129
+ Object.defineProperty(element, 'clientHeight', { configurable: true, value: 300 });
130
+ // Simulate scroll up by changing scrollTop
131
+ element.scrollTop = 200;
132
+ const scrollEvent = new Event('scroll', { bubbles: true });
133
+ act(() => {
134
+ element.dispatchEvent(scrollEvent);
135
+ });
136
+ expect((_b = ref.current) === null || _b === void 0 ? void 0 : _b.isSmartScrollActive()).toBe(false);
137
+ }));
138
+ it('should resume automatic scrolling when user scrolls down to the bottom using scroll event', () => __awaiter(void 0, void 0, void 0, function* () {
139
+ var _a, _b;
140
+ jest.useFakeTimers();
141
+ const ref = createRef();
142
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, children: _jsx("div", { children: "Test message content" }) }));
143
+ const element = ref.current;
144
+ // Manually set scrollHeight and clientHeight for calculations
145
+ Object.defineProperty(element, 'scrollHeight', { configurable: true, value: 1000 });
146
+ Object.defineProperty(element, 'clientHeight', { configurable: true, value: 300 });
147
+ // Simulate scroll up by changing scrollTop
148
+ element.scrollTop = 100;
149
+ const scrollEvent = new Event('scroll', { bubbles: true });
150
+ act(() => {
151
+ element.dispatchEvent(scrollEvent);
152
+ });
153
+ expect((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive()).toBe(false);
154
+ act(() => {
155
+ // Simulate scroll down by changing scrollTop
156
+ element.scrollTop = 650; // scrollHeight - scrollTop - clientHeight - DELTA_DOWN (50) = 0
157
+ const scrollEvent = new Event('scroll', { bubbles: true });
158
+ element.dispatchEvent(scrollEvent);
159
+ jest.advanceTimersByTime(250);
160
+ });
161
+ expect((_b = ref.current) === null || _b === void 0 ? void 0 : _b.isSmartScrollActive()).toBe(true);
162
+ jest.useRealTimers();
163
+ }));
164
+ it('should resume automatic scrolling when scrollToBottom method is used', () => __awaiter(void 0, void 0, void 0, function* () {
165
+ var _a, _b;
166
+ const ref = createRef();
167
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, children: _jsx("div", { children: "Test message content" }) }));
168
+ const element = ref.current;
169
+ // Manually set scrollHeight and clientHeight for calculations
170
+ Object.defineProperty(element, 'scrollHeight', { configurable: true, value: 1000 });
171
+ Object.defineProperty(element, 'clientHeight', { configurable: true, value: 300 });
172
+ // Simulate scroll up by changing scrollTop
173
+ element.scrollTop = 100;
174
+ const scrollEvent = new Event('scroll', { bubbles: true });
175
+ act(() => {
176
+ element.dispatchEvent(scrollEvent);
177
+ });
178
+ expect((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive()).toBe(false);
179
+ act(() => {
180
+ var _a;
181
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollToBottom({ resumeSmartScroll: true, behavior: 'auto' }); // resumes auto scroll and scrolls to bottom.
182
+ });
183
+ expect((_b = ref.current) === null || _b === void 0 ? void 0 : _b.isSmartScrollActive()).toBe(true);
184
+ }));
185
+ it('should resume automatic scrolling when mouse wheel event is used', () => __awaiter(void 0, void 0, void 0, function* () {
186
+ var _a, _b;
187
+ const ref = createRef();
188
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, children: _jsx("div", { children: "Test message content" }) }));
189
+ const element = ref.current;
190
+ // Manually set scrollHeight and clientHeight for calculations
191
+ Object.defineProperty(element, 'scrollHeight', { configurable: true, value: 1000 });
192
+ Object.defineProperty(element, 'clientHeight', { configurable: true, value: 300 });
193
+ Object.defineProperty(element, 'scrollTop', { configurable: true, value: 350 });
194
+ const scrollEvent = new Event('scroll', { bubbles: true });
195
+ act(() => {
196
+ element.dispatchEvent(scrollEvent);
197
+ });
198
+ expect((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive()).toBe(false);
199
+ // Simulate mouse wheel event
200
+ act(() => {
201
+ Object.defineProperty(element, 'scrollTop', { configurable: true, value: 650 });
202
+ fireEvent.wheel(element, { deltaY: 10 });
203
+ });
204
+ expect((_b = ref.current) === null || _b === void 0 ? void 0 : _b.isSmartScrollActive()).toBe(true);
205
+ }));
206
+ it('should resume automatic scrolling when user swipes up in touch screen', () => __awaiter(void 0, void 0, void 0, function* () {
207
+ var _a, _b;
208
+ const ref = createRef();
209
+ render(_jsx(MessageBox, { ref: ref, enableSmartScroll: true, children: _jsx("div", { children: "Test message content" }) }));
210
+ const element = ref.current;
211
+ // Manually set scrollHeight and clientHeight for calculations
212
+ Object.defineProperty(element, 'scrollHeight', { configurable: true, value: 1000 });
213
+ Object.defineProperty(element, 'clientHeight', { configurable: true, value: 300 });
214
+ Object.defineProperty(element, 'scrollTop', { configurable: true, value: 350 });
215
+ const scrollEvent = new Event('scroll', { bubbles: true });
216
+ act(() => {
217
+ element.dispatchEvent(scrollEvent);
218
+ });
219
+ expect((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isSmartScrollActive()).toBe(false);
220
+ // Simulate touch event - swipe up
221
+ act(() => {
222
+ Object.defineProperty(element, 'scrollTop', { configurable: true, value: 650 });
223
+ fireEvent.touchStart(element, { touches: [{ clientY: 700 }] });
224
+ fireEvent.touchMove(element, { touches: [{ clientY: 700 }] });
225
+ fireEvent.touchMove(element, { touches: [{ clientY: 600 }] });
226
+ fireEvent.touchEnd(element);
227
+ });
228
+ expect((_b = ref.current) === null || _b === void 0 ? void 0 : _b.isSmartScrollActive()).toBe(true);
229
+ }));
17
230
  });
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type { FunctionComponent, MouseEvent } from 'react';
2
2
  import { ChatbotDisplayMode } from '../Chatbot';
3
3
  export interface PreviewAttachmentProps {
4
4
  /** Text shown in code editor */
@@ -17,6 +17,18 @@ export interface PreviewAttachmentProps {
17
17
  title?: string;
18
18
  /** Display mode for the Chatbot parent; this influences the styles applied */
19
19
  displayMode?: ChatbotDisplayMode;
20
+ /** Sets modal to compact styling. */
21
+ isCompact?: boolean;
22
+ /** Primary action button text */
23
+ primaryActionButtonText?: string;
24
+ /** Secondary action button text */
25
+ secondaryActionButtonText?: string;
26
+ /** Class applied to modal header */
27
+ modalHeaderClassName?: string;
28
+ /** Class applied to modal body */
29
+ modalBodyClassName?: string;
30
+ /** Class applied to modal footer */
31
+ modalFooterClassName?: string;
20
32
  }
21
- export declare const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>;
33
+ export declare const PreviewAttachment: FunctionComponent<PreviewAttachmentProps>;
22
34
  export default PreviewAttachment;
@@ -1,10 +1,7 @@
1
- // ============================================================================
2
- // Preview Attachment - Chatbot Code Snippet Viewer
3
- // ============================================================================
4
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
5
2
  import CodeModal from '../CodeModal';
6
3
  import { ChatbotDisplayMode } from '../Chatbot';
7
- export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', displayMode = ChatbotDisplayMode.default }) => {
4
+ export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', primaryActionButtonText = 'Edit', secondaryActionButtonText = 'Dismiss', displayMode = ChatbotDisplayMode.default, modalHeaderClassName, modalBodyClassName, modalFooterClassName, isCompact }) => {
8
5
  const handleEdit = (_event) => {
9
6
  handleModalToggle(_event);
10
7
  onEdit(_event);
@@ -13,6 +10,6 @@ export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOp
13
10
  handleModalToggle(_event);
14
11
  onDismiss && onDismiss(_event);
15
12
  };
16
- return (React.createElement(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: "Edit", secondaryActionBtn: "Dismiss", title: title, isReadOnly: true, displayMode: displayMode }));
13
+ return (_jsx(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: primaryActionButtonText, secondaryActionBtn: secondaryActionButtonText, title: title, isReadOnly: true, displayMode: displayMode, isCompact: isCompact, modalHeaderClassName: modalHeaderClassName, modalBodyClassName: modalBodyClassName, modalFooterClassName: modalFooterClassName }));
17
14
  };
18
15
  export default PreviewAttachment;
@@ -1 +1 @@
1
- export {};
1
+ import '@testing-library/jest-dom';