@patternfly/chatbot 6.5.0-prerelease.1 → 6.5.0-prerelease.10
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.
- package/dist/cjs/AttachMenu/AttachMenu.d.ts +8 -2
- package/dist/cjs/AttachMenu/AttachMenu.js +2 -2
- package/dist/cjs/ChatbotContent/ChatbotContent.d.ts +2 -0
- package/dist/cjs/ChatbotContent/ChatbotContent.js +2 -2
- package/dist/cjs/ChatbotContent/ChatbotContent.test.js +4 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -3
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +4 -0
- package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +5 -2
- package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -1
- package/dist/cjs/CodeModal/CodeModal.js +40 -4
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.d.ts +2 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +5 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +3 -3
- package/dist/cjs/Message/Message.d.ts +6 -19
- package/dist/cjs/Message/Message.js +10 -7
- package/dist/cjs/Message/Message.test.js +38 -0
- package/dist/cjs/Message/MessageLoading.d.ts +2 -1
- package/dist/cjs/Message/MessageLoading.js +1 -1
- package/dist/cjs/Message/TableMessage/TableMessage.d.ts +4 -1
- package/dist/cjs/Message/TableMessage/TableMessage.js +2 -2
- package/dist/cjs/Message/TextMessage/TextMessage.d.ts +4 -1
- package/dist/cjs/Message/TextMessage/TextMessage.js +2 -2
- package/dist/cjs/MessageBar/AttachButton.d.ts +2 -0
- package/dist/cjs/MessageBar/AttachButton.js +2 -2
- package/dist/cjs/MessageBar/AttachButton.test.js +4 -0
- package/dist/cjs/MessageBar/MessageBar.d.ts +16 -6
- package/dist/cjs/MessageBar/MessageBar.js +6 -5
- package/dist/cjs/MessageBar/MessageBar.test.js +62 -0
- package/dist/cjs/__mocks__/monaco-editor.d.ts +11 -0
- package/dist/cjs/__mocks__/monaco-editor.js +18 -0
- package/dist/cjs/__mocks__/rehype-highlight.d.ts +2 -0
- package/dist/cjs/__mocks__/rehype-highlight.js +4 -0
- package/dist/css/main.css +81 -10
- package/dist/css/main.css.map +1 -1
- package/dist/esm/AttachMenu/AttachMenu.d.ts +8 -2
- package/dist/esm/AttachMenu/AttachMenu.js +2 -2
- package/dist/esm/ChatbotContent/ChatbotContent.d.ts +2 -0
- package/dist/esm/ChatbotContent/ChatbotContent.js +2 -2
- package/dist/esm/ChatbotContent/ChatbotContent.test.js +4 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +4 -0
- package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +5 -2
- package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -1
- package/dist/esm/CodeModal/CodeModal.js +42 -6
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.d.ts +2 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +5 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +3 -3
- package/dist/esm/Message/Message.d.ts +6 -19
- package/dist/esm/Message/Message.js +10 -7
- package/dist/esm/Message/Message.test.js +39 -1
- package/dist/esm/Message/MessageLoading.d.ts +2 -1
- package/dist/esm/Message/MessageLoading.js +1 -1
- package/dist/esm/Message/TableMessage/TableMessage.d.ts +4 -1
- package/dist/esm/Message/TableMessage/TableMessage.js +2 -2
- package/dist/esm/Message/TextMessage/TextMessage.d.ts +4 -1
- package/dist/esm/Message/TextMessage/TextMessage.js +2 -2
- package/dist/esm/MessageBar/AttachButton.d.ts +2 -0
- package/dist/esm/MessageBar/AttachButton.js +2 -2
- package/dist/esm/MessageBar/AttachButton.test.js +4 -0
- package/dist/esm/MessageBar/MessageBar.d.ts +16 -6
- package/dist/esm/MessageBar/MessageBar.js +6 -5
- package/dist/esm/MessageBar/MessageBar.test.js +62 -0
- package/dist/esm/__mocks__/monaco-editor.d.ts +11 -0
- package/dist/esm/__mocks__/monaco-editor.js +18 -0
- package/dist/esm/__mocks__/rehype-highlight.d.ts +2 -0
- package/dist/esm/__mocks__/rehype-highlight.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +3 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +14 -14
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +14 -14
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarIndicatorThinking.tsx +15 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +10 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +12 -4
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotTranscripts.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/WhiteEmbeddedChatbot.tsx +451 -0
- package/patternfly-docs/patternfly-docs.config.js +1 -0
- package/src/AttachMenu/AttachMenu.tsx +26 -11
- package/src/Chatbot/Chatbot.scss +23 -1
- package/src/ChatbotContent/ChatbotContent.scss +4 -0
- package/src/ChatbotContent/ChatbotContent.test.tsx +5 -0
- package/src/ChatbotContent/ChatbotContent.tsx +4 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx +5 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +7 -4
- package/src/ChatbotFooter/ChatbotFooter.scss +21 -0
- package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -1
- package/src/ChatbotFooter/ChatbotFooter.tsx +10 -3
- package/src/ChatbotHeader/ChatbotHeader.scss +19 -0
- package/src/CodeModal/CodeModal.tsx +58 -7
- package/src/FileDetailsLabel/FileDetailsLabel.tsx +2 -2
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +7 -2
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +9 -2
- package/src/Message/Message.test.tsx +56 -1
- package/src/Message/Message.tsx +14 -26
- package/src/Message/MessageLoading.scss +7 -0
- package/src/Message/MessageLoading.tsx +2 -2
- package/src/Message/TableMessage/TableMessage.scss +4 -0
- package/src/Message/TableMessage/TableMessage.tsx +6 -2
- package/src/Message/TextMessage/TextMessage.scss +12 -0
- package/src/Message/TextMessage/TextMessage.tsx +11 -2
- package/src/Message/UserFeedback/UserFeedback.scss +2 -1
- package/src/MessageBar/AttachButton.test.tsx +4 -0
- package/src/MessageBar/AttachButton.tsx +4 -1
- package/src/MessageBar/MessageBar.scss +11 -5
- package/src/MessageBar/MessageBar.test.tsx +102 -1
- package/src/MessageBar/MessageBar.tsx +44 -11
- package/src/__mocks__/monaco-editor.ts +19 -0
- package/src/__mocks__/rehype-highlight.ts +3 -0
|
@@ -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
|
-
|
|
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
|
-
&:
|
|
30
|
-
|
|
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
|
-
|
|
34
|
-
|
|
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 {
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
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
|
+
};
|