@patternfly/chatbot 6.3.0-prerelease.9 → 6.3.0

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 (564) 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 +12 -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 +1 -2
  8. package/dist/cjs/Chatbot/Chatbot.js +4 -9
  9. package/dist/cjs/Chatbot/Chatbot.test.js +11 -11
  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 +2 -2
  20. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +16 -33
  21. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +56 -64
  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 +3 -3
  27. package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -15
  28. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +7 -7
  29. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +28 -28
  30. package/dist/cjs/ChatbotFooter/ChatbotFootnote.d.ts +3 -3
  31. package/dist/cjs/ChatbotFooter/ChatbotFootnote.js +10 -23
  32. package/dist/cjs/ChatbotHeader/ChatbotHeader.d.ts +3 -3
  33. package/dist/cjs/ChatbotHeader/ChatbotHeader.js +2 -7
  34. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +5 -5
  35. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.d.ts +2 -2
  36. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.js +2 -5
  37. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +5 -5
  38. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +1 -2
  39. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +5 -10
  40. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +7 -10
  41. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.d.ts +2 -2
  42. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +2 -5
  43. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +5 -5
  44. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -2
  45. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +5 -7
  46. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +7 -10
  47. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +6 -3
  48. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
  49. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +19 -21
  50. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +8 -3
  51. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -12
  52. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +17 -19
  53. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.d.ts +2 -2
  54. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.js +2 -5
  55. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +23 -23
  56. package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +2 -2
  57. package/dist/cjs/ChatbotModal/ChatbotModal.js +3 -9
  58. package/dist/cjs/ChatbotModal/ChatbotModal.test.js +4 -16
  59. package/dist/cjs/ChatbotPopover/ChatbotPopover.d.ts +2 -2
  60. package/dist/cjs/ChatbotPopover/ChatbotPopover.js +2 -8
  61. package/dist/cjs/ChatbotToggle/ChatbotToggle.d.ts +1 -2
  62. package/dist/cjs/ChatbotToggle/ChatbotToggle.js +8 -13
  63. package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +25 -25
  64. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +2 -2
  65. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +6 -20
  66. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +16 -16
  67. package/dist/cjs/CodeModal/CodeModal.d.ts +8 -2
  68. package/dist/cjs/CodeModal/CodeModal.js +8 -20
  69. package/dist/cjs/CodeModal/CodeModal.test.js +23 -4
  70. package/dist/cjs/Compare/Compare.d.ts +2 -2
  71. package/dist/cjs/Compare/Compare.js +7 -16
  72. package/dist/cjs/Compare/Compare.test.js +7 -9
  73. package/dist/cjs/FileDetails/FileDetails.d.ts +2 -2
  74. package/dist/cjs/FileDetails/FileDetails.js +2 -15
  75. package/dist/cjs/FileDetails/FileDetails.test.js +10 -10
  76. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.d.ts +2 -2
  77. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.js +2 -5
  78. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +21 -21
  79. package/dist/cjs/FileDropZone/FileDropZone.d.ts +23 -2
  80. package/dist/cjs/FileDropZone/FileDropZone.js +11 -9
  81. package/dist/cjs/FileDropZone/FileDropZone.test.js +86 -5
  82. package/dist/cjs/LoadingMessage/LoadingMessage.d.ts +2 -2
  83. package/dist/cjs/LoadingMessage/LoadingMessage.js +2 -10
  84. package/dist/cjs/LoadingMessage/LoadingMessage.test.js +6 -6
  85. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +20 -3
  86. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +34 -16
  87. package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
  88. package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +139 -0
  89. package/dist/cjs/Message/ErrorMessage/ErrorMessage.d.ts +1 -2
  90. package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +5 -8
  91. package/dist/cjs/Message/ImageMessage/ImageMessage.d.ts +1 -2
  92. package/dist/cjs/Message/ImageMessage/ImageMessage.js +2 -8
  93. package/dist/cjs/Message/LinkMessage/LinkMessage.d.ts +1 -2
  94. package/dist/cjs/Message/LinkMessage/LinkMessage.js +6 -9
  95. package/dist/cjs/Message/ListMessage/ListItemMessage.d.ts +1 -2
  96. package/dist/cjs/Message/ListMessage/ListItemMessage.js +2 -8
  97. package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +1 -2
  98. package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -9
  99. package/dist/cjs/Message/ListMessage/UnorderedListMessage.d.ts +1 -2
  100. package/dist/cjs/Message/ListMessage/UnorderedListMessage.js +2 -9
  101. package/dist/cjs/Message/Message.d.ts +24 -8
  102. package/dist/cjs/Message/Message.js +49 -71
  103. package/dist/cjs/Message/Message.test.js +112 -82
  104. package/dist/cjs/Message/MessageInput.d.ts +2 -2
  105. package/dist/cjs/Message/MessageInput.js +5 -14
  106. package/dist/cjs/Message/MessageLoading.d.ts +1 -2
  107. package/dist/cjs/Message/MessageLoading.js +3 -8
  108. package/dist/cjs/Message/Plugins/index.d.ts +1 -0
  109. package/dist/cjs/Message/Plugins/index.js +5 -0
  110. package/dist/cjs/Message/Plugins/rehypeCodeBlockToggle.d.ts +2 -0
  111. package/dist/cjs/Message/Plugins/rehypeCodeBlockToggle.js +24 -0
  112. package/dist/cjs/Message/Plugins/rehypeMoveImagesOutOfParagraphs.d.ts +2 -0
  113. package/dist/cjs/Message/Plugins/rehypeMoveImagesOutOfParagraphs.js +47 -0
  114. package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +2 -2
  115. package/dist/cjs/Message/QuickResponse/QuickResponse.js +7 -9
  116. package/dist/cjs/Message/QuickStarts/FallbackImg.d.ts +2 -2
  117. package/dist/cjs/Message/QuickStarts/FallbackImg.js +5 -27
  118. package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +2 -2
  119. package/dist/cjs/Message/QuickStarts/QuickStartTile.js +7 -43
  120. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.d.ts +2 -2
  121. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +9 -38
  122. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +16 -16
  123. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.d.ts +2 -2
  124. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.js +2 -26
  125. package/dist/cjs/Message/QuickStarts/types.d.ts +4 -3
  126. package/dist/cjs/Message/TableMessage/TableMessage.d.ts +1 -2
  127. package/dist/cjs/Message/TableMessage/TableMessage.js +8 -10
  128. package/dist/cjs/Message/TableMessage/TbodyMessage.d.ts +2 -3
  129. package/dist/cjs/Message/TableMessage/TbodyMessage.js +7 -9
  130. package/dist/cjs/Message/TableMessage/TdMessage.d.ts +1 -2
  131. package/dist/cjs/Message/TableMessage/TdMessage.js +2 -8
  132. package/dist/cjs/Message/TableMessage/ThMessage.d.ts +1 -2
  133. package/dist/cjs/Message/TableMessage/ThMessage.js +2 -8
  134. package/dist/cjs/Message/TableMessage/TheadMessage.d.ts +1 -2
  135. package/dist/cjs/Message/TableMessage/TheadMessage.js +2 -8
  136. package/dist/cjs/Message/TableMessage/TrMessage.d.ts +2 -3
  137. package/dist/cjs/Message/TableMessage/TrMessage.js +8 -10
  138. package/dist/cjs/Message/TextMessage/TextMessage.d.ts +1 -2
  139. package/dist/cjs/Message/TextMessage/TextMessage.js +2 -9
  140. package/dist/cjs/Message/UserFeedback/CloseButton.d.ts +2 -2
  141. package/dist/cjs/Message/UserFeedback/CloseButton.js +2 -8
  142. package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +2 -2
  143. package/dist/cjs/Message/UserFeedback/UserFeedback.js +12 -23
  144. package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +53 -53
  145. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
  146. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +20 -44
  147. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +81 -91
  148. package/dist/cjs/Message/index.d.ts +1 -0
  149. package/dist/cjs/Message/index.js +3 -1
  150. package/dist/cjs/MessageBar/AttachButton.d.ts +25 -2
  151. package/dist/cjs/MessageBar/AttachButton.js +10 -20
  152. package/dist/cjs/MessageBar/AttachButton.test.js +102 -24
  153. package/dist/cjs/MessageBar/MessageBar.d.ts +31 -3
  154. package/dist/cjs/MessageBar/MessageBar.js +30 -32
  155. package/dist/cjs/MessageBar/MessageBar.test.js +122 -108
  156. package/dist/cjs/MessageBar/MicrophoneButton.d.ts +2 -2
  157. package/dist/cjs/MessageBar/MicrophoneButton.js +7 -14
  158. package/dist/cjs/MessageBar/SendButton.d.ts +3 -2
  159. package/dist/cjs/MessageBar/SendButton.js +3 -11
  160. package/dist/cjs/MessageBar/SendButton.test.js +15 -15
  161. package/dist/cjs/MessageBar/StopButton.d.ts +3 -2
  162. package/dist/cjs/MessageBar/StopButton.js +3 -12
  163. package/dist/cjs/MessageBar/StopButton.test.js +15 -15
  164. package/dist/cjs/MessageBox/JumpButton.d.ts +2 -2
  165. package/dist/cjs/MessageBox/JumpButton.js +2 -10
  166. package/dist/cjs/MessageBox/JumpButton.test.js +10 -10
  167. package/dist/cjs/MessageBox/MessageBox.d.ts +21 -5
  168. package/dist/cjs/MessageBox/MessageBox.js +170 -45
  169. package/dist/cjs/MessageBox/MessageBox.test.js +219 -6
  170. package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +12 -2
  171. package/dist/cjs/PreviewAttachment/PreviewAttachment.js +3 -6
  172. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +1 -1
  173. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +34 -12
  174. package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +5 -5
  175. package/dist/cjs/ResponseActions/ResponseActionButton.js +5 -8
  176. package/dist/cjs/ResponseActions/ResponseActionButton.test.js +19 -19
  177. package/dist/cjs/ResponseActions/ResponseActions.d.ts +7 -3
  178. package/dist/cjs/ResponseActions/ResponseActions.js +39 -18
  179. package/dist/cjs/ResponseActions/ResponseActions.test.js +120 -41
  180. package/dist/cjs/Settings/SettingsForm.d.ts +2 -2
  181. package/dist/cjs/Settings/SettingsForm.js +2 -8
  182. package/dist/cjs/Settings/SettingsForm.test.js +9 -12
  183. package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +2 -2
  184. package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.js +2 -11
  185. package/dist/cjs/SourcesCard/SourcesCard.d.ts +12 -3
  186. package/dist/cjs/SourcesCard/SourcesCard.js +17 -42
  187. package/dist/cjs/SourcesCard/SourcesCard.test.js +70 -60
  188. package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +3 -3
  189. package/dist/cjs/TermsOfUse/TermsOfUse.js +4 -16
  190. package/dist/cjs/TermsOfUse/TermsOfUse.test.js +31 -33
  191. package/dist/css/main.css +15 -7
  192. package/dist/css/main.css.map +1 -1
  193. package/dist/esm/AttachMenu/AttachMenu.d.ts +2 -2
  194. package/dist/esm/AttachMenu/AttachMenu.js +2 -9
  195. package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +12 -2
  196. package/dist/esm/AttachmentEdit/AttachmentEdit.js +3 -6
  197. package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +1 -1
  198. package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +30 -5
  199. package/dist/esm/Chatbot/Chatbot.d.ts +1 -2
  200. package/dist/esm/Chatbot/Chatbot.js +4 -6
  201. package/dist/esm/Chatbot/Chatbot.test.js +6 -6
  202. package/dist/esm/ChatbotAlert/ChatbotAlert.d.ts +2 -2
  203. package/dist/esm/ChatbotAlert/ChatbotAlert.js +4 -5
  204. package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +4 -4
  205. package/dist/esm/ChatbotContent/ChatbotContent.d.ts +3 -3
  206. package/dist/esm/ChatbotContent/ChatbotContent.js +2 -5
  207. package/dist/esm/ChatbotContent/ChatbotContent.test.js +3 -3
  208. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +2 -2
  209. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +7 -11
  210. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +8 -10
  211. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +2 -2
  212. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +16 -33
  213. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +26 -34
  214. package/dist/esm/ChatbotConversationHistoryNav/EmptyState.d.ts +2 -2
  215. package/dist/esm/ChatbotConversationHistoryNav/EmptyState.js +2 -6
  216. package/dist/esm/ChatbotConversationHistoryNav/LoadingState.d.ts +2 -2
  217. package/dist/esm/ChatbotConversationHistoryNav/LoadingState.js +2 -22
  218. package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +3 -3
  219. package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -12
  220. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +4 -4
  221. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +5 -5
  222. package/dist/esm/ChatbotFooter/ChatbotFootnote.d.ts +3 -3
  223. package/dist/esm/ChatbotFooter/ChatbotFootnote.js +10 -23
  224. package/dist/esm/ChatbotHeader/ChatbotHeader.d.ts +3 -3
  225. package/dist/esm/ChatbotHeader/ChatbotHeader.js +2 -4
  226. package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +3 -3
  227. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.d.ts +2 -2
  228. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.js +2 -2
  229. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +3 -3
  230. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +1 -2
  231. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +5 -7
  232. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +4 -4
  233. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.d.ts +2 -2
  234. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +2 -2
  235. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +3 -3
  236. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -2
  237. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +5 -7
  238. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +4 -4
  239. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +6 -3
  240. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
  241. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +9 -8
  242. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +8 -3
  243. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -9
  244. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +9 -8
  245. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.d.ts +2 -2
  246. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.js +2 -2
  247. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +12 -12
  248. package/dist/esm/ChatbotModal/ChatbotModal.d.ts +2 -2
  249. package/dist/esm/ChatbotModal/ChatbotModal.js +3 -6
  250. package/dist/esm/ChatbotModal/ChatbotModal.test.js +2 -14
  251. package/dist/esm/ChatbotPopover/ChatbotPopover.d.ts +2 -2
  252. package/dist/esm/ChatbotPopover/ChatbotPopover.js +2 -5
  253. package/dist/esm/ChatbotToggle/ChatbotToggle.d.ts +1 -2
  254. package/dist/esm/ChatbotToggle/ChatbotToggle.js +8 -13
  255. package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +8 -8
  256. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +2 -2
  257. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +6 -17
  258. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +8 -8
  259. package/dist/esm/CodeModal/CodeModal.d.ts +8 -2
  260. package/dist/esm/CodeModal/CodeModal.js +8 -20
  261. package/dist/esm/CodeModal/CodeModal.test.js +22 -3
  262. package/dist/esm/Compare/Compare.d.ts +2 -2
  263. package/dist/esm/Compare/Compare.js +7 -13
  264. package/dist/esm/Compare/Compare.test.js +4 -6
  265. package/dist/esm/FileDetails/FileDetails.d.ts +2 -2
  266. package/dist/esm/FileDetails/FileDetails.js +2 -15
  267. package/dist/esm/FileDetails/FileDetails.test.js +4 -4
  268. package/dist/esm/FileDetailsLabel/FileDetailsLabel.d.ts +2 -2
  269. package/dist/esm/FileDetailsLabel/FileDetailsLabel.js +2 -5
  270. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +9 -9
  271. package/dist/esm/FileDropZone/FileDropZone.d.ts +23 -2
  272. package/dist/esm/FileDropZone/FileDropZone.js +11 -6
  273. package/dist/esm/FileDropZone/FileDropZone.test.js +84 -3
  274. package/dist/esm/LoadingMessage/LoadingMessage.d.ts +2 -2
  275. package/dist/esm/LoadingMessage/LoadingMessage.js +2 -10
  276. package/dist/esm/LoadingMessage/LoadingMessage.test.js +3 -3
  277. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +20 -3
  278. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +35 -17
  279. package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
  280. package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +133 -0
  281. package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +1 -2
  282. package/dist/esm/Message/ErrorMessage/ErrorMessage.js +5 -5
  283. package/dist/esm/Message/ImageMessage/ImageMessage.d.ts +1 -2
  284. package/dist/esm/Message/ImageMessage/ImageMessage.js +2 -5
  285. package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +1 -2
  286. package/dist/esm/Message/LinkMessage/LinkMessage.js +6 -6
  287. package/dist/esm/Message/ListMessage/ListItemMessage.d.ts +1 -2
  288. package/dist/esm/Message/ListMessage/ListItemMessage.js +2 -5
  289. package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +1 -2
  290. package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -6
  291. package/dist/esm/Message/ListMessage/UnorderedListMessage.d.ts +1 -2
  292. package/dist/esm/Message/ListMessage/UnorderedListMessage.js +2 -6
  293. package/dist/esm/Message/Message.d.ts +24 -8
  294. package/dist/esm/Message/Message.js +49 -71
  295. package/dist/esm/Message/Message.test.js +112 -82
  296. package/dist/esm/Message/MessageInput.d.ts +2 -2
  297. package/dist/esm/Message/MessageInput.js +5 -11
  298. package/dist/esm/Message/MessageLoading.d.ts +1 -2
  299. package/dist/esm/Message/MessageLoading.js +2 -4
  300. package/dist/esm/Message/Plugins/index.d.ts +1 -0
  301. package/dist/esm/Message/Plugins/index.js +1 -0
  302. package/dist/esm/Message/Plugins/rehypeCodeBlockToggle.d.ts +2 -0
  303. package/dist/esm/Message/Plugins/rehypeCodeBlockToggle.js +20 -0
  304. package/dist/esm/Message/Plugins/rehypeMoveImagesOutOfParagraphs.d.ts +2 -0
  305. package/dist/esm/Message/Plugins/rehypeMoveImagesOutOfParagraphs.js +43 -0
  306. package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +2 -2
  307. package/dist/esm/Message/QuickResponse/QuickResponse.js +7 -6
  308. package/dist/esm/Message/QuickStarts/FallbackImg.d.ts +2 -2
  309. package/dist/esm/Message/QuickStarts/FallbackImg.js +5 -4
  310. package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +2 -2
  311. package/dist/esm/Message/QuickStarts/QuickStartTile.js +7 -20
  312. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.d.ts +2 -2
  313. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +9 -15
  314. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +5 -5
  315. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.d.ts +2 -2
  316. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.js +2 -3
  317. package/dist/esm/Message/QuickStarts/types.d.ts +4 -3
  318. package/dist/esm/Message/TableMessage/TableMessage.d.ts +1 -2
  319. package/dist/esm/Message/TableMessage/TableMessage.js +8 -7
  320. package/dist/esm/Message/TableMessage/TbodyMessage.d.ts +2 -3
  321. package/dist/esm/Message/TableMessage/TbodyMessage.js +7 -6
  322. package/dist/esm/Message/TableMessage/TdMessage.d.ts +1 -2
  323. package/dist/esm/Message/TableMessage/TdMessage.js +2 -5
  324. package/dist/esm/Message/TableMessage/ThMessage.d.ts +1 -2
  325. package/dist/esm/Message/TableMessage/ThMessage.js +2 -5
  326. package/dist/esm/Message/TableMessage/TheadMessage.d.ts +1 -2
  327. package/dist/esm/Message/TableMessage/TheadMessage.js +2 -5
  328. package/dist/esm/Message/TableMessage/TrMessage.d.ts +2 -3
  329. package/dist/esm/Message/TableMessage/TrMessage.js +8 -7
  330. package/dist/esm/Message/TextMessage/TextMessage.d.ts +1 -2
  331. package/dist/esm/Message/TextMessage/TextMessage.js +2 -6
  332. package/dist/esm/Message/UserFeedback/CloseButton.d.ts +2 -2
  333. package/dist/esm/Message/UserFeedback/CloseButton.js +2 -5
  334. package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +2 -2
  335. package/dist/esm/Message/UserFeedback/UserFeedback.js +12 -23
  336. package/dist/esm/Message/UserFeedback/UserFeedback.test.js +21 -21
  337. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
  338. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +20 -44
  339. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +26 -36
  340. package/dist/esm/Message/index.d.ts +1 -0
  341. package/dist/esm/Message/index.js +1 -0
  342. package/dist/esm/MessageBar/AttachButton.d.ts +25 -2
  343. package/dist/esm/MessageBar/AttachButton.js +10 -17
  344. package/dist/esm/MessageBar/AttachButton.test.js +95 -17
  345. package/dist/esm/MessageBar/MessageBar.d.ts +31 -3
  346. package/dist/esm/MessageBar/MessageBar.js +28 -30
  347. package/dist/esm/MessageBar/MessageBar.test.js +87 -73
  348. package/dist/esm/MessageBar/MicrophoneButton.d.ts +2 -2
  349. package/dist/esm/MessageBar/MicrophoneButton.js +7 -11
  350. package/dist/esm/MessageBar/SendButton.d.ts +3 -2
  351. package/dist/esm/MessageBar/SendButton.js +3 -8
  352. package/dist/esm/MessageBar/SendButton.test.js +9 -9
  353. package/dist/esm/MessageBar/StopButton.d.ts +3 -2
  354. package/dist/esm/MessageBar/StopButton.js +3 -9
  355. package/dist/esm/MessageBar/StopButton.test.js +9 -9
  356. package/dist/esm/MessageBox/JumpButton.d.ts +2 -2
  357. package/dist/esm/MessageBox/JumpButton.js +2 -7
  358. package/dist/esm/MessageBox/JumpButton.test.js +9 -9
  359. package/dist/esm/MessageBox/MessageBox.d.ts +21 -5
  360. package/dist/esm/MessageBox/MessageBox.js +170 -45
  361. package/dist/esm/MessageBox/MessageBox.test.js +220 -7
  362. package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +12 -2
  363. package/dist/esm/PreviewAttachment/PreviewAttachment.js +3 -6
  364. package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +1 -1
  365. package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +30 -5
  366. package/dist/esm/ResponseActions/ResponseActionButton.d.ts +5 -5
  367. package/dist/esm/ResponseActions/ResponseActionButton.js +5 -5
  368. package/dist/esm/ResponseActions/ResponseActionButton.test.js +7 -7
  369. package/dist/esm/ResponseActions/ResponseActions.d.ts +7 -3
  370. package/dist/esm/ResponseActions/ResponseActions.js +40 -19
  371. package/dist/esm/ResponseActions/ResponseActions.test.js +95 -16
  372. package/dist/esm/Settings/SettingsForm.d.ts +2 -2
  373. package/dist/esm/Settings/SettingsForm.js +2 -5
  374. package/dist/esm/Settings/SettingsForm.test.js +6 -6
  375. package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +2 -2
  376. package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.js +2 -8
  377. package/dist/esm/SourcesCard/SourcesCard.d.ts +12 -3
  378. package/dist/esm/SourcesCard/SourcesCard.js +17 -39
  379. package/dist/esm/SourcesCard/SourcesCard.test.js +29 -19
  380. package/dist/esm/TermsOfUse/TermsOfUse.d.ts +3 -3
  381. package/dist/esm/TermsOfUse/TermsOfUse.js +4 -16
  382. package/dist/esm/TermsOfUse/TermsOfUse.test.js +10 -12
  383. package/dist/tsconfig.tsbuildinfo +1 -1
  384. package/package.json +5 -6
  385. package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +10 -0
  386. package/patternfly-docs/content/extensions/chatbot/examples/Customizing Messages/Customizing Messages.md +51 -0
  387. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachMenu.tsx +9 -9
  388. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +5 -5
  389. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +2 -2
  390. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +24 -20
  391. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetails.tsx +2 -2
  392. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +9 -9
  393. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDropZone.tsx +4 -4
  394. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithAttachment.tsx +7 -7
  395. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithClickedResponseActions.tsx +25 -0
  396. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +3 -12
  397. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +4 -4
  398. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedbackTimeout.tsx +3 -3
  399. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +2 -2
  400. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
  401. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +3 -3
  402. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +3 -3
  403. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +19 -0
  404. package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +5 -5
  405. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +25 -14
  406. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +4 -4
  407. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotContainer.tsx +59 -36
  408. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +2 -2
  409. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +2 -2
  410. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +10 -13
  411. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +10 -10
  412. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerNavigation.tsx +5 -5
  413. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +5 -5
  414. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +6 -6
  415. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +7 -7
  416. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderTitle.tsx +59 -34
  417. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBar.tsx +2 -2
  418. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +9 -9
  419. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx +3 -3
  420. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarLanguage.tsx +2 -2
  421. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarStop.tsx +2 -2
  422. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotModal.tsx +74 -37
  423. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotToggleBasic.tsx +3 -3
  424. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomeInteraction.tsx +8 -8
  425. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomePrompt.tsx +3 -3
  426. package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +16 -23
  427. package/patternfly-docs/content/extensions/chatbot/examples/UI/CustomClosedIcon.tsx +3 -3
  428. package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +16 -23
  429. package/patternfly-docs/content/extensions/chatbot/examples/UI/SkipToContent.tsx +5 -5
  430. package/patternfly-docs/content/extensions/chatbot/examples/UI/SquareChatbotToggle.tsx +3 -3
  431. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +91 -48
  432. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUseCompact.tsx +82 -39
  433. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +3 -0
  434. package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +37 -0
  435. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +1 -0
  436. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +19 -25
  437. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +42 -15
  438. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +15 -14
  439. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +19 -25
  440. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +17 -22
  441. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotScrolling.tsx +536 -0
  442. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +17 -22
  443. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +13 -13
  444. package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +7 -7
  445. package/patternfly-docs/content/extensions/chatbot/img/quick-response-confirmation.svg +67 -0
  446. package/src/AttachMenu/AttachMenu.tsx +2 -2
  447. package/src/AttachmentEdit/AttachmentEdit.test.tsx +46 -2
  448. package/src/AttachmentEdit/AttachmentEdit.tsx +25 -7
  449. package/src/Chatbot/Chatbot.test.tsx +0 -1
  450. package/src/Chatbot/Chatbot.tsx +5 -3
  451. package/src/ChatbotAlert/ChatbotAlert.test.tsx +0 -1
  452. package/src/ChatbotAlert/ChatbotAlert.tsx +2 -2
  453. package/src/ChatbotContent/ChatbotContent.test.tsx +0 -1
  454. package/src/ChatbotContent/ChatbotContent.tsx +3 -3
  455. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx +0 -1
  456. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +6 -4
  457. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +3 -3
  458. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +8 -6
  459. package/src/ChatbotConversationHistoryNav/EmptyState.tsx +2 -2
  460. package/src/ChatbotConversationHistoryNav/LoadingState.tsx +2 -2
  461. package/src/ChatbotFooter/ChatbotFooter.test.tsx +0 -1
  462. package/src/ChatbotFooter/ChatbotFooter.tsx +3 -3
  463. package/src/ChatbotFooter/ChatbotFooternote.test.tsx +0 -1
  464. package/src/ChatbotFooter/ChatbotFootnote.tsx +6 -4
  465. package/src/ChatbotHeader/ChatbotHeader.test.tsx +0 -1
  466. package/src/ChatbotHeader/ChatbotHeader.tsx +3 -6
  467. package/src/ChatbotHeader/ChatbotHeaderActions.test.tsx +0 -1
  468. package/src/ChatbotHeader/ChatbotHeaderActions.tsx +2 -2
  469. package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +0 -1
  470. package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +5 -4
  471. package/src/ChatbotHeader/ChatbotHeaderMain.test.tsx +0 -1
  472. package/src/ChatbotHeader/ChatbotHeaderMain.tsx +2 -2
  473. package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +0 -1
  474. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +7 -7
  475. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +9 -1
  476. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +12 -5
  477. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +9 -1
  478. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +26 -6
  479. package/src/ChatbotHeader/ChatbotHeaderTitle.test.tsx +0 -1
  480. package/src/ChatbotHeader/ChatbotHeaderTitle.tsx +2 -2
  481. package/src/ChatbotModal/ChatbotModal.test.tsx +0 -1
  482. package/src/ChatbotModal/ChatbotModal.tsx +2 -2
  483. package/src/ChatbotPopover/ChatbotPopover.tsx +3 -3
  484. package/src/ChatbotToggle/ChatbotToggle.test.tsx +0 -1
  485. package/src/ChatbotToggle/ChatbotToggle.tsx +5 -3
  486. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +0 -1
  487. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +2 -2
  488. package/src/CodeModal/CodeModal.test.tsx +29 -2
  489. package/src/CodeModal/CodeModal.tsx +18 -8
  490. package/src/Compare/Compare.test.tsx +0 -1
  491. package/src/Compare/Compare.tsx +7 -6
  492. package/src/FileDetails/FileDetails.test.tsx +0 -1
  493. package/src/FileDetails/FileDetails.tsx +1 -1
  494. package/src/FileDetailsLabel/FileDetailsLabel.test.tsx +0 -1
  495. package/src/FileDetailsLabel/FileDetailsLabel.tsx +1 -1
  496. package/src/FileDropZone/FileDropZone.test.tsx +112 -1
  497. package/src/FileDropZone/FileDropZone.tsx +44 -4
  498. package/src/LoadingMessage/LoadingMessage.test.tsx +0 -1
  499. package/src/LoadingMessage/LoadingMessage.tsx +2 -2
  500. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +7 -0
  501. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +126 -18
  502. package/src/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.tsx +223 -0
  503. package/src/Message/ErrorMessage/ErrorMessage.tsx +0 -1
  504. package/src/Message/ImageMessage/ImageMessage.tsx +1 -2
  505. package/src/Message/LinkMessage/LinkMessage.tsx +0 -1
  506. package/src/Message/ListMessage/ListItemMessage.tsx +0 -1
  507. package/src/Message/ListMessage/OrderedListMessage.tsx +0 -1
  508. package/src/Message/ListMessage/UnorderedListMessage.tsx +0 -1
  509. package/src/Message/Message.test.tsx +49 -6
  510. package/src/Message/Message.tsx +31 -14
  511. package/src/Message/MessageInput.tsx +5 -5
  512. package/src/Message/MessageLoading.tsx +0 -2
  513. package/src/Message/Plugins/index.ts +1 -0
  514. package/src/Message/Plugins/rehypeCodeBlockToggle.ts +24 -0
  515. package/src/Message/Plugins/rehypeMoveImagesOutOfParagraphs.ts +53 -0
  516. package/src/Message/QuickResponse/QuickResponse.tsx +4 -3
  517. package/src/Message/QuickStarts/FallbackImg.tsx +4 -3
  518. package/src/Message/QuickStarts/QuickStartTile.tsx +3 -3
  519. package/src/Message/QuickStarts/QuickStartTileDescription.test.tsx +0 -1
  520. package/src/Message/QuickStarts/QuickStartTileDescription.tsx +4 -3
  521. package/src/Message/QuickStarts/QuickStartTileHeader.tsx +2 -2
  522. package/src/Message/QuickStarts/types.ts +4 -3
  523. package/src/Message/TableMessage/TableMessage.tsx +4 -4
  524. package/src/Message/TableMessage/TbodyMessage.tsx +3 -3
  525. package/src/Message/TableMessage/TdMessage.tsx +1 -2
  526. package/src/Message/TableMessage/ThMessage.tsx +1 -2
  527. package/src/Message/TableMessage/TheadMessage.tsx +3 -2
  528. package/src/Message/TableMessage/TrMessage.tsx +4 -4
  529. package/src/Message/TextMessage/TextMessage.scss +2 -5
  530. package/src/Message/TextMessage/TextMessage.tsx +1 -2
  531. package/src/Message/UserFeedback/CloseButton.tsx +2 -2
  532. package/src/Message/UserFeedback/UserFeedback.test.tsx +0 -1
  533. package/src/Message/UserFeedback/UserFeedback.tsx +8 -6
  534. package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +0 -1
  535. package/src/Message/UserFeedback/UserFeedbackComplete.tsx +16 -14
  536. package/src/Message/index.ts +1 -0
  537. package/src/MessageBar/AttachButton.test.tsx +127 -8
  538. package/src/MessageBar/AttachButton.tsx +49 -6
  539. package/src/MessageBar/MessageBar.test.tsx +81 -30
  540. package/src/MessageBar/MessageBar.tsx +85 -19
  541. package/src/MessageBar/MicrophoneButton.tsx +10 -7
  542. package/src/MessageBar/SendButton.test.tsx +5 -6
  543. package/src/MessageBar/SendButton.tsx +4 -3
  544. package/src/MessageBar/StopButton.test.tsx +5 -6
  545. package/src/MessageBar/StopButton.tsx +4 -3
  546. package/src/MessageBox/JumpButton.test.tsx +4 -5
  547. package/src/MessageBox/JumpButton.tsx +3 -3
  548. package/src/MessageBox/MessageBox.test.tsx +295 -5
  549. package/src/MessageBox/MessageBox.tsx +301 -84
  550. package/src/PreviewAttachment/PreviewAttachment.test.tsx +44 -2
  551. package/src/PreviewAttachment/PreviewAttachment.tsx +24 -6
  552. package/src/ResponseActions/ResponseActionButton.test.tsx +0 -1
  553. package/src/ResponseActions/ResponseActionButton.tsx +6 -5
  554. package/src/ResponseActions/ResponseActions.test.tsx +121 -4
  555. package/src/ResponseActions/ResponseActions.tsx +71 -12
  556. package/src/Settings/SettingsForm.test.tsx +0 -1
  557. package/src/Settings/SettingsForm.tsx +2 -7
  558. package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx +2 -2
  559. package/src/SourcesCard/SourcesCard.test.tsx +14 -1
  560. package/src/SourcesCard/SourcesCard.tsx +19 -7
  561. package/src/TermsOfUse/TermsOfUse.test.tsx +0 -1
  562. package/src/TermsOfUse/TermsOfUse.tsx +6 -5
  563. package/tsconfig.cjs.json +0 -1
  564. package/tsconfig.json +3 -3
