@patternfly/chatbot 2.2.0-prerelease.3 → 2.2.0-prerelease.5

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.
Files changed (52) hide show
  1. package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +6 -0
  2. package/dist/cjs/ResponseActions/ResponseActionButton.js +10 -2
  3. package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +1 -0
  4. package/dist/cjs/ResponseActions/ResponseActionButton.test.js +54 -0
  5. package/dist/cjs/ResponseActions/ResponseActions.d.ts +4 -0
  6. package/dist/cjs/ResponseActions/ResponseActions.js +26 -9
  7. package/dist/cjs/ResponseActions/ResponseActions.test.js +79 -5
  8. package/dist/cjs/TermsOfUse/TermsOfUse.d.ts +34 -0
  9. package/dist/cjs/TermsOfUse/TermsOfUse.js +49 -0
  10. package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +1 -0
  11. package/dist/cjs/TermsOfUse/TermsOfUse.test.js +79 -0
  12. package/dist/cjs/TermsOfUse/index.d.ts +2 -0
  13. package/dist/cjs/TermsOfUse/index.js +23 -0
  14. package/dist/cjs/index.d.ts +2 -0
  15. package/dist/cjs/index.js +4 -1
  16. package/dist/css/main.css +66 -4
  17. package/dist/css/main.css.map +1 -1
  18. package/dist/dynamic/TermsOfUse/package.json +1 -0
  19. package/dist/esm/ResponseActions/ResponseActionButton.d.ts +6 -0
  20. package/dist/esm/ResponseActions/ResponseActionButton.js +10 -2
  21. package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +1 -0
  22. package/dist/esm/ResponseActions/ResponseActionButton.test.js +49 -0
  23. package/dist/esm/ResponseActions/ResponseActions.d.ts +4 -0
  24. package/dist/esm/ResponseActions/ResponseActions.js +26 -9
  25. package/dist/esm/ResponseActions/ResponseActions.test.js +79 -5
  26. package/dist/esm/TermsOfUse/TermsOfUse.d.ts +34 -0
  27. package/dist/esm/TermsOfUse/TermsOfUse.js +42 -0
  28. package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +1 -0
  29. package/dist/esm/TermsOfUse/TermsOfUse.test.js +74 -0
  30. package/dist/esm/TermsOfUse/index.d.ts +2 -0
  31. package/dist/esm/TermsOfUse/index.js +2 -0
  32. package/dist/esm/index.d.ts +2 -0
  33. package/dist/esm/index.js +2 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +4 -0
  37. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +13 -2
  38. package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-TermsAndConditionsHeader.svg +148 -0
  39. package/patternfly-docs/content/extensions/chatbot/examples/UI/TermsOfUse.tsx +147 -0
  40. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +14 -0
  41. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +2 -2
  42. package/src/ResponseActions/ResponseActionButton.test.tsx +52 -0
  43. package/src/ResponseActions/ResponseActionButton.tsx +46 -27
  44. package/src/ResponseActions/ResponseActions.scss +10 -8
  45. package/src/ResponseActions/ResponseActions.test.tsx +103 -5
  46. package/src/ResponseActions/ResponseActions.tsx +54 -7
  47. package/src/TermsOfUse/TermsOfUse.scss +66 -0
  48. package/src/TermsOfUse/TermsOfUse.test.tsx +138 -0
  49. package/src/TermsOfUse/TermsOfUse.tsx +117 -0
  50. package/src/TermsOfUse/index.ts +3 -0
  51. package/src/index.ts +3 -0
  52. package/src/main.scss +1 -0
