@patternfly/chatbot 2.2.0-prerelease.41 → 2.2.0-prerelease.42

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.
@@ -76,6 +76,10 @@ export interface ChatbotConversationHistoryNavProps extends DrawerProps {
76
76
  loadingState?: SkeletonProps;
77
77
  /** Content to show in error state. Error state will appear once content is passed in. */
78
78
  errorState?: HistoryEmptyStateProps;
79
+ /** Content to show in empty state. Empty state will appear once content is passed in. */
80
+ emptyState?: HistoryEmptyStateProps;
81
+ /** Content to show in no results state. No results state will appear once content is passed in. */
82
+ noResultsState?: HistoryEmptyStateProps;
79
83
  }
80
84
  export declare const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConversationHistoryNavProps>;
81
85
  export default ChatbotConversationHistoryNav;
@@ -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 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"]);
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, emptyState, noResultsState } = _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", "emptyState", "noResultsState"]);
31
31
  const drawerRef = react_1.default.useRef(null);
32
32
  const onExpand = () => {
33
33
  drawerRef.current && drawerRef.current.focus();
@@ -58,6 +58,12 @@ const ChatbotConversationHistoryNav = (_a) => {
58
58
  if (errorState) {
59
59
  return react_1.default.createElement(EmptyState_1.default, Object.assign({}, errorState));
60
60
  }
61
+ if (emptyState) {
62
+ return react_1.default.createElement(EmptyState_1.default, Object.assign({}, emptyState));
63
+ }
64
+ if (noResultsState) {
65
+ return react_1.default.createElement(EmptyState_1.default, Object.assign({}, noResultsState));
66
+ }
61
67
  return (react_1.default.createElement(react_core_1.Menu, Object.assign({ isPlain: true, onSelect: onSelectActiveItem, activeItemId: activeItemId }, menuProps),
62
68
  react_1.default.createElement(react_core_1.MenuContent, null, buildMenu())));
63
69
  };
@@ -18,6 +18,7 @@ const react_2 = require("@testing-library/react");
18
18
  const Chatbot_1 = require("../Chatbot/Chatbot");
19
19
  const ChatbotConversationHistoryNav_1 = __importDefault(require("./ChatbotConversationHistoryNav"));
20
20
  const react_core_1 = require("@patternfly/react-core");
21
+ const react_icons_1 = require("@patternfly/react-icons");
21
22
  const ERROR = {
22
23
  bodyText: (react_1.default.createElement(react_1.default.Fragment, null,
23
24
  "To try again, check your connection and reload this page. If the issue persists,",
@@ -31,6 +32,16 @@ const ERROR = {
31
32
  status: react_core_1.EmptyStateStatus.danger,
32
33
  onClick: () => alert('Clicked Reload')
33
34
  };
35
+ const NO_RESULTS = {
36
+ bodyText: 'Adjust your search query and try again. Check your spelling or try a more general term.',
37
+ titleText: 'No results found',
38
+ icon: react_icons_1.SearchIcon
39
+ };
40
+ const EMPTY_STATE = {
41
+ bodyText: 'Access timely assistance by starting a conversation with an AI model.',
42
+ titleText: 'Start a new chat',
43
+ icon: react_icons_1.OutlinedCommentsIcon
44
+ };
34
45
  const ERROR_WITHOUT_BUTTON = {
35
46
  bodyText: (react_1.default.createElement(react_1.default.Fragment, null,
36
47
  "To try again, check your connection and reload this page. If the issue persists,",
@@ -162,4 +173,16 @@ describe('ChatbotConversationHistoryNav', () => {
162
173
  (0, react_2.render)(react_1.default.createElement(ChatbotConversationHistoryNav_1.default, { onDrawerToggle: onDrawerToggle, isDrawerOpen: true, displayMode: Chatbot_1.ChatbotDisplayMode.fullscreen, setIsDrawerOpen: jest.fn(), reverseButtonOrder: false, handleTextInputChange: jest.fn(), conversations: initialConversations, isLoading: true, errorState: ERROR }));
163
174
  expect(react_2.screen.getByRole('dialog', { name: /Loading/i })).toBeTruthy();
164
175
  });
176
+ it('should accept emptyState', () => {
177
+ (0, react_2.render)(react_1.default.createElement(ChatbotConversationHistoryNav_1.default, { onDrawerToggle: onDrawerToggle, isDrawerOpen: true, displayMode: Chatbot_1.ChatbotDisplayMode.fullscreen, setIsDrawerOpen: jest.fn(), reverseButtonOrder: false, handleTextInputChange: jest.fn(), conversations: initialConversations, emptyState: EMPTY_STATE }));
178
+ expect(react_2.screen.getByRole('dialog', {
179
+ name: /Start a new chat Access timely assistance by starting a conversation with an AI model./i
180
+ })).toBeTruthy();
181
+ });
182
+ it('should accept no results state', () => {
183
+ (0, react_2.render)(react_1.default.createElement(ChatbotConversationHistoryNav_1.default, { onDrawerToggle: onDrawerToggle, isDrawerOpen: true, displayMode: Chatbot_1.ChatbotDisplayMode.fullscreen, setIsDrawerOpen: jest.fn(), reverseButtonOrder: false, handleTextInputChange: jest.fn(), conversations: initialConversations, noResultsState: NO_RESULTS }));
184
+ expect(react_2.screen.getByRole('dialog', {
185
+ name: /No results found Adjust your search query and try again. Check your spelling or try a more general term./i
186
+ })).toBeTruthy();
187
+ });
165
188
  });
@@ -76,6 +76,10 @@ export interface ChatbotConversationHistoryNavProps extends DrawerProps {
76
76
  loadingState?: SkeletonProps;
77
77
  /** Content to show in error state. Error state will appear once content is passed in. */
78
78
  errorState?: HistoryEmptyStateProps;
79
+ /** Content to show in empty state. Empty state will appear once content is passed in. */
80
+ emptyState?: HistoryEmptyStateProps;
81
+ /** Content to show in no results state. No results state will appear once content is passed in. */
82
+ noResultsState?: HistoryEmptyStateProps;
79
83
  }
80
84
  export declare const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConversationHistoryNavProps>;
81
85
  export default ChatbotConversationHistoryNav;
@@ -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 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"]);
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, emptyState, noResultsState } = _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", "emptyState", "noResultsState"]);
25
25
  const drawerRef = React.useRef(null);
26
26
  const onExpand = () => {
27
27
  drawerRef.current && drawerRef.current.focus();
@@ -52,6 +52,12 @@ export const ChatbotConversationHistoryNav = (_a) => {
52
52
  if (errorState) {
53
53
  return React.createElement(HistoryEmptyState, Object.assign({}, errorState));
54
54
  }
55
+ if (emptyState) {
56
+ return React.createElement(HistoryEmptyState, Object.assign({}, emptyState));
57
+ }
58
+ if (noResultsState) {
59
+ return React.createElement(HistoryEmptyState, Object.assign({}, noResultsState));
60
+ }
55
61
  return (React.createElement(Menu, Object.assign({ isPlain: true, onSelect: onSelectActiveItem, activeItemId: activeItemId }, menuProps),
56
62
  React.createElement(MenuContent, null, buildMenu())));
57
63
  };
@@ -13,6 +13,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
13
13
  import { ChatbotDisplayMode } from '../Chatbot/Chatbot';
14
14
  import ChatbotConversationHistoryNav from './ChatbotConversationHistoryNav';
15
15
  import { EmptyStateStatus, Spinner } from '@patternfly/react-core';
16
+ import { OutlinedCommentsIcon, SearchIcon } from '@patternfly/react-icons';
16
17
  const ERROR = {
17
18
  bodyText: (React.createElement(React.Fragment, null,
18
19
  "To try again, check your connection and reload this page. If the issue persists,",
@@ -26,6 +27,16 @@ const ERROR = {
26
27
  status: EmptyStateStatus.danger,
27
28
  onClick: () => alert('Clicked Reload')
28
29
  };
30
+ const NO_RESULTS = {
31
+ bodyText: 'Adjust your search query and try again. Check your spelling or try a more general term.',
32
+ titleText: 'No results found',
33
+ icon: SearchIcon
34
+ };
35
+ const EMPTY_STATE = {
36
+ bodyText: 'Access timely assistance by starting a conversation with an AI model.',
37
+ titleText: 'Start a new chat',
38
+ icon: OutlinedCommentsIcon
39
+ };
29
40
  const ERROR_WITHOUT_BUTTON = {
30
41
  bodyText: (React.createElement(React.Fragment, null,
31
42
  "To try again, check your connection and reload this page. If the issue persists,",
@@ -157,4 +168,16 @@ describe('ChatbotConversationHistoryNav', () => {
157
168
  render(React.createElement(ChatbotConversationHistoryNav, { onDrawerToggle: onDrawerToggle, isDrawerOpen: true, displayMode: ChatbotDisplayMode.fullscreen, setIsDrawerOpen: jest.fn(), reverseButtonOrder: false, handleTextInputChange: jest.fn(), conversations: initialConversations, isLoading: true, errorState: ERROR }));
158
169
  expect(screen.getByRole('dialog', { name: /Loading/i })).toBeTruthy();
159
170
  });
171
+ it('should accept emptyState', () => {
172
+ render(React.createElement(ChatbotConversationHistoryNav, { onDrawerToggle: onDrawerToggle, isDrawerOpen: true, displayMode: ChatbotDisplayMode.fullscreen, setIsDrawerOpen: jest.fn(), reverseButtonOrder: false, handleTextInputChange: jest.fn(), conversations: initialConversations, emptyState: EMPTY_STATE }));
173
+ expect(screen.getByRole('dialog', {
174
+ name: /Start a new chat Access timely assistance by starting a conversation with an AI model./i
175
+ })).toBeTruthy();
176
+ });
177
+ it('should accept no results state', () => {
178
+ render(React.createElement(ChatbotConversationHistoryNav, { onDrawerToggle: onDrawerToggle, isDrawerOpen: true, displayMode: ChatbotDisplayMode.fullscreen, setIsDrawerOpen: jest.fn(), reverseButtonOrder: false, handleTextInputChange: jest.fn(), conversations: initialConversations, noResultsState: NO_RESULTS }));
179
+ expect(screen.getByRole('dialog', {
180
+ name: /No results found Adjust your search query and try again. Check your spelling or try a more general term./i
181
+ })).toBeTruthy();
182
+ });
160
183
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/chatbot",
3
- "version": "2.2.0-prerelease.41",
3
+ "version": "2.2.0-prerelease.42",
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",
@@ -4,6 +4,7 @@ import ChatbotConversationHistoryNav, {
4
4
  Conversation
5
5
  } from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
6
6
  import { Checkbox, EmptyStateStatus, Spinner } from '@patternfly/react-core';
7
+ import { OutlinedCommentsIcon, SearchIcon } from '@patternfly/react-icons';
7
8
 
8
9
  const initialConversations: { [key: string]: Conversation[] } = {
9
10
  Today: [{ id: '1', text: 'Red Hat products and services' }],
@@ -46,6 +47,18 @@ const ERROR = {
46
47
  onClick: () => alert('Clicked Reload')
47
48
  };
48
49
 
50
+ const NO_RESULTS = {
51
+ bodyText: 'Adjust your search query and try again. Check your spelling or try a more general term.',
52
+ titleText: 'No results found',
53
+ icon: SearchIcon
54
+ };
55
+
56
+ const EMPTY_STATE = {
57
+ bodyText: 'Access timely assistance by starting a conversation with an AI model.',
58
+ titleText: 'Start a new chat',
59
+ icon: OutlinedCommentsIcon
60
+ };
61
+
49
62
  export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
50
63
  const [isOpen, setIsOpen] = React.useState(true);
51
64
  const [isButtonOrderReversed, setIsButtonOrderReversed] = React.useState(false);
@@ -54,10 +67,12 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
54
67
  );
55
68
  const [isLoading, setIsLoading] = React.useState(false);
56
69
  const [hasError, setHasError] = React.useState(false);
70
+ const [isEmpty, setIsEmpty] = React.useState(false);
71
+ const [hasNoResults, setHasNoResults] = React.useState(false);
57
72
  const displayMode = ChatbotDisplayMode.embedded;
58
73
 
59
74
  const findMatchingItems = (targetValue: string) => {
60
- let filteredConversations = Object.entries(initialConversations).reduce((acc, [key, items]) => {
75
+ const filteredConversations = Object.entries(initialConversations).reduce((acc, [key, items]) => {
61
76
  const filteredItems = items.filter((item) => item.text.toLowerCase().includes(targetValue.toLowerCase()));
62
77
  if (filteredItems.length > 0) {
63
78
  acc[key] = filteredItems;
@@ -67,7 +82,9 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
67
82
 
68
83
  // append message if no items are found
69
84
  if (Object.keys(filteredConversations).length === 0) {
70
- filteredConversations = [{ id: '13', noIcon: true, text: 'No results found' }];
85
+ setHasNoResults(true);
86
+ } else {
87
+ setHasNoResults(false);
71
88
  }
72
89
  return filteredConversations;
73
90
  };
@@ -105,6 +122,20 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
105
122
  id="drawer-has-error"
106
123
  name="drawer-has-error"
107
124
  ></Checkbox>
125
+ <Checkbox
126
+ label="Show empty state"
127
+ isChecked={isEmpty}
128
+ onChange={() => setIsEmpty(!isEmpty)}
129
+ id="drawer-is-empty"
130
+ name="drawer-is-empty"
131
+ ></Checkbox>
132
+ <Checkbox
133
+ label="Show no results state"
134
+ isChecked={hasNoResults}
135
+ onChange={() => setHasNoResults(!hasNoResults)}
136
+ id="drawer-has-no-results"
137
+ name="drawer-has-no-results"
138
+ ></Checkbox>
108
139
  <ChatbotConversationHistoryNav
109
140
  displayMode={displayMode}
110
141
  onDrawerToggle={() => setIsOpen(!isOpen)}
@@ -129,6 +160,8 @@ export const ChatbotHeaderTitleDemo: React.FunctionComponent = () => {
129
160
  drawerContent={<div>Drawer content</div>}
130
161
  isLoading={isLoading}
131
162
  errorState={hasError ? ERROR : undefined}
163
+ emptyState={isEmpty ? EMPTY_STATE : undefined}
164
+ noResultsState={hasNoResults ? NO_RESULTS : undefined}
132
165
  />
133
166
  </>
134
167
  );
@@ -4,6 +4,7 @@ import ChatbotConversationHistoryNav, {
4
4
  Conversation
5
5
  } from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
6
6
  import { Checkbox } from '@patternfly/react-core';
7
+ import { SearchIcon } from '@patternfly/react-icons';
7
8
 
8
9
  const initialConversations: { [key: string]: Conversation[] } = {
9
10
  Today: [{ id: '1', text: 'Red Hat products and services' }],
@@ -31,15 +32,22 @@ const initialConversations: { [key: string]: Conversation[] } = {
31
32
  ]
32
33
  };
33
34
 
35
+ const NO_RESULTS = {
36
+ bodyText: 'Adjust your search query and try again. Check your spelling or try a more general term.',
37
+ titleText: 'No results found',
38
+ icon: SearchIcon
39
+ };
40
+
34
41
  export const ChatbotHeaderDrawerResizableDemo: React.FunctionComponent = () => {
35
42
  const [isOpen, setIsOpen] = React.useState(true);
36
43
  const [conversations, setConversations] = React.useState<Conversation[] | { [key: string]: Conversation[] }>(
37
44
  initialConversations
38
45
  );
46
+ const [showNoResults, setShowNoResults] = React.useState(false);
39
47
  const displayMode = ChatbotDisplayMode.embedded;
40
48
 
41
49
  const findMatchingItems = (targetValue: string) => {
42
- let filteredConversations = Object.entries(initialConversations).reduce((acc, [key, items]) => {
50
+ const filteredConversations = Object.entries(initialConversations).reduce((acc, [key, items]) => {
43
51
  const filteredItems = items.filter((item) => item.text.toLowerCase().includes(targetValue.toLowerCase()));
44
52
  if (filteredItems.length > 0) {
45
53
  acc[key] = filteredItems;
@@ -49,7 +57,9 @@ export const ChatbotHeaderDrawerResizableDemo: React.FunctionComponent = () => {
49
57
 
50
58
  // append message if no items are found
51
59
  if (Object.keys(filteredConversations).length === 0) {
52
- filteredConversations = [{ id: '13', noIcon: true, text: 'No results found' }];
60
+ setShowNoResults(true);
61
+ } else {
62
+ setShowNoResults(false);
53
63
  }
54
64
  return filteredConversations;
55
65
  };
@@ -88,6 +98,7 @@ export const ChatbotHeaderDrawerResizableDemo: React.FunctionComponent = () => {
88
98
  }}
89
99
  drawerContent={<div>Drawer content</div>}
90
100
  drawerPanelContentProps={{ isResizable: true, minSize: '200px' }}
101
+ emptyState={showNoResults ? NO_RESULTS : undefined}
91
102
  />
92
103
  </>
93
104
  );
@@ -83,7 +83,7 @@ import PFHorizontalLogoReverse from './PF-HorizontalLogo-Reverse.svg';
83
83
  import userAvatar from '../Messages/user_avatar.svg';
84
84
  import patternflyAvatar from '../Messages/patternfly_avatar.jpg';
85
85
  import termsAndConditionsHeader from './PF-TermsAndConditionsHeader.svg';
86
- import { CloseIcon } from '@patternfly/react-icons';
86
+ import { CloseIcon, SearchIcon, OutlinedCommentsIcon } from '@patternfly/react-icons';
87
87
 
88
88
  ## Structure
89
89
 
@@ -5,6 +5,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
5
5
  import { ChatbotDisplayMode } from '../Chatbot/Chatbot';
6
6
  import ChatbotConversationHistoryNav, { Conversation } from './ChatbotConversationHistoryNav';
7
7
  import { EmptyStateStatus, Spinner } from '@patternfly/react-core';
8
+ import { OutlinedCommentsIcon, SearchIcon } from '@patternfly/react-icons';
8
9
 
9
10
  const ERROR = {
10
11
  bodyText: (
@@ -21,6 +22,18 @@ const ERROR = {
21
22
  onClick: () => alert('Clicked Reload')
22
23
  };
23
24
 
25
+ const NO_RESULTS = {
26
+ bodyText: 'Adjust your search query and try again. Check your spelling or try a more general term.',
27
+ titleText: 'No results found',
28
+ icon: SearchIcon
29
+ };
30
+
31
+ const EMPTY_STATE = {
32
+ bodyText: 'Access timely assistance by starting a conversation with an AI model.',
33
+ titleText: 'Start a new chat',
34
+ icon: OutlinedCommentsIcon
35
+ };
36
+
24
37
  const ERROR_WITHOUT_BUTTON = {
25
38
  bodyText: (
26
39
  <>
@@ -362,4 +375,44 @@ describe('ChatbotConversationHistoryNav', () => {
362
375
  );
363
376
  expect(screen.getByRole('dialog', { name: /Loading/i })).toBeTruthy();
364
377
  });
378
+
379
+ it('should accept emptyState', () => {
380
+ render(
381
+ <ChatbotConversationHistoryNav
382
+ onDrawerToggle={onDrawerToggle}
383
+ isDrawerOpen={true}
384
+ displayMode={ChatbotDisplayMode.fullscreen}
385
+ setIsDrawerOpen={jest.fn()}
386
+ reverseButtonOrder={false}
387
+ handleTextInputChange={jest.fn()}
388
+ conversations={initialConversations}
389
+ emptyState={EMPTY_STATE}
390
+ />
391
+ );
392
+ expect(
393
+ screen.getByRole('dialog', {
394
+ name: /Start a new chat Access timely assistance by starting a conversation with an AI model./i
395
+ })
396
+ ).toBeTruthy();
397
+ });
398
+
399
+ it('should accept no results state', () => {
400
+ render(
401
+ <ChatbotConversationHistoryNav
402
+ onDrawerToggle={onDrawerToggle}
403
+ isDrawerOpen={true}
404
+ displayMode={ChatbotDisplayMode.fullscreen}
405
+ setIsDrawerOpen={jest.fn()}
406
+ reverseButtonOrder={false}
407
+ handleTextInputChange={jest.fn()}
408
+ conversations={initialConversations}
409
+ noResultsState={NO_RESULTS}
410
+ />
411
+ );
412
+ expect(
413
+ screen.getByRole('dialog', {
414
+ name: /No results found Adjust your search query and try again. Check your spelling or try a more general term./i
415
+ })
416
+ ).toBeTruthy();
417
+ });
365
418
  });
@@ -112,6 +112,10 @@ export interface ChatbotConversationHistoryNavProps extends DrawerProps {
112
112
  loadingState?: SkeletonProps;
113
113
  /** Content to show in error state. Error state will appear once content is passed in. */
114
114
  errorState?: HistoryEmptyStateProps;
115
+ /** Content to show in empty state. Empty state will appear once content is passed in. */
116
+ emptyState?: HistoryEmptyStateProps;
117
+ /** Content to show in no results state. No results state will appear once content is passed in. */
118
+ noResultsState?: HistoryEmptyStateProps;
115
119
  }
116
120
 
117
121
  export const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConversationHistoryNavProps> = ({
@@ -141,6 +145,8 @@ export const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConve
141
145
  isLoading,
142
146
  loadingState,
143
147
  errorState,
148
+ emptyState,
149
+ noResultsState,
144
150
  ...props
145
151
  }: ChatbotConversationHistoryNavProps) => {
146
152
  const drawerRef = React.useRef<HTMLDivElement>(null);
@@ -210,6 +216,14 @@ export const ChatbotConversationHistoryNav: React.FunctionComponent<ChatbotConve
210
216
  if (errorState) {
211
217
  return <HistoryEmptyState {...errorState} />;
212
218
  }
219
+
220
+ if (emptyState) {
221
+ return <HistoryEmptyState {...emptyState} />;
222
+ }
223
+
224
+ if (noResultsState) {
225
+ return <HistoryEmptyState {...noResultsState} />;
226
+ }
213
227
  return (
214
228
  <Menu isPlain onSelect={onSelectActiveItem} activeItemId={activeItemId} {...menuProps}>
215
229
  <MenuContent>{buildMenu()}</MenuContent>