@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,75 +0,0 @@
1
- /* Copiar do EDP ou usar o AnimatedHeight da lib de components */
2
-
3
- import { ChevronDown } from '@citric/icons'
4
- import { IconButton } from '@citric/ui'
5
- import { AnimatedHeight } from '@stack-spot/portal-components/AnimatedHeight'
6
- import { theme, WithStyle } from '@stack-spot/portal-theme'
7
- import React, { useState } from 'react'
8
- import { styled } from 'styled-components'
9
- import { WithChildren } from '../types'
10
-
11
- interface Props extends WithStyle, Required<WithChildren> {
12
- /**
13
- * The header of the accordion (always rendered). The body (hidden part) must be passed as the children.
14
- */
15
- header: React.ReactNode,
16
- /**
17
- * Whether or not to start expanded.
18
- * @default false
19
- */
20
- startExpanded?: boolean,
21
- }
22
-
23
- const StyledAccordion = styled.div`
24
- > header {
25
- display: flex;
26
- flex-direction: row;
27
- justify-content: space-between;
28
- align-items: center;
29
- padding: 10px;
30
- background-color: ${theme.color.light[400]};
31
-
32
- > button {
33
- transition: transform 0.3s ease-out;
34
- background: transparent;
35
- border: none;
36
- padding: 0;
37
-
38
- &:hover {
39
- background: transparent;
40
- }
41
-
42
- svg {
43
- width: 16px;
44
- height: 16px;
45
- margin: 4px;
46
- }
47
- }
48
-
49
- &.expanded > button {
50
- transform: rotate(180deg);
51
- }
52
- }
53
-
54
- > .accordion-content {
55
- padding: 10px;
56
- }
57
- `
58
-
59
- /**
60
- * A component that can have it's content shown or hidden (animated).
61
- */
62
- export const Accordion = ({ children, header, className, startExpanded, style }: Props) => {
63
- const [expanded, setExpanded] = useState(startExpanded)
64
- return (
65
- <AnimatedHeight style={style} className={className} outerStyle={{ width: '100%' }}>
66
- <StyledAccordion>
67
- <header className={expanded ? 'expanded' : ''}>
68
- {header}
69
- <IconButton onClick={() => setExpanded(v => !v)}><ChevronDown /></IconButton>
70
- </header>
71
- {expanded ? <div className="accordion-content">{children}</div> : null}
72
- </StyledAccordion>
73
- </AnimatedHeight>
74
- )
75
- }
@@ -1,71 +0,0 @@
1
- import { IconBox, Text } from '@citric/core'
2
- import { TimesCircle } from '@citric/icons'
3
- import { ErrorDescription, ErrorFeedback } from '@stack-spot/portal-components/error'
4
- import { StackspotAPIError } from '@stack-spot/portal-network'
5
- import { Component } from 'react'
6
- import { styled } from 'styled-components'
7
-
8
- interface State extends ErrorDescription {
9
- hasError: boolean,
10
- }
11
-
12
- interface Props {
13
- mini?: boolean,
14
- message?: string,
15
- children: React.ReactNode,
16
- }
17
-
18
- const ErrorBox = styled.div`
19
- width: 100%;
20
- height: 100%;
21
- display: flex;
22
- flex-direction: column;
23
- align-items: center;
24
- justify-content: center;
25
- `
26
-
27
- /**
28
- * An Error Boundary that renders an ErrorFeedback instead of its content if any of its children throws.
29
- *
30
- * To customize what properties are passed to the ErrorFeedback component, setup an error descriptor for the ErrorManager class. If you're
31
- * using the component `Layout` or `RawLayout`, you can use the property `errorDescriptor`.
32
- *
33
- * To run an error handler every time an error is catch by this boundary, setup an error handler for the ErrorManager class. If you're
34
- * using the component `Layout` or `RawLayout`, you can use the property `onError`.
35
- */
36
- export class ErrorBoundary extends Component<Props, State> {
37
- constructor(props: Props) {
38
- super(props)
39
- this.state = { hasError: false }
40
- }
41
-
42
- static getDerivedStateFromError(error: any) {
43
- const message = error instanceof StackspotAPIError ? error.translate() : (error.message ?? `${error}`)
44
- const code = error instanceof StackspotAPIError ? error.status : undefined
45
- return { hasError: true, message, code }
46
- }
47
-
48
- componentDidCatch(error: any, errorInfo: any) {
49
- // eslint-disable-next-line no-console
50
- console.error(error, errorInfo)
51
- }
52
-
53
- componentDidUpdate(prevProps: Readonly<Props>) {
54
- if (this.props.children !== prevProps.children) this.setState({ hasError: false })
55
- }
56
-
57
- private renderError() {
58
- return this.props.mini
59
- ? (
60
- <ErrorBox className="error">
61
- <IconBox size="lg" colorIcon="danger.500"><TimesCircle /></IconBox>
62
- <Text colorScheme="light.700">{this.props.message || this.state.message}</Text>
63
- </ErrorBox>
64
- )
65
- : <ErrorFeedback className="error" code={this.state.code} message={this.props.message || this.state.message} />
66
- }
67
-
68
- render() {
69
- return this.state.hasError ? this.renderError() : this.props.children
70
- }
71
- }
@@ -1,14 +0,0 @@
1
- import { LoadingCircular } from '@citric/ui'
2
- import styled from 'styled-components'
3
-
4
- const LoadingBox = styled.div`
5
- width: 100%;
6
- height: 100%;
7
- display: flex;
8
- align-items: center;
9
- justify-content: center;
10
- `
11
-
12
- export const Loading = () => (
13
- <LoadingBox className="loading"><LoadingCircular /></LoadingBox>
14
- )
@@ -1,26 +0,0 @@
1
- import { Suspense } from 'react'
2
- import { WithChildren } from '../../types'
3
- import { ErrorBoundary } from './ErrorBoundary'
4
- import { Loading } from './Loading'
5
-
6
- interface Props extends WithChildren {
7
- /**
8
- * Use this to show errors in small spaces.
9
- */
10
- mini?: boolean,
11
- /**
12
- * Replaces the error message with this text.
13
- */
14
- message?: string,
15
- }
16
-
17
- /**
18
- * Fallbacks for errors and loadings (suspense).
19
- */
20
- export const FallbackBoundary = ({ children, mini, message }: Props) => (
21
- <ErrorBoundary mini={mini} message={message}>
22
- <Suspense fallback={<Loading />}>
23
- {children}
24
- </Suspense>
25
- </ErrorBoundary>
26
- )
@@ -1,73 +0,0 @@
1
- import { IconBox } from '@citric/core'
2
- import { listToClass, theme } from '@stack-spot/portal-theme'
3
- import { useMemo, useState } from 'react'
4
- import { styled } from 'styled-components'
5
-
6
- interface Props extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
7
- icon: React.ReactElement,
8
- onChange?: (value: string) => void,
9
- }
10
-
11
- const InputBox = styled.div`
12
- display: flex;
13
- flex-direction: row;
14
- transition: border-color 0.3s, box-shadow 0.3s;
15
- border: 1px solid ${theme.color.light[600]};
16
- border-radius: 0.25rem;
17
- background-color: ${theme.color.light[300]};
18
- overflow: hidden;
19
- flex-shrink: 0;
20
-
21
- &.focused {
22
- border-color: ${theme.color.primary[500]};
23
- box-shadow: 0 0 0 1px ${theme.color.primary[500]};
24
- }
25
-
26
- &.disabled {
27
- background-color: ${theme.color.light[500]};
28
- }
29
-
30
- ${IconBox} {
31
- width: 40px;
32
- height: 40px;
33
- border-radius: 0;
34
- background-color: ${theme.color.light[600]};
35
- }
36
-
37
- input {
38
- padding: 8px;
39
- border: none;
40
- background-color: transparent;
41
- flex: 1;
42
- color: ${theme.color.light.contrastText};
43
-
44
- &:focus {
45
- outline: none;
46
- }
47
- }
48
- `
49
-
50
- /**
51
- * A text input with an icon at the left side.
52
- */
53
- export const IconInput = ({ icon, onChange, style, className, disabled, onFocus, onBlur, ...props }: Props) => {
54
- const [focused, setFocused] = useState(false)
55
-
56
- const { focus, blur } = useMemo(() => ({
57
- focus: (e: React.FocusEvent<HTMLInputElement, Element>) => {
58
- setFocused(true)
59
- onFocus?.(e)
60
- },
61
- blur: (e: React.FocusEvent<HTMLInputElement, Element>) => {
62
- setFocused(false)
63
- onBlur?.(e)
64
- },
65
- }), [])
66
-
67
- return (
68
- <InputBox style={style} className={listToClass([className, focused && !disabled && 'focused', disabled && 'disabled'])}>
69
- <IconBox>{icon}</IconBox>
70
- <input {...props} disabled={disabled} onFocus={focus} onBlur={blur} onChange={e => onChange?.(e.target.value)} />
71
- </InputBox>
72
- )
73
- }
@@ -1,133 +0,0 @@
1
- /* eslint-disable react/display-name */
2
- import { IconBox, Text } from '@citric/core'
3
- import { useKeyboardControls } from '@stack-spot/portal-components'
4
- import { theme, WithStyle } from '@stack-spot/portal-theme'
5
- import { forwardRef, RefObject, useCallback, useRef } from 'react'
6
- import { styled } from 'styled-components'
7
- import { ButtonAction, WithChildren } from '../types'
8
- import { Tooltip } from './Tooltip'
9
- import { useTooltip } from './Tooltip/context'
10
- import { TooltipPosition } from './Tooltip/types'
11
-
12
- interface Props extends WithStyle, WithChildren {
13
- /**
14
- * The position of the menu relative to its children.
15
- */
16
- position?: TooltipPosition,
17
- /**
18
- * The actions of the menu.
19
- */
20
- actions: ButtonAction[],
21
- }
22
-
23
- interface MenuProps {
24
- /**
25
- * The actions of the menu.
26
- */
27
- actions: ButtonAction[],
28
- /**
29
- * A reference to the HTML element that triggered the menu.
30
- */
31
- trigger: RefObject<HTMLDivElement>,
32
- }
33
-
34
- const MenuList = styled.ul`
35
- margin: 0;
36
- padding: 0;
37
- list-style: none;
38
- border-radius: 8px;
39
- background-color: ${theme.color.light[400]};
40
- overflow: hidden;
41
- display: flex;
42
- flex-direction: column;
43
-
44
- > li {
45
- display: flex;
46
- flex-direction: column;
47
-
48
- > button {
49
- padding: 8px 12px;
50
- transition: background-color 0.2s;
51
- cursor: pointer;
52
- display: flex;
53
- flex-direction: row;
54
- align-items: center;
55
- gap: 8px;
56
- background-color: transparent;
57
- border: none;
58
- outline: none;
59
-
60
- &:hover, &:focus {
61
- background-color: ${theme.color.light[500]};
62
- }
63
- }
64
- }
65
- `
66
-
67
- const StyledButton = styled.button<{ $color: string | undefined }>`
68
- color: ${({ $color }) => $color || theme.color.light.contrastText};
69
-
70
- svg {
71
- fill: ${({ $color }) => $color || theme.color.light.contrastText};
72
- }
73
- `
74
-
75
- const Menu = ({ actions, trigger }: MenuProps) => {
76
- const tooltip = useTooltip()
77
- const ref = useRef<HTMLUListElement>(null)
78
-
79
- useKeyboardControls({
80
- querySelectors: 'button',
81
- onPressEscape: () => {
82
- tooltip.hide()
83
- trigger.current?.focus()
84
- },
85
- ref,
86
- }, [])
87
-
88
- return (
89
- <MenuList ref={ref}>
90
- {actions.map(({ label, onClick, className, color, icon, style }) => (
91
- <li key={label} className={className} style={style}>
92
- <StyledButton $color={color} onClick={() => {
93
- onClick()
94
- tooltip.hide()
95
- }}>
96
- <IconBox>{icon}</IconBox>
97
- <Text>{label}</Text>
98
- </StyledButton>
99
- </li>
100
- ))}
101
- </MenuList>
102
- )
103
- }
104
-
105
- /**
106
- * A floating menu that shows up when the user clicks the children.
107
- *
108
- * This uses the tooltip component to build the menu.
109
- */
110
- export const OverlayMenu = forwardRef<HTMLDivElement, Props>(({ actions, children, className, position, style }, externalRef) => {
111
- const localRef = useRef<HTMLDivElement>(null)
112
- const ref = externalRef as RefObject<HTMLDivElement> ?? localRef
113
- const tooltip = useTooltip()
114
-
115
- const onShow = useCallback(() => {
116
- tooltip.tooltipRef.current?.querySelector('button')?.focus()
117
- }, [])
118
-
119
- return (
120
- <Tooltip
121
- content={<Menu actions={actions} trigger={ref} />}
122
- custom
123
- position={position}
124
- className={className}
125
- style={style}
126
- triggeredBy="click"
127
- onShow={onShow}
128
- ref={ref}
129
- >
130
- {children}
131
- </Tooltip>
132
- )
133
- })
@@ -1,183 +0,0 @@
1
- import { listToClass, theme, WithStyle } from '@stack-spot/portal-theme'
2
- import { styled } from 'styled-components'
3
-
4
- interface Props extends WithStyle {
5
- /**
6
- * Apply animation effects to the progress bar.
7
- */
8
- animate?: boolean,
9
- /**
10
- * Whether or not the progress bar is visible.
11
- */
12
- visible?: boolean,
13
- /**
14
- * When true, the progress bar becomes very colorful and bright.
15
- */
16
- shimmer?: boolean,
17
- /**
18
- * Color to use in the progress bar that appears in the foreground. Arrays create linear gradients.
19
- * @default primary.500 if shimmer is false, white otherwise.
20
- */
21
- foregroundColor?: string | string[],
22
- /**
23
- * Color to use in the progress bar that appears in the background. Arrays create linear gradients.
24
- * @default light.500 if shimmer is false, a transparent white otherwise.
25
- */
26
- backgroundColor?: string | string[],
27
- /**
28
- * Only useful if `shimmer` is true. This allows to customize the colors in the shimmering effect. Arrays create linear gradients.
29
- * @default ['#ff6633', '#d668cd', '#ff6633', '#FFF8', '#299cf4']
30
- */
31
- shimmerColor?: string | string[],
32
- }
33
-
34
- function gradientFromColorArray(colors: string[]) {
35
- if (colors.length === 1) return colors[0]
36
- const step = 100 / (colors.length - 1)
37
- const partials: string[] = []
38
- let current = 0
39
- for (const color of colors) {
40
- partials.push(`${color} ${Math.ceil(current)}%`)
41
- current += step
42
- }
43
- return `linear-gradient(to right, ${partials.join(', ')})`
44
- }
45
-
46
- // the shimmering effect requires more space
47
- const SHIMMER_PADDING = '10px'
48
-
49
- const Styled = styled.div<{ $bg: string[], $fg: string[], $shimmer: string[], $animate?: boolean }>`
50
- /* margin: ${({ $shimmer }) => $shimmer.length > 0 ? '7px 0' : '0'}; */
51
- opacity: 0;
52
- transition: opacity 0.5s;
53
-
54
- &.visible {
55
- opacity: 1;
56
- }
57
-
58
- .shimmer {
59
- display: flex;
60
- flex-direction: column;
61
- justify-content: center;
62
- height: 10px;
63
- position: relative;
64
- padding: 0 ${SHIMMER_PADDING};
65
- margin: 3px 0;
66
-
67
- .progress-glow {
68
- filter: blur(2px);
69
- position: absolute;
70
- top: 0;
71
- left: ${SHIMMER_PADDING};
72
- bottom: 0;
73
- right: ${SHIMMER_PADDING};
74
- display: flex;
75
- flex-direction: column;
76
- justify-content: center;
77
- overflow: hidden;
78
-
79
- &::before {
80
- content: '';
81
- height: 3px;
82
- display: block;
83
- width: 33%;
84
- display: block;
85
- animation: slide 3s infinite forwards;
86
- background: ${({ $fg }) => gradientFromColorArray($fg)};
87
- }
88
- }
89
-
90
- .colors {
91
- position: absolute;
92
- top: 0;
93
- bottom: 0;
94
- left: 0;
95
- right: 0;
96
- overflow: hidden;
97
- filter: blur(10px);
98
-
99
- ${({ $shimmer }) => `
100
- &:before {
101
- content: '';
102
- position: absolute;
103
- top: 0;
104
- bottom: 0;
105
- width: ${$shimmer.length * 100}%;
106
- background: ${gradientFromColorArray($shimmer)};
107
- ${$shimmer.length > 2 ? `animation: shimmer-slide ${$shimmer.length}s ease-in infinite alternate;` : ''}
108
- }
109
-
110
- @keyframes shimmer-slide {
111
- from {
112
- left: 0;
113
- }
114
- to {
115
- left: -${($shimmer.length - 1) * 100}%;
116
- }
117
- }
118
- `}
119
- }
120
- }
121
-
122
- .progress-bar {
123
- height: 2px;
124
- width: 100%;
125
- background: ${({ $bg }) => gradientFromColorArray($bg)};
126
- position: relative;
127
- overflow-x: clip;
128
-
129
- &:before {
130
- content: '';
131
- display: block;
132
- width: 100%;
133
- height: 100%;
134
- background: ${({ $fg, $animate, $bg }) => $animate ? gradientFromColorArray($fg) : $bg};
135
- animation: ${({ $animate }) => $animate ? 'slide .5s infinite forwards' : 'none'};
136
- }
137
-
138
- @keyframes slide {
139
- from {
140
- margin-left: -100%;
141
- }
142
- to {
143
- margin-left: 100%;
144
- }
145
- }
146
- }
147
- `
148
-
149
- /**
150
- * A progress bar with indefinite progress report. This renders a narrower bar on top of larger one that animates from the left to the
151
- * right.
152
- */
153
- export const ProgressBar = ({
154
- animate,
155
- visible = true,
156
- shimmer,
157
- backgroundColor = shimmer ? 'rgba(255, 255, 255, 0.4)' : theme.color.light[500],
158
- foregroundColor = shimmer ? ['#FFF0', '#FFF', '#FFF0'] : theme.color.primary[500],
159
- shimmerColor = ['#ff6633', '#d668cd', '#ff6633', '#FFF8', '#299cf4'],
160
- className,
161
- style,
162
- }: Props) => {
163
- const $bg = Array.isArray(backgroundColor) ? backgroundColor : [backgroundColor]
164
- const $fg = Array.isArray(foregroundColor) ? foregroundColor : [...$bg, foregroundColor, ...$bg]
165
- const $shimmer = Array.isArray(shimmerColor) ? shimmerColor : [shimmerColor]
166
- const progress = <div className="progress-bar"></div>
167
- const result = shimmer
168
- ? (
169
- <div className={listToClass([shimmer && 'shimmer'])}>
170
- <div className="colors"></div>
171
- <div className="progress-glow"></div>
172
- {progress}
173
- </div>
174
- )
175
- : progress
176
- return (
177
- <Styled
178
- className={listToClass([className, visible && 'visible'])}
179
- style={style} $fg={$fg} $bg={$bg} $shimmer={$shimmer} $animate={animate}>
180
- {result}
181
- </Styled>
182
- )
183
- }
@@ -1,78 +0,0 @@
1
- /* eslint-disable react/display-name */
2
- import { Text } from '@citric/core'
3
- import { WithStyle } from '@stack-spot/portal-theme'
4
- import { forwardRef } from 'react'
5
- import { WithChildren } from '../../types'
6
- import { useTooltip } from './context'
7
- import { DefaultTooltip } from './style'
8
- import { TooltipPosition } from './types'
9
-
10
- interface Props extends WithChildren, WithStyle {
11
- /**
12
- * The content of the tooltip. Can be either a string or a Rect Element.
13
- */
14
- content: React.ReactNode,
15
- /**
16
- * Where to position the tooltip relative to the element that triggered it.
17
- */
18
- position?: TooltipPosition,
19
- /**
20
- * A tooltip can be triggered either by hovering an element or by clicking it.
21
- * @default 'hover'
22
- */
23
- triggeredBy?: 'click' | 'hover',
24
- /**
25
- * If true, no style is applied to the tooltip, letting you customize it however you want to.
26
- */
27
- custom?: boolean,
28
- /**
29
- * Function to run whenever the tooltip is shown.
30
- */
31
- onShow?: () => void,
32
- /**
33
- * Function to run whenever the tooltip is hidden.
34
- */
35
- onHide?: () => void,
36
- }
37
-
38
- /**
39
- * Shows a tooltip for its children. This tooltip element is always reused and placed at a root level in order to not be cut out by
40
- * hidden overflows in the children and its ascendants.
41
- */
42
- export const Tooltip = forwardRef<HTMLDivElement, Props>((
43
- { content, custom, position, triggeredBy = 'hover', onHide, onShow, children, className, style },
44
- ref,
45
- ) => {
46
- const api = useTooltip()
47
-
48
- async function show(e: React.UIEvent, hideOnClickOutside?: boolean) {
49
- await api.show({
50
- content: custom ? content : <DefaultTooltip><Text appearance="microtext1">{content}</Text></DefaultTooltip>,
51
- anchor: e.target as HTMLElement,
52
- position,
53
- hideOnClickOutside,
54
- })
55
- onShow?.()
56
- }
57
-
58
- function hide() {
59
- api.hide()
60
- onHide?.()
61
- }
62
-
63
- return (
64
- <div
65
- {...(triggeredBy === 'hover'
66
- ? { onMouseEnter: show, onMouseLeave: hide }
67
- : { onClick: (e) => show(e, true), onKeyDown: (e) => e.key === 'Enter' && show(e, true) }
68
- )}
69
- className={className}
70
- style={style}
71
- tabIndex={triggeredBy === 'click' ? 0 : undefined}
72
- role={triggeredBy === 'click' ? 'button' : undefined}
73
- ref={ref}
74
- >
75
- {children}
76
- </div>
77
- )
78
- })