@patternfly/chatbot 6.3.0-prerelease.2 → 6.3.0-prerelease.21
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 +14 -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 +3 -2
- package/dist/cjs/Chatbot/Chatbot.js +5 -10
- package/dist/cjs/Chatbot/Chatbot.test.js +13 -9
- 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 +4 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +17 -34
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +58 -62
- 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 +4 -3
- package/dist/cjs/ChatbotFooter/ChatbotFooter.js +3 -16
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +10 -5
- 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 +5 -4
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +19 -10
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +10 -8
- 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 +5 -4
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +20 -8
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +10 -8
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +7 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +22 -19
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +9 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -12
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +20 -17
- 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 +5 -2
- package/dist/cjs/ChatbotModal/ChatbotModal.js +4 -10
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +16 -0
- 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 +3 -2
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +7 -21
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +18 -14
- package/dist/cjs/CodeModal/CodeModal.d.ts +10 -2
- package/dist/cjs/CodeModal/CodeModal.js +8 -20
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/cjs/CodeModal/CodeModal.test.js +34 -0
- 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 +9 -2
- package/dist/cjs/FileDropZone/FileDropZone.js +6 -9
- package/dist/cjs/FileDropZone/FileDropZone.test.js +31 -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 +20 -3
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +22 -16
- package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
- package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +136 -0
- 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 +26 -8
- package/dist/cjs/Message/Message.js +50 -72
- package/dist/cjs/Message/Message.test.js +123 -81
- 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/Plugins/rehypeMoveImagesOutOfParagraphs.d.ts +2 -0
- package/dist/cjs/Message/Plugins/rehypeMoveImagesOutOfParagraphs.js +47 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +4 -2
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +8 -10
- 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 +4 -2
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +8 -44
- 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 +13 -24
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +55 -51
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +21 -45
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +83 -89
- package/dist/cjs/MessageBar/AttachButton.d.ts +9 -2
- package/dist/cjs/MessageBar/AttachButton.js +9 -17
- package/dist/cjs/MessageBar/AttachButton.test.js +50 -22
- package/dist/cjs/MessageBar/MessageBar.d.ts +16 -3
- package/dist/cjs/MessageBar/MessageBar.js +36 -37
- package/dist/cjs/MessageBar/MessageBar.test.js +122 -108
- package/dist/cjs/MessageBar/MicrophoneButton.d.ts +3 -2
- package/dist/cjs/MessageBar/MicrophoneButton.js +8 -15
- package/dist/cjs/MessageBar/SendButton.d.ts +4 -2
- package/dist/cjs/MessageBar/SendButton.js +4 -12
- package/dist/cjs/MessageBar/SendButton.test.js +18 -14
- package/dist/cjs/MessageBar/StopButton.d.ts +4 -2
- package/dist/cjs/MessageBar/StopButton.js +4 -13
- package/dist/cjs/MessageBar/StopButton.test.js +18 -14
- 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 +21 -5
- package/dist/cjs/MessageBox/MessageBox.js +181 -44
- package/dist/cjs/MessageBox/MessageBox.test.js +219 -6
- package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +14 -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 +5 -5
- package/dist/cjs/ResponseActions/ResponseActionButton.js +5 -8
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +19 -19
- package/dist/cjs/ResponseActions/ResponseActions.d.ts +7 -3
- package/dist/cjs/ResponseActions/ResponseActions.js +12 -16
- package/dist/cjs/ResponseActions/ResponseActions.test.js +60 -41
- package/dist/cjs/Settings/SettingsForm.d.ts +4 -2
- package/dist/cjs/Settings/SettingsForm.js +3 -9
- package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/cjs/Settings/SettingsForm.test.js +18 -9
- 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 +17 -43
- package/dist/cjs/SourcesCard/SourcesCard.test.js +60 -60
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +5 -3
- package/dist/cjs/TermsOfUse/TermsOfUse.js +5 -17
- package/dist/cjs/TermsOfUse/TermsOfUse.test.js +31 -33
- package/dist/css/main.css +228 -15
- package/dist/css/main.css.map +1 -1
- package/dist/esm/AttachMenu/AttachMenu.d.ts +2 -2
- package/dist/esm/AttachMenu/AttachMenu.js +2 -9
- package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +14 -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 +3 -2
- package/dist/esm/Chatbot/Chatbot.js +5 -7
- package/dist/esm/Chatbot/Chatbot.test.js +9 -5
- 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 +4 -2
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +17 -34
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +29 -33
- 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 +4 -3
- package/dist/esm/ChatbotFooter/ChatbotFooter.js +3 -13
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +8 -3
- 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 +5 -4
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -8
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +8 -3
- 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 +5 -4
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +20 -8
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +8 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +7 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +8 -9
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +13 -7
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +9 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -9
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +13 -7
- 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 +5 -2
- package/dist/esm/ChatbotModal/ChatbotModal.js +4 -7
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +11 -0
- 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 +3 -2
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +7 -18
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +11 -7
- package/dist/esm/CodeModal/CodeModal.d.ts +10 -2
- package/dist/esm/CodeModal/CodeModal.js +8 -20
- package/dist/esm/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/esm/CodeModal/CodeModal.test.js +29 -0
- 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 +9 -2
- package/dist/esm/FileDropZone/FileDropZone.js +6 -6
- package/dist/esm/FileDropZone/FileDropZone.test.js +29 -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 +20 -3
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +23 -17
- package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
- package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +130 -0
- 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 +26 -8
- package/dist/esm/Message/Message.js +50 -72
- package/dist/esm/Message/Message.test.js +123 -81
- 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/Plugins/rehypeMoveImagesOutOfParagraphs.d.ts +2 -0
- package/dist/esm/Message/Plugins/rehypeMoveImagesOutOfParagraphs.js +43 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +4 -2
- package/dist/esm/Message/QuickResponse/QuickResponse.js +8 -7
- 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 +4 -2
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +8 -21
- 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 +13 -24
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +24 -20
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +2 -2
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +21 -45
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +29 -35
- package/dist/esm/MessageBar/AttachButton.d.ts +9 -2
- package/dist/esm/MessageBar/AttachButton.js +9 -14
- package/dist/esm/MessageBar/AttachButton.test.js +44 -16
- package/dist/esm/MessageBar/MessageBar.d.ts +16 -3
- package/dist/esm/MessageBar/MessageBar.js +34 -35
- package/dist/esm/MessageBar/MessageBar.test.js +87 -73
- package/dist/esm/MessageBar/MicrophoneButton.d.ts +3 -2
- package/dist/esm/MessageBar/MicrophoneButton.js +8 -12
- package/dist/esm/MessageBar/SendButton.d.ts +4 -2
- package/dist/esm/MessageBar/SendButton.js +4 -9
- package/dist/esm/MessageBar/SendButton.test.js +13 -9
- package/dist/esm/MessageBar/StopButton.d.ts +4 -2
- package/dist/esm/MessageBar/StopButton.js +4 -10
- package/dist/esm/MessageBar/StopButton.test.js +13 -9
- package/dist/esm/MessageBox/JumpButton.d.ts +2 -2
- package/dist/esm/MessageBox/JumpButton.js +2 -7
- package/dist/esm/MessageBox/JumpButton.test.js +9 -9
- package/dist/esm/MessageBox/MessageBox.d.ts +21 -5
- package/dist/esm/MessageBox/MessageBox.js +181 -44
- package/dist/esm/MessageBox/MessageBox.test.js +220 -7
- package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +14 -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 +5 -5
- package/dist/esm/ResponseActions/ResponseActionButton.js +5 -5
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +7 -7
- package/dist/esm/ResponseActions/ResponseActions.d.ts +7 -3
- package/dist/esm/ResponseActions/ResponseActions.js +13 -17
- package/dist/esm/ResponseActions/ResponseActions.test.js +35 -16
- package/dist/esm/Settings/SettingsForm.d.ts +4 -2
- package/dist/esm/Settings/SettingsForm.js +3 -6
- package/dist/esm/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/esm/Settings/SettingsForm.test.js +16 -4
- 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 +17 -40
- package/dist/esm/SourcesCard/SourcesCard.test.js +19 -19
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +5 -3
- package/dist/esm/TermsOfUse/TermsOfUse.js +5 -17
- package/dist/esm/TermsOfUse/TermsOfUse.test.js +10 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -6
- package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +10 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Customizing Messages/Customizing Messages.md +51 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachMenu.tsx +9 -9
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +14 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +19 -20
- 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 -12
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +37 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedbackTimeout.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +26 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +13 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +24 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +14 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +20 -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 +18 -9
- 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 +14 -5
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +17 -8
- 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 +8 -8
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomePrompt.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +282 -0
- 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 +179 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +17 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +37 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +9 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +19 -25
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +23 -14
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +14 -14
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +475 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +17 -22
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotScrolling.tsx +536 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +17 -22
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +13 -13
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +7 -7
- package/patternfly-docs/content/extensions/chatbot/img/quick-response-confirmation.svg +67 -0
- package/src/AttachMenu/AttachMenu.tsx +2 -2
- package/src/AttachmentEdit/AttachmentEdit.test.tsx +46 -2
- package/src/AttachmentEdit/AttachmentEdit.tsx +29 -7
- package/src/Chatbot/Chatbot.scss +7 -0
- package/src/Chatbot/Chatbot.test.tsx +9 -1
- package/src/Chatbot/Chatbot.tsx +9 -4
- 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.scss +38 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +21 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +17 -8
- package/src/ChatbotConversationHistoryNav/EmptyState.tsx +2 -2
- package/src/ChatbotConversationHistoryNav/LoadingState.tsx +2 -2
- package/src/ChatbotFooter/ChatbotFooter.scss +5 -0
- package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -1
- package/src/ChatbotFooter/ChatbotFooter.tsx +6 -4
- package/src/ChatbotFooter/ChatbotFooternote.test.tsx +0 -1
- package/src/ChatbotFooter/ChatbotFootnote.tsx +6 -4
- package/src/ChatbotHeader/ChatbotHeader.scss +25 -0
- package/src/ChatbotHeader/ChatbotHeader.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeader.tsx +4 -7
- package/src/ChatbotHeader/ChatbotHeaderActions.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderActions.tsx +2 -2
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +6 -1
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +17 -10
- package/src/ChatbotHeader/ChatbotHeaderMain.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderMain.tsx +5 -3
- package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +8 -1
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +17 -12
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +15 -1
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +17 -7
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +19 -1
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +30 -6
- package/src/ChatbotHeader/ChatbotHeaderTitle.test.tsx +0 -1
- package/src/ChatbotHeader/ChatbotHeaderTitle.tsx +2 -2
- package/src/ChatbotModal/ChatbotModal.scss +15 -4
- package/src/ChatbotModal/ChatbotModal.test.tsx +58 -0
- package/src/ChatbotModal/ChatbotModal.tsx +7 -3
- package/src/ChatbotPopover/ChatbotPopover.scss +9 -5
- package/src/ChatbotPopover/ChatbotPopover.tsx +2 -2
- package/src/ChatbotToggle/ChatbotToggle.test.tsx +0 -1
- package/src/ChatbotToggle/ChatbotToggle.tsx +5 -3
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +13 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +15 -4
- package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
- package/src/CodeModal/CodeModal.scss +11 -3
- package/src/CodeModal/CodeModal.test.tsx +51 -0
- package/src/CodeModal/CodeModal.tsx +24 -10
- 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 +2 -2
- package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +1 -1
- package/src/FileDetailsLabel/FileDetailsLabel.test.tsx +0 -1
- package/src/FileDetailsLabel/FileDetailsLabel.tsx +1 -1
- package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +1 -1
- package/src/FileDropZone/FileDropZone.test.tsx +29 -1
- package/src/FileDropZone/FileDropZone.tsx +13 -3
- package/src/LoadingMessage/LoadingMessage.test.tsx +0 -1
- package/src/LoadingMessage/LoadingMessage.tsx +2 -2
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +7 -0
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +105 -18
- package/src/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.tsx +220 -0
- 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.scss +27 -0
- package/src/Message/Message.test.tsx +70 -6
- package/src/Message/Message.tsx +41 -17
- package/src/Message/MessageInput.tsx +5 -5
- package/src/Message/MessageLoading.tsx +0 -2
- package/src/Message/Plugins/rehypeMoveImagesOutOfParagraphs.ts +53 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +9 -4
- package/src/Message/QuickStarts/FallbackImg.tsx +4 -3
- package/src/Message/QuickStarts/QuickStartTile.tsx +8 -4
- 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.scss +25 -0
- package/src/Message/TextMessage/TextMessage.tsx +1 -2
- package/src/Message/UserFeedback/CloseButton.tsx +2 -2
- package/src/Message/UserFeedback/UserFeedback.scss +24 -3
- package/src/Message/UserFeedback/UserFeedback.test.tsx +13 -1
- package/src/Message/UserFeedback/UserFeedback.tsx +12 -8
- package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +4 -1
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +26 -16
- package/src/MessageBar/AttachButton.scss +10 -0
- package/src/MessageBar/AttachButton.test.tsx +56 -8
- package/src/MessageBar/AttachButton.tsx +21 -8
- package/src/MessageBar/MessageBar.scss +17 -0
- package/src/MessageBar/MessageBar.test.tsx +81 -30
- package/src/MessageBar/MessageBar.tsx +60 -25
- package/src/MessageBar/MicrophoneButton.scss +10 -0
- package/src/MessageBar/MicrophoneButton.tsx +15 -9
- package/src/MessageBar/SendButton.scss +10 -0
- package/src/MessageBar/SendButton.test.tsx +10 -7
- package/src/MessageBar/SendButton.tsx +9 -5
- package/src/MessageBar/StopButton.scss +10 -0
- package/src/MessageBar/StopButton.test.tsx +10 -7
- package/src/MessageBar/StopButton.tsx +9 -5
- package/src/MessageBox/JumpButton.test.tsx +4 -5
- package/src/MessageBox/JumpButton.tsx +3 -3
- package/src/MessageBox/MessageBox.scss +6 -0
- package/src/MessageBox/MessageBox.test.tsx +295 -5
- package/src/MessageBox/MessageBox.tsx +301 -82
- package/src/PreviewAttachment/PreviewAttachment.test.tsx +44 -2
- package/src/PreviewAttachment/PreviewAttachment.tsx +29 -7
- package/src/ResponseActions/ResponseActionButton.test.tsx +0 -1
- package/src/ResponseActions/ResponseActionButton.tsx +6 -5
- package/src/ResponseActions/ResponseActions.test.tsx +23 -3
- package/src/ResponseActions/ResponseActions.tsx +40 -10
- package/src/Settings/Settings.scss +11 -0
- package/src/Settings/SettingsForm.test.tsx +17 -1
- package/src/Settings/SettingsForm.tsx +8 -3
- package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx +2 -2
- package/src/SourcesCard/SourcesCard.scss +8 -0
- package/src/SourcesCard/SourcesCard.test.tsx +0 -1
- package/src/SourcesCard/SourcesCard.tsx +9 -8
- package/src/TermsOfUse/TermsOfUse.scss +20 -0
- package/src/TermsOfUse/TermsOfUse.test.tsx +0 -1
- package/src/TermsOfUse/TermsOfUse.tsx +15 -9
- package/tsconfig.cjs.json +0 -1
- package/tsconfig.json +3 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { FunctionComponent, MouseEvent } from 'react';
|
2
2
|
import { ChatbotDisplayMode } from '../Chatbot';
|
3
3
|
export interface CodeModalProps {
|
4
4
|
/** Class applied to code editor */
|
@@ -29,6 +29,14 @@ export interface CodeModalProps {
|
|
29
29
|
title: string;
|
30
30
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
31
31
|
displayMode?: ChatbotDisplayMode;
|
32
|
+
/** Sets modal to compact styling. */
|
33
|
+
isCompact?: boolean;
|
34
|
+
/** Class applied to modal header */
|
35
|
+
modalHeaderClassName?: string;
|
36
|
+
/** Class applied to modal body */
|
37
|
+
modalBodyClassName?: string;
|
38
|
+
/** Class applied to modal footer */
|
39
|
+
modalFooterClassName?: string;
|
32
40
|
}
|
33
|
-
export declare const CodeModal:
|
41
|
+
export declare const CodeModal: FunctionComponent<CodeModalProps>;
|
34
42
|
export default CodeModal;
|
@@ -9,10 +9,8 @@ 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 } from "react/jsx-runtime";
|
13
|
+
import { useState } from 'react';
|
16
14
|
import path from 'path-browserify';
|
17
15
|
// Import PatternFly components
|
18
16
|
import { CodeEditor } from '@patternfly/react-code-editor';
|
@@ -21,8 +19,8 @@ import FileDetails, { extensionToLanguage } from '../FileDetails';
|
|
21
19
|
import { ChatbotDisplayMode } from '../Chatbot';
|
22
20
|
import ChatbotModal from '../ChatbotModal/ChatbotModal';
|
23
21
|
export const CodeModal = (_a) => {
|
24
|
-
var { fileName, code, codeEditorControlClassName: codeEditorClassName, handleModalToggle, isCopyEnabled, isLineNumbersVisible, isModalOpen, isReadOnly, onPrimaryAction, onSecondaryAction, primaryActionBtn, secondaryActionBtn, title, displayMode = ChatbotDisplayMode.default } = _a, props = __rest(_a, ["fileName", "code", "codeEditorControlClassName", "handleModalToggle", "isCopyEnabled", "isLineNumbersVisible", "isModalOpen", "isReadOnly", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "displayMode"]);
|
25
|
-
const [newCode, setNewCode] =
|
22
|
+
var { fileName, code, codeEditorControlClassName: codeEditorClassName, handleModalToggle, isCopyEnabled, isLineNumbersVisible, isModalOpen, isReadOnly, onPrimaryAction, onSecondaryAction, primaryActionBtn, secondaryActionBtn, title, displayMode = ChatbotDisplayMode.default, isCompact, modalHeaderClassName, modalBodyClassName, modalFooterClassName } = _a, props = __rest(_a, ["fileName", "code", "codeEditorControlClassName", "handleModalToggle", "isCopyEnabled", "isLineNumbersVisible", "isModalOpen", "isReadOnly", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "displayMode", "isCompact", "modalHeaderClassName", "modalBodyClassName", "modalFooterClassName"]);
|
23
|
+
const [newCode, setNewCode] = useState(code);
|
26
24
|
const handlePrimaryAction = (_event) => {
|
27
25
|
handleModalToggle(_event);
|
28
26
|
if (!isReadOnly) {
|
@@ -46,20 +44,10 @@ export const CodeModal = (_a) => {
|
|
46
44
|
setNewCode(value);
|
47
45
|
}
|
48
46
|
};
|
49
|
-
const modal = (
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
React.createElement(StackItem, { className: "pf-chatbot__code-modal-file-details" },
|
54
|
-
React.createElement(FileDetails, { fileName: fileName })),
|
55
|
-
React.createElement(StackItem, { className: "pf-chatbot__code-modal-body" },
|
56
|
-
React.createElement(CodeEditor, Object.assign({ isDarkTheme: true, isLineNumbersVisible: isLineNumbersVisible, isLanguageLabelVisible: true, isCopyEnabled: isCopyEnabled, isReadOnly: isReadOnly, code: newCode, language: extensionToLanguage[path.extname(fileName).slice(1)], onEditorDidMount: onEditorDidMount, onCodeChange: onCodeChange, className: codeEditorClassName, isFullHeight: true, options: {
|
57
|
-
glyphMargin: false,
|
58
|
-
folding: false
|
59
|
-
} }, props))))),
|
60
|
-
React.createElement(ModalFooter, null,
|
61
|
-
React.createElement(Button, { isBlock: true, key: "code-modal-primary", variant: "primary", onClick: handlePrimaryAction, form: "code-modal-form" }, primaryActionBtn),
|
62
|
-
React.createElement(Button, { isBlock: true, key: "code-modal-secondary", variant: "link", onClick: handleSecondaryAction }, secondaryActionBtn))));
|
47
|
+
const modal = (_jsxs(ChatbotModal, { isOpen: isModalOpen, onClose: handleModalToggle, ouiaId: "CodeModal", "aria-labelledby": "code-modal-title", "aria-describedby": "code-modal", className: `pf-chatbot__code-modal ${isCompact ? 'pf-m-compact' : ''} pf-chatbot__code-modal--${displayMode}`, displayMode: displayMode, isCompact: isCompact, children: [_jsx(ModalHeader, { className: modalHeaderClassName, title: title, labelId: "code-modal-title" }), _jsx(ModalBody, { className: modalBodyClassName, id: "code-modal-body", children: _jsxs(Stack, { className: "pf-chatbot__code-modal-body", children: [_jsx(StackItem, { className: "pf-chatbot__code-modal-file-details", children: _jsx(FileDetails, { fileName: fileName }) }), _jsx(StackItem, { className: "pf-chatbot__code-modal-editor", children: _jsx(CodeEditor, Object.assign({ isDarkTheme: true, isLineNumbersVisible: isLineNumbersVisible, isLanguageLabelVisible: true, isCopyEnabled: isCopyEnabled, isReadOnly: isReadOnly, code: newCode, language: extensionToLanguage[path.extname(fileName).slice(1)], onEditorDidMount: onEditorDidMount, onCodeChange: onCodeChange, className: codeEditorClassName, isFullHeight: true, options: {
|
48
|
+
glyphMargin: false,
|
49
|
+
folding: false
|
50
|
+
} }, props)) })] }) }), _jsxs(ModalFooter, { className: modalFooterClassName, children: [_jsx(Button, { isBlock: true, variant: "primary", onClick: handlePrimaryAction, form: "code-modal-form", children: primaryActionBtn }, "code-modal-primary"), _jsx(Button, { isBlock: true, variant: "link", onClick: handleSecondaryAction, children: secondaryActionBtn }, "code-modal-secondary")] })] }));
|
63
51
|
return modal;
|
64
52
|
};
|
65
53
|
export default CodeModal;
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -0,0 +1,29 @@
|
|
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 { render, screen, within } from '@testing-library/react';
|
12
|
+
import '@testing-library/jest-dom';
|
13
|
+
import CodeModal from './CodeModal';
|
14
|
+
describe('ChatbotModal', () => {
|
15
|
+
it('should render compact modal', () => {
|
16
|
+
render(_jsx(CodeModal, { isCompact: true, code: "Hello world", fileName: "greetings.txt", isModalOpen: true, handleModalToggle: jest.fn(), onPrimaryAction: jest.fn(), onSecondaryAction: jest.fn(), title: "Preview attachment", primaryActionBtn: "Submit", secondaryActionBtn: "Cancel" }));
|
17
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-m-compact');
|
18
|
+
});
|
19
|
+
it('should render CodeModal with custom classNames', () => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
render(_jsx(CodeModal, { isCompact: true, code: "Hello world", fileName: "greetings.txt", isModalOpen: true, handleModalToggle: jest.fn(), onPrimaryAction: jest.fn(), onSecondaryAction: jest.fn(), title: "Preview attachment", primaryActionBtn: "Submit", secondaryActionBtn: "Cancel", modalHeaderClassName: "custom-header-class", modalBodyClassName: "custom-body-class", modalFooterClassName: "custom-footer-class" }));
|
21
|
+
const modal = screen.getByRole('dialog');
|
22
|
+
const modalHeader = within(modal).getByRole('banner');
|
23
|
+
expect(modalHeader).toHaveClass('custom-header-class');
|
24
|
+
const modalBody = modal.querySelector('#code-modal-body');
|
25
|
+
expect(modalBody).toHaveClass('custom-body-class');
|
26
|
+
const modalfooter = within(modal).getByRole('contentinfo');
|
27
|
+
expect(modalfooter).toHaveClass('custom-footer-class');
|
28
|
+
}));
|
29
|
+
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import type { PropsWithChildren } from 'react';
|
2
2
|
interface CompareProps {
|
3
3
|
/** First of two children to render */
|
4
4
|
firstChild: React.ReactNode;
|
@@ -13,5 +13,5 @@ interface CompareProps {
|
|
13
13
|
/** Callback for when mobile toggle is used */
|
14
14
|
onToggleClick?: (event: MouseEvent | React.MouseEvent<any, MouseEvent> | React.KeyboardEvent<Element>) => void;
|
15
15
|
}
|
16
|
-
export declare const Compare: ({ firstChild, secondChild, firstChildDisplayName, secondChildDisplayName, onToggleClick, toggleGroupAriaLabel }: PropsWithChildren<CompareProps>) =>
|
16
|
+
export declare const Compare: ({ firstChild, secondChild, firstChildDisplayName, secondChildDisplayName, onToggleClick, toggleGroupAriaLabel }: PropsWithChildren<CompareProps>) => import("react/jsx-runtime").JSX.Element;
|
17
17
|
export default Compare;
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import { useEffect, useState } from 'react';
|
2
3
|
import { ToggleGroup, ToggleGroupItem } from '@patternfly/react-core';
|
3
4
|
export const Compare = ({ firstChild, secondChild, firstChildDisplayName, secondChildDisplayName, onToggleClick, toggleGroupAriaLabel = 'Select which chatbot to display' }) => {
|
4
|
-
const [isSelected, setIsSelected] =
|
5
|
-
const [showFirstChatbot, setShowFirstChatbot] =
|
6
|
-
const [showSecondChatbot, setShowSecondChatbot] =
|
7
|
-
|
5
|
+
const [isSelected, setIsSelected] = useState('toggle-group-chatbot-1');
|
6
|
+
const [showFirstChatbot, setShowFirstChatbot] = useState(true);
|
7
|
+
const [showSecondChatbot, setShowSecondChatbot] = useState(false);
|
8
|
+
useEffect(() => {
|
8
9
|
// we want to show the first if we switch to the mobile toggle view
|
9
10
|
// and reset/switch back to normal otherwise
|
10
11
|
const updateChatbotVisibility = () => {
|
@@ -31,13 +32,6 @@ export const Compare = ({ firstChild, secondChild, firstChildDisplayName, second
|
|
31
32
|
setShowFirstChatbot(!showFirstChatbot);
|
32
33
|
onToggleClick && onToggleClick(event);
|
33
34
|
};
|
34
|
-
return (
|
35
|
-
React.createElement("div", { className: "pf-chatbot__compare-mobile-controls" },
|
36
|
-
React.createElement(ToggleGroup, { "aria-label": toggleGroupAriaLabel },
|
37
|
-
React.createElement(ToggleGroupItem, { className: "pf-chatbot__compare-toggle", text: firstChildDisplayName, buttonId: "toggle-group-chatbot-1", isSelected: isSelected === 'toggle-group-chatbot-1', onChange: handleChildToggleClick }),
|
38
|
-
React.createElement(ToggleGroupItem, { className: "pf-chatbot__compare-toggle", text: secondChildDisplayName, buttonId: "toggle-group-chatbot-2", isSelected: isSelected === 'toggle-group-chatbot-2', onChange: handleChildToggleClick }))),
|
39
|
-
React.createElement("div", { className: "pf-chatbot__compare" },
|
40
|
-
React.createElement("div", { className: `pf-chatbot__compare-item ${!showFirstChatbot ? 'pf-chatbot__compare-item-hidden' : undefined}` }, firstChild),
|
41
|
-
React.createElement("div", { className: `pf-chatbot__compare-item ${!showSecondChatbot ? 'pf-chatbot__compare-item-hidden' : undefined}` }, secondChild))));
|
35
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "pf-chatbot__compare-mobile-controls", children: _jsxs(ToggleGroup, { "aria-label": toggleGroupAriaLabel, children: [_jsx(ToggleGroupItem, { className: "pf-chatbot__compare-toggle", text: firstChildDisplayName, buttonId: "toggle-group-chatbot-1", isSelected: isSelected === 'toggle-group-chatbot-1', onChange: handleChildToggleClick }), _jsx(ToggleGroupItem, { className: "pf-chatbot__compare-toggle", text: secondChildDisplayName, buttonId: "toggle-group-chatbot-2", isSelected: isSelected === 'toggle-group-chatbot-2', onChange: handleChildToggleClick })] }) }), _jsxs("div", { className: "pf-chatbot__compare", children: [_jsx("div", { className: `pf-chatbot__compare-item ${!showFirstChatbot ? 'pf-chatbot__compare-item-hidden' : undefined}`, children: firstChild }), _jsx("div", { className: `pf-chatbot__compare-item ${!showSecondChatbot ? 'pf-chatbot__compare-item-hidden' : undefined}`, children: secondChild })] })] }));
|
42
36
|
};
|
43
37
|
export default Compare;
|
@@ -1,14 +1,12 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { render, screen } from '@testing-library/react';
|
3
3
|
import '@testing-library/jest-dom';
|
4
4
|
import Compare from './Compare';
|
5
|
-
const firstChild = (
|
6
|
-
|
7
|
-
const secondChild = (React.createElement("div", null,
|
8
|
-
React.createElement("h1", null, "Child 2")));
|
5
|
+
const firstChild = (_jsx("div", { children: _jsx("h1", { children: "Child 1" }) }));
|
6
|
+
const secondChild = (_jsx("div", { children: _jsx("h1", { children: "Child 2" }) }));
|
9
7
|
describe('Compare', () => {
|
10
8
|
it('should render compare correctly', () => {
|
11
|
-
render(
|
9
|
+
render(_jsx(Compare, { firstChildDisplayName: "Child 1", secondChildDisplayName: "Child 2", firstChild: firstChild, secondChild: secondChild }));
|
12
10
|
expect(screen.getByRole('heading', { name: /Child 1/i })).toBeTruthy();
|
13
11
|
expect(screen.getByRole('heading', { name: /Child 2/i })).toBeTruthy();
|
14
12
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { PropsWithChildren } from 'react';
|
2
2
|
interface FileDetailsProps {
|
3
3
|
/** Class name applied to container */
|
4
4
|
className?: string;
|
@@ -918,5 +918,5 @@ export declare const extensionToLanguage: {
|
|
918
918
|
odp: string;
|
919
919
|
pdf: string;
|
920
920
|
};
|
921
|
-
export declare const FileDetails: ({ className, fileName, fileNameClassName, languageTestId }: PropsWithChildren<FileDetailsProps>) =>
|
921
|
+
export declare const FileDetails: ({ className, fileName, fileNameClassName, languageTestId }: PropsWithChildren<FileDetailsProps>) => import("react/jsx-runtime").JSX.Element;
|
922
922
|
export default FileDetails;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { Flex, Stack, StackItem, Truncate } from '@patternfly/react-core';
|
3
3
|
import path from 'path-browserify';
|
4
4
|
// source https://gist.github.com/ppisarczyk/43962d06686722d26d176fad46879d41
|
@@ -929,19 +929,6 @@ export const extensionToLanguage = {
|
|
929
929
|
export const FileDetails = ({ className, fileName, fileNameClassName, languageTestId }) => {
|
930
930
|
var _a;
|
931
931
|
const language = (_a = extensionToLanguage[path.extname(fileName).slice(1)]) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
932
|
-
return (
|
933
|
-
React.createElement(Flex, { className: "pf-chatbot__code-icon", justifyContent: { default: 'justifyContentCenter' }, alignItems: { default: 'alignItemsCenter' }, alignSelf: { default: 'alignSelfCenter' } },
|
934
|
-
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg" },
|
935
|
-
React.createElement("path", { d: "M0 4C0 1.79086 1.79086 0 4 0H20C22.2091 0 24 1.79086 24 4V20C24 22.2091 22.2091 24 20 24H4C1.79086 24 0 22.2091 0 20V4Z", fill: "currentColor" }),
|
936
|
-
React.createElement("g", { clipPath: "url(#clip0_3280_27505)" },
|
937
|
-
React.createElement("path", { d: "M13.8204 5.63002C13.3954 5.50752 12.9529 5.75502 12.8304 6.18002L9.63035 17.38C9.50785 17.805 9.75535 18.2475 10.1804 18.37C10.6054 18.4925 11.0479 18.245 11.1704 17.82L14.3704 6.62002C14.4929 6.19502 14.2454 5.75252 13.8204 5.63002ZM15.8354 8.63252C15.5229 8.94502 15.5229 9.45252 15.8354 9.76502L18.0679 12L15.8329 14.235C15.5204 14.5475 15.5204 15.055 15.8329 15.3675C16.1454 15.68 16.6529 15.68 16.9654 15.3675L19.7654 12.5675C20.0779 12.255 20.0779 11.7475 19.7654 11.435L16.9654 8.63502C16.6529 8.32252 16.1454 8.32252 15.8329 8.63502L15.8354 8.63252ZM8.16785 8.63252C7.85535 8.32002 7.34785 8.32002 7.03535 8.63252L4.23535 11.4325C3.92285 11.745 3.92285 12.2525 4.23535 12.565L7.03535 15.365C7.34785 15.6775 7.85535 15.6775 8.16785 15.365C8.48035 15.0525 8.48035 14.545 8.16785 14.2325L5.93285 12L8.16785 9.76502C8.48035 9.45252 8.48035 8.94502 8.16785 8.63252Z", fill: "white" })),
|
938
|
-
React.createElement("defs", null,
|
939
|
-
React.createElement("clipPath", null,
|
940
|
-
React.createElement("rect", { width: "16", height: "12.8", fill: "white", transform: "translate(4 5.60001)" }))))),
|
941
|
-
React.createElement(Stack, null,
|
942
|
-
React.createElement(StackItem, null,
|
943
|
-
React.createElement("span", { className: "pf-chatbot__code-fileName" },
|
944
|
-
React.createElement(Truncate, { className: fileNameClassName, content: path.parse(fileName).name }))),
|
945
|
-
language && (React.createElement(StackItem, { "data-testid": languageTestId, className: "pf-chatbot__code-language" }, language)))));
|
932
|
+
return (_jsxs(Flex, { className: `pf-chatbot__file-details ${className ? className : ''}`, gap: { default: 'gapSm' }, children: [_jsx(Flex, { className: "pf-chatbot__code-icon", justifyContent: { default: 'justifyContentCenter' }, alignItems: { default: 'alignItemsCenter' }, alignSelf: { default: 'alignSelfCenter' }, children: _jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M0 4C0 1.79086 1.79086 0 4 0H20C22.2091 0 24 1.79086 24 4V20C24 22.2091 22.2091 24 20 24H4C1.79086 24 0 22.2091 0 20V4Z", fill: "currentColor" }), _jsx("g", { clipPath: "url(#clip0_3280_27505)", children: _jsx("path", { d: "M13.8204 5.63002C13.3954 5.50752 12.9529 5.75502 12.8304 6.18002L9.63035 17.38C9.50785 17.805 9.75535 18.2475 10.1804 18.37C10.6054 18.4925 11.0479 18.245 11.1704 17.82L14.3704 6.62002C14.4929 6.19502 14.2454 5.75252 13.8204 5.63002ZM15.8354 8.63252C15.5229 8.94502 15.5229 9.45252 15.8354 9.76502L18.0679 12L15.8329 14.235C15.5204 14.5475 15.5204 15.055 15.8329 15.3675C16.1454 15.68 16.6529 15.68 16.9654 15.3675L19.7654 12.5675C20.0779 12.255 20.0779 11.7475 19.7654 11.435L16.9654 8.63502C16.6529 8.32252 16.1454 8.32252 15.8329 8.63502L15.8354 8.63252ZM8.16785 8.63252C7.85535 8.32002 7.34785 8.32002 7.03535 8.63252L4.23535 11.4325C3.92285 11.745 3.92285 12.2525 4.23535 12.565L7.03535 15.365C7.34785 15.6775 7.85535 15.6775 8.16785 15.365C8.48035 15.0525 8.48035 14.545 8.16785 14.2325L5.93285 12L8.16785 9.76502C8.48035 9.45252 8.48035 8.94502 8.16785 8.63252Z", fill: "white" }) }), _jsx("defs", { children: _jsx("clipPath", { children: _jsx("rect", { width: "16", height: "12.8", fill: "white", transform: "translate(4 5.60001)" }) }) })] }) }), _jsxs(Stack, { children: [_jsx(StackItem, { children: _jsx("span", { className: "pf-chatbot__code-fileName", children: _jsx(Truncate, { className: fileNameClassName, content: path.parse(fileName).name }) }) }), language && (_jsx(StackItem, { "data-testid": languageTestId, className: "pf-chatbot__code-language", children: language }))] })] }));
|
946
933
|
};
|
947
934
|
export default FileDetails;
|
@@ -1,20 +1,20 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { render, screen } from '@testing-library/react';
|
3
3
|
import '@testing-library/jest-dom';
|
4
4
|
import FileDetails from './FileDetails';
|
5
5
|
describe('FileDetails', () => {
|
6
6
|
it('should render file details', () => {
|
7
|
-
const { container } = render(
|
7
|
+
const { container } = render(_jsx(FileDetails, { fileName: "test.txt" }));
|
8
8
|
expect(container).toMatchSnapshot();
|
9
9
|
});
|
10
10
|
it('should render file details correctly if an extension we support is passed in', () => {
|
11
|
-
render(
|
11
|
+
render(_jsx(FileDetails, { fileName: "test.txt", languageTestId: "language" }));
|
12
12
|
expect(screen.getByText('test')).toBeTruthy();
|
13
13
|
expect(screen.getByText('TEXT')).toBeTruthy();
|
14
14
|
expect(screen.getByTestId('language')).toBeTruthy();
|
15
15
|
});
|
16
16
|
it('should skip language if we do not support an extension', () => {
|
17
|
-
render(
|
17
|
+
render(_jsx(FileDetails, { fileName: "test.joke", languageTestId: "language" }));
|
18
18
|
expect(screen.getByText('test')).toBeTruthy();
|
19
19
|
expect(screen.queryByTestId('language')).toBeFalsy();
|
20
20
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { PropsWithChildren } from 'react';
|
2
2
|
interface FileDetailsLabelProps {
|
3
3
|
/** Name of file, including extension */
|
4
4
|
fileName: string;
|
@@ -17,5 +17,5 @@ interface FileDetailsLabelProps {
|
|
17
17
|
/** Custom test id for the loading spinner in the component */
|
18
18
|
spinnerTestId?: string;
|
19
19
|
}
|
20
|
-
export declare const FileDetailsLabel: ({ fileName, fileId, isLoading, onClick, onClose, closeButtonAriaLabel, languageTestId, spinnerTestId }: PropsWithChildren<FileDetailsLabelProps>) =>
|
20
|
+
export declare const FileDetailsLabel: ({ fileName, fileId, isLoading, onClick, onClose, closeButtonAriaLabel, languageTestId, spinnerTestId }: PropsWithChildren<FileDetailsLabelProps>) => import("react/jsx-runtime").JSX.Element;
|
21
21
|
export default FileDetailsLabel;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { Button, Label } from '@patternfly/react-core';
|
3
3
|
import FileDetails from '../FileDetails';
|
4
4
|
import { Spinner } from '@patternfly/react-core';
|
@@ -7,9 +7,6 @@ export const FileDetailsLabel = ({ fileName, fileId, isLoading, onClick, onClose
|
|
7
7
|
const handleClose = (event) => {
|
8
8
|
onClose && onClose(event, fileName, fileId);
|
9
9
|
};
|
10
|
-
return (
|
11
|
-
React.createElement("div", { className: "pf-chatbot__file-label-contents" },
|
12
|
-
React.createElement(FileDetails, { className: isLoading ? 'pf-chatbot__file-label-loading' : undefined, fileName: fileName, languageTestId: languageTestId }),
|
13
|
-
isLoading && React.createElement(Spinner, { "data-testid": spinnerTestId, size: "sm" }))));
|
10
|
+
return (_jsx(Label, Object.assign({ className: "pf-chatbot__file-label" }, (onClose && { onClose: (event) => onClose(event, fileName, fileId) }), { closeBtn: _jsx(Button, { type: "button", variant: "plain", "aria-label": closeButtonAriaLabel !== null && closeButtonAriaLabel !== void 0 ? closeButtonAriaLabel : `Close ${fileName}`, icon: _jsx(TimesIcon, {}), onClick: handleClose }) }, (onClick && { onClick: (event) => onClick(event, fileName, fileId) }), { children: _jsxs("div", { className: "pf-chatbot__file-label-contents", children: [_jsx(FileDetails, { className: isLoading ? 'pf-chatbot__file-label-loading' : undefined, fileName: fileName, languageTestId: languageTestId }), isLoading && _jsx(Spinner, { "data-testid": spinnerTestId, size: "sm" })] }) })));
|
14
11
|
};
|
15
12
|
export default FileDetailsLabel;
|
@@ -7,50 +7,50 @@ 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 FileDetailsLabel from './FileDetailsLabel';
|
14
14
|
import userEvent from '@testing-library/user-event';
|
15
15
|
describe('FileDetailsLabel', () => {
|
16
16
|
it('should render file details label', () => {
|
17
|
-
const { container } = render(
|
17
|
+
const { container } = render(_jsx(FileDetailsLabel, { fileName: "test.txt" }));
|
18
18
|
expect(container).toMatchSnapshot();
|
19
19
|
});
|
20
20
|
it('should render file details correctly if an extension we support is passed in', () => {
|
21
|
-
render(
|
21
|
+
render(_jsx(FileDetailsLabel, { fileName: "test.txt" }));
|
22
22
|
expect(screen.getByText('test')).toBeTruthy();
|
23
23
|
expect(screen.getByText('TEXT')).toBeTruthy();
|
24
24
|
});
|
25
25
|
it('should skip language if we do not support an extension', () => {
|
26
|
-
render(
|
26
|
+
render(_jsx(FileDetailsLabel, { fileName: "test.joke", languageTestId: "language" }));
|
27
27
|
expect(screen.getByText('test')).toBeTruthy();
|
28
28
|
expect(screen.queryByTestId('language')).toBeFalsy();
|
29
29
|
});
|
30
30
|
it('should not show spinner by default', () => {
|
31
|
-
render(
|
31
|
+
render(_jsx(FileDetailsLabel, { fileName: "test.txt", spinnerTestId: "spinner" }));
|
32
32
|
expect(screen.queryByTestId('spinner')).toBeFalsy();
|
33
33
|
});
|
34
34
|
it('should show spinner if loading', () => {
|
35
|
-
render(
|
35
|
+
render(_jsx(FileDetailsLabel, { fileName: "test.txt", isLoading: true, spinnerTestId: "spinner" }));
|
36
36
|
expect(screen.getByText('test')).toBeTruthy();
|
37
37
|
expect(screen.getByText('TEXT')).toBeTruthy();
|
38
38
|
expect(screen.queryByTestId('spinner')).toBeTruthy();
|
39
39
|
});
|
40
40
|
it('should call onClick prop', () => __awaiter(void 0, void 0, void 0, function* () {
|
41
41
|
const spy = jest.fn();
|
42
|
-
render(
|
42
|
+
render(_jsx(FileDetailsLabel, { fileName: "test.txt", onClick: spy }));
|
43
43
|
yield userEvent.click(screen.getByRole('button'));
|
44
44
|
expect(spy).toHaveBeenCalledTimes(1);
|
45
45
|
}));
|
46
46
|
it('should call onClose prop', () => __awaiter(void 0, void 0, void 0, function* () {
|
47
47
|
const spy = jest.fn();
|
48
|
-
render(
|
48
|
+
render(_jsx(FileDetailsLabel, { fileName: "test.txt", onClose: spy }));
|
49
49
|
yield userEvent.click(screen.getByRole('button', { name: /Close test.txt/i }));
|
50
50
|
expect(spy).toHaveBeenCalledTimes(1);
|
51
51
|
}));
|
52
52
|
it('should use closeButtonAriaLabel prop appropriately', () => {
|
53
|
-
render(
|
53
|
+
render(_jsx(FileDetailsLabel, { fileName: "test.txt", onClose: jest.fn(), closeButtonAriaLabel: "Delete file" }));
|
54
54
|
screen.getByRole('button', { name: /Delete file/i });
|
55
55
|
});
|
56
56
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { DropEvent } from '@patternfly/react-core';
|
2
|
-
import
|
2
|
+
import type { FunctionComponent } from 'react';
|
3
3
|
import { ChatbotDisplayMode } from '../Chatbot';
|
4
|
+
import { Accept } from 'react-dropzone/.';
|
4
5
|
export interface FileDropZoneProps {
|
5
6
|
/** Content displayed when the drop zone is not currently in use */
|
6
7
|
children?: React.ReactNode;
|
@@ -10,8 +11,14 @@ export interface FileDropZoneProps {
|
|
10
11
|
infoText?: string;
|
11
12
|
/** When files are dropped or uploaded this callback will be called with all accepted files */
|
12
13
|
onFileDrop: (event: DropEvent, data: File[]) => void;
|
14
|
+
/** Specifies the file types accepted by the attachment upload component.
|
15
|
+
* Files that don't match the accepted types will be disabled in the file picker.
|
16
|
+
* For example,
|
17
|
+
* allowedFileTypes: { 'application/json': ['.json'], 'text/plain': ['.txt'] }
|
18
|
+
**/
|
19
|
+
allowedFileTypes?: Accept;
|
13
20
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
14
21
|
displayMode?: ChatbotDisplayMode;
|
15
22
|
}
|
16
|
-
declare const FileDropZone:
|
23
|
+
declare const FileDropZone: FunctionComponent<FileDropZoneProps>;
|
17
24
|
export default FileDropZone;
|
@@ -9,15 +9,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
12
13
|
import { MultipleFileUpload, MultipleFileUploadMain } from '@patternfly/react-core';
|
13
|
-
import
|
14
|
+
import { useState } from 'react';
|
14
15
|
import { ChatbotDisplayMode } from '../Chatbot';
|
15
16
|
import { UploadIcon } from '@patternfly/react-icons';
|
16
17
|
const FileDropZone = (_a) => {
|
17
|
-
var { children, className, infoText = 'Maximum file size is 25 MB', onFileDrop, displayMode = ChatbotDisplayMode.default } = _a, props = __rest(_a, ["children", "className", "infoText", "onFileDrop", "displayMode"]);
|
18
|
-
const [showDropZone, setShowDropZone] =
|
19
|
-
const renderDropZone = () => (
|
20
|
-
|
21
|
-
return (React.createElement(MultipleFileUpload, { dropzoneProps: Object.assign({ onDrop: () => setShowDropZone(false) }, props), onDragEnter: () => setShowDropZone(true), onDragLeave: () => setShowDropZone(false), onFileDrop: onFileDrop, className: `pf-chatbot__dropzone pf-chatbot__dropzone--${displayMode} pf-chatbot__dropzone--${showDropZone ? 'visible' : 'invisible'} ${className ? className : ''}` }, showDropZone ? renderDropZone() : children));
|
18
|
+
var { children, className, infoText = 'Maximum file size is 25 MB', onFileDrop, allowedFileTypes, displayMode = ChatbotDisplayMode.default } = _a, props = __rest(_a, ["children", "className", "infoText", "onFileDrop", "allowedFileTypes", "displayMode"]);
|
19
|
+
const [showDropZone, setShowDropZone] = useState(false);
|
20
|
+
const renderDropZone = () => (_jsx(_Fragment, { children: _jsx(MultipleFileUploadMain, { titleIcon: _jsx(UploadIcon, {}), titleText: "Drag and drop your file here", infoText: infoText, isUploadButtonHidden: true }) }));
|
21
|
+
return (_jsx(MultipleFileUpload, { dropzoneProps: Object.assign({ accept: allowedFileTypes, onDrop: () => setShowDropZone(false) }, props), onDragEnter: () => setShowDropZone(true), onDragLeave: () => setShowDropZone(false), onFileDrop: onFileDrop, className: `pf-chatbot__dropzone pf-chatbot__dropzone--${displayMode} pf-chatbot__dropzone--${showDropZone ? 'visible' : 'invisible'} ${className ? className : ''}`, children: showDropZone ? renderDropZone() : children }));
|
22
22
|
};
|
23
23
|
export default FileDropZone;
|
@@ -1,14 +1,40 @@
|
|
1
|
-
|
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";
|
2
11
|
import { render, screen } from '@testing-library/react';
|
3
12
|
import '@testing-library/jest-dom';
|
4
13
|
import FileDropZone from './FileDropZone';
|
14
|
+
import userEvent from '@testing-library/user-event';
|
5
15
|
describe('FileDropZone', () => {
|
6
16
|
it('should render file drop zone', () => {
|
7
|
-
const { container } = render(
|
17
|
+
const { container } = render(_jsx(FileDropZone, { onFileDrop: jest.fn() }));
|
8
18
|
expect(container).toMatchSnapshot();
|
9
19
|
});
|
10
20
|
it('should render children', () => {
|
11
|
-
render(
|
21
|
+
render(_jsx(FileDropZone, { onFileDrop: jest.fn(), children: "Hi" }));
|
12
22
|
expect(screen.getByText('Hi')).toBeTruthy();
|
13
23
|
});
|
24
|
+
it('should call onFileDrop when file type is accepted', () => __awaiter(void 0, void 0, void 0, function* () {
|
25
|
+
const onFileDrop = jest.fn();
|
26
|
+
const { container } = render(_jsx(FileDropZone, { "data-testid": "input", allowedFileTypes: { 'text/plain': ['.txt'] }, onFileDrop: onFileDrop }));
|
27
|
+
const file = new File(['Test'], 'example.text', { type: 'text/plain' });
|
28
|
+
const fileInput = container.querySelector('input[type="file"]');
|
29
|
+
yield userEvent.upload(fileInput, file);
|
30
|
+
expect(onFileDrop).toHaveBeenCalled();
|
31
|
+
}));
|
32
|
+
it('should not call onFileDrop when file type is not accepted', () => __awaiter(void 0, void 0, void 0, function* () {
|
33
|
+
const onFileDrop = jest.fn();
|
34
|
+
const { container } = render(_jsx(FileDropZone, { "data-testid": "input", allowedFileTypes: { 'text/plain': ['.txt'] }, onFileDrop: onFileDrop }));
|
35
|
+
const file = new File(['[]'], 'example.json', { type: 'application/json' });
|
36
|
+
const fileInput = container.querySelector('input[type="file"]');
|
37
|
+
yield userEvent.upload(fileInput, file);
|
38
|
+
expect(onFileDrop).not.toHaveBeenCalled();
|
39
|
+
}));
|
14
40
|
});
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
1
|
+
import type { FunctionComponent } from 'react';
|
2
2
|
export interface LoadingMessageProps {
|
3
3
|
icon?: React.ComponentType;
|
4
4
|
}
|
5
|
-
export declare const LoadingMessage:
|
5
|
+
export declare const LoadingMessage: FunctionComponent<LoadingMessageProps>;
|
6
6
|
export default LoadingMessage;
|
@@ -1,13 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { Icon, Split, SplitItem } from '@patternfly/react-core';
|
3
3
|
import RobotIcon from '@patternfly/react-icons/dist/js/icons/robot-icon';
|
4
|
-
export const LoadingMessage = ({ icon: IconComponent = RobotIcon }) => (
|
5
|
-
React.createElement(SplitItem, null,
|
6
|
-
React.createElement(Icon, { size: "lg", className: "pf-v6-u-mr-sm pf-v6-u-pt-md" },
|
7
|
-
React.createElement(IconComponent, null))),
|
8
|
-
React.createElement(SplitItem, { className: "pf-u-background-color-200" },
|
9
|
-
React.createElement("div", { className: "pf-v6-u-display-flex pf-u-align-items-center" },
|
10
|
-
React.createElement("div", null, "."),
|
11
|
-
React.createElement("div", null, "."),
|
12
|
-
React.createElement("div", null, ".")))));
|
4
|
+
export const LoadingMessage = ({ icon: IconComponent = RobotIcon }) => (_jsxs(Split, { children: [_jsx(SplitItem, { children: _jsx(Icon, { size: "lg", className: "pf-v6-u-mr-sm pf-v6-u-pt-md", children: _jsx(IconComponent, {}) }) }), _jsx(SplitItem, { className: "pf-u-background-color-200", children: _jsxs("div", { className: "pf-v6-u-display-flex pf-u-align-items-center", children: [_jsx("div", { children: "." }), _jsx("div", { children: "." }), _jsx("div", { children: "." })] }) })] }));
|
13
5
|
export default LoadingMessage;
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { render, screen } from '@testing-library/react';
|
3
3
|
import '@testing-library/jest-dom';
|
4
4
|
import LoadingMessage from './LoadingMessage';
|
5
5
|
describe('LoadingMessage', () => {
|
6
6
|
it('should render loading message', () => {
|
7
|
-
const { container } = render(
|
7
|
+
const { container } = render(_jsx(LoadingMessage, {}));
|
8
8
|
expect(container).toMatchSnapshot();
|
9
9
|
});
|
10
10
|
it('should render loading message correctly', () => {
|
11
|
-
render(
|
11
|
+
render(_jsx(LoadingMessage, {}));
|
12
12
|
expect(screen.getAllByText('.')).toBeTruthy();
|
13
13
|
expect(screen.getAllByText('.')).toHaveLength(3);
|
14
14
|
});
|
@@ -1,4 +1,21 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
|
1
|
+
import { ExpandableSectionProps, ExpandableSectionToggleProps } from '@patternfly/react-core';
|
2
|
+
export interface CodeBlockMessageProps {
|
3
|
+
/** Content rendered in code block */
|
4
|
+
children?: React.ReactNode;
|
5
|
+
/** Aria label applied to code block */
|
6
|
+
'aria-label'?: string;
|
7
|
+
/** Class name applied to code block */
|
8
|
+
className?: string;
|
9
|
+
/** Whether code block is expandable */
|
10
|
+
isExpandable?: boolean;
|
11
|
+
/** Additional props passed to expandable section if isExpandable is applied */
|
12
|
+
expandableSectionProps?: Omit<ExpandableSectionProps, 'ref'>;
|
13
|
+
/** Additional props passed to expandable toggle if isExpandable is applied */
|
14
|
+
expandableSectionToggleProps?: ExpandableSectionToggleProps;
|
15
|
+
/** Link text applied to expandable toggle when expanded */
|
16
|
+
expandedText?: string;
|
17
|
+
/** Link text applied to expandable toggle when collapsed */
|
18
|
+
collapsedText?: string;
|
19
|
+
}
|
20
|
+
declare const CodeBlockMessage: ({ children, className, "aria-label": ariaLabel, isExpandable, expandableSectionProps, expandableSectionToggleProps, expandedText, collapsedText, ...props }: CodeBlockMessageProps) => import("react/jsx-runtime").JSX.Element;
|
4
21
|
export default CodeBlockMessage;
|
@@ -9,30 +9,39 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
12
13
|
// ============================================================================
|
13
14
|
// Chatbot Main - Message - Content - Code Block
|
14
15
|
// ============================================================================
|
15
|
-
import
|
16
|
+
import { useState, useRef, useId, useCallback, useEffect } from 'react';
|
16
17
|
import SyntaxHighlighter from 'react-syntax-highlighter';
|
17
18
|
import { obsidian } from 'react-syntax-highlighter/dist/esm/styles/hljs';
|
18
19
|
// Import PatternFly components
|
19
|
-
import { CodeBlock, CodeBlockAction, CodeBlockCode, Button, Tooltip } from '@patternfly/react-core';
|
20
|
+
import { CodeBlock, CodeBlockAction, CodeBlockCode, Button, Tooltip, ExpandableSection, ExpandableSectionToggle, ExpandableSectionVariant } from '@patternfly/react-core';
|
20
21
|
import { CheckIcon } from '@patternfly/react-icons/dist/esm/icons/check-icon';
|
21
22
|
import { CopyIcon } from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
23
|
+
import { ExpandableSectionForSyntaxHighlighter } from './ExpandableSectionForSyntaxHighlighter';
|
22
24
|
const CodeBlockMessage = (_a) => {
|
23
25
|
var _b;
|
24
|
-
var { children, className, 'aria-label': ariaLabel } = _a, props = __rest(_a, ["children", "className", 'aria-label']);
|
25
|
-
const [copied, setCopied] =
|
26
|
-
const
|
27
|
-
const
|
26
|
+
var { children, className, 'aria-label': ariaLabel, isExpandable = false, expandableSectionProps, expandableSectionToggleProps, expandedText = 'Show less', collapsedText = 'Show more' } = _a, props = __rest(_a, ["children", "className", 'aria-label', "isExpandable", "expandableSectionProps", "expandableSectionToggleProps", "expandedText", "collapsedText"]);
|
27
|
+
const [copied, setCopied] = useState(false);
|
28
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
29
|
+
const buttonRef = useRef();
|
30
|
+
const tooltipID = useId();
|
31
|
+
const toggleId = useId();
|
32
|
+
const contentId = useId();
|
33
|
+
const codeBlockRef = useRef(null);
|
28
34
|
const language = (_b = /language-(\w+)/.exec(className || '')) === null || _b === void 0 ? void 0 : _b[1];
|
35
|
+
const onToggle = (isExpanded) => {
|
36
|
+
setIsExpanded(isExpanded);
|
37
|
+
};
|
29
38
|
// Handle clicking copy button
|
30
|
-
const handleCopy =
|
39
|
+
const handleCopy = useCallback((event, text) => {
|
31
40
|
navigator.clipboard.writeText(text.toString());
|
32
41
|
setCopied(true);
|
33
42
|
}, []);
|
34
43
|
// Reset copied state
|
35
|
-
|
44
|
+
useEffect(() => {
|
36
45
|
if (copied) {
|
37
46
|
const timer = setTimeout(() => {
|
38
47
|
setCopied(false);
|
@@ -41,16 +50,13 @@ const CodeBlockMessage = (_a) => {
|
|
41
50
|
}
|
42
51
|
});
|
43
52
|
if (!String(children).includes('\n')) {
|
44
|
-
return (
|
53
|
+
return (_jsx("code", Object.assign({}, props, { className: "pf-chatbot__message-inline-code", children: children })));
|
45
54
|
}
|
46
55
|
// Setup code block header
|
47
|
-
const actions = (
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
return (React.createElement("div", { className: "pf-chatbot__message-code-block" },
|
53
|
-
React.createElement(CodeBlock, { actions: actions },
|
54
|
-
React.createElement(CodeBlockCode, null, language ? (React.createElement(SyntaxHighlighter, Object.assign({}, props, { language: language, style: obsidian, PreTag: "div", CodeTag: "div", wrapLongLines: true }), String(children).replace(/\n$/, ''))) : (React.createElement(React.Fragment, null, children))))));
|
56
|
+
const actions = (_jsx(_Fragment, { children: _jsxs(CodeBlockAction, { children: [language && _jsx("div", { className: "pf-chatbot__message-code-block-language", children: language }), _jsx(Button, { ref: buttonRef, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : 'Copy code', variant: "plain", className: "pf-chatbot__button--copy", onClick: (event) => handleCopy(event, children), children: copied ? _jsx(CheckIcon, {}) : _jsx(CopyIcon, {}) }), _jsx(Tooltip, { id: tooltipID, content: "Copy", position: "top", triggerRef: buttonRef })] }) }));
|
57
|
+
return (_jsx("div", { className: "pf-chatbot__message-code-block", ref: codeBlockRef, children: _jsxs(CodeBlock, { actions: actions, children: [_jsx(CodeBlockCode, { children: _jsx(_Fragment, { children: language ? (
|
58
|
+
// SyntaxHighlighter doesn't work with ExpandableSection because it targets the direct child
|
59
|
+
// Forked for now and adjusted to match what we need
|
60
|
+
_jsx(ExpandableSectionForSyntaxHighlighter, Object.assign({ variant: ExpandableSectionVariant.truncate, isExpanded: isExpanded, isDetached: true, toggleId: toggleId, contentId: contentId, language: language }, expandableSectionProps, { children: _jsx(SyntaxHighlighter, Object.assign({}, props, { language: language, style: obsidian, PreTag: "div", CodeTag: "div", wrapLongLines: true, children: String(children).replace(/\n$/, '') })) }))) : (_jsx(ExpandableSection, Object.assign({ variant: ExpandableSectionVariant.truncate, isExpanded: isExpanded, isDetached: true, toggleId: toggleId, contentId: contentId }, expandableSectionProps, { children: children }))) }) }), isExpandable && (_jsx(ExpandableSectionToggle, Object.assign({ isExpanded: isExpanded, onToggle: onToggle, direction: "up", toggleId: toggleId, contentId: contentId, hasTruncatedContent: true, className: "pf-chatbot__message-code-toggle" }, expandableSectionToggleProps, { children: isExpanded ? expandedText : collapsedText })))] }) }));
|
55
61
|
};
|
56
62
|
export default CodeBlockMessage;
|