@patternfly/chatbot 6.3.0-prerelease.1 → 6.3.0-prerelease.11
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 +2 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +3 -3
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +4 -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/CodeBlockMessage/CodeBlockMessage.js +1 -1
- package/dist/cjs/Message/Message.d.ts +2 -0
- package/dist/cjs/Message/Message.js +6 -6
- package/dist/cjs/Message/Message.test.js +15 -3
- 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 +11 -7
- package/dist/cjs/MessageBar/MessageBar.d.ts +5 -0
- package/dist/cjs/MessageBar/MessageBar.js +14 -13
- package/dist/cjs/MessageBar/MessageBar.test.js +41 -28
- package/dist/cjs/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/cjs/MessageBar/MicrophoneButton.js +3 -3
- package/dist/cjs/MessageBar/SendButton.d.ts +1 -0
- package/dist/cjs/MessageBar/SendButton.js +3 -3
- package/dist/cjs/MessageBar/SendButton.test.js +9 -5
- package/dist/cjs/MessageBar/StopButton.d.ts +1 -0
- package/dist/cjs/MessageBar/StopButton.js +3 -3
- package/dist/cjs/MessageBar/StopButton.test.js +9 -5
- package/dist/cjs/MessageBox/JumpButton.js +1 -1
- package/dist/cjs/MessageBox/JumpButton.test.js +4 -4
- package/dist/cjs/MessageBox/MessageBox.d.ts +4 -0
- package/dist/cjs/MessageBox/MessageBox.js +16 -2
- 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.js +2 -2
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/css/main.css +218 -15
- 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 +2 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +3 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +4 -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/CodeBlockMessage/CodeBlockMessage.js +1 -1
- package/dist/esm/Message/Message.d.ts +2 -0
- package/dist/esm/Message/Message.js +6 -6
- package/dist/esm/Message/Message.test.js +15 -3
- 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 +11 -7
- package/dist/esm/MessageBar/MessageBar.d.ts +5 -0
- package/dist/esm/MessageBar/MessageBar.js +14 -13
- package/dist/esm/MessageBar/MessageBar.test.js +41 -28
- package/dist/esm/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/esm/MessageBar/MicrophoneButton.js +3 -3
- package/dist/esm/MessageBar/SendButton.d.ts +1 -0
- package/dist/esm/MessageBar/SendButton.js +3 -3
- package/dist/esm/MessageBar/SendButton.test.js +9 -5
- package/dist/esm/MessageBar/StopButton.d.ts +1 -0
- package/dist/esm/MessageBar/StopButton.js +3 -3
- package/dist/esm/MessageBar/StopButton.test.js +9 -5
- package/dist/esm/MessageBox/JumpButton.js +1 -1
- package/dist/esm/MessageBox/JumpButton.test.js +4 -4
- package/dist/esm/MessageBox/MessageBox.d.ts +4 -0
- package/dist/esm/MessageBox/MessageBox.js +16 -2
- 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.js +2 -2
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/esm/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +33 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +24 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +11 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +21 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +9 -0
- 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 +14 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +8 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +481 -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 +18 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +9 -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/CodeBlockMessage/CodeBlockMessage.tsx +1 -1
- package/src/Message/Message.scss +27 -0
- package/src/Message/Message.test.tsx +24 -3
- package/src/Message/Message.tsx +10 -3
- 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 +11 -7
- package/src/MessageBar/AttachButton.tsx +6 -3
- package/src/MessageBar/MessageBar.scss +17 -0
- package/src/MessageBar/MessageBar.test.tsx +41 -28
- package/src/MessageBar/MessageBar.tsx +23 -8
- package/src/MessageBar/MicrophoneButton.scss +10 -0
- package/src/MessageBar/MicrophoneButton.tsx +7 -3
- package/src/MessageBar/SendButton.scss +10 -0
- package/src/MessageBar/SendButton.test.tsx +10 -6
- package/src/MessageBar/SendButton.tsx +6 -3
- package/src/MessageBar/StopButton.scss +10 -0
- package/src/MessageBar/StopButton.test.tsx +10 -6
- package/src/MessageBar/StopButton.tsx +6 -3
- package/src/MessageBox/JumpButton.test.tsx +4 -4
- package/src/MessageBox/JumpButton.tsx +1 -1
- package/src/MessageBox/MessageBox.scss +6 -0
- package/src/MessageBox/MessageBox.test.tsx +45 -1
- package/src/MessageBox/MessageBox.tsx +11 -1
- 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 +8 -0
- package/src/SourcesCard/SourcesCard.tsx +2 -1
- package/src/TermsOfUse/TermsOfUse.scss +20 -0
- package/src/TermsOfUse/TermsOfUse.tsx +9 -4
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { render, screen } from '@testing-library/react';
|
3
3
|
import ChatbotFooter from './ChatbotFooter';
|
4
|
+
import '@testing-library/jest-dom';
|
4
5
|
|
5
6
|
describe('ChatbotFooter', () => {
|
6
7
|
it('should render ChatbotFooter with children', () => {
|
@@ -12,4 +13,13 @@ describe('ChatbotFooter', () => {
|
|
12
13
|
const { container } = render(<ChatbotFooter className="custom-class">Chatbot Content</ChatbotFooter>);
|
13
14
|
expect(container.querySelector('.custom-class')).toBeTruthy();
|
14
15
|
});
|
16
|
+
|
17
|
+
it('should handle isCompact', () => {
|
18
|
+
render(
|
19
|
+
<ChatbotFooter className="custom-class" isCompact data-testid="footer">
|
20
|
+
Chatbot Content
|
21
|
+
</ChatbotFooter>
|
22
|
+
);
|
23
|
+
expect(screen.getByTestId('footer')).toHaveClass('pf-m-compact');
|
24
|
+
});
|
15
25
|
});
|
@@ -17,14 +17,16 @@ export interface ChatbotFooterProps extends React.HTMLProps<HTMLDivElement> {
|
|
17
17
|
children?: React.ReactNode;
|
18
18
|
/** Custom classname for the Footer component */
|
19
19
|
className?: string;
|
20
|
+
isCompact?: boolean;
|
20
21
|
}
|
21
22
|
|
22
23
|
export const ChatbotFooter: React.FunctionComponent<ChatbotFooterProps> = ({
|
23
24
|
children,
|
24
25
|
className,
|
26
|
+
isCompact,
|
25
27
|
...props
|
26
28
|
}: ChatbotFooterProps) => (
|
27
|
-
<div className={`pf-chatbot__footer ${className ?? ''}`} {...props}>
|
29
|
+
<div className={`pf-chatbot__footer ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`} {...props}>
|
28
30
|
<Divider />
|
29
31
|
<div className="pf-chatbot__footer-container">{children}</div>
|
30
32
|
</div>
|
@@ -137,3 +137,28 @@
|
|
137
137
|
:where(.pf-v6-theme-dark) .show-dark .pf-m-picture {
|
138
138
|
display: inline-flex;
|
139
139
|
}
|
140
|
+
|
141
|
+
// ============================================================================
|
142
|
+
// Information density styles
|
143
|
+
// ============================================================================
|
144
|
+
.pf-chatbot.pf-m-compact {
|
145
|
+
.pf-chatbot__header {
|
146
|
+
gap: var(--pf-t--global--spacer--sm);
|
147
|
+
padding: var(--pf-t--global--spacer--sm);
|
148
|
+
}
|
149
|
+
|
150
|
+
.pf-chatbot__header .pf-chatbot__title img {
|
151
|
+
max-height: 24px;
|
152
|
+
vertical-align: middle;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
.pf-v6-c-menu-toggle.pf-chatbot__button--toggle-options.pf-m-compact,
|
157
|
+
.pf-chatbot__button--toggle-menu.pf-m-compact {
|
158
|
+
width: 2rem;
|
159
|
+
height: 2rem;
|
160
|
+
}
|
161
|
+
|
162
|
+
.pf-chatbot__header .pf-chatbot__actions .pf-v6-c-menu-toggle.pf-m-secondary.pf-m-compact {
|
163
|
+
width: initial;
|
164
|
+
}
|
@@ -14,7 +14,7 @@ export const ChatbotHeader: React.FunctionComponent<ChatbotHeaderProps> = ({
|
|
14
14
|
children
|
15
15
|
}: ChatbotHeaderProps) => (
|
16
16
|
<div className="pf-chatbot__header-container">
|
17
|
-
<div className={`pf-chatbot__header ${className
|
17
|
+
<div className={`pf-chatbot__header${className ? ` ${className}` : ''}`}>{children}</div>
|
18
18
|
<Divider className="pf-chatbot__header__divider" />
|
19
19
|
</div>
|
20
20
|
);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { fireEvent, render, screen } from '@testing-library/react';
|
3
3
|
import { ChatbotHeaderCloseButton } from './ChatbotHeaderCloseButton';
|
4
|
+
import '@testing-library/jest-dom';
|
4
5
|
|
5
6
|
describe('ChatbotHeaderCloseButton', () => {
|
6
7
|
it('should render ChatbotHeaderCloseButton', () => {
|
@@ -17,4 +18,9 @@ describe('ChatbotHeaderCloseButton', () => {
|
|
17
18
|
fireEvent.click(screen.getByRole('button', { name: 'Close' }));
|
18
19
|
expect(onClick).toHaveBeenCalled();
|
19
20
|
});
|
21
|
+
|
22
|
+
it('should render button with isCompact', () => {
|
23
|
+
render(<ChatbotHeaderCloseButton data-testid="close-button" onClick={jest.fn()} isCompact />);
|
24
|
+
expect(screen.getByTestId('close-button')).toHaveClass('pf-m-compact');
|
25
|
+
});
|
20
26
|
});
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
|
3
|
-
import { Button, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
3
|
+
import { Button, ButtonProps, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
4
4
|
import { CloseIcon } from '@patternfly/react-icons';
|
5
5
|
|
6
|
-
export interface ChatbotHeaderCloseButtonProps {
|
6
|
+
export interface ChatbotHeaderCloseButtonProps extends ButtonProps {
|
7
7
|
/** Callback function for when button is clicked */
|
8
8
|
onClick: () => void;
|
9
9
|
/** Custom classname for the header component */
|
@@ -16,6 +16,8 @@ export interface ChatbotHeaderCloseButtonProps {
|
|
16
16
|
innerRef?: React.Ref<HTMLButtonElement>;
|
17
17
|
/** Content used in tooltip */
|
18
18
|
tooltipContent?: string;
|
19
|
+
/** Sets button to compact styling. */
|
20
|
+
isCompact?: boolean;
|
19
21
|
}
|
20
22
|
|
21
23
|
const ChatbotHeaderCloseButtonBase: React.FunctionComponent<ChatbotHeaderCloseButtonProps> = ({
|
@@ -24,9 +26,11 @@ const ChatbotHeaderCloseButtonBase: React.FunctionComponent<ChatbotHeaderCloseBu
|
|
24
26
|
tooltipProps,
|
25
27
|
menuAriaLabel = 'Close',
|
26
28
|
innerRef,
|
27
|
-
tooltipContent = 'Close'
|
29
|
+
tooltipContent = 'Close',
|
30
|
+
isCompact,
|
31
|
+
...props
|
28
32
|
}: ChatbotHeaderCloseButtonProps) => (
|
29
|
-
<div className={`pf-chatbot__menu ${className}`}>
|
33
|
+
<div className={`pf-chatbot__menu${className ? ` ${className}` : ''}`}>
|
30
34
|
<Tooltip
|
31
35
|
content={tooltipContent}
|
32
36
|
position="bottom"
|
@@ -35,16 +39,18 @@ const ChatbotHeaderCloseButtonBase: React.FunctionComponent<ChatbotHeaderCloseBu
|
|
35
39
|
{...tooltipProps}
|
36
40
|
>
|
37
41
|
<Button
|
38
|
-
className=
|
42
|
+
className={`pf-chatbot__button--toggle-menu ${isCompact ? 'pf-m-compact' : ''}`}
|
39
43
|
variant="plain"
|
40
44
|
onClick={onClick}
|
41
45
|
aria-label={menuAriaLabel}
|
42
46
|
ref={innerRef}
|
43
47
|
icon={
|
44
|
-
<Icon size=
|
48
|
+
<Icon size={isCompact ? 'lg' : 'xl'} isInline>
|
45
49
|
<CloseIcon />
|
46
50
|
</Icon>
|
47
51
|
}
|
52
|
+
size={isCompact ? 'sm' : undefined}
|
53
|
+
{...props}
|
48
54
|
/>
|
49
55
|
</Tooltip>
|
50
56
|
</div>
|
@@ -10,6 +10,8 @@ export interface ChatbotHeaderMainProps {
|
|
10
10
|
export const ChatbotHeaderMain: React.FunctionComponent<ChatbotHeaderMainProps> = ({
|
11
11
|
className,
|
12
12
|
children
|
13
|
-
}: ChatbotHeaderMainProps) =>
|
13
|
+
}: ChatbotHeaderMainProps) => (
|
14
|
+
<div className={`pf-chatbot__header-main${className ? ` ${className}` : ''}`}>{children}</div>
|
15
|
+
);
|
14
16
|
|
15
17
|
export default ChatbotHeaderMain;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { fireEvent, render, screen } from '@testing-library/react';
|
3
3
|
import { ChatbotHeaderMenu } from './ChatbotHeaderMenu';
|
4
|
+
import '@testing-library/jest-dom';
|
4
5
|
|
5
6
|
describe('ChatbotHeaderMenu', () => {
|
6
7
|
it('should render ChatbotHeaderMenu with custom class', () => {
|
@@ -16,4 +17,11 @@ describe('ChatbotHeaderMenu', () => {
|
|
16
17
|
|
17
18
|
expect(onMenuToggle).toHaveBeenCalled();
|
18
19
|
});
|
20
|
+
|
21
|
+
it('should handle isCompact', () => {
|
22
|
+
render(
|
23
|
+
<ChatbotHeaderMenu className="custom-header-menu" onMenuToggle={jest.fn()} isCompact data-testid="button" />
|
24
|
+
);
|
25
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
26
|
+
});
|
19
27
|
});
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
|
3
|
-
import { Button, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
3
|
+
import { Button, ButtonProps, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
4
4
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
5
5
|
|
6
|
-
export interface ChatbotHeaderMenuProps {
|
6
|
+
export interface ChatbotHeaderMenuProps extends ButtonProps {
|
7
7
|
/** Callback function to attach to menu toggle on top right of chatbot header. */
|
8
8
|
onMenuToggle: () => void;
|
9
9
|
/** Custom classname for the header component */
|
@@ -16,6 +16,7 @@ export interface ChatbotHeaderMenuProps {
|
|
16
16
|
innerRef?: React.Ref<HTMLButtonElement>;
|
17
17
|
/** Content used in tooltip */
|
18
18
|
tooltipContent?: string;
|
19
|
+
isCompact?: boolean;
|
19
20
|
}
|
20
21
|
|
21
22
|
const ChatbotHeaderMenuBase: React.FunctionComponent<ChatbotHeaderMenuProps> = ({
|
@@ -24,7 +25,9 @@ const ChatbotHeaderMenuBase: React.FunctionComponent<ChatbotHeaderMenuProps> = (
|
|
24
25
|
tooltipProps,
|
25
26
|
menuAriaLabel = 'Toggle menu',
|
26
27
|
innerRef,
|
27
|
-
tooltipContent = 'Menu'
|
28
|
+
tooltipContent = 'Menu',
|
29
|
+
isCompact,
|
30
|
+
...props
|
28
31
|
}: ChatbotHeaderMenuProps) => (
|
29
32
|
<div className={`pf-chatbot__menu ${className}`}>
|
30
33
|
<Tooltip
|
@@ -35,16 +38,18 @@ const ChatbotHeaderMenuBase: React.FunctionComponent<ChatbotHeaderMenuProps> = (
|
|
35
38
|
{...tooltipProps}
|
36
39
|
>
|
37
40
|
<Button
|
38
|
-
className=
|
41
|
+
className={`pf-chatbot__button--toggle-menu ${isCompact ? 'pf-m-compact' : ''}`}
|
39
42
|
variant="plain"
|
40
43
|
onClick={onMenuToggle}
|
41
44
|
aria-label={menuAriaLabel}
|
42
45
|
ref={innerRef}
|
43
46
|
icon={
|
44
|
-
<Icon size=
|
47
|
+
<Icon size={isCompact ? 'lg' : 'xl'} isInline>
|
45
48
|
<BarsIcon />
|
46
49
|
</Icon>
|
47
50
|
}
|
51
|
+
size={isCompact ? 'sm' : undefined}
|
52
|
+
{...props}
|
48
53
|
/>
|
49
54
|
</Tooltip>
|
50
55
|
</div>
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { DropdownItem } from '@patternfly/react-core';
|
3
3
|
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
4
4
|
import { ChatbotHeaderOptionsDropdown } from './ChatbotHeaderOptionsDropdown';
|
5
|
+
import '@testing-library/jest-dom';
|
5
6
|
|
6
7
|
describe('ChatbotHeaderOptionsDropdown', () => {
|
7
8
|
const dropdownItems = (
|
@@ -42,4 +43,9 @@ describe('ChatbotHeaderOptionsDropdown', () => {
|
|
42
43
|
expect(onSelect).toHaveBeenCalled();
|
43
44
|
});
|
44
45
|
});
|
46
|
+
|
47
|
+
it('should handle isCompact', () => {
|
48
|
+
render(<ChatbotHeaderOptionsDropdown isCompact>{dropdownItems}</ChatbotHeaderOptionsDropdown>);
|
49
|
+
expect(screen.getByRole('button', { name: 'Chatbot options' })).toHaveClass('pf-m-compact');
|
50
|
+
});
|
45
51
|
});
|
@@ -20,6 +20,7 @@ export interface ChatbotHeaderOptionsDropdownProps extends Omit<DropdownProps, '
|
|
20
20
|
tooltipProps?: TooltipProps;
|
21
21
|
/** Aria label for menu toggle */
|
22
22
|
menuToggleAriaLabel?: string;
|
23
|
+
isCompact?: boolean;
|
23
24
|
}
|
24
25
|
|
25
26
|
export const ChatbotHeaderOptionsDropdown: React.FunctionComponent<ChatbotHeaderOptionsDropdownProps> = ({
|
@@ -28,6 +29,7 @@ export const ChatbotHeaderOptionsDropdown: React.FunctionComponent<ChatbotHeader
|
|
28
29
|
onSelect,
|
29
30
|
tooltipProps,
|
30
31
|
menuToggleAriaLabel = 'Chatbot options',
|
32
|
+
isCompact,
|
31
33
|
...props
|
32
34
|
}: ChatbotHeaderOptionsDropdownProps) => {
|
33
35
|
const [isOptionsMenuOpen, setIsOptionsMenuOpen] = React.useState(false);
|
@@ -42,17 +44,18 @@ export const ChatbotHeaderOptionsDropdown: React.FunctionComponent<ChatbotHeader
|
|
42
44
|
{...tooltipProps}
|
43
45
|
>
|
44
46
|
<MenuToggle
|
45
|
-
className=
|
47
|
+
className={`pf-chatbot__button--toggle-options ${isCompact ? 'pf-m-compact' : ''}`}
|
46
48
|
variant="plain"
|
47
49
|
aria-label={menuToggleAriaLabel}
|
48
50
|
ref={toggleRef}
|
49
51
|
icon={
|
50
|
-
<Icon
|
52
|
+
<Icon size={isCompact ? 'lg' : 'xl'} isInline>
|
51
53
|
<EllipsisIcon />
|
52
54
|
</Icon>
|
53
55
|
}
|
54
56
|
isExpanded={isOptionsMenuOpen}
|
55
57
|
onClick={() => setIsOptionsMenuOpen(!isOptionsMenuOpen)}
|
58
|
+
size={isCompact ? 'sm' : undefined}
|
56
59
|
/>
|
57
60
|
</Tooltip>
|
58
61
|
);
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { DropdownItem } from '@patternfly/react-core';
|
3
3
|
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
4
4
|
import { ChatbotHeaderSelectorDropdown } from './ChatbotHeaderSelectorDropdown';
|
5
|
+
import '@testing-library/jest-dom';
|
5
6
|
|
6
7
|
describe('ChatbotHeaderSelectorDropdown', () => {
|
7
8
|
const dropdownItems = (
|
@@ -40,4 +41,13 @@ describe('ChatbotHeaderSelectorDropdown', () => {
|
|
40
41
|
expect(onSelect).toHaveBeenCalled();
|
41
42
|
});
|
42
43
|
});
|
44
|
+
|
45
|
+
it('should handle isCompact', () => {
|
46
|
+
render(
|
47
|
+
<ChatbotHeaderSelectorDropdown value="Option 1" isCompact>
|
48
|
+
{dropdownItems}
|
49
|
+
</ChatbotHeaderSelectorDropdown>
|
50
|
+
);
|
51
|
+
expect(screen.getByRole('button', { name: /Select model/i })).toHaveClass('pf-m-compact');
|
52
|
+
});
|
43
53
|
});
|
@@ -15,6 +15,7 @@ export interface ChatbotHeaderSelectorDropdownProps extends Omit<DropdownProps,
|
|
15
15
|
menuToggleAriaLabel?: string;
|
16
16
|
/** Text displayed in Tooltip wrapping the display mode dropdown */
|
17
17
|
tooltipContent?: string;
|
18
|
+
isCompact?: boolean;
|
18
19
|
}
|
19
20
|
|
20
21
|
export const ChatbotHeaderSelectorDropdown: React.FunctionComponent<ChatbotHeaderSelectorDropdownProps> = ({
|
@@ -25,6 +26,7 @@ export const ChatbotHeaderSelectorDropdown: React.FunctionComponent<ChatbotHeade
|
|
25
26
|
tooltipProps,
|
26
27
|
tooltipContent = 'Select model',
|
27
28
|
menuToggleAriaLabel,
|
29
|
+
isCompact,
|
28
30
|
...props
|
29
31
|
}: ChatbotHeaderSelectorDropdownProps) => {
|
30
32
|
const [isOptionsMenuOpen, setIsOptionsMenuOpen] = React.useState(false);
|
@@ -45,6 +47,8 @@ export const ChatbotHeaderSelectorDropdown: React.FunctionComponent<ChatbotHeade
|
|
45
47
|
ref={toggleRef}
|
46
48
|
isExpanded={isOptionsMenuOpen}
|
47
49
|
onClick={() => setIsOptionsMenuOpen(!isOptionsMenuOpen)}
|
50
|
+
size={isCompact ? 'sm' : undefined}
|
51
|
+
className={`${isCompact ? 'pf-m-compact' : ''}`}
|
48
52
|
>
|
49
53
|
{value}
|
50
54
|
</MenuToggle>
|
@@ -14,10 +14,7 @@
|
|
14
14
|
.pf-v6-c-modal-box__title {
|
15
15
|
--pf-v6-c-modal-box__title--FontSize: var(--pf-t--global--font--size--heading--h3);
|
16
16
|
}
|
17
|
-
|
18
|
-
.pf-v6-c-button.pf-m-link.pf-m-block {
|
19
|
-
--pf-v6-c-button--FontWeight: var(--pf-t--global--font--weight--body--bold);
|
20
|
-
}
|
17
|
+
|
21
18
|
.pf-v6-c-modal-box__footer {
|
22
19
|
padding-block-start: var(--pf-t--global--spacer--xl);
|
23
20
|
padding-block-end: var(--pf-t--global--spacer--xl);
|
@@ -91,3 +88,17 @@
|
|
91
88
|
.pf-v6-c-backdrop.pf-chatbot__backdrop {
|
92
89
|
position: absolute;
|
93
90
|
}
|
91
|
+
|
92
|
+
// ============================================================================
|
93
|
+
// Compact
|
94
|
+
// ============================================================================
|
95
|
+
.pf-chatbot__chatbot-modal.pf-m-compact {
|
96
|
+
.pf-v6-c-modal-box__header {
|
97
|
+
padding-block-end: 0;
|
98
|
+
}
|
99
|
+
|
100
|
+
.pf-v6-c-modal-box__footer {
|
101
|
+
padding-block-start: var(--pf-t--global--spacer--lg);
|
102
|
+
padding-block-end: var(--pf-t--global--spacer--lg);
|
103
|
+
}
|
104
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import ChatbotModal from './ChatbotModal';
|
4
|
+
import '@testing-library/jest-dom';
|
5
|
+
import { ModalBody, ModalHeader } from '@patternfly/react-core';
|
6
|
+
|
7
|
+
describe('ChatbotModal', () => {
|
8
|
+
it('should render compact modal', () => {
|
9
|
+
render(
|
10
|
+
<ChatbotModal data-testid="modal" isCompact isOpen>
|
11
|
+
<ModalHeader
|
12
|
+
title="Modal with description"
|
13
|
+
labelId="modal-with-description-title"
|
14
|
+
description="A description is used when you want to provide more info about the modal than the title is able to describe. The content in the description is static and will not scroll with the rest of the modal body."
|
15
|
+
/>
|
16
|
+
<ModalBody tabIndex={0} id="modal-box-body-with-description">
|
17
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
|
18
|
+
magna aliqua. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Semper auctor neque vitae
|
19
|
+
tempus. Diam donec adipiscing tristique risus. Augue eget arcu dictum varius duis. Ut enim blandit volutpat
|
20
|
+
maecenas volutpat blandit aliquam. Sit amet mauris commodo quis imperdiet massa tincidunt. Habitant morbi
|
21
|
+
tristique senectus et netus. Fames ac turpis egestas sed tempus urna. Neque laoreet suspendisse interdum
|
22
|
+
consectetur libero id. Volutpat lacus laoreet non curabitur gravida arcu ac tortor. Porta nibh venenatis cras
|
23
|
+
sed felis eget velit. Nullam non nisi est sit amet facilisis. Nunc mi ipsum faucibus vitae. Lorem sed risus
|
24
|
+
ultricies tristique nulla aliquet enim tortor at. Egestas sed tempus urna et pharetra pharetra massa massa
|
25
|
+
ultricies. Lacinia quis vel eros donec ac odio tempor orci. Malesuada fames ac turpis egestas integer eget
|
26
|
+
aliquet.
|
27
|
+
<br />
|
28
|
+
<br />
|
29
|
+
Neque aliquam vestibulum morbi blandit cursus risus at ultrices. Molestie at elementum eu facilisis sed odio
|
30
|
+
morbi. Elit pellentesque habitant morbi tristique. Consequat nisl vel pretium lectus quam id leo in vitae.
|
31
|
+
Quis varius quam quisque id diam vel quam elementum. Viverra nam libero justo laoreet sit amet cursus.
|
32
|
+
Sollicitudin tempor id eu nisl nunc. Orci nulla pellentesque dignissim enim sit amet venenatis. Dignissim enim
|
33
|
+
sit amet venenatis urna cursus eget. Iaculis at erat pellentesque adipiscing commodo elit. Faucibus pulvinar
|
34
|
+
elementum integer enim neque volutpat. Nullam vehicula ipsum a arcu cursus vitae congue mauris. Nunc mattis
|
35
|
+
enim ut tellus elementum sagittis vitae. Blandit cursus risus at ultrices. Tellus mauris a diam maecenas sed
|
36
|
+
enim. Non diam phasellus vestibulum lorem sed risus ultricies tristique nulla.
|
37
|
+
<br />
|
38
|
+
<br />
|
39
|
+
Nulla pharetra diam sit amet nisl suscipit adipiscing. Ac tortor vitae purus faucibus ornare suspendisse sed
|
40
|
+
nisi. Sed felis eget velit aliquet sagittis id consectetur purus. Tincidunt tortor aliquam nulla facilisi cras
|
41
|
+
fermentum. Volutpat est velit egestas dui id ornare arcu odio. Pharetra magna ac placerat vestibulum. Ultrices
|
42
|
+
sagittis orci a scelerisque purus semper eget duis at. Nisi est sit amet facilisis magna etiam tempor orci eu.
|
43
|
+
Convallis tellus id interdum velit. Facilisis sed odio morbi quis commodo odio aenean sed.
|
44
|
+
<br />
|
45
|
+
<br />
|
46
|
+
Eu scelerisque felis imperdiet proin fermentum leo vel orci porta. Facilisi etiam dignissim diam quis enim
|
47
|
+
lobortis scelerisque fermentum. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada. Magna
|
48
|
+
etiam tempor orci eu lobortis elementum. Quis auctor elit sed vulputate mi sit. Eleifend quam adipiscing vitae
|
49
|
+
proin sagittis nisl rhoncus mattis rhoncus. Erat velit scelerisque in dictum non. Sit amet nulla facilisi
|
50
|
+
morbi tempus iaculis urna. Enim ut tellus elementum sagittis vitae et leo duis ut. Lectus arcu bibendum at
|
51
|
+
varius vel pharetra vel turpis. Morbi tristique senectus et netus et. Eget aliquet nibh praesent tristique
|
52
|
+
magna sit amet purus gravida. Nisl purus in mollis nunc sed id semper risus. Id neque aliquam vestibulum
|
53
|
+
morbi. Mauris a diam maecenas sed enim ut sem. Egestas tellus rutrum tellus pellentesque.
|
54
|
+
</ModalBody>
|
55
|
+
</ChatbotModal>
|
56
|
+
);
|
57
|
+
expect(screen.getByTestId('modal')).toHaveClass('pf-m-compact');
|
58
|
+
});
|
59
|
+
});
|
@@ -10,7 +10,10 @@ import { ChatbotDisplayMode } from '../Chatbot';
|
|
10
10
|
export interface ChatbotModalProps extends Omit<ModalProps, 'ref'> {
|
11
11
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
12
12
|
displayMode?: ChatbotDisplayMode;
|
13
|
+
/** Additional className applied to modal */
|
13
14
|
className?: string;
|
15
|
+
/** Sets modal to compact styling. */
|
16
|
+
isCompact?: boolean;
|
14
17
|
}
|
15
18
|
|
16
19
|
export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
@@ -18,6 +21,7 @@ export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
|
18
21
|
displayMode = ChatbotDisplayMode.default,
|
19
22
|
className,
|
20
23
|
isOpen,
|
24
|
+
isCompact,
|
21
25
|
...props
|
22
26
|
}: ChatbotModalProps) => {
|
23
27
|
const modal = (
|
@@ -26,7 +30,7 @@ export const ChatbotModal: React.FunctionComponent<ChatbotModalProps> = ({
|
|
26
30
|
ouiaId="ChatbotModal"
|
27
31
|
aria-labelledby="chatbot-modal-title"
|
28
32
|
aria-describedby="chatbot-modal"
|
29
|
-
className={`pf-chatbot__chatbot-modal pf-chatbot__chatbot-modal--${displayMode} ${className}`}
|
33
|
+
className={`pf-chatbot__chatbot-modal pf-chatbot__chatbot-modal--${displayMode} ${isCompact ? 'pf-m-compact' : ''} ${className}`}
|
30
34
|
backdropClassName="pf-chatbot__chatbot-modal-backdrop"
|
31
35
|
{...props}
|
32
36
|
>
|
@@ -2,14 +2,19 @@
|
|
2
2
|
// Chatbot Popover
|
3
3
|
// ============================================================================
|
4
4
|
.pf-chatbot__popover {
|
5
|
-
.pf-v6-c-popover__arrow {
|
5
|
+
.pf-v6-c-popover__arrow {
|
6
|
+
display: none;
|
7
|
+
}
|
6
8
|
|
7
9
|
// Footnote popover
|
8
10
|
&--footnote.pf-chatbot__popover {
|
9
|
-
|
10
11
|
// Contents
|
11
|
-
img {
|
12
|
-
|
12
|
+
img {
|
13
|
+
border-radius: var(--pf-t--global--border--radius--small);
|
14
|
+
}
|
15
|
+
.pf-v6-c-content--h3 {
|
16
|
+
font-weight: var(--pf-t--global--font--weight--body--bold);
|
17
|
+
}
|
13
18
|
.pf-v6-c-content--p {
|
14
19
|
font-size: var(--pf-t--global--font--size--body--lg);
|
15
20
|
}
|
@@ -23,5 +28,4 @@
|
|
23
28
|
font-size: var(--pf-t--global--font--size--body--lg);
|
24
29
|
}
|
25
30
|
}
|
26
|
-
|
27
31
|
}
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
7
7
|
import { Popover, PopoverProps } from '@patternfly/react-core';
|
8
8
|
|
9
9
|
export const ChatbotPopover: React.FunctionComponent<PopoverProps> = ({ children, className, ...props }) => (
|
10
|
-
<Popover className={`pf-chatbot__popover
|
10
|
+
<Popover className={`pf-chatbot__popover ${className ?? ''}`} showClose={false} {...props}>
|
11
11
|
{children}
|
12
12
|
</Popover>
|
13
13
|
);
|
@@ -8,7 +8,6 @@
|
|
8
8
|
gap: var(--pf-t--global--spacer--lg);
|
9
9
|
|
10
10
|
.pf-v6-c-content--h1 {
|
11
|
-
--pf-v6-c-content--h1--FontSize: var(--pf-t--global--font--size--3xl); // larger than any of our semantic tokens
|
12
11
|
--pf-v6-c-content--h1--FontWeight: var(--pf-t--global--font--weight--400);
|
13
12
|
--pf-v6-c-content--h1--MarginBlockEnd: 0;
|
14
13
|
}
|
@@ -34,6 +33,15 @@
|
|
34
33
|
}
|
35
34
|
}
|
36
35
|
|
36
|
+
.pf-chatbot--layout--welcome.pf-m-compact {
|
37
|
+
gap: var(--pf-t--global--spacer--md);
|
38
|
+
padding-block-end: var(--pf-t--global--spacer--md);
|
39
|
+
|
40
|
+
.pf-chatbot__prompt-suggestions {
|
41
|
+
gap: var(--pf-t--global--spacer--md);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
37
45
|
// ============================================================================
|
38
46
|
// Chatbot Display Mode - Fullscreen and Embedded
|
39
47
|
// ============================================================================
|
@@ -69,4 +69,17 @@ describe('ChatbotWelcomePrompt', () => {
|
|
69
69
|
const element = screen.getByTestId('welcome-prompt');
|
70
70
|
expect(element).toHaveClass('test');
|
71
71
|
});
|
72
|
+
|
73
|
+
it('should handle isCompact', () => {
|
74
|
+
render(
|
75
|
+
<ChatbotWelcomePrompt
|
76
|
+
title="Hi, ChatBot User!"
|
77
|
+
description="How can I help you today?"
|
78
|
+
className="test"
|
79
|
+
testId="welcome-prompt"
|
80
|
+
isCompact
|
81
|
+
/>
|
82
|
+
);
|
83
|
+
expect(screen.getByTestId('welcome-prompt')).toHaveClass('pf-m-compact');
|
84
|
+
});
|
72
85
|
});
|
@@ -16,6 +16,7 @@ export interface ChatbotWelcomePromptProps extends React.HTMLProps<HTMLDivElemen
|
|
16
16
|
className?: string;
|
17
17
|
/** Custom test id for the WelcomePrompt component */
|
18
18
|
testId?: string;
|
19
|
+
isCompact?: boolean;
|
19
20
|
}
|
20
21
|
|
21
22
|
export interface WelcomePrompt {
|
@@ -33,9 +34,14 @@ export const ChatbotWelcomePrompt: React.FunctionComponent<ChatbotWelcomePromptP
|
|
33
34
|
prompts,
|
34
35
|
className,
|
35
36
|
testId,
|
37
|
+
isCompact = false,
|
36
38
|
...props
|
37
39
|
}: ChatbotWelcomePromptProps) => (
|
38
|
-
<div
|
40
|
+
<div
|
41
|
+
data-testid={testId}
|
42
|
+
className={`pf-chatbot--layout--welcome ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
43
|
+
{...props}
|
44
|
+
>
|
39
45
|
<Content component={ContentVariants.h1}>
|
40
46
|
<span className="pf-chatbot__hello">{title}</span>
|
41
47
|
<br />
|
@@ -45,7 +51,12 @@ export const ChatbotWelcomePrompt: React.FunctionComponent<ChatbotWelcomePromptP
|
|
45
51
|
{prompts && (
|
46
52
|
<div className="pf-chatbot__prompt-suggestions">
|
47
53
|
{prompts?.map((prompt, index) => (
|
48
|
-
<Card
|
54
|
+
<Card
|
55
|
+
key={`welcome-prompt-${index}`}
|
56
|
+
className="pf-chatbot__prompt-suggestion"
|
57
|
+
isClickable
|
58
|
+
isCompact={isCompact}
|
59
|
+
>
|
49
60
|
<CardHeader
|
50
61
|
selectableActions={{
|
51
62
|
onClickAction: prompt.onClick,
|
@@ -61,8 +61,10 @@
|
|
61
61
|
.pf-v6-c-code-editor__header-main {
|
62
62
|
display: none;
|
63
63
|
}
|
64
|
-
.pf-
|
65
|
-
|
64
|
+
.pf-v6-c-modal-box__close {
|
65
|
+
.pf-v6-c-button.pf-m-plain {
|
66
|
+
--pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--subtle);
|
67
|
+
}
|
66
68
|
}
|
67
69
|
}
|
68
70
|
|
@@ -78,10 +80,16 @@
|
|
78
80
|
}
|
79
81
|
}
|
80
82
|
|
81
|
-
.pf-chatbot__code-modal-
|
83
|
+
.pf-chatbot__code-modal-editor {
|
82
84
|
flex: 1;
|
83
85
|
}
|
84
86
|
|
85
87
|
.pf-chatbot__code-modal--fullscreen {
|
86
88
|
height: inherit !important; // override shared modal so code editor works in full screen
|
87
89
|
}
|
90
|
+
|
91
|
+
.pf-chatbot__code-modal.pf-m-compact {
|
92
|
+
.pf-chatbot__code-modal-body {
|
93
|
+
gap: var(--pf-t--global--spacer--md);
|
94
|
+
}
|
95
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { render, screen } from '@testing-library/react';
|
3
|
+
import '@testing-library/jest-dom';
|
4
|
+
import CodeModal from './CodeModal';
|
5
|
+
|
6
|
+
describe('ChatbotModal', () => {
|
7
|
+
it('should render compact modal', () => {
|
8
|
+
render(
|
9
|
+
<CodeModal
|
10
|
+
isCompact
|
11
|
+
code="Hello world"
|
12
|
+
fileName="greetings.txt"
|
13
|
+
isModalOpen={true}
|
14
|
+
handleModalToggle={jest.fn()}
|
15
|
+
onPrimaryAction={jest.fn()}
|
16
|
+
onSecondaryAction={jest.fn()}
|
17
|
+
title="Preview attachment"
|
18
|
+
primaryActionBtn="Submit"
|
19
|
+
secondaryActionBtn="Cancel"
|
20
|
+
></CodeModal>
|
21
|
+
);
|
22
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-m-compact');
|
23
|
+
});
|
24
|
+
});
|