@patternfly/chatbot 6.5.0-prerelease.27 → 6.5.0-prerelease.29
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/MarkdownContent/MarkdownContent.d.ts +7 -2
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +5 -3
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +30 -0
- package/dist/cjs/Message/Message.d.ts +2 -0
- package/dist/cjs/Message/Message.js +5 -5
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.js +22 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +25 -0
- package/dist/cjs/Message/MessageAndActions/index.d.ts +1 -0
- package/dist/cjs/Message/MessageAndActions/index.js +17 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.js +22 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +25 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.js +22 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +25 -0
- package/dist/cjs/Message/MessageAttachments/index.d.ts +2 -0
- package/dist/cjs/Message/MessageAttachments/index.js +18 -0
- package/dist/cjs/Message/MessageInput.d.ts +1 -1
- package/dist/cjs/Message/MessageInput.js +3 -1
- package/dist/cjs/Message/MessageLoading.d.ts +13 -4
- package/dist/cjs/Message/MessageLoading.js +19 -5
- package/dist/cjs/Message/MessageLoading.test.d.ts +1 -0
- package/dist/cjs/Message/MessageLoading.test.js +25 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +3 -2
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +109 -0
- package/dist/cjs/Message/QuickResponse/index.d.ts +1 -0
- package/dist/cjs/Message/QuickResponse/index.js +17 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +1 -1
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +3 -2
- package/dist/cjs/Message/QuickStarts/index.d.ts +2 -0
- package/dist/cjs/Message/QuickStarts/index.js +18 -0
- package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +1 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.js +3 -1
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +3 -2
- package/dist/cjs/Message/UserFeedback/index.d.ts +2 -0
- package/dist/cjs/Message/UserFeedback/index.js +18 -0
- package/dist/cjs/Message/index.d.ts +8 -0
- package/dist/cjs/Message/index.js +8 -0
- package/dist/cjs/MessageBar/MessageBar.d.ts +6 -0
- package/dist/cjs/MessageBar/MessageBar.js +24 -12
- package/dist/cjs/MessageBar/MessageBar.test.js +12 -0
- package/dist/cjs/ResponseActions/ResponseActions.d.ts +4 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.d.ts +13 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.js +22 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +25 -0
- package/dist/cjs/ResponseActions/index.d.ts +1 -0
- package/dist/cjs/ResponseActions/index.js +1 -0
- package/dist/css/main.css +13 -1
- package/dist/css/main.css.map +1 -1
- package/dist/esm/MarkdownContent/MarkdownContent.d.ts +7 -2
- package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
- package/dist/esm/Message/ErrorMessage/ErrorMessage.js +3 -3
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +25 -0
- package/dist/esm/Message/Message.d.ts +2 -0
- package/dist/esm/Message/Message.js +5 -5
- package/dist/esm/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.js +18 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +20 -0
- package/dist/esm/Message/MessageAndActions/index.d.ts +1 -0
- package/dist/esm/Message/MessageAndActions/index.js +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.js +18 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +20 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.js +18 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +20 -0
- package/dist/esm/Message/MessageAttachments/index.d.ts +2 -0
- package/dist/esm/Message/MessageAttachments/index.js +2 -0
- package/dist/esm/Message/MessageInput.d.ts +1 -1
- package/dist/esm/Message/MessageInput.js +1 -1
- package/dist/esm/Message/MessageLoading.d.ts +13 -4
- package/dist/esm/Message/MessageLoading.js +16 -4
- package/dist/esm/Message/MessageLoading.test.d.ts +1 -0
- package/dist/esm/Message/MessageLoading.test.js +20 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +3 -2
- package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.test.js +104 -0
- package/dist/esm/Message/QuickResponse/index.d.ts +1 -0
- package/dist/esm/Message/QuickResponse/index.js +1 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +1 -1
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +1 -1
- package/dist/esm/Message/QuickStarts/index.d.ts +2 -0
- package/dist/esm/Message/QuickStarts/index.js +2 -0
- package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +1 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.js +1 -1
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +1 -2
- package/dist/esm/Message/UserFeedback/index.d.ts +2 -0
- package/dist/esm/Message/UserFeedback/index.js +2 -0
- package/dist/esm/Message/index.d.ts +8 -0
- package/dist/esm/Message/index.js +8 -0
- package/dist/esm/MessageBar/MessageBar.d.ts +6 -0
- package/dist/esm/MessageBar/MessageBar.js +24 -12
- package/dist/esm/MessageBar/MessageBar.test.js +12 -0
- package/dist/esm/ResponseActions/ResponseActions.d.ts +4 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.d.ts +13 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.js +18 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +20 -0
- package/dist/esm/ResponseActions/index.d.ts +1 -0
- package/dist/esm/ResponseActions/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomStructure.tsx +102 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +55 -10
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarCustomActions.tsx +190 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +15 -2
- package/src/MarkdownContent/MarkdownContent.tsx +7 -2
- package/src/Message/ErrorMessage/ErrorMessage.test.tsx +38 -0
- package/src/Message/ErrorMessage/ErrorMessage.tsx +17 -2
- package/src/Message/Message.tsx +75 -64
- package/src/Message/MessageAndActions/MessageAndActions.test.tsx +23 -0
- package/src/Message/MessageAndActions/MessageAndActions.tsx +22 -0
- package/src/Message/MessageAndActions/index.ts +1 -0
- package/src/Message/MessageAttachments/MessageAttachmentItem.test.tsx +23 -0
- package/src/Message/MessageAttachments/MessageAttachmentItem.tsx +25 -0
- package/src/Message/MessageAttachments/MessageAttachmentsContainer.test.tsx +23 -0
- package/src/Message/MessageAttachments/MessageAttachmentsContainer.tsx +25 -0
- package/src/Message/MessageAttachments/index.ts +2 -0
- package/src/Message/MessageInput.tsx +1 -1
- package/src/Message/MessageLoading.test.tsx +23 -0
- package/src/Message/MessageLoading.tsx +17 -2
- package/src/Message/QuickResponse/QuickResponse.test.tsx +131 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +3 -2
- package/src/Message/QuickResponse/index.ts +1 -0
- package/src/Message/QuickStarts/QuickStartTile.tsx +1 -1
- package/src/Message/QuickStarts/index.ts +2 -0
- package/src/Message/UserFeedback/UserFeedback.tsx +1 -1
- package/src/Message/UserFeedback/UserFeedbackComplete.tsx +1 -4
- package/src/Message/UserFeedback/index.ts +2 -0
- package/src/Message/index.ts +8 -0
- package/src/MessageBar/MessageBar.scss +15 -1
- package/src/MessageBar/MessageBar.test.tsx +27 -0
- package/src/MessageBar/MessageBar.tsx +86 -50
- package/src/ResponseActions/ResponseActions.tsx +6 -0
- package/src/ResponseActions/ResponseActionsGroups.test.tsx +23 -0
- package/src/ResponseActions/ResponseActionsGroups.tsx +28 -0
- package/src/ResponseActions/index.ts +1 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_1 = require("@testing-library/react");
|
|
17
|
+
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
18
|
+
require("@testing-library/jest-dom");
|
|
19
|
+
const QuickResponse_1 = __importDefault(require("./QuickResponse"));
|
|
20
|
+
test('Renders with quick responses', () => {
|
|
21
|
+
const quickResponses = [
|
|
22
|
+
{ id: '1', content: 'Response 1' },
|
|
23
|
+
{ id: '2', content: 'Response 2' },
|
|
24
|
+
{ id: '3', content: 'Response 3' }
|
|
25
|
+
];
|
|
26
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses }));
|
|
27
|
+
expect(react_1.screen.getByText('Response 1')).toBeVisible();
|
|
28
|
+
expect(react_1.screen.getByText('Response 2')).toBeVisible();
|
|
29
|
+
expect(react_1.screen.getByText('Response 3')).toBeVisible();
|
|
30
|
+
});
|
|
31
|
+
test('Renders with compact styling', () => {
|
|
32
|
+
const quickResponses = [{ id: '1', content: 'Compact response' }];
|
|
33
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses, isCompact: true }));
|
|
34
|
+
expect(react_1.screen.getByText('Compact response').closest('.pf-v6-c-label')).toHaveClass('pf-m-compact');
|
|
35
|
+
});
|
|
36
|
+
test('Renders with custom className on response', () => {
|
|
37
|
+
const quickResponses = [{ id: '1', content: 'Custom class response', className: 'custom-response-class' }];
|
|
38
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses }));
|
|
39
|
+
expect(react_1.screen.getByText('Custom class response').closest('.pf-v6-c-label')).toHaveClass('custom-response-class');
|
|
40
|
+
});
|
|
41
|
+
test('Renders with custom container className', () => {
|
|
42
|
+
const quickResponses = [
|
|
43
|
+
{ id: '1', content: 'Response 1' },
|
|
44
|
+
{ id: '2', content: 'Response 2' }
|
|
45
|
+
];
|
|
46
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses, quickResponseContainerProps: { className: 'custom-container-class' } }));
|
|
47
|
+
expect(react_1.screen.getByText('Response 1').closest('.pf-v6-c-label-group')).toHaveClass('custom-container-class');
|
|
48
|
+
});
|
|
49
|
+
test('Spreads additional custom container props', () => {
|
|
50
|
+
const quickResponses = [
|
|
51
|
+
{ id: '1', content: 'Response 1' },
|
|
52
|
+
{ id: '2', content: 'Response 2' }
|
|
53
|
+
];
|
|
54
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses, quickResponseContainerProps: { id: 'custom-container-id' } }));
|
|
55
|
+
expect(react_1.screen.getByText('Response 1').closest('.pf-v6-c-label-group__list')).toHaveAttribute('id', 'custom-container-id');
|
|
56
|
+
});
|
|
57
|
+
test('Renders with pf-chatbot__message-quick-response--selected class after click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
+
const user = user_event_1.default.setup();
|
|
59
|
+
const quickResponses = [
|
|
60
|
+
{ id: '1', content: 'Response 1' },
|
|
61
|
+
{ id: '2', content: 'Response 2' }
|
|
62
|
+
];
|
|
63
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses }));
|
|
64
|
+
yield user.click(react_1.screen.getByText('Response 1'));
|
|
65
|
+
expect(react_1.screen.getByText('Response 1').closest('.pf-v6-c-label')).toHaveClass('pf-chatbot__message-quick-response--selected');
|
|
66
|
+
}));
|
|
67
|
+
test('Does not calls onClick handler when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
+
const user = user_event_1.default.setup();
|
|
69
|
+
const handleClick = jest.fn();
|
|
70
|
+
const quickResponses = [{ id: '1', content: 'Clickable response' }];
|
|
71
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses }));
|
|
72
|
+
yield user.click(react_1.screen.getByText('Clickable response'));
|
|
73
|
+
expect(handleClick).not.toHaveBeenCalled();
|
|
74
|
+
}));
|
|
75
|
+
test('Calls onClick handler when passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
|
+
const user = user_event_1.default.setup();
|
|
77
|
+
const handleClick = jest.fn();
|
|
78
|
+
const quickResponses = [{ id: '1', content: 'Clickable response', onClick: handleClick }];
|
|
79
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses }));
|
|
80
|
+
yield user.click(react_1.screen.getByText('Clickable response'));
|
|
81
|
+
expect(handleClick).toHaveBeenCalled();
|
|
82
|
+
}));
|
|
83
|
+
test('Does not call onSelect when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
const user = user_event_1.default.setup();
|
|
85
|
+
const handleSelect = jest.fn();
|
|
86
|
+
const quickResponses = [
|
|
87
|
+
{ id: '1', content: 'Response 1' },
|
|
88
|
+
{ id: '2', content: 'Response 2' }
|
|
89
|
+
];
|
|
90
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses }));
|
|
91
|
+
yield user.click(react_1.screen.getByText('Response 2'));
|
|
92
|
+
expect(handleSelect).not.toHaveBeenCalled();
|
|
93
|
+
}));
|
|
94
|
+
test('Calls onSelect when passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
+
const user = user_event_1.default.setup();
|
|
96
|
+
const handleSelect = jest.fn();
|
|
97
|
+
const quickResponses = [
|
|
98
|
+
{ id: '1', content: 'Response 1' },
|
|
99
|
+
{ id: '2', content: 'Response 2' }
|
|
100
|
+
];
|
|
101
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses, onSelect: handleSelect }));
|
|
102
|
+
yield user.click(react_1.screen.getByText('Response 2'));
|
|
103
|
+
expect(handleSelect).toHaveBeenCalledWith('2');
|
|
104
|
+
}));
|
|
105
|
+
test('Spreads additional response props', () => {
|
|
106
|
+
const quickResponses = [{ id: '1', content: 'Response with props', isCompact: true, 'aria-label': 'Test label' }];
|
|
107
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(QuickResponse_1.default, { quickResponses: quickResponses }));
|
|
108
|
+
expect(react_1.screen.getByText('Response with props').closest('.pf-v6-c-label')).toHaveAttribute('aria-label', 'Test label');
|
|
109
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuickResponse';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./QuickResponse"), exports);
|
|
@@ -25,5 +25,5 @@ export interface QuickStartTileProps {
|
|
|
25
25
|
/** Sets the tile to compact styling */
|
|
26
26
|
isCompact?: boolean;
|
|
27
27
|
}
|
|
28
|
-
declare const QuickStartTile: FC<QuickStartTileProps>;
|
|
28
|
+
export declare const QuickStartTile: FC<QuickStartTileProps>;
|
|
29
29
|
export default QuickStartTile;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.camelize = void 0;
|
|
6
|
+
exports.QuickStartTile = exports.camelize = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const rocket_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/rocket-icon"));
|
|
9
9
|
const outlined_bookmark_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/outlined-bookmark-icon"));
|
|
@@ -43,4 +43,5 @@ const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, mi
|
|
|
43
43
|
actions: { actions: additionalAction }
|
|
44
44
|
}), { children: quickStartIcon })), (0, jsx_runtime_1.jsx)(react_core_1.CardTitle, { children: (0, jsx_runtime_1.jsx)(QuickStartTileHeader_1.default, { name: displayName, onSelect: onSelect, quickStartId: id }) }), (0, jsx_runtime_1.jsx)(react_core_1.CardBody, { children: (0, jsx_runtime_1.jsxs)(react_core_1.Stack, { hasGutter: true, children: [(0, jsx_runtime_1.jsxs)(react_core_1.Flex, { spaceItems: { default: 'spaceItemsSm' }, children: [type && (0, jsx_runtime_1.jsx)(react_core_1.Label, { color: type.color, children: type.text }), durationMinutes && ((0, jsx_runtime_1.jsx)(react_core_1.Label, { variant: "outline", "data-test": "duration", icon: (0, jsx_runtime_1.jsx)(outlined_clock_icon_1.default, {}), children: (0, react_core_1.pluralize)(durationMinutes, minuteWord, minuteWordPlural) }))] }), (0, jsx_runtime_1.jsx)(QuickStartTileDescription_1.default, { description: description, prerequisites: prerequisites, prerequisiteWord: prerequisiteWord, prerequisiteWordPlural: prerequisiteWordPlural, quickStartButtonAriaLabel: quickStartButtonAriaLabel })] }) }), (0, jsx_runtime_1.jsx)(react_core_1.CardFooter, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, { variant: "link", isInline: true, onClick: onSelect, children: (0, jsx_runtime_1.jsx)("span", { className: "pf-v6-c-button__text", children: "Start" }) }) })] }));
|
|
45
45
|
};
|
|
46
|
-
exports.
|
|
46
|
+
exports.QuickStartTile = QuickStartTile;
|
|
47
|
+
exports.default = exports.QuickStartTile;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./QuickStartTile"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -51,5 +51,5 @@ export interface UserFeedbackProps extends Omit<CardProps, 'onSubmit'>, OUIAProp
|
|
|
51
51
|
/** Optional privacy statement text displayed under text area */
|
|
52
52
|
privacyStatement?: string;
|
|
53
53
|
}
|
|
54
|
-
declare const UserFeedback: FunctionComponent<UserFeedbackProps>;
|
|
54
|
+
export declare const UserFeedback: FunctionComponent<UserFeedbackProps>;
|
|
55
55
|
export default UserFeedback;
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.UserFeedback = void 0;
|
|
17
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
19
|
const react_1 = require("react");
|
|
19
20
|
// Import PatternFly components
|
|
@@ -40,4 +41,5 @@ const UserFeedback = (_a) => {
|
|
|
40
41
|
onTextAreaChange && onTextAreaChange(_event, value);
|
|
41
42
|
}, placeholder: textAreaPlaceholder, "aria-label": textAreaAriaLabel, resizeOrientation: "vertical" }, textAreaProps)) })), privacyStatement && (0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__feedback-card-privacy", children: privacyStatement }), children, (0, jsx_runtime_1.jsx)(react_core_1.ActionGroup, Object.assign({}, actionGroupProps, { children: (0, jsx_runtime_1.jsx)(react_core_1.Button, Object.assign({ onClick: () => onSubmit(selectedResponse, value), size: isCompact ? 'sm' : undefined }, submitButtonProps, { children: submitWord })) }))] })) }))] })) }));
|
|
42
43
|
};
|
|
43
|
-
exports.
|
|
44
|
+
exports.UserFeedback = UserFeedback;
|
|
45
|
+
exports.default = exports.UserFeedback;
|
|
@@ -38,5 +38,5 @@ export interface UserFeedbackCompleteProps extends Omit<CardProps, 'ref'>, OUIAP
|
|
|
38
38
|
/** Timestamp passed in by Message for more context in aria announcements */
|
|
39
39
|
timestamp?: string;
|
|
40
40
|
}
|
|
41
|
-
declare const UserFeedbackComplete: FunctionComponent<UserFeedbackCompleteProps>;
|
|
41
|
+
export declare const UserFeedbackComplete: FunctionComponent<UserFeedbackCompleteProps>;
|
|
42
42
|
export default UserFeedbackComplete;
|
|
@@ -14,9 +14,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.UserFeedbackComplete = void 0;
|
|
17
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
19
|
const react_1 = require("react");
|
|
19
|
-
// Import PatternFly components
|
|
20
20
|
const react_core_1 = require("@patternfly/react-core");
|
|
21
21
|
const CloseButton_1 = __importDefault(require("./CloseButton"));
|
|
22
22
|
const UserFeedbackComplete = (_a) => {
|
|
@@ -90,4 +90,5 @@ const UserFeedbackComplete = (_a) => {
|
|
|
90
90
|
}
|
|
91
91
|
: undefined }), (0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__feedback-complete-body", children: [(0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__feedback-complete-image", children: (0, jsx_runtime_1.jsxs)("svg", { width: "60", height: "64", viewBox: "0 0 60 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M53.0555 21.5975H6.94323C3.57013 21.5975 0.835693 24.3319 0.835693 27.705V57.8925C0.835693 61.2656 3.57013 64 6.94323 64H53.0555C56.4286 64 59.1631 61.2656 59.1631 57.8925V27.705C59.1631 24.3319 56.4286 21.5975 53.0555 21.5975Z", fill: "#F8AE54" }), (0, jsx_runtime_1.jsx)("path", { d: "M55.8973 19.8247C52.5894 15.7926 29.9992 0 29.9992 0C29.9992 0 7.40996 15.7926 4.10102 19.8247C0.79312 23.8568 0.835476 25.7184 0.835476 27.8899H59.1629C59.1629 25.7184 59.2052 23.8578 55.8973 19.8257V19.8247Z", fill: "#FFCC17" }), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("path", { d: "M53.0567 8.48981H6.94336V61.8388H53.0567V8.48981Z", fill: "#F2F2F2" }) }), (0, jsx_runtime_1.jsx)("path", { d: "M51.6589 7.49908H8.34204V60.8481H51.6589V7.49908Z", fill: "white" }), (0, jsx_runtime_1.jsx)("path", { d: "M0.835693 29.1296V57.8925C0.835693 59.2375 1.27165 60.4803 2.00823 61.4896L23.0303 43.5462L0.835693 29.1296Z", fill: "#FFCC17" }), (0, jsx_runtime_1.jsx)("path", { d: "M36.9695 43.5472L57.9905 61.4907C58.7271 60.4813 59.1631 59.2386 59.1631 57.8935V29.1306L36.9685 43.5472H36.9695Z", fill: "#FFF4CC" }), (0, jsx_runtime_1.jsx)("path", { d: "M0.835693 57.8925V57.8067L22.4146 42.7992L29.9994 37.5244L37.5842 42.7992L59.1641 57.8067V57.8925C59.1641 61.2665 56.4296 64 53.0566 64H6.94323C3.57024 64 0.835693 61.2665 0.835693 57.8925Z", fill: "#FFE072" }), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("path", { d: "M22.1563 42.978L0.835693 57.8067V56.6993L22.1563 42.978Z", fill: "#FEF07C" }) }), (0, jsx_runtime_1.jsx)("g", { children: (0, jsx_runtime_1.jsx)("path", { d: "M37.8425 42.978L59.1631 57.8067V56.6993L37.8425 42.978Z", fill: "#FEF07C" }) }), (0, jsx_runtime_1.jsx)("path", { d: "M37.8037 32.2373C42.1136 27.9273 42.1136 20.9395 37.8037 16.6295C33.4937 12.3196 26.5059 12.3196 22.196 16.6295C17.886 20.9395 17.886 27.9273 22.196 32.2373C26.5059 36.5472 33.4937 36.5472 37.8037 32.2373Z", fill: "#0066CC" }), (0, jsx_runtime_1.jsx)("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" })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "pf-chatbot__feedback-complete-text", children: [(0, jsx_runtime_1.jsx)(react_core_1.CardTitle, { className: "pf-chatbot__feedback-complete-title", children: title }), (0, jsx_runtime_1.jsx)(react_core_1.CardBody, { className: `pf-chatbot__feedback-complete-card-body`, children: body })] })] })] })) })));
|
|
92
92
|
};
|
|
93
|
-
exports.
|
|
93
|
+
exports.UserFeedbackComplete = UserFeedbackComplete;
|
|
94
|
+
exports.default = exports.UserFeedbackComplete;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./UserFeedback"), exports);
|
|
18
|
+
__exportStar(require("./UserFeedbackComplete"), exports);
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export { default } from './Message';
|
|
2
2
|
export { rehypeCodeBlockToggle } from './Plugins/rehypeCodeBlockToggle';
|
|
3
|
+
export * from './ErrorMessage/ErrorMessage';
|
|
4
|
+
export * from './MessageAndActions';
|
|
5
|
+
export * from './MessageAttachments';
|
|
3
6
|
export * from './Message';
|
|
7
|
+
export * from './MessageLoading';
|
|
8
|
+
export * from './MessageInput';
|
|
9
|
+
export * from './QuickResponse';
|
|
10
|
+
export * from './QuickStarts';
|
|
11
|
+
export * from './UserFeedback';
|
|
@@ -22,4 +22,12 @@ var Message_1 = require("./Message");
|
|
|
22
22
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Message_1).default; } });
|
|
23
23
|
var rehypeCodeBlockToggle_1 = require("./Plugins/rehypeCodeBlockToggle");
|
|
24
24
|
Object.defineProperty(exports, "rehypeCodeBlockToggle", { enumerable: true, get: function () { return rehypeCodeBlockToggle_1.rehypeCodeBlockToggle; } });
|
|
25
|
+
__exportStar(require("./ErrorMessage/ErrorMessage"), exports);
|
|
26
|
+
__exportStar(require("./MessageAndActions"), exports);
|
|
27
|
+
__exportStar(require("./MessageAttachments"), exports);
|
|
25
28
|
__exportStar(require("./Message"), exports);
|
|
29
|
+
__exportStar(require("./MessageLoading"), exports);
|
|
30
|
+
__exportStar(require("./MessageInput"), exports);
|
|
31
|
+
__exportStar(require("./QuickResponse"), exports);
|
|
32
|
+
__exportStar(require("./QuickStarts"), exports);
|
|
33
|
+
__exportStar(require("./UserFeedback"), exports);
|
|
@@ -40,6 +40,8 @@ export interface MessageBarProps extends Omit<TextAreaProps, 'innerRef'> {
|
|
|
40
40
|
placeholder?: string;
|
|
41
41
|
/** Flag to disable/enable the Attach button */
|
|
42
42
|
hasAttachButton?: boolean;
|
|
43
|
+
/** Whether the attach button is rendered before or after the message input. */
|
|
44
|
+
attachButtonPosition?: 'start' | 'end';
|
|
43
45
|
/** Flag to enable the Microphone button */
|
|
44
46
|
hasMicrophoneButton?: boolean;
|
|
45
47
|
/** Placeholder text when listening */
|
|
@@ -111,6 +113,10 @@ export interface MessageBarProps extends Omit<TextAreaProps, 'innerRef'> {
|
|
|
111
113
|
innerRef?: React.Ref<HTMLTextAreaElement>;
|
|
112
114
|
/** Sets background color to primary */
|
|
113
115
|
isPrimary?: boolean;
|
|
116
|
+
/** Additional actions to render for the message bar. This will force a multiline layout, and the actions will render at the start of the container. */
|
|
117
|
+
additionalActions?: React.ReactNode;
|
|
118
|
+
/** Flag indicating whether a multiline layout for the message input and actions should be forced. This can be used to always render actions below the message input. */
|
|
119
|
+
forceMultilineLayout?: boolean;
|
|
114
120
|
/** @beta Flag indicating whether the message bar has an AI indicator border. */
|
|
115
121
|
hasAiIndicator?: boolean;
|
|
116
122
|
/** @beta Flag indicating whether the chatbot is thinking in response to a query, adding an animation to the message bar. */
|
|
@@ -27,14 +27,15 @@ const AttachMenu_1 = __importDefault(require("../AttachMenu"));
|
|
|
27
27
|
const StopButton_1 = __importDefault(require("./StopButton"));
|
|
28
28
|
const MessageBarBase = (_a) => {
|
|
29
29
|
var _b;
|
|
30
|
-
var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value, isCompact = false, allowedFileTypes, minSize, maxSize, maxFiles, isAttachmentDisabled, onAttach, onAttachRejected, validator, dropzoneProps, innerRef, isPrimary, hasAiIndicator, isThinking } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value", "isCompact", "allowedFileTypes", "minSize", "maxSize", "maxFiles", "isAttachmentDisabled", "onAttach", "onAttachRejected", "validator", "dropzoneProps", "innerRef", "isPrimary", "hasAiIndicator", "isThinking"]);
|
|
30
|
+
var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, attachButtonPosition = 'end', hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value, isCompact = false, allowedFileTypes, minSize, maxSize, maxFiles, isAttachmentDisabled, onAttach, onAttachRejected, validator, dropzoneProps, innerRef, isPrimary, additionalActions, forceMultilineLayout = false, hasAiIndicator, isThinking } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "attachButtonPosition", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value", "isCompact", "allowedFileTypes", "minSize", "maxSize", "maxFiles", "isAttachmentDisabled", "onAttach", "onAttachRejected", "validator", "dropzoneProps", "innerRef", "isPrimary", "additionalActions", "forceMultilineLayout", "hasAiIndicator", "isThinking"]);
|
|
31
31
|
// Text Input
|
|
32
32
|
// --------------------------------------------------------------------------
|
|
33
33
|
const [message, setMessage] = (0, react_1.useState)(value !== null && value !== void 0 ? value : '');
|
|
34
34
|
const [isListeningMessage, setIsListeningMessage] = (0, react_1.useState)(false);
|
|
35
35
|
const [hasSentMessage, setHasSentMessage] = (0, react_1.useState)(false);
|
|
36
36
|
const [isComposing, setIsComposing] = (0, react_1.useState)(false);
|
|
37
|
-
const
|
|
37
|
+
const shouldForceMultiline = forceMultilineLayout || additionalActions;
|
|
38
|
+
const [isMultiline, setIsMultiline] = (0, react_1.useState)(shouldForceMultiline);
|
|
38
39
|
const inputRef = (0, react_1.useRef)(null);
|
|
39
40
|
const textareaRef = (_b = innerRef) !== null && _b !== void 0 ? _b : inputRef;
|
|
40
41
|
const attachButtonRef = (0, react_1.useRef)(null);
|
|
@@ -48,7 +49,7 @@ const MessageBarBase = (_a) => {
|
|
|
48
49
|
parent.style.setProperty('height', 'inherit');
|
|
49
50
|
const grandparent = parent.parentElement;
|
|
50
51
|
if (grandparent) {
|
|
51
|
-
grandparent.style.setProperty('flex-basis', 'auto');
|
|
52
|
+
grandparent.style.setProperty('flex-basis', shouldForceMultiline ? '100%' : 'auto');
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
};
|
|
@@ -88,7 +89,7 @@ const MessageBarBase = (_a) => {
|
|
|
88
89
|
const parent = field.parentElement;
|
|
89
90
|
if (parent) {
|
|
90
91
|
const grandparent = parent.parentElement;
|
|
91
|
-
if (textIsLongerThan2Lines(field) && grandparent) {
|
|
92
|
+
if ((textIsLongerThan2Lines(field) || shouldForceMultiline) && grandparent) {
|
|
92
93
|
grandparent.style.setProperty('flex-basis', `100%`);
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -136,15 +137,15 @@ const MessageBarBase = (_a) => {
|
|
|
136
137
|
if (field) {
|
|
137
138
|
if (field.value === '') {
|
|
138
139
|
setInitialLineHeight(field);
|
|
139
|
-
setIsMultiline(false);
|
|
140
|
+
!shouldForceMultiline && setIsMultiline(false);
|
|
140
141
|
}
|
|
141
142
|
else {
|
|
142
143
|
setAutoHeight(field);
|
|
143
144
|
setAutoWidth(field);
|
|
144
|
-
checkIfMultiline(field);
|
|
145
|
+
!shouldForceMultiline && checkIfMultiline(field);
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
|
-
}, [displayMode, message, setAutoWidth, checkIfMultiline]);
|
|
148
|
+
}, [displayMode, message, setAutoWidth, shouldForceMultiline, checkIfMultiline]);
|
|
148
149
|
(0, react_1.useEffect)(() => {
|
|
149
150
|
const field = textareaRef.current;
|
|
150
151
|
if (field) {
|
|
@@ -157,11 +158,11 @@ const MessageBarBase = (_a) => {
|
|
|
157
158
|
if (textareaRef.current) {
|
|
158
159
|
if (event.target.value === '') {
|
|
159
160
|
setInitialLineHeight(textareaRef.current);
|
|
160
|
-
setIsMultiline(false);
|
|
161
|
+
!shouldForceMultiline && setIsMultiline(false);
|
|
161
162
|
}
|
|
162
163
|
else {
|
|
163
164
|
setAutoHeight(textareaRef.current);
|
|
164
|
-
checkIfMultiline(textareaRef.current);
|
|
165
|
+
!shouldForceMultiline && checkIfMultiline(textareaRef.current);
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
setMessage(event.target.value);
|
|
@@ -207,14 +208,25 @@ const MessageBarBase = (_a) => {
|
|
|
207
208
|
setMessage(message);
|
|
208
209
|
onChange && onChange({}, message);
|
|
209
210
|
};
|
|
211
|
+
const renderAttachButton = () => {
|
|
212
|
+
var _a, _b, _c, _d, _e, _f;
|
|
213
|
+
if (!attachMenuProps && hasAttachButton) {
|
|
214
|
+
return ((0, jsx_runtime_1.jsx)(AttachButton_1.AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _a === void 0 ? void 0 : _a.tooltipContent, inputTestId: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _b === void 0 ? void 0 : _b.inputTestId, isCompact: isCompact, tooltipProps: (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _c === void 0 ? void 0 : _c.tooltipProps, allowedFileTypes: allowedFileTypes, minSize: minSize, maxSize: maxSize, maxFiles: maxFiles, isAttachmentDisabled: isAttachmentDisabled, onAttach: onAttach, onAttachRejected: onAttachRejected, validator: validator, dropzoneProps: dropzoneProps }, buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach, (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.props)));
|
|
215
|
+
}
|
|
216
|
+
if (attachMenuProps) {
|
|
217
|
+
return ((0, jsx_runtime_1.jsx)(AttachButton_1.AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipContent, isCompact: isCompact, tooltipProps: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.tooltipProps, allowedFileTypes: allowedFileTypes, minSize: minSize, maxSize: maxSize, maxFiles: maxFiles, isAttachmentDisabled: isAttachmentDisabled, onAttach: onAttach, onAttachRejected: onAttachRejected, validator: validator, dropzoneProps: dropzoneProps }, buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach)));
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const isAttachButtonAtStart = attachButtonPosition === 'start';
|
|
210
221
|
const renderButtons = () => {
|
|
211
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
222
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
212
223
|
if (hasStopButton && handleStopButton) {
|
|
213
224
|
return ((0, jsx_runtime_1.jsx)(StopButton_1.default, 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, tooltipProps: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.tooltipProps }, (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _c === void 0 ? void 0 : _c.props)));
|
|
214
225
|
}
|
|
215
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [
|
|
226
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isAttachButtonAtStart && renderAttachButton(), hasMicrophoneButton && ((0, jsx_runtime_1.jsx)(MicrophoneButton_1.default, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _d === void 0 ? void 0 : _d.tooltipContent, language: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _e === void 0 ? void 0 : _e.language, isCompact: isCompact, tooltipProps: (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _f === void 0 ? void 0 : _f.tooltipProps }, (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _g === void 0 ? void 0 : _g.props))), (alwayShowSendButton || message) && ((0, jsx_runtime_1.jsx)(SendButton_1.default, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _h === void 0 ? void 0 : _h.tooltipContent, isCompact: isCompact, tooltipProps: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _j === void 0 ? void 0 : _j.tooltipProps }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _k === void 0 ? void 0 : _k.props)))] }));
|
|
216
227
|
};
|
|
217
|
-
const
|
|
228
|
+
const hasGroupedActions = additionalActions || (isAttachButtonAtStart && isMultiline);
|
|
229
|
+
const messageBarContents = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isAttachButtonAtStart && !isMultiline && ((0, jsx_runtime_1.jsx)("div", { className: "pf-chatbot__message-bar-actions test", children: renderAttachButton() })), (0, jsx_runtime_1.jsx)("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}`, children: (0, jsx_runtime_1.jsx)(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, onCompositionStart: handleCompositionStart, onCompositionEnd: handleCompositionEnd }, props)) }), (0, jsx_runtime_1.jsx)("div", { className: (0, react_styles_1.css)('pf-chatbot__message-bar-actions', hasGroupedActions && 'pf-m-grouped'), children: hasGroupedActions ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: (0, react_styles_1.css)('pf-chatbot__message-bar-actions-group'), children: [isAttachButtonAtStart && renderAttachButton(), additionalActions] }), (0, jsx_runtime_1.jsx)("div", { className: (0, react_styles_1.css)('pf-chatbot__message-bar-actions-group'), children: renderButtons() })] })) : (renderButtons()) })] }));
|
|
218
230
|
if (attachMenuProps) {
|
|
219
231
|
return ((0, jsx_runtime_1.jsx)(AttachMenu_1.default, Object.assign({ toggle: (toggleRef) => ((0, jsx_runtime_1.jsx)("div", { ref: toggleRef, className: (0, react_styles_1.css)('pf-chatbot__message-bar', isMultiline && 'pf-m-multiline', className), children: messageBarContents })), filteredItems: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.attachMenuItems }, (attachMenuProps && { isOpen: attachMenuProps.isAttachMenuOpen }), { onOpenChange: (isAttachMenuOpen) => {
|
|
220
232
|
var _a;
|
|
@@ -331,4 +331,16 @@ describe('Message bar', () => {
|
|
|
331
331
|
(0, react_1.render)((0, jsx_runtime_1.jsx)(MessageBar_1.MessageBar, { onSendMessage: jest.fn, isThinking: true }));
|
|
332
332
|
expect(react_1.screen.getByRole('textbox').closest('.pf-chatbot__message-bar')).toHaveClass('pf-v6-m-thinking');
|
|
333
333
|
});
|
|
334
|
+
it('Renders with flex-basis of auto by default', () => {
|
|
335
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(MessageBar_1.MessageBar, { onSendMessage: jest.fn }));
|
|
336
|
+
expect(react_1.screen.getByRole('textbox').closest('.pf-chatbot__message-bar-input')).toHaveAttribute('style', 'flex-basis: auto;');
|
|
337
|
+
});
|
|
338
|
+
it('Renders with flex-basis of 100% when forceMultilineLayout is true', () => {
|
|
339
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(MessageBar_1.MessageBar, { forceMultilineLayout: true, onSendMessage: jest.fn }));
|
|
340
|
+
expect(react_1.screen.getByRole('textbox').closest('.pf-chatbot__message-bar-input')).toHaveAttribute('style', 'flex-basis: 100%;');
|
|
341
|
+
});
|
|
342
|
+
it('Renders with flex-basis of 100% when additionalActions is truthy', () => {
|
|
343
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(MessageBar_1.MessageBar, { additionalActions: "actions", onSendMessage: jest.fn }));
|
|
344
|
+
expect(react_1.screen.getByRole('textbox').closest('.pf-chatbot__message-bar-input')).toHaveAttribute('style', 'flex-basis: 100%;');
|
|
345
|
+
});
|
|
334
346
|
});
|
|
@@ -29,6 +29,10 @@ export interface ActionProps extends Omit<ButtonProps, 'ref'> {
|
|
|
29
29
|
type ExtendedActionProps = ActionProps & {
|
|
30
30
|
[key: string]: any;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* The various actions that can be attached to a bot message for users to interact with.
|
|
34
|
+
* Use this component when passing children to Message to customize its structure.
|
|
35
|
+
*/
|
|
32
36
|
export interface ResponseActionProps {
|
|
33
37
|
/** Props for message actions, such as feedback (positive or negative), copy button, share, and listen */
|
|
34
38
|
actions: Record<string, ExtendedActionProps | undefined> & {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The container for grouping multiple related ResponseActions components, typically used for having different persistence states amongst groups.
|
|
4
|
+
* Use this component when passing children to Message to customize its structure.
|
|
5
|
+
*/
|
|
6
|
+
export interface ResponseActionsGroupsProps extends HTMLProps<HTMLDivElement> {
|
|
7
|
+
/** Content to render inside the response actions groups container */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Additional classes applied to the response actions groups container. */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const ResponseActionsGroups: FunctionComponent<ResponseActionsGroupsProps>;
|
|
13
|
+
export default ResponseActionsGroups;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.ResponseActionsGroups = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_styles_1 = require("@patternfly/react-styles");
|
|
17
|
+
const ResponseActionsGroups = (_a) => {
|
|
18
|
+
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, react_styles_1.css)('pf-chatbot__response-actions-groups', className) }, props, { children: children })));
|
|
20
|
+
};
|
|
21
|
+
exports.ResponseActionsGroups = ResponseActionsGroups;
|
|
22
|
+
exports.default = exports.ResponseActionsGroups;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
require("@testing-library/jest-dom");
|
|
8
|
+
const react_1 = require("@testing-library/react");
|
|
9
|
+
const ResponseActionsGroups_1 = __importDefault(require("./ResponseActionsGroups"));
|
|
10
|
+
test('Renders with children', () => {
|
|
11
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionsGroups_1.default, { children: "Test content" }));
|
|
12
|
+
expect(react_1.screen.getByText('Test content')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
test('Renders with pf-chatbot__response-actions-groups class by default', () => {
|
|
15
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionsGroups_1.default, { children: "Test content" }));
|
|
16
|
+
expect(react_1.screen.getByText('Test content')).toHaveClass('pf-chatbot__response-actions-groups', { exact: true });
|
|
17
|
+
});
|
|
18
|
+
test('Renders with custom className', () => {
|
|
19
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionsGroups_1.default, { className: "custom-class", children: "Test content" }));
|
|
20
|
+
expect(react_1.screen.getByText('Test content')).toHaveClass('custom-class');
|
|
21
|
+
});
|
|
22
|
+
test('Spreads additional props', () => {
|
|
23
|
+
(0, react_1.render)((0, jsx_runtime_1.jsx)(ResponseActionsGroups_1.default, { id: "test-id", children: "Test content" }));
|
|
24
|
+
expect(react_1.screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
|
|
25
|
+
});
|
|
@@ -21,3 +21,4 @@ exports.default = void 0;
|
|
|
21
21
|
var ResponseActions_1 = require("./ResponseActions");
|
|
22
22
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ResponseActions_1).default; } });
|
|
23
23
|
__exportStar(require("./ResponseActions"), exports);
|
|
24
|
+
__exportStar(require("./ResponseActionsGroups"), exports);
|
package/dist/css/main.css
CHANGED
|
@@ -2262,6 +2262,17 @@ li[id*=user-content-fn-]:has(> span > span > .pf-chatbot__message-text + .pf-cha
|
|
|
2262
2262
|
padding-block-end: var(--pf-t--global--spacer--xs);
|
|
2263
2263
|
gap: var(--pf-t--global--spacer--gap--action-to-action--plain);
|
|
2264
2264
|
}
|
|
2265
|
+
.pf-chatbot__message-bar-actions.pf-m-grouped {
|
|
2266
|
+
flex-basis: 100%;
|
|
2267
|
+
justify-content: space-between;
|
|
2268
|
+
}
|
|
2269
|
+
.pf-chatbot__message-bar-actions-group {
|
|
2270
|
+
display: flex;
|
|
2271
|
+
padding-block-start: var(--pf-t--global--spacer--xs);
|
|
2272
|
+
padding-block-end: var(--pf-t--global--spacer--xs);
|
|
2273
|
+
gap: var(--pf-t--global--spacer--gap--action-to-action--plain);
|
|
2274
|
+
align-items: center;
|
|
2275
|
+
}
|
|
2265
2276
|
.pf-chatbot__message-bar-input {
|
|
2266
2277
|
flex: 1 1 auto;
|
|
2267
2278
|
padding-block-start: var(--pf-t--global--spacer--sm);
|
|
@@ -2334,7 +2345,8 @@ li[id*=user-content-fn-]:has(> span > span > .pf-chatbot__message-text + .pf-cha
|
|
|
2334
2345
|
font-size: var(--pf-t--global--font--size--sm) !important;
|
|
2335
2346
|
}
|
|
2336
2347
|
|
|
2337
|
-
.pf-m-compact .pf-chatbot__message-bar-actions
|
|
2348
|
+
.pf-m-compact .pf-chatbot__message-bar-actions,
|
|
2349
|
+
.pf-m-compact .pf-chatbot__message-bar-actions-group {
|
|
2338
2350
|
padding-block-start: var(--pf-t--global--spacer--sm);
|
|
2339
2351
|
padding-block-end: var(--pf-t--global--spacer--sm);
|
|
2340
2352
|
}
|