@patternfly/chatbot 6.5.0-prerelease.1 → 6.5.0-prerelease.11

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 (118) hide show
  1. package/dist/cjs/AttachMenu/AttachMenu.d.ts +8 -2
  2. package/dist/cjs/AttachMenu/AttachMenu.js +2 -2
  3. package/dist/cjs/ChatbotContent/ChatbotContent.d.ts +2 -0
  4. package/dist/cjs/ChatbotContent/ChatbotContent.js +2 -2
  5. package/dist/cjs/ChatbotContent/ChatbotContent.test.js +4 -0
  6. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -1
  7. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -3
  8. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +4 -0
  9. package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +5 -2
  10. package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
  11. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -1
  12. package/dist/cjs/CodeModal/CodeModal.js +40 -4
  13. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.d.ts +2 -1
  14. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +5 -1
  15. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +3 -3
  16. package/dist/cjs/Message/Message.d.ts +7 -20
  17. package/dist/cjs/Message/Message.js +11 -8
  18. package/dist/cjs/Message/Message.test.js +42 -0
  19. package/dist/cjs/Message/MessageLoading.d.ts +2 -1
  20. package/dist/cjs/Message/MessageLoading.js +1 -1
  21. package/dist/cjs/Message/TableMessage/TableMessage.d.ts +4 -1
  22. package/dist/cjs/Message/TableMessage/TableMessage.js +2 -2
  23. package/dist/cjs/Message/TextMessage/TextMessage.d.ts +4 -1
  24. package/dist/cjs/Message/TextMessage/TextMessage.js +2 -2
  25. package/dist/cjs/MessageBar/AttachButton.d.ts +2 -0
  26. package/dist/cjs/MessageBar/AttachButton.js +2 -2
  27. package/dist/cjs/MessageBar/AttachButton.test.js +4 -0
  28. package/dist/cjs/MessageBar/MessageBar.d.ts +16 -6
  29. package/dist/cjs/MessageBar/MessageBar.js +6 -5
  30. package/dist/cjs/MessageBar/MessageBar.test.js +62 -0
  31. package/dist/cjs/__mocks__/monaco-editor.d.ts +11 -0
  32. package/dist/cjs/__mocks__/monaco-editor.js +18 -0
  33. package/dist/cjs/__mocks__/rehype-highlight.d.ts +2 -0
  34. package/dist/cjs/__mocks__/rehype-highlight.js +4 -0
  35. package/dist/css/main.css +84 -13
  36. package/dist/css/main.css.map +1 -1
  37. package/dist/esm/AttachMenu/AttachMenu.d.ts +8 -2
  38. package/dist/esm/AttachMenu/AttachMenu.js +2 -2
  39. package/dist/esm/ChatbotContent/ChatbotContent.d.ts +2 -0
  40. package/dist/esm/ChatbotContent/ChatbotContent.js +2 -2
  41. package/dist/esm/ChatbotContent/ChatbotContent.test.js +4 -0
  42. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -1
  43. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -3
  44. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +4 -0
  45. package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +5 -2
  46. package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
  47. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -1
  48. package/dist/esm/CodeModal/CodeModal.js +42 -6
  49. package/dist/esm/FileDetailsLabel/FileDetailsLabel.d.ts +2 -1
  50. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +5 -1
  51. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +3 -3
  52. package/dist/esm/Message/Message.d.ts +7 -20
  53. package/dist/esm/Message/Message.js +11 -8
  54. package/dist/esm/Message/Message.test.js +43 -1
  55. package/dist/esm/Message/MessageLoading.d.ts +2 -1
  56. package/dist/esm/Message/MessageLoading.js +1 -1
  57. package/dist/esm/Message/TableMessage/TableMessage.d.ts +4 -1
  58. package/dist/esm/Message/TableMessage/TableMessage.js +2 -2
  59. package/dist/esm/Message/TextMessage/TextMessage.d.ts +4 -1
  60. package/dist/esm/Message/TextMessage/TextMessage.js +2 -2
  61. package/dist/esm/MessageBar/AttachButton.d.ts +2 -0
  62. package/dist/esm/MessageBar/AttachButton.js +2 -2
  63. package/dist/esm/MessageBar/AttachButton.test.js +4 -0
  64. package/dist/esm/MessageBar/MessageBar.d.ts +16 -6
  65. package/dist/esm/MessageBar/MessageBar.js +6 -5
  66. package/dist/esm/MessageBar/MessageBar.test.js +62 -0
  67. package/dist/esm/__mocks__/monaco-editor.d.ts +11 -0
  68. package/dist/esm/__mocks__/monaco-editor.js +18 -0
  69. package/dist/esm/__mocks__/rehype-highlight.d.ts +2 -0
  70. package/dist/esm/__mocks__/rehype-highlight.js +2 -0
  71. package/dist/tsconfig.tsbuildinfo +1 -1
  72. package/package.json +5 -2
  73. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -0
  74. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -0
  75. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +3 -1
  76. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +14 -14
  77. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +14 -14
  78. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +2 -2
  79. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarIndicatorThinking.tsx +15 -0
  80. package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +1 -1
  81. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +10 -0
  82. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +12 -4
  83. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -2
  84. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotTranscripts.tsx +1 -1
  85. package/patternfly-docs/content/extensions/chatbot/examples/demos/WhiteEmbeddedChatbot.tsx +451 -0
  86. package/patternfly-docs/patternfly-docs.config.js +1 -0
  87. package/src/AttachMenu/AttachMenu.tsx +26 -11
  88. package/src/Chatbot/Chatbot.scss +23 -1
  89. package/src/ChatbotContent/ChatbotContent.scss +4 -0
  90. package/src/ChatbotContent/ChatbotContent.test.tsx +5 -0
  91. package/src/ChatbotContent/ChatbotContent.tsx +4 -1
  92. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx +5 -0
  93. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +7 -4
  94. package/src/ChatbotFooter/ChatbotFooter.scss +21 -0
  95. package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -1
  96. package/src/ChatbotFooter/ChatbotFooter.tsx +10 -3
  97. package/src/ChatbotHeader/ChatbotHeader.scss +19 -0
  98. package/src/CodeModal/CodeModal.tsx +58 -7
  99. package/src/FileDetailsLabel/FileDetailsLabel.tsx +2 -2
  100. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +7 -2
  101. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +9 -2
  102. package/src/Message/Message.scss +3 -3
  103. package/src/Message/Message.test.tsx +60 -1
  104. package/src/Message/Message.tsx +23 -33
  105. package/src/Message/MessageLoading.scss +7 -0
  106. package/src/Message/MessageLoading.tsx +2 -2
  107. package/src/Message/TableMessage/TableMessage.scss +4 -0
  108. package/src/Message/TableMessage/TableMessage.tsx +6 -2
  109. package/src/Message/TextMessage/TextMessage.scss +12 -0
  110. package/src/Message/TextMessage/TextMessage.tsx +11 -2
  111. package/src/Message/UserFeedback/UserFeedback.scss +2 -1
  112. package/src/MessageBar/AttachButton.test.tsx +4 -0
  113. package/src/MessageBar/AttachButton.tsx +4 -1
  114. package/src/MessageBar/MessageBar.scss +11 -5
  115. package/src/MessageBar/MessageBar.test.tsx +102 -1
  116. package/src/MessageBar/MessageBar.tsx +44 -11
  117. package/src/__mocks__/monaco-editor.ts +19 -0
  118. package/src/__mocks__/rehype-highlight.ts +3 -0
