@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
@@ -41,8 +41,13 @@ import rehypeExternalLinks from 'rehype-external-links';
41
41
  import rehypeSanitize from 'rehype-sanitize';
42
42
  import LinkMessage from './LinkMessage/LinkMessage';
43
43
  import ErrorMessage from './ErrorMessage/ErrorMessage';
44
+ import MessageInput from './MessageInput';
44
45
  export const MessageBase = (_a) => {
45
- var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [], error } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins", "error"]);
46
+ var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [], linkProps, error, isEditable, editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, editFormProps, isCompact } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins", "linkProps", "error", "isEditable", "editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "editFormProps", "isCompact"]);
47
+ const [messageText, setMessageText] = React.useState(content);
48
+ React.useEffect(() => {
49
+ setMessageText(content);
50
+ }, [content]);
46
51
  const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
47
52
  let rehypePlugins = [rehypeUnwrapImages];
48
53
  if (openLinkInNewTab) {
@@ -60,6 +65,51 @@ export const MessageBase = (_a) => {
60
65
  // Keep timestamps consistent between Timestamp component and aria-label
61
66
  const date = new Date();
62
67
  const dateString = timestamp !== null && timestamp !== void 0 ? timestamp : `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
68
+ const renderMessage = () => {
69
+ if (isLoading) {
70
+ return React.createElement(MessageLoading, { loadingWord: loadingWord });
71
+ }
72
+ if (isEditable) {
73
+ return (React.createElement(React.Fragment, null,
74
+ beforeMainContent && React.createElement(React.Fragment, null, beforeMainContent),
75
+ React.createElement(MessageInput, Object.assign({ content: content, editPlaceholder: editPlaceholder, updateWord: updateWord, cancelWord: cancelWord, onEditUpdate: (event, text) => {
76
+ onEditUpdate && onEditUpdate(event);
77
+ setMessageText(text);
78
+ }, onEditCancel: onEditCancel }, editFormProps))));
79
+ }
80
+ return (React.createElement(React.Fragment, null,
81
+ beforeMainContent && React.createElement(React.Fragment, null, beforeMainContent),
82
+ error ? (React.createElement(ErrorMessage, Object.assign({}, error))) : (React.createElement(Markdown, { components: {
83
+ p: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.p }, props)),
84
+ code: (_a) => {
85
+ var { children } = _a, props = __rest(_a, ["children"]);
86
+ return (React.createElement(CodeBlockMessage, Object.assign({}, props, codeBlockProps), children));
87
+ },
88
+ h1: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h1 }, props)),
89
+ h2: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h2 }, props)),
90
+ h3: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h3 }, props)),
91
+ h4: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h4 }, props)),
92
+ h5: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h5 }, props)),
93
+ h6: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h6 }, props)),
94
+ blockquote: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.blockquote }, props)),
95
+ ul: (props) => React.createElement(UnorderedListMessage, Object.assign({}, props)),
96
+ ol: (props) => React.createElement(OrderedListMessage, Object.assign({}, props)),
97
+ li: (props) => React.createElement(ListItemMessage, Object.assign({}, props)),
98
+ table: (props) => React.createElement(TableMessage, Object.assign({}, props, tableProps)),
99
+ tbody: (props) => React.createElement(TbodyMessage, Object.assign({}, props)),
100
+ thead: (props) => React.createElement(TheadMessage, Object.assign({}, props)),
101
+ tr: (props) => React.createElement(TrMessage, Object.assign({}, props)),
102
+ td: (props) => {
103
+ // Conflicts with Td type
104
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
105
+ const { width } = props, rest = __rest(props, ["width"]);
106
+ return React.createElement(TdMessage, Object.assign({}, rest));
107
+ },
108
+ th: (props) => React.createElement(ThMessage, Object.assign({}, props)),
109
+ img: (props) => React.createElement(ImageMessage, Object.assign({}, props)),
110
+ a: (props) => (React.createElement(LinkMessage, Object.assign({ href: props.href, rel: props.rel, target: props.target }, linkProps), props.children))
111
+ }, remarkPlugins: [remarkGfm], rehypePlugins: rehypePlugins }, messageText))));
112
+ };
63
113
  return (React.createElement("section", Object.assign({ "aria-label": `Message from ${role} - ${dateString}`, className: `pf-chatbot__message pf-chatbot__message--${role}`, "aria-live": isLiveRegion ? 'polite' : undefined, "aria-atomic": isLiveRegion ? false : undefined, ref: innerRef }, props),
64
114
  React.createElement(Avatar, Object.assign({ className: `pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`, src: avatar, alt: "" }, avatarProps)),
65
115
  React.createElement("div", { className: "pf-chatbot__message-contents" },
@@ -70,45 +120,14 @@ export const MessageBase = (_a) => {
70
120
  React.createElement(Timestamp, { date: date }, timestamp)),
71
121
  React.createElement("div", { className: "pf-chatbot__message-response" },
72
122
  React.createElement("div", { className: "pf-chatbot__message-and-actions" },
73
- isLoading ? (React.createElement(MessageLoading, { loadingWord: loadingWord })) : (React.createElement(React.Fragment, null,
74
- beforeMainContent && React.createElement(React.Fragment, null, beforeMainContent),
75
- error ? (React.createElement(ErrorMessage, Object.assign({}, error))) : (React.createElement(Markdown, { components: {
76
- p: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.p }, props)),
77
- code: (_a) => {
78
- var { children } = _a, props = __rest(_a, ["children"]);
79
- return (React.createElement(CodeBlockMessage, Object.assign({}, props, codeBlockProps), children));
80
- },
81
- h1: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h1 }, props)),
82
- h2: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h2 }, props)),
83
- h3: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h3 }, props)),
84
- h4: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h4 }, props)),
85
- h5: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h5 }, props)),
86
- h6: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.h6 }, props)),
87
- blockquote: (props) => React.createElement(TextMessage, Object.assign({ component: ContentVariants.blockquote }, props)),
88
- ul: (props) => React.createElement(UnorderedListMessage, Object.assign({}, props)),
89
- ol: (props) => React.createElement(OrderedListMessage, Object.assign({}, props)),
90
- li: (props) => React.createElement(ListItemMessage, Object.assign({}, props)),
91
- table: (props) => React.createElement(TableMessage, Object.assign({}, props, tableProps)),
92
- tbody: (props) => React.createElement(TbodyMessage, Object.assign({}, props)),
93
- thead: (props) => React.createElement(TheadMessage, Object.assign({}, props)),
94
- tr: (props) => React.createElement(TrMessage, Object.assign({}, props)),
95
- td: (props) => {
96
- // Conflicts with Td type
97
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
98
- const { width } = props, rest = __rest(props, ["width"]);
99
- return React.createElement(TdMessage, Object.assign({}, rest));
100
- },
101
- th: (props) => React.createElement(ThMessage, Object.assign({}, props)),
102
- img: (props) => React.createElement(ImageMessage, Object.assign({}, props)),
103
- a: (props) => (React.createElement(LinkMessage, { href: props.href, rel: props.rel, target: props.target }, props.children))
104
- }, remarkPlugins: [remarkGfm], rehypePlugins: rehypePlugins }, content)),
105
- afterMainContent && React.createElement(React.Fragment, null, afterMainContent))),
106
- !isLoading && sources && React.createElement(SourcesCard, Object.assign({}, sources)),
107
- quickStarts && quickStarts.quickStart && (React.createElement(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel })),
123
+ renderMessage(),
124
+ afterMainContent && React.createElement(React.Fragment, null, afterMainContent),
125
+ !isLoading && sources && React.createElement(SourcesCard, Object.assign({}, sources, { isCompact: isCompact })),
126
+ quickStarts && quickStarts.quickStart && (React.createElement(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel, isCompact: isCompact })),
108
127
  !isLoading && actions && React.createElement(ResponseActions, { actions: actions }),
109
- userFeedbackForm && React.createElement(UserFeedback, Object.assign({}, userFeedbackForm, { timestamp: dateString })),
110
- userFeedbackComplete && React.createElement(UserFeedbackComplete, Object.assign({}, userFeedbackComplete, { timestamp: dateString })),
111
- !isLoading && quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps }))),
128
+ userFeedbackForm && React.createElement(UserFeedback, Object.assign({}, userFeedbackForm, { timestamp: dateString, isCompact: isCompact })),
129
+ userFeedbackComplete && (React.createElement(UserFeedbackComplete, Object.assign({}, userFeedbackComplete, { timestamp: dateString, isCompact: isCompact }))),
130
+ !isLoading && quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, isCompact: isCompact }))),
112
131
  attachments && (React.createElement("div", { className: "pf-chatbot__message-attachments-container" }, attachments.map((attachment) => {
113
132
  var _a;
114
133
  return (React.createElement("div", { key: (_a = attachment.id) !== null && _a !== void 0 ? _a : attachment.name, className: "pf-chatbot__message-attachment" },
@@ -282,6 +282,18 @@ describe('Message', () => {
282
282
  yield userEvent.click(quickResponse);
283
283
  expect(spy).toHaveBeenCalledTimes(1);
284
284
  }));
285
+ it('should be able to handle isCompact', () => __awaiter(void 0, void 0, void 0, function* () {
286
+ render(React.createElement(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", quickResponses: [
287
+ {
288
+ id: '1',
289
+ content: 'Yes',
290
+ onClick: jest.fn(),
291
+ className: 'test'
292
+ }
293
+ ], isCompact: true }));
294
+ const parent = screen.getByRole('button', { name: /Yes/i }).parentNode;
295
+ expect(parent).toHaveClass('pf-m-compact');
296
+ }));
285
297
  it('should be able to show more than 1 quick response', () => __awaiter(void 0, void 0, void 0, function* () {
286
298
  const spy = jest.fn();
287
299
  render(React.createElement(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", quickResponses: [
@@ -597,6 +609,12 @@ describe('Message', () => {
597
609
  // we are mocking rehype libraries, so we can't test target _blank addition on links directly with RTL
598
610
  expect(rehypeExternalLinks).not.toHaveBeenCalled();
599
611
  });
612
+ it('should handle extra link props correctly', () => __awaiter(void 0, void 0, void 0, function* () {
613
+ const spy = jest.fn();
614
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", content: `[PatternFly](https://www.patternfly.org/)`, linkProps: { onClick: spy } }));
615
+ yield userEvent.click(screen.getByRole('link', { name: /PatternFly/i }));
616
+ expect(spy).toHaveBeenCalledTimes(1);
617
+ }));
600
618
  it('should handle error correctly', () => {
601
619
  render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", error: ERROR }));
602
620
  expect(screen.getByRole('heading', { name: /Could not load chat/i })).toBeTruthy();
@@ -614,4 +632,50 @@ describe('Message', () => {
614
632
  expect(screen.getByRole('heading', { name: /Could not load chat/i })).toBeTruthy();
615
633
  expect(screen.queryByText('Test')).toBeFalsy();
616
634
  });
635
+ it('should handle isEditable when there is message content', () => {
636
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true, content: "Test" }));
637
+ expect(screen.getByRole('textbox')).toBeTruthy();
638
+ expect(screen.getByRole('textbox')).toHaveValue('Test');
639
+ expect(screen.getByRole('button', { name: /Update/i })).toBeTruthy();
640
+ expect(screen.getByRole('button', { name: /Cancel/i })).toBeTruthy();
641
+ });
642
+ it('should handle isEditable when there is no message content', () => {
643
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true }));
644
+ expect(screen.getByRole('textbox')).toBeTruthy();
645
+ expect(screen.getByRole('textbox')).toHaveValue('');
646
+ expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Edit prompt message...');
647
+ expect(screen.getByRole('button', { name: /Update/i })).toBeTruthy();
648
+ expect(screen.getByRole('button', { name: /Cancel/i })).toBeTruthy();
649
+ });
650
+ it('should be able to change edit placeholder', () => {
651
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true, editPlaceholder: "I am a placeholder" }));
652
+ expect(screen.getByRole('textbox')).toBeTruthy();
653
+ expect(screen.getByRole('textbox')).toHaveValue('');
654
+ expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'I am a placeholder');
655
+ });
656
+ it('should be able to change updateWord', () => {
657
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true, updateWord: "Submit" }));
658
+ expect(screen.getByRole('button', { name: /Submit/i })).toBeTruthy();
659
+ });
660
+ it('should be able to change cancelWord', () => {
661
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true, cancelWord: "Don't submit" }));
662
+ expect(screen.getByRole('button', { name: /Don't submit/i })).toBeTruthy();
663
+ });
664
+ it('should be able to add onEditUpdate', () => __awaiter(void 0, void 0, void 0, function* () {
665
+ const spy = jest.fn();
666
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true, onEditUpdate: spy }));
667
+ yield userEvent.click(screen.getByRole('button', { name: /Update/i }));
668
+ expect(spy).toHaveBeenCalledTimes(1);
669
+ }));
670
+ it('should be able to add onEditCancel', () => __awaiter(void 0, void 0, void 0, function* () {
671
+ const spy = jest.fn();
672
+ render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true, onEditCancel: spy }));
673
+ yield userEvent.click(screen.getByRole('button', { name: /Cancel/i }));
674
+ expect(spy).toHaveBeenCalledTimes(1);
675
+ }));
676
+ it('should be able to add editFormProps', () => {
677
+ const { container } = render(React.createElement(Message, { avatar: "./img", role: "user", name: "User", isEditable: true, editFormProps: { className: 'test' } }));
678
+ const form = container.querySelector('form');
679
+ expect(form).toHaveClass('test');
680
+ });
617
681
  });
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { FormProps } from '@patternfly/react-core';
3
+ export interface MessageInputProps extends FormProps {
4
+ /** Placeholder for edit input */
5
+ editPlaceholder?: string;
6
+ /** Label for the English word "Update" used in edit mode. */
7
+ updateWord?: string;
8
+ /** Label for the English word "Cancel" used in edit mode. */
9
+ cancelWord?: string;
10
+ /** Callback function for when edit mode update button is clicked */
11
+ onEditUpdate?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, value: string) => void;
12
+ /** Callback functionf or when edit cancel update button is clicked */
13
+ onEditCancel?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
14
+ /** Message text */
15
+ content?: string;
16
+ }
17
+ declare const MessageInput: React.FunctionComponent<MessageInputProps>;
18
+ export default MessageInput;
@@ -0,0 +1,29 @@
1
+ // ============================================================================
2
+ // Chatbot Main - Message Input
3
+ // ============================================================================
4
+ var __rest = (this && this.__rest) || function (s, e) {
5
+ var t = {};
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
7
+ t[p] = s[p];
8
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
9
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
10
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
11
+ t[p[i]] = s[p[i]];
12
+ }
13
+ return t;
14
+ };
15
+ import React from 'react';
16
+ import { ActionGroup, Button, Form, TextArea } from '@patternfly/react-core';
17
+ const MessageInput = (_a) => {
18
+ var { editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, content } = _a, props = __rest(_a, ["editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "content"]);
19
+ const [messageText, setMessageText] = React.useState(content !== null && content !== void 0 ? content : '');
20
+ const onChange = (event, value) => {
21
+ setMessageText(value);
22
+ };
23
+ return (React.createElement(Form, Object.assign({}, props),
24
+ React.createElement(TextArea, { placeholder: editPlaceholder, value: messageText, onChange: onChange, "aria-label": editPlaceholder, autoResize: true }),
25
+ React.createElement(ActionGroup, { className: "pf-chatbot__message-edit-buttons" },
26
+ React.createElement(Button, { variant: "primary", onClick: (event) => onEditUpdate && onEditUpdate(event, messageText) }, updateWord),
27
+ React.createElement(Button, { variant: "secondary", onClick: onEditCancel }, cancelWord))));
28
+ };
29
+ export default MessageInput;
@@ -12,6 +12,8 @@ export interface QuickResponseProps {
12
12
  quickResponseContainerProps?: Omit<LabelGroupProps, 'ref'>;
13
13
  /** Callback when a response is clicked; used in feedback cards */
14
14
  onSelect?: (id: string) => void;
15
+ /** Sets the quick responses to compact styling */
16
+ isCompact?: boolean;
15
17
  }
16
18
  export declare const QuickResponse: React.FunctionComponent<QuickResponseProps>;
17
19
  export default QuickResponse;
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import { Label, LabelGroup } from '@patternfly/react-core';
14
14
  import { CheckIcon } from '@patternfly/react-icons';
15
- export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 }, onSelect }) => {
15
+ export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 }, onSelect, isCompact }) => {
16
16
  const [selectedQuickResponse, setSelectedQuickResponse] = React.useState();
17
17
  const handleQuickResponseClick = (id, onClick) => {
18
18
  setSelectedQuickResponse(id);
@@ -21,7 +21,7 @@ export const QuickResponse = ({ quickResponses, quickResponseContainerProps = {
21
21
  };
22
22
  return (React.createElement(LabelGroup, Object.assign({ className: `pf-chatbot__message-quick-response ${(quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className) ? quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className : ''}` }, quickResponseContainerProps), quickResponses.map((_a) => {
23
23
  var { id, onClick, content, className } = _a, props = __rest(_a, ["id", "onClick", "content", "className"]);
24
- return (React.createElement(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? React.createElement(CheckIcon, null) : undefined, color: "blue", key: id, onClick: () => handleQuickResponseClick(id, onClick), className: `${id === selectedQuickResponse ? 'pf-chatbot__message-quick-response--selected' : ''} ${className ? className : ''}` }, props), content));
24
+ return (React.createElement(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? React.createElement(CheckIcon, null) : undefined, color: "blue", key: id, onClick: () => handleQuickResponseClick(id, onClick), className: `${id === selectedQuickResponse ? 'pf-chatbot__message-quick-response--selected' : ''} ${className ? className : ''}`, isCompact: isCompact }, props), content));
25
25
  })));
