@stack-spot/ai-chat-widget 1.37.0-beta.1 → 2.0.0-betacitric.2

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 (356) hide show
  1. package/CHANGELOG.md +1 -71
  2. package/dist/StackspotAIWidget.d.ts +6 -2
  3. package/dist/StackspotAIWidget.d.ts.map +1 -1
  4. package/dist/StackspotAIWidget.js +7 -8
  5. package/dist/StackspotAIWidget.js.map +1 -1
  6. package/dist/app-metadata.json +13 -17
  7. package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
  8. package/dist/chat-interceptors/quick-commands.js +3 -9
  9. package/dist/chat-interceptors/quick-commands.js.map +1 -1
  10. package/dist/components/AdaptiveTextArea.d.ts +1 -1
  11. package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
  12. package/dist/components/AdaptiveTextArea.js +1 -1
  13. package/dist/components/AdaptiveTextArea.js.map +1 -1
  14. package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -1
  15. package/dist/components/AgentCard/AgentCardCreate.js +4 -5
  16. package/dist/components/AgentCard/AgentCardCreate.js.map +1 -1
  17. package/dist/components/AgentCard/index.d.ts.map +1 -1
  18. package/dist/components/AgentCard/index.js +5 -6
  19. package/dist/components/AgentCard/index.js.map +1 -1
  20. package/dist/components/ButtonFavorite.d.ts +8 -7
  21. package/dist/components/ButtonFavorite.d.ts.map +1 -1
  22. package/dist/components/ButtonFavorite.js +5 -14
  23. package/dist/components/ButtonFavorite.js.map +1 -1
  24. package/dist/components/Code.d.ts.map +1 -1
  25. package/dist/components/Code.js +11 -9
  26. package/dist/components/Code.js.map +1 -1
  27. package/dist/components/ComponentNavigator.d.ts.map +1 -1
  28. package/dist/components/ComponentNavigator.js +2 -4
  29. package/dist/components/ComponentNavigator.js.map +1 -1
  30. package/dist/components/FadingOverflow.d.ts.map +1 -1
  31. package/dist/components/FadingOverflow.js +3 -4
  32. package/dist/components/FadingOverflow.js.map +1 -1
  33. package/dist/components/FileDescription.d.ts +0 -1
  34. package/dist/components/FileDescription.d.ts.map +1 -1
  35. package/dist/components/FileDescription.js +3 -4
  36. package/dist/components/FileDescription.js.map +1 -1
  37. package/dist/components/HistoryList.js +1 -1
  38. package/dist/components/HistoryList.js.map +1 -1
  39. package/dist/components/ListResource.js +3 -3
  40. package/dist/components/ListResource.js.map +1 -1
  41. package/dist/components/Markdown.js +1 -1
  42. package/dist/components/Markdown.js.map +1 -1
  43. package/dist/components/Modal.d.ts.map +1 -1
  44. package/dist/components/Modal.js +2 -4
  45. package/dist/components/Modal.js.map +1 -1
  46. package/dist/components/QuickStartButton.d.ts +2 -3
  47. package/dist/components/QuickStartButton.d.ts.map +1 -1
  48. package/dist/components/QuickStartButton.js +4 -3
  49. package/dist/components/QuickStartButton.js.map +1 -1
  50. package/dist/components/RightPanelForm.d.ts.map +1 -1
  51. package/dist/components/RightPanelForm.js +20 -13
  52. package/dist/components/RightPanelForm.js.map +1 -1
  53. package/dist/components/RightPanelTabs.d.ts +1 -4
  54. package/dist/components/RightPanelTabs.d.ts.map +1 -1
  55. package/dist/components/RightPanelTabs.js +4 -16
  56. package/dist/components/RightPanelTabs.js.map +1 -1
  57. package/dist/components/Selector/index.d.ts.map +1 -1
  58. package/dist/components/Selector/index.js +5 -8
  59. package/dist/components/Selector/index.js.map +1 -1
  60. package/dist/components/Selector/styled.d.ts.map +1 -1
  61. package/dist/components/Selector/styled.js +8 -5
  62. package/dist/components/Selector/styled.js.map +1 -1
  63. package/dist/components/StackedBadge.js +5 -5
  64. package/dist/components/StackedBadge.js.map +1 -1
  65. package/dist/components/TabManager.d.ts.map +1 -1
  66. package/dist/components/TabManager.js +8 -31
  67. package/dist/components/TabManager.js.map +1 -1
  68. package/dist/components/ToolBadge.d.ts +3 -8
  69. package/dist/components/ToolBadge.d.ts.map +1 -1
  70. package/dist/components/ToolBadge.js +21 -99
  71. package/dist/components/ToolBadge.js.map +1 -1
  72. package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
  73. package/dist/components/WorkspaceTabNavigator.js +7 -9
  74. package/dist/components/WorkspaceTabNavigator.js.map +1 -1
  75. package/dist/components/form/DescribedCheckboxGroup.d.ts +24 -2
  76. package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
  77. package/dist/components/form/DescribedCheckboxGroup.js +46 -29
  78. package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
  79. package/dist/components/form/DescribedRadioGroup.d.ts +24 -4
  80. package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
  81. package/dist/components/form/DescribedRadioGroup.js +39 -18
  82. package/dist/components/form/DescribedRadioGroup.js.map +1 -1
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.js +0 -1
  86. package/dist/index.js.map +1 -1
  87. package/dist/layout.css +1 -27
  88. package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
  89. package/dist/right-panel/DefaultPanel.js +2 -4
  90. package/dist/right-panel/DefaultPanel.js.map +1 -1
  91. package/dist/state/ChatEntry.d.ts +3 -4
  92. package/dist/state/ChatEntry.d.ts.map +1 -1
  93. package/dist/state/ChatEntry.js.map +1 -1
  94. package/dist/state/constants.js +2 -2
  95. package/dist/state/constants.js.map +1 -1
  96. package/dist/types.d.ts +7 -3
  97. package/dist/types.d.ts.map +1 -1
  98. package/dist/utils/tools.d.ts +1 -2
  99. package/dist/utils/tools.d.ts.map +1 -1
  100. package/dist/utils/tools.js +1 -12
  101. package/dist/utils/tools.js.map +1 -1
  102. package/dist/utils/upload/FileUpload.d.ts.map +1 -1
  103. package/dist/utils/upload/FileUpload.js +2 -1
  104. package/dist/utils/upload/FileUpload.js.map +1 -1
  105. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  106. package/dist/views/Agents/AgentDescription.js +5 -6
  107. package/dist/views/Agents/AgentDescription.js.map +1 -1
  108. package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
  109. package/dist/views/Agents/AgentsPanel.js +7 -7
  110. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  111. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  112. package/dist/views/Agents/AgentsTab.js +29 -28
  113. package/dist/views/Agents/AgentsTab.js.map +1 -1
  114. package/dist/views/Agents/dictionary.d.ts +1 -1
  115. package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
  116. package/dist/views/Chat/AgentInfo.js +3 -5
  117. package/dist/views/Chat/AgentInfo.js.map +1 -1
  118. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  119. package/dist/views/Chat/ChatMessage.js +28 -36
  120. package/dist/views/Chat/ChatMessage.js.map +1 -1
  121. package/dist/views/Chat/StepsList.d.ts.map +1 -1
  122. package/dist/views/Chat/StepsList.js +10 -10
  123. package/dist/views/Chat/StepsList.js.map +1 -1
  124. package/dist/views/Chat/styled.d.ts.map +1 -1
  125. package/dist/views/Chat/styled.js +8 -2
  126. package/dist/views/Chat/styled.js.map +1 -1
  127. package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
  128. package/dist/views/ChatHistory/HistoryItem.js +7 -14
  129. package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
  130. package/dist/views/ChatHistory/index.js +1 -1
  131. package/dist/views/ChatHistory/index.js.map +1 -1
  132. package/dist/views/ChatHistory/styled.d.ts.map +1 -1
  133. package/dist/views/ChatHistory/styled.js +3 -5
  134. package/dist/views/ChatHistory/styled.js.map +1 -1
  135. package/dist/views/ChatTabSelection.d.ts +6 -1
  136. package/dist/views/ChatTabSelection.d.ts.map +1 -1
  137. package/dist/views/ChatTabSelection.js +12 -7
  138. package/dist/views/ChatTabSelection.js.map +1 -1
  139. package/dist/views/Editor.d.ts.map +1 -1
  140. package/dist/views/Editor.js +6 -12
  141. package/dist/views/Editor.js.map +1 -1
  142. package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
  143. package/dist/views/Home/BuiltInAgent.js +2 -3
  144. package/dist/views/Home/BuiltInAgent.js.map +1 -1
  145. package/dist/views/Home/CustomAgent.js +3 -3
  146. package/dist/views/Home/CustomAgent.js.map +1 -1
  147. package/dist/views/Home/index.js +2 -2
  148. package/dist/views/Home/index.js.map +1 -1
  149. package/dist/views/Home/styled.d.ts.map +1 -1
  150. package/dist/views/Home/styled.js +21 -22
  151. package/dist/views/Home/styled.js.map +1 -1
  152. package/dist/views/KSDocument.d.ts.map +1 -1
  153. package/dist/views/KSDocument.js +3 -4
  154. package/dist/views/KSDocument.js.map +1 -1
  155. package/dist/views/KnowledgeSources.d.ts.map +1 -1
  156. package/dist/views/KnowledgeSources.js +14 -36
  157. package/dist/views/KnowledgeSources.js.map +1 -1
  158. package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
  159. package/dist/views/MessageInput/AgentSelector.js +7 -5
  160. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  161. package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -1
  162. package/dist/views/MessageInput/ButtonAgent.js +4 -5
  163. package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
  164. package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
  165. package/dist/views/MessageInput/ButtonBar.js +2 -4
  166. package/dist/views/MessageInput/ButtonBar.js.map +1 -1
  167. package/dist/views/MessageInput/ContextBar.d.ts.map +1 -1
  168. package/dist/views/MessageInput/ContextBar.js +3 -6
  169. package/dist/views/MessageInput/ContextBar.js.map +1 -1
  170. package/dist/views/MessageInput/QuickCommandSelector.js +2 -2
  171. package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
  172. package/dist/views/MessageInput/SelectContent.d.ts.map +1 -1
  173. package/dist/views/MessageInput/SelectContent.js +30 -35
  174. package/dist/views/MessageInput/SelectContent.js.map +1 -1
  175. package/dist/views/MessageInput/UploadBar.d.ts.map +1 -1
  176. package/dist/views/MessageInput/UploadBar.js +2 -29
  177. package/dist/views/MessageInput/UploadBar.js.map +1 -1
  178. package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
  179. package/dist/views/MessageInput/UploadDragNDrop.js +2 -3
  180. package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
  181. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  182. package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
  183. package/dist/views/MessageInput/dictionary.js +0 -4
  184. package/dist/views/MessageInput/dictionary.js.map +1 -1
  185. package/dist/views/MessageInput/index.d.ts.map +1 -1
  186. package/dist/views/MessageInput/index.js +3 -4
  187. package/dist/views/MessageInput/index.js.map +1 -1
  188. package/dist/views/MessageInput/styled.d.ts +1 -3
  189. package/dist/views/MessageInput/styled.d.ts.map +1 -1
  190. package/dist/views/MessageInput/styled.js +11 -27
  191. package/dist/views/MessageInput/styled.js.map +1 -1
  192. package/dist/views/MinimizedHeader.d.ts.map +1 -1
  193. package/dist/views/MinimizedHeader.js +2 -4
  194. package/dist/views/MinimizedHeader.js.map +1 -1
  195. package/dist/views/Stacks.d.ts.map +1 -1
  196. package/dist/views/Stacks.js +23 -28
  197. package/dist/views/Stacks.js.map +1 -1
  198. package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -1
  199. package/dist/views/Steps/FlowChart/NodeStep.js +3 -3
  200. package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -1
  201. package/dist/views/Steps/StepModal.d.ts.map +1 -1
  202. package/dist/views/Steps/StepModal.js +4 -6
  203. package/dist/views/Steps/StepModal.js.map +1 -1
  204. package/dist/views/Steps/dictionary.d.ts +1 -1
  205. package/dist/views/Steps/index.d.ts.map +1 -1
  206. package/dist/views/Steps/index.js +3 -4
  207. package/dist/views/Steps/index.js.map +1 -1
  208. package/dist/views/Steps/utils.d.ts +2 -1
  209. package/dist/views/Steps/utils.d.ts.map +1 -1
  210. package/dist/views/Steps/utils.js +8 -8
  211. package/dist/views/Steps/utils.js.map +1 -1
  212. package/dist/views/Tools.js +2 -4
  213. package/dist/views/Tools.js.map +1 -1
  214. package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
  215. package/dist/views/Workspaces/WorkspacesTab.js +7 -10
  216. package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
  217. package/dist/views/Workspaces/index.js +4 -2
  218. package/dist/views/Workspaces/index.js.map +1 -1
  219. package/package.json +12 -13
  220. package/src/StackspotAIWidget.tsx +36 -34
  221. package/src/app-metadata.json +13 -17
  222. package/src/chat-interceptors/quick-commands.ts +5 -11
  223. package/src/components/AdaptiveTextArea.tsx +1 -1
  224. package/src/components/AgentCard/AgentCardCreate.tsx +4 -7
  225. package/src/components/AgentCard/index.tsx +7 -7
  226. package/src/components/ButtonFavorite.tsx +20 -47
  227. package/src/components/Code.tsx +31 -36
  228. package/src/components/ComponentNavigator.tsx +4 -8
  229. package/src/components/FadingOverflow.tsx +6 -7
  230. package/src/components/FileDescription.tsx +14 -11
  231. package/src/components/HistoryList.tsx +1 -1
  232. package/src/components/ListResource.tsx +5 -5
  233. package/src/components/Markdown.tsx +1 -1
  234. package/src/components/Modal.tsx +2 -4
  235. package/src/components/QuickStartButton.tsx +5 -4
  236. package/src/components/RightPanelForm.tsx +20 -13
  237. package/src/components/RightPanelTabs.tsx +4 -32
  238. package/src/components/Selector/index.tsx +17 -13
  239. package/src/components/Selector/styled.ts +8 -5
  240. package/src/components/StackedBadge.tsx +5 -5
  241. package/src/components/TabManager.tsx +28 -54
  242. package/src/components/ToolBadge.tsx +39 -129
  243. package/src/components/WorkspaceTabNavigator.tsx +22 -25
  244. package/src/components/form/DescribedCheckboxGroup.tsx +90 -65
  245. package/src/components/form/DescribedRadioGroup.tsx +79 -46
  246. package/src/index.ts +1 -2
  247. package/src/layout.css +1 -27
  248. package/src/right-panel/DefaultPanel.tsx +3 -7
  249. package/src/state/ChatEntry.ts +3 -4
  250. package/src/state/constants.ts +2 -2
  251. package/src/types.ts +8 -3
  252. package/src/utils/tools.ts +2 -23
  253. package/src/utils/upload/FileUpload.ts +2 -1
  254. package/src/views/Agents/AgentDescription.tsx +6 -7
  255. package/src/views/Agents/AgentsPanel.tsx +11 -12
  256. package/src/views/Agents/AgentsTab.tsx +37 -56
  257. package/src/views/Chat/AgentInfo.tsx +7 -6
  258. package/src/views/Chat/ChatMessage.tsx +109 -118
  259. package/src/views/Chat/StepsList.tsx +10 -11
  260. package/src/views/Chat/styled.ts +8 -2
  261. package/src/views/ChatHistory/HistoryItem.tsx +12 -19
  262. package/src/views/ChatHistory/index.tsx +1 -1
  263. package/src/views/ChatHistory/styled.ts +3 -5
  264. package/src/views/ChatTabSelection.tsx +17 -9
  265. package/src/views/Editor.tsx +9 -14
  266. package/src/views/Home/BuiltInAgent.tsx +7 -8
  267. package/src/views/Home/CustomAgent.tsx +3 -3
  268. package/src/views/Home/index.tsx +2 -2
  269. package/src/views/Home/styled.ts +21 -22
  270. package/src/views/KSDocument.tsx +7 -8
  271. package/src/views/KnowledgeSources.tsx +24 -66
  272. package/src/views/MessageInput/AgentSelector.tsx +10 -8
  273. package/src/views/MessageInput/ButtonAgent.tsx +24 -12
  274. package/src/views/MessageInput/ButtonBar.tsx +25 -21
  275. package/src/views/MessageInput/ContextBar.tsx +17 -14
  276. package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
  277. package/src/views/MessageInput/SelectContent.tsx +39 -68
  278. package/src/views/MessageInput/UploadBar.tsx +2 -40
  279. package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
  280. package/src/views/MessageInput/dictionary.ts +0 -4
  281. package/src/views/MessageInput/index.tsx +5 -7
  282. package/src/views/MessageInput/styled.ts +12 -28
  283. package/src/views/MinimizedHeader.tsx +4 -7
  284. package/src/views/Stacks.tsx +31 -54
  285. package/src/views/Steps/FlowChart/NodeStep.tsx +6 -4
  286. package/src/views/Steps/StepModal.tsx +14 -18
  287. package/src/views/Steps/index.tsx +4 -5
  288. package/src/views/Steps/utils.tsx +9 -9
  289. package/src/views/Tools.tsx +12 -19
  290. package/src/views/Workspaces/WorkspacesTab.tsx +17 -21
  291. package/src/views/Workspaces/index.tsx +4 -2
  292. package/dist/components/Accordion.d.ts +0 -20
  293. package/dist/components/Accordion.d.ts.map +0 -1
  294. package/dist/components/Accordion.js +0 -51
  295. package/dist/components/Accordion.js.map +0 -1
  296. package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -33
  297. package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
  298. package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -52
  299. package/dist/components/FallbackBoundary/ErrorBoundary.js.map +0 -1
  300. package/dist/components/FallbackBoundary/Loading.d.ts +0 -2
  301. package/dist/components/FallbackBoundary/Loading.d.ts.map +0 -1
  302. package/dist/components/FallbackBoundary/Loading.js +0 -12
  303. package/dist/components/FallbackBoundary/Loading.js.map +0 -1
  304. package/dist/components/FallbackBoundary/index.d.ts +0 -17
  305. package/dist/components/FallbackBoundary/index.d.ts.map +0 -1
  306. package/dist/components/FallbackBoundary/index.js +0 -9
  307. package/dist/components/FallbackBoundary/index.js.map +0 -1
  308. package/dist/components/IconInput.d.ts +0 -10
  309. package/dist/components/IconInput.d.ts.map +0 -1
  310. package/dist/components/IconInput.js +0 -61
  311. package/dist/components/IconInput.js.map +0 -1
  312. package/dist/components/OverlayMenu.d.ts +0 -21
  313. package/dist/components/OverlayMenu.d.ts.map +0 -1
  314. package/dist/components/OverlayMenu.js +0 -79
  315. package/dist/components/OverlayMenu.js.map +0 -1
  316. package/dist/components/ProgressBar.d.ts +0 -37
  317. package/dist/components/ProgressBar.d.ts.map +0 -1
  318. package/dist/components/ProgressBar.js +0 -131
  319. package/dist/components/ProgressBar.js.map +0 -1
  320. package/dist/components/Tooltip/Tooltip.d.ts +0 -37
  321. package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
  322. package/dist/components/Tooltip/Tooltip.js +0 -30
  323. package/dist/components/Tooltip/Tooltip.js.map +0 -1
  324. package/dist/components/Tooltip/TooltipAPI.d.ts +0 -29
  325. package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
  326. package/dist/components/Tooltip/TooltipAPI.js +0 -107
  327. package/dist/components/Tooltip/TooltipAPI.js.map +0 -1
  328. package/dist/components/Tooltip/context.d.ts +0 -5
  329. package/dist/components/Tooltip/context.d.ts.map +0 -1
  330. package/dist/components/Tooltip/context.js +0 -18
  331. package/dist/components/Tooltip/context.js.map +0 -1
  332. package/dist/components/Tooltip/index.d.ts +0 -3
  333. package/dist/components/Tooltip/index.d.ts.map +0 -1
  334. package/dist/components/Tooltip/index.js +0 -3
  335. package/dist/components/Tooltip/index.js.map +0 -1
  336. package/dist/components/Tooltip/style.d.ts +0 -4
  337. package/dist/components/Tooltip/style.d.ts.map +0 -1
  338. package/dist/components/Tooltip/style.js +0 -22
  339. package/dist/components/Tooltip/style.js.map +0 -1
  340. package/dist/components/Tooltip/types.d.ts +0 -27
  341. package/dist/components/Tooltip/types.d.ts.map +0 -1
  342. package/dist/components/Tooltip/types.js +0 -2
  343. package/dist/components/Tooltip/types.js.map +0 -1
  344. package/src/components/Accordion.tsx +0 -75
  345. package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -71
  346. package/src/components/FallbackBoundary/Loading.tsx +0 -14
  347. package/src/components/FallbackBoundary/index.tsx +0 -26
  348. package/src/components/IconInput.tsx +0 -73
  349. package/src/components/OverlayMenu.tsx +0 -133
  350. package/src/components/ProgressBar.tsx +0 -183
  351. package/src/components/Tooltip/Tooltip.tsx +0 -78
  352. package/src/components/Tooltip/TooltipAPI.ts +0 -101
  353. package/src/components/Tooltip/context.tsx +0 -24
  354. package/src/components/Tooltip/index.ts +0 -2
  355. package/src/components/Tooltip/style.tsx +0 -24
  356. package/src/components/Tooltip/types.ts +0 -28
