@patternfly/chatbot 2.1.0-prerelease.17

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 (534) hide show
  1. package/@types/index.d.ts +9 -0
  2. package/dist/cjs/AttachMenu/AttachMenu.d.ts +29 -0
  3. package/dist/cjs/AttachMenu/AttachMenu.js +33 -0
  4. package/dist/cjs/AttachMenu/index.d.ts +2 -0
  5. package/dist/cjs/AttachMenu/index.js +23 -0
  6. package/dist/cjs/AttachmentEdit/AttachmentEdit.d.ts +22 -0
  7. package/dist/cjs/AttachmentEdit/AttachmentEdit.js +25 -0
  8. package/dist/cjs/AttachmentEdit/index.d.ts +2 -0
  9. package/dist/cjs/AttachmentEdit/index.js +23 -0
  10. package/dist/cjs/Chatbot/Chatbot.d.ts +23 -0
  11. package/dist/cjs/Chatbot/Chatbot.js +49 -0
  12. package/dist/cjs/Chatbot/index.d.ts +2 -0
  13. package/dist/cjs/Chatbot/index.js +23 -0
  14. package/dist/cjs/ChatbotAlert/ChatbotAlert.d.ts +8 -0
  15. package/dist/cjs/ChatbotAlert/ChatbotAlert.js +28 -0
  16. package/dist/cjs/ChatbotAlert/index.d.ts +2 -0
  17. package/dist/cjs/ChatbotAlert/index.js +23 -0
  18. package/dist/cjs/ChatbotContent/ChatbotContent.d.ts +9 -0
  19. package/dist/cjs/ChatbotContent/ChatbotContent.js +27 -0
  20. package/dist/cjs/ChatbotContent/index.d.ts +2 -0
  21. package/dist/cjs/ChatbotContent/index.js +23 -0
  22. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +14 -0
  23. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +22 -0
  24. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +52 -0
  25. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +83 -0
  26. package/dist/cjs/ChatbotConversationHistoryNav/index.d.ts +3 -0
  27. package/dist/cjs/ChatbotConversationHistoryNav/index.js +24 -0
  28. package/dist/cjs/ChatbotFooter/ChatbotFooter.d.ts +9 -0
  29. package/dist/cjs/ChatbotFooter/ChatbotFooter.js +35 -0
  30. package/dist/cjs/ChatbotFooter/ChatbotFootnote.d.ts +44 -0
  31. package/dist/cjs/ChatbotFooter/ChatbotFootnote.js +56 -0
  32. package/dist/cjs/ChatbotFooter/index.d.ts +3 -0
  33. package/dist/cjs/ChatbotFooter/index.js +24 -0
  34. package/dist/cjs/ChatbotHeader/ChatbotHeader.d.ts +9 -0
  35. package/dist/cjs/ChatbotHeader/ChatbotHeader.js +13 -0
  36. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.d.ts +9 -0
  37. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.js +10 -0
  38. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.d.ts +9 -0
  39. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.js +10 -0
  40. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.d.ts +15 -0
  41. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.js +14 -0
  42. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +14 -0
  43. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +33 -0
  44. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +18 -0
  45. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +33 -0
  46. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.d.ts +20 -0
  47. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.js +33 -0
  48. package/dist/cjs/ChatbotHeader/index.d.ts +8 -0
  49. package/dist/cjs/ChatbotHeader/index.js +29 -0
  50. package/dist/cjs/ChatbotModal/ChatbotModal.d.ts +10 -0
  51. package/dist/cjs/ChatbotModal/ChatbotModal.js +34 -0
  52. package/dist/cjs/ChatbotModal/index.d.ts +2 -0
  53. package/dist/cjs/ChatbotModal/index.js +23 -0
  54. package/dist/cjs/ChatbotPopover/ChatbotPopover.d.ts +4 -0
  55. package/dist/cjs/ChatbotPopover/ChatbotPopover.js +29 -0
  56. package/dist/cjs/ChatbotPopover/index.d.ts +2 -0
  57. package/dist/cjs/ChatbotPopover/index.js +23 -0
  58. package/dist/cjs/ChatbotToggle/ChatbotToggle.d.ts +20 -0
  59. package/dist/cjs/ChatbotToggle/ChatbotToggle.js +35 -0
  60. package/dist/cjs/ChatbotToggle/index.d.ts +2 -0
  61. package/dist/cjs/ChatbotToggle/index.js +23 -0
  62. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +23 -0
  63. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +40 -0
  64. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +1 -0
  65. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +49 -0
  66. package/dist/cjs/ChatbotWelcomePrompt/index.d.ts +2 -0
  67. package/dist/cjs/ChatbotWelcomePrompt/index.js +23 -0
  68. package/dist/cjs/CodeModal/CodeModal.d.ts +34 -0
  69. package/dist/cjs/CodeModal/CodeModal.js +105 -0
  70. package/dist/cjs/CodeModal/index.d.ts +2 -0
  71. package/dist/cjs/CodeModal/index.js +23 -0
  72. package/dist/cjs/FileDetails/FileDetails.d.ts +922 -0
  73. package/dist/cjs/FileDetails/FileDetails.js +954 -0
  74. package/dist/cjs/FileDetails/FileDetails.test.d.ts +1 -0
  75. package/dist/cjs/FileDetails/FileDetails.test.js +26 -0
  76. package/dist/cjs/FileDetails/index.d.ts +2 -0
  77. package/dist/cjs/FileDetails/index.js +23 -0
  78. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.d.ts +21 -0
  79. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.js +22 -0
  80. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.d.ts +1 -0
  81. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +61 -0
  82. package/dist/cjs/FileDetailsLabel/index.d.ts +2 -0
  83. package/dist/cjs/FileDetailsLabel/index.js +23 -0
  84. package/dist/cjs/FileDropZone/FileDropZone.d.ts +17 -0
  85. package/dist/cjs/FileDropZone/FileDropZone.js +28 -0
  86. package/dist/cjs/FileDropZone/FileDropZone.test.d.ts +1 -0
  87. package/dist/cjs/FileDropZone/FileDropZone.test.js +19 -0
  88. package/dist/cjs/FileDropZone/index.d.ts +2 -0
  89. package/dist/cjs/FileDropZone/index.js +23 -0
  90. package/dist/cjs/LoadingMessage/LoadingMessage.d.ts +6 -0
  91. package/dist/cjs/LoadingMessage/LoadingMessage.js +20 -0
  92. package/dist/cjs/LoadingMessage/LoadingMessage.test.d.ts +1 -0
  93. package/dist/cjs/LoadingMessage/LoadingMessage.test.js +20 -0
  94. package/dist/cjs/LoadingMessage/index.d.ts +2 -0
  95. package/dist/cjs/LoadingMessage/index.js +23 -0
  96. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.d.ts +4 -0
  97. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.js +61 -0
  98. package/dist/cjs/Message/ListMessage/ListItemMessage.d.ts +4 -0
  99. package/dist/cjs/Message/ListMessage/ListItemMessage.js +12 -0
  100. package/dist/cjs/Message/ListMessage/OrderedListMessage.d.ts +4 -0
  101. package/dist/cjs/Message/ListMessage/OrderedListMessage.js +13 -0
  102. package/dist/cjs/Message/ListMessage/UnorderedListMessage.d.ts +4 -0
  103. package/dist/cjs/Message/ListMessage/UnorderedListMessage.js +13 -0
  104. package/dist/cjs/Message/Message.d.ts +65 -0
  105. package/dist/cjs/Message/Message.js +69 -0
  106. package/dist/cjs/Message/Message.test.d.ts +1 -0
  107. package/dist/cjs/Message/Message.test.js +239 -0
  108. package/dist/cjs/Message/MessageLoading.d.ts +5 -0
  109. package/dist/cjs/Message/MessageLoading.js +13 -0
  110. package/dist/cjs/Message/TextMessage/TextMessage.d.ts +4 -0
  111. package/dist/cjs/Message/TextMessage/TextMessage.js +27 -0
  112. package/dist/cjs/Message/index.d.ts +2 -0
  113. package/dist/cjs/Message/index.js +23 -0
  114. package/dist/cjs/MessageBar/AttachButton.d.ts +21 -0
  115. package/dist/cjs/MessageBar/AttachButton.js +38 -0
  116. package/dist/cjs/MessageBar/AttachButton.test.d.ts +1 -0
  117. package/dist/cjs/MessageBar/AttachButton.test.js +66 -0
  118. package/dist/cjs/MessageBar/MessageBar.d.ts +71 -0
  119. package/dist/cjs/MessageBar/MessageBar.js +112 -0
  120. package/dist/cjs/MessageBar/MessageBar.test.d.ts +1 -0
  121. package/dist/cjs/MessageBar/MessageBar.test.js +237 -0
  122. package/dist/cjs/MessageBar/MicrophoneButton.d.ts +21 -0
  123. package/dist/cjs/MessageBar/MicrophoneButton.js +74 -0
  124. package/dist/cjs/MessageBar/SendButton.d.ts +14 -0
  125. package/dist/cjs/MessageBar/SendButton.js +32 -0
  126. package/dist/cjs/MessageBar/SendButton.test.d.ts +1 -0
  127. package/dist/cjs/MessageBar/SendButton.test.js +54 -0
  128. package/dist/cjs/MessageBar/StopButton.d.ts +14 -0
  129. package/dist/cjs/MessageBar/StopButton.js +32 -0
  130. package/dist/cjs/MessageBar/StopButton.test.d.ts +1 -0
  131. package/dist/cjs/MessageBar/StopButton.test.js +54 -0
  132. package/dist/cjs/MessageBar/index.d.ts +5 -0
  133. package/dist/cjs/MessageBar/index.js +26 -0
  134. package/dist/cjs/MessageBox/JumpButton.d.ts +11 -0
  135. package/dist/cjs/MessageBox/JumpButton.js +17 -0
  136. package/dist/cjs/MessageBox/JumpButton.test.d.ts +1 -0
  137. package/dist/cjs/MessageBox/JumpButton.test.js +39 -0
  138. package/dist/cjs/MessageBox/MessageBox.d.ts +17 -0
  139. package/dist/cjs/MessageBox/MessageBox.js +74 -0
  140. package/dist/cjs/MessageBox/index.d.ts +3 -0
  141. package/dist/cjs/MessageBox/index.js +24 -0
  142. package/dist/cjs/PreviewAttachment/PreviewAttachment.d.ts +22 -0
  143. package/dist/cjs/PreviewAttachment/PreviewAttachment.js +25 -0
  144. package/dist/cjs/PreviewAttachment/index.d.ts +2 -0
  145. package/dist/cjs/PreviewAttachment/index.js +23 -0
  146. package/dist/cjs/ResponseActions/ResponseActionButton.d.ts +20 -0
  147. package/dist/cjs/ResponseActions/ResponseActionButton.js +12 -0
  148. package/dist/cjs/ResponseActions/ResponseActions.d.ts +30 -0
  149. package/dist/cjs/ResponseActions/ResponseActions.js +36 -0
  150. package/dist/cjs/ResponseActions/ResponseActions.test.d.ts +1 -0
  151. package/dist/cjs/ResponseActions/ResponseActions.test.js +67 -0
  152. package/dist/cjs/ResponseActions/index.d.ts +2 -0
  153. package/dist/cjs/ResponseActions/index.js +23 -0
  154. package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +11 -0
  155. package/dist/cjs/SourceDetailsMenuItem/SourceDetailsMenuItem.js +31 -0
  156. package/dist/cjs/SourceDetailsMenuItem/index.d.ts +2 -0
  157. package/dist/cjs/SourceDetailsMenuItem/index.js +23 -0
  158. package/dist/cjs/SourcesCard/SourcesCard.d.ts +34 -0
  159. package/dist/cjs/SourcesCard/SourcesCard.js +68 -0
  160. package/dist/cjs/SourcesCard/SourcesCard.test.d.ts +1 -0
  161. package/dist/cjs/SourcesCard/SourcesCard.test.js +167 -0
  162. package/dist/cjs/SourcesCard/index.d.ts +2 -0
  163. package/dist/cjs/SourcesCard/index.js +23 -0
  164. package/dist/cjs/index.d.ts +48 -0
  165. package/dist/cjs/index.js +93 -0
  166. package/dist/css/main.css +1583 -0
  167. package/dist/css/main.css.map +1 -0
  168. package/dist/dynamic/AttachMenu/package.json +1 -0
  169. package/dist/dynamic/AttachmentEdit/package.json +1 -0
  170. package/dist/dynamic/Chatbot/package.json +1 -0
  171. package/dist/dynamic/ChatbotAlert/package.json +1 -0
  172. package/dist/dynamic/ChatbotContent/package.json +1 -0
  173. package/dist/dynamic/ChatbotConversationHistoryNav/package.json +1 -0
  174. package/dist/dynamic/ChatbotFooter/package.json +1 -0
  175. package/dist/dynamic/ChatbotHeader/package.json +1 -0
  176. package/dist/dynamic/ChatbotModal/package.json +1 -0
  177. package/dist/dynamic/ChatbotPopover/package.json +1 -0
  178. package/dist/dynamic/ChatbotToggle/package.json +1 -0
  179. package/dist/dynamic/ChatbotWelcomePrompt/package.json +1 -0
  180. package/dist/dynamic/CodeModal/package.json +1 -0
  181. package/dist/dynamic/FileDetails/package.json +1 -0
  182. package/dist/dynamic/FileDetailsLabel/package.json +1 -0
  183. package/dist/dynamic/FileDropZone/package.json +1 -0
  184. package/dist/dynamic/LoadingMessage/package.json +1 -0
  185. package/dist/dynamic/Message/package.json +1 -0
  186. package/dist/dynamic/MessageBar/package.json +1 -0
  187. package/dist/dynamic/MessageBox/package.json +1 -0
  188. package/dist/dynamic/PreviewAttachment/package.json +1 -0
  189. package/dist/dynamic/ResponseActions/package.json +1 -0
  190. package/dist/dynamic/SourceDetailsMenuItem/package.json +1 -0
  191. package/dist/dynamic/SourcesCard/package.json +1 -0
  192. package/dist/esm/AttachMenu/AttachMenu.d.ts +29 -0
  193. package/dist/esm/AttachMenu/AttachMenu.js +26 -0
  194. package/dist/esm/AttachMenu/index.d.ts +2 -0
  195. package/dist/esm/AttachMenu/index.js +2 -0
  196. package/dist/esm/AttachmentEdit/AttachmentEdit.d.ts +22 -0
  197. package/dist/esm/AttachmentEdit/AttachmentEdit.js +18 -0
  198. package/dist/esm/AttachmentEdit/index.d.ts +2 -0
  199. package/dist/esm/AttachmentEdit/index.js +2 -0
  200. package/dist/esm/Chatbot/Chatbot.d.ts +23 -0
  201. package/dist/esm/Chatbot/Chatbot.js +43 -0
  202. package/dist/esm/Chatbot/index.d.ts +2 -0
  203. package/dist/esm/Chatbot/index.js +2 -0
  204. package/dist/esm/ChatbotAlert/ChatbotAlert.d.ts +8 -0
  205. package/dist/esm/ChatbotAlert/ChatbotAlert.js +21 -0
  206. package/dist/esm/ChatbotAlert/index.d.ts +2 -0
  207. package/dist/esm/ChatbotAlert/index.js +2 -0
  208. package/dist/esm/ChatbotContent/ChatbotContent.d.ts +9 -0
  209. package/dist/esm/ChatbotContent/ChatbotContent.js +20 -0
  210. package/dist/esm/ChatbotContent/index.d.ts +2 -0
  211. package/dist/esm/ChatbotContent/index.js +2 -0
  212. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.d.ts +14 -0
  213. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.js +15 -0
  214. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +52 -0
  215. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +76 -0
  216. package/dist/esm/ChatbotConversationHistoryNav/index.d.ts +3 -0
  217. package/dist/esm/ChatbotConversationHistoryNav/index.js +3 -0
  218. package/dist/esm/ChatbotFooter/ChatbotFooter.d.ts +9 -0
  219. package/dist/esm/ChatbotFooter/ChatbotFooter.js +28 -0
  220. package/dist/esm/ChatbotFooter/ChatbotFootnote.d.ts +44 -0
  221. package/dist/esm/ChatbotFooter/ChatbotFootnote.js +49 -0
  222. package/dist/esm/ChatbotFooter/index.d.ts +3 -0
  223. package/dist/esm/ChatbotFooter/index.js +3 -0
  224. package/dist/esm/ChatbotHeader/ChatbotHeader.d.ts +9 -0
  225. package/dist/esm/ChatbotHeader/ChatbotHeader.js +6 -0
  226. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.d.ts +9 -0
  227. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.js +3 -0
  228. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.d.ts +9 -0
  229. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.js +3 -0
  230. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.d.ts +15 -0
  231. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.js +8 -0
  232. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.d.ts +14 -0
  233. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.js +26 -0
  234. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.d.ts +18 -0
  235. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.js +26 -0
  236. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.d.ts +20 -0
  237. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.js +26 -0
  238. package/dist/esm/ChatbotHeader/index.d.ts +8 -0
  239. package/dist/esm/ChatbotHeader/index.js +8 -0
  240. package/dist/esm/ChatbotModal/ChatbotModal.d.ts +10 -0
  241. package/dist/esm/ChatbotModal/ChatbotModal.js +27 -0
  242. package/dist/esm/ChatbotModal/index.d.ts +2 -0
  243. package/dist/esm/ChatbotModal/index.js +2 -0
  244. package/dist/esm/ChatbotPopover/ChatbotPopover.d.ts +4 -0
  245. package/dist/esm/ChatbotPopover/ChatbotPopover.js +22 -0
  246. package/dist/esm/ChatbotPopover/index.d.ts +2 -0
  247. package/dist/esm/ChatbotPopover/index.js +2 -0
  248. package/dist/esm/ChatbotToggle/ChatbotToggle.d.ts +20 -0
  249. package/dist/esm/ChatbotToggle/ChatbotToggle.js +30 -0
  250. package/dist/esm/ChatbotToggle/index.d.ts +2 -0
  251. package/dist/esm/ChatbotToggle/index.js +2 -0
  252. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.d.ts +23 -0
  253. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.js +33 -0
  254. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +1 -0
  255. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +44 -0
  256. package/dist/esm/ChatbotWelcomePrompt/index.d.ts +2 -0
  257. package/dist/esm/ChatbotWelcomePrompt/index.js +2 -0
  258. package/dist/esm/CodeModal/CodeModal.d.ts +34 -0
  259. package/dist/esm/CodeModal/CodeModal.js +75 -0
  260. package/dist/esm/CodeModal/index.d.ts +2 -0
  261. package/dist/esm/CodeModal/index.js +2 -0
  262. package/dist/esm/FileDetails/FileDetails.d.ts +922 -0
  263. package/dist/esm/FileDetails/FileDetails.js +947 -0
  264. package/dist/esm/FileDetails/FileDetails.test.d.ts +1 -0
  265. package/dist/esm/FileDetails/FileDetails.test.js +21 -0
  266. package/dist/esm/FileDetails/index.d.ts +2 -0
  267. package/dist/esm/FileDetails/index.js +2 -0
  268. package/dist/esm/FileDetailsLabel/FileDetailsLabel.d.ts +21 -0
  269. package/dist/esm/FileDetailsLabel/FileDetailsLabel.js +15 -0
  270. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.d.ts +1 -0
  271. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +56 -0
  272. package/dist/esm/FileDetailsLabel/index.d.ts +2 -0
  273. package/dist/esm/FileDetailsLabel/index.js +2 -0
  274. package/dist/esm/FileDropZone/FileDropZone.d.ts +17 -0
  275. package/dist/esm/FileDropZone/FileDropZone.js +23 -0
  276. package/dist/esm/FileDropZone/FileDropZone.test.d.ts +1 -0
  277. package/dist/esm/FileDropZone/FileDropZone.test.js +14 -0
  278. package/dist/esm/FileDropZone/index.d.ts +2 -0
  279. package/dist/esm/FileDropZone/index.js +2 -0
  280. package/dist/esm/LoadingMessage/LoadingMessage.d.ts +6 -0
  281. package/dist/esm/LoadingMessage/LoadingMessage.js +13 -0
  282. package/dist/esm/LoadingMessage/LoadingMessage.test.d.ts +1 -0
  283. package/dist/esm/LoadingMessage/LoadingMessage.test.js +15 -0
  284. package/dist/esm/LoadingMessage/index.d.ts +2 -0
  285. package/dist/esm/LoadingMessage/index.js +2 -0
  286. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.d.ts +4 -0
  287. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +56 -0
  288. package/dist/esm/Message/ListMessage/ListItemMessage.d.ts +4 -0
  289. package/dist/esm/Message/ListMessage/ListItemMessage.js +7 -0
  290. package/dist/esm/Message/ListMessage/OrderedListMessage.d.ts +4 -0
  291. package/dist/esm/Message/ListMessage/OrderedListMessage.js +8 -0
  292. package/dist/esm/Message/ListMessage/UnorderedListMessage.d.ts +4 -0
  293. package/dist/esm/Message/ListMessage/UnorderedListMessage.js +8 -0
  294. package/dist/esm/Message/Message.d.ts +65 -0
  295. package/dist/esm/Message/Message.js +62 -0
  296. package/dist/esm/Message/Message.test.d.ts +1 -0
  297. package/dist/esm/Message/Message.test.js +234 -0
  298. package/dist/esm/Message/MessageLoading.d.ts +5 -0
  299. package/dist/esm/Message/MessageLoading.js +8 -0
  300. package/dist/esm/Message/TextMessage/TextMessage.d.ts +4 -0
  301. package/dist/esm/Message/TextMessage/TextMessage.js +22 -0
  302. package/dist/esm/Message/index.d.ts +2 -0
  303. package/dist/esm/Message/index.js +2 -0
  304. package/dist/esm/MessageBar/AttachButton.d.ts +21 -0
  305. package/dist/esm/MessageBar/AttachButton.js +32 -0
  306. package/dist/esm/MessageBar/AttachButton.test.d.ts +1 -0
  307. package/dist/esm/MessageBar/AttachButton.test.js +61 -0
  308. package/dist/esm/MessageBar/MessageBar.d.ts +71 -0
  309. package/dist/esm/MessageBar/MessageBar.js +105 -0
  310. package/dist/esm/MessageBar/MessageBar.test.d.ts +1 -0
  311. package/dist/esm/MessageBar/MessageBar.test.js +232 -0
  312. package/dist/esm/MessageBar/MicrophoneButton.d.ts +21 -0
  313. package/dist/esm/MessageBar/MicrophoneButton.js +67 -0
  314. package/dist/esm/MessageBar/SendButton.d.ts +14 -0
  315. package/dist/esm/MessageBar/SendButton.js +25 -0
  316. package/dist/esm/MessageBar/SendButton.test.d.ts +1 -0
  317. package/dist/esm/MessageBar/SendButton.test.js +49 -0
  318. package/dist/esm/MessageBar/StopButton.d.ts +14 -0
  319. package/dist/esm/MessageBar/StopButton.js +25 -0
  320. package/dist/esm/MessageBar/StopButton.test.d.ts +1 -0
  321. package/dist/esm/MessageBar/StopButton.test.js +49 -0
  322. package/dist/esm/MessageBar/index.d.ts +5 -0
  323. package/dist/esm/MessageBar/index.js +5 -0
  324. package/dist/esm/MessageBox/JumpButton.d.ts +11 -0
  325. package/dist/esm/MessageBox/JumpButton.js +12 -0
  326. package/dist/esm/MessageBox/JumpButton.test.d.ts +1 -0
  327. package/dist/esm/MessageBox/JumpButton.test.js +34 -0
  328. package/dist/esm/MessageBox/MessageBox.d.ts +17 -0
  329. package/dist/esm/MessageBox/MessageBox.js +68 -0
  330. package/dist/esm/MessageBox/index.d.ts +3 -0
  331. package/dist/esm/MessageBox/index.js +3 -0
  332. package/dist/esm/PreviewAttachment/PreviewAttachment.d.ts +22 -0
  333. package/dist/esm/PreviewAttachment/PreviewAttachment.js +18 -0
  334. package/dist/esm/PreviewAttachment/index.d.ts +2 -0
  335. package/dist/esm/PreviewAttachment/index.js +2 -0
  336. package/dist/esm/ResponseActions/ResponseActionButton.d.ts +20 -0
  337. package/dist/esm/ResponseActions/ResponseActionButton.js +5 -0
  338. package/dist/esm/ResponseActions/ResponseActions.d.ts +30 -0
  339. package/dist/esm/ResponseActions/ResponseActions.js +29 -0
  340. package/dist/esm/ResponseActions/ResponseActions.test.d.ts +1 -0
  341. package/dist/esm/ResponseActions/ResponseActions.test.js +62 -0
  342. package/dist/esm/ResponseActions/index.d.ts +2 -0
  343. package/dist/esm/ResponseActions/index.js +2 -0
  344. package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.d.ts +11 -0
  345. package/dist/esm/SourceDetailsMenuItem/SourceDetailsMenuItem.js +24 -0
  346. package/dist/esm/SourceDetailsMenuItem/index.d.ts +2 -0
  347. package/dist/esm/SourceDetailsMenuItem/index.js +2 -0
  348. package/dist/esm/SourcesCard/SourcesCard.d.ts +34 -0
  349. package/dist/esm/SourcesCard/SourcesCard.js +63 -0
  350. package/dist/esm/SourcesCard/SourcesCard.test.d.ts +1 -0
  351. package/dist/esm/SourcesCard/SourcesCard.test.js +162 -0
  352. package/dist/esm/SourcesCard/index.d.ts +2 -0
  353. package/dist/esm/SourcesCard/index.js +2 -0
  354. package/dist/esm/index.d.ts +48 -0
  355. package/dist/esm/index.js +49 -0
  356. package/dist/tsconfig.tsbuildinfo +1 -0
  357. package/generate-fed-package-json.js +75 -0
  358. package/generate-index.js +42 -0
  359. package/package.json +79 -0
  360. package/patternfly-a11y.config.js +28 -0
  361. package/patternfly-docs/content/extensions/chatbot/about-chatbot.md +29 -0
  362. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachMenu.tsx +149 -0
  363. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentEdit.tsx +26 -0
  364. package/patternfly-docs/content/extensions/chatbot/examples/Messages/AttachmentError.tsx +13 -0
  365. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +87 -0
  366. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetails.tsx +4 -0
  367. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +54 -0
  368. package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDropZone.tsx +60 -0
  369. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithAttachment.tsx +75 -0
  370. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithCustomResponseActions.tsx +39 -0
  371. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +44 -0
  372. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithResponseActions.tsx +25 -0
  373. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +118 -0
  374. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +171 -0
  375. package/patternfly-docs/content/extensions/chatbot/examples/Messages/PaperclipIcon.svg +10 -0
  376. package/patternfly-docs/content/extensions/chatbot/examples/Messages/PreviewAttachment.tsx +25 -0
  377. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +37 -0
  378. package/patternfly-docs/content/extensions/chatbot/examples/Messages/patternfly_avatar.jpg +0 -0
  379. package/patternfly-docs/content/extensions/chatbot/examples/Messages/user_avatar.jpg +0 -0
  380. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotContainer.tsx +66 -0
  381. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFooter.tsx +14 -0
  382. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotFootnote.tsx +26 -0
  383. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderBasic.tsx +189 -0
  384. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +93 -0
  385. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx +75 -0
  386. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderTitle.tsx +50 -0
  387. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBar.tsx +8 -0
  388. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx +148 -0
  389. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarStop.tsx +10 -0
  390. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotModal.tsx +84 -0
  391. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotToggleBasic.tsx +13 -0
  392. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomeInteraction.tsx +144 -0
  393. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotWelcomePrompt.tsx +38 -0
  394. package/patternfly-docs/content/extensions/chatbot/examples/UI/CustomClosedIcon.tsx +89 -0
  395. package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-HorizontalLogo-Color.svg +29 -0
  396. package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-HorizontalLogo-Reverse.svg +28 -0
  397. package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-IconLogo-Color.svg +17 -0
  398. package/patternfly-docs/content/extensions/chatbot/examples/UI/PF-IconLogo-Reverse.svg +16 -0
  399. package/patternfly-docs/content/extensions/chatbot/examples/UI/SkipToContent.tsx +40 -0
  400. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +336 -0
  401. package/patternfly-docs/content/extensions/chatbot/examples/demos/AttachmentDemos.md +99 -0
  402. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.md +105 -0
  403. package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +473 -0
  404. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +278 -0
  405. package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +268 -0
  406. package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +437 -0
  407. package/patternfly-docs/pages/index.js +27 -0
  408. package/patternfly-docs/patternfly-docs.config.js +8 -0
  409. package/patternfly-docs/patternfly-docs.css.js +9 -0
  410. package/patternfly-docs/patternfly-docs.routes.js +12 -0
  411. package/patternfly-docs/patternfly-docs.source.js +24 -0
  412. package/release.config.js +18 -0
  413. package/src/AttachMenu/AttachMenu.scss +62 -0
  414. package/src/AttachMenu/AttachMenu.tsx +81 -0
  415. package/src/AttachMenu/index.ts +3 -0
  416. package/src/AttachmentEdit/AttachmentEdit.tsx +63 -0
  417. package/src/AttachmentEdit/index.ts +3 -0
  418. package/src/Chatbot/Chatbot.scss +89 -0
  419. package/src/Chatbot/Chatbot.tsx +81 -0
  420. package/src/Chatbot/index.ts +3 -0
  421. package/src/ChatbotAlert/ChatbotAlert.scss +5 -0
  422. package/src/ChatbotAlert/ChatbotAlert.tsx +32 -0
  423. package/src/ChatbotAlert/index.ts +3 -0
  424. package/src/ChatbotContent/ChatbotContent.scss +23 -0
  425. package/src/ChatbotContent/ChatbotContent.tsx +23 -0
  426. package/src/ChatbotContent/index.ts +3 -0
  427. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.tsx +62 -0
  428. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +166 -0
  429. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +217 -0
  430. package/src/ChatbotConversationHistoryNav/index.ts +4 -0
  431. package/src/ChatbotFooter/ChatbotFooter.scss +54 -0
  432. package/src/ChatbotFooter/ChatbotFooter.tsx +33 -0
  433. package/src/ChatbotFooter/ChatbotFootnote.scss +12 -0
  434. package/src/ChatbotFooter/ChatbotFootnote.tsx +135 -0
  435. package/src/ChatbotFooter/index.ts +4 -0
  436. package/src/ChatbotHeader/ChatbotHeader.scss +140 -0
  437. package/src/ChatbotHeader/ChatbotHeader.tsx +22 -0
  438. package/src/ChatbotHeader/ChatbotHeaderActions.tsx +15 -0
  439. package/src/ChatbotHeader/ChatbotHeaderMain.tsx +15 -0
  440. package/src/ChatbotHeader/ChatbotHeaderMenu.tsx +48 -0
  441. package/src/ChatbotHeader/ChatbotHeaderOptionsDropdown.tsx +73 -0
  442. package/src/ChatbotHeader/ChatbotHeaderSelectorDropdown.tsx +68 -0
  443. package/src/ChatbotHeader/ChatbotHeaderTitle.tsx +57 -0
  444. package/src/ChatbotHeader/index.ts +9 -0
  445. package/src/ChatbotModal/ChatbotModal.scss +93 -0
  446. package/src/ChatbotModal/ChatbotModal.tsx +43 -0
  447. package/src/ChatbotModal/index.ts +3 -0
  448. package/src/ChatbotPopover/ChatbotPopover.scss +27 -0
  449. package/src/ChatbotPopover/ChatbotPopover.tsx +15 -0
  450. package/src/ChatbotPopover/index.ts +3 -0
  451. package/src/ChatbotToggle/ChatbotToggle.scss +26 -0
  452. package/src/ChatbotToggle/ChatbotToggle.tsx +80 -0
  453. package/src/ChatbotToggle/index.ts +3 -0
  454. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.scss +48 -0
  455. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.tsx +64 -0
  456. package/src/ChatbotWelcomePrompt/ChatbotWelcomePrompt.tsx +66 -0
  457. package/src/ChatbotWelcomePrompt/__snapshots__/ChatbotWelcomePrompt.test.tsx.snap +29 -0
  458. package/src/ChatbotWelcomePrompt/index.ts +3 -0
  459. package/src/CodeModal/CodeModal.scss +76 -0
  460. package/src/CodeModal/CodeModal.tsx +153 -0
  461. package/src/CodeModal/index.ts +3 -0
  462. package/src/FileDetails/FileDetails.scss +25 -0
  463. package/src/FileDetails/FileDetails.test.tsx +23 -0
  464. package/src/FileDetails/FileDetails.tsx +990 -0
  465. package/src/FileDetails/__snapshots__/FileDetails.test.tsx.snap +74 -0
  466. package/src/FileDetails/index.ts +2 -0
  467. package/src/FileDetailsLabel/FileDetailsLabel.scss +66 -0
  468. package/src/FileDetailsLabel/FileDetailsLabel.test.tsx +48 -0
  469. package/src/FileDetailsLabel/FileDetailsLabel.tsx +66 -0
  470. package/src/FileDetailsLabel/__snapshots__/FileDetailsLabel.test.tsx.snap +90 -0
  471. package/src/FileDetailsLabel/index.ts +2 -0
  472. package/src/FileDropZone/FileDropZone.scss +36 -0
  473. package/src/FileDropZone/FileDropZone.test.tsx +15 -0
  474. package/src/FileDropZone/FileDropZone.tsx +56 -0
  475. package/src/FileDropZone/__snapshots__/FileDropZone.test.tsx.snap +18 -0
  476. package/src/FileDropZone/index.ts +3 -0
  477. package/src/LoadingMessage/LoadingMessage.test.tsx +16 -0
  478. package/src/LoadingMessage/LoadingMessage.tsx +27 -0
  479. package/src/LoadingMessage/__snapshots__/LoadingMessage.test.tsx.snap +52 -0
  480. package/src/LoadingMessage/index.ts +3 -0
  481. package/src/Message/CodeBlockMessage/CodeBlockMessage.scss +82 -0
  482. package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +88 -0
  483. package/src/Message/ListMessage/ListItemMessage.tsx +11 -0
  484. package/src/Message/ListMessage/ListMessage.scss +25 -0
  485. package/src/Message/ListMessage/OrderedListMessage.tsx +17 -0
  486. package/src/Message/ListMessage/UnorderedListMessage.tsx +15 -0
  487. package/src/Message/Message.scss +118 -0
  488. package/src/Message/Message.test.tsx +281 -0
  489. package/src/Message/Message.tsx +181 -0
  490. package/src/Message/MessageLoading.scss +53 -0
  491. package/src/Message/MessageLoading.tsx +15 -0
  492. package/src/Message/TextMessage/TextMessage.scss +51 -0
  493. package/src/Message/TextMessage/TextMessage.tsx +17 -0
  494. package/src/Message/index.ts +3 -0
  495. package/src/MessageBar/AttachButton.scss +20 -0
  496. package/src/MessageBar/AttachButton.test.tsx +53 -0
  497. package/src/MessageBar/AttachButton.tsx +81 -0
  498. package/src/MessageBar/MessageBar.scss +77 -0
  499. package/src/MessageBar/MessageBar.test.tsx +318 -0
  500. package/src/MessageBar/MessageBar.tsx +252 -0
  501. package/src/MessageBar/MicrophoneButton.scss +48 -0
  502. package/src/MessageBar/MicrophoneButton.tsx +114 -0
  503. package/src/MessageBar/SendButton.scss +29 -0
  504. package/src/MessageBar/SendButton.test.tsx +43 -0
  505. package/src/MessageBar/SendButton.tsx +54 -0
  506. package/src/MessageBar/StopButton.scss +22 -0
  507. package/src/MessageBar/StopButton.test.tsx +42 -0
  508. package/src/MessageBar/StopButton.tsx +57 -0
  509. package/src/MessageBar/index.ts +6 -0
  510. package/src/MessageBox/JumpButton.scss +46 -0
  511. package/src/MessageBox/JumpButton.test.tsx +26 -0
  512. package/src/MessageBox/JumpButton.tsx +37 -0
  513. package/src/MessageBox/MessageBox.scss +36 -0
  514. package/src/MessageBox/MessageBox.tsx +114 -0
  515. package/src/MessageBox/index.ts +4 -0
  516. package/src/PreviewAttachment/PreviewAttachment.tsx +67 -0
  517. package/src/PreviewAttachment/index.ts +3 -0
  518. package/src/ResponseActions/ResponseActionButton.tsx +56 -0
  519. package/src/ResponseActions/ResponseActions.scss +26 -0
  520. package/src/ResponseActions/ResponseActions.test.tsx +59 -0
  521. package/src/ResponseActions/ResponseActions.tsx +115 -0
  522. package/src/ResponseActions/index.ts +3 -0
  523. package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.scss +33 -0
  524. package/src/SourceDetailsMenuItem/SourceDetailsMenuItem.tsx +36 -0
  525. package/src/SourceDetailsMenuItem/index.ts +2 -0
  526. package/src/SourcesCard/SourcesCard.scss +74 -0
  527. package/src/SourcesCard/SourcesCard.test.tsx +238 -0
  528. package/src/SourcesCard/SourcesCard.tsx +159 -0
  529. package/src/SourcesCard/__snapshots__/SourcesCard.test.tsx.snap +34 -0
  530. package/src/SourcesCard/index.ts +3 -0
  531. package/src/index.ts +73 -0
  532. package/src/main.scss +89 -0
  533. package/tsconfig.cjs.json +8 -0
  534. package/tsconfig.json +73 -0
