@patternfly/chatbot 2.2.1 → 6.3.0-prerelease.10

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 (310) hide show
  1. package/dist/cjs/AttachmentEdit/AttachmentEdit.d.ts +2 -0
  2. package/dist/cjs/AttachmentEdit/AttachmentEdit.js +2 -2
  3. package/dist/cjs/Chatbot/Chatbot.d.ts +2 -0
  4. package/dist/cjs/Chatbot/Chatbot.js +2 -2
  5. package/dist/cjs/Chatbot/Chatbot.test.js +4 -0
  6. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +6 -0
  7. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -3
  8. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +27 -0
  9. package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +1 -0
  10. package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
  11. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
  12. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -0
  13. package/dist/cjs/ChatbotHeader/ChatbotHeader.js +1 -1
  14. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
  15. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
  16. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
  17. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
  18. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +1 -1
  19. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
  20. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
  21. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
  22. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
  23. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
  24. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
  25. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
  26. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
  27. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
  28. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
  29. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
  30. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
  31. package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +3 -0
  32. package/dist/cjs/ChatbotModal/ChatbotModal.js +2 -2
  33. package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +1 -0
  34. package/dist/cjs/ChatbotModal/ChatbotModal.test.js +28 -0
  35. package/dist/cjs/ChatbotPopover/ChatbotPopover.js +1 -1
  36. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
  37. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
  38. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
  39. package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
  40. package/dist/cjs/CodeModal/CodeModal.js +3 -3
  41. package/dist/cjs/CodeModal/CodeModal.test.d.ts +1 -0
  42. package/dist/cjs/CodeModal/CodeModal.test.js +15 -0
  43. package/dist/cjs/FileDetails/FileDetails.js +1 -1
  44. package/dist/cjs/Message/Message.d.ts +19 -1
  45. package/dist/cjs/Message/Message.js +58 -39
  46. package/dist/cjs/Message/Message.test.js +64 -0
  47. package/dist/cjs/Message/MessageInput.d.ts +18 -0
  48. package/dist/cjs/Message/MessageInput.js +34 -0
  49. package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +2 -0
  50. package/dist/cjs/Message/QuickResponse/QuickResponse.js +2 -2
  51. package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +2 -0
  52. package/dist/cjs/Message/QuickStarts/QuickStartTile.js +2 -2
  53. package/dist/cjs/Message/UserFeedback/UserFeedback.js +4 -4
  54. package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +4 -0
  55. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +4 -4
  56. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
  57. package/dist/cjs/MessageBar/AttachButton.d.ts +1 -0
  58. package/dist/cjs/MessageBar/AttachButton.js +3 -3
  59. package/dist/cjs/MessageBar/AttachButton.test.js +4 -0
  60. package/dist/cjs/MessageBar/MessageBar.d.ts +5 -0
  61. package/dist/cjs/MessageBar/MessageBar.js +14 -13
  62. package/dist/cjs/MessageBar/MessageBar.test.js +13 -0
  63. package/dist/cjs/MessageBar/MicrophoneButton.d.ts +1 -0
  64. package/dist/cjs/MessageBar/MicrophoneButton.js +4 -4
  65. package/dist/cjs/MessageBar/SendButton.d.ts +1 -0
  66. package/dist/cjs/MessageBar/SendButton.js +3 -3
  67. package/dist/cjs/MessageBar/SendButton.test.js +4 -0
  68. package/dist/cjs/MessageBar/StopButton.d.ts +1 -0
  69. package/dist/cjs/MessageBar/StopButton.js +3 -3
  70. package/dist/cjs/MessageBar/StopButton.test.js +4 -0
  71. package/dist/cjs/MessageBox/MessageBox.d.ts +4 -0
  72. package/dist/cjs/MessageBox/MessageBox.js +21 -7
  73. package/dist/cjs/MessageBox/MessageBox.test.js +43 -0
  74. package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +2 -0
  75. package/dist/cjs/PreviewAttachment/PreviewAttachment.js +2 -2
  76. package/dist/cjs/Settings/SettingsForm.d.ts +2 -0
  77. package/dist/cjs/Settings/SettingsForm.js +2 -2
  78. package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -1
  79. package/dist/cjs/Settings/SettingsForm.test.js +12 -0
  80. package/dist/cjs/SourcesCard/SourcesCard.d.ts +7 -1
  81. package/dist/cjs/SourcesCard/SourcesCard.js +17 -11
  82. package/dist/cjs/SourcesCard/SourcesCard.test.js +25 -15
  83. package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +2 -0
  84. package/dist/cjs/TermsOfUse/TermsOfUse.js +5 -5
  85. package/dist/cjs/tracking/console_tracking_provider.d.ts +4 -5
  86. package/dist/cjs/tracking/console_tracking_provider.js +22 -15
  87. package/dist/cjs/tracking/posthog_tracking_provider.d.ts +2 -2
  88. package/dist/cjs/tracking/posthog_tracking_provider.js +21 -12
  89. package/dist/cjs/tracking/segment_tracking_provider.d.ts +2 -2
  90. package/dist/cjs/tracking/segment_tracking_provider.js +21 -12
  91. package/dist/cjs/tracking/trackingProviderProxy.d.ts +1 -1
  92. package/dist/cjs/tracking/trackingProviderProxy.js +2 -2
  93. package/dist/cjs/tracking/tracking_api.d.ts +1 -1
  94. package/dist/cjs/tracking/tracking_registry.js +46 -12
  95. package/dist/cjs/tracking/tracking_spi.d.ts +15 -5
  96. package/dist/cjs/tracking/tracking_spi.js +9 -0
  97. package/dist/cjs/tracking/umami_tracking_provider.d.ts +6 -2
  98. package/dist/cjs/tracking/umami_tracking_provider.js +66 -22
  99. package/dist/css/main.css +225 -22
  100. package/dist/css/main.css.map +1 -1
  101. package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +2 -0
  102. package/dist/esm/AttachmentEdit/AttachmentEdit.js +2 -2
  103. package/dist/esm/Chatbot/Chatbot.d.ts +2 -0
  104. package/dist/esm/Chatbot/Chatbot.js +2 -2
  105. package/dist/esm/Chatbot/Chatbot.test.js +4 -0
  106. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +6 -0
  107. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -3
  108. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +27 -0
  109. package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +1 -0
  110. package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
  111. package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
  112. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -0
  113. package/dist/esm/ChatbotHeader/ChatbotHeader.js +1 -1
  114. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
  115. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
  116. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
  117. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
  118. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +1 -1
  119. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
  120. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
  121. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
  122. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
  123. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
  124. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
  125. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
  126. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
  127. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
  128. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
  129. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
  130. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
  131. package/dist/esm/ChatbotModal/ChatbotModal.d.ts +3 -0
  132. package/dist/esm/ChatbotModal/ChatbotModal.js +2 -2
  133. package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +1 -0
  134. package/dist/esm/ChatbotModal/ChatbotModal.test.js +23 -0
  135. package/dist/esm/ChatbotPopover/ChatbotPopover.js +1 -1
  136. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
  137. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
  138. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
  139. package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
  140. package/dist/esm/CodeModal/CodeModal.js +3 -3
  141. package/dist/esm/CodeModal/CodeModal.test.d.ts +1 -0
  142. package/dist/esm/CodeModal/CodeModal.test.js +10 -0
  143. package/dist/esm/FileDetails/FileDetails.js +1 -1
  144. package/dist/esm/Message/Message.d.ts +19 -1
  145. package/dist/esm/Message/Message.js +58 -39
  146. package/dist/esm/Message/Message.test.js +64 -0
  147. package/dist/esm/Message/MessageInput.d.ts +18 -0
  148. package/dist/esm/Message/MessageInput.js +29 -0
  149. package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +2 -0
  150. package/dist/esm/Message/QuickResponse/QuickResponse.js +2 -2
  151. package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +2 -0
  152. package/dist/esm/Message/QuickStarts/QuickStartTile.js +2 -2
  153. package/dist/esm/Message/UserFeedback/UserFeedback.js +4 -4
  154. package/dist/esm/Message/UserFeedback/UserFeedback.test.js +4 -0
  155. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +4 -4
  156. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
  157. package/dist/esm/MessageBar/AttachButton.d.ts +1 -0
  158. package/dist/esm/MessageBar/AttachButton.js +3 -3
  159. package/dist/esm/MessageBar/AttachButton.test.js +4 -0
  160. package/dist/esm/MessageBar/MessageBar.d.ts +5 -0
  161. package/dist/esm/MessageBar/MessageBar.js +14 -13
  162. package/dist/esm/MessageBar/MessageBar.test.js +13 -0
  163. package/dist/esm/MessageBar/MicrophoneButton.d.ts +1 -0
  164. package/dist/esm/MessageBar/MicrophoneButton.js +4 -4
  165. package/dist/esm/MessageBar/SendButton.d.ts +1 -0
  166. package/dist/esm/MessageBar/SendButton.js +3 -3
  167. package/dist/esm/MessageBar/SendButton.test.js +4 -0
  168. package/dist/esm/MessageBar/StopButton.d.ts +1 -0
  169. package/dist/esm/MessageBar/StopButton.js +3 -3
  170. package/dist/esm/MessageBar/StopButton.test.js +4 -0
  171. package/dist/esm/MessageBox/MessageBox.d.ts +4 -0
  172. package/dist/esm/MessageBox/MessageBox.js +21 -7
  173. package/dist/esm/MessageBox/MessageBox.test.js +44 -1
  174. package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +2 -0
  175. package/dist/esm/PreviewAttachment/PreviewAttachment.js +2 -2
  176. package/dist/esm/Settings/SettingsForm.d.ts +2 -0
  177. package/dist/esm/Settings/SettingsForm.js +2 -2
  178. package/dist/esm/Settings/SettingsForm.test.d.ts +1 -1
  179. package/dist/esm/Settings/SettingsForm.test.js +12 -0
  180. package/dist/esm/SourcesCard/SourcesCard.d.ts +7 -1
  181. package/dist/esm/SourcesCard/SourcesCard.js +18 -12
  182. package/dist/esm/SourcesCard/SourcesCard.test.js +25 -15
  183. package/dist/esm/TermsOfUse/TermsOfUse.d.ts +2 -0
  184. package/dist/esm/TermsOfUse/TermsOfUse.js +5 -5
  185. package/dist/esm/tracking/console_tracking_provider.d.ts +4 -5
  186. package/dist/esm/tracking/console_tracking_provider.js +22 -15
  187. package/dist/esm/tracking/posthog_tracking_provider.d.ts +2 -2
  188. package/dist/esm/tracking/posthog_tracking_provider.js +21 -12
  189. package/dist/esm/tracking/segment_tracking_provider.d.ts +2 -2
  190. package/dist/esm/tracking/segment_tracking_provider.js +21 -12
  191. package/dist/esm/tracking/trackingProviderProxy.d.ts +1 -1
  192. package/dist/esm/tracking/trackingProviderProxy.js +2 -2
  193. package/dist/esm/tracking/tracking_api.d.ts +1 -1
  194. package/dist/esm/tracking/tracking_registry.js +46 -12
  195. package/dist/esm/tracking/tracking_spi.d.ts +15 -5
  196. package/dist/esm/tracking/tracking_spi.js +8 -1
  197. package/dist/esm/tracking/umami_tracking_provider.d.ts +6 -2
  198. package/dist/esm/tracking/umami_tracking_provider.js +66 -22
  199. package/dist/tsconfig.tsbuildinfo +1 -1
  200. package/package.json +1 -1
  201. package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +18 -14
  202. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +10 -1
  203. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +74 -104
  204. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +48 -37
  205. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +33 -0
  206. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +34 -0
  207. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +11 -0
  208. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +71 -13
  209. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +3 -1
  210. package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +10 -1
  211. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +80 -104
  212. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +44 -2
  213. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +13 -2
  214. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +9 -0
  215. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +11 -2
  216. package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +289 -0
  217. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUseCompact.tsx +136 -0
  218. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +15 -1
  219. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +8 -1
  220. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +6 -3
  221. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +2 -0
  222. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -0
  223. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +481 -0
  224. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +2 -0
  225. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -0
  226. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +62 -57
  227. package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +2 -0
  228. package/src/AttachmentEdit/AttachmentEdit.tsx +5 -1
  229. package/src/Chatbot/Chatbot.scss +7 -0
  230. package/src/Chatbot/Chatbot.test.tsx +9 -0
  231. package/src/Chatbot/Chatbot.tsx +4 -1
  232. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +38 -3
  233. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +71 -0
  234. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +23 -2
  235. package/src/ChatbotFooter/ChatbotFooter.scss +5 -0
  236. package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -0
  237. package/src/ChatbotFooter/ChatbotFooter.tsx +3 -1
  238. package/src/ChatbotHeader/ChatbotHeader.scss +25 -0
  239. package/src/ChatbotHeader/ChatbotHeader.tsx +1 -1
  240. package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +6 -0
  241. package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +12 -6
  242. package/src/ChatbotHeader/ChatbotHeaderMain.tsx +3 -1
  243. package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +8 -0
  244. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +10 -5
  245. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +6 -0
  246. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +5 -2
  247. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +10 -0
  248. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +4 -0
  249. package/src/ChatbotModal/ChatbotModal.scss +15 -4
  250. package/src/ChatbotModal/ChatbotModal.test.tsx +59 -0
  251. package/src/ChatbotModal/ChatbotModal.tsx +5 -1
  252. package/src/ChatbotPopover/ChatbotPopover.scss +9 -5
  253. package/src/ChatbotPopover/ChatbotPopover.tsx +1 -1
  254. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -1
  255. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +13 -0
  256. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +13 -2
  257. package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
  258. package/src/CodeModal/CodeModal.scss +11 -3
  259. package/src/CodeModal/CodeModal.test.tsx +24 -0
  260. package/src/CodeModal/CodeModal.tsx +6 -2
  261. package/src/FileDetails/FileDetails.tsx +1 -1
  262. package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +1 -1
  263. package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +1 -1
  264. package/src/Message/Message.scss +31 -0
  265. package/src/Message/Message.test.tsx +83 -0
  266. package/src/Message/Message.tsx +121 -56
  267. package/src/Message/MessageInput.tsx +59 -0
  268. package/src/Message/QuickResponse/QuickResponse.tsx +5 -1
  269. package/src/Message/QuickStarts/QuickStartTile.tsx +5 -1
  270. package/src/Message/TextMessage/TextMessage.scss +25 -0
  271. package/src/Message/UserFeedback/UserFeedback.scss +24 -3
  272. package/src/Message/UserFeedback/UserFeedback.test.tsx +13 -0
  273. package/src/Message/UserFeedback/UserFeedback.tsx +4 -2
  274. package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +4 -0
  275. package/src/Message/UserFeedback/UserFeedbackComplete.tsx +10 -2
  276. package/src/MessageBar/AttachButton.scss +10 -0
  277. package/src/MessageBar/AttachButton.test.tsx +4 -0
  278. package/src/MessageBar/AttachButton.tsx +5 -2
  279. package/src/MessageBar/MessageBar.scss +17 -0
  280. package/src/MessageBar/MessageBar.test.tsx +13 -0
  281. package/src/MessageBar/MessageBar.tsx +23 -8
  282. package/src/MessageBar/MicrophoneButton.scss +10 -0
  283. package/src/MessageBar/MicrophoneButton.tsx +6 -3
  284. package/src/MessageBar/SendButton.scss +10 -0
  285. package/src/MessageBar/SendButton.test.tsx +5 -1
  286. package/src/MessageBar/SendButton.tsx +5 -2
  287. package/src/MessageBar/StopButton.scss +10 -0
  288. package/src/MessageBar/StopButton.test.tsx +5 -1
  289. package/src/MessageBar/StopButton.tsx +5 -2
  290. package/src/MessageBox/MessageBox.scss +6 -0
  291. package/src/MessageBox/MessageBox.test.tsx +45 -1
  292. package/src/MessageBox/MessageBox.tsx +16 -6
  293. package/src/PreviewAttachment/PreviewAttachment.tsx +5 -1
  294. package/src/Settings/Settings.scss +11 -0
  295. package/src/Settings/SettingsForm.test.tsx +17 -0
  296. package/src/Settings/SettingsForm.tsx +12 -2
  297. package/src/SourcesCard/SourcesCard.scss +11 -7
  298. package/src/SourcesCard/SourcesCard.test.tsx +30 -22
  299. package/src/SourcesCard/SourcesCard.tsx +56 -13
  300. package/src/TermsOfUse/TermsOfUse.scss +20 -0
  301. package/src/TermsOfUse/TermsOfUse.tsx +9 -4
  302. package/src/tracking/console_tracking_provider.ts +21 -17
  303. package/src/tracking/posthog_tracking_provider.ts +20 -13
  304. package/src/tracking/segment_tracking_provider.ts +20 -13
  305. package/src/tracking/trackingProviderProxy.ts +2 -2
  306. package/src/tracking/tracking_api.ts +1 -1
  307. package/src/tracking/tracking_registry.ts +46 -13
  308. package/src/tracking/tracking_spi.ts +18 -7
  309. package/src/tracking/umami_tracking_provider.ts +76 -20
  310. package/src/SourcesCard/__snapshots__/SourcesCard.test.tsx.snap +0 -34
