@patternfly/chatbot 6.5.0-prerelease.9 → 6.6.0-prerelease.1

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 (315) hide show
  1. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +9 -1
  2. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +9 -2
  3. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +38 -0
  4. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +29 -2
  5. package/dist/cjs/CodeModal/CodeModal.d.ts +2 -0
  6. package/dist/cjs/CodeModal/CodeModal.js +53 -12
  7. package/dist/cjs/DeepThinking/DeepThinking.d.ts +13 -0
  8. package/dist/cjs/DeepThinking/DeepThinking.js +31 -3
  9. package/dist/cjs/DeepThinking/DeepThinking.test.js +80 -0
  10. package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +44 -0
  11. package/dist/cjs/MarkdownContent/MarkdownContent.js +181 -0
  12. package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +1 -0
  13. package/dist/cjs/MarkdownContent/MarkdownContent.test.js +192 -0
  14. package/dist/cjs/MarkdownContent/index.d.ts +2 -0
  15. package/dist/cjs/MarkdownContent/index.js +23 -0
  16. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
  17. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +15 -4
  18. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +1 -0
  19. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +131 -0
  20. package/dist/cjs/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
  21. package/dist/cjs/Message/ErrorMessage/ErrorMessage.js +5 -3
  22. package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
  23. package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +30 -0
  24. package/dist/cjs/Message/LinkMessage/LinkMessage.d.ts +5 -1
  25. package/dist/cjs/Message/LinkMessage/LinkMessage.js +4 -3
  26. package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +9 -1
  27. package/dist/cjs/Message/ListMessage/OrderedListMessage.js +2 -1
  28. package/dist/cjs/Message/ListMessage/UnorderedListMessage.d.ts +7 -1
  29. package/dist/cjs/Message/ListMessage/UnorderedListMessage.js +2 -1
  30. package/dist/cjs/Message/Message.d.ts +20 -3
  31. package/dist/cjs/Message/Message.js +7 -160
  32. package/dist/cjs/Message/Message.test.js +129 -2
  33. package/dist/cjs/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
  34. package/dist/cjs/Message/MessageAndActions/MessageAndActions.js +22 -0
  35. package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
  36. package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +25 -0
  37. package/dist/cjs/Message/MessageAndActions/index.d.ts +1 -0
  38. package/dist/cjs/Message/MessageAndActions/index.js +17 -0
  39. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
  40. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.js +22 -0
  41. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
  42. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +25 -0
  43. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
  44. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.js +22 -0
  45. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
  46. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +25 -0
  47. package/dist/cjs/Message/MessageAttachments/index.d.ts +2 -0
  48. package/dist/cjs/Message/MessageAttachments/index.js +18 -0
  49. package/dist/cjs/Message/MessageInput.d.ts +1 -1
  50. package/dist/cjs/Message/MessageInput.js +3 -1
  51. package/dist/cjs/Message/MessageLoading.d.ts +13 -4
  52. package/dist/cjs/Message/MessageLoading.js +19 -5
  53. package/dist/cjs/Message/MessageLoading.test.d.ts +1 -0
  54. package/dist/cjs/Message/MessageLoading.test.js +25 -0
  55. package/dist/cjs/Message/QuickResponse/QuickResponse.js +3 -2
  56. package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
  57. package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +109 -0
  58. package/dist/cjs/Message/QuickResponse/index.d.ts +1 -0
  59. package/dist/cjs/Message/QuickResponse/index.js +17 -0
  60. package/dist/cjs/Message/QuickStarts/QuickStartTile.d.ts +1 -1
  61. package/dist/cjs/Message/QuickStarts/QuickStartTile.js +3 -2
  62. package/dist/cjs/Message/QuickStarts/index.d.ts +2 -0
  63. package/dist/cjs/Message/QuickStarts/index.js +18 -0
  64. package/dist/cjs/Message/TableMessage/TableMessage.d.ts +6 -1
  65. package/dist/cjs/Message/TableMessage/TableMessage.js +3 -2
  66. package/dist/cjs/Message/TextMessage/TextMessage.d.ts +8 -1
  67. package/dist/cjs/Message/TextMessage/TextMessage.js +3 -2
  68. package/dist/cjs/Message/UserFeedback/UserFeedback.d.ts +3 -1
  69. package/dist/cjs/Message/UserFeedback/UserFeedback.js +8 -6
  70. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
  71. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.js +3 -2
  72. package/dist/cjs/Message/UserFeedback/index.d.ts +2 -0
  73. package/dist/cjs/Message/UserFeedback/index.js +18 -0
  74. package/dist/cjs/Message/index.d.ts +8 -0
  75. package/dist/cjs/Message/index.js +8 -0
  76. package/dist/cjs/MessageBar/MessageBar.d.ts +10 -0
  77. package/dist/cjs/MessageBar/MessageBar.js +42 -10
  78. package/dist/cjs/MessageBar/MessageBar.test.js +20 -0
  79. package/dist/cjs/Onboarding/Onboarding.d.ts +36 -0
  80. package/dist/cjs/Onboarding/Onboarding.js +37 -0
  81. package/dist/cjs/Onboarding/Onboarding.test.d.ts +1 -0
  82. package/dist/cjs/Onboarding/Onboarding.test.js +80 -0
  83. package/dist/cjs/Onboarding/index.d.ts +2 -0
  84. package/dist/cjs/Onboarding/index.js +23 -0
  85. package/dist/cjs/ResponseActions/ResponseActions.d.ts +7 -0
  86. package/dist/cjs/ResponseActions/ResponseActions.js +28 -7
  87. package/dist/cjs/ResponseActions/ResponseActions.test.js +67 -12
  88. package/dist/cjs/ResponseActions/ResponseActionsGroups.d.ts +13 -0
  89. package/dist/cjs/ResponseActions/ResponseActionsGroups.js +22 -0
  90. package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
  91. package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +25 -0
  92. package/dist/cjs/ResponseActions/index.d.ts +1 -0
  93. package/dist/cjs/ResponseActions/index.js +1 -0
  94. package/dist/cjs/ToolCall/ToolCall.d.ts +11 -0
  95. package/dist/cjs/ToolCall/ToolCall.js +24 -3
  96. package/dist/cjs/ToolCall/ToolCall.test.js +57 -0
  97. package/dist/cjs/ToolResponse/ToolResponse.d.ts +17 -0
  98. package/dist/cjs/ToolResponse/ToolResponse.js +49 -3
  99. package/dist/cjs/ToolResponse/ToolResponse.test.js +100 -0
  100. package/dist/cjs/index.d.ts +4 -0
  101. package/dist/cjs/index.js +7 -1
  102. package/dist/css/main.css +276 -30
  103. package/dist/css/main.css.map +1 -1
  104. package/dist/dynamic/MarkdownContent/package.json +1 -0
  105. package/dist/dynamic/Onboarding/package.json +1 -0
  106. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +9 -1
  107. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +10 -3
  108. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +38 -0
  109. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +30 -3
  110. package/dist/esm/CodeModal/CodeModal.d.ts +2 -0
  111. package/dist/esm/CodeModal/CodeModal.js +54 -13
  112. package/dist/esm/DeepThinking/DeepThinking.d.ts +13 -0
  113. package/dist/esm/DeepThinking/DeepThinking.js +28 -3
  114. package/dist/esm/DeepThinking/DeepThinking.test.js +80 -0
  115. package/dist/esm/MarkdownContent/MarkdownContent.d.ts +44 -0
  116. package/dist/esm/MarkdownContent/MarkdownContent.js +174 -0
  117. package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +1 -0
  118. package/dist/esm/MarkdownContent/MarkdownContent.test.js +187 -0
  119. package/dist/esm/MarkdownContent/index.d.ts +2 -0
  120. package/dist/esm/MarkdownContent/index.js +2 -0
  121. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +3 -1
  122. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +15 -4
  123. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +1 -0
  124. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +126 -0
  125. package/dist/esm/Message/ErrorMessage/ErrorMessage.d.ts +15 -1
  126. package/dist/esm/Message/ErrorMessage/ErrorMessage.js +3 -3
  127. package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +1 -0
  128. package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +25 -0
  129. package/dist/esm/Message/LinkMessage/LinkMessage.d.ts +5 -1
  130. package/dist/esm/Message/LinkMessage/LinkMessage.js +4 -3
  131. package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +9 -1
  132. package/dist/esm/Message/ListMessage/OrderedListMessage.js +2 -1
  133. package/dist/esm/Message/ListMessage/UnorderedListMessage.d.ts +7 -1
  134. package/dist/esm/Message/ListMessage/UnorderedListMessage.js +2 -1
  135. package/dist/esm/Message/Message.d.ts +20 -3
  136. package/dist/esm/Message/Message.js +8 -161
  137. package/dist/esm/Message/Message.test.js +129 -2
  138. package/dist/esm/Message/MessageAndActions/MessageAndActions.d.ts +14 -0
  139. package/dist/esm/Message/MessageAndActions/MessageAndActions.js +18 -0
  140. package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +1 -0
  141. package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +20 -0
  142. package/dist/esm/Message/MessageAndActions/index.d.ts +1 -0
  143. package/dist/esm/Message/MessageAndActions/index.js +1 -0
  144. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.d.ts +13 -0
  145. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.js +18 -0
  146. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +1 -0
  147. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +20 -0
  148. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.d.ts +13 -0
  149. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.js +18 -0
  150. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +1 -0
  151. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +20 -0
  152. package/dist/esm/Message/MessageAttachments/index.d.ts +2 -0
  153. package/dist/esm/Message/MessageAttachments/index.js +2 -0
  154. package/dist/esm/Message/MessageInput.d.ts +1 -1
  155. package/dist/esm/Message/MessageInput.js +1 -1
  156. package/dist/esm/Message/MessageLoading.d.ts +13 -4
  157. package/dist/esm/Message/MessageLoading.js +16 -4
  158. package/dist/esm/Message/MessageLoading.test.d.ts +1 -0
  159. package/dist/esm/Message/MessageLoading.test.js +20 -0
  160. package/dist/esm/Message/QuickResponse/QuickResponse.js +3 -2
  161. package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +1 -0
  162. package/dist/esm/Message/QuickResponse/QuickResponse.test.js +104 -0
  163. package/dist/esm/Message/QuickResponse/index.d.ts +1 -0
  164. package/dist/esm/Message/QuickResponse/index.js +1 -0
  165. package/dist/esm/Message/QuickStarts/QuickStartTile.d.ts +1 -1
  166. package/dist/esm/Message/QuickStarts/QuickStartTile.js +1 -1
  167. package/dist/esm/Message/QuickStarts/index.d.ts +2 -0
  168. package/dist/esm/Message/QuickStarts/index.js +2 -0
  169. package/dist/esm/Message/TableMessage/TableMessage.d.ts +6 -1
  170. package/dist/esm/Message/TableMessage/TableMessage.js +3 -2
  171. package/dist/esm/Message/TextMessage/TextMessage.d.ts +8 -1
  172. package/dist/esm/Message/TextMessage/TextMessage.js +3 -2
  173. package/dist/esm/Message/UserFeedback/UserFeedback.d.ts +3 -1
  174. package/dist/esm/Message/UserFeedback/UserFeedback.js +7 -7
  175. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.d.ts +1 -1
  176. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.js +1 -2
  177. package/dist/esm/Message/UserFeedback/index.d.ts +2 -0
  178. package/dist/esm/Message/UserFeedback/index.js +2 -0
  179. package/dist/esm/Message/index.d.ts +8 -0
  180. package/dist/esm/Message/index.js +8 -0
  181. package/dist/esm/MessageBar/MessageBar.d.ts +10 -0
  182. package/dist/esm/MessageBar/MessageBar.js +42 -10
  183. package/dist/esm/MessageBar/MessageBar.test.js +20 -0
  184. package/dist/esm/Onboarding/Onboarding.d.ts +36 -0
  185. package/dist/esm/Onboarding/Onboarding.js +30 -0
  186. package/dist/esm/Onboarding/Onboarding.test.d.ts +1 -0
  187. package/dist/esm/Onboarding/Onboarding.test.js +75 -0
  188. package/dist/esm/Onboarding/index.d.ts +2 -0
  189. package/dist/esm/Onboarding/index.js +2 -0
  190. package/dist/esm/ResponseActions/ResponseActions.d.ts +7 -0
  191. package/dist/esm/ResponseActions/ResponseActions.js +28 -7
  192. package/dist/esm/ResponseActions/ResponseActions.test.js +67 -12
  193. package/dist/esm/ResponseActions/ResponseActionsGroups.d.ts +13 -0
  194. package/dist/esm/ResponseActions/ResponseActionsGroups.js +18 -0
  195. package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +1 -0
  196. package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +20 -0
  197. package/dist/esm/ResponseActions/index.d.ts +1 -0
  198. package/dist/esm/ResponseActions/index.js +1 -0
  199. package/dist/esm/ToolCall/ToolCall.d.ts +11 -0
  200. package/dist/esm/ToolCall/ToolCall.js +21 -3
  201. package/dist/esm/ToolCall/ToolCall.test.js +57 -0
  202. package/dist/esm/ToolResponse/ToolResponse.d.ts +17 -0
  203. package/dist/esm/ToolResponse/ToolResponse.js +46 -3
  204. package/dist/esm/ToolResponse/ToolResponse.test.js +100 -0
  205. package/dist/esm/index.d.ts +4 -0
  206. package/dist/esm/index.js +4 -0
  207. package/dist/tsconfig.tsbuildinfo +1 -1
  208. package/package.json +13 -3
  209. package/patternfly-docs/content/extensions/chatbot/chatbot.md +57 -0
  210. package/patternfly-docs/content/extensions/chatbot/design-guidelines.md +12 -12
  211. package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +1 -1
  212. package/patternfly-docs/content/extensions/chatbot/examples/Customizing Messages/Customizing Messages.md +1 -1
  213. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -0
  214. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomStructure.tsx +102 -0
  215. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithDeepThinking.tsx +25 -11
  216. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithFeedback.tsx +14 -1
  217. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownDeepThinking.tsx +26 -0
  218. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolCall.tsx +29 -0
  219. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMarkdownToolResponse.tsx +200 -0
  220. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithMultipleActionGroups.tsx +61 -0
  221. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithPersistedActions.tsx +22 -0
  222. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +11 -0
  223. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolCall.tsx +14 -1
  224. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithToolResponse.tsx +222 -105
  225. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +123 -14
  226. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -0
  227. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSearchActions.tsx +198 -0
  228. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarCustomActions.tsx +190 -0
  229. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarIndicatorThinking.tsx +15 -0
  230. package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactOnboarding.tsx +141 -0
  231. package/patternfly-docs/content/extensions/chatbot/examples/UI/Onboarding.tsx +151 -0
  232. package/patternfly-docs/content/extensions/chatbot/examples/UI/RH-Hat-Image.svg +9 -0
  233. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +81 -30
  234. package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +18 -18
  235. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +33 -19
  236. package/patternfly-docs/patternfly-docs.config.js +1 -1
  237. package/patternfly-docs/patternfly-docs.source.js +1 -1
  238. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +43 -0
  239. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +95 -0
  240. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +51 -15
  241. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +56 -14
  242. package/src/ChatbotModal/ChatbotModal.scss +3 -0
  243. package/src/CodeModal/CodeModal.tsx +71 -26
  244. package/src/DeepThinking/DeepThinking.scss +1 -1
  245. package/src/DeepThinking/DeepThinking.test.tsx +109 -0
  246. package/src/DeepThinking/DeepThinking.tsx +54 -5
  247. package/src/MarkdownContent/MarkdownContent.test.tsx +207 -0
  248. package/src/MarkdownContent/MarkdownContent.tsx +269 -0
  249. package/src/MarkdownContent/index.ts +2 -0
  250. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +13 -0
  251. package/src/Message/CodeBlockMessage/CodeBlockMessage.test.tsx +171 -0
  252. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +17 -4
  253. package/src/Message/ErrorMessage/ErrorMessage.test.tsx +38 -0
  254. package/src/Message/ErrorMessage/ErrorMessage.tsx +17 -2
  255. package/src/Message/LinkMessage/LinkMessage.scss +5 -0
  256. package/src/Message/LinkMessage/LinkMessage.tsx +24 -2
  257. package/src/Message/ListMessage/ListMessage.scss +8 -0
  258. package/src/Message/ListMessage/OrderedListMessage.tsx +16 -2
  259. package/src/Message/ListMessage/UnorderedListMessage.tsx +12 -2
  260. package/src/Message/Message.scss +11 -7
  261. package/src/Message/Message.test.tsx +202 -2
  262. package/src/Message/Message.tsx +129 -241
  263. package/src/Message/MessageAndActions/MessageAndActions.test.tsx +23 -0
  264. package/src/Message/MessageAndActions/MessageAndActions.tsx +22 -0
  265. package/src/Message/MessageAndActions/index.ts +1 -0
  266. package/src/Message/MessageAttachments/MessageAttachmentItem.test.tsx +23 -0
  267. package/src/Message/MessageAttachments/MessageAttachmentItem.tsx +25 -0
  268. package/src/Message/MessageAttachments/MessageAttachmentsContainer.test.tsx +23 -0
  269. package/src/Message/MessageAttachments/MessageAttachmentsContainer.tsx +25 -0
  270. package/src/Message/MessageAttachments/index.ts +2 -0
  271. package/src/Message/MessageInput.tsx +1 -1
  272. package/src/Message/MessageLoading.test.tsx +23 -0
  273. package/src/Message/MessageLoading.tsx +17 -2
  274. package/src/Message/QuickResponse/QuickResponse.scss +3 -1
  275. package/src/Message/QuickResponse/QuickResponse.test.tsx +131 -0
  276. package/src/Message/QuickResponse/QuickResponse.tsx +3 -2
  277. package/src/Message/QuickResponse/index.ts +1 -0
  278. package/src/Message/QuickStarts/QuickStartTile.tsx +1 -1
  279. package/src/Message/QuickStarts/index.ts +2 -0
  280. package/src/Message/TableMessage/TableMessage.scss +13 -1
  281. package/src/Message/TableMessage/TableMessage.tsx +18 -2
  282. package/src/Message/TextMessage/TextMessage.scss +12 -0
  283. package/src/Message/TextMessage/TextMessage.tsx +29 -2
  284. package/src/Message/UserFeedback/UserFeedback.scss +28 -1
  285. package/src/Message/UserFeedback/UserFeedback.tsx +23 -13
  286. package/src/Message/UserFeedback/UserFeedbackComplete.tsx +1 -4
  287. package/src/Message/UserFeedback/index.ts +2 -0
  288. package/src/Message/index.ts +8 -0
  289. package/src/MessageBar/AttachButton.scss +0 -1
  290. package/src/MessageBar/MessageBar.scss +63 -7
  291. package/src/MessageBar/MessageBar.test.tsx +39 -0
  292. package/src/MessageBar/MessageBar.tsx +124 -48
  293. package/src/MessageBar/MicrophoneButton.scss +0 -1
  294. package/src/MessageBar/SendButton.scss +0 -1
  295. package/src/MessageBar/StopButton.scss +0 -1
  296. package/src/Onboarding/Onboarding.scss +101 -0
  297. package/src/Onboarding/Onboarding.test.tsx +148 -0
  298. package/src/Onboarding/Onboarding.tsx +126 -0
  299. package/src/Onboarding/index.ts +3 -0
  300. package/src/ResponseActions/ResponseActions.scss +12 -1
  301. package/src/ResponseActions/ResponseActions.test.tsx +111 -12
  302. package/src/ResponseActions/ResponseActions.tsx +44 -10
  303. package/src/ResponseActions/ResponseActionsGroups.test.tsx +23 -0
  304. package/src/ResponseActions/ResponseActionsGroups.tsx +28 -0
  305. package/src/ResponseActions/index.ts +1 -0
  306. package/src/ToolCall/ToolCall.scss +1 -1
  307. package/src/ToolCall/ToolCall.test.tsx +91 -0
  308. package/src/ToolCall/ToolCall.tsx +49 -4
  309. package/src/ToolResponse/ToolResponse.scss +13 -3
  310. package/src/ToolResponse/ToolResponse.test.tsx +119 -0
  311. package/src/ToolResponse/ToolResponse.tsx +82 -7
  312. package/src/index.ts +6 -0
  313. package/src/main.scss +2 -0
  314. package/tsconfig.json +1 -1
  315. package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +0 -44
