@patternfly/chatbot 6.8.0-prerelease.7 → 6.8.0-prerelease.9
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/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +46 -5
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +125 -16
- package/dist/cjs/CodeModal/CodeModal.js +5 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +26 -7
- package/dist/cjs/MarkdownContent/MarkdownContent.js +79 -166
- package/dist/cjs/MarkdownContent/MarkdownRenderer.d.ts +6 -0
- package/dist/cjs/MarkdownContent/MarkdownRenderer.js +187 -0
- package/dist/cjs/Message/Message.d.ts +3 -4
- package/dist/cjs/Message/Message.js +0 -2
- package/dist/cjs/MessageBox/MessageBox.d.ts +2 -0
- package/dist/cjs/MessageBox/MessageBox.js +7 -2
- package/dist/cjs/index.d.ts +0 -8
- package/dist/cjs/index.js +1 -13
- package/dist/css/main.css +77 -10
- package/dist/css/main.css.map +1 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +46 -5
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +128 -19
- package/dist/esm/CodeModal/CodeModal.js +5 -0
- package/dist/esm/MarkdownContent/MarkdownContent.d.ts +26 -7
- package/dist/esm/MarkdownContent/MarkdownContent.js +52 -165
- package/dist/esm/MarkdownContent/MarkdownRenderer.d.ts +6 -0
- package/dist/esm/MarkdownContent/MarkdownRenderer.js +182 -0
- package/dist/esm/Message/Message.d.ts +3 -4
- package/dist/esm/Message/Message.js +0 -2
- package/dist/esm/MessageBox/MessageBox.d.ts +2 -0
- package/dist/esm/MessageBox/MessageBox.js +7 -2
- package/dist/esm/index.d.ts +0 -8
- package/dist/esm/index.js +0 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/generate-index.js +41 -16
- package/generate-index.test.js +68 -0
- package/monaco-environment.js +45 -0
- package/package.json +20 -2
- package/patternfly-docs/content/extensions/chatbot/chatbot.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/monitor-sampleapp-quickstart.ts +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithExpandableGroups.tsx +104 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +12 -1
- package/patternfly-docs/content/extensions/chatbot/tree-shaking.md +124 -0
- package/patternfly-docs/monaco-environment.js +45 -0
- package/patternfly-docs/patternfly-docs.css.js +6 -0
- package/src/Chatbot/Chatbot.scss +4 -0
- package/src/ChatbotContent/ChatbotContent.scss +1 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +52 -6
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +551 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +350 -49
- package/src/ChatbotFooter/ChatbotFooter.scss +2 -2
- package/src/ChatbotHeader/ChatbotHeader.scss +4 -0
- package/src/ChatbotModal/ChatbotModal.scss +10 -0
- package/src/ChatbotToggle/ChatbotToggle.scss +6 -0
- package/src/CodeModal/CodeModal.tsx +6 -0
- package/src/DeepThinking/DeepThinking.test.tsx +10 -12
- package/src/MarkdownContent/MarkdownContent.test.tsx +52 -5
- package/src/MarkdownContent/MarkdownContent.tsx +77 -220
- package/src/MarkdownContent/MarkdownRenderer.tsx +235 -0
- package/src/Message/Message.scss +5 -0
- package/src/Message/Message.test.tsx +5 -0
- package/src/Message/Message.tsx +3 -5
- package/src/MessageBox/MessageBox.scss +15 -1
- package/src/MessageBox/MessageBox.tsx +23 -2
- package/src/ResponseActions/ResponseActions.test.tsx +42 -48
- package/src/ToolCall/ToolCall.test.tsx +6 -9
- package/src/ToolResponse/ToolResponse.test.tsx +16 -22
- package/src/index.ts +0 -12
- package/src/test-utils/markdownTestUtils.ts +21 -0
- package/tsconfig.json +6 -1
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +0 -77
- package/dist/cjs/Chatbot/Chatbot.test.d.ts +0 -1
- package/dist/cjs/Chatbot/Chatbot.test.js +0 -32
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +0 -27
- package/dist/cjs/ChatbotContent/ChatbotContent.test.d.ts +0 -1
- package/dist/cjs/ChatbotContent/ChatbotContent.test.js +0 -22
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -75
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -277
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +0 -27
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +0 -87
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -46
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -44
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -55
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +0 -1
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +0 -16
- package/dist/cjs/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
- package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +0 -64
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -61
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +0 -1
- package/dist/cjs/CodeModal/CodeModal.test.js +0 -34
- package/dist/cjs/Compare/Compare.test.d.ts +0 -1
- package/dist/cjs/Compare/Compare.test.js +0 -18
- package/dist/cjs/DeepThinking/DeepThinking.test.d.ts +0 -1
- package/dist/cjs/DeepThinking/DeepThinking.test.js +0 -146
- package/dist/cjs/FileDetails/FileDetails.test.d.ts +0 -1
- package/dist/cjs/FileDetails/FileDetails.test.js +0 -42
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +0 -79
- package/dist/cjs/FileDropZone/FileDropZone.test.d.ts +0 -1
- package/dist/cjs/FileDropZone/FileDropZone.test.js +0 -100
- package/dist/cjs/FilePreview/FilePreview.test.d.ts +0 -1
- package/dist/cjs/FilePreview/FilePreview.test.js +0 -97
- package/dist/cjs/ImagePreview/ImagePreview.test.d.ts +0 -1
- package/dist/cjs/ImagePreview/ImagePreview.test.js +0 -225
- package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +0 -1
- package/dist/cjs/MarkdownContent/MarkdownContent.test.js +0 -192
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -131
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +0 -30
- package/dist/cjs/Message/Message.test.d.ts +0 -1
- package/dist/cjs/Message/Message.test.js +0 -1128
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +0 -25
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -25
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -25
- package/dist/cjs/Message/MessageLoading.test.d.ts +0 -1
- package/dist/cjs/Message/MessageLoading.test.js +0 -25
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +0 -109
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +0 -76
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +0 -181
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +0 -243
- package/dist/cjs/MessageBar/AttachButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/AttachButton.test.js +0 -152
- package/dist/cjs/MessageBar/MessageBar.test.d.ts +0 -1
- package/dist/cjs/MessageBar/MessageBar.test.js +0 -338
- package/dist/cjs/MessageBar/SendButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/SendButton.test.js +0 -58
- package/dist/cjs/MessageBar/StopButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/StopButton.test.js +0 -58
- package/dist/cjs/MessageBox/JumpButton.test.d.ts +0 -1
- package/dist/cjs/MessageBox/JumpButton.test.js +0 -39
- package/dist/cjs/MessageBox/MessageBox.test.d.ts +0 -1
- package/dist/cjs/MessageBox/MessageBox.test.js +0 -294
- package/dist/cjs/MessageDivider/MessageDivider.test.d.ts +0 -1
- package/dist/cjs/MessageDivider/MessageDivider.test.js +0 -29
- package/dist/cjs/Onboarding/Onboarding.test.d.ts +0 -1
- package/dist/cjs/Onboarding/Onboarding.test.js +0 -80
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +0 -50
- package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +0 -54
- package/dist/cjs/ResponseActions/ResponseActions.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActions.test.js +0 -455
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +0 -25
- package/dist/cjs/Settings/SettingsForm.test.d.ts +0 -1
- package/dist/cjs/Settings/SettingsForm.test.js +0 -35
- package/dist/cjs/SourcesCard/SourcesCard.test.d.ts +0 -1
- package/dist/cjs/SourcesCard/SourcesCard.test.js +0 -39
- package/dist/cjs/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
- package/dist/cjs/SourcesCardBase/SourcesCardBase.test.js +0 -199
- package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +0 -1
- package/dist/cjs/TermsOfUse/TermsOfUse.test.js +0 -77
- package/dist/cjs/ToolCall/ToolCall.test.d.ts +0 -1
- package/dist/cjs/ToolCall/ToolCall.test.js +0 -201
- package/dist/cjs/ToolResponse/ToolResponse.test.d.ts +0 -1
- package/dist/cjs/ToolResponse/ToolResponse.test.js +0 -184
- package/dist/cjs/__mocks__/monaco-editor.d.ts +0 -11
- package/dist/cjs/__mocks__/monaco-editor.js +0 -18
- package/dist/cjs/__mocks__/rehype-external-links.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-external-links.js +0 -4
- package/dist/cjs/__mocks__/rehype-highlight.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-highlight.js +0 -4
- package/dist/cjs/__mocks__/rehype-sanitize.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-sanitize.js +0 -4
- package/dist/cjs/__mocks__/rehype-unwrap-images.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-unwrap-images.js +0 -4
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +0 -72
- package/dist/esm/Chatbot/Chatbot.test.d.ts +0 -1
- package/dist/esm/Chatbot/Chatbot.test.js +0 -27
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +0 -22
- package/dist/esm/ChatbotContent/ChatbotContent.test.d.ts +0 -1
- package/dist/esm/ChatbotContent/ChatbotContent.test.js +0 -17
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -70
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -272
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +0 -22
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +0 -82
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -44
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -42
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -50
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +0 -1
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +0 -11
- package/dist/esm/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
- package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +0 -59
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -56
- package/dist/esm/CodeModal/CodeModal.test.d.ts +0 -1
- package/dist/esm/CodeModal/CodeModal.test.js +0 -29
- package/dist/esm/Compare/Compare.test.d.ts +0 -1
- package/dist/esm/Compare/Compare.test.js +0 -13
- package/dist/esm/DeepThinking/DeepThinking.test.d.ts +0 -1
- package/dist/esm/DeepThinking/DeepThinking.test.js +0 -141
- package/dist/esm/FileDetails/FileDetails.test.d.ts +0 -1
- package/dist/esm/FileDetails/FileDetails.test.js +0 -37
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +0 -74
- package/dist/esm/FileDropZone/FileDropZone.test.d.ts +0 -1
- package/dist/esm/FileDropZone/FileDropZone.test.js +0 -95
- package/dist/esm/FilePreview/FilePreview.test.d.ts +0 -1
- package/dist/esm/FilePreview/FilePreview.test.js +0 -92
- package/dist/esm/ImagePreview/ImagePreview.test.d.ts +0 -1
- package/dist/esm/ImagePreview/ImagePreview.test.js +0 -220
- package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +0 -1
- package/dist/esm/MarkdownContent/MarkdownContent.test.js +0 -187
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -126
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +0 -25
- package/dist/esm/Message/Message.test.d.ts +0 -1
- package/dist/esm/Message/Message.test.js +0 -1123
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +0 -20
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -20
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -20
- package/dist/esm/Message/MessageLoading.test.d.ts +0 -1
- package/dist/esm/Message/MessageLoading.test.js +0 -20
- package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
- package/dist/esm/Message/QuickResponse/QuickResponse.test.js +0 -104
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +0 -48
- package/dist/esm/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +0 -176
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +0 -238
- package/dist/esm/MessageBar/AttachButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/AttachButton.test.js +0 -147
- package/dist/esm/MessageBar/MessageBar.test.d.ts +0 -1
- package/dist/esm/MessageBar/MessageBar.test.js +0 -333
- package/dist/esm/MessageBar/SendButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/SendButton.test.js +0 -53
- package/dist/esm/MessageBar/StopButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/StopButton.test.js +0 -53
- package/dist/esm/MessageBox/JumpButton.test.d.ts +0 -1
- package/dist/esm/MessageBox/JumpButton.test.js +0 -34
- package/dist/esm/MessageBox/MessageBox.test.d.ts +0 -1
- package/dist/esm/MessageBox/MessageBox.test.js +0 -289
- package/dist/esm/MessageDivider/MessageDivider.test.d.ts +0 -1
- package/dist/esm/MessageDivider/MessageDivider.test.js +0 -24
- package/dist/esm/Onboarding/Onboarding.test.d.ts +0 -1
- package/dist/esm/Onboarding/Onboarding.test.js +0 -75
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +0 -48
- package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +0 -49
- package/dist/esm/ResponseActions/ResponseActions.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActions.test.js +0 -450
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +0 -20
- package/dist/esm/Settings/SettingsForm.test.d.ts +0 -1
- package/dist/esm/Settings/SettingsForm.test.js +0 -33
- package/dist/esm/SourcesCard/SourcesCard.test.d.ts +0 -1
- package/dist/esm/SourcesCard/SourcesCard.test.js +0 -34
- package/dist/esm/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
- package/dist/esm/SourcesCardBase/SourcesCardBase.test.js +0 -194
- package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +0 -1
- package/dist/esm/TermsOfUse/TermsOfUse.test.js +0 -72
- package/dist/esm/ToolCall/ToolCall.test.d.ts +0 -1
- package/dist/esm/ToolCall/ToolCall.test.js +0 -196
- package/dist/esm/ToolResponse/ToolResponse.test.d.ts +0 -1
- package/dist/esm/ToolResponse/ToolResponse.test.js +0 -179
- package/dist/esm/__mocks__/monaco-editor.d.ts +0 -11
- package/dist/esm/__mocks__/monaco-editor.js +0 -18
- package/dist/esm/__mocks__/rehype-external-links.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-external-links.js +0 -2
- package/dist/esm/__mocks__/rehype-highlight.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-highlight.js +0 -2
- package/dist/esm/__mocks__/rehype-sanitize.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-sanitize.js +0 -2
- package/dist/esm/__mocks__/rehype-unwrap-images.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-unwrap-images.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FunctionComponent } from 'react';
|
|
2
|
-
import { ButtonProps, DrawerProps, DrawerPanelContentProps, DrawerContentProps, DrawerContentBodyProps, DrawerHeadProps, DrawerActionsProps, DrawerCloseButtonProps, DrawerPanelBodyProps, SkeletonProps, TitleProps, SearchInputProps, MenuProps, MenuListProps, MenuItemProps, MenuGroupProps, MenuContentProps } from '@patternfly/react-core';
|
|
1
|
+
import type { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps, DrawerProps, DrawerPanelContentProps, DrawerContentProps, DrawerContentBodyProps, DrawerHeadProps, DrawerActionsProps, DrawerCloseButtonProps, DrawerPanelBodyProps, SkeletonProps, TitleProps, SearchInputProps, MenuProps, MenuListProps, MenuItemProps, MenuGroupProps, MenuContentProps, ExpandableSectionProps, ExpandableSectionToggleProps } from '@patternfly/react-core';
|
|
3
3
|
import { ChatbotDisplayMode } from '../Chatbot/Chatbot';
|
|
4
4
|
import { HistoryEmptyStateProps } from './EmptyState';
|
|
5
5
|
export interface Conversation {
|
|
@@ -24,6 +24,49 @@ export interface Conversation {
|
|
|
24
24
|
/** Custom dropdown ID to ensure uniqueness across demo instances */
|
|
25
25
|
dropdownId?: string;
|
|
26
26
|
}
|
|
27
|
+
export interface ConversationGroupShowAll {
|
|
28
|
+
/** Number of items visible when collapsed */
|
|
29
|
+
visibleCount: number;
|
|
30
|
+
/** Whether all items are shown */
|
|
31
|
+
isExpanded: boolean;
|
|
32
|
+
/** Callback when show all / show less is toggled */
|
|
33
|
+
onToggle: (isExpanded: boolean) => void;
|
|
34
|
+
/** Custom content rendered in the show all / show less toggle. Defaults to "Show all" when collapsed and "Show less" when expanded. */
|
|
35
|
+
label?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
export interface ConversationGroupExpandable {
|
|
38
|
+
/** Whether the group content is expanded */
|
|
39
|
+
isExpanded: boolean;
|
|
40
|
+
/** Callback when the group is toggled */
|
|
41
|
+
onToggle: (isExpanded: boolean) => void;
|
|
42
|
+
/** Additional props applied to ExpandableSection */
|
|
43
|
+
expandableSectionProps?: Omit<ExpandableSectionProps, 'ref'>;
|
|
44
|
+
/** Additional props applied to ExpandableSectionToggle */
|
|
45
|
+
expandableSectionToggleProps?: ExpandableSectionToggleProps;
|
|
46
|
+
}
|
|
47
|
+
export interface ConversationGroup {
|
|
48
|
+
/** Unique group id */
|
|
49
|
+
id: string;
|
|
50
|
+
/** Group label rendered as a MenuGroup heading or expandable toggle label */
|
|
51
|
+
label: ReactNode;
|
|
52
|
+
/** Conversation items or custom menu content such as a "Show all" action */
|
|
53
|
+
items: (Conversation | ReactNode)[];
|
|
54
|
+
/** Content rendered after the group's menu list */
|
|
55
|
+
footer?: ReactNode;
|
|
56
|
+
/** Custom group header that replaces the default label or expandable toggle */
|
|
57
|
+
header?: ReactNode;
|
|
58
|
+
/** When set, the group renders as an expandable section */
|
|
59
|
+
expandable?: ConversationGroupExpandable;
|
|
60
|
+
/** When set, truncates the list with an expandable show all / show less section */
|
|
61
|
+
showAll?: ConversationGroupShowAll;
|
|
62
|
+
/** Additional props applied to the conversation menu group */
|
|
63
|
+
menuGroupProps?: MenuGroupProps;
|
|
64
|
+
/** Additional props applied to the conversation list */
|
|
65
|
+
menuListProps?: Omit<MenuListProps, 'children'>;
|
|
66
|
+
}
|
|
67
|
+
export type Conversations = (Conversation | ReactNode)[] | ConversationGroup[] | {
|
|
68
|
+
[key: string]: (Conversation | ReactNode)[];
|
|
69
|
+
};
|
|
27
70
|
export interface ChatbotConversationHistoryNavProps extends DrawerProps {
|
|
28
71
|
/** Function called to toggle drawer */
|
|
29
72
|
onDrawerToggle: (event: React.KeyboardEvent | React.MouseEvent | React.TransitionEvent) => void;
|
|
@@ -35,9 +78,7 @@ export interface ChatbotConversationHistoryNavProps extends DrawerProps {
|
|
|
35
78
|
/** Callback function for when an item is selected */
|
|
36
79
|
onSelectActiveItem?: (event?: React.MouseEvent, itemId?: string | number) => void;
|
|
37
80
|
/** Items shown in chat history */
|
|
38
|
-
conversations:
|
|
39
|
-
[key: string]: Conversation[];
|
|
40
|
-
};
|
|
81
|
+
conversations: Conversations;
|
|
41
82
|
/** Additional button props for new chat button. */
|
|
42
83
|
newChatButtonProps?: ButtonProps;
|
|
43
84
|
/** Additional props applied to conversation menu group. If conversations is an object, you should pass an object of MenuGroupProps for each group. */
|
|
@@ -24,35 +24,144 @@ const Chatbot_1 = require("../Chatbot/Chatbot");
|
|
|
24
24
|
const ChatbotConversationHistoryDropdown_1 = __importDefault(require("./ChatbotConversationHistoryDropdown"));
|
|
25
25
|
const LoadingState_1 = __importDefault(require("./LoadingState"));
|
|
26
26
|
const EmptyState_1 = __importDefault(require("./EmptyState"));
|
|
27
|
+
const isConversation = (item) => Boolean(item && typeof item === 'object' && 'id' in item && 'text' in item && !('items' in item));
|
|
28
|
+
const isConversationGroup = (item) => Boolean(item && typeof item === 'object' && 'id' in item && 'label' in item && 'items' in item);
|
|
29
|
+
const isConversationGroupArray = (items) => items.length > 0 && isConversationGroup(items[0]);
|
|
30
|
+
const getExpandableGroupContentId = (groupId) => `chatbot-nav-group-${groupId}-content`;
|
|
31
|
+
const getGroupLabelId = (groupId) => `chatbot-nav-group-${groupId}-label`;
|
|
32
|
+
const getExpandableGroupToggleId = (groupId) => `chatbot-nav-group-${groupId}-toggle`;
|
|
33
|
+
const getShowAllToggleId = (groupId) => `chatbot-nav-group-${groupId}-show-all-toggle`;
|
|
34
|
+
const getStaticMenuLabelId = (group) => { var _a, _b; return (_b = (_a = group.menuGroupProps) === null || _a === void 0 ? void 0 : _a.titleId) !== null && _b !== void 0 ? _b : getGroupLabelId(group.id); };
|
|
35
|
+
const getMenuListLabelledBy = (group) => {
|
|
36
|
+
var _a, _b, _c, _d;
|
|
37
|
+
if (group.expandable) {
|
|
38
|
+
return (_b = (_a = group.menuGroupProps) === null || _a === void 0 ? void 0 : _a['aria-labelledby']) !== null && _b !== void 0 ? _b : getExpandableGroupToggleId(group.id);
|
|
39
|
+
}
|
|
40
|
+
return (_d = (_c = group.menuGroupProps) === null || _c === void 0 ? void 0 : _c['aria-labelledby']) !== null && _d !== void 0 ? _d : getStaticMenuLabelId(group);
|
|
41
|
+
};
|
|
42
|
+
const getMenuListProps = (group) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
return (Object.assign(Object.assign({}, group.menuListProps), { 'aria-labelledby': (_b = (_a = group.menuListProps) === null || _a === void 0 ? void 0 : _a['aria-labelledby']) !== null && _b !== void 0 ? _b : getMenuListLabelledBy(group) }));
|
|
45
|
+
};
|
|
46
|
+
const focusElementById = (id) => {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
49
|
+
};
|
|
50
|
+
// Matches PatternFly's Menu "view more" example: expanding moves focus to the first
|
|
51
|
+
// newly revealed item; collapsing keeps focus on the toggle as it updates to "Show all".
|
|
52
|
+
const useShowAllFocusManagement = (isExpanded, toggleId, firstOverflowItemRef, hasOverflowItems) => {
|
|
53
|
+
const wasExpandedRef = (0, react_1.useRef)(isExpanded);
|
|
54
|
+
(0, react_1.useEffect)(() => {
|
|
55
|
+
var _a;
|
|
56
|
+
if (hasOverflowItems && isExpanded !== wasExpandedRef.current) {
|
|
57
|
+
if (isExpanded) {
|
|
58
|
+
(_a = firstOverflowItemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
focusElementById(toggleId);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
wasExpandedRef.current = isExpanded;
|
|
65
|
+
}, [isExpanded, toggleId, firstOverflowItemRef, hasOverflowItems]);
|
|
66
|
+
};
|
|
67
|
+
// The toggle is rendered as a real MenuItem (rather than a standalone button) so it
|
|
68
|
+
// participates in the Menu's built-in roving tabindex and arrow-key navigation just
|
|
69
|
+
// like any other conversation item, instead of being skipped over or interrupting
|
|
70
|
+
// arrow-key handling. Since it keeps a stable key and DOM position regardless of how
|
|
71
|
+
// many overflow items are shown, it also keeps focus across clicks without being
|
|
72
|
+
// unmounted or recreated.
|
|
73
|
+
const ShowAllGroupBody = ({ group, getNavItem }) => {
|
|
74
|
+
const { visibleCount, isExpanded, onToggle, label } = group.showAll;
|
|
75
|
+
const conversationItems = group.items.filter(isConversation);
|
|
76
|
+
const alwaysVisibleItems = conversationItems.slice(0, visibleCount);
|
|
77
|
+
const overflowItems = conversationItems.slice(visibleCount);
|
|
78
|
+
const hasOverflowItems = overflowItems.length > 0;
|
|
79
|
+
const toggleId = getShowAllToggleId(group.id);
|
|
80
|
+
const firstOverflowItemRef = (0, react_1.useRef)(null);
|
|
81
|
+
const toggleLabel = label !== null && label !== void 0 ? label : (isExpanded ? 'Show less' : 'Show all');
|
|
82
|
+
useShowAllFocusManagement(isExpanded, toggleId, firstOverflowItemRef, hasOverflowItems);
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_core_1.MenuList, Object.assign({}, getMenuListProps(group), { children: [alwaysVisibleItems.map((chat) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: getNavItem(chat) }, chat.id))), isExpanded &&
|
|
84
|
+
overflowItems.map((chat, index) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: getNavItem(chat, undefined, index === 0 ? firstOverflowItemRef : undefined) }, chat.id))), hasOverflowItems && ((0, jsx_runtime_1.jsx)(react_core_1.MenuItem, { id: toggleId, itemId: toggleId, className: "pf-chatbot__menu-show-all-toggle", onClick: () => onToggle(!isExpanded), children: toggleLabel }, "show-all-toggle"))] })), group.footer] }));
|
|
85
|
+
};
|
|
86
|
+
const ExpandableConversationGroup = ({ group, children }) => {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
const toggleId = getExpandableGroupToggleId(group.id);
|
|
89
|
+
const contentId = getExpandableGroupContentId(group.id);
|
|
90
|
+
const { isExpanded, onToggle, expandableSectionProps, expandableSectionToggleProps } = group.expandable;
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `pf-chatbot__menu-item-header pf-chatbot__menu-item-header--expandable ${(_b = (_a = group.menuGroupProps) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ''}`, children: [(0, jsx_runtime_1.jsx)(react_core_1.ExpandableSectionToggle, Object.assign({ toggleId: toggleId, contentId: contentId, isExpanded: isExpanded, onToggle: onToggle, toggleWrapper: "h3", className: "pf-chatbot__menu-group-toggle" }, expandableSectionToggleProps, { children: group.label })), (0, jsx_runtime_1.jsx)(react_core_1.ExpandableSection, Object.assign({ isDetached: true, isExpanded: isExpanded, toggleId: toggleId, contentId: contentId }, expandableSectionProps, { children: isExpanded && children }))] }));
|
|
92
|
+
};
|
|
93
|
+
const buildConversationMenuSegments = (groups) => groups.reduce((segments, group) => {
|
|
94
|
+
if (group.expandable) {
|
|
95
|
+
return [...segments, { type: 'expandable', group }];
|
|
96
|
+
}
|
|
97
|
+
const last = segments[segments.length - 1];
|
|
98
|
+
if ((last === null || last === void 0 ? void 0 : last.type) === 'static') {
|
|
99
|
+
last.groups.push(group);
|
|
100
|
+
return segments;
|
|
101
|
+
}
|
|
102
|
+
return [...segments, { type: 'static', groups: [group] }];
|
|
103
|
+
}, []);
|
|
27
104
|
const ChatbotConversationHistoryNav = (_a) => {
|
|
28
105
|
var { onDrawerToggle, isDrawerOpen, setIsDrawerOpen, activeItemId, onSelectActiveItem, conversations, menuListProps, newChatButtonText = 'New chat', drawerContent, onNewChat, newChatButtonProps, searchInputPlaceholder = 'Search previous conversations...', searchInputAriaLabel = 'Search previous conversations', searchInputProps, handleTextInputChange, displayMode, reverseButtonOrder = false, drawerActionsTestId = 'chatbot-nav-drawer-actions', drawerPanelContentProps, drawerContentProps, drawerContentBodyProps, drawerHeadProps, drawerActionsProps, drawerCloseButtonProps, drawerPanelBodyProps, hasDrawerHeadDivider, isLoading, loadingState, errorState, emptyState, noResultsState, isCompact, title = 'Chat history', navTitleProps, navTitleIcon = (0, jsx_runtime_1.jsx)(react_icons_1.RhUiClockIcon, {}), searchInputScreenReaderText, searchActionStart, searchActionEnd, searchToolbar, menuProps, menuGroupProps, menuContentProps } = _a, props = __rest(_a, ["onDrawerToggle", "isDrawerOpen", "setIsDrawerOpen", "activeItemId", "onSelectActiveItem", "conversations", "menuListProps", "newChatButtonText", "drawerContent", "onNewChat", "newChatButtonProps", "searchInputPlaceholder", "searchInputAriaLabel", "searchInputProps", "handleTextInputChange", "displayMode", "reverseButtonOrder", "drawerActionsTestId", "drawerPanelContentProps", "drawerContentProps", "drawerContentBodyProps", "drawerHeadProps", "drawerActionsProps", "drawerCloseButtonProps", "drawerPanelBodyProps", "hasDrawerHeadDivider", "isLoading", "loadingState", "errorState", "emptyState", "noResultsState", "isCompact", "title", "navTitleProps", "navTitleIcon", "searchInputScreenReaderText", "searchActionStart", "searchActionEnd", "searchToolbar", "menuProps", "menuGroupProps", "menuContentProps"]);
|
|
29
106
|
const drawerRef = (0, react_1.useRef)(null);
|
|
30
107
|
const onExpand = () => {
|
|
31
108
|
drawerRef.current && drawerRef.current.focus();
|
|
32
109
|
};
|
|
33
|
-
const
|
|
34
|
-
const getNavItem = (conversation) => {
|
|
110
|
+
const getNavItem = (conversation, itemOverrides, itemRef) => {
|
|
35
111
|
var _a;
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(react_core_1.MenuItem, Object.assign({ className: `pf-chatbot__menu-item ${activeItemId && activeItemId === conversation.id ? 'pf-chatbot__menu-item--active' : ''}`, itemId: conversation.id }, (conversation.noIcon ? {} : { icon: (_a = conversation.icon) !== null && _a !== void 0 ? _a : (0, jsx_runtime_1.jsx)(react_icons_1.RhUiCommentIcon, {}) }), (conversation.menuItems
|
|
112
|
+
return ((0, jsx_runtime_1.jsx)(react_core_1.MenuItem, Object.assign({ className: `pf-chatbot__menu-item ${activeItemId && activeItemId === conversation.id ? 'pf-chatbot__menu-item--active' : ''}`, itemId: conversation.id, ref: itemRef }, (conversation.noIcon ? {} : { icon: (_a = conversation.icon) !== null && _a !== void 0 ? _a : (0, jsx_runtime_1.jsx)(react_icons_1.RhUiCommentIcon, {}) }), (conversation.menuItems
|
|
37
113
|
? {
|
|
38
114
|
actions: ((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuClassName: conversation.menuClassName, onSelect: conversation.onSelect, menuItems: conversation.menuItems, label: conversation.label }))
|
|
39
115
|
}
|
|
40
|
-
: {}), conversation.additionalProps, { children: conversation.text })));
|
|
116
|
+
: {}), conversation.additionalProps, itemOverrides, { children: conversation.text })));
|
|
41
117
|
};
|
|
118
|
+
const renderConversationItems = (items, keyPrefix = '') => items.map((item, index) => {
|
|
119
|
+
if (isConversation(item)) {
|
|
120
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: getNavItem(item) }, item.id);
|
|
121
|
+
}
|
|
122
|
+
const key = (0, react_1.isValidElement)(item) && item.key != null ? String(item.key) : `${keyPrefix}-${index}`;
|
|
123
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: item }, key);
|
|
124
|
+
});
|
|
125
|
+
const renderGroupBody = (group) => {
|
|
126
|
+
if (group.showAll) {
|
|
127
|
+
return (0, jsx_runtime_1.jsx)(ShowAllGroupBody, { group: group, getNavItem: getNavItem });
|
|
128
|
+
}
|
|
129
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_core_1.MenuList, Object.assign({}, getMenuListProps(group), { children: renderConversationItems(group.items, group.id) })), group.footer] }));
|
|
130
|
+
};
|
|
131
|
+
const renderConversationGroup = (group) => {
|
|
132
|
+
var _a, _b, _c, _d;
|
|
133
|
+
if (group.header) {
|
|
134
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `pf-chatbot__menu-item-header ${(_b = (_a = group.menuGroupProps) === null || _a === void 0 ? void 0 : _a.className) !== null && _b !== void 0 ? _b : ''}`, children: [group.header, renderGroupBody(group)] }, group.id));
|
|
135
|
+
}
|
|
136
|
+
const labelId = getStaticMenuLabelId(group);
|
|
137
|
+
return ((0, jsx_runtime_1.jsx)(react_core_1.MenuGroup, Object.assign({ className: "pf-chatbot__menu-item-header", label: group.label, labelHeadingLevel: "h3" }, group.menuGroupProps, { titleId: labelId, "aria-labelledby": (_d = (_c = group.menuGroupProps) === null || _c === void 0 ? void 0 : _c['aria-labelledby']) !== null && _d !== void 0 ? _d : labelId, children: renderGroupBody(group) }), group.id));
|
|
138
|
+
};
|
|
139
|
+
const renderConversationMenu = (content, key) => ((0, jsx_runtime_1.jsx)(react_core_1.Menu, Object.assign({ className: "pf-chatbot__history-menu", isPlain: true, onSelect: onSelectActiveItem, activeItemId: activeItemId }, menuProps, { children: (0, jsx_runtime_1.jsx)(react_core_1.MenuContent, Object.assign({}, menuContentProps, { children: content })) }), key));
|
|
140
|
+
const renderConversationMenuSegment = (segment) => {
|
|
141
|
+
if (segment.type === 'static') {
|
|
142
|
+
return renderConversationMenu((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: segment.groups.map(renderConversationGroup) }), segment.groups.map((group) => group.id).join('-'));
|
|
143
|
+
}
|
|
144
|
+
return ((0, jsx_runtime_1.jsx)(ExpandableConversationGroup, { group: segment.group, children: renderConversationMenu(renderGroupBody(segment.group)) }, segment.group.id));
|
|
145
|
+
};
|
|
146
|
+
const normalizeObjectGroups = (groupedConversations) => Object.keys(groupedConversations).map((groupKey) => ({
|
|
147
|
+
id: groupKey,
|
|
148
|
+
label: groupKey,
|
|
149
|
+
items: groupedConversations[groupKey],
|
|
150
|
+
menuGroupProps: menuGroupProps && typeof menuGroupProps === 'object' && groupKey in menuGroupProps
|
|
151
|
+
? menuGroupProps[groupKey]
|
|
152
|
+
: undefined,
|
|
153
|
+
menuListProps: menuListProps && typeof menuListProps === 'object' && groupKey in menuListProps
|
|
154
|
+
? menuListProps[groupKey]
|
|
155
|
+
: undefined
|
|
156
|
+
}));
|
|
42
157
|
const buildConversations = () => {
|
|
43
158
|
if (Array.isArray(conversations)) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
else {
|
|
49
|
-
return conversation;
|
|
50
|
-
}
|
|
51
|
-
}) })));
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.keys(conversations).map((navGroup) => ((0, jsx_runtime_1.jsx)(react_core_1.MenuGroup, Object.assign({ className: "pf-chatbot__menu-item-header", label: navGroup, labelHeadingLevel: "h3" }, menuGroupProps === null || menuGroupProps === void 0 ? void 0 : menuGroupProps[navGroup], { children: (0, jsx_runtime_1.jsx)(react_core_1.MenuList, Object.assign({}, menuListProps === null || menuListProps === void 0 ? void 0 : menuListProps[navGroup], { children: conversations[navGroup].map((conversation) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: getNavItem(conversation) }, conversation.id))) })) }), navGroup))) }));
|
|
159
|
+
if (isConversationGroupArray(conversations)) {
|
|
160
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: buildConversationMenuSegments(conversations).map(renderConversationMenuSegment) });
|
|
161
|
+
}
|
|
162
|
+
return renderConversationMenu((0, jsx_runtime_1.jsx)(react_core_1.MenuList, Object.assign({}, menuListProps, { children: renderConversationItems(conversations) })));
|
|
55
163
|
}
|
|
164
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: buildConversationMenuSegments(normalizeObjectGroups(conversations)).map(renderConversationMenuSegment) }));
|
|
56
165
|
};
|
|
57
166
|
// Menu Content
|
|
58
167
|
// - Consumers should pass an array to <Chatbot> of the list of conversations
|
|
@@ -67,7 +176,7 @@ const ChatbotConversationHistoryNav = (_a) => {
|
|
|
67
176
|
if (noResultsState) {
|
|
68
177
|
return (0, jsx_runtime_1.jsx)(EmptyState_1.default, Object.assign({}, noResultsState));
|
|
69
178
|
}
|
|
70
|
-
return
|
|
179
|
+
return buildConversations();
|
|
71
180
|
};
|
|
72
181
|
const renderDrawerContent = () => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_core_1.DrawerPanelBody, Object.assign({}, drawerPanelBodyProps, { children: renderMenuContent() })) }));
|
|
73
182
|
const searchInputContainer = handleTextInputChange && ((0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__input", children: [(0, jsx_runtime_1.jsx)(react_core_1.SearchInput, Object.assign({ "aria-label": searchInputAriaLabel, onChange: (_event, value) => handleTextInputChange(value), placeholder: searchInputPlaceholder }, searchInputProps)), searchInputScreenReaderText && ((0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__filter-announcement pf-chatbot-m-hidden", children: searchInputScreenReaderText }))] }));
|
|
@@ -59,7 +59,12 @@ const ChatbotModal_1 = __importDefault(require("../ChatbotModal/ChatbotModal"));
|
|
|
59
59
|
// Try to lazy load - some consumers need to be below a certain bundle size, but can't use the CDN and don't have webpack
|
|
60
60
|
let monacoInstance = null;
|
|
61
61
|
const loadMonaco = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b;
|
|
62
63
|
if (!monacoInstance) {
|
|
64
|
+
if (!((_a = globalThis.MonacoEnvironment) === null || _a === void 0 ? void 0 : _a.getWorker) && !((_b = globalThis.MonacoEnvironment) === null || _b === void 0 ? void 0 : _b.getWorkerUrl)) {
|
|
65
|
+
// eslint-disable-next-line no-console
|
|
66
|
+
console.error('Monaco web workers are not configured. Import @patternfly/chatbot/monaco-environment before using CodeModal.');
|
|
67
|
+
}
|
|
63
68
|
const [monaco, { loader }] = yield Promise.all([Promise.resolve().then(() => __importStar(require('monaco-editor'))), Promise.resolve().then(() => __importStar(require('@monaco-editor/react')))]);
|
|
64
69
|
monacoInstance = monaco;
|
|
65
70
|
loader.config({ monaco });
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
import { type FunctionComponent, ReactNode } from 'react';
|
|
2
|
-
import { Options } from 'react-markdown';
|
|
3
|
-
import { CodeBlockMessageProps } from '../Message/CodeBlockMessage/CodeBlockMessage';
|
|
4
|
-
import { TableProps } from '@patternfly/react-table';
|
|
5
|
-
import '
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { type FunctionComponent, type ReactNode } from 'react';
|
|
2
|
+
import type { Options } from 'react-markdown';
|
|
3
|
+
import type { CodeBlockMessageProps } from '../Message/CodeBlockMessage/CodeBlockMessage';
|
|
4
|
+
import type { TableProps } from '@patternfly/react-table';
|
|
5
|
+
import type { PluggableList } from 'unified';
|
|
6
|
+
import type { ButtonProps } from '@patternfly/react-core';
|
|
7
|
+
type MarkdownRendererModule = typeof import('./MarkdownRenderer');
|
|
8
|
+
/**
|
|
9
|
+
* Whether the lazy-loaded markdown renderer chunk has finished loading.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useIsMarkdownRendererReady: () => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When provided by `MessageBox`, defers markdown rendering until the shared chunk is ready
|
|
14
|
+
* so existing messages don't each flash an individual loading state.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MarkdownRendererReadyContext: import("react").Context<boolean | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Eagerly fetches the markdown renderer chunk so the first rendered message
|
|
19
|
+
* doesn't flash a loading state while the chunk downloads. Safe to call repeatedly
|
|
20
|
+
* (the dynamic import is cached).
|
|
21
|
+
*/
|
|
22
|
+
export declare const preloadMarkdownRenderer: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves when the markdown renderer chunk has loaded.
|
|
25
|
+
*/
|
|
26
|
+
export declare const whenMarkdownRendererReady: () => Promise<MarkdownRendererModule>;
|
|
8
27
|
/**
|
|
9
28
|
* MarkdownContent renders content either as plain text or with content with markdown support.
|
|
10
29
|
*
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
26
|
var t = {};
|
|
4
27
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -14,182 +37,72 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
38
|
};
|
|
16
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.MarkdownContent = void 0;
|
|
40
|
+
exports.MarkdownContent = exports.whenMarkdownRendererReady = exports.preloadMarkdownRenderer = exports.MarkdownRendererReadyContext = exports.useIsMarkdownRendererReady = void 0;
|
|
18
41
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
|
-
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// Markdown Content - Shared component for rendering markdown
|
|
44
|
+
// ============================================================================
|
|
45
|
+
const react_1 = require("react");
|
|
21
46
|
const react_core_1 = require("@patternfly/react-core");
|
|
22
|
-
const CodeBlockMessage_1 = __importDefault(require("../Message/CodeBlockMessage/CodeBlockMessage"));
|
|
23
47
|
const TextMessage_1 = __importDefault(require("../Message/TextMessage/TextMessage"));
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const rehype_external_links_1 = __importDefault(require("rehype-external-links"));
|
|
36
|
-
const rehype_sanitize_1 = __importDefault(require("rehype-sanitize"));
|
|
37
|
-
const rehype_highlight_1 = __importDefault(require("rehype-highlight"));
|
|
38
|
-
require("highlight.js/styles/vs2015.css");
|
|
39
|
-
const LinkMessage_1 = __importDefault(require("../Message/LinkMessage/LinkMessage"));
|
|
40
|
-
const rehypeMoveImagesOutOfParagraphs_1 = require("../Message/Plugins/rehypeMoveImagesOutOfParagraphs");
|
|
41
|
-
const SuperscriptMessage_1 = __importDefault(require("../Message/SuperscriptMessage/SuperscriptMessage"));
|
|
42
|
-
const react_styles_1 = require("@patternfly/react-styles");
|
|
43
|
-
const MarkdownContent = ({ content, isMarkdownDisabled, codeBlockProps, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [], additionalRemarkPlugins = [], linkProps, reactMarkdownProps, remarkGfmProps, hasNoImages = false, isPrimary, textComponent, shouldRetainStyles }) => {
|
|
44
|
-
let rehypePlugins = [rehype_unwrap_images_1.default, rehypeMoveImagesOutOfParagraphs_1.rehypeMoveImagesOutOfParagraphs, rehype_highlight_1.default];
|
|
45
|
-
if (openLinkInNewTab) {
|
|
46
|
-
rehypePlugins = rehypePlugins.concat([[rehype_external_links_1.default, { target: '_blank' }, rehype_sanitize_1.default]]);
|
|
47
|
-
}
|
|
48
|
-
if (additionalRehypePlugins) {
|
|
49
|
-
rehypePlugins.push(...additionalRehypePlugins);
|
|
50
|
-
}
|
|
51
|
-
const disallowedElements = hasNoImages ? ['img'] : [];
|
|
52
|
-
if (reactMarkdownProps && reactMarkdownProps.disallowedElements) {
|
|
53
|
-
disallowedElements.push(...reactMarkdownProps.disallowedElements);
|
|
48
|
+
let markdownRendererPromise = null;
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
let ResolvedMarkdownRenderer = null;
|
|
51
|
+
const markdownRendererListeners = new Set();
|
|
52
|
+
const importMarkdownRenderer = () => {
|
|
53
|
+
if (!markdownRendererPromise) {
|
|
54
|
+
markdownRendererPromise = Promise.resolve().then(() => __importStar(require('./MarkdownRenderer'))).then((module) => {
|
|
55
|
+
ResolvedMarkdownRenderer = module.default;
|
|
56
|
+
markdownRendererListeners.forEach((listener) => listener());
|
|
57
|
+
return module;
|
|
58
|
+
});
|
|
54
59
|
}
|
|
60
|
+
return markdownRendererPromise;
|
|
61
|
+
};
|
|
62
|
+
const subscribeToMarkdownRendererReady = (listener) => {
|
|
63
|
+
markdownRendererListeners.add(listener);
|
|
64
|
+
void importMarkdownRenderer();
|
|
65
|
+
return () => markdownRendererListeners.delete(listener);
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Whether the lazy-loaded markdown renderer chunk has finished loading.
|
|
69
|
+
*/
|
|
70
|
+
const useIsMarkdownRendererReady = () => (0, react_1.useSyncExternalStore)(subscribeToMarkdownRendererReady, () => ResolvedMarkdownRenderer !== null, () => true);
|
|
71
|
+
exports.useIsMarkdownRendererReady = useIsMarkdownRendererReady;
|
|
72
|
+
/**
|
|
73
|
+
* When provided by `MessageBox`, defers markdown rendering until the shared chunk is ready
|
|
74
|
+
* so existing messages don't each flash an individual loading state.
|
|
75
|
+
*/
|
|
76
|
+
exports.MarkdownRendererReadyContext = (0, react_1.createContext)(null);
|
|
77
|
+
/**
|
|
78
|
+
* Eagerly fetches the markdown renderer chunk so the first rendered message
|
|
79
|
+
* doesn't flash a loading state while the chunk downloads. Safe to call repeatedly
|
|
80
|
+
* (the dynamic import is cached).
|
|
81
|
+
*/
|
|
82
|
+
const preloadMarkdownRenderer = () => {
|
|
83
|
+
void importMarkdownRenderer();
|
|
84
|
+
};
|
|
85
|
+
exports.preloadMarkdownRenderer = preloadMarkdownRenderer;
|
|
86
|
+
/**
|
|
87
|
+
* Resolves when the markdown renderer chunk has loaded.
|
|
88
|
+
*/
|
|
89
|
+
const whenMarkdownRendererReady = () => importMarkdownRenderer();
|
|
90
|
+
exports.whenMarkdownRendererReady = whenMarkdownRendererReady;
|
|
91
|
+
const MarkdownContent = (_a) => {
|
|
92
|
+
var { content, isMarkdownDisabled, isPrimary, textComponent } = _a, markdownProps = __rest(_a, ["content", "isMarkdownDisabled", "isPrimary", "textComponent"]);
|
|
93
|
+
const contextReady = (0, react_1.useContext)(exports.MarkdownRendererReadyContext);
|
|
94
|
+
const storeReady = (0, exports.useIsMarkdownRendererReady)();
|
|
95
|
+
const isMarkdownRendererReady = contextReady !== null && contextReady !== void 0 ? contextReady : storeReady;
|
|
55
96
|
if (isMarkdownDisabled) {
|
|
56
97
|
if (textComponent) {
|
|
57
98
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: textComponent });
|
|
58
99
|
}
|
|
59
100
|
return ((0, jsx_runtime_1.jsx)(TextMessage_1.default, { component: react_core_1.ContentVariants.p, isPrimary: isPrimary, children: content }));
|
|
60
101
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return ((0, jsx_runtime_1.jsx)("section", Object.assign({}, rest, { className: (0, react_styles_1.css)('pf-chatbot__message-text', shouldRetainStyles && 'pf-m-markdown', rest === null || rest === void 0 ? void 0 : rest.className) })));
|
|
66
|
-
},
|
|
67
|
-
p: (props) => {
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.p }, rest, { isPrimary: isPrimary })));
|
|
71
|
-
},
|
|
72
|
-
code: (_a) => {
|
|
73
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
75
|
-
const { node } = props, codeProps = __rest(props, ["node"]);
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, Object.assign({}, codeProps, codeBlockProps, { isPrimary: isPrimary, shouldRetainStyles: shouldRetainStyles, children: children })));
|
|
77
|
-
},
|
|
78
|
-
h1: (props) => {
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
80
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
81
|
-
return (0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.h1 }, rest));
|
|
82
|
-
},
|
|
83
|
-
h2: (props) => {
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
86
|
-
return (0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.h2 }, rest));
|
|
87
|
-
},
|
|
88
|
-
h3: (props) => {
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
91
|
-
return (0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.h3 }, rest));
|
|
92
|
-
},
|
|
93
|
-
h4: (props) => {
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
95
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
96
|
-
return (0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.h4 }, rest));
|
|
97
|
-
},
|
|
98
|
-
h5: (props) => {
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
101
|
-
return (0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.h5 }, rest));
|
|
102
|
-
},
|
|
103
|
-
h6: (props) => {
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
105
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
106
|
-
return (0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.h6 }, rest));
|
|
107
|
-
},
|
|
108
|
-
blockquote: (props) => {
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
110
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
111
|
-
return ((0, jsx_runtime_1.jsx)(TextMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles, component: react_core_1.ContentVariants.blockquote }, rest)));
|
|
112
|
-
},
|
|
113
|
-
ul: (props) => {
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
115
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
116
|
-
return (0, jsx_runtime_1.jsx)(UnorderedListMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles }, rest));
|
|
117
|
-
},
|
|
118
|
-
ol: (props) => {
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
120
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
121
|
-
return (0, jsx_runtime_1.jsx)(OrderedListMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles }, rest));
|
|
122
|
-
},
|
|
123
|
-
li: (props) => {
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
125
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
126
|
-
return (0, jsx_runtime_1.jsx)(ListItemMessage_1.default, Object.assign({}, rest));
|
|
127
|
-
},
|
|
128
|
-
// table requires node attribute for calculating headers for mobile breakpoint
|
|
129
|
-
table: (props) => ((0, jsx_runtime_1.jsx)(TableMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles }, props, tableProps, { isPrimary: isPrimary }))),
|
|
130
|
-
tbody: (props) => {
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
133
|
-
return (0, jsx_runtime_1.jsx)(TbodyMessage_1.default, Object.assign({}, rest));
|
|
134
|
-
},
|
|
135
|
-
thead: (props) => {
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
137
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
138
|
-
return (0, jsx_runtime_1.jsx)(TheadMessage_1.default, Object.assign({}, rest));
|
|
139
|
-
},
|
|
140
|
-
tr: (props) => {
|
|
141
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
142
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
143
|
-
return (0, jsx_runtime_1.jsx)(TrMessage_1.default, Object.assign({}, rest));
|
|
144
|
-
},
|
|
145
|
-
td: (props) => {
|
|
146
|
-
// Conflicts with Td type
|
|
147
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
148
|
-
const { node, width } = props, rest = __rest(props, ["node", "width"]);
|
|
149
|
-
return (0, jsx_runtime_1.jsx)(TdMessage_1.default, Object.assign({}, rest));
|
|
150
|
-
},
|
|
151
|
-
th: (props) => {
|
|
152
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
153
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
154
|
-
return (0, jsx_runtime_1.jsx)(ThMessage_1.default, Object.assign({}, rest));
|
|
155
|
-
},
|
|
156
|
-
img: (props) => {
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
158
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
159
|
-
return (0, jsx_runtime_1.jsx)(ImageMessage_1.default, Object.assign({}, rest));
|
|
160
|
-
},
|
|
161
|
-
a: (props) => {
|
|
162
|
-
// node is just the details of the document structure - not needed
|
|
163
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
164
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
165
|
-
return (
|
|
166
|
-
// some a types conflict with ButtonProps, but it's ok because we are using an a tag
|
|
167
|
-
// there are too many to handle manually
|
|
168
|
-
(0, jsx_runtime_1.jsx)(LinkMessage_1.default, Object.assign({ shouldRetainStyles: shouldRetainStyles }, rest, linkProps, { children: props.children })));
|
|
169
|
-
},
|
|
170
|
-
// used for footnotes
|
|
171
|
-
sup: (props) => {
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
173
|
-
const { node } = props, rest = __rest(props, ["node"]);
|
|
174
|
-
return (0, jsx_runtime_1.jsx)(SuperscriptMessage_1.default, Object.assign({}, rest));
|
|
175
|
-
}
|
|
176
|
-
}, remarkPlugins: [[remark_gfm_1.default, Object.assign({}, remarkGfmProps)], ...additionalRemarkPlugins], rehypePlugins: rehypePlugins }, reactMarkdownProps, { remarkRehypeOptions: Object.assign({
|
|
177
|
-
// removes sr-only class from footnote labels applied by default
|
|
178
|
-
footnoteLabelProperties: { className: [''] },
|
|
179
|
-
// omit default ↩ text; backref icon is rendered in LinkMessage
|
|
180
|
-
footnoteBackContent: (_referenceIndex, rereferenceIndex) => {
|
|
181
|
-
if (rereferenceIndex > 1) {
|
|
182
|
-
return [
|
|
183
|
-
{
|
|
184
|
-
type: 'element',
|
|
185
|
-
tagName: 'sup',
|
|
186
|
-
properties: {},
|
|
187
|
-
children: [{ type: 'text', value: String(rereferenceIndex) }]
|
|
188
|
-
}
|
|
189
|
-
];
|
|
190
|
-
}
|
|
191
|
-
return [];
|
|
192
|
-
} }, reactMarkdownProps === null || reactMarkdownProps === void 0 ? void 0 : reactMarkdownProps.remarkRehypeOptions), disallowedElements: disallowedElements, children: content })));
|
|
102
|
+
if (!isMarkdownRendererReady || !ResolvedMarkdownRenderer) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return (0, jsx_runtime_1.jsx)(ResolvedMarkdownRenderer, Object.assign({}, markdownProps, { content: content, isPrimary: isPrimary }));
|
|
193
106
|
};
|
|
194
107
|
exports.MarkdownContent = MarkdownContent;
|
|
195
108
|
exports.default = exports.MarkdownContent;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type FunctionComponent } from 'react';
|
|
2
|
+
import 'highlight.js/styles/vs2015.css';
|
|
3
|
+
import type { MarkdownContentProps } from './MarkdownContent';
|
|
4
|
+
export type MarkdownRendererProps = Omit<MarkdownContentProps, 'isMarkdownDisabled' | 'textComponent'>;
|
|
5
|
+
declare const MarkdownRenderer: FunctionComponent<MarkdownRendererProps>;
|
|
6
|
+
export default MarkdownRenderer;
|