26
26
  };
27
27
  export default QuickResponse;
@@ -22,6 +22,8 @@ export interface QuickStartTileProps {
22
22
  prerequisiteWordPlural?: string;
23
23
  /** Aria-label for the quick start description button */
24
24
  quickStartButtonAriaLabel?: string;
25
+ /** Sets the tile to compact styling */
26
+ isCompact?: boolean;
25
27
  }
26
28
  declare const QuickStartTile: React.FC<QuickStartTileProps>;
27
29
  export default QuickStartTile;
@@ -12,7 +12,7 @@ export const camelize = (str) => str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function
12
12
  } // or if (/\s+/.test(match)) for white spaces
13
13
  return index === 0 ? match.toLowerCase() : match.toUpperCase();
14
14
  });
15
- const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action }) => {
15
+ const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action, isCompact }) => {
16
16
  const { metadata: { name: id }, spec: { icon, displayName, description, durationMinutes, prerequisites, link, type } } = quickStart;
17
17
  let quickStartIcon;
18
18
  if (typeof icon === 'object') {
@@ -33,7 +33,7 @@ const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, mi
33
33
  };
34
34
  const ActionIcon = (action === null || action === void 0 ? void 0 : action.icon) || OutlinedBookmarkIcon;
35
35
  const additionalAction = action ? (React.createElement(Button, Object.assign({ "aria-label": action['aria-label'], icon: React.createElement(ActionIcon, null), variant: "plain", onClick: action.onClick }, action.buttonProps))) : undefined;
36
- return (React.createElement(Card, { className: `pf-chatbot__quickstarts-tile ${className ? className : ''}`, id: `${id}-chatbot-qs-tile`, style: { height: '100%' }, "data-testid": `chatbot-qs-card-${camelize(displayName)}` },
36
+ return (React.createElement(Card, { className: `pf-chatbot__quickstarts-tile ${className ? className : ''}`, id: `${id}-chatbot-qs-tile`, style: { height: '100%' }, "data-testid": `chatbot-qs-card-${camelize(displayName)}`, isCompact: isCompact },
37
37
  React.createElement(CardHeader, Object.assign({}, (action && {
38
38
  actions: { actions: additionalAction }
39
39
  })), quickStartIcon),
@@ -18,7 +18,7 @@ import { ActionGroup, Button, Card, CardBody, CardHeader, Form, TextArea } from
18
18
  import QuickResponse from '../QuickResponse/QuickResponse';
19
19
  import CloseButton from './CloseButton';
20
20
  const UserFeedback = (_a) => {
21
- var { className, timestamp, title = 'Why did you choose this rating?', hasTextArea, textAreaAriaLabel = `Provide optional additional feedback for message received at ${timestamp}`, textAreaPlaceholder = 'Provide optional additional feedback', onTextAreaChange, submitWord = 'Submit', quickResponses, quickResponseContainerProps = { 'aria-label': `Quick feedback for message received at ${timestamp}` }, onSubmit, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, id, headingLevel: HeadingLevel = 'h1', focusOnLoad = true } = _a, props = __rest(_a, ["className", "timestamp", "title", "hasTextArea", "textAreaAriaLabel", "textAreaPlaceholder", "onTextAreaChange", "submitWord", "quickResponses", "quickResponseContainerProps", "onSubmit", "onClose", "closeButtonAriaLabel", "id", "headingLevel", "focusOnLoad"]);
21
+ var { className, timestamp, title = 'Why did you choose this rating?', hasTextArea, textAreaAriaLabel = `Provide optional additional feedback for message received at ${timestamp}`, textAreaPlaceholder = 'Provide optional additional feedback', onTextAreaChange, submitWord = 'Submit', quickResponses, quickResponseContainerProps = { 'aria-label': `Quick feedback for message received at ${timestamp}` }, onSubmit, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, id, headingLevel: HeadingLevel = 'h1', focusOnLoad = true, isCompact } = _a, props = __rest(_a, ["className", "timestamp", "title", "hasTextArea", "textAreaAriaLabel", "textAreaPlaceholder", "onTextAreaChange", "submitWord", "quickResponses", "quickResponseContainerProps", "onSubmit", "onClose", "closeButtonAriaLabel", "id", "headingLevel", "focusOnLoad", "isCompact"]);
22
22
  const [selectedResponse, setSelectedResponse] = React.useState();
23
23
  const [value, setValue] = React.useState('');
24
24
  const divRef = React.useRef(null);
@@ -31,14 +31,14 @@ const UserFeedback = (_a) => {
31
31
  return (
32
32
  /* card does not have ref forwarding; hence wrapper div */
33
33
  React.createElement("div", { ref: divRef, id: id, tabIndex: 0, "aria-label": title },
34
- React.createElement(Card, Object.assign({ className: `pf-chatbot__feedback-card ${className ? className : ''}` }, props),
34
+ React.createElement(Card, Object.assign({ isCompact: isCompact, className: `pf-chatbot__feedback-card ${className ? className : ''}` }, props),
35
35
  React.createElement(CardHeader, { actions: {
36
36
  actions: React.createElement(CloseButton, { onClose: onClose, ariaLabel: closeButtonAriaLabel })
37
37
  } },
38
38
  React.createElement(HeadingLevel, { className: "pf-chatbot__feedback-card-title" }, title)),
39
39
  React.createElement(CardBody, null,
40
- React.createElement(Form, { className: "pf-chatbot__feedback-card-form" },
41
- quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, onSelect: (id) => setSelectedResponse(id) })),
40
+ React.createElement(Form, { className: `pf-chatbot__feedback-card-form ${isCompact ? 'pf-m-compact' : ''}` },
41
+ quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, onSelect: (id) => setSelectedResponse(id), isCompact: isCompact })),
42
42
  hasTextArea && (React.createElement(TextArea, { value: value, onChange: (_event, value) => {
43
43
  setValue(value);
44
44
  onTextAreaChange && onTextAreaChange(_event, value);
@@ -125,4 +125,8 @@ describe('UserFeedback', () => {
125
125
  render(React.createElement(UserFeedback, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, "data-testid": "card", focusOnLoad: false }));
126
126
  expect(screen.getByTestId('card').parentElement).not.toHaveFocus();
127
127
  });
128
+ it('should handle isCompact', () => {
129
+ render(React.createElement(UserFeedback, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, "data-testid": "card", isCompact: true }));
130
+ expect(screen.getByTestId('card')).toHaveClass('pf-m-compact');
131
+ });
128
132
  });
@@ -17,7 +17,7 @@ import React from 'react';
17
17
  import { Card, CardBody, CardHeader, CardTitle, useOUIAProps } from '@patternfly/react-core';
18
18
  import CloseButton from './CloseButton';
19
19
  const UserFeedbackComplete = (_a) => {
20
- var { className, title = 'Feedback submitted', body = "We've received your response. Thank you for sharing your feedback!", timestamp, timeout = false, timeoutAnimation = 3000, onTimeout, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, onMouseEnter, onMouseLeave, ouiaId, ouiaSafe, isLiveRegion, id, focusOnLoad = true } = _a, props = __rest(_a, ["className", "title", "body", "timestamp", "timeout", "timeoutAnimation", "onTimeout", "onClose", "closeButtonAriaLabel", "onMouseEnter", "onMouseLeave", "ouiaId", "ouiaSafe", "isLiveRegion", "id", "focusOnLoad"]);
20
+ var { className, title = 'Feedback submitted', body = "We've received your response. Thank you for sharing your feedback!", timestamp, timeout = false, timeoutAnimation = 3000, onTimeout, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, onMouseEnter, onMouseLeave, ouiaId, ouiaSafe, isLiveRegion, id, focusOnLoad = true, isCompact } = _a, props = __rest(_a, ["className", "title", "body", "timestamp", "timeout", "timeoutAnimation", "onTimeout", "onClose", "closeButtonAriaLabel", "onMouseEnter", "onMouseLeave", "ouiaId", "ouiaSafe", "isLiveRegion", "id", "focusOnLoad", "isCompact"]);
21
21
  const [timedOut, setTimedOut] = React.useState(false);
22
22
  const [timedOutAnimation, setTimedOutAnimation] = React.useState(true);
23
23
  const [isMouseOver, setIsMouseOver] = React.useState();
@@ -80,8 +80,8 @@ const UserFeedbackComplete = (_a) => {
80
80
  'aria-live': 'polite',
81
81
  'aria-atomic': 'false'
82
82
  }), { id: id, tabIndex: 0, "aria-label": title }, ouiaProps),
83
- React.createElement(Card, Object.assign({ className: `pf-chatbot__feedback-card ${className ? className : ''}` }, props),
84
- React.createElement(CardHeader, { actions:
83
+ React.createElement(Card, Object.assign({ isCompact: isCompact, className: `pf-chatbot__feedback-card pf-chatbot__feedback-card-complete${className ? ` ${className}` : ''}` }, props),
84
+ React.createElement(CardHeader, { className: onClose ? 'pf-chatbot__feedback-card-complete-header' : 'pf-chatbot__feedback-card-complete-empty-header', actions:
85
85
  /* eslint-disable indent */
86
86
  onClose
87
87
  ? {
@@ -107,6 +107,6 @@ const UserFeedbackComplete = (_a) => {
107
107
  React.createElement("path", { d: "M27.7803 30.1276C27.6098 30.1276 27.4497 30.0614 27.3298 29.9406L22.9465 25.5562C22.8267 25.4364 22.7595 25.2762 22.7595 25.1068C22.7595 24.9374 22.8256 24.7762 22.9465 24.6554L24.2379 23.364C24.3577 23.2442 24.5178 23.177 24.6883 23.177C24.8587 23.177 25.0168 23.2431 25.1377 23.363L27.7803 26.0056L34.861 18.9259C34.9808 18.8061 35.1409 18.7389 35.3103 18.7389C35.4798 18.7389 35.6389 18.8051 35.7597 18.9239L37.0531 20.2173C37.173 20.3361 37.2401 20.4962 37.2401 20.6677C37.2401 20.8392 37.174 20.9983 37.0531 21.1181L28.2317 29.9406C28.1119 30.0604 27.9518 30.1265 27.7823 30.1265L27.7803 30.1276Z", fill: "white" }))),
108
108
  React.createElement("div", { className: "pf-chatbot__feedback-complete-text" },
109
109
  React.createElement(CardTitle, { className: "pf-chatbot__feedback-complete-title" }, title),
110
- React.createElement(CardBody, { className: `pf-chatbot__feedback-complete-body` }, body))))));
110
+ React.createElement(CardBody, { className: `pf-chatbot__feedback-complete-card-body` }, body))))));
111
111
  };
112
112
  export default UserFeedbackComplete;
@@ -241,4 +241,8 @@ describe('UserFeedbackComplete', () => {
241
241
  render(React.createElement(UserFeedbackComplete, { timestamp: "12/12/12", "data-testid": "card", focusOnLoad: false }));
242
242
  expect(screen.getByTestId('card').parentElement).not.toHaveFocus();
243
243
  });
244
+ it('should handle isCompact', () => {
245
+ render(React.createElement(UserFeedbackComplete, { timestamp: "12/12/12", "data-testid": "card", isCompact: true }));
246
+ expect(screen.getByTestId('card')).toHaveClass('pf-m-compact');
247
+ });
244
248
  });
@@ -17,5 +17,6 @@ export interface AttachButtonProps extends ButtonProps {
17
17
  tooltipContent?: string;
18
18
  /** Test id applied to input */
19
19
  inputTestId?: string;
20
+ isCompact?: boolean;
20
21
  }
21
22
  export declare const AttachButton: React.ForwardRefExoticComponent<AttachButtonProps & React.RefAttributes<any>>;
@@ -18,7 +18,7 @@ import { Button, Icon, Tooltip } from '@patternfly/react-core';
18
18
  import { useDropzone } from 'react-dropzone';
19
19
  import { PaperclipIcon } from '@patternfly/react-icons/dist/esm/icons/paperclip-icon';
20
20
  const AttachButtonBase = (_a) => {
21
- var { onAttachAccepted, onClick, isDisabled, className, tooltipProps, innerRef, tooltipContent = 'Attach', inputTestId } = _a, props = __rest(_a, ["onAttachAccepted", "onClick", "isDisabled", "className", "tooltipProps", "innerRef", "tooltipContent", "inputTestId"]);
21
+ var { onAttachAccepted, onClick, isDisabled, className, tooltipProps, innerRef, tooltipContent = 'Attach', inputTestId, isCompact } = _a, props = __rest(_a, ["onAttachAccepted", "onClick", "isDisabled", "className", "tooltipProps", "innerRef", "tooltipContent", "inputTestId", "isCompact"]);
22
22
  const { open, getInputProps } = useDropzone({
23
23
  multiple: true,
24
24
  onDropAccepted: onAttachAccepted
@@ -28,7 +28,7 @@ const AttachButtonBase = (_a) => {
28
28
  React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--attach", content: tooltipContent, position: "top", entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
29
29
  // prevents VO announcements of both aria label and tooltip
30
30
  aria: "none" }, tooltipProps),
31
- React.createElement(Button, Object.assign({ variant: "plain", ref: innerRef, className: `pf-chatbot__button--attach ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Attach button', isDisabled: isDisabled, onClick: onClick !== null && onClick !== void 0 ? onClick : open, icon: React.createElement(Icon, { iconSize: "xl", isInline: true },
32
- React.createElement(PaperclipIcon, null)) }, props)))));
31
+ React.createElement(Button, Object.assign({ variant: "plain", ref: innerRef, className: `pf-chatbot__button--attach ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Attach button', isDisabled: isDisabled, onClick: onClick !== null && onClick !== void 0 ? onClick : open, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
32
+ React.createElement(PaperclipIcon, null)), size: isCompact ? 'sm' : undefined }, props)))));
33
33
  };