@@ -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, tooltipProps }) => (react_1.default.createElement(react_core_1.Tooltip, Object.assign({ id: `pf-chatbot__tooltip-response-action-${tooltipContent}`, content: tooltipContent, 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),
10
- react_1.default.createElement(react_core_1.Button, { variant: "plain", className: `pf-chatbot__button--response-action ${className !== null && className !== void 0 ? className : ''}`, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : tooltipContent, icon: react_1.default.createElement(react_core_1.Icon, { isInline: true, size: "lg" }, icon), isDisabled: isDisabled, onClick: onClick, size: "sm" })));
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';
@@ -0,0 +1,54 @@
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 react_1 = __importDefault(require("react"));
16
+ const react_2 = require("@testing-library/react");
17
+ require("@testing-library/jest-dom");
18
+ const user_event_1 = __importDefault(require("@testing-library/user-event"));
19
+ const react_icons_1 = require("@patternfly/react-icons");
20
+ const ResponseActionButton_1 = __importDefault(require("./ResponseActionButton"));
21
+ describe('ResponseActionButton', () => {
22
+ it('renders aria-label correctly if not clicked', () => {
23
+ (0, react_2.render)(react_1.default.createElement(ResponseActionButton_1.default, { icon: react_1.default.createElement(react_icons_1.DownloadIcon, null), ariaLabel: "Download", clickedAriaLabel: "Downloaded" }));
24
+ expect(react_2.screen.getByRole('button', { name: 'Download' })).toBeTruthy();
25
+ });
26
+ it('renders aria-label correctly if clicked', () => {
27
+ (0, react_2.render)(react_1.default.createElement(ResponseActionButton_1.default, { icon: react_1.default.createElement(react_icons_1.DownloadIcon, null), ariaLabel: "Download", clickedAriaLabel: "Downloaded", isClicked: true }));
28
+ expect(react_2.screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
29
+ });
30
+ it('renders tooltip correctly if not clicked', () => __awaiter(void 0, void 0, void 0, function* () {
31
+ (0, react_2.render)(react_1.default.createElement(ResponseActionButton_1.default, { icon: react_1.default.createElement(react_icons_1.DownloadIcon, null), tooltipContent: "Download", clickedTooltipContent: "Downloaded" }));
32
+ expect(react_2.screen.getByRole('button', { name: 'Download' })).toBeTruthy();
33
+ // clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
34
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Download' }));
35
+ expect(react_2.screen.getByRole('tooltip', { name: 'Download' })).toBeTruthy();
36
+ }));
37
+ it('renders tooltip correctly if clicked', () => __awaiter(void 0, void 0, void 0, function* () {
38
+ (0, react_2.render)(react_1.default.createElement(ResponseActionButton_1.default, { icon: react_1.default.createElement(react_icons_1.DownloadIcon, null), tooltipContent: "Download", clickedTooltipContent: "Downloaded", isClicked: true }));
39
+ expect(react_2.screen.getByRole('button', { name: 'Downloaded' })).toBeTruthy();
40
+ // clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
41
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Downloaded' }));
42
+ expect(react_2.screen.getByRole('tooltip', { name: 'Downloaded' })).toBeTruthy();
43
+ }));
44
+ it('if clicked variant for tooltip is not supplied, it uses the default', () => __awaiter(void 0, void 0, void 0, function* () {
45
+ (0, react_2.render)(react_1.default.createElement(ResponseActionButton_1.default, { icon: react_1.default.createElement(react_icons_1.DownloadIcon, null), tooltipContent: "Download", isClicked: true }));
46
+ // clicking here just triggers the tooltip; in this button, the logic is divorced from whether it is actually clicked
47
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Download' }));
48
+ expect(react_2.screen.getByRole('button', { name: 'Download' })).toBeTruthy();
49
+ }));
50
+ it('if clicked variant for aria label is not supplied, it uses the default', () => __awaiter(void 0, void 0, void 0, function* () {
51
+ (0, react_2.render)(react_1.default.createElement(ResponseActionButton_1.default, { icon: react_1.default.createElement(react_icons_1.DownloadIcon, null), ariaLabel: "Download", isClicked: true }));
52
+ expect(react_2.screen.getByRole('button', { name: 'Download' })).toBeTruthy();
53
+ }));
54
+ });
@@ -3,6 +3,8 @@ import { TooltipProps } from '@patternfly/react-core';
3
3
  export interface ActionProps {
4
4
  /** Aria-label for the button */
5
5
  ariaLabel?: string;
6
+ /** Aria-label for the button, shown when the button is clicked. */
7
+ clickedAriaLabel?: string;
6
8
  /** On-click handler for the button */
7
9
  onClick?: ((event: MouseEvent | React.MouseEvent<Element, MouseEvent> | KeyboardEvent) => void) | undefined;
8
10
  /** Class name for the button */
@@ -11,6 +13,8 @@ export interface ActionProps {
11
13
  isDisabled?: boolean;
12
14
  /** Content shown in the tooltip */
13
15
  tooltipContent?: string;
16
+ /** Content shown in the tooltip when the button is clicked. */
17
+ clickedTooltipContent?: string;
14
18
  /** Props to control the PF Tooltip component */
15
19
  tooltipProps?: TooltipProps;
16
20
  /** Icon for custom response action */
@@ -19,17 +19,34 @@ const react_1 = __importDefault(require("react"));
19
19
  const react_icons_1 = require("@patternfly/react-icons");
20
20
  const ResponseActionButton_1 = __importDefault(require("./ResponseActionButton"));
21
21
  const ResponseActions = ({ actions }) => {
22
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
23
+ const [activeButton, setActiveButton] = react_1.default.useState();
23
24
  const { positive, negative, copy, share, listen } = actions, additionalActions = __rest(actions, ["positive", "negative", "copy", "share", "listen"]);
24
- return (react_1.default.createElement("div", { className: "pf-chatbot__response-actions" },
25
- positive && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_a = positive.ariaLabel) !== null && _a !== void 0 ? _a : 'Good response', onClick: positive.onClick, className: positive.className, isDisabled: positive.isDisabled, tooltipContent: (_b = positive.tooltipContent) !== null && _b !== void 0 ? _b : 'Good response', tooltipProps: positive.tooltipProps, icon: react_1.default.createElement(react_icons_1.OutlinedThumbsUpIcon, null) })),
26
- negative && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_c = negative.ariaLabel) !== null && _c !== void 0 ? _c : 'Bad response', onClick: negative.onClick, className: negative.className, isDisabled: negative.isDisabled, tooltipContent: (_d = negative.tooltipContent) !== null && _d !== void 0 ? _d : 'Bad response', tooltipProps: negative.tooltipProps, icon: react_1.default.createElement(react_icons_1.OutlinedThumbsDownIcon, null) })),
27
- copy && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_e = copy.ariaLabel) !== null && _e !== void 0 ? _e : 'Copy', onClick: copy.onClick, className: copy.className, isDisabled: copy.isDisabled, tooltipContent: (_f = copy.tooltipContent) !== null && _f !== void 0 ? _f : 'Copy', tooltipProps: copy.tooltipProps, icon: react_1.default.createElement(react_icons_1.OutlinedCopyIcon, null) })),
28
- share && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_g = share.ariaLabel) !== null && _g !== void 0 ? _g : 'Share', onClick: share.onClick, className: share.className, isDisabled: share.isDisabled, tooltipContent: (_h = share.tooltipContent) !== null && _h !== void 0 ? _h : 'Share', tooltipProps: share.tooltipProps, icon: react_1.default.createElement(react_icons_1.ExternalLinkAltIcon, null) })),
29
- listen && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_j = listen.ariaLabel) !== null && _j !== void 0 ? _j : 'Listen', onClick: listen.onClick, className: listen.className, isDisabled: listen.isDisabled, tooltipContent: (_k = listen.tooltipContent) !== null && _k !== void 0 ? _k : 'Listen', tooltipProps: listen.tooltipProps, icon: react_1.default.createElement(react_icons_1.VolumeUpIcon, null) })),
25
+ const responseActions = react_1.default.useRef(null);
26
+ react_1.default.useEffect(() => {
27
+ const handleClickOutside = (e) => {
28
+ if (responseActions.current && !responseActions.current.contains(e.target)) {
29
+ setActiveButton(undefined);
30
+ }
31
+ };
32
+ window.addEventListener('click', handleClickOutside);
33
+ return () => {
34
+ window.removeEventListener('click', handleClickOutside);
35
+ };
36
+ }, []);
37
+ const handleClick = (e, id, onClick) => {
38
+ setActiveButton(id);
39
+ onClick && onClick(e);
40
+ };
41
+ return (react_1.default.createElement("div", { ref: responseActions, className: "pf-chatbot__response-actions" },
42
+ positive && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_a = positive.ariaLabel) !== null && _a !== void 0 ? _a : 'Good response', clickedAriaLabel: (_b = positive.ariaLabel) !== null && _b !== void 0 ? _b : 'Response recorded', onClick: (e) => handleClick(e, 'positive', positive.onClick), className: positive.className, isDisabled: positive.isDisabled, tooltipContent: (_c = positive.tooltipContent) !== null && _c !== void 0 ? _c : 'Good response', clickedTooltipContent: (_d = positive.clickedTooltipContent) !== null && _d !== void 0 ? _d : 'Response recorded', tooltipProps: positive.tooltipProps, icon: react_1.default.createElement(react_icons_1.OutlinedThumbsUpIcon, null), isClicked: activeButton === 'positive' })),
43
+ negative && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_e = negative.ariaLabel) !== null && _e !== void 0 ? _e : 'Bad response', clickedAriaLabel: (_f = negative.ariaLabel) !== null && _f !== void 0 ? _f : 'Response recorded', onClick: (e) => handleClick(e, 'negative', negative.onClick), className: negative.className, isDisabled: negative.isDisabled, tooltipContent: (_g = negative.tooltipContent) !== null && _g !== void 0 ? _g : 'Bad response', clickedTooltipContent: (_h = negative.clickedTooltipContent) !== null && _h !== void 0 ? _h : 'Response recorded', tooltipProps: negative.tooltipProps, icon: react_1.default.createElement(react_icons_1.OutlinedThumbsDownIcon, null), isClicked: activeButton === 'negative' })),
44
+ copy && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_j = copy.ariaLabel) !== null && _j !== void 0 ? _j : 'Copy', clickedAriaLabel: (_k = copy.ariaLabel) !== null && _k !== void 0 ? _k : 'Copied', onClick: (e) => handleClick(e, 'copy', copy.onClick), className: copy.className, isDisabled: copy.isDisabled, tooltipContent: (_l = copy.tooltipContent) !== null && _l !== void 0 ? _l : 'Copy', clickedTooltipContent: (_m = copy.clickedTooltipContent) !== null && _m !== void 0 ? _m : 'Copied', tooltipProps: copy.tooltipProps, icon: react_1.default.createElement(react_icons_1.OutlinedCopyIcon, null), isClicked: activeButton === 'copy' })),
45
+ share && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_o = share.ariaLabel) !== null && _o !== void 0 ? _o : 'Share', clickedAriaLabel: (_p = share.ariaLabel) !== null && _p !== void 0 ? _p : 'Shared', onClick: (e) => handleClick(e, 'share', share.onClick), className: share.className, isDisabled: share.isDisabled, tooltipContent: (_q = share.tooltipContent) !== null && _q !== void 0 ? _q : 'Share', clickedTooltipContent: (_r = share.clickedTooltipContent) !== null && _r !== void 0 ? _r : 'Shared', tooltipProps: share.tooltipProps, icon: react_1.default.createElement(react_icons_1.ExternalLinkAltIcon, null), isClicked: activeButton === 'share' })),
46
+ listen && (react_1.default.createElement(ResponseActionButton_1.default, { ariaLabel: (_s = listen.ariaLabel) !== null && _s !== void 0 ? _s : 'Listen', clickedAriaLabel: (_t = listen.ariaLabel) !== null && _t !== void 0 ? _t : 'Listening', onClick: (e) => handleClick(e, 'listen', listen.onClick), className: listen.className, isDisabled: listen.isDisabled, tooltipContent: (_u = listen.tooltipContent) !== null && _u !== void 0 ? _u : 'Listen', clickedTooltipContent: (_v = listen.clickedTooltipContent) !== null && _v !== void 0 ? _v : 'Listening', tooltipProps: listen.tooltipProps, icon: react_1.default.createElement(react_icons_1.VolumeUpIcon, null), isClicked: activeButton === 'listen' })),
30
47
  Object.keys(additionalActions).map((action) => {
31
- var _a, _b, _c, _d, _e, _f, _g;
32
- return (react_1.default.createElement(ResponseActionButton_1.default, { key: action, ariaLabel: (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.ariaLabel, onClick: (_b = additionalActions[action]) === null || _b === void 0 ? void 0 : _b.onClick, className: (_c = additionalActions[action]) === null || _c === void 0 ? void 0 : _c.className, isDisabled: (_d = additionalActions[action]) === null || _d === void 0 ? void 0 : _d.isDisabled, tooltipContent: (_e = additionalActions[action]) === null || _e === void 0 ? void 0 : _e.tooltipContent, tooltipProps: (_f = additionalActions[action]) === null || _f === void 0 ? void 0 : _f.tooltipProps, icon: (_g = additionalActions[action]) === null || _g === void 0 ? void 0 : _g.icon }));
48
+ var _a, _b, _c, _d, _e, _f, _g, _h;
49
+ return (react_1.default.createElement(ResponseActionButton_1.default, { key: action, ariaLabel: (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.ariaLabel, clickedAriaLabel: (_b = additionalActions[action]) === null || _b === void 0 ? void 0 : _b.clickedAriaLabel, onClick: (e) => { var _a; return handleClick(e, action, (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.onClick); }, className: (_c = additionalActions[action]) === null || _c === void 0 ? void 0 : _c.className, isDisabled: (_d = additionalActions[action]) === null || _d === void 0 ? void 0 : _d.isDisabled, tooltipContent: (_e = additionalActions[action]) === null || _e === void 0 ? void 0 : _e.tooltipContent, tooltipProps: (_f = additionalActions[action]) === null || _f === void 0 ? void 0 : _f.tooltipProps, clickedTooltipContent: (_g = additionalActions[action]) === null || _g === void 0 ? void 0 : _g.clickedTooltipContent, icon: (_h = additionalActions[action]) === null || _h === void 0 ? void 0 : _h.icon, isClicked: activeButton === action }));
33
50
  })));
34
51
  };