@@ -7,7 +7,7 @@ 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 ResponseActions from './ResponseActions';
@@ -29,7 +29,7 @@ const CUSTOM_ACTIONS = [
29
29
  onClick: jest.fn(),
30
30
  tooltipContent: 'Regenerate',
31
31
  clickedTooltipContent: 'Regenerated',
32
- icon: React.createElement(RedoIcon, null)
32
+ icon: _jsx(RedoIcon, {})
33
33
  },
34
34
  download: {
35
35
  ariaLabel: 'Download',
@@ -37,34 +37,44 @@ const CUSTOM_ACTIONS = [
37
37
  onClick: jest.fn(),
38
38
  tooltipContent: 'Download',
39
39
  clickedTooltipContent: 'Downloaded',
40
- icon: React.createElement(DownloadIcon, null)
40
+ icon: _jsx(DownloadIcon, {})
41
41
  },
42
42
  info: {
43
43
  ariaLabel: 'Info',
44
44
  onClick: jest.fn(),
45
45
  tooltipContent: 'Info',
46
- icon: React.createElement(InfoCircleIcon, null)
46
+ icon: _jsx(InfoCircleIcon, {})
47
47
  }
48
48
  }
49
49
  ];
50
+ const ALL_ACTIONS_DATA_TEST = [
51
+ { type: 'positive', label: 'Good response', dataTestId: 'positive' },
52
+ { type: 'negative', label: 'Bad response', dataTestId: 'negative' },
53
+ { type: 'copy', label: 'Copy', dataTestId: 'copy' },
54
+ { type: 'share', label: 'Share', dataTestId: 'share' },
55
+ { type: 'download', label: 'Download', dataTestId: 'download' },
56
+ { type: 'listen', label: 'Listen', dataTestId: 'listen' }
57
+ ];
50
58
  describe('ResponseActions', () => {
51
59
  afterEach(() => {
52
60
  jest.clearAllMocks();
53
61
  });
54
62
  it('should handle click within group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
55
- render(React.createElement(ResponseActions, { actions: {
63
+ render(_jsx(ResponseActions, { actions: {
56
64
  positive: { onClick: jest.fn() },
57
65
  negative: { onClick: jest.fn() },
58
66
  copy: { onClick: jest.fn() },
59
67
  share: { onClick: jest.fn() },
68
+ download: { onClick: jest.fn() },
60
69
  listen: { onClick: jest.fn() }
61
70
  } }));
62
71
  const goodBtn = screen.getByRole('button', { name: 'Good response' });
63
72
  const badBtn = screen.getByRole('button', { name: 'Bad response' });
64
73
  const copyBtn = screen.getByRole('button', { name: 'Copy' });
65
74
  const shareBtn = screen.getByRole('button', { name: 'Share' });
75
+ const downloadBtn = screen.getByRole('button', { name: 'Download' });
66
76
  const listenBtn = screen.getByRole('button', { name: 'Listen' });
67
- const buttons = [goodBtn, badBtn, copyBtn, shareBtn, listenBtn];
77
+ const buttons = [goodBtn, badBtn, copyBtn, shareBtn, downloadBtn, listenBtn];
68
78
  buttons.forEach((button) => {
69
79
  expect(button).toBeTruthy();
70
80
  });
@@ -83,7 +93,7 @@ describe('ResponseActions', () => {
83
93
  }));
84
94
  it('should handle click outside of group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
85
95
  // using message just so we have something outside the group that's rendered
86
- render(React.createElement(Message, { name: "Bot", role: "bot", avatar: "", content: "I updated your account with those settings. You're ready to set up your first dashboard!", actions: {
96
+ render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "I updated your account with those settings. You're ready to set up your first dashboard!", actions: {
87
97
  positive: {},
88
98
  negative: {}
89
99
  } }));
@@ -101,23 +111,83 @@ describe('ResponseActions', () => {
101
111
  expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
102
112
  expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
103
113
  }));
114
+ it('should handle isClicked prop within group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
115
+ render(_jsx(ResponseActions, { actions: {
116
+ positive: { 'data-testid': 'positive-btn', onClick: jest.fn(), isClicked: true },
117
+ negative: { 'data-testid': 'negative-btn', onClick: jest.fn() }
118
+ } }));
119
+ expect(screen.getByTestId('positive-btn')).toHaveClass('pf-chatbot__button--response-action-clicked');
120
+ expect(screen.getByTestId('negative-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
121
+ }));
122
+ it('should set "listen" button as active if its `isClicked` is true', () => __awaiter(void 0, void 0, void 0, function* () {
123
+ render(_jsx(ResponseActions, { actions: {
124
+ positive: { 'data-testid': 'positive-btn', onClick: jest.fn(), isClicked: false },
125
+ negative: { 'data-testid': 'negative-btn', onClick: jest.fn(), isClicked: false },
126
+ listen: { 'data-testid': 'listen-btn', onClick: jest.fn(), isClicked: true }
127
+ } }));
128
+ expect(screen.getByTestId('listen-btn')).toHaveClass('pf-chatbot__button--response-action-clicked');
129
+ expect(screen.getByTestId('positive-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
130
+ expect(screen.getByTestId('negative-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
131
+ }));
132
+ it('should prioritize "positive" when both "positive" and "negative" are set to clicked', () => __awaiter(void 0, void 0, void 0, function* () {
133
+ render(_jsx(ResponseActions, { actions: {
134
+ positive: { 'data-testid': 'positive-btn', onClick: jest.fn(), isClicked: true },
135
+ negative: { 'data-testid': 'negative-btn', onClick: jest.fn(), isClicked: true }
136
+ } }));
137
+ // Positive button should take precendence
138
+ expect(screen.getByTestId('positive-btn')).toHaveClass('pf-chatbot__button--response-action-clicked');
139
+ expect(screen.getByTestId('negative-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
140
+ }));
141
+ it('should set an additional action button as active if it is initially clicked and no predefined are clicked', () => __awaiter(void 0, void 0, void 0, function* () {
142
+ const [additionalActions] = CUSTOM_ACTIONS;
143
+ const customActions = Object.assign({ positive: { 'data-testid': 'positive', onClick: jest.fn(), isClicked: false }, negative: { 'data-testid': 'negative', onClick: jest.fn(), isClicked: false } }, Object.keys(additionalActions).reduce((acc, actionKey) => {
144
+ acc[actionKey] = Object.assign(Object.assign({}, additionalActions[actionKey]), { 'data-testid': actionKey, isClicked: actionKey === 'regenerate' });
145
+ return acc;
146
+ }, {}));
147
+ render(_jsx(ResponseActions, { actions: customActions }));
148
+ Object.keys(customActions).forEach((actionKey) => {
149
+ if (actionKey === 'regenerate') {
150
+ expect(screen.getByTestId(actionKey)).toHaveClass('pf-chatbot__button--response-action-clicked');
151
+ }
152
+ else {
153
+ // Other actions should not have clicked class
154
+ expect(screen.getByTestId(actionKey)).not.toHaveClass('pf-chatbot__button--response-action-clicked');
155
+ }
156
+ });
157
+ }));
158
+ it('should activate the clicked button and deactivate any previously active button', () => __awaiter(void 0, void 0, void 0, function* () {
159
+ const actions = {
160
+ positive: { 'data-testid': 'positive', onClick: jest.fn(), isClicked: false },
161
+ negative: { 'data-testid': 'negative', onClick: jest.fn(), isClicked: true }
162
+ };
163
+ render(_jsx(ResponseActions, { actions: actions }));
164
+ const negativeBtn = screen.getByTestId('negative');
165
+ const positiveBtn = screen.getByTestId('positive');
166
+ // negative button is initially clicked
167
+ expect(negativeBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
168
+ expect(positiveBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
169
+ yield userEvent.click(positiveBtn);
170
+ // positive button should now have the clicked class
171
+ expect(positiveBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
172
+ expect(negativeBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
173
+ }));
104
174
  it('should render buttons correctly', () => {
105
175
  ALL_ACTIONS.forEach(({ type, label }) => {
106
- render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
176
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
107
177
  expect(screen.getByRole('button', { name: label })).toBeTruthy();
108
178
  });
109
179
  });
110
180
  it('should be able to call onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
111
181
  ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label }) {
112
182
  const spy = jest.fn();
113
- render(React.createElement(ResponseActions, { actions: { [type]: { onClick: spy } } }));
183
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: spy } } }));
114
184
  yield userEvent.click(screen.getByRole('button', { name: label }));
115
185
  expect(spy).toHaveBeenCalledTimes(1);
116
186
  }));
117
187
  }));
118
188
  it('should swap clicked and non-clicked aria labels on click', () => __awaiter(void 0, void 0, void 0, function* () {
119
189
  ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label, clickedLabel }) {
120
- render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
190
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
121
191
  expect(screen.getByRole('button', { name: label })).toBeTruthy();
122
192
  yield userEvent.click(screen.getByRole('button', { name: label }));
123
193
  expect(screen.getByRole('button', { name: clickedLabel })).toBeTruthy();
@@ -125,7 +195,7 @@ describe('ResponseActions', () => {
125
195
  }));
126
196
  it('should swap clicked and non-clicked tooltips on click', () => __awaiter(void 0, void 0, void 0, function* () {
127
197
  ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label, clickedLabel }) {
128
- render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
198
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
129
199
  expect(screen.getByRole('button', { name: label })).toBeTruthy();
130
200
  yield userEvent.click(screen.getByRole('button', { name: label }));
131
201
  expect(screen.getByRole('tooltip', { name: clickedLabel })).toBeTruthy();
@@ -137,38 +207,47 @@ describe('ResponseActions', () => {
137
207
  { type: 'negative', ariaLabel: 'Thumbs down' },
138
208
  { type: 'copy', ariaLabel: 'Copy the message' },
139
209
  { type: 'share', ariaLabel: 'Share it with friends' },
210
+ { type: 'download', ariaLabel: 'Download your cool message' },
140
211
  { type: 'listen', ariaLabel: 'Listen up' }
141
212
  ];
142
213
  actions.forEach(({ type, ariaLabel }) => {
143
- render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn(), ariaLabel } } }));
214
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), ariaLabel } } }));
144
215
  expect(screen.getByRole('button', { name: ariaLabel })).toBeTruthy();
145
216
  });
