@patternfly/chatbot 6.7.0-prerelease.3 → 6.7.0-prerelease.5
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/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +2 -2
- package/dist/cjs/Message/Message.d.ts +4 -2
- package/dist/cjs/Message/Message.js +19 -2
- package/dist/cjs/Message/Message.test.js +13 -1
- package/dist/cjs/MessageDivider/MessageDivider.js +1 -1
- package/dist/css/main.css +61 -78
- package/dist/css/main.css.map +1 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +2 -2
- package/dist/esm/Message/Message.d.ts +4 -2
- package/dist/esm/Message/Message.js +19 -2
- package/dist/esm/Message/Message.test.js +13 -1
- package/dist/esm/MessageDivider/MessageDivider.js +1 -1
- package/package.json +8 -8
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +3 -13
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithClickedResponseActions.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomStructure.tsx +1 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithDeepThinking.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithDividers.tsx +1 -8
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +0 -5
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedbackTimeout.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithIconSwapping.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownDeepThinking.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolCall.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolResponse.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMultipleActionGroups.tsx +0 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithPersistedActions.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +0 -8
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +0 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +0 -10
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolCall.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolResponse.tsx +0 -3
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +6 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomeInteraction.tsx +0 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +1 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotCompact.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotDisplayMode.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotScrolling.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotTranscripts.tsx +0 -7
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +0 -4
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +0 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +0 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/WhiteEmbeddedChatbot.tsx +0 -4
- package/src/Chatbot/Chatbot.scss +42 -26
- package/src/ChatbotContent/ChatbotContent.scss +10 -5
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +14 -0
- package/src/ChatbotFooter/ChatbotFooter.scss +12 -10
- package/src/ChatbotHeader/ChatbotHeader.scss +7 -53
- package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +2 -2
- package/src/ChatbotModal/ChatbotModal.scss +0 -9
- package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +1 -1
- package/src/FileDetailsLabel/FileDetailsLabel.scss +5 -0
- package/src/Message/Message.scss +5 -0
- package/src/Message/Message.test.tsx +13 -1
- package/src/Message/Message.tsx +37 -11
- package/src/MessageBar/MessageBar.scss +4 -24
- package/src/MessageDivider/MessageDivider.scss +7 -9
- package/src/MessageDivider/MessageDivider.tsx +1 -1
|
@@ -203,6 +203,20 @@
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
.pf-chatbot:is(.pf-chatbot--drawer, .pf-chatbot--docked) .pf-chatbot__history {
|
|
207
|
+
// .pf-v6-c-menu {
|
|
208
|
+
// @at-root :where(.pf-v6-theme-glass) & {
|
|
209
|
+
// --pf-v6-c-menu--BackgroundColor: var(--pf-t--global--background--color--floating--default);
|
|
210
|
+
// }
|
|
211
|
+
// }
|
|
212
|
+
|
|
213
|
+
// .pf-chatbot__menu-item-header > .pf-v6-c-menu__group-title {
|
|
214
|
+
// @at-root :where(.pf-v6-theme-glass) & {
|
|
215
|
+
// background-color: var(--pf-t--global--background--color--floating--default);
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
218
|
+
}
|
|
219
|
+
|
|
206
220
|
// ============================================================================
|
|
207
221
|
// Chatbot Display Mode - Docked
|
|
208
222
|
// ============================================================================
|
|
@@ -6,10 +6,7 @@
|
|
|
6
6
|
// ============================================================================
|
|
7
7
|
.pf-chatbot__footer {
|
|
8
8
|
--pf-chatbot__footer--RowGap: var(--pf-t--global--spacer--md);
|
|
9
|
-
background-color: var(
|
|
10
|
-
--pf-t--global--background--color--floating--secondary--default,
|
|
11
|
-
--pf-t--global--background--color--secondary--default
|
|
12
|
-
);
|
|
9
|
+
background-color: var(--pf-t--global--background--color--floating--secondary--default);
|
|
13
10
|
display: flex;
|
|
14
11
|
flex-direction: column;
|
|
15
12
|
row-gap: var(--pf-chatbot__footer--RowGap);
|
|
@@ -19,6 +16,17 @@
|
|
|
19
16
|
background-color: var(--pf-t--global--background--color--primary--default);
|
|
20
17
|
}
|
|
21
18
|
}
|
|
19
|
+
|
|
20
|
+
.pf-chatbot:not(.pf-chatnot--default) {
|
|
21
|
+
.pf-chatbot__footer {
|
|
22
|
+
background-color: var(--pf-t--global--background--color--secondary--default);
|
|
23
|
+
|
|
24
|
+
@at-root :where(.pf-v6-theme-glass) & {
|
|
25
|
+
background-color: var(--pf-t--global--background--color--glass--primary--default);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
.pf-chatbot__footer-container {
|
|
23
31
|
padding: 0 var(--pf-t--global--spacer--lg) var(--pf-t--global--spacer--lg) var(--pf-t--global--spacer--lg);
|
|
24
32
|
display: flex;
|
|
@@ -35,12 +43,6 @@
|
|
|
35
43
|
.pf-chatbot--fullscreen {
|
|
36
44
|
.pf-chatbot__footer {
|
|
37
45
|
align-items: center;
|
|
38
|
-
.pf-v6-c-divider {
|
|
39
|
-
display: none;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
.pf-chatbot__footer {
|
|
43
|
-
background-color: var(--pf-t--global--background--color--secondary--default);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
.pf-chatbot__footer-container {
|
|
@@ -9,10 +9,7 @@
|
|
|
9
9
|
grid-template-columns: 1fr auto;
|
|
10
10
|
gap: var(--pf-t--global--spacer--sm);
|
|
11
11
|
position: relative; // this is so focus ring on parent chatbot doesn't include header
|
|
12
|
-
background-color: var(
|
|
13
|
-
--pf-t--global--background--color--floating--secondary--default,
|
|
14
|
-
--pf-t--global--background--color--secondary--default
|
|
15
|
-
);
|
|
12
|
+
background-color: var(--pf-t--global--background--color--floating--secondary--default);
|
|
16
13
|
justify-content: space-between;
|
|
17
14
|
padding: var(--pf-t--global--spacer--lg);
|
|
18
15
|
|
|
@@ -58,28 +55,13 @@
|
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
|
|
61
|
-
|
|
62
|
-
// Chatbot Display Mode - Fullscreen and Embedded
|
|
63
|
-
// ============================================================================
|
|
64
|
-
@media screen and (min-width: 64rem) {
|
|
65
|
-
.pf-chatbot--fullscreen,
|
|
66
|
-
.pf-chatbot--embedded {
|
|
67
|
-
.pf-chatbot__header {
|
|
68
|
-
background-color: var(--pf-t--global--background--color--primary--default);
|
|
69
|
-
}
|
|
70
|
-
.pf-chatbot__header__divider {
|
|
71
|
-
display: none;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// ============================================================================
|
|
77
|
-
// Chatbot Display Mode - Docked and Drawer
|
|
78
|
-
// ============================================================================
|
|
79
|
-
.pf-chatbot--drawer,
|
|
80
|
-
.pf-chatbot--docked {
|
|
58
|
+
.pf-chatbot:not(.pf-chatbot--default) {
|
|
81
59
|
.pf-chatbot__header {
|
|
82
|
-
background-color: var(--pf-t--global--background--color--secondary--
|
|
60
|
+
background-color: var(--pf-t--global--background--color--secondary--default);
|
|
61
|
+
|
|
62
|
+
@at-root :where(.pf-v6-theme-glass) & {
|
|
63
|
+
background-color: var(--pf-t--global--background--color--glass--primary--default);
|
|
64
|
+
}
|
|
83
65
|
}
|
|
84
66
|
}
|
|
85
67
|
|
|
@@ -98,12 +80,6 @@
|
|
|
98
80
|
border-radius: inherit;
|
|
99
81
|
}
|
|
100
82
|
|
|
101
|
-
.pf-v6-c-button__icon,
|
|
102
|
-
.pf-v6-c-menu-toggle__icon,
|
|
103
|
-
.pf-v6-c-icon__content {
|
|
104
|
-
color: var(--pf-t--global--icon--color--subtle);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
83
|
.pf-v6-c-button__icon,
|
|
108
84
|
.pf-v6-c-menu-toggle__icon {
|
|
109
85
|
display: flex;
|
|
@@ -122,13 +98,6 @@
|
|
|
122
98
|
}
|
|
123
99
|
}
|
|
124
100
|
|
|
125
|
-
// Rotate icon
|
|
126
|
-
.pf-chatbot__button--toggle-options {
|
|
127
|
-
svg {
|
|
128
|
-
transform: rotate(90deg);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
101
|
// ============================================================================
|
|
133
102
|
// Examples
|
|
134
103
|
// ============================================================================
|
|
@@ -169,18 +138,3 @@
|
|
|
169
138
|
.pf-chatbot__header .pf-chatbot__actions .pf-v6-c-menu-toggle.pf-m-secondary.pf-m-compact {
|
|
170
139
|
width: initial;
|
|
171
140
|
}
|
|
172
|
-
|
|
173
|
-
// ============================================================================
|
|
174
|
-
// High contrast
|
|
175
|
-
// ============================================================================
|
|
176
|
-
:root:where(.pf-v6-theme-high-contrast) {
|
|
177
|
-
// Chatbot Display Mode - Fullscreen and Embedded
|
|
178
|
-
@media screen and (min-width: 64rem) {
|
|
179
|
-
.pf-chatbot--fullscreen,
|
|
180
|
-
.pf-chatbot--embedded {
|
|
181
|
-
.pf-chatbot__header__divider {
|
|
182
|
-
display: var(--pf-v6-hidden-visible--Display);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
Icon,
|
|
12
12
|
MenuToggleProps
|
|
13
13
|
} from '@patternfly/react-core';
|
|
14
|
-
import
|
|
14
|
+
import RhUiEllipsisHorizontalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-horizontal-fill-icon';
|
|
15
15
|
|
|
16
16
|
export interface ChatbotHeaderOptionsDropdownProps extends Omit<DropdownProps, 'toggle'> {
|
|
17
17
|
/** Content to be displayed in the chatbot header */
|
|
@@ -56,7 +56,7 @@ export const ChatbotHeaderOptionsDropdown: FunctionComponent<ChatbotHeaderOption
|
|
|
56
56
|
ref={toggleRef}
|
|
57
57
|
icon={
|
|
58
58
|
<Icon size={isCompact ? 'lg' : 'xl'} isInline>
|
|
59
|
-
<
|
|
59
|
+
<RhUiEllipsisHorizontalFillIcon />
|
|
60
60
|
</Icon>
|
|
61
61
|
}
|
|
62
62
|
isExpanded={isOptionsMenuOpen}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
inset-inline-end: var(--pf-t--global--spacer--lg);
|
|
10
10
|
width: 30rem !important;
|
|
11
11
|
height: 70vh;
|
|
12
|
-
background-color: var(--pf-t--global--background--color--secondary--default) !important;
|
|
13
12
|
|
|
14
13
|
.pf-v6-c-modal-box__title {
|
|
15
14
|
--pf-v6-c-modal-box__title--FontSize: var(--pf-t--global--font--size--heading--h3);
|
|
@@ -55,13 +54,6 @@
|
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
// ============================================================================
|
|
59
|
-
// Chatbot Display Mode - Default
|
|
60
|
-
// ============================================================================
|
|
61
|
-
.pf-chatbot__chatbot-modal--default {
|
|
62
|
-
box-shadow: unset !important;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
57
|
// ============================================================================
|
|
66
58
|
// Chatbot Display Mode - Docked
|
|
67
59
|
// ============================================================================
|
|
@@ -71,7 +63,6 @@
|
|
|
71
63
|
inset-inline-end: 0;
|
|
72
64
|
border-radius: 0 !important;
|
|
73
65
|
--pf-v6-c-modal-box--MaxHeight: 100vh !important;
|
|
74
|
-
box-shadow: unset !important;
|
|
75
66
|
}
|
|
76
67
|
|
|
77
68
|
// ============================================================================
|
|
@@ -7,7 +7,7 @@ exports[`ChatbotWelcomePrompt should render welcome prompt 1`] = `
|
|
|
7
7
|
>
|
|
8
8
|
<h1
|
|
9
9
|
class="pf-v6-c-content--h1"
|
|
10
|
-
data-ouia-component-id="OUIA-Generated-Content
|
|
10
|
+
data-ouia-component-id="OUIA-Generated-Content-:r0:"
|
|
11
11
|
data-ouia-component-type="PF6/Content"
|
|
12
12
|
data-ouia-safe="true"
|
|
13
13
|
data-pf-content="true"
|
|
@@ -30,6 +30,11 @@
|
|
|
30
30
|
.pf-chatbot__file-label > .pf-v6-c-label__content {
|
|
31
31
|
--pf-v6-c-label--Color: var(--pf-t--global--background--color--primary--default);
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
@at-root :where(.pf-v6-theme-glass) & {
|
|
35
|
+
--pf-v6-c-label--BackgroundColor: var(--pf-t--global--background--color--secondary--default);
|
|
36
|
+
--pf-v6-c-label--m-clickable--hover--BackgroundColor: var(--pf-t--global--background--color--secondary--hover);
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
39
|
|
|
35
40
|
.pf-v6-theme-dark {
|
package/src/Message/Message.scss
CHANGED
|
@@ -11,12 +11,17 @@
|
|
|
11
11
|
// --------------------------------------------------------------------------
|
|
12
12
|
&-avatar.pf-v6-c-avatar {
|
|
13
13
|
--pf-v6-c-avatar--BorderRadius: 0;
|
|
14
|
+
flex-shrink: 0;
|
|
14
15
|
position: sticky;
|
|
15
16
|
top: var(--pf-t--global--spacer--md);
|
|
16
17
|
object-fit: cover;
|
|
17
18
|
pointer-events: none; // prevent dragging - interferes with FileDropZone
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
&-avatar.pf-v6-c-avatar:not(.pf-m-colorful) {
|
|
22
|
+
--pf-v6-c-avatar--BackgroundColor: var(--pf-t--global--background--color--floating--default);
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
&-avatar.pf-chatbot__message-avatar--round.pf-v6-c-avatar {
|
|
21
26
|
&:not(.pf-m-xl, .pf-m-lg, .pf-m-md, .pf-m-sm) {
|
|
22
27
|
--pf-v6-c-avatar--Width: 3rem;
|
|
@@ -242,11 +242,23 @@ describe('Message', () => {
|
|
|
242
242
|
).toBeInTheDocument();
|
|
243
243
|
});
|
|
244
244
|
it('should render avatar correctly', () => {
|
|
245
|
-
render(<Message avatar="./testImg" role="
|
|
245
|
+
render(<Message avatar="./testImg" role="user" name="A" content="Hi" />);
|
|
246
246
|
expect(screen.getByRole('img')).toHaveAttribute('src', './testImg');
|
|
247
247
|
});
|
|
248
248
|
it('should not render avatar if no avatar prop is passed', () => {
|
|
249
|
+
render(<Message role="user" name="A" content="Hi" />);
|
|
250
|
+
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
251
|
+
});
|
|
252
|
+
it('should render bot avatar if no avatar prop is passed', () => {
|
|
249
253
|
render(<Message role="bot" name="Bot" content="Hi" />);
|
|
254
|
+
expect(screen.queryAllByRole('img', { hidden: true })[0]).toBeVisible();
|
|
255
|
+
});
|
|
256
|
+
it('should not render avatar if isAvatarHidden is passed', () => {
|
|
257
|
+
render(<Message role="user" name="A" content="Hi" isAvatarHidden />);
|
|
258
|
+
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
259
|
+
});
|
|
260
|
+
it('should not render bot avatar if isAvatarHidden is passed', () => {
|
|
261
|
+
render(<Message role="bot" name="Bot" content="Hi" isAvatarHidden />);
|
|
250
262
|
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
251
263
|
});
|
|
252
264
|
it('should render botWord correctly', () => {
|
package/src/Message/Message.tsx
CHANGED
|
@@ -36,6 +36,7 @@ import DeepThinking, { DeepThinkingProps } from '../DeepThinking';
|
|
|
36
36
|
import ToolCall, { ToolCallProps } from '../ToolCall';
|
|
37
37
|
import MarkdownContent from '../MarkdownContent';
|
|
38
38
|
import { css } from '@patternfly/react-styles';
|
|
39
|
+
import RhUiAiChatbotIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-chatbot-icon';
|
|
39
40
|
|
|
40
41
|
export interface MessageAttachment {
|
|
41
42
|
/** Name of file attached to the message */
|
|
@@ -84,8 +85,10 @@ export interface MessageProps extends Omit<HTMLProps<HTMLDivElement>, 'role'> {
|
|
|
84
85
|
extraContent?: MessageExtraContent;
|
|
85
86
|
/** Name of the user */
|
|
86
87
|
name?: string;
|
|
87
|
-
/** Avatar
|
|
88
|
-
avatar?: string;
|
|
88
|
+
/** Avatar for the user. Pass a string for an image src, or a ReactNode for custom content like an svg or icon. Avatars for Messages with role="bot" are pre-defined and not customizable. */
|
|
89
|
+
avatar?: string | ReactNode;
|
|
90
|
+
/** Flag indicating whether the avatar is hidden */
|
|
91
|
+
isAvatarHidden?: boolean;
|
|
89
92
|
/** Timestamp for the message */
|
|
90
93
|
timestamp?: string;
|
|
91
94
|
/** Set this to true if message is being loaded */
|
|
@@ -214,6 +217,7 @@ export const MessageBase: FunctionComponent<MessageProps> = ({
|
|
|
214
217
|
extraContent,
|
|
215
218
|
name,
|
|
216
219
|
avatar,
|
|
220
|
+
isAvatarHidden = false,
|
|
217
221
|
timestamp,
|
|
218
222
|
isLoading,
|
|
219
223
|
actions,
|
|
@@ -326,6 +330,36 @@ export const MessageBase: FunctionComponent<MessageProps> = ({
|
|
|
326
330
|
);
|
|
327
331
|
};
|
|
328
332
|
|
|
333
|
+
const avatarClasses = css(
|
|
334
|
+
`pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
/* We are using an empty alt tag intentionally in order to reduce noise on screen readers */
|
|
338
|
+
const botAvatar = (
|
|
339
|
+
<Avatar className={avatarClasses} alt="" isBordered {...avatarProps} src={undefined} initials={undefined}>
|
|
340
|
+
<RhUiAiChatbotIcon />
|
|
341
|
+
</Avatar>
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
let _avatar: ReactNode | undefined;
|
|
345
|
+
|
|
346
|
+
if (!isAvatarHidden) {
|
|
347
|
+
if (role === 'bot') {
|
|
348
|
+
_avatar = botAvatar;
|
|
349
|
+
} else if (avatar) {
|
|
350
|
+
_avatar =
|
|
351
|
+
typeof avatar === 'string' ? (
|
|
352
|
+
<Avatar className={avatarClasses} src={avatar} alt="" {...avatarProps} />
|
|
353
|
+
) : (
|
|
354
|
+
<Avatar className={avatarClasses} alt="" {...avatarProps}>
|
|
355
|
+
{avatar}
|
|
356
|
+
</Avatar>
|
|
357
|
+
);
|
|
358
|
+
} else if (avatarProps?.initials) {
|
|
359
|
+
_avatar = <Avatar className={avatarClasses} alt="" {...avatarProps} />;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
329
363
|
return (
|
|
330
364
|
<section
|
|
331
365
|
aria-label={`Message from ${role} - ${dateString}`}
|
|
@@ -335,15 +369,7 @@ export const MessageBase: FunctionComponent<MessageProps> = ({
|
|
|
335
369
|
ref={innerRef}
|
|
336
370
|
{...props}
|
|
337
371
|
>
|
|
338
|
-
{
|
|
339
|
-
{avatar && (
|
|
340
|
-
<Avatar
|
|
341
|
-
className={`pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`}
|
|
342
|
-
src={avatar}
|
|
343
|
-
alt=""
|
|
344
|
-
{...avatarProps}
|
|
345
|
-
/>
|
|
346
|
-
)}
|
|
372
|
+
{_avatar && _avatar}
|
|
347
373
|
<div className="pf-chatbot__message-contents">
|
|
348
374
|
{isMetadataVisible && (
|
|
349
375
|
<div className="pf-chatbot__message-meta">
|
|
@@ -36,33 +36,24 @@
|
|
|
36
36
|
position: absolute;
|
|
37
37
|
inset: 0;
|
|
38
38
|
border-radius: inherit;
|
|
39
|
-
border: var(--pf-t--global--border--width--control--default) solid
|
|
39
|
+
border: var(--pf-t--global--border--width--control--default) solid
|
|
40
|
+
var(--pf-t--global--border--color--control--default);
|
|
40
41
|
pointer-events: none;
|
|
41
42
|
transition:
|
|
42
43
|
border-color var(--pf-t--global--motion--timing-function--accelerate) var(--pf-t--global--motion--duration--sm),
|
|
43
44
|
border-width var(--pf-t--global--motion--timing-function--accelerate) var(--pf-t--global--motion--duration--sm);
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
&::after {
|
|
47
|
-
border-color: var(--pf-t--global--border--color--control--default, transparent);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&.pf-m-primary {
|
|
51
|
-
&::after {
|
|
52
|
-
border-color: var(--pf-t--global--border--color--control--default, --pf-t--global--border--color--default);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
47
|
&:hover {
|
|
57
48
|
&::after {
|
|
58
|
-
border-color: var(--pf-t--global--border--color--hover
|
|
49
|
+
border-color: var(--pf-t--global--border--color--control--hover);
|
|
59
50
|
border-width: var(--pf-t--global--border--width--control--hover);
|
|
60
51
|
}
|
|
61
52
|
}
|
|
62
53
|
|
|
63
54
|
&:focus-within {
|
|
64
55
|
&::after {
|
|
65
|
-
border-color: var(--pf-t--global--border--color--clicked
|
|
56
|
+
border-color: var(--pf-t--global--border--color--control--clicked);
|
|
66
57
|
border-width: var(--pf-t--global--border--width--control--clicked);
|
|
67
58
|
}
|
|
68
59
|
}
|
|
@@ -183,14 +174,3 @@
|
|
|
183
174
|
.pf-chatbot__message-bar.pf-m-multiline {
|
|
184
175
|
border-radius: calc(var(--pf-t--global--border--radius--small) * 2);
|
|
185
176
|
}
|
|
186
|
-
|
|
187
|
-
// ============================================================================
|
|
188
|
-
// High contrast styles
|
|
189
|
-
// ============================================================================
|
|
190
|
-
:root:where(.pf-v6-theme-high-contrast) {
|
|
191
|
-
.pf-chatbot__message-bar {
|
|
192
|
-
&::after {
|
|
193
|
-
border-color: var(--pf-t--global--border--color--control--default, --pf-t--global--border--color--default);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
@@ -12,30 +12,28 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
.pf-v6-c-label {
|
|
15
|
-
--pf-v6-c-label--
|
|
16
|
-
--pf-v6-c-label--
|
|
17
|
-
--pf-v6-c-label--PaddingInlineStart: var(--pf-t--global--spacer--action--horizontal--compact);
|
|
15
|
+
--pf-v6-c-label--BorderColor: var(--pf-t--global--border--color--default);
|
|
16
|
+
--pf-v6-c-label--PaddingInlineStart: var(--pf-t--global--spacer--action--horizontal--compact);
|
|
18
17
|
--pf-v6-c-label--PaddingInlineEnd: var(--pf-t--global--spacer--action--horizontal--compact);
|
|
19
|
-
|
|
18
|
+
|
|
20
19
|
.pf-v6-c-label__text {
|
|
21
20
|
font-weight: var(--pf-t--global--font--weight--body--bold);
|
|
22
21
|
text-align: center;
|
|
23
|
-
}
|
|
22
|
+
}
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
&.pf-m-divider {
|
|
25
|
+
&.pf-m-divider {
|
|
27
26
|
.pf-v6-c-label {
|
|
28
|
-
--pf-v6-c-label--BackgroundColor: var(--pf-t--global--background--color--secondary--default);
|
|
29
27
|
--pf-v6-c-label--MaxWidth: 75%;
|
|
30
28
|
|
|
31
29
|
justify-self: center;
|
|
32
30
|
}
|
|
33
|
-
|
|
31
|
+
|
|
34
32
|
.pf-v6-c-divider {
|
|
35
33
|
align-self: center;
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
|
-
|
|
36
|
+
|
|
39
37
|
&.pf-m-wrap {
|
|
40
38
|
.pf-v6-c-label,
|
|
41
39
|
.pf-v6-c-label__text {
|
|
@@ -20,7 +20,7 @@ const MessageDivider: FunctionComponent<MessageDividerProps> = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<div className="pf-chatbot__message-divider pf-m-divider pf-m-wrap" {...props}>
|
|
22
22
|
<Divider />
|
|
23
|
-
<Label
|
|
23
|
+
<Label>{content}</Label>
|
|
24
24
|
</div>
|
|
25
25
|
);
|
|
26
26
|
}
|