@@ -1,52 +1,85 @@
1
- import { Radio, Text } from '@citric/core'
2
- import { listToClass } from '@stack-spot/portal-theme'
3
- import { useMemo } from 'react'
4
- import { Accordion } from '../Accordion'
5
- import { RadioCheckBox } from './styled'
6
- import { RadioProps } from './types'
1
+ import { Icon } from '@stack-spot/citric-icons'
2
+ import { Accordion, FieldGroup, ImageBox, Input, RadioGroup, Row, Text, useRadioGroupControls } from '@stack-spot/citric-react'
3
+ import { useEffect, useState } from 'react'
4
+ import { ButtonFavorite, Favorite } from '../ButtonFavorite'
5
+
6
+ interface Props<T> {
7
+ initialValue?: T,
8
+ options: T[],
9
+ /**
10
+ * Must return the data needed by the component, given the option.
11
+ * @param option
12
+ * @returns
13
+ */
14
+ data: (option: T) => { name: string, description: React.ReactNode, image?: React.ReactElement } & Favorite<any>,
15
+ emptyResults: React.ReactNode,
16
+ emptyDataset: React.ReactNode,
17
+ onChange?: (value: T | undefined) => void,
18
+ }
7
19
 
8
20
  /**
9
- * Renders a radio button group where each option has a label and a description.
10
- * The description in placed under the label and radio button as an accordion.
21
+ * Renders a radio group where each option has a label and a description.
22
+ * The description in placed under the label and checkbox as an accordion.
23
+ *
24
+ * Also renders a search input.
11
25
  */
