@patternfly/chatbot 6.3.0-prerelease.1 → 6.3.0-prerelease.3
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/Chatbot/Chatbot.d.ts +2 -0
- package/dist/cjs/Chatbot/Chatbot.js +2 -2
- 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/MessageBar/MessageBar.d.ts +4 -0
- package/dist/cjs/MessageBar/MessageBar.js +2 -2
- package/dist/cjs/MessageBar/MessageBar.test.js +13 -0
- 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/css/main.css +18 -0
- package/dist/css/main.css.map +1 -1
- package/dist/esm/Chatbot/Chatbot.d.ts +2 -0
- package/dist/esm/Chatbot/Chatbot.js +2 -2
- 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/MessageBar/MessageBar.d.ts +4 -0
- package/dist/esm/MessageBar/MessageBar.js +2 -2
- package/dist/esm/MessageBar/MessageBar.test.js +13 -0
- 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/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactSettings.tsx +289 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +7 -0
- package/src/Chatbot/Chatbot.scss +7 -0
- package/src/Chatbot/Chatbot.tsx +4 -1
- package/src/ChatbotHeader/ChatbotHeader.scss +8 -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/MessageBar/MessageBar.test.tsx +13 -0
- package/src/MessageBar/MessageBar.tsx +8 -2
- package/src/Settings/Settings.scss +11 -0
- package/src/Settings/SettingsForm.test.tsx +17 -0
- package/src/Settings/SettingsForm.tsx +12 -2
@@ -12,6 +12,8 @@ export interface ChatbotProps {
|
|
12
12
|
innerRef?: React.Ref<HTMLDivElement>;
|
13
13
|
/** Custom aria label applied to focusable container */
|
14
14
|
ariaLabel?: string;
|
15
|
+
/** Density of information within the ChatBot */
|
16
|
+
isCompact?: boolean;
|
15
17
|
}
|
16
18
|
export declare enum ChatbotDisplayMode {
|
17
19
|
default = "default",
|
@@ -29,13 +29,13 @@ var ChatbotDisplayMode;
|
|
29
29
|
ChatbotDisplayMode["drawer"] = "drawer";
|
30
30
|
})(ChatbotDisplayMode || (exports.ChatbotDisplayMode = ChatbotDisplayMode = {}));
|
31
31
|
const ChatbotBase = (_a) => {
|
32
|
-
var { children, displayMode = ChatbotDisplayMode.default, isVisible = true, className, innerRef, ariaLabel } = _a, props = __rest(_a, ["children", "displayMode", "isVisible", "className", "innerRef", "ariaLabel"]);
|
32
|
+
var { children, displayMode = ChatbotDisplayMode.default, isVisible = true, className, innerRef, ariaLabel, isCompact } = _a, props = __rest(_a, ["children", "displayMode", "isVisible", "className", "innerRef", "ariaLabel", "isCompact"]);
|
33
33
|
// Configure animations
|
34
34
|
const motionChatbot = {
|
35
35
|
visible: { opacity: 1, y: 0 },
|
36
36
|
hidden: { opacity: 0, y: '16px' }
|
37
37
|
};
|
38
|
-
return (react_1.default.createElement(framer_motion_1.motion.div, Object.assign({ className: `pf-chatbot pf-chatbot--${displayMode} ${!isVisible ? 'pf-chatbot--hidden' : ''} ${className !== null && className !== void 0 ? className : ''}`, variants: motionChatbot, initial: "hidden", animate: isVisible ? 'visible' : 'hidden' }, props), isVisible ? (react_1.default.createElement("section", { "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : 'Chatbot', className: `pf-chatbot-container pf-chatbot-container--${displayMode} ${!isVisible ? 'pf-chatbot-container--hidden' : ''}`, tabIndex: -1, ref: innerRef }, children)) : undefined));
|
38
|
+
return (react_1.default.createElement(framer_motion_1.motion.div, Object.assign({ className: `pf-chatbot pf-chatbot--${displayMode} ${!isVisible ? 'pf-chatbot--hidden' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, variants: motionChatbot, initial: "hidden", animate: isVisible ? 'visible' : 'hidden' }, props), isVisible ? (react_1.default.createElement("section", { "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : 'Chatbot', className: `pf-chatbot-container pf-chatbot-container--${displayMode} ${!isVisible ? 'pf-chatbot-container--hidden' : ''}`, tabIndex: -1, ref: innerRef }, children)) : undefined));
|
39
39
|
};
|
40
40
|
const Chatbot = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(ChatbotBase, Object.assign({ innerRef: ref }, props))));
|
41
41
|
exports.default = Chatbot;
|
@@ -7,7 +7,7 @@ exports.ChatbotHeader = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
8
|
const react_core_1 = require("@patternfly/react-core");
|
9
9
|
const ChatbotHeader = ({ className, children }) => (react_1.default.createElement("div", { className: "pf-chatbot__header-container" },
|
10
|
-
react_1.default.createElement("div", { className: `pf-chatbot__header
|
10
|
+
react_1.default.createElement("div", { className: `pf-chatbot__header${className ? ` ${className}` : ''}` }, children),
|
11
11
|
react_1.default.createElement(react_core_1.Divider, { className: "pf-chatbot__header__divider" })));
|
12
12
|
exports.ChatbotHeader = ChatbotHeader;
|
13
13
|
exports.default = exports.ChatbotHeader;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { TooltipProps } from '@patternfly/react-core';
|
3
|
-
export interface ChatbotHeaderCloseButtonProps {
|
2
|
+
import { ButtonProps, TooltipProps } from '@patternfly/react-core';
|
3
|
+
export interface ChatbotHeaderCloseButtonProps extends ButtonProps {
|
4
4
|
/** Callback function for when button is clicked */
|
5
5
|
onClick: () => void;
|
6
6
|
/** Custom classname for the header component */
|
@@ -13,5 +13,7 @@ export interface ChatbotHeaderCloseButtonProps {
|
|
13
13
|
innerRef?: React.Ref<HTMLButtonElement>;
|
14
14
|
/** Content used in tooltip */
|
15
15
|
tooltipContent?: string;
|
16
|
+
/** Sets button to compact styling. */
|
17
|
+
isCompact?: boolean;
|
16
18
|
}
|
17
19
|
export declare const ChatbotHeaderCloseButton: React.ForwardRefExoticComponent<ChatbotHeaderCloseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
@@ -1,4 +1,15 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
3
|
+
var t = {};
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
+
t[p] = s[p];
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
+
t[p[i]] = s[p[i]];
|
10
|
+
}
|
11
|
+
return t;
|
12
|
+
};
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
15
|
};
|
@@ -7,10 +18,13 @@ exports.ChatbotHeaderCloseButton = void 0;
|
|
7
18
|
const react_1 = __importDefault(require("react"));
|
8
19
|
const react_core_1 = require("@patternfly/react-core");
|
9
20
|
const react_icons_1 = require("@patternfly/react-icons");
|
10
|
-
const ChatbotHeaderCloseButtonBase = (
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
21
|
+
const ChatbotHeaderCloseButtonBase = (_a) => {
|
22
|
+
var { className, onClick, tooltipProps, menuAriaLabel = 'Close', innerRef, tooltipContent = 'Close', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "menuAriaLabel", "innerRef", "tooltipContent", "isCompact"]);
|
23
|
+
return (react_1.default.createElement("div", { className: `pf-chatbot__menu${className ? ` ${className}` : ''}` },
|
24
|
+
react_1.default.createElement(react_core_1.Tooltip, Object.assign({ content: tooltipContent, position: "bottom",
|
25
|
+
// prevents VO announcements of both aria label and tooltip
|
26
|
+
aria: "none" }, tooltipProps),
|
27
|
+
react_1.default.createElement(react_core_1.Button, Object.assign({ className: `pf-chatbot__button--toggle-menu ${isCompact ? 'pf-m-compact' : ''}`, variant: "plain", onClick: onClick, "aria-label": menuAriaLabel, ref: innerRef, icon: react_1.default.createElement(react_core_1.Icon, { size: isCompact ? 'lg' : 'xl', isInline: true },
|
28
|
+
react_1.default.createElement(react_icons_1.CloseIcon, null)), size: isCompact ? 'sm' : undefined }, props)))));
|
29
|
+
};
|
16
30
|
exports.ChatbotHeaderCloseButton = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(ChatbotHeaderCloseButtonBase, Object.assign({ innerRef: ref }, props))));
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
7
7
|
const react_2 = require("@testing-library/react");
|
8
8
|
const ChatbotHeaderCloseButton_1 = require("./ChatbotHeaderCloseButton");
|
9
|
+
require("@testing-library/jest-dom");
|
9
10
|
describe('ChatbotHeaderCloseButton', () => {
|
10
11
|
it('should render ChatbotHeaderCloseButton', () => {
|
11
12
|
const { container } = (0, react_2.render)(react_1.default.createElement(ChatbotHeaderCloseButton_1.ChatbotHeaderCloseButton, { className: "custom-header-close-button", onClick: jest.fn() }));
|
@@ -17,4 +18,8 @@ describe('ChatbotHeaderCloseButton', () => {
|
|
17
18
|
react_2.fireEvent.click(react_2.screen.getByRole('button', { name: 'Close' }));
|
18
19
|
expect(onClick).toHaveBeenCalled();
|
19
20
|
});
|
21
|
+
it('should render button with isCompact', () => {
|
22
|
+
(0, react_2.render)(react_1.default.createElement(ChatbotHeaderCloseButton_1.ChatbotHeaderCloseButton, { "data-testid": "close-button", onClick: jest.fn(), isCompact: true }));
|
23
|
+
expect(react_2.screen.getByTestId('close-button')).toHaveClass('pf-m-compact');
|
24
|
+
});
|
20
25
|
});
|
@@ -5,6 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.ChatbotHeaderMain = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
|
-
const ChatbotHeaderMain = ({ className, children }) => react_1.default.createElement("div", { className: `pf-chatbot__header-main ${className}` }, children);
|
8
|
+
const ChatbotHeaderMain = ({ className, children }) => (react_1.default.createElement("div", { className: `pf-chatbot__header-main${className ? ` ${className}` : ''}` }, children));
|
9
9
|
exports.ChatbotHeaderMain = ChatbotHeaderMain;
|
10
10
|
exports.default = exports.ChatbotHeaderMain;
|
@@ -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 */
|
@@ -24,7 +24,7 @@ const AttachButton_1 = require("./AttachButton");
|
|
24
24
|
const AttachMenu_1 = __importDefault(require("../AttachMenu"));
|
25
25
|
const StopButton_1 = __importDefault(require("./StopButton"));
|
26
26
|
const MessageBar = (_a) => {
|
27
|
-
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"]);
|
27
|
+
var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value"]);
|
28
28
|
// Text Input
|
29
29
|
// --------------------------------------------------------------------------
|
30
30
|
const [message, setMessage] = react_1.default.useState(value !== null && value !== void 0 ? value : '');
|
@@ -186,7 +186,7 @@ const MessageBar = (_a) => {
|
|
186
186
|
};
|
187
187
|
const messageBarContents = (react_1.default.createElement(react_1.default.Fragment, null,
|
188
188
|
react_1.default.createElement("div", { className: "pf-chatbot__message-bar-input" },
|
189
|
-
react_1.default.createElement(react_core_1.TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ?
|
189
|
+
react_1.default.createElement(react_core_1.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))),
|
190
190
|
react_1.default.createElement("div", { className: "pf-chatbot__message-bar-actions" }, renderButtons())));
|
191
191
|
if (attachMenuProps) {
|
192
192
|
return (react_1.default.createElement(AttachMenu_1.default, Object.assign({ toggle: (toggleRef) => (react_1.default.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) => {
|
@@ -76,6 +76,12 @@ describe('Message bar', () => {
|
|
76
76
|
expect(spy).toHaveBeenCalledTimes(1);
|
77
77
|
expect(spy).toHaveBeenCalledWith(expect.any(Object), 'A');
|
78
78
|
}));
|
79
|
+
it('can use specified placeholder text', () => __awaiter(void 0, void 0, void 0, function* () {
|
80
|
+
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, placeholder: "test placeholder" }));
|
81
|
+
const input = react_2.screen.getByRole('textbox', { name: /test placeholder/i });
|
82
|
+
yield user_event_1.default.type(input, 'Hello world');
|
83
|
+
expect(input).toHaveTextContent('Hello world');
|
84
|
+
}));
|
79
85
|
// Send button
|
80
86
|
// --------------------------------------------------------------------------
|
81
87
|
it('shows send button when text is input', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -229,6 +235,13 @@ describe('Message bar', () => {
|
|
229
235
|
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Microphone button' }));
|
230
236
|
expect(react_2.screen.getByRole('tooltip', { name: 'Not currently listening' })).toBeTruthy();
|
231
237
|
}));
|
238
|
+
it('can customize the listening placeholder', () => __awaiter(void 0, void 0, void 0, function* () {
|
239
|
+
mockSpeechRecognition();
|
240
|
+
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, listeningText: "I am listening" }));
|
241
|
+
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Microphone button' }));
|
242
|
+
const input = react_2.screen.getByRole('textbox', { name: /I am listening/i });
|
243
|
+
expect(input).toBeTruthy();
|
244
|
+
}));
|
232
245
|
it('can handle buttonProps props appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
|
233
246
|
mockSpeechRecognition();
|
234
247
|
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { props: { 'aria-label': 'Test' } } } }));
|
@@ -8,6 +8,8 @@ export interface SettingsFormProps {
|
|
8
8
|
label: string;
|
9
9
|
field: React.ReactElement;
|
10
10
|
}[];
|
11
|
+
/** Sets form to compact styling. */
|
12
|
+
isCompact?: boolean;
|
11
13
|
}
|
12
14
|
export declare const SettingsForm: React.FunctionComponent<SettingsFormProps>;
|
13
15
|
export default SettingsForm;
|
@@ -17,8 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.SettingsForm = void 0;
|
18
18
|
const react_1 = __importDefault(require("react"));
|
19
19
|
const SettingsForm = (_a) => {
|
20
|
-
var { className, fields = [] } = _a, props = __rest(_a, ["className", "fields"]);
|
21
|
-
return (react_1.default.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${className}` }, props),
|
20
|
+
var { className, fields = [], isCompact } = _a, props = __rest(_a, ["className", "fields", "isCompact"]);
|
21
|
+
return (react_1.default.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}` }, props),
|
22
22
|
react_1.default.createElement("form", { className: "pf-chatbot__settings-form" }, fields.map((field) => (react_1.default.createElement("div", { className: "pf-chatbot__settings-form-row", key: field.label },
|
23
23
|
react_1.default.createElement("label", { className: "pf-chatbot__settings-label", htmlFor: field.id }, field.label),
|
24
24
|
field.field))))));
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -7,6 +7,7 @@ const react_1 = __importDefault(require("react"));
|
|
7
7
|
const react_core_1 = require("@patternfly/react-core");
|
8
8
|
const react_2 = require("@testing-library/react");
|
9
9
|
const SettingsForm_1 = require("./SettingsForm");
|
10
|
+
require("@testing-library/jest-dom");
|
10
11
|
describe('SettingsForm', () => {
|
11
12
|
it('should render settingsForm with custom classname', () => {
|
12
13
|
const { container } = (0, react_2.render)(react_1.default.createElement(SettingsForm_1.SettingsForm, { className: "custom-settings" }));
|
@@ -23,4 +24,15 @@ describe('SettingsForm', () => {
|
|
23
24
|
(0, react_2.render)(react_1.default.createElement(SettingsForm_1.SettingsForm, { fields: fields }));
|
24
25
|
expect(react_2.screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
|
25
26
|
});
|
27
|
+
it('should render settingsForm with isCompact', () => {
|
28
|
+
const fields = [
|
29
|
+
{
|
30
|
+
id: 'archived-chat',
|
31
|
+
label: 'Archive chat',
|
32
|
+
field: (react_1.default.createElement(react_core_1.Button, { id: "archived-chat", variant: "secondary" }, "Archive chat"))
|
33
|
+
}
|
34
|
+
];
|
35
|
+
(0, react_2.render)(react_1.default.createElement(SettingsForm_1.SettingsForm, { "data-testid": "settings-form", fields: fields, isCompact: true }));
|
36
|
+
expect(react_2.screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
|
37
|
+
});
|
26
38
|
});
|
package/dist/css/main.css
CHANGED
@@ -159,6 +159,10 @@
|
|
159
159
|
border-radius: var(--pf-t--global--border--radius--sharp);
|
160
160
|
}
|
161
161
|
|
162
|
+
.pf-chatbot.pf-m-compact {
|
163
|
+
font-size: var(--pf-t--global--font--size--sm);
|
164
|
+
}
|
165
|
+
|
162
166
|
.pf-chatbot__alert {
|
163
167
|
position: sticky;
|
164
168
|
top: var(--pf-t--global--spacer--lg);
|
@@ -507,6 +511,11 @@
|
|
507
511
|
display: inline-flex;
|
508
512
|
}
|
509
513
|
|
514
|
+
.pf-chatbot__button--toggle-menu.pf-m-compact {
|
515
|
+
width: 2rem;
|
516
|
+
height: 2rem;
|
517
|
+
}
|
518
|
+
|
510
519
|
.pf-chatbot__chatbot-modal-backdrop {
|
511
520
|
position: static !important;
|
512
521
|
}
|
@@ -1882,6 +1891,15 @@
|
|
1882
1891
|
text-align: center;
|
1883
1892
|
}
|
1884
1893
|
|
1894
|
+
.pf-chatbot__settings-form-container.pf-m-compact .pf-chatbot__settings-form-row {
|
1895
|
+
padding: var(--pf-t--global--spacer--md);
|
1896
|
+
font-size: var(--pf-t--global--font--size--body--md);
|
1897
|
+
}
|
1898
|
+
|
1899
|
+
.pf-chatbot__header.pf-m-compact {
|
1900
|
+
padding-inline-start: var(--pf-t--global--spacer--md);
|
1901
|
+
}
|
1902
|
+
|
1885
1903
|
.pf-chatbot__source {
|
1886
1904
|
display: flex;
|
1887
1905
|
flex-direction: column;
|
package/dist/css/main.css.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../src/AttachMenu/AttachMenu.scss","../../src/Chatbot/Chatbot.scss","../../src/ChatbotAlert/ChatbotAlert.scss","../../src/ChatbotContent/ChatbotContent.scss","../../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss","../../src/ChatbotFooter/ChatbotFootnote.scss","../../src/ChatbotFooter/ChatbotFooter.scss","../../src/ChatbotHeader/ChatbotHeader.scss","../../src/ChatbotModal/ChatbotModal.scss","../../src/ChatbotPopover/ChatbotPopover.scss","../../src/ChatbotToggle/ChatbotToggle.scss","../../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss","../../src/CodeModal/CodeModal.scss","../../src/Compare/Compare.scss","../../src/FileDetails/FileDetails.scss","../../src/FileDetailsLabel/FileDetailsLabel.scss","../../src/FileDropZone/FileDropZone.scss","../../src/Message/Message.scss","../../src/Message/MessageLoading.scss","../../src/Message/CodeBlockMessage/CodeBlockMessage.scss","../../src/Message/TextMessage/TextMessage.scss","../../src/Message/ImageMessage/ImageMessage.scss","../../src/Message/ListMessage/ListMessage.scss","../../src/Message/TableMessage/TableMessage.scss","../../src/Message/QuickStarts/QuickStartTile.scss","../../src/Message/QuickResponse/QuickResponse.scss","../../src/Message/UserFeedback/UserFeedback.scss","../../src/MessageBar/AttachButton.scss","../../src/MessageBar/MicrophoneButton.scss","../../src/MessageBar/SendButton.scss","../../src/MessageBar/StopButton.scss","../../src/MessageBar/MessageBar.scss","../../src/MessageBox/JumpButton.scss","../../src/MessageBox/MessageBox.scss","../../src/ResponseActions/ResponseActions.scss","../../src/Settings/Settings.scss","../../src/SourcesCard/SourcesCard.scss","../../src/SourceDetailsMenuItem/SourceDetailsMenuItem.scss","../../src/TermsOfUse/TermsOfUse.scss","../../src/main.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;AACE;AAsBA;AASA;;AA9BA;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAGF;AACE;;AACA;EACE;EACA;EACA;EACA;EACA;;AAKJ;EACE;;AAGF;EACE;;AAIF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;;ACxDJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAKF;EAvBF;IAwBI;IACA;;;AAIF;EA7BF;IA8BI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIA;EAXF;IAYI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAMF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAIF;EAdF;IAeI;;;;AAIJ;EACE;;;AAGF;AAAA;AAAA;EAGE;;;AAMF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AC5HJ;EACE;EACA;EACA;;;ACAF;EACE;EACA;EACA;EACA;EACA;;AAGA;EARF;IASI;;;;AAOJ;EAII;AAAA;AAAA;IACE;IACA;;;ACrBJ;EACE;EACA;;AAIF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAMJ;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;;AAIF;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAIF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAKA;EACE;EACA;EACA;EACA;EACA;EACA;;AAKJ;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAKA;EACE;;;AASJ;EACE;;;AASF;AAAA;EACE;;AACA;AAAA;EACE;;;AASJ;EACE;;AACA;EACE;EACA;;AAEF;EACE;;;AAUF;AAAA;AAAA;AAAA;EACE;;;AAKN;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;ACzMF;EACE;;AAEA;EACE;EACA;;;ACHJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAMF;EAGI;AAAA;IACE;;EACA;AAAA;IACE;;EAGJ;AAAA;IACE;IACA;IACA;;;AASJ;EACE;;;AAQF;EACE;;;ACrDJ;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;;AAKJ;EACE;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;;AAQN;EAGI;AAAA;IACE;;EAEF;AAAA;IACE;;;AAUJ;AAAA;EACE;;;AAOJ;AAAA;EAEE;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAGF;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAOJ;EACE;;;AAOJ;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;ACzIF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;AAAA;EAEE;;AAEF;EACE;EACA;;AAEF;EACE;;;AAOJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAGJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAOJ;EACE;;;AAMF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAQE;EACE;;;AAQN;EACE;;;ACvFA;EAA0B;;AAMxB;EAAM;;AACN;EAAuB;;AACvB;EACE;;AAIF;EACE;EACA;;AAEF;EACE;;;ACnBN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;;AAIF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;;AC3BF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;;AAOJ;EAIM;AAAA;IACE;IACA;;;AC5CN;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;AACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;AAAA;AAAA;EAGA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;;AASA;EACE;EACA;;;AAKN;EACE;;;AAGF;EACE;;;ACrFF;EACE;EACA;EACA;EACA;;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;;AAEA;EALF;IAMI;;;AAGF;EACE;;AAEA;EAHF;IAII;;;;AAKN;EACE;;AAEA;EACE;;AAGF;EACE;;AAIA;EADF;IAEI;;;;AAIN;EACE;;AAEA;EAHF;IAII;;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EARF;IASI;IACA;IACA;;;;ACrEJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAIF;EACE;EACA;EACA;EACA;EACA;;;ACvBF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EAEA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;;;AAKF;EACE;;AAGF;EACE;;;AAIJ;AAAA;EAEE;EACA;;AAEA;AAAA;EACE;;;AAKF;EACE;;;AAMF;AAAA;EACE;;;AC/DJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAGA;EANF;IAOI;;;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIJ;AACA;EACE;EACA;EACA;EACA;;;AAME;EADF;IAEI;IACA;IACA;;EAEA;IACE;;;;AChDR;EACE;EACA;EACA;EACA;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAKF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAKF;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAKJ;EACE;;AAEF;EACE;;AAMJ;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;;AAMJ;EACE;EACA;EACA;;;AAGF;EACE;;;ACjGF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAEE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IAEE;;;;AC9CN;EACE;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAIF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EAEE;;AAMN;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;;;AC1EE;EACE;;;AAMN;EACE;;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;AAGF;EACE;EACA;;;AAKF;EACE;EACA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;ADrDN;EACE;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAIF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EAEE;;AAMN;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;;;AEhFF;EACE;EACA;EACA;EACA;EAGA;;;ADDE;EACE;;;AAMN;EACE;;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;AAGF;EACE;EACA;;;AAKF;EACE;EACA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;AEpDN;AAAA;EAEE;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAKF;AAAA;EAEE;EACA;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;;;ALjBJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAEE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IAEE;;;;AMjDN;EACE;EACA;;AAEA;EAJF;IAKI;IACA;;;AAKA;EACE;;;AAOF;EACE;;;ACnBJ;EACE;;AAEA;EAHF;IAII;;;AAGF;EAPF;IAQI;;;AAKF;EACE;EACA;;AAIJ;AAAA;EAEE;EACA;;AAIF;EACE;EACA;EACA;;;AC7BJ;EACE;EACA;EACA;;;AAIF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAIF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AChDF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAKA;EACE;;AAIJ;EAEE;;AAEA;EACE;;AAKA;EACE;;;AC5BR;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAMA;EACE;;AAKJ;EACE;EACA;;AAGA;EACE;;AAKA;EACE;;;AAMR;EACE;IACE;;EAEF;IACE;;;AC1CJ;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EAEE;EACA;;AAEA;EACE;;;AAMJ;EACE;;AACA;EACE;;AAIJ;EACE;EACA;;AAGF;AAAA;EAEE;;;AAIJ;EACE;IACE;IACA;;EAEF;IACE;IACA;;;AC/CJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;;AAEA;EACE;;AAKA;EACE;;;ACrBR;EACE;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;IACE;IACA;;;AAKF;EACE;IACE;IACA;;;;ACxGN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAIF;;AAEA;EACE;;AAGF;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EA3CF;IA4CI;;;;AC9CJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAIA;EAVF;IAWI;;;AAGF;EAdF;IAeI;;;;AAIJ;EACE;;;AAKF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EAII;AAAA;AAAA;IACE;IACA;;;ADvCN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAIF;;AAEA;EACE;;AAGF;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EA3CF;IA4CI;;;;AEhDJ;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;;AAKN;EACE;EACA;;;AC1BF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AChCF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAIJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIA;AAAA;EACE;;AAGJ;EACE;EACA;;AAKA;AAAA;EACE;;AAGJ;EACE;;;ACvER;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAIF;EACE;EACA;;;AAGA;EACE;;;AAIJ;EACE;;;AAGF;EACE;;;AC9BA;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAIF;EACE;IACE;IACA;;;;AAKN;AAAA;EAGE;;AAGE;AAAA;EACE;;AAIJ;AAAA;EACE;;;AC5BJ;EAKE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EASA;EACA;EAEA;EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAMA;EAKA;EACA;EACA;EAEA;EAEA;;;AAMF;EACE;EACA;EAEA;EAEA;EACA;;;AAGF;EACE;EACA","file":"main.css"}
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../src/AttachMenu/AttachMenu.scss","../../src/Chatbot/Chatbot.scss","../../src/ChatbotAlert/ChatbotAlert.scss","../../src/ChatbotContent/ChatbotContent.scss","../../src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss","../../src/ChatbotFooter/ChatbotFootnote.scss","../../src/ChatbotFooter/ChatbotFooter.scss","../../src/ChatbotHeader/ChatbotHeader.scss","../../src/ChatbotModal/ChatbotModal.scss","../../src/ChatbotPopover/ChatbotPopover.scss","../../src/ChatbotToggle/ChatbotToggle.scss","../../src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss","../../src/CodeModal/CodeModal.scss","../../src/Compare/Compare.scss","../../src/FileDetails/FileDetails.scss","../../src/FileDetailsLabel/FileDetailsLabel.scss","../../src/FileDropZone/FileDropZone.scss","../../src/Message/Message.scss","../../src/Message/MessageLoading.scss","../../src/Message/CodeBlockMessage/CodeBlockMessage.scss","../../src/Message/TextMessage/TextMessage.scss","../../src/Message/ImageMessage/ImageMessage.scss","../../src/Message/ListMessage/ListMessage.scss","../../src/Message/TableMessage/TableMessage.scss","../../src/Message/QuickStarts/QuickStartTile.scss","../../src/Message/QuickResponse/QuickResponse.scss","../../src/Message/UserFeedback/UserFeedback.scss","../../src/MessageBar/AttachButton.scss","../../src/MessageBar/MicrophoneButton.scss","../../src/MessageBar/SendButton.scss","../../src/MessageBar/StopButton.scss","../../src/MessageBar/MessageBar.scss","../../src/MessageBox/JumpButton.scss","../../src/MessageBox/MessageBox.scss","../../src/ResponseActions/ResponseActions.scss","../../src/Settings/Settings.scss","../../src/SourcesCard/SourcesCard.scss","../../src/SourceDetailsMenuItem/SourceDetailsMenuItem.scss","../../src/TermsOfUse/TermsOfUse.scss","../../src/main.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;AACE;AAsBA;AASA;;AA9BA;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAGF;AACE;;AACA;EACE;EACA;EACA;EACA;EACA;;AAKJ;EACE;;AAGF;EACE;;AAIF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;;ACxDJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAKF;EAvBF;IAwBI;IACA;;;AAIF;EA7BF;IA8BI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIA;EAXF;IAYI;;;;AAOJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAMF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;;AAIF;EAdF;IAeI;;;;AAIJ;EACE;;;AAGF;AAAA;AAAA;EAGE;;;AAMF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAOJ;EACE;;;ACpIF;EACE;EACA;EACA;;;ACAF;EACE;EACA;EACA;EACA;EACA;;AAGA;EARF;IASI;;;;AAOJ;EAII;AAAA;AAAA;IACE;IACA;;;ACrBJ;EACE;EACA;;AAIF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAMJ;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;;AAIF;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAIF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAKA;EACE;EACA;EACA;EACA;EACA;EACA;;AAKJ;EACE;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;;AAKA;EACE;;;AASJ;EACE;;;AASF;AAAA;EACE;;AACA;AAAA;EACE;;;AASJ;EACE;;AACA;EACE;EACA;;AAEF;EACE;;;AAUF;AAAA;AAAA;AAAA;EACE;;;AAKN;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;ACzMF;EACE;;AAEA;EACE;EACA;;;ACHJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAMF;EAGI;AAAA;IACE;;EACA;AAAA;IACE;;EAGJ;AAAA;IACE;IACA;IACA;;;AASJ;EACE;;;AAQF;EACE;;;ACrDJ;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;;AAKJ;EACE;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;;AAQN;EAGI;AAAA;IACE;;EAEF;AAAA;IACE;;;AAUJ;AAAA;EACE;;;AAOJ;AAAA;EAEE;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;AAGF;AAAA;AAAA;AAAA;EAEE;EACA;EACA;;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAOJ;EACE;;;AAOJ;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;AAMF;EACE;EACA;;;ACjJF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;AAAA;EAEE;;AAEF;EACE;EACA;;AAEF;EACE;;;AAOJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAGJ;EACE;AAAA;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;;AAOJ;EACE;;;AAMF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAQE;EACE;;;AAQN;EACE;;;ACvFA;EAA0B;;AAMxB;EAAM;;AACN;EAAuB;;AACvB;EACE;;AAIF;EACE;EACA;;AAEF;EACE;;;ACnBN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;;AAIF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;;AC3BF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;;;AAOJ;EAIM;AAAA;IACE;IACA;;;AC5CN;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;AACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;AAAA;AAAA;EAGA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;;AASA;EACE;EACA;;;AAKN;EACE;;;AAGF;EACE;;;ACrFF;EACE;EACA;EACA;EACA;;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;;AAEA;EALF;IAMI;;;AAGF;EACE;;AAEA;EAHF;IAII;;;;AAKN;EACE;;AAEA;EACE;;AAGF;EACE;;AAIA;EADF;IAEI;;;;AAIN;EACE;;AAEA;EAHF;IAII;;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EARF;IASI;IACA;IACA;;;;ACrEJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAIF;EACE;EACA;EACA;EACA;EACA;;;ACvBF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EAEA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;;;AAKF;EACE;;AAGF;EACE;;;AAIJ;AAAA;EAEE;EACA;;AAEA;AAAA;EACE;;;AAKF;EACE;;;AAMF;AAAA;EACE;;;AC/DJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAGA;EANF;IAOI;;;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIJ;AACA;EACE;EACA;EACA;EACA;;;AAME;EADF;IAEI;IACA;IACA;;EAEA;IACE;;;;AChDR;EACE;EACA;EACA;EACA;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAKF;EACE;EACA;;AAKF;EACE;EACA;EACA;EACA;;AAKF;EACE;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAKJ;EACE;;AAEF;EACE;;AAMJ;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;;;AAMJ;EACE;EACA;EACA;;;AAGF;EACE;;;ACjGF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAEE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IAEE;;;;AC9CN;EACE;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAIF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EAEE;;AAMN;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;;;AC1EE;EACE;;;AAMN;EACE;;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;AAGF;EACE;EACA;;;AAKF;EACE;EACA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;ADrDN;EACE;EACA;EACA;EACA;;AAGA;EACE;EACA;;AAIF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EAEE;;AAMN;EACE;EACA;EACA;EACA;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAGF;EACE;EACA;;;AAKN;EACE;EACA;;;AEhFF;EACE;EACA;EACA;EACA;EAGA;;;ADDE;EACE;;;AAMN;EACE;;;AAIF;EACE;EACA;EACA;;AAEA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;AAGF;EACE;EACA;;;AAKF;EACE;EACA;EACA;EACA;;AACA;EACE;;AAGF;AAAA;AAAA;AAAA;AAAA;EAKE;;;AEpDN;AAAA;EAEE;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGE;;;AAKF;AAAA;EAEE;EACA;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;;;ALjBJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAEE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;IACE;;EAEF;IAEE;;;;AMjDN;EACE;EACA;;AAEA;EAJF;IAKI;IACA;;;AAKA;EACE;;;AAOF;EACE;;;ACnBJ;EACE;;AAEA;EAHF;IAII;;;AAGF;EAPF;IAQI;;;AAKF;EACE;EACA;;AAIJ;AAAA;EAEE;EACA;;AAIF;EACE;EACA;EACA;;;AC7BJ;EACE;EACA;EACA;;;AAIF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;;;AAIF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AChDF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAKA;EACE;;AAIJ;EAEE;;AAEA;EACE;;AAKA;EACE;;;AC5BR;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAMA;EACE;;AAKJ;EACE;EACA;;AAGA;EACE;;AAKA;EACE;;;AAMR;EACE;IACE;;EAEF;IACE;;;AC1CJ;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EAEE;EACA;;AAEA;EACE;;;AAMJ;EACE;;AACA;EACE;;AAIJ;EACE;EACA;;AAGF;AAAA;EAEE;;;AAIJ;EACE;IACE;IACA;;EAEF;IACE;IACA;;;AC/CJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;;AAEA;EACE;;AAKA;EACE;;;ACrBR;EACE;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;IACE;IACA;;;AAKF;EACE;IACE;IACA;;;;ACxGN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAIF;;AAEA;EACE;;AAGF;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EA3CF;IA4CI;;;;AC9CJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAIA;EAVF;IAWI;;;AAGF;EAdF;IAeI;;;;AAIJ;EACE;;;AAKF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EAII;AAAA;AAAA;IACE;IACA;;;ADvCN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAIF;;AAEA;EACE;;AAGF;EAEE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAIF;EA3CF;IA4CI;;;;AEhDJ;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;;AAKN;EACE;EACA;;;AC1BF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AAIA;EACE;EACA;;;AAIJ;EACE;;;AC3CF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAIJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAIA;AAAA;EACE;;AAGJ;EACE;EACA;;AAKA;AAAA;EACE;;AAGJ;EACE;;;ACvER;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAIF;EACE;EACA;;;AAGA;EACE;;;AAIJ;EACE;;;AAGF;EACE;;;AC9BA;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAIF;EACE;IACE;IACA;;;;AAKN;AAAA;EAGE;;AAGE;AAAA;EACE;;AAIJ;AAAA;EACE;;;AC5BJ;EAKE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EASA;EACA;EAEA;EAEA;AAAA;AAAA;AAAA;AAAA;AAAA;EAMA;EAKA;EACA;EACA;EAEA;EAEA;;;AAMF;EACE;EACA;EAEA;EAEA;EACA;;;AAGF;EACE;EACA","file":"main.css"}
|
@@ -12,6 +12,8 @@ export interface ChatbotProps {
|
|
12
12
|
innerRef?: React.Ref<HTMLDivElement>;
|
13
13
|
/** Custom aria label applied to focusable container */
|
14
14
|
ariaLabel?: string;
|
15
|
+
/** Density of information within the ChatBot */
|
16
|
+
isCompact?: boolean;
|
15
17
|
}
|
16
18
|
export declare enum ChatbotDisplayMode {
|
17
19
|
default = "default",
|
@@ -23,13 +23,13 @@ export var ChatbotDisplayMode;
|
|
23
23
|
ChatbotDisplayMode["drawer"] = "drawer";
|
24
24
|
})(ChatbotDisplayMode || (ChatbotDisplayMode = {}));
|
25
25
|
const ChatbotBase = (_a) => {
|
26
|
-
var { children, displayMode = ChatbotDisplayMode.default, isVisible = true, className, innerRef, ariaLabel } = _a, props = __rest(_a, ["children", "displayMode", "isVisible", "className", "innerRef", "ariaLabel"]);
|
26
|
+
var { children, displayMode = ChatbotDisplayMode.default, isVisible = true, className, innerRef, ariaLabel, isCompact } = _a, props = __rest(_a, ["children", "displayMode", "isVisible", "className", "innerRef", "ariaLabel", "isCompact"]);
|
27
27
|
// Configure animations
|
28
28
|
const motionChatbot = {
|
29
29
|
visible: { opacity: 1, y: 0 },
|
30
30
|
hidden: { opacity: 0, y: '16px' }
|
31
31
|
};
|
32
|
-
return (React.createElement(motion.div, Object.assign({ className: `pf-chatbot pf-chatbot--${displayMode} ${!isVisible ? 'pf-chatbot--hidden' : ''} ${className !== null && className !== void 0 ? className : ''}`, variants: motionChatbot, initial: "hidden", animate: isVisible ? 'visible' : 'hidden' }, props), isVisible ? (React.createElement("section", { "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : 'Chatbot', className: `pf-chatbot-container pf-chatbot-container--${displayMode} ${!isVisible ? 'pf-chatbot-container--hidden' : ''}`, tabIndex: -1, ref: innerRef }, children)) : undefined));
|
32
|
+
return (React.createElement(motion.div, Object.assign({ className: `pf-chatbot pf-chatbot--${displayMode} ${!isVisible ? 'pf-chatbot--hidden' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className !== null && className !== void 0 ? className : ''}`, variants: motionChatbot, initial: "hidden", animate: isVisible ? 'visible' : 'hidden' }, props), isVisible ? (React.createElement("section", { "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : 'Chatbot', className: `pf-chatbot-container pf-chatbot-container--${displayMode} ${!isVisible ? 'pf-chatbot-container--hidden' : ''}`, tabIndex: -1, ref: innerRef }, children)) : undefined));
|
33
33
|
};
|
34
34
|
const Chatbot = React.forwardRef((props, ref) => (React.createElement(ChatbotBase, Object.assign({ innerRef: ref }, props))));
|
35
35
|
export default Chatbot;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { Divider } from '@patternfly/react-core';
|
3
3
|
export const ChatbotHeader = ({ className, children }) => (React.createElement("div", { className: "pf-chatbot__header-container" },
|
4
|
-
React.createElement("div", { className: `pf-chatbot__header
|
4
|
+
React.createElement("div", { className: `pf-chatbot__header${className ? ` ${className}` : ''}` }, children),
|
5
5
|
React.createElement(Divider, { className: "pf-chatbot__header__divider" })));
|
6
6
|
export default ChatbotHeader;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { TooltipProps } from '@patternfly/react-core';
|
3
|
-
export interface ChatbotHeaderCloseButtonProps {
|
2
|
+
import { ButtonProps, TooltipProps } from '@patternfly/react-core';
|
3
|
+
export interface ChatbotHeaderCloseButtonProps extends ButtonProps {
|
4
4
|
/** Callback function for when button is clicked */
|
5
5
|
onClick: () => void;
|
6
6
|
/** Custom classname for the header component */
|
@@ -13,5 +13,7 @@ export interface ChatbotHeaderCloseButtonProps {
|
|
13
13
|
innerRef?: React.Ref<HTMLButtonElement>;
|
14
14
|
/** Content used in tooltip */
|
15
15
|
tooltipContent?: string;
|
16
|
+
/** Sets button to compact styling. */
|
17
|
+
isCompact?: boolean;
|
16
18
|
}
|
17
19
|
export declare const ChatbotHeaderCloseButton: React.ForwardRefExoticComponent<ChatbotHeaderCloseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
@@ -1,10 +1,24 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React from 'react';
|
2
13
|
import { Button, Icon, Tooltip } from '@patternfly/react-core';
|
3
14
|
import { CloseIcon } from '@patternfly/react-icons';
|
4
|
-
const ChatbotHeaderCloseButtonBase = (
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
15
|
+
const ChatbotHeaderCloseButtonBase = (_a) => {
|
16
|
+
var { className, onClick, tooltipProps, menuAriaLabel = 'Close', innerRef, tooltipContent = 'Close', isCompact } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "menuAriaLabel", "innerRef", "tooltipContent", "isCompact"]);
|
17
|
+
return (React.createElement("div", { className: `pf-chatbot__menu${className ? ` ${className}` : ''}` },
|
18
|
+
React.createElement(Tooltip, Object.assign({ content: tooltipContent, position: "bottom",
|
19
|
+
// prevents VO announcements of both aria label and tooltip
|
20
|
+
aria: "none" }, tooltipProps),
|
21
|
+
React.createElement(Button, Object.assign({ className: `pf-chatbot__button--toggle-menu ${isCompact ? 'pf-m-compact' : ''}`, variant: "plain", onClick: onClick, "aria-label": menuAriaLabel, ref: innerRef, icon: React.createElement(Icon, { size: isCompact ? 'lg' : 'xl', isInline: true },
|
22
|
+
React.createElement(CloseIcon, null)), size: isCompact ? 'sm' : undefined }, props)))));
|
23
|
+
};
|
10
24
|
export const ChatbotHeaderCloseButton = React.forwardRef((props, ref) => (React.createElement(ChatbotHeaderCloseButtonBase, Object.assign({ innerRef: ref }, props))));
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { fireEvent, render, screen } from '@testing-library/react';
|
3
3
|
import { ChatbotHeaderCloseButton } from './ChatbotHeaderCloseButton';
|
4
|
+
import '@testing-library/jest-dom';
|
4
5
|
describe('ChatbotHeaderCloseButton', () => {
|
5
6
|
it('should render ChatbotHeaderCloseButton', () => {
|
6
7
|
const { container } = render(React.createElement(ChatbotHeaderCloseButton, { className: "custom-header-close-button", onClick: jest.fn() }));
|
@@ -12,4 +13,8 @@ describe('ChatbotHeaderCloseButton', () => {
|
|
12
13
|
fireEvent.click(screen.getByRole('button', { name: 'Close' }));
|
13
14
|
expect(onClick).toHaveBeenCalled();
|
14
15
|
});
|
16
|
+
it('should render button with isCompact', () => {
|
17
|
+
render(React.createElement(ChatbotHeaderCloseButton, { "data-testid": "close-button", onClick: jest.fn(), isCompact: true }));
|
18
|
+
expect(screen.getByTestId('close-button')).toHaveClass('pf-m-compact');
|
19
|
+
});
|
15
20
|
});
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
export const ChatbotHeaderMain = ({ className, children }) => React.createElement("div", { className: `pf-chatbot__header-main ${className}` }, children);
|
2
|
+
export const ChatbotHeaderMain = ({ className, children }) => (React.createElement("div", { className: `pf-chatbot__header-main${className ? ` ${className}` : ''}` }, children));
|
3
3
|
export default ChatbotHeaderMain;
|
@@ -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 */
|
@@ -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 } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value"]);
|
22
22
|
// Text Input
|
23
23
|
// --------------------------------------------------------------------------
|
24
24
|
const [message, setMessage] = React.useState(value !== null && value !== void 0 ? value : '');
|
@@ -180,7 +180,7 @@ export const MessageBar = (_a) => {
|
|
180
180
|
};
|
181
181
|
const messageBarContents = (React.createElement(React.Fragment, null,
|
182
182
|
React.createElement("div", { className: "pf-chatbot__message-bar-input" },
|
183
|
-
React.createElement(TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ?
|
183
|
+
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
184
|
React.createElement("div", { className: "pf-chatbot__message-bar-actions" }, renderButtons())));
|
185
185
|
if (attachMenuProps) {
|
186
186
|
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' } } } }));
|
@@ -8,6 +8,8 @@ export interface SettingsFormProps {
|
|
8
8
|
label: string;
|
9
9
|
field: React.ReactElement;
|
10
10
|
}[];
|
11
|
+
/** Sets form to compact styling. */
|
12
|
+
isCompact?: boolean;
|
11
13
|
}
|
12
14
|
export declare const SettingsForm: React.FunctionComponent<SettingsFormProps>;
|
13
15
|
export default SettingsForm;
|
@@ -11,8 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
11
11
|
};
|
12
12
|
import React from 'react';
|
13
13
|
export const SettingsForm = (_a) => {
|
14
|
-
var { className, fields = [] } = _a, props = __rest(_a, ["className", "fields"]);
|
15
|
-
return (React.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${className}` }, props),
|
14
|
+
var { className, fields = [], isCompact } = _a, props = __rest(_a, ["className", "fields", "isCompact"]);
|
15
|
+
return (React.createElement("div", Object.assign({ className: `pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}` }, props),
|
16
16
|
React.createElement("form", { className: "pf-chatbot__settings-form" }, fields.map((field) => (React.createElement("div", { className: "pf-chatbot__settings-form-row", key: field.label },
|
17
17
|
React.createElement("label", { className: "pf-chatbot__settings-label", htmlFor: field.id }, field.label),
|
18
18
|
field.field))))));
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { Button } from '@patternfly/react-core';
|
3
3
|
import { render, screen } from '@testing-library/react';
|
4
4
|
import { SettingsForm } from './SettingsForm';
|
5
|
+
import '@testing-library/jest-dom';
|
5
6
|
describe('SettingsForm', () => {
|
6
7
|
it('should render settingsForm with custom classname', () => {
|
7
8
|
const { container } = render(React.createElement(SettingsForm, { className: "custom-settings" }));
|
@@ -18,4 +19,15 @@ describe('SettingsForm', () => {
|
|
18
19
|
render(React.createElement(SettingsForm, { fields: fields }));
|
19
20
|
expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
|
20
21
|
});
|
22
|
+
it('should render settingsForm with isCompact', () => {
|
23
|
+
const fields = [
|
24
|
+
{
|
25
|
+
id: 'archived-chat',
|
26
|
+
label: 'Archive chat',
|
27
|
+
field: (React.createElement(Button, { id: "archived-chat", variant: "secondary" }, "Archive chat"))
|
28
|
+
}
|
29
|
+
];
|
30
|
+
render(React.createElement(SettingsForm, { "data-testid": "settings-form", fields: fields, isCompact: true }));
|
31
|
+
expect(screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
|
32
|
+
});
|
21
33
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@patternfly/chatbot",
|
3
|
-
"version": "6.3.0-prerelease.
|
3
|
+
"version": "6.3.0-prerelease.3",
|
4
4
|
"description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|
@@ -0,0 +1,289 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
import SettingsForm from '@patternfly/chatbot/dist/dynamic/Settings';
|
4
|
+
import {
|
5
|
+
Button,
|
6
|
+
Divider,
|
7
|
+
Dropdown,
|
8
|
+
DropdownGroup,
|
9
|
+
DropdownItem,
|
10
|
+
DropdownList,
|
11
|
+
MenuToggle,
|
12
|
+
MenuToggleElement,
|
13
|
+
Switch,
|
14
|
+
Title
|
15
|
+
} from '@patternfly/react-core';
|
16
|
+
import Chatbot, { ChatbotDisplayMode } from '@patternfly/chatbot/dist/dynamic/Chatbot';
|
17
|
+
import ChatbotHeader, {
|
18
|
+
ChatbotHeaderActions,
|
19
|
+
ChatbotHeaderCloseButton,
|
20
|
+
ChatbotHeaderMain,
|
21
|
+
ChatbotHeaderOptionsDropdown,
|
22
|
+
ChatbotHeaderTitle
|
23
|
+
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
24
|
+
import { CogIcon, ExpandIcon, OpenDrawerRightIcon, OutlinedWindowRestoreIcon } from '@patternfly/react-icons';
|
25
|
+
|
26
|
+
export const CompactSettingsDemo: React.FunctionComponent = () => {
|
27
|
+
const [isChecked, setIsChecked] = React.useState<boolean>(true);
|
28
|
+
const [isThemeOpen, setIsThemeOpen] = React.useState(false);
|
29
|
+
const [isLanguageOpen, setIsLanguageOpen] = React.useState(false);
|
30
|
+
const [isVoiceOpen, setIsVoiceOpen] = React.useState(false);
|
31
|
+
const [displayMode, setDisplayMode] = React.useState(ChatbotDisplayMode.default);
|
32
|
+
const [areSettingsOpen, setAreSettingsOpen] = React.useState(true);
|
33
|
+
const chatbotVisible = true;
|
34
|
+
|
35
|
+
const onFocus = (id: string) => {
|
36
|
+
const element = document.getElementById(id);
|
37
|
+
(element as HTMLElement).focus();
|
38
|
+
};
|
39
|
+
|
40
|
+
const onThemeToggleClick = () => {
|
41
|
+
setIsThemeOpen(!isThemeOpen);
|
42
|
+
};
|
43
|
+
|
44
|
+
const onThemeSelect = (
|
45
|
+
_event: React.MouseEvent<Element, MouseEvent> | undefined,
|
46
|
+
value: string | number | undefined
|
47
|
+
) => {
|
48
|
+
// eslint-disable-next-line no-console
|
49
|
+
console.log('selected', value);
|
50
|
+
onFocus('theme');
|
51
|
+
setIsThemeOpen(false);
|
52
|
+
};
|
53
|
+
|
54
|
+
const onLanguageToggleClick = () => {
|
55
|
+
setIsLanguageOpen(!isLanguageOpen);
|
56
|
+
};
|
57
|
+
|
58
|
+
const onLanguageSelect = (
|
59
|
+
_event: React.MouseEvent<Element, MouseEvent> | undefined,
|
60
|
+
value: string | number | undefined
|
61
|
+
) => {
|
62
|
+
// eslint-disable-next-line no-console
|
63
|
+
console.log('selected', value);
|
64
|
+
onFocus('language');
|
65
|
+
setIsLanguageOpen(false);
|
66
|
+
};
|
67
|
+
|
68
|
+
const onVoiceToggleClick = () => {
|
69
|
+
onFocus('voice');
|
70
|
+
setIsVoiceOpen(!isVoiceOpen);
|
71
|
+
};
|
72
|
+
|
73
|
+
const onVoiceSelect = (
|
74
|
+
_event: React.MouseEvent<Element, MouseEvent> | undefined,
|
75
|
+
value: string | number | undefined
|
76
|
+
) => {
|
77
|
+
// eslint-disable-next-line no-console
|
78
|
+
console.log('selected', value);
|
79
|
+
setIsVoiceOpen(false);
|
80
|
+
};
|
81
|
+
|
82
|
+
const handleChange = (_event: React.FormEvent<HTMLInputElement>, checked: boolean) => {
|
83
|
+
setIsChecked(checked);
|
84
|
+
};
|
85
|
+
|
86
|
+
const themeDropdown = (
|
87
|
+
<Dropdown
|
88
|
+
isOpen={isThemeOpen}
|
89
|
+
onSelect={onThemeSelect}
|
90
|
+
onOpenChange={(isOpen: boolean) => setIsThemeOpen(isOpen)}
|
91
|
+
shouldFocusToggleOnSelect
|
92
|
+
shouldFocusFirstItemOnOpen
|
93
|
+
shouldPreventScrollOnItemFocus
|
94
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
95
|
+
// We want to add the id property here as well so the label is coupled
|
96
|
+
// with t he button on screen readers.
|
97
|
+
<MenuToggle size="sm" id="theme" ref={toggleRef} onClick={onThemeToggleClick} isExpanded={isThemeOpen}>
|
98
|
+
System
|
99
|
+
</MenuToggle>
|
100
|
+
)}
|
101
|
+
ouiaId="ThemeDropdown"
|
102
|
+
>
|
103
|
+
<DropdownList>
|
104
|
+
<DropdownItem value="System" key="system">
|
105
|
+
System
|
106
|
+
</DropdownItem>
|
107
|
+
</DropdownList>
|
108
|
+
</Dropdown>
|
109
|
+
);
|
110
|
+
|
111
|
+
const languageDropdown = (
|
112
|
+
<Dropdown
|
113
|
+
isOpen={isLanguageOpen}
|
114
|
+
onSelect={onLanguageSelect}
|
115
|
+
onOpenChange={(isOpen: boolean) => setIsLanguageOpen(isOpen)}
|
116
|
+
shouldFocusToggleOnSelect
|
117
|
+
shouldFocusFirstItemOnOpen
|
118
|
+
shouldPreventScrollOnItemFocus
|
119
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
120
|
+
// We want to add the id property here as well so the label is coupled
|
121
|
+
// with the button on screen readers.
|
122
|
+
<MenuToggle size="sm" id="language" ref={toggleRef} onClick={onLanguageToggleClick} isExpanded={isLanguageOpen}>
|
123
|
+
Auto-detect
|
124
|
+
</MenuToggle>
|
125
|
+
)}
|
126
|
+
ouiaId="LanguageDropdown"
|
127
|
+
>
|
128
|
+
<DropdownList>
|
129
|
+
<DropdownItem value="Auto-detect" key="auto-detect">
|
130
|
+
Auto-detect
|
131
|
+
</DropdownItem>
|
132
|
+
</DropdownList>
|
133
|
+
</Dropdown>
|
134
|
+
);
|
135
|
+
const voiceDropdown = (
|
136
|
+
<Dropdown
|
137
|
+
isOpen={isVoiceOpen}
|
138
|
+
onSelect={onVoiceSelect}
|
139
|
+
onOpenChange={(isOpen: boolean) => setIsVoiceOpen(isOpen)}
|
140
|
+
shouldFocusToggleOnSelect
|
141
|
+
shouldFocusFirstItemOnOpen
|
142
|
+
shouldPreventScrollOnItemFocus
|
143
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
144
|
+
// We want to add the id property here as well so the label is coupled
|
145
|
+
// with the button on screen readers.
|
146
|
+
<MenuToggle size="sm" id="voice" ref={toggleRef} onClick={onVoiceToggleClick} isExpanded={isVoiceOpen}>
|
147
|
+
Bot
|
148
|
+
</MenuToggle>
|
149
|
+
)}
|
150
|
+
ouiaId="VoiceDropdown"
|
151
|
+
>
|
152
|
+
<DropdownList>
|
153
|
+
<DropdownItem value="Bot" key="bot">
|
154
|
+
Bot
|
155
|
+
</DropdownItem>
|
156
|
+
</DropdownList>
|
157
|
+
</Dropdown>
|
158
|
+
);
|
159
|
+
const children = [
|
160
|
+
{ id: 'theme', label: 'Theme', field: themeDropdown },
|
161
|
+
{ id: 'language', label: 'Language', field: languageDropdown },
|
162
|
+
{ id: 'voice', label: 'Voice', field: voiceDropdown },
|
163
|
+
{
|
164
|
+
id: 'analytics',
|
165
|
+
label: 'Share analytics',
|
166
|
+
field: (
|
167
|
+
<Switch
|
168
|
+
// We want to add the id property here as well so the label is coupled
|
169
|
+
// with the button on screen readers.
|
170
|
+
id="analytics"
|
171
|
+
aria-label="Togglable option for whether to share analytics"
|
172
|
+
isChecked={isChecked}
|
173
|
+
onChange={handleChange}
|
174
|
+
/>
|
175
|
+
)
|
176
|
+
},
|
177
|
+
{
|
178
|
+
id: 'archived-chat',
|
179
|
+
label: 'Archive chat',
|
180
|
+
field: (
|
181
|
+
// We want to add the id property here as well so the label is coupled
|
182
|
+
// with the button on screen readers.
|
183
|
+
<Button size="sm" id="archived-chat" variant="secondary">
|
184
|
+
Manage
|
185
|
+
</Button>
|
186
|
+
)
|
187
|
+
},
|
188
|
+
{
|
189
|
+
id: 'archive-all',
|
190
|
+
label: 'Archive all chat',
|
191
|
+
field: (
|
192
|
+
// We want to add the id property here as well so the label is coupled
|
193
|
+
// with the button on screen readers.
|
194
|
+
<Button size="sm" id="archive-all" variant="secondary">
|
195
|
+
Archive all
|
196
|
+
</Button>
|
197
|
+
)
|
198
|
+
},
|
199
|
+
{
|
200
|
+
id: 'delete-all',
|
201
|
+
label: 'Delete all chats',
|
202
|
+
field: (
|
203
|
+
// We want to add the id property here as well so the label is coupled
|
204
|
+
// with the button on screen readers.
|
205
|
+
<Button size="sm" id="delete-all" variant="danger">
|
206
|
+
Delete all
|
207
|
+
</Button>
|
208
|
+
)
|
209
|
+
}
|
210
|
+
];
|
211
|
+
|
212
|
+
const onSelectDropdownItem = (
|
213
|
+
_event: React.MouseEvent<Element, MouseEvent> | undefined,
|
214
|
+
value: string | number | undefined
|
215
|
+
) => {
|
216
|
+
if (value === 'Settings') {
|
217
|
+
setAreSettingsOpen(true);
|
218
|
+
} else {
|
219
|
+
setDisplayMode(value as ChatbotDisplayMode);
|
220
|
+
}
|
221
|
+
};
|
222
|
+
|
223
|
+
const regularChatbot = (
|
224
|
+
<ChatbotHeader>
|
225
|
+
<ChatbotHeaderActions>
|
226
|
+
<ChatbotHeaderOptionsDropdown isCompact onSelect={onSelectDropdownItem}>
|
227
|
+
<DropdownGroup label="Display mode">
|
228
|
+
<DropdownList>
|
229
|
+
<DropdownItem
|
230
|
+
value={ChatbotDisplayMode.default}
|
231
|
+
key="switchDisplayOverlay"
|
232
|
+
icon={<OutlinedWindowRestoreIcon aria-hidden />}
|
233
|
+
isSelected={displayMode === ChatbotDisplayMode.default}
|
234
|
+
>
|
235
|
+
<span>Overlay</span>
|
236
|
+
</DropdownItem>
|
237
|
+
<DropdownItem
|
238
|
+
value={ChatbotDisplayMode.docked}
|
239
|
+
key="switchDisplayDock"
|
240
|
+
icon={<OpenDrawerRightIcon aria-hidden />}
|
241
|
+
isSelected={displayMode === ChatbotDisplayMode.docked}
|
242
|
+
>
|
243
|
+
<span>Dock to window</span>
|
244
|
+
</DropdownItem>
|
245
|
+
<DropdownItem
|
246
|
+
value={ChatbotDisplayMode.fullscreen}
|
247
|
+
key="switchDisplayFullscreen"
|
248
|
+
icon={<ExpandIcon aria-hidden />}
|
249
|
+
isSelected={displayMode === ChatbotDisplayMode.fullscreen}
|
250
|
+
>
|
251
|
+
<span>Fullscreen</span>
|
252
|
+
</DropdownItem>
|
253
|
+
</DropdownList>
|
254
|
+
</DropdownGroup>
|
255
|
+
<Divider />
|
256
|
+
<DropdownList>
|
257
|
+
<DropdownItem value="Settings" key="switchSettings" icon={<CogIcon aria-hidden />}>
|
258
|
+
<span>Settings</span>
|
259
|
+
</DropdownItem>
|
260
|
+
</DropdownList>
|
261
|
+
</ChatbotHeaderOptionsDropdown>
|
262
|
+
</ChatbotHeaderActions>
|
263
|
+
</ChatbotHeader>
|
264
|
+
);
|
265
|
+
|
266
|
+
return (
|
267
|
+
<>
|
268
|
+
<Chatbot isCompact isVisible={chatbotVisible} displayMode={displayMode}>
|
269
|
+
{areSettingsOpen ? (
|
270
|
+
<>
|
271
|
+
<ChatbotHeader className="pf-m-compact">
|
272
|
+
<ChatbotHeaderMain>
|
273
|
+
<ChatbotHeaderTitle>
|
274
|
+
<Title headingLevel="h1" size="2xl">
|
275
|
+
Settings
|
276
|
+
</Title>
|
277
|
+
</ChatbotHeaderTitle>
|
278
|
+
</ChatbotHeaderMain>
|
279
|
+
<ChatbotHeaderCloseButton isCompact onClick={() => setAreSettingsOpen(false)} />
|
280
|
+
</ChatbotHeader>
|
281
|
+
<SettingsForm isCompact fields={children} />
|
282
|
+
</>
|
283
|
+
) : (
|
284
|
+
<>{regularChatbot}</>
|
285
|
+
)}
|
286
|
+
</Chatbot>
|
287
|
+
</>
|
288
|
+
);
|
289
|
+
};
|
@@ -406,6 +406,13 @@ In this demo, you can toggle the settings page by clicking the "Settings" button
|
|
406
406
|
|
407
407
|
```
|
408
408
|
|
409
|
+
### Compact settings
|
410
|
+
|
411
|
+
To make the settings menu compact, with less spacing between the menu contents, pass `isCompact` to the `<SettingsForm>`.
|
412
|
+
```js file="./CompactSettings.tsx" isFullscreen
|
413
|
+
|
414
|
+
```
|
415
|
+
|
409
416
|
## Modals
|
410
417
|
|
411
418
|
### Modal
|
package/src/Chatbot/Chatbot.scss
CHANGED
@@ -125,3 +125,10 @@
|
|
125
125
|
border-radius: var(--pf-t--global--border--radius--sharp);
|
126
126
|
}
|
127
127
|
}
|
128
|
+
|
129
|
+
// ============================================================================
|
130
|
+
// Information density styles
|
131
|
+
// ============================================================================
|
132
|
+
.pf-chatbot.pf-m-compact {
|
133
|
+
font-size: var(--pf-t--global--font--size--sm);
|
134
|
+
}
|
package/src/Chatbot/Chatbot.tsx
CHANGED
@@ -17,6 +17,8 @@ export interface ChatbotProps {
|
|
17
17
|
innerRef?: React.Ref<HTMLDivElement>;
|
18
18
|
/** Custom aria label applied to focusable container */
|
19
19
|
ariaLabel?: string;
|
20
|
+
/** Density of information within the ChatBot */
|
21
|
+
isCompact?: boolean;
|
20
22
|
}
|
21
23
|
|
22
24
|
export enum ChatbotDisplayMode {
|
@@ -34,6 +36,7 @@ const ChatbotBase: React.FunctionComponent<ChatbotProps> = ({
|
|
34
36
|
className,
|
35
37
|
innerRef,
|
36
38
|
ariaLabel,
|
39
|
+
isCompact,
|
37
40
|
...props
|
38
41
|
}: ChatbotProps) => {
|
39
42
|
// Configure animations
|
@@ -44,7 +47,7 @@ const ChatbotBase: React.FunctionComponent<ChatbotProps> = ({
|
|
44
47
|
|
45
48
|
return (
|
46
49
|
<motion.div
|
47
|
-
className={`pf-chatbot pf-chatbot--${displayMode} ${!isVisible ? 'pf-chatbot--hidden' : ''} ${className ?? ''}`}
|
50
|
+
className={`pf-chatbot pf-chatbot--${displayMode} ${!isVisible ? 'pf-chatbot--hidden' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
48
51
|
variants={motionChatbot}
|
49
52
|
initial="hidden"
|
50
53
|
animate={isVisible ? 'visible' : 'hidden'}
|
@@ -137,3 +137,11 @@
|
|
137
137
|
:where(.pf-v6-theme-dark) .show-dark .pf-m-picture {
|
138
138
|
display: inline-flex;
|
139
139
|
}
|
140
|
+
|
141
|
+
// ============================================================================
|
142
|
+
// Information density styles
|
143
|
+
// ============================================================================
|
144
|
+
.pf-chatbot__button--toggle-menu.pf-m-compact {
|
145
|
+
width: 2rem;
|
146
|
+
height: 2rem;
|
147
|
+
}
|
@@ -14,7 +14,7 @@ export const ChatbotHeader: React.FunctionComponent<ChatbotHeaderProps> = ({
|
|
14
14
|
children
|
15
15
|
}: ChatbotHeaderProps) => (
|
16
16
|
<div className="pf-chatbot__header-container">
|
17
|
-
<div className={`pf-chatbot__header ${className
|
17
|
+
<div className={`pf-chatbot__header${className ? ` ${className}` : ''}`}>{children}</div>
|
18
18
|
<Divider className="pf-chatbot__header__divider" />
|
19
19
|
</div>
|
20
20
|
);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { fireEvent, render, screen } from '@testing-library/react';
|
3
3
|
import { ChatbotHeaderCloseButton } from './ChatbotHeaderCloseButton';
|
4
|
+
import '@testing-library/jest-dom';
|
4
5
|
|
5
6
|
describe('ChatbotHeaderCloseButton', () => {
|
6
7
|
it('should render ChatbotHeaderCloseButton', () => {
|
@@ -17,4 +18,9 @@ describe('ChatbotHeaderCloseButton', () => {
|
|
17
18
|
fireEvent.click(screen.getByRole('button', { name: 'Close' }));
|
18
19
|
expect(onClick).toHaveBeenCalled();
|
19
20
|
});
|
21
|
+
|
22
|
+
it('should render button with isCompact', () => {
|
23
|
+
render(<ChatbotHeaderCloseButton data-testid="close-button" onClick={jest.fn()} isCompact />);
|
24
|
+
expect(screen.getByTestId('close-button')).toHaveClass('pf-m-compact');
|
25
|
+
});
|
20
26
|
});
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
|
3
|
-
import { Button, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
3
|
+
import { Button, ButtonProps, Icon, Tooltip, TooltipProps } from '@patternfly/react-core';
|
4
4
|
import { CloseIcon } from '@patternfly/react-icons';
|
5
5
|
|
6
|
-
export interface ChatbotHeaderCloseButtonProps {
|
6
|
+
export interface ChatbotHeaderCloseButtonProps extends ButtonProps {
|
7
7
|
/** Callback function for when button is clicked */
|
8
8
|
onClick: () => void;
|
9
9
|
/** Custom classname for the header component */
|
@@ -16,6 +16,8 @@ export interface ChatbotHeaderCloseButtonProps {
|
|
16
16
|
innerRef?: React.Ref<HTMLButtonElement>;
|
17
17
|
/** Content used in tooltip */
|
18
18
|
tooltipContent?: string;
|
19
|
+
/** Sets button to compact styling. */
|
20
|
+
isCompact?: boolean;
|
19
21
|
}
|
20
22
|
|
21
23
|
const ChatbotHeaderCloseButtonBase: React.FunctionComponent<ChatbotHeaderCloseButtonProps> = ({
|
@@ -24,9 +26,11 @@ const ChatbotHeaderCloseButtonBase: React.FunctionComponent<ChatbotHeaderCloseBu
|
|
24
26
|
tooltipProps,
|
25
27
|
menuAriaLabel = 'Close',
|
26
28
|
innerRef,
|
27
|
-
tooltipContent = 'Close'
|
29
|
+
tooltipContent = 'Close',
|
30
|
+
isCompact,
|
31
|
+
...props
|
28
32
|
}: ChatbotHeaderCloseButtonProps) => (
|
29
|
-
<div className={`pf-chatbot__menu ${className}`}>
|
33
|
+
<div className={`pf-chatbot__menu${className ? ` ${className}` : ''}`}>
|
30
34
|
<Tooltip
|
31
35
|
content={tooltipContent}
|
32
36
|
position="bottom"
|
@@ -35,16 +39,18 @@ const ChatbotHeaderCloseButtonBase: React.FunctionComponent<ChatbotHeaderCloseBu
|
|
35
39
|
{...tooltipProps}
|
36
40
|
>
|
37
41
|
<Button
|
38
|
-
className=
|
42
|
+
className={`pf-chatbot__button--toggle-menu ${isCompact ? 'pf-m-compact' : ''}`}
|
39
43
|
variant="plain"
|
40
44
|
onClick={onClick}
|
41
45
|
aria-label={menuAriaLabel}
|
42
46
|
ref={innerRef}
|
43
47
|
icon={
|
44
|
-
<Icon size=
|
48
|
+
<Icon size={isCompact ? 'lg' : 'xl'} isInline>
|
45
49
|
<CloseIcon />
|
46
50
|
</Icon>
|
47
51
|
}
|
52
|
+
size={isCompact ? 'sm' : undefined}
|
53
|
+
{...props}
|
48
54
|
/>
|
49
55
|
</Tooltip>
|
50
56
|
</div>
|
@@ -10,6 +10,8 @@ export interface ChatbotHeaderMainProps {
|
|
10
10
|
export const ChatbotHeaderMain: React.FunctionComponent<ChatbotHeaderMainProps> = ({
|
11
11
|
className,
|
12
12
|
children
|
13
|
-
}: ChatbotHeaderMainProps) =>
|
13
|
+
}: ChatbotHeaderMainProps) => (
|
14
|
+
<div className={`pf-chatbot__header-main${className ? ` ${className}` : ''}`}>{children}</div>
|
15
|
+
);
|
14
16
|
|
15
17
|
export default ChatbotHeaderMain;
|
@@ -96,6 +96,12 @@ describe('Message bar', () => {
|
|
96
96
|
expect(spy).toHaveBeenCalledTimes(1);
|
97
97
|
expect(spy).toHaveBeenCalledWith(expect.any(Object), 'A');
|
98
98
|
});
|
99
|
+
it('can use specified placeholder text', async () => {
|
100
|
+
render(<MessageBar onSendMessage={jest.fn} placeholder="test placeholder" />);
|
101
|
+
const input = screen.getByRole('textbox', { name: /test placeholder/i });
|
102
|
+
await userEvent.type(input, 'Hello world');
|
103
|
+
expect(input).toHaveTextContent('Hello world');
|
104
|
+
});
|
99
105
|
|
100
106
|
// Send button
|
101
107
|
// --------------------------------------------------------------------------
|
@@ -304,6 +310,13 @@ describe('Message bar', () => {
|
|
304
310
|
await userEvent.click(screen.getByRole('button', { name: 'Microphone button' }));
|
305
311
|
expect(screen.getByRole('tooltip', { name: 'Not currently listening' })).toBeTruthy();
|
306
312
|
});
|
313
|
+
it('can customize the listening placeholder', async () => {
|
314
|
+
mockSpeechRecognition();
|
315
|
+
render(<MessageBar onSendMessage={jest.fn} hasMicrophoneButton listeningText="I am listening" />);
|
316
|
+
await userEvent.click(screen.getByRole('button', { name: 'Microphone button' }));
|
317
|
+
const input = screen.getByRole('textbox', { name: /I am listening/i });
|
318
|
+
expect(input).toBeTruthy();
|
319
|
+
});
|
307
320
|
it('can handle buttonProps props appropriately for microphone', async () => {
|
308
321
|
mockSpeechRecognition();
|
309
322
|
render(
|
@@ -37,10 +37,14 @@ export interface MessageBarProps extends TextAreaProps {
|
|
37
37
|
className?: string;
|
38
38
|
/** Flag to always to show the send button. By default send button is shown when there is a message in the input field */
|
39
39
|
alwayShowSendButton?: boolean;
|
40
|
+
/** Placeholder for message input */
|
41
|
+
placeholder?: string;
|
40
42
|
/** Flag to disable/enable the Attach button */
|
41
43
|
hasAttachButton?: boolean;
|
42
44
|
/** Flag to enable the Microphone button */
|
43
45
|
hasMicrophoneButton?: boolean;
|
46
|
+
/** Placeholder text when listening */
|
47
|
+
listeningText?: string;
|
44
48
|
/** Flag to enable the Stop button, used for streaming content */
|
45
49
|
hasStopButton?: boolean;
|
46
50
|
/** Callback function for when stop button is clicked */
|
@@ -78,8 +82,10 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
78
82
|
onSendMessage,
|
79
83
|
className,
|
80
84
|
alwayShowSendButton,
|
85
|
+
placeholder = 'Send a message...',
|
81
86
|
hasAttachButton = true,
|
82
87
|
hasMicrophoneButton,
|
88
|
+
listeningText = 'Listening',
|
83
89
|
handleAttach,
|
84
90
|
attachMenuProps,
|
85
91
|
isSendButtonDisabled,
|
@@ -322,8 +328,8 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
322
328
|
className="pf-chatbot__message-textarea"
|
323
329
|
value={message}
|
324
330
|
onChange={handleChange}
|
325
|
-
aria-label={isListeningMessage ?
|
326
|
-
placeholder={isListeningMessage ?
|
331
|
+
aria-label={isListeningMessage ? listeningText : placeholder}
|
332
|
+
placeholder={isListeningMessage ? listeningText : placeholder}
|
327
333
|
ref={textareaRef}
|
328
334
|
onKeyDown={handleKeyDown}
|
329
335
|
{...props}
|
@@ -32,3 +32,14 @@
|
|
32
32
|
font-weight: var(--pf-t--global--font--weight--body--bold);
|
33
33
|
text-align: center;
|
34
34
|
}
|
35
|
+
|
36
|
+
.pf-chatbot__settings-form-container.pf-m-compact {
|
37
|
+
.pf-chatbot__settings-form-row {
|
38
|
+
padding: var(--pf-t--global--spacer--md);
|
39
|
+
font-size: var(--pf-t--global--font--size--body--md);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
.pf-chatbot__header.pf-m-compact {
|
44
|
+
padding-inline-start: var(--pf-t--global--spacer--md);
|
45
|
+
}
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import { Button } from '@patternfly/react-core';
|
3
3
|
import { render, screen } from '@testing-library/react';
|
4
4
|
import { SettingsForm } from './SettingsForm';
|
5
|
+
import '@testing-library/jest-dom';
|
5
6
|
|
6
7
|
describe('SettingsForm', () => {
|
7
8
|
it('should render settingsForm with custom classname', () => {
|
@@ -25,4 +26,20 @@ describe('SettingsForm', () => {
|
|
25
26
|
|
26
27
|
expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
|
27
28
|
});
|
29
|
+
|
30
|
+
it('should render settingsForm with isCompact', () => {
|
31
|
+
const fields = [
|
32
|
+
{
|
33
|
+
id: 'archived-chat',
|
34
|
+
label: 'Archive chat',
|
35
|
+
field: (
|
36
|
+
<Button id="archived-chat" variant="secondary">
|
37
|
+
Archive chat
|
38
|
+
</Button>
|
39
|
+
)
|
40
|
+
}
|
41
|
+
];
|
42
|
+
render(<SettingsForm data-testid="settings-form" fields={fields} isCompact />);
|
43
|
+
expect(screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
|
44
|
+
});
|
28
45
|
});
|
@@ -5,10 +5,20 @@ export interface SettingsFormProps {
|
|
5
5
|
className?: string;
|
6
6
|
/** Array of fields to display in the settings layout */
|
7
7
|
fields?: { id: string; label: string; field: React.ReactElement }[];
|
8
|
+
/** Sets form to compact styling. */
|
9
|
+
isCompact?: boolean;
|
8
10
|
}
|
9
11
|
|
10
|
-
export const SettingsForm: React.FunctionComponent<SettingsFormProps> = ({
|
11
|
-
|
12
|
+
export const SettingsForm: React.FunctionComponent<SettingsFormProps> = ({
|
13
|
+
className,
|
14
|
+
fields = [],
|
15
|
+
isCompact,
|
16
|
+
...props
|
17
|
+
}) => (
|
18
|
+
<div
|
19
|
+
className={`pf-chatbot__settings-form-container ${isCompact ? 'pf-m-compact' : ''} ${className ? ` ${className}` : ''}`}
|
20
|
+
{...props}
|
21
|
+
>
|
12
22
|
<form className="pf-chatbot__settings-form">
|
13
23
|
{fields.map((field) => (
|
14
24
|
<div className="pf-chatbot__settings-form-row" key={field.label}>
|