@patternfly/chatbot 2.2.0-prerelease.26 → 2.2.0-prerelease.28

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 (65) hide show
  1. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -3
  2. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +11 -4
  3. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +22 -10
  4. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +60 -0
  5. package/dist/cjs/ChatbotConversationHistoryNav/EmptyState.d.ts +11 -0
  6. package/dist/cjs/ChatbotConversationHistoryNav/EmptyState.js +29 -0
  7. package/dist/cjs/ChatbotConversationHistoryNav/LoadingState.d.ts +4 -0
  8. package/dist/cjs/ChatbotConversationHistoryNav/LoadingState.js +45 -0
  9. package/dist/cjs/ChatbotFooter/ChatbotFootnote.d.ts +1 -1
  10. package/dist/cjs/ChatbotFooter/ChatbotFootnote.js +1 -1
  11. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -3
  12. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +2 -2
  13. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +19 -11
  14. package/dist/cjs/ResponseActions/ResponseActions.test.js +2 -2
  15. package/dist/css/main.css +17 -3
  16. package/dist/css/main.css.map +1 -1
  17. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -3
  18. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +11 -4
  19. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +22 -10
  20. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +60 -0
  21. package/dist/esm/ChatbotConversationHistoryNav/EmptyState.d.ts +11 -0
  22. package/dist/esm/ChatbotConversationHistoryNav/EmptyState.js +22 -0
  23. package/dist/esm/ChatbotConversationHistoryNav/LoadingState.d.ts +4 -0
  24. package/dist/esm/ChatbotConversationHistoryNav/LoadingState.js +38 -0
  25. package/dist/esm/ChatbotFooter/ChatbotFootnote.d.ts +1 -1
  26. package/dist/esm/ChatbotFooter/ChatbotFootnote.js +1 -1
  27. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +3 -3
  28. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +2 -2
  29. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +19 -11
  30. package/dist/esm/ResponseActions/ResponseActions.test.js +2 -2
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +1 -1
  33. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +2 -2
  34. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +19 -6
  35. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDropZone.tsx +2 -1
  36. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithAttachment.tsx +2 -2
  37. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +1 -1
  38. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +1 -1
  39. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
  40. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +1 -1
  41. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +1 -1
  42. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +2 -2
  43. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +4 -4
  44. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +1 -1
  45. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +34 -1
  46. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomeInteraction.tsx +1 -1
  47. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomePrompt.tsx +7 -7
  48. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +10 -10
  49. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +1 -1
  50. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +1 -1
  51. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +10 -10
  52. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +1 -1
  53. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +3 -3
  54. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +14 -0
  55. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +130 -0
  56. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +60 -25
  57. package/src/ChatbotConversationHistoryNav/EmptyState.tsx +44 -0
  58. package/src/ChatbotConversationHistoryNav/LoadingState.tsx +38 -0
  59. package/src/ChatbotFooter/ChatbotFootnote.tsx +2 -2
  60. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.tsx +2 -2
  61. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +3 -3
  62. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +26 -18
  63. package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +2 -2
  64. package/src/MessageBar/MessageBar.scss +3 -3
  65. package/src/ResponseActions/ResponseActions.test.tsx +4 -2
@@ -0,0 +1,38 @@
1
+ import { Skeleton, SkeletonProps } from '@patternfly/react-core';
2
+ import React from 'react';
3
+
4
+ export const LoadingState: React.FunctionComponent<SkeletonProps> = ({ screenreaderText, ...rest }: SkeletonProps) => (
5
+ <div className="pf-chatbot__history-loading">
6
+ <div className="pf-chatbot__history-loading-block">
7
+ <Skeleton
8
+ screenreaderText={screenreaderText ?? 'Loading chatbot conversation history'}
9
+ fontSize="3xl"
10
+ {...rest}
11
+ />
12
+ </div>
13
+ <div className="pf-chatbot__history-loading-block">
14
+ <Skeleton fontSize="sm" width="70%" {...rest} />
15
+ <Skeleton fontSize="3xl" {...rest} />
16
+ <Skeleton fontSize="3xl" {...rest} />
17
+ </div>
18
+ <div className="pf-chatbot__history-loading-block">
19
+ <Skeleton fontSize="sm" width="70%" {...rest} />
20
+ <Skeleton fontSize="3xl" {...rest} />
21
+ <Skeleton fontSize="3xl" {...rest} />
22
+ <Skeleton fontSize="3xl" {...rest} />
23
+ </div>
24
+ <div className="pf-chatbot__history-loading-block">
25
+ <Skeleton fontSize="sm" width="70%" {...rest} />
26
+ <Skeleton fontSize="3xl" {...rest} />
27
+ <Skeleton fontSize="3xl" {...rest} />
28
+ <Skeleton fontSize="3xl" {...rest} />
29
+ <Skeleton fontSize="3xl" {...rest} />
30
+ </div>
31
+ <div className="pf-chatbot__history-loading-block">
32
+ <Skeleton fontSize="sm" width="70%" {...rest} />
33
+ <Skeleton fontSize="3xl" {...rest} />
34
+ </div>
35
+ </div>
36
+ );
37
+
38
+ export default LoadingState;
@@ -32,7 +32,7 @@ export interface ChatbotFootnotePopover {
32
32
  bannerImage?: ChatbotFootnotePopoverBannerImage;
33
33
  /** Optional CTA button that can be used to trigger an action and close the popover */
34
34
  cta?: ChatbotFootnotePopoverCTA;
35
- /** Optional link that can be used to show and external link like **Learn More** */
35
+ /** Optional link that can be used to show an external link like **View AI policy** */
36
36
  link?: ChatbotFootnotePopoverLink;
37
37
  /** Props for PF Popover */
38
38
  popoverProps?: PopoverProps;
@@ -87,7 +87,7 @@ export const ChatbotFootnote: React.FunctionComponent<ChatbotFootnoteProps> = ({
87
87
  popover.cta?.onClick();
88
88
  }}
89
89
  >
90
- {popover.cta?.label || 'Got it'}
90
+ {popover.cta?.label || 'Dismiss'}
91
91
  </Button>
92
92
  )}