@@ -37,10 +37,14 @@ export interface MessageBarProps extends TextAreaProps {
37
37
  className?: string;
38
38
  /** Flag to always to show the send button. By default send button is shown when there is a message in the input field */
39
39
  alwayShowSendButton?: boolean;
40
+ /** Placeholder for message input */
41
+ placeholder?: string;
40
42
  /** Flag to disable/enable the Attach button */
41
43
  hasAttachButton?: boolean;
42
44
  /** Flag to enable the Microphone button */
43
45
  hasMicrophoneButton?: boolean;
46
+ /** Placeholder text when listening */
47
+ listeningText?: string;
44
48
  /** Flag to enable the Stop button, used for streaming content */
45
49
  hasStopButton?: boolean;
46
50
  /** Callback function for when stop button is clicked */
@@ -72,14 +76,17 @@ export interface MessageBarProps extends TextAreaProps {
72
76
  onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, value: string | number) => void;
73
77
  /** Display mode of chatbot, if you want to message bar to resize when the display mode changes */
74
78
  displayMode?: ChatbotDisplayMode;
79
+ isCompact?: boolean;
75
80
  }
76
81
 
77
82
  export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
78
83
  onSendMessage,
79
84
  className,
80
85
  alwayShowSendButton,
86
+ placeholder = 'Send a message...',
81
87
  hasAttachButton = true,