@@ -15,15 +15,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  // ============================================================================
16
16
  import { Button } from '@patternfly/react-core';
17
17
  import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons';
18
+ import { css } from '@patternfly/react-styles';
18
19
  const LinkMessage = (_a) => {
19
- var { children, target, href, id } = _a, props = __rest(_a, ["children", "target", "href", "id"]);
20
+ var { children, target, href, id, shouldRetainStyles } = _a, props = __rest(_a, ["children", "target", "href", "id", "shouldRetainStyles"]);
20
21
  if (target === '_blank') {
21
22
  return (_jsx(Button, Object.assign({ component: "a", variant: "link", href: href, icon: _jsx(ExternalLinkSquareAltIcon, {}), iconPosition: "end", isInline: true, target: target,
22
23
  // need to explicitly call this out or id doesn't seem to get passed - required for footnotes
23
- id: id }, props, { children: children })));
24
+ id: id }, props, { className: css(shouldRetainStyles && 'pf-m-markdown', props === null || props === void 0 ? void 0 : props.className), children: children })));
24
25
  }
25
26
  return (
26
27
  // need to explicitly call this out or id doesn't seem to get passed - required for footnotes
27
- _jsx(Button, Object.assign({ isInline: true, component: "a", href: href, variant: "link", id: id }, props, { children: children })));
28
+ _jsx(Button, Object.assign({ isInline: true, component: "a", href: href, variant: "link", id: id }, props, { className: css(shouldRetainStyles && 'pf-m-markdown', props === null || props === void 0 ? void 0 : props.className), children: children })));
28
29
  };
