@patternfly/chatbot 6.5.0-prerelease.9 → 6.5.0

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 (314) 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 +4 -0
  77. package/dist/cjs/MessageBar/MessageBar.js +20 -5
  78. package/dist/cjs/MessageBar/MessageBar.test.js +8 -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 +264 -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 +4 -0
  182. package/dist/esm/MessageBar/MessageBar.js +20 -5
  183. package/dist/esm/MessageBar/MessageBar.test.js +8 -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/ChatbotMessageBarIndicatorThinking.tsx +15 -0
  229. package/patternfly-docs/content/extensions/chatbot/examples/UI/CompactOnboarding.tsx +141 -0
  230. package/patternfly-docs/content/extensions/chatbot/examples/UI/Onboarding.tsx +151 -0
  231. package/patternfly-docs/content/extensions/chatbot/examples/UI/RH-Hat-Image.svg +9 -0
  232. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +67 -29
  233. package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +18 -18
  234. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +33 -19
  235. package/patternfly-docs/patternfly-docs.config.js +1 -1
  236. package/patternfly-docs/patternfly-docs.source.js +1 -1
  237. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +43 -0
  238. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +95 -0
  239. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +51 -15
  240. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +56 -14
  241. package/src/ChatbotModal/ChatbotModal.scss +3 -0
  242. package/src/CodeModal/CodeModal.tsx +71 -26
  243. package/src/DeepThinking/DeepThinking.scss +1 -1
  244. package/src/DeepThinking/DeepThinking.test.tsx +109 -0
  245. package/src/DeepThinking/DeepThinking.tsx +54 -5
  246. package/src/MarkdownContent/MarkdownContent.test.tsx +207 -0
  247. package/src/MarkdownContent/MarkdownContent.tsx +269 -0
  248. package/src/MarkdownContent/index.ts +2 -0
  249. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +13 -0
  250. package/src/Message/CodeBlockMessage/CodeBlockMessage.test.tsx +171 -0
  251. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +17 -4
  252. package/src/Message/ErrorMessage/ErrorMessage.test.tsx +38 -0
  253. package/src/Message/ErrorMessage/ErrorMessage.tsx +17 -2
  254. package/src/Message/LinkMessage/LinkMessage.scss +5 -0
  255. package/src/Message/LinkMessage/LinkMessage.tsx +24 -2
  256. package/src/Message/ListMessage/ListMessage.scss +8 -0
  257. package/src/Message/ListMessage/OrderedListMessage.tsx +16 -2
  258. package/src/Message/ListMessage/UnorderedListMessage.tsx +12 -2
  259. package/src/Message/Message.scss +11 -7
  260. package/src/Message/Message.test.tsx +202 -2
  261. package/src/Message/Message.tsx +129 -241
  262. package/src/Message/MessageAndActions/MessageAndActions.test.tsx +23 -0
  263. package/src/Message/MessageAndActions/MessageAndActions.tsx +22 -0
  264. package/src/Message/MessageAndActions/index.ts +1 -0
  265. package/src/Message/MessageAttachments/MessageAttachmentItem.test.tsx +23 -0
  266. package/src/Message/MessageAttachments/MessageAttachmentItem.tsx +25 -0
  267. package/src/Message/MessageAttachments/MessageAttachmentsContainer.test.tsx +23 -0
  268. package/src/Message/MessageAttachments/MessageAttachmentsContainer.tsx +25 -0
  269. package/src/Message/MessageAttachments/index.ts +2 -0
  270. package/src/Message/MessageInput.tsx +1 -1
  271. package/src/Message/MessageLoading.test.tsx +23 -0
  272. package/src/Message/MessageLoading.tsx +17 -2
  273. package/src/Message/QuickResponse/QuickResponse.scss +3 -1
  274. package/src/Message/QuickResponse/QuickResponse.test.tsx +131 -0
  275. package/src/Message/QuickResponse/QuickResponse.tsx +3 -2
  276. package/src/Message/QuickResponse/index.ts +1 -0
  277. package/src/Message/QuickStarts/QuickStartTile.tsx +1 -1
  278. package/src/Message/QuickStarts/index.ts +2 -0
  279. package/src/Message/TableMessage/TableMessage.scss +13 -1
  280. package/src/Message/TableMessage/TableMessage.tsx +18 -2
  281. package/src/Message/TextMessage/TextMessage.scss +12 -0
  282. package/src/Message/TextMessage/TextMessage.tsx +29 -2
  283. package/src/Message/UserFeedback/UserFeedback.scss +28 -1
  284. package/src/Message/UserFeedback/UserFeedback.tsx +23 -13
  285. package/src/Message/UserFeedback/UserFeedbackComplete.tsx +1 -4
  286. package/src/Message/UserFeedback/index.ts +2 -0
  287. package/src/Message/index.ts +8 -0
  288. package/src/MessageBar/AttachButton.scss +0 -1
  289. package/src/MessageBar/MessageBar.scss +48 -6
  290. package/src/MessageBar/MessageBar.test.tsx +12 -0
  291. package/src/MessageBar/MessageBar.tsx +38 -4
  292. package/src/MessageBar/MicrophoneButton.scss +0 -1
  293. package/src/MessageBar/SendButton.scss +0 -1
  294. package/src/MessageBar/StopButton.scss +0 -1
  295. package/src/Onboarding/Onboarding.scss +101 -0
  296. package/src/Onboarding/Onboarding.test.tsx +148 -0
  297. package/src/Onboarding/Onboarding.tsx +126 -0
  298. package/src/Onboarding/index.ts +3 -0
  299. package/src/ResponseActions/ResponseActions.scss +12 -1
  300. package/src/ResponseActions/ResponseActions.test.tsx +111 -12
  301. package/src/ResponseActions/ResponseActions.tsx +44 -10
  302. package/src/ResponseActions/ResponseActionsGroups.test.tsx +23 -0
  303. package/src/ResponseActions/ResponseActionsGroups.tsx +28 -0
  304. package/src/ResponseActions/index.ts +1 -0
  305. package/src/ToolCall/ToolCall.scss +1 -1
  306. package/src/ToolCall/ToolCall.test.tsx +91 -0
  307. package/src/ToolCall/ToolCall.tsx +49 -4
  308. package/src/ToolResponse/ToolResponse.scss +13 -3
  309. package/src/ToolResponse/ToolResponse.test.tsx +119 -0
  310. package/src/ToolResponse/ToolResponse.tsx +82 -7
  311. package/src/index.ts +6 -0
  312. package/src/main.scss +2 -0
  313. package/tsconfig.json +1 -1
  314. package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +0 -44