82
88
  hasMicrophoneButton,
89
+ listeningText = 'Listening',
83
90
  handleAttach,
84
91
  attachMenuProps,
85
92
  isSendButtonDisabled,
@@ -89,6 +96,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
89
96
  onChange,
90
97
  displayMode,
91
98
  value,
99
+ isCompact = false,
92
100
  ...props
93
101
  }: MessageBarProps) => {
94
102
  // Text Input
@@ -99,11 +107,13 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
99
107
  const textareaRef = React.useRef<HTMLTextAreaElement>(null);
100
108
  const attachButtonRef = React.useRef<HTMLButtonElement>(null);
101
109
 
110
+ const topMargin = '1rem';
111
+
102
112
  const setInitialLineHeight = (field: HTMLTextAreaElement) => {
103
113
  field.style.setProperty('line-height', '1rem');
104
114
  const parent = field.parentElement;
105
115
  if (parent) {
106
- parent.style.setProperty('margin-top', `1rem`);
116
+ parent.style.setProperty('margin-top', topMargin);
107
117
  parent.style.setProperty('margin-bottom', `0rem`);
108
118
  parent.style.setProperty('height', 'inherit');
109
119
 
@@ -129,8 +139,8 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
129
139
  parent.style.setProperty('height', `${height}px`);
130
140
 
131
141
  if (height > 32 || window.innerWidth <= 507) {
132
- parent.style.setProperty('margin-bottom', `1rem`);
133
- parent.style.setProperty('margin-top', `1rem`);
142
+ parent.style.setProperty('margin-bottom', topMargin);
143
+ parent.style.setProperty('margin-top', topMargin);
134
144
  }
135
145
  }
136
146
  };
@@ -154,8 +164,8 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
154
164
  const handleNewLine = (field: HTMLTextAreaElement) => {
155
165
  const parent = field.parentElement;
156
166
  if (parent) {
157
- parent.style.setProperty('margin-bottom', `1rem`);
158
- parent.style.setProperty('margin-top', `1rem`);
167
+ parent.style.setProperty('margin-bottom', topMargin);
168
+ parent.style.setProperty('margin-top', topMargin);
159
169
  }
160
170
  };
161
171
 
@@ -268,6 +278,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
268
278
  <StopButton
269
279
  onClick={handleStopButton}
270
280
  tooltipContent={buttonProps?.stop?.tooltipContent}
281
+ isCompact={isCompact}
271
282
  {...buttonProps?.stop?.props}
272
283
  />
273
284
  );