29
30
  export default LinkMessage;
@@ -1,3 +1,11 @@
1
1
  import { ExtraProps } from 'react-markdown';
2
- declare const OrderedListMessage: ({ children, start }: JSX.IntrinsicElements["ol"] & ExtraProps) => import("react/jsx-runtime").JSX.Element;
2
+ export interface OrderedListMessageProps {
3
+ /** The ordered list content */
4
+ children?: React.ReactNode;
5
+ /** The number to start the ordered list at. */
6
+ start?: number;
7
+ /** Flag indicating that the content should retain message styles when using Markdown. */
8
+ shouldRetainStyles?: boolean;
9
+ }
10
+ declare const OrderedListMessage: ({ children, start, shouldRetainStyles }: OrderedListMessageProps & JSX.IntrinsicElements["ol"] & ExtraProps) => import("react/jsx-runtime").JSX.Element;
3
11
  export default OrderedListMessage;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { List, ListComponent, OrderType } from '@patternfly/react-core';
3
- const OrderedListMessage = ({ children, start }) => (_jsx("div", { className: "pf-chatbot__message-ordered-list", children: _jsx(List, { component: ListComponent.ol, type: OrderType.number, start: start, children: children }) }));
3
+ import { css } from '@patternfly/react-styles';
4
+ const OrderedListMessage = ({ children, start, shouldRetainStyles }) => (_jsx("div", { className: css('pf-chatbot__message-ordered-list', shouldRetainStyles && 'pf-m-markdown'), children: _jsx(List, { component: ListComponent.ol, type: OrderType.number, start: start, children: children }) }));
4
5
  export default OrderedListMessage;