93
93
  {popover?.link && (
@@ -15,7 +15,7 @@ describe('ChatbotHeaderSelectorDropdown', () => {
15
15
  it('should render ChatbotHeaderSelectorDropdown', () => {
16
16
  render(<ChatbotHeaderSelectorDropdown value="Option 1">{dropdownItems}</ChatbotHeaderSelectorDropdown>);
17
17
 
18
- expect(screen.getByRole('button', { name: 'Chatbot selector' })).toBeTruthy();
18
+ expect(screen.getByRole('button', { name: /Select model/i })).toBeTruthy();
19
19
  });
20
20
 
21
21
  it('should call onselect handler when a dropdown item is clicked', async () => {
@@ -27,7 +27,7 @@ describe('ChatbotHeaderSelectorDropdown', () => {
27
27
  );
28
28
 
29
29
  act(() => {
30
- fireEvent.click(screen.getByRole('button', { name: 'Chatbot selector' }));
30
+ fireEvent.click(screen.getByRole('button', { name: /Select model/i }));
31
31
  });
32
32
 
33
33
  await waitFor(() => {
@@ -23,12 +23,12 @@ export const ChatbotHeaderSelectorDropdown: React.FunctionComponent<ChatbotHeade
23
23
  children,
24
24
  onSelect,
25
25
  tooltipProps,
26
- tooltipContent = 'Chatbot selector',
26
+ tooltipContent = 'Select model',
27
27
  menuToggleAriaLabel,
28
28
  ...props
29
29
  }: ChatbotHeaderSelectorDropdownProps) => {
30
30
  const [isOptionsMenuOpen, setIsOptionsMenuOpen] = React.useState(false);
31
- const [defaultAriaLabel, setDefaultAriaLabel] = React.useState('Chatbot selector');
31
+ const [defaultAriaLabel, setDefaultAriaLabel] = React.useState('Select model');
32
32
 
33
33
  const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
34
34
  <Tooltip
@@ -57,7 +57,7 @@ export const ChatbotHeaderSelectorDropdown: React.FunctionComponent<ChatbotHeade
57
57
  isOpen={isOptionsMenuOpen}
58
58
  onSelect={(e, value) => {
59
59
  onSelect && onSelect(e, value);
60
- setDefaultAriaLabel(`Chatbot selector: ${value}`);
60
+ setDefaultAriaLabel(`Select model: ${value}`);
61
61
  setIsOptionsMenuOpen(false);
62
62
  }}
63
63
  onOpenChange={(isOpen) => setIsOptionsMenuOpen(isOpen)}
@@ -7,53 +7,61 @@ import userEvent from '@testing-library/user-event';
7
7
  describe('ChatbotWelcomePrompt', () => {
8
8
  it('should render welcome prompt', () => {
9
9
  const { container } = render(
10
- <ChatbotWelcomePrompt title="Hello, Chatbot User" description="How may I help you today?" />
10
+ <ChatbotWelcomePrompt title="Hi, ChatBot User!" description="How can I help you today?" />
11
11
  );
12
12
  expect(container).toMatchSnapshot();
13
13
  });
14
14
 
15
15
  it('should render correctly', () => {
16
- render(<ChatbotWelcomePrompt title="Hello, Chatbot User" description="How may I help you today?" />);
17
- expect(screen.getByText('Hello, Chatbot User')).toBeTruthy();
18
- expect(screen.getByText('How may I help you today?')).toBeTruthy();
16
+ render(<ChatbotWelcomePrompt title="Hi, ChatBot User!" description="How can I help you today?" />);
17
+ expect(screen.getByText('Hi, ChatBot User!')).toBeTruthy();
18
+ expect(screen.getByText('How can I help you today?')).toBeTruthy();
19
19
  });
20
20
  it('should render prompts with titles correctly', () => {
21
21
  render(
22
22
  <ChatbotWelcomePrompt
23
- title="Hello, Chatbot User"
24
- description="How may I help you today?"
25
- prompts={[{ title: 'Topic 1' }]}
23
+ title="Hi, ChatBot User!"
24
+ description="How can I help you today?"
25
+ prompts={[{ title: 'Set up account' }]}
26
26
  />
27
27
  );
28
- expect(screen.getByText('Topic 1')).toBeTruthy();
28
+ expect(screen.getByText('Set up account')).toBeTruthy();
29
29
  });
30
30
  it('should render prompts with messages correctly', () => {
31
31
  render(
32
32
  <ChatbotWelcomePrompt
33
- title="Hello, Chatbot User"
34
- description="How may I help you today?"
35
- prompts={[{ title: 'Topic 1', message: 'Helpful prompt for Topic 1' }]}
33
+ title="Hi, ChatBot User!"
34
+ description="How can I help you today?"
35
+ prompts={[
36
+ { title: 'Set up account', message: 'Choose the necessary settings and preferences for your account.' }
37
+ ]}
36
38
  />
37
39
  );
38
- expect(screen.getByText('Helpful prompt for Topic 1')).toBeTruthy();
40
+ expect(screen.getByText('Choose the necessary settings and preferences for your account.')).toBeTruthy();
39
41
  });
40
42
  it('should render prompts with onClick correctly', async () => {
41
43
  const spy = jest.fn();
42
44
  render(
43
45
  <ChatbotWelcomePrompt
44
- title="Hello, Chatbot User"
45
- description="How may I help you today?"
46
- prompts={[{ title: 'Topic 1', message: 'Helpful prompt for Topic 1', onClick: spy }]}
46
+ title="Hi, ChatBot User!"
47
+ description="How can I help you today?"
48
+ prompts={[
49
+ {
50
+ title: 'Set up account',
51
+ message: 'Choose the necessary settings and preferences for your account.',
52
+ onClick: spy
53
+ }
54
+ ]}
47
55
  />
48
56
  );
49
- await userEvent.click(screen.getByRole('button', { name: /Topic 1/i }));
57
+ await userEvent.click(screen.getByRole('button', { name: /Set up account/i }));
50
58
  expect(spy).toHaveBeenCalled();
51
59
  });
52
60
  it('should apply className appropriately', () => {
53
61
  render(
54
62
  <ChatbotWelcomePrompt
55
- title="Hello, Chatbot User"
56
- description="How may I help you today?"
63
+ title="Hi, ChatBot User!"
64
+ description="How can I help you today?"
57
65
  className="test"
58
66
  testId="welcome-prompt"
59
67
  />
@@ -15,13 +15,13 @@ exports[`ChatbotWelcomePrompt should render welcome prompt 1`] = `
15
15
  <span
16
16
  class="pf-chatbot__hello"
17
17
  >
18
- Hello, Chatbot User
18
+ Hi, ChatBot User!
19
19
  </span>
20
20
  <br />
21
21
  <span
22
22
  class="pf-chatbot__question"
23
23
  >
24
- How may I help you today?
24
+ How can I help you today?
25
25
  </span>
26
26
  </h1>
27
27
  </div>
@@ -68,13 +68,13 @@
68
68
  .pf-v6-c-form-control__textarea:focus-visible {
69
69
  outline: none;
70
70
  }
71
- .pf-v6-c-form-control > textarea {
72
- outline-offset: 0px;
71
+ textarea {
72
+ outline-offset: 0px !important;
73
73
  --pf-v6-c-form-control--PaddingBlockStart: 0;
74
74
  --pf-v6-c-form-control--PaddingBlockEnd: 0;
75
75
  --pf-v6-c-form-control--BorderRadius: 0;
76
76
  }
77
- .pf-v6-c-form-control > textarea:focus-visible {
77
+ textarea:focus-visible {
78
78
  outline: none;
79
79
  }
80
80
  }
@@ -90,7 +90,7 @@ describe('ResponseActions', () => {
90
90
  name="Bot"
91
91
  role="bot"
92
92
  avatar=""
93
- content="Example with all prebuilt actions"
93
+ content="I updated your account with those settings. You're ready to set up your first dashboard!"
94
94
  actions={{
95
95
  positive: {},
96
96
  negative: {}
@@ -113,7 +113,9 @@ describe('ResponseActions', () => {
113
113
  'pf-chatbot__button--response-action-clicked'
114
114
  );
115
115
  expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
116
- await userEvent.click(screen.getByText('Example with all prebuilt actions'));
116
+ await userEvent.click(
117
+ screen.getByText("I updated your account with those settings. You're ready to set up your first dashboard!")
118
+ );
117
119
  expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
118
120
  expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
119
121
  });