@patternfly/chatbot 2.2.0-prerelease.2 → 2.2.0-prerelease.20

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 (370) hide show
  1. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +1 -0
  2. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +52 -0
  3. package/dist/cjs/Chatbot/Chatbot.test.d.ts +1 -0
  4. package/dist/cjs/Chatbot/Chatbot.test.js +28 -0
  5. package/dist/cjs/ChatbotAlert/ChatbotAlert.test.d.ts +1 -0
  6. package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +27 -0
  7. package/dist/cjs/ChatbotContent/ChatbotContent.test.d.ts +1 -0
  8. package/dist/cjs/ChatbotContent/ChatbotContent.test.js +18 -0
  9. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -1
  10. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +17 -1
  11. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -9
  12. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +39 -3
  13. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -0
  14. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +18 -0
  15. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.d.ts +1 -0
  16. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +87 -0
  17. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.d.ts +1 -0
  18. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +18 -0
  19. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.d.ts +1 -0
  20. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +18 -0
  21. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
  22. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +16 -0
  23. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -0
  24. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +20 -0
  25. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.d.ts +1 -0
  26. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +18 -0
  27. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
  28. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +4 -2
  29. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -0
  30. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +20 -0
  31. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -1
  32. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -0
  33. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +43 -0
  34. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -1
  35. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -0
  36. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +41 -0
  37. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +1 -0
  38. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +47 -0
  39. package/dist/cjs/ChatbotHeader/index.d.ts +1 -0
  40. package/dist/cjs/ChatbotHeader/index.js +1 -0
  41. package/dist/cjs/ChatbotToggle/ChatbotToggle.js +3 -1
  42. package/dist/cjs/CodeModal/CodeModal.js +2 -12
  43. package/dist/cjs/Compare/Compare.d.ts +17 -0
  44. package/dist/cjs/Compare/Compare.js +50 -0
  45. package/dist/cjs/Compare/Compare.test.d.ts +1 -0
  46. package/dist/cjs/Compare/Compare.test.js +20 -0
  47. package/dist/cjs/Compare/index.d.ts +2 -0
  48. package/dist/cjs/Compare/index.js +23 -0
  49. package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +1 -1
  50. package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -2
  51. package/dist/cjs/Message/Message.d.ts +28 -7
  52. package/dist/cjs/Message/Message.js +29 -14
  53. package/dist/cjs/Message/Message.test.js +89 -3
  54. package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +17 -0
  55. package/dist/cjs/Message/QuickResponse/QuickResponse.js +34 -0
  56. package/dist/cjs/Message/QuickStarts/FallbackImg.d.ts +13 -0
  57. package/dist/cjs/Message/QuickStarts/FallbackImg.js +34 -0
  58. package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +27 -0
  59. package/dist/cjs/Message/QuickStarts/QuickStartTile.js +82 -0
  60. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
  61. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +64 -0
  62. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
  63. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +76 -0
  64. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
  65. package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.js +30 -0
  66. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
  67. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +77 -0
  68. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
  69. package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.js +77 -0
  70. package/dist/cjs/Message/QuickStarts/types.d.ts +132 -0
  71. package/dist/cjs/Message/QuickStarts/types.js +17 -0
  72. package/dist/cjs/Message/TextMessage/TextMessage.d.ts +2 -1
  73. package/dist/cjs/Message/TextMessage/TextMessage.js +2 -2
  74. package/dist/cjs/Message/UserFeedback/CloseButton.d.ts +10 -0
  75. package/dist/cjs/Message/UserFeedback/CloseButton.js +14 -0
  76. package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +39 -0
  77. package/dist/cjs/Message/UserFeedback/UserFeedback.js +55 -0
  78. package/dist/cjs/Message/UserFeedback/UserFeedback.test.d.ts +1 -0
  79. package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +146 -0
  80. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +42 -0
  81. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +117 -0
  82. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.d.ts +1 -0
  83. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +249 -0
  84. package/dist/cjs/MessageBar/AttachButton.js +4 -2
  85. package/dist/cjs/MessageBar/MessageBar.js +9 -12
  86. package/dist/cjs/MessageBar/MessageBar.test.js +4 -4
  87. package/dist/cjs/MessageBar/SendButton.js +3 -1
  88. package/dist/cjs/MessageBar/StopButton.js +3 -1
  89. package/dist/cjs/MessageBox/MessageBox.test.d.ts +1 -0
  90. package/dist/cjs/MessageBox/MessageBox.test.js +22 -0
  91. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +1 -0
  92. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +28 -0
  93. package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +10 -1
  94. package/dist/cjs/ResponseActions/ResponseActionButton.js +28 -5
  95. package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +1 -0
  96. package/dist/cjs/ResponseActions/ResponseActionButton.test.js +54 -0
  97. package/dist/cjs/ResponseActions/ResponseActions.d.ts +12 -2
  98. package/dist/cjs/ResponseActions/ResponseActions.js +26 -9
  99. package/dist/cjs/ResponseActions/ResponseActions.test.js +79 -5
  100. package/dist/cjs/Settings/SettingsForm.d.ts +13 -0
  101. package/dist/cjs/Settings/SettingsForm.js +27 -0
  102. package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -0
  103. package/dist/cjs/Settings/SettingsForm.test.js +26 -0
  104. package/dist/cjs/Settings/index.d.ts +2 -0
  105. package/dist/cjs/Settings/index.js +23 -0
  106. package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +34 -0
  107. package/dist/cjs/TermsOfUse/TermsOfUse.js +49 -0
  108. package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +1 -0
  109. package/dist/cjs/TermsOfUse/TermsOfUse.test.js +79 -0
  110. package/dist/cjs/TermsOfUse/index.d.ts +2 -0
  111. package/dist/cjs/TermsOfUse/index.js +23 -0
  112. package/dist/cjs/index.d.ts +6 -0
  113. package/dist/cjs/index.js +10 -1
  114. package/dist/css/main.css +372 -102
  115. package/dist/css/main.css.map +1 -1
  116. package/dist/dynamic/Compare/package.json +1 -0
  117. package/dist/dynamic/Settings/package.json +1 -0
  118. package/dist/dynamic/TermsOfUse/package.json +1 -0
  119. package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +1 -0
  120. package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +47 -0
  121. package/dist/esm/Chatbot/Chatbot.test.d.ts +1 -0
  122. package/dist/esm/Chatbot/Chatbot.test.js +23 -0
  123. package/dist/esm/ChatbotAlert/ChatbotAlert.test.d.ts +1 -0
  124. package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +22 -0
  125. package/dist/esm/ChatbotContent/ChatbotContent.test.d.ts +1 -0
  126. package/dist/esm/ChatbotContent/ChatbotContent.test.js +13 -0
  127. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -1
  128. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +17 -1
  129. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -9
  130. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +39 -3
  131. package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -0
  132. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +13 -0
  133. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.d.ts +1 -0
  134. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +82 -0
  135. package/dist/esm/ChatbotHeader/ChatbotHeader.test.d.ts +1 -0
  136. package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +13 -0
  137. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.d.ts +1 -0
  138. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +13 -0
  139. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
  140. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +10 -0
  141. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -0
  142. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +15 -0
  143. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.d.ts +1 -0
  144. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +13 -0
  145. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
  146. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +4 -2
  147. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -0
  148. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +15 -0
  149. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -1
  150. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -0
  151. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +38 -0
  152. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -1
  153. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -0
  154. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +36 -0
  155. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +1 -0
  156. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +42 -0
  157. package/dist/esm/ChatbotHeader/index.d.ts +1 -0
  158. package/dist/esm/ChatbotHeader/index.js +1 -0
  159. package/dist/esm/ChatbotToggle/ChatbotToggle.js +3 -1
  160. package/dist/esm/CodeModal/CodeModal.js +2 -12
  161. package/dist/esm/Compare/Compare.d.ts +17 -0
  162. package/dist/esm/Compare/Compare.js +43 -0
  163. package/dist/esm/Compare/Compare.test.d.ts +1 -0
  164. package/dist/esm/Compare/Compare.test.js +15 -0
  165. package/dist/esm/Compare/index.d.ts +2 -0
  166. package/dist/esm/Compare/index.js +2 -0
  167. package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +1 -1
  168. package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -2
  169. package/dist/esm/Message/Message.d.ts +28 -7
  170. package/dist/esm/Message/Message.js +27 -12
  171. package/dist/esm/Message/Message.test.js +89 -3
  172. package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +17 -0
  173. package/dist/esm/Message/QuickResponse/QuickResponse.js +27 -0
  174. package/dist/esm/Message/QuickStarts/FallbackImg.d.ts +13 -0
  175. package/dist/esm/Message/QuickStarts/FallbackImg.js +9 -0
  176. package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +27 -0
  177. package/dist/esm/Message/QuickStarts/QuickStartTile.js +52 -0
  178. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
  179. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +35 -0
  180. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
  181. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +48 -0
  182. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
  183. package/dist/esm/Message/QuickStarts/QuickStartTileHeader.js +5 -0
  184. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
  185. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +74 -0
  186. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
  187. package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.js +74 -0
  188. package/dist/esm/Message/QuickStarts/types.d.ts +132 -0
  189. package/dist/esm/Message/QuickStarts/types.js +14 -0
  190. package/dist/esm/Message/TextMessage/TextMessage.d.ts +2 -1
  191. package/dist/esm/Message/TextMessage/TextMessage.js +3 -3
  192. package/dist/esm/Message/UserFeedback/CloseButton.d.ts +10 -0
  193. package/dist/esm/Message/UserFeedback/CloseButton.js +9 -0
  194. package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +39 -0
  195. package/dist/esm/Message/UserFeedback/UserFeedback.js +50 -0
  196. package/dist/esm/Message/UserFeedback/UserFeedback.test.d.ts +1 -0
  197. package/dist/esm/Message/UserFeedback/UserFeedback.test.js +141 -0
  198. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +42 -0
  199. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +112 -0
  200. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.d.ts +1 -0
  201. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +244 -0
  202. package/dist/esm/MessageBar/AttachButton.js +4 -2
  203. package/dist/esm/MessageBar/MessageBar.js +9 -12
  204. package/dist/esm/MessageBar/MessageBar.test.js +4 -4
  205. package/dist/esm/MessageBar/SendButton.js +3 -1
  206. package/dist/esm/MessageBar/StopButton.js +3 -1
  207. package/dist/esm/MessageBox/MessageBox.test.d.ts +1 -0
  208. package/dist/esm/MessageBox/MessageBox.test.js +17 -0
  209. package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +1 -0
  210. package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +23 -0
  211. package/dist/esm/ResponseActions/ResponseActionButton.d.ts +10 -1
  212. package/dist/esm/ResponseActions/ResponseActionButton.js +25 -2
  213. package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +1 -0
  214. package/dist/esm/ResponseActions/ResponseActionButton.test.js +49 -0
  215. package/dist/esm/ResponseActions/ResponseActions.d.ts +12 -2
  216. package/dist/esm/ResponseActions/ResponseActions.js +26 -9
  217. package/dist/esm/ResponseActions/ResponseActions.test.js +79 -5
  218. package/dist/esm/Settings/SettingsForm.d.ts +13 -0
  219. package/dist/esm/Settings/SettingsForm.js +20 -0
  220. package/dist/esm/Settings/SettingsForm.test.d.ts +1 -0
  221. package/dist/esm/Settings/SettingsForm.test.js +21 -0
  222. package/dist/esm/Settings/index.d.ts +2 -0
  223. package/dist/esm/Settings/index.js +2 -0
  224. package/dist/esm/TermsOfUse/TermsOfUse.d.ts +34 -0
  225. package/dist/esm/TermsOfUse/TermsOfUse.js +42 -0
  226. package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +1 -0
  227. package/dist/esm/TermsOfUse/TermsOfUse.test.js +74 -0
  228. package/dist/esm/TermsOfUse/index.d.ts +2 -0
  229. package/dist/esm/TermsOfUse/index.js +2 -0
  230. package/dist/esm/index.d.ts +6 -0
  231. package/dist/esm/index.js +6 -0
  232. package/dist/tsconfig.tsbuildinfo +1 -1
  233. package/package.json +7 -13
  234. package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +5 -2
  235. package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +41 -4
  236. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +142 -13
  237. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +4 -0
  238. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +71 -0
  239. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedbackTimeout.tsx +27 -0
  240. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +31 -0
  241. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +63 -11
  242. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +182 -12
  243. package/patternfly-docs/content/extensions/chatbot/examples/Messages/explore-pipeline-quickstart.ts +65 -0
  244. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +1 -1
  245. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +2 -2
  246. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +2 -2
  247. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerNavigation.tsx +67 -0
  248. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +94 -0
  249. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +1 -1
  250. package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-TermsAndConditionsHeader.svg +148 -0
  251. package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +289 -0
  252. package/patternfly-docs/content/extensions/chatbot/examples/UI/SquareChatbotToggle.tsx +1 -1
  253. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +147 -0
  254. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +49 -6
  255. package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +14 -0
  256. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +26 -3
  257. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +2 -2
  258. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +20 -19
  259. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -2
  260. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -2
  261. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +206 -0
  262. package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +104 -0
  263. package/patternfly-docs/content/extensions/chatbot/img/attached-file.svg +24 -29
  264. package/patternfly-docs/content/extensions/chatbot/img/attachment-menu.svg +4 -4
  265. package/patternfly-docs/content/extensions/chatbot/img/attachment-unsent.svg +30 -57
  266. package/patternfly-docs/content/extensions/chatbot/img/chatbot-elements.svg +5 -5
  267. package/patternfly-docs/content/extensions/chatbot/img/chatbot-quickstarts-tile.svg +58 -0
  268. package/patternfly-docs/content/extensions/chatbot/img/chatbot-settings.svg +83 -0
  269. package/patternfly-docs/content/extensions/chatbot/img/conversation-history.svg +6 -29
  270. package/patternfly-docs/content/extensions/chatbot/img/docked.svg +68 -49
  271. package/patternfly-docs/content/extensions/chatbot/img/footnote.svg +1 -1
  272. package/patternfly-docs/content/extensions/chatbot/img/fullscreen.svg +25 -16
  273. package/patternfly-docs/content/extensions/chatbot/img/listening.svg +1 -1
  274. package/patternfly-docs/content/extensions/chatbot/img/message-bar-elements.svg +3 -3
  275. package/patternfly-docs/content/extensions/chatbot/img/message-elements.svg +85 -142
  276. package/patternfly-docs/content/extensions/chatbot/img/overlay.svg +52 -36
  277. package/patternfly-docs/content/extensions/chatbot/img/settings-menu.svg +122 -0
  278. package/patternfly-docs/content/extensions/chatbot/img/source-tile.svg +62 -0
  279. package/patternfly-docs/content/extensions/chatbot/img/toggle-customizations.svg +12 -0
  280. package/src/AttachMenu/AttachMenu.scss +1 -1
  281. package/src/AttachmentEdit/AttachmentEdit.test.tsx +55 -0
  282. package/src/Chatbot/Chatbot.test.tsx +31 -0
  283. package/src/ChatbotAlert/ChatbotAlert.test.tsx +31 -0
  284. package/src/ChatbotContent/ChatbotContent.test.tsx +15 -0
  285. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +7 -1
  286. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +8 -1
  287. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +112 -3
  288. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +41 -8
  289. package/src/ChatbotFooter/ChatbotFooter.scss +2 -6
  290. package/src/ChatbotFooter/ChatbotFooter.test.tsx +15 -0
  291. package/src/ChatbotFooter/ChatbotFooternote.test.tsx +84 -0
  292. package/src/ChatbotHeader/ChatbotHeader.scss +2 -5
  293. package/src/ChatbotHeader/ChatbotHeader.test.tsx +15 -0
  294. package/src/ChatbotHeader/ChatbotHeaderActions.test.tsx +17 -0
  295. package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +20 -0
  296. package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +57 -0
  297. package/src/ChatbotHeader/ChatbotHeaderMain.test.tsx +17 -0
  298. package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +19 -0
  299. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +11 -2
  300. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +45 -0
  301. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +8 -1
  302. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +43 -0
  303. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +8 -1
  304. package/src/ChatbotHeader/ChatbotHeaderTitle.test.tsx +59 -0
  305. package/src/ChatbotHeader/index.ts +1 -0
  306. package/src/ChatbotModal/ChatbotModal.scss +1 -1
  307. package/src/ChatbotToggle/ChatbotToggle.tsx +6 -1
  308. package/src/CodeModal/CodeModal.scss +9 -1
  309. package/src/CodeModal/CodeModal.tsx +2 -13
  310. package/src/Compare/Compare.scss +72 -0
  311. package/src/Compare/Compare.test.tsx +31 -0
  312. package/src/Compare/Compare.tsx +98 -0
  313. package/src/Compare/index.ts +2 -0
  314. package/src/FileDetails/FileDetails.scss +1 -1
  315. package/src/FileDropZone/__snapshots__/FileDropZone.test.tsx.snap +1 -1
  316. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +4 -4
  317. package/src/Message/ListMessage/ListMessage.scss +5 -5
  318. package/src/Message/ListMessage/OrderedListMessage.tsx +2 -2
  319. package/src/Message/Message.scss +4 -26
  320. package/src/Message/Message.test.tsx +116 -3
  321. package/src/Message/Message.tsx +72 -22
  322. package/src/Message/MessageLoading.scss +2 -2
  323. package/src/Message/QuickResponse/QuickResponse.scss +33 -0
  324. package/src/Message/QuickResponse/QuickResponse.tsx +54 -0
  325. package/src/Message/QuickStarts/FallbackImg.tsx +24 -0
  326. package/src/Message/QuickStarts/QuickStartTile.scss +24 -0
  327. package/src/Message/QuickStarts/QuickStartTile.tsx +147 -0
  328. package/src/Message/QuickStarts/QuickStartTileDescription.test.tsx +57 -0
  329. package/src/Message/QuickStarts/QuickStartTileDescription.tsx +81 -0
  330. package/src/Message/QuickStarts/QuickStartTileHeader.tsx +21 -0
  331. package/src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts +75 -0
  332. package/src/Message/QuickStarts/monitor-sampleapp-quickstart.ts +75 -0
  333. package/src/Message/QuickStarts/types.ts +154 -0
  334. package/src/Message/TextMessage/TextMessage.scss +8 -11
  335. package/src/Message/TextMessage/TextMessage.tsx +3 -3
  336. package/src/Message/UserFeedback/CloseButton.tsx +21 -0
  337. package/src/Message/UserFeedback/UserFeedback.scss +53 -0
  338. package/src/Message/UserFeedback/UserFeedback.test.tsx +257 -0
  339. package/src/Message/UserFeedback/UserFeedback.tsx +132 -0
  340. package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +255 -0
  341. package/src/Message/UserFeedback/UserFeedbackComplete.tsx +211 -0
  342. package/src/MessageBar/AttachButton.scss +19 -3
  343. package/src/MessageBar/AttachButton.tsx +3 -1
  344. package/src/MessageBar/MessageBar.scss +3 -2
  345. package/src/MessageBar/MessageBar.test.tsx +4 -4
  346. package/src/MessageBar/MessageBar.tsx +9 -12
  347. package/src/MessageBar/MicrophoneButton.scss +8 -8
  348. package/src/MessageBar/SendButton.tsx +2 -0
  349. package/src/MessageBar/StopButton.scss +17 -3
  350. package/src/MessageBar/StopButton.tsx +2 -0
  351. package/src/MessageBox/JumpButton.scss +6 -6
  352. package/src/MessageBox/MessageBox.test.tsx +26 -0
  353. package/src/PreviewAttachment/PreviewAttachment.test.tsx +51 -0
  354. package/src/ResponseActions/ResponseActionButton.test.tsx +52 -0
  355. package/src/ResponseActions/ResponseActionButton.tsx +59 -28
  356. package/src/ResponseActions/ResponseActions.scss +11 -9
  357. package/src/ResponseActions/ResponseActions.test.tsx +103 -5
  358. package/src/ResponseActions/ResponseActions.tsx +80 -9
  359. package/src/Settings/Settings.scss +34 -0
  360. package/src/Settings/SettingsForm.test.tsx +28 -0
  361. package/src/Settings/SettingsForm.tsx +25 -0
  362. package/src/Settings/index.ts +3 -0
  363. package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.scss +1 -1
  364. package/src/SourcesCard/SourcesCard.scss +2 -2
  365. package/src/TermsOfUse/TermsOfUse.scss +66 -0
  366. package/src/TermsOfUse/TermsOfUse.test.tsx +138 -0
  367. package/src/TermsOfUse/TermsOfUse.tsx +117 -0
  368. package/src/TermsOfUse/index.ts +3 -0
  369. package/src/index.ts +9 -0
  370. package/src/main.scss +6 -4