34
34
  export const AttachButton = React.forwardRef((props, ref) => (React.createElement(AttachButtonBase, Object.assign({ innerRef: ref }, props))));
@@ -58,4 +58,8 @@ describe('Attach button', () => {
58
58
  expect(input.files).toHaveLength(1);
59
59
  expect(spy).toHaveBeenCalledTimes(1);
60
60
  }));
61
+ it('should handle isCompact', () => {
62
+ render(React.createElement(AttachButton, { isCompact: true, "data-testid": "button" }));
63
+ expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
64
+ });
61
65
  });
@@ -28,10 +28,14 @@ export interface MessageBarProps extends TextAreaProps {
28
28
  className?: string;
29
29
  /** Flag to always to show the send button. By default send button is shown when there is a message in the input field */
30
30
  alwayShowSendButton?: boolean;
31
+ /** Placeholder for message input */
32
+ placeholder?: string;
31
33
  /** Flag to disable/enable the Attach button */
32
34
  hasAttachButton?: boolean;
33
35
  /** Flag to enable the Microphone button */
34
36
  hasMicrophoneButton?: boolean;
37
+ /** Placeholder text when listening */
38
+ listeningText?: string;
35
39
  /** Flag to enable the Stop button, used for streaming content */
36
40
  hasStopButton?: boolean;
37
41
  /** Callback function for when stop button is clicked */
@@ -74,6 +78,7 @@ export interface MessageBarProps extends TextAreaProps {
74
78
  onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, value: string | number) => void;
75
79
  /** Display mode of chatbot, if you want to message bar to resize when the display mode changes */
76
80
  displayMode?: ChatbotDisplayMode;
81
+ isCompact?: boolean;
77
82
  }