@@ -0,0 +1,13 @@
1
+ import { FunctionComponent, HTMLProps, ReactNode } from 'react';
2
+ /**
3
+ * The container to wrap MessageAttachment components. You must wrap any MessageAttachment components in this container.
4
+ * Use this component when passing children to Message to customize its structure.
5
+ */
6
+ export interface MessageAttachmentsContainerProps extends HTMLProps<HTMLDivElement> {
7
+ /** Content to render inside the attachments container */
8
+ children: ReactNode;
9
+ /** Additional classes applied to the attachments container. */
10
+ className?: string;
11
+ }
12
+ export declare const MessageAttachmentsContainer: FunctionComponent<MessageAttachmentsContainerProps>;
13
+ export default MessageAttachmentsContainer;
@@ -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 MessageAttachmentsContainer = (_a) => {
15
+ var { children, className } = _a, props = __rest(_a, ["children", "className"]);
16
+ return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-attachments-container', className) }, props, { children: children })));
17
+ };
18
+ export default MessageAttachmentsContainer;
@@ -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 MessageAttachmentsContainer from './MessageAttachmentsContainer';
5
+ test('Renders with children', () => {
6
+ render(_jsx(MessageAttachmentsContainer, { children: "Test content" }));
7
+ expect(screen.getByText('Test content')).toBeInTheDocument();
8
+ });
9
+ test('Renders with pf-chatbot__message-attachments-container class by default', () => {
10
+ render(_jsx(MessageAttachmentsContainer, { children: "Test content" }));
11
+ expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__message-attachments-container', { exact: true });
12
+ });
13
+ test('Renders with custom className', () => {
14
+ render(_jsx(MessageAttachmentsContainer, { className: "custom-class", children: "Test content" }));
15
+ expect(screen.getByText('Test content')).toHaveClass('custom-class');
16
+ });
17
+ test('Spreads additional props', () => {
18
+ render(_jsx(MessageAttachmentsContainer, { id: "test-id", children: "Test content" }));
19
+ expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
20
+ });
@@ -0,0 +1,2 @@
1
+ export * from './MessageAttachmentItem';
2
+ export * from './MessageAttachmentsContainer';
@@ -0,0 +1,2 @@
1
+ export * from './MessageAttachmentItem';
2
+ export * from './MessageAttachmentsContainer';
@@ -16,5 +16,5 @@ export interface MessageInputProps extends FormProps {
16
16
  /** Message text */
17
17
  content?: string;
18
18
  }
19
- declare const MessageInput: FunctionComponent<MessageInputProps>;
19
+ export declare const MessageInput: FunctionComponent<MessageInputProps>;
20
20
  export default MessageInput;
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useState } from 'react';
14
14
  import { ActionGroup, Button, Form, TextArea } from '@patternfly/react-core';