12
- export function DescribedRadioGroup<T>(
13
- {
14
- keygen,
15
- onChange,
16
- options,
17
- renderDescription,
18
- renderLabel,
19
- renderBeforeElement,
20
- renderAfterElement,
21
- optionClassName,
22
- optionStyle,
23
- value,
24
- className,
25
- style }: RadioProps<T>,
26
- ) {
27
- const items = useMemo(() => options.map((option) => {
28
- const label = renderLabel(option)
29
- const description = renderDescription(option)
26
+ export function DescribedRadioGroup<T>({ initialValue, options: opt, data, emptyDataset, emptyResults, onChange }: Props<T>) {
27
+ const [options, setOptions] = useState(opt)
28
+ const controls = useRadioGroupControls({
29
+ initialValue,
30
+ options,
31
+ applyFilter: (filter, o) => data(o).name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()),
32
+ renderKey: o => data(o).idOrSlug,
33
+ onChange,
34
+ })
30
35
 
31
- const header = (
32
- <label>
33
- <Radio checked={option === value} onChange={() => onChange(option)} />
34
- {typeof label === 'string' ? <Text>{label}</Text> : label}
35
- </label>
36
- )
37
- return (
38
- <li key={keygen(option)} className={listToClass(['radio-group-item', optionClassName?.(option)])} style={optionStyle?.(option)}>
39
- {renderBeforeElement?.(option)}
40
- <Accordion header={header}>
41
- {typeof description === 'string'
42
- ? <Text appearance="microtext1" colorScheme="light.700">{description}</Text>
43
- : description as any
44
- }
45
- </Accordion>
46
- {renderAfterElement?.(option)}
47
- </li>
48
- )
49
- }), [options, value])
36
+ useEffect(() => {
37
+ if (controls.value === undefined && initialValue !== undefined) controls.setValue(initialValue)
38
+ }, [initialValue])
50
39
 
51
- return <RadioCheckBox style={style} className={className}>{items}</RadioCheckBox>
40
+ return options.length ? <>
41
+ <FieldGroup fullWidth>
42
+ <Icon icon="Search" />
43
+ <Input type="search" value={controls.filter} onChange={controls.setFilter} />
44
+ </FieldGroup>
45
+ {controls.options.length ? <RadioGroup
46
+ options={controls.options}
47
+ value={controls.value}
48
+ onChange={controls.setValue}
49
+ renderKey={controls.renderKey}
50
+ className="option-list"
51
+ renderItem={(radio, o) => {
52
+ const { description, idOrSlug, name, image, listFavorites, onAddFavorite, onRemoveFavorite } = data(o)
53
+ return (
54
+ <Row className={controls.isUnfilteredButChecked(o) ? 'filtered-out' : ''}>
55
+ <Accordion
56
+ header={btn => <>
57
+ {radio}
58
+ {image && <ImageBox size="xs" style={{ fontSize: '16px' }}>{image}</ImageBox>}
59
+ <Text>{name}</Text>{btn}</>
60
+ }
61
+ appearance="card"
62
+ maxHeight={100}
63
+ >
64
+ {typeof description === 'string' ? <Text appearance="microtext1" color="light.700">{description}</Text> : description}
65
+ </Accordion>
66
+ {onAddFavorite && <ButtonFavorite favorite={{
67
+ idOrSlug: idOrSlug,
68
+ listFavorites,
69
+ onAddFavorite: async (...args) => {
70
+ const res = await onAddFavorite(...args)
71
+ setOptions([...options]) // forces options re-rendering
72
+ return res
73
+ },
74
+ onRemoveFavorite: async (...args) => {
75
+ const res = await onRemoveFavorite?.(...args)
76
+ setOptions([...options]) // forces options re-rendering
77
+ return res ?? false
78
+ },
79
+ }} />}
80
+ </Row>
81
+ )
82
+ }}
83
+ /> : emptyResults}
84
+ </> : emptyDataset
52
85
  }
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /* Attention: in order for the package "page" to work without linking the lib, we must export types separately, using the "type" keyword */
2
2
 
