@patternfly/chatbot 2.2.0-prerelease.27 → 2.2.0-prerelease.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -3
  2. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +3 -3
  3. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
  4. package/dist/cjs/ChatbotFooter/ChatbotFootnote.d.ts +1 -1
  5. package/dist/cjs/ChatbotFooter/ChatbotFootnote.js +1 -1
  6. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -3
  7. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +2 -2
  8. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +19 -11
  9. package/dist/cjs/Message/Message.d.ts +3 -0
  10. package/dist/cjs/Message/Message.js +3 -2
  11. package/dist/cjs/ResponseActions/ResponseActions.test.js +2 -2
  12. package/dist/css/main.css +3 -3
  13. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -3
  14. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +3 -3
  15. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
  16. package/dist/esm/ChatbotFooter/ChatbotFootnote.d.ts +1 -1
  17. package/dist/esm/ChatbotFooter/ChatbotFootnote.js +1 -1
  18. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -3
  19. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +2 -2
  20. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +19 -11
  21. package/dist/esm/Message/Message.d.ts +3 -0
  22. package/dist/esm/Message/Message.js +3 -2
  23. package/dist/esm/ResponseActions/ResponseActions.test.js +2 -2
  24. package/package.json +1 -1
  25. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +2 -2
  26. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +19 -6
  27. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDropZone.tsx +2 -1
  28. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithAttachment.tsx +2 -2
  29. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +1 -1
  30. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +1 -1
  31. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
  32. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +1 -1
  33. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +1 -1
  34. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +2 -2
  35. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +4 -4
  36. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +1 -1
  37. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomeInteraction.tsx +1 -1
  38. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomePrompt.tsx +7 -7
  39. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +10 -10
  40. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +1 -1
  41. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +1 -1
  42. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +10 -10
  43. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +1 -1
  44. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +3 -3
  45. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +4 -4
  46. package/src/ChatbotFooter/ChatbotFootnote.tsx +2 -2
  47. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +2 -2
  48. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +3 -3
  49. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +26 -18
  50. package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +2 -2
  51. package/src/Message/Message.tsx +8 -1
  52. package/src/MessageBar/MessageBar.scss +3 -3
  53. package/src/ResponseActions/ResponseActions.test.tsx +4 -2
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { DropdownProps } from '@patternfly/react-core';
3
3
  export interface ChatbotConversationHistoryDropdownProps extends Omit<DropdownProps, 'toggle'> {
4
- /** Dropdown items rendered in conversation options dropdown */
4
+ /** Dropdown items rendered in conversation settings dropdown */
5
5
  menuItems: React.ReactNode;
6
- /** Optional classname applied to conversation options dropdown */
6
+ /** Optional classname applied to conversation settings dropdown */
7
7
  menuClassName?: string;
8
- /** Tooltip content and aria-label applied to conversation options dropdown */
8
+ /** Tooltip content and aria-label applied to conversation settings dropdown */
9
9
  label?: string;
10
10
  /** Callback for when user selects item. */
11
11
  onSelect?: (event?: React.MouseEvent, value?: string | number) => void;
@@ -11,11 +11,11 @@ export interface Conversation {
11
11
  noIcon?: boolean;
12
12
  /** Conversation */
13
13
  text: string;
14
- /** Dropdown items rendered in conversation options dropdown */
14
+ /** Dropdown items rendered in conversation settings dropdown */
15
15
  menuItems?: React.ReactNode;
16
- /** Optional classname applied to conversation options dropdown */
16
+ /** Optional classname applied to conversation settings dropdown */
17
17
  menuClassName?: string;
18
- /** Tooltip content and aria-label applied to conversation options dropdown */
18
+ /** Tooltip content and aria-label applied to conversation settings dropdown */
19
19
  label?: string;
20
20
  /** Callback for when user selects item. */
21
21
  onSelect?: (event?: React.MouseEvent, value?: string | number) => void;
@@ -27,7 +27,7 @@ const ChatbotConversationHistoryDropdown_1 = __importDefault(require("./ChatbotC
27
27
  const LoadingState_1 = __importDefault(require("./LoadingState"));
28
28
  const EmptyState_1 = __importDefault(require("./EmptyState"));
29
29
  const ChatbotConversationHistoryNav = (_a) => {
30
- var { onDrawerToggle, isDrawerOpen, setIsDrawerOpen, activeItemId, onSelectActiveItem, conversations, newChatButtonText = 'New chat', drawerContent, onNewChat, searchInputPlaceholder = 'Search...', searchInputAriaLabel = 'Filter menu items', handleTextInputChange, displayMode, reverseButtonOrder = false, drawerActionsTestId = 'chatbot-nav-drawer-actions', menuProps, drawerPanelContentProps, drawerContentProps, drawerContentBodyProps, drawerHeadProps, drawerActionsProps, drawerCloseButtonProps, drawerPanelBodyProps, isLoading, loadingState, errorState } = _a, props = __rest(_a, ["onDrawerToggle", "isDrawerOpen", "setIsDrawerOpen", "activeItemId", "onSelectActiveItem", "conversations", "newChatButtonText", "drawerContent", "onNewChat", "searchInputPlaceholder", "searchInputAriaLabel", "handleTextInputChange", "displayMode", "reverseButtonOrder", "drawerActionsTestId", "menuProps", "drawerPanelContentProps", "drawerContentProps", "drawerContentBodyProps", "drawerHeadProps", "drawerActionsProps", "drawerCloseButtonProps", "drawerPanelBodyProps", "isLoading", "loadingState", "errorState"]);
30
+ var { onDrawerToggle, isDrawerOpen, setIsDrawerOpen, activeItemId, onSelectActiveItem, conversations, newChatButtonText = 'New chat', drawerContent, onNewChat, searchInputPlaceholder = 'Search previous conversations...', searchInputAriaLabel = 'Filter menu items', handleTextInputChange, displayMode, reverseButtonOrder = false, drawerActionsTestId = 'chatbot-nav-drawer-actions', menuProps, drawerPanelContentProps, drawerContentProps, drawerContentBodyProps, drawerHeadProps, drawerActionsProps, drawerCloseButtonProps, drawerPanelBodyProps, isLoading, loadingState, errorState } = _a, props = __rest(_a, ["onDrawerToggle", "isDrawerOpen", "setIsDrawerOpen", "activeItemId", "onSelectActiveItem", "conversations", "newChatButtonText", "drawerContent", "onNewChat", "searchInputPlaceholder", "searchInputAriaLabel", "handleTextInputChange", "displayMode", "reverseButtonOrder", "drawerActionsTestId", "menuProps", "drawerPanelContentProps", "drawerContentProps", "drawerContentBodyProps", "drawerHeadProps", "drawerActionsProps", "drawerCloseButtonProps", "drawerPanelBodyProps", "isLoading", "loadingState", "errorState"]);
31
31
  const drawerRef = react_1.default.useRef(null);
32
32
  const onExpand = () => {
33
33
  drawerRef.current && drawerRef.current.focus();
@@ -17,7 +17,7 @@ export interface ChatbotFootnotePopover {
17
17
  bannerImage?: ChatbotFootnotePopoverBannerImage;
18
18
  /** Optional CTA button that can be used to trigger an action and close the popover */
19
19
  cta?: ChatbotFootnotePopoverCTA;
20
- /** Optional link that can be used to show and external link like **Learn More** */
20
+ /** Optional link that can be used to show an external link like **View AI policy** */
21
21
  link?: ChatbotFootnotePopoverLink;
22
22
  /** Props for PF Popover */
23
23
  popoverProps?: PopoverProps;
@@ -42,7 +42,7 @@ const ChatbotFootnote = (_a) => {
42
42
  var _a;
43
43
  setIsVisible(false);
44
44
  (_a = popover.cta) === null || _a === void 0 ? void 0 : _a.onClick();
45
- } }, ((_b = popover.cta) === null || _b === void 0 ? void 0 : _b.label) || 'Got it')),
45
+ } }, ((_b = popover.cta) === null || _b === void 0 ? void 0 : _b.label) || 'Dismiss')),
46
46
  (popover === null || popover === void 0 ? void 0 : popover.link) && (react_1.default.createElement(react_core_1.Button, { variant: "link", component: "a", href: popover.link.url, target: "_blank", icon: react_1.default.createElement(external_link_alt_icon_1.ExternalLinkAltIcon, null), iconPosition: "end" }, popover.link.label))));
