@patternfly/chatbot 2.1.0 → 2.2.0-prerelease.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Chatbot/Chatbot.js +0 -9
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +5 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +4 -4
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +3 -3
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.js +14 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +2 -2
- package/dist/cjs/ChatbotHeader/index.d.ts +1 -0
- package/dist/cjs/ChatbotHeader/index.js +1 -0
- package/dist/cjs/CodeModal/CodeModal.js +2 -12
- package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +1 -1
- package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -2
- package/dist/cjs/Message/Message.d.ts +16 -6
- package/dist/cjs/Message/Message.js +6 -6
- package/dist/cjs/Message/Message.test.js +51 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.d.ts +15 -0
- package/dist/cjs/Message/QuickResponse/QuickResponse.js +33 -0
- package/dist/cjs/Message/QuickStarts/FallbackImg.d.ts +13 -0
- package/dist/cjs/Message/QuickStarts/FallbackImg.js +34 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +27 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTile.js +82 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.js +64 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +76 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
- package/dist/cjs/Message/QuickStarts/QuickStartTileHeader.js +30 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +77 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
- package/dist/cjs/Message/QuickStarts/monitor-sampleapp-quickstart.js +77 -0
- package/dist/cjs/Message/QuickStarts/types.d.ts +132 -0
- package/dist/cjs/Message/QuickStarts/types.js +17 -0
- package/dist/cjs/MessageBar/SendButton.js +1 -1
- package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +6 -0
- package/dist/cjs/ResponseActions/ResponseActionButton.js +10 -2
- package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +1 -0
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +54 -0
- package/dist/cjs/ResponseActions/ResponseActions.d.ts +4 -0
- package/dist/cjs/ResponseActions/ResponseActions.js +26 -9
- package/dist/cjs/ResponseActions/ResponseActions.test.js +79 -5
- package/dist/cjs/Settings/SettingsForm.d.ts +13 -0
- package/dist/cjs/Settings/SettingsForm.js +27 -0
- package/dist/cjs/Settings/index.d.ts +2 -0
- package/dist/cjs/Settings/index.js +23 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +34 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.js +49 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +1 -0
- package/dist/cjs/TermsOfUse/TermsOfUse.test.js +79 -0
- package/dist/cjs/TermsOfUse/index.d.ts +2 -0
- package/dist/cjs/TermsOfUse/index.js +23 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +7 -1
- package/dist/css/main.css +191 -30
- package/dist/css/main.css.map +1 -1
- package/dist/dynamic/Settings/package.json +1 -0
- package/dist/dynamic/TermsOfUse/package.json +1 -0
- package/dist/esm/Chatbot/Chatbot.js +0 -9
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +5 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +4 -4
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +3 -3
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.d.ts +17 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.js +8 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +2 -0
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +2 -2
- package/dist/esm/ChatbotHeader/index.d.ts +1 -0
- package/dist/esm/ChatbotHeader/index.js +1 -0
- package/dist/esm/CodeModal/CodeModal.js +2 -12
- package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +1 -1
- package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -2
- package/dist/esm/Message/Message.d.ts +16 -6
- package/dist/esm/Message/Message.js +7 -7
- package/dist/esm/Message/Message.test.js +51 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.d.ts +15 -0
- package/dist/esm/Message/QuickResponse/QuickResponse.js +26 -0
- package/dist/esm/Message/QuickStarts/FallbackImg.d.ts +13 -0
- package/dist/esm/Message/QuickStarts/FallbackImg.js +9 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +27 -0
- package/dist/esm/Message/QuickStarts/QuickStartTile.js +52 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.d.ts +23 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.js +35 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +1 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +48 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileHeader.d.ts +11 -0
- package/dist/esm/Message/QuickStarts/QuickStartTileHeader.js +5 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.d.ts +30 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.js +74 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.d.ts +30 -0
- package/dist/esm/Message/QuickStarts/monitor-sampleapp-quickstart.js +74 -0
- package/dist/esm/Message/QuickStarts/types.d.ts +132 -0
- package/dist/esm/Message/QuickStarts/types.js +14 -0
- package/dist/esm/MessageBar/SendButton.js +1 -1
- package/dist/esm/ResponseActions/ResponseActionButton.d.ts +6 -0
- package/dist/esm/ResponseActions/ResponseActionButton.js +10 -2
- package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +1 -0
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +49 -0
- package/dist/esm/ResponseActions/ResponseActions.d.ts +4 -0
- package/dist/esm/ResponseActions/ResponseActions.js +26 -9
- package/dist/esm/ResponseActions/ResponseActions.test.js +79 -5
- package/dist/esm/Settings/SettingsForm.d.ts +13 -0
- package/dist/esm/Settings/SettingsForm.js +20 -0
- package/dist/esm/Settings/index.d.ts +2 -0
- package/dist/esm/Settings/index.js +2 -0
- package/dist/esm/TermsOfUse/TermsOfUse.d.ts +34 -0
- package/dist/esm/TermsOfUse/TermsOfUse.js +42 -0
- package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +1 -0
- package/dist/esm/TermsOfUse/TermsOfUse.test.js +74 -0
- package/dist/esm/TermsOfUse/index.d.ts +2 -0
- package/dist/esm/TermsOfUse/index.js +2 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -13
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +4 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +31 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +26 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/explore-pipeline-quickstart.ts +65 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerNavigation.tsx +67 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +78 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarDisabled.tsx +26 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-TermsAndConditionsHeader.svg +148 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +289 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/SquareChatbotToggle.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +147 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +56 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +20 -19
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -2
- package/src/Chatbot/Chatbot.scss +0 -10
- package/src/Chatbot/Chatbot.tsx +0 -9
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +14 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +3 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +11 -3
- package/src/ChatbotFooter/ChatbotFooter.scss +2 -1
- package/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx +51 -0
- package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +5 -2
- package/src/ChatbotHeader/index.ts +1 -0
- package/src/CodeModal/CodeModal.scss +8 -0
- package/src/CodeModal/CodeModal.tsx +2 -13
- package/src/FileDropZone/__snapshots__/FileDropZone.test.tsx.snap +1 -1
- package/src/Message/ListMessage/OrderedListMessage.tsx +2 -2
- package/src/Message/Message.scss +0 -14
- package/src/Message/Message.test.tsx +76 -0
- package/src/Message/Message.tsx +35 -26
- package/src/Message/QuickResponse/QuickResponse.scss +33 -0
- package/src/Message/QuickResponse/QuickResponse.tsx +50 -0
- package/src/Message/QuickStarts/FallbackImg.tsx +24 -0
- package/src/Message/QuickStarts/QuickStartTile.scss +25 -0
- package/src/Message/QuickStarts/QuickStartTile.tsx +147 -0
- package/src/Message/QuickStarts/QuickStartTileDescription.test.tsx +57 -0
- package/src/Message/QuickStarts/QuickStartTileDescription.tsx +81 -0
- package/src/Message/QuickStarts/QuickStartTileHeader.tsx +21 -0
- package/src/Message/QuickStarts/monitor-sampleapp-quickstart-with-image.ts +75 -0
- package/src/Message/QuickStarts/monitor-sampleapp-quickstart.ts +75 -0
- package/src/Message/QuickStarts/types.ts +154 -0
- package/src/MessageBar/SendButton.scss +24 -0
- package/src/MessageBar/SendButton.tsx +1 -1
- package/src/ResponseActions/ResponseActionButton.test.tsx +52 -0
- package/src/ResponseActions/ResponseActionButton.tsx +46 -27
- package/src/ResponseActions/ResponseActions.scss +10 -8
- package/src/ResponseActions/ResponseActions.test.tsx +103 -5
- package/src/ResponseActions/ResponseActions.tsx +54 -7
- package/src/Settings/Settings.scss +34 -0
- package/src/Settings/SettingsForm.tsx +25 -0
- package/src/Settings/index.ts +3 -0
- package/src/TermsOfUse/TermsOfUse.scss +66 -0
- package/src/TermsOfUse/TermsOfUse.test.tsx +138 -0
- package/src/TermsOfUse/TermsOfUse.tsx +117 -0
- package/src/TermsOfUse/index.ts +3 -0
- package/src/index.ts +6 -0
- package/src/main.scss +7 -3
@@ -0,0 +1,64 @@
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.pluralizeWord = pluralizeWord;
|
30
|
+
const React = __importStar(require("react"));
|
31
|
+
const react_core_1 = require("@patternfly/react-core");
|
32
|
+
const info_circle_icon_1 = __importDefault(require("@patternfly/react-icons/dist/js/icons/info-circle-icon"));
|
33
|
+
/** This function is a helper for pluralizing strings stolen from React.
|
34
|
+
*
|
35
|
+
* @param {number} i The quantity of the string you want to pluralize
|
36
|
+
* @param {string} singular The singular version of the string
|
37
|
+
* @param {string} plural The change to the string that should occur if the quantity is not equal to 1.
|
38
|
+
* Defaults to adding an 's'.
|
39
|
+
*/
|
40
|
+
function pluralizeWord(i, singular, plural) {
|
41
|
+
if (!plural) {
|
42
|
+
plural = `${singular}s`;
|
43
|
+
}
|
44
|
+
return `${i === 1 ? singular : plural}`;
|
45
|
+
}
|
46
|
+
const QuickStartTileDescription = ({ description, prerequisites, prerequisiteWord = 'Prerequisite', prerequisiteWordPlural = 'Prerequisites', quickStartButtonAriaLabel = 'Show prerequisites' }) => {
|
47
|
+
const prereqs = prerequisites === null || prerequisites === void 0 ? void 0 : prerequisites.filter((p) => p);
|
48
|
+
const buttonRef = React.useRef(null);
|
49
|
+
const pluralizedPrereq = pluralizeWord((prereqs === null || prereqs === void 0 ? void 0 : prereqs.length) || 0, prerequisiteWord, prerequisiteWordPlural);
|
50
|
+
return (React.createElement(React.Fragment, null,
|
51
|
+
description,
|
52
|
+
prereqs && prereqs.length > 0 && (React.createElement(react_core_1.Flex, { spaceItems: { default: 'spaceItemsSm' } },
|
53
|
+
React.createElement("h5", null, (0, react_core_1.pluralize)(prereqs.length, prerequisiteWord, prerequisiteWordPlural)),
|
54
|
+
React.createElement(react_core_1.Button, { variant: "link", isInline: true, "data-testid": "qs-card-prereqs", ref: buttonRef, onClick: (e) => {
|
55
|
+
e.preventDefault();
|
56
|
+
e.stopPropagation();
|
57
|
+
}, "aria-label": quickStartButtonAriaLabel },
|
58
|
+
React.createElement(info_circle_icon_1.default, null)),
|
59
|
+
React.createElement(react_core_1.Popover, { "aria-label": pluralizedPrereq, headerContent: pluralizedPrereq, triggerRef: buttonRef, bodyContent: React.createElement("div", null,
|
60
|
+
React.createElement("ul", { "aria-label": pluralizedPrereq }, prereqs.map((prerequisite, index) => (
|
61
|
+
// eslint-disable-next-line react/no-array-index-key
|
62
|
+
React.createElement("li", { key: index }, prerequisite))))) })))));
|
63
|
+
};
|
64
|
+
exports.default = QuickStartTileDescription;
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom';
|
@@ -0,0 +1,76 @@
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
|
+
});
|
33
|
+
};
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
36
|
+
};
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
38
|
+
const react_1 = __importDefault(require("react"));
|
39
|
+
const react_2 = require("@testing-library/react");
|
40
|
+
require("@testing-library/jest-dom");
|
41
|
+
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
42
|
+
const monitor_sampleapp_quickstart_1 = require("./monitor-sampleapp-quickstart");
|
43
|
+
const QuickStartTileDescription_1 = __importStar(require("./QuickStartTileDescription"));
|
44
|
+
describe('pluralizeWord function', () => {
|
45
|
+
it('should render no plural correctly', () => {
|
46
|
+
expect((0, QuickStartTileDescription_1.pluralizeWord)(2, 'pizza')).toBe('pizzas');
|
47
|
+
});
|
48
|
+
});
|
49
|
+
describe('QuickStart tile description', () => {
|
50
|
+
it('should render no prereqs correctly', () => {
|
51
|
+
(0, react_2.render)(react_1.default.createElement(QuickStartTileDescription_1.default, { description: monitor_sampleapp_quickstart_1.monitorSampleAppQuickStart.spec.description }));
|
52
|
+
expect(react_2.screen.queryByRole('heading')).toBeFalsy();
|
53
|
+
});
|
54
|
+
it('should render singular prereq correctly', () => {
|
55
|
+
(0, react_2.render)(react_1.default.createElement(QuickStartTileDescription_1.default, { description: monitor_sampleapp_quickstart_1.monitorSampleAppQuickStart.spec.description, prerequisites: [`You completed the "Getting started with a sample" quick start.`] }));
|
56
|
+
expect(react_2.screen.getByRole('heading', { name: /1 Prerequisite/i })).toBeTruthy();
|
57
|
+
expect(react_2.screen.getByRole('button', { name: /Show prerequisite/i })).toBeTruthy();
|
58
|
+
});
|
59
|
+
it('should render plural prereq correctly', () => {
|
60
|
+
(0, react_2.render)(react_1.default.createElement(QuickStartTileDescription_1.default, { description: monitor_sampleapp_quickstart_1.monitorSampleAppQuickStart.spec.description, prerequisites: [
|
61
|
+
`You completed the "Getting started with a sample" quick start.`,
|
62
|
+
`You completed the app quick start`
|
63
|
+
] }));
|
64
|
+
expect(react_2.screen.getByRole('heading', { name: /2 Prerequisites/i })).toBeTruthy();
|
65
|
+
expect(react_2.screen.getByRole('button', { name: /Show prerequisites/i })).toBeTruthy();
|
66
|
+
});
|
67
|
+
it('should be able to click prereqs link', () => __awaiter(void 0, void 0, void 0, function* () {
|
68
|
+
(0, react_2.render)(react_1.default.createElement(QuickStartTileDescription_1.default, { description: monitor_sampleapp_quickstart_1.monitorSampleAppQuickStart.spec.description, prerequisites: [`You completed the "Getting started with a sample" quick start.`] }));
|
69
|
+
const button = react_2.screen.getByRole('button', { name: /Show prerequisites/i });
|
70
|
+
expect(react_2.screen.queryByRole('dialog', { name: /Prerequisite/i })).toBeFalsy();
|
71
|
+
yield user_event_1.default.click(button);
|
72
|
+
expect(react_2.screen.getByRole('dialog', { name: /Prerequisite/i })).toBeTruthy();
|
73
|
+
expect(react_2.screen.getByRole('button', { name: /Close/i })).toBeTruthy();
|
74
|
+
expect(react_2.screen.getByText(/You completed the "Getting started with a sample" quick start./i)).toBeTruthy();
|
75
|
+
}));
|
76
|
+
});
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
interface QuickStartTileHeaderProps {
|
3
|
+
/** Name for the header */
|
4
|
+
name: string;
|
5
|
+
/** Id for the QuickStart */
|
6
|
+
quickStartId?: string;
|
7
|
+
/** Callback for when the name of the QuickStart is clicked */
|
8
|
+
onSelect: (e: React.FormEvent<HTMLInputElement> | React.MouseEvent<Element, MouseEvent>) => void;
|
9
|
+
}
|
10
|
+
declare const QuickStartTileHeader: React.FC<QuickStartTileHeaderProps>;
|
11
|
+
export default QuickStartTileHeader;
|
@@ -0,0 +1,30 @@
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
const React = __importStar(require("react"));
|
27
|
+
const react_core_1 = require("@patternfly/react-core");
|
28
|
+
const QuickStartTileHeader = ({ name, quickStartId, onSelect }) => (React.createElement(react_core_1.Flex, { flexWrap: { default: 'nowrap' } },
|
29
|
+
React.createElement(react_core_1.Button, { "data-test": "title", id: quickStartId, variant: "link", isInline: true, onClick: onSelect }, name)));
|
30
|
+
exports.default = QuickStartTileHeader;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export declare const monitorSampleAppQuickStartWithImage: {
|
2
|
+
apiVersion: string;
|
3
|
+
kind: string;
|
4
|
+
metadata: {
|
5
|
+
name: string;
|
6
|
+
};
|
7
|
+
spec: {
|
8
|
+
icon: string;
|
9
|
+
version: number;
|
10
|
+
displayName: string;
|
11
|
+
durationMinutes: number;
|
12
|
+
description: string;
|
13
|
+
prerequisites: string[];
|
14
|
+
introduction: string;
|
15
|
+
tasks: {
|
16
|
+
title: string;
|
17
|
+
description: string;
|
18
|
+
review: {
|
19
|
+
instructions: string;
|
20
|
+
failedTaskHelp: string;
|
21
|
+
};
|
22
|
+
summary: {
|
23
|
+
success: string;
|
24
|
+
failed: string;
|
25
|
+
};
|
26
|
+
}[];
|
27
|
+
conclusion: string;
|
28
|
+
nextQuickStart: string[];
|
29
|
+
};
|
30
|
+
};
|
@@ -0,0 +1,77 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.monitorSampleAppQuickStartWithImage = void 0;
|
4
|
+
exports.monitorSampleAppQuickStartWithImage = {
|
5
|
+
apiVersion: 'console.openshift.io/v1',
|
6
|
+
kind: 'QuickStarts',
|
7
|
+
metadata: {
|
8
|
+
name: 'monitor-sampleapp'
|
9
|
+
},
|
10
|
+
spec: {
|
11
|
+
icon: 'test.png', // this is only difference
|
12
|
+
version: 4.7,
|
13
|
+
displayName: 'Monitoring your sample application',
|
14
|
+
durationMinutes: 10,
|
15
|
+
description: `Now that you’ve created a sample application and added health checks, let’s monitor your application.`,
|
16
|
+
prerequisites: [`You completed the "Getting started with a sample" quick start.`],
|
17
|
+
introduction: `### This quick start shows you how to monitor your sample application.
|
18
|
+
You should have previously created the **sample-app** application and **nodejs-sample** deployment via the **Get started with a sample** quick start. If you haven't, you may be able to follow these tasks with any existing deployment.`,
|
19
|
+
tasks: [
|
20
|
+
{
|
21
|
+
title: `Viewing the monitoring details of your sample application`,
|
22
|
+
description: `### To view the details of your sample application:
|
23
|
+
1. Go to the project your sample application was created in.
|
24
|
+
2. In the **</> Developer** perspective, go to **Topology** view.
|
25
|
+
3. Click on the **nodejs-sample** deployment to view its details.
|
26
|
+
4. Click on the **Monitoring** tab in the side panel.
|
27
|
+
You can see context sensitive metrics and alerts in the **Monitoring** tab.`,
|
28
|
+
review: {
|
29
|
+
instructions: `#### To verify you can view the monitoring information:
|
30
|
+
1. Do you see a **Metrics** accordion in the side panel?
|
31
|
+
2. Do you see a **View monitoring dashboard** link in the **Metrics** accordion?
|
32
|
+
3. Do you see three charts in the **Metrics** accordion: **CPU Usage**, **Memory Usage** and **Receive Bandwidth**?`,
|
33
|
+
failedTaskHelp: `This task isn’t verified yet. Try the task again.`
|
34
|
+
},
|
35
|
+
summary: {
|
36
|
+
success: `You have learned how you can monitor your sample app!`,
|
37
|
+
failed: `Try the steps again.`
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
title: `Viewing your project monitoring dashboard`,
|
42
|
+
description: `### To view the project monitoring dashboard in the context of **nodejs-sample**:
|
43
|
+
1. Click on the **View monitoring dashboard** link in the side panel.
|
44
|
+
2. You can change the **Time Range** and **Refresh Interval** of the dashboard.
|
45
|
+
3. You can change the context of the dashboard as well by clicking on the drop-down list. Select a specific workload or **All Workloads** to view the dashboard in the context of the entire project.`,
|
46
|
+
review: {
|
47
|
+
instructions: `#### To verify that you are able to view the monitoring dashboard:
|
48
|
+
Do you see metrics charts in the dashboard?`,
|
49
|
+
failedTaskHelp: `This task isn’t verified yet. Try the task again.`
|
50
|
+
},
|
51
|
+
summary: {
|
52
|
+
success: `You have learned how to view the dashboard in the context of your sample app!`,
|
53
|
+
failed: `Try the steps again.`
|
54
|
+
}
|
55
|
+
},
|
56
|
+
{
|
57
|
+
title: `Viewing custom metrics`,
|
58
|
+
description: `### To view custom metrics:
|
59
|
+
1. Click on the **Metrics** tab of the **Monitoring** page.
|
60
|
+
2. Click the **Select Query** drop-down list to see the available queries.
|
61
|
+
3. Click on **Filesystem Usage** from the list to run the query.`,
|
62
|
+
review: {
|
63
|
+
instructions: `#### Verify you can see the chart associated with the query:
|
64
|
+
Do you see a chart displayed with filesystem usage for your project? Note: select **Custom Query** from the dropdown to create and run a custom query utilizing PromQL.
|
65
|
+
`,
|
66
|
+
failedTaskHelp: `This task isn’t verified yet. Try the task again.`
|
67
|
+
},
|
68
|
+
summary: {
|
69
|
+
success: `You have learned how to run a query!`,
|
70
|
+
failed: `Try the steps again.`
|
71
|
+
}
|
72
|
+
}
|
73
|
+
],
|
74
|
+
conclusion: `You have learned how to access workload monitoring and metrics!`,
|
75
|
+
nextQuickStart: [``]
|
76
|
+
}
|
77
|
+
};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export declare const monitorSampleAppQuickStart: {
|
2
|
+
apiVersion: string;
|
3
|
+
kind: string;
|
4
|
+
metadata: {
|
5
|
+
name: string;
|
6
|
+
};
|
7
|
+
spec: {
|
8
|
+
version: number;
|
9
|
+
displayName: string;
|
10
|
+
durationMinutes: number;
|
11
|
+
icon: string;
|
12
|
+
description: string;
|
13
|
+
prerequisites: string[];
|
14
|
+
introduction: string;
|
15
|
+
tasks: {
|
16
|
+
title: string;
|
17
|
+
description: string;
|
18
|
+
review: {
|
19
|
+
instructions: string;
|
20
|
+
failedTaskHelp: string;
|
21
|
+
};
|
22
|
+
summary: {
|
23
|
+
success: string;
|
24
|
+
failed: string;
|
25
|
+
};
|
26
|
+
}[];
|
27
|
+
conclusion: string;
|
28
|
+
nextQuickStart: string[];
|
29
|
+
};
|
30
|
+
};
|
@@ -0,0 +1,77 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.monitorSampleAppQuickStart = void 0;
|
4
|
+
exports.monitorSampleAppQuickStart = {
|
5
|
+
apiVersion: 'console.openshift.io/v1',
|
6
|
+
kind: 'QuickStarts',
|
7
|
+
metadata: {
|
8
|
+
name: 'monitor-sampleapp'
|
9
|
+
},
|
10
|
+
spec: {
|
11
|
+
version: 4.7,
|
12
|
+
displayName: 'Monitoring your sample application',
|
13
|
+
durationMinutes: 10,
|
14
|
+
icon: '',
|
15
|
+
description: `Now that you’ve created a sample application and added health checks, let’s monitor your application.`,
|
16
|
+
prerequisites: [`You completed the "Getting started with a sample" quick start.`],
|
17
|
+
introduction: `### This quick start shows you how to monitor your sample application.
|
18
|
+
You should have previously created the **sample-app** application and **nodejs-sample** deployment via the **Get started with a sample** quick start. If you haven't, you may be able to follow these tasks with any existing deployment.`,
|
19
|
+
tasks: [
|
20
|
+
{
|
21
|
+
title: `Viewing the monitoring details of your sample application`,
|
22
|
+
description: `### To view the details of your sample application:
|
23
|
+
1. Go to the project your sample application was created in.
|
24
|
+
2. In the **</> Developer** perspective, go to **Topology** view.
|
25
|
+
3. Click on the **nodejs-sample** deployment to view its details.
|
26
|
+
4. Click on the **Monitoring** tab in the side panel.
|
27
|
+
You can see context sensitive metrics and alerts in the **Monitoring** tab.`,
|
28
|
+
review: {
|
29
|
+
instructions: `#### To verify you can view the monitoring information:
|
30
|
+
1. Do you see a **Metrics** accordion in the side panel?
|
31
|
+
2. Do you see a **View monitoring dashboard** link in the **Metrics** accordion?
|
32
|
+
3. Do you see three charts in the **Metrics** accordion: **CPU Usage**, **Memory Usage** and **Receive Bandwidth**?`,
|
33
|
+
failedTaskHelp: `This task isn’t verified yet. Try the task again.`
|
34
|
+
},
|
35
|
+
summary: {
|
36
|
+
success: `You have learned how you can monitor your sample app!`,
|
37
|
+
failed: `Try the steps again.`
|
38
|
+
}
|
39
|
+
},
|
40
|
+
{
|
41
|
+
title: `Viewing your project monitoring dashboard`,
|
42
|
+
description: `### To view the project monitoring dashboard in the context of **nodejs-sample**:
|
43
|
+
1. Click on the **View monitoring dashboard** link in the side panel.
|
44
|
+
2. You can change the **Time Range** and **Refresh Interval** of the dashboard.
|
45
|
+
3. You can change the context of the dashboard as well by clicking on the drop-down list. Select a specific workload or **All Workloads** to view the dashboard in the context of the entire project.`,
|
46
|
+
review: {
|
47
|
+
instructions: `#### To verify that you are able to view the monitoring dashboard:
|
48
|
+
Do you see metrics charts in the dashboard?`,
|
49
|
+
failedTaskHelp: `This task isn’t verified yet. Try the task again.`
|
50
|
+
},
|
51
|
+
summary: {
|
52
|
+
success: `You have learned how to view the dashboard in the context of your sample app!`,
|
53
|
+
failed: `Try the steps again.`
|
54
|
+
}
|
55
|
+
},
|
56
|
+
{
|
57
|
+
title: `Viewing custom metrics`,
|
58
|
+
description: `### To view custom metrics:
|
59
|
+
1. Click on the **Metrics** tab of the **Monitoring** page.
|
60
|
+
2. Click the **Select Query** drop-down list to see the available queries.
|
61
|
+
3. Click on **Filesystem Usage** from the list to run the query.`,
|
62
|
+
review: {
|
63
|
+
instructions: `#### Verify you can see the chart associated with the query:
|
64
|
+
Do you see a chart displayed with filesystem usage for your project? Note: select **Custom Query** from the dropdown to create and run a custom query utilizing PromQL.
|
65
|
+
`,
|
66
|
+
failedTaskHelp: `This task isn’t verified yet. Try the task again.`
|
67
|
+
},
|
68
|
+
summary: {
|
69
|
+
success: `You have learned how to run a query!`,
|
70
|
+
failed: `Try the steps again.`
|
71
|
+
}
|
72
|
+
}
|
73
|
+
],
|
74
|
+
conclusion: `You have learned how to access workload monitoring and metrics!`,
|
75
|
+
nextQuickStart: [``]
|
76
|
+
}
|
77
|
+
};
|
@@ -0,0 +1,132 @@
|
|
1
|
+
import { ButtonProps } from '@patternfly/react-core';
|
2
|
+
export interface AccessReviewResourceAttributes {
|
3
|
+
group?: string;
|
4
|
+
resource?: string;
|
5
|
+
subresource?: string;
|
6
|
+
verb?: K8sVerb;
|
7
|
+
name?: string;
|
8
|
+
namespace?: string;
|
9
|
+
}
|
10
|
+
export type K8sVerb = 'create' | 'get' | 'list' | 'update' | 'patch' | 'delete' | 'deletecollection' | 'watch';
|
11
|
+
export interface QuickStart {
|
12
|
+
apiVersion?: string;
|
13
|
+
kind?: string;
|
14
|
+
metadata: ObjectMetadata;
|
15
|
+
spec: QuickStartSpec;
|
16
|
+
}
|
17
|
+
export interface ObjectMetadata {
|
18
|
+
name: string;
|
19
|
+
annotations?: {
|
20
|
+
[key: string]: string;
|
21
|
+
};
|
22
|
+
clusterName?: string;
|
23
|
+
creationTimestamp?: string;
|
24
|
+
deletionGracePeriodSeconds?: number;
|
25
|
+
deletionTimestamp?: string;
|
26
|
+
finalizers?: string[];
|
27
|
+
generateName?: string;
|
28
|
+
generation?: number;
|
29
|
+
labels?: {
|
30
|
+
[key: string]: string;
|
31
|
+
};
|
32
|
+
managedFields?: any[];
|
33
|
+
namespace?: string;
|
34
|
+
ownerReferences?: OwnerReference[];
|
35
|
+
resourceVersion?: string;
|
36
|
+
uid?: string;
|
37
|
+
language?: string;
|
38
|
+
country?: string;
|
39
|
+
locale?: string;
|
40
|
+
[key: string]: any;
|
41
|
+
}
|
42
|
+
export interface OwnerReference {
|
43
|
+
name: string;
|
44
|
+
kind: string;
|
45
|
+
uid: string;
|
46
|
+
apiVersion: string;
|
47
|
+
controller?: boolean;
|
48
|
+
blockOwnerDeletion?: boolean;
|
49
|
+
}
|
50
|
+
export interface QuickStartTask {
|
51
|
+
title?: string;
|
52
|
+
description?: string;
|
53
|
+
review?: QuickStartTaskReview;
|
54
|
+
summary?: QuickStartTaskSummary;
|
55
|
+
proc?: string;
|
56
|
+
}
|
57
|
+
export interface QuickStartTaskReview {
|
58
|
+
instructions?: string;
|
59
|
+
failedTaskHelp?: string;
|
60
|
+
}
|
61
|
+
export interface QuickStartTaskSummary {
|
62
|
+
success?: string;
|
63
|
+
failed?: string;
|
64
|
+
}
|
65
|
+
export interface QuickstartAction {
|
66
|
+
/** Screen reader aria label. */
|
67
|
+
'aria-label': string;
|
68
|
+
/** Icon to be rendered as a plain button, by default Bookmark outlined will be used. */
|
69
|
+
icon?: React.ComponentType<unknown>;
|
70
|
+
/** Callback with synthetic event parameter. */
|
71
|
+
onClick?: (e: React.SyntheticEvent) => void;
|
72
|
+
/** Additional button props to be rendered as extra props. */
|
73
|
+
buttonProps?: ButtonProps;
|
74
|
+
}
|
75
|
+
export interface QuickStart {
|
76
|
+
apiVersion?: string;
|
77
|
+
kind?: string;
|
78
|
+
metadata: ObjectMetadata;
|
79
|
+
spec: QuickStartSpec;
|
80
|
+
}
|
81
|
+
export interface QuickStartSpec {
|
82
|
+
version?: number;
|
83
|
+
displayName: string;
|
84
|
+
durationMinutes?: number;
|
85
|
+
icon: React.ReactNode;
|
86
|
+
description: string;
|
87
|
+
prerequisites?: string[];
|
88
|
+
introduction?: string;
|
89
|
+
tasks?: QuickStartTask[];
|
90
|
+
conclusion?: string;
|
91
|
+
nextQuickStart?: string[];
|
92
|
+
accessReviewResources?: AccessReviewResourceAttributes[];
|
93
|
+
link?: QuickStartExternal;
|
94
|
+
type?: QuickStartType;
|
95
|
+
}
|
96
|
+
export interface QuickStartTask {
|
97
|
+
title?: string;
|
98
|
+
description?: string;
|
99
|
+
review?: QuickStartTaskReview;
|
100
|
+
summary?: QuickStartTaskSummary;
|
101
|
+
proc?: string;
|
102
|
+
}
|
103
|
+
export interface QuickStartTaskReview {
|
104
|
+
instructions?: string;
|
105
|
+
failedTaskHelp?: string;
|
106
|
+
}
|
107
|
+
export interface QuickStartTaskSummary {
|
108
|
+
success?: string;
|
109
|
+
failed?: string;
|
110
|
+
}
|
111
|
+
export type AllQuickStartStates = Record<string, QuickStartState>;
|
112
|
+
export type QuickStartState = Record<string, string | number | QuickStartStatus>;
|
113
|
+
export declare enum QuickStartStatus {
|
114
|
+
COMPLETE = "Complete",
|
115
|
+
IN_PROGRESS = "In Progress",
|
116
|
+
NOT_STARTED = "Not started"
|
117
|
+
}
|
118
|
+
export declare enum QuickStartTaskStatus {
|
119
|
+
INIT = "Initial",
|
120
|
+
VISITED = "Visited",
|
121
|
+
REVIEW = "Review",
|
122
|
+
SUCCESS = "Success",
|
123
|
+
FAILED = "Failed"
|
124
|
+
}
|
125
|
+
export interface QuickStartExternal {
|
126
|
+
href: string;
|
127
|
+
text?: string;
|
128
|
+
}
|
129
|
+
export interface QuickStartType {
|
130
|
+
text: string;
|
131
|
+
color?: 'green' | 'purple' | 'grey' | 'blue' | 'orange' | 'red' | 'teal' | 'orangered' | 'yellow';
|
132
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.QuickStartTaskStatus = exports.QuickStartStatus = void 0;
|
4
|
+
var QuickStartStatus;
|
5
|
+
(function (QuickStartStatus) {
|
6
|
+
QuickStartStatus["COMPLETE"] = "Complete";
|
7
|
+
QuickStartStatus["IN_PROGRESS"] = "In Progress";
|
8
|
+
QuickStartStatus["NOT_STARTED"] = "Not started";
|
9
|
+
})(QuickStartStatus || (exports.QuickStartStatus = QuickStartStatus = {}));
|
10
|
+
var QuickStartTaskStatus;
|
11
|
+
(function (QuickStartTaskStatus) {
|
12
|
+
QuickStartTaskStatus["INIT"] = "Initial";
|
13
|
+
QuickStartTaskStatus["VISITED"] = "Visited";
|
14
|
+
QuickStartTaskStatus["REVIEW"] = "Review";
|
15
|
+
QuickStartTaskStatus["SUCCESS"] = "Success";
|
16
|
+
QuickStartTaskStatus["FAILED"] = "Failed";
|
17
|
+
})(QuickStartTaskStatus || (exports.QuickStartTaskStatus = QuickStartTaskStatus = {}));
|
@@ -25,7 +25,7 @@ const paper_plane_icon_1 = require("@patternfly/react-icons/dist/esm/icons/paper
|
|
25
25
|
const SendButton = (_a) => {
|
26
26
|
var { className, onClick, tooltipProps, tooltipContent = 'Send' } = _a, props = __rest(_a, ["className", "onClick", "tooltipProps", "tooltipContent"]);
|
27
27
|
return (react_1.default.createElement(react_core_1.Tooltip, Object.assign({ id: "pf-chatbot__tooltip--send", content: tooltipContent, position: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.position) || 'top', entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0 }, tooltipProps),
|
28
|
-
react_1.default.createElement(react_core_1.Button, Object.assign({ className: `pf-chatbot__button--send ${className !== null && className !== void 0 ? className : ''}`,
|
28
|
+
react_1.default.createElement(react_core_1.Button, Object.assign({ variant: "plain", className: `pf-chatbot__button--send ${className !== null && className !== void 0 ? className : ''}`, "aria-label": props['aria-label'] || 'Send button', onClick: onClick, icon: react_1.default.createElement(react_core_1.Icon, { iconSize: "xl", isInline: true },
|
29
29
|
react_1.default.createElement(paper_plane_icon_1.PaperPlaneIcon, null)) }, props))));
|
30
30
|
};
|
31
31
|
exports.SendButton = SendButton;
|
@@ -3,6 +3,8 @@ import { TooltipProps } from '@patternfly/react-core';
|
|
3
3
|
export interface ResponseActionButtonProps {
|
4
4
|
/** Aria-label for the button. Defaults to the value of the tooltipContent if none provided */
|
5
5
|
ariaLabel?: string;
|
6
|
+
/** Aria-label for the button, shown when the button is clicked. Defaults to the value of ariaLabel or tooltipContent if not provided. */
|
7
|
+
clickedAriaLabel?: string;
|
6
8
|
/** Icon for the button */
|
7
9
|
icon: React.ReactNode;
|
8
10
|
/** On-click handler for the button */
|
@@ -13,8 +15,12 @@ export interface ResponseActionButtonProps {
|
|
13
15
|
isDisabled?: boolean;
|
14
16
|
/** Content shown in the tooltip */
|
15
17
|
tooltipContent?: string;
|
18
|
+
/** Content shown in the tooltip when the button is clicked. Defaults to the value of tooltipContent if not provided. */
|
19
|
+
clickedTooltipContent?: string;
|
16
20
|
/** Props to control the PF Tooltip component */
|
17
21
|
tooltipProps?: TooltipProps;
|
22
|
+
/** Whether button is in clicked state */
|
23
|
+
isClicked?: boolean;
|
18
24
|
}
|
19
25
|
export declare const ResponseActionButton: React.FunctionComponent<ResponseActionButtonProps>;
|
20
26
|
export default ResponseActionButton;
|
@@ -6,7 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ResponseActionButton = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
8
|
const react_core_1 = require("@patternfly/react-core");
|
9
|
-
const ResponseActionButton = ({ ariaLabel, className, icon, isDisabled, onClick, tooltipContent,
|
10
|
-
|
9
|
+
const ResponseActionButton = ({ ariaLabel, clickedAriaLabel = ariaLabel, className, icon, isDisabled, onClick, tooltipContent, clickedTooltipContent = tooltipContent, tooltipProps, isClicked = false }) => {
|
10
|
+
const generateAriaLabel = () => {
|
11
|
+
if (ariaLabel) {
|
12
|
+
return isClicked ? clickedAriaLabel : ariaLabel;
|
13
|
+
}
|
14
|
+
return isClicked ? clickedTooltipContent : tooltipContent;
|
15
|
+
};
|
16
|
+
return (react_1.default.createElement(react_core_1.Tooltip, Object.assign({ id: `pf-chatbot__tooltip-response-action-${tooltipContent}`, content: isClicked ? clickedTooltipContent : tooltipContent, "aria-live": "polite", position: "bottom", entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0 }, tooltipProps),
|
17
|
+
react_1.default.createElement(react_core_1.Button, { variant: "plain", className: `pf-chatbot__button--response-action ${isClicked ? 'pf-chatbot__button--response-action-clicked' : ''} ${className !== null && className !== void 0 ? className : ''}`, "aria-label": generateAriaLabel(), icon: react_1.default.createElement(react_core_1.Icon, { isInline: true, size: "lg" }, icon), isDisabled: isDisabled, onClick: onClick, size: "sm" })));
|
18
|
+
};
|
11
19
|
exports.ResponseActionButton = ResponseActionButton;
|
12
20
|
exports.default = exports.ResponseActionButton;
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom';
|