@@ -280,6 +291,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
280
291
  onClick={handleAttachMenuToggle}
281
292
  isDisabled={isListeningMessage}
282
293
  tooltipContent={buttonProps?.attach?.tooltipContent}
294
+ isCompact={isCompact}
283
295
  {...buttonProps?.attach?.props}
284
296
  />
285
297
  )}
@@ -289,6 +301,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
289
301
  isDisabled={isListeningMessage}
290
302
  tooltipContent={buttonProps?.attach?.tooltipContent}
291
303
  inputTestId={buttonProps?.attach?.inputTestId}
304
+ isCompact={isCompact}
292
305
  {...buttonProps?.attach?.props}
293
306
  />
294
307
  )}
@@ -299,6 +312,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
299
312
  onSpeechRecognition={handleSpeechRecognition}
300
313
  tooltipContent={buttonProps?.microphone?.tooltipContent}
301
314
  language={buttonProps?.microphone?.language}
315
+ isCompact={isCompact}
302
316
  {...buttonProps?.microphone?.props}
303
317
  />
304
318
  )}
@@ -308,6 +322,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
308
322
  onClick={() => handleSend(message)}
309
323
  isDisabled={isSendButtonDisabled}
310
324
  tooltipContent={buttonProps?.send?.tooltipContent}