15
- const MessageInput = (_a) => {
15
+ export const MessageInput = (_a) => {
16
16
  var { editPlaceholder = 'Edit prompt message...', updateWord = 'Update', cancelWord = 'Cancel', onEditUpdate, onEditCancel, inputRef, content } = _a, props = __rest(_a, ["editPlaceholder", "updateWord", "cancelWord", "onEditUpdate", "onEditCancel", "inputRef", "content"]);
17
17
  const [messageText, setMessageText] = useState(content !== null && content !== void 0 ? content : '');
18
18
  const onChange = (_event, value) => {
@@ -1,5 +1,14 @@
1
- declare const MessageLoading: ({ loadingWord, isPrimary }: {
2
- loadingWord: any;
3
- isPrimary: any;
4
- }) => import("react/jsx-runtime").JSX.Element;
1
+ import { FunctionComponent } from 'react';
2
+ import type { HTMLProps } from 'react';
3
+ /**
4
+ * MessageLoading displays a loading animation for messages.
5
+ * Use this component when passing children to Message to show a loading state.
6
+ */
7
+ export interface MessageLoadingProps extends HTMLProps<HTMLDivElement> {
8
+ /** Text announced to screen readers during loading. */
9
+ loadingWord?: string;
10
+ /** Flag indicating whether primary styling is applied */
11
+ isPrimary?: boolean;
12
+ }
13
+ export declare const MessageLoading: FunctionComponent<MessageLoadingProps>;
5
14
  export default MessageLoading;
@@ -1,6 +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
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
- // ============================================================================
3
- // Chatbot Main - Message - Processing
4
- // ============================================================================
5
- const MessageLoading = ({ loadingWord, isPrimary }) => (_jsx("div", { className: `pf-chatbot__message-loading ${isPrimary ? 'pf-m-primary' : ''}`, children: _jsx("span", { className: "pf-chatbot__message-loading-dots", children: _jsx("span", { className: "pf-v6-screen-reader", children: loadingWord }) }) }));
13
+ import { css } from '@patternfly/react-styles';
14
+ export const MessageLoading = (_a) => {
15
+ var { loadingWord, isPrimary } = _a, props = __rest(_a, ["loadingWord", "isPrimary"]);
16
+ return (_jsx("div", Object.assign({ className: css('pf-chatbot__message-loading', isPrimary && 'pf-m-primary') }, props, { children: _jsx("span", { className: "pf-chatbot__message-loading-dots", children: _jsx("span", { className: "pf-v6-screen-reader", children: loadingWord }) }) })));
17
+ };
6
18
  export default MessageLoading;
@@ -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 MessageLoading from './MessageLoading';
5
+ test('Renders with pf-chatbot__message-loading class by default', () => {
6
+ render(_jsx(MessageLoading, { "data-testid": "test-id" }));
7
+ expect(screen.getByTestId('test-id')).toHaveClass('pf-chatbot__message-loading', { exact: true });
8
+ });
9
+ test('Renders with pf-m-primary class when isPrimary is true', () => {
10
+ render(_jsx(MessageLoading, { "data-testid": "test-id", isPrimary: true }));
11
+ expect(screen.getByTestId('test-id')).toHaveClass('pf-chatbot__message-loading pf-m-primary');
12
+ });
13
+ test('Renders loading word when loadingWord is passed', () => {
14
+ render(_jsx(MessageLoading, { loadingWord: "Loading message" }));
15
+ expect(screen.getByText('Loading message')).toBeInTheDocument();
16
+ });
17
+ test('Spreads additional props', () => {
18
+ render(_jsx(MessageLoading, { "data-testid": "test-id", id: "custom-id" }));
19
+ expect(screen.getByTestId('test-id')).toHaveAttribute('id', 'custom-id');
20
+ });
@@ -13,6 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { useState } from 'react';
14
14
  import { Label, LabelGroup } from '@patternfly/react-core';
15
15
  import { CheckIcon } from '@patternfly/react-icons';
16
+ import { css } from '@patternfly/react-styles';
16
17
  export const QuickResponse = ({ quickResponses, quickResponseContainerProps = { numLabels: 5 }, onSelect, isCompact }) => {
17
18
  const [selectedQuickResponse, setSelectedQuickResponse] = useState();
18
19
  const handleQuickResponseClick = (id, onClick) => {
@@ -20,9 +21,9 @@ export const QuickResponse = ({ quickResponses, quickResponseContainerProps = {
20
21
  onClick && onClick();
21
22
  onSelect && onSelect(id);
22
23
  };
23
- return (_jsx(LabelGroup, Object.assign({ className: `pf-chatbot__message-quick-response ${(quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className) ? quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className : ''}` }, quickResponseContainerProps, { children: quickResponses.map((_a) => {
24
+ return (_jsx(LabelGroup, Object.assign({ className: css('pf-chatbot__message-quick-response', quickResponseContainerProps === null || quickResponseContainerProps === void 0 ? void 0 : quickResponseContainerProps.className) }, quickResponseContainerProps, { children: quickResponses.map((_a) => {
24
25
  var { id, onClick, content, className } = _a, props = __rest(_a, ["id", "onClick", "content", "className"]);
25
- return (_jsx(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? _jsx(CheckIcon, {}) : undefined, color: "blue", onClick: () => handleQuickResponseClick(id, onClick), className: `${id === selectedQuickResponse ? 'pf-chatbot__message-quick-response--selected' : ''} ${className ? className : ''}`, isCompact: isCompact }, props, { children: content }), id));
26
+ return (_jsx(Label, Object.assign({ variant: id === selectedQuickResponse ? undefined : 'outline', icon: id === selectedQuickResponse ? _jsx(CheckIcon, {}) : undefined, color: "blue", onClick: () => handleQuickResponseClick(id, onClick), className: css(id === selectedQuickResponse && 'pf-chatbot__message-quick-response--selected', className), isCompact: isCompact }, props, { children: content }), id));
26
27
  }) })));
27
28
  };
28
29
  export default QuickResponse;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,104 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { render, screen } from '@testing-library/react';
12
+ import userEvent from '@testing-library/user-event';
13
+ import '@testing-library/jest-dom';
14
+ import QuickResponse from './QuickResponse';
15
+ test('Renders with quick responses', () => {
16
+ const quickResponses = [
17
+ { id: '1', content: 'Response 1' },
18
+ { id: '2', content: 'Response 2' },
19
+ { id: '3', content: 'Response 3' }
20
+ ];
21
+ render(_jsx(QuickResponse, { quickResponses: quickResponses }));
22
+ expect(screen.getByText('Response 1')).toBeVisible();
23
+ expect(screen.getByText('Response 2')).toBeVisible();
24
+ expect(screen.getByText('Response 3')).toBeVisible();
25
+ });
26
+ test('Renders with compact styling', () => {
27
+ const quickResponses = [{ id: '1', content: 'Compact response' }];
28
+ render(_jsx(QuickResponse, { quickResponses: quickResponses, isCompact: true }));
29
+ expect(screen.getByText('Compact response').closest('.pf-v6-c-label')).toHaveClass('pf-m-compact');
30
+ });
31
+ test('Renders with custom className on response', () => {
32
+ const quickResponses = [{ id: '1', content: 'Custom class response', className: 'custom-response-class' }];
33
+ render(_jsx(QuickResponse, { quickResponses: quickResponses }));
34
+ expect(screen.getByText('Custom class response').closest('.pf-v6-c-label')).toHaveClass('custom-response-class');
35
+ });
36
+ test('Renders with custom container className', () => {
37
+ const quickResponses = [
38
+ { id: '1', content: 'Response 1' },
39
+ { id: '2', content: 'Response 2' }
40
+ ];
41
+ render(_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: { className: 'custom-container-class' } }));
42
+ expect(screen.getByText('Response 1').closest('.pf-v6-c-label-group')).toHaveClass('custom-container-class');
43
+ });
44
+ test('Spreads additional custom container props', () => {
45
+ const quickResponses = [
46
+ { id: '1', content: 'Response 1' },
47
+ { id: '2', content: 'Response 2' }
48
+ ];
49
+ render(_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: { id: 'custom-container-id' } }));
50
+ expect(screen.getByText('Response 1').closest('.pf-v6-c-label-group__list')).toHaveAttribute('id', 'custom-container-id');
51
+ });
52
+ test('Renders with pf-chatbot__message-quick-response--selected class after click', () => __awaiter(void 0, void 0, void 0, function* () {
53
+ const user = userEvent.setup();
54
+ const quickResponses = [
55
+ { id: '1', content: 'Response 1' },
56
+ { id: '2', content: 'Response 2' }
57
+ ];
58
+ render(_jsx(QuickResponse, { quickResponses: quickResponses }));
59
+ yield user.click(screen.getByText('Response 1'));
60
+ expect(screen.getByText('Response 1').closest('.pf-v6-c-label')).toHaveClass('pf-chatbot__message-quick-response--selected');
61
+ }));
62
+ test('Does not calls onClick handler when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
63
+ const user = userEvent.setup();
64
+ const handleClick = jest.fn();
65
+ const quickResponses = [{ id: '1', content: 'Clickable response' }];
66
+ render(_jsx(QuickResponse, { quickResponses: quickResponses }));
67
+ yield user.click(screen.getByText('Clickable response'));
68
+ expect(handleClick).not.toHaveBeenCalled();
69
+ }));
70
+ test('Calls onClick handler when passed', () => __awaiter(void 0, void 0, void 0, function* () {
71
+ const user = userEvent.setup();
72
+ const handleClick = jest.fn();
73
+ const quickResponses = [{ id: '1', content: 'Clickable response', onClick: handleClick }];
74
+ render(_jsx(QuickResponse, { quickResponses: quickResponses }));
75
+ yield user.click(screen.getByText('Clickable response'));
76
+ expect(handleClick).toHaveBeenCalled();
77
+ }));
78
+ test('Does not call onSelect when not passed', () => __awaiter(void 0, void 0, void 0, function* () {
79
+ const user = userEvent.setup();
80
+ const handleSelect = jest.fn();
81
+ const quickResponses = [
82
+ { id: '1', content: 'Response 1' },
83
+ { id: '2', content: 'Response 2' }
84
+ ];
85
+ render(_jsx(QuickResponse, { quickResponses: quickResponses }));
86
+ yield user.click(screen.getByText('Response 2'));
87
+ expect(handleSelect).not.toHaveBeenCalled();
88
+ }));
89
+ test('Calls onSelect when passed', () => __awaiter(void 0, void 0, void 0, function* () {
90
+ const user = userEvent.setup();
91
+ const handleSelect = jest.fn();
92
+ const quickResponses = [
93
+ { id: '1', content: 'Response 1' },
94
+ { id: '2', content: 'Response 2' }
95
+ ];
96
+ render(_jsx(QuickResponse, { quickResponses: quickResponses, onSelect: handleSelect }));
97
+ yield user.click(screen.getByText('Response 2'));
98
+ expect(handleSelect).toHaveBeenCalledWith('2');
99
+ }));
100
+ test('Spreads additional response props', () => {
101
+ const quickResponses = [{ id: '1', content: 'Response with props', isCompact: true, 'aria-label': 'Test label' }];
102
+ render(_jsx(QuickResponse, { quickResponses: quickResponses }));
103
+ expect(screen.getByText('Response with props').closest('.pf-v6-c-label')).toHaveAttribute('aria-label', 'Test label');
104
+ });
@@ -0,0 +1 @@
1
+ export * from './QuickResponse';
@@ -0,0 +1 @@
1
+ export * from './QuickResponse';
@@ -25,5 +25,5 @@ export interface QuickStartTileProps {
25
25
  /** Sets the tile to compact styling */
26
26
  isCompact?: boolean;
27
27
  }
28
- declare const QuickStartTile: FC<QuickStartTileProps>;
28
+ export declare const QuickStartTile: FC<QuickStartTileProps>;
29
29
  export default QuickStartTile;
@@ -12,7 +12,7 @@ export const camelize = (str) => str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function
12
12
  } // or if (/\s+/.test(match)) for white spaces
13
13
  return index === 0 ? match.toLowerCase() : match.toUpperCase();
14
14
  });
15
- const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action, isCompact }) => {
15
+ export const QuickStartTile = ({ className, quickStart, onClick, onSelectQuickStart, minuteWord = 'minute', minuteWordPlural = 'minutes', prerequisiteWord, prerequisiteWordPlural, quickStartButtonAriaLabel, action, isCompact }) => {
16
16
  const { metadata: { name: id }, spec: { icon, displayName, description, durationMinutes, prerequisites, link, type } } = quickStart;
17
17
  let quickStartIcon;
18
18
  if (typeof icon === 'object') {
@@ -0,0 +1,2 @@
1
+ export * from './QuickStartTile';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './QuickStartTile';
2
+ export * from './types';
@@ -16,7 +16,12 @@ export interface TableNode {
16
16
  type: string;
17
17
  }
18
18
  export interface TableMessageProps {
19
+ /** Content of the table */
20
+ children?: React.ReactNode;
21
+ /** Flag indicating whether primary styles should be applied. */
19
22
  isPrimary?: boolean;
23
+ /** Flag indicating that the content should retain message styles when using Markdown. */
24
+ shouldRetainStyles?: boolean;
20
25
  }
21
- declare const TableMessage: ({ children, isPrimary, ...props }: Omit<TableProps, "ref"> & ExtraProps & TableMessageProps) => import("react/jsx-runtime").JSX.Element;
26
+ declare const TableMessage: ({ children, isPrimary, shouldRetainStyles, ...props }: Omit<TableProps, "ref"> & ExtraProps & TableMessageProps) => import("react/jsx-runtime").JSX.Element;
22
27
  export default TableMessage;
@@ -15,9 +15,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  // ============================================================================
16
16
  import { Children, cloneElement } from 'react';
17
17
  import { Table } from '@patternfly/react-table';
18
+ import { css } from '@patternfly/react-styles';
18
19
  const TableMessage = (_a) => {
19
20
  var _b;
20
- var { children, isPrimary } = _a, props = __rest(_a, ["children", "isPrimary"]);
21
+ var { children, isPrimary, shouldRetainStyles } = _a, props = __rest(_a, ["children", "isPrimary", "shouldRetainStyles"]);
21
22
  const { className } = props, rest = __rest(props, ["className"]);
22
23
  // This allows us to parse the nested data we get back from the 3rd party Markdown parser
23
24
  // Open to feedback here if there is a better way to do this
@@ -58,6 +59,6 @@ const TableMessage = (_a) => {
58
59
  }
59
60
  return (
60
61
  // gridBreakPoint is so we show mobile-styled-PF table
61
- _jsx(Table, Object.assign({ "aria-label": props['aria-label'], gridBreakPoint: "grid", className: `pf-chatbot__message-table ${isPrimary ? 'pf-m-primary' : ''} ${className ? className : ''}` }, rest, { children: modifyChildren(children) })));
62
+ _jsx(Table, Object.assign({ "aria-label": props['aria-label'], gridBreakPoint: "grid", className: css('pf-chatbot__message-table', isPrimary && 'pf-m-primary', shouldRetainStyles && 'pf-m-markdown', className) }, rest, { children: modifyChildren(children) })));
62
63
  };
63
64
  export default TableMessage;
@@ -1,7 +1,14 @@
1
1
  import { ExtraProps } from 'react-markdown';
2
2
  import { ContentProps } from '@patternfly/react-core';
3
3
  export interface TextMessageProps {
4
+ /** The text message content */
5
+ children?: React.ReactNode;
6
+ /** Flag indicating whether primary styling is applied. */
4
7
  isPrimary?: boolean;
8
+ /** The wrapper component to use for the PatternFly Content component. Defaults to a div. */
9
+ component?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'a' | 'small' | 'blockquote' | 'pre' | 'hr' | 'ul' | 'ol' | 'dl' | 'li' | 'dt' | 'dd';
10
+ /** Flag indicating that the content should retain message styles when using Markdown. */
11
+ shouldRetainStyles?: boolean;
5
12
  }
6
- declare const TextMessage: ({ component, children, isPrimary, ...props }: Omit<ContentProps, "ref"> & ExtraProps & TextMessageProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const TextMessage: ({ component, children, isPrimary, shouldRetainStyles, ...props }: Omit<ContentProps, "ref"> & ExtraProps & TextMessageProps) => import("react/jsx-runtime").JSX.Element;
7
14
  export default TextMessage;
@@ -11,8 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { Content } from '@patternfly/react-core';
14
+ import { css } from '@patternfly/react-styles';
14
15
  const TextMessage = (_a) => {
15
- var { component, children, isPrimary } = _a, props = __rest(_a, ["component", "children", "isPrimary"]);
16
- return (_jsx("span", { className: `pf-chatbot__message-text ${isPrimary ? 'pf-m-primary' : ''}`, children: _jsx(Content, Object.assign({ component: component }, props, { children: children })) }));
16
+ var { component, children, isPrimary, shouldRetainStyles } = _a, props = __rest(_a, ["component", "children", "isPrimary", "shouldRetainStyles"]);
17
+ return (_jsx("span", { className: css('pf-chatbot__message-text', isPrimary && 'pf-m-primary', shouldRetainStyles && 'pf-m-markdown'), children: _jsx(Content, Object.assign({ component: component }, props, { className: css(props === null || props === void 0 ? void 0 : props.className), children: children })) }));
17
18
  };
18
19
  export default TextMessage;
@@ -48,6 +48,8 @@ export interface UserFeedbackProps extends Omit<CardProps, 'onSubmit'>, OUIAProp
48
48
  textAreaProps?: TextAreaProps;
49
49
  /** Additional props passed to action group */
50
50
  actionGroupProps?: ActionGroupProps;
51
+ /** Optional privacy statement text displayed under text area */
52
+ privacyStatement?: string;
51
53
  }
52
- declare const UserFeedback: FunctionComponent<UserFeedbackProps>;
54
+ export declare const UserFeedback: FunctionComponent<UserFeedbackProps>;
53
55
  export default UserFeedback;
@@ -9,14 +9,14 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useState, useRef, useEffect } from 'react';
14
14
  // Import PatternFly components
15
15
  import { ActionGroup, Button, Card, CardBody, CardHeader, Form, TextArea } from '@patternfly/react-core';
16
16
  import QuickResponse from '../QuickResponse/QuickResponse';
17
17
  import CloseButton from './CloseButton';
18
- const UserFeedback = (_a) => {
19
- var { className, timestamp, title = 'Why did you choose this rating?', hasTextArea, textAreaAriaLabel = `Provide optional additional feedback for message received at ${timestamp}`, textAreaPlaceholder = 'Provide optional additional feedback', onTextAreaChange, submitWord = 'Submit', quickResponses, quickResponseContainerProps = { 'aria-label': `Quick feedback for message received at ${timestamp}` }, onSubmit, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, id, headingLevel: HeadingLevel = 'h1', focusOnLoad = true, isCompact, children, cardHeaderProps, cardBodyProps, headingLevelProps, formProps, textAreaProps, actionGroupProps, submitButtonProps } = _a, props = __rest(_a, ["className", "timestamp", "title", "hasTextArea", "textAreaAriaLabel", "textAreaPlaceholder", "onTextAreaChange", "submitWord", "quickResponses", "quickResponseContainerProps", "onSubmit", "onClose", "closeButtonAriaLabel", "id", "headingLevel", "focusOnLoad", "isCompact", "children", "cardHeaderProps", "cardBodyProps", "headingLevelProps", "formProps", "textAreaProps", "actionGroupProps", "submitButtonProps"]);
18
+ export const UserFeedback = (_a) => {
19
+ var { className, timestamp, title = 'Why did you choose this rating?', hasTextArea, textAreaAriaLabel = `Provide optional additional feedback for message received at ${timestamp}`, textAreaPlaceholder = 'Provide optional additional feedback', onTextAreaChange, submitWord = 'Submit', quickResponses, quickResponseContainerProps = { 'aria-label': `Quick feedback for message received at ${timestamp}` }, onSubmit, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, id, headingLevel: HeadingLevel = 'h1', focusOnLoad = true, isCompact, children, cardHeaderProps, cardBodyProps, headingLevelProps, formProps, textAreaProps, actionGroupProps, submitButtonProps, privacyStatement } = _a, props = __rest(_a, ["className", "timestamp", "title", "hasTextArea", "textAreaAriaLabel", "textAreaPlaceholder", "onTextAreaChange", "submitWord", "quickResponses", "quickResponseContainerProps", "onSubmit", "onClose", "closeButtonAriaLabel", "id", "headingLevel", "focusOnLoad", "isCompact", "children", "cardHeaderProps", "cardBodyProps", "headingLevelProps", "formProps", "textAreaProps", "actionGroupProps", "submitButtonProps", "privacyStatement"]);
20
20
  const [selectedResponse, setSelectedResponse] = useState();
21
21
  const [value, setValue] = useState('');
22
22
  const divRef = useRef(null);
@@ -30,9 +30,9 @@ const UserFeedback = (_a) => {
30
30
  /* card does not have ref forwarding; hence wrapper div */
31
31
  _jsx("div", { ref: divRef, id: id, tabIndex: 0, "aria-label": title, children: _jsxs(Card, Object.assign({ isCompact: isCompact, className: `pf-chatbot__feedback-card ${className ? className : ''}` }, props, { children: [_jsx(CardHeader, Object.assign({ actions: {
32
32
  actions: _jsx(CloseButton, { onClose: onClose, ariaLabel: closeButtonAriaLabel })
33
- } }, cardHeaderProps, { children: _jsx(HeadingLevel, Object.assign({ className: "pf-chatbot__feedback-card-title" }, headingLevelProps, { children: title })) })), _jsx(CardBody, Object.assign({}, cardBodyProps, { children: _jsxs(Form, Object.assign({ className: `pf-chatbot__feedback-card-form ${isCompact ? 'pf-m-compact' : ''}` }, formProps, { children: [quickResponses && (_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, onSelect: (id) => setSelectedResponse(id), isCompact: isCompact })), hasTextArea && (_jsx(TextArea, Object.assign({ value: value, onChange: (_event, value) => {
34
- setValue(value);
35
- onTextAreaChange && onTextAreaChange(_event, value);
36
- }, placeholder: textAreaPlaceholder, "aria-label": textAreaAriaLabel, resizeOrientation: "vertical" }, textAreaProps))), children, _jsx(ActionGroup, Object.assign({}, actionGroupProps, { children: _jsx(Button, Object.assign({ onClick: () => onSubmit(selectedResponse, value) }, submitButtonProps, { children: submitWord })) }))] })) }))] })) }));
33
+ } }, cardHeaderProps, { children: _jsx(HeadingLevel, Object.assign({ className: "pf-chatbot__feedback-card-title" }, headingLevelProps, { children: title })) })), _jsx(CardBody, Object.assign({}, cardBodyProps, { children: _jsxs(Form, Object.assign({ className: `pf-chatbot__feedback-card-form ${isCompact ? 'pf-m-compact' : ''}` }, formProps, { children: [quickResponses && (_jsx(QuickResponse, { quickResponses: quickResponses, quickResponseContainerProps: quickResponseContainerProps, onSelect: (id) => setSelectedResponse(id), isCompact: isCompact })), hasTextArea && (_jsx(_Fragment, { children: _jsx(TextArea, Object.assign({ value: value, onChange: (_event, value) => {
34
+ setValue(value);
35
+ onTextAreaChange && onTextAreaChange(_event, value);
36
+ }, placeholder: textAreaPlaceholder, "aria-label": textAreaAriaLabel, resizeOrientation: "vertical" }, textAreaProps)) })), privacyStatement && _jsx("div", { className: "pf-chatbot__feedback-card-privacy", children: privacyStatement }), children, _jsx(ActionGroup, Object.assign({}, actionGroupProps, { children: _jsx(Button, Object.assign({ onClick: () => onSubmit(selectedResponse, value), size: isCompact ? 'sm' : undefined }, submitButtonProps, { children: submitWord })) }))] })) }))] })) }));
37
37
  };