@@ -19,7 +19,11 @@ export interface TableNode {
19
19
  type: string;
20
20
  }
21
21
 
22
- const TableMessage = ({ children, ...props }: Omit<TableProps, 'ref'> & ExtraProps) => {
22
+ export interface TableMessageProps {
23
+ isPrimary?: boolean;
24
+ }
25
+
26
+ const TableMessage = ({ children, isPrimary, ...props }: Omit<TableProps, 'ref'> & ExtraProps & TableMessageProps) => {
23
27
  const { className, ...rest } = props;
24
28
 
25
29
  // This allows us to parse the nested data we get back from the 3rd party Markdown parser
@@ -72,7 +76,7 @@ const TableMessage = ({ children, ...props }: Omit<TableProps, 'ref'> & ExtraPro
72
76
  <Table
73
77
  aria-label={props['aria-label']}
74
78
  gridBreakPoint="grid"
75
- className={`pf-chatbot__message-table ${className ? className : ''}`}
79
+ className={`pf-chatbot__message-table ${isPrimary ? 'pf-m-primary' : ''} ${className ? className : ''}`}
76
80
  {...rest}
77
81
  >
78
82
  {modifyChildren(children)}
@@ -47,6 +47,12 @@
47
47
  white-space: nowrap;
48
48
  width: 1px;
49
49
  }
50
+
51
+ &.pf-m-primary {
52
+ code {
53
+ background-color: var(--pf-t--global--background--color--secondary--default);
54
+ }
55
+ }
50
56
  }
51
57
 
52
58
  // ============================================================================
@@ -71,6 +77,12 @@ li[id*='user-content-fn-']:has(> span > span > .pf-chatbot__message-text + .pf-c
71
77
  margin-block-end: var(--pf-t--global--spacer--md);
72
78
  }
73
79
 
80
+ .pf-chatbot__message-text.footnotes {
81
+ .data-footnote-backref {
82
+ width: fit-content;
83
+ }
84
+ }
85
+
74
86
  .pf-chatbot__message--user {
75
87
  .pf-chatbot__message-text {
76
88
  background-color: var(--pf-t--global--color--brand--default);
@@ -5,8 +5,17 @@
5
5
  import { ExtraProps } from 'react-markdown';
6
6
  import { Content, ContentProps } from '@patternfly/react-core';
7
7
 
8
- const TextMessage = ({ component, children, ...props }: Omit<ContentProps, 'ref'> & ExtraProps) => (
9
- <span className="pf-chatbot__message-text">
8
+ export interface TextMessageProps {
9
+ isPrimary?: boolean;
10
+ }
11
+
12
+ const TextMessage = ({
13
+ component,
14
+ children,
15
+ isPrimary,
16
+ ...props
17
+ }: Omit<ContentProps, 'ref'> & ExtraProps & TextMessageProps) => (
18
+ <span className={`pf-chatbot__message-text ${isPrimary ? 'pf-m-primary' : ''}`}>
10
19
  <Content component={component} {...props}>
11
20
  {children}
12
21
  </Content>
@@ -1,7 +1,8 @@
1
1
  // shared
2
2
  .pf-chatbot__feedback-card {
3
3
  box-shadow: var(--pf-t--global--box-shadow--sm);
4
- --pf-v6-c-card--BorderWidth: 0;
4
+ // we want to override to 0 usually and assume the default border for high contrast support
5
+ --pf-v6-c-card--BorderWidth: var(--pf-t--global--border--width--high-contrast--regular);
5
6
  max-width: 27.5rem; // fixme address mobile vs desktop
6
7
  }
7
8
 
@@ -173,4 +173,8 @@ describe('Attach button', () => {
173
173
  expect(validator).toHaveBeenCalledWith(file);
174
174
  expect(onAttachRejected).toHaveBeenCalled();
175
175
  });
176
+ it('should handle icon prop', () => {
177
+ render(<AttachButton icon={<img alt="" src="" />} />);
178
+ expect(screen.getByRole('img')).toBeVisible();
179
+ });
176
180
  });
@@ -51,6 +51,8 @@ export interface AttachButtonProps extends ButtonProps {
51
51
  validator?: <T extends File>(file: T) => FileError | readonly FileError[] | null;
52
52
  /** Additional props passed to react-dropzone */
53
53
  dropzoneProps?: DropzoneOptions;
54
+ /** Icon displayed in attach button */
55
+ icon?: React.ReactNode;
54
56
  }
55
57
 
56
58
  const AttachButtonBase: FunctionComponent<AttachButtonProps> = ({
@@ -72,6 +74,7 @@ const AttachButtonBase: FunctionComponent<AttachButtonProps> = ({
72
74
  onAttachRejected,
73
75
  validator,
74
76
  dropzoneProps,
77
+ icon = <PaperclipIcon />,
75
78
  ...props
76
79
  }: AttachButtonProps) => {
77
80
  const { open, getInputProps } = useDropzone({
@@ -113,7 +116,7 @@ const AttachButtonBase: FunctionComponent<AttachButtonProps> = ({
113
116
  onClick={onClick ?? open}
114
117
  icon={
115
118
  <Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
116
- <PaperclipIcon />
119
+ {icon}
117
120
  </Icon>
118
121
  }
119
122
  size={isCompact ? 'sm' : undefined}
@@ -26,12 +26,18 @@
26
26
 
27
27
  overflow: hidden;
28
28
 
29
- &:hover {
30
- box-shadow: inset 0 0 0 1px var(--pf-t--global--border--color--default);
31
- }
29
+ &:not(.pf-v6-m-thinking) {
30
+ &.pf-m-primary {
31
+ box-shadow: inset 0 0 0 1px var(--pf-t--global--border--color--default);
32
+ }
32
33
 
33
- &:focus-within {
34
- box-shadow: inset 0 0 0 2px var(--pf-t--global--color--brand--default);
34
+ &:hover {
35
+ box-shadow: inset 0 0 0 1px var(--pf-t--global--border--color--default);
36
+ }
37
+
38
+ &:focus-within {
39
+ box-shadow: inset 0 0 0 2px var(--pf-t--global--color--brand--default);
40
+ }
35
41
  }
36
42
 
37
43
  &-actions {
@@ -1,5 +1,11 @@
1
1
  import '@testing-library/jest-dom';
2
- import { DropdownGroup, DropdownItem, DropdownList } from '@patternfly/react-core';
2
+ import {
3
+ DropdownGroup,
4
+ DropdownItem,
5
+ DropdownList,
6
+ MenuSearchInputProps,
7
+ MenuSearchProps
8
+ } from '@patternfly/react-core';
3
9
  import { BellIcon, CalendarAltIcon, ClipboardIcon, CodeIcon } from '@patternfly/react-icons';
4
10
  import { render, screen } from '@testing-library/react';
5
11
  import userEvent from '@testing-library/user-event';
@@ -218,6 +224,71 @@ describe('Message bar', () => {
218
224
  await userEvent.click(attachButton);
219
225
  expect(attachToggleClickSpy).toHaveBeenCalledTimes(1);
220
226
  });
227
+ it('can pass searchInputProps to search input in AttachMenu', () => {
228
+ render(
229
+ <MessageBar
230
+ onSendMessage={jest.fn}
231
+ value="test"
232
+ attachMenuProps={{
233
+ isAttachMenuOpen: true,
234
+ setIsAttachMenuOpen: jest.fn(),
235
+ onAttachMenuToggleClick: jest.fn(),
236
+ onAttachMenuInputChange: jest.fn(),
237
+ attachMenuItems: ATTACH_MENU_ITEMS,
238
+ searchInputProps: { isDisabled: true }
239
+ }}
240
+ />
241
+ );
242
+ expect(screen.getByRole('textbox', { name: /Filter menu items/i })).toBeDisabled();
243
+ });
244
+ it('can pass menuSearchProps to search input in AttachMenu', () => {
245
+ render(
246
+ <MessageBar
247
+ onSendMessage={jest.fn}
248
+ value="test"
249
+ attachMenuProps={{
250
+ isAttachMenuOpen: true,
251
+ setIsAttachMenuOpen: jest.fn(),
252
+ onAttachMenuToggleClick: jest.fn(),
253
+ onAttachMenuInputChange: jest.fn(),
254
+ attachMenuItems: ATTACH_MENU_ITEMS,
255
+ menuSearchProps: { 'data-testid': 'menu-search' } as MenuSearchProps
256
+ }}
257
+ />
258
+ );
259
+ expect(screen.getByTestId('menu-search')).toBeTruthy();
260
+ });
261
+ it('can pass menuSearchInputProps to search input in AttachMenu', () => {
262
+ render(
263
+ <MessageBar
264
+ onSendMessage={jest.fn}
265
+ value="test"
266
+ attachMenuProps={{
267
+ isAttachMenuOpen: true,
268
+ setIsAttachMenuOpen: jest.fn(),
269
+ onAttachMenuToggleClick: jest.fn(),
270
+ onAttachMenuInputChange: jest.fn(),
271
+ attachMenuItems: ATTACH_MENU_ITEMS,
272
+ menuSearchInputProps: { 'data-testid': 'menu-search-input' } as MenuSearchInputProps
273
+ }}
274
+ />
275
+ );
276
+ expect(screen.getByTestId('menu-search-input')).toBeTruthy();
277
+ });
278
+ it('can remove input from attach menu', async () => {
279
+ render(
280
+ <MessageBar
281
+ onSendMessage={jest.fn}
282
+ attachMenuProps={{
283
+ isAttachMenuOpen: true,
284
+ setIsAttachMenuOpen: jest.fn(),
285
+ onAttachMenuToggleClick: jest.fn(),
286
+ attachMenuItems: ATTACH_MENU_ITEMS
287
+ }}
288
+ />
289
+ );
290
+ expect(screen.queryByRole('textbox', { name: /Filter menu items/i })).not.toBeInTheDocument();
291
+ });
221
292
  it('can hide attach button', () => {
222
293
  render(<MessageBar onSendMessage={jest.fn} hasAttachButton={false} />);
223
294
  expect(screen.queryByRole('button', { name: 'Attach' })).toBeFalsy();
@@ -268,6 +339,20 @@ describe('Message bar', () => {
268
339
  );
269
340
  await userEvent.click(screen.getByRole('button', { name: 'Test' }));
270
341
  });
342
+ it('can change attach button icon', () => {
343
+ render(
344
+ <MessageBar
345
+ onSendMessage={jest.fn}
346
+ hasAttachButton
347
+ buttonProps={{
348
+ attach: {
349
+ icon: <img alt="" src="" />
350
+ }
351
+ }}
352
+ />
353
+ );
354
+ expect(screen.getByRole('img')).toBeVisible();
355
+ });
271
356
 
272
357
  // Stop button
273
358
  // --------------------------------------------------------------------------
@@ -387,4 +472,20 @@ describe('Message bar', () => {
387
472
  ref.current?.focus();
388
473
  expect(document.activeElement).toBe(screen.getByRole('textbox'));
389
474
  });
475
+ it('should handle isPrimary', () => {
476
+ const { container } = render(<MessageBar isPrimary onSendMessage={jest.fn} />);
477
+ expect(container.querySelector('.pf-m-primary')).toBeTruthy();
478
+ });
479
+
480
+ it('Renders with class pf-v6-m-ai-indicator when hasAiIndicator is true', () => {
481
+ render(<MessageBar onSendMessage={jest.fn} hasAiIndicator />);
482
+
483
+ expect(screen.getByRole('textbox').closest('.pf-chatbot__message-bar')).toHaveClass('pf-v6-m-ai-indicator');
484
+ });
485
+
486
+ it('Renders with class pf-v6-m-thinking when isThinking is true', () => {
487
+ render(<MessageBar onSendMessage={jest.fn} isThinking />);
488
+
489
+ expect(screen.getByRole('textbox').closest('.pf-chatbot__message-bar')).toHaveClass('pf-v6-m-thinking');
490
+ });
390
491
  });
@@ -1,12 +1,21 @@
1
1
  import type { ChangeEvent, FunctionComponent, KeyboardEvent as ReactKeyboardEvent, Ref } from 'react';
2
2
  import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { Accept, DropEvent, DropzoneOptions, FileError, FileRejection } from 'react-dropzone';
4
- import { ButtonProps, TextArea, TextAreaProps, TooltipProps } from '@patternfly/react-core';
4
+ import {
5
+ ButtonProps,
6
+ MenuSearchInputProps,
7
+ MenuSearchProps,
8
+ SearchInputProps,
9
+ TextArea,
10
+ TextAreaProps,
11
+ TooltipProps
12
+ } from '@patternfly/react-core';
13
+ import { css } from '@patternfly/react-styles';
5
14
 
6
15
  // Import Chatbot components
7
16
  import SendButton from './SendButton';
8
17
  import MicrophoneButton from './MicrophoneButton';
9
- import { AttachButton } from './AttachButton';
18
+ import { AttachButton, AttachButtonProps } from './AttachButton';
10
19
  import AttachMenu from '../AttachMenu';
11
20
  import StopButton from './StopButton';
12
21
  import { ChatbotDisplayMode } from '../Chatbot';
@@ -21,7 +30,7 @@ export interface MessageBarWithAttachMenuProps {
21
30
  /** A callback for when the attachment menu toggle is clicked */
22
31
  onAttachMenuToggleClick: () => void;
23
32
  /** A callback for when the input value in the menu changes. */
24
- onAttachMenuInputChange: (value: string) => void;
33
+ onAttachMenuInputChange?: (value: string) => void;
25
34
  /** Function callback called when user selects item in menu. */
26
35
  onAttachMenuSelect?: (event?: React.MouseEvent<Element, MouseEvent>, value?: string | number) => void;
27
36
  /** Placeholder for search input */
@@ -30,6 +39,12 @@ export interface MessageBarWithAttachMenuProps {
30
39
  onAttachMenuOnOpenChangeKeys?: string[];
31
40
  /** Callback to change the open state of the menu. Triggered by clicking outside of the menu. */
32
41
  onAttachMenuOpenChange?: (isOpen: boolean) => void;
42
+ /** Additional props passed to MenuSearch component in attach menu */
43
+ menuSearchProps?: Omit<MenuSearchProps, 'ref'>;
44
+ /** Additional props passed to MenuSearchInput component in attach menu */
45
+ menuSearchInputProps?: Omit<MenuSearchInputProps, 'ref'>;
46
+ /** Additional props passed to SearchInput component in attach menu */
47
+ searchInputProps?: SearchInputProps;
33
48
  }
34
49
 
35
50
  export interface MessageBarProps extends Omit<TextAreaProps, 'innerRef'> {
@@ -81,12 +96,7 @@ export interface MessageBarProps extends Omit<TextAreaProps, 'innerRef'> {
81
96
  isSendButtonDisabled?: boolean;
82
97
  /** Prop to allow passage of additional props to buttons */
83
98
  buttonProps?: {
84
- attach?: {
85
- tooltipContent?: string;
86
- props?: ButtonProps;
87
- inputTestId?: string;
88
- tooltipProps?: Omit<TooltipProps, 'content'>;
89
- };
99
+ attach?: AttachButtonProps & { props?: ButtonProps };
90
100
  stop?: { tooltipContent?: string; props?: ButtonProps; tooltipProps?: Omit<TooltipProps, 'content'> };
91
101
  send?: { tooltipContent?: string; props?: ButtonProps; tooltipProps?: Omit<TooltipProps, 'content'> };
92
102
  microphone?: {
@@ -104,6 +114,12 @@ export interface MessageBarProps extends Omit<TextAreaProps, 'innerRef'> {
104
114
  isCompact?: boolean;
105
115
  /** Ref applied to message bar textarea, for use with focus or other custom behaviors */
106
116
  innerRef?: React.Ref<HTMLTextAreaElement>;
117
+ /** Sets background color to primary */
118
+ isPrimary?: boolean;
119
+ /** @beta Flag indicating whether the message bar has an AI indicator border. */
120
+ hasAiIndicator?: boolean;
121
+ /** @beta Flag indicating whether the chatbot is thinking in response to a query, adding an animation to the message bar. */
122
+ isThinking?: boolean;
107
123
  }
108
124
 
109
125
  export const MessageBarBase: FunctionComponent<MessageBarProps> = ({
@@ -134,6 +150,9 @@ export const MessageBarBase: FunctionComponent<MessageBarProps> = ({
134
150
  validator,
135
151
  dropzoneProps,
136
152
  innerRef,
153
+ isPrimary,
154
+ hasAiIndicator,
155
+ isThinking,
137
156
  ...props
138
157
  }: MessageBarProps) => {
139
158
  // Text Input
@@ -359,7 +378,7 @@ export const MessageBarBase: FunctionComponent<MessageBarProps> = ({
359
378
  onAttachRejected={onAttachRejected}
360
379
  validator={validator}
361
380
  dropzoneProps={dropzoneProps}
362
- {...buttonProps?.attach?.props}
381
+ {...buttonProps?.attach}
363
382
  />
364
383
  )}
365
384
  {!attachMenuProps && hasAttachButton && (
@@ -379,6 +398,7 @@ export const MessageBarBase: FunctionComponent<MessageBarProps> = ({
379
398
  onAttachRejected={onAttachRejected}
380
399
  validator={validator}
381
400
  dropzoneProps={dropzoneProps}
401
+ {...buttonProps?.attach}
382
402
  {...buttonProps?.attach?.props}
383
403
  />
384
404
  )}
@@ -449,11 +469,24 @@ export const MessageBarBase: FunctionComponent<MessageBarProps> = ({
449
469
  {...(attachMenuProps && { handleTextInputChange: attachMenuProps.onAttachMenuInputChange })}
450
470
  popperProps={{ direction: 'up', distance: 8 }}
451
471
  searchInputPlaceholder={attachMenuProps?.attachMenuInputPlaceholder}
472
+ {...attachMenuProps}
452
473
  />
453
474
  );
454
475
  }
455
476
 
456
- return <div className={`pf-chatbot__message-bar ${className ?? ''}`}>{messageBarContents}</div>;
477
+ return (
478
+ <div
479
+ className={css(
480
+ 'pf-chatbot__message-bar',
481
+ isPrimary && 'pf-m-primary',
482
+ hasAiIndicator && 'pf-v6-m-ai-indicator',
483
+ isThinking && 'pf-v6-m-thinking',
484
+ className
485
+ )}
486
+ >
487
+ {messageBarContents}
488
+ </div>
489
+ );
457
490
  };
458
491
 
459
492
  const MessageBar = forwardRef((props: MessageBarProps, ref: Ref<HTMLTextAreaElement>) => (
@@ -0,0 +1,19 @@
1
+ const mockEditor = {
2
+ layout: jest.fn(),
3
+ focus: jest.fn(),
4
+ dispose: jest.fn(),
5
+ getModel: jest.fn(),
6
+ updateOptions: jest.fn()
7
+ };
8
+
9
+ const mockModel = {
10
+ updateOptions: jest.fn(),
11
+ dispose: jest.fn()
12
+ };
13
+
14
+ module.exports = {
15
+ editor: {
16
+ create: jest.fn(() => mockEditor),
17
+ getModels: jest.fn(() => [mockModel])
18
+ }
19
+ };
@@ -0,0 +1,3 @@
1
+ const rehypeHighlight = () => (tree) => tree;
2
+
3
+ export default rehypeHighlight;