325
+ isCompact={isCompact}
311
326
  {...buttonProps?.send?.props}
312
327
  />
313
328
  )}
@@ -317,13 +332,13 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
317
332
 
318
333
  const messageBarContents = (
319
334
  <>
320
- <div className="pf-chatbot__message-bar-input">
335
+ <div className={`pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}`}>
321
336
  <TextArea
322
337
  className="pf-chatbot__message-textarea"
323
338
  value={message}
324
339
  onChange={handleChange}
325
- aria-label={isListeningMessage ? 'Listening' : 'Send a message...'}
326
- placeholder={isListeningMessage ? 'Listening' : 'Send a message...'}
340
+ aria-label={isListeningMessage ? listeningText : placeholder}
341
+ placeholder={isListeningMessage ? listeningText : placeholder}
327
342
  ref={textareaRef}
328
343
  onKeyDown={handleKeyDown}
329
344
  {...props}
@@ -46,3 +46,13 @@
46
46
  box-shadow: 0 0 0 16px rgba(0, 102, 204, 0);
47
47
  }
48
48
  }
49
+
50
+ // ============================================================================
51
+ // Information density styles
52
+ // ============================================================================
53
+ .pf-v6-c-button.pf-chatbot__button--microphone.pf-m-compact {
54
+ width: 1.5rem;
55
+ height: 1.5rem;
56
+ padding: var(--pf-t--global--spacer--sm);
57
+ align-items: center;
58
+ }
@@ -24,6 +24,7 @@ export interface MicrophoneButtonProps extends ButtonProps {
24
24
  tooltipContent?: { active?: string; inactive?: string };
25
25
  /** Locale code for language speech recognition is conducted in. This should be in the format 'en-US', a.k.a. the ISO 639-1 code, a dash, and the ISO_3166-1 code. */
26
26
  language?: string;
27
+ isCompact?: boolean;
27
28
  }
28
29
 
29
30
  export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> = ({
@@ -34,6 +35,7 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
34
35
  tooltipProps,
35
36
  tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' },
36
37
  language = 'en-US',
38
+ isCompact,
37
39
  ...props
38
40
  }: MicrophoneButtonProps) => {
39
41
  // Microphone
@@ -81,7 +83,7 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
81
83
 
82
84
  setSpeechRecognition(recognition);
83
85
  }
84
- }, [onSpeechRecognition]);
86
+ }, [onSpeechRecognition, language, onIsListeningChange]);
85
87
 
86
88
  if (!speechRecognition) {
87
89
  return null;
@@ -102,14 +104,15 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
102
104
  >
103
105
  <Button
104
106
  variant="plain"
105
- className={`pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${className ?? ''}`}
107
+ className={`pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
106
108
  aria-label={props['aria-label'] || 'Microphone button'}
107
109
  onClick={isListening ? stopListening : startListening}
108
110
  icon={
109
- <Icon iconSize="xl" isInline>
111
+ <Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
110
112
  <MicrophoneIcon />
111
113
  </Icon>
112
114
  }
115
+ size={isCompact ? 'sm' : undefined}
113
116
  {...props}
114
117
  />
115
118
  </Tooltip>
@@ -51,3 +51,13 @@
51
51
  transform: translate3d(0, 0, 0);
52
52
  }
53
53
  }
54
+
55
+ // ============================================================================
56
+ // Information density styles
57
+ // ============================================================================
58
+ .pf-v6-c-button.pf-chatbot__button--send.pf-m-compact {
59
+ width: 1.5rem;
60
+ height: 1.5rem;
61
+ padding: var(--pf-t--global--spacer--sm);
62
+ align-items: center;
63
+ }
@@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event';
5
5
  import { SendButton } from './SendButton';
6
6
  import { TooltipProps } from '@patternfly/react-core';
7
7
 
8
- const renderSend = (props?: { [key: string]: string | Omit<TooltipProps, 'content'> }) => {
8
+ const renderSend = (props?: { [key: string]: string | boolean | Omit<TooltipProps, 'content'> }) => {
9
9
  const spy = jest.fn();
10
10
  render(<SendButton onClick={spy} {...props} />);
11
11
  };
@@ -40,4 +40,8 @@ describe('Send button', () => {
40
40
  await userEvent.click(screen.getByRole('button', { name: 'Send button' }));
41
41
  expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
42
42
  });
43
+ it('should handle isCompact', () => {
44
+ renderSend({ 'data-testid': 'button', isCompact: true });
45
+ expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
46
+ });
43
47
  });
@@ -17,6 +17,7 @@ export interface SendButtonProps extends ButtonProps {
17
17
  tooltipProps?: Omit<TooltipProps, 'content'>;
18
18
  /** English text "Send" used in the tooltip */
19
19
  tooltipContent?: string;
20
+ isCompact?: boolean;
20
21
  }
21
22
 
22
23
  export const SendButton: React.FunctionComponent<SendButtonProps> = ({
@@ -24,6 +25,7 @@ export const SendButton: React.FunctionComponent<SendButtonProps> = ({
24
25
  onClick,
25
26
  tooltipProps,
26
27
  tooltipContent = 'Send',
28
+ isCompact,
27
29
  ...props
28
30
  }: SendButtonProps) => (
29
31
  <Tooltip
@@ -40,14 +42,15 @@ export const SendButton: React.FunctionComponent<SendButtonProps> = ({
40
42
  >
41
43
  <Button
42
44
  variant="plain"
43
- className={`pf-chatbot__button--send ${className ?? ''}`}
45
+ className={`pf-chatbot__button--send ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
44
46
  aria-label={props['aria-label'] || 'Send button'}
45
47
  onClick={onClick}
46
48
  icon={
47
- <Icon iconSize="xl" isInline>
49
+ <Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
48
50
  <PaperPlaneIcon />
49
51
  </Icon>
50
52
  }
53
+ size={isCompact ? 'sm' : undefined}
51
54
  {...props}
52
55
  />
53
56
  </Tooltip>
@@ -34,3 +34,13 @@
34
34
  }
35
35
  }