78
83
  export declare const MessageBar: React.FunctionComponent<MessageBarProps>;
79
84
  export default MessageBar;
@@ -18,7 +18,7 @@ import { AttachButton } from './AttachButton';
18
18
  import AttachMenu from '../AttachMenu';
19
19
  import StopButton from './StopButton';
20
20
  export const MessageBar = (_a) => {
21
- var { onSendMessage, className, alwayShowSendButton, hasAttachButton = true, hasMicrophoneButton, handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "hasAttachButton", "hasMicrophoneButton", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value"]);
21
+ var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value, isCompact = false } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value", "isCompact"]);
22
22
  // Text Input
23
23
  // --------------------------------------------------------------------------
24
24
  const [message, setMessage] = React.useState(value !== null && value !== void 0 ? value : '');
@@ -26,11 +26,12 @@ export const MessageBar = (_a) => {
26
26
  const [hasSentMessage, setHasSentMessage] = React.useState(false);
27
27
  const textareaRef = React.useRef(null);
28
28
  const attachButtonRef = React.useRef(null);
29
+ const topMargin = '1rem';
29
30
  const setInitialLineHeight = (field) => {
30
31
  field.style.setProperty('line-height', '1rem');
31
32
  const parent = field.parentElement;
32
33
  if (parent) {
33
- parent.style.setProperty('margin-top', `1rem`);
34
+ parent.style.setProperty('margin-top', topMargin);
34
35
  parent.style.setProperty('margin-bottom', `0rem`);
35
36
  parent.style.setProperty('height', 'inherit');
36
37
  const grandparent = parent.parentElement;
@@ -52,8 +53,8 @@ export const MessageBar = (_a) => {
52
53
  parseInt(computed.getPropertyValue('border-bottom-width'));
53
54
  parent.style.setProperty('height', `${height}px`);
54
55
  if (height > 32 || window.innerWidth <= 507) {
55
- parent.style.setProperty('margin-bottom', `1rem`);
56
- parent.style.setProperty('margin-top', `1rem`);
56
+ parent.style.setProperty('margin-bottom', topMargin);
57
+ parent.style.setProperty('margin-top', topMargin);
57
58
  }
58
59
  }
59
60
  };
@@ -74,8 +75,8 @@ export const MessageBar = (_a) => {
74
75
  const handleNewLine = (field) => {
75
76
  const parent = field.parentElement;
76
77
  if (parent) {
77
- parent.style.setProperty('margin-bottom', `1rem`);
78
- parent.style.setProperty('margin-top', `1rem`);
78
+ parent.style.setProperty('margin-bottom', topMargin);
79
+ parent.style.setProperty('margin-top', topMargin);
79
80
  }
80
81
  };
81
82
  React.useEffect(() => {
@@ -170,17 +171,17 @@ export const MessageBar = (_a) => {
170
171
  const renderButtons = () => {
171
172
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
172
173
  if (hasStopButton && handleStopButton) {
173
- return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent }, (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.props)));
174
+ return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent, isCompact: isCompact }, (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.props)));
174
175
  }
175
176
  return (React.createElement(React.Fragment, null,
176
- attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _c === void 0 ? void 0 : _c.tooltipContent }, (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.props))),
177
- !attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipContent, inputTestId: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.inputTestId }, (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.props))),
178
- hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _h === void 0 ? void 0 : _h.tooltipContent, language: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _j === void 0 ? void 0 : _j.language }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _k === void 0 ? void 0 : _k.props))),
179
- (alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _l === void 0 ? void 0 : _l.tooltipContent }, (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _m === void 0 ? void 0 : _m.props)))));
177
+ attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _c === void 0 ? void 0 : _c.tooltipContent, isCompact: isCompact }, (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.props))),
178
+ !attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipContent, inputTestId: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.inputTestId, isCompact: isCompact }, (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.props))),
179
+ hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _h === void 0 ? void 0 : _h.tooltipContent, language: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _j === void 0 ? void 0 : _j.language, isCompact: isCompact }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _k === void 0 ? void 0 : _k.props))),
180
+ (alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _l === void 0 ? void 0 : _l.tooltipContent, isCompact: isCompact }, (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _m === void 0 ? void 0 : _m.props)))));
180
181
  };