35
52
  exports.ResponseActions = ResponseActions;
@@ -18,25 +18,30 @@ require("@testing-library/jest-dom");
18
18
  const ResponseActions_1 = __importDefault(require("./ResponseActions"));
19
19
  const user_event_1 = __importDefault(require("@testing-library/user-event"));
20
20
  const react_icons_1 = require("@patternfly/react-icons");
21
+ const Message_1 = __importDefault(require("../Message"));
21
22
  const ALL_ACTIONS = [
22
- { type: 'positive', label: 'Good response' },
23
- { type: 'negative', label: 'Bad response' },
24
- { type: 'copy', label: 'Copy' },
25
- { type: 'share', label: 'Share' },
26
- { type: 'listen', label: 'Listen' }
23
+ { type: 'positive', label: 'Good response', clickedLabel: 'Response recorded' },
24
+ { type: 'negative', label: 'Bad response', clickedLabel: 'Response recorded' },
25
+ { type: 'copy', label: 'Copy', clickedLabel: 'Copied' },
26
+ { type: 'share', label: 'Share', clickedLabel: 'Shared' },
27
+ { type: 'listen', label: 'Listen', clickedLabel: 'Listening' }
27
28
  ];
28
29
  const CUSTOM_ACTIONS = [
29
30
  {
30
31
  regenerate: {
31
32
  ariaLabel: 'Regenerate',
33
+ clickedAriaLabel: 'Regenerated',
32
34
  onClick: jest.fn(),
33
35
  tooltipContent: 'Regenerate',
36
+ clickedTooltipContent: 'Regenerated',
34
37
  icon: react_1.default.createElement(react_icons_1.RedoIcon, null)
35
38
  },
36
39
  download: {
37
40
  ariaLabel: 'Download',
41
+ clickedAriaLabel: 'Downloaded',
38
42
  onClick: jest.fn(),
39
43
  tooltipContent: 'Download',
44
+ clickedTooltipContent: 'Downloaded',
40
45
  icon: react_1.default.createElement(react_icons_1.DownloadIcon, null)
41
46
  },
42
47
  info: {
@@ -48,6 +53,59 @@ const CUSTOM_ACTIONS = [
48
53
  }
49
54
  ];
50
55
  describe('ResponseActions', () => {
56
+ afterEach(() => {
57
+ jest.clearAllMocks();
58
+ });
59
+ it('should handle click within group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
60
+ (0, react_2.render)(react_1.default.createElement(ResponseActions_1.default, { actions: {
61
+ positive: { onClick: jest.fn() },
62
+ negative: { onClick: jest.fn() },
63
+ copy: { onClick: jest.fn() },
64
+ share: { onClick: jest.fn() },
65
+ listen: { onClick: jest.fn() }
66
+ } }));
67
+ const goodBtn = react_2.screen.getByRole('button', { name: 'Good response' });
68
+ const badBtn = react_2.screen.getByRole('button', { name: 'Bad response' });
69
+ const copyBtn = react_2.screen.getByRole('button', { name: 'Copy' });
70
+ const shareBtn = react_2.screen.getByRole('button', { name: 'Share' });
71
+ const listenBtn = react_2.screen.getByRole('button', { name: 'Listen' });
72
+ const buttons = [goodBtn, badBtn, copyBtn, shareBtn, listenBtn];
73
+ buttons.forEach((button) => {
74
+ expect(button).toBeTruthy();
75
+ });
76
+ yield user_event_1.default.click(goodBtn);
77
+ expect(react_2.screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
78
+ let unclickedButtons = buttons.filter((button) => button !== goodBtn);
79
+ unclickedButtons.forEach((button) => {
80
+ expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
81
+ });
82
+ yield user_event_1.default.click(badBtn);
83
+ expect(react_2.screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
84
+ unclickedButtons = buttons.filter((button) => button !== badBtn);
85
+ unclickedButtons.forEach((button) => {
86
+ expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
87
+ });
88
+ }));
89
+ it('should handle click outside of group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
90
+ // using message just so we have something outside the group that's rendered
91
+ (0, react_2.render)(react_1.default.createElement(Message_1.default, { name: "Bot", role: "bot", avatar: "", content: "Example with all prebuilt actions", actions: {
92
+ positive: {},
93
+ negative: {}
94
+ } }));
95
+ const goodBtn = react_2.screen.getByRole('button', { name: 'Good response' });
96
+ const badBtn = react_2.screen.getByRole('button', { name: 'Bad response' });
97
+ expect(goodBtn).toBeTruthy();
98
+ expect(badBtn).toBeTruthy();
99
+ yield user_event_1.default.click(goodBtn);
100
+ expect(react_2.screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
101
+ expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
102
+ yield user_event_1.default.click(badBtn);
103
+ expect(react_2.screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
104
+ expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
105
+ yield user_event_1.default.click(react_2.screen.getByText('Example with all prebuilt actions'));
106
+ expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
107
+ expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
108
+ }));
51
109
  it('should render buttons correctly', () => {
52
110
  ALL_ACTIONS.forEach(({ type, label }) => {
53
111
  (0, react_2.render)(react_1.default.createElement(ResponseActions_1.default, { actions: { [type]: { onClick: jest.fn() } } }));
@@ -62,6 +120,22 @@ describe('ResponseActions', () => {
62
120
  expect(spy).toHaveBeenCalledTimes(1);
63
121
  }));
64
122
  }));
123
+ it('should swap clicked and non-clicked aria labels on click', () => __awaiter(void 0, void 0, void 0, function* () {
124
+ ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label, clickedLabel }) {
125
+ (0, react_2.render)(react_1.default.createElement(ResponseActions_1.default, { actions: { [type]: { onClick: jest.fn() } } }));
126
+ expect(react_2.screen.getByRole('button', { name: label })).toBeTruthy();
127
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: label }));
128
+ expect(react_2.screen.getByRole('button', { name: clickedLabel })).toBeTruthy();
129
+ }));
130
+ }));
131
+ it('should swap clicked and non-clicked tooltips on click', () => __awaiter(void 0, void 0, void 0, function* () {
132
+ ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label, clickedLabel }) {
133
+ (0, react_2.render)(react_1.default.createElement(ResponseActions_1.default, { actions: { [type]: { onClick: jest.fn() } } }));
134
+ expect(react_2.screen.getByRole('button', { name: label })).toBeTruthy();
135
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: label }));
136
+ expect(react_2.screen.getByRole('tooltip', { name: clickedLabel })).toBeTruthy();
137
+ }));
138
+ }));
65
139
  it('should be able to change aria labels', () => {
66
140
  const actions = [
67
141
  { type: 'positive', ariaLabel: 'Thumbs up' },
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { ModalProps } from '@patternfly/react-core';
3
+ import { ChatbotDisplayMode } from '../Chatbot';
4
+ export interface TermsOfUseProps extends ModalProps {
5
+ /** Class applied to modal */
6
+ className?: string;
7
+ /** Action assigned to primary modal button */
8
+ onPrimaryAction?: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
9
+ /** Action assigned to secondary modal button */
10
+ onSecondaryAction: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
11
+ /** Name of primary modal button */
12
+ primaryActionBtn?: string;
13
+ /** Name of secondary modal button */
14
+ secondaryActionBtn?: string;
15
+ /** Function that handles modal toggle */
16
+ handleModalToggle: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
17
+ /** Whether modal is open */
18
+ isModalOpen: boolean;
19
+ /** Title of modal */
20
+ title?: string;
21
+ /** Display mode for the Chatbot parent; this influences the styles applied */
22
+ displayMode?: ChatbotDisplayMode;
23
+ /** Optional image displayed in header */
24
+ image?: string;
25
+ /** Alt text for optional image displayed in header */
26
+ altText?: string;
27
+ /** Ref applied to modal */
28
+ innerRef?: React.Ref<HTMLDivElement>;
29
+ /** OuiaID applied to modal */
30
+ ouiaId?: string;
31
+ }
32
+ export declare const TermsOfUseBase: React.FunctionComponent<TermsOfUseProps>;
33
+ declare const TermsOfUse: React.ForwardRefExoticComponent<Omit<TermsOfUseProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
34
+ export default TermsOfUse;
@@ -0,0 +1,49 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TermsOfUseBase = void 0;
18
+ // ============================================================================
19
+ // Terms of Use Modal - Chatbot Modal Extension
20
+ // ============================================================================
21
+ const react_1 = __importDefault(require("react"));
22
+ const react_core_1 = require("@patternfly/react-core");
23
+ const Chatbot_1 = require("../Chatbot");
24
+ const ChatbotModal_1 = __importDefault(require("../ChatbotModal/ChatbotModal"));
25
+ const TermsOfUseBase = (_a) => {
26
+ var { handleModalToggle, isModalOpen, onPrimaryAction, onSecondaryAction, primaryActionBtn = 'Accept', secondaryActionBtn = 'Decline', title = 'Terms of use', image, altText, displayMode = Chatbot_1.ChatbotDisplayMode.default, className, children, innerRef, ouiaId = 'TermsOfUse' } = _a, props = __rest(_a, ["handleModalToggle", "isModalOpen", "onPrimaryAction", "onSecondaryAction", "primaryActionBtn", "secondaryActionBtn", "title", "image", "altText", "displayMode", "className", "children", "innerRef", "ouiaId"]);
27
+ const handlePrimaryAction = (_event) => {
28
+ handleModalToggle(_event);
29
+ onPrimaryAction && onPrimaryAction(_event);
30
+ };
31
+ const handleSecondaryAction = (_event) => {
32
+ onSecondaryAction(_event);
33
+ };
34
+ const modal = (react_1.default.createElement(ChatbotModal_1.default, Object.assign({ isOpen: isModalOpen, ouiaId: ouiaId, "aria-labelledby": "terms-of-use-title", "aria-describedby": "terms-of-use-modal", className: `pf-chatbot__terms-of-use-modal pf-chatbot__terms-of-use-modal--${displayMode} ${className ? className : ''}`, displayMode: displayMode }, props),
35
+ react_1.default.createElement("section", { className: `pf-chatbot__terms-of-use--section`, "aria-label": title, tabIndex: -1, ref: innerRef },
36
+ react_1.default.createElement(react_core_1.ModalHeader, null,
37
+ react_1.default.createElement("div", { className: "pf-chatbot__terms-of-use--header" },
38
+ image && altText && react_1.default.createElement("img", { src: image, className: "pf-chatbot__terms-of-use--image", alt: altText }),
39
+ react_1.default.createElement("h1", { className: "pf-chatbot__terms-of-use--title" }, title))),
40
+ react_1.default.createElement(react_core_1.ModalBody, null,
41
+ react_1.default.createElement(react_core_1.Content, null, children)),
42
+ react_1.default.createElement(react_core_1.ModalFooter, { className: "pf-chatbot__terms-of-use--footer" },
43
+ react_1.default.createElement(react_core_1.Button, { isBlock: true, key: "terms-of-use-modal-primary", variant: "primary", onClick: handlePrimaryAction, form: "terms-of-use-form", size: "lg" }, primaryActionBtn),
44
+ react_1.default.createElement(react_core_1.Button, { isBlock: true, key: "terms-of-use-modal-secondary", variant: "secondary", onClick: handleSecondaryAction, size: "lg" }, secondaryActionBtn)))));
45
+ return modal;
46
+ };
47
+ exports.TermsOfUseBase = TermsOfUseBase;
48
+ const TermsOfUse = react_1.default.forwardRef((props, ref) => (react_1.default.createElement(exports.TermsOfUseBase, Object.assign({ innerRef: ref }, props))));
49
+ exports.default = TermsOfUse;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,79 @@
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 react_1 = __importDefault(require("react"));
16
+ const react_2 = require("@testing-library/react");
17
+ require("@testing-library/jest-dom");
18
+ const user_event_1 = __importDefault(require("@testing-library/user-event"));
19
+ const TermsOfUse_1 = __importDefault(require("./TermsOfUse"));
20
+ const react_core_1 = require("@patternfly/react-core");
21
+ const handleModalToggle = jest.fn();
22
+ const onPrimaryAction = jest.fn();
23
+ const onSecondaryAction = jest.fn();
24
+ const body = (react_1.default.createElement(react_core_1.Content, null,
25
+ react_1.default.createElement("h1", null, "Heading 1"),
26
+ react_1.default.createElement("p", null, "Legal text")));
27
+ describe('TermsOfUse', () => {
28
+ afterEach(() => {
29
+ jest.clearAllMocks();
30
+ });
31
+ it('should render modal correctly', () => {
32
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, ouiaId: "Terms" }, body));
33
+ expect(react_2.screen.getByRole('heading', { name: /Terms of use/i })).toBeTruthy();
34
+ expect(react_2.screen.getByRole('button', { name: /Accept/i })).toBeTruthy();
35
+ expect(react_2.screen.getByRole('button', { name: /Decline/i })).toBeTruthy();
36
+ expect(react_2.screen.getByRole('heading', { name: /Heading 1/i })).toBeTruthy();
37
+ expect(react_2.screen.getByText(/Legal text/i)).toBeTruthy();
38
+ expect(react_2.screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal');
39
+ expect(react_2.screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal--default');
40
+ });
41
+ it('should handle image and altText props', () => {
42
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, image: "./image.png", altText: "Test image" }, body));
43
+ expect(react_2.screen.getByRole('img')).toBeTruthy();
44
+ expect(react_2.screen.getByRole('img')).toHaveAttribute('alt', 'Test image');
45
+ });
46
+ it('should handle className prop', () => {
47
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, className: "test" }, body));
48
+ expect(react_2.screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal');
49
+ expect(react_2.screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal--default');
50
+ expect(react_2.screen.getByRole('dialog')).toHaveClass('test');
51
+ });
52
+ it('should handle title prop', () => {
53
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, title: "Updated title" }, body));
54
+ expect(react_2.screen.getByRole('heading', { name: /Updated title/i })).toBeTruthy();
55
+ expect(react_2.screen.queryByRole('heading', { name: /Terms of use/i })).toBeFalsy();
56
+ });
57
+ it('should handle primary button prop', () => {
58
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, primaryActionBtn: "First" }, body));
59
+ expect(react_2.screen.getByRole('button', { name: /First/i })).toBeTruthy();
60
+ expect(react_2.screen.queryByRole('button', { name: /Accept/i })).toBeFalsy();
61
+ });
62
+ it('should handle secondary button prop', () => {
63
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, secondaryActionBtn: "Second" }, body));
64
+ expect(react_2.screen.getByRole('button', { name: /Second/i })).toBeTruthy();
65
+ expect(react_2.screen.queryByRole('button', { name: /Deny/i })).toBeFalsy();
66
+ });
67
+ it('should handle primary button click', () => __awaiter(void 0, void 0, void 0, function* () {
68
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onPrimaryAction: onPrimaryAction, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle }, body));
69
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: /Accept/i }));
70
+ expect(onPrimaryAction).toHaveBeenCalledTimes(1);
71
+ expect(handleModalToggle).toHaveBeenCalledTimes(1);
72
+ }));
73
+ it('should handle secondary button click', () => __awaiter(void 0, void 0, void 0, function* () {
74
+ (0, react_2.render)(react_1.default.createElement(TermsOfUse_1.default, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle }, body));
75
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: /Decline/i }));
76
+ expect(onSecondaryAction).toHaveBeenCalledTimes(1);
77
+ expect(handleModalToggle).not.toHaveBeenCalled();
78
+ }));
79
+ });
@@ -0,0 +1,2 @@
1
+ export { default } from './TermsOfUse';
2
+ export * from './TermsOfUse';
@@ -0,0 +1,23 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ var TermsOfUse_1 = require("./TermsOfUse");
22
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(TermsOfUse_1).default; } });
23
+ __exportStar(require("./TermsOfUse"), exports);
@@ -46,3 +46,5 @@ export { default as SourceDetailsMenuItem } from './SourceDetailsMenuItem';
46
46
  export * from './SourceDetailsMenuItem';