146
217
  });
147
218
  it('should be able to disable buttons', () => {
148
219
  ALL_ACTIONS.forEach(({ type, label }) => {
149
- render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn(), isDisabled: true } } }));
220
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), isDisabled: true } } }));
150
221
  expect(screen.getByRole('button', { name: label })).toBeDisabled();
151
222
  });
152
223
  });
153
224
  it('should be able to add class to buttons', () => {
154
225
  ALL_ACTIONS.forEach(({ type, label }) => {
155
- render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn(), className: 'test' } } }));
226
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), className: 'test' } } }));
156
227
  expect(screen.getByRole('button', { name: label })).toHaveClass('test');
157
228
  });
158
229
  });
230
+ it('should be able to add custom attributes to buttons', () => {
231
+ ALL_ACTIONS_DATA_TEST.forEach(({ type, dataTestId }) => {
232
+ render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), 'data-testid': dataTestId } } }));
233
+ expect(screen.getByTestId(dataTestId)).toBeTruthy();
234
+ });
235
+ });
159
236
  it('should be able to add custom actions', () => {
160
237
  CUSTOM_ACTIONS.forEach((action) => {
161
238
  const key = Object.keys(action)[0];
162
- render(React.createElement(ResponseActions, { actions: {
239
+ render(_jsx(ResponseActions, { actions: {
163
240
  [key]: {
164
241
  tooltipContent: action[key].tooltipContent,
165
242
  onClick: action[key].onClick,
166
243
  // doing this just because it's easier to test without a regex for the button name
167
244
  ariaLabel: action[key].ariaLabel.toLowerCase(),
168
- icon: action[key].icon
245
+ icon: action[key].icon,
246
+ 'data-testid': action[key]
169
247
  }
170
248
  } }));
171
249
  expect(screen.getByRole('button', { name: key })).toBeTruthy();
250
+ expect(screen.getByTestId(action[key])).toBeTruthy();
172
251
  });
173
252
  });
174
253
  });
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type { FunctionComponent } from 'react';
2
2
  export interface SettingsFormProps {
3
3
  /** Class applied to form container */
4
4
  className?: string;
@@ -11,5 +11,5 @@ export interface SettingsFormProps {
11
11
  /** Sets form to compact styling. */
12
12
  isCompact?: boolean;
13
13
  }
14
- export declare const SettingsForm: React.FunctionComponent<SettingsFormProps>;
14
+ export declare const SettingsForm: FunctionComponent<SettingsFormProps>;
15
15
  export default SettingsForm;
@@ -9,12 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import React from 'react';
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  export const SettingsForm = (_a) => {
14
14
  var { className, fields = [], isCompact } = _a, props = __rest(_a, ["className", "fields", "isCompact"]);
15
- return (React.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}` }, props),
16
- React.createElement("form", { className: "pf-chatbot__settings-form" }, fields.map((field) => (React.createElement("div", { className: "pf-chatbot__settings-form-row", key: field.label },
17
- React.createElement("label", { className: "pf-chatbot__settings-label", htmlFor: field.id }, field.label),
18
- field.field))))));
15
+ return (_jsx("div", Object.assign({ className: `pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}` }, props, { children: _jsx("form", { className: "pf-chatbot__settings-form", children: fields.map((field) => (_jsxs("div", { className: "pf-chatbot__settings-form-row", children: [_jsx("label", { className: "pf-chatbot__settings-label", htmlFor: field.id, children: field.label }), field.field] }, field.label))) }) })));
19
16
  };
20
17
  export default SettingsForm;
@@ -1,11 +1,11 @@
1
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Button } from '@patternfly/react-core';
3
3
  import { render, screen } from '@testing-library/react';
4
4
  import { SettingsForm } from './SettingsForm';
5
5
  import '@testing-library/jest-dom';
6
6
  describe('SettingsForm', () => {
7
7
  it('should render settingsForm with custom classname', () => {
8
- const { container } = render(React.createElement(SettingsForm, { className: "custom-settings" }));
8
+ const { container } = render(_jsx(SettingsForm, { className: "custom-settings" }));
9
9
  expect(container.querySelector('.custom-settings')).toBeTruthy();
10
10
  });
11
11
  it('should render settingsForm with fields', () => {
@@ -13,10 +13,10 @@ describe('SettingsForm', () => {
13
13
  {
14
14
  id: 'archived-chat',
15
15
  label: 'Archive chat',
16
- field: (React.createElement(Button, { id: "archived-chat", variant: "secondary" }, "Archive chat"))
16
+ field: (_jsx(Button, { id: "archived-chat", variant: "secondary", children: "Archive chat" }))
17
17
  }
18
18
  ];
19
- render(React.createElement(SettingsForm, { fields: fields }));
19
+ render(_jsx(SettingsForm, { fields: fields }));
20
20
  expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
21
21
  });
22
22
  it('should render settingsForm with isCompact', () => {
@@ -24,10 +24,10 @@ describe('SettingsForm', () => {
24
24
  {
25
25
  id: 'archived-chat',
26
26
  label: 'Archive chat',
27
- field: (React.createElement(Button, { id: "archived-chat", variant: "secondary" }, "Archive chat"))
27
+ field: (_jsx(Button, { id: "archived-chat", variant: "secondary", children: "Archive chat" }))
28
28
  }
29
29
  ];
30
- render(React.createElement(SettingsForm, { "data-testid": "settings-form", fields: fields, isCompact: true }));
30
+ render(_jsx(SettingsForm, { "data-testid": "settings-form", fields: fields, isCompact: true }));
31
31
  expect(screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
32
32
  });
33
33
  });
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type { FunctionComponent } from 'react';
2
2
  export interface SourceDetailsMenuItemProps extends React.HTMLProps<HTMLDivElement> {
3
3
  /** Icon */
4
4
  icon: React.ReactNode;
@@ -7,5 +7,5 @@ export interface SourceDetailsMenuItemProps extends React.HTMLProps<HTMLDivEleme
7
7
  /** Description of source */
8
8
  type?: string;
9
9
  }
10
- export declare const SourceDetailsMenuItem: React.FunctionComponent<SourceDetailsMenuItemProps>;
10
+ export declare const SourceDetailsMenuItem: FunctionComponent<SourceDetailsMenuItemProps>;
11
11
  export default SourceDetailsMenuItem;
@@ -9,16 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import React from 'react';
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Icon, Flex, Stack, StackItem } from '@patternfly/react-core';
14
14
  export const SourceDetailsMenuItem = (_a) => {
15
15
  var { icon, name, type } = _a, props = __rest(_a, ["icon", "name", "type"]);
16
- return (React.createElement(Flex, Object.assign({ className: "pf-chatbot__source-details", gap: { default: 'gapSm' } }, props),
17
- React.createElement(Flex, { justifyContent: { default: 'justifyContentCenter' }, alignItems: { default: 'alignItemsCenter' }, alignSelf: { default: 'alignSelfCenter' } },
18
- React.createElement(Icon, { className: "pf-chatbot__source-details-icon" }, icon)),
19
- React.createElement(Stack, { className: "pf-chatbot__source-details-text" },
20
- React.createElement(StackItem, null,
21
- React.createElement("span", { className: "pf-chatbot__source-details-heading" }, name)),
22
- type && React.createElement(StackItem, { className: "pf-chatbot__source-details-subhead" }, type))));
16
+ return (_jsxs(Flex, Object.assign({ className: "pf-chatbot__source-details", gap: { default: 'gapSm' } }, props, { children: [_jsx(Flex, { justifyContent: { default: 'justifyContentCenter' }, alignItems: { default: 'alignItemsCenter' }, alignSelf: { default: 'alignSelfCenter' }, children: _jsx(Icon, { className: "pf-chatbot__source-details-icon", children: icon }) }), _jsxs(Stack, { className: "pf-chatbot__source-details-text", children: [_jsx(StackItem, { children: _jsx("span", { className: "pf-chatbot__source-details-heading", children: name }) }), type && _jsx(StackItem, { className: "pf-chatbot__source-details-subhead", children: type })] })] })));
23
17
  };
24
18
  export default SourceDetailsMenuItem;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { CardProps } from '@patternfly/react-core';
1
+ import type { FunctionComponent } from 'react';
2
+ import { ButtonProps, CardProps } from '@patternfly/react-core';
3
3
  export interface SourcesCardProps extends CardProps {
4
4
  /** Additional classes for the pagination navigation container. */
5
5
  className?: string;
@@ -11,11 +11,20 @@ export interface SourcesCardProps extends CardProps {
11
11
  paginationAriaLabel?: string;
12
12
  /** Content rendered inside the paginated card */
13
13
  sources: {
14
+ /** Title of sources card */
14
15
  title?: string;
16
+ /** Link to source */
15
17
  link: string;
18
+ /** Body of sources card */
16
19
  body?: React.ReactNode | string;
20
+ /** Whether link is external */
17
21
  isExternal?: boolean;
22
+ /** Whether sources card is expandable */
18
23
  hasShowMore?: boolean;
24
+ /** onClick event applied to the title of the Sources card */
25
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
26
+ /** Any additional props applied to the title of the Sources card */
27
+ titleProps?: ButtonProps;
19
28
  }[];
20
29
  /** Label for the English word "source" */
21
30
  sourceWord?: string;
@@ -36,5 +45,5 @@ export interface SourcesCardProps extends CardProps {
36
45
  /** Label for English words "show less" */
37
46
  showLessWords?: string;
38
47
  }
39
- declare const SourcesCard: React.FunctionComponent<SourcesCardProps>;
48
+ declare const SourcesCard: FunctionComponent<SourcesCardProps>;
40
49
  export default SourcesCard;
@@ -9,17 +9,16 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- // ============================================================================
13
- // Chatbot Main - Messages - Sources Card
14
- // ============================================================================
15
- import React from 'react';
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useState } from 'react';
16
14
  // Import PatternFly components
17
15
  import { Button, ButtonVariant, Card, CardBody, CardFooter, CardTitle, ExpandableSection, ExpandableSectionVariant, Icon, pluralize, Truncate } from '@patternfly/react-core';
18
16
  import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons';
19
17
  const SourcesCard = (_a) => {
18
+ var _b;
20
19
  var { className, isDisabled, paginationAriaLabel = 'Pagination', sources, sourceWord = 'source', sourceWordPlural = 'sources', toNextPageAriaLabel = 'Go to next page', toPreviousPageAriaLabel = 'Go to previous page', onNextClick, onPreviousClick, onSetPage, showMoreWords = 'show more', showLessWords = 'show less', isCompact } = _a, props = __rest(_a, ["className", "isDisabled", "paginationAriaLabel", "sources", "sourceWord", "sourceWordPlural", "toNextPageAriaLabel", "toPreviousPageAriaLabel", "onNextClick", "onPreviousClick", "onSetPage", "showMoreWords", "showLessWords", "isCompact"]);
21
- const [page, setPage] = React.useState(1);
22
- const [isExpanded, setIsExpanded] = React.useState(false);
20
+ const [page, setPage] = useState(1);
21
+ const [isExpanded, setIsExpanded] = useState(false);
23
22
  const onToggle = (_event, isExpanded) => {
24
23
  setIsExpanded(isExpanded);
25
24
  };
@@ -29,41 +28,20 @@ const SourcesCard = (_a) => {
29
28
  };
30
29
  const renderTitle = (title) => {
31
30
  if (title) {
32
- return React.createElement(Truncate, { content: title });
31
+ return _jsx(Truncate, { content: title });
33
32
  }
34
33
  return `Source ${page}`;
35
34
  };
36
- return (React.createElement("div", { className: "pf-chatbot__source" },
37
- React.createElement("span", null, pluralize(sources.length, sourceWord, sourceWordPlural)),
38
- React.createElement(Card, Object.assign({ isCompact: isCompact, className: "pf-chatbot__sources-card" }, props),
39
- React.createElement(CardTitle, { className: "pf-chatbot__sources-card-title" },
40
- React.createElement(Button, { component: "a", variant: ButtonVariant.link, href: sources[page - 1].link, icon: sources[page - 1].isExternal ? React.createElement(ExternalLinkSquareAltIcon, null) : undefined, iconPosition: "end", isInline: true, rel: sources[page - 1].isExternal ? 'noreferrer' : undefined, target: sources[page - 1].isExternal ? '_blank' : undefined }, renderTitle(sources[page - 1].title))),
41
- sources[page - 1].body && (React.createElement(CardBody, { className: `pf-chatbot__sources-card-body` }, sources[page - 1].hasShowMore ? (
42
- // prevents extra VO announcements of button text - parent Message has aria-live
43
- React.createElement("div", { "aria-live": "off" },
44
- React.createElement(ExpandableSection, { variant: ExpandableSectionVariant.truncate, toggleText: isExpanded ? showLessWords : showMoreWords, onToggle: onToggle, isExpanded: isExpanded, truncateMaxLines: 2 }, sources[page - 1].body))) : (React.createElement("div", { className: "pf-chatbot__sources-card-body-text" }, sources[page - 1].body)))),
45
- sources.length > 1 && (React.createElement(CardFooter, { className: "pf-chatbot__sources-card-footer-container" },
46
- React.createElement("div", { className: "pf-chatbot__sources-card-footer" },
47
- React.createElement("nav", { className: `pf-chatbot__sources-card-footer-buttons ${className}`, "aria-label": paginationAriaLabel },
48
- React.createElement(Button, { variant: ButtonVariant.plain, isDisabled: isDisabled || page === 1, "data-action": "previous", onClick: (event) => {
49
- const newPage = page >= 1 ? page - 1 : 1;
50
- onPreviousClick && onPreviousClick(event, newPage);
51
- handleNewPage(event, newPage);
52
- }, "aria-label": toPreviousPageAriaLabel },
53
- React.createElement(Icon, { iconSize: "lg" },
54
- React.createElement("svg", { className: "pf-v6-svg", viewBox: "0 0 280 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em" },
55
- React.createElement("path", { d: "M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z" })))),
56
- React.createElement("span", { "aria-hidden": "true" },
57
- page,
58
- "/",
59
- sources.length),
60
- React.createElement(Button, { variant: ButtonVariant.plain, isDisabled: isDisabled || page === sources.length, "aria-label": toNextPageAriaLabel, "data-action": "next", onClick: (event) => {
61
- const newPage = page + 1 <= sources.length ? page + 1 : sources.length;
62
- onNextClick && onNextClick(event, newPage);
63
- handleNewPage(event, newPage);
64
- } },
65
- React.createElement(Icon, { isInline: true, iconSize: "lg" },
66
- React.createElement("svg", { className: "pf-v6-svg", viewBox: "0 0 180 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em" },
67
- React.createElement("path", { d: "M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z" })))))))))));
35
+ return (_jsxs("div", { className: "pf-chatbot__source", children: [_jsx("span", { children: pluralize(sources.length, sourceWord, sourceWordPlural) }), _jsxs(Card, Object.assign({ isCompact: isCompact, className: "pf-chatbot__sources-card" }, props, { children: [_jsx(CardTitle, { className: "pf-chatbot__sources-card-title", children: _jsx(Button, Object.assign({ component: "a", variant: ButtonVariant.link, href: sources[page - 1].link, icon: sources[page - 1].isExternal ? _jsx(ExternalLinkSquareAltIcon, {}) : undefined, iconPosition: "end", isInline: true, rel: sources[page - 1].isExternal ? 'noreferrer' : undefined, target: sources[page - 1].isExternal ? '_blank' : undefined, onClick: (_b = sources[page - 1].onClick) !== null && _b !== void 0 ? _b : undefined }, sources[page - 1].titleProps, { children: renderTitle(sources[page - 1].title) })) }), sources[page - 1].body && (_jsx(CardBody, { className: `pf-chatbot__sources-card-body`, children: sources[page - 1].hasShowMore ? (
36
+ // prevents extra VO announcements of button text - parent Message has aria-live
37
+ _jsx("div", { "aria-live": "off", children: _jsx(ExpandableSection, { variant: ExpandableSectionVariant.truncate, toggleText: isExpanded ? showLessWords : showMoreWords, onToggle: onToggle, isExpanded: isExpanded, truncateMaxLines: 2, children: sources[page - 1].body }) })) : (_jsx("div", { className: "pf-chatbot__sources-card-body-text", children: sources[page - 1].body })) })), sources.length > 1 && (_jsx(CardFooter, { className: "pf-chatbot__sources-card-footer-container", children: _jsx("div", { className: "pf-chatbot__sources-card-footer", children: _jsxs("nav", { className: `pf-chatbot__sources-card-footer-buttons ${className}`, "aria-label": paginationAriaLabel, children: [_jsx(Button, { variant: ButtonVariant.plain, isDisabled: isDisabled || page === 1, "data-action": "previous", onClick: (event) => {
38
+ const newPage = page >= 1 ? page - 1 : 1;
39
+ onPreviousClick && onPreviousClick(event, newPage);
40
+ handleNewPage(event, newPage);
41
+ }, "aria-label": toPreviousPageAriaLabel, children: _jsx(Icon, { iconSize: "lg", children: _jsx("svg", { className: "pf-v6-svg", viewBox: "0 0 280 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em", children: _jsx("path", { d: "M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z" }) }) }) }), _jsxs("span", { "aria-hidden": "true", children: [page, "/", sources.length] }), _jsx(Button, { variant: ButtonVariant.plain, isDisabled: isDisabled || page === sources.length, "aria-label": toNextPageAriaLabel, "data-action": "next", onClick: (event) => {
42
+ const newPage = page + 1 <= sources.length ? page + 1 : sources.length;
43
+ onNextClick && onNextClick(event, newPage);
44
+ handleNewPage(event, newPage);
45
+ }, children: _jsx(Icon, { isInline: true, iconSize: "lg", children: _jsx("svg", { className: "pf-v6-svg", viewBox: "0 0 180 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em", children: _jsx("path", { d: "M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z" }) }) }) })] }) }) }))] }))] }));
68
46
  };
69
47
  export default SourcesCard;
@@ -7,14 +7,14 @@ 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 userEvent from '@testing-library/user-event';
13
13
  import '@testing-library/jest-dom';
14
14
  import SourcesCard from './SourcesCard';
15
15
  describe('SourcesCard', () => {
16
16
  it('should render card correctly if one source with only a link is passed in', () => {
17
- render(React.createElement(SourcesCard, { sources: [{ link: '' }] }));
17
+ render(_jsx(SourcesCard, { sources: [{ link: '' }] }));
18
18
  expect(screen.getByText('1 source')).toBeTruthy();
19
19
  expect(screen.getByText('Source 1')).toBeTruthy();
20
20
  // no buttons or navigation when there is only 1 source
@@ -22,23 +22,23 @@ describe('SourcesCard', () => {
22
22
  expect(screen.queryByText('1/1')).toBeFalsy();
23
23
  });
24
24
  it('should render card correctly if one source with a title is passed in', () => {
25
- render(React.createElement(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }] }));
25
+ render(_jsx(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }] }));
26
26
  expect(screen.getByText('1 source')).toBeTruthy();
27
27
  expect(screen.getByText('How to make an apple pie')).toBeTruthy();
28
28
  });
29
29
  it('should render card correctly if one source with a body is passed in', () => {
30
- render(React.createElement(SourcesCard, { sources: [{ link: '', body: 'To make an apple pie, you must first...' }] }));
30
+ render(_jsx(SourcesCard, { sources: [{ link: '', body: 'To make an apple pie, you must first...' }] }));
31
31
  expect(screen.getByText('1 source')).toBeTruthy();
32
32
  expect(screen.getByText('To make an apple pie, you must first...')).toBeTruthy();
33
33
  });
34
34
  it('should render card correctly if one source with a title and body is passed in', () => {
35
- render(React.createElement(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '', body: 'To make an apple pie, you must first...' }] }));
35
+ render(_jsx(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '', body: 'To make an apple pie, you must first...' }] }));
36
36
  expect(screen.getByText('1 source')).toBeTruthy();
37
37
  expect(screen.getByText('How to make an apple pie')).toBeTruthy();
38
38
  expect(screen.getByText('To make an apple pie, you must first...')).toBeTruthy();
39
39
  });
40
40
  it('should render multiple cards correctly', () => {
41
- render(React.createElement(SourcesCard, { sources: [
41
+ render(_jsx(SourcesCard, { sources: [
42
42
  { title: 'How to make an apple pie', link: '' },
43
43
  { title: 'How to make cookies', link: '' }
44
44
  ] }));
@@ -49,7 +49,7 @@ describe('SourcesCard', () => {
49
49
  screen.getByRole('button', { name: /Go to next page/i });
50
50
  });
51
51
  it('should navigate between cards correctly', () => __awaiter(void 0, void 0, void 0, function* () {
52
- render(React.createElement(SourcesCard, { sources: [
52
+ render(_jsx(SourcesCard, { sources: [
53
53
  { title: 'How to make an apple pie', link: '' },
54
54
  { title: 'How to make cookies', link: '' }
55
55
  ] }));
@@ -64,7 +64,7 @@ describe('SourcesCard', () => {
64
64
  expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
65
65
  }));
66
66
  it('should apply className appropriately', () => {
67
- render(React.createElement(SourcesCard, { sources: [
67
+ render(_jsx(SourcesCard, { sources: [
68
68
  { title: 'How to make an apple pie', link: '' },
69
69
  { title: 'How to make cookies', link: '' }
70
70
  ], className: "test" }));
@@ -72,7 +72,7 @@ describe('SourcesCard', () => {
72
72
  expect(element).toHaveClass('test');
73
73
  });
74
74
  it('should disable pagination appropriately', () => {
75
- render(React.createElement(SourcesCard, { sources: [
75
+ render(_jsx(SourcesCard, { sources: [
76
76
  { title: 'How to make an apple pie', link: '' },
77
77
  { title: 'How to make cookies', link: '' }
78
78
  ], isDisabled: true }));
@@ -80,39 +80,39 @@ describe('SourcesCard', () => {
80
80
  expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
81
81
  });
82
82
  it('should render navigation aria label appropriately', () => {
83
- render(React.createElement(SourcesCard, { sources: [
83
+ render(_jsx(SourcesCard, { sources: [
84
84
  { title: 'How to make an apple pie', link: '' },
85
85
  { title: 'How to make cookies', link: '' }
86
86
  ] }));
87
87
  expect(screen.getByRole('navigation', { name: /Pagination/i })).toBeTruthy();
88
88
  });
89
89
  it('should change paginationAriaLabel appropriately', () => {
90
- render(React.createElement(SourcesCard, { sources: [
90
+ render(_jsx(SourcesCard, { sources: [
91
91
  { title: 'How to make an apple pie', link: '' },
92
92
  { title: 'How to make cookies', link: '' }
93
93
  ], paginationAriaLabel: "Navegaci\u00F3n" }));
94
94
  expect(screen.getByRole('navigation', { name: /Navegación/i })).toBeTruthy();
95
95
  });
96
96
  it('should change sourceWord appropriately', () => {
97
- render(React.createElement(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }], sourceWord: 'fuente' }));
97
+ render(_jsx(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }], sourceWord: 'fuente' }));
98
98
  expect(screen.getByText('1 fuente')).toBeTruthy();
99
99
  });
100
100
  it('should sourceWordPlural appropriately', () => {
101
- render(React.createElement(SourcesCard, { sources: [
101
+ render(_jsx(SourcesCard, { sources: [
102
102
  { title: 'How to make an apple pie', link: '' },
103
103
  { title: 'How to make cookies', link: '' }
104
104
  ], sourceWordPlural: 'fuentes' }));
105
105
  expect(screen.getByText('2 fuentes')).toBeTruthy();
106
106
  });
107
107
  it('should change toNextPageAriaLabel appropriately', () => {
108
- render(React.createElement(SourcesCard, { sources: [
108
+ render(_jsx(SourcesCard, { sources: [
109
109
  { title: 'How to make an apple pie', link: '' },
110
110
  { title: 'How to make cookies', link: '' }
111
111
  ], toNextPageAriaLabel: "Pase a la siguiente p\u00E1gina" }));
112
112
  expect(screen.getByRole('button', { name: /Pase a la siguiente página/i })).toBeTruthy();
113
113
  });
114
114
  it('should change toPreviousPageAriaLabel appropriately', () => {
115
- render(React.createElement(SourcesCard, { sources: [
115
+ render(_jsx(SourcesCard, { sources: [
116
116
  { title: 'How to make an apple pie', link: '' },
117
117
  { title: 'How to make cookies', link: '' }
118
118
  ], toPreviousPageAriaLabel: "Presione para regresar a la p\u00E1gina anterior" }));
@@ -120,7 +120,7 @@ describe('SourcesCard', () => {
120
120
  });
121
121
  it('should call onNextClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
122
122
  const spy = jest.fn();
123
- render(React.createElement(SourcesCard, { sources: [
123
+ render(_jsx(SourcesCard, { sources: [
124
124
  { title: 'How to make an apple pie', link: '' },
125
125
  { title: 'How to make cookies', link: '' }
126
126
  ], onNextClick: spy }));
@@ -129,7 +129,7 @@ describe('SourcesCard', () => {
129
129
  }));
130
130
  it('should call onPreviousClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
131
131
  const spy = jest.fn();
132
- render(React.createElement(SourcesCard, { sources: [
132
+ render(_jsx(SourcesCard, { sources: [
133
133
  { title: 'How to make an apple pie', link: '' },
134
134
  { title: 'How to make cookies', link: '' }
135
135
  ], onPreviousClick: spy }));
@@ -139,7 +139,7 @@ describe('SourcesCard', () => {
139
139
  }));
140
140
  it('should call onSetPage appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
141
141
  const spy = jest.fn();
142
- render(React.createElement(SourcesCard, { sources: [
142
+ render(_jsx(SourcesCard, { sources: [
143
143
  { title: 'How to make an apple pie', link: '' },
144
144
  { title: 'How to make cookies', link: '' }
145
145
  ], onSetPage: spy }));
@@ -149,7 +149,7 @@ describe('SourcesCard', () => {
149
149
  expect(spy).toHaveBeenCalledTimes(2);
150
150
  }));
151
151
  it('should handle showMore appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
152
- render(React.createElement(SourcesCard, { sources: [
152
+ render(_jsx(SourcesCard, { sources: [
153
153
  {
154
154
  title: 'Getting started with Red Hat OpenShift',
155
155
  link: '#',
@@ -169,4 +169,14 @@ describe('SourcesCard', () => {
169
169
  ] }));
170
170
  expect(screen.getByRole('region')).toHaveAttribute('class', 'pf-v6-c-expandable-section__content');
171
171
  }));
172
+ it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
173
+ const spy = jest.fn();
174
+ render(_jsx(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '', onClick: spy }] }));
175
+ yield userEvent.click(screen.getByRole('link', { name: /How to make an apple pie/i }));
176
+ expect(spy).toHaveBeenCalled();
177
+ }));
178
+ it('should apply titleProps appropriately', () => {
179
+ render(_jsx(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '', titleProps: { className: 'test' } }] }));
180
+ expect(screen.getByRole('link', { name: /How to make an apple pie/i })).toHaveClass('test');
181
+ });
172
182
  });