3
- export { ProgressBar } from './components/ProgressBar'
4
3
  export { QuickStartButton } from './components/QuickStartButton'
5
4
  export { AIWidgetProvider } from './context/AIWidgetProvider'
6
5
  export * from './context/hooks'
@@ -16,5 +15,5 @@ export { acceptedFileTypes } from './state/constants'
16
15
  export { ObservableState } from './state/ObservableState'
17
16
  export type { Labeled, LabeledAgent, LabeledWithImage } from './state/types'
18
17
  export { WidgetState } from './state/WidgetState'
18
+ export type { ButtonAction } from './types'
19
19
  export { defaultLanguage, languages } from './utils/programming-languages'
20
-
package/src/layout.css CHANGED
@@ -1,29 +1,3 @@
1
- @font-face {
2
- font-family: "San Francisco";
3
- font-weight: 400;
4
- src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff");
5
- }
6
-
7
- /* Scroll bars */
8
-
9
- ::-webkit-scrollbar-track {
10
- background-color: transparent;
11
- }
12
-
13
- ::-webkit-scrollbar {
14
- width: 0.25rem;
15
- height: 0.5rem;
16
- background-color: transparent;
17
- }
18
-
19
- ::-webkit-scrollbar-thumb {
20
- background-color: var(--light-600);
21
- }
22
-
23
- ::-webkit-scrollbar-corner {
24
- background-color: transparent;
25
- }
26
-
27
1
  /* Classes */
