@patternfly/chatbot 6.3.0-prerelease.1 → 6.3.0-prerelease.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/cjs/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/cjs/Chatbot/Chatbot.d.ts +2 -0
- package/dist/cjs/Chatbot/Chatbot.js +2 -2
- package/dist/cjs/Chatbot/Chatbot.test.js +4 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +2 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +3 -3
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +4 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +1 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeader.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +28 -0
- package/dist/cjs/ChatbotPopover/ChatbotPopover.js +1 -1
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
- package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
- package/dist/cjs/CodeModal/CodeModal.js +3 -3
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/cjs/CodeModal/CodeModal.test.js +15 -0
- package/dist/cjs/FileDetails/FileDetails.js +1 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +1 -1
- package/dist/cjs/Message/Message.d.ts +2 -0
- package/dist/cjs/Message/Message.js +6 -6
- package/dist/cjs/Message/Message.test.js +15 -3
- package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +2 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +2 -2
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +2 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +2 -2
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +4 -0
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +4 -4
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
- package/dist/cjs/MessageBar/AttachButton.d.ts +1 -0
- package/dist/cjs/MessageBar/AttachButton.js +3 -3
- package/dist/cjs/MessageBar/AttachButton.test.js +11 -7
- package/dist/cjs/MessageBar/MessageBar.d.ts +5 -0
- package/dist/cjs/MessageBar/MessageBar.js +14 -13
- package/dist/cjs/MessageBar/MessageBar.test.js +41 -28
- package/dist/cjs/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/cjs/MessageBar/MicrophoneButton.js +3 -3
- package/dist/cjs/MessageBar/SendButton.d.ts +1 -0
- package/dist/cjs/MessageBar/SendButton.js +3 -3
- package/dist/cjs/MessageBar/SendButton.test.js +9 -5
- package/dist/cjs/MessageBar/StopButton.d.ts +1 -0
- package/dist/cjs/MessageBar/StopButton.js +3 -3
- package/dist/cjs/MessageBar/StopButton.test.js +9 -5
- package/dist/cjs/MessageBox/JumpButton.js +1 -1
- package/dist/cjs/MessageBox/JumpButton.test.js +4 -4
- package/dist/cjs/MessageBox/MessageBox.d.ts +4 -0
- package/dist/cjs/MessageBox/MessageBox.js +16 -2
- package/dist/cjs/MessageBox/MessageBox.test.js +43 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/cjs/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/cjs/Settings/SettingsForm.d.ts +2 -0
- package/dist/cjs/Settings/SettingsForm.js +2 -2
- package/dist/cjs/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/cjs/Settings/SettingsForm.test.js +12 -0
- package/dist/cjs/SourcesCard/SourcesCard.js +2 -2
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/css/main.css +218 -15
- package/dist/css/main.css.map +1 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +2 -0
- package/dist/esm/AttachmentEdit/AttachmentEdit.js +2 -2
- package/dist/esm/Chatbot/Chatbot.d.ts +2 -0
- package/dist/esm/Chatbot/Chatbot.js +2 -2
- package/dist/esm/Chatbot/Chatbot.test.js +4 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +2 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +3 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +4 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +1 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +1 -1
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeader.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +4 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +20 -6
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +3 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +20 -6
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +5 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +1 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +2 -2
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +5 -0
- package/dist/esm/ChatbotModal/ChatbotModal.d.ts +3 -0
- package/dist/esm/ChatbotModal/ChatbotModal.js +2 -2
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +1 -0
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +23 -0
- package/dist/esm/ChatbotPopover/ChatbotPopover.js +1 -1
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +1 -0
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +3 -3
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +4 -0
- package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
- package/dist/esm/CodeModal/CodeModal.js +3 -3
- package/dist/esm/CodeModal/CodeModal.test.d.ts +1 -0
- package/dist/esm/CodeModal/CodeModal.test.js +10 -0
- package/dist/esm/FileDetails/FileDetails.js +1 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +1 -1
- package/dist/esm/Message/Message.d.ts +2 -0
- package/dist/esm/Message/Message.js +6 -6
- package/dist/esm/Message/Message.test.js +15 -3
- package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +2 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +2 -2
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +2 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +2 -2
- package/dist/esm/Message/UserFeedback/UserFeedback.js +4 -4
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +4 -0
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +4 -4
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +4 -0
- package/dist/esm/MessageBar/AttachButton.d.ts +1 -0
- package/dist/esm/MessageBar/AttachButton.js +3 -3
- package/dist/esm/MessageBar/AttachButton.test.js +11 -7
- package/dist/esm/MessageBar/MessageBar.d.ts +5 -0
- package/dist/esm/MessageBar/MessageBar.js +14 -13
- package/dist/esm/MessageBar/MessageBar.test.js +41 -28
- package/dist/esm/MessageBar/MicrophoneButton.d.ts +1 -0
- package/dist/esm/MessageBar/MicrophoneButton.js +3 -3
- package/dist/esm/MessageBar/SendButton.d.ts +1 -0
- package/dist/esm/MessageBar/SendButton.js +3 -3
- package/dist/esm/MessageBar/SendButton.test.js +9 -5
- package/dist/esm/MessageBar/StopButton.d.ts +1 -0
- package/dist/esm/MessageBar/StopButton.js +3 -3
- package/dist/esm/MessageBar/StopButton.test.js +9 -5
- package/dist/esm/MessageBox/JumpButton.js +1 -1
- package/dist/esm/MessageBox/JumpButton.test.js +4 -4
- package/dist/esm/MessageBox/MessageBox.d.ts +4 -0
- package/dist/esm/MessageBox/MessageBox.js +16 -2
- package/dist/esm/MessageBox/MessageBox.test.js +44 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +2 -0
- package/dist/esm/PreviewAttachment/PreviewAttachment.js +2 -2
- package/dist/esm/Settings/SettingsForm.d.ts +2 -0
- package/dist/esm/Settings/SettingsForm.js +2 -2
- package/dist/esm/Settings/SettingsForm.test.d.ts +1 -1
- package/dist/esm/Settings/SettingsForm.test.js +12 -0
- package/dist/esm/SourcesCard/SourcesCard.js +2 -2
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +2 -0
- package/dist/esm/TermsOfUse/TermsOfUse.js +5 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +33 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +24 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +11 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +21 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +10 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +9 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +11 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +289 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUseCompact.tsx +136 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +14 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +8 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +481 -0
- package/src/AttachmentEdit/AttachmentEdit.tsx +5 -1
- package/src/Chatbot/Chatbot.scss +7 -0
- package/src/Chatbot/Chatbot.test.tsx +9 -0
- package/src/Chatbot/Chatbot.tsx +4 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +38 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +18 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +9 -2
- package/src/ChatbotFooter/ChatbotFooter.scss +5 -0
- package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -0
- package/src/ChatbotFooter/ChatbotFooter.tsx +3 -1
- package/src/ChatbotHeader/ChatbotHeader.scss +25 -0
- package/src/ChatbotHeader/ChatbotHeader.tsx +1 -1
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.test.tsx +6 -0
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +12 -6
- package/src/ChatbotHeader/ChatbotHeaderMain.tsx +3 -1
- package/src/ChatbotHeader/ChatbotHeaderMenu.test.tsx +8 -0
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +10 -5
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.tsx +6 -0
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +5 -2
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +10 -0
- package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +4 -0
- package/src/ChatbotModal/ChatbotModal.scss +15 -4
- package/src/ChatbotModal/ChatbotModal.test.tsx +59 -0
- package/src/ChatbotModal/ChatbotModal.tsx +5 -1
- package/src/ChatbotPopover/ChatbotPopover.scss +9 -5
- package/src/ChatbotPopover/ChatbotPopover.tsx +1 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -1
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +13 -0
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +13 -2
- package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
- package/src/CodeModal/CodeModal.scss +11 -3
- package/src/CodeModal/CodeModal.test.tsx +24 -0
- package/src/CodeModal/CodeModal.tsx +6 -2
- package/src/FileDetails/FileDetails.tsx +1 -1
- package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +1 -1
- package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +1 -1
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +1 -1
- package/src/Message/Message.scss +27 -0
- package/src/Message/Message.test.tsx +24 -3
- package/src/Message/Message.tsx +10 -3
- package/src/Message/QuickResponse/QuickResponse.tsx +5 -1
- package/src/Message/QuickStarts/QuickStartTile.tsx +5 -1
- package/src/Message/TextMessage/TextMessage.scss +25 -0
- package/src/Message/UserFeedback/UserFeedback.scss +24 -3
- package/src/Message/UserFeedback/UserFeedback.test.tsx +13 -0
- package/src/Message/UserFeedback/UserFeedback.tsx +4 -2
- package/src/Message/UserFeedback/UserFeedbackComplete.test.tsx +4 -0
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +10 -2
- package/src/MessageBar/AttachButton.scss +10 -0
- package/src/MessageBar/AttachButton.test.tsx +11 -7
- package/src/MessageBar/AttachButton.tsx +6 -3
- package/src/MessageBar/MessageBar.scss +17 -0
- package/src/MessageBar/MessageBar.test.tsx +41 -28
- package/src/MessageBar/MessageBar.tsx +23 -8
- package/src/MessageBar/MicrophoneButton.scss +10 -0
- package/src/MessageBar/MicrophoneButton.tsx +7 -3
- package/src/MessageBar/SendButton.scss +10 -0
- package/src/MessageBar/SendButton.test.tsx +10 -6
- package/src/MessageBar/SendButton.tsx +6 -3
- package/src/MessageBar/StopButton.scss +10 -0
- package/src/MessageBar/StopButton.test.tsx +10 -6
- package/src/MessageBar/StopButton.tsx +6 -3
- package/src/MessageBox/JumpButton.test.tsx +4 -4
- package/src/MessageBox/JumpButton.tsx +1 -1
- package/src/MessageBox/MessageBox.scss +6 -0
- package/src/MessageBox/MessageBox.test.tsx +45 -1
- package/src/MessageBox/MessageBox.tsx +11 -1
- package/src/PreviewAttachment/PreviewAttachment.tsx +5 -1
- package/src/Settings/Settings.scss +11 -0
- package/src/Settings/SettingsForm.test.tsx +17 -0
- package/src/Settings/SettingsForm.tsx +12 -2
- package/src/SourcesCard/SourcesCard.scss +8 -0
- package/src/SourcesCard/SourcesCard.tsx +2 -1
- package/src/TermsOfUse/TermsOfUse.scss +20 -0
- package/src/TermsOfUse/TermsOfUse.tsx +9 -4
@@ -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
|
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', 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))));
|
@@ -15,11 +15,11 @@ import { AttachButton } from './AttachButton';
|
|
15
15
|
describe('Attach button', () => {
|
16
16
|
it('should render button correctly', () => {
|
17
17
|
render(React.createElement(AttachButton, null));
|
18
|
-
expect(screen.getByRole('button', { name: 'Attach
|
18
|
+
expect(screen.getByRole('button', { name: 'Attach' })).toBeTruthy();
|
19
19
|
});
|
20
20
|
it('should handle isDisabled prop', () => {
|
21
21
|
render(React.createElement(AttachButton, { isDisabled: true }));
|
22
|
-
expect(screen.getByRole('button', { name: 'Attach
|
22
|
+
expect(screen.getByRole('button', { name: 'Attach' })).toBeDisabled();
|
23
23
|
});
|
24
24
|
it('should handle spread props, including aria-label', () => {
|
25
25
|
render(React.createElement(AttachButton, { "aria-label": "test" }));
|
@@ -28,22 +28,22 @@ describe('Attach button', () => {
|
|
28
28
|
it('should handle onClick', () => __awaiter(void 0, void 0, void 0, function* () {
|
29
29
|
const spy = jest.fn();
|
30
30
|
render(React.createElement(AttachButton, { onClick: spy }));
|
31
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Attach
|
31
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
32
32
|
expect(screen.getByRole('tooltip', { name: 'Attach' })).toBeTruthy();
|
33
33
|
expect(spy).toHaveBeenCalledTimes(1);
|
34
34
|
}));
|
35
35
|
it('should handle className prop', () => {
|
36
36
|
render(React.createElement(AttachButton, { className: "test" }));
|
37
|
-
expect(screen.getByRole('button', { name: 'Attach
|
37
|
+
expect(screen.getByRole('button', { name: 'Attach' })).toHaveClass('test');
|
38
38
|
});
|
39
39
|
it('should handle custom tooltip correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
40
40
|
render(React.createElement(AttachButton, { onClick: jest.fn, tooltipContent: "Test" }));
|
41
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Attach
|
41
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
42
42
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
43
43
|
}));
|
44
44
|
it('should handle tooltipProps prop', () => __awaiter(void 0, void 0, void 0, function* () {
|
45
45
|
render(React.createElement(AttachButton, { tooltipProps: { id: 'test' } }));
|
46
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Attach
|
46
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
47
47
|
expect(screen.getByRole('tooltip', { name: 'Attach' })).toHaveAttribute('id', 'test');
|
48
48
|
}));
|
49
49
|
// Based on this because I had no idea how to do this and was looking around: https://stackoverflow.com/a/75562651
|
@@ -51,11 +51,15 @@ describe('Attach button', () => {
|
|
51
51
|
it('should handle onAttachAccepted prop', () => __awaiter(void 0, void 0, void 0, function* () {
|
52
52
|
const spy = jest.fn();
|
53
53
|
render(React.createElement(AttachButton, { onAttachAccepted: spy, inputTestId: "input" }));
|
54
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Attach
|
54
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
55
55
|
const file = new File(['test'], 'test.json');
|
56
56
|
const input = screen.getByTestId('input');
|
57
57
|
yield userEvent.upload(input, file);
|
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) => {
|
@@ -48,9 +48,9 @@ describe('Message bar', () => {
|
|
48
48
|
});
|
49
49
|
it('should render correctly', () => {
|
50
50
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn }));
|
51
|
-
expect(screen.getByRole('button', { name: 'Attach
|
52
|
-
expect(screen.queryByRole('button', { name: 'Send
|
53
|
-
expect(screen.queryByRole('button', { name: '
|
51
|
+
expect(screen.getByRole('button', { name: 'Attach' })).toBeTruthy();
|
52
|
+
expect(screen.queryByRole('button', { name: 'Send' })).toBeFalsy();
|
53
|
+
expect(screen.queryByRole('button', { name: 'Use microphone' })).toBeFalsy();
|
54
54
|
expect(screen.getByRole('textbox', { name: /Send a message.../i })).toBeTruthy();
|
55
55
|
});
|
56
56
|
it('can send via enter key', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -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* () {
|
@@ -78,15 +84,15 @@ describe('Message bar', () => {
|
|
78
84
|
const input = screen.getByRole('textbox', { name: /Send a message.../i });
|
79
85
|
yield userEvent.type(input, 'Hello world');
|
80
86
|
expect(input).toHaveTextContent('Hello world');
|
81
|
-
expect(screen.getByRole('button', { name: 'Send
|
87
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
|
82
88
|
}));
|
83
89
|
it('can disable send button shown when text is input', () => __awaiter(void 0, void 0, void 0, function* () {
|
84
90
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, isSendButtonDisabled: true }));
|
85
91
|
const input = screen.getByRole('textbox', { name: /Send a message.../i });
|
86
92
|
yield userEvent.type(input, 'Hello world');
|
87
93
|
expect(input).toHaveTextContent('Hello world');
|
88
|
-
expect(screen.getByRole('button', { name: 'Send
|
89
|
-
expect(screen.getByRole('button', { name: 'Send
|
94
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
|
95
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeDisabled();
|
90
96
|
}));
|
91
97
|
it('can click send button', () => __awaiter(void 0, void 0, void 0, function* () {
|
92
98
|
const spy = jest.fn();
|
@@ -94,24 +100,24 @@ describe('Message bar', () => {
|
|
94
100
|
const input = screen.getByRole('textbox', { name: /Send a message.../i });
|
95
101
|
yield userEvent.type(input, 'Hello world');
|
96
102
|
expect(input).toHaveTextContent('Hello world');
|
97
|
-
const sendButton = screen.getByRole('button', { name: 'Send
|
103
|
+
const sendButton = screen.getByRole('button', { name: 'Send' });
|
98
104
|
expect(sendButton).toBeTruthy();
|
99
105
|
yield userEvent.click(sendButton);
|
100
106
|
expect(spy).toHaveBeenCalledTimes(1);
|
101
107
|
}));
|
102
108
|
it('can always show send button', () => {
|
103
109
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true }));
|
104
|
-
expect(screen.getByRole('button', { name: 'Send
|
105
|
-
expect(screen.getByRole('button', { name: 'Send
|
110
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
|
111
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeEnabled();
|
106
112
|
});
|
107
113
|
it('can disable send button if always showing', () => {
|
108
114
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, isSendButtonDisabled: true }));
|
109
|
-
expect(screen.getByRole('button', { name: 'Send
|
110
|
-
expect(screen.getByRole('button', { name: 'Send
|
115
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
|
116
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeDisabled();
|
111
117
|
});
|
112
118
|
it('can handle buttonProps tooltipContent appropriately for send', () => __awaiter(void 0, void 0, void 0, function* () {
|
113
119
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { tooltipContent: 'Test' } } }));
|
114
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Send
|
120
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
115
121
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
116
122
|
}));
|
117
123
|
it('can handle buttonProps props appropriately for send', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -152,30 +158,30 @@ describe('Message bar', () => {
|
|
152
158
|
expect(screen.queryByRole('menuitem', { name: /Logs/i })).toBeFalsy();
|
153
159
|
expect(screen.queryByRole('menuitem', { name: /YAML - Status/i })).toBeFalsy();
|
154
160
|
expect(screen.queryByRole('menuitem', { name: /YAML - All contents/i })).toBeFalsy();
|
155
|
-
const attachButton = screen.getByRole('button', { name: 'Attach
|
161
|
+
const attachButton = screen.getByRole('button', { name: 'Attach' });
|
156
162
|
yield userEvent.click(attachButton);
|
157
163
|
expect(attachToggleClickSpy).toHaveBeenCalledTimes(1);
|
158
164
|
}));
|
159
165
|
it('can hide attach button', () => {
|
160
166
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasAttachButton: false }));
|
161
|
-
expect(screen.queryByRole('button', { name: 'Attach
|
167
|
+
expect(screen.queryByRole('button', { name: 'Attach' })).toBeFalsy();
|
162
168
|
});
|
163
169
|
// Based on this because I had no idea how to do this and was looking around: https://stackoverflow.com/a/75562651
|
164
170
|
// See also https://developer.mozilla.org/en-US/docs/Web/API/File/File for what that file variable is doing
|
165
171
|
it('can handle handleAttach', () => __awaiter(void 0, void 0, void 0, function* () {
|
166
172
|
const spy = jest.fn();
|
167
173
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, handleAttach: spy, buttonProps: { attach: { inputTestId: 'input' } } }));
|
168
|
-
expect(screen.getByRole('button', { name: 'Attach
|
169
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Attach
|
174
|
+
expect(screen.getByRole('button', { name: 'Attach' })).toBeTruthy();
|
175
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
170
176
|
const file = new File(['test'], 'test.json');
|
171
177
|
const input = screen.getByTestId('input');
|
172
178
|
yield userEvent.upload(input, file);
|
173
179
|
expect(input.files).toHaveLength(1);
|
174
180
|
expect(spy).toHaveBeenCalledTimes(1);
|
175
181
|
}));
|
176
|
-
it('can handle buttonProps tooltipContent
|
182
|
+
it('can handle buttonProps tooltipContent appropriately for attach', () => __awaiter(void 0, void 0, void 0, function* () {
|
177
183
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, buttonProps: { attach: { tooltipContent: 'Test' } } }));
|
178
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Attach
|
184
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
179
185
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
180
186
|
}));
|
181
187
|
it('can handle buttonProps props appropriately for attach', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -186,17 +192,17 @@ describe('Message bar', () => {
|
|
186
192
|
// --------------------------------------------------------------------------
|
187
193
|
it('can show stop button', () => {
|
188
194
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn }));
|
189
|
-
expect(screen.getByRole('button', { name: 'Stop
|
195
|
+
expect(screen.getByRole('button', { name: 'Stop' })).toBeTruthy();
|
190
196
|
});
|
191
197
|
it('can call handleStopButton', () => __awaiter(void 0, void 0, void 0, function* () {
|
192
198
|
const spy = jest.fn();
|
193
199
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: spy }));
|
194
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Stop
|
200
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
195
201
|
expect(spy).toHaveBeenCalledTimes(1);
|
196
202
|
}));
|
197
203
|
it('can handle buttonProps tooltipContent appropriately for stop', () => __awaiter(void 0, void 0, void 0, function* () {
|
198
204
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { tooltipContent: 'Test' } } }));
|
199
|
-
yield userEvent.click(screen.getByRole('button', { name: 'Stop
|
205
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
200
206
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
201
207
|
}));
|
202
208
|
it('can handle buttonProps props appropriately for stop', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -207,23 +213,30 @@ describe('Message bar', () => {
|
|
207
213
|
// --------------------------------------------------------------------------
|
208
214
|
it('can hide microphone button when window.SpeechRecognition is not there', () => {
|
209
215
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true }));
|
210
|
-
expect(screen.queryByRole('button', { name: '
|
216
|
+
expect(screen.queryByRole('button', { name: 'Use microphone' })).toBeFalsy();
|
211
217
|
});
|
212
218
|
it('can show microphone button', () => {
|
213
219
|
mockSpeechRecognition();
|
214
220
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true }));
|
215
|
-
expect(screen.getByRole('button', { name: '
|
221
|
+
expect(screen.getByRole('button', { name: 'Use microphone' })).toBeTruthy();
|
216
222
|
});
|
217
223
|
it('can handle buttonProps appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
|
218
224
|
mockSpeechRecognition();
|
219
225
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: {
|
220
226
|
microphone: { tooltipContent: { active: 'Currently listening', inactive: 'Not currently listening' } }
|
221
227
|
} }));
|
222
|
-
yield userEvent.click(screen.getByRole('button', { name: '
|
228
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Use microphone' }));
|
223
229
|
expect(screen.getByRole('tooltip', { name: 'Currently listening' })).toBeTruthy();
|
224
|
-
yield userEvent.click(screen.getByRole('button', { name: '
|
230
|
+
yield userEvent.click(screen.getByRole('button', { name: 'Stop listening' }));
|
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: 'Use microphone' }));
|
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' } } } }));
|
@@ -231,9 +244,9 @@ describe('Message bar', () => {
|
|
231
244
|
}));
|
232
245
|
it('can be controlled', () => {
|
233
246
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, value: "test" }));
|
234
|
-
expect(screen.getByRole('button', { name: 'Attach
|
235
|
-
expect(screen.getByRole('button', { name: 'Send
|
236
|
-
expect(screen.queryByRole('button', { name: '
|
247
|
+
expect(screen.getByRole('button', { name: 'Attach' })).toBeTruthy();
|
248
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
|
249
|
+
expect(screen.queryByRole('button', { name: 'Use microphone' })).toBeFalsy();
|
237
250
|
expect(screen.getByRole('textbox', { name: /Send a message.../i })).toBeTruthy();
|
238
251
|
expect(screen.getByRole('textbox', { name: /Send a message.../i })).toHaveValue('test');
|
239
252
|
});
|
@@ -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'] || '
|
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'] || (isListening ? 'Stop listening' : 'Use microphone'), "aria-pressed": isListening, 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
|
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', 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;
|