@patternfly/chatbot 6.3.0-prerelease.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 +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/Message.d.ts +2 -0
- package/dist/cjs/Message/Message.js +6 -6
- package/dist/cjs/Message/Message.test.js +12 -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 +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 +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 +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/Message.d.ts +2 -0
- package/dist/esm/Message/Message.js +6 -6
- package/dist/esm/Message/Message.test.js +12 -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 +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 +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 +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/Message.scss +27 -0
- package/src/Message/Message.test.tsx +21 -0
- 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 +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 +5 -2
- 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 +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
@@ -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
|
@@ -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);
|
@@ -61,6 +68,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
61
68
|
if (element) {
|
62
69
|
element.scrollTo({ top: 0, behavior: 'smooth' });
|
63
70
|
}
|
71
|
+
onScrollToTopClick && onScrollToTopClick();
|
64
72
|
}, [messageBoxRef]);
|
65
73
|
|
66
74
|
const scrollToBottom = React.useCallback(() => {
|
@@ -68,6 +76,7 @@ const MessageBoxBase: React.FunctionComponent<MessageBoxProps> = ({
|
|
68
76
|
if (element) {
|
69
77
|
element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
|
70
78
|
}
|
79
|
+
onScrollToBottomClick && onScrollToBottomClick();
|
71
80
|
}, [messageBoxRef]);
|
72
81
|
|
73
82
|
// Detect scroll position
|
@@ -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}>
|
@@ -74,3 +74,11 @@
|
|
74
74
|
}
|
75
75
|
}
|
76
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
|
+
}
|
@@ -71,6 +71,7 @@ const SourcesCard: React.FunctionComponent<SourcesCardProps> = ({
|
|
71
71
|
onSetPage,
|
72
72
|
showMoreWords = 'show more',
|
73
73
|
showLessWords = 'show less',
|
74
|
+
isCompact,
|
74
75
|
...props
|
75
76
|
}: SourcesCardProps) => {
|
76
77
|
const [page, setPage] = React.useState(1);
|
@@ -95,7 +96,7 @@ const SourcesCard: React.FunctionComponent<SourcesCardProps> = ({
|
|
95
96
|
return (
|
96
97
|
<div className="pf-chatbot__source">
|
97
98
|
<span>{pluralize(sources.length, sourceWord, sourceWordPlural)}</span>
|
98
|
-
<Card className="pf-chatbot__sources-card" {...props}>
|
99
|
+
<Card isCompact={isCompact} className="pf-chatbot__sources-card" {...props}>
|
99
100
|
<CardTitle className="pf-chatbot__sources-card-title">
|
100
101
|
<Button
|
101
102
|
component="a"
|
@@ -64,3 +64,23 @@
|
|
64
64
|
font-size: var(--pf-t--global--font--size--heading--2xl);
|
65
65
|
}
|
66
66
|
}
|
67
|
+
|
68
|
+
.pf-chatbot__terms-of-use-modal.pf-m-compact {
|
69
|
+
.pf-chatbot__terms-of-use--header {
|
70
|
+
gap: var(--pf-t--global--spacer--md);
|
71
|
+
align-items: flex-start;
|
72
|
+
margin-block-start: var(--pf-t--global--spacer--lg);
|
73
|
+
}
|
74
|
+
|
75
|
+
.pf-chatbot__terms-of-use--modal-header {
|
76
|
+
--pf-v6-c-modal-box__header--PaddingBlockStart: var(--pf-t--global--spacer--md);
|
77
|
+
--pf-v6-c-modal-box__header--PaddingBlockEnd: var(--pf-t--global--spacer--md);
|
78
|
+
--pf-v6-c-modal-box__header--PaddingInlineStart: var(--pf-t--global--spacer--md);
|
79
|
+
--pf-v6-c-modal-box__header--PaddingInlineEnd: var(--pf-t--global--spacer--md);
|
80
|
+
}
|
81
|
+
|
82
|
+
.pf-chatbot__terms-of-use--modal-body {
|
83
|
+
--pf-v6-c-modal-box__body--PaddingInlineStart: var(--pf-t--global--spacer--md);
|
84
|
+
--pf-v6-c-modal-box__body--PaddingInlineEnd: var(--pf-t--global--spacer--md);
|
85
|
+
}
|
86
|
+
}
|
@@ -33,6 +33,8 @@ export interface TermsOfUseProps extends ModalProps {
|
|
33
33
|
innerRef?: React.Ref<HTMLDivElement>;
|
34
34
|
/** OuiaID applied to modal */
|
35
35
|
ouiaId?: string;
|
36
|
+
/** Sets modal to compact styling. */
|
37
|
+
isCompact?: boolean;
|
36
38
|
}
|
37
39
|
|
38
40
|
export const TermsOfUseBase: React.FunctionComponent<TermsOfUseProps> = ({
|
@@ -50,6 +52,7 @@ export const TermsOfUseBase: React.FunctionComponent<TermsOfUseProps> = ({
|
|
50
52
|
children,
|
51
53
|
innerRef,
|
52
54
|
ouiaId = 'TermsOfUse',
|
55
|
+
isCompact,
|
53
56
|
...props
|
54
57
|
}: TermsOfUseProps) => {
|
55
58
|
const handlePrimaryAction = (_event: React.MouseEvent | MouseEvent | KeyboardEvent) => {
|
@@ -67,19 +70,21 @@ export const TermsOfUseBase: React.FunctionComponent<TermsOfUseProps> = ({
|
|
67
70
|
ouiaId={ouiaId}
|
68
71
|
aria-labelledby="terms-of-use-title"
|
69
72
|
aria-describedby="terms-of-use-modal"
|
70
|
-
className={`pf-chatbot__terms-of-use-modal pf-chatbot__terms-of-use-modal--${displayMode} ${className ? className : ''}`}
|
73
|
+
className={`pf-chatbot__terms-of-use-modal pf-chatbot__terms-of-use-modal--${displayMode} ${isCompact ? 'pf-m-compact' : ''} ${className ? className : ''}`}
|
71
74
|
displayMode={displayMode}
|
72
75
|
{...props}
|
73
76
|
>
|
74
77
|
{/* This is a workaround since the PatternFly modal doesn't have ref forwarding */}
|
75
78
|
<section className={`pf-chatbot__terms-of-use--section`} aria-label={title} tabIndex={-1} ref={innerRef}>
|
76
|
-
<ModalHeader>
|
79
|
+
<ModalHeader className="pf-chatbot__terms-of-use--modal-header">
|
77
80
|
<div className="pf-chatbot__terms-of-use--header">
|
78
|
-
{image && altText &&
|
81
|
+
{!isCompact && image && altText && (
|
82
|
+
<img src={image} className="pf-chatbot__terms-of-use--image" alt={altText} />
|
83
|
+
)}
|
79
84
|
<h1 className="pf-chatbot__terms-of-use--title">{title}</h1>
|
80
85
|
</div>
|
81
86
|
</ModalHeader>
|
82
|
-
<ModalBody>
|
87
|
+
<ModalBody className="pf-chatbot__terms-of-use--modal-body">
|
83
88
|
<Content>{children}</Content>
|
84
89
|
</ModalBody>
|
85
90
|
<ModalFooter className="pf-chatbot__terms-of-use--footer">
|