@patternfly/chatbot 6.5.0-prerelease.1 → 6.5.0-prerelease.3
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/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/CodeModal/CodeModal.js +36 -4
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
- package/dist/cjs/Message/Message.d.ts +4 -19
- package/dist/cjs/Message/Message.js +4 -1
- package/dist/cjs/Message/Message.test.js +6 -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 +17 -6
- package/dist/css/main.css.map +1 -1
- 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/CodeModal/CodeModal.js +38 -6
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
- package/dist/esm/Message/Message.d.ts +4 -19
- package/dist/esm/Message/Message.js +4 -1
- package/dist/esm/Message/Message.test.js +7 -1
- 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 +2 -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/demos/ChatbotAttachmentMenu.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotTranscripts.tsx +1 -1
- package/patternfly-docs/patternfly-docs.config.js +1 -0
- 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/CodeModal/CodeModal.tsx +54 -7
- package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +3 -2
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +5 -1
- package/src/Message/Message.test.tsx +19 -1
- package/src/Message/Message.tsx +6 -22
- package/src/Message/TextMessage/TextMessage.scss +6 -0
- package/src/__mocks__/rehype-highlight.ts +3 -0
package/src/Message/Message.tsx
CHANGED
|
@@ -11,8 +11,6 @@ import {
|
|
|
11
11
|
AvatarProps,
|
|
12
12
|
ButtonProps,
|
|
13
13
|
ContentVariants,
|
|
14
|
-
ExpandableSectionProps,
|
|
15
|
-
ExpandableSectionToggleProps,
|
|
16
14
|
FormProps,
|
|
17
15
|
Label,
|
|
18
16
|
LabelGroupProps,
|
|
@@ -20,7 +18,7 @@ import {
|
|
|
20
18
|
Truncate
|
|
21
19
|
} from '@patternfly/react-core';
|
|
22
20
|
import MessageLoading from './MessageLoading';
|
|
23
|
-
import CodeBlockMessage from './CodeBlockMessage/CodeBlockMessage';
|
|
21
|
+
import CodeBlockMessage, { CodeBlockMessageProps } from './CodeBlockMessage/CodeBlockMessage';
|
|
24
22
|
import TextMessage from './TextMessage/TextMessage';
|
|
25
23
|
import FileDetailsLabel from '../FileDetailsLabel/FileDetailsLabel';
|
|
26
24
|
import ResponseActions, { ActionProps } from '../ResponseActions/ResponseActions';
|
|
@@ -44,6 +42,9 @@ import ImageMessage from './ImageMessage/ImageMessage';
|
|
|
44
42
|
import rehypeUnwrapImages from 'rehype-unwrap-images';
|
|
45
43
|
import rehypeExternalLinks from 'rehype-external-links';
|
|
46
44
|
import rehypeSanitize from 'rehype-sanitize';
|
|
45
|
+
import rehypeHighlight from 'rehype-highlight';
|
|
46
|
+
// see the full list of styles here: https://highlightjs.org/examples
|
|
47
|
+
import 'highlight.js/styles/vs2015.css';
|
|
47
48
|
import { PluggableList } from 'unified';
|
|
48
49
|
import LinkMessage from './LinkMessage/LinkMessage';
|
|
49
50
|
import ErrorMessage from './ErrorMessage/ErrorMessage';
|
|
@@ -114,24 +115,7 @@ export interface MessageProps extends Omit<HTMLProps<HTMLDivElement>, 'role'> {
|
|
|
114
115
|
/** Label for the English "Loading message," displayed to screenreaders when loading a message */
|
|
115
116
|
loadingWord?: string;
|
|
116
117
|
/** Props for code blocks */
|
|
117
|
-
codeBlockProps?:
|
|
118
|
-
/** Aria label applied to code blocks */
|
|
119
|
-
'aria-label'?: string;
|
|
120
|
-
/** Class name applied to code blocks */
|
|
121
|
-
className?: string;
|
|
122
|
-
/** Whether code blocks are expandable */
|
|
123
|
-
isExpandable?: boolean;
|
|
124
|
-
/** Length of text initially shown in expandable code blocks; defaults to 10 characters */
|
|
125
|
-
maxLength?: number;
|
|
126
|
-
/** Additional props passed to expandable section if isExpandable is applied */
|
|
127
|
-
expandableSectionProps?: Omit<ExpandableSectionProps, 'ref'>;
|
|
128
|
-
/** Additional props passed to expandable toggle if isExpandable is applied */
|
|
129
|
-
expandableSectionToggleProps?: ExpandableSectionToggleProps;
|
|
130
|
-
/** Link text applied to expandable toggle when expanded */
|
|
131
|
-
expandedText?: string;
|
|
132
|
-
/** Link text applied to expandable toggle when collapsed */
|
|
133
|
-
collapsedText?: string;
|
|
134
|
-
};
|
|
118
|
+
codeBlockProps?: CodeBlockMessageProps;
|
|
135
119
|
/** Props for quick responses */
|
|
136
120
|
quickResponses?: QuickResponse[];
|
|
137
121
|
/** Props for quick responses container */
|
|
@@ -261,7 +245,7 @@ export const MessageBase: FunctionComponent<MessageProps> = ({
|
|
|
261
245
|
}, [content]);
|
|
262
246
|
|
|
263
247
|
const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
|
|
264
|
-
let rehypePlugins: PluggableList = [rehypeUnwrapImages, rehypeMoveImagesOutOfParagraphs];
|
|
248
|
+
let rehypePlugins: PluggableList = [rehypeUnwrapImages, rehypeMoveImagesOutOfParagraphs, rehypeHighlight];
|
|
265
249
|
if (openLinkInNewTab) {
|
|
266
250
|
rehypePlugins = rehypePlugins.concat([[rehypeExternalLinks, { target: '_blank' }, rehypeSanitize]]);
|
|
267
251
|
}
|
|
@@ -71,6 +71,12 @@ li[id*='user-content-fn-']:has(> span > span > .pf-chatbot__message-text + .pf-c
|
|
|
71
71
|
margin-block-end: var(--pf-t--global--spacer--md);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
.pf-chatbot__message-text.footnotes {
|
|
75
|
+
.data-footnote-backref {
|
|
76
|
+
width: fit-content;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
.pf-chatbot__message--user {
|
|
75
81
|
.pf-chatbot__message-text {
|
|
76
82
|
background-color: var(--pf-t--global--color--brand--default);
|