@@ -1,3 +1,9 @@
1
1
  import { ExtraProps } from 'react-markdown';
2
- declare const UnorderedListMessage: ({ children }: JSX.IntrinsicElements["ul"] & ExtraProps) => import("react/jsx-runtime").JSX.Element;
2
+ export interface UnrderedListMessageProps {
3
+ /** The ordered list content */
4
+ children?: React.ReactNode;
5
+ /** Flag indicating that the content should retain message styles when using Markdown. */
6
+ shouldRetainStyles?: boolean;
7
+ }
8
+ declare const UnorderedListMessage: ({ children, shouldRetainStyles }: UnrderedListMessageProps & JSX.IntrinsicElements["ul"] & ExtraProps) => import("react/jsx-runtime").JSX.Element;
3
9
  export default UnorderedListMessage;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { List } from '@patternfly/react-core';
3
- const UnorderedListMessage = ({ children }) => (_jsx("div", { className: "pf-chatbot__message-unordered-list", children: _jsx(List, { children: children }) }));
3
+ import { css } from '@patternfly/react-styles';
4
+ const UnorderedListMessage = ({ children, shouldRetainStyles }) => (_jsx("div", { className: css('pf-chatbot__message-unordered-list', shouldRetainStyles && 'pf-m-markdown'), children: _jsx(List, { children: children }) }));
4
5
  export default UnorderedListMessage;
@@ -42,6 +42,8 @@ export interface MessageExtraContent {
42
42
  endContent?: ReactNode;
43
43
  }