@@ -0,0 +1,147 @@
1
+ import React from 'react';
2
+ import { Button, Checkbox, FormGroup, Radio, SkipToContent } from '@patternfly/react-core';
3
+ import TermsOfUse from '@patternfly/chatbot/dist/dynamic/TermsOfUse';
4
+ import Chatbot, { ChatbotDisplayMode } from '@patternfly/chatbot/dist/dynamic/Chatbot';
5
+ import termsAndConditionsHeader from './PF-TermsAndConditionsHeader.svg';
6
+
7
+ export const TermsOfUseExample: React.FunctionComponent = () => {
8
+ const [isModalOpen, setIsModalOpen] = React.useState(true);
9
+ const [displayMode, setDisplayMode] = React.useState(ChatbotDisplayMode.default);
10
+ const [hasImage, setHasImage] = React.useState(true);
11
+ const chatbotRef = React.useRef<HTMLDivElement>(null);
12
+ const termsRef = React.useRef<HTMLDivElement>(null);
13
+
14
+ const handleSkipToContent = (e) => {
15
+ e.preventDefault();
16
+ if (!isModalOpen && chatbotRef.current) {
17
+ chatbotRef.current.focus();
18
+ }
19
+ if (isModalOpen && termsRef.current) {
20
+ termsRef.current.focus();
21
+ }
22
+ };
23
+
24
+ const handleModalToggle = (_event: React.MouseEvent | MouseEvent | KeyboardEvent) => {
25
+ setIsModalOpen(!isModalOpen);
26
+ };
27
+
28
+ const onPrimaryAction = () => {
29
+ // eslint-disable-next-line no-console
30
+ console.log('Clicked primary action');
31
+ };
32
+
33
+ const onSecondaryAction = () => {
34
+ // eslint-disable-next-line no-console
35
+ console.log('Clicked secondary action');
36
+ };
37
+
38
+ const introduction = (
39
+ <>
40
+ <p>
41
+ Welcome to PatternFly! These terms and conditions outline the rules and regulations for the use of PatternFly's
42
+ website, located at <a href="https://patternfly.org">www.patternfly.org.</a>
43
+ </p>
44
+ <p>
45
+ By accessing this website, you are agreeing with our terms and conditions. If you do not agree to all of these
46
+ terms and conditions, do not continue to use PatternFly.
47
+ </p>
48
+ </>
49
+ );
50
+
51
+ const terminology = (
52
+ <>
53
+ <p>
54
+ The following terminology applies to these Terms and Conditions, Privacy Statement, Disclaimer Notice, and all
55
+ Agreements:
56
+ </p>
57
+ <ul>
58
+ <li>
59
+ "Client", "You", and "Your" refer to you, the person using this website who is compliant with the Company's
60
+ terms and conditions.
61
+ </li>
62
+ <li>
63
+ "The Company", "Ourselves", "We", "Our", and "Us", refer to our Company. "Party", "Parties", or "Us", refers
64
+ to both the Client and ourselves.
65
+ </li>
66
+ </ul>
67
+ </>
68
+ );
69
+
70
+ const body = (
71
+ <>
72
+ <h2>Introduction</h2>
73
+ {introduction}
74
+ <h2>Terminology</h2>
75
+ {terminology}
76
+ </>
77
+ );
78
+
79
+ return (
80
+ <>
81
+ <SkipToContent style={{ zIndex: '999' }} onClick={handleSkipToContent} href="#">
82
+ Skip to chatbot
83
+ </SkipToContent>
84
+ <div
85
+ style={{
86
+ position: 'fixed',
87
+ padding: 'var(--pf-t--global--spacer--lg)',
88
+ zIndex: '601',
89
+ boxShadow: 'var(--pf-t--global--box-shadow--lg)'
90
+ }}
91
+ >
92
+ <FormGroup role="radiogroup" isInline fieldId="basic-form-radio-group" label="Display mode">
93
+ <Radio
94
+ isChecked={displayMode === ChatbotDisplayMode.default}
95
+ onChange={() => setDisplayMode(ChatbotDisplayMode.default)}
96
+ name="basic-inline-radio"
97
+ label="Default"
98
+ id="default"
99
+ />
100
+ <Radio
101
+ isChecked={displayMode === ChatbotDisplayMode.docked}
102
+ onChange={() => setDisplayMode(ChatbotDisplayMode.docked)}
103
+ name="basic-inline-radio"
104
+ label="Docked"
105
+ id="docked"
106
+ />
107
+ <Radio
108
+ isChecked={displayMode === ChatbotDisplayMode.fullscreen}
109
+ onChange={() => setDisplayMode(ChatbotDisplayMode.fullscreen)}
110
+ name="basic-inline-radio"
111
+ label="Fullscreen"
112
+ id="fullscreen"
113
+ />
114
+ <Radio
115
+ isChecked={displayMode === ChatbotDisplayMode.embedded}
116
+ onChange={() => setDisplayMode(ChatbotDisplayMode.embedded)}
117
+ name="basic-inline-radio"
118
+ label="Embedded"
119
+ id="embedded"
120
+ />
121
+ </FormGroup>
122
+ <Checkbox
123
+ isChecked={hasImage}
124
+ aria-label="Toggle whether terms and conditions has a header image"
125
+ id="toggle-header-image"
126
+ name="toggle-header-image"
127
+ label="Has image in header"
128
+ onChange={(_event, checked) => setHasImage(checked)}
129
+ ></Checkbox>
130
+ <Button onClick={handleModalToggle}>Launch modal</Button>
131
+ </div>
132
+ <Chatbot ref={chatbotRef} displayMode={displayMode} isVisible></Chatbot>
133
+ <TermsOfUse
134
+ ref={termsRef}
135
+ displayMode={displayMode}
136
+ isModalOpen={isModalOpen}
137
+ handleModalToggle={handleModalToggle}
138
+ onPrimaryAction={onPrimaryAction}
139
+ onSecondaryAction={onSecondaryAction}
140
+ image={hasImage ? termsAndConditionsHeader : undefined}
141
+ altText={hasImage ? 'Open book' : undefined}
142
+ >
143
+ {body}
144
+ </TermsOfUse>
145
+ </>
146
+ );
147
+ };
@@ -52,8 +52,10 @@ import FileDetailsLabel from '@patternfly/chatbot/dist/dynamic/FileDetailsLabel'
52
52
  import FileDropZone from '@patternfly/chatbot/dist/dynamic/FileDropZone';
