@patternfly/chatbot 6.5.0-prerelease.2 → 6.5.0-prerelease.20

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 (152) hide show
  1. package/dist/cjs/AttachMenu/AttachMenu.d.ts +8 -2
  2. package/dist/cjs/AttachMenu/AttachMenu.js +2 -2
  3. package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +5 -2
  4. package/dist/cjs/ChatbotFooter/ChatbotFooter.js +2 -2
  5. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +5 -1
  6. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +29 -2
  7. package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
  8. package/dist/cjs/CodeModal/CodeModal.js +53 -8
  9. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.d.ts +2 -1
  10. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
  11. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
  12. package/dist/cjs/Message/Message.d.ts +7 -1
  13. package/dist/cjs/Message/Message.js +11 -8
  14. package/dist/cjs/Message/Message.test.js +36 -0
  15. package/dist/cjs/Message/MessageLoading.d.ts +2 -1
  16. package/dist/cjs/Message/MessageLoading.js +1 -1
  17. package/dist/cjs/Message/TableMessage/TableMessage.d.ts +4 -1
  18. package/dist/cjs/Message/TableMessage/TableMessage.js +2 -2
  19. package/dist/cjs/Message/TextMessage/TextMessage.d.ts +4 -1
  20. package/dist/cjs/Message/TextMessage/TextMessage.js +2 -2
  21. package/dist/cjs/MessageBar/AttachButton.d.ts +2 -0
  22. package/dist/cjs/MessageBar/AttachButton.js +2 -2
  23. package/dist/cjs/MessageBar/AttachButton.test.js +4 -0
  24. package/dist/cjs/MessageBar/MessageBar.d.ts +16 -6
  25. package/dist/cjs/MessageBar/MessageBar.js +6 -5
  26. package/dist/cjs/MessageBar/MessageBar.test.js +62 -0
  27. package/dist/cjs/Onboarding/Onboarding.d.ts +36 -0
  28. package/dist/cjs/Onboarding/Onboarding.js +37 -0
  29. package/dist/cjs/Onboarding/Onboarding.test.d.ts +1 -0
  30. package/dist/cjs/Onboarding/Onboarding.test.js +80 -0
  31. package/dist/cjs/Onboarding/index.d.ts +2 -0
  32. package/dist/cjs/Onboarding/index.js +23 -0
  33. package/dist/cjs/ResponseActions/ResponseActions.d.ts +3 -0
  34. package/dist/cjs/ResponseActions/ResponseActions.js +28 -7
  35. package/dist/cjs/ResponseActions/ResponseActions.test.js +67 -12
  36. package/dist/cjs/__mocks__/monaco-editor.d.ts +11 -0
  37. package/dist/cjs/__mocks__/monaco-editor.js +18 -0
  38. package/dist/cjs/__mocks__/rehype-highlight.d.ts +2 -0
  39. package/dist/cjs/__mocks__/rehype-highlight.js +4 -0
  40. package/dist/cjs/index.d.ts +2 -0
  41. package/dist/cjs/index.js +4 -1
  42. package/dist/css/main.css +219 -21
  43. package/dist/css/main.css.map +1 -1
  44. package/dist/dynamic/Onboarding/package.json +1 -0
  45. package/dist/esm/AttachMenu/AttachMenu.d.ts +8 -2
  46. package/dist/esm/AttachMenu/AttachMenu.js +2 -2
  47. package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +5 -2
  48. package/dist/esm/ChatbotFooter/ChatbotFooter.js +2 -2
  49. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +5 -1
  50. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +30 -3
  51. package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
  52. package/dist/esm/CodeModal/CodeModal.js +54 -9
  53. package/dist/esm/FileDetailsLabel/FileDetailsLabel.d.ts +2 -1
  54. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
  55. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +2 -2
  56. package/dist/esm/Message/Message.d.ts +7 -1
  57. package/dist/esm/Message/Message.js +11 -8
  58. package/dist/esm/Message/Message.test.js +36 -0
  59. package/dist/esm/Message/MessageLoading.d.ts +2 -1
  60. package/dist/esm/Message/MessageLoading.js +1 -1
  61. package/dist/esm/Message/TableMessage/TableMessage.d.ts +4 -1
  62. package/dist/esm/Message/TableMessage/TableMessage.js +2 -2
  63. package/dist/esm/Message/TextMessage/TextMessage.d.ts +4 -1
  64. package/dist/esm/Message/TextMessage/TextMessage.js +2 -2
  65. package/dist/esm/MessageBar/AttachButton.d.ts +2 -0
  66. package/dist/esm/MessageBar/AttachButton.js +2 -2
  67. package/dist/esm/MessageBar/AttachButton.test.js +4 -0
  68. package/dist/esm/MessageBar/MessageBar.d.ts +16 -6
  69. package/dist/esm/MessageBar/MessageBar.js +6 -5
  70. package/dist/esm/MessageBar/MessageBar.test.js +62 -0
  71. package/dist/esm/Onboarding/Onboarding.d.ts +36 -0
  72. package/dist/esm/Onboarding/Onboarding.js +30 -0
  73. package/dist/esm/Onboarding/Onboarding.test.d.ts +1 -0
  74. package/dist/esm/Onboarding/Onboarding.test.js +75 -0
  75. package/dist/esm/Onboarding/index.d.ts +2 -0
  76. package/dist/esm/Onboarding/index.js +2 -0
  77. package/dist/esm/ResponseActions/ResponseActions.d.ts +3 -0
  78. package/dist/esm/ResponseActions/ResponseActions.js +28 -7
  79. package/dist/esm/ResponseActions/ResponseActions.test.js +67 -12
  80. package/dist/esm/__mocks__/monaco-editor.d.ts +11 -0
  81. package/dist/esm/__mocks__/monaco-editor.js +18 -0
  82. package/dist/esm/__mocks__/rehype-highlight.d.ts +2 -0
  83. package/dist/esm/__mocks__/rehype-highlight.js +2 -0
  84. package/dist/esm/index.d.ts +2 -0
  85. package/dist/esm/index.js +2 -0
  86. package/dist/tsconfig.tsbuildinfo +1 -1
  87. package/package.json +14 -2
  88. package/patternfly-docs/content/extensions/chatbot/chatbot.md +57 -0
  89. package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +12 -12
  90. package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +1 -1
  91. package/patternfly-docs/content/extensions/chatbot/examples/Customizing Messages/Customizing Messages.md +1 -1
  92. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -0
  93. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithPersistedActions.tsx +22 -0
  94. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +11 -0
  95. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +18 -4
  96. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -0
  97. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessageWithExtraContent.tsx +3 -1
  98. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarIndicatorThinking.tsx +15 -0
  99. package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactOnboarding.tsx +141 -0
  100. package/patternfly-docs/content/extensions/chatbot/examples/UI/Onboarding.tsx +151 -0
  101. package/patternfly-docs/content/extensions/chatbot/examples/UI/RH-Hat-Image.svg +9 -0
  102. package/patternfly-docs/content/extensions/chatbot/examples/UI/Settings.tsx +1 -1
  103. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +55 -27
  104. package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +18 -18
  105. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +29 -21
  106. package/patternfly-docs/content/extensions/chatbot/examples/demos/WhiteEmbeddedChatbot.tsx +451 -0
  107. package/patternfly-docs/patternfly-docs.config.js +2 -1
  108. package/patternfly-docs/patternfly-docs.source.js +1 -1
  109. package/src/AttachMenu/AttachMenu.tsx +26 -11
  110. package/src/Chatbot/Chatbot.scss +23 -1
  111. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +25 -0
  112. package/src/ChatbotFooter/ChatbotFooter.scss +21 -0
  113. package/src/ChatbotFooter/ChatbotFooter.test.tsx +10 -1
  114. package/src/ChatbotFooter/ChatbotFooter.tsx +10 -3
  115. package/src/ChatbotHeader/ChatbotHeader.scss +19 -0
  116. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +56 -14
  117. package/src/ChatbotModal/ChatbotModal.scss +3 -0
  118. package/src/CodeModal/CodeModal.tsx +72 -23
  119. package/src/DeepThinking/DeepThinking.scss +1 -1
  120. package/src/FileDetailsLabel/FileDetailsLabel.tsx +2 -2
  121. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +12 -0
  122. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +4 -1
  123. package/src/Message/Message.scss +11 -7
  124. package/src/Message/Message.test.tsx +41 -0
  125. package/src/Message/Message.tsx +28 -13
  126. package/src/Message/MessageLoading.scss +7 -0
  127. package/src/Message/MessageLoading.tsx +2 -2
  128. package/src/Message/TableMessage/TableMessage.scss +6 -1
  129. package/src/Message/TableMessage/TableMessage.tsx +6 -2
  130. package/src/Message/TextMessage/TextMessage.scss +10 -0
  131. package/src/Message/TextMessage/TextMessage.tsx +11 -2
  132. package/src/Message/UserFeedback/UserFeedback.scss +2 -1
  133. package/src/MessageBar/AttachButton.test.tsx +4 -0
  134. package/src/MessageBar/AttachButton.tsx +4 -1
  135. package/src/MessageBar/MessageBar.scss +40 -3
  136. package/src/MessageBar/MessageBar.test.tsx +102 -1
  137. package/src/MessageBar/MessageBar.tsx +44 -11
  138. package/src/Onboarding/Onboarding.scss +101 -0
  139. package/src/Onboarding/Onboarding.test.tsx +148 -0
  140. package/src/Onboarding/Onboarding.tsx +126 -0
  141. package/src/Onboarding/index.ts +3 -0
  142. package/src/ResponseActions/ResponseActions.scss +1 -1
  143. package/src/ResponseActions/ResponseActions.test.tsx +111 -12
  144. package/src/ResponseActions/ResponseActions.tsx +38 -10
  145. package/src/ToolCall/ToolCall.scss +1 -1
  146. package/src/ToolResponse/ToolResponse.scss +3 -3
  147. package/src/__mocks__/monaco-editor.ts +19 -0
  148. package/src/__mocks__/rehype-highlight.ts +3 -0
  149. package/src/index.ts +3 -0
  150. package/src/main.scss +1 -0
  151. package/tsconfig.json +1 -1
  152. package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +0 -44
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/chatbot",
3
- "version": "6.5.0-prerelease.2",
3
+ "version": "6.5.0-prerelease.20",
4
4
  "description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -36,6 +36,7 @@
