@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.
Files changed (50) hide show
  1. package/dist/cjs/ChatbotContent/ChatbotContent.d.ts +2 -0
  2. package/dist/cjs/ChatbotContent/ChatbotContent.js +2 -2
  3. package/dist/cjs/ChatbotContent/ChatbotContent.test.js +4 -0
  4. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -1
  5. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -3
  6. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +4 -0
  7. package/dist/cjs/CodeModal/CodeModal.js +36 -4
  8. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
  9. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
  10. package/dist/cjs/Message/Message.d.ts +4 -19
  11. package/dist/cjs/Message/Message.js +4 -1
  12. package/dist/cjs/Message/Message.test.js +6 -0
  13. package/dist/cjs/__mocks__/rehype-highlight.d.ts +2 -0
  14. package/dist/cjs/__mocks__/rehype-highlight.js +4 -0
  15. package/dist/css/main.css +17 -6
  16. package/dist/css/main.css.map +1 -1
  17. package/dist/esm/ChatbotContent/ChatbotContent.d.ts +2 -0
  18. package/dist/esm/ChatbotContent/ChatbotContent.js +2 -2
  19. package/dist/esm/ChatbotContent/ChatbotContent.test.js +4 -0
  20. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +3 -1
  21. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +3 -3
  22. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +4 -0
  23. package/dist/esm/CodeModal/CodeModal.js +38 -6
  24. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
  25. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
  26. package/dist/esm/Message/Message.d.ts +4 -19
  27. package/dist/esm/Message/Message.js +4 -1
  28. package/dist/esm/Message/Message.test.js +7 -1
  29. package/dist/esm/__mocks__/rehype-highlight.d.ts +2 -0
  30. package/dist/esm/__mocks__/rehype-highlight.js +2 -0
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +2 -1
  33. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +14 -14
  34. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx +14 -14
  35. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +2 -2
  36. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -2
  37. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotTranscripts.tsx +1 -1
  38. package/patternfly-docs/patternfly-docs.config.js +1 -0
  39. package/src/ChatbotContent/ChatbotContent.scss +4 -0
  40. package/src/ChatbotContent/ChatbotContent.test.tsx +5 -0
  41. package/src/ChatbotContent/ChatbotContent.tsx +4 -1
  42. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.tsx +5 -0
  43. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +7 -4
  44. package/src/CodeModal/CodeModal.tsx +54 -7
  45. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +3 -2
  46. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +5 -1
  47. package/src/Message/Message.test.tsx +19 -1
  48. package/src/Message/Message.tsx +6 -22
  49. package/src/Message/TextMessage/TextMessage.scss +6 -0
  50. package/src/__mocks__/rehype-highlight.ts +3 -0
@@ -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);
@@ -0,0 +1,3 @@
1
+ const rehypeHighlight = () => (tree) => tree;
2
+
3
+ export default rehypeHighlight;