47
47
  export { default as SourcesCard } from './SourcesCard';
48
48
  export * from './SourcesCard';
49
+ export { default as TermsOfUse } from './TermsOfUse';
50
+ export * from './TermsOfUse';
package/dist/cjs/index.js CHANGED
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.SourcesCard = exports.SourceDetailsMenuItem = exports.ResponseActions = exports.PreviewAttachment = exports.MessageBox = exports.MessageBar = exports.Message = exports.LoadingMessage = exports.FileDropZone = exports.FileDetailsLabel = exports.FileDetails = exports.CodeModal = exports.ChatbotWelcomePrompt = exports.ChatbotToggle = exports.ChatbotPopover = exports.ChatbotModal = exports.ChatbotHeader = exports.ChatbotFooter = exports.ChatbotConversationHistoryNav = exports.ChatbotContent = exports.ChatbotAlert = exports.Chatbot = exports.AttachMenu = exports.AttachmentEdit = void 0;
21
+ exports.TermsOfUse = exports.SourcesCard = exports.SourceDetailsMenuItem = exports.ResponseActions = exports.PreviewAttachment = exports.MessageBox = exports.MessageBar = exports.Message = exports.LoadingMessage = exports.FileDropZone = exports.FileDetailsLabel = exports.FileDetails = exports.CodeModal = exports.ChatbotWelcomePrompt = exports.ChatbotToggle = exports.ChatbotPopover = exports.ChatbotModal = exports.ChatbotHeader = exports.ChatbotFooter = exports.ChatbotConversationHistoryNav = exports.ChatbotContent = exports.ChatbotAlert = exports.Chatbot = exports.AttachMenu = exports.AttachmentEdit = void 0;
22
22
  var AttachmentEdit_1 = require("./AttachmentEdit");