@@ -0,0 +1,68 @@
1
+ // ============================================================================
2
+ // Chatbot Main - Messages
3
+ // ============================================================================
4
+ import React from 'react';
5
+ import JumpButton from './JumpButton';
6
+ const MessageBoxBase = ({ announcement, ariaLabel = 'Scrollable message log', children, innerRef, className, position = 'top' }) => {
7
+ const [atTop, setAtTop] = React.useState(false);
8
+ const [atBottom, setAtBottom] = React.useState(true);
9
+ const [isOverflowing, setIsOverflowing] = React.useState(false);
10
+ const defaultRef = React.useRef(null);
11
+ let messageBoxRef;
12
+ if (innerRef) {
13
+ messageBoxRef = innerRef;
14
+ }
15
+ else {
16
+ messageBoxRef = defaultRef;
17
+ }
18
+ // Configure handlers
19
+ const handleScroll = React.useCallback(() => {
20
+ const element = messageBoxRef.current;
21
+ if (element) {
22
+ const { scrollTop, scrollHeight, clientHeight } = element;
23
+ setAtTop(scrollTop === 0);
24
+ setAtBottom(Math.round(scrollTop) + Math.round(clientHeight) >= Math.round(scrollHeight) - 1); // rounding means it could be within a pixel of the bottom
25
+ }
26
+ }, []);
27
+ const checkOverflow = React.useCallback(() => {
28
+ const element = messageBoxRef.current;
29
+ if (element) {
30
+ const { scrollHeight, clientHeight } = element;
31
+ setIsOverflowing(scrollHeight >= clientHeight);
32
+ }
33
+ }, []);
34
+ const scrollToTop = React.useCallback(() => {
35
+ const element = messageBoxRef.current;
36
+ if (element) {
37
+ element.scrollTo({ top: 0, behavior: 'smooth' });
38
+ }
39
+ }, []);
40
+ const scrollToBottom = React.useCallback(() => {
41
+ const element = messageBoxRef.current;
42
+ if (element) {
43
+ element.scrollTo({ top: element.scrollHeight, behavior: 'smooth' });
44
+ }
45
+ }, []);
46
+ // Detect scroll position
47
+ React.useEffect(() => {
48
+ const element = messageBoxRef.current;
49
+ if (element) {
50
+ // Listen for scroll events
51
+ element.addEventListener('scroll', handleScroll);
52
+ // Check initial position and overflow
53
+ handleScroll();
54
+ checkOverflow();
55
+ return () => {
56
+ element.removeEventListener('scroll', handleScroll);
57
+ };
58
+ }
59
+ }, [checkOverflow, handleScroll]);
60
+ return (React.createElement(React.Fragment, null,
61
+ React.createElement(JumpButton, { position: "top", isHidden: isOverflowing && atTop, onClick: scrollToTop }),
62
+ React.createElement("div", { role: "region", tabIndex: 0, "aria-label": ariaLabel, className: `pf-chatbot__messagebox ${position === 'bottom' && 'pf-chatbot__messagebox--bottom'} ${className !== null && className !== void 0 ? className : ''}`, ref: innerRef !== null && innerRef !== void 0 ? innerRef : messageBoxRef },
63
+ children,
64
+ React.createElement("div", { className: "pf-chatbot__messagebox-announcement", "aria-live": "polite" }, announcement)),
65
+ React.createElement(JumpButton, { position: "bottom", isHidden: isOverflowing && atBottom, onClick: scrollToBottom })));
66
+ };
67
+ export const MessageBox = React.forwardRef((props, ref) => (React.createElement(MessageBoxBase, Object.assign({ innerRef: ref }, props))));
68
+ export default MessageBox;
@@ -0,0 +1,3 @@
1
+ export { default } from './MessageBox';
2
+ export * from './MessageBox';
3
+ export * from './JumpButton';
@@ -0,0 +1,3 @@
1
+ export { default } from './MessageBox';
2
+ export * from './MessageBox';
3
+ export * from './JumpButton';
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { ChatbotDisplayMode } from '../Chatbot';
3
+ export interface PreviewAttachmentProps {
4
+ /** Text shown in code editor */
5
+ code: string;
6
+ /** Filename, including extension, of file shown in modal */
7
+ fileName: string;
8
+ /** Function called when edit button is clicked */
9
+ onEdit: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
10
+ /** Function called when dismiss button is clicked */
11
+ onDismiss?: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
12
+ /** Function called when modal is toggled */
13
+ handleModalToggle: (event: React.MouseEvent | MouseEvent | KeyboardEvent) => void;
14
+ /** Whether modal is open */
15
+ isModalOpen: boolean;
16
+ /** Title of modal */
17
+ title?: string;
18
+ /** Display mode for the Chatbot parent; this influences the styles applied */
19
+ displayMode?: ChatbotDisplayMode;
20
+ }
21
+ export declare const PreviewAttachment: React.FunctionComponent<PreviewAttachmentProps>;
22
+ export default PreviewAttachment;
@@ -0,0 +1,18 @@
1
+ // ============================================================================
2
+ // Preview Attachment - Chatbot Code Snippet Viewer
3
+ // ============================================================================
4
+ import React from 'react';
5
+ import CodeModal from '../CodeModal';
6
+ import { ChatbotDisplayMode } from '../Chatbot';
7
+ export const PreviewAttachment = ({ fileName, code, handleModalToggle, isModalOpen, onDismiss = undefined, onEdit, title = 'Preview attachment', displayMode = ChatbotDisplayMode.default }) => {
8
+ const handleEdit = (_event) => {
9
+ handleModalToggle(_event);
10
+ onEdit(_event);
11
+ };
12
+ const handleDismiss = (_event) => {
13
+ handleModalToggle(_event);
14
+ onDismiss && onDismiss(_event);
15
+ };
16
+ return (React.createElement(CodeModal, { codeEditorControlClassName: "pf-chatbot__code-modal--controls", code: code, fileName: fileName, handleModalToggle: handleModalToggle, isCopyEnabled: true, isLineNumbersVisible: false, isModalOpen: isModalOpen, onPrimaryAction: handleEdit, onSecondaryAction: handleDismiss, primaryActionBtn: "Edit", secondaryActionBtn: "Dismiss", title: title, isReadOnly: true, displayMode: displayMode }));
17
+ };
18
+ export default PreviewAttachment;
@@ -0,0 +1,2 @@
1
+ export { default } from './PreviewAttachment';
2
+ export * from './PreviewAttachment';
@@ -0,0 +1,2 @@
1
+ export { default } from './PreviewAttachment';
2
+ export * from './PreviewAttachment';
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { TooltipProps } from '@patternfly/react-core';
3
+ export interface ResponseActionButtonProps {
4
+ /** Aria-label for the button. Defaults to the value of the tooltipContent if none provided */
5
+ ariaLabel?: string;
6
+ /** Icon for the button */
7
+ icon: React.ReactNode;
8
+ /** On-click handler for the button */
9
+ onClick?: ((event: MouseEvent | React.MouseEvent<Element, MouseEvent> | KeyboardEvent) => void) | undefined;
10
+ /** Class name for the button */
11
+ className?: string;
12
+ /** Props to control if the attach button should be disabled */
13
+ isDisabled?: boolean;
14
+ /** Content shown in the tooltip */
15
+ tooltipContent?: string;
16
+ /** Props to control the PF Tooltip component */
17
+ tooltipProps?: TooltipProps;
18
+ }
19
+ export declare const ResponseActionButton: React.FunctionComponent<ResponseActionButtonProps>;
20
+ export default ResponseActionButton;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { Button, Icon, Tooltip } from '@patternfly/react-core';
3
+ export const ResponseActionButton = ({ ariaLabel, className, icon, isDisabled, onClick, tooltipContent, tooltipProps }) => (React.createElement(Tooltip, Object.assign({ id: `pf-chatbot__tooltip-response-action-${tooltipContent}`, content: tooltipContent, position: "bottom", entryDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.entryDelay) || 0, exitDelay: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.exitDelay) || 0, distance: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.distance) || 8, animationDuration: (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.animationDuration) || 0 }, tooltipProps),
4
+ React.createElement(Button, { variant: "plain", className: `pf-chatbot__button--response-action ${className !== null && className !== void 0 ? className : ''}`, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : tooltipContent, icon: React.createElement(Icon, { isInline: true, size: "lg" }, icon), isDisabled: isDisabled, onClick: onClick, size: "sm" })));
5
+ export default ResponseActionButton;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { TooltipProps } from '@patternfly/react-core';
3
+ export interface ActionProps {
4
+ /** Aria-label for the button */
5
+ ariaLabel?: string;
6
+ /** On-click handler for the button */
7
+ onClick?: ((event: MouseEvent | React.MouseEvent<Element, MouseEvent> | KeyboardEvent) => void) | undefined;
8
+ /** Class name for the button */
9
+ className?: string;
10
+ /** Props to control if the attach button should be disabled */
11
+ isDisabled?: boolean;
12
+ /** Content shown in the tooltip */
13
+ tooltipContent?: string;
14
+ /** Props to control the PF Tooltip component */
15
+ tooltipProps?: TooltipProps;
16
+ /** Icon for custom response action */
17
+ icon?: React.ReactNode;
18
+ }
19
+ export interface ResponseActionProps {
20
+ /** Props for message actions, such as feedback (positive or negative), copy button, share, and listen */
21
+ actions: Record<string, ActionProps | undefined> & {
22
+ positive?: ActionProps;
23
+ negative?: ActionProps;
24
+ copy?: ActionProps;
25
+ share?: ActionProps;
26
+ listen?: ActionProps;
27
+ };
28
+ }
29
+ export declare const ResponseActions: React.FunctionComponent<ResponseActionProps>;
30
+ export default ResponseActions;
@@ -0,0 +1,29 @@
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 React from 'react';
13
+ import { ExternalLinkAltIcon, VolumeUpIcon, OutlinedThumbsUpIcon, OutlinedThumbsDownIcon, OutlinedCopyIcon } from '@patternfly/react-icons';
14
+ import ResponseActionButton from './ResponseActionButton';
15
+ export const ResponseActions = ({ actions }) => {
16
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
17
+ const { positive, negative, copy, share, listen } = actions, additionalActions = __rest(actions, ["positive", "negative", "copy", "share", "listen"]);
18
+ return (React.createElement("div", { className: "pf-chatbot__response-actions" },
19
+ positive && (React.createElement(ResponseActionButton, { ariaLabel: (_a = positive.ariaLabel) !== null && _a !== void 0 ? _a : 'Good response', onClick: positive.onClick, className: positive.className, isDisabled: positive.isDisabled, tooltipContent: (_b = positive.tooltipContent) !== null && _b !== void 0 ? _b : 'Good response', tooltipProps: positive.tooltipProps, icon: React.createElement(OutlinedThumbsUpIcon, null) })),
20
+ negative && (React.createElement(ResponseActionButton, { ariaLabel: (_c = negative.ariaLabel) !== null && _c !== void 0 ? _c : 'Bad response', onClick: negative.onClick, className: negative.className, isDisabled: negative.isDisabled, tooltipContent: (_d = negative.tooltipContent) !== null && _d !== void 0 ? _d : 'Bad response', tooltipProps: negative.tooltipProps, icon: React.createElement(OutlinedThumbsDownIcon, null) })),
21
+ copy && (React.createElement(ResponseActionButton, { ariaLabel: (_e = copy.ariaLabel) !== null && _e !== void 0 ? _e : 'Copy', onClick: copy.onClick, className: copy.className, isDisabled: copy.isDisabled, tooltipContent: (_f = copy.tooltipContent) !== null && _f !== void 0 ? _f : 'Copy', tooltipProps: copy.tooltipProps, icon: React.createElement(OutlinedCopyIcon, null) })),
22
+ share && (React.createElement(ResponseActionButton, { ariaLabel: (_g = share.ariaLabel) !== null && _g !== void 0 ? _g : 'Share', onClick: share.onClick, className: share.className, isDisabled: share.isDisabled, tooltipContent: (_h = share.tooltipContent) !== null && _h !== void 0 ? _h : 'Share', tooltipProps: share.tooltipProps, icon: React.createElement(ExternalLinkAltIcon, null) })),
23
+ listen && (React.createElement(ResponseActionButton, { ariaLabel: (_j = listen.ariaLabel) !== null && _j !== void 0 ? _j : 'Listen', onClick: listen.onClick, className: listen.className, isDisabled: listen.isDisabled, tooltipContent: (_k = listen.tooltipContent) !== null && _k !== void 0 ? _k : 'Listen', tooltipProps: listen.tooltipProps, icon: React.createElement(VolumeUpIcon, null) })),
24
+ Object.keys(additionalActions).map((action) => {
25
+ var _a, _b, _c, _d, _e, _f, _g;
26
+ return (React.createElement(ResponseActionButton, { key: action, ariaLabel: (_a = additionalActions[action]) === null || _a === void 0 ? void 0 : _a.ariaLabel, onClick: (_b = additionalActions[action]) === null || _b === void 0 ? void 0 : _b.onClick, className: (_c = additionalActions[action]) === null || _c === void 0 ? void 0 : _c.className, isDisabled: (_d = additionalActions[action]) === null || _d === void 0 ? void 0 : _d.isDisabled, tooltipContent: (_e = additionalActions[action]) === null || _e === void 0 ? void 0 : _e.tooltipContent, tooltipProps: (_f = additionalActions[action]) === null || _f === void 0 ? void 0 : _f.tooltipProps, icon: (_g = additionalActions[action]) === null || _g === void 0 ? void 0 : _g.icon }));
27
+ })));
28
+ };
29
+ export default ResponseActions;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,62 @@
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 React from 'react';
11
+ import { render, screen } from '@testing-library/react';
12
+ import '@testing-library/jest-dom';
13
+ import ResponseActions from './ResponseActions';
14
+ import userEvent from '@testing-library/user-event';
15
+ const ALL_ACTIONS = [
16
+ { type: 'positive', label: 'Good response' },
17
+ { type: 'negative', label: 'Bad response' },
18
+ { type: 'copy', label: 'Copy' },
19
+ { type: 'share', label: 'Share' },
20
+ { type: 'listen', label: 'Listen' }
21
+ ];
22
+ describe('ResponseActions', () => {
23
+ it('should render buttons correctly', () => {
24
+ ALL_ACTIONS.forEach(({ type, label }) => {
25
+ render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
26
+ expect(screen.getByRole('button', { name: label })).toBeTruthy();
27
+ });
28
+ });
29
+ it('should be able to call onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
30
+ ALL_ACTIONS.forEach((_a) => __awaiter(void 0, [_a], void 0, function* ({ type, label }) {
31
+ const spy = jest.fn();
32
+ render(React.createElement(ResponseActions, { actions: { [type]: { onClick: spy } } }));
33
+ yield userEvent.click(screen.getByRole('button', { name: label }));
34
+ expect(spy).toHaveBeenCalledTimes(1);
35
+ }));
36
+ }));
37
+ it('should be able to change aria labels', () => {
38
+ const actions = [
39
+ { type: 'positive', ariaLabel: 'Thumbs up' },
40
+ { type: 'negative', ariaLabel: 'Thumbs down' },
41
+ { type: 'copy', ariaLabel: 'Copy the message' },
42
+ { type: 'share', ariaLabel: 'Share it with friends' },
43
+ { type: 'listen', ariaLabel: 'Listen up' }
44
+ ];
45
+ actions.forEach(({ type, ariaLabel }) => {
46
+ render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn(), ariaLabel } } }));
47
+ expect(screen.getByRole('button', { name: ariaLabel })).toBeTruthy();
48
+ });
49
+ });
50
+ it('should be able to disable buttons', () => {
51
+ ALL_ACTIONS.forEach(({ type, label }) => {
52
+ render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn(), isDisabled: true } } }));
53
+ expect(screen.getByRole('button', { name: label })).toBeDisabled();
54
+ });
55
+ });
56
+ it('should be able to add class to buttons', () => {
57
+ ALL_ACTIONS.forEach(({ type, label }) => {
58
+ render(React.createElement(ResponseActions, { actions: { [type]: { onClick: jest.fn(), className: 'test' } } }));
59
+ expect(screen.getByRole('button', { name: label })).toHaveClass('test');
60
+ });
61
+ });
62
+ });
@@ -0,0 +1,2 @@
1
+ export { default } from './ResponseActions';
2
+ export * from './ResponseActions';
@@ -0,0 +1,2 @@
1
+ export { default } from './ResponseActions';
2
+ export * from './ResponseActions';
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export interface SourceDetailsMenuItemProps extends React.HTMLProps<HTMLDivElement> {
3
+ /** Icon */
4
+ icon: React.ReactNode;
5
+ /** Name of source */
6
+ name: string;
7
+ /** Description of source */
8
+ type?: string;
9
+ }
10
+ export declare const SourceDetailsMenuItem: React.FunctionComponent<SourceDetailsMenuItemProps>;
11
+ export default SourceDetailsMenuItem;
@@ -0,0 +1,24 @@
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 React from 'react';
13
+ import { Icon, Flex, Stack, StackItem } from '@patternfly/react-core';
14
+ export const SourceDetailsMenuItem = (_a) => {
15
+ var { icon, name, type } = _a, props = __rest(_a, ["icon", "name", "type"]);
16
+ return (React.createElement(Flex, Object.assign({ className: "pf-chatbot__source-details", gap: { default: 'gapSm' } }, props),
17
+ React.createElement(Flex, { justifyContent: { default: 'justifyContentCenter' }, alignItems: { default: 'alignItemsCenter' }, alignSelf: { default: 'alignSelfCenter' } },
18
+ React.createElement(Icon, { className: "pf-chatbot__source-details-icon" }, icon)),
19
+ React.createElement(Stack, { className: "pf-chatbot__source-details-text" },
20
+ React.createElement(StackItem, null,
21
+ React.createElement("span", { className: "pf-chatbot__source-details-heading" }, name)),
22
+ type && React.createElement(StackItem, { className: "pf-chatbot__source-details-subhead" }, type))));
23
+ };
24
+ export default SourceDetailsMenuItem;
@@ -0,0 +1,2 @@
1
+ export { default } from './SourceDetailsMenuItem';
2
+ export * from './SourceDetailsMenuItem';
@@ -0,0 +1,2 @@
1
+ export { default } from './SourceDetailsMenuItem';
2
+ export * from './SourceDetailsMenuItem';
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { CardProps } from '@patternfly/react-core';
3
+ export interface SourcesCardProps extends CardProps {
4
+ /** Additional classes for the pagination navigation container. */
5
+ className?: string;
6
+ /** Flag indicating if the pagination is disabled. */
7
+ isDisabled?: boolean;
8
+ /** Label for the English word "of". */
9
+ ofWord?: string;
10
+ /** Accessible label for the pagination component. */
11
+ paginationAriaLabel?: string;
12
+ /** Content rendered inside the paginated card */
13
+ sources: {
14
+ title?: string;
15
+ link: string;
16
+ body?: React.ReactNode | string;
17
+ }[];
18
+ /** Label for the English word "source" */
19
+ sourceWord?: string;
20
+ /** Plural for sourceWord */
21
+ sourceWordPlural?: string;
22
+ /** Accessible label for the button which moves to the next page. */
23
+ toNextPageAriaLabel?: string;
24
+ /** Accessible label for the button which moves to the previous page. */
25
+ toPreviousPageAriaLabel?: string;
26
+ /** Function called when user clicks to navigate to next page. */
27
+ onNextClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void;
28
+ /** Function called when user clicks to navigate to previous page. */
29
+ onPreviousClick?: (event: React.SyntheticEvent<HTMLButtonElement>, page: number) => void;
30
+ /** Function called when page is changed. */
31
+ onSetPage?: (event: React.MouseEvent | React.KeyboardEvent | MouseEvent, newPage: number) => void;
32
+ }
33
+ declare const SourcesCard: React.FunctionComponent<SourcesCardProps>;
34
+ export default SourcesCard;
@@ -0,0 +1,63 @@
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
+ // ============================================================================
13
+ // Chatbot Main - Messages - Sources Card
14
+ // ============================================================================
15
+ import React from 'react';
16
+ // Import PatternFly components
17
+ import { Button, ButtonVariant, Card, CardBody, CardFooter, CardTitle, Icon, pluralize, Truncate } from '@patternfly/react-core';
18
+ const SourcesCard = (_a) => {
19
+ var { className, isDisabled, ofWord = 'of', paginationAriaLabel = 'Pagination', sources, sourceWord = 'source', sourceWordPlural = 'sources', toNextPageAriaLabel = 'Go to next page', toPreviousPageAriaLabel = 'Go to previous page', onNextClick, onPreviousClick, onSetPage } = _a, props = __rest(_a, ["className", "isDisabled", "ofWord", "paginationAriaLabel", "sources", "sourceWord", "sourceWordPlural", "toNextPageAriaLabel", "toPreviousPageAriaLabel", "onNextClick", "onPreviousClick", "onSetPage"]);
20
+ const [page, setPage] = React.useState(1);
21
+ const handleNewPage = (_evt, newPage) => {
22
+ setPage(newPage);
23
+ onSetPage && onSetPage(_evt, newPage);
24
+ };
25
+ const renderTitle = (title) => {
26
+ if (title) {
27
+ return React.createElement(Truncate, { content: title });
28
+ }
29
+ return `Source ${page}`;
30
+ };
31
+ return (React.createElement("div", { className: "pf-chatbot__source" },
32
+ React.createElement("span", null, pluralize(sources.length, sourceWord, sourceWordPlural)),
33
+ React.createElement(Card, Object.assign({ className: "pf-chatbot__sources-card" }, props),
34
+ React.createElement(CardTitle, { className: "pf-chatbot__sources-card-title" },
35
+ React.createElement("a", { href: sources[page - 1].link }, renderTitle(sources[page - 1].title))),
36
+ sources[page - 1].body && (React.createElement(CardBody, { className: `pf-chatbot__sources-card-body ${sources.length === 1 && 'pf-chatbot__sources-card-no-footer'}` }, sources[page - 1].body)),
37
+ sources.length > 1 && (React.createElement(CardFooter, { className: "pf-chatbot__sources-card-footer-container" },
38
+ React.createElement("div", { className: "pf-chatbot__sources-card-footer" },
39
+ React.createElement("nav", { className: `pf-chatbot__sources-card-footer-buttons ${className}`, "aria-label": paginationAriaLabel },
40
+ React.createElement(Button, { variant: ButtonVariant.plain, isDisabled: isDisabled || page === 1, "data-action": "previous", onClick: (event) => {
41
+ const newPage = page >= 1 ? page - 1 : 1;
42
+ onPreviousClick && onPreviousClick(event, newPage);
43
+ handleNewPage(event, newPage);
44
+ }, "aria-label": toPreviousPageAriaLabel },
45
+ React.createElement(Icon, { iconSize: "lg" },
46
+ React.createElement("svg", { className: "pf-v6-svg", viewBox: "0 0 280 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em" },
47
+ React.createElement("path", { d: "M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z" })))),
48
+ React.createElement(Button, { variant: ButtonVariant.plain, isDisabled: isDisabled || page === sources.length, "aria-label": toNextPageAriaLabel, "data-action": "next", onClick: (event) => {
49
+ const newPage = page + 1 <= sources.length ? page + 1 : sources.length;
50
+ onNextClick && onNextClick(event, newPage);
51
+ handleNewPage(event, newPage);
52
+ } },
53
+ React.createElement(Icon, { isInline: true, iconSize: "lg" },
54
+ React.createElement("svg", { className: "pf-v6-svg", viewBox: "0 0 180 500", fill: "currentColor", "aria-hidden": "true", role: "img", width: "1em", height: "1em" },
55
+ React.createElement("path", { d: "M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z" }))))),
56
+ React.createElement("span", { "aria-hidden": "true" },
57
+ page,
58
+ " ",
59
+ ofWord,
60
+ " ",
61
+ sources.length)))))));
62
+ };
63
+ export default SourcesCard;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,162 @@
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 React from 'react';
11
+ import { render, screen } from '@testing-library/react';
12
+ import userEvent from '@testing-library/user-event';
13
+ import '@testing-library/jest-dom';
14
+ import SourcesCard from './SourcesCard';
15
+ describe('SourcesCard', () => {
16
+ it('should render card', () => {
17
+ const { container } = render(React.createElement(SourcesCard, { sources: [{ link: '' }] }));
18
+ expect(container).toMatchSnapshot();
19
+ });
20
+ it('should render card correctly if one source with only a link is passed in', () => {
21
+ render(React.createElement(SourcesCard, { sources: [{ link: '' }] }));
22
+ expect(screen.getByText('1 source')).toBeTruthy();
23
+ expect(screen.getByText('Source 1')).toBeTruthy();
24
+ // no buttons or navigation when there is only 1 source
25
+ expect(screen.queryByRole('button')).toBeFalsy();
26
+ expect(screen.queryByText('1 of 1')).toBeFalsy();
27
+ });
28
+ it('should render card correctly if one source with a title is passed in', () => {
29
+ render(React.createElement(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }] }));
30
+ expect(screen.getByText('1 source')).toBeTruthy();
31
+ expect(screen.getByText('How to make an apple pie')).toBeTruthy();
32
+ });
33
+ it('should render card correctly if one source with a body is passed in', () => {
34
+ render(React.createElement(SourcesCard, { sources: [{ link: '', body: 'To make an apple pie, you must first...' }] }));
35
+ expect(screen.getByText('1 source')).toBeTruthy();
36
+ expect(screen.getByText('To make an apple pie, you must first...')).toBeTruthy();
37
+ });
38
+ it('should render card correctly if one source with a title and body is passed in', () => {
39
+ render(React.createElement(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '', body: 'To make an apple pie, you must first...' }] }));
40
+ expect(screen.getByText('1 source')).toBeTruthy();
41
+ expect(screen.getByText('How to make an apple pie')).toBeTruthy();
42
+ expect(screen.getByText('To make an apple pie, you must first...')).toBeTruthy();
43
+ });
44
+ it('should render multiple cards correctly', () => {
45
+ render(React.createElement(SourcesCard, { sources: [
46
+ { title: 'How to make an apple pie', link: '' },
47
+ { title: 'How to make cookies', link: '' }
48
+ ] }));
49
+ expect(screen.getByText('2 sources')).toBeTruthy();
50
+ expect(screen.getByText('How to make an apple pie')).toBeTruthy();
51
+ expect(screen.getByText('1 of 2')).toBeTruthy();
52
+ screen.getByRole('button', { name: /Go to previous page/i });
53
+ screen.getByRole('button', { name: /Go to next page/i });
54
+ });
55
+ it('should navigate between cards correctly', () => __awaiter(void 0, void 0, void 0, function* () {
56
+ render(React.createElement(SourcesCard, { sources: [
57
+ { title: 'How to make an apple pie', link: '' },
58
+ { title: 'How to make cookies', link: '' }
59
+ ] }));
60
+ expect(screen.getByText('How to make an apple pie')).toBeTruthy();
61
+ expect(screen.getByText('1 of 2')).toBeTruthy();
62
+ expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeDisabled();
63
+ yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
64
+ expect(screen.queryByText('How to make an apple pie')).toBeFalsy();
65
+ expect(screen.getByText('How to make cookies')).toBeTruthy();
66
+ expect(screen.getByText('2 of 2')).toBeTruthy();
67
+ expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeEnabled();
68
+ expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
69
+ }));
70
+ it('should apply className appropriately', () => {
71
+ render(React.createElement(SourcesCard, { sources: [
72
+ { title: 'How to make an apple pie', link: '' },
73
+ { title: 'How to make cookies', link: '' }
74
+ ], className: "test" }));
75
+ const element = screen.getByRole('navigation');
76
+ expect(element).toHaveClass('test');
77
+ });
78
+ it('should disable pagination appropriately', () => {
79
+ render(React.createElement(SourcesCard, { sources: [
80
+ { title: 'How to make an apple pie', link: '' },
81
+ { title: 'How to make cookies', link: '' }
82
+ ], isDisabled: true }));
83
+ expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeDisabled();
84
+ expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
85
+ });
86
+ it('should change ofWord appropriately', () => {
87
+ render(React.createElement(SourcesCard, { sources: [
88
+ { title: 'How to make an apple pie', link: '' },
89
+ { title: 'How to make cookies', link: '' }
90
+ ], ofWord: 'de' }));
91
+ expect(screen.getByText('1 de 2')).toBeTruthy();
92
+ });
93
+ it('should render navigation aria label appropriately', () => {
94
+ render(React.createElement(SourcesCard, { sources: [
95
+ { title: 'How to make an apple pie', link: '' },
96
+ { title: 'How to make cookies', link: '' }
97
+ ] }));
98
+ expect(screen.getByRole('navigation', { name: /Pagination/i })).toBeTruthy();
99
+ });
100
+ it('should change paginationAriaLabel appropriately', () => {
101
+ render(React.createElement(SourcesCard, { sources: [
102
+ { title: 'How to make an apple pie', link: '' },
103
+ { title: 'How to make cookies', link: '' }
104
+ ], paginationAriaLabel: "Navegaci\u00F3n" }));
105
+ expect(screen.getByRole('navigation', { name: /Navegación/i })).toBeTruthy();
106
+ });
107
+ it('should change sourceWord appropriately', () => {
108
+ render(React.createElement(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }], sourceWord: 'fuente' }));
109
+ expect(screen.getByText('1 fuente')).toBeTruthy();
110
+ });
111
+ it('should sourceWordPlural appropriately', () => {
112
+ render(React.createElement(SourcesCard, { sources: [
113
+ { title: 'How to make an apple pie', link: '' },
114
+ { title: 'How to make cookies', link: '' }
115
+ ], sourceWordPlural: 'fuentes' }));
116
+ expect(screen.getByText('2 fuentes')).toBeTruthy();
117
+ });
118
+ it('should change toNextPageAriaLabel appropriately', () => {
119
+ render(React.createElement(SourcesCard, { sources: [
120
+ { title: 'How to make an apple pie', link: '' },
121
+ { title: 'How to make cookies', link: '' }
122
+ ], toNextPageAriaLabel: "Pase a la siguiente p\u00E1gina" }));
123
+ expect(screen.getByRole('button', { name: /Pase a la siguiente página/i })).toBeTruthy();
124
+ });
125
+ it('should change toPreviousPageAriaLabel appropriately', () => {
126
+ render(React.createElement(SourcesCard, { sources: [
127
+ { title: 'How to make an apple pie', link: '' },
128
+ { title: 'How to make cookies', link: '' }
129
+ ], toPreviousPageAriaLabel: "Presione para regresar a la p\u00E1gina anterior" }));
130
+ expect(screen.getByRole('button', { name: /Presione para regresar a la página anterior/i })).toBeTruthy();
131
+ });
132
+ it('should call onNextClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
133
+ const spy = jest.fn();
134
+ render(React.createElement(SourcesCard, { sources: [
135
+ { title: 'How to make an apple pie', link: '' },
136
+ { title: 'How to make cookies', link: '' }
137
+ ], onNextClick: spy }));
138
+ yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
139
+ expect(spy).toHaveBeenCalled();
140
+ }));
141
+ it('should call onPreviousClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
142
+ const spy = jest.fn();
143
+ render(React.createElement(SourcesCard, { sources: [
144
+ { title: 'How to make an apple pie', link: '' },
145
+ { title: 'How to make cookies', link: '' }
146
+ ], onPreviousClick: spy }));
147
+ yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
148
+ yield userEvent.click(screen.getByRole('button', { name: /Go to previous page/i }));
149
+ expect(spy).toHaveBeenCalled();
150
+ }));
151
+ it('should call onSetPage appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
152
+ const spy = jest.fn();
153
+ render(React.createElement(SourcesCard, { sources: [
154
+ { title: 'How to make an apple pie', link: '' },
155
+ { title: 'How to make cookies', link: '' }
156
+ ], onSetPage: spy }));
157
+ yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
158
+ expect(spy).toHaveBeenCalledTimes(1);
159
+ yield userEvent.click(screen.getByRole('button', { name: /Go to previous page/i }));
160
+ expect(spy).toHaveBeenCalledTimes(2);
161
+ }));
162
+ });
@@ -0,0 +1,2 @@
1
+ export { default } from './SourcesCard';
2
+ export * from './SourcesCard';
@@ -0,0 +1,2 @@
1
+ export { default } from './SourcesCard';
2
+ export * from './SourcesCard';