38
38
  export default UserFeedback;
@@ -38,5 +38,5 @@ export interface UserFeedbackCompleteProps extends Omit<CardProps, 'ref'>, OUIAP
38
38
  /** Timestamp passed in by Message for more context in aria announcements */
39
39
  timestamp?: string;
40
40
  }
41
- declare const UserFeedbackComplete: FunctionComponent<UserFeedbackCompleteProps>;
41
+ export declare const UserFeedbackComplete: FunctionComponent<UserFeedbackCompleteProps>;
42
42
  export default UserFeedbackComplete;
@@ -11,10 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useState, useRef, useEffect } from 'react';
14
- // Import PatternFly components
15
14
  import { Card, CardBody, CardHeader, CardTitle, useOUIAProps } from '@patternfly/react-core';
16
15
  import CloseButton from './CloseButton';
17
- const UserFeedbackComplete = (_a) => {
16
+ export const UserFeedbackComplete = (_a) => {
18
17
  var { className, title = 'Feedback submitted', body = "We've received your response. Thank you for sharing your feedback!", timestamp, timeout = false, timeoutAnimation = 3000, onTimeout, onClose, closeButtonAriaLabel = `Close feedback for message received at ${timestamp}`, onMouseEnter, onMouseLeave, ouiaId, ouiaSafe, isLiveRegion, id, focusOnLoad = true, isCompact } = _a, props = __rest(_a, ["className", "title", "body", "timestamp", "timeout", "timeoutAnimation", "onTimeout", "onClose", "closeButtonAriaLabel", "onMouseEnter", "onMouseLeave", "ouiaId", "ouiaSafe", "isLiveRegion", "id", "focusOnLoad", "isCompact"]);
19
18
  const [timedOut, setTimedOut] = useState(false);
20
19
  const [timedOutAnimation, setTimedOutAnimation] = useState(true);
@@ -0,0 +1,2 @@
1
+ export * from './UserFeedback';
2
+ export * from './UserFeedbackComplete';
@@ -0,0 +1,2 @@
1
+ export * from './UserFeedback';
2
+ export * from './UserFeedbackComplete';
@@ -1,3 +1,11 @@
1
1
  export { default } from './Message';
2
2
  export { rehypeCodeBlockToggle } from './Plugins/rehypeCodeBlockToggle';
3
+ export * from './ErrorMessage/ErrorMessage';
4
+ export * from './MessageAndActions';
5
+ export * from './MessageAttachments';
3
6
  export * from './Message';
7
+ export * from './MessageLoading';
8
+ export * from './MessageInput';
9
+ export * from './QuickResponse';
10
+ export * from './QuickStarts';
11
+ export * from './UserFeedback';
@@ -1,3 +1,11 @@
1
1
  export { default } from './Message';
2
2
  export { rehypeCodeBlockToggle } from './Plugins/rehypeCodeBlockToggle';
3
+ export * from './ErrorMessage/ErrorMessage';
4
+ export * from './MessageAndActions';
5
+ export * from './MessageAttachments';
3
6
  export * from './Message';
7
+ export * from './MessageLoading';
8
+ export * from './MessageInput';
9
+ export * from './QuickResponse';
10
+ export * from './QuickStarts';
11
+ export * from './UserFeedback';
@@ -111,6 +111,10 @@ export interface MessageBarProps extends Omit<TextAreaProps, 'innerRef'> {
111
111
  innerRef?: React.Ref<HTMLTextAreaElement>;
112
112
  /** Sets background color to primary */
113
113
  isPrimary?: boolean;
114
+ /** @beta Flag indicating whether the message bar has an AI indicator border. */
115
+ hasAiIndicator?: boolean;
116
+ /** @beta Flag indicating whether the chatbot is thinking in response to a query, adding an animation to the message bar. */
117
+ isThinking?: boolean;
114
118
  }
115
119
  export declare const MessageBarBase: FunctionComponent<MessageBarProps>;
116
120
  declare const MessageBar: import("react").ForwardRefExoticComponent<MessageBarProps & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
14
14
  import { TextArea } from '@patternfly/react-core';
15
+ import { css } from '@patternfly/react-styles';
15
16
  // Import Chatbot components
16
17
  import SendButton from './SendButton';
17
18
  import MicrophoneButton from './MicrophoneButton';
@@ -20,13 +21,14 @@ import AttachMenu from '../AttachMenu';
20
21
  import StopButton from './StopButton';
21
22
  export const MessageBarBase = (_a) => {
22
23
  var _b;
23
- var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value, isCompact = false, allowedFileTypes, minSize, maxSize, maxFiles, isAttachmentDisabled, onAttach, onAttachRejected, validator, dropzoneProps, innerRef, isPrimary } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value", "isCompact", "allowedFileTypes", "minSize", "maxSize", "maxFiles", "isAttachmentDisabled", "onAttach", "onAttachRejected", "validator", "dropzoneProps", "innerRef", "isPrimary"]);
24
+ var { onSendMessage, className, alwayShowSendButton, placeholder = 'Send a message...', hasAttachButton = true, hasMicrophoneButton, listeningText = 'Listening', handleAttach, attachMenuProps, isSendButtonDisabled, handleStopButton, hasStopButton, buttonProps, onChange, displayMode, value, isCompact = false, allowedFileTypes, minSize, maxSize, maxFiles, isAttachmentDisabled, onAttach, onAttachRejected, validator, dropzoneProps, innerRef, isPrimary, hasAiIndicator, isThinking } = _a, props = __rest(_a, ["onSendMessage", "className", "alwayShowSendButton", "placeholder", "hasAttachButton", "hasMicrophoneButton", "listeningText", "handleAttach", "attachMenuProps", "isSendButtonDisabled", "handleStopButton", "hasStopButton", "buttonProps", "onChange", "displayMode", "value", "isCompact", "allowedFileTypes", "minSize", "maxSize", "maxFiles", "isAttachmentDisabled", "onAttach", "onAttachRejected", "validator", "dropzoneProps", "innerRef", "isPrimary", "hasAiIndicator", "isThinking"]);
24
25
  // Text Input
25
26
  // --------------------------------------------------------------------------
26
27
  const [message, setMessage] = useState(value !== null && value !== void 0 ? value : '');
27
28
  const [isListeningMessage, setIsListeningMessage] = useState(false);
28
29
  const [hasSentMessage, setHasSentMessage] = useState(false);
29
30
  const [isComposing, setIsComposing] = useState(false);
31
+ const [isMultiline, setIsMultiline] = useState(false);
30
32
  const inputRef = useRef(null);
31
33
  const textareaRef = (_b = innerRef) !== null && _b !== void 0 ? _b : inputRef;
32
34
  const attachButtonRef = useRef(null);
@@ -67,6 +69,15 @@ export const MessageBarBase = (_a) => {
67
69
  const lines = field.scrollHeight / lineHeight;
68
70
  return lines > 2;
69
71
  };
72
+ const checkIfMultiline = useCallback((field) => {
73
+ const parent = field.parentElement;
74
+ const grandparent = parent === null || parent === void 0 ? void 0 : parent.parentElement;
75
+ if (grandparent) {
76
+ const containerHeight = grandparent.offsetHeight;
77
+ const threshold = isCompact ? 56 : 70;
78
+ setIsMultiline(containerHeight > threshold);
79
+ }
80
+ }, [isCompact]);
70
81
  const setAutoWidth = useCallback((field) => {
71
82
  const parent = field.parentElement;
72
83
  if (parent) {
@@ -119,13 +130,15 @@ export const MessageBarBase = (_a) => {
119
130
  if (field) {
120
131
  if (field.value === '') {
121
132
  setInitialLineHeight(field);
133
+ setIsMultiline(false);
122
134
  }
123
135
  else {
124
136
  setAutoHeight(field);
125
137
  setAutoWidth(field);
138
+ checkIfMultiline(field);
126
139
  }
127
140
  }
128
- }, [displayMode, message, setAutoWidth]);
141
+ }, [displayMode, message, setAutoWidth, checkIfMultiline]);
129
142
  useEffect(() => {
130
143
  const field = textareaRef.current;
131
144
  if (field) {
@@ -138,13 +151,15 @@ export const MessageBarBase = (_a) => {
138
151
  if (textareaRef.current) {
139
152
  if (event.target.value === '') {
140
153
  setInitialLineHeight(textareaRef.current);
154
+ setIsMultiline(false);
141
155
  }
142
156
  else {
143
157
  setAutoHeight(textareaRef.current);
158
+ checkIfMultiline(textareaRef.current);
144
159
  }
145
160
  }
146
161
  setMessage(event.target.value);
147
- }, [onChange]);
162
+ }, [onChange, checkIfMultiline]);
148
163
  // Handle sending message
149
164
  const handleSend = useCallback((newMessage) => {
150
165
  onSendMessage(newMessage);
@@ -195,14 +210,14 @@ export const MessageBarBase = (_a) => {
195
210
  };
196
211
  const messageBarContents = (_jsxs(_Fragment, { children: [_jsx("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}`, children: _jsx(TextArea, Object.assign({ className: "pf-chatbot__message-textarea", value: message, onChange: handleChange, "aria-label": isListeningMessage ? listeningText : placeholder, placeholder: isListeningMessage ? listeningText : placeholder, ref: textareaRef, onKeyDown: handleKeyDown, onCompositionStart: handleCompositionStart, onCompositionEnd: handleCompositionEnd }, props)) }), _jsx("div", { className: "pf-chatbot__message-bar-actions", children: renderButtons() })] }));
197
212
  if (attachMenuProps) {
198
- return (_jsx(AttachMenu, Object.assign({ toggle: (toggleRef) => (_jsx("div", { ref: toggleRef, className: `pf-chatbot__message-bar ${className !== null && className !== void 0 ? className : ''}`, children: messageBarContents })), filteredItems: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.attachMenuItems }, (attachMenuProps && { isOpen: attachMenuProps.isAttachMenuOpen }), { onOpenChange: (isAttachMenuOpen) => {
213
+ return (_jsx(AttachMenu, Object.assign({ toggle: (toggleRef) => (_jsx("div", { ref: toggleRef, className: css('pf-chatbot__message-bar', isMultiline && 'pf-m-multiline', className), children: messageBarContents })), filteredItems: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.attachMenuItems }, (attachMenuProps && { isOpen: attachMenuProps.isAttachMenuOpen }), { onOpenChange: (isAttachMenuOpen) => {
199
214
  var _a;
200
215
  (_a = attachButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
201
216
  attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.setIsAttachMenuOpen(isAttachMenuOpen);
202
217
  (attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuOpenChange) && (attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuOpenChange(isAttachMenuOpen));
203
218
  }, onOpenChangeKeys: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuOnOpenChangeKeys, onSelect: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.onAttachMenuSelect }, (attachMenuProps && { handleTextInputChange: attachMenuProps.onAttachMenuInputChange }), { popperProps: { direction: 'up', distance: 8 }, searchInputPlaceholder: attachMenuProps === null || attachMenuProps === void 0 ? void 0 : attachMenuProps.attachMenuInputPlaceholder }, attachMenuProps)));
204
219
  }
205
- return (_jsx("div", { className: `pf-chatbot__message-bar ${isPrimary ? 'pf-m-primary' : ''} ${className !== null && className !== void 0 ? className : ''}`, children: messageBarContents }));
220
+ return (_jsx("div", { className: css('pf-chatbot__message-bar', isPrimary && 'pf-m-primary', hasAiIndicator && 'pf-v6-m-ai-indicator', isThinking && 'pf-v6-m-thinking', isMultiline && 'pf-m-multiline', className), children: messageBarContents }));
206
221
  };
207
222
  const MessageBar = forwardRef((props, ref) => (_jsx(MessageBarBase, Object.assign({ innerRef: ref }, props))));
208
223
  export { MessageBar };