@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
@@ -29,6 +29,8 @@ export interface CodeModalProps {
|
|
29
29
|
title: string;
|
30
30
|
/** Display mode for the Chatbot parent; this influences the styles applied */
|
31
31
|
displayMode?: ChatbotDisplayMode;
|
32
|
+
/** Sets modal to compact styling. */
|
33
|
+
isCompact?: boolean;
|
32
34
|
}
|
33
35
|
export declare const CodeModal: React.FunctionComponent<CodeModalProps>;
|
34
36
|
export default CodeModal;
|
@@ -21,7 +21,7 @@ import FileDetails, { extensionToLanguage } from '../FileDetails';
|
|
21
21
|
import { ChatbotDisplayMode } from '../Chatbot';
|
22
22
|
import ChatbotModal from '../ChatbotModal/ChatbotModal';
|
23
23
|
export const CodeModal = (_a) => {
|
24
|
-
var { fileName, code, codeEditorControlClassName: codeEditorClassName, handleModalToggle, isCopyEnabled, isLineNumbersVisible, isModalOpen, isReadOnly, onPrimaryAction, onSecondaryAction, primaryActionBtn, secondaryActionBtn, title, displayMode = ChatbotDisplayMode.default } = _a, props = __rest(_a, ["fileName", "code", "codeEditorControlClassName", "handleModalToggle", "isCopyEnabled", "isLineNumbersVisible", "isModalOpen", "isReadOnly", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "displayMode"]);
|
24
|
+
var { fileName, code, codeEditorControlClassName: codeEditorClassName, handleModalToggle, isCopyEnabled, isLineNumbersVisible, isModalOpen, isReadOnly, onPrimaryAction, onSecondaryAction, primaryActionBtn, secondaryActionBtn, title, displayMode = ChatbotDisplayMode.default, isCompact } = _a, props = __rest(_a, ["fileName", "code", "codeEditorControlClassName", "handleModalToggle", "isCopyEnabled", "isLineNumbersVisible", "isModalOpen", "isReadOnly", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "displayMode", "isCompact"]);
|
25
25
|
const [newCode, setNewCode] = React.useState(code);
|
26
26
|
const handlePrimaryAction = (_event) => {
|
27
27
|
handleModalToggle(_event);
|
@@ -46,13 +46,13 @@ export const CodeModal = (_a) => {
|
|
46
46
|
setNewCode(value);
|
47
47
|
}
|
48
48
|
};
|
49
|
-
const modal = (React.createElement(ChatbotModal, { isOpen: isModalOpen, onClose: handleModalToggle, ouiaId: "CodeModal", "aria-labelledby": "code-modal-title", "aria-describedby": "code-modal", className: `pf-chatbot__code-modal pf-chatbot__code-modal--${displayMode}`, displayMode: displayMode },
|
49
|
+
const modal = (React.createElement(ChatbotModal, { isOpen: isModalOpen, onClose: handleModalToggle, ouiaId: "CodeModal", "aria-labelledby": "code-modal-title", "aria-describedby": "code-modal", className: `pf-chatbot__code-modal ${isCompact ? 'pf-m-compact' : ''} pf-chatbot__code-modal--${displayMode}`, displayMode: displayMode, isCompact: isCompact },
|
50
50
|
React.createElement(ModalHeader, { title: title, labelId: "code-modal-title" }),
|
51
51
|
React.createElement(ModalBody, { id: "code-modal-body" },
|
52
52
|
React.createElement(Stack, { className: "pf-chatbot__code-modal-body" },
|
53
53
|
React.createElement(StackItem, { className: "pf-chatbot__code-modal-file-details" },
|
54
54
|
React.createElement(FileDetails, { fileName: fileName })),
|
55
|
-
React.createElement(StackItem, { className: "pf-chatbot__code-modal-
|
55
|
+
React.createElement(StackItem, { className: "pf-chatbot__code-modal-editor" },
|
56
56
|
React.createElement(CodeEditor, Object.assign({ isDarkTheme: true, isLineNumbersVisible: isLineNumbersVisible, isLanguageLabelVisible: true, isCopyEnabled: isCopyEnabled, isReadOnly: isReadOnly, code: newCode, language: extensionToLanguage[path.extname(fileName).slice(1)], onEditorDidMount: onEditorDidMount, onCodeChange: onCodeChange, className: codeEditorClassName, isFullHeight: true, options: {
|
57
57
|
glyphMargin: false,
|
58
58
|
folding: false
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -0,0 +1,10 @@
|
|
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
|
+
describe('ChatbotModal', () => {
|
6
|
+
it('should render compact modal', () => {
|
7
|
+
render(React.createElement(CodeModal, { isCompact: true, code: "Hello world", fileName: "greetings.txt", isModalOpen: true, handleModalToggle: jest.fn(), onPrimaryAction: jest.fn(), onSecondaryAction: jest.fn(), title: "Preview attachment", primaryActionBtn: "Submit", secondaryActionBtn: "Cancel" }));
|
8
|
+
expect(screen.getByRole('dialog')).toHaveClass('pf-m-compact');
|
9
|
+
});
|
10
|
+
});
|
@@ -929,7 +929,7 @@ export const extensionToLanguage = {
|
|
929
929
|
export const FileDetails = ({ className, fileName, fileNameClassName, languageTestId }) => {
|
930
930
|
var _a;
|
931
931
|
const language = (_a = extensionToLanguage[path.extname(fileName).slice(1)]) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
932
|
-
return (React.createElement(Flex, { className: `pf-chatbot__file-details ${className}`, gap: { default: 'gapSm' } },
|
932
|
+
return (React.createElement(Flex, { className: `pf-chatbot__file-details ${className ? className : ''}`, gap: { default: 'gapSm' } },
|
933
933
|
React.createElement(Flex, { className: "pf-chatbot__code-icon", justifyContent: { default: 'justifyContentCenter' }, alignItems: { default: 'alignItemsCenter' }, alignSelf: { default: 'alignSelfCenter' } },
|
934
934
|
React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg" },
|
935
935
|
React.createElement("path", { d: "M0 4C0 1.79086 1.79086 0 4 0H20C22.2091 0 24 1.79086 24 4V20C24 22.2091 22.2091 24 20 24H4C1.79086 24 0 22.2091 0 20V4Z", fill: "currentColor" }),
|
@@ -120,6 +120,8 @@ export interface MessageProps extends Omit<React.HTMLProps<HTMLDivElement>, 'rol
|
|
120
120
|
onEditCancel?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
121
121
|
/** Props for edit form */
|
122
122
|
editFormProps?: FormProps;
|
123
|
+
/** Sets message to compact styling. */
|
124
|
+
isCompact?: boolean;
|
123
125
|
}
|
124
126
|
export declare const MessageBase: React.FunctionComponent<MessageProps>;
|
125
127
|
declare const Message: React.ForwardRefExoticComponent<Omit<MessageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
@@ -43,7 +43,7 @@ import LinkMessage from './LinkMessage/LinkMessage';
|
|
43
43
|
import ErrorMessage from './ErrorMessage/ErrorMessage';
|
44
44
|
import MessageInput from './MessageInput';
|
45
45
|
export const MessageBase = (_a) => {
|
46
|
-
var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [], linkProps, error, isEditable, editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, editFormProps } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins", "linkProps", "error", "isEditable", "editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "editFormProps"]);
|
46
|
+
var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [], linkProps, error, isEditable, editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, editFormProps, isCompact } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins", "linkProps", "error", "isEditable", "editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "editFormProps", "isCompact"]);
|
47
47
|
const [messageText, setMessageText] = React.useState(content);
|
48
48
|
React.useEffect(() => {
|
49
49
|
setMessageText(content);
|
@@ -122,12 +122,12 @@ export const MessageBase = (_a) => {
|
|
122
122
|
React.createElement("div", { className: "pf-chatbot__message-and-actions" },
|
123
123
|
renderMessage(),
|
124
124
|
afterMainContent && React.createElement(React.Fragment, null, afterMainContent),
|
125
|
-
!isLoading && sources && React.createElement(SourcesCard, Object.assign({}, sources)),
|
126
|
-
quickStarts && quickStarts.quickStart && (React.createElement(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel })),
|
125
|
+
!isLoading && sources && React.createElement(SourcesCard, Object.assign({}, sources, { isCompact: isCompact })),
|
126
|
+
quickStarts && quickStarts.quickStart && (React.createElement(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel, isCompact: isCompact })),
|
127
127
|
!isLoading && actions && React.createElement(ResponseActions, { actions: actions }),
|
128
|
-
userFeedbackForm && React.createElement(UserFeedback, Object.assign({}, userFeedbackForm, { timestamp: dateString })),
|
129
|
-
userFeedbackComplete && React.createElement(UserFeedbackComplete, Object.assign({}, userFeedbackComplete, { timestamp: dateString })),
|
130
|
-
!isLoading && quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps }))),
|
128
|
+
userFeedbackForm && React.createElement(UserFeedback, Object.assign({}, userFeedbackForm, { timestamp: dateString, isCompact: isCompact })),
|
129
|
+
userFeedbackComplete && (React.createElement(UserFeedbackComplete, Object.assign({}, userFeedbackComplete, { timestamp: dateString, isCompact: isCompact }))),
|
130
|
+
!isLoading && quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, isCompact: isCompact }))),
|
131
131
|
attachments && (React.createElement("div", { className: "pf-chatbot__message-attachments-container" }, attachments.map((attachment) => {
|
132
132
|
var _a;
|
133
133
|
return (React.createElement("div", { key: (_a = attachment.id) !== null && _a !== void 0 ? _a : attachment.name, className: "pf-chatbot__message-attachment" },
|
@@ -282,6 +282,18 @@ describe('Message', () => {
|
|
282
282
|
yield userEvent.click(quickResponse);
|
283
283
|
expect(spy).toHaveBeenCalledTimes(1);
|
284
284
|
}));
|
285
|
+
it('should be able to handle isCompact', () => __awaiter(void 0, void 0, void 0, function* () {
|
286
|
+
render(React.createElement(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", quickResponses: [
|
287
|
+
{
|
288
|
+
id: '1',
|
289
|
+
content: 'Yes',
|
290
|
+
onClick: jest.fn(),
|
291
|
+
className: 'test'
|
292
|
+
}
|
293
|
+
], isCompact: true }));
|
294
|
+
const parent = screen.getByRole('button', { name: /Yes/i }).parentNode;
|
295
|
+
expect(parent).toHaveClass('pf-m-compact');
|
296
|
+
}));
|
285
297
|
it('should be able to show more than 1 quick response', () => __awaiter(void 0, void 0, void 0, function* () {
|
286
298
|
const spy = jest.fn();
|
287
299
|
render(React.createElement(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", quickResponses: [
|
@@ -12,6 +12,8 @@ export interface QuickResponseProps {
|
|
12
12
|
quickResponseContainerProps?: Omit<LabelGroupProps, 'ref'>;
|
13
13
|
/** Callback when a response is clicked; used in feedback cards */
|
14
14
|
onSelect?: (id: string) => void;
|
15
|
+
/** Sets the quick responses to compact styling */
|
16
|
+
isCompact?: boolean;
|
15
17
|
}
|
16
18
|
export declare const QuickResponse: React.FunctionComponent<QuickResponseProps>;
|
17
19
|
export default QuickResponse;
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
12
12
|
import React from 'react';
|
13
13
|
import { Label, LabelGroup } from '@patternfly/react-core';
|
14
14
|
import { CheckIcon } from '@patternfly/react-icons';
|
15
|
-
export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 }, onSelect }) => {
|
15
|
+
export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 }, onSelect, isCompact }) => {
|
16
16
|
const [selectedQuickResponse, setSelectedQuickResponse] = React.useState();
|
17
17
|
const handleQuickResponseClick = (id, onClick) => {
|
18
18
|
setSelectedQuickResponse(id);
|
@@ -21,7 +21,7 @@ export const QuickResponse = ({ quickResponses, quickResponseContainerProps = {
|
|
21
21
|
};
|
22
22
|
return (React.createElement(LabelGroup, Object.assign({ className: `pf-chatbot__message-quick-response ${(quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className) ? quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className : ''}` }, quickResponseContainerProps), quickResponses.map((_a) => {
|
23
23
|
var { id, onClick, content, className } = _a, props = __rest(_a, ["id", "onClick", "content", "className"]);
|
24
|
-
return (React.createElement(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? React.createElement(CheckIcon, null) : undefined, color: "blue", key: id, onClick: () => handleQuickResponseClick(id, onClick), className: `${id === selectedQuickResponse ? 'pf-chatbot__message-quick-response--selected' : ''} ${className ? className : ''}
|
24
|
+
return (React.createElement(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? React.createElement(CheckIcon, null) : undefined, color: "blue", key: id, onClick: () => handleQuickResponseClick(id, onClick), className: `${id === selectedQuickResponse ? 'pf-chatbot__message-quick-response--selected' : ''} ${className ? className : ''}`, isCompact: isCompact }, props), content));
|
25
25
|
})));
|
26
26
|
};
|
27
27
|
export default QuickResponse;
|
@@ -22,6 +22,8 @@ export interface QuickStartTileProps {
|
|
22
22
|
prerequisiteWordPlural?: string;
|
23
23
|
/** Aria-label for the quick start description button */
|
24
24
|
quickStartButtonAriaLabel?: string;
|
25
|
+
/** Sets the tile to compact styling */
|
26
|
+
isCompact?: boolean;
|
25
27
|
}
|
26
28
|
declare const QuickStartTile: React.FC<QuickStartTileProps>;
|
27
29
|
export default QuickStartTile;
|
@@ -12,7 +12,7 @@ export const camelize = (str) => str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function
|
|
12
12
|
} // or if (/\s+/.test(match)) for white spaces
|
13
13
|
return index === 0 ? match.toLowerCase() : match.toUpperCase();
|
14
14
|
});
|
15
|
-
const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action }) => {
|
15
|
+
const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action, isCompact }) => {
|
16
16
|
const { metadata: { name: id }, spec: { icon, displayName, description, durationMinutes, prerequisites, link, type } } = quickStart;
|
17
17
|
let quickStartIcon;
|
18
18
|
if (typeof icon === 'object') {
|
@@ -33,7 +33,7 @@ const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, mi
|
|
33
33
|
};
|
34
34
|
const ActionIcon = (action === null || action === void 0 ? void 0 : action.icon) || OutlinedBookmarkIcon;
|
35
35
|
const additionalAction = action ? (React.createElement(Button, Object.assign({ "aria-label": action['aria-label'], icon: React.createElement(ActionIcon, null), variant: "plain", onClick: action.onClick }, action.buttonProps))) : undefined;
|
36
|
-
return (React.createElement(Card, { className: `pf-chatbot__quickstarts-tile ${className ? className : ''}`, id: `${id}-chatbot-qs-tile`, style: { height: '100%' }, "data-testid": `chatbot-qs-card-${camelize(displayName)}
|
36
|
+
return (React.createElement(Card, { className: `pf-chatbot__quickstarts-tile ${className ? className : ''}`, id: `${id}-chatbot-qs-tile`, style: { height: '100%' }, "data-testid": `chatbot-qs-card-${camelize(displayName)}`, isCompact: isCompact },
|
37
37
|
React.createElement(CardHeader, Object.assign({}, (action && {
|
38
38
|
actions: { actions: additionalAction }
|
39
39
|
})), quickStartIcon),
|
@@ -18,7 +18,7 @@ import { ActionGroup, Button, Card, CardBody, CardHeader, Form, TextArea } from
|
|
18
18
|
import QuickResponse from '../QuickResponse/QuickResponse';
|
19
19
|
import CloseButton from './CloseButton';
|
20
20
|
const UserFeedback = (_a) => {
|
21
|
-
var { className, timestamp, title = 'Why did you choose this rating?', hasTextArea, textAreaAriaLabel = `Provide optional additional feedback for message received at ${timestamp}`, textAreaPlaceholder = 'Provide optional additional feedback', onTextAreaChange, submitWord = 'Submit', quickResponses, quickResponseContainerProps = { 'aria-label': `Quick feedback for message received at ${timestamp}` }, onSubmit, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, id, headingLevel: HeadingLevel = 'h1', focusOnLoad = true } = _a, props = __rest(_a, ["className", "timestamp", "title", "hasTextArea", "textAreaAriaLabel", "textAreaPlaceholder", "onTextAreaChange", "submitWord", "quickResponses", "quickResponseContainerProps", "onSubmit", "onClose", "closeButtonAriaLabel", "id", "headingLevel", "focusOnLoad"]);
|
21
|
+
var { className, timestamp, title = 'Why did you choose this rating?', hasTextArea, textAreaAriaLabel = `Provide optional additional feedback for message received at ${timestamp}`, textAreaPlaceholder = 'Provide optional additional feedback', onTextAreaChange, submitWord = 'Submit', quickResponses, quickResponseContainerProps = { 'aria-label': `Quick feedback for message received at ${timestamp}` }, onSubmit, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, id, headingLevel: HeadingLevel = 'h1', focusOnLoad = true, isCompact } = _a, props = __rest(_a, ["className", "timestamp", "title", "hasTextArea", "textAreaAriaLabel", "textAreaPlaceholder", "onTextAreaChange", "submitWord", "quickResponses", "quickResponseContainerProps", "onSubmit", "onClose", "closeButtonAriaLabel", "id", "headingLevel", "focusOnLoad", "isCompact"]);
|
22
22
|
const [selectedResponse, setSelectedResponse] = React.useState();
|
23
23
|
const [value, setValue] = React.useState('');
|
24
24
|
const divRef = React.useRef(null);
|
@@ -31,14 +31,14 @@ const UserFeedback = (_a) => {
|
|
31
31
|
return (
|
32
32
|
/* card does not have ref forwarding; hence wrapper div */
|
33
33
|
React.createElement("div", { ref: divRef, id: id, tabIndex: 0, "aria-label": title },
|
34
|
-
React.createElement(Card, Object.assign({ className: `pf-chatbot__feedback-card ${className ? className : ''}` }, props),
|
34
|
+
React.createElement(Card, Object.assign({ isCompact: isCompact, className: `pf-chatbot__feedback-card ${className ? className : ''}` }, props),
|
35
35
|
React.createElement(CardHeader, { actions: {
|
36
36
|
actions: React.createElement(CloseButton, { onClose: onClose, ariaLabel: closeButtonAriaLabel })
|
37
37
|
} },
|
38
38
|
React.createElement(HeadingLevel, { className: "pf-chatbot__feedback-card-title" }, title)),
|
39
39
|
React.createElement(CardBody, null,
|
40
|
-
React.createElement(Form, { className:
|
41
|
-
quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, onSelect: (id) => setSelectedResponse(id) })),
|
40
|
+
React.createElement(Form, { className: `pf-chatbot__feedback-card-form ${isCompact ? 'pf-m-compact' : ''}` },
|
41
|
+
quickResponses && (React.createElement(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, onSelect: (id) => setSelectedResponse(id), isCompact: isCompact })),
|
42
42
|
hasTextArea && (React.createElement(TextArea, { value: value, onChange: (_event, value) => {
|
43
43
|
setValue(value);
|
44
44
|
onTextAreaChange && onTextAreaChange(_event, value);
|
@@ -125,4 +125,8 @@ describe('UserFeedback', () => {
|
|
125
125
|
render(React.createElement(UserFeedback, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, "data-testid": "card", focusOnLoad: false }));
|
126
126
|
expect(screen.getByTestId('card').parentElement).not.toHaveFocus();
|
127
127
|
});
|
128
|
+
it('should handle isCompact', () => {
|
129
|
+
render(React.createElement(UserFeedback, { timestamp: "12/12/12", onClose: jest.fn, onSubmit: jest.fn, quickResponses: MOCK_RESPONSES, "data-testid": "card", isCompact: true }));
|
130
|
+
expect(screen.getByTestId('card')).toHaveClass('pf-m-compact');
|
131
|
+
});
|
128
132
|
});
|
@@ -17,7 +17,7 @@ import React from 'react';
|
|
17
17
|
import { Card, CardBody, CardHeader, CardTitle, useOUIAProps } from '@patternfly/react-core';
|
18
18
|
import CloseButton from './CloseButton';
|
19
19
|
const UserFeedbackComplete = (_a) => {
|
20
|
-
var { className, title = 'Feedback submitted', body = "We've received your response. Thank you for sharing your feedback!", timestamp, timeout = false, timeoutAnimation = 3000, onTimeout, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, onMouseEnter, onMouseLeave, ouiaId, ouiaSafe, isLiveRegion, id, focusOnLoad = true } = _a, props = __rest(_a, ["className", "title", "body", "timestamp", "timeout", "timeoutAnimation", "onTimeout", "onClose", "closeButtonAriaLabel", "onMouseEnter", "onMouseLeave", "ouiaId", "ouiaSafe", "isLiveRegion", "id", "focusOnLoad"]);
|
20
|
+
var { className, title = 'Feedback submitted', body = "We've received your response. Thank you for sharing your feedback!", timestamp, timeout = false, timeoutAnimation = 3000, onTimeout, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, onMouseEnter, onMouseLeave, ouiaId, ouiaSafe, isLiveRegion, id, focusOnLoad = true, isCompact } = _a, props = __rest(_a, ["className", "title", "body", "timestamp", "timeout", "timeoutAnimation", "onTimeout", "onClose", "closeButtonAriaLabel", "onMouseEnter", "onMouseLeave", "ouiaId", "ouiaSafe", "isLiveRegion", "id", "focusOnLoad", "isCompact"]);
|
21
21
|
const [timedOut, setTimedOut] = React.useState(false);
|
22
22
|
const [timedOutAnimation, setTimedOutAnimation] = React.useState(true);
|
23
23
|
const [isMouseOver, setIsMouseOver] = React.useState();
|
@@ -80,8 +80,8 @@ const UserFeedbackComplete = (_a) => {
|
|
80
80
|
'aria-live': 'polite',
|
81
81
|
'aria-atomic': 'false'
|
82
82
|
}), { id: id, tabIndex: 0, "aria-label": title }, ouiaProps),
|
83
|
-
React.createElement(Card, Object.assign({ className: `pf-chatbot__feedback-card ${className ? className : ''}` }, props),
|
84
|
-
React.createElement(CardHeader, { actions:
|
83
|
+
React.createElement(Card, Object.assign({ isCompact: isCompact, className: `pf-chatbot__feedback-card pf-chatbot__feedback-card-complete${className ? ` ${className}` : ''}` }, props),
|
84
|
+
React.createElement(CardHeader, { className: onClose ? 'pf-chatbot__feedback-card-complete-header' : 'pf-chatbot__feedback-card-complete-empty-header', actions:
|
85
85
|
/* eslint-disable indent */
|
86
86
|
onClose
|
87
87
|
? {
|
@@ -107,6 +107,6 @@ const UserFeedbackComplete = (_a) => {
|
|
107
107
|
React.createElement("path", { d: "M27.7803 30.1276C27.6098 30.1276 27.4497 30.0614 27.3298 29.9406L22.9465 25.5562C22.8267 25.4364 22.7595 25.2762 22.7595 25.1068C22.7595 24.9374 22.8256 24.7762 22.9465 24.6554L24.2379 23.364C24.3577 23.2442 24.5178 23.177 24.6883 23.177C24.8587 23.177 25.0168 23.2431 25.1377 23.363L27.7803 26.0056L34.861 18.9259C34.9808 18.8061 35.1409 18.7389 35.3103 18.7389C35.4798 18.7389 35.6389 18.8051 35.7597 18.9239L37.0531 20.2173C37.173 20.3361 37.2401 20.4962 37.2401 20.6677C37.2401 20.8392 37.174 20.9983 37.0531 21.1181L28.2317 29.9406C28.1119 30.0604 27.9518 30.1265 27.7823 30.1265L27.7803 30.1276Z", fill: "white" }))),
|
108
108
|
React.createElement("div", { className: "pf-chatbot__feedback-complete-text" },
|
109
109
|
React.createElement(CardTitle, { className: "pf-chatbot__feedback-complete-title" }, title),
|
110
|
-
React.createElement(CardBody, { className: `pf-chatbot__feedback-complete-body` }, body))))));
|
110
|
+
React.createElement(CardBody, { className: `pf-chatbot__feedback-complete-card-body` }, body))))));
|
111
111
|
};
|
112
112
|
export default UserFeedbackComplete;
|
@@ -241,4 +241,8 @@ describe('UserFeedbackComplete', () => {
|
|
241
241
|
render(React.createElement(UserFeedbackComplete, { timestamp: "12/12/12", "data-testid": "card", focusOnLoad: false }));
|
242
242
|
expect(screen.getByTestId('card').parentElement).not.toHaveFocus();
|
243
243
|
});
|
244
|
+
it('should handle isCompact', () => {
|
245
|
+
render(React.createElement(UserFeedbackComplete, { timestamp: "12/12/12", "data-testid": "card", isCompact: true }));
|
246
|
+
expect(screen.getByTestId('card')).toHaveClass('pf-m-compact');
|
247
|
+
});
|
244
248
|
});
|
@@ -17,5 +17,6 @@ export interface AttachButtonProps extends ButtonProps {
|
|
17
17
|
tooltipContent?: string;
|
18
18
|
/** Test id applied to input */
|
19
19
|
inputTestId?: string;
|
20
|
+
isCompact?: boolean;
|
20
21
|
}
|
21
22
|
export declare const AttachButton: React.ForwardRefExoticComponent<AttachButtonProps & React.RefAttributes<any>>;
|
@@ -18,7 +18,7 @@ import { Button, Icon, Tooltip } from '@patternfly/react-core';
|
|
18
18
|
import { useDropzone } from 'react-dropzone';
|
19
19
|
import { PaperclipIcon } from '@patternfly/react-icons/dist/esm/icons/paperclip-icon';
|
20
20
|
const AttachButtonBase = (_a) => {
|
21
|
-
var { onAttachAccepted, onClick, isDisabled, className, tooltipProps, innerRef, tooltipContent = 'Attach', inputTestId } = _a, props = __rest(_a, ["onAttachAccepted", "onClick", "isDisabled", "className", "tooltipProps", "innerRef", "tooltipContent", "inputTestId"]);
|
21
|
+
var { onAttachAccepted, onClick, isDisabled, className, tooltipProps, innerRef, tooltipContent = 'Attach', inputTestId, isCompact } = _a, props = __rest(_a, ["onAttachAccepted", "onClick", "isDisabled", "className", "tooltipProps", "innerRef", "tooltipContent", "inputTestId", "isCompact"]);
|
22
22
|
const { open, getInputProps } = useDropzone({
|
23
23
|
multiple: true,
|
24
24
|
onDropAccepted: onAttachAccepted
|
@@ -28,7 +28,7 @@ const AttachButtonBase = (_a) => {
|
|
28
28
|
React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--attach", content: tooltipContent, position: "top", entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
|
29
29
|
// prevents VO announcements of both aria label and tooltip
|
30
30
|
aria: "none" }, tooltipProps),
|
31
|
-
React.createElement(Button, Object.assign({ variant: "plain", ref: innerRef, className: `pf-chatbot__button--attach ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Attach button', isDisabled: isDisabled, onClick: onClick !== null && onClick !== void 0 ? onClick : open, icon: React.createElement(Icon, { iconSize:
|
32
|
-
React.createElement(PaperclipIcon, null)) }, props)))));
|
31
|
+
React.createElement(Button, Object.assign({ variant: "plain", ref: innerRef, className: `pf-chatbot__button--attach ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Attach button', isDisabled: isDisabled, onClick: onClick !== null && onClick !== void 0 ? onClick : open, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
32
|
+
React.createElement(PaperclipIcon, null)), size: isCompact ? 'sm' : undefined }, props)))));
|
33
33
|
};
|
34
34
|
export const AttachButton = React.forwardRef((props, ref) => (React.createElement(AttachButtonBase, Object.assign({ innerRef: ref }, props))));
|
@@ -58,4 +58,8 @@ describe('Attach button', () => {
|
|
58
58
|
expect(input.files).toHaveLength(1);
|
59
59
|
expect(spy).toHaveBeenCalledTimes(1);
|
60
60
|
}));
|
61
|
+
it('should handle isCompact', () => {
|
62
|
+
render(React.createElement(AttachButton, { isCompact: true, "data-testid": "button" }));
|
63
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
64
|
+
});
|
61
65
|
});
|
@@ -28,10 +28,14 @@ export interface MessageBarProps extends TextAreaProps {
|
|
28
28
|
className?: string;
|
29
29
|
/** Flag to always to show the send button. By default send button is shown when there is a message in the input field */
|
30
30
|
alwayShowSendButton?: boolean;
|
31
|
+
/** Placeholder for message input */
|
32
|
+
placeholder?: string;
|
31
33
|
/** Flag to disable/enable the Attach button */
|
32
34
|
hasAttachButton?: boolean;
|
33
35
|
/** Flag to enable the Microphone button */
|
34
36
|
hasMicrophoneButton?: boolean;
|
37
|
+
/** Placeholder text when listening */
|
38
|
+
listeningText?: string;
|
35
39
|
/** Flag to enable the Stop button, used for streaming content */
|
36
40
|
hasStopButton?: boolean;
|
37
41
|
/** Callback function for when stop button is clicked */
|
@@ -74,6 +78,7 @@ export interface MessageBarProps extends TextAreaProps {
|
|
74
78
|
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>, value: string | number) => void;
|
75
79
|
/** Display mode of chatbot, if you want to message bar to resize when the display mode changes */
|
76
80
|
displayMode?: ChatbotDisplayMode;
|
81
|
+
isCompact?: boolean;
|
77
82
|
}
|
78
83
|
export declare const MessageBar: React.FunctionComponent<MessageBarProps>;
|
79
84
|
export default MessageBar;
|
@@ -18,7 +18,7 @@ import { AttachButton } from './AttachButton';
|
|
18
18
|
import AttachMenu from '../AttachMenu';
|
19
19
|
import StopButton from './StopButton';
|
20
20
|
export const MessageBar = (_a) => {
|
21
|
-
var { onSendMessage, className, alwayShowSendButton, hasAttachButton = true, hasMicrophoneButton, handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "hasAttachButton", "hasMicrophoneButton", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value"]);
|
21
|
+
var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value, isCompact = false } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value", "isCompact"]);
|
22
22
|
// Text Input
|
23
23
|
// --------------------------------------------------------------------------
|
24
24
|
const [message, setMessage] = React.useState(value !== null && value !== void 0 ? value : '');
|
@@ -26,11 +26,12 @@ export const MessageBar = (_a) => {
|
|
26
26
|
const [hasSentMessage, setHasSentMessage] = React.useState(false);
|
27
27
|
const textareaRef = React.useRef(null);
|
28
28
|
const attachButtonRef = React.useRef(null);
|
29
|
+
const topMargin = '1rem';
|
29
30
|
const setInitialLineHeight = (field) => {
|
30
31
|
field.style.setProperty('line-height', '1rem');
|
31
32
|
const parent = field.parentElement;
|
32
33
|
if (parent) {
|
33
|
-
parent.style.setProperty('margin-top',
|
34
|
+
parent.style.setProperty('margin-top', topMargin);
|
34
35
|
parent.style.setProperty('margin-bottom', `0rem`);
|
35
36
|
parent.style.setProperty('height', 'inherit');
|
36
37
|
const grandparent = parent.parentElement;
|
@@ -52,8 +53,8 @@ export const MessageBar = (_a) => {
|
|
52
53
|
parseInt(computed.getPropertyValue('border-bottom-width'));
|
53
54
|
parent.style.setProperty('height', `${height}px`);
|
54
55
|
if (height > 32 || window.innerWidth <= 507) {
|
55
|
-
parent.style.setProperty('margin-bottom',
|
56
|
-
parent.style.setProperty('margin-top',
|
56
|
+
parent.style.setProperty('margin-bottom', topMargin);
|
57
|
+
parent.style.setProperty('margin-top', topMargin);
|
57
58
|
}
|
58
59
|
}
|
59
60
|
};
|
@@ -74,8 +75,8 @@ export const MessageBar = (_a) => {
|
|
74
75
|
const handleNewLine = (field) => {
|
75
76
|
const parent = field.parentElement;
|
76
77
|
if (parent) {
|
77
|
-
parent.style.setProperty('margin-bottom',
|
78
|
-
parent.style.setProperty('margin-top',
|
78
|
+
parent.style.setProperty('margin-bottom', topMargin);
|
79
|
+
parent.style.setProperty('margin-top', topMargin);
|
79
80
|
}
|
80
81
|
};
|
81
82
|
React.useEffect(() => {
|
@@ -170,17 +171,17 @@ export const MessageBar = (_a) => {
|
|
170
171
|
const renderButtons = () => {
|
171
172
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
172
173
|
if (hasStopButton && handleStopButton) {
|
173
|
-
return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent }, (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.props)));
|
174
|
+
return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent, isCompact: isCompact }, (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.props)));
|
174
175
|
}
|
175
176
|
return (React.createElement(React.Fragment, null,
|
176
|
-
attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _c === void 0 ? void 0 : _c.tooltipContent }, (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.props))),
|
177
|
-
!attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipContent, inputTestId: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.inputTestId }, (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.props))),
|
178
|
-
hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _h === void 0 ? void 0 : _h.tooltipContent, language: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _j === void 0 ? void 0 : _j.language }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _k === void 0 ? void 0 : _k.props))),
|
179
|
-
(alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _l === void 0 ? void 0 : _l.tooltipContent }, (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _m === void 0 ? void 0 : _m.props)))));
|
177
|
+
attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _c === void 0 ? void 0 : _c.tooltipContent, isCompact: isCompact }, (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.props))),
|
178
|
+
!attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipContent, inputTestId: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.inputTestId, isCompact: isCompact }, (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.props))),
|
179
|
+
hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _h === void 0 ? void 0 : _h.tooltipContent, language: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _j === void 0 ? void 0 : _j.language, isCompact: isCompact }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _k === void 0 ? void 0 : _k.props))),
|
180
|
+
(alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _l === void 0 ? void 0 : _l.tooltipContent, isCompact: isCompact }, (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _m === void 0 ? void 0 : _m.props)))));
|
180
181
|
};
|
181
182
|
const messageBarContents = (React.createElement(React.Fragment, null,
|
182
|
-
React.createElement("div", { className:
|
183
|
-
React.createElement(TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ?
|
183
|
+
React.createElement("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}` },
|
184
|
+
React.createElement(TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ? listeningText : placeholder, placeholder: isListeningMessage ? listeningText : placeholder, ref: textareaRef, onKeyDown: handleKeyDown }, props))),
|
184
185
|
React.createElement("div", { className: "pf-chatbot__message-bar-actions" }, renderButtons())));
|
185
186
|
if (attachMenuProps) {
|
186
187
|
return (React.createElement(AttachMenu, Object.assign({ toggle: (toggleRef) => (React.createElement("div", { ref: toggleRef, className: `pf-chatbot__message-bar ${className !== null && className !== void 0 ? className : ''}` }, messageBarContents)), filteredItems: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.attachMenuItems }, (attachMenuProps && { isOpen: attachMenuProps.isAttachMenuOpen }), { onOpenChange: (isAttachMenuOpen) => {
|
@@ -71,6 +71,12 @@ describe('Message bar', () => {
|
|
71
71
|
expect(spy).toHaveBeenCalledTimes(1);
|
72
72
|
expect(spy).toHaveBeenCalledWith(expect.any(Object), 'A');
|
73
73
|
}));
|
74
|
+
it('can use specified placeholder text', () => __awaiter(void 0, void 0, void 0, function* () {
|
75
|
+
render(React.createElement(MessageBar, { onSendMessage: jest.fn, placeholder: "test placeholder" }));
|
76
|
+
const input = screen.getByRole('textbox', { name: /test placeholder/i });
|
77
|
+
yield userEvent.type(input, 'Hello world');
|
78
|
+
expect(input).toHaveTextContent('Hello world');
|
79
|
+
}));
|
74
80
|
// Send button
|
75
81
|
// --------------------------------------------------------------------------
|
76
82
|
it('shows send button when text is input', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -224,6 +230,13 @@ describe('Message bar', () => {
|
|
224
230
|
yield userEvent.click(screen.getByRole('button', { name: 'Microphone button' }));
|
225
231
|
expect(screen.getByRole('tooltip', { name: 'Not currently listening' })).toBeTruthy();
|
226
232
|
}));
|
233
|
+
it('can customize the listening placeholder', () => __awaiter(void 0, void 0, void 0, function* () {
|
234
|
+
mockSpeechRecognition();
|
235
|
+
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, listeningText: "I am listening" }));
|
236
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Microphone button' }));
|
237
|
+
const input = screen.getByRole('textbox', { name: /I am listening/i });
|
238
|
+
expect(input).toBeTruthy();
|
239
|
+
}));
|
227
240
|
it('can handle buttonProps props appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
|
228
241
|
mockSpeechRecognition();
|
229
242
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { props: { 'aria-label': 'Test' } } } }));
|
@@ -18,6 +18,7 @@ export interface MicrophoneButtonProps extends ButtonProps {
|
|
18
18
|
};
|
19
19
|
/** 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. */
|
20
20
|
language?: string;
|
21
|
+
isCompact?: boolean;
|
21
22
|
}
|
22
23
|
export declare const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps>;
|
23
24
|
export default MicrophoneButton;
|
@@ -18,7 +18,7 @@ import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
|
18
18
|
// Import FontAwesome icons
|
19
19
|
import { MicrophoneIcon } from '@patternfly/react-icons/dist/esm/icons/microphone-icon';
|
20
20
|
export const MicrophoneButton = (_a) => {
|
21
|
-
var { isListening, onIsListeningChange, onSpeechRecognition, className, tooltipProps, tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' }, language = 'en-US' } = _a, props = __rest(_a, ["isListening", "onIsListeningChange", "onSpeechRecognition", "className", "tooltipProps", "tooltipContent", "language"]);
|
21
|
+
var { isListening, onIsListeningChange, onSpeechRecognition, className, tooltipProps, tooltipContent = { active: 'Stop listening', inactive: 'Use microphone' }, language = 'en-US', isCompact } = _a, props = __rest(_a, ["isListening", "onIsListeningChange", "onSpeechRecognition", "className", "tooltipProps", "tooltipContent", "language", "isCompact"]);
|
22
22
|
// Microphone
|
23
23
|
// --------------------------------------------------------------------------
|
24
24
|
const [speechRecognition, setSpeechRecognition] = React.useState();
|
@@ -63,7 +63,7 @@ export const MicrophoneButton = (_a) => {
|
|
63
63
|
return null;
|
64
64
|
}
|
65
65
|
return (React.createElement(Tooltip, Object.assign({ aria: "none", "aria-live": "polite", id: "pf-chatbot__tooltip--use-microphone", content: isListening ? tooltipContent.active : tooltipContent.inactive, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0 }, tooltipProps),
|
66
|
-
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Microphone button', onClick: isListening ? stopListening : startListening, icon: React.createElement(Icon, { iconSize:
|
67
|
-
React.createElement(MicrophoneIcon, null)) }, props))));
|
66
|
+
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Microphone button', onClick: isListening ? stopListening : startListening, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
67
|
+
React.createElement(MicrophoneIcon, null)), size: isCompact ? 'sm' : undefined }, props))));
|
68
68
|
};
|
69
69
|
export default MicrophoneButton;
|
@@ -9,6 +9,7 @@ export interface SendButtonProps extends ButtonProps {
|
|
9
9
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
10
10
|
/** English text "Send" used in the tooltip */
|
11
11
|
tooltipContent?: string;
|
12
|
+
isCompact?: boolean;
|
12
13
|
}
|
13
14
|
export declare const SendButton: React.FunctionComponent<SendButtonProps>;
|
14
15
|
export default SendButton;
|
@@ -17,11 +17,11 @@ import React from 'react';
|
|
17
17
|
import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
18
18
|
import { PaperPlaneIcon } from '@patternfly/react-icons/dist/esm/icons/paper-plane-icon';
|
19
19
|
export const SendButton = (_a) => {
|
20
|
-
var { className, onClick, tooltipProps, tooltipContent = 'Send' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
|
20
|
+
var { className, onClick, tooltipProps, tooltipContent = 'Send', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent", "isCompact"]);
|
21
21
|
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--send", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
|
22
22
|
// prevents VO announcements of both aria label and tooltip
|
23
23
|
aria: "none" }, tooltipProps),
|
24
|
-
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: React.createElement(Icon, { iconSize:
|
25
|
-
React.createElement(PaperPlaneIcon, null)) }, props))));
|
24
|
+
React.createElement(Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
25
|
+
React.createElement(PaperPlaneIcon, null)), size: isCompact ? 'sm' : undefined }, props))));
|
26
26
|
};
|
27
27
|
export default SendButton;
|
@@ -46,4 +46,8 @@ describe('Send button', () => {
|
|
46
46
|
yield userEvent.click(screen.getByRole('button', { name: 'Send button' }));
|
47
47
|
expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
|
48
48
|
}));
|
49
|
+
it('should handle isCompact', () => {
|
50
|
+
renderSend({ 'data-testid': 'button', isCompact: true });
|
51
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
52
|
+
});
|
49
53
|
});
|
@@ -9,6 +9,7 @@ export interface StopButtonProps extends ButtonProps {
|
|
9
9
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
10
10
|
/** English text "Stop" used in the tooltip */
|
11
11
|
tooltipContent?: string;
|
12
|
+
isCompact?: boolean;
|
12
13
|
}
|
13
14
|
export declare const StopButton: React.FunctionComponent<StopButtonProps>;
|
14
15
|
export default StopButton;
|
@@ -16,12 +16,12 @@ import React from 'react';
|
|
16
16
|
// Import PatternFly components
|
17
17
|
import { Button, Tooltip, Icon } from '@patternfly/react-core';
|
18
18
|
export const StopButton = (_a) => {
|
19
|
-
var { className, onClick, tooltipProps, tooltipContent = 'Stop' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
|
19
|
+
var { className, onClick, tooltipProps, tooltipContent = 'Stop', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent", "isCompact"]);
|
20
20
|
return (React.createElement(Tooltip, Object.assign({ id: "pf-chatbot__tooltip--stop", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0,
|
21
21
|
// prevents VO announcements of both aria label and tooltip
|
22
22
|
aria: "none" }, tooltipProps),
|
23
|
-
React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop button', onClick: onClick, icon: React.createElement(Icon, { iconSize:
|
23
|
+
React.createElement(Button, Object.assign({ className: `pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, variant: "link", "aria-label": props['aria-label'] || 'Stop button', onClick: onClick, icon: React.createElement(Icon, { iconSize: isCompact ? 'lg' : 'xl', isInline: true },
|
24
24
|
React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
25
|
-
React.createElement("path", { 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", fill: "currentColor" }))) }, props))));
|
25
|
+
React.createElement("path", { 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", fill: "currentColor" }))), size: isCompact ? 'sm' : undefined }, props))));
|
26
26
|
};
|
27
27
|
export default StopButton;
|
@@ -46,4 +46,8 @@ describe('Stop button', () => {
|
|
46
46
|
yield userEvent.click(screen.getByRole('button', { name: 'Stop button' }));
|
47
47
|
expect(screen.getByRole('tooltip', { name: 'Stop' })).toHaveAttribute('id', 'test');
|
48
48
|
}));
|
49
|
+
it('should handle isCompact', () => {
|
50
|
+
renderStop({ 'data-testid': 'button', isCompact: true });
|
51
|
+
expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
|
52
|
+
});
|
49
53
|
});
|
@@ -12,6 +12,10 @@ export interface MessageBoxProps extends React.HTMLProps<HTMLDivElement> {
|
|
12
12
|
innerRef?: React.Ref<HTMLDivElement>;
|
13
13
|
/** Modifier that controls how content in MessageBox is positioned within the container */
|
14
14
|
position?: 'top' | 'bottom';
|
15
|
+
/** Click handler for additional logic for when scroll to top jump button is clicked */
|
16
|
+
onScrollToTopClick?: () => void;
|
17
|
+
/** Click handler for additional logic for when scroll to bottom jump button is clicked */
|
18
|
+
onScrollToBottomClick?: () => void;
|
15
19
|
}
|
16
20
|
export declare const MessageBox: React.ForwardRefExoticComponent<Omit<MessageBoxProps, "ref"> & React.RefAttributes<any>>;
|
17
21
|
export default MessageBox;
|