44
44
  export interface MessageProps extends Omit<HTMLProps<HTMLDivElement>, 'role'> {
45
+ /** Children to render instead of the default message structure, allowing more fine-tuned message control. When provided, this will override the default rendering of content, toolResponse, deepThinking, toolCall, sources, quickStarts, actions, etc. */
46
+ children?: ReactNode;
45
47
  /** Unique id for message */
46
48
  id?: string;
47
49
  /** Role of the user sending the message */
@@ -53,17 +55,32 @@ export interface MessageProps extends Omit<HTMLProps<HTMLDivElement>, 'role'> {
53
55
  /** Name of the user */
54
56
  name?: string;
55
57
  /** Avatar src for the user */
56
- avatar: string;
58
+ avatar?: string;
57
59
  /** Timestamp for the message */
58
60
  timestamp?: string;
59
61
  /** Set this to true if message is being loaded */
60
62
  isLoading?: boolean;
61
63
  /** Array of attachments attached to a message */
62
64
  attachments?: MessageAttachment[];
63
- /** Props for message actions, such as feedback (positive or negative), copy button, edit message, share, and listen */
65
+ /** Props for message actions, such as feedback (positive or negative), copy button, edit message, share, and listen.
66
+ * Can be a single actions object or an array of action group objects. When passing an array, you can pass an object of actions or
67
+ * an object that contains an actions property for finer control of selection persistence.
68
+ */
64
69
  actions?: {
65
70
  [key: string]: ActionProps;
66
- };
71
+ } | {
72
+ [key: string]: ActionProps;
73
+ }[] | {
74
+ actions: {
75
+ [key: string]: ActionProps;
76
+ };
77
+ persistActionSelection?: boolean;
78
+ }[];
79
+ /** When true, the selected action will persist even when clicking outside the component.
80
+ * When false (default), clicking outside or clicking another action will deselect the current selection.
81
+ * For finer control of multiple action groups, use persistActionSelection on each group.
82
+ */
83
+ persistActionSelection?: boolean;
67
84
  /** Sources for message */
68
85
  sources?: SourcesCardProps;
69
86
  /** Label for the English word "AI," used to tag messages with role "bot" */
@@ -14,57 +14,30 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
14
14
  // Chatbot Main - Message
15
15
  // ============================================================================
16
16
  import { forwardRef, useEffect, useState } from 'react';
17
- import Markdown from 'react-markdown';
18
- import remarkGfm from 'remark-gfm';
19
- import { Avatar, ContentVariants, Label, Timestamp, Truncate } from '@patternfly/react-core';
17
+ import { Avatar, Label, Timestamp, Truncate } from '@patternfly/react-core';
20
18
  import MessageLoading from './MessageLoading';
21
- import CodeBlockMessage from './CodeBlockMessage/CodeBlockMessage';
22
- import TextMessage from './TextMessage/TextMessage';
23
19
  import FileDetailsLabel from '../FileDetailsLabel/FileDetailsLabel';
24
20
  import ResponseActions from '../ResponseActions/ResponseActions';
25
21
  import SourcesCard from '../SourcesCard';
26
- import ListItemMessage from './ListMessage/ListItemMessage';
27
- import UnorderedListMessage from './ListMessage/UnorderedListMessage';
28
- import OrderedListMessage from './ListMessage/OrderedListMessage';
29
22
  import QuickStartTile from './QuickStarts/QuickStartTile';
30
23
  import QuickResponse from './QuickResponse/QuickResponse';
31
24
  import UserFeedback from './UserFeedback/UserFeedback';
32
25
  import UserFeedbackComplete from './UserFeedback/UserFeedbackComplete';
33
- import TableMessage from './TableMessage/TableMessage';
34
- import TrMessage from './TableMessage/TrMessage';
35
- import TdMessage from './TableMessage/TdMessage';
36
- import TbodyMessage from './TableMessage/TbodyMessage';
37
- import TheadMessage from './TableMessage/TheadMessage';
38
- import ThMessage from './TableMessage/ThMessage';
39
- import ImageMessage from './ImageMessage/ImageMessage';
40
- import rehypeUnwrapImages from 'rehype-unwrap-images';
41
- import rehypeExternalLinks from 'rehype-external-links';
42
- import rehypeSanitize from 'rehype-sanitize';
43
- import rehypeHighlight from 'rehype-highlight';
44
26
  // see the full list of styles here: https://highlightjs.org/examples
45
27
  import 'highlight.js/styles/vs2015.css';
46
- import LinkMessage from './LinkMessage/LinkMessage';
47
28
  import ErrorMessage from './ErrorMessage/ErrorMessage';
48
29
  import MessageInput from './MessageInput';
49
- import { rehypeMoveImagesOutOfParagraphs } from './Plugins/rehypeMoveImagesOutOfParagraphs';
50
30
  import ToolResponse from '../ToolResponse';
51
31
  import DeepThinking from '../DeepThinking';
52
- import SuperscriptMessage from './SuperscriptMessage/SuperscriptMessage';
53
32
  import ToolCall from '../ToolCall';
33
+ import MarkdownContent from '../MarkdownContent';
54
34
  export const MessageBase = (_a) => {
55
- var { role, content, extraContent, name, avatar, timestamp, isLoading, actions, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [], additionalRemarkPlugins = [], linkProps, error, isEditable, editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, inputRef, editFormProps, isCompact, isMarkdownDisabled, reactMarkdownProps, toolResponse, deepThinking, remarkGfmProps, toolCall, hasNoImagesInUserMessages = true, isPrimary } = _a, props = __rest(_a, ["role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins", "additionalRemarkPlugins", "linkProps", "error", "isEditable", "editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "inputRef", "editFormProps", "isCompact", "isMarkdownDisabled", "reactMarkdownProps", "toolResponse", "deepThinking", "remarkGfmProps", "toolCall", "hasNoImagesInUserMessages", "isPrimary"]);
35
+ var { children, role, content, extraContent, name, avatar, timestamp, isLoading, actions, persistActionSelection, sources, botWord = 'AI', loadingWord = 'Loading message', codeBlockProps, quickResponses, quickResponseContainerProps = { numLabels: 5 }, attachments, hasRoundAvatar = true, avatarProps, quickStarts, userFeedbackForm, userFeedbackComplete, isLiveRegion = true, innerRef, tableProps, openLinkInNewTab = true, additionalRehypePlugins = [], additionalRemarkPlugins = [], linkProps, error, isEditable, editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, inputRef, editFormProps, isCompact, isMarkdownDisabled, reactMarkdownProps, toolResponse, deepThinking, remarkGfmProps, toolCall, hasNoImagesInUserMessages = true, isPrimary } = _a, props = __rest(_a, ["children", "role", "content", "extraContent", "name", "avatar", "timestamp", "isLoading", "actions", "persistActionSelection", "sources", "botWord", "loadingWord", "codeBlockProps", "quickResponses", "quickResponseContainerProps", "attachments", "hasRoundAvatar", "avatarProps", "quickStarts", "userFeedbackForm", "userFeedbackComplete", "isLiveRegion", "innerRef", "tableProps", "openLinkInNewTab", "additionalRehypePlugins", "additionalRemarkPlugins", "linkProps", "error", "isEditable", "editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "inputRef", "editFormProps", "isCompact", "isMarkdownDisabled", "reactMarkdownProps", "toolResponse", "deepThinking", "remarkGfmProps", "toolCall", "hasNoImagesInUserMessages", "isPrimary"]);
56
36
  const [messageText, setMessageText] = useState(content);
57
37
  useEffect(() => {
58
38
  setMessageText(content);
59
39
  }, [content]);
60
40
  const { beforeMainContent, afterMainContent, endContent } = extraContent || {};
61
- let rehypePlugins = [rehypeUnwrapImages, rehypeMoveImagesOutOfParagraphs, rehypeHighlight];
62
- if (openLinkInNewTab) {
63
- rehypePlugins = rehypePlugins.concat([[rehypeExternalLinks, { target: '_blank' }, rehypeSanitize]]);
64
- }
65
- if (additionalRehypePlugins) {
66
- rehypePlugins.push(...additionalRehypePlugins);
67
- }
68
41
  let avatarClassName;
69
42
  if (avatarProps && 'className' in avatarProps) {
70
43
  const { className } = avatarProps, rest = __rest(avatarProps, ["className"]);
@@ -74,133 +47,7 @@ export const MessageBase = (_a) => {
74
47
  // Keep timestamps consistent between Timestamp component and aria-label
75
48
  const date = new Date();
76
49
  const dateString = timestamp !== null && timestamp !== void 0 ? timestamp : `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
77
- const disallowedElements = role === 'user' && hasNoImagesInUserMessages ? ['img'] : [];
78
- if (reactMarkdownProps && reactMarkdownProps.disallowedElements) {
79
- disallowedElements.push(...reactMarkdownProps.disallowedElements);
80
- }
81
- const handleMarkdown = () => {
82
- if (isMarkdownDisabled) {
83
- return (_jsx(TextMessage, Object.assign({ component: ContentVariants.p }, props, { children: messageText })));
84
- }
85
- return (_jsx(Markdown, Object.assign({ components: {
86
- section: (props) => {
87
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
88
- const { node } = props, rest = __rest(props, ["node"]);
89
- return _jsx("section", Object.assign({}, rest, { className: `pf-chatbot__message-text ${rest === null || rest === void 0 ? void 0 : rest.className}` }));
90
- },
91
- p: (props) => {
92
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
- const { node } = props, rest = __rest(props, ["node"]);
94
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.p }, rest, { isPrimary: isPrimary }));
95
- },
96
- code: (_a) => {
97
- var { children } = _a, props = __rest(_a, ["children"]);
98
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
99
- const { node } = props, codeProps = __rest(props, ["node"]);
100
- return (_jsx(CodeBlockMessage, Object.assign({}, codeProps, codeBlockProps, { isPrimary: isPrimary, children: children })));
101
- },
102
- h1: (props) => {
103
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
104
- const { node } = props, rest = __rest(props, ["node"]);
105
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.h1 }, rest));
106
- },
107
- h2: (props) => {
108
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
109
- const { node } = props, rest = __rest(props, ["node"]);
110
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.h2 }, rest));
111
- },
112
- h3: (props) => {
113
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
114
- const { node } = props, rest = __rest(props, ["node"]);
115
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.h3 }, rest));
116
- },
117
- h4: (props) => {
118
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
119
- const { node } = props, rest = __rest(props, ["node"]);
120
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.h4 }, rest));
121
- },
122
- h5: (props) => {
123
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
124
- const { node } = props, rest = __rest(props, ["node"]);
125
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.h5 }, rest));
126
- },
127
- h6: (props) => {
128
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
129
- const { node } = props, rest = __rest(props, ["node"]);
130
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.h6 }, rest));
131
- },
132
- blockquote: (props) => {
133
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
134
- const { node } = props, rest = __rest(props, ["node"]);
135
- return _jsx(TextMessage, Object.assign({ component: ContentVariants.blockquote }, rest));
136
- },
137
- ul: (props) => {
138
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
139
- const { node } = props, rest = __rest(props, ["node"]);
140
- return _jsx(UnorderedListMessage, Object.assign({}, rest));
141
- },
142
- ol: (props) => {
143
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
144
- const { node } = props, rest = __rest(props, ["node"]);
145
- return _jsx(OrderedListMessage, Object.assign({}, rest));
146
- },
147
- li: (props) => {
148
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
149
- const { node } = props, rest = __rest(props, ["node"]);
150
- return _jsx(ListItemMessage, Object.assign({}, rest));
151
- },
152
- // table requires node attribute for calculating headers for mobile breakpoint
153
- table: (props) => _jsx(TableMessage, Object.assign({}, props, tableProps, { isPrimary: isPrimary })),
154
- tbody: (props) => {
155
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
156
- const { node } = props, rest = __rest(props, ["node"]);
157
- return _jsx(TbodyMessage, Object.assign({}, rest));
158
- },
159
- thead: (props) => {
160
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
161
- const { node } = props, rest = __rest(props, ["node"]);
162
- return _jsx(TheadMessage, Object.assign({}, rest));
163
- },
164
- tr: (props) => {
165
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
166
- const { node } = props, rest = __rest(props, ["node"]);
167
- return _jsx(TrMessage, Object.assign({}, rest));
168
- },
169
- td: (props) => {
170
- // Conflicts with Td type
171
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
172
- const { node, width } = props, rest = __rest(props, ["node", "width"]);
173
- return _jsx(TdMessage, Object.assign({}, rest));
174
- },
175
- th: (props) => {
176
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
177
- const { node } = props, rest = __rest(props, ["node"]);
178
- return _jsx(ThMessage, Object.assign({}, rest));
179
- },
180
- img: (props) => {
181
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
182
- const { node } = props, rest = __rest(props, ["node"]);
183
- return _jsx(ImageMessage, Object.assign({}, rest));
184
- },
185
- a: (props) => {
186
- // node is just the details of the document structure - not needed
187
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
188
- const { node } = props, rest = __rest(props, ["node"]);
189
- return (
190
- // some a types conflict with ButtonProps, but it's ok because we are using an a tag
191
- // there are too many to handle manually
192
- _jsx(LinkMessage, Object.assign({}, rest, linkProps, { children: props.children })));
193
- },
194
- // used for footnotes
195
- sup: (props) => {
196
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
197
- const { node } = props, rest = __rest(props, ["node"]);
198
- return _jsx(SuperscriptMessage, Object.assign({}, rest));
199
- }
200
- }, remarkPlugins: [[remarkGfm, Object.assign({}, remarkGfmProps)], ...additionalRemarkPlugins], rehypePlugins: rehypePlugins }, reactMarkdownProps, { remarkRehypeOptions: Object.assign({
201
- // removes sr-only class from footnote labels applied by default
202
- footnoteLabelProperties: { className: [''] } }, reactMarkdownProps === null || reactMarkdownProps === void 0 ? void 0 : reactMarkdownProps.remarkRehypeOptions), disallowedElements: disallowedElements, children: messageText })));
203
- };
50
+ const handleMarkdown = () => (_jsx(MarkdownContent, { content: messageText, isMarkdownDisabled: isMarkdownDisabled, codeBlockProps: codeBlockProps, tableProps: tableProps, openLinkInNewTab: openLinkInNewTab, additionalRehypePlugins: additionalRehypePlugins, additionalRemarkPlugins: additionalRemarkPlugins, linkProps: linkProps, reactMarkdownProps: reactMarkdownProps, remarkGfmProps: remarkGfmProps, hasNoImages: role === 'user' && hasNoImagesInUserMessages, isPrimary: isPrimary }));
204
51
  const renderMessage = () => {
205
52
  if (isLoading) {
206
53
  return _jsx(MessageLoading, { loadingWord: loadingWord, isPrimary: isPrimary });
@@ -213,10 +60,10 @@ export const MessageBase = (_a) => {
213
60
  }
214
61
  return (_jsxs(_Fragment, { children: [beforeMainContent && _jsx(_Fragment, { children: beforeMainContent }), error ? _jsx(ErrorMessage, Object.assign({}, error)) : handleMarkdown()] }));
215
62
  };
216
- return (_jsxs("section", Object.assign({ "aria-label": `Message from ${role} - ${dateString}`, className: `pf-chatbot__message pf-chatbot__message--${role}`, "aria-live": isLiveRegion ? 'polite' : undefined, "aria-atomic": isLiveRegion ? false : undefined, ref: innerRef }, props, { children: [_jsx(Avatar, Object.assign({ className: `pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`, src: avatar, alt: "" }, avatarProps)), _jsxs("div", { className: "pf-chatbot__message-contents", children: [_jsxs("div", { className: "pf-chatbot__message-meta", children: [name && (_jsx("span", { className: "pf-chatbot__message-name", children: _jsx(Truncate, { content: name }) })), role === 'bot' && (_jsx(Label, { variant: "outline", isCompact: true, children: botWord })), _jsx(Timestamp, { date: date, children: timestamp })] }), _jsxs("div", { className: "pf-chatbot__message-response", children: [_jsxs("div", { className: "pf-chatbot__message-and-actions", children: [renderMessage(), afterMainContent && _jsx(_Fragment, { children: afterMainContent }), toolResponse && _jsx(ToolResponse, Object.assign({}, toolResponse)), deepThinking && _jsx(DeepThinking, Object.assign({}, deepThinking)), toolCall && _jsx(ToolCall, Object.assign({}, toolCall)), !isLoading && sources && _jsx(SourcesCard, Object.assign({}, sources, { isCompact: isCompact })), quickStarts && quickStarts.quickStart && (_jsx(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel, isCompact: isCompact })), !isLoading && !isEditable && actions && _jsx(ResponseActions, { actions: actions }), userFeedbackForm && _jsx(UserFeedback, Object.assign({}, userFeedbackForm, { timestamp: dateString, isCompact: isCompact })), userFeedbackComplete && (_jsx(UserFeedbackComplete, Object.assign({}, userFeedbackComplete, { timestamp: dateString, isCompact: isCompact }))), !isLoading && quickResponses && (_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, isCompact: isCompact }))] }), attachments && (_jsx("div", { className: "pf-chatbot__message-attachments-container", children: attachments.map((attachment) => {
217
- var _a;
218
- return (_jsx("div", { className: "pf-chatbot__message-attachment", children: _jsx(FileDetailsLabel, { fileName: attachment.name, fileId: attachment.id, onClose: attachment.onClose, onClick: attachment.onClick, isLoading: attachment.isLoading, closeButtonAriaLabel: attachment.closeButtonAriaLabel, languageTestId: attachment.languageTestId, spinnerTestId: attachment.spinnerTestId, variant: isPrimary ? 'outline' : undefined }) }, (_a = attachment.id) !== null && _a !== void 0 ? _a : attachment.name));
219
- }) })), !isLoading && endContent && _jsx(_Fragment, { children: endContent })] })] })] })));
63
+ return (_jsxs("section", Object.assign({ "aria-label": `Message from ${role} - ${dateString}`, className: `pf-chatbot__message pf-chatbot__message--${role}`, "aria-live": isLiveRegion ? 'polite' : undefined, "aria-atomic": isLiveRegion ? false : undefined, ref: innerRef }, props, { children: [avatar && (_jsx(Avatar, Object.assign({ className: `pf-chatbot__message-avatar ${hasRoundAvatar ? 'pf-chatbot__message-avatar--round' : ''} ${avatarClassName ? avatarClassName : ''}`, src: avatar, alt: "" }, avatarProps))), _jsxs("div", { className: "pf-chatbot__message-contents", children: [_jsxs("div", { className: "pf-chatbot__message-meta", children: [name && (_jsx("span", { className: "pf-chatbot__message-name", children: _jsx(Truncate, { content: name }) })), role === 'bot' && (_jsx(Label, { variant: "outline", isCompact: true, children: botWord })), _jsx(Timestamp, { date: date, children: timestamp })] }), _jsx("div", { className: "pf-chatbot__message-response", children: children ? (_jsx(_Fragment, { children: children })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "pf-chatbot__message-and-actions", children: [renderMessage(), afterMainContent && _jsx(_Fragment, { children: afterMainContent }), toolResponse && _jsx(ToolResponse, Object.assign({}, toolResponse)), deepThinking && _jsx(DeepThinking, Object.assign({}, deepThinking)), toolCall && _jsx(ToolCall, Object.assign({}, toolCall)), !isLoading && sources && _jsx(SourcesCard, Object.assign({}, sources, { isCompact: isCompact })), quickStarts && quickStarts.quickStart && (_jsx(QuickStartTile, { quickStart: quickStarts.quickStart, onSelectQuickStart: quickStarts.onSelectQuickStart, minuteWord: quickStarts.minuteWord, minuteWordPlural: quickStarts.minuteWordPlural, prerequisiteWord: quickStarts.prerequisiteWord, prerequisiteWordPlural: quickStarts.prerequisiteWordPlural, quickStartButtonAriaLabel: quickStarts.quickStartButtonAriaLabel, isCompact: isCompact })), !isLoading && !isEditable && actions && (_jsx(_Fragment, { children: Array.isArray(actions) ? (_jsx("div", { className: "pf-chatbot__response-actions-groups", children: actions.map((actionGroup, index) => (_jsx(ResponseActions, { actions: actionGroup.actions || actionGroup, persistActionSelection: persistActionSelection || actionGroup.persistActionSelection }, index))) })) : (_jsx(ResponseActions, { actions: actions, persistActionSelection: persistActionSelection })) })), userFeedbackForm && (_jsx(UserFeedback, Object.assign({}, userFeedbackForm, { timestamp: dateString, isCompact: isCompact }))), userFeedbackComplete && (_jsx(UserFeedbackComplete, Object.assign({}, userFeedbackComplete, { timestamp: dateString, isCompact: isCompact }))), !isLoading && quickResponses && (_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, isCompact: isCompact }))] }), attachments && (_jsx("div", { className: "pf-chatbot__message-attachments-container", children: attachments.map((attachment) => {
64
+ var _a;
65
+ return (_jsx("div", { className: "pf-chatbot__message-attachment", children: _jsx(FileDetailsLabel, { fileName: attachment.name, fileId: attachment.id, onClose: attachment.onClose, onClick: attachment.onClick, isLoading: attachment.isLoading, closeButtonAriaLabel: attachment.closeButtonAriaLabel, languageTestId: attachment.languageTestId, spinnerTestId: attachment.spinnerTestId, variant: isPrimary ? 'outline' : undefined }) }, (_a = attachment.id) !== null && _a !== void 0 ? _a : attachment.name));
66
+ }) })), !isLoading && endContent && _jsx(_Fragment, { children: endContent })] })) })] })] })));
220
67
  };
221
68
  const Message = forwardRef((props, ref) => (_jsx(MessageBase, Object.assign({ innerRef: ref }, props))));
222
69
  export default Message;
@@ -204,6 +204,10 @@ describe('Message', () => {
204
204
  render(_jsx(Message, { avatar: "./testImg", role: "bot", name: "Bot", content: "Hi" }));
205
205
  expect(screen.getByRole('img')).toHaveAttribute('src', './testImg');
206
206
  });
207
+ it('should not render avatar if no avatar prop is passed', () => {
208
+ render(_jsx(Message, { role: "bot", name: "Bot", content: "Hi" }));
209
+ expect(screen.queryByRole('img')).not.toBeInTheDocument();
210
+ });
207
211
  it('should render botWord correctly', () => {
208
212
  render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", botWord: "\u4EBA\u5DE5\u77E5\u80FD" }));
209
213
  expect(screen.getByText('Bot')).toBeTruthy();
@@ -351,7 +355,7 @@ describe('Message', () => {
351
355
  expect(screen.queryByRole('button', { name: /No/i })).toBeFalsy();
352
356
  expect(screen.getByRole('button', { name: /1 more/i }));
353
357
  }));
354
- it('should be able to show actions', () => __awaiter(void 0, void 0, void 0, function* () {
358
+ it('Renders response actions when a single actions object is passed', () => __awaiter(void 0, void 0, void 0, function* () {
355
359
  render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", actions: {
356
360
  // eslint-disable-next-line no-console
357
361
  positive: { onClick: () => console.log('Good response') },
@@ -369,9 +373,132 @@ describe('Message', () => {
369
373
  listen: { onClick: () => console.log('Listen') }
370
374
  } }));
371
375
  ALL_ACTIONS.forEach(({ label }) => {
372
- expect(screen.getByRole('button', { name: label })).toBeTruthy();
376
+ expect(screen.getByRole('button', { name: label })).toBeVisible();
377
+ });
378
+ }));
379
+ it('Renders response actions when an array of actions objects is passed', () => __awaiter(void 0, void 0, void 0, function* () {
380
+ render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", actions: [
381
+ {
382
+ // eslint-disable-next-line no-console
383
+ positive: { onClick: () => console.log('Good response') },
384
+ // eslint-disable-next-line no-console
385
+ negative: { onClick: () => console.log('Bad response') }
386
+ },
387
+ {
388
+ // eslint-disable-next-line no-console
389
+ copy: { onClick: () => console.log('Copy') },
390
+ // eslint-disable-next-line no-console
391
+ edit: { onClick: () => console.log('Edit') },
392
+ // eslint-disable-next-line no-console
393
+ share: { onClick: () => console.log('Share') },
394
+ // eslint-disable-next-line no-console
395
+ download: { onClick: () => console.log('Download') }
396
+ },
397
+ {
398
+ // eslint-disable-next-line no-console
399
+ listen: { onClick: () => console.log('Listen') }
400
+ }
401
+ ] }));
402
+ ALL_ACTIONS.forEach(({ label }) => {
403
+ expect(screen.getByRole('button', { name: label })).toBeVisible();
404
+ });
405
+ }));
406
+ it('Renders response actions when an array of objects containing actions objects is passed', () => __awaiter(void 0, void 0, void 0, function* () {
407
+ render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", actions: [
408
+ {
409
+ actions: {
410
+ // eslint-disable-next-line no-console
411
+ positive: { onClick: () => console.log('Good response') },
412
+ // eslint-disable-next-line no-console
413
+ negative: { onClick: () => console.log('Bad response') }
414
+ }
415
+ },
416
+ {
417
+ actions: {
418
+ // eslint-disable-next-line no-console
419
+ copy: { onClick: () => console.log('Copy') },
420
+ // eslint-disable-next-line no-console
421
+ edit: { onClick: () => console.log('Edit') },
422
+ // eslint-disable-next-line no-console
423
+ share: { onClick: () => console.log('Share') },
424
+ // eslint-disable-next-line no-console
425
+ download: { onClick: () => console.log('Download') }
426
+ }
427
+ },
428
+ {
429
+ actions: {
430
+ // eslint-disable-next-line no-console
431
+ listen: { onClick: () => console.log('Listen') }
432
+ }
433
+ }
434
+ ] }));
435
+ ALL_ACTIONS.forEach(({ label }) => {
436
+ expect(screen.getByRole('button', { name: label })).toBeVisible();
373
437
  });
374
438
  }));
439
+ it('should handle persistActionSelection correctly when a single actions object is passed', () => __awaiter(void 0, void 0, void 0, function* () {
440
+ render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Test message", persistActionSelection: true, actions: {
441
+ positive: { onClick: jest.fn() },
442
+ negative: { onClick: jest.fn() }
443
+ } }));
444
+ const goodBtn = screen.getByRole('button', { name: /Good response/i });
445
+ const badBtn = screen.getByRole('button', { name: /Bad response/i });
446
+ yield userEvent.click(goodBtn);
447
+ expect(screen.getByRole('button', { name: /Good response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
448
+ yield userEvent.click(screen.getByText('Test message'));
449
+ expect(screen.getByRole('button', { name: /Good response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
450
+ yield userEvent.click(badBtn);
451
+ expect(screen.getByRole('button', { name: /Bad response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
452
+ expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
453
+ }));
454
+ it('should handle persistActionSelection correctly when an array of actions objects is passed', () => __awaiter(void 0, void 0, void 0, function* () {
455
+ render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Test message", persistActionSelection: true, actions: [
456
+ {
457
+ positive: { onClick: jest.fn() },
458
+ negative: { onClick: jest.fn() }
459
+ },
460
+ {
461
+ copy: { onClick: jest.fn() }
462
+ }
463
+ ] }));
464
+ const goodBtn = screen.getByRole('button', { name: /Good response/i });
465
+ const copyBtn = screen.getByRole('button', { name: /Copy/i });
466
+ yield userEvent.click(goodBtn);
467
+ expect(screen.getByRole('button', { name: /Good response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
468
+ yield userEvent.click(screen.getByText('Test message'));
469
+ expect(screen.getByRole('button', { name: /Good response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
470
+ yield userEvent.click(copyBtn);
471
+ expect(screen.getByRole('button', { name: /Copied/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
472
+ yield userEvent.click(screen.getByText('Test message'));
473
+ expect(screen.getByRole('button', { name: /Good response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
474
+ expect(screen.getByRole('button', { name: /Copied/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
475
+ }));
476
+ it('should handle persistActionSelection correctly when an array of objects containing actions objects is passed', () => __awaiter(void 0, void 0, void 0, function* () {
477
+ render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Test message", actions: [
478
+ {
479
+ actions: {
480
+ positive: { onClick: jest.fn() },
481
+ negative: { onClick: jest.fn() }
482
+ },
483
+ persistActionSelection: true
484
+ },
485
+ {
486
+ actions: {
487
+ copy: { onClick: jest.fn() }
488
+ },
489
+ persistActionSelection: false
490
+ }
491
+ ] }));
492
+ const goodBtn = screen.getByRole('button', { name: /Good response/i });
493
+ const copyBtn = screen.getByRole('button', { name: /Copy/i });
494
+ yield userEvent.click(goodBtn);
495
+ expect(screen.getByRole('button', { name: /Good response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
496
+ yield userEvent.click(copyBtn);
497
+ expect(screen.getByRole('button', { name: /Copied/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
498
+ yield userEvent.click(screen.getByText('Test message'));
499
+ expect(screen.getByRole('button', { name: /Good response recorded/i })).toHaveClass('pf-chatbot__button--response-action-clicked');
500
+ expect(copyBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
501
+ }));
375
502
  it('should not show actions if loading', () => __awaiter(void 0, void 0, void 0, function* () {
376
503
  render(_jsx(Message, { avatar: "./img", role: "bot", name: "Bot", content: "Hi", isLoading: true, actions: {
377
504
  // eslint-disable-next-line no-console
@@ -0,0 +1,14 @@
1
+ import { FunctionComponent, HTMLProps, ReactNode } from 'react';
2
+ /**
3
+ * The container that wraps the primary message content and inline actions, such as ToolCall, ToolResponse, DeepThinking, ResponseActions, etc.
4
+ * Attachments should not be rendered inside this container.
5
+ * Use this component when passing children to Message to customize its structure.
6
+ */
7
+ export interface MessageAndActionsProps extends HTMLProps<HTMLDivElement> {
8
+ /** Content to render inside the message and actions container. */
9
+ children: ReactNode;
10
+ /** Additional classes applied to the message and actions container. */
11
+ className?: string;
12
+ }
13
+ export declare const MessageAndActions: FunctionComponent<MessageAndActionsProps>;
14
+ export default MessageAndActions;
@@ -0,0 +1,18 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { css } from '@patternfly/react-styles';
14
+ export const MessageAndActions = (_a) => {
15
+ var { children, className } = _a, props = __rest(_a, ["children", "className"]);
16
+ return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-and-actions', className) }, props, { children: children })));
17
+ };
18
+ export default MessageAndActions;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen } from '@testing-library/react';
4
+ import MessageAndActions from './MessageAndActions';
5
+ test('Renders with children', () => {
6
+ render(_jsx(MessageAndActions, { children: "Test content" }));
7
+ expect(screen.getByText('Test content')).toBeInTheDocument();
8
+ });
9
+ test('Renders with pf-chatbot__message-and-actions class by default', () => {
10
+ render(_jsx(MessageAndActions, { children: "Test content" }));
11
+ expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__message-and-actions', { exact: true });
12
+ });
13
+ test('Renders with custom className', () => {
14
+ render(_jsx(MessageAndActions, { className: "custom-class", children: "Test content" }));
15
+ expect(screen.getByText('Test content')).toHaveClass('custom-class');
16
+ });
17
+ test('Spreads additional props', () => {
18
+ render(_jsx(MessageAndActions, { id: "test-id", children: "Test content" }));
19
+ expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
20
+ });
@@ -0,0 +1 @@
1
+ export * from './MessageAndActions';
@@ -0,0 +1 @@
1
+ export * from './MessageAndActions';
@@ -0,0 +1,13 @@
1
+ import { FunctionComponent, HTMLProps, ReactNode } from 'react';
2
+ /**
3
+ * The container for a single message attachment item, typically the FileDetailsLabel component. You must wrap any attachment components in this container.
4
+ * Use this component within MessageAttachmentsContainer when passing children to Message to customize its structure.
5
+ */
6
+ export interface MessageAttachmentItemProps extends HTMLProps<HTMLDivElement> {
7
+ /** Content to render inside a single attachment container */
8
+ children: ReactNode;
9
+ /** Additional classes applied to the attachment container. */
10
+ className?: string;
11
+ }
12
+ export declare const MessageAttachmentItem: FunctionComponent<MessageAttachmentItemProps>;
13
+ export default MessageAttachmentItem;
@@ -0,0 +1,18 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { css } from '@patternfly/react-styles';
14
+ export const MessageAttachmentItem = (_a) => {
15
+ var { children, className } = _a, props = __rest(_a, ["children", "className"]);
16
+ return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-attachment', className) }, props, { children: children })));
17
+ };
18
+ export default MessageAttachmentItem;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import '@testing-library/jest-dom';
3
+ import { render, screen } from '@testing-library/react';
4
+ import MessageAttachmentItem from './MessageAttachmentItem';
5
+ test('Renders with children', () => {
6
+ render(_jsx(MessageAttachmentItem, { children: "Test content" }));
7
+ expect(screen.getByText('Test content')).toBeInTheDocument();
8
+ });
9
+ test('Renders with pf-chatbot__message-attachment class by default', () => {
10
+ render(_jsx(MessageAttachmentItem, { children: "Test content" }));
11
+ expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__message-attachment', { exact: true });
12
+ });
13
+ test('Renders with custom className', () => {
14
+ render(_jsx(MessageAttachmentItem, { className: "custom-class", children: "Test content" }));
15
+ expect(screen.getByText('Test content')).toHaveClass('custom-class');
16
+ });
17
+ test('Spreads additional props', () => {
18
+ render(_jsx(MessageAttachmentItem, { id: "test-id", children: "Test content" }));
19
+ expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
20
+ });