23
23
  Object.defineProperty(exports, "AttachmentEdit", { enumerable: true, get: function () { return __importDefault(AttachmentEdit_1).default; } });
24
24
  __exportStar(require("./AttachmentEdit"), exports);
@@ -91,3 +91,6 @@ __exportStar(require("./SourceDetailsMenuItem"), exports);
91
91
  var SourcesCard_1 = require("./SourcesCard");
92
92
  Object.defineProperty(exports, "SourcesCard", { enumerable: true, get: function () { return __importDefault(SourcesCard_1).default; } });
93
93
  __exportStar(require("./SourcesCard"), exports);
94
+ var TermsOfUse_1 = require("./TermsOfUse");
95
+ Object.defineProperty(exports, "TermsOfUse", { enumerable: true, get: function () { return __importDefault(TermsOfUse_1).default; } });
96
+ __exportStar(require("./TermsOfUse"), exports);
package/dist/css/main.css CHANGED
@@ -1524,6 +1524,7 @@
1524
1524
  grid-template-columns: repeat(auto-fit, minmax(0, max-content));
1525
1525
  }
1526
1526
  .pf-chatbot__response-actions .pf-v6-c-button {
1527
+ --pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--subtle);
1527
1528
  border-radius: var(--pf-t--global--border--radius--pill);
