@patternfly/chatbot 2.2.1 → 6.3.0-prerelease.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/cjs/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/cjs/Chatbot/Chatbot.d.ts +2 -0
- package/dist/cjs/Chatbot/Chatbot.js +2 -2
- package/dist/cjs/Chatbot/Chatbot.test.js +4 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +6 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -3
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +27 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +1 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeader.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +28 -0
- package/dist/cjs/ChatbotPopover/ChatbotPopover.js +1 -1
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
- package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
- package/dist/cjs/CodeModal/CodeModal.js +3 -3
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/cjs/CodeModal/CodeModal.test.js +15 -0
- package/dist/cjs/FileDetails/FileDetails.js +1 -1
- package/dist/cjs/Message/Message.d.ts +19 -1
- package/dist/cjs/Message/Message.js +58 -39
- package/dist/cjs/Message/Message.test.js +64 -0
- package/dist/cjs/Message/MessageInput.d.ts +18 -0
- package/dist/cjs/Message/MessageInput.js +34 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +2 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +2 -2
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +2 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +2 -2
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +4 -0
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +4 -4
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
- package/dist/cjs/MessageBar/AttachButton.d.ts +1 -0
- package/dist/cjs/MessageBar/AttachButton.js +3 -3
- package/dist/cjs/MessageBar/AttachButton.test.js +4 -0
- package/dist/cjs/MessageBar/MessageBar.d.ts +5 -0
- package/dist/cjs/MessageBar/MessageBar.js +14 -13
- package/dist/cjs/MessageBar/MessageBar.test.js +13 -0
- package/dist/cjs/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/cjs/MessageBar/MicrophoneButton.js +4 -4
- package/dist/cjs/MessageBar/SendButton.d.ts +1 -0
- package/dist/cjs/MessageBar/SendButton.js +3 -3
- package/dist/cjs/MessageBar/SendButton.test.js +4 -0
- package/dist/cjs/MessageBar/StopButton.d.ts +1 -0
- package/dist/cjs/MessageBar/StopButton.js +3 -3
- package/dist/cjs/MessageBar/StopButton.test.js +4 -0
- package/dist/cjs/MessageBox/MessageBox.d.ts +4 -0
- package/dist/cjs/MessageBox/MessageBox.js +21 -7
- package/dist/cjs/MessageBox/MessageBox.test.js +43 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/cjs/Settings/SettingsForm.d.ts +2 -0
- package/dist/cjs/Settings/SettingsForm.js +2 -2
- package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/cjs/Settings/SettingsForm.test.js +12 -0
- package/dist/cjs/SourcesCard/SourcesCard.d.ts +7 -1
- package/dist/cjs/SourcesCard/SourcesCard.js +17 -11
- package/dist/cjs/SourcesCard/SourcesCard.test.js +25 -15
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/cjs/tracking/console_tracking_provider.d.ts +4 -5
- package/dist/cjs/tracking/console_tracking_provider.js +22 -15
- package/dist/cjs/tracking/posthog_tracking_provider.d.ts +2 -2
- package/dist/cjs/tracking/posthog_tracking_provider.js +21 -12
- package/dist/cjs/tracking/segment_tracking_provider.d.ts +2 -2
- package/dist/cjs/tracking/segment_tracking_provider.js +21 -12
- package/dist/cjs/tracking/trackingProviderProxy.d.ts +1 -1
- package/dist/cjs/tracking/trackingProviderProxy.js +2 -2
- package/dist/cjs/tracking/tracking_api.d.ts +1 -1
- package/dist/cjs/tracking/tracking_registry.js +46 -12
- package/dist/cjs/tracking/tracking_spi.d.ts +15 -5
- package/dist/cjs/tracking/tracking_spi.js +9 -0
- package/dist/cjs/tracking/umami_tracking_provider.d.ts +6 -2
- package/dist/cjs/tracking/umami_tracking_provider.js +66 -22
- package/dist/css/main.css +225 -22
- package/dist/css/main.css.map +1 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/esm/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/esm/Chatbot/Chatbot.d.ts +2 -0
- package/dist/esm/Chatbot/Chatbot.js +2 -2
- package/dist/esm/Chatbot/Chatbot.test.js +4 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +6 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +27 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +1 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeader.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
- package/dist/esm/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/esm/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +23 -0
- package/dist/esm/ChatbotPopover/ChatbotPopover.js +1 -1
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
- package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
- package/dist/esm/CodeModal/CodeModal.js +3 -3
- package/dist/esm/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/esm/CodeModal/CodeModal.test.js +10 -0
- package/dist/esm/FileDetails/FileDetails.js +1 -1
- package/dist/esm/Message/Message.d.ts +19 -1
- package/dist/esm/Message/Message.js +58 -39
- package/dist/esm/Message/Message.test.js +64 -0
- package/dist/esm/Message/MessageInput.d.ts +18 -0
- package/dist/esm/Message/MessageInput.js +29 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +2 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +2 -2
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +2 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +2 -2
- package/dist/esm/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +4 -0
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +4 -4
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
- package/dist/esm/MessageBar/AttachButton.d.ts +1 -0
- package/dist/esm/MessageBar/AttachButton.js +3 -3
- package/dist/esm/MessageBar/AttachButton.test.js +4 -0
- package/dist/esm/MessageBar/MessageBar.d.ts +5 -0
- package/dist/esm/MessageBar/MessageBar.js +14 -13
- package/dist/esm/MessageBar/MessageBar.test.js +13 -0
- package/dist/esm/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/esm/MessageBar/MicrophoneButton.js +4 -4
- package/dist/esm/MessageBar/SendButton.d.ts +1 -0
- package/dist/esm/MessageBar/SendButton.js +3 -3
- package/dist/esm/MessageBar/SendButton.test.js +4 -0
- package/dist/esm/MessageBar/StopButton.d.ts +1 -0
- package/dist/esm/MessageBar/StopButton.js +3 -3
- package/dist/esm/MessageBar/StopButton.test.js +4 -0
- package/dist/esm/MessageBox/MessageBox.d.ts +4 -0
- package/dist/esm/MessageBox/MessageBox.js +21 -7
- package/dist/esm/MessageBox/MessageBox.test.js +44 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/esm/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/esm/Settings/SettingsForm.d.ts +2 -0
- package/dist/esm/Settings/SettingsForm.js +2 -2
- package/dist/esm/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/esm/Settings/SettingsForm.test.js +12 -0
- package/dist/esm/SourcesCard/SourcesCard.d.ts +7 -1
- package/dist/esm/SourcesCard/SourcesCard.js +18 -12
- package/dist/esm/SourcesCard/SourcesCard.test.js +25 -15
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/esm/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/esm/tracking/console_tracking_provider.d.ts +4 -5
- package/dist/esm/tracking/console_tracking_provider.js +22 -15
- package/dist/esm/tracking/posthog_tracking_provider.d.ts +2 -2
- package/dist/esm/tracking/posthog_tracking_provider.js +21 -12
- package/dist/esm/tracking/segment_tracking_provider.d.ts +2 -2
- package/dist/esm/tracking/segment_tracking_provider.js +21 -12
- package/dist/esm/tracking/trackingProviderProxy.d.ts +1 -1
- package/dist/esm/tracking/trackingProviderProxy.js +2 -2
- package/dist/esm/tracking/tracking_api.d.ts +1 -1
- package/dist/esm/tracking/tracking_registry.js +46 -12
- package/dist/esm/tracking/tracking_spi.d.ts +15 -5
- package/dist/esm/tracking/tracking_spi.js +8 -1
- package/dist/esm/tracking/umami_tracking_provider.d.ts +6 -2
- package/dist/esm/tracking/umami_tracking_provider.js +66 -22
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +18 -14
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +74 -104
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +48 -37
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +33 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +34 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +11 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +71 -13
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +3 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +80 -104
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +44 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +13 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +11 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +289 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUseCompact.tsx +136 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +15 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +8 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +6 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +481 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +62 -57
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +2 -0
- package/src/AttachmentEdit/AttachmentEdit.tsx +5 -1
- package/src/Chatbot/Chatbot.scss +7 -0
- package/src/Chatbot/Chatbot.test.tsx +9 -0
- package/src/Chatbot/Chatbot.tsx +4 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +38 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +71 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +23 -2
- package/src/ChatbotFooter/ChatbotFooter.scss +5 -0
- package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -0
- package/src/ChatbotFooter/ChatbotFooter.tsx +3 -1
- package/src/ChatbotHeader/ChatbotHeader.scss +25 -0
- package/src/ChatbotHeader/ChatbotHeader.tsx +1 -1
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +6 -0
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +12 -6
- package/src/ChatbotHeader/ChatbotHeaderMain.tsx +3 -1
- package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +8 -0
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +10 -5
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +6 -0
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +5 -2
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +10 -0
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +4 -0
- package/src/ChatbotModal/ChatbotModal.scss +15 -4
- package/src/ChatbotModal/ChatbotModal.test.tsx +59 -0
- package/src/ChatbotModal/ChatbotModal.tsx +5 -1
- package/src/ChatbotPopover/ChatbotPopover.scss +9 -5
- package/src/ChatbotPopover/ChatbotPopover.tsx +1 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +13 -0
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +13 -2
- package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
- package/src/CodeModal/CodeModal.scss +11 -3
- package/src/CodeModal/CodeModal.test.tsx +24 -0
- package/src/CodeModal/CodeModal.tsx +6 -2
- package/src/FileDetails/FileDetails.tsx +1 -1
- package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +1 -1
- package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +1 -1
- package/src/Message/Message.scss +31 -0
- package/src/Message/Message.test.tsx +83 -0
- package/src/Message/Message.tsx +121 -56
- package/src/Message/MessageInput.tsx +59 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +5 -1
- package/src/Message/QuickStarts/QuickStartTile.tsx +5 -1
- package/src/Message/TextMessage/TextMessage.scss +25 -0
- package/src/Message/UserFeedback/UserFeedback.scss +24 -3
- package/src/Message/UserFeedback/UserFeedback.test.tsx +13 -0
- package/src/Message/UserFeedback/UserFeedback.tsx +4 -2
- package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +4 -0
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +10 -2
- package/src/MessageBar/AttachButton.scss +10 -0
- package/src/MessageBar/AttachButton.test.tsx +4 -0
- package/src/MessageBar/AttachButton.tsx +5 -2
- package/src/MessageBar/MessageBar.scss +17 -0
- package/src/MessageBar/MessageBar.test.tsx +13 -0
- package/src/MessageBar/MessageBar.tsx +23 -8
- package/src/MessageBar/MicrophoneButton.scss +10 -0
- package/src/MessageBar/MicrophoneButton.tsx +6 -3
- package/src/MessageBar/SendButton.scss +10 -0
- package/src/MessageBar/SendButton.test.tsx +5 -1
- package/src/MessageBar/SendButton.tsx +5 -2
- package/src/MessageBar/StopButton.scss +10 -0
- package/src/MessageBar/StopButton.test.tsx +5 -1
- package/src/MessageBar/StopButton.tsx +5 -2
- package/src/MessageBox/MessageBox.scss +6 -0
- package/src/MessageBox/MessageBox.test.tsx +45 -1
- package/src/MessageBox/MessageBox.tsx +16 -6
- package/src/PreviewAttachment/PreviewAttachment.tsx +5 -1
- package/src/Settings/Settings.scss +11 -0
- package/src/Settings/SettingsForm.test.tsx +17 -0
- package/src/Settings/SettingsForm.tsx +12 -2
- package/src/SourcesCard/SourcesCard.scss +11 -7
- package/src/SourcesCard/SourcesCard.test.tsx +30 -22
- package/src/SourcesCard/SourcesCard.tsx +56 -13
- package/src/TermsOfUse/TermsOfUse.scss +20 -0
- package/src/TermsOfUse/TermsOfUse.tsx +9 -4
- package/src/tracking/console_tracking_provider.ts +21 -17
- package/src/tracking/posthog_tracking_provider.ts +20 -13
- package/src/tracking/segment_tracking_provider.ts +20 -13
- package/src/tracking/trackingProviderProxy.ts +2 -2
- package/src/tracking/tracking_api.ts +1 -1
- package/src/tracking/tracking_registry.ts +46 -13
- package/src/tracking/tracking_spi.ts +18 -7
- package/src/tracking/umami_tracking_provider.ts +76 -20
- package/src/SourcesCard/__snapshots__/SourcesCard.test.tsx.snap +0 -34
@@ -37,10 +37,14 @@ export interface MessageBarProps extends TextAreaProps {
|
|
37
37
|
className?: string;
|
38
38
|
/** Flag to always to show the send button. By default send button is shown when there is a message in the input field */
|
39
39
|
alwayShowSendButton?: boolean;
|
40
|
+
/** Placeholder for message input */
|
41
|
+
placeholder?: string;
|
40
42
|
/** Flag to disable/enable the Attach button */
|
41
43
|
hasAttachButton?: boolean;
|
42
44
|
/** Flag to enable the Microphone button */
|
43
45
|
hasMicrophoneButton?: boolean;
|
46
|
+
/** Placeholder text when listening */
|
47
|
+
listeningText?: string;
|
44
48
|
/** Flag to enable the Stop button, used for streaming content */
|
45
49
|
hasStopButton?: boolean;
|
46
50
|
/** Callback function for when stop button is clicked */
|
@@ -72,14 +76,17 @@ export interface MessageBarProps extends TextAreaProps {
|
|
72
76
|
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, value: string | number) => void;
|
73
77
|
/** Display mode of chatbot, if you want to message bar to resize when the display mode changes */
|
74
78
|
displayMode?: ChatbotDisplayMode;
|
79
|
+
isCompact?: boolean;
|
75
80
|
}
|
76
81
|
|
77
82
|
export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
78
83
|
onSendMessage,
|
79
84
|
className,
|
80
85
|
alwayShowSendButton,
|
86
|
+
placeholder = 'Send a message...',
|
81
87
|
hasAttachButton = true,
|
82
88
|
hasMicrophoneButton,
|
89
|
+
listeningText = 'Listening',
|
83
90
|
handleAttach,
|
84
91
|
attachMenuProps,
|
85
92
|
isSendButtonDisabled,
|
@@ -89,6 +96,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
89
96
|
onChange,
|
90
97
|
displayMode,
|
91
98
|
value,
|
99
|
+
isCompact = false,
|
92
100
|
...props
|
93
101
|
}: MessageBarProps) => {
|
94
102
|
// Text Input
|
@@ -99,11 +107,13 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
99
107
|
const textareaRef = React.useRef<HTMLTextAreaElement>(null);
|
100
108
|
const attachButtonRef = React.useRef<HTMLButtonElement>(null);
|
101
109
|
|
110
|
+
const topMargin = '1rem';
|
111
|
+
|
102
112
|
const setInitialLineHeight = (field: HTMLTextAreaElement) => {
|
103
113
|
field.style.setProperty('line-height', '1rem');
|
104
114
|
const parent = field.parentElement;
|
105
115
|
if (parent) {
|
106
|
-
parent.style.setProperty('margin-top',
|
116
|
+
parent.style.setProperty('margin-top', topMargin);
|
107
117
|
parent.style.setProperty('margin-bottom', `0rem`);
|
108
118
|
parent.style.setProperty('height', 'inherit');
|
109
119
|
|
@@ -129,8 +139,8 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
129
139
|
parent.style.setProperty('height', `${height}px`);
|
130
140
|
|
131
141
|
if (height > 32 || window.innerWidth <= 507) {
|
132
|
-
parent.style.setProperty('margin-bottom',
|
133
|
-
parent.style.setProperty('margin-top',
|
142
|
+
parent.style.setProperty('margin-bottom', topMargin);
|
143
|
+
parent.style.setProperty('margin-top', topMargin);
|
134
144
|
}
|
135
145
|
}
|
136
146
|
};
|
@@ -154,8 +164,8 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
154
164
|
const handleNewLine = (field: HTMLTextAreaElement) => {
|
155
165
|
const parent = field.parentElement;
|
156
166
|
if (parent) {
|
157
|
-
parent.style.setProperty('margin-bottom',
|
158
|
-
parent.style.setProperty('margin-top',
|
167
|
+
parent.style.setProperty('margin-bottom', topMargin);
|
168
|
+
parent.style.setProperty('margin-top', topMargin);
|
159
169
|
}
|
160
170
|
};
|
161
171
|
|
@@ -268,6 +278,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
268
278
|
<StopButton
|
269
279
|
onClick={handleStopButton}
|
270
280
|
tooltipContent={buttonProps?.stop?.tooltipContent}
|
281
|
+
isCompact={isCompact}
|
271
282
|
{...buttonProps?.stop?.props}
|
272
283
|
/>
|
273
284
|
);
|
@@ -280,6 +291,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
280
291
|
onClick={handleAttachMenuToggle}
|
281
292
|
isDisabled={isListeningMessage}
|
282
293
|
tooltipContent={buttonProps?.attach?.tooltipContent}
|
294
|
+
isCompact={isCompact}
|
283
295
|
{...buttonProps?.attach?.props}
|
284
296
|
/>
|
285
297
|
)}
|
@@ -289,6 +301,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
289
301
|
isDisabled={isListeningMessage}
|
290
302
|
tooltipContent={buttonProps?.attach?.tooltipContent}
|
291
303
|
inputTestId={buttonProps?.attach?.inputTestId}
|
304
|
+
isCompact={isCompact}
|
292
305
|
{...buttonProps?.attach?.props}
|
293
306
|
/>
|
294
307
|
)}
|
@@ -299,6 +312,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
299
312
|
onSpeechRecognition={handleSpeechRecognition}
|
300
313
|
tooltipContent={buttonProps?.microphone?.tooltipContent}
|
301
314
|
language={buttonProps?.microphone?.language}
|
315
|
+
isCompact={isCompact}
|
302
316
|
{...buttonProps?.microphone?.props}
|
303
317
|
/>
|
304
318
|
)}
|
@@ -308,6 +322,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
308
322
|
onClick={() => handleSend(message)}
|
309
323
|
isDisabled={isSendButtonDisabled}
|
310
324
|
tooltipContent={buttonProps?.send?.tooltipContent}
|
325
|
+
isCompact={isCompact}
|
311
326
|
{...buttonProps?.send?.props}
|
312
327
|
/>
|
313
328
|
)}
|
@@ -317,13 +332,13 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
317
332
|
|
318
333
|
const messageBarContents = (
|
319
334
|
<>
|
320
|
-
<div className=
|
335
|
+
<div className={`pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}`}>
|
321
336
|
<TextArea
|
322
337
|
className="pf-chatbot__message-textarea"
|
323
338
|
value={message}
|
324
339
|
onChange={handleChange}
|
325
|
-
aria-label={isListeningMessage ?
|
326
|
-
placeholder={isListeningMessage ?
|
340
|
+
aria-label={isListeningMessage ? listeningText : placeholder}
|
341
|
+
placeholder={isListeningMessage ? listeningText : placeholder}
|
327
342
|
ref={textareaRef}
|
328
343
|
onKeyDown={handleKeyDown}
|
329
344
|
{...props}
|
@@ -46,3 +46,13 @@
|
|
46
46
|
box-shadow: 0 0 0 16px rgba(0, 102, 204, 0);
|
47
47
|
}
|
48
48
|
}
|
49
|
+
|
50
|
+
// ============================================================================
|
51
|
+
// Information density styles
|
52
|
+
// ============================================================================
|
53
|
+
.pf-v6-c-button.pf-chatbot__button--microphone.pf-m-compact {
|
54
|
+
width: 1.5rem;
|
55
|
+
height: 1.5rem;
|
56
|
+
padding: var(--pf-t--global--spacer--sm);
|
57
|
+
align-items: center;
|
58
|
+
}
|
@@ -24,6 +24,7 @@ export interface MicrophoneButtonProps extends ButtonProps {
|
|
24
24
|
tooltipContent?: { active?: string; inactive?: string };
|
25
25
|
/** Locale code for language speech recognition is conducted in. This should be in the format 'en-US', a.k.a. the ISO 639-1 code, a dash, and the ISO_3166-1 code. */
|
26
26
|
language?: string;
|
27
|
+
isCompact?: boolean;
|
27
28
|
}
|
28
29
|
|
29
30
|
export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> = ({
|
@@ -34,6 +35,7 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
|
|
34
35
|
tooltipProps,
|
35
36
|
tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' },
|
36
37
|
language = 'en-US',
|
38
|
+
isCompact,
|
37
39
|
...props
|
38
40
|
}: MicrophoneButtonProps) => {
|
39
41
|
// Microphone
|
@@ -81,7 +83,7 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
|
|
81
83
|
|
82
84
|
setSpeechRecognition(recognition);
|
83
85
|
}
|
84
|
-
}, [onSpeechRecognition]);
|
86
|
+
}, [onSpeechRecognition, language, onIsListeningChange]);
|
85
87
|
|
86
88
|
if (!speechRecognition) {
|
87
89
|
return null;
|
@@ -102,14 +104,15 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
|
|
102
104
|
>
|
103
105
|
<Button
|
104
106
|
variant="plain"
|
105
|
-
className={`pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${className ?? ''}`}
|
107
|
+
className={`pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
106
108
|
aria-label={props['aria-label'] || 'Microphone button'}
|
107
109
|
onClick={isListening ? stopListening : startListening}
|
108
110
|
icon={
|
109
|
-
<Icon iconSize=
|
111
|
+
<Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
|
110
112
|
<MicrophoneIcon />
|
111
113
|
</Icon>
|
112
114
|
}
|
115
|
+
size={isCompact ? 'sm' : undefined}
|
113
116
|
{...props}
|
114
117
|
/>
|
115
118
|
</Tooltip>
|
@@ -51,3 +51,13 @@
|
|
51
51
|
transform: translate3d(0, 0, 0);
|
52
52
|
}
|
53
53
|
}
|
54
|
+
|
55
|
+
// ============================================================================
|
56
|
+
// Information density styles
|
57
|
+
// ============================================================================
|
58
|
+
.pf-v6-c-button.pf-chatbot__button--send.pf-m-compact {
|
59
|
+
width: 1.5rem;
|
60
|
+
height: 1.5rem;
|
61
|
+
padding: var(--pf-t--global--spacer--sm);
|
62
|
+
align-items: center;
|
63
|
+
}
|
@@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event';
|
|
5
5
|
import { SendButton } from './SendButton';
|
6
6
|
import { TooltipProps } from '@patternfly/react-core';
|
7
7
|
|
8
|
-
const renderSend = (props?: { [key: string]: string | Omit<TooltipProps, 'content'> }) => {
|
8
|
+
const renderSend = (props?: { [key: string]: string | boolean | Omit<TooltipProps, 'content'> }) => {
|
9
9
|
const spy = jest.fn();
|
10
10
|
render(<SendButton onClick={spy} {...props} />);
|
11
11
|
};
|
@@ -40,4 +40,8 @@ describe('Send button', () => {
|
|
40
40
|
await userEvent.click(screen.getByRole('button', { name: 'Send button' }));
|
41
41
|
expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
|
42
42
|
});
|
43
|
+
it('should handle isCompact', () => {
|
44
|
+
renderSend({ 'data-testid': 'button', isCompact: true });
|
45
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
46
|
+
});
|
43
47
|
});
|
@@ -17,6 +17,7 @@ export interface SendButtonProps extends ButtonProps {
|
|
17
17
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
18
18
|
/** English text "Send" used in the tooltip */
|
19
19
|
tooltipContent?: string;
|
20
|
+
isCompact?: boolean;
|
20
21
|
}
|
21
22
|
|
22
23
|
export const SendButton: React.FunctionComponent<SendButtonProps> = ({
|
@@ -24,6 +25,7 @@ export const SendButton: React.FunctionComponent<SendButtonProps> = ({
|
|
24
25
|
onClick,
|
25
26
|
tooltipProps,
|
26
27
|
tooltipContent = 'Send',
|
28
|
+
isCompact,
|
27
29
|
...props
|
28
30
|
}: SendButtonProps) => (
|
29
31
|
<Tooltip
|
@@ -40,14 +42,15 @@ export const SendButton: React.FunctionComponent<SendButtonProps> = ({
|
|
40
42
|
>
|
41
43
|
<Button
|
42
44
|
variant="plain"
|
43
|
-
className={`pf-chatbot__button--send ${className ?? ''}`}
|
45
|
+
className={`pf-chatbot__button--send ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
44
46
|
aria-label={props['aria-label'] || 'Send button'}
|
45
47
|
onClick={onClick}
|
46
48
|
icon={
|
47
|
-
<Icon iconSize=
|
49
|
+
<Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
|
48
50
|
<PaperPlaneIcon />
|
49
51
|
</Icon>
|
50
52
|
}
|
53
|
+
size={isCompact ? 'sm' : undefined}
|
51
54
|
{...props}
|
52
55
|
/>
|
53
56
|
</Tooltip>
|
@@ -34,3 +34,13 @@
|
|
34
34
|
}
|
35
35
|
}
|
36
36
|
}
|
37
|
+
|
38
|
+
// ============================================================================
|
39
|
+
// Information density styles
|
40
|
+
// ============================================================================
|
41
|
+
.pf-v6-c-button.pf-chatbot__button--stop.pf-m-compact {
|
42
|
+
width: 1.5rem;
|
43
|
+
height: 1.5rem;
|
44
|
+
padding: var(--pf-t--global--spacer--sm);
|
45
|
+
align-items: center;
|
46
|
+
}
|
@@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event';
|
|
5
5
|
import { StopButton } from './StopButton';
|
6
6
|
import { TooltipProps } from '@patternfly/react-core';
|
7
7
|
|
8
|
-
const renderStop = (props?: { [key: string]: string | Omit<TooltipProps, 'content'> }) => {
|
8
|
+
const renderStop = (props?: { [key: string]: string | boolean | Omit<TooltipProps, 'content'> }) => {
|
9
9
|
const spy = jest.fn();
|
10
10
|
render(<StopButton onClick={spy} {...props} />);
|
11
11
|
};
|
@@ -39,4 +39,8 @@ describe('Stop button', () => {
|
|
39
39
|
await userEvent.click(screen.getByRole('button', { name: 'Stop button' }));
|
40
40
|
expect(screen.getByRole('tooltip', { name: 'Stop' })).toHaveAttribute('id', 'test');
|
41
41
|
});
|
42
|
+
it('should handle isCompact', () => {
|
43
|
+
renderStop({ 'data-testid': 'button', isCompact: true });
|
44
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
45
|
+
});
|
42
46
|
});
|
@@ -15,6 +15,7 @@ export interface StopButtonProps extends ButtonProps {
|
|
15
15
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
16
16
|
/** English text "Stop" used in the tooltip */
|
17
17
|
tooltipContent?: string;
|
18
|
+
isCompact?: boolean;
|
18
19
|
}
|
19
20
|
|
20
21
|
export const StopButton: React.FunctionComponent<StopButtonProps> = ({
|
@@ -22,6 +23,7 @@ export const StopButton: React.FunctionComponent<StopButtonProps> = ({
|
|
22
23
|
onClick,
|
23
24
|
tooltipProps,
|
24
25
|
tooltipContent = 'Stop',
|
26
|
+
isCompact,
|
25
27
|
...props
|
26
28
|
}: StopButtonProps) => (
|
27
29
|
<Tooltip
|
@@ -37,12 +39,12 @@ export const StopButton: React.FunctionComponent<StopButtonProps> = ({
|
|
37
39
|
{...tooltipProps}
|
38
40
|
>
|
39
41
|
<Button
|
40
|
-
className={`pf-chatbot__button--stop ${className ?? ''}`}
|
42
|
+
className={`pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
41
43
|
variant="link"
|
42
44
|
aria-label={props['aria-label'] || 'Stop button'}
|
43
45
|
onClick={onClick}
|
44
46
|
icon={
|
45
|
-
<Icon iconSize=
|
47
|
+
<Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
|
46
48
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
47
49
|
<path
|
48
50
|
d="M0.5 3C0.5 1.62109 1.62109 0.5 3 0.5H13C14.3789 0.5 15.5 1.62109 15.5 3V13C15.5 14.3789 14.3789 15.5 13 15.5H3C1.62109 15.5 0.5 14.3789 0.5 13V3Z"
|
@@ -51,6 +53,7 @@ export const StopButton: React.FunctionComponent<StopButtonProps> = ({
|
|
51
53
|
</svg>
|
52
54
|
</Icon>
|
53
55
|
}
|
56
|
+
size={isCompact ? 'sm' : undefined}
|
54
57
|
{...props}
|
55
58
|
/>
|
56
59
|
</Tooltip>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { render, screen } from '@testing-library/react';
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
3
3
|
import { MessageBox } from './MessageBox';
|
4
|
+
import userEvent from '@testing-library/user-event';
|
4
5
|
|
5
6
|
describe('MessageBox', () => {
|
6
7
|
it('should render Message box', () => {
|
@@ -23,4 +24,47 @@ describe('MessageBox', () => {
|
|
23
24
|
expect(ref.current).not.toBeNull();
|
24
25
|
expect(ref.current).toBeInstanceOf(HTMLDivElement);
|
25
26
|
});
|
27
|
+
it('should call onScrollToBottomClick when scroll to top button is clicked', async () => {
|
28
|
+
const spy = jest.fn();
|
29
|
+
render(
|
30
|
+
<MessageBox onScrollToBottomClick={spy}>
|
31
|
+
<div>Test message content</div>
|
32
|
+
</MessageBox>
|
33
|
+
);
|
34
|
+
|
35
|
+
// this forces button to show
|
36
|
+
const region = screen.getByRole('region');
|
37
|
+
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
38
|
+
Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
|
39
|
+
Object.defineProperty(region, 'scrollTop', { configurable: true, value: 0 });
|
40
|
+
region.dispatchEvent(new Event('scroll'));
|
41
|
+
|
42
|
+
await waitFor(() => {
|
43
|
+
userEvent.click(screen.getByRole('button', { name: /Jump bottom button/i }));
|
44
|
+
expect(spy).toHaveBeenCalled();
|
45
|
+
});
|
46
|
+
});
|
47
|
+
it('should call onScrollToTopClick when scroll to top button is clicked', async () => {
|
48
|
+
const spy = jest.fn();
|
49
|
+
render(
|
50
|
+
<MessageBox onScrollToTopClick={spy}>
|
51
|
+
<div>Test message content</div>
|
52
|
+
</MessageBox>
|
53
|
+
);
|
54
|
+
|
55
|
+
// this forces button to show
|
56
|
+
const region = screen.getByRole('region');
|
57
|
+
Object.defineProperty(region, 'scrollHeight', { configurable: true, value: 1000 });
|
58
|
+
Object.defineProperty(region, 'clientHeight', { configurable: true, value: 500 });
|
59
|
+
Object.defineProperty(region, 'scrollTop', {
|
60
|
+
configurable: true,
|
61
|
+
value: 500
|
62
|
+
});
|
63
|
+
region.dispatchEvent(new Event('scroll'));
|
64
|
+
|
65
|
+
await waitFor(() => {
|
66
|
+
userEvent.click(screen.getByRole('button', { name: /Jump top button/i }));
|
67
|
+
expect(spy).toHaveBeenCalled();
|
68
|
+
});
|
69
|
+
});
|
26
70
|
});
|
@@ -17,6 +17,10 @@ export interface MessageBoxProps extends React.HTMLProps<HTMLDivElement> {
|
|
17
17
|
innerRef?: React.Ref<HTMLDivElement>;
|
18
18
|
/** Modifier that controls how content in MessageBox is positioned within the container */
|
19
19
|
position?: 'top' | 'bottom';
|
20
|
+
/** Click handler for additional logic for when scroll to top jump button is clicked */
|
21
|
+
onScrollToTopClick?: () => void;
|
22
|
+
/** Click handler for additional logic for when scroll to bottom jump button is clicked */
|
23
|
+
onScrollToBottomClick?: () => void;
|
20
24
|
}
|
21
25
|
|
22
26
|
const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
@@ -25,7 +29,10 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
25
29
|
children,
|
26
30
|
innerRef,
|
27
31
|
className,
|
28
|
-
position = 'top'
|
32
|
+
position = 'top',
|
33
|
+
onScrollToTopClick,
|
34
|
+
onScrollToBottomClick,
|
35
|
+
...props
|
29
36
|
}: MessageBoxProps) => {
|
30
37
|
const [atTop, setAtTop] = React.useState(false);
|
31
38
|
const [atBottom, setAtBottom] = React.useState(true);
|
@@ -46,7 +53,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
46
53
|
setAtTop(scrollTop === 0);
|
47
54
|
setAtBottom(Math.round(scrollTop) + Math.round(clientHeight) >= Math.round(scrollHeight) - 1); // rounding means it could be within a pixel of the bottom
|
48
55
|
}
|
49
|
-
}, []);
|
56
|
+
}, [messageBoxRef]);
|
50
57
|
|
51
58
|
const checkOverflow = React.useCallback(() => {
|
52
59
|
const element = messageBoxRef.current;
|
@@ -54,21 +61,23 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
54
61
|
const { scrollHeight, clientHeight } = element;
|
55
62
|
setIsOverflowing(scrollHeight >= clientHeight);
|
56
63
|
}
|
57
|
-
}, []);
|
64
|
+
}, [messageBoxRef]);
|
58
65
|
|
59
66
|
const scrollToTop = React.useCallback(() => {
|
60
67
|
const element = messageBoxRef.current;
|
61
68
|
if (element) {
|
62
69
|
element.scrollTo({ top: 0, behavior: 'smooth' });
|
63
70
|
}
|
64
|
-
|
71
|
+
onScrollToTopClick && onScrollToTopClick();
|
72
|
+
}, [messageBoxRef]);
|
65
73
|
|
66
74
|
const scrollToBottom = React.useCallback(() => {
|
67
75
|
const element = messageBoxRef.current;
|
68
76
|
if (element) {
|
69
77
|
element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
|
70
78
|
}
|
71
|
-
|
79
|
+
onScrollToBottomClick && onScrollToBottomClick();
|
80
|
+
}, [messageBoxRef]);
|
72
81
|
|
73
82
|
// Detect scroll position
|
74
83
|
React.useEffect(() => {
|
@@ -85,7 +94,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
85
94
|
element.removeEventListener('scroll', handleScroll);
|
86
95
|
};
|
87
96
|
}
|
88
|
-
}, [checkOverflow, handleScroll]);
|
97
|
+
}, [checkOverflow, handleScroll, messageBoxRef]);
|
89
98
|
|
90
99
|
return (
|
91
100
|
<>
|
@@ -96,6 +105,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
96
105
|
aria-label={ariaLabel}
|
97
106
|
className={`pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className ?? ''}`}
|
98
107
|
ref={innerRef ?? messageBoxRef}
|
108
|
+
{...props}
|
99
109
|
>
|
100
110
|
{children}
|
101
111
|
<div className="pf-chatbot__messagebox-announcement" aria-live="polite">
|
@@ -22,6 +22,8 @@ export interface PreviewAttachmentProps {
|
|
22
22
|
title?: string;
|
23
23
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
24
24
|
displayMode?: ChatbotDisplayMode;
|
25
|
+
/** Sets modal to compact styling. */
|
26
|
+
isCompact?: boolean;
|
25
27
|
}
|
26
28
|
|
27
29
|
export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps> = ({
|
@@ -32,7 +34,8 @@ export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>
|
|
32
34
|
onDismiss = undefined,
|
33
35
|
onEdit,
|
34
36
|
title = 'Preview attachment',
|
35
|
-
displayMode = ChatbotDisplayMode.default
|
37
|
+
displayMode = ChatbotDisplayMode.default,
|
38
|
+
isCompact
|
36
39
|
}: PreviewAttachmentProps) => {
|
37
40
|
const handleEdit = (_event: React.MouseEvent | MouseEvent | KeyboardEvent) => {
|
38
41
|
handleModalToggle(_event);
|
@@ -60,6 +63,7 @@ export const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>
|
|
60
63
|
title={title}
|
61
64
|
isReadOnly
|
62
65
|
displayMode={displayMode}
|
66
|
+
isCompact={isCompact}
|
63
67
|
/>
|
64
68
|
);
|
65
69
|
};
|
@@ -32,3 +32,14 @@
|
|
32
32
|
font-weight: var(--pf-t--global--font--weight--body--bold);
|
33
33
|
text-align: center;
|
34
34
|
}
|
35
|
+
|
36
|
+
.pf-chatbot__settings-form-container.pf-m-compact {
|
37
|
+
.pf-chatbot__settings-form-row {
|
38
|
+
padding: var(--pf-t--global--spacer--md);
|
39
|
+
font-size: var(--pf-t--global--font--size--body--md);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
.pf-chatbot__header.pf-m-compact {
|
44
|
+
padding-inline-start: var(--pf-t--global--spacer--md);
|
45
|
+
}
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { Button } from '@patternfly/react-core';
|
3
3
|
import { render, screen } from '@testing-library/react';
|
4
4
|
import { SettingsForm } from './SettingsForm';
|
5
|
+
import '@testing-library/jest-dom';
|
5
6
|
|
6
7
|
describe('SettingsForm', () => {
|
7
8
|
it('should render settingsForm with custom classname', () => {
|
@@ -25,4 +26,20 @@ describe('SettingsForm', () => {
|
|
25
26
|
|
26
27
|
expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
|
27
28
|
});
|
29
|
+
|
30
|
+
it('should render settingsForm with isCompact', () => {
|
31
|
+
const fields = [
|
32
|
+
{
|
33
|
+
id: 'archived-chat',
|
34
|
+
label: 'Archive chat',
|
35
|
+
field: (
|
36
|
+
<Button id="archived-chat" variant="secondary">
|
37
|
+
Archive chat
|
38
|
+
</Button>
|
39
|
+
)
|
40
|
+
}
|
41
|
+
];
|
42
|
+
render(<SettingsForm data-testid="settings-form" fields={fields} isCompact />);
|
43
|
+
expect(screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
|
44
|
+
});
|
28
45
|
});
|
@@ -5,10 +5,20 @@ export interface SettingsFormProps {
|
|
5
5
|
className?: string;
|
6
6
|
/** Array of fields to display in the settings layout */
|
7
7
|
fields?: { id: string; label: string; field: React.ReactElement }[];
|
8
|
+
/** Sets form to compact styling. */
|
9
|
+
isCompact?: boolean;
|
8
10
|
}
|
9
11
|
|
10
|
-
export const SettingsForm: React.FunctionComponent<SettingsFormProps> = ({
|
11
|
-
|
12
|
+
export const SettingsForm: React.FunctionComponent<SettingsFormProps> = ({
|
13
|
+
className,
|
14
|
+
fields = [],
|
15
|
+
isCompact,
|
16
|
+
...props
|
17
|
+
}) => (
|
18
|
+
<div
|
19
|
+
className={`pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}`}
|
20
|
+
{...props}
|
21
|
+
>
|
12
22
|
<form className="pf-chatbot__settings-form">
|
13
23
|
{fields.map((field) => (
|
14
24
|
<div className="pf-chatbot__settings-form-row" key={field.label}>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
box-shadow: var(--pf-t--global--box-shadow--sm);
|
17
17
|
}
|
18
18
|
|
19
|
-
.pf-chatbot__sources-card-body {
|
19
|
+
.pf-chatbot__sources-card-body-text {
|
20
20
|
display: block;
|
21
21
|
display: -webkit-box;
|
22
22
|
height: 2.8125rem;
|
@@ -25,11 +25,6 @@
|
|
25
25
|
-webkit-box-orient: vertical;
|
26
26
|
overflow: hidden;
|
27
27
|
text-overflow: ellipsis;
|
28
|
-
margin-bottom: var(--pf-t--global--spacer--md);
|
29
|
-
}
|
30
|
-
|
31
|
-
.pf-chatbot__sources-card-no-footer {
|
32
|
-
margin-bottom: var(--pf-t--global--spacer--lg);
|
33
28
|
}
|
34
29
|
|
35
30
|
.pf-chatbot__sources-card-footer-container {
|
@@ -38,13 +33,14 @@
|
|
38
33
|
var(--pf-t--global--spacer--sm) !important;
|
39
34
|
.pf-chatbot__sources-card-footer {
|
40
35
|
display: flex;
|
41
|
-
justify-content: space-between;
|
42
36
|
align-items: center;
|
43
37
|
|
44
38
|
&-buttons {
|
45
39
|
display: flex;
|
46
40
|
gap: var(--pf-t--global--spacer--xs);
|
47
41
|
align-items: center;
|
42
|
+
justify-content: space-between;
|
43
|
+
flex: 1;
|
48
44
|
|
49
45
|
.pf-v6-c-button {
|
50
46
|
border-radius: var(--pf-t--global--border--radius--pill);
|
@@ -78,3 +74,11 @@
|
|
78
74
|
}
|
79
75
|
}
|
80
76
|
}
|
77
|
+
|
78
|
+
.pf-v6-c-card.pf-m-compact.pf-chatbot__sources-card {
|
79
|
+
.pf-v6-c-card__footer.pf-chatbot__sources-card-footer-container {
|
80
|
+
border-top: var(--pf-t--global--border--width--regular) solid var(--pf-t--global--border--color--default);
|
81
|
+
padding: var(--pf-t--global--spacer--xs) var(--pf-t--global--spacer--sm) var(--pf-t--global--spacer--xs)
|
82
|
+
var(--pf-t--global--spacer--xs) !important;
|
83
|
+
}
|
84
|
+
}
|