181
182
  const messageBarContents = (React.createElement(React.Fragment, null,
182
- React.createElement("div", { className: "pf-chatbot__message-bar-input" },
183
- React.createElement(TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ? 'Listening' : 'Send a message...', placeholder: isListeningMessage ? 'Listening' : 'Send a message...', ref: textareaRef, onKeyDown: handleKeyDown }, props))),
183
+ React.createElement("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}` },
184
+ React.createElement(TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ? listeningText : placeholder, placeholder: isListeningMessage ? listeningText : placeholder, ref: textareaRef, onKeyDown: handleKeyDown }, props))),
184
185
  React.createElement("div", { className: "pf-chatbot__message-bar-actions" }, renderButtons())));
185
186
  if (attachMenuProps) {
186
187
  return (React.createElement(AttachMenu, Object.assign({ toggle: (toggleRef) => (React.createElement("div", { ref: toggleRef, className: `pf-chatbot__message-bar ${className !== null && className !== void 0 ? className : ''}` }, messageBarContents)), filteredItems: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.attachMenuItems }, (attachMenuProps && { isOpen: attachMenuProps.isAttachMenuOpen }), { onOpenChange: (isAttachMenuOpen) => {
@@ -71,6 +71,12 @@ describe('Message bar', () => {
71
71
  expect(spy).toHaveBeenCalledTimes(1);
72
72
  expect(spy).toHaveBeenCalledWith(expect.any(Object), 'A');
73
73
  }));
74
+ it('can use specified placeholder text', () => __awaiter(void 0, void 0, void 0, function* () {
75
+ render(React.createElement(MessageBar, { onSendMessage: jest.fn, placeholder: "test placeholder" }));
76
+ const input = screen.getByRole('textbox', { name: /test placeholder/i });
77
+ yield userEvent.type(input, 'Hello world');
78
+ expect(input).toHaveTextContent('Hello world');
79
+ }));
74
80
  // Send button
75
81
  // --------------------------------------------------------------------------
76
82
  it('shows send button when text is input', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -224,6 +230,13 @@ describe('Message bar', () => {
224
230
  yield userEvent.click(screen.getByRole('button', { name: 'Microphone button' }));
225
231
  expect(screen.getByRole('tooltip', { name: 'Not currently listening' })).toBeTruthy();
226
232
  }));
233
+ it('can customize the listening placeholder', () => __awaiter(void 0, void 0, void 0, function* () {
234
+ mockSpeechRecognition();
235
+ render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, listeningText: "I am listening" }));
236
+ yield userEvent.click(screen.getByRole('button', { name: 'Microphone button' }));
237
+ const input = screen.getByRole('textbox', { name: /I am listening/i });
238
+ expect(input).toBeTruthy();
239
+ }));
227
240
  it('can handle buttonProps props appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
228
241
  mockSpeechRecognition();
229
242
  render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { props: { 'aria-label': 'Test' } } } }));
@@ -18,6 +18,7 @@ export interface MicrophoneButtonProps extends ButtonProps {
18
18
  };
19
19
  /** 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. */
20
20
  language?: string;
21
+ isCompact?: boolean;
21
22
  }
22
23
  export declare const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps>;
23
24
  export default MicrophoneButton;