1528
1529
  width: 2.3125rem;
1529
1530
  height: 2.3125rem;
@@ -1531,11 +1532,17 @@
1531
1532
  align-items: center;
1532
1533
  justify-content: center;
1533
1534
  }
1534
- .pf-chatbot__response-actions .pf-v6-c-button .pf-v6-c-button__icon {
1535
- color: var(--pf-t--global--icon--color--subtle);
1535
+ .pf-chatbot__response-actions .pf-v6-c-button:hover {
1536
+ --pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--subtle);
1536
1537
  }
1537
- .pf-chatbot__response-actions .pf-v6-c-button:hover .pf-v6-c-button__icon, .pf-chatbot__response-actions .pf-v6-c-button:focus .pf-v6-c-button__icon {
1538
- color: var(--pf-t--global--icon--color--subtle);
1538
+ .pf-chatbot__response-actions .pf-v6-c-button:focus {
1539
+ --pf-v6-c-button--hover--BackgroundColor: var(--pf-t--global--background--color--action--plain--alt--clicked);
1540
+ --pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--regular);
1541
+ }
1542
+
1543
+ .pf-v6-c-button.pf-chatbot__button--response-action-clicked {
1544
+ --pf-v6-c-button--m-plain--BackgroundColor: var(--pf-t--global--background--color--action--plain--alt--clicked);
1545
+ --pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--regular);
1539
1546
  }