47
47
  return (react_1.default.createElement("div", Object.assign({ className: `pf-chatbot__footnote ${className !== null && className !== void 0 ? className : ''}` }, props),
48
48
  popover && (react_1.default.createElement(ChatbotPopover_1.default, Object.assign({ className: "pf-chatbot__popover--footnote", "aria-label": ((_c = popover.popoverProps) === null || _c === void 0 ? void 0 : _c['aria-label']) || 'More information', isVisible: isVisible, shouldOpen: (_event, _fn) => setIsVisible(true), shouldClose: (_event, _fn) => setIsVisible(false), bodyContent: popoverBodyContent, footerContent: popoverFooterContent, minWidth: ((_d = popover.popoverProps) === null || _d === void 0 ? void 0 : _d.minWidth) || '432', maxWidth: ((_e = popover.popoverProps) === null || _e === void 0 ? void 0 : _e.maxWidth) || '432', distance: ((_f = popover.popoverProps) === null || _f === void 0 ? void 0 : _f.distance) || 16, showClose: false }, popover.popoverProps),
@@ -18,16 +18,16 @@ exports.ChatbotHeaderSelectorDropdown = void 0;
18
18
  const react_1 = __importDefault(require("react"));
19
19
  const react_core_1 = require("@patternfly/react-core");
20
20
  const ChatbotHeaderSelectorDropdown = (_a) => {
21
- var { value, className, children, onSelect, tooltipProps, tooltipContent = 'Chatbot selector', menuToggleAriaLabel } = _a, props = __rest(_a, ["value", "className", "children", "onSelect", "tooltipProps", "tooltipContent", "menuToggleAriaLabel"]);
21
+ var { value, className, children, onSelect, tooltipProps, tooltipContent = 'Select model', menuToggleAriaLabel } = _a, props = __rest(_a, ["value", "className", "children", "onSelect", "tooltipProps", "tooltipContent", "menuToggleAriaLabel"]);
22
22
  const [isOptionsMenuOpen, setIsOptionsMenuOpen] = react_1.default.useState(false);
23
- const [defaultAriaLabel, setDefaultAriaLabel] = react_1.default.useState('Chatbot selector');
23
+ const [defaultAriaLabel, setDefaultAriaLabel] = react_1.default.useState('Select model');
24
24
  const toggle = (toggleRef) => (react_1.default.createElement(react_core_1.Tooltip, Object.assign({ className: "pf-chatbot__tooltip", content: tooltipContent, position: "bottom",
25
25
  // prevents VO announcements of both aria label and tooltip
26
26
  aria: "none" }, tooltipProps),
27
27
  react_1.default.createElement(react_core_1.MenuToggle, { variant: "secondary", "aria-label": menuToggleAriaLabel !== null && menuToggleAriaLabel !== void 0 ? menuToggleAriaLabel : defaultAriaLabel, ref: toggleRef, isExpanded: isOptionsMenuOpen, onClick: () => setIsOptionsMenuOpen(!isOptionsMenuOpen) }, value)));
28
28
  return (react_1.default.createElement(react_core_1.Dropdown, Object.assign({ className: `pf-chatbot__selections ${className !== null && className !== void 0 ? className : ''}`, isOpen: isOptionsMenuOpen, onSelect: (e, value) => {
29
29
  onSelect && onSelect(e, value);
30
- setDefaultAriaLabel(`Chatbot selector: ${value}`);
30
+ setDefaultAriaLabel(`Select model: ${value}`);
31
31
  setIsOptionsMenuOpen(false);
32
32
  }, onOpenChange: (isOpen) => setIsOptionsMenuOpen(isOpen), popperProps: { position: 'right', appendTo: 'inline' }, shouldFocusToggleOnSelect: true, shouldFocusFirstItemOnOpen: true, toggle: toggle }, props), children));
33
33
  };
@@ -23,13 +23,13 @@ describe('ChatbotHeaderSelectorDropdown', () => {
23
23
  react_1.default.createElement(react_core_1.DropdownItem, null, "Option 3")));
24
24
  it('should render ChatbotHeaderSelectorDropdown', () => {
25
25
  (0, react_2.render)(react_1.default.createElement(ChatbotHeaderSelectorDropdown_1.ChatbotHeaderSelectorDropdown, { value: "Option 1" }, dropdownItems));
26
- expect(react_2.screen.getByRole('button', { name: 'Chatbot selector' })).toBeTruthy();
26
+ expect(react_2.screen.getByRole('button', { name: /Select model/i })).toBeTruthy();
27
27
  });
28
28
  it('should call onselect handler when a dropdown item is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
29
29
  const onSelect = jest.fn();
30
30
  const { container } = (0, react_2.render)(react_1.default.createElement(ChatbotHeaderSelectorDropdown_1.ChatbotHeaderSelectorDropdown, { value: "Option 1", className: "custom-header-selector-dropdown", onSelect: onSelect }, dropdownItems));
31
31
  (0, react_2.act)(() => {
32
- react_2.fireEvent.click(react_2.screen.getByRole('button', { name: 'Chatbot selector' }));
32
+ react_2.fireEvent.click(react_2.screen.getByRole('button', { name: /Select model/i }));
33
33
  });
34
34
  yield (0, react_2.waitFor)(() => {
35
35
  expect(container.querySelector('.custom-header-selector-dropdown')).toBeTruthy();
@@ -19,30 +19,38 @@ const ChatbotWelcomePrompt_1 = __importDefault(require("./ChatbotWelcomePrompt")
19
19
  const user_event_1 = __importDefault(require("@testing-library/user-event"));
20
20
  describe('ChatbotWelcomePrompt', () => {
21
21
  it('should render welcome prompt', () => {
22
- const { container } = (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hello, Chatbot User", description: "How may I help you today?" }));
22
+ const { container } = (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
23
23
  expect(container).toMatchSnapshot();
24
24
  });
25
25
  it('should render correctly', () => {
26
- (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hello, Chatbot User", description: "How may I help you today?" }));
27
- expect(react_2.screen.getByText('Hello, Chatbot User')).toBeTruthy();
28
- expect(react_2.screen.getByText('How may I help you today?')).toBeTruthy();
26
+ (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
27
+ expect(react_2.screen.getByText('Hi, ChatBot User!')).toBeTruthy();
28
+ expect(react_2.screen.getByText('How can I help you today?')).toBeTruthy();
29
29
  });
30
30
  it('should render prompts with titles correctly', () => {
31
- (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hello, Chatbot User", description: "How may I help you today?", prompts: [{ title: 'Topic 1' }] }));
32
- expect(react_2.screen.getByText('Topic 1')).toBeTruthy();
31
+ (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [{ title: 'Set up account' }] }));
32
+ expect(react_2.screen.getByText('Set up account')).toBeTruthy();
33
33
  });
34
34
  it('should render prompts with messages correctly', () => {
35
- (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hello, Chatbot User", description: "How may I help you today?", prompts: [{ title: 'Topic 1', message: 'Helpful prompt for Topic 1' }] }));
36
- expect(react_2.screen.getByText('Helpful prompt for Topic 1')).toBeTruthy();
35
+ (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
36
+ { title: 'Set up account', message: 'Choose the necessary settings and preferences for your account.' }
37
+ ] }));
38
+ expect(react_2.screen.getByText('Choose the necessary settings and preferences for your account.')).toBeTruthy();
37
39
  });
38
40
  it('should render prompts with onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
39
41
  const spy = jest.fn();
40
- (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hello, Chatbot User", description: "How may I help you today?", prompts: [{ title: 'Topic 1', message: 'Helpful prompt for Topic 1', onClick: spy }] }));
41
- yield user_event_1.default.click(react_2.screen.getByRole('button', { name: /Topic 1/i }));
42
+ (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
43
+ {
44
+ title: 'Set up account',
45
+ message: 'Choose the necessary settings and preferences for your account.',
46
+ onClick: spy
47
+ }
48
+ ] }));
49
+ yield user_event_1.default.click(react_2.screen.getByRole('button', { name: /Set up account/i }));
42
50
  expect(spy).toHaveBeenCalled();
43
51
  }));
44
52
  it('should apply className appropriately', () => {
45
- (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hello, Chatbot User", description: "How may I help you today?", className: "test", testId: "welcome-prompt" }));
53
+ (0, react_2.render)(react_1.default.createElement(ChatbotWelcomePrompt_1.default, { title: "Hi, ChatBot User!", description: "How can I help you today?", className: "test", testId: "welcome-prompt" }));
46
54
  const element = react_2.screen.getByTestId('welcome-prompt');
47
55
  expect(element).toHaveClass('test');
48
56
  });
@@ -7,6 +7,7 @@ import QuickResponse from './QuickResponse/QuickResponse';
7
7
  import { UserFeedbackProps } from './UserFeedback/UserFeedback';
8
8
  import { UserFeedbackCompleteProps } from './UserFeedback/UserFeedbackComplete';
9
9
  import { TableProps } from '@patternfly/react-table';
10
+ import { PluggableList } from 'react-markdown/lib';
10
11
  export interface MessageAttachment {
11
12
  /** Name of file attached to the message */
12
13
  name: string;
@@ -97,6 +98,8 @@ export interface MessageProps extends Omit<React.HTMLProps<HTMLDivElement>, 'rol
97
98
  innerRef?: React.Ref<HTMLDivElement>;
98
99
  /** Props for table message. It is important to include a detailed aria-label that describes the purpose of the table. */
99
100
  tableProps?: Required<Pick<TableProps, 'aria-label'>> & TableProps;
101
+ /** Additional rehype plugins passed from the consumer */
102
+ additionalRehypePlugins?: PluggableList;
100
103
  }
101
104
  export declare const MessageBase: React.FunctionComponent<MessageProps>;
102
105
  declare const Message: React.ForwardRefExoticComponent<Omit<MessageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -44,7 +44,7 @@ const ThMessage_1 = __importDefault(require("./TableMessage/ThMessage"));
44
44
  const ImageMessage_1 = __importDefault(require("./ImageMessage/ImageMessage"));
45
45
  const rehype_unwrap_images_1 = __importDefault(require("rehype-unwrap-images"));
46
46
  const MessageBase = (_a) => {
47
- var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps"]);
47
+ var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, additionalRehypePlugins = [] } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "additionalRehypePlugins"]);
48
48
  const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
49
49
  let avatarClassName;
50
50
  if (avatarProps && 'className' in avatarProps) {
@@ -55,6 +55,7 @@ const MessageBase = (_a) => {
55
55
  // Keep timestamps consistent between Timestamp component and aria-label
56
56
  const date = new Date();
57
57
  const dateString = timestamp !== null && timestamp !== void 0 ? timestamp : `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
58
+ const rehypePlugins = [rehype_unwrap_images_1.default, ...(additionalRehypePlugins !== null && additionalRehypePlugins !== void 0 ? additionalRehypePlugins : [])];
58
59
  return (react_1.default.createElement("section", Object.assign({ "aria-label": `Message from ${role} - ${dateString}`, className: `pf-chatbot__message pf-chatbot__message--${role}`, "aria-live": isLiveRegion ? 'polite' : undefined, "aria-atomic": isLiveRegion ? false : undefined, ref: innerRef }, props),
59
60
  react_1.default.createElement(react_core_1.Avatar, Object.assign({ className: `pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`, src: avatar, alt: "" }, avatarProps)),
60
61
  react_1.default.createElement("div", { className: "pf-chatbot__message-contents" },
@@ -95,7 +96,7 @@ const MessageBase = (_a) => {
95
96
  },
96
97
  th: (props) => react_1.default.createElement(ThMessage_1.default, Object.assign({}, props)),
97
98
  img: (props) => react_1.default.createElement(ImageMessage_1.default, Object.assign({}, props))
98
- }, remarkPlugins: [remark_gfm_1.default], rehypePlugins: [rehype_unwrap_images_1.default] }, content),
99
+ }, remarkPlugins: [remark_gfm_1.default], rehypePlugins: rehypePlugins }, content),
99
100
  afterMainContent && react_1.default.createElement(react_1.default.Fragment, null, afterMainContent))),
100
101
  !isLoading && sources && react_1.default.createElement(SourcesCard_1.default, Object.assign({}, sources)),
101
102
  quickStarts && quickStarts.quickStart && (react_1.default.createElement(QuickStartTile_1.default, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel })),
@@ -88,7 +88,7 @@ describe('ResponseActions', () => {
88
88
  }));
89
89
  it('should handle click outside of group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
90
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: {
91
+ (0, react_2.render)(react_1.default.createElement(Message_1.default, { name: "Bot", role: "bot", avatar: "", content: "I updated your account with those settings. You're ready to set up your first dashboard!", actions: {
92
92
  positive: {},
93
93
  negative: {}
94
94
  } }));
@@ -102,7 +102,7 @@ describe('ResponseActions', () => {
102
102
  yield user_event_1.default.click(badBtn);
103
103
  expect(react_2.screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
104
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'));
105
+ yield user_event_1.default.click(react_2.screen.getByText("I updated your account with those settings. You're ready to set up your first dashboard!"));
106
106
  expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
107
107
  expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
108
108
  }));
package/dist/css/main.css CHANGED
@@ -1616,13 +1616,13 @@
1616
1616
  .pf-chatbot__message-textarea .pf-v6-c-form-control__textarea:focus-visible {
1617
1617
  outline: none;
1618
1618
  }
1619
- .pf-chatbot__message-textarea .pf-v6-c-form-control > textarea {
1620
- outline-offset: 0px;
1619
+ .pf-chatbot__message-textarea textarea {
1620
+ outline-offset: 0px !important;
1621
1621
  --pf-v6-c-form-control--PaddingBlockStart: 0;
1622
1622
  --pf-v6-c-form-control--PaddingBlockEnd: 0;
1623
1623
  --pf-v6-c-form-control--BorderRadius: 0;
1624
1624
  }
1625
- .pf-chatbot__message-textarea .pf-v6-c-form-control > textarea:focus-visible {
1625
+ .pf-chatbot__message-textarea textarea:focus-visible {
1626
1626
  outline: none;
1627
1627
  }
1628
1628
 
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { DropdownProps } from '@patternfly/react-core';
3
3
  export interface ChatbotConversationHistoryDropdownProps extends Omit<DropdownProps, 'toggle'> {
4
- /** Dropdown items rendered in conversation options dropdown */
4
+ /** Dropdown items rendered in conversation settings dropdown */
5
5
  menuItems: React.ReactNode;
6
- /** Optional classname applied to conversation options dropdown */
6
+ /** Optional classname applied to conversation settings dropdown */
7
7
  menuClassName?: string;
8
- /** Tooltip content and aria-label applied to conversation options dropdown */
8
+ /** Tooltip content and aria-label applied to conversation settings dropdown */
9
9
  label?: string;
10
10
  /** Callback for when user selects item. */
11
11
  onSelect?: (event?: React.MouseEvent, value?: string | number) => void;
@@ -11,11 +11,11 @@ export interface Conversation {
11
11
  noIcon?: boolean;
12
12
  /** Conversation */
13
13
  text: string;
14
- /** Dropdown items rendered in conversation options dropdown */
14
+ /** Dropdown items rendered in conversation settings dropdown */
15
15
  menuItems?: React.ReactNode;
16
- /** Optional classname applied to conversation options dropdown */
16
+ /** Optional classname applied to conversation settings dropdown */
17
17
  menuClassName?: string;
18
- /** Tooltip content and aria-label applied to conversation options dropdown */
18
+ /** Tooltip content and aria-label applied to conversation settings dropdown */
19
19
  label?: string;
20
20
  /** Callback for when user selects item. */
21
21
  onSelect?: (event?: React.MouseEvent, value?: string | number) => void;
@@ -21,7 +21,7 @@ import ConversationHistoryDropdown from './ChatbotConversationHistoryDropdown';
21
21
  import LoadingState from './LoadingState';
22
22
  import HistoryEmptyState from './EmptyState';
23
23
  export const ChatbotConversationHistoryNav = (_a) => {
24
- var { onDrawerToggle, isDrawerOpen, setIsDrawerOpen, activeItemId, onSelectActiveItem, conversations, newChatButtonText = 'New chat', drawerContent, onNewChat, searchInputPlaceholder = 'Search...', searchInputAriaLabel = 'Filter menu items', handleTextInputChange, displayMode, reverseButtonOrder = false, drawerActionsTestId = 'chatbot-nav-drawer-actions', menuProps, drawerPanelContentProps, drawerContentProps, drawerContentBodyProps, drawerHeadProps, drawerActionsProps, drawerCloseButtonProps, drawerPanelBodyProps, isLoading, loadingState, errorState } = _a, props = __rest(_a, ["onDrawerToggle", "isDrawerOpen", "setIsDrawerOpen", "activeItemId", "onSelectActiveItem", "conversations", "newChatButtonText", "drawerContent", "onNewChat", "searchInputPlaceholder", "searchInputAriaLabel", "handleTextInputChange", "displayMode", "reverseButtonOrder", "drawerActionsTestId", "menuProps", "drawerPanelContentProps", "drawerContentProps", "drawerContentBodyProps", "drawerHeadProps", "drawerActionsProps", "drawerCloseButtonProps", "drawerPanelBodyProps", "isLoading", "loadingState", "errorState"]);
24
+ var { onDrawerToggle, isDrawerOpen, setIsDrawerOpen, activeItemId, onSelectActiveItem, conversations, newChatButtonText = 'New chat', drawerContent, onNewChat, searchInputPlaceholder = 'Search previous conversations...', searchInputAriaLabel = 'Filter menu items', handleTextInputChange, displayMode, reverseButtonOrder = false, drawerActionsTestId = 'chatbot-nav-drawer-actions', menuProps, drawerPanelContentProps, drawerContentProps, drawerContentBodyProps, drawerHeadProps, drawerActionsProps, drawerCloseButtonProps, drawerPanelBodyProps, isLoading, loadingState, errorState } = _a, props = __rest(_a, ["onDrawerToggle", "isDrawerOpen", "setIsDrawerOpen", "activeItemId", "onSelectActiveItem", "conversations", "newChatButtonText", "drawerContent", "onNewChat", "searchInputPlaceholder", "searchInputAriaLabel", "handleTextInputChange", "displayMode", "reverseButtonOrder", "drawerActionsTestId", "menuProps", "drawerPanelContentProps", "drawerContentProps", "drawerContentBodyProps", "drawerHeadProps", "drawerActionsProps", "drawerCloseButtonProps", "drawerPanelBodyProps", "isLoading", "loadingState", "errorState"]);
25
25
  const drawerRef = React.useRef(null);
26
26
  const onExpand = () => {
27
27
  drawerRef.current && drawerRef.current.focus();
@@ -17,7 +17,7 @@ export interface ChatbotFootnotePopover {
17
17
  bannerImage?: ChatbotFootnotePopoverBannerImage;
18
18
  /** Optional CTA button that can be used to trigger an action and close the popover */
19
19
  cta?: ChatbotFootnotePopoverCTA;
20
- /** Optional link that can be used to show and external link like **Learn More** */
20
+ /** Optional link that can be used to show an external link like **View AI policy** */
21
21
  link?: ChatbotFootnotePopoverLink;
22
22
  /** Props for PF Popover */
23
23
  popoverProps?: PopoverProps;
@@ -36,7 +36,7 @@ export const ChatbotFootnote = (_a) => {
36
36
  var _a;
37
37
  setIsVisible(false);
38
38
  (_a = popover.cta) === null || _a === void 0 ? void 0 : _a.onClick();
39
- } }, ((_b = popover.cta) === null || _b === void 0 ? void 0 : _b.label) || 'Got it')),
39
+ } }, ((_b = popover.cta) === null || _b === void 0 ? void 0 : _b.label) || 'Dismiss')),
40
40
  (popover === null || popover === void 0 ? void 0 : popover.link) && (React.createElement(Button, { variant: "link", component: "a", href: popover.link.url, target: "_blank", icon: React.createElement(ExternalLinkAltIcon, null), iconPosition: "end" }, popover.link.label))));
41
41
  return (React.createElement("div", Object.assign({ className: `pf-chatbot__footnote ${className !== null && className !== void 0 ? className : ''}` }, props),
42
42
  popover && (React.createElement(ChatbotPopover, Object.assign({ className: "pf-chatbot__popover--footnote", "aria-label": ((_c = popover.popoverProps) === null || _c === void 0 ? void 0 : _c['aria-label']) || 'More information', isVisible: isVisible, shouldOpen: (_event, _fn) => setIsVisible(true), shouldClose: (_event, _fn) => setIsVisible(false), bodyContent: popoverBodyContent, footerContent: popoverFooterContent, minWidth: ((_d = popover.popoverProps) === null || _d === void 0 ? void 0 : _d.minWidth) || '432', maxWidth: ((_e = popover.popoverProps) === null || _e === void 0 ? void 0 : _e.maxWidth) || '432', distance: ((_f = popover.popoverProps) === null || _f === void 0 ? void 0 : _f.distance) || 16, showClose: false }, popover.popoverProps),
@@ -12,16 +12,16 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import { Tooltip, Dropdown, MenuToggle } from '@patternfly/react-core';
14
14
  export const ChatbotHeaderSelectorDropdown = (_a) => {
15
- var { value, className, children, onSelect, tooltipProps, tooltipContent = 'Chatbot selector', menuToggleAriaLabel } = _a, props = __rest(_a, ["value", "className", "children", "onSelect", "tooltipProps", "tooltipContent", "menuToggleAriaLabel"]);
15
+ var { value, className, children, onSelect, tooltipProps, tooltipContent = 'Select model', menuToggleAriaLabel } = _a, props = __rest(_a, ["value", "className", "children", "onSelect", "tooltipProps", "tooltipContent", "menuToggleAriaLabel"]);
16
16
  const [isOptionsMenuOpen, setIsOptionsMenuOpen] = React.useState(false);
17
- const [defaultAriaLabel, setDefaultAriaLabel] = React.useState('Chatbot selector');
17
+ const [defaultAriaLabel, setDefaultAriaLabel] = React.useState('Select model');
18
18
  const toggle = (toggleRef) => (React.createElement(Tooltip, Object.assign({ className: "pf-chatbot__tooltip", content: tooltipContent, position: "bottom",
19
19
  // prevents VO announcements of both aria label and tooltip
20
20
  aria: "none" }, tooltipProps),
21
21
  React.createElement(MenuToggle, { variant: "secondary", "aria-label": menuToggleAriaLabel !== null && menuToggleAriaLabel !== void 0 ? menuToggleAriaLabel : defaultAriaLabel, ref: toggleRef, isExpanded: isOptionsMenuOpen, onClick: () => setIsOptionsMenuOpen(!isOptionsMenuOpen) }, value)));
22
22
  return (React.createElement(Dropdown, Object.assign({ className: `pf-chatbot__selections ${className !== null && className !== void 0 ? className : ''}`, isOpen: isOptionsMenuOpen, onSelect: (e, value) => {
23
23
  onSelect && onSelect(e, value);
24
- setDefaultAriaLabel(`Chatbot selector: ${value}`);
24
+ setDefaultAriaLabel(`Select model: ${value}`);
25
25
  setIsOptionsMenuOpen(false);
26
26
  }, onOpenChange: (isOpen) => setIsOptionsMenuOpen(isOpen), popperProps: { position: 'right', appendTo: 'inline' }, shouldFocusToggleOnSelect: true, shouldFocusFirstItemOnOpen: true, toggle: toggle }, props), children));
27
27
  };
@@ -18,13 +18,13 @@ describe('ChatbotHeaderSelectorDropdown', () => {
18
18
  React.createElement(DropdownItem, null, "Option 3")));
19
19
  it('should render ChatbotHeaderSelectorDropdown', () => {
20
20
  render(React.createElement(ChatbotHeaderSelectorDropdown, { value: "Option 1" }, dropdownItems));
21
- expect(screen.getByRole('button', { name: 'Chatbot selector' })).toBeTruthy();
21
+ expect(screen.getByRole('button', { name: /Select model/i })).toBeTruthy();
22
22
  });
23
23
  it('should call onselect handler when a dropdown item is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
24
24
  const onSelect = jest.fn();
25
25
  const { container } = render(React.createElement(ChatbotHeaderSelectorDropdown, { value: "Option 1", className: "custom-header-selector-dropdown", onSelect: onSelect }, dropdownItems));
26
26
  act(() => {
27
- fireEvent.click(screen.getByRole('button', { name: 'Chatbot selector' }));
27
+ fireEvent.click(screen.getByRole('button', { name: /Select model/i }));
28
28
  });
29
29
  yield waitFor(() => {
30
30
  expect(container.querySelector('.custom-header-selector-dropdown')).toBeTruthy();
@@ -14,30 +14,38 @@ import ChatbotWelcomePrompt from './ChatbotWelcomePrompt';
14
14
  import userEvent from '@testing-library/user-event';
15
15
  describe('ChatbotWelcomePrompt', () => {
16
16
  it('should render welcome prompt', () => {
17
- const { container } = render(React.createElement(ChatbotWelcomePrompt, { title: "Hello, Chatbot User", description: "How may I help you today?" }));
17
+ const { container } = render(React.createElement(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
18
18
  expect(container).toMatchSnapshot();
19
19
  });
20
20
  it('should render correctly', () => {
21
- render(React.createElement(ChatbotWelcomePrompt, { title: "Hello, Chatbot User", description: "How may I help you today?" }));
22
- expect(screen.getByText('Hello, Chatbot User')).toBeTruthy();
23
- expect(screen.getByText('How may I help you today?')).toBeTruthy();
21
+ render(React.createElement(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?" }));
22
+ expect(screen.getByText('Hi, ChatBot User!')).toBeTruthy();
23
+ expect(screen.getByText('How can I help you today?')).toBeTruthy();
24
24
  });
25
25
  it('should render prompts with titles correctly', () => {
26
- render(React.createElement(ChatbotWelcomePrompt, { title: "Hello, Chatbot User", description: "How may I help you today?", prompts: [{ title: 'Topic 1' }] }));
27
- expect(screen.getByText('Topic 1')).toBeTruthy();
26
+ render(React.createElement(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [{ title: 'Set up account' }] }));
27
+ expect(screen.getByText('Set up account')).toBeTruthy();
28
28
  });
29
29
  it('should render prompts with messages correctly', () => {
30
- render(React.createElement(ChatbotWelcomePrompt, { title: "Hello, Chatbot User", description: "How may I help you today?", prompts: [{ title: 'Topic 1', message: 'Helpful prompt for Topic 1' }] }));
31
- expect(screen.getByText('Helpful prompt for Topic 1')).toBeTruthy();
30
+ render(React.createElement(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
31
+ { title: 'Set up account', message: 'Choose the necessary settings and preferences for your account.' }
32
+ ] }));
33
+ expect(screen.getByText('Choose the necessary settings and preferences for your account.')).toBeTruthy();
32
34
  });
33
35
  it('should render prompts with onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
34
36
  const spy = jest.fn();
35
- render(React.createElement(ChatbotWelcomePrompt, { title: "Hello, Chatbot User", description: "How may I help you today?", prompts: [{ title: 'Topic 1', message: 'Helpful prompt for Topic 1', onClick: spy }] }));
36
- yield userEvent.click(screen.getByRole('button', { name: /Topic 1/i }));
37
+ render(React.createElement(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", prompts: [
38
+ {
39
+ title: 'Set up account',
40
+ message: 'Choose the necessary settings and preferences for your account.',
41
+ onClick: spy
42
+ }
43
+ ] }));
44
+ yield userEvent.click(screen.getByRole('button', { name: /Set up account/i }));
37
45
  expect(spy).toHaveBeenCalled();
38
46
  }));
39
47
  it('should apply className appropriately', () => {
40
- render(React.createElement(ChatbotWelcomePrompt, { title: "Hello, Chatbot User", description: "How may I help you today?", className: "test", testId: "welcome-prompt" }));
48
+ render(React.createElement(ChatbotWelcomePrompt, { title: "Hi, ChatBot User!", description: "How can I help you today?", className: "test", testId: "welcome-prompt" }));
41
49
  const element = screen.getByTestId('welcome-prompt');
42
50
  expect(element).toHaveClass('test');
43
51
  });
@@ -7,6 +7,7 @@ import QuickResponse from './QuickResponse/QuickResponse';
7
7
  import { UserFeedbackProps } from './UserFeedback/UserFeedback';
8
8
  import { UserFeedbackCompleteProps } from './UserFeedback/UserFeedbackComplete';
9
9
  import { TableProps } from '@patternfly/react-table';
10
+ import { PluggableList } from 'react-markdown/lib';
10
11
  export interface MessageAttachment {
11
12
  /** Name of file attached to the message */
12
13
  name: string;
@@ -97,6 +98,8 @@ export interface MessageProps extends Omit<React.HTMLProps<HTMLDivElement>, 'rol
97
98
  innerRef?: React.Ref<HTMLDivElement>;
98
99
  /** Props for table message. It is important to include a detailed aria-label that describes the purpose of the table. */
99
100
  tableProps?: Required<Pick<TableProps, 'aria-label'>> & TableProps;
101
+ /** Additional rehype plugins passed from the consumer */
102
+ additionalRehypePlugins?: PluggableList;
100
103
  }
101
104
  export declare const MessageBase: React.FunctionComponent<MessageProps>;
102
105
  declare const Message: React.ForwardRefExoticComponent<Omit<MessageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -38,7 +38,7 @@ import ThMessage from './TableMessage/ThMessage';
38
38
  import ImageMessage from './ImageMessage/ImageMessage';
39
39
  import rehypeUnwrapImages from 'rehype-unwrap-images';
40
40
  export const MessageBase = (_a) => {
41
- var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps"]);
41
+ var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, additionalRehypePlugins = [] } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "additionalRehypePlugins"]);
42
42
  const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
43
43
  let avatarClassName;
44
44
  if (avatarProps && 'className' in avatarProps) {
@@ -49,6 +49,7 @@ export const MessageBase = (_a) => {
49
49
  // Keep timestamps consistent between Timestamp component and aria-label
50
50
  const date = new Date();
51
51
  const dateString = timestamp !== null && timestamp !== void 0 ? timestamp : `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
52
+ const rehypePlugins = [rehypeUnwrapImages, ...(additionalRehypePlugins !== null && additionalRehypePlugins !== void 0 ? additionalRehypePlugins : [])];
52
53
  return (React.createElement("section", Object.assign({ "aria-label": `Message from ${role} - ${dateString}`, className: `pf-chatbot__message pf-chatbot__message--${role}`, "aria-live": isLiveRegion ? 'polite' : undefined, "aria-atomic": isLiveRegion ? false : undefined, ref: innerRef }, props),
53
54
  React.createElement(Avatar, Object.assign({ className: `pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`, src: avatar, alt: "" }, avatarProps)),
54
55
  React.createElement("div", { className: "pf-chatbot__message-contents" },
@@ -89,7 +90,7 @@ export const MessageBase = (_a) => {
89
90
  },
90
91
  th: (props) => React.createElement(ThMessage, Object.assign({}, props)),
91
92
  img: (props) => React.createElement(ImageMessage, Object.assign({}, props))
92
- }, remarkPlugins: [remarkGfm], rehypePlugins: [rehypeUnwrapImages] }, content),
93
+ }, remarkPlugins: [remarkGfm], rehypePlugins: rehypePlugins }, content),
93
94
  afterMainContent && React.createElement(React.Fragment, null, afterMainContent))),
94
95
  !isLoading && sources && React.createElement(SourcesCard, Object.assign({}, sources)),
95
96
  quickStarts && quickStarts.quickStart && (React.createElement(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel })),
@@ -83,7 +83,7 @@ describe('ResponseActions', () => {
83
83
  }));
84
84
  it('should handle click outside of group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
85
85
  // using message just so we have something outside the group that's rendered
86
- render(React.createElement(Message, { name: "Bot", role: "bot", avatar: "", content: "Example with all prebuilt actions", actions: {
86
+ render(React.createElement(Message, { name: "Bot", role: "bot", avatar: "", content: "I updated your account with those settings. You're ready to set up your first dashboard!", actions: {
87
87
  positive: {},
88
88
  negative: {}
89
89
  } }));
@@ -97,7 +97,7 @@ describe('ResponseActions', () => {
97
97
  yield userEvent.click(badBtn);
98
98
  expect(screen.getByRole('button', { name: 'Response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
99
99
  expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
100
- yield userEvent.click(screen.getByText('Example with all prebuilt actions'));
100
+ yield userEvent.click(screen.getByText("I updated your account with those settings. You're ready to set up your first dashboard!"));
101
101
  expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
102
102
  expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
103
103
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/chatbot",
3
- "version": "2.2.0-prerelease.27",
3
+ "version": "2.2.0-prerelease.29",
4
4
  "description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -6,8 +6,8 @@ export const AttachmentErrorExample: React.FunctionComponent = () => (
6
6
  variant="danger"
7
7
  // eslint-disable-next-line no-console
8
8
  onClose={() => console.log('Clicked the close button')}
9
- title="File upload failed"
9
+ title="Could not upload file"
10
10
  >
11
- Your file size is too large. Please ensure that your file is less than 25 MB.
11
+ Your file size must be less than 25 MB.
12
12
  </ChatbotAlert>
13
13
  );
@@ -117,8 +117,8 @@ _Italic text, formatted with single underscores_
117
117
 
118
118
  1. **Using a \`toaster\`:**
119
119
 
120
- - Place \`bread\` in a \`toaster\`
121
- - Once \`bread\` is lightly browned, remove from \`toaster\`
120
+ - Place \`bread\` in a \`toaster\`.
121
+ - Once \`bread\` is lightly browned, remove from \`toaster\`.
122
122
 
123
123
  2. **Using a \`knife\`:**
124
124
 
@@ -142,19 +142,32 @@ _Italic text, formatted with single underscores_
142
142
 
143
143
  return (
144
144
  <>
145
- <Message name="Bot" role="bot" avatar={patternflyAvatar} content={`Text-based message from a bot named "Bot"`} />
146
- <Message role="bot" avatar={patternflyAvatar} content="Text-based message from a nameless bot" />
145
+ <Message
146
+ name="Bot"
147
+ role="bot"
148
+ avatar={patternflyAvatar}
149
+ content={`This is a text-based message from a bot named "Bot."`}
150
+ />
151
+ <Message
152
+ name="Bot"
153
+ role="bot"
154
+ avatar={patternflyAvatar}
155
+ content={`This is a text-based message from "Bot," with an updated timestamp.`}
156
+ timestamp="1 hour ago"
157
+ />
158
+ <Message name="Bot" role="bot" avatar={patternflyAvatar} content="Example content" isLoading />
159
+ <Message role="bot" avatar={patternflyAvatar} content="This message is from a nameless bot." />
147
160
  <Message
148
161
  name="Default Openshift Container Platform Assistant That Can Help With Any Query You Might Need Help With"
149
162
  role="bot"
150
163
  avatar={patternflyAvatar}
151
- content="Text-based message, where the bot's name is truncated"
164
+ content="This is a message from a bot with really long name: it's truncated!"
152
165
  />
153
166
  <Message
154
167
  name="Bot"
155
168
  role="bot"
156
169
  avatar={squareImg}
157
- content="Text-based message from a bot with a square avatar. You can further customize the avatar by applying an additional class or passing [PatternFly avatar props](/components/avatar) to the `<Message>` component via `avatarProps`."
170
+ content="This bot has a square avatar. You can further customize the avatar by applying an additional class or passing [PatternFly avatar props](/components/avatar) to the `<Message>` component via `avatarProps`."
158
171
  hasRoundAvatar={false}
159
172
  />
160
173
  <Message
@@ -53,7 +53,8 @@ export const DropzoneExample: React.FunctionComponent = () => {
53
53
  return (
54
54
  <FileDropZone onFileDrop={handleFileDrop} displayMode="fullscreen">
55
55
  <div className="pf-chatbot__file-drop-zone-example">
56
- Content that shows when no dragging is happening (drag an item here to see the drop zone)
56
+ This is example content that would be shown when no dragging is happening. To see the drop zone, start to drag
57
+ an item into this section. The static content will be replaced by an active drop zone message.
57
58
  </div>
58
59
  </FileDropZone>
59
60
  );
@@ -32,14 +32,14 @@ export const AttachmentMenuExample: React.FunctionComponent = () => {
32
32
  name="User"
33
33
  role="user"
34
34
  avatar={userAvatar}
35
- content="Here is an uploaded file"
35
+ content="Here is an uploaded file:"
36
36
  attachments={[{ name: 'auth-operator.yml', id: '1', onClick, onClose }]}
37
37
  />
38
38
  <Message
39
39
  name="User"
40
40
  role="user"
41
41
  avatar={userAvatar}
42
- content="Here are two uploaded files"
42
+ content="Here are 2 uploaded files:"
43
43
  attachments={[
44
44
  { name: 'auth-operator.yml', id: '1' },
45
45
  { name: 'patternfly.svg', id: '2' }
@@ -11,7 +11,7 @@ export const CustomActionExample: React.FunctionComponent = () => (
11
11
  name="Bot"
12
12
  role="bot"
13
13
  avatar={patternflyAvatar}
14
- content="Example with custom actions"
14
+ content="I updated your account with those settings. You're ready to set up your first dashboard!"
15
15
  actions={{
16
16
  regenerate: {
17
17
  ariaLabel: 'Regenerate',