@patternfly/chatbot 6.3.0-prerelease.13 → 6.3.0-prerelease.14
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/AttachMenu/AttachMenu.d.ts +2 -2
- package/dist/cjs/AttachMenu/AttachMenu.js +2 -12
- package/dist/cjs/AttachmentEdit/AttachmentEdit.d.ts +12 -2
- package/dist/cjs/AttachmentEdit/AttachmentEdit.js +3 -6
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +1 -1
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +33 -8
- package/dist/cjs/Chatbot/Chatbot.d.ts +1 -2
- package/dist/cjs/Chatbot/Chatbot.js +4 -9
- package/dist/cjs/Chatbot/Chatbot.test.js +11 -11
- package/dist/cjs/ChatbotAlert/ChatbotAlert.d.ts +2 -2
- package/dist/cjs/ChatbotAlert/ChatbotAlert.js +4 -8
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +10 -10
- package/dist/cjs/ChatbotContent/ChatbotContent.d.ts +3 -3
- package/dist/cjs/ChatbotContent/ChatbotContent.js +2 -8
- package/dist/cjs/ChatbotContent/ChatbotContent.test.js +5 -5
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +7 -11
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +31 -33
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +16 -33
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +56 -64
- package/dist/cjs/ChatbotConversationHistoryNav/EmptyState.d.ts +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/EmptyState.js +2 -9
- package/dist/cjs/ChatbotConversationHistoryNav/LoadingState.d.ts +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/LoadingState.js +2 -25
- package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +3 -3
- package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -15
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +7 -7
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +28 -28
- package/dist/cjs/ChatbotFooter/ChatbotFootnote.d.ts +3 -3
- package/dist/cjs/ChatbotFooter/ChatbotFootnote.js +10 -23
- package/dist/cjs/ChatbotHeader/ChatbotHeader.d.ts +3 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeader.js +2 -7
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +5 -5
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.d.ts +2 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.js +2 -5
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +5 -5
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +1 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +5 -10
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +7 -10
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.d.ts +2 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +2 -5
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +5 -5
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +5 -7
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +7 -10
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +6 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +19 -21
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +6 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +9 -12
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +17 -19
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.d.ts +2 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.js +2 -5
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +23 -23
- package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +2 -2
- package/dist/cjs/ChatbotModal/ChatbotModal.js +3 -9
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +4 -16
- package/dist/cjs/ChatbotPopover/ChatbotPopover.d.ts +2 -2
- package/dist/cjs/ChatbotPopover/ChatbotPopover.js +2 -8
- package/dist/cjs/ChatbotToggle/ChatbotToggle.d.ts +1 -2
- package/dist/cjs/ChatbotToggle/ChatbotToggle.js +8 -13
- package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +25 -25
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +2 -2
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +6 -20
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +16 -16
- package/dist/cjs/CodeModal/CodeModal.d.ts +8 -2
- package/dist/cjs/CodeModal/CodeModal.js +8 -20
- package/dist/cjs/CodeModal/CodeModal.test.js +23 -4
- package/dist/cjs/Compare/Compare.d.ts +2 -2
- package/dist/cjs/Compare/Compare.js +7 -16
- package/dist/cjs/Compare/Compare.test.js +7 -9
- package/dist/cjs/FileDetails/FileDetails.d.ts +2 -2
- package/dist/cjs/FileDetails/FileDetails.js +2 -15
- package/dist/cjs/FileDetails/FileDetails.test.js +10 -10
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.d.ts +2 -2
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.js +2 -5
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +21 -21
- package/dist/cjs/FileDropZone/FileDropZone.d.ts +2 -2
- package/dist/cjs/FileDropZone/FileDropZone.js +5 -8
- package/dist/cjs/FileDropZone/FileDropZone.test.js +5 -5
- package/dist/cjs/LoadingMessage/LoadingMessage.d.ts +2 -2
- package/dist/cjs/LoadingMessage/LoadingMessage.js +2 -10
- package/dist/cjs/LoadingMessage/LoadingMessage.test.js +6 -6
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +1 -2
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +10 -15
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.d.ts +1 -2
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +5 -8
- package/dist/cjs/Message/ImageMessage/ImageMessage.d.ts +1 -2
- package/dist/cjs/Message/ImageMessage/ImageMessage.js +2 -8
- package/dist/cjs/Message/LinkMessage/LinkMessage.d.ts +1 -2
- package/dist/cjs/Message/LinkMessage/LinkMessage.js +6 -9
- package/dist/cjs/Message/ListMessage/ListItemMessage.d.ts +1 -2
- package/dist/cjs/Message/ListMessage/ListItemMessage.js +2 -8
- package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +1 -2
- package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -9
- package/dist/cjs/Message/ListMessage/UnorderedListMessage.d.ts +1 -2
- package/dist/cjs/Message/ListMessage/UnorderedListMessage.js +2 -9
- package/dist/cjs/Message/Message.d.ts +8 -7
- package/dist/cjs/Message/Message.js +47 -70
- package/dist/cjs/Message/Message.test.js +75 -79
- package/dist/cjs/Message/MessageInput.d.ts +2 -2
- package/dist/cjs/Message/MessageInput.js +5 -14
- package/dist/cjs/Message/MessageLoading.d.ts +1 -2
- package/dist/cjs/Message/MessageLoading.js +3 -8
- package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +2 -2
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +7 -9
- package/dist/cjs/Message/QuickStarts/FallbackImg.d.ts +2 -2
- package/dist/cjs/Message/QuickStarts/FallbackImg.js +5 -27
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +2 -2
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +7 -43
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.d.ts +2 -2
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +9 -38
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +16 -16
- package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.d.ts +2 -2
- package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.js +2 -26
- package/dist/cjs/Message/QuickStarts/types.d.ts +4 -3
- package/dist/cjs/Message/TableMessage/TableMessage.d.ts +1 -2
- package/dist/cjs/Message/TableMessage/TableMessage.js +8 -10
- package/dist/cjs/Message/TableMessage/TbodyMessage.d.ts +2 -3
- package/dist/cjs/Message/TableMessage/TbodyMessage.js +7 -9
- package/dist/cjs/Message/TableMessage/TdMessage.d.ts +1 -2
- package/dist/cjs/Message/TableMessage/TdMessage.js +2 -8
- package/dist/cjs/Message/TableMessage/ThMessage.d.ts +1 -2
- package/dist/cjs/Message/TableMessage/ThMessage.js +2 -8
- package/dist/cjs/Message/TableMessage/TheadMessage.d.ts +1 -2
- package/dist/cjs/Message/TableMessage/TheadMessage.js +2 -8
- package/dist/cjs/Message/TableMessage/TrMessage.d.ts +2 -3
- package/dist/cjs/Message/TableMessage/TrMessage.js +8 -10
- package/dist/cjs/Message/TextMessage/TextMessage.d.ts +1 -2
- package/dist/cjs/Message/TextMessage/TextMessage.js +2 -9
- package/dist/cjs/Message/UserFeedback/CloseButton.d.ts +2 -2
- package/dist/cjs/Message/UserFeedback/CloseButton.js +2 -8
- package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +2 -2
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +12 -23
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +53 -53
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +20 -44
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +81 -91
- package/dist/cjs/MessageBar/AttachButton.d.ts +1 -2
- package/dist/cjs/MessageBar/AttachButton.js +6 -15
- package/dist/cjs/MessageBar/AttachButton.test.js +24 -24
- package/dist/cjs/MessageBar/MessageBar.d.ts +2 -2
- package/dist/cjs/MessageBar/MessageBar.js +21 -27
- package/dist/cjs/MessageBar/MessageBar.test.js +101 -115
- package/dist/cjs/MessageBar/MicrophoneButton.d.ts +2 -2
- package/dist/cjs/MessageBar/MicrophoneButton.js +7 -14
- package/dist/cjs/MessageBar/SendButton.d.ts +3 -2
- package/dist/cjs/MessageBar/SendButton.js +3 -11
- package/dist/cjs/MessageBar/SendButton.test.js +15 -15
- package/dist/cjs/MessageBar/StopButton.d.ts +3 -2
- package/dist/cjs/MessageBar/StopButton.js +3 -12
- package/dist/cjs/MessageBar/StopButton.test.js +15 -15
- package/dist/cjs/MessageBox/JumpButton.d.ts +2 -2
- package/dist/cjs/MessageBox/JumpButton.js +2 -10
- package/dist/cjs/MessageBox/JumpButton.test.js +10 -10
- package/dist/cjs/MessageBox/MessageBox.d.ts +3 -3
- package/dist/cjs/MessageBox/MessageBox.js +13 -20
- package/dist/cjs/MessageBox/MessageBox.test.js +7 -10
- package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +12 -2
- package/dist/cjs/PreviewAttachment/PreviewAttachment.js +3 -6
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +1 -1
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +34 -12
- package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +3 -3
- package/dist/cjs/ResponseActions/ResponseActionButton.js +5 -8
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +19 -19
- package/dist/cjs/ResponseActions/ResponseActions.d.ts +2 -2
- package/dist/cjs/ResponseActions/ResponseActions.js +10 -14
- package/dist/cjs/ResponseActions/ResponseActions.test.js +42 -42
- package/dist/cjs/Settings/SettingsForm.d.ts +2 -2
- package/dist/cjs/Settings/SettingsForm.js +2 -8
- package/dist/cjs/Settings/SettingsForm.test.js +9 -12
- package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +2 -2
- package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.js +2 -11
- package/dist/cjs/SourcesCard/SourcesCard.d.ts +2 -2
- package/dist/cjs/SourcesCard/SourcesCard.js +16 -42
- package/dist/cjs/SourcesCard/SourcesCard.test.js +60 -60
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +3 -3
- package/dist/cjs/TermsOfUse/TermsOfUse.js +4 -16
- package/dist/cjs/TermsOfUse/TermsOfUse.test.js +31 -33
- package/dist/esm/AttachMenu/AttachMenu.d.ts +2 -2
- package/dist/esm/AttachMenu/AttachMenu.js +2 -9
- package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +12 -2
- package/dist/esm/AttachmentEdit/AttachmentEdit.js +3 -6
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +1 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +30 -5
- package/dist/esm/Chatbot/Chatbot.d.ts +1 -2
- package/dist/esm/Chatbot/Chatbot.js +4 -6
- package/dist/esm/Chatbot/Chatbot.test.js +6 -6
- package/dist/esm/ChatbotAlert/ChatbotAlert.d.ts +2 -2
- package/dist/esm/ChatbotAlert/ChatbotAlert.js +4 -5
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +4 -4
- package/dist/esm/ChatbotContent/ChatbotContent.d.ts +3 -3
- package/dist/esm/ChatbotContent/ChatbotContent.js +2 -5
- package/dist/esm/ChatbotContent/ChatbotContent.test.js +3 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +7 -11
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +8 -10
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +16 -33
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +26 -34
- package/dist/esm/ChatbotConversationHistoryNav/EmptyState.d.ts +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/EmptyState.js +2 -6
- package/dist/esm/ChatbotConversationHistoryNav/LoadingState.d.ts +2 -2
- package/dist/esm/ChatbotConversationHistoryNav/LoadingState.js +2 -22
- package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +3 -3
- package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -12
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +4 -4
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +5 -5
- package/dist/esm/ChatbotFooter/ChatbotFootnote.d.ts +3 -3
- package/dist/esm/ChatbotFooter/ChatbotFootnote.js +10 -23
- package/dist/esm/ChatbotHeader/ChatbotHeader.d.ts +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeader.js +2 -4
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.d.ts +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.js +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +1 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +5 -7
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +4 -4
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.d.ts +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +5 -7
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +4 -4
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +6 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +9 -8
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +6 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +9 -9
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +9 -8
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.d.ts +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.js +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +12 -12
- package/dist/esm/ChatbotModal/ChatbotModal.d.ts +2 -2
- package/dist/esm/ChatbotModal/ChatbotModal.js +3 -6
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +2 -14
- package/dist/esm/ChatbotPopover/ChatbotPopover.d.ts +2 -2
- package/dist/esm/ChatbotPopover/ChatbotPopover.js +2 -5
- package/dist/esm/ChatbotToggle/ChatbotToggle.d.ts +1 -2
- package/dist/esm/ChatbotToggle/ChatbotToggle.js +8 -13
- package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +8 -8
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +2 -2
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +6 -17
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +8 -8
- package/dist/esm/CodeModal/CodeModal.d.ts +8 -2
- package/dist/esm/CodeModal/CodeModal.js +8 -20
- package/dist/esm/CodeModal/CodeModal.test.js +22 -3
- package/dist/esm/Compare/Compare.d.ts +2 -2
- package/dist/esm/Compare/Compare.js +7 -13
- package/dist/esm/Compare/Compare.test.js +4 -6
- package/dist/esm/FileDetails/FileDetails.d.ts +2 -2
- package/dist/esm/FileDetails/FileDetails.js +2 -15
- package/dist/esm/FileDetails/FileDetails.test.js +4 -4
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.d.ts +2 -2
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.js +2 -5
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +9 -9
- package/dist/esm/FileDropZone/FileDropZone.d.ts +2 -2
- package/dist/esm/FileDropZone/FileDropZone.js +5 -5
- package/dist/esm/FileDropZone/FileDropZone.test.js +3 -3
- package/dist/esm/LoadingMessage/LoadingMessage.d.ts +2 -2
- package/dist/esm/LoadingMessage/LoadingMessage.js +2 -10
- package/dist/esm/LoadingMessage/LoadingMessage.test.js +3 -3
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +1 -2
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +10 -15
- package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +1 -2
- package/dist/esm/Message/ErrorMessage/ErrorMessage.js +5 -5
- package/dist/esm/Message/ImageMessage/ImageMessage.d.ts +1 -2
- package/dist/esm/Message/ImageMessage/ImageMessage.js +2 -5
- package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +1 -2
- package/dist/esm/Message/LinkMessage/LinkMessage.js +6 -6
- package/dist/esm/Message/ListMessage/ListItemMessage.d.ts +1 -2
- package/dist/esm/Message/ListMessage/ListItemMessage.js +2 -5
- package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +1 -2
- package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -6
- package/dist/esm/Message/ListMessage/UnorderedListMessage.d.ts +1 -2
- package/dist/esm/Message/ListMessage/UnorderedListMessage.js +2 -6
- package/dist/esm/Message/Message.d.ts +8 -7
- package/dist/esm/Message/Message.js +47 -70
- package/dist/esm/Message/Message.test.js +75 -79
- package/dist/esm/Message/MessageInput.d.ts +2 -2
- package/dist/esm/Message/MessageInput.js +5 -11
- package/dist/esm/Message/MessageLoading.d.ts +1 -2
- package/dist/esm/Message/MessageLoading.js +2 -4
- package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +2 -2
- package/dist/esm/Message/QuickResponse/QuickResponse.js +7 -6
- package/dist/esm/Message/QuickStarts/FallbackImg.d.ts +2 -2
- package/dist/esm/Message/QuickStarts/FallbackImg.js +5 -4
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +2 -2
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +7 -20
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.d.ts +2 -2
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +9 -15
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +5 -5
- package/dist/esm/Message/QuickStarts/QuickStartTileHeader.d.ts +2 -2
- package/dist/esm/Message/QuickStarts/QuickStartTileHeader.js +2 -3
- package/dist/esm/Message/QuickStarts/types.d.ts +4 -3
- package/dist/esm/Message/TableMessage/TableMessage.d.ts +1 -2
- package/dist/esm/Message/TableMessage/TableMessage.js +8 -7
- package/dist/esm/Message/TableMessage/TbodyMessage.d.ts +2 -3
- package/dist/esm/Message/TableMessage/TbodyMessage.js +7 -6
- package/dist/esm/Message/TableMessage/TdMessage.d.ts +1 -2
- package/dist/esm/Message/TableMessage/TdMessage.js +2 -5
- package/dist/esm/Message/TableMessage/ThMessage.d.ts +1 -2
- package/dist/esm/Message/TableMessage/ThMessage.js +2 -5
- package/dist/esm/Message/TableMessage/TheadMessage.d.ts +1 -2
- package/dist/esm/Message/TableMessage/TheadMessage.js +2 -5
- package/dist/esm/Message/TableMessage/TrMessage.d.ts +2 -3
- package/dist/esm/Message/TableMessage/TrMessage.js +8 -7
- package/dist/esm/Message/TextMessage/TextMessage.d.ts +1 -2
- package/dist/esm/Message/TextMessage/TextMessage.js +2 -6
- package/dist/esm/Message/UserFeedback/CloseButton.d.ts +2 -2
- package/dist/esm/Message/UserFeedback/CloseButton.js +2 -5
- package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +2 -2
- package/dist/esm/Message/UserFeedback/UserFeedback.js +12 -23
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +21 -21
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +20 -44
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +26 -36
- package/dist/esm/MessageBar/AttachButton.d.ts +1 -2
- package/dist/esm/MessageBar/AttachButton.js +6 -12
- package/dist/esm/MessageBar/AttachButton.test.js +10 -10
- package/dist/esm/MessageBar/MessageBar.d.ts +2 -2
- package/dist/esm/MessageBar/MessageBar.js +21 -27
- package/dist/esm/MessageBar/MessageBar.test.js +34 -48
- package/dist/esm/MessageBar/MicrophoneButton.d.ts +2 -2
- package/dist/esm/MessageBar/MicrophoneButton.js +7 -11
- package/dist/esm/MessageBar/SendButton.d.ts +3 -2
- package/dist/esm/MessageBar/SendButton.js +3 -8
- package/dist/esm/MessageBar/SendButton.test.js +4 -4
- package/dist/esm/MessageBar/StopButton.d.ts +3 -2
- package/dist/esm/MessageBar/StopButton.js +3 -9
- package/dist/esm/MessageBar/StopButton.test.js +4 -4
- package/dist/esm/MessageBox/JumpButton.d.ts +2 -2
- package/dist/esm/MessageBox/JumpButton.js +2 -7
- package/dist/esm/MessageBox/JumpButton.test.js +5 -5
- package/dist/esm/MessageBox/MessageBox.d.ts +3 -3
- package/dist/esm/MessageBox/MessageBox.js +13 -20
- package/dist/esm/MessageBox/MessageBox.test.js +7 -10
- package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +12 -2
- package/dist/esm/PreviewAttachment/PreviewAttachment.js +3 -6
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +1 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +30 -5
- package/dist/esm/ResponseActions/ResponseActionButton.d.ts +3 -3
- package/dist/esm/ResponseActions/ResponseActionButton.js +5 -5
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +7 -7
- package/dist/esm/ResponseActions/ResponseActions.d.ts +2 -2
- package/dist/esm/ResponseActions/ResponseActions.js +10 -14
- package/dist/esm/ResponseActions/ResponseActions.test.js +15 -15
- package/dist/esm/Settings/SettingsForm.d.ts +2 -2
- package/dist/esm/Settings/SettingsForm.js +2 -5
- package/dist/esm/Settings/SettingsForm.test.js +6 -6
- package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +2 -2
- package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.js +2 -8
- package/dist/esm/SourcesCard/SourcesCard.d.ts +2 -2
- package/dist/esm/SourcesCard/SourcesCard.js +16 -39
- package/dist/esm/SourcesCard/SourcesCard.test.js +19 -19
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +3 -3
- package/dist/esm/TermsOfUse/TermsOfUse.js +4 -16
- package/dist/esm/TermsOfUse/TermsOfUse.test.js +10 -12
- package/package.json +3 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachMenu.tsx +9 -9
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +10 -12
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetails.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +9 -9
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDropZone.tsx +4 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithAttachment.tsx +7 -7
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +4 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedbackTimeout.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +11 -14
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +4 -4
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotContainer.tsx +59 -36
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +10 -13
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +10 -10
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerNavigation.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +4 -4
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderTitle.tsx +59 -34
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBar.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +9 -9
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarLanguage.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarStop.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotModal.tsx +74 -37
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotToggleBasic.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomeInteraction.tsx +7 -7
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomePrompt.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +16 -23
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CustomClosedIcon.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +16 -23
- package/patternfly-docs/content/extensions/chatbot/examples/UI/SkipToContent.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/SquareChatbotToggle.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +91 -48
- package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUseCompact.tsx +82 -39
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +3 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +17 -23
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +13 -13
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +14 -14
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +17 -23
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +15 -20
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +15 -20
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +12 -12
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +7 -7
- package/src/AttachMenu/AttachMenu.tsx +2 -2
- package/src/AttachmentEdit/AttachmentEdit.test.tsx +46 -2
- package/src/AttachmentEdit/AttachmentEdit.tsx +25 -7
- package/src/Chatbot/Chatbot.test.tsx +0 -1
- package/src/Chatbot/Chatbot.tsx +5 -3
- package/src/ChatbotAlert/ChatbotAlert.test.tsx +0 -1
- package/src/ChatbotAlert/ChatbotAlert.tsx +2 -2
- package/src/ChatbotContent/ChatbotContent.test.tsx +0 -1
- package/src/ChatbotContent/ChatbotContent.tsx +3 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx +0 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +6 -4
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +3 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +8 -6
- package/src/ChatbotConversationHistoryNav/EmptyState.tsx +2 -2
- package/src/ChatbotConversationHistoryNav/LoadingState.tsx +2 -2
- package/src/ChatbotFooter/ChatbotFooter.test.tsx +0 -1
- package/src/ChatbotFooter/ChatbotFooter.tsx +3 -3
- package/src/ChatbotFooter/ChatbotFooternote.test.tsx +0 -1
- package/src/ChatbotFooter/ChatbotFootnote.tsx +6 -4
- package/src/ChatbotHeader/ChatbotHeader.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeader.tsx +3 -6
- package/src/ChatbotHeader/ChatbotHeaderActions.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderActions.tsx +2 -2
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +5 -4
- package/src/ChatbotHeader/ChatbotHeaderMain.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderMain.tsx +2 -2
- package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +7 -7
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +9 -1
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +12 -5
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +9 -1
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +20 -6
- package/src/ChatbotHeader/ChatbotHeaderTitle.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderTitle.tsx +2 -2
- package/src/ChatbotModal/ChatbotModal.test.tsx +0 -1
- package/src/ChatbotModal/ChatbotModal.tsx +2 -2
- package/src/ChatbotPopover/ChatbotPopover.tsx +3 -3
- package/src/ChatbotToggle/ChatbotToggle.test.tsx +0 -1
- package/src/ChatbotToggle/ChatbotToggle.tsx +5 -3
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +0 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +2 -2
- package/src/CodeModal/CodeModal.test.tsx +29 -2
- package/src/CodeModal/CodeModal.tsx +18 -8
- package/src/Compare/Compare.test.tsx +0 -1
- package/src/Compare/Compare.tsx +7 -6
- package/src/FileDetails/FileDetails.test.tsx +0 -1
- package/src/FileDetails/FileDetails.tsx +1 -1
- package/src/FileDetailsLabel/FileDetailsLabel.test.tsx +0 -1
- package/src/FileDetailsLabel/FileDetailsLabel.tsx +1 -1
- package/src/FileDropZone/FileDropZone.test.tsx +0 -1
- package/src/FileDropZone/FileDropZone.tsx +4 -3
- package/src/LoadingMessage/LoadingMessage.test.tsx +0 -1
- package/src/LoadingMessage/LoadingMessage.tsx +2 -2
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +7 -7
- package/src/Message/ErrorMessage/ErrorMessage.tsx +0 -1
- package/src/Message/ImageMessage/ImageMessage.tsx +1 -2
- package/src/Message/LinkMessage/LinkMessage.tsx +0 -1
- package/src/Message/ListMessage/ListItemMessage.tsx +0 -1
- package/src/Message/ListMessage/OrderedListMessage.tsx +0 -1
- package/src/Message/ListMessage/UnorderedListMessage.tsx +0 -1
- package/src/Message/Message.test.tsx +3 -3
- package/src/Message/Message.tsx +12 -13
- package/src/Message/MessageInput.tsx +5 -5
- package/src/Message/MessageLoading.tsx +0 -2
- package/src/Message/QuickResponse/QuickResponse.tsx +4 -3
- package/src/Message/QuickStarts/FallbackImg.tsx +4 -3
- package/src/Message/QuickStarts/QuickStartTile.tsx +3 -3
- package/src/Message/QuickStarts/QuickStartTileDescription.test.tsx +0 -1
- package/src/Message/QuickStarts/QuickStartTileDescription.tsx +4 -3
- package/src/Message/QuickStarts/QuickStartTileHeader.tsx +2 -2
- package/src/Message/QuickStarts/types.ts +4 -3
- package/src/Message/TableMessage/TableMessage.tsx +4 -4
- package/src/Message/TableMessage/TbodyMessage.tsx +3 -3
- package/src/Message/TableMessage/TdMessage.tsx +1 -2
- package/src/Message/TableMessage/ThMessage.tsx +1 -2
- package/src/Message/TableMessage/TheadMessage.tsx +3 -2
- package/src/Message/TableMessage/TrMessage.tsx +4 -4
- package/src/Message/TextMessage/TextMessage.tsx +1 -2
- package/src/Message/UserFeedback/CloseButton.tsx +2 -2
- package/src/Message/UserFeedback/UserFeedback.test.tsx +0 -1
- package/src/Message/UserFeedback/UserFeedback.tsx +8 -6
- package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +0 -1
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +16 -14
- package/src/MessageBar/AttachButton.test.tsx +0 -1
- package/src/MessageBar/AttachButton.tsx +5 -3
- package/src/MessageBar/MessageBar.test.tsx +0 -1
- package/src/MessageBar/MessageBar.tsx +19 -18
- package/src/MessageBar/MicrophoneButton.tsx +8 -6
- package/src/MessageBar/SendButton.test.tsx +0 -1
- package/src/MessageBar/SendButton.tsx +3 -2
- package/src/MessageBar/StopButton.test.tsx +0 -1
- package/src/MessageBar/StopButton.tsx +3 -2
- package/src/MessageBox/JumpButton.test.tsx +0 -1
- package/src/MessageBox/JumpButton.tsx +2 -2
- package/src/MessageBox/MessageBox.test.tsx +2 -2
- package/src/MessageBox/MessageBox.tsx +15 -13
- package/src/PreviewAttachment/PreviewAttachment.test.tsx +44 -2
- package/src/PreviewAttachment/PreviewAttachment.tsx +24 -6
- package/src/ResponseActions/ResponseActionButton.test.tsx +0 -1
- package/src/ResponseActions/ResponseActionButton.tsx +4 -3
- package/src/ResponseActions/ResponseActions.test.tsx +0 -1
- package/src/ResponseActions/ResponseActions.tsx +8 -7
- package/src/Settings/SettingsForm.test.tsx +0 -1
- package/src/Settings/SettingsForm.tsx +2 -7
- package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx +2 -2
- package/src/SourcesCard/SourcesCard.test.tsx +0 -1
- package/src/SourcesCard/SourcesCard.tsx +7 -7
- package/src/TermsOfUse/TermsOfUse.test.tsx +0 -1
- package/src/TermsOfUse/TermsOfUse.tsx +6 -5
- package/tsconfig.cjs.json +0 -1
- package/tsconfig.json +3 -3
@@ -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
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
import { render, screen } from '@testing-library/react';
|
12
12
|
import '@testing-library/jest-dom';
|
13
13
|
import userEvent from '@testing-library/user-event';
|
14
14
|
import { SendButton } from './SendButton';
|
15
15
|
const renderSend = (props) => {
|
16
16
|
const spy = jest.fn();
|
17
|
-
render(
|
17
|
+
render(_jsx(SendButton, Object.assign({ onClick: spy }, props)));
|
18
18
|
};
|
19
19
|
describe('Send button', () => {
|
20
20
|
it('should render button correctly', () => {
|
@@ -23,13 +23,13 @@ describe('Send button', () => {
|
|
23
23
|
});
|
24
24
|
it('should handle onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
25
25
|
const spy = jest.fn();
|
26
|
-
render(
|
26
|
+
render(_jsx(SendButton, { onClick: spy }));
|
27
27
|
yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
28
28
|
expect(screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
|
29
29
|
expect(spy).toHaveBeenCalledTimes(1);
|
30
30
|
}));
|
31
31
|
it('should handle custom tooltip correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
32
|
-
render(
|
32
|
+
render(_jsx(SendButton, { onClick: jest.fn, tooltipContent: "Test" }));
|
33
33
|
yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
34
34
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
35
35
|
}));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { FunctionComponent } from 'react';
|
2
2
|
import { ButtonProps, TooltipProps } from '@patternfly/react-core';
|
3
3
|
export interface StopButtonProps extends ButtonProps {
|
4
4
|
/** Callback for when button is clicked */
|
@@ -9,7 +9,8 @@ export interface StopButtonProps extends ButtonProps {
|
|
9
9
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
10
10
|
/** English text "Stop" used in the tooltip */
|
11
11
|
tooltipContent?: string;
|
12
|
+
/** Whether stop button has compact styling */
|
12
13
|
isCompact?: boolean;
|
13
14
|
}
|
14
|
-
export declare const StopButton:
|
15
|
+
export declare const StopButton: FunctionComponent<StopButtonProps>;
|
15
16
|
export default StopButton;
|
@@ -9,19 +9,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
|
13
|
-
// Chatbot Footer - Message Bar - Stop
|
14
|
-
// ============================================================================
|
15
|
-
import React from 'react';
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
16
13
|
// Import PatternFly components
|
17
14
|
import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
18
15
|
export const StopButton = (_a) => {
|
19
16
|
var { className, onClick, tooltipProps, tooltipContent = 'Stop', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent", "isCompact"]);
|
20
|
-
return (
|
17
|
+
return (_jsx(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
18
|
// prevents VO announcements of both aria label and tooltip
|
22
|
-
aria: "none" }, tooltipProps),
|
23
|
-
React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop', onClick: onClick, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
24
|
-
React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
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" }))), size: isCompact ? 'sm' : undefined }, props))));
|
19
|
+
aria: "none" }, tooltipProps, { children: _jsx(Button, Object.assign({ className: `pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop', onClick: onClick, icon: _jsx(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("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" }) }) }), size: isCompact ? 'sm' : undefined }, props)) })));
|
26
20
|
};
|
27
21
|
export default StopButton;
|
@@ -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
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
import { render, screen } from '@testing-library/react';
|
12
12
|
import '@testing-library/jest-dom';
|
13
13
|
import userEvent from '@testing-library/user-event';
|
14
14
|
import { StopButton } from './StopButton';
|
15
15
|
const renderStop = (props) => {
|
16
16
|
const spy = jest.fn();
|
17
|
-
render(
|
17
|
+
render(_jsx(StopButton, Object.assign({ onClick: spy }, props)));
|
18
18
|
};
|
19
19
|
describe('Stop button', () => {
|
20
20
|
it('should render button correctly', () => {
|
@@ -23,13 +23,13 @@ describe('Stop button', () => {
|
|
23
23
|
});
|
24
24
|
it('should handle onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
25
25
|
const spy = jest.fn();
|
26
|
-
render(
|
26
|
+
render(_jsx(StopButton, { onClick: spy }));
|
27
27
|
yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
28
28
|
expect(screen.getByRole('tooltip', { name: 'Stop' })).toBeTruthy();
|
29
29
|
expect(spy).toHaveBeenCalledTimes(1);
|
30
30
|
}));
|
31
31
|
it('should handle custom tooltip correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
32
|
-
render(
|
32
|
+
render(_jsx(StopButton, { onClick: jest.fn, tooltipContent: "Test" }));
|
33
33
|
yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
34
34
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
35
35
|
}));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { FunctionComponent } from 'react';
|
2
2
|
export interface JumpButtonProps {
|
3
3
|
/** Position of the Jump Button(top/bottom) */
|
4
4
|
position: 'top' | 'bottom';
|
@@ -7,5 +7,5 @@ export interface JumpButtonProps {
|
|
7
7
|
/** Flag to change the visibilty of the button */
|
8
8
|
isHidden?: boolean;
|
9
9
|
}
|
10
|
-
declare const JumpButton:
|
10
|
+
declare const JumpButton: FunctionComponent<JumpButtonProps>;
|
11
11
|
export default JumpButton;
|
@@ -1,12 +1,7 @@
|
|
1
|
-
|
2
|
-
// Chatbot Main - Messages - Jump to Top
|
3
|
-
// ============================================================================
|
4
|
-
import React from 'react';
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
2
|
// Import PatternFly components
|
6
3
|
import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
7
4
|
import { ArrowUpIcon } from '@patternfly/react-icons/dist/esm/icons/arrow-up-icon';
|
8
5
|
import { ArrowDownIcon } from '@patternfly/react-icons/dist/esm/icons/arrow-down-icon';
|
9
|
-
const JumpButton = ({ position, isHidden, onClick }) => isHidden ? null : (
|
10
|
-
React.createElement(Button, { variant: "plain", className: `pf-chatbot__jump pf-chatbot__jump--${position}`, "aria-label": `Jump ${position}`, onClick: onClick },
|
11
|
-
React.createElement(Icon, { iconSize: "lg", isInline: true }, position === 'top' ? React.createElement(ArrowUpIcon, null) : React.createElement(ArrowDownIcon, null)))));
|
6
|
+
const JumpButton = ({ position, isHidden, onClick }) => isHidden ? null : (_jsx(Tooltip, { id: `pf-chatbot__tooltip--jump-${position}`, content: `Back to ${position}`, position: "top", children: _jsx(Button, { variant: "plain", className: `pf-chatbot__jump pf-chatbot__jump--${position}`, "aria-label": `Jump ${position}`, onClick: onClick, children: _jsx(Icon, { iconSize: "lg", isInline: true, children: position === 'top' ? _jsx(ArrowUpIcon, {}) : _jsx(ArrowDownIcon, {}) }) }) }));
|
12
7
|
export default JumpButton;
|
@@ -7,28 +7,28 @@ 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
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
import { render, screen } from '@testing-library/react';
|
12
12
|
import '@testing-library/jest-dom';
|
13
13
|
import JumpButton from './JumpButton';
|
14
14
|
import userEvent from '@testing-library/user-event';
|
15
15
|
describe('JumpButton', () => {
|
16
16
|
it('should render top button correctly', () => {
|
17
|
-
render(
|
17
|
+
render(_jsx(JumpButton, { position: "top", onClick: jest.fn() }));
|
18
18
|
expect(screen.getByRole('button', { name: /Jump top/i })).toBeTruthy();
|
19
19
|
});
|
20
20
|
it('should render bottom button correctly', () => {
|
21
|
-
render(
|
21
|
+
render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn() }));
|
22
22
|
expect(screen.getByRole('button', { name: /Jump bottom/i })).toBeTruthy();
|
23
23
|
});
|
24
24
|
it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
25
25
|
const spy = jest.fn();
|
26
|
-
render(
|
26
|
+
render(_jsx(JumpButton, { position: "bottom", onClick: spy }));
|
27
27
|
yield userEvent.click(screen.getByRole('button', { name: /Jump bottom/i }));
|
28
28
|
expect(spy).toHaveBeenCalledTimes(1);
|
29
29
|
}));
|
30
30
|
it('should be hidden if isHidden prop is used', () => __awaiter(void 0, void 0, void 0, function* () {
|
31
|
-
render(
|
31
|
+
render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn(), isHidden: true }));
|
32
32
|
expect(screen.queryByRole('button', { name: /Jump bottom/i })).toBeFalsy();
|
33
33
|
}));
|
34
34
|
});
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
2
|
-
export interface MessageBoxProps extends
|
1
|
+
import type { HTMLProps } from 'react';
|
2
|
+
export interface MessageBoxProps extends HTMLProps<HTMLDivElement> {
|
3
3
|
/** Content that can be announced, such as a new message, for screen readers */
|
4
4
|
announcement?: string;
|
5
5
|
/** Custom aria-label for scrollable portion of message box */
|
@@ -17,5 +17,5 @@ export interface MessageBoxProps extends React.HTMLProps<HTMLDivElement> {
|
|
17
17
|
/** Click handler for additional logic for when scroll to bottom jump button is clicked */
|
18
18
|
onScrollToBottomClick?: () => void;
|
19
19
|
}
|
20
|
-
export declare const MessageBox:
|
20
|
+
export declare const MessageBox: import("react").ForwardRefExoticComponent<Omit<MessageBoxProps, "ref"> & import("react").RefAttributes<any>>;
|
21
21
|
export default MessageBox;
|
@@ -9,17 +9,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
|
13
|
-
|
14
|
-
// ============================================================================
|
15
|
-
import React from 'react';
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
13
|
+
import { useState, useRef, useCallback, useEffect, forwardRef } from 'react';
|
16
14
|
import JumpButton from './JumpButton';
|
17
15
|
const MessageBoxBase = (_a) => {
|
18
16
|
var { announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top', onScrollToTopClick, onScrollToBottomClick } = _a, props = __rest(_a, ["announcement", "ariaLabel", "children", "innerRef", "className", "position", "onScrollToTopClick", "onScrollToBottomClick"]);
|
19
|
-
const [atTop, setAtTop] =
|
20
|
-
const [atBottom, setAtBottom] =
|
21
|
-
const [isOverflowing, setIsOverflowing] =
|
22
|
-
const defaultRef =
|
17
|
+
const [atTop, setAtTop] = useState(false);
|
18
|
+
const [atBottom, setAtBottom] = useState(true);
|
19
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
20
|
+
const defaultRef = useRef(null);
|
23
21
|
let messageBoxRef;
|
24
22
|
if (innerRef) {
|
25
23
|
messageBoxRef = innerRef;
|
@@ -28,7 +26,7 @@ const MessageBoxBase = (_a) => {
|
|
28
26
|
messageBoxRef = defaultRef;
|
29
27
|
}
|
30
28
|
// Configure handlers
|
31
|
-
const handleScroll =
|
29
|
+
const handleScroll = useCallback(() => {
|
32
30
|
const element = messageBoxRef.current;
|
33
31
|
if (element) {
|
34
32
|
const { scrollTop, scrollHeight, clientHeight } = element;
|
@@ -36,21 +34,21 @@ const MessageBoxBase = (_a) => {
|
|
36
34
|
setAtBottom(Math.round(scrollTop) + Math.round(clientHeight) >= Math.round(scrollHeight) - 1); // rounding means it could be within a pixel of the bottom
|
37
35
|
}
|
38
36
|
}, [messageBoxRef]);
|
39
|
-
const checkOverflow =
|
37
|
+
const checkOverflow = useCallback(() => {
|
40
38
|
const element = messageBoxRef.current;
|
41
39
|
if (element) {
|
42
40
|
const { scrollHeight, clientHeight } = element;
|
43
41
|
setIsOverflowing(scrollHeight >= clientHeight);
|
44
42
|
}
|
45
43
|
}, [messageBoxRef]);
|
46
|
-
const scrollToTop =
|
44
|
+
const scrollToTop = useCallback(() => {
|
47
45
|
const element = messageBoxRef.current;
|
48
46
|
if (element) {
|
49
47
|
element.scrollTo({ top: 0, behavior: 'smooth' });
|
50
48
|
}
|
51
49
|
onScrollToTopClick && onScrollToTopClick();
|
52
50
|
}, [messageBoxRef]);
|
53
|
-
const scrollToBottom =
|
51
|
+
const scrollToBottom = useCallback(() => {
|
54
52
|
const element = messageBoxRef.current;
|
55
53
|
if (element) {
|
56
54
|
element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
|
@@ -58,7 +56,7 @@ const MessageBoxBase = (_a) => {
|
|
58
56
|
onScrollToBottomClick && onScrollToBottomClick();
|
59
57
|
}, [messageBoxRef]);
|
60
58
|
// Detect scroll position
|
61
|
-
|
59
|
+
useEffect(() => {
|
62
60
|
const element = messageBoxRef.current;
|
63
61
|
if (element) {
|
64
62
|
// Listen for scroll events
|
@@ -71,12 +69,7 @@ const MessageBoxBase = (_a) => {
|
|
71
69
|
};
|
72
70
|
}
|
73
71
|
}, [checkOverflow, handleScroll, messageBoxRef]);
|
74
|
-
return (
|
75
|
-
React.createElement(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }),
|
76
|
-
React.createElement("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef }, props),
|
77
|
-
children,
|
78
|
-
React.createElement("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite" }, announcement)),
|
79
|
-
React.createElement(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })));
|
72
|
+
return (_jsxs(_Fragment, { children: [_jsx(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }), _jsxs("div", Object.assign({ role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef }, props, { children: [children, _jsx("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite", children: announcement })] })), _jsx(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })] }));
|
80
73
|
};
|
81
|
-
export const MessageBox =
|
74
|
+
export const MessageBox = forwardRef((props, ref) => (_jsx(MessageBoxBase, Object.assign({ innerRef: ref }, props))));
|
82
75
|
export default MessageBox;
|
@@ -7,27 +7,25 @@ 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
|
10
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
11
|
+
import { createRef } from 'react';
|
11
12
|
import { render, screen, waitFor } from '@testing-library/react';
|
12
13
|
import { MessageBox } from './MessageBox';
|
13
14
|
import userEvent from '@testing-library/user-event';
|
14
15
|
describe('MessageBox', () => {
|
15
16
|
it('should render Message box', () => {
|
16
|
-
render(
|
17
|
-
React.createElement(React.Fragment, null, "Chatbot Messages")));
|
17
|
+
render(_jsx(MessageBox, { children: _jsx(_Fragment, { children: "Chatbot Messages" }) }));
|
18
18
|
expect(screen.getByText('Chatbot Messages')).toBeTruthy();
|
19
19
|
});
|
20
20
|
it('should assign ref to Message box', () => {
|
21
|
-
const ref =
|
22
|
-
render(
|
23
|
-
React.createElement("div", null, "Test message content")));
|
21
|
+
const ref = createRef();
|
22
|
+
render(_jsx(MessageBox, { ref: ref, children: _jsx("div", { children: "Test message content" }) }));
|
24
23
|
expect(ref.current).not.toBeNull();
|
25
24
|
expect(ref.current).toBeInstanceOf(HTMLDivElement);
|
26
25
|
});
|
27
26
|
it('should call onScrollToBottomClick when scroll to top button is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
28
27
|
const spy = jest.fn();
|
29
|
-
render(
|
30
|
-
React.createElement("div", null, "Test message content")));
|
28
|
+
render(_jsx(MessageBox, { onScrollToBottomClick: spy, children: _jsx("div", { children: "Test message content" }) }));
|
31
29
|
// this forces button to show
|
32
30
|
const region = screen.getByRole('region');
|
33
31
|
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
@@ -41,8 +39,7 @@ describe('MessageBox', () => {
|
|
41
39
|
}));
|
42
40
|
it('should call onScrollToTopClick when scroll to top button is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
43
41
|
const spy = jest.fn();
|
44
|
-
render(
|
45
|
-
React.createElement("div", null, "Test message content")));
|
42
|
+
render(_jsx(MessageBox, { onScrollToTopClick: spy, children: _jsx("div", { children: "Test message content" }) }));
|
46
43
|
// this forces button to show
|
47
44
|
const region = screen.getByRole('region');
|
48
45
|
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { FunctionComponent, MouseEvent } from 'react';
|
2
2
|
import { ChatbotDisplayMode } from '../Chatbot';
|
3
3
|
export interface PreviewAttachmentProps {
|
4
4
|
/** Text shown in code editor */
|
@@ -19,6 +19,16 @@ export interface PreviewAttachmentProps {
|
|
19
19
|
displayMode?: ChatbotDisplayMode;
|
20
20
|
/** Sets modal to compact styling. */
|
21
21
|
isCompact?: boolean;
|
22
|
+
/** Primary action button text */
|
23
|
+
primaryActionButtonText?: string;
|
24
|
+
/** Secondary action button text */
|
25
|
+
secondaryActionButtonText?: string;
|
26
|
+
/** Class applied to modal header */
|
27
|
+
modalHeaderClassName?: string;
|
28
|
+
/** Class applied to modal body */
|
29
|
+
modalBodyClassName?: string;
|
30
|
+
/** Class applied to modal footer */
|
31
|
+
modalFooterClassName?: string;
|
22
32
|
}
|
23
|
-
export declare const PreviewAttachment:
|
33
|
+
export declare const PreviewAttachment: FunctionComponent<PreviewAttachmentProps>;
|
24
34
|
export default PreviewAttachment;
|
@@ -1,10 +1,7 @@
|
|
1
|
-
|
2
|
-
// Preview Attachment - Chatbot Code Snippet Viewer
|
3
|
-
// ============================================================================
|
4
|
-
import React from 'react';
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
2
|
import CodeModal from '../CodeModal';
|
6
3
|
import { ChatbotDisplayMode } from '../Chatbot';
|
7
|
-
export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', displayMode = ChatbotDisplayMode.default, isCompact }) => {
|
4
|
+
export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', primaryActionButtonText = 'Edit', secondaryActionButtonText = 'Dismiss', displayMode = ChatbotDisplayMode.default, modalHeaderClassName, modalBodyClassName, modalFooterClassName, isCompact }) => {
|
8
5
|
const handleEdit = (_event) => {
|
9
6
|
handleModalToggle(_event);
|
10
7
|
onEdit(_event);
|
@@ -13,6 +10,6 @@ export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOp
|
|
13
10
|
handleModalToggle(_event);
|
14
11
|
onDismiss && onDismiss(_event);
|
15
12
|
};
|
16
|
-
return (
|
13
|
+
return (_jsx(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: primaryActionButtonText, secondaryActionBtn: secondaryActionButtonText, title: title, isReadOnly: true, displayMode: displayMode, isCompact: isCompact, modalHeaderClassName: modalHeaderClassName, modalBodyClassName: modalBodyClassName, modalFooterClassName: modalFooterClassName }));
|
17
14
|
};
|
18
15
|
export default PreviewAttachment;
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -1,23 +1,48 @@
|
|
1
|
-
|
2
|
-
|
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 { jsx as _jsx } from "react/jsx-runtime";
|
11
|
+
import { fireEvent, render, screen, within } from '@testing-library/react';
|
12
|
+
import '@testing-library/jest-dom';
|
3
13
|
import { PreviewAttachment } from './PreviewAttachment';
|
4
14
|
describe('PreviewAttachment', () => {
|
5
15
|
it('should render PreviewAttachment', () => {
|
6
|
-
render(
|
16
|
+
render(_jsx(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: jest.fn() }));
|
7
17
|
expect(screen.getByText('Preview attachment')).toBeTruthy();
|
8
18
|
expect(screen.getByText('greetings')).toBeTruthy();
|
9
19
|
expect(screen.getAllByText('TEXT')).toBeTruthy();
|
10
20
|
});
|
11
21
|
it('should call onEdit handler when edit button is pressed', () => {
|
12
22
|
const onEdit = jest.fn();
|
13
|
-
render(
|
23
|
+
render(_jsx(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: onEdit, handleModalToggle: jest.fn() }));
|
14
24
|
fireEvent.click(screen.getByText('Edit'));
|
15
25
|
expect(onEdit).toHaveBeenCalled();
|
16
26
|
});
|
17
27
|
it('should call onDismiss handler when dismiss button is pressed', () => {
|
18
28
|
const onDismiss = jest.fn();
|
19
|
-
render(
|
29
|
+
render(_jsx(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: onDismiss }));
|
20
30
|
fireEvent.click(screen.getByText('Dismiss'));
|
21
31
|
expect(onDismiss).toHaveBeenCalled();
|
22
32
|
});
|
33
|
+
it('should render custom button text for footer actions buttons', () => {
|
34
|
+
render(_jsx(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: jest.fn(), primaryActionButtonText: "Edit", secondaryActionButtonText: "Close" }));
|
35
|
+
screen.getByText('Edit');
|
36
|
+
screen.getByText('Close');
|
37
|
+
});
|
38
|
+
it('should render PreviewAttachment with custom classNames', () => __awaiter(void 0, void 0, void 0, function* () {
|
39
|
+
render(_jsx(PreviewAttachment, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onEdit: jest.fn(), handleModalToggle: jest.fn(), primaryActionButtonText: "Edit", secondaryActionButtonText: "Close", modalHeaderClassName: "custom-header-class", modalBodyClassName: "custom-body-class", modalFooterClassName: "custom-footer-class" }));
|
40
|
+
const modal = screen.getByRole('dialog');
|
41
|
+
const modalHeader = within(modal).getByRole('banner');
|
42
|
+
expect(modalHeader).toHaveClass('custom-header-class');
|
43
|
+
const modalBody = modal.querySelector('#code-modal-body');
|
44
|
+
expect(modalBody).toHaveClass('custom-body-class');
|
45
|
+
const modalfooter = within(modal).getByRole('contentinfo');
|
46
|
+
expect(modalfooter).toHaveClass('custom-footer-class');
|
47
|
+
}));
|
23
48
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { FunctionComponent, MouseEvent } from 'react';
|
2
2
|
import { ButtonProps, TooltipProps } from '@patternfly/react-core';
|
3
3
|
export interface ResponseActionButtonProps extends ButtonProps {
|
4
4
|
/** Aria-label for the button. Defaults to the value of the tooltipContent if none provided */
|
@@ -24,6 +24,6 @@ export interface ResponseActionButtonProps extends ButtonProps {
|
|
24
24
|
/** Ref applied to button */
|
25
25
|
innerRef?: React.Ref<HTMLButtonElement>;
|
26
26
|
}
|
27
|
-
export declare const ResponseActionButtonBase:
|
28
|
-
declare const ResponseActionButton:
|
27
|
+
export declare const ResponseActionButtonBase: FunctionComponent<ResponseActionButtonProps>;
|
28
|
+
declare const ResponseActionButton: import("react").ForwardRefExoticComponent<ResponseActionButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
29
29
|
export default ResponseActionButton;
|
@@ -9,7 +9,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
import
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import { forwardRef } from 'react';
|
13
14
|
import { Button, Icon, Tooltip } from '@patternfly/react-core';
|
14
15
|
export const ResponseActionButtonBase = (_a) => {
|
15
16
|
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"]);
|
@@ -19,10 +20,9 @@ export const ResponseActionButtonBase = (_a) => {
|
|
19
20
|
}
|
20
21
|
return isClicked ? clickedTooltipContent : tooltipContent;
|
21
22
|
};
|
22
|
-
return (
|
23
|
+
return (_jsx(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
24
|
// 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))));
|
25
|
+
aria: "none" }, tooltipProps, { children: _jsx(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: _jsx(Icon, { isInline: true, size: "lg", children: icon }), isDisabled: isDisabled, onClick: onClick, size: "sm", ref: innerRef }, props)) })));
|
26
26
|
};
|
27
|
-
const ResponseActionButton =
|
27
|
+
const ResponseActionButton = forwardRef((props, ref) => (_jsx(ResponseActionButtonBase, Object.assign({ innerRef: ref }, props))));
|
28
28
|
export default ResponseActionButton;
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
8
|
});
|
9
9
|
};
|
10
|
-
import
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
11
11
|
import { render, screen } from '@testing-library/react';
|
12
12
|
import '@testing-library/jest-dom';
|
13
13
|
import userEvent from '@testing-library/user-event';
|
@@ -15,35 +15,35 @@ import { DownloadIcon } from '@patternfly/react-icons';
|
|
15
15
|
import ResponseActionButton from './ResponseActionButton';
|
16
16
|
describe('ResponseActionButton', () => {
|
17
17
|
it('renders aria-label correctly if not clicked', () => {
|
18
|
-
render(
|
18
|
+
render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), ariaLabel: "Download", clickedAriaLabel: "Downloaded" }));
|
19
19
|
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
20
20
|
});
|
21
21
|
it('renders aria-label correctly if clicked', () => {
|
22
|
-
render(
|
22
|
+
render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), ariaLabel: "Download", clickedAriaLabel: "Downloaded", isClicked: true }));
|
23
23
|
expect(screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
|
24
24
|
});
|
25
25
|
it('renders tooltip correctly if not clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
26
|
-
render(
|
26
|
+
render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), tooltipContent: "Download", clickedTooltipContent: "Downloaded" }));
|
27
27
|
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
28
28
|
// clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
|
29
29
|
yield userEvent.click(screen.getByRole('button', { name: 'Download' }));
|
30
30
|
expect(screen.getByRole('tooltip', { name: 'Download' })).toBeTruthy();
|
31
31
|
}));
|
32
32
|
it('renders tooltip correctly if clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
33
|
-
render(
|
33
|
+
render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), tooltipContent: "Download", clickedTooltipContent: "Downloaded", isClicked: true }));
|
34
34
|
expect(screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
|
35
35
|
// clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
|
36
36
|
yield userEvent.click(screen.getByRole('button', { name: 'Downloaded' }));
|
37
37
|
expect(screen.getByRole('tooltip', { name: 'Downloaded' })).toBeTruthy();
|
38
38
|
}));
|
39
39
|
it('if clicked variant for tooltip is not supplied, it uses the default', () => __awaiter(void 0, void 0, void 0, function* () {
|
40
|
-
render(
|
40
|
+
render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), tooltipContent: "Download", isClicked: true }));
|
41
41
|
// clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
|
42
42
|
yield userEvent.click(screen.getByRole('button', { name: 'Download' }));
|
43
43
|
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
44
44
|
}));
|
45
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(
|
46
|
+
render(_jsx(ResponseActionButton, { icon: _jsx(DownloadIcon, {}), ariaLabel: "Download", isClicked: true }));
|
47
47
|
expect(screen.getByRole('button', { name: 'Download' })).toBeTruthy();
|
48
48
|
}));
|
49
49
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { FunctionComponent, MouseEvent } from 'react';
|
2
2
|
import { ButtonProps, TooltipProps } from '@patternfly/react-core';
|
3
3
|
export interface ActionProps extends Omit<ButtonProps, 'ref'> {
|
4
4
|
/** Aria-label for the button */
|
@@ -39,5 +39,5 @@ export interface ResponseActionProps {
|
|
39
39
|
listen?: ActionProps;
|
40
40
|
};
|
41
41
|
}
|
42
|
-
export declare const ResponseActions:
|
42
|
+
export declare const ResponseActions: FunctionComponent<ResponseActionProps>;
|
43
43
|
export default ResponseActions;
|
@@ -9,15 +9,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
import
|
12
|
+
import { createElement as _createElement } from "react";
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
14
|
+
import { useEffect, useRef, useState } from 'react';
|
13
15
|
import { ExternalLinkAltIcon, VolumeUpIcon, OutlinedThumbsUpIcon, OutlinedThumbsDownIcon, OutlinedCopyIcon } from '@patternfly/react-icons';
|
14
16
|
import ResponseActionButton from './ResponseActionButton';
|
15
17
|
export const ResponseActions = ({ actions }) => {
|
16
18
|
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] =
|
19
|
+
const [activeButton, setActiveButton] = useState();
|
18
20
|
const { positive, negative, copy, share, listen } = actions, additionalActions = __rest(actions, ["positive", "negative", "copy", "share", "listen"]);
|
19
|
-
const responseActions =
|
20
|
-
|
21
|
+
const responseActions = useRef(null);
|
22
|
+
useEffect(() => {
|
21
23
|
const handleClickOutside = (e) => {
|
22
24
|
if (responseActions.current && !responseActions.current.contains(e.target)) {
|
23
25
|
setActiveButton(undefined);
|
@@ -32,15 +34,9 @@ export const ResponseActions = ({ actions }) => {
|
|
32
34
|
setActiveButton(id);
|
33
35
|
onClick && onClick(e);
|
34
36
|
};
|
35
|
-
return (
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
share && (React.createElement(ResponseActionButton, Object.assign({}, share, { 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, Object.assign({}, listen, { 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'] }))),
|
41
|
-
Object.keys(additionalActions).map((action) => {
|
42
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
43
|
-
return (React.createElement(ResponseActionButton, Object.assign({}, additionalActions[action], { 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'] })));
|
44
|
-
})));
|
37
|
+
return (_jsxs("div", { ref: responseActions, className: "pf-chatbot__response-actions", children: [positive && (_jsx(ResponseActionButton, Object.assign({}, positive, { 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: _jsx(OutlinedThumbsUpIcon, {}), isClicked: activeButton === 'positive', ref: positive.ref, "aria-expanded": positive['aria-expanded'], "aria-controls": positive['aria-controls'] }))), negative && (_jsx(ResponseActionButton, Object.assign({}, negative, { 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: _jsx(OutlinedThumbsDownIcon, {}), isClicked: activeButton === 'negative', ref: negative.ref, "aria-expanded": negative['aria-expanded'], "aria-controls": negative['aria-controls'] }))), copy && (_jsx(ResponseActionButton, Object.assign({}, copy, { 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: _jsx(OutlinedCopyIcon, {}), isClicked: activeButton === 'copy', ref: copy.ref, "aria-expanded": copy['aria-expanded'], "aria-controls": copy['aria-controls'] }))), share && (_jsx(ResponseActionButton, Object.assign({}, share, { 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: _jsx(ExternalLinkAltIcon, {}), isClicked: activeButton === 'share', ref: share.ref, "aria-expanded": share['aria-expanded'], "aria-controls": share['aria-controls'] }))), listen && (_jsx(ResponseActionButton, Object.assign({}, listen, { 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: _jsx(VolumeUpIcon, {}), isClicked: activeButton === 'listen', ref: listen.ref, "aria-expanded": listen['aria-expanded'], "aria-controls": listen['aria-controls'] }))), Object.keys(additionalActions).map((action) => {
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
39
|
+
return (_createElement(ResponseActionButton, Object.assign({}, additionalActions[action], { 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'] })));
|
40
|
+
})] }));
|
45
41
|
};
|
46
42
|
export default ResponseActions;
|