1540
1547
 
1541
1548
  .pf-chatbot__source {
@@ -1637,6 +1644,61 @@
1637
1644
  max-width: 20rem;
1638
1645
  }
1639
1646
 
1647
+ .pf-chatbot__terms-of-use-modal .pf-v6-c-content {
1648
+ font-size: var(--pf-t--global--font--size--body--lg);
1649
+ }
1650
+ .pf-chatbot__terms-of-use-modal .pf-v6-c-content h2 {
1651
+ font-size: var(--pf-t--global--icon--size--font--heading--h2);
1652
+ font-family: var(--pf-t--global--font--family--heading);
1653
+ margin-bottom: var(--pf-t--global--spacer--md);
1654
+ margin-top: var(--pf-t--global--spacer--md);
1655
+ font-weight: var(--pf-t--global--font--weight--heading--default);
1656
+ }
1657
+ .pf-chatbot__terms-of-use-modal .pf-v6-c-content h2:first-of-type {
1658
+ margin-top: 0;
1659
+ }
1660
+ .pf-chatbot__terms-of-use-modal .pf-chatbot__terms-of-use--header {
1661
+ display: flex;
1662
+ align-items: center;
1663
+ justify-content: center;
1664
+ flex-direction: column;
1665
+ gap: var(--pf-t--global--spacer--xl);
1666
+ margin-block-start: var(--pf-t--global--spacer--xl);
1667
+ }
1668
+ .pf-chatbot__terms-of-use-modal .pf-chatbot__terms-of-use--title {
1669
+ font-size: var(--pf-t--global--font--size--heading--h1);
1670
+ font-family: var(--pf-t--global--font--family--heading);
1671
+ font-weight: var(--pf-t--global--font--weight--heading--bold);
1672
+ }
1673
+ .pf-chatbot__terms-of-use-modal .pf-chatbot__terms-of-use--footer {
1674
+ margin-block-start: var(--pf-t--global--spacer--md);
1675
+ }
1676
+ .pf-chatbot__terms-of-use-modal .pf-chatbot__terms-of-use--section {
1677
+ display: flex;
1678
+ flex-direction: column;
1679
+ height: 100%;
1680
+ width: 100%;
1681
+ }
1682
+ @media screen and (max-height: 620px) {
1683
+ .pf-chatbot__terms-of-use-modal .pf-v6-c-modal-box__body {
1684
+ --pf-v6-c-modal-box__body--MinHeight: auto;
1685
+ overflow: visible;
1686
+ }
1687
+ }
1688
+
1689
+ .pf-chatbot__chatbot-modal.pf-chatbot__chatbot-modal--fullscreen.pf-chatbot__terms-of-use-modal.pf-chatbot__terms-of-use-modal--fullscreen,
1690
+ .pf-chatbot__chatbot-modal.pf-chatbot__chatbot-modal--embedded.pf-chatbot__terms-of-use-modal.pf-chatbot__terms-of-use-modal--embedded {
1691
+ height: inherit;
1692
+ }
1693
+ .pf-chatbot__chatbot-modal.pf-chatbot__chatbot-modal--fullscreen.pf-chatbot__terms-of-use-modal.pf-chatbot__terms-of-use-modal--fullscreen .pf-v6-c-content h2,
1694
+ .pf-chatbot__chatbot-modal.pf-chatbot__chatbot-modal--embedded.pf-chatbot__terms-of-use-modal.pf-chatbot__terms-of-use-modal--embedded .pf-v6-c-content h2 {
1695
+ font-size: var(--pf-t--global--icon--size--font--heading--h1);
1696
+ }
1697
+ .pf-chatbot__chatbot-modal.pf-chatbot__chatbot-modal--fullscreen.pf-chatbot__terms-of-use-modal.pf-chatbot__terms-of-use-modal--fullscreen .pf-chatbot__terms-of-use--title,
1698
+ .pf-chatbot__chatbot-modal.pf-chatbot__chatbot-modal--embedded.pf-chatbot__terms-of-use-modal.pf-chatbot__terms-of-use-modal--embedded .pf-chatbot__terms-of-use--title {
1699
+ font-size: var(--pf-t--global--font--size--heading--2xl);
1700
+ }
1701
+
1640
1702
  :where(:root) {
1641
1703
  --pf-t--chatbot--heading--font-family: var(
1642
1704
  --pf-v6-c-content--heading--FontFamily,