53
53
  import { PreviewAttachment } from '@patternfly/chatbot/dist/dynamic/PreviewAttachment';
54
54
  import ChatbotAlert from '@patternfly/chatbot/dist/dynamic/ChatbotAlert';
55
+ import TermsOfUse from '@patternfly/chatbot/dist/dynamic/TermsOfUse';
55
56
  import {
56
57
  ChatbotHeader,
58
+ ChatbotHeaderCloseButton,
57
59
  ChatbotHeaderMain,
58
60
  ChatbotHeaderMenu,
59
61
  ChatbotHeaderActions,
@@ -65,6 +67,7 @@ import { ChatbotFooter, ChatbotFootnote } from '@patternfly/chatbot/dist/dynamic
65
67
  import { MessageBar } from '@patternfly/chatbot/dist/dynamic/MessageBar';
66
68
  import SourceDetailsMenuItem from '@patternfly/chatbot/dist/dynamic/SourceDetailsMenuItem';
67
69
  import { ChatbotModal } from '@patternfly/chatbot/dist/dynamic/ChatbotModal';
70
+ import SettingsForm from '@patternfly/chatbot/dist/dynamic/Settings';
68
71
  import { BellIcon, CalendarAltIcon, ClipboardIcon, CodeIcon, UploadIcon } from '@patternfly/react-icons';
69
72
  import { useDropzone } from 'react-dropzone';
70
73
 
@@ -74,10 +77,13 @@ import { DropdownItem, DropdownList, Checkbox } from '@patternfly/react-core';
74
77
  import OutlinedWindowRestoreIcon from '@patternfly/react-icons/dist/esm/icons/outlined-window-restore-icon';
75
78
  import ExpandIcon from '@patternfly/react-icons/dist/esm/icons/expand-icon';
76
79
  import OpenDrawerRightIcon from '@patternfly/react-icons/dist/esm/icons/open-drawer-right-icon';
80
+ import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
77
81
  import PFHorizontalLogoColor from './PF-HorizontalLogo-Color.svg';
78
82
  import PFHorizontalLogoReverse from './PF-HorizontalLogo-Reverse.svg';
79
83
  import userAvatar from '../Messages/user_avatar.svg';
80
84
  import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
85
+ import termsAndConditionsHeader from './PF-TermsAndConditionsHeader.svg';
86
+ import { CloseIcon } from '@patternfly/react-icons';
81
87
 
82
88
  ## Structure
83
89
 
@@ -96,11 +102,9 @@ The "embedded" display mode is meant to be used within a [PatternFly page](/comp
96
102
  ### Content and message box
97
103
 
98
104
  The `<ChatbotContent>` component is the container that is placed within the `<Chatbot>`, between the [`<ChatbotHeader>`](/patternfly-ai/chatbot/ui#header) and [`<ChatbotFooter>`.](/patternfly-ai/chatbot/ui#footer)
99
- <br />
100
- <br />
105
+
101
106
  `<ChatbotContent>` usually contains a `<ChatbotMessageBox>` for displaying messages.
102
- <br />
103
- <br />
107
+
104
108
  Your code structure should look like this:
105
109
 
106
110
  ```noLive
@@ -138,8 +142,7 @@ To provide users with a more specific direction, you can also include optional w
138
142
  ### Skip to content
139
143
 
140
144
  To provide page context, we recommend using a "Skip to chatbot" button. This allows you to skip past other content on the page, directly to the ChatBot content, using a [PatternFly skip to content component](/components/skip-to-content). To display this button, you must tab into the main window.
141
- <br />
142
- <br />
145
+
143
146
  When using default or docked modes, we recommend putting focus on the toggle if the ChatBot is closed, and the ChatBot when it is open. For fullscreen and embedded, we recommend putting the focus on the first focusable item in the ChatBot, such as a menu toggle. This can be seen in our more fully-featured demos for the [default, embedded, and fullscreen ChatBot](/patternfly-ai/chatbot/overview/demo#basic-chatbot) and the [embedded ChatBot](/patternfly-ai/chatbot/overview/demo#embedded-chatbot).
144
147
 
145
148
  ```js file="./SkipToContent.tsx" isFullscreen
@@ -365,6 +368,46 @@ If you're showing a conversation that is already active, you can set the `active
365
368
 
366
369
  ```
367
370
 
371
+ ### Resizable drawer
372
+
373
+ By default, the conversation history drawer has a fixed width (384px) and a focus trap. To provide users with more flexibility as they navigate their conversation history, or to better support embedded ChatBots on tablet-sized devices or smaller browser windows, you can instead make the drawer resizable. By default, even resizable drawers will still open to their full width on mobile devices.
374
+
375
+ In this example, the drawer can be resized up to the max size of the parent and resized down to 200px wide. To customize this behavior further (including width, style, and focus behavior) use PatternFly [`<Drawer>` props](/components/drawer#props), [`<DrawerPanelContent>` props](/components/drawer/#drawerpanelcontent), or any other drawer subcomponents.
376
+
377
+ ```js file="./ChatbotHeaderDrawerResizable.tsx"
378
+
379
+ ```
380
+
381
+ ### Drawer with simple menu
382
+
383
+ The drawer can also be used to display a list of basic menu items.
384
+
385
+ ```js file="./ChatbotHeaderDrawerNavigation.tsx"
386
+
387
+ ```
388
+
389
+ ### Terms of use
390
+
391
+ Based on the [PatternFly modal](/components/modal), this modal adapts to the ChatBot display mode and is meant to display terms and conditions for using a ChatBot in your project. The image in the header can be toggled on or off depending on whether the `image` and `altText` props are provided.
392
+
393
+ This example also includes an example of how to use [skip to content](/patternfly-ai/chatbot/ui#skip-to-content). When the terms of use modal is open, focus is placed on the terms of use container. When it is closed, focus is placed on the ChatBot. In a real example with a functioning ChatBot toggle, you would also want to place focus on the toggle when appropriate.
394
+
395
+ ```js file="./TermsOfUse.tsx" isFullscreen
396
+
397
+ ```
398
+
399
+ ### Settings
400
+
401
+ To contain user preference controls and other ChatBot setting options, you can create a separate settings page that can accept any number of buttons, dropdown menus, toggles, labels, and so on. This settings page will render all components appropriately within all 4 display modes.
402
+
403
+ In this demo, you can toggle the settings page by clicking the "Settings" button in the display mode menu.
404
+
405
+ ```js file="./Settings.tsx" isFullscreen
406
+
407
+ ```
408
+
409
+ ## Modals
410
+
368
411
  ### Modal
369
412
 
370
413
  Based on the [PatternFly modal](/components/modal), this modal adapts to the ChatBot display mode and accepts components typically used in a modal. It is primarily used and tested in the context of the attachment modals, but you can customize this modal to adapt it to other use cases as needed. The modal will overlay the ChatBot in default and docked modes, and will behave more like a traditional PatternFly modal in fullscreen and embedded modes.
@@ -47,6 +47,20 @@ import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
47
47
 
48
48
  ## Demos
49
49
 
50
+ ### Message feedback
51
+
52
+ When a user selects a positive or negative message action, you can display a message feedback card that acknowledges their response and provides space for additional written feedback. These cards can be manually dismissed via the close button and the thank-you card can be configured to time out automatically.
53
+
54
+ The following example demonstrates a full feedback flow, which accepts written feedback submission and displays a thank you card.
55
+
56
+ It also demonstrates how to handle focus appropriately for accessibility. The card will be focused when it appears in the DOM. When the card closes, place the focus back on the launching button. To provide additional context on what the button controls, you can also add `aria-expanded` and `aria-controls` attributes to the feedback buttons.
57
+
58
+ It is also important to announce when new content appears onscreen for accessibility purposes. `isLiveRegion` is set to true by default on `<Message>` so it will make appropriate announcements for you when the feedback card appears.
59
+
60
+ ```js file="./Feedback.tsx"
61
+
62
+ ```
63
+
50
64
  ### Attach via upload button in message bar
51
65
 
52
66
  This demo displays unique attachment features, including:
@@ -21,7 +21,8 @@ propComponents:
21
21
  'ChatbotFootnote',
22
22
  'MessageBox',
23
23
  'Message',
24
- 'MessageBarWithAttachMenuProps'
24
+ 'MessageBarWithAttachMenuProps',
25
+ 'CompareProps'
25
26
  ]
26
27
  sortValue: 2
27
28
  ---
@@ -34,6 +35,7 @@ import ChatbotFooter, { ChatbotFootnote } from '@patternfly/chatbot/dist/dynamic
34
35
  import MessageBar from '@patternfly/chatbot/dist/dynamic/MessageBar';
35
36
  import MessageBox from '@patternfly/chatbot/dist/dynamic/MessageBox';
36
37
  import Message from '@patternfly/chatbot/dist/dynamic/Message';
38
+ import Compare from '@patternfly/chatbot/dist/dynamic/Compare';
37
39
  import ChatbotConversationHistoryNav from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
38
40
 
39
41
  import ChatbotHeader, {
@@ -66,7 +68,7 @@ This demo displays a basic ChatBot, which includes:
66
68
  4. [`<ChatbotContent>` and `<MessageBox>`](/patternfly-ai/chatbot/ui#content-and-message-box) with:
67
69
 
68
70
  - A `<ChatbotWelcomePrompt>`
69
- - An initial [user `<Message>`](/patternfly-ai/chatbot/messages#user-messages) and an initial bot message with [message actions.](/patternfly-ai/chatbot/messages#messages-actions)
71
+ - An initial [user `<Message>`](/patternfly-ai/chatbot/messages#user-messages) and an initial bot message with [message actions.](/patternfly-ai/chatbot/messages#message-actions)
70
72
  - Logic for enabling auto-scrolling to the most recent message whenever a new message is sent or received using a `scrollToBottomRef`
71
73
 
72
74
  5. A [`<ChatbotFooter>`](/patternfly-ai/chatbot/ui#footer) with a [`<ChatbotFootNote>`](/patternfly-ai/chatbot/ui#footnote-with-popover) and a `<MessageBar>` that contains the abilities of:
@@ -92,7 +94,7 @@ This demo displays an embedded ChatBot. Embedded ChatBots are meant to be placed
92
94
  3. A [`<ChatbotHeader>`](/patternfly-ai/chatbot/ui#header) with all built sub-components laid out, including a `<ChatbotHeaderTitle>`
93
95
  4. [`<ChatbotContent>` and `<MessageBox>`](/patternfly-ai/chatbot/ui#content-and-message-box) with:
94
96
  - A `<ChatbotWelcomePrompt>`
95
- - An initial [user `<Message>`](/patternfly-ai/chatbot/messages#user-messages) and an initial bot message with [message actions.](/patternfly-ai/chatbot/messages/#messages-actions)
97
+ - An initial [user `<Message>`](/patternfly-ai/chatbot/messages#user-messages) and an initial bot message with [message actions.](/patternfly-ai/chatbot/messages/#message-actions)
96
98
  - Logic for enabling auto-scrolling to the most recent message whenever a new message is sent or received using a `scrollToBottomRef`
97
99
  5. A [`<ChatbotFooter>`](/patternfly-ai/chatbot/ui#footer) with a [`<ChatbotFootNote>`](/patternfly-ai/chatbot/ui#footnote-with-popover) and a `<MessageBar>` that contains the abilities of:
98
100
  - [Speech to text.](/patternfly-ai/chatbot/ui#message-bar-with-speech-recognition-and-file-attachment)
@@ -103,3 +105,24 @@ This demo displays an embedded ChatBot. Embedded ChatBots are meant to be placed
103
105
  ```js file="./EmbeddedChatbot.tsx" isFullscreen
104
106
 
105
107
  ```
108
+
109
+ ### Comparing ChatBots
110
+
111
+ To let users compare how different ChatBots respond to the same prompt, you can add multiple ChatBots within the same window. The following demo illustrates a comparison view pattern that allows users to toggle between different conversations in a single ChatBot window.
112
+ <br /><br />
113
+ Your code structure should look like this:
114
+
115
+ ```noLive
116
+ <Page ... >
117
+ <div className="pf-chatbot__compare-container">
118
+ <Compare ... />
119
+ <ChatbotFooter ... >
120
+ <MessageBar ... />
121
+ </ChatbotFooter>
122
+ </div>
123
+ </Page>
124
+ ```
125
+
126
+ ```js file="./EmbeddedComparisonChatbot.tsx" isFullscreen
127
+
128
+ ```
@@ -34,10 +34,10 @@ import userAvatar from '../Messages/user_avatar.svg';
34
34
  import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
35
35
 
36
36
  const footnoteProps = {
37
- label: 'Lightspeed uses AI. Check for mistakes.',
37
+ label: 'ChatBot uses AI. Check for mistakes.',
38
38
  popover: {
39
39
  title: 'Verify accuracy',
40
- description: `While Lightspeed strives for accuracy, there's always a possibility of errors. It's a good practice to verify critical information from reliable sources, especially if it's crucial for decision-making or actions.`,
40
+ description: `While ChatBot strives for accuracy, there's always a possibility of errors. It's a good practice to verify critical information from reliable sources, especially if it's crucial for decision-making or actions.`,
41
41
  bannerImage: {
42
42
  src: 'https://cdn.dribbble.com/userupload/10651749/file/original-8a07b8e39d9e8bf002358c66fce1223e.gif',
43
43
  alt: 'Example image for footnote popover'
@@ -36,18 +36,26 @@ interface ModalData {
36
36
  }
37
37
 
38
38
  export const BasicDemo: React.FunctionComponent = () => {
39
- const onAttachmentClose = (attachmentId: string) => {
40
- const index = messages.findIndex((message) => message.attachmentId === attachmentId);
39
+ const onAttachmentClose = (event, name, id) => {
41
40
  const updatedMessages: MessageProps[] = [];
42
- if (index >= 0) {
43
- messages.forEach((message) => updatedMessages.push(message));
44
- delete updatedMessages[index].attachmentName;
45
- delete updatedMessages[index].attachmentId;
46
- delete updatedMessages[index].onAttachmentClick;
47
- delete updatedMessages[index].onAttachmentClose;
48
- setMessages(updatedMessages);
49
- }
41
+ messages.map((message) => {
42
+ if (message.attachments) {
43
+ const filteredAttachments = message.attachments.filter((attachment) => attachment.id !== id);
44
+ message.attachments = filteredAttachments;
45
+ updatedMessages.push(message);
46
+ } else {
47
+ updatedMessages.push(message);
48
+ }
49
+ });
50
+ setMessages(updatedMessages);
50
51
  };
52
+
53
+ const onAttachmentClick = () => {
54
+ setCurrentModalData({ fileName: 'auth-operator.yml', code: 'test' });
55
+ setIsEditModalOpen(false);
56
+ setIsPreviewModalOpen(true);
57
+ };
58
+
51
59
  const initialMessages: MessageProps[] = [
52
60
  {
53
61
  role: 'user',
@@ -55,14 +63,7 @@ export const BasicDemo: React.FunctionComponent = () => {
55
63
  name: 'User',
56
64
  avatar: userAvatar,
57
65
  avatarProps: { isBordered: true },
58
- attachmentName: 'auth-operator.yml',
59
- attachmentId: '1',
60
- onAttachmentClose,
61
- onAttachmentClick: () => {
62
- setCurrentModalData({ fileName: 'auth-operator.yml', code: 'test' });
63
- setIsEditModalOpen(false);
64
- setIsPreviewModalOpen(true);
65
- }
66
+ attachments: [{ name: 'auth-operator.yml', id: '1', onClick: onAttachmentClick, onClose: onAttachmentClose }]
66
67
  },
67
68
  {
68
69
  role: 'bot',
@@ -243,7 +244,7 @@ export const BasicDemo: React.FunctionComponent = () => {
243
244
  </div>
244
245
  )}
245
246
  <MessageBar onSendMessage={handleSend} hasAttachButton handleAttach={handleAttach} />
246
- <ChatbotFootnote label="Lightspeed uses AI. Check for mistakes." />
247
+ <ChatbotFootnote label="ChatBot uses AI. Check for mistakes." />
247
248
  </ChatbotFooter>
248
249
  </FileDropZone>
249
250
  </Chatbot>
@@ -209,7 +209,7 @@ export const AttachmentMenuDemo: React.FunctionComponent = () => {
209
209
  return (
210
210
  <>
211
211
  {/* this is required for react-dropzone to work in Safari and Firefox */}
212
- <input {...getInputProps()} />
212
+ <input {...getInputProps()} hidden />
213
213
  <ChatbotToggle
214
214
  tooltipLabel="Chatbot"
215
215
  isChatbotVisible={chatbotVisible}
@@ -259,7 +259,7 @@ export const AttachmentMenuDemo: React.FunctionComponent = () => {
259
259
  onAttachMenuToggleClick: onToggleClick
260
260
  }}
261
261
  />
262
- <ChatbotFootnote label="Lightspeed uses AI. Check for mistakes." />
262
+ <ChatbotFootnote label="ChatBot uses AI. Check for mistakes." />
263
263
  </ChatbotFooter>
264
264
  </>
265
265
  </FileDropZone>
@@ -42,10 +42,10 @@ import userAvatar from '../Messages/user_avatar.svg';
42
42
  import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
43
43
 
44
44
  const footnoteProps = {
45
- label: 'Lightspeed uses AI. Check for mistakes.',
45
+ label: 'ChatBot uses AI. Check for mistakes.',
46
46
  popover: {
47
47
  title: 'Verify accuracy',
48
- description: `While Lightspeed strives for accuracy, there's always a possibility of errors. It's a good practice to verify critical information from reliable sources, especially if it's crucial for decision-making or actions.`,
48
+ description: `While ChatBot strives for accuracy, there's always a possibility of errors. It's a good practice to verify critical information from reliable sources, especially if it's crucial for decision-making or actions.`,
49
49
  bannerImage: {
50
50
  src: 'https://cdn.dribbble.com/userupload/10651749/file/original-8a07b8e39d9e8bf002358c66fce1223e.gif',
51
51
  alt: 'Example image for footnote popover'
@@ -0,0 +1,206 @@
1
+ import React from 'react';
2
+
3
+ import {
4
+ Page,
5
+ Masthead,
6
+ MastheadMain,
7
+ MastheadBrand,
8
+ MastheadLogo,
9
+ PageSidebarBody,
10
+ PageSidebar,
11
+ MastheadToggle,
12
+ PageToggleButton
13
+ } from '@patternfly/react-core';
14
+ import Chatbot, { ChatbotDisplayMode } from '@patternfly/chatbot/dist/dynamic/Chatbot';
15
+ import ChatbotContent from '@patternfly/chatbot/dist/dynamic/ChatbotContent';
16
+ import ChatbotWelcomePrompt from '@patternfly/chatbot/dist/dynamic/ChatbotWelcomePrompt';
17
+ import ChatbotFooter from '@patternfly/chatbot/dist/dynamic/ChatbotFooter';
18
+ import MessageBar from '@patternfly/chatbot/dist/dynamic/MessageBar';
19
+ import MessageBox from '@patternfly/chatbot/dist/dynamic/MessageBox';
20
+ import Message, { MessageProps } from '@patternfly/chatbot/dist/dynamic/Message';
21
+ import ChatbotHeader, { ChatbotHeaderMain } from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
22
+ import Compare from '@patternfly/chatbot/dist/dynamic/Compare';
23
+ import { BarsIcon } from '@patternfly/react-icons';
24
+ import userAvatar from '../Messages/user_avatar.svg';
25
+ import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
26
+
27
+ export const CompareChild = ({ name, input, hasNewInput, setIsSendButtonDisabled }) => {
28
+ const [messages, setMessages] = React.useState<MessageProps[]>([]);
29
+ const [announcement, setAnnouncement] = React.useState<string>();
30
+ const scrollToBottomRef = React.useRef<HTMLDivElement>(null);
31
+ const displayMode = ChatbotDisplayMode.embedded;
32
+
33
+ // you will likely want to come up with your own unique id function; this is for demo purposes only
34
+ const generateId = () => {
35
+ const id = Date.now() + Math.random();
36
+ return id.toString();
37
+ };
38
+
39
+ const handleSend = (input: string) => {
40
+ const date = new Date();
41
+ const newMessages: MessageProps[] = [];
42
+ messages.forEach((message) => newMessages.push(message));
43
+ newMessages.push({
44
+ avatar: userAvatar,
45
+ avatarProps: { isBordered: true },
46
+ id: generateId(),
47
+ name: 'You',
48
+ role: 'user',
49
+ content: input,
50
+ timestamp: `${date?.toLocaleDateString()} ${date?.toLocaleTimeString()}`
51
+ });
52
+ newMessages.push({
53
+ avatar: patternflyAvatar,
54
+ id: generateId(),
55
+ name,
56
+ role: 'bot',
57
+ timestamp: `${date?.toLocaleDateString()} ${date?.toLocaleTimeString()}`,
58
+ isLoading: true
59
+ });
60
+ setMessages(newMessages);
61
+ // make announcement to assistive devices that new messages have been added
62
+ setAnnouncement(`Message from You: ${input}. Message from ${name} is loading.`);
63
+
64
+ // this is for demo purposes only; in a real situation, there would be an API response we would wait for
65
+ setTimeout(() => {
66
+ const loadedMessages: MessageProps[] = [];
67
+ // we can't use structuredClone since messages contains functions, but we can't mutate
68
+ // items that are going into state or the UI won't update correctly
69
+ newMessages.forEach((message) => loadedMessages.push(message));
70
+ loadedMessages.pop();
71
+ loadedMessages.push({
72
+ id: generateId(),
73
+ role: 'bot',
74
+ content: `API response from ${name} goes here`,
75
+ name,
76
+ avatar: patternflyAvatar,
77
+ isLoading: false,
78
+ actions: {
79
+ // eslint-disable-next-line no-console
80
+ positive: { onClick: () => console.log('Good response') },
81
+ // eslint-disable-next-line no-console
82
+ negative: { onClick: () => console.log('Bad response') },
83
+ // eslint-disable-next-line no-console
84
+ copy: { onClick: () => console.log('Copy') },
85
+ // eslint-disable-next-line no-console
86
+ share: { onClick: () => console.log('Share') },
87
+ // eslint-disable-next-line no-console
88
+ listen: { onClick: () => console.log('Listen') }
89
+ },
90
+ timestamp: date.toLocaleString()
91
+ });
92
+ setMessages(loadedMessages);
93
+ // make announcement to assistive devices that new message has loaded
94
+ setAnnouncement(`Message from ${name}: API response goes here`);
95
+ setIsSendButtonDisabled(false);
96
+ }, 5000);
97
+ };
98
+
99
+ React.useEffect(() => {
100
+ if (input) {
101
+ handleSend(input);
102
+ }
103
+ }, [hasNewInput]);
104
+
105
+ // Auto-scrolls to the latest message
106
+ React.useEffect(() => {
107
+ // don't scroll the first load, but scroll if there's a current stream or a new source has popped up
108
+ if (messages.length > 0) {
109
+ scrollToBottomRef.current?.scrollIntoView();
110
+ }
111
+ }, [messages]);
112
+
113
+ return (
114
+ <Chatbot displayMode={displayMode}>
115
+ <ChatbotHeader>
116
+ <ChatbotHeaderMain>{name}</ChatbotHeaderMain>
117
+ </ChatbotHeader>
118
+ <ChatbotContent>
119
+ <MessageBox ariaLabel={`Scrollable message log for ${name}`} announcement={announcement}>
120
+ <ChatbotWelcomePrompt title="Hello, Chatbot User" description="How may I help you today?" />
121
+ {messages.map((message) => (
122
+ <Message key={message.id} {...message} />
123
+ ))}
124
+ <div ref={scrollToBottomRef}></div>
125
+ </MessageBox>
126
+ </ChatbotContent>
127
+ </Chatbot>
128
+ );
129
+ };
130
+
131
+ export const EmbeddedComparisonChatbotDemo: React.FunctionComponent = () => {
132
+ const [input, setInput] = React.useState<string>();
133
+ const [hasNewInput, setHasNewInput] = React.useState(false);
134
+ const [isSidebarOpen, setIsSidebarOpen] = React.useState(false);
135
+ const [isSendButtonDisabled, setIsSendButtonDisabled] = React.useState(false);
136
+
137
+ const handleSend = (value: string) => {
138
+ setInput(value);
139
+ setHasNewInput(!hasNewInput);
140
+ setIsSendButtonDisabled(true);
141
+ };
142
+
143
+ const masthead = (
144
+ <Masthead>
145
+ <MastheadMain>
146
+ <MastheadToggle>
147
+ <PageToggleButton
148
+ variant="plain"
149
+ aria-label="Global navigation"
150
+ isSidebarOpen={isSidebarOpen}
151
+ onSidebarToggle={() => setIsSidebarOpen(!isSidebarOpen)}
152
+ id="fill-nav-toggle"
153
+ >
154
+ <BarsIcon />
155
+ </PageToggleButton>
156
+ </MastheadToggle>
157
+ <MastheadBrand>
158
+ <MastheadLogo href="https://patternfly.org" target="_blank">
159
+ Logo
160
+ </MastheadLogo>
161
+ </MastheadBrand>
162
+ </MastheadMain>
163
+ </Masthead>
164
+ );
165
+
166
+ const sidebar = (
167
+ <PageSidebar isSidebarOpen={isSidebarOpen} id="fill-sidebar">
168
+ <PageSidebarBody>Navigation</PageSidebarBody>
169
+ </PageSidebar>
170
+ );
171
+
172
+ return (
173
+ <Page masthead={masthead} sidebar={sidebar} isContentFilled>
174
+ <div className="pf-chatbot__compare-container">
175
+ <Compare
176
+ firstChild={
177
+ <CompareChild
178
+ input={input}
179
+ hasNewInput={hasNewInput}
180
+ name="ChatBot 1"
181
+ setIsSendButtonDisabled={setIsSendButtonDisabled}
182
+ />
183
+ }
184
+ secondChild={
185
+ <CompareChild
186
+ input={input}
187
+ hasNewInput={hasNewInput}
188
+ name="ChatBot 2"
189
+ setIsSendButtonDisabled={setIsSendButtonDisabled}
190
+ />
191
+ }
192
+ firstChildDisplayName="ChatBot 1"
193
+ secondChildDisplayName="ChatBot 2"
194
+ />
195
+ <ChatbotFooter>
196
+ <MessageBar
197
+ onSendMessage={handleSend}
198
+ hasAttachButton={false}
199
+ alwayShowSendButton
200
+ isSendButtonDisabled={isSendButtonDisabled}
201
+ />
202
+ </ChatbotFooter>
203
+ </div>
204
+ </Page>
205
+ );
206
+ };