28
2
 
29
3
  .ai-chat-widget {
@@ -209,4 +183,4 @@
209
183
  z-index: 9999;
210
184
  pointer-events: auto;
211
185
  color: var(--light-contrastText)
212
- }
186
+ }
@@ -1,6 +1,4 @@
1
- import { Text } from '@citric/core'
2
- import { Times } from '@citric/icons'
3
- import { IconButton } from '@citric/ui'
1
+ import { IconButton, Text } from '@stack-spot/citric-react'
4
2
  import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
5
3
  import { styled } from 'styled-components'
6
4
  import { WithChildren } from '../types'
@@ -51,11 +49,9 @@ export const DefaultPanel = ({ description, onClose, title, children }: Props) =
51
49
  <header>
52
50
  <div className="title">
53
51
  {typeof title === 'string' ? <Text appearance="h5">{title}</Text> : title}
54
- {typeof description === 'string' ? <Text colorScheme="light.700">{description}</Text> : description}
52
+ {typeof description === 'string' ? <Text color="light.700">{description}</Text> : description}
55
53
  </div>
56
- <IconButton title={t.close} aria-label={t.close} onClick={onClose}>
57
- <Times />
58
- </IconButton>
54
+ <IconButton icon="Times" title={t.close} aria-label={t.close} onClick={onClose} />
59
55
  </header>
60
56
  <article>{children}</article>
61
57
  </PanelBox>
@@ -1,6 +1,5 @@
1
- import { OneOfColorSchemes } from '@citric/core'
2
1
  import { ChatStep } from '@stack-spot/portal-network'
3
- import { ColorPaletteName } from '@stack-spot/portal-theme'
2
+ import { ColorPaletteName, ColorSchemeName } from '@stack-spot/portal-theme'
4
3
  import { pull } from 'lodash'
5
4
  import { LabeledAgent } from './types'
6
5
 