36
36
  }
37
+
38
+ // ============================================================================
39
+ // Information density styles
40
+ // ============================================================================
41
+ .pf-v6-c-button.pf-chatbot__button--stop.pf-m-compact {
42
+ width: 1.5rem;
43
+ height: 1.5rem;
44
+ padding: var(--pf-t--global--spacer--sm);
45
+ align-items: center;
46
+ }
@@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event';
5
5
  import { StopButton } from './StopButton';
6
6
  import { TooltipProps } from '@patternfly/react-core';
7
7
 
8
- const renderStop = (props?: { [key: string]: string | Omit<TooltipProps, 'content'> }) => {
8
+ const renderStop = (props?: { [key: string]: string | boolean | Omit<TooltipProps, 'content'> }) => {
9
9
  const spy = jest.fn();
10
10
  render(<StopButton onClick={spy} {...props} />);
11
11
  };
@@ -39,4 +39,8 @@ describe('Stop button', () => {
39
39
  await userEvent.click(screen.getByRole('button', { name: 'Stop button' }));
40
40
  expect(screen.getByRole('tooltip', { name: 'Stop' })).toHaveAttribute('id', 'test');
41
41
  });
42
+ it('should handle isCompact', () => {
43
+ renderStop({ 'data-testid': 'button', isCompact: true });
44
+ expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
45
+ });
42
46
  });
@@ -15,6 +15,7 @@ export interface StopButtonProps extends ButtonProps {
15
15
  tooltipProps?: Omit<TooltipProps, 'content'>;
16
16
  /** English text "Stop" used in the tooltip */
17
17
  tooltipContent?: string;
18
+ isCompact?: boolean;
18
19
  }
19
20
 
