@patternfly/chatbot 6.3.0-prerelease.9 → 6.3.0
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 +8 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -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 +23 -2
- package/dist/cjs/FileDropZone/FileDropZone.js +11 -9
- package/dist/cjs/FileDropZone/FileDropZone.test.js +86 -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 +34 -16
- package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
- package/dist/cjs/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +139 -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 +24 -8
- package/dist/cjs/Message/Message.js +49 -71
- package/dist/cjs/Message/Message.test.js +112 -82
- 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/index.d.ts +1 -0
- package/dist/cjs/Message/Plugins/index.js +5 -0
- package/dist/cjs/Message/Plugins/rehypeCodeBlockToggle.d.ts +2 -0
- package/dist/cjs/Message/Plugins/rehypeCodeBlockToggle.js +24 -0
- 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 +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/Message/index.d.ts +1 -0
- package/dist/cjs/Message/index.js +3 -1
- package/dist/cjs/MessageBar/AttachButton.d.ts +25 -2
- package/dist/cjs/MessageBar/AttachButton.js +10 -20
- package/dist/cjs/MessageBar/AttachButton.test.js +102 -24
- package/dist/cjs/MessageBar/MessageBar.d.ts +31 -3
- package/dist/cjs/MessageBar/MessageBar.js +30 -32
- package/dist/cjs/MessageBar/MessageBar.test.js +122 -108
- 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 +21 -5
- package/dist/cjs/MessageBox/MessageBox.js +170 -45
- package/dist/cjs/MessageBox/MessageBox.test.js +219 -6
- 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 +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 +39 -18
- package/dist/cjs/ResponseActions/ResponseActions.test.js +120 -41
- 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 +12 -3
- package/dist/cjs/SourcesCard/SourcesCard.js +17 -42
- package/dist/cjs/SourcesCard/SourcesCard.test.js +70 -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/css/main.css +15 -7
- 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 +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 +8 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +11 -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 +23 -2
- package/dist/esm/FileDropZone/FileDropZone.js +11 -6
- package/dist/esm/FileDropZone/FileDropZone.test.js +84 -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 +35 -17
- package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.d.ts +62 -0
- package/dist/esm/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.js +133 -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 +24 -8
- package/dist/esm/Message/Message.js +49 -71
- package/dist/esm/Message/Message.test.js +112 -82
- 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/index.d.ts +1 -0
- package/dist/esm/Message/Plugins/index.js +1 -0
- package/dist/esm/Message/Plugins/rehypeCodeBlockToggle.d.ts +2 -0
- package/dist/esm/Message/Plugins/rehypeCodeBlockToggle.js +20 -0
- 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 +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/Message/index.d.ts +1 -0
- package/dist/esm/Message/index.js +1 -0
- package/dist/esm/MessageBar/AttachButton.d.ts +25 -2
- package/dist/esm/MessageBar/AttachButton.js +10 -17
- package/dist/esm/MessageBar/AttachButton.test.js +95 -17
- package/dist/esm/MessageBar/MessageBar.d.ts +31 -3
- package/dist/esm/MessageBar/MessageBar.js +28 -30
- package/dist/esm/MessageBar/MessageBar.test.js +87 -73
- 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 +9 -9
- package/dist/esm/MessageBar/StopButton.d.ts +3 -2
- package/dist/esm/MessageBar/StopButton.js +3 -9
- package/dist/esm/MessageBar/StopButton.test.js +9 -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 +170 -45
- package/dist/esm/MessageBox/MessageBox.test.js +220 -7
- 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 +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 +40 -19
- package/dist/esm/ResponseActions/ResponseActions.test.js +95 -16
- 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 +12 -3
- package/dist/esm/SourcesCard/SourcesCard.js +17 -39
- package/dist/esm/SourcesCard/SourcesCard.test.js +29 -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/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 +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +24 -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/MessageWithClickedResponseActions.tsx +25 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +3 -12
- 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 +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +3 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +19 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +5 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +25 -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 +6 -6
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +7 -7
- 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 +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 +37 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +19 -25
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +42 -15
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +15 -14
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +19 -25
- 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 +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 +26 -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 +112 -1
- package/src/FileDropZone/FileDropZone.tsx +44 -4
- 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 +126 -18
- package/src/Message/CodeBlockMessage/ExpandableSectionForSyntaxHighlighter.tsx +223 -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.test.tsx +49 -6
- package/src/Message/Message.tsx +31 -14
- package/src/Message/MessageInput.tsx +5 -5
- package/src/Message/MessageLoading.tsx +0 -2
- package/src/Message/Plugins/index.ts +1 -0
- package/src/Message/Plugins/rehypeCodeBlockToggle.ts +24 -0
- package/src/Message/Plugins/rehypeMoveImagesOutOfParagraphs.ts +53 -0
- 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.scss +2 -5
- 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/Message/index.ts +1 -0
- package/src/MessageBar/AttachButton.test.tsx +127 -8
- package/src/MessageBar/AttachButton.tsx +49 -6
- package/src/MessageBar/MessageBar.test.tsx +81 -30
- package/src/MessageBar/MessageBar.tsx +85 -19
- package/src/MessageBar/MicrophoneButton.tsx +10 -7
- package/src/MessageBar/SendButton.test.tsx +5 -6
- package/src/MessageBar/SendButton.tsx +4 -3
- package/src/MessageBar/StopButton.test.tsx +5 -6
- package/src/MessageBar/StopButton.tsx +4 -3
- package/src/MessageBox/JumpButton.test.tsx +4 -5
- package/src/MessageBox/JumpButton.tsx +3 -3
- package/src/MessageBox/MessageBox.test.tsx +295 -5
- package/src/MessageBox/MessageBox.tsx +301 -84
- 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 +6 -5
- package/src/ResponseActions/ResponseActions.test.tsx +121 -4
- package/src/ResponseActions/ResponseActions.tsx +71 -12
- 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 +14 -1
- package/src/SourcesCard/SourcesCard.tsx +19 -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,48 +7,48 @@ 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 ChatbotToggle from './ChatbotToggle';
|
|
15
15
|
describe('ChatbotToggle', () => {
|
|
16
16
|
it('should render tooltipLabel correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
render(
|
|
17
|
+
render(_jsx(ChatbotToggle, { tooltipLabel: "Tooltip" }));
|
|
18
18
|
yield userEvent.click(screen.getByRole('button', { name: /Tooltip toggle/i }));
|
|
19
19
|
expect(screen.getByRole('tooltip', { name: /Tooltip/i })).toBeTruthy();
|
|
20
20
|
}));
|
|
21
21
|
it('should render toggleButtonLabel correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
render(
|
|
22
|
+
render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", toggleButtonLabel: "Button" }));
|
|
23
23
|
expect(screen.getByRole('button', { name: /Button/i })).toBeTruthy();
|
|
24
24
|
}));
|
|
25
25
|
it('should call onToggleChatbot when clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
26
|
const spy = jest.fn();
|
|
27
|
-
render(
|
|
27
|
+
render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", onToggleChatbot: spy }));
|
|
28
28
|
yield userEvent.click(screen.getByRole('button'));
|
|
29
29
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
30
30
|
}));
|
|
31
31
|
it('should handle isChatbotVisible correctly when true', () => {
|
|
32
|
-
render(
|
|
32
|
+
render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", isChatbotVisible: true, openIconTestId: "Open" }));
|
|
33
33
|
expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
|
|
34
34
|
expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button--active');
|
|
35
35
|
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true');
|
|
36
36
|
expect(screen.getByTestId('Open')).toBeTruthy();
|
|
37
37
|
});
|
|
38
38
|
it('should handle isChatbotVisible correctly when false', () => {
|
|
39
|
-
render(
|
|
39
|
+
render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", isChatbotVisible: false, openIconTestId: "Open" }));
|
|
40
40
|
expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
|
|
41
41
|
expect(screen.getByRole('button')).not.toHaveClass('pf-chatbot__button--active');
|
|
42
42
|
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'false');
|
|
43
43
|
expect(screen.queryByTestId('Open')).toBeFalsy();
|
|
44
44
|
});
|
|
45
45
|
it('should handle isRound correctly', () => {
|
|
46
|
-
render(
|
|
46
|
+
render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", isRound: true }));
|
|
47
47
|
expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
|
|
48
48
|
expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button--round');
|
|
49
49
|
});
|
|
50
50
|
it('should handle className correctly', () => {
|
|
51
|
-
render(
|
|
51
|
+
render(_jsx(ChatbotToggle, { tooltipLabel: "Chatbot", className: "test" }));
|
|
52
52
|
expect(screen.getByRole('button')).toHaveClass('pf-chatbot__button');
|
|
53
53
|
expect(screen.getByRole('button')).toHaveClass('test');
|
|
54
54
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
2
|
export interface ChatbotWelcomePromptProps extends React.HTMLProps<HTMLDivElement> {
|
|
3
3
|
/** Title for the welcome message*/
|
|
4
4
|
title: string;
|
|
@@ -20,5 +20,5 @@ export interface WelcomePrompt {
|
|
|
20
20
|
/** Callback handler for the onClick event for welcome prompt */
|
|
21
21
|
onClick?: () => void;
|
|
22
22
|
}
|
|
23
|
-
export declare const ChatbotWelcomePrompt:
|
|
23
|
+
export declare const ChatbotWelcomePrompt: FunctionComponent<ChatbotWelcomePromptProps>;
|
|
24
24
|
export default ChatbotWelcomePrompt;
|
|
@@ -9,25 +9,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
// Chatbot Layout - Chat - Welcome
|
|
14
|
-
// ============================================================================
|
|
15
|
-
import React from 'react';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
13
|
import { Content, ContentVariants, Card, CardHeader, CardTitle, CardBody } from '@patternfly/react-core';
|
|
17
14
|
export const ChatbotWelcomePrompt = (_a) => {
|
|
18
15
|
var { title, description, prompts, className, testId, isCompact = false } = _a, props = __rest(_a, ["title", "description", "prompts", "className", "testId", "isCompact"]);
|
|
19
|
-
return (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
prompts && (React.createElement("div", { className: "pf-chatbot__prompt-suggestions" }, prompts === null || prompts === void 0 ? void 0 : prompts.map((prompt, index) => (React.createElement(Card, { key: `welcome-prompt-${index}`, className: "pf-chatbot__prompt-suggestion", isClickable: true, isCompact: isCompact },
|
|
25
|
-
React.createElement(CardHeader, { selectableActions: {
|
|
26
|
-
onClickAction: prompt.onClick,
|
|
27
|
-
selectableActionId: `welcome-prompt-input-${index}`,
|
|
28
|
-
selectableActionAriaLabelledby: `welcome-prompt-title-${index}`
|
|
29
|
-
} },
|
|
30
|
-
React.createElement(CardTitle, { id: `welcome-prompt-title-${index}` }, prompt.title)),
|
|
31
|
-
prompt.message && React.createElement(CardBody, null, prompt.message))))))));
|
|
16
|
+
return (_jsxs("div", Object.assign({ "data-testid": testId, className: `pf-chatbot--layout--welcome ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}` }, props, { children: [_jsxs(Content, { component: ContentVariants.h1, children: [_jsx("span", { className: "pf-chatbot__hello", children: title }), _jsx("br", {}), _jsx("span", { className: "pf-chatbot__question", children: description })] }), prompts && (_jsx("div", { className: "pf-chatbot__prompt-suggestions", children: prompts === null || prompts === void 0 ? void 0 : prompts.map((prompt, index) => (_jsxs(Card, { className: "pf-chatbot__prompt-suggestion", isClickable: true, isCompact: isCompact, children: [_jsx(CardHeader, { selectableActions: {
|
|
17
|
+
onClickAction: prompt.onClick,
|
|
18
|
+
selectableActionId: `welcome-prompt-input-${index}`,
|
|
19
|
+
selectableActionAriaLabelledby: `welcome-prompt-title-${index}`
|
|
20
|
+
}, children: _jsx(CardTitle, { id: `welcome-prompt-title-${index}`, children: prompt.title }) }), prompt.message && _jsx(CardBody, { children: prompt.message })] }, `welcome-prompt-${index}`))) }))] })));
|
|
32
21
|
};
|
|
33
22
|
export default ChatbotWelcomePrompt;
|
|
@@ -7,34 +7,34 @@ 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 ChatbotWelcomePrompt from './ChatbotWelcomePrompt';
|
|
14
14
|
import userEvent from '@testing-library/user-event';
|
|
15
15
|
describe('ChatbotWelcomePrompt', () => {
|
|
16
16
|
it('should render welcome prompt', () => {
|
|
17
|
-
const { container } = render(
|
|
17
|
+
const { container } = render(_jsx(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
|
|
18
18
|
expect(container).toMatchSnapshot();
|
|
19
19
|
});
|
|
20
20
|
it('should render correctly', () => {
|
|
21
|
-
render(
|
|
21
|
+
render(_jsx(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
|
|
22
22
|
expect(screen.getByText('Hi, ChatBot User!')).toBeTruthy();
|
|
23
23
|
expect(screen.getByText('How can I help you today?')).toBeTruthy();
|
|
24
24
|
});
|
|
25
25
|
it('should render prompts with titles correctly', () => {
|
|
26
|
-
render(
|
|
26
|
+
render(_jsx(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [{ title: 'Set up account' }] }));
|
|
27
27
|
expect(screen.getByText('Set up account')).toBeTruthy();
|
|
28
28
|
});
|
|
29
29
|
it('should render prompts with messages correctly', () => {
|
|
30
|
-
render(
|
|
30
|
+
render(_jsx(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
|
|
31
31
|
{ title: 'Set up account', message: 'Choose the necessary settings and preferences for your account.' }
|
|
32
32
|
] }));
|
|
33
33
|
expect(screen.getByText('Choose the necessary settings and preferences for your account.')).toBeTruthy();
|
|
34
34
|
});
|
|
35
35
|
it('should render prompts with onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
36
|
const spy = jest.fn();
|
|
37
|
-
render(
|
|
37
|
+
render(_jsx(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
|
|
38
38
|
{
|
|
39
39
|
title: 'Set up account',
|
|
40
40
|
message: 'Choose the necessary settings and preferences for your account.',
|
|
@@ -45,12 +45,12 @@ describe('ChatbotWelcomePrompt', () => {
|
|
|
45
45
|
expect(spy).toHaveBeenCalled();
|
|
46
46
|
}));
|
|
47
47
|
it('should apply className appropriately', () => {
|
|
48
|
-
render(
|
|
48
|
+
render(_jsx(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", className: "test", testId: "welcome-prompt" }));
|
|
49
49
|
const element = screen.getByTestId('welcome-prompt');
|
|
50
50
|
expect(element).toHaveClass('test');
|
|
51
51
|
});
|
|
52
52
|
it('should handle isCompact', () => {
|
|
53
|
-
render(
|
|
53
|
+
render(_jsx(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", className: "test", testId: "welcome-prompt", isCompact: true }));
|
|
54
54
|
expect(screen.getByTestId('welcome-prompt')).toHaveClass('pf-m-compact');
|
|
55
55
|
});
|
|
56
56
|
});
|
|
@@ -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 */
|
|
@@ -31,6 +31,12 @@ export interface CodeModalProps {
|
|
|
31
31
|
displayMode?: ChatbotDisplayMode;
|
|
32
32
|
/** Sets modal to compact styling. */
|
|
33
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;
|
|
34
40
|
}
|
|
35
|
-
export declare const CodeModal:
|
|
41
|
+
export declare const CodeModal: FunctionComponent<CodeModalProps>;
|
|
36
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, isCompact } = _a, props = __rest(_a, ["fileName", "code", "codeEditorControlClassName", "handleModalToggle", "isCopyEnabled", "isLineNumbersVisible", "isModalOpen", "isReadOnly", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "displayMode", "isCompact"]);
|
|
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-editor" },
|
|
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;
|
|
@@ -1,10 +1,29 @@
|
|
|
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 { render, screen, within } from '@testing-library/react';
|
|
3
12
|
import '@testing-library/jest-dom';
|
|
4
13
|
import CodeModal from './CodeModal';
|
|
5
14
|
describe('ChatbotModal', () => {
|
|
6
15
|
it('should render compact modal', () => {
|
|
7
|
-
render(
|
|
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" }));
|
|
8
17
|
expect(screen.getByRole('dialog')).toHaveClass('pf-m-compact');
|
|
9
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
|
+
}));
|
|
10
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, FileError, FileRejection } 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,28 @@ 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;
|
|
22
|
+
/** Minimum file size allowed */
|
|
23
|
+
minSize?: number;
|
|
24
|
+
/** Max file size allowed */
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
/** Max number of files allowed */
|
|
27
|
+
maxFiles?: number;
|
|
28
|
+
/** Whether attachments are disabled */
|
|
29
|
+
isAttachmentDisabled?: boolean;
|
|
30
|
+
/** Callback when file(s) are attached */
|
|
31
|
+
onAttach?: <T extends File>(acceptedFiles: T[], fileRejections: FileRejection[], event: DropEvent) => void;
|
|
32
|
+
/** Callback function for AttachButton when an attachment fails */
|
|
33
|
+
onAttachRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;
|
|
34
|
+
/** Validator for files; see https://react-dropzone.js.org/#!/Custom%20validation for more information */
|
|
35
|
+
validator?: <T extends File>(file: T) => FileError | readonly FileError[] | null;
|
|
15
36
|
}
|
|
16
|
-
declare const FileDropZone:
|
|
37
|
+
declare const FileDropZone: FunctionComponent<FileDropZoneProps>;
|
|
17
38
|
export default FileDropZone;
|
|
@@ -9,15 +9,20 @@ 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
|
-
|
|
18
|
+
var { children, className, infoText = 'Maximum file size is 25 MB', onFileDrop, allowedFileTypes, minSize, maxSize, maxFiles, isAttachmentDisabled, onAttach, onAttachRejected, validator, displayMode = ChatbotDisplayMode.default } = _a, props = __rest(_a, ["children", "className", "infoText", "onFileDrop", "allowedFileTypes", "minSize", "maxSize", "maxFiles", "isAttachmentDisabled", "onAttach", "onAttachRejected", "validator", "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: (acceptedFiles, fileRejections, event) => {
|
|
22
|
+
setShowDropZone(false);
|
|
23
|
+
onAttach && onAttach(acceptedFiles, fileRejections, event);
|
|
24
|
+
}, minSize,
|
|
25
|
+
maxSize,
|
|
26
|
+
maxFiles, disabled: isAttachmentDisabled, onDropRejected: onAttachRejected, validator }, 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
27
|
};
|
|
23
28
|
export default FileDropZone;
|