@@ -32,7 +31,7 @@ export interface ChatAction extends SerializableAction {
32
31
  /**
33
32
  * @default inverse
34
33
  */
35
- colorScheme?: OneOfColorSchemes,
34
+ colorScheme?: ColorSchemeName,
36
35
  /**
37
36
  * @default false
38
37
  */
@@ -150,7 +149,7 @@ export interface TextChatEntry {
150
149
  /*
151
150
  * Options for radio, checkbox or button type.
152
151
  */
153
- options?: { color?: OneOfColorSchemes, label: string, value?: string, hasInput?: boolean}[],
152
+ options?: { color?: ColorSchemeName, label: string, value?: string, hasInput?: boolean}[],
154
153
  /**
155
154
  * Name to be used in input type fields.
156
155
  */
@@ -1,10 +1,10 @@
1
1
  import { FileSize } from './types'
2
2
 
3
3
  export const acceptedFileTypes = [
4
- 'json', 'yaml', 'txt', 'md', 'json', 'yaml', 'pdf', /*'xls',*/ 'xlsx', 'csv', 'cbl', 'cpp', 'cxx', 'cc', 'c', 'hpp', 'hxx', 'hh', 'h',
4
+ 'json', 'yaml', 'txt', 'md', 'json', 'yaml', 'pdf', /*'xls', 'xlsx',*/ 'csv', 'cbl', 'cpp', 'cxx', 'cc', 'c', 'hpp', 'hxx', 'hh', 'h',
5
5
  'cs', 'go', 'html', 'htm', 'kt', 'kts', 'md', 'php', 'proto', 'py', 'java', 'js', 'jsx', 'ts', 'tsx', 'rst', 'rb', 'rs', 'scala', 'swift',
6
6
  'sql', 'yaml', 'yml', 'tf', 'sh', 'ps1', 'psd1', 'psm1', 'bat', 'cmd', 'rego', 'f', 'for', 'r', 'pl', 'vb', 'dart', 'hs', 'lua',
7
- 'asm', 'groovy', 'gvy', 'gy', 'mat', 'clj', 'lisp', 'm', 'cls', 'css', 'scss', 'json', 'jpg', 'jpeg', 'png', 'docx', 'pptx',
7
+ 'asm', 'groovy', 'gvy', 'gy', 'mat', 'clj', 'lisp', 'm', 'cls', 'css', 'scss', 'json', 'jpg', 'jpeg', 'png',
8
8
  ]
9
9
 
10
10
  export const maxFileSize: FileSize = { value: 10, unit: 'MB' }
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { WithIcon } from '@stack-spot/citric-icons'
2
+ import { BaseIconBoxProps } from '@stack-spot/citric-react'
1
3
  import { WithStyle } from '@stack-spot/portal-theme'
2
4
 
3
5
  export interface WithChildren<T = React.ReactNode> {
@@ -6,13 +8,16 @@ export interface WithChildren<T = React.ReactNode> {
6
8
 
7
9
  export type PropsOf<T extends React.FunctionComponent> = T extends React.FunctionComponent<infer P> ? P : never
8
10
 
9
- export interface ButtonAction extends WithStyle {
10
- icon?: React.ReactElement,
11
+ export type ButtonAction = {
11
12
  color?: string,
12
13
  label?: string,
13
14
  ariaLabel?: string,
15
+ title?: string,
14
16
  onClick: () => any,
15
- }
17
+ appearance?: BaseIconBoxProps<any, any>['appearance'],
18
+ size?: BaseIconBoxProps<any, any>['size'],
19
+ } & WithStyle & Partial<WithIcon>
20
+
16
21
 
17
22
  export interface MinimizedActions {
18
23
  /**
@@ -1,30 +1,9 @@
1
1
  import { BuiltinToolkitResponse, BuiltinToolResponse } from '@stack-spot/portal-network/api/agent'
2
- import { CustomToolkitDto } from '@stack-spot/portal-network/api/agent-tools'
3
2
  import { keyBy } from 'lodash'
4
3
 
5
4
  export type ToolWithImage = BuiltinToolResponse & { id: string, image?: string }
6
5
 
7
- function isBuiltinToolkit(
8
- toolkit: BuiltinToolkitResponse | CustomToolkitDto,
9
- ): toolkit is BuiltinToolkitResponse {
10
- return 'image_url' in toolkit
11
- }
12
-
13
-
14
- export function toolById(
15
- id: string,
16
- toolkits: (BuiltinToolkitResponse | CustomToolkitDto)[] | undefined,
17
- ): ToolWithImage | undefined {
18
- const tools = toolkits
19
- ?.map((toolkit) =>
20
- toolkit.tools?.map((tool) => ({
21
- ...tool,
22
- id: tool.id!,
23
- image: isBuiltinToolkit(toolkit)
24
- ? toolkit.image_url ?? undefined
25
- : (toolkit as CustomToolkitDto).avatar ?? undefined,
26
- })),
27
- )
28
- .flat()
6
+ export function toolById(id: string, toolkits: BuiltinToolkitResponse[] | undefined): ToolWithImage | undefined {
7
+ const tools = toolkits?.map(({ image_url, tools }) => tools?.map((tool) => ({ ...tool, id: tool.id!, image: image_url! }))).flat()
29
8
  return keyBy(tools, 'id')[id]
30
9
  }
@@ -2,6 +2,7 @@ import { dataIntegrationClient } from '@stack-spot/portal-network'
2
2
  import { FileUploadType } from '@stack-spot/portal-network/api/dataIntegration'
3
3
  import { pull } from 'lodash'
4
4
  import { FileUploadStatus } from './types'
5
+ import { getFileId } from './utils'
5
6
 
6
7
  export type FileUploadChangeListener = (status: FileUploadStatus) => void
7
8
 
@@ -17,8 +18,8 @@ export class FileUpload {
17
18
 
18
19
  constructor(file: File, type: FileUploadType = 'CONTEXT') {
19
20
  this.file = file
21
+ this.id = getFileId(file)
20
22
  this.type = type
21
- this.id = `${Date.now()}-${Math.random()}`
22
23
  this.upload()
23
24
  }
24
25
 
@@ -1,5 +1,4 @@
1
- import { Text } from '@citric/core'
2
- import { Badge, Skeleton } from '@citric/ui'
1
+ import { Badge, Skeleton, Text } from '@stack-spot/citric-react'
3
2
  import { agentToolsClient } from '@stack-spot/portal-network'
4
3
  import { useMemo } from 'react'
5
4
  import { ToolBadge } from '../../components/ToolBadge'
@@ -11,18 +10,18 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
11
10
  const t = useAgentsDictionary()
12
11
  const [agent, , , { isLoading }] = agentToolsClient.agent.useStatefulQuery({ agentId: agentId! }, { enabled: !!agentId })
13
12
  const [toolKits, , , { isLoading: isLoadingToolKit }] = agentToolsClient.tools.useStatefulQuery({})
14
- const numberOfKnowledgeSources = agent?.knowledge_sources_config?.knowledge_sources.length ?? 0
13
+ const numberOfKnowledgeSources = agent?.knowledge_source_config?.knowledge_sources.length ?? 0
15
14
 
16
15
  const knowledgeSources = useMemo(
17
- () => agent?.knowledge_sources_config?.knowledge_sources_details?.map((ks, index) => (
18
- <li key={index}><Badge palette="teal" appearance="square">{ks.name}</Badge></li>
16
+ () => agent?.knowledge_source_config?.knowledge_sources_details?.map((ks, index) => (
17
+ <li key={index}><Badge colorPalette="teal" appearance="square">{ks.name}</Badge></li>
19
18
  )),
20
19
  [agent],
21
20
  )
22
21
  const skeleton = useMemo(() => {
23
22
  const loadingKS: React.ReactElement[] = []
24
23
  for (let i = 0; i < numberOfKnowledgeSources; i++) {
25
- loadingKS.push(<li key={i}><Badge palette="teal" appearance="square"><Skeleton className="ks-skeleton" /></Badge></li>)
24
+ loadingKS.push(<li key={i}><Badge colorPalette="teal" appearance="square"><Skeleton className="ks-skeleton" /></Badge></li>)
26
25
  }
27
26
  return loadingKS
28
27
  }, [numberOfKnowledgeSources])
@@ -70,7 +69,7 @@ export const AgentDescription = ({ agentId }: { agentId?: string }) => {
70
69
  </section>}
71
70
  {agent?.model_name && <section>
72
71
  <Text appearance="microtext1" className="title">LLM</Text>
73
- <Badge palette="orange" appearance="square">{agent?.model_name}</Badge>
72
+ <Badge colorPalette="orange" appearance="square">{agent?.model_name}</Badge>
74
73
  </section>}
75
74
  </AgentDescriptionBox>
76
75
  )
@@ -1,5 +1,6 @@
1
+ import { Tab } from '@stack-spot/citric-react'
1
2
  import { agentToolsClient } from '@stack-spot/portal-network'
2
- import { ReactElement, useEffect, useRef } from 'react'
3
+ import { useEffect, useRef } from 'react'
3
4
  import { RightPanelContentList } from '../../components/RightPanelContentList'
4
5
  import { RightPanelTabs } from '../../components/RightPanelTabs'
5
6
  import { useCurrentChat, useWidgetState } from '../../context/hooks'
@@ -8,8 +9,6 @@ import { checkIsTrial } from '../../utils/check-is-trial'
8
9
  import { AgentsTab, AgentsTabWorkspace } from './AgentsTab'
9
10
  import { useAgentsDictionary } from './dictionary'
10
11
 
11
- type TabElement = { title: string, content: ReactElement }
12
-
13
12
  /**
14
13
  * Renders the Agent selection form in the Right Panel if this is the panel that is currently opened.
15
14
  */
@@ -29,13 +28,13 @@ export const AgentsPanel = () => {
29
28
  }
30
29
  }, [chat])
31
30
 
32
- const allTabsMap: Record<Scope, TabElement> = {
33
- favorite: { title: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
34
- builtin: { title: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
35
- personal: { title: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
36
- shared: { title: t.shared, content: <AgentsTab key="shared" visibility="shared" agent={agent} /> },
37
- workspace: { title: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="workspace" agent={agent} /> },
38
- account: { title: t.account, content: <AgentsTab key="account" visibility="account" agent={agent} /> },
31
+ const allTabsMap: Record<Scope, Omit<Tab, 'key'>> = {
32
+ favorite: { label: t.favorites, content: <AgentsTab key="favorite" visibility="favorite" agent={agent} /> },
33
+ builtin: { label: t.builtin, content: <AgentsTab key="builtin" visibility="built_in" agent={agent} /> },
34
+ personal: { label: t.personal, content: <AgentsTab key="personal" visibility="personal" agent={agent} /> },
35
+ shared: { label: t.shared, content: <AgentsTab key="shared" visibility="shared" agent={agent} /> },
36
+ workspace: { label: t.spots, content: <AgentsTabWorkspace key="workspace" visibility="workspace" agent={agent} /> },
37
+ account: { label: t.account, content: <AgentsTab key="account" visibility="account" agent={agent} /> },
39
38
  }
40
39
 
41
40
  const defaultScopes: Scope[] = ['favorite', 'builtin', 'personal', 'shared', 'workspace', 'account']
@@ -47,8 +46,8 @@ export const AgentsPanel = () => {
47
46
  : rawScopes
48
47
 
49
48
  const tabs = scopesToRender
50
- .map(scope => allTabsMap[scope])
51
- .filter(Boolean) as TabElement[]
49
+ .map(scope => scope in allTabsMap ? ({ key: scope, ...allTabsMap[scope] }) : undefined)
50
+ .filter(Boolean) as Tab[]
52
51
 
53
52
  return (isGroupResourcesByScope ? (
54
53
  <RightPanelTabs key={chat.id} tabs={tabs} />
@@ -1,21 +1,17 @@
1
- import { Button, IconBox, Text } from '@citric/core'
2
- import { Agent, Search } from '@citric/icons'
1
+ import { Icon } from '@stack-spot/citric-icons'
2
+ import { Button } from '@stack-spot/citric-react'
3
3
  import { Placeholder } from '@stack-spot/portal-components/Placeholder'
4
- import { MiniLogo } from '@stack-spot/portal-components/svg'
5
4
  import { AgentResponseWithBuiltIn, agentToolsClient, AgentVisibilityLevel, workspaceAiClient } from '@stack-spot/portal-network'
6
5
  import { WorkspaceResponse } from '@stack-spot/portal-network/api/workspace-ai'
7
- import { useCallback, useMemo, useState } from 'react'
8
- import { ButtonFavorite } from '../../components/ButtonFavorite'
6
+ import { useMemo, useState } from 'react'
9
7
  import { NavigationComponent } from '../../components/ComponentNavigator'
10
8
  import { DescribedRadioGroup } from '../../components/form/DescribedRadioGroup'
11
- import { IconInput } from '../../components/IconInput'
12
9
  import { WorkspaceTabNavigator } from '../../components/WorkspaceTabNavigator'
13
10
  import { useCurrentChat } from '../../context/hooks'
14
11
  import { useRightPanel } from '../../right-panel/hooks'
15
12
  import { ChatProperties } from '../../state/ChatState'
16
13
  import { AgentDescription } from './AgentDescription'
17
14
  import { useAgentsDictionary } from './dictionary'
18
- import { AgentLabel } from './styled'
19
15
  import { useAgentFavorites } from './useAgentFavorites'
20
16
 
21
17
  export interface AgentTabProps {
@@ -29,73 +25,58 @@ export const AgentsTab = ({ visibility, workspaceId, agent, showSubmitButton = t
29
25
  const t = useAgentsDictionary()
30
26
  const { close } = useRightPanel()
31
27
  const chat = useCurrentChat()
32
- const [filter, setFilter] = useState('')
33
28
  const { useFavorites, onAddFavorite, onRemoveFavorite } = useAgentFavorites()
29
+ const [submitEnabled, setSubmitEnabled] = useState(false)
34
30
  const listFavorites = useFavorites()
35
31
  const agentDefault = agentToolsClient.agentDefault.useQuery()
36
32
  const agents = workspaceId
37
33
  ? workspaceAiClient.getAgentFromWorkspaceAi.useQuery({ workspaceId }) as AgentResponseWithBuiltIn[]
38
34
  : agentToolsClient.agents.useQuery({ visibility })
39
35
 
40
- const [value, setValue] = useState<AgentResponseWithBuiltIn | undefined>(
41
- agent.current
42
- ? agents.find(a => a.id === agent.current?.id)
43
- : chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn,
44
- )
45
-
46
- const filtered = useMemo(
47
- // Recreate the list so that the favorites list is taken into account
48
- () => filter ? agents.filter(a => a === value || a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase())) : [...agents],
49
- [agents, filter, value, listFavorites],
36
+ const initialValue = useMemo<AgentResponseWithBuiltIn | undefined>(
37
+ () => {
38
+ const initial = agent.current
39
+ ? agents.find(a => a.id === agent.current?.id)
40
+ : chat.get('agent') ? agents.find(a => a.id === chat.get('agent')?.id) : agentDefault as unknown as AgentResponseWithBuiltIn
41
+ if (initial) setSubmitEnabled(true)
42
+ return initial
43
+ },
44
+ [agents],
50
45
  )
51
46
 
52
47
  function submit() {
53
- if (value) {
54
- chat.set(
55
- 'agent',
56
- { id: value.id, label: value.name, image: value.avatar!, builtIn: value.visibility_level === 'built_in', slug: value.slug },
57
- )
58
- }
48
+ if (agent.current) chat.set('agent', agent.current)
59
49
  close()
60
50
  }
61
51
 
62
- const onChange = useCallback((newValue: AgentResponseWithBuiltIn) => {
63
- setValue(newValue)
64
- agent.current = { ...newValue, label: newValue.name, builtIn: newValue.visibility_level === 'built_in' }
65
- }, [])
66
-
67
52
  return (
68
53
  <>
69
54
  <div className="content">
70
- <IconInput icon={<Search />} value={filter} onChange={setFilter} className="search" />
71
- {!!filtered.length && <DescribedRadioGroup
72
- options={filtered}
73
- renderAfterElement={({ id }) => (
74
- <ButtonFavorite favorite={{
75
- idOrSlug: id, listFavorites, onAddFavorite, onRemoveFavorite,
76
- }} />
77
- )}
78
- keygen={a => a.id}
79
- value={value}
80
- onChange={onChange}
81
- renderLabel={({ name, avatar, id }) => (
82
- <AgentLabel>
83
- {id ? (avatar ? <img src={avatar} /> : <IconBox size="xs"><Agent /></IconBox>) : <MiniLogo />}
84
- <Text>{name}</Text>
85
- </AgentLabel>
86
- )}
87
- renderDescription={a => <AgentDescription agentId={a.id} />}
88
- optionClassName={a => (a === value && filter && !a.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
89
- ? 'filtered-out'
90
- : ''
55
+ <DescribedRadioGroup
56
+ options={agents}
57
+ initialValue={initialValue}
58
+ onChange={(ag) => {
59
+ agent.current = ag
60
+ ? { ...ag, label: ag.name, image: ag.avatar!, slug: ag.slug, builtIn: ag.visibility_level === 'built_in' }
61
+ : undefined
62
+ setSubmitEnabled(true)
63
+ }}
64
+ data={ag => ({
65
+ idOrSlug: ag.id,
66
+ image: ag.avatar ? <img src={ag.avatar} /> : <Icon icon="Agent" />,
67
+ description: <AgentDescription agentId={ag.id} />,
68
+ name: ag.name,
69
+ listFavorites,
70
+ onAddFavorite,
71
+ onRemoveFavorite,
72
+ })}
73
+ emptyResults={
74
+ <Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />
91
75
  }
92
- className="option-list"
93
- />}
94
- {!!agents.length && !filtered.length &&
95
- <Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />}
96
- {!agents.length && <Placeholder title={t.noData} description={t.noDataDescription} />}
76
+ emptyDataset={<Placeholder title={t.noData} description={t.noDataDescription} />}
77
+ />
97
78
  </div>
98
- {!!filtered.length && showSubmitButton && <Button onClick={submit} disabled={!value}>{t.apply}</Button>}
79
+ {!!agents.length && showSubmitButton && <Button onClick={submit} disabled={!submitEnabled}>{t.apply}</Button>}
99
80
  </>
100
81
  )
101
82
  }
@@ -1,5 +1,5 @@
1
- import { IconBox, Text } from '@citric/core'
2
- import { Agent } from '@citric/icons'
1
+ import { Icon } from '@stack-spot/citric-icons'
2
+ import { ImageWithFallback, Text } from '@stack-spot/citric-react'
3
3
  import { LabeledWithImage } from '../../state/types'
4
4
 
5
5
  interface Props {
@@ -12,10 +12,11 @@ interface Props {
12
12
  */
13
13
  export const AgentInfo = ({ agent, icon }: Props) => (
14
14
  <>
15
- {agent?.image
16
- ? <img src={agent.image} className="custom-agent-image" />
17
- : <IconBox className="default-image-wrapper" colorIcon="light.700">{icon ?? <Agent className="agent-image" />}</IconBox>
18
- }
15
+ <ImageWithFallback
16
+ src={agent?.image ?? ''}
17
+ className="custom-agent-image"
18
+ fallback={<div className="default-image-wrapper">{icon ?? <Icon icon="Agent" className="agent-image" />}</div>}
19
+ />
19
20
  <Text appearance="body2">{agent?.label}</Text>
20
21
  </>
21
22
  )