20
21
  export const StopButton: React.FunctionComponent<StopButtonProps> = ({
@@ -22,6 +23,7 @@ export const StopButton: React.FunctionComponent<StopButtonProps> = ({
22
23
  onClick,
23
24
  tooltipProps,
24
25
  tooltipContent = 'Stop',
26
+ isCompact,
25
27
  ...props
26
28
  }: StopButtonProps) => (
27
29
  <Tooltip
@@ -37,12 +39,12 @@ export const StopButton: React.FunctionComponent<StopButtonProps> = ({
37
39
  {...tooltipProps}
38
40
  >
39
41
  <Button
40
- className={`pf-chatbot__button--stop ${className ?? ''}`}
42
+ className={`pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
41
43
  variant="link"
42
44
  aria-label={props['aria-label'] || 'Stop button'}
43
45
  onClick={onClick}
44
46
  icon={
45
- <Icon iconSize="xl" isInline>
47
+ <Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
46
48
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
47
49
  <path
48
50
  d="M0.5 3C0.5 1.62109 1.62109 0.5 3 0.5H13C14.3789 0.5 15.5 1.62109 15.5 3V13C15.5 14.3789 14.3789 15.5 13 15.5H3C1.62109 15.5 0.5 14.3789 0.5 13V3Z"
@@ -51,6 +53,7 @@ export const StopButton: React.FunctionComponent<StopButtonProps> = ({
51
53
  </svg>
52
54
  </Icon>
53
55
  }
56
+ size={isCompact ? 'sm' : undefined}
54
57
  {...props}
55
58
  />
56
59
  </Tooltip>
@@ -45,3 +45,9 @@
45
45
  }
46
46
  }
47
47
  }
48
+
49
+ .pf-chatbot.pf-m-compact {
50
+ .pf-chatbot__messagebox {
51
+ padding: var(--pf-t--global--spacer--md);
52
+ }
53
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
2
+ import { render, screen, waitFor } from '@testing-library/react';
3
3
  import { MessageBox } from './MessageBox';
4
+ import userEvent from '@testing-library/user-event';
4
5
 
5
6
  describe('MessageBox', () => {
6
7
  it('should render Message box', () => {
@@ -23,4 +24,47 @@ describe('MessageBox', () => {
23
24
  expect(ref.current).not.toBeNull();
24
25
  expect(ref.current).toBeInstanceOf(HTMLDivElement);
25
26
  });
27
+ it('should call onScrollToBottomClick when scroll to top button is clicked', async () => {
28
+ const spy = jest.fn();
29
+ render(
30
+ <MessageBox onScrollToBottomClick={spy}>
31
+ <div>Test message content</div>
32
+ </MessageBox>
33
+ );
34
+
35
+ // this forces button to show
36
+ const region = screen.getByRole('region');
37
+ Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
38
+ Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
39
+ Object.defineProperty(region, 'scrollTop', { configurable: true, value: 0 });
40
+ region.dispatchEvent(new Event('scroll'));
41
+
42
+ await waitFor(() => {
43
+ userEvent.click(screen.getByRole('button', { name: /Jump bottom button/i }));
44
+ expect(spy).toHaveBeenCalled();
45
+ });
46
+ });
47
+ it('should call onScrollToTopClick when scroll to top button is clicked', async () => {
48
+ const spy = jest.fn();
49
+ render(
50
+ <MessageBox onScrollToTopClick={spy}>
51
+ <div>Test message content</div>
52
+ </MessageBox>
53
+ );
54
+
55
+ // this forces button to show
56
+ const region = screen.getByRole('region');
57
+ Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
58
+ Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
59
+ Object.defineProperty(region, 'scrollTop', {
60
+ configurable: true,
61
+ value: 500
62
+ });
63
+ region.dispatchEvent(new Event('scroll'));
64
+
65
+ await waitFor(() => {
66
+ userEvent.click(screen.getByRole('button', { name: /Jump top button/i }));
67
+ expect(spy).toHaveBeenCalled();
68
+ });
69
+ });
26
70
  });
@@ -17,6 +17,10 @@ export interface MessageBoxProps extends React.HTMLProps<HTMLDivElement> {
17
17
  innerRef?: React.Ref<HTMLDivElement>;
18
18
  /** Modifier that controls how content in MessageBox is positioned within the container */
19
19
  position?: 'top' | 'bottom';
20
+ /** Click handler for additional logic for when scroll to top jump button is clicked */
21
+ onScrollToTopClick?: () => void;
22
+ /** Click handler for additional logic for when scroll to bottom jump button is clicked */
23
+ onScrollToBottomClick?: () => void;
20
24
  }
21
25
 
22
26
  const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
@@ -25,7 +29,10 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
25
29
  children,
26
30
  innerRef,
27
31
  className,
28
- position = 'top'
32
+ position = 'top',
33
+ onScrollToTopClick,
34
+ onScrollToBottomClick,
35
+ ...props
29
36
  }: MessageBoxProps) => {
30
37
  const [atTop, setAtTop] = React.useState(false);
31
38
  const [atBottom, setAtBottom] = React.useState(true);
@@ -46,7 +53,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
46
53
  setAtTop(scrollTop === 0);
47
54
  setAtBottom(Math.round(scrollTop) + Math.round(clientHeight) >= Math.round(scrollHeight) - 1); // rounding means it could be within a pixel of the bottom
48
55
  }
49
- }, []);
56
+ }, [messageBoxRef]);
50
57
 
51
58
  const checkOverflow = React.useCallback(() => {
52
59
  const element = messageBoxRef.current;
@@ -54,21 +61,23 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
54
61
  const { scrollHeight, clientHeight } = element;
55
62
  setIsOverflowing(scrollHeight >= clientHeight);
56
63
  }
57
- }, []);
64
+ }, [messageBoxRef]);
58
65
 
59
66
  const scrollToTop = React.useCallback(() => {
60
67
  const element = messageBoxRef.current;
61
68
  if (element) {
62
69
  element.scrollTo({ top: 0, behavior: 'smooth' });
63
70
  }
64
- }, []);
71
+ onScrollToTopClick && onScrollToTopClick();
72
+ }, [messageBoxRef]);
65
73
 
66
74
  const scrollToBottom = React.useCallback(() => {
67
75
  const element = messageBoxRef.current;
68
76
  if (element) {
69
77
  element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
70
78
  }
71
- }, []);
79
+ onScrollToBottomClick && onScrollToBottomClick();
80
+ }, [messageBoxRef]);
72
81
 
73
82
  // Detect scroll position
74
83
  React.useEffect(() => {
@@ -85,7 +94,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
85
94
  element.removeEventListener('scroll', handleScroll);
86
95
  };
87
96
  }
88
- }, [checkOverflow, handleScroll]);
97
+ }, [checkOverflow, handleScroll, messageBoxRef]);
89
98
 
90
99
  return (
91
100
  <>
@@ -96,6 +105,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
96
105
  aria-label={ariaLabel}
97
106
  className={`pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className ?? ''}`}
98
107
  ref={innerRef ?? messageBoxRef}
108
+ {...props}
99
109
  >
100
110
  {children}
101
111
  <div className="pf-chatbot__messagebox-announcement" aria-live="polite">
@@ -22,6 +22,8 @@ export interface PreviewAttachmentProps {
22
22
  title?: string;
23
23
  /** Display mode for the Chatbot parent; this influences the styles applied */
24
24
  displayMode?: ChatbotDisplayMode;
25
+ /** Sets modal to compact styling. */
26
+ isCompact?: boolean;
25
27
  }
26
28
 
27
29
  export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps> = ({
@@ -32,7 +34,8 @@ export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>
32
34
  onDismiss = undefined,
33
35
  onEdit,
34
36
  title = 'Preview attachment',
35
- displayMode = ChatbotDisplayMode.default
37
+ displayMode = ChatbotDisplayMode.default,
38
+ isCompact
36
39
  }: PreviewAttachmentProps) => {
37
40
  const handleEdit = (_event: React.MouseEvent | MouseEvent | KeyboardEvent) => {
38
41
  handleModalToggle(_event);
@@ -60,6 +63,7 @@ export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>
60
63
  title={title}
61
64
  isReadOnly
62
65
  displayMode={displayMode}
66
+ isCompact={isCompact}
63
67
  />
64
68
  );
65
69
  };
@@ -32,3 +32,14 @@
32
32
  font-weight: var(--pf-t--global--font--weight--body--bold);
33
33
  text-align: center;
34
34
  }
35
+
36
+ .pf-chatbot__settings-form-container.pf-m-compact {
37
+ .pf-chatbot__settings-form-row {
38
+ padding: var(--pf-t--global--spacer--md);
39
+ font-size: var(--pf-t--global--font--size--body--md);
40
+ }
41
+ }
42
+
43
+ .pf-chatbot__header.pf-m-compact {
44
+ padding-inline-start: var(--pf-t--global--spacer--md);
45
+ }
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Button } from '@patternfly/react-core';
3
3
  import { render, screen } from '@testing-library/react';
4
4
  import { SettingsForm } from './SettingsForm';
5
+ import '@testing-library/jest-dom';
5
6
 
6
7
  describe('SettingsForm', () => {
7
8
  it('should render settingsForm with custom classname', () => {
@@ -25,4 +26,20 @@ describe('SettingsForm', () => {
25
26
 
26
27
  expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
27
28
  });
29
+
30
+ it('should render settingsForm with isCompact', () => {
31
+ const fields = [
32
+ {
33
+ id: 'archived-chat',
34
+ label: 'Archive chat',
35
+ field: (
36
+ <Button id="archived-chat" variant="secondary">
37
+ Archive chat
38
+ </Button>
39
+ )
40
+ }
41
+ ];
42
+ render(<SettingsForm data-testid="settings-form" fields={fields} isCompact />);
43
+ expect(screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
44
+ });
28
45
  });
@@ -5,10 +5,20 @@ export interface SettingsFormProps {
5
5
  className?: string;
6
6
  /** Array of fields to display in the settings layout */
7
7
  fields?: { id: string; label: string; field: React.ReactElement }[];
8
+ /** Sets form to compact styling. */
9
+ isCompact?: boolean;
8
10
  }
9
11
 
10
- export const SettingsForm: React.FunctionComponent<SettingsFormProps> = ({ className, fields = [], ...props }) => (
11
- <div className={`pf-chatbot__settings-form-container ${className}`} {...props}>
12
+ export const SettingsForm: React.FunctionComponent<SettingsFormProps> = ({
13
+ className,
14
+ fields = [],
15
+ isCompact,
16
+ ...props
17
+ }) => (
18
+ <div
19
+ className={`pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}`}
20
+ {...props}
21
+ >
12
22
  <form className="pf-chatbot__settings-form">
13
23
  {fields.map((field) => (
14
24
  <div className="pf-chatbot__settings-form-row" key={field.label}>
@@ -16,7 +16,7 @@
16
16
  box-shadow: var(--pf-t--global--box-shadow--sm);
17
17
  }
18
18
 
19
- .pf-chatbot__sources-card-body {
19
+ .pf-chatbot__sources-card-body-text {
20
20
  display: block;
21
21
  display: -webkit-box;
22
22
  height: 2.8125rem;
@@ -25,11 +25,6 @@
25
25
  -webkit-box-orient: vertical;
26
26
  overflow: hidden;
27
27
  text-overflow: ellipsis;
28
- margin-bottom: var(--pf-t--global--spacer--md);
29
- }
30
-
31
- .pf-chatbot__sources-card-no-footer {
32
- margin-bottom: var(--pf-t--global--spacer--lg);
33
28
  }
34
29
 
35
30
  .pf-chatbot__sources-card-footer-container {
@@ -38,13 +33,14 @@
38
33
  var(--pf-t--global--spacer--sm) !important;
39
34
  .pf-chatbot__sources-card-footer {
40
35
  display: flex;
41
- justify-content: space-between;
42
36
  align-items: center;
43
37
 
44
38
  &-buttons {
45
39
  display: flex;
46
40
  gap: var(--pf-t--global--spacer--xs);
47
41
  align-items: center;
42
+ justify-content: space-between;
43
+ flex: 1;
48
44
 
49
45
  .pf-v6-c-button {
50
46
  border-radius: var(--pf-t--global--border--radius--pill);
@@ -78,3 +74,11 @@
78
74
  }
79
75
  }
80
76
  }
77
+
78
+ .pf-v6-c-card.pf-m-compact.pf-chatbot__sources-card {
79
+ .pf-v6-c-card__footer.pf-chatbot__sources-card-footer-container {
80
+ border-top: var(--pf-t--global--border--width--regular) solid var(--pf-t--global--border--color--default);
81
+ padding: var(--pf-t--global--spacer--xs) var(--pf-t--global--spacer--sm) var(--pf-t--global--spacer--xs)
82
+ var(--pf-t--global--spacer--xs) !important;
83
+ }
84
+ }