@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.
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +1 -0
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +52 -0
- package/dist/cjs/Chatbot/Chatbot.test.d.ts +1 -0
- package/dist/cjs/Chatbot/Chatbot.test.js +28 -0
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.d.ts +1 -0
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +27 -0
- package/dist/cjs/ChatbotContent/ChatbotContent.test.d.ts +1 -0
- package/dist/cjs/ChatbotContent/ChatbotContent.test.js +18 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +17 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -9
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +39 -3
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +18 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.d.ts +1 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +87 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +18 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +18 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +16 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +20 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +18 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +4 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +20 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +43 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +41 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +47 -0
- package/dist/cjs/ChatbotHeader/index.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/index.js +1 -0
- package/dist/cjs/ChatbotToggle/ChatbotToggle.js +3 -1
- package/dist/cjs/CodeModal/CodeModal.js +2 -12
- package/dist/cjs/Compare/Compare.d.ts +17 -0
- package/dist/cjs/Compare/Compare.js +50 -0
- package/dist/cjs/Compare/Compare.test.d.ts +1 -0
- package/dist/cjs/Compare/Compare.test.js +20 -0
- package/dist/cjs/Compare/index.d.ts +2 -0
- package/dist/cjs/Compare/index.js +23 -0
- package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +1 -1
- package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -2
- package/dist/cjs/Message/Message.d.ts +28 -7
- package/dist/cjs/Message/Message.js +29 -14
- package/dist/cjs/Message/Message.test.js +89 -3
- package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +17 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +34 -0
- package/dist/cjs/Message/QuickStarts/FallbackImg.d.ts +13 -0
- package/dist/cjs/Message/QuickStarts/FallbackImg.js +34 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +27 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +82 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +64 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +76 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.js +30 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +77 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.js +77 -0
- package/dist/cjs/Message/QuickStarts/types.d.ts +132 -0
- package/dist/cjs/Message/QuickStarts/types.js +17 -0
- package/dist/cjs/Message/TextMessage/TextMessage.d.ts +2 -1
- package/dist/cjs/Message/TextMessage/TextMessage.js +2 -2
- package/dist/cjs/Message/UserFeedback/CloseButton.d.ts +10 -0
- package/dist/cjs/Message/UserFeedback/CloseButton.js +14 -0
- package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +39 -0
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +55 -0
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.d.ts +1 -0
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +146 -0
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +42 -0
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +117 -0
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.d.ts +1 -0
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +249 -0
- package/dist/cjs/MessageBar/AttachButton.js +4 -2
- package/dist/cjs/MessageBar/MessageBar.js +9 -12
- package/dist/cjs/MessageBar/MessageBar.test.js +4 -4
- package/dist/cjs/MessageBar/SendButton.js +3 -1
- package/dist/cjs/MessageBar/StopButton.js +3 -1
- package/dist/cjs/MessageBox/MessageBox.test.d.ts +1 -0
- package/dist/cjs/MessageBox/MessageBox.test.js +22 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +1 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +28 -0
- package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +10 -1
- package/dist/cjs/ResponseActions/ResponseActionButton.js +28 -5
- package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +1 -0
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +54 -0
- package/dist/cjs/ResponseActions/ResponseActions.d.ts +12 -2
- package/dist/cjs/ResponseActions/ResponseActions.js +26 -9
- package/dist/cjs/ResponseActions/ResponseActions.test.js +79 -5
- package/dist/cjs/Settings/SettingsForm.d.ts +13 -0
- package/dist/cjs/Settings/SettingsForm.js +27 -0
- package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -0
- package/dist/cjs/Settings/SettingsForm.test.js +26 -0
- package/dist/cjs/Settings/index.d.ts +2 -0
- package/dist/cjs/Settings/index.js +23 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +34 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.js +49 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +1 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.test.js +79 -0
- package/dist/cjs/TermsOfUse/index.d.ts +2 -0
- package/dist/cjs/TermsOfUse/index.js +23 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.js +10 -1
- package/dist/css/main.css +372 -102
- package/dist/css/main.css.map +1 -1
- package/dist/dynamic/Compare/package.json +1 -0
- package/dist/dynamic/Settings/package.json +1 -0
- package/dist/dynamic/TermsOfUse/package.json +1 -0
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +1 -0
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +47 -0
- package/dist/esm/Chatbot/Chatbot.test.d.ts +1 -0
- package/dist/esm/Chatbot/Chatbot.test.js +23 -0
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.d.ts +1 -0
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +22 -0
- package/dist/esm/ChatbotContent/ChatbotContent.test.d.ts +1 -0
- package/dist/esm/ChatbotContent/ChatbotContent.test.js +13 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +17 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -9
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +39 -3
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +13 -0
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.d.ts +1 -0
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +82 -0
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +13 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +13 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +10 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +15 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +13 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +4 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +15 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +38 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +36 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +42 -0
- package/dist/esm/ChatbotHeader/index.d.ts +1 -0
- package/dist/esm/ChatbotHeader/index.js +1 -0
- package/dist/esm/ChatbotToggle/ChatbotToggle.js +3 -1
- package/dist/esm/CodeModal/CodeModal.js +2 -12
- package/dist/esm/Compare/Compare.d.ts +17 -0
- package/dist/esm/Compare/Compare.js +43 -0
- package/dist/esm/Compare/Compare.test.d.ts +1 -0
- package/dist/esm/Compare/Compare.test.js +15 -0
- package/dist/esm/Compare/index.d.ts +2 -0
- package/dist/esm/Compare/index.js +2 -0
- package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +1 -1
- package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -2
- package/dist/esm/Message/Message.d.ts +28 -7
- package/dist/esm/Message/Message.js +27 -12
- package/dist/esm/Message/Message.test.js +89 -3
- package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +17 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +27 -0
- package/dist/esm/Message/QuickStarts/FallbackImg.d.ts +13 -0
- package/dist/esm/Message/QuickStarts/FallbackImg.js +9 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +27 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +52 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +35 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +48 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileHeader.js +5 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +74 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.js +74 -0
- package/dist/esm/Message/QuickStarts/types.d.ts +132 -0
- package/dist/esm/Message/QuickStarts/types.js +14 -0
- package/dist/esm/Message/TextMessage/TextMessage.d.ts +2 -1
- package/dist/esm/Message/TextMessage/TextMessage.js +3 -3
- package/dist/esm/Message/UserFeedback/CloseButton.d.ts +10 -0
- package/dist/esm/Message/UserFeedback/CloseButton.js +9 -0
- package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +39 -0
- package/dist/esm/Message/UserFeedback/UserFeedback.js +50 -0
- package/dist/esm/Message/UserFeedback/UserFeedback.test.d.ts +1 -0
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +141 -0
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +42 -0
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +112 -0
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.d.ts +1 -0
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +244 -0
- package/dist/esm/MessageBar/AttachButton.js +4 -2
- package/dist/esm/MessageBar/MessageBar.js +9 -12
- package/dist/esm/MessageBar/MessageBar.test.js +4 -4
- package/dist/esm/MessageBar/SendButton.js +3 -1
- package/dist/esm/MessageBar/StopButton.js +3 -1
- package/dist/esm/MessageBox/MessageBox.test.d.ts +1 -0
- package/dist/esm/MessageBox/MessageBox.test.js +17 -0
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +1 -0
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +23 -0
- package/dist/esm/ResponseActions/ResponseActionButton.d.ts +10 -1
- package/dist/esm/ResponseActions/ResponseActionButton.js +25 -2
- package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +1 -0
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +49 -0
- package/dist/esm/ResponseActions/ResponseActions.d.ts +12 -2
- package/dist/esm/ResponseActions/ResponseActions.js +26 -9
- package/dist/esm/ResponseActions/ResponseActions.test.js +79 -5
- package/dist/esm/Settings/SettingsForm.d.ts +13 -0
- package/dist/esm/Settings/SettingsForm.js +20 -0
- package/dist/esm/Settings/SettingsForm.test.d.ts +1 -0
- package/dist/esm/Settings/SettingsForm.test.js +21 -0
- package/dist/esm/Settings/index.d.ts +2 -0
- package/dist/esm/Settings/index.js +2 -0
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +34 -0
- package/dist/esm/TermsOfUse/TermsOfUse.js +42 -0
- package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +1 -0
- package/dist/esm/TermsOfUse/TermsOfUse.test.js +74 -0
- package/dist/esm/TermsOfUse/index.d.ts +2 -0
- package/dist/esm/TermsOfUse/index.js +2 -0
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +6 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -13
- package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +5 -2
- package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +41 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +142 -13
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +4 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +71 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedbackTimeout.tsx +27 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +31 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +63 -11
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +182 -12
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/explore-pipeline-quickstart.ts +65 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerNavigation.tsx +67 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +94 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-TermsAndConditionsHeader.svg +148 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +289 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/SquareChatbotToggle.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +147 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +49 -6
- package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +14 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +26 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +20 -19
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +206 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +104 -0
- package/patternfly-docs/content/extensions/chatbot/img/attached-file.svg +24 -29
- package/patternfly-docs/content/extensions/chatbot/img/attachment-menu.svg +4 -4
- package/patternfly-docs/content/extensions/chatbot/img/attachment-unsent.svg +30 -57
- package/patternfly-docs/content/extensions/chatbot/img/chatbot-elements.svg +5 -5
- package/patternfly-docs/content/extensions/chatbot/img/chatbot-quickstarts-tile.svg +58 -0
- package/patternfly-docs/content/extensions/chatbot/img/chatbot-settings.svg +83 -0
- package/patternfly-docs/content/extensions/chatbot/img/conversation-history.svg +6 -29
- package/patternfly-docs/content/extensions/chatbot/img/docked.svg +68 -49
- package/patternfly-docs/content/extensions/chatbot/img/footnote.svg +1 -1
- package/patternfly-docs/content/extensions/chatbot/img/fullscreen.svg +25 -16
- package/patternfly-docs/content/extensions/chatbot/img/listening.svg +1 -1
- package/patternfly-docs/content/extensions/chatbot/img/message-bar-elements.svg +3 -3
- package/patternfly-docs/content/extensions/chatbot/img/message-elements.svg +85 -142
- package/patternfly-docs/content/extensions/chatbot/img/overlay.svg +52 -36
- package/patternfly-docs/content/extensions/chatbot/img/settings-menu.svg +122 -0
- package/patternfly-docs/content/extensions/chatbot/img/source-tile.svg +62 -0
- package/patternfly-docs/content/extensions/chatbot/img/toggle-customizations.svg +12 -0
- package/src/AttachMenu/AttachMenu.scss +1 -1
- package/src/AttachmentEdit/AttachmentEdit.test.tsx +55 -0
- package/src/Chatbot/Chatbot.test.tsx +31 -0
- package/src/ChatbotAlert/ChatbotAlert.test.tsx +31 -0
- package/src/ChatbotContent/ChatbotContent.test.tsx +15 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +7 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +8 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +112 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +41 -8
- package/src/ChatbotFooter/ChatbotFooter.scss +2 -6
- package/src/ChatbotFooter/ChatbotFooter.test.tsx +15 -0
- package/src/ChatbotFooter/ChatbotFooternote.test.tsx +84 -0
- package/src/ChatbotHeader/ChatbotHeader.scss +2 -5
- package/src/ChatbotHeader/ChatbotHeader.test.tsx +15 -0
- package/src/ChatbotHeader/ChatbotHeaderActions.test.tsx +17 -0
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +20 -0
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +57 -0
- package/src/ChatbotHeader/ChatbotHeaderMain.test.tsx +17 -0
- package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +19 -0
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +11 -2
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +45 -0
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +8 -1
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +43 -0
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +8 -1
- package/src/ChatbotHeader/ChatbotHeaderTitle.test.tsx +59 -0
- package/src/ChatbotHeader/index.ts +1 -0
- package/src/ChatbotModal/ChatbotModal.scss +1 -1
- package/src/ChatbotToggle/ChatbotToggle.tsx +6 -1
- package/src/CodeModal/CodeModal.scss +9 -1
- package/src/CodeModal/CodeModal.tsx +2 -13
- package/src/Compare/Compare.scss +72 -0
- package/src/Compare/Compare.test.tsx +31 -0
- package/src/Compare/Compare.tsx +98 -0
- package/src/Compare/index.ts +2 -0
- package/src/FileDetails/FileDetails.scss +1 -1
- package/src/FileDropZone/__snapshots__/FileDropZone.test.tsx.snap +1 -1
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +4 -4
- package/src/Message/ListMessage/ListMessage.scss +5 -5
- package/src/Message/ListMessage/OrderedListMessage.tsx +2 -2
- package/src/Message/Message.scss +4 -26
- package/src/Message/Message.test.tsx +116 -3
- package/src/Message/Message.tsx +72 -22
- package/src/Message/MessageLoading.scss +2 -2
- package/src/Message/QuickResponse/QuickResponse.scss +33 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +54 -0
- package/src/Message/QuickStarts/FallbackImg.tsx +24 -0
- package/src/Message/QuickStarts/QuickStartTile.scss +24 -0
- package/src/Message/QuickStarts/QuickStartTile.tsx +147 -0
- package/src/Message/QuickStarts/QuickStartTileDescription.test.tsx +57 -0
- package/src/Message/QuickStarts/QuickStartTileDescription.tsx +81 -0
- package/src/Message/QuickStarts/QuickStartTileHeader.tsx +21 -0
- package/src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts +75 -0
- package/src/Message/QuickStarts/monitor-sampleapp-quickstart.ts +75 -0
- package/src/Message/QuickStarts/types.ts +154 -0
- package/src/Message/TextMessage/TextMessage.scss +8 -11
- package/src/Message/TextMessage/TextMessage.tsx +3 -3
- package/src/Message/UserFeedback/CloseButton.tsx +21 -0
- package/src/Message/UserFeedback/UserFeedback.scss +53 -0
- package/src/Message/UserFeedback/UserFeedback.test.tsx +257 -0
- package/src/Message/UserFeedback/UserFeedback.tsx +132 -0
- package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +255 -0
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +211 -0
- package/src/MessageBar/AttachButton.scss +19 -3
- package/src/MessageBar/AttachButton.tsx +3 -1
- package/src/MessageBar/MessageBar.scss +3 -2
- package/src/MessageBar/MessageBar.test.tsx +4 -4
- package/src/MessageBar/MessageBar.tsx +9 -12
- package/src/MessageBar/MicrophoneButton.scss +8 -8
- package/src/MessageBar/SendButton.tsx +2 -0
- package/src/MessageBar/StopButton.scss +17 -3
- package/src/MessageBar/StopButton.tsx +2 -0
- package/src/MessageBox/JumpButton.scss +6 -6
- package/src/MessageBox/MessageBox.test.tsx +26 -0
- package/src/PreviewAttachment/PreviewAttachment.test.tsx +51 -0
- package/src/ResponseActions/ResponseActionButton.test.tsx +52 -0
- package/src/ResponseActions/ResponseActionButton.tsx +59 -28
- package/src/ResponseActions/ResponseActions.scss +11 -9
- package/src/ResponseActions/ResponseActions.test.tsx +103 -5
- package/src/ResponseActions/ResponseActions.tsx +80 -9
- package/src/Settings/Settings.scss +34 -0
- package/src/Settings/SettingsForm.test.tsx +28 -0
- package/src/Settings/SettingsForm.tsx +25 -0
- package/src/Settings/index.ts +3 -0
- package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.scss +1 -1
- package/src/SourcesCard/SourcesCard.scss +2 -2
- package/src/TermsOfUse/TermsOfUse.scss +66 -0
- package/src/TermsOfUse/TermsOfUse.test.tsx +138 -0
- package/src/TermsOfUse/TermsOfUse.tsx +117 -0
- package/src/TermsOfUse/index.ts +3 -0
- package/src/index.ts +9 -0
- package/src/main.scss +6 -4
@@ -24,8 +24,10 @@ const AttachButtonBase = (_a) => {
|
|
24
24
|
onDropAccepted: onAttachAccepted
|
25
25
|
});
|
26
26
|
return (React.createElement(React.Fragment, null,
|
27
|
-
React.createElement("input", Object.assign({ "data-testid": inputTestId }, getInputProps())),
|
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
|
27
|
+
React.createElement("input", Object.assign({ "data-testid": inputTestId }, getInputProps(), { hidden: true })),
|
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
|
+
// prevents VO announcements of both aria label and tooltip
|
30
|
+
aria: "none" }, tooltipProps),
|
29
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 },
|
30
32
|
React.createElement(PaperclipIcon, null)) }, props)))));
|
31
33
|
};
|
@@ -48,17 +48,14 @@ export const MessageBar = (_a) => {
|
|
48
48
|
};
|
49
49
|
// Handle sending message
|
50
50
|
const handleSend = React.useCallback(() => {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
return '';
|
60
|
-
});
|
61
|
-
}, [onSendMessage]);
|
51
|
+
onSendMessage(message);
|
52
|
+
if (textareaRef.current) {
|
53
|
+
textareaRef.current.innerText = '';
|
54
|
+
setShowPlaceholder(true);
|
55
|
+
textareaRef.current.blur();
|
56
|
+
}
|
57
|
+
setMessage('');
|
58
|
+
}, [onSendMessage, message]);
|
62
59
|
const handleKeyDown = React.useCallback((event) => {
|
63
60
|
if (event.key === 'Enter' && !event.shiftKey) {
|
64
61
|
event.preventDefault();
|
@@ -66,7 +63,7 @@ export const MessageBar = (_a) => {
|
|
66
63
|
handleSend();
|
67
64
|
}
|
68
65
|
}
|
69
|
-
}, [handleSend]);
|
66
|
+
}, [handleSend, isSendButtonDisabled, handleStopButton]);
|
70
67
|
const handleAttachMenuToggle = () => {
|
71
68
|
(attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.setIsAttachMenuOpen) && (attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.setIsAttachMenuOpen(!(attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.isAttachMenuOpen)));
|
72
69
|
attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuToggleClick();
|
@@ -7,14 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
8
|
});
|
9
9
|
};
|
10
|
+
import '@testing-library/jest-dom';
|
10
11
|
import React from 'react';
|
12
|
+
import { DropdownGroup, DropdownItem, DropdownList } from '@patternfly/react-core';
|
13
|
+
import { BellIcon, CalendarAltIcon, ClipboardIcon, CodeIcon } from '@patternfly/react-icons';
|
11
14
|
import { render, screen } from '@testing-library/react';
|
12
|
-
import '@testing-library/jest-dom';
|
13
15
|
import userEvent from '@testing-library/user-event';
|
14
|
-
import { MessageBar } from './MessageBar';
|
15
|
-
import { DropdownGroup, DropdownItem, DropdownList } from '@patternfly/react-core';
|
16
16
|
import SourceDetailsMenuItem from '../SourceDetailsMenuItem';
|
17
|
-
import {
|
17
|
+
import { MessageBar } from './MessageBar';
|
18
18
|
const ATTACH_MENU_ITEMS = [
|
19
19
|
React.createElement(DropdownList, { key: "list-1" },
|
20
20
|
React.createElement(DropdownItem, { className: "pf-chatbot-source-details-dropdown-item", value: "auth-operator Pod", id: "0" },
|
@@ -18,7 +18,9 @@ import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
|
18
18
|
import { PaperPlaneIcon } from '@patternfly/react-icons/dist/esm/icons/paper-plane-icon';
|
19
19
|
export const SendButton = (_a) => {
|
20
20
|
var { className, onClick, tooltipProps, tooltipContent = 'Send' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
|
21
|
-
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--send", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.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
|
21
|
+
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--send", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.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,
|
22
|
+
// prevents VO announcements of both aria label and tooltip
|
23
|
+
aria: "none" }, tooltipProps),
|
22
24
|
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: React.createElement(Icon, { iconSize: "xl", isInline: true },
|
23
25
|
React.createElement(PaperPlaneIcon, null)) }, props))));
|
24
26
|
};
|
@@ -17,7 +17,9 @@ import React from 'react';
|
|
17
17
|
import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
18
18
|
export const StopButton = (_a) => {
|
19
19
|
var { className, onClick, tooltipProps, tooltipContent = 'Stop' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
|
20
|
-
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--stop", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.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
|
20
|
+
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--stop", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.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,
|
21
|
+
// prevents VO announcements of both aria label and tooltip
|
22
|
+
aria: "none" }, tooltipProps),
|
21
23
|
React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop button', onClick: onClick, icon: React.createElement(Icon, { iconSize: "xl", isInline: true },
|
22
24
|
React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
23
25
|
React.createElement("path", { d: "M0.5 3C0.5 1.62109 1.62109 0.5 3 0.5H13C14.3789 0.5 15.5 1.62109 15.5 3V13C15.5 14.3789 14.3789 15.5 13 15.5H3C1.62109 15.5 0.5 14.3789 0.5 13V3Z", fill: "currentColor" }))) }, props))));
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import { MessageBox } from './MessageBox';
|
4
|
+
describe('MessageBox', () => {
|
5
|
+
it('should render Message box', () => {
|
6
|
+
render(React.createElement(MessageBox, null,
|
7
|
+
React.createElement(React.Fragment, null, "Chatbot Messages")));
|
8
|
+
expect(screen.getByText('Chatbot Messages')).toBeTruthy();
|
9
|
+
});
|
10
|
+
it('should assign ref to Message box', () => {
|
11
|
+
const ref = React.createRef();
|
12
|
+
render(React.createElement(MessageBox, { ref: ref },
|
13
|
+
React.createElement("div", null, "Test message content")));
|
14
|
+
expect(ref.current).not.toBeNull();
|
15
|
+
expect(ref.current).toBeInstanceOf(HTMLDivElement);
|
16
|
+
});
|
17
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
3
|
+
import { PreviewAttachment } from './PreviewAttachment';
|
4
|
+
describe('PreviewAttachment', () => {
|
5
|
+
it('should render PreviewAttachment', () => {
|
6
|
+
render(React.createElement(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: jest.fn() }));
|
7
|
+
expect(screen.getByText('Preview attachment')).toBeTruthy();
|
8
|
+
expect(screen.getByText('greetings')).toBeTruthy();
|
9
|
+
expect(screen.getAllByText('TEXT')).toBeTruthy();
|
10
|
+
});
|
11
|
+
it('should call onEdit handler when edit button is pressed', () => {
|
12
|
+
const onEdit = jest.fn();
|
13
|
+
render(React.createElement(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: onEdit, handleModalToggle: jest.fn() }));
|
14
|
+
fireEvent.click(screen.getByText('Edit'));
|
15
|
+
expect(onEdit).toHaveBeenCalled();
|
16
|
+
});
|
17
|
+
it('should call onDismiss handler when dismiss button is pressed', () => {
|
18
|
+
const onDismiss = jest.fn();
|
19
|
+
render(React.createElement(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: onDismiss }));
|
20
|
+
fireEvent.click(screen.getByText('Dismiss'));
|
21
|
+
expect(onDismiss).toHaveBeenCalled();
|
22
|
+
});
|
23
|
+
});
|
@@ -3,6 +3,8 @@ import { TooltipProps } from '@patternfly/react-core';
|
|
3
3
|
export interface ResponseActionButtonProps {
|
4
4
|
/** Aria-label for the button. Defaults to the value of the tooltipContent if none provided */
|
5
5
|
ariaLabel?: string;
|
6
|
+
/** Aria-label for the button, shown when the button is clicked. Defaults to the value of ariaLabel or tooltipContent if not provided. */
|
7
|
+
clickedAriaLabel?: string;
|
6
8
|
/** Icon for the button */
|
7
9
|
icon: React.ReactNode;
|
8
10
|
/** On-click handler for the button */
|
@@ -13,8 +15,15 @@ export interface ResponseActionButtonProps {
|
|
13
15
|
isDisabled?: boolean;
|
14
16
|
/** Content shown in the tooltip */
|
15
17
|
tooltipContent?: string;
|
18
|
+
/** Content shown in the tooltip when the button is clicked. Defaults to the value of tooltipContent if not provided. */
|
19
|
+
clickedTooltipContent?: string;
|
16
20
|
/** Props to control the PF Tooltip component */
|
17
21
|
tooltipProps?: TooltipProps;
|
22
|
+
/** Whether button is in clicked state */
|
23
|
+
isClicked?: boolean;
|
24
|
+
/** Ref applied to button */
|
25
|
+
innerRef?: React.Ref<HTMLButtonElement>;
|
18
26
|
}
|
19
|
-
export declare const
|
27
|
+
export declare const ResponseActionButtonBase: React.FunctionComponent<ResponseActionButtonProps>;
|
28
|
+
declare const ResponseActionButton: React.ForwardRefExoticComponent<ResponseActionButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
20
29
|
export default ResponseActionButton;
|
@@ -1,5 +1,28 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React from 'react';
|
2
13
|
import { Button, Icon, Tooltip } from '@patternfly/react-core';
|
3
|
-
export const
|
4
|
-
|
14
|
+
export const ResponseActionButtonBase = (_a) => {
|
15
|
+
var { ariaLabel, clickedAriaLabel = ariaLabel, className, icon, isDisabled, onClick, tooltipContent, clickedTooltipContent = tooltipContent, tooltipProps, isClicked = false, innerRef } = _a, props = __rest(_a, ["ariaLabel", "clickedAriaLabel", "className", "icon", "isDisabled", "onClick", "tooltipContent", "clickedTooltipContent", "tooltipProps", "isClicked", "innerRef"]);
|
16
|
+
const generateAriaLabel = () => {
|
17
|
+
if (ariaLabel) {
|
18
|
+
return isClicked ? clickedAriaLabel : ariaLabel;
|
19
|
+
}
|
20
|
+
return isClicked ? clickedTooltipContent : tooltipContent;
|
21
|
+
};
|
22
|
+
return (React.createElement(Tooltip, Object.assign({ id: `pf-chatbot__tooltip-response-action-${tooltipContent}`, content: isClicked ? clickedTooltipContent : tooltipContent, "aria-live": "polite", position: "bottom", 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,
|
23
|
+
// prevents VO announcements of both aria label and tooltip
|
24
|
+
aria: "none" }, tooltipProps),
|
25
|
+
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--response-action ${isClicked ? 'pf-chatbot__button--response-action-clicked' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": generateAriaLabel(), icon: React.createElement(Icon, { isInline: true, size: "lg" }, icon), isDisabled: isDisabled, onClick: onClick, size: "sm", ref: innerRef }, props))));
|
26
|
+
};
|
27
|
+
const ResponseActionButton = React.forwardRef((props, ref) => (React.createElement(ResponseActionButtonBase, Object.assign({ innerRef: ref }, props))));
|
5
28
|
export default ResponseActionButton;
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -0,0 +1,49 @@
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
+
});
|
9
|
+
};
|
10
|
+
import React from 'react';
|
11
|
+
import { render, screen } from '@testing-library/react';
|
12
|
+
import '@testing-library/jest-dom';
|
13
|
+
import userEvent from '@testing-library/user-event';
|
14
|
+
import { DownloadIcon } from '@patternfly/react-icons';
|
15
|
+
import ResponseActionButton from './ResponseActionButton';
|
16
|
+
describe('ResponseActionButton', () => {
|
17
|
+
it('renders aria-label correctly if not clicked', () => {
|
18
|
+
render(React.createElement(ResponseActionButton, { icon: React.createElement(DownloadIcon, null), ariaLabel: "Download", clickedAriaLabel: "Downloaded" }));
|
19
|
+
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
20
|
+
});
|
21
|
+
it('renders aria-label correctly if clicked', () => {
|
22
|
+
render(React.createElement(ResponseActionButton, { icon: React.createElement(DownloadIcon, null), ariaLabel: "Download", clickedAriaLabel: "Downloaded", isClicked: true }));
|
23
|
+
expect(screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
|
24
|
+
});
|
25
|
+
it('renders tooltip correctly if not clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
+
render(React.createElement(ResponseActionButton, { icon: React.createElement(DownloadIcon, null), tooltipContent: "Download", clickedTooltipContent: "Downloaded" }));
|
27
|
+
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
28
|
+
// clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
|
29
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Download' }));
|
30
|
+
expect(screen.getByRole('tooltip', { name: 'Download' })).toBeTruthy();
|
31
|
+
}));
|
32
|
+
it('renders tooltip correctly if clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
33
|
+
render(React.createElement(ResponseActionButton, { icon: React.createElement(DownloadIcon, null), tooltipContent: "Download", clickedTooltipContent: "Downloaded", isClicked: true }));
|
34
|
+
expect(screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
|
35
|
+
// clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
|
36
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Downloaded' }));
|
37
|
+
expect(screen.getByRole('tooltip', { name: 'Downloaded' })).toBeTruthy();
|
38
|
+
}));
|
39
|
+
it('if clicked variant for tooltip is not supplied, it uses the default', () => __awaiter(void 0, void 0, void 0, function* () {
|
40
|
+
render(React.createElement(ResponseActionButton, { icon: React.createElement(DownloadIcon, null), tooltipContent: "Download", isClicked: true }));
|
41
|
+
// clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
|
42
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Download' }));
|
43
|
+
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
44
|
+
}));
|
45
|
+
it('if clicked variant for aria label is not supplied, it uses the default', () => __awaiter(void 0, void 0, void 0, function* () {
|
46
|
+
render(React.createElement(ResponseActionButton, { icon: React.createElement(DownloadIcon, null), ariaLabel: "Download", isClicked: true }));
|
47
|
+
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
48
|
+
}));
|
49
|
+
});
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { TooltipProps } from '@patternfly/react-core';
|
3
|
-
export interface ActionProps {
|
2
|
+
import { ButtonProps, TooltipProps } from '@patternfly/react-core';
|
3
|
+
export interface ActionProps extends Omit<ButtonProps, 'ref'> {
|
4
4
|
/** Aria-label for the button */
|
5
5
|
ariaLabel?: string;
|
6
|
+
/** Aria-label for the button, shown when the button is clicked. */
|
7
|
+
clickedAriaLabel?: string;
|
6
8
|
/** On-click handler for the button */
|
7
9
|
onClick?: ((event: MouseEvent | React.MouseEvent<Element, MouseEvent> | KeyboardEvent) => void) | undefined;
|
8
10
|
/** Class name for the button */
|
@@ -11,10 +13,18 @@ export interface ActionProps {
|
|
11
13
|
isDisabled?: boolean;
|
12
14
|
/** Content shown in the tooltip */
|
13
15
|
tooltipContent?: string;
|
16
|
+
/** Content shown in the tooltip when the button is clicked. */
|
17
|
+
clickedTooltipContent?: string;
|
14
18
|
/** Props to control the PF Tooltip component */
|
15
19
|
tooltipProps?: TooltipProps;
|
16
20
|
/** Icon for custom response action */
|
17
21
|
icon?: React.ReactNode;
|
22
|
+
/** Ref for response action button */
|
23
|
+
ref?: React.Ref<HTMLButtonElement>;
|
24
|
+
/** Whether content launched by button, such as the feedback form, is expanded */
|
25
|
+
'aria-expanded'?: boolean;
|
26
|
+
/** Id for content controlled by the button, such as the feedback form */
|
27
|
+
'aria-controls'?: string;
|
18
28
|
}
|
19
29
|
export interface ResponseActionProps {
|
20
30
|
/** Props for message actions, such as feedback (positive or negative), copy button, share, and listen */
|
@@ -13,17 +13,34 @@ import React from 'react';
|
|
13
13
|
import { ExternalLinkAltIcon, VolumeUpIcon, OutlinedThumbsUpIcon, OutlinedThumbsDownIcon, OutlinedCopyIcon } from '@patternfly/react-icons';
|
14
14
|
import ResponseActionButton from './ResponseActionButton';
|
15
15
|
export const ResponseActions = ({ actions }) => {
|
16
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
17
|
+
const [activeButton, setActiveButton] = React.useState();
|
17
18
|
const { positive, negative, copy, share, listen } = actions, additionalActions = __rest(actions, ["positive", "negative", "copy", "share", "listen"]);
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
const responseActions = React.useRef(null);
|
20
|
+
React.useEffect(() => {
|
21
|
+
const handleClickOutside = (e) => {
|
22
|
+
if (responseActions.current && !responseActions.current.contains(e.target)) {
|
23
|
+
setActiveButton(undefined);
|
24
|
+
}
|
25
|
+
};
|
26
|
+
window.addEventListener('click', handleClickOutside);
|
27
|
+
return () => {
|
28
|
+
window.removeEventListener('click', handleClickOutside);
|
29
|
+
};
|
30
|
+
}, []);
|
31
|
+
const handleClick = (e, id, onClick) => {
|
32
|
+
setActiveButton(id);
|
33
|
+
onClick && onClick(e);
|
34
|
+
};
|
35
|
+
return (React.createElement("div", { ref: responseActions, className: "pf-chatbot__response-actions" },
|
36
|
+
positive && (React.createElement(ResponseActionButton, { ariaLabel: (_a = positive.ariaLabel) !== null && _a !== void 0 ? _a : 'Good response', clickedAriaLabel: (_b = positive.ariaLabel) !== null && _b !== void 0 ? _b : 'Response recorded', onClick: (e) => handleClick(e, 'positive', positive.onClick), className: positive.className, isDisabled: positive.isDisabled, tooltipContent: (_c = positive.tooltipContent) !== null && _c !== void 0 ? _c : 'Good response', clickedTooltipContent: (_d = positive.clickedTooltipContent) !== null && _d !== void 0 ? _d : 'Response recorded', tooltipProps: positive.tooltipProps, icon: React.createElement(OutlinedThumbsUpIcon, null), isClicked: activeButton === 'positive', ref: positive.ref, "aria-expanded": positive['aria-expanded'], "aria-controls": positive['aria-controls'] })),
|
37
|
+
negative && (React.createElement(ResponseActionButton, { ariaLabel: (_e = negative.ariaLabel) !== null && _e !== void 0 ? _e : 'Bad response', clickedAriaLabel: (_f = negative.ariaLabel) !== null && _f !== void 0 ? _f : 'Response recorded', onClick: (e) => handleClick(e, 'negative', negative.onClick), className: negative.className, isDisabled: negative.isDisabled, tooltipContent: (_g = negative.tooltipContent) !== null && _g !== void 0 ? _g : 'Bad response', clickedTooltipContent: (_h = negative.clickedTooltipContent) !== null && _h !== void 0 ? _h : 'Response recorded', tooltipProps: negative.tooltipProps, icon: React.createElement(OutlinedThumbsDownIcon, null), isClicked: activeButton === 'negative', ref: negative.ref, "aria-expanded": negative['aria-expanded'], "aria-controls": negative['aria-controls'] })),
|
38
|
+
copy && (React.createElement(ResponseActionButton, { ariaLabel: (_j = copy.ariaLabel) !== null && _j !== void 0 ? _j : 'Copy', clickedAriaLabel: (_k = copy.ariaLabel) !== null && _k !== void 0 ? _k : 'Copied', onClick: (e) => handleClick(e, 'copy', copy.onClick), className: copy.className, isDisabled: copy.isDisabled, tooltipContent: (_l = copy.tooltipContent) !== null && _l !== void 0 ? _l : 'Copy', clickedTooltipContent: (_m = copy.clickedTooltipContent) !== null && _m !== void 0 ? _m : 'Copied', tooltipProps: copy.tooltipProps, icon: React.createElement(OutlinedCopyIcon, null), isClicked: activeButton === 'copy', ref: copy.ref, "aria-expanded": copy['aria-expanded'], "aria-controls": copy['aria-controls'] })),
|
39
|
+
share && (React.createElement(ResponseActionButton, { ariaLabel: (_o = share.ariaLabel) !== null && _o !== void 0 ? _o : 'Share', clickedAriaLabel: (_p = share.ariaLabel) !== null && _p !== void 0 ? _p : 'Shared', onClick: (e) => handleClick(e, 'share', share.onClick), className: share.className, isDisabled: share.isDisabled, tooltipContent: (_q = share.tooltipContent) !== null && _q !== void 0 ? _q : 'Share', clickedTooltipContent: (_r = share.clickedTooltipContent) !== null && _r !== void 0 ? _r : 'Shared', tooltipProps: share.tooltipProps, icon: React.createElement(ExternalLinkAltIcon, null), isClicked: activeButton === 'share', ref: share.ref, "aria-expanded": share['aria-expanded'], "aria-controls": share['aria-controls'] })),
|
40
|
+
listen && (React.createElement(ResponseActionButton, { ariaLabel: (_s = listen.ariaLabel) !== null && _s !== void 0 ? _s : 'Listen', clickedAriaLabel: (_t = listen.ariaLabel) !== null && _t !== void 0 ? _t : 'Listening', onClick: (e) => handleClick(e, 'listen', listen.onClick), className: listen.className, isDisabled: listen.isDisabled, tooltipContent: (_u = listen.tooltipContent) !== null && _u !== void 0 ? _u : 'Listen', clickedTooltipContent: (_v = listen.clickedTooltipContent) !== null && _v !== void 0 ? _v : 'Listening', tooltipProps: listen.tooltipProps, icon: React.createElement(VolumeUpIcon, null), isClicked: activeButton === 'listen', ref: listen.ref, "aria-expanded": listen['aria-expanded'], "aria-controls": listen['aria-controls'] })),
|
24
41
|
Object.keys(additionalActions).map((action) => {
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
26
|
-
return (React.createElement(ResponseActionButton, { key: action, ariaLabel: (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.ariaLabel,
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
43
|
+
return (React.createElement(ResponseActionButton, { key: action, ariaLabel: (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.ariaLabel, clickedAriaLabel: (_b = additionalActions[action]) === null || _b === void 0 ? void 0 : _b.clickedAriaLabel, onClick: (e) => { var _a; return handleClick(e, action, (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.onClick); }, className: (_c = additionalActions[action]) === null || _c === void 0 ? void 0 : _c.className, isDisabled: (_d = additionalActions[action]) === null || _d === void 0 ? void 0 : _d.isDisabled, tooltipContent: (_e = additionalActions[action]) === null || _e === void 0 ? void 0 : _e.tooltipContent, tooltipProps: (_f = additionalActions[action]) === null || _f === void 0 ? void 0 : _f.tooltipProps, clickedTooltipContent: (_g = additionalActions[action]) === null || _g === void 0 ? void 0 : _g.clickedTooltipContent, icon: (_h = additionalActions[action]) === null || _h === void 0 ? void 0 : _h.icon, isClicked: activeButton === action, ref: (_j = additionalActions[action]) === null || _j === void 0 ? void 0 : _j.ref, "aria-expanded": (_k = additionalActions[action]) === null || _k === void 0 ? void 0 : _k['aria-expanded'], "aria-controls": (_l = additionalActions[action]) === null || _l === void 0 ? void 0 : _l['aria-controls'] }));
|
27
44
|
})));
|
28
45
|
};
|
29
46
|
export default ResponseActions;
|
@@ -13,25 +13,30 @@ import '@testing-library/jest-dom';
|
|
13
13
|
import ResponseActions from './ResponseActions';
|
14
14
|
import userEvent from '@testing-library/user-event';
|
15
15
|
import { DownloadIcon, InfoCircleIcon, RedoIcon } from '@patternfly/react-icons';
|
16
|
+
import Message from '../Message';
|
16
17
|
const ALL_ACTIONS = [
|
17
|
-
{ type: 'positive', label: 'Good response' },
|
18
|
-
{ type: 'negative', label: 'Bad response' },
|
19
|
-
{ type: 'copy', label: 'Copy' },
|
20
|
-
{ type: 'share', label: 'Share' },
|
21
|
-
{ type: 'listen', label: 'Listen' }
|
18
|
+
{ type: 'positive', label: 'Good response', clickedLabel: 'Response recorded' },
|
19
|
+
{ type: 'negative', label: 'Bad response', clickedLabel: 'Response recorded' },
|
20
|
+
{ type: 'copy', label: 'Copy', clickedLabel: 'Copied' },
|
21
|
+
{ type: 'share', label: 'Share', clickedLabel: 'Shared' },
|
22
|
+
{ type: 'listen', label: 'Listen', clickedLabel: 'Listening' }
|
22
23
|
];
|
23
24
|
const CUSTOM_ACTIONS = [
|
24
25
|
{
|
25
26
|
regenerate: {
|
26
27
|
ariaLabel: 'Regenerate',
|
28
|
+
clickedAriaLabel: 'Regenerated',
|
27
29
|
onClick: jest.fn(),
|
28
30
|
tooltipContent: 'Regenerate',
|
31
|
+
clickedTooltipContent: 'Regenerated',
|
29
32
|
icon: React.createElement(RedoIcon, null)
|
30
33
|
},
|
31
34
|
download: {
|
32
35
|
ariaLabel: 'Download',
|
36
|
+
clickedAriaLabel: 'Downloaded',
|
33
37
|
onClick: jest.fn(),
|
34
38
|
tooltipContent: 'Download',
|
39
|
+
clickedTooltipContent: 'Downloaded',
|
35
40
|
icon: React.createElement(DownloadIcon, null)
|
36
41
|
},
|
37
42
|
info: {
|
@@ -43,6 +48,59 @@ const CUSTOM_ACTIONS = [
|
|
43
48
|
}
|
44
49
|
];
|
45
50
|
describe('ResponseActions', () => {
|
51
|
+
afterEach(() => {
|
52
|
+
jest.clearAllMocks();
|
53
|
+
});
|
54
|
+
it('should handle click within group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
55
|
+
render(React.createElement(ResponseActions, { actions: {
|
56
|
+
positive: { onClick: jest.fn() },
|
57
|
+
negative: { onClick: jest.fn() },
|
58
|
+
copy: { onClick: jest.fn() },
|
59
|
+
share: { onClick: jest.fn() },
|
60
|
+
listen: { onClick: jest.fn() }
|
61
|
+
} }));
|
62
|
+
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
63
|
+
const badBtn = screen.getByRole('button', { name: 'Bad response' });
|
64
|
+
const copyBtn = screen.getByRole('button', { name: 'Copy' });
|
65
|
+
const shareBtn = screen.getByRole('button', { name: 'Share' });
|
66
|
+
const listenBtn = screen.getByRole('button', { name: 'Listen' });
|
67
|
+
const buttons = [goodBtn, badBtn, copyBtn, shareBtn, listenBtn];
|
68
|
+
buttons.forEach((button) => {
|
69
|
+
expect(button).toBeTruthy();
|
70
|
+
});
|
71
|
+
yield userEvent.click(goodBtn);
|
72
|
+
expect(screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
73
|
+
let unclickedButtons = buttons.filter((button) => button !== goodBtn);
|
74
|
+
unclickedButtons.forEach((button) => {
|
75
|
+
expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
76
|
+
});
|
77
|
+
yield userEvent.click(badBtn);
|
78
|
+
expect(screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
79
|
+
unclickedButtons = buttons.filter((button) => button !== badBtn);
|
80
|
+
unclickedButtons.forEach((button) => {
|
81
|
+
expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
82
|
+
});
|
83
|
+
}));
|
84
|
+
it('should handle click outside of group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
85
|
+
// using message just so we have something outside the group that's rendered
|
86
|
+
render(React.createElement(Message, { name: "Bot", role: "bot", avatar: "", content: "Example with all prebuilt actions", actions: {
|
87
|
+
positive: {},
|
88
|
+
negative: {}
|
89
|
+
} }));
|
90
|
+
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
91
|
+
const badBtn = screen.getByRole('button', { name: 'Bad response' });
|
92
|
+
expect(goodBtn).toBeTruthy();
|
93
|
+
expect(badBtn).toBeTruthy();
|
94
|
+
yield userEvent.click(goodBtn);
|
95
|
+
expect(screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
96
|
+
expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
97
|
+
yield userEvent.click(badBtn);
|
98
|
+
expect(screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
|
99
|
+
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
100
|
+
yield userEvent.click(screen.getByText('Example with all prebuilt actions'));
|
101
|
+
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
102
|
+
expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
103
|
+
}));
|
46
104
|
it('should render buttons correctly', () => {
|
47
105
|
ALL_ACTIONS.forEach(({ type, label }) => {
|
48
106
|
render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
|
@@ -57,6 +115,22 @@ describe('ResponseActions', () => {
|
|
57
115
|
expect(spy).toHaveBeenCalledTimes(1);
|
58
116
|
}));
|
59
117
|
}));
|
118
|
+
it('should swap clicked and non-clicked aria labels on click', () => __awaiter(void 0, void 0, void 0, function* () {
|
119
|
+
ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label, clickedLabel }) {
|
120
|
+
render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
|
121
|
+
expect(screen.getByRole('button', { name: label })).toBeTruthy();
|
122
|
+
yield userEvent.click(screen.getByRole('button', { name: label }));
|
123
|
+
expect(screen.getByRole('button', { name: clickedLabel })).toBeTruthy();
|
124
|
+
}));
|
125
|
+
}));
|
126
|
+
it('should swap clicked and non-clicked tooltips on click', () => __awaiter(void 0, void 0, void 0, function* () {
|
127
|
+
ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label, clickedLabel }) {
|
128
|
+
render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
|
129
|
+
expect(screen.getByRole('button', { name: label })).toBeTruthy();
|
130
|
+
yield userEvent.click(screen.getByRole('button', { name: label }));
|
131
|
+
expect(screen.getByRole('tooltip', { name: clickedLabel })).toBeTruthy();
|
132
|
+
}));
|
133
|
+
}));
|
60
134
|
it('should be able to change aria labels', () => {
|
61
135
|
const actions = [
|
62
136
|
{ type: 'positive', ariaLabel: 'Thumbs up' },
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface SettingsFormProps {
|
3
|
+
/** Class applied to form container */
|
4
|
+
className?: string;
|
5
|
+
/** Array of fields to display in the settings layout */
|
6
|
+
fields?: {
|
7
|
+
id: string;
|
8
|
+
label: string;
|
9
|
+
field: React.ReactElement;
|
10
|
+
}[];
|
11
|
+
}
|
12
|
+
export declare const SettingsForm: React.FunctionComponent<SettingsFormProps>;
|
13
|
+
export default SettingsForm;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
12
|
+
import React from 'react';
|
13
|
+
export const SettingsForm = (_a) => {
|
14
|
+
var { className, fields = [] } = _a, props = __rest(_a, ["className", "fields"]);
|
15
|
+
return (React.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${className}` }, props),
|
16
|
+
React.createElement("form", { className: "pf-chatbot__settings-form" }, fields.map((field) => (React.createElement("div", { className: "pf-chatbot__settings-form-row", key: field.label },
|
17
|
+
React.createElement("label", { className: "pf-chatbot__settings-label", htmlFor: field.id }, field.label),
|
18
|
+
field.field))))));
|
19
|
+
};
|
20
|
+
export default SettingsForm;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Button } from '@patternfly/react-core';
|
3
|
+
import { render, screen } from '@testing-library/react';
|
4
|
+
import { SettingsForm } from './SettingsForm';
|
5
|
+
describe('SettingsForm', () => {
|
6
|
+
it('should render settingsForm with custom classname', () => {
|
7
|
+
const { container } = render(React.createElement(SettingsForm, { className: "custom-settings" }));
|
8
|
+
expect(container.querySelector('.custom-settings')).toBeTruthy();
|
9
|
+
});
|
10
|
+
it('should render settingsForm with fields', () => {
|
11
|
+
const fields = [
|
12
|
+
{
|
13
|
+
id: 'archived-chat',
|
14
|
+
label: 'Archive chat',
|
15
|
+
field: (React.createElement(Button, { id: "archived-chat", variant: "secondary" }, "Archive chat"))
|
16
|
+
}
|
17
|
+
];
|
18
|
+
render(React.createElement(SettingsForm, { fields: fields }));
|
19
|
+
expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
|
20
|
+
});
|
21
|
+
});
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { ModalProps } from '@patternfly/react-core';
|
3
|
+
import { ChatbotDisplayMode } from '../Chatbot';
|
4
|
+
export interface TermsOfUseProps extends ModalProps {
|
5
|
+
/** Class applied to modal */
|
6
|
+
className?: string;
|
7
|
+
/** Action assigned to primary modal button */
|
8
|
+
onPrimaryAction?: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
|
9
|
+
/** Action assigned to secondary modal button */
|
10
|
+
onSecondaryAction: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
|
11
|
+
/** Name of primary modal button */
|
12
|
+
primaryActionBtn?: string;
|
13
|
+
/** Name of secondary modal button */
|
14
|
+
secondaryActionBtn?: string;
|
15
|
+
/** Function that handles modal toggle */
|
16
|
+
handleModalToggle: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
|
17
|
+
/** Whether modal is open */
|
18
|
+
isModalOpen: boolean;
|
19
|
+
/** Title of modal */
|
20
|
+
title?: string;
|
21
|
+
/** Display mode for the Chatbot parent; this influences the styles applied */
|
22
|
+
displayMode?: ChatbotDisplayMode;
|
23
|
+
/** Optional image displayed in header */
|
24
|
+
image?: string;
|
25
|
+
/** Alt text for optional image displayed in header */
|
26
|
+
altText?: string;
|
27
|
+
/** Ref applied to modal */
|
28
|
+
innerRef?: React.Ref<HTMLDivElement>;
|
29
|
+
/** OuiaID applied to modal */
|
30
|
+
ouiaId?: string;
|
31
|
+
}
|
32
|
+
export declare const TermsOfUseBase: React.FunctionComponent<TermsOfUseProps>;
|
33
|
+
declare const TermsOfUse: React.ForwardRefExoticComponent<Omit<TermsOfUseProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
34
|
+
export default TermsOfUse;
|