@patternfly/chatbot 6.9.0-prerelease.1 → 6.9.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/Chatbot/Chatbot.d.ts +2 -0
- package/dist/cjs/Chatbot/Chatbot.js +2 -2
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
- package/dist/cjs/ChatbotFooter/ChatbotFootnote.js +1 -1
- package/dist/cjs/ChatbotModal/ChatbotModal.js +1 -1
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +1 -1
- package/dist/cjs/MessageBar/MessageBar.d.ts +1 -1
- package/dist/cjs/MessageBar/MessageBar.js +4 -3
- package/dist/cjs/MessageBar/SendButton.js +2 -2
- package/dist/cjs/SourcesCard/SourcesCard.d.ts +2 -0
- package/dist/cjs/SourcesCardBase/SourcesCardBase.d.ts +2 -0
- package/dist/cjs/SourcesCardBase/SourcesCardBase.js +2 -2
- package/dist/css/main.css +199 -61
- package/dist/css/main.css.map +1 -1
- package/dist/esm/Chatbot/Chatbot.d.ts +2 -0
- package/dist/esm/Chatbot/Chatbot.js +3 -3
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +1 -1
- package/dist/esm/ChatbotFooter/ChatbotFootnote.js +1 -1
- package/dist/esm/ChatbotModal/ChatbotModal.js +1 -1
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +1 -1
- package/dist/esm/MessageBar/MessageBar.d.ts +1 -1
- package/dist/esm/MessageBar/MessageBar.js +4 -3
- package/dist/esm/MessageBar/SendButton.js +2 -2
- package/dist/esm/SourcesCard/SourcesCard.d.ts +2 -0
- package/dist/esm/SourcesCardBase/SourcesCardBase.d.ts +2 -0
- package/dist/esm/SourcesCardBase/SourcesCardBase.js +2 -2
- package/package.json +9 -9
- package/patternfly-docs/content/extensions/chatbot/chatbot.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +31 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Canvas.md +132 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Canvas.tsx +615 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/CanvasWithDockedNav.tsx +697 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +39 -5
- package/patternfly-docs/content/extensions/chatbot/examples/demos/FullscreenDockedNav.tsx +385 -0
- package/patternfly-docs/patternfly-docs.config.js +1 -1
- package/src/Canvas/Canvas.scss +150 -0
- package/src/Chatbot/Chatbot.scss +13 -1
- package/src/Chatbot/Chatbot.test.tsx +11 -0
- package/src/Chatbot/Chatbot.tsx +5 -1
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +91 -77
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +32 -13
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +1 -0
- package/src/ChatbotFooter/ChatbotFooternote.test.tsx +50 -0
- package/src/ChatbotFooter/ChatbotFootnote.tsx +1 -1
- package/src/ChatbotModal/ChatbotModal.tsx +1 -0
- package/src/ChatbotToggle/ChatbotToggle.scss +3 -2
- package/src/ChatbotToggle/ChatbotToggle.test.tsx +4 -0
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +9 -0
- package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +4 -2
- package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +2 -6
- package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +2 -6
- package/src/Message/Message.scss +9 -0
- package/src/MessageBar/AttachButton.scss +4 -21
- package/src/MessageBar/MessageBar.scss +2 -2
- package/src/MessageBar/MessageBar.test.tsx +20 -0
- package/src/MessageBar/MessageBar.tsx +7 -3
- package/src/MessageBar/SendButton.scss +1 -32
- package/src/MessageBar/SendButton.tsx +2 -2
- package/src/SourcesCard/SourcesCard.scss +6 -0
- package/src/SourcesCard/SourcesCard.test.tsx +16 -0
- package/src/SourcesCard/SourcesCard.tsx +2 -0
- package/src/SourcesCardBase/SourcesCardBase.test.tsx +62 -0
- package/src/SourcesCardBase/SourcesCardBase.tsx +8 -0
- package/src/main.scss +1 -0
|
@@ -7,38 +7,7 @@
|
|
|
7
7
|
width: 3rem;
|
|
8
8
|
height: 3rem;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
--pf-v6-c-button__icon--Color: var(--pf-t--global--color--brand--default);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&:hover,
|
|
15
|
-
&:focus {
|
|
16
|
-
background-color: rgba(146, 197, 249, 0.25); // --pf-t--global--color--nonstatus--blue--default @ 25%;
|
|
17
|
-
color: var(--pf-t--global--color--brand--hover);
|
|
18
|
-
|
|
19
|
-
.pf-v6-c-button__icon {
|
|
20
|
-
color: var(--pf-t--global--color--brand--hover);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.pf-v6-theme-dark {
|
|
26
|
-
.pf-v6-c-button.pf-chatbot__button--send {
|
|
27
|
-
background-color: var(--pf-t--global--color--brand--default);
|
|
28
|
-
.pf-v6-c-button__icon {
|
|
29
|
-
--pf-v6-c-button__icon--Color: var(--pf-t--global--icon--color--inverse);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.pf-v6-c-button:disabled.pf-chatbot__button--send:disabled {
|
|
34
|
-
--pf-v6-c-button--disabled--Color: var(--pf-t--global--icon--color--disabled);
|
|
35
|
-
background-color: var(--pf-t--global--background--color--disabled--default);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.pf-v6-c-button.pf-chatbot__button--send:hover,
|
|
39
|
-
.pf-v6-c-button.pf-chatbot__button--send:focus {
|
|
40
|
-
background-color: rgba(146, 197, 249, 0.25); // --pf-t--global--color--nonstatus--blue--default @ 25%;
|
|
41
|
-
}
|
|
10
|
+
--pf-v6-c-button--m-plain__icon--Color: var(--pf-t--global--color--brand--default);
|
|
42
11
|
}
|
|
43
12
|
|
|
44
13
|
@keyframes motionSendButton {
|
|
@@ -6,7 +6,7 @@ import type { FunctionComponent } from 'react';
|
|
|
6
6
|
// Import PatternFly components
|
|
7
7
|
import { Button, ButtonProps, Tooltip, TooltipProps, Icon } from '@patternfly/react-core';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { RhUiSendFillIcon } from '@patternfly/react-icons/dist/esm/icons/rh-ui-send-fill-icon';
|
|
10
10
|
|
|
11
11
|
export interface SendButtonProps extends ButtonProps {
|
|
12
12
|
/** Callback for when button is clicked */
|
|
@@ -48,7 +48,7 @@ export const SendButton: FunctionComponent<SendButtonProps> = ({
|
|
|
48
48
|
onClick={onClick}
|
|
49
49
|
icon={
|
|
50
50
|
<Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
|
|
51
|
-
<
|
|
51
|
+
<RhUiSendFillIcon />
|
|
52
52
|
</Icon>
|
|
53
53
|
}
|
|
54
54
|
size={isCompact ? 'sm' : undefined}
|
|
@@ -58,6 +58,12 @@
|
|
|
58
58
|
text-overflow: ellipsis;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
.pf-chatbot__sources-header-content-container {
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
width: fit-content;
|
|
64
|
+
margin-block-end: var(--pf-t--global--spacer--sm);
|
|
65
|
+
}
|
|
66
|
+
|
|
61
67
|
.pf-chatbot__sources-card-title-container {
|
|
62
68
|
display: flex;
|
|
63
69
|
flex-direction: column;
|
|
@@ -25,6 +25,22 @@ describe('SourcesCard', () => {
|
|
|
25
25
|
screen.getByRole('button', { name: /Go to next page/i });
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
it('should render headerContent above the title', () => {
|
|
29
|
+
render(
|
|
30
|
+
<SourcesCard
|
|
31
|
+
sources={[
|
|
32
|
+
{
|
|
33
|
+
title: 'How to make an apple pie',
|
|
34
|
+
link: '',
|
|
35
|
+
headerContent: <span>Dessert</span>
|
|
36
|
+
}
|
|
37
|
+
]}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
expect(screen.getByText('Dessert')).toBeTruthy();
|
|
41
|
+
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
|
42
|
+
});
|
|
43
|
+
|
|
28
44
|
it('should render with wrap layout when layout is set to wrap', () => {
|
|
29
45
|
render(
|
|
30
46
|
<SourcesCard
|
|
@@ -49,6 +49,8 @@ export interface SourcesCardProps extends CardProps {
|
|
|
49
49
|
footer?: React.ReactNode;
|
|
50
50
|
/** Additional props passed to Truncate component */
|
|
51
51
|
truncateProps?: TruncateProps;
|
|
52
|
+
/** Additional content applied to the beginning of the sources card header, such as a label */
|
|
53
|
+
headerContent?: React.ReactNode;
|
|
52
54
|
}[];
|
|
53
55
|
/** Label for the English word "source" */
|
|
54
56
|
sourceWord?: string;
|
|
@@ -234,6 +234,68 @@ describe('SourcesCardBase', () => {
|
|
|
234
234
|
expect(screen.getByRole('link', { name: /How to make an apple pie/i })).toHaveClass('test');
|
|
235
235
|
});
|
|
236
236
|
|
|
237
|
+
it('should render headerContent above the title', () => {
|
|
238
|
+
render(
|
|
239
|
+
<SourcesCardBase
|
|
240
|
+
sources={[
|
|
241
|
+
{
|
|
242
|
+
title: 'How to make an apple pie',
|
|
243
|
+
link: '',
|
|
244
|
+
headerContent: <span>Dessert</span>
|
|
245
|
+
}
|
|
246
|
+
]}
|
|
247
|
+
/>
|
|
248
|
+
);
|
|
249
|
+
expect(screen.getByText('Dessert')).toBeTruthy();
|
|
250
|
+
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it('should update headerContent when navigating between sources', async () => {
|
|
254
|
+
render(
|
|
255
|
+
<SourcesCardBase
|
|
256
|
+
sources={[
|
|
257
|
+
{
|
|
258
|
+
title: 'How to make an apple pie',
|
|
259
|
+
link: '',
|
|
260
|
+
headerContent: <span>Dessert</span>
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
title: 'How to make cookies',
|
|
264
|
+
link: '',
|
|
265
|
+
headerContent: <span>Snack</span>
|
|
266
|
+
}
|
|
267
|
+
]}
|
|
268
|
+
/>
|
|
269
|
+
);
|
|
270
|
+
expect(screen.getByText('Dessert')).toBeTruthy();
|
|
271
|
+
expect(screen.queryByText('Snack')).toBeFalsy();
|
|
272
|
+
await userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
|
|
273
|
+
expect(screen.queryByText('Dessert')).toBeFalsy();
|
|
274
|
+
expect(screen.getByText('Snack')).toBeTruthy();
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('should render headerContent when using wrap layout', () => {
|
|
278
|
+
render(
|
|
279
|
+
<SourcesCardBase
|
|
280
|
+
layout="wrap"
|
|
281
|
+
sources={[
|
|
282
|
+
{
|
|
283
|
+
title: 'How to make an apple pie',
|
|
284
|
+
link: '',
|
|
285
|
+
headerContent: <span>Dessert</span>
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
title: 'How to make cookies',
|
|
289
|
+
link: '',
|
|
290
|
+
headerContent: <span>Snack</span>
|
|
291
|
+
}
|
|
292
|
+
]}
|
|
293
|
+
/>
|
|
294
|
+
);
|
|
295
|
+
expect(screen.getByText('Dessert')).toBeTruthy();
|
|
296
|
+
expect(screen.getByText('Snack')).toBeTruthy();
|
|
297
|
+
});
|
|
298
|
+
|
|
237
299
|
it('should render with wrap layout when layout prop is set to wrap', () => {
|
|
238
300
|
render(
|
|
239
301
|
<SourcesCardBase
|
|
@@ -63,6 +63,8 @@ export interface SourcesCardBaseProps extends CardProps {
|
|
|
63
63
|
footer?: React.ReactNode;
|
|
64
64
|
/** Additional props passed to Truncate component */
|
|
65
65
|
truncateProps?: TruncateProps;
|
|
66
|
+
/** Additional content applied to the beginning of the sources card header, such as a label */
|
|
67
|
+
headerContent?: React.ReactNode;
|
|
66
68
|
}[];
|
|
67
69
|
/** Accessible label for the button which moves to the next page. */
|
|
68
70
|
toNextPageAriaLabel?: string;
|
|
@@ -133,6 +135,9 @@ const SourcesCardBase: FunctionComponent<SourcesCardBaseProps> = ({
|
|
|
133
135
|
>
|
|
134
136
|
<Card isFullHeight isCompact={isCompact} className="pf-chatbot__sources-card" {...props}>
|
|
135
137
|
<CardTitle className="pf-chatbot__sources-card-title" {...cardTitleProps}>
|
|
138
|
+
{source.headerContent && (
|
|
139
|
+
<div className="pf-chatbot__sources-header-content-container">{source.headerContent}</div>
|
|
140
|
+
)}
|
|
136
141
|
<div className="pf-chatbot__sources-card-title-container">
|
|
137
142
|
<Button
|
|
138
143
|
component="a"
|
|
@@ -196,6 +201,9 @@ const SourcesCardBase: FunctionComponent<SourcesCardBaseProps> = ({
|
|
|
196
201
|
<div className="pf-chatbot__sources-card-base">
|
|
197
202
|
<Card isCompact={isCompact} className="pf-chatbot__sources-card" {...props}>
|
|
198
203
|
<CardTitle className="pf-chatbot__sources-card-title" {...cardTitleProps}>
|
|
204
|
+
{sources[page - 1].headerContent && (
|
|
205
|
+
<div className="pf-chatbot__sources-header-content-container">{sources[page - 1].headerContent}</div>
|
|
206
|
+
)}
|
|
199
207
|
<div className="pf-chatbot__sources-card-title-container">
|
|
200
208
|
<Button
|
|
201
209
|
component="a"
|
package/src/main.scss
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
@import './ChatbotPopover/ChatbotPopover';
|
|
10
10
|
@import './ChatbotToggle/ChatbotToggle';
|
|
11
11
|
@import './ChatbotWelcomePrompt/ChatbotWelcomePrompt';
|
|
12
|
+
@import './Canvas/Canvas';
|
|
12
13
|
@import './CodeModal/CodeModal';
|
|
13
14
|
@import './Compare/Compare';
|
|
14
15
|
@import './DeepThinking/DeepThinking';
|