36
36
  "@patternfly/react-code-editor": "^6.1.0",
37
37
  "@patternfly/react-core": "^6.1.0",
38
38
  "@patternfly/react-icons": "^6.1.0",
39
+ "@patternfly/react-styles": "^6.1.0",
39
40
  "@patternfly/react-table": "^6.1.0",
40
41
  "@segment/analytics-next": "^1.76.0",
41
42
  "clsx": "^2.1.0",
@@ -43,18 +44,29 @@
43
44
  "posthog-js": "^1.194.4",
44
45
  "react-markdown": "^9.0.1",
45
46
  "rehype-external-links": "^3.0.0",
47
+ "rehype-highlight": "^7.0.0",
46
48
  "rehype-sanitize": "^6.0.0",
47
49
  "rehype-unwrap-images": "^1.0.0",
48
50
  "remark-gfm": "^4.0.0",
49
51
  "unist-util-visit": "^5.0.0"
50
52
  },
51
53
  "peerDependencies": {
54
+ "@monaco-editor/react": "^4.7.0",
55
+ "monaco-editor": "^0.54.0",
52
56
  "react": "^18 || ^19",
53
57
  "react-dom": "^18 || ^19"
54
58
  },
59
+ "peerDependenciesMeta": {
60
+ "@monaco-editor/react": {
61
+ "optional": false
62
+ },
63
+ "monaco-editor": {
64
+ "optional": false
65
+ }
66
+ },
55
67
  "devDependencies": {
56
68
  "@octokit/rest": "^18.0.0",
57
- "@patternfly/documentation-framework": "6.28.6",
69
+ "@patternfly/documentation-framework": "6.28.9",
58
70
  "@patternfly/patternfly": "^6.1.0",
59
71
  "@patternfly/patternfly-a11y": "^5.0.0",
60
72
  "@types/dom-speech-recognition": "^0.0.4",
@@ -0,0 +1,57 @@
1
+ ---
2
+ id: Overview
3
+ title: ChatBot overview
4
+ section: extensions
5
+ subsection: ChatBot
6
+ sortValue: 1
7
+ source: ChatBot
8
+ ---
9
+
10
+ **Note:** The PatternFly ChatBot extension lives in its own package [`@patternfly/chatbot`](https://www.npmjs.com/package/@patternfly/chatbot).
11
+
12
+ The PatternFly **ChatBot** extension contains a React implementation of an AI-focused chatbot, providing users with access to convenient and persistent help. This extension is intended to remain in alignment with our [AI principles and design guidelines](/ai/overview).
13
+
14
+ *Only use this ChatBot when it adds value to your users' experiences.* Don't use it simply for the sake of novelty—it must directly help users reach their goals.
15
+
16
+ ---
17
+
18
+ ## How do I use ChatBot?
19
+
20
+ To get started:
21
+ 1. Install the `@patternfly/chatbot` package by following [the README instructions](https://github.com/patternfly/chatbot).
22
+ 2. To use a ChatBot component in your project, import the ChatBot and the component you need. For example: `import ChatbotWelcomePrompt from '@patternfly/chatbot/dist/dynamic/ChatbotWelcomePrompt';`
23
+ 3. To build out and customize your ChatBot experience, refer to our extensive documentation on PatternFly.org.
24
+
25
+ ## What does a built-out ChatBot look like?
26
+
27
+ To illustrate holistic ChatBot solutions, we offer these interactive demos:
28
+ - [Basic ChatBot](/extensions/chatbot/overview/demo#basic-chatbot): A standard ChatBot that can swap between display modes.
29
+ - [Compact ChatBot](/extensions/chatbot/overview/demo#compact-chatbot): A compact version of a standard ChatBot that allows for more information density.
30
+ - [Embedded ChatBot](/extensions/chatbot/overview/demo#embedded-chatbot): A ChatBot experience that can be embedded into a page within an application.
31
+ - [Inline drawer ChatBot](/extensions/chatbot/overview/demo#inline-drawer-chatbot): A ChatBot placed within a drawer that is inline with page content, rather than one that overlays the page.
32
+
33
+ ## How do I build a ChatBot for my product?
34
+
35
+ To learn how to design ChatBot experiences, refer to [the design guidelines](/extensions/chatbot/overview/design-guidelines) and our [conversation design guidelines](/ai/conversation-design/).
36
+
37
+ Explore our documentation, which covers both the components you'll need to build your ChatBot and the guidance to follow for different functionality:
38
+ - UI: Structural, core components
39
+ - [Structural elements](/extensions/chatbot/ui#structure)
40
+ - [Toggle](/extensions/chatbot/ui#toggle)
41
+ - [Header](/extensions/chatbot/ui#header)
42
+ - [Footer](/extensions/chatbot/ui#footer)
43
+ - [Navigation](/extensions/chatbot/ui#navigation)
44
+ - [Modals](/extensions/chatbot/ui#modals)
45
+ - Messages: Components that customize features related to the conversation
46
+ - [Bot and user messages](/extensions/chatbot/messages)
47
+ - [File attachments](/extensions/chatbot/messages#file-attachments)
48
+ - Patterns: More opinionated implementation solutions for common use cases
49
+ - [Primary color background](/extensions/chatbot/overview/demo#primary-color-background)
50
+ - [Display mode switcher](/extensions/chatbot/overview/demo#display-mode-switcher)
51
+ - [Chat transcripts](/extensions/chatbot/overview/demo#chat-transcripts)
52
+ - [Analytics](/extensions/chatbot/analytics): Tracking for ChatBot interactions
53
+ - [Customizing messages](/extensions/chatbot/customizing-messages): Details for the implementation of custom messages
54
+
55
+ ---
56
+
57
+ We will continue to grow and evolve our ChatBot. If you notice a bug or have any suggestions, feel free to file an issue in our [GitHub repository!](https://github.com/patternfly/chatbot/issues) Make sure to check if there is already a pre-existing issue before creating a new one.
@@ -1,5 +1,5 @@
1
1
  ---
2
- section: PatternFly-AI
2
+ section: extensions
3
3
  subsection: ChatBot
4
4
  id: Overview
5
5
  sortValue: 1
@@ -22,7 +22,7 @@ import "./images.css"
22
22
  1. **Attachments:** Details about files that a user has uploaded to the ChatBot.
23
23
  1. **Footer:** A persistent region at the bottom of the ChatBot window that contains the message bar and the footnote.
24
24
  1. **Footnote (optional):** A persistent, short message that contains any legal disclaimers or important information about the ChatBot. Footnotes are optional, but strongly recommended. More details can be found in the [footnote guidelines](#footnotes).
25
- 1. **Toggle:** The button that allows users to open and close the ChatBot window. When the ChatBot is opened, the toggle should appear below the ChatBot window. The toggle shape and icon can be customized as needed, as shown in these [ChatBot toggle examples](/patternfly-ai/chatbot/ui#custom-toggle-icon). More details can be found in the [guidelines for accessing a ChatBot](#accessing-a-chatbot).
25
+ 1. **Toggle:** The button that allows users to open and close the ChatBot window. When the ChatBot is opened, the toggle should appear below the ChatBot window. The toggle shape and icon can be customized as needed, as shown in these [ChatBot toggle examples](/extensions/chatbot/ui#custom-toggle-icon). More details can be found in the [guidelines for accessing a ChatBot](#accessing-a-chatbot).
26
26
 
27
27
  ### Messages
28
28
 
@@ -37,7 +37,7 @@ import "./images.css"
37
37
  1. **Timestamp:** The relative or absolute time that a message was sent.
38
38
  1. **Label:** Labels ChatBot messages as "AI."
39
39
  1. **Quick responses:** Programmable, clickable actions that allow users to quickly answer questions from the ChatBot.
40
- 1. **Message actions:** Actions that allow users to interact with a bot message. These typically include providing feedback, copying, sharing, or reading aloud, but [custom message actions](/patternfly-ai/chatbot/messages#custom-message-actions) are also supported. More details for the feedback actions can be found in the [message feedback](#message-feedback) section.
40
+ 1. **Message actions:** Actions that allow users to interact with a bot message. These typically include providing feedback, copying, sharing, or reading aloud, but [custom message actions](/extensions/chatbot/messages#custom-message-actions) are also supported. More details for the feedback actions can be found in the [message feedback](#message-feedback) section.
41
41
 
42
42
  #### Welcome message
43
43
 
@@ -77,7 +77,7 @@ Selecting the quick start title, or the "Start" link can be configured to launch
77
77
 
78
78
  ### Message actions
79
79
 
80
- To allow users to interact with bot messages, utilize message actions. Refer to [the message actions React example](/patternfly-ai/chatbot/messages#message-actions) for an interactive visual.
80
+ To allow users to interact with bot messages, utilize message actions. Refer to [the message actions React example](/extensions/chatbot/messages#message-actions) for an interactive visual.
81
81
 
82
82
  The following actions can be used for some of the most common interactions:
83
83
 
@@ -91,7 +91,7 @@ The following actions can be used for some of the most common interactions:
91
91
  1. **Download:** Downloads the chat message. [Learn more about downloading chat transcripts](#downloading-chat-transcripts).
92
92
  1. **Listen:** Reads the message content out loud.
93
93
 
94
- You can also use [custom message actions](/patternfly-ai/chatbot/messages#custom-message-actions) as needed for your particular use case. When using custom actions, be sure to add a tooltip that describes the effect that the action will have. For more information, view [our tooltips guidelines](/ux-writing/tooltips).
94
+ You can also use [custom message actions](/extensions/chatbot/messages#custom-message-actions) as needed for your particular use case. When using custom actions, be sure to add a tooltip that describes the effect that the action will have. For more information, view [our tooltips guidelines](/ux-writing/tooltips).
95
95
 
96
96
  #### Message feedback
97
97
 
@@ -133,7 +133,7 @@ To message the ChatBot, users can type directly into the message bar in the foot
133
133
  1. **Use microphone button:** Supports speech recognition to allow users to use voice input. This feature is currently only available in Chrome and Safari.
134
134
  1. **Send button:** Allows users to send a typed message. This button should be disabled until a user has input text.
135
135
 
136
- When a user chooses to use speech input via the microphone button, the button will display a pulsing animation to indicate that the ChatBot is listening to the user (as shown in [this speech recognition example](/patternfly-ai/chatbot/ui#message-bar-with-speech-recognition-and-file-attachment)).
136
+ When a user chooses to use speech input via the microphone button, the button will display a pulsing animation to indicate that the ChatBot is listening to the user (as shown in [this speech recognition example](/extensions/chatbot/ui#message-bar-with-speech-recognition-and-file-attachment)).
137
137
 
138
138
  <div class="ws-docs-content-img">
139
139
  ![Animation phases of the listening button in the message bar.](./img/listening-pulse.svg)
@@ -266,7 +266,7 @@ As much as possible, the suggested prompts should consider the user’s location
266
266
 
267
267
  Instead of automatically initiating what sounds like a request from a user, the ChatBot should ask users to confirm or deny their intent. This differentiates moments where users are simply asking about feasibility, rather than actually making a request.
268
268
 
269
- This can be done using the [quick response](/patternfly-ai/chatbot/messages#messages-with-quick-responses) buttons:
269
+ This can be done using the [quick response](/extensions/chatbot/messages#messages-with-quick-responses) buttons:
270
270
 
271
271
  <div class="ws-docs-content-img">
272
272
  ![Confirmation options from a bot in response to a user's request.](./img/quick-response-confirmation.svg)
@@ -310,7 +310,7 @@ Within the settings menu, users can select their preferences for a variety of Ch
310
310
 
311
311
  ### Attaching files
312
312
 
313
- Using [the attach button](/patternfly-ai/chatbot/overview/design-guidelines#message-bar) in the message bar, users can [attach files](/patternfly-ai/chatbot/messages#file-attachments) to their message to share with the ChatBot.
313
+ Using [the attach button](/extensions/chatbot/overview/design-guidelines#message-bar) in the message bar, users can [attach files](/extensions/chatbot/messages#file-attachments) to their message to share with the ChatBot.
314
314
 
315
315
  The attach button can follow a couple of patterns, including:
316
316
 
@@ -333,7 +333,7 @@ If a message attachment is successful, a label with the file details will be dis
333
333
  ![File attached to user message.](./img/attached-file.svg)
334
334
  </div>
335
335
 
336
- Users can select the file label to either preview or edit their attachment, as shown in these [attachment examples](/patternfly-ai/chatbot/messages#attachment-preview).
336
+ Users can select the file label to either preview or edit their attachment, as shown in these [attachment examples](/extensions/chatbot/messages#attachment-preview).
337
337
 
338
338
  If a message attachment fails, an error message should share the reason for failure:
339
339
 
@@ -351,7 +351,7 @@ Choose the download action location that best works for your ChatBot:
351
351
 
352
352
  #### Download via conversation history drawer
353
353
 
354
- If your ChatBot uses a conversation history drawer, you can provide a download option in the [actions menu linked to a previous conversation](/patternfly-ai/chatbot/ui#drawer-with-conversation-actions).
354
+ If your ChatBot uses a conversation history drawer, you can provide a download option in the [actions menu linked to a previous conversation](/extensions/chatbot/ui#drawer-with-conversation-actions).
355
355
 
356
356
  <div class="ws-docs-content-img">
357
357
  ![Expanded menu for previous chat in the history window, which shows a download option.](./img/download-chat-history.svg)
@@ -415,7 +415,7 @@ There are a few display modes that users can choose when interacting with a Chat
415
415
 
416
416
  ### Layouts
417
417
 
418
- ChatBot supports a side-by-side [comparison layout](/patternfly-ai/chatbot/overview/demo#comparing-chatbots), which allows users to compare 2 chats at once. This can be helpful to let users understand how different models respond to the same prompt.
418
+ ChatBot supports a side-by-side [comparison layout](/extensions/chatbot/overview/demo#comparing-chatbots), which allows users to compare 2 chats at once. This can be helpful to let users understand how different models respond to the same prompt.
419
419
 
420
420
  <div class="ws-docs-content-img">
421
421
  ![2 ChatBots in comparison mode.](./img/comparison.svg)
@@ -429,7 +429,7 @@ Refer to the additional guidelines for [accessing a ChatBot](#accessing-a-chatbo
429
429
 
430
430
  ## Content considerations
431
431
 
432
- For guidance on writing ChatBot content, refer to our [conversation design guidelines](/patternfly-ai/conversation-design).
432
+ For guidance on writing ChatBot content, refer to our [conversation design guidelines](/ai/conversation-design).
433
433
 
434
434
  ## Accessibility
435
435
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  # Sidenav top-level section
3
3
  # should be the same for all markdown files
4
- section: PatternFly-AI
4
+ section: extensions
5
5
  subsection: ChatBot
6
6
  # Sidenav secondary level section
7
7
  # should be the same for all markdown files
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  # Sidenav top-level section
3
3
  # should be the same for all markdown files
4
- section: PatternFly-AI
4
+ section: extensions
5
5
  subsection: ChatBot
6
6
  # Sidenav secondary level section
7
7
  # should be the same for all markdown files
@@ -318,6 +318,7 @@ _Italic text, formatted with single underscores_
318
318
  content="This bot has a square avatar. You can further customize the avatar by applying an additional class or passing [PatternFly avatar props](/components/avatar) to the `<Message>` component via `avatarProps`."
319
319
  hasRoundAvatar={false}
320
320
  />
321
+ <Message name="Bot" role="bot" content="This is a message from a bot with no avatar." />
321
322
  <Select
322
323
  id="single-select"
323
324
  isOpen={isOpen}
@@ -0,0 +1,22 @@
1
+ import { FunctionComponent } from 'react';
2
+
3
+ import Message from '@patternfly/chatbot/dist/dynamic/Message';
4
+ import patternflyAvatar from './patternfly_avatar.jpg';
5
+
6
+ export const MessageWithPersistedActions: FunctionComponent = () => (
7
+ <Message
8
+ name="Bot"
9
+ role="bot"
10
+ avatar={patternflyAvatar}
11
+ content="I updated your account with those settings. You're ready to set up your first dashboard! Click a button and then click outside the message - notice the selection persists."
12
+ actions={{
13
+ // eslint-disable-next-line no-console
14
+ positive: { onClick: () => console.log('Good response') },
15
+ // eslint-disable-next-line no-console
16
+ negative: { onClick: () => console.log('Bad response') },
17
+ // eslint-disable-next-line no-console
18
+ listen: { onClick: () => console.log('Listen') }
19
+ }}
20
+ persistActionSelection
21
+ />
22
+ );
@@ -1,6 +1,7 @@
1
1
  import { FunctionComponent } from 'react';
2
2
  import Message from '@patternfly/chatbot/dist/dynamic/Message';
3
3
  import patternflyAvatar from './patternfly_avatar.jpg';
4
+ import { CopyIcon, WrenchIcon } from '@patternfly/react-icons';
4
5
 
5
6
  export const MessageWithQuickResponsesExample: FunctionComponent = () => (
6
7
  <>
@@ -74,5 +75,15 @@ export const MessageWithQuickResponsesExample: FunctionComponent = () => (
74
75
  ]}
75
76
  isCompact
76
77
  />
78
+ <Message
79
+ name="Bot"
80
+ role="bot"
81
+ avatar={patternflyAvatar}
82
+ content="Example with icons"
83
+ quickResponses={[
84
+ { id: '1', content: 'Update your settings', onClick: () => alert('Clicked yes'), icon: <WrenchIcon /> },
85
+ { id: '2', content: 'Copy', onClick: () => alert('Clicked no'), icon: <CopyIcon /> }
86
+ ]}
87
+ />
77
88
  </>
78
89
  );
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  # Sidenav top-level section
3
3
  # should be the same for all markdown files
4
- section: PatternFly-AI
4
+ section: extensions
5
5
  subsection: ChatBot
6
6
  # Sidenav secondary level section
7
7
  # should be the same for all markdown files
@@ -108,6 +108,20 @@ Once the component has rendered, user interactions will take precedence over the
108
108
 
109
109
  ```
110
110
 
111
+ ### Message actions persistent selections
112
+
113
+ By default, message actions will automatically deselect when you click outside the component or on a different action button. To persist the selection instead, set `persistActionSelection` to `true`.
114
+
115
+ When `persistActionSelection` is `true`:
116
+
117
+ - The selected action will remain selected even when you click outside the component.
118
+ - Clicking a different button will still switch the selection to that button.
119
+ - Clicking the same action button again will toggle the selection off, though you will have to move your focus elsewhere to see the visual state change.
120
+
121
+ ```js file="./MessageWithPersistedActions.tsx"
122
+
123
+ ```
124
+
111
125
  ### Custom message actions
112
126
 
113
127
  Beyond the standard message actions (good response, bad response, copy, share, or listen), you can add custom actions to a bot message by passing an `actions` object to the `<Message>` component. This object can contain the following customizations:
@@ -130,9 +144,9 @@ You can apply a `clickedAriaLabel` and `clickedTooltipContent` once a button is
130
144
 
131
145
  ### Message feedback
132
146
 
133
- When a user selects a positive or negative [message action](#message-actions), you can display a message feedback card that acknowledges their response and provides space for additional written feedback. These cards can be manually dismissed via the close button and the thank-you card can be [configured to time out automatically](/patternfly-ai/chatbot/messages#message-feedback-with-timeouts).
147
+ When a user selects a positive or negative [message action](#message-actions), you can display a message feedback card that acknowledges their response and provides space for additional written feedback. These cards can be manually dismissed via the close button and the thank-you card can be [configured to time out automatically](/extensions/chatbot/messages#message-feedback-with-timeouts).
134
148
 
135
- You can see the full feedback flow [in the message demos](/patternfly-ai/chatbot/messages/demo#message-feedback).
149
+ You can see the full feedback flow [in the message demos](/extensions/chatbot/messages/demo#message-feedback).
136
150
 
137
151
  The message feedback cards will immediately receive focus by default, but you can remove this behavior by passing `focusOnLoad: false` to the `<Message>` (as shown in the following examples). For better usability, you should generally keep the default focus behavior.
138
152
 
@@ -243,7 +257,7 @@ You can add custom content to specific parts of a `<Message>` via the `extraCont
243
257
 
244
258
  ### Messages with attachments
245
259
 
246
- When [attachments](/patternfly-ai/chatbot/messages#file-attachments) are shared and displayed in the ChatBot window, users will see a selectable and dismissible message that contains file details in a label. Selecting the file label can open a preview modal, which allows users to view or make edits to the file contents.
260
+ When [attachments](/extensions/chatbot/messages#file-attachments) are shared and displayed in the ChatBot window, users will see a selectable and dismissible message that contains file details in a label. Selecting the file label can open a preview modal, which allows users to view or make edits to the file contents.
247
261
 
248
262
  The `<PreviewAttachment>` component displays a modal with a read-only view of the attached file's contents. Selecting the "edit" button will open the `<AttachmentEdit>` component, which provides an interactive environment where users can make changes to the file.
249
263
 
@@ -333,6 +333,7 @@ _Italic text, formatted with single underscores_
333
333
  avatar={userAvatar}
334
334
  avatarProps={{ isBordered: true }}
335
335
  />
336
+ <Message name="User" role="user" content="This is a user message with no avatar" />
336
337
  <Message
337
338
  name="User"
338
339
  role="user"
@@ -366,7 +366,9 @@ Setting up cluster console...`;
366
366
  <FlexItem>{stage.name}</FlexItem>
367
367
  </Flex>
368
368
  </AccordionToggle>
369
- <AccordionContent id={stage.id.replace('-toggle', '')}>{renderCodeBlock(stage)}</AccordionContent>
369
+ <AccordionContent id={stage.id.replace('-toggle', '')} style={{ border: '0px' }}>
370
+ {renderCodeBlock(stage)}
371
+ </AccordionContent>
370
372
  </AccordionItem>
371
373
  ))}
372
374
  </Accordion>
@@ -0,0 +1,15 @@
1
+ import { FunctionComponent, useState } from 'react';
2
+ import { MessageBar } from '@patternfly/chatbot/dist/dynamic/MessageBar';
3
+
4
+ export const ChatbotMessageBarIndicatorThinking: FunctionComponent = () => {
5
+ const [isThinking, setIsThinking] = useState(false);
6
+ const handleSend = (_message: string | number) => {
7
+ setIsThinking(true);
8
+
9
+ setTimeout(() => {
10
+ setIsThinking(false);
11
+ }, 10000);
12
+ };
13
+
14
+ return <MessageBar onSendMessage={handleSend} hasAiIndicator isThinking={isThinking} />;
15
+ };
@@ -0,0 +1,141 @@
1
+ import {
2
+ useRef,
3
+ useState,
4
+ FunctionComponent,
5
+ MouseEvent,
6
+ CSSProperties,
7
+ Ref,
8
+ MouseEvent as ReactMouseEvent
9
+ } from 'react';
10
+ import {
11
+ Button,
12
+ SkipToContent,
13
+ MenuToggle,
14
+ MenuToggleElement,
15
+ Select,
16
+ SelectList,
17
+ SelectOption,
18
+ Stack
19
+ } from '@patternfly/react-core';
20
+ import Onboarding from '@patternfly/chatbot/dist/dynamic/Onboarding';
21
+ import Chatbot, { ChatbotDisplayMode } from '@patternfly/chatbot/dist/dynamic/Chatbot';
22
+
23
+ export const OnboardingExample: FunctionComponent = () => {
24
+ const [isModalOpen, setIsModalOpen] = useState(true);
25
+ const [displayMode, setDisplayMode] = useState(ChatbotDisplayMode.default);
26
+ const chatbotRef = useRef<HTMLDivElement>(null);
27
+ const termsRef = useRef<HTMLDivElement>(null);
28
+ const [isOpen, setIsOpen] = useState(false);
29
+ const [selected, setSelected] = useState<string>('Select display mode');
30
+
31
+ const handleSkipToContent = (e) => {
32
+ e.preventDefault();
33
+ if (!isModalOpen && chatbotRef.current) {
34
+ chatbotRef.current.focus();
35
+ }
36
+ if (isModalOpen && termsRef.current) {
37
+ termsRef.current.focus();
38
+ }
39
+ };
40
+
41
+ const handleModalToggle = (_event: MouseEvent | MouseEvent | KeyboardEvent) => {
42
+ setIsModalOpen(!isModalOpen);
43
+ };
44
+
45
+ const onPrimaryAction = () => {
46
+ // eslint-disable-next-line no-console
47
+ console.log('Clicked primary action');
48
+ };
49
+
50
+ const onSecondaryAction = () => {
51
+ // eslint-disable-next-line no-console
52
+ console.log('Clicked secondary action');
53
+ };
54
+ const onSelect = (_event: ReactMouseEvent<Element, MouseEvent> | undefined, value: string | number | undefined) => {
55
+ setSelected(value as string);
56
+ setIsOpen(false);
57
+ if (value === 'Default') {
58
+ setDisplayMode(ChatbotDisplayMode.default);
59
+ }
60
+ if (value === 'Docked') {
61
+ setDisplayMode(ChatbotDisplayMode.docked);
62
+ }
63
+ if (value === 'Fullscreen') {
64
+ setDisplayMode(ChatbotDisplayMode.fullscreen);
65
+ }
66
+ if (value === 'Embedded') {
67
+ setDisplayMode(ChatbotDisplayMode.embedded);
68
+ }
69
+ };
70
+
71
+ const onToggleClick = () => {
72
+ setIsOpen(!isOpen);
73
+ };
74
+
75
+ const toggle = (toggleRef: Ref<MenuToggleElement>) => (
76
+ <MenuToggle
77
+ ref={toggleRef}
78
+ onClick={onToggleClick}
79
+ isExpanded={isOpen}
80
+ style={
81
+ {
82
+ width: '200px'
83
+ } as CSSProperties
84
+ }
85
+ aria-label={selected === 'Select display mode' ? 'Select display mode' : `Display mode, ${selected}`}
86
+ >
87
+ {selected}
88
+ </MenuToggle>
89
+ );
90
+
91
+ const body = 'Simplify your Red Hat journey with personalized assistance and seamless problem-solving.';
92
+
93
+ return (
94
+ <>
95
+ <SkipToContent style={{ zIndex: '999' }} onClick={handleSkipToContent} href="#">
96
+ Skip to chatbot
97
+ </SkipToContent>
98
+ <div
99
+ style={{
100
+ position: 'fixed',
101
+ padding: 'var(--pf-t--global--spacer--lg)',
102
+ zIndex: '601',
103
+ boxShadow: 'var(--pf-t--global--box-shadow--lg)'
104
+ }}
105
+ >
106
+ <Stack hasGutter>
107
+ <Select
108
+ id="single-select"
109
+ isOpen={isOpen}
110
+ selected={selected}
111
+ onSelect={onSelect}
112
+ onOpenChange={(isOpen) => setIsOpen(isOpen)}
113
+ toggle={toggle}
114
+ shouldFocusToggleOnSelect
115
+ >
116
+ <SelectList>
117
+ <SelectOption value="Default">Default</SelectOption>
118
+ <SelectOption value="Docked">Docked</SelectOption>
119
+ <SelectOption value="Fullscreen">Fullscreen</SelectOption>
120
+ <SelectOption value="Embedded">Embedded</SelectOption>
121
+ </SelectList>
122
+ </Select>
123
+ <Button onClick={handleModalToggle}>Toggle modal</Button>
124
+ </Stack>
125
+ </div>
126
+ <Chatbot ref={chatbotRef} displayMode={displayMode} isVisible isCompact></Chatbot>
127
+ <Onboarding
128
+ ref={termsRef}
129
+ displayMode={displayMode}
130
+ isModalOpen={isModalOpen}
131
+ handleModalToggle={handleModalToggle}
132
+ onPrimaryAction={onPrimaryAction}
133
+ onSecondaryAction={onSecondaryAction}
134
+ title="Redefine work in the age of AI"
135
+ isCompact
136
+ >
137
+ {body}
138
+ </Onboarding>
139
+ </>
140
+ );
141
+ };