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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. package/CHANGELOG.md +33 -32
  2. package/dist/StackspotAIWidget.d.ts +14 -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 -5
  7. package/dist/chat-interceptors/quick-commands.js +3 -3
  8. package/dist/chat-interceptors/quick-commands.js.map +1 -1
  9. package/dist/components/AdaptiveTextArea.d.ts +1 -1
  10. package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
  11. package/dist/components/AdaptiveTextArea.js +1 -1
  12. package/dist/components/AdaptiveTextArea.js.map +1 -1
  13. package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -1
  14. package/dist/components/AgentCard/AgentCardCreate.js +4 -5
  15. package/dist/components/AgentCard/AgentCardCreate.js.map +1 -1
  16. package/dist/components/AgentCard/index.d.ts.map +1 -1
  17. package/dist/components/AgentCard/index.js +5 -6
  18. package/dist/components/AgentCard/index.js.map +1 -1
  19. package/dist/components/ButtonFavorite.d.ts +8 -7
  20. package/dist/components/ButtonFavorite.d.ts.map +1 -1
  21. package/dist/components/ButtonFavorite.js +5 -14
  22. package/dist/components/ButtonFavorite.js.map +1 -1
  23. package/dist/components/Code.d.ts.map +1 -1
  24. package/dist/components/Code.js +11 -9
  25. package/dist/components/Code.js.map +1 -1
  26. package/dist/components/ComponentNavigator.d.ts.map +1 -1
  27. package/dist/components/ComponentNavigator.js +2 -4
  28. package/dist/components/ComponentNavigator.js.map +1 -1
  29. package/dist/components/FadingOverflow.d.ts.map +1 -1
  30. package/dist/components/FadingOverflow.js +3 -4
  31. package/dist/components/FadingOverflow.js.map +1 -1
  32. package/dist/components/FileDescription.d.ts.map +1 -1
  33. package/dist/components/FileDescription.js +3 -4
  34. package/dist/components/FileDescription.js.map +1 -1
  35. package/dist/components/HistoryList.d.ts.map +1 -1
  36. package/dist/components/HistoryList.js +3 -1
  37. package/dist/components/HistoryList.js.map +1 -1
  38. package/dist/components/ListResource.js +3 -3
  39. package/dist/components/ListResource.js.map +1 -1
  40. package/dist/components/Markdown.js +1 -1
  41. package/dist/components/Markdown.js.map +1 -1
  42. package/dist/components/Modal.d.ts.map +1 -1
  43. package/dist/components/Modal.js +2 -4
  44. package/dist/components/Modal.js.map +1 -1
  45. package/dist/components/QuickStartButton.d.ts +2 -3
  46. package/dist/components/QuickStartButton.d.ts.map +1 -1
  47. package/dist/components/QuickStartButton.js +4 -3
  48. package/dist/components/QuickStartButton.js.map +1 -1
  49. package/dist/components/RightPanelForm.d.ts.map +1 -1
  50. package/dist/components/RightPanelForm.js +20 -13
  51. package/dist/components/RightPanelForm.js.map +1 -1
  52. package/dist/components/RightPanelTabs.d.ts +1 -4
  53. package/dist/components/RightPanelTabs.d.ts.map +1 -1
  54. package/dist/components/RightPanelTabs.js +4 -16
  55. package/dist/components/RightPanelTabs.js.map +1 -1
  56. package/dist/components/Selector/index.d.ts.map +1 -1
  57. package/dist/components/Selector/index.js +5 -8
  58. package/dist/components/Selector/index.js.map +1 -1
  59. package/dist/components/Selector/styled.d.ts.map +1 -1
  60. package/dist/components/Selector/styled.js +8 -5
  61. package/dist/components/Selector/styled.js.map +1 -1
  62. package/dist/components/StackedBadge.js +5 -5
  63. package/dist/components/StackedBadge.js.map +1 -1
  64. package/dist/components/TabManager.d.ts.map +1 -1
  65. package/dist/components/TabManager.js +9 -32
  66. package/dist/components/TabManager.js.map +1 -1
  67. package/dist/components/ToolBadge.d.ts +3 -8
  68. package/dist/components/ToolBadge.d.ts.map +1 -1
  69. package/dist/components/ToolBadge.js +23 -99
  70. package/dist/components/ToolBadge.js.map +1 -1
  71. package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
  72. package/dist/components/WorkspaceTabNavigator.js +7 -9
  73. package/dist/components/WorkspaceTabNavigator.js.map +1 -1
  74. package/dist/components/form/DescribedCheckboxGroup.d.ts +24 -2
  75. package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
  76. package/dist/components/form/DescribedCheckboxGroup.js +46 -29
  77. package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
  78. package/dist/components/form/DescribedRadioGroup.d.ts +24 -4
  79. package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
  80. package/dist/components/form/DescribedRadioGroup.js +39 -18
  81. package/dist/components/form/DescribedRadioGroup.js.map +1 -1
  82. package/dist/context/hooks.d.ts +6 -1
  83. package/dist/context/hooks.d.ts.map +1 -1
  84. package/dist/context/hooks.js +4 -1
  85. package/dist/context/hooks.js.map +1 -1
  86. package/dist/hooks/midnight-update-view.d.ts +5 -0
  87. package/dist/hooks/midnight-update-view.d.ts.map +1 -0
  88. package/dist/hooks/midnight-update-view.js +30 -0
  89. package/dist/hooks/midnight-update-view.js.map +1 -0
  90. package/dist/index.d.ts +4 -2
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +1 -1
  93. package/dist/index.js.map +1 -1
  94. package/dist/layout.css +0 -26
  95. package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
  96. package/dist/right-panel/DefaultPanel.js +2 -4
  97. package/dist/right-panel/DefaultPanel.js.map +1 -1
  98. package/dist/state/ChatEntry.d.ts +3 -4
  99. package/dist/state/ChatEntry.d.ts.map +1 -1
  100. package/dist/state/ChatEntry.js.map +1 -1
  101. package/dist/state/constants.d.ts.map +1 -1
  102. package/dist/state/constants.js +1 -0
  103. package/dist/state/constants.js.map +1 -1
  104. package/dist/types.d.ts +8 -3
  105. package/dist/types.d.ts.map +1 -1
  106. package/dist/utils/tools.d.ts +9 -3
  107. package/dist/utils/tools.d.ts.map +1 -1
  108. package/dist/utils/tools.js +1 -6
  109. package/dist/utils/tools.js.map +1 -1
  110. package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
  111. package/dist/views/Agents/AgentDescription.js +8 -13
  112. package/dist/views/Agents/AgentDescription.js.map +1 -1
  113. package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
  114. package/dist/views/Agents/AgentsPanel.js +7 -7
  115. package/dist/views/Agents/AgentsPanel.js.map +1 -1
  116. package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
  117. package/dist/views/Agents/AgentsTab.js +30 -29
  118. package/dist/views/Agents/AgentsTab.js.map +1 -1
  119. package/dist/views/Agents/dictionary.d.ts +1 -1
  120. package/dist/views/Agents/useAgentFavorites.js +3 -3
  121. package/dist/views/Agents/useAgentFavorites.js.map +1 -1
  122. package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
  123. package/dist/views/Chat/AgentInfo.js +3 -5
  124. package/dist/views/Chat/AgentInfo.js.map +1 -1
  125. package/dist/views/Chat/ChatMessage.d.ts +24 -2
  126. package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
  127. package/dist/views/Chat/ChatMessage.js +36 -47
  128. package/dist/views/Chat/ChatMessage.js.map +1 -1
  129. package/dist/views/Chat/ChatMessages.d.ts +1 -1
  130. package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
  131. package/dist/views/Chat/ChatMessages.js +2 -2
  132. package/dist/views/Chat/ChatMessages.js.map +1 -1
  133. package/dist/views/Chat/StepsList.d.ts.map +1 -1
  134. package/dist/views/Chat/StepsList.js +10 -10
  135. package/dist/views/Chat/StepsList.js.map +1 -1
  136. package/dist/views/Chat/index.d.ts +1 -1
  137. package/dist/views/Chat/index.d.ts.map +1 -1
  138. package/dist/views/Chat/index.js +2 -2
  139. package/dist/views/Chat/index.js.map +1 -1
  140. package/dist/views/Chat/styled.d.ts.map +1 -1
  141. package/dist/views/Chat/styled.js +11 -16
  142. package/dist/views/Chat/styled.js.map +1 -1
  143. package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
  144. package/dist/views/ChatHistory/HistoryItem.js +10 -48
  145. package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
  146. package/dist/views/ChatHistory/index.js +1 -1
  147. package/dist/views/ChatHistory/index.js.map +1 -1
  148. package/dist/views/ChatHistory/styled.d.ts.map +1 -1
  149. package/dist/views/ChatHistory/styled.js +3 -5
  150. package/dist/views/ChatHistory/styled.js.map +1 -1
  151. package/dist/views/ChatHistory/utils.d.ts +7 -0
  152. package/dist/views/ChatHistory/utils.d.ts.map +1 -1
  153. package/dist/views/ChatHistory/utils.js +40 -1
  154. package/dist/views/ChatHistory/utils.js.map +1 -1
  155. package/dist/views/ChatTabSelection.d.ts +6 -1
  156. package/dist/views/ChatTabSelection.d.ts.map +1 -1
  157. package/dist/views/ChatTabSelection.js +13 -8
  158. package/dist/views/ChatTabSelection.js.map +1 -1
  159. package/dist/views/Editor.d.ts.map +1 -1
  160. package/dist/views/Editor.js +6 -12
  161. package/dist/views/Editor.js.map +1 -1
  162. package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
  163. package/dist/views/Home/BuiltInAgent.js +2 -3
  164. package/dist/views/Home/BuiltInAgent.js.map +1 -1
  165. package/dist/views/Home/CustomAgent.js +3 -3
  166. package/dist/views/Home/CustomAgent.js.map +1 -1
  167. package/dist/views/Home/index.js +2 -2
  168. package/dist/views/Home/index.js.map +1 -1
  169. package/dist/views/Home/styled.d.ts.map +1 -1
  170. package/dist/views/Home/styled.js +21 -22
  171. package/dist/views/Home/styled.js.map +1 -1
  172. package/dist/views/KSDocument.d.ts.map +1 -1
  173. package/dist/views/KSDocument.js +3 -4
  174. package/dist/views/KSDocument.js.map +1 -1
  175. package/dist/views/KnowledgeSources.d.ts.map +1 -1
  176. package/dist/views/KnowledgeSources.js +14 -36
  177. package/dist/views/KnowledgeSources.js.map +1 -1
  178. package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
  179. package/dist/views/MessageInput/AgentSelector.js +7 -5
  180. package/dist/views/MessageInput/AgentSelector.js.map +1 -1
  181. package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -1
  182. package/dist/views/MessageInput/ButtonAgent.js +4 -5
  183. package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
  184. package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
  185. package/dist/views/MessageInput/ButtonBar.js +2 -4
  186. package/dist/views/MessageInput/ButtonBar.js.map +1 -1
  187. package/dist/views/MessageInput/ContextBar.d.ts.map +1 -1
  188. package/dist/views/MessageInput/ContextBar.js +3 -6
  189. package/dist/views/MessageInput/ContextBar.js.map +1 -1
  190. package/dist/views/MessageInput/QuickCommandSelector.js +2 -2
  191. package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
  192. package/dist/views/MessageInput/SelectContent.d.ts.map +1 -1
  193. package/dist/views/MessageInput/SelectContent.js +30 -29
  194. package/dist/views/MessageInput/SelectContent.js.map +1 -1
  195. package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
  196. package/dist/views/MessageInput/UploadDragNDrop.js +2 -3
  197. package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
  198. package/dist/views/MessageInput/dictionary.d.ts +1 -1
  199. package/dist/views/MessageInput/index.d.ts +2 -1
  200. package/dist/views/MessageInput/index.d.ts.map +1 -1
  201. package/dist/views/MessageInput/index.js +5 -6
  202. package/dist/views/MessageInput/index.js.map +1 -1
  203. package/dist/views/MessageInput/styled.d.ts +1 -3
  204. package/dist/views/MessageInput/styled.d.ts.map +1 -1
  205. package/dist/views/MessageInput/styled.js +11 -15
  206. package/dist/views/MessageInput/styled.js.map +1 -1
  207. package/dist/views/MinimizedHeader.d.ts.map +1 -1
  208. package/dist/views/MinimizedHeader.js +3 -4
  209. package/dist/views/MinimizedHeader.js.map +1 -1
  210. package/dist/views/Resources.d.ts.map +1 -1
  211. package/dist/views/Resources.js +11 -8
  212. package/dist/views/Resources.js.map +1 -1
  213. package/dist/views/Stacks.d.ts.map +1 -1
  214. package/dist/views/Stacks.js +23 -28
  215. package/dist/views/Stacks.js.map +1 -1
  216. package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -1
  217. package/dist/views/Steps/FlowChart/NodeStep.js +3 -3
  218. package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -1
  219. package/dist/views/Steps/StepModal.d.ts.map +1 -1
  220. package/dist/views/Steps/StepModal.js +4 -6
  221. package/dist/views/Steps/StepModal.js.map +1 -1
  222. package/dist/views/Steps/dictionary.d.ts +1 -1
  223. package/dist/views/Steps/index.d.ts.map +1 -1
  224. package/dist/views/Steps/index.js +3 -4
  225. package/dist/views/Steps/index.js.map +1 -1
  226. package/dist/views/Steps/utils.d.ts +2 -1
  227. package/dist/views/Steps/utils.d.ts.map +1 -1
  228. package/dist/views/Steps/utils.js +8 -8
  229. package/dist/views/Steps/utils.js.map +1 -1
  230. package/dist/views/Tools.js +1 -1
  231. package/dist/views/Tools.js.map +1 -1
  232. package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
  233. package/dist/views/Workspaces/WorkspacesTab.js +7 -10
  234. package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
  235. package/dist/views/Workspaces/index.js +4 -2
  236. package/dist/views/Workspaces/index.js.map +1 -1
  237. package/package.json +5 -3
  238. package/src/StackspotAIWidget.tsx +51 -37
  239. package/src/app-metadata.json +13 -5
  240. package/src/chat-interceptors/quick-commands.ts +3 -3
  241. package/src/components/AdaptiveTextArea.tsx +1 -1
  242. package/src/components/AgentCard/AgentCardCreate.tsx +4 -7
  243. package/src/components/AgentCard/index.tsx +7 -7
  244. package/src/components/ButtonFavorite.tsx +20 -47
  245. package/src/components/Code.tsx +31 -36
  246. package/src/components/ComponentNavigator.tsx +4 -8
  247. package/src/components/FadingOverflow.tsx +6 -7
  248. package/src/components/FileDescription.tsx +14 -10
  249. package/src/components/HistoryList.tsx +4 -1
  250. package/src/components/ListResource.tsx +5 -5
  251. package/src/components/Markdown.tsx +1 -1
  252. package/src/components/Modal.tsx +2 -4
  253. package/src/components/QuickStartButton.tsx +5 -4
  254. package/src/components/RightPanelForm.tsx +20 -13
  255. package/src/components/RightPanelTabs.tsx +4 -32
  256. package/src/components/Selector/index.tsx +17 -13
  257. package/src/components/Selector/styled.ts +8 -5
  258. package/src/components/StackedBadge.tsx +5 -5
  259. package/src/components/TabManager.tsx +31 -55
  260. package/src/components/ToolBadge.tsx +48 -129
  261. package/src/components/WorkspaceTabNavigator.tsx +22 -25
  262. package/src/components/form/DescribedCheckboxGroup.tsx +90 -65
  263. package/src/components/form/DescribedRadioGroup.tsx +78 -46
  264. package/src/context/hooks.ts +4 -1
  265. package/src/hooks/midnight-update-view.ts +36 -0
  266. package/src/index.ts +4 -2
  267. package/src/layout.css +0 -26
  268. package/src/right-panel/DefaultPanel.tsx +3 -7
  269. package/src/state/ChatEntry.ts +3 -4
  270. package/src/state/constants.ts +2 -1
  271. package/src/types.ts +9 -3
  272. package/src/utils/tools.ts +3 -12
  273. package/src/views/Agents/AgentDescription.tsx +20 -36
  274. package/src/views/Agents/AgentsPanel.tsx +11 -12
  275. package/src/views/Agents/AgentsTab.tsx +38 -57
  276. package/src/views/Agents/useAgentFavorites.ts +3 -3
  277. package/src/views/Chat/AgentInfo.tsx +7 -6
  278. package/src/views/Chat/ChatMessage.tsx +163 -145
  279. package/src/views/Chat/ChatMessages.tsx +2 -1
  280. package/src/views/Chat/StepsList.tsx +10 -11
  281. package/src/views/Chat/index.tsx +9 -2
  282. package/src/views/Chat/styled.ts +11 -16
  283. package/src/views/ChatHistory/HistoryItem.tsx +15 -54
  284. package/src/views/ChatHistory/index.tsx +1 -1
  285. package/src/views/ChatHistory/styled.ts +3 -5
  286. package/src/views/ChatHistory/utils.ts +43 -2
  287. package/src/views/ChatTabSelection.tsx +18 -10
  288. package/src/views/Editor.tsx +9 -14
  289. package/src/views/Home/BuiltInAgent.tsx +7 -8
  290. package/src/views/Home/CustomAgent.tsx +3 -3
  291. package/src/views/Home/index.tsx +2 -2
  292. package/src/views/Home/styled.ts +21 -22
  293. package/src/views/KSDocument.tsx +7 -8
  294. package/src/views/KnowledgeSources.tsx +24 -66
  295. package/src/views/MessageInput/AgentSelector.tsx +10 -8
  296. package/src/views/MessageInput/ButtonAgent.tsx +24 -12
  297. package/src/views/MessageInput/ButtonBar.tsx +25 -21
  298. package/src/views/MessageInput/ContextBar.tsx +16 -14
  299. package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
  300. package/src/views/MessageInput/SelectContent.tsx +39 -62
  301. package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
  302. package/src/views/MessageInput/index.tsx +8 -9
  303. package/src/views/MessageInput/styled.ts +12 -16
  304. package/src/views/MinimizedHeader.tsx +5 -7
  305. package/src/views/Resources.tsx +31 -30
  306. package/src/views/Stacks.tsx +31 -54
  307. package/src/views/Steps/FlowChart/NodeStep.tsx +6 -4
  308. package/src/views/Steps/StepModal.tsx +14 -18
  309. package/src/views/Steps/index.tsx +4 -5
  310. package/src/views/Steps/utils.tsx +9 -9
  311. package/src/views/Tools.tsx +0 -1
  312. package/src/views/Workspaces/WorkspacesTab.tsx +17 -21
  313. package/src/views/Workspaces/index.tsx +4 -2
  314. package/dist/components/Accordion.d.ts +0 -20
  315. package/dist/components/Accordion.d.ts.map +0 -1
  316. package/dist/components/Accordion.js +0 -51
  317. package/dist/components/Accordion.js.map +0 -1
  318. package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -33
  319. package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
  320. package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -52
  321. package/dist/components/FallbackBoundary/ErrorBoundary.js.map +0 -1
  322. package/dist/components/FallbackBoundary/Loading.d.ts +0 -2
  323. package/dist/components/FallbackBoundary/Loading.d.ts.map +0 -1
  324. package/dist/components/FallbackBoundary/Loading.js +0 -12
  325. package/dist/components/FallbackBoundary/Loading.js.map +0 -1
  326. package/dist/components/FallbackBoundary/index.d.ts +0 -17
  327. package/dist/components/FallbackBoundary/index.d.ts.map +0 -1
  328. package/dist/components/FallbackBoundary/index.js +0 -9
  329. package/dist/components/FallbackBoundary/index.js.map +0 -1
  330. package/dist/components/IconInput.d.ts +0 -10
  331. package/dist/components/IconInput.d.ts.map +0 -1
  332. package/dist/components/IconInput.js +0 -61
  333. package/dist/components/IconInput.js.map +0 -1
  334. package/dist/components/OverlayMenu.d.ts +0 -21
  335. package/dist/components/OverlayMenu.d.ts.map +0 -1
  336. package/dist/components/OverlayMenu.js +0 -79
  337. package/dist/components/OverlayMenu.js.map +0 -1
  338. package/dist/components/ProgressBar.d.ts +0 -37
  339. package/dist/components/ProgressBar.d.ts.map +0 -1
  340. package/dist/components/ProgressBar.js +0 -131
  341. package/dist/components/ProgressBar.js.map +0 -1
  342. package/dist/components/Tooltip/Tooltip.d.ts +0 -37
  343. package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
  344. package/dist/components/Tooltip/Tooltip.js +0 -30
  345. package/dist/components/Tooltip/Tooltip.js.map +0 -1
  346. package/dist/components/Tooltip/TooltipAPI.d.ts +0 -29
  347. package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
  348. package/dist/components/Tooltip/TooltipAPI.js +0 -107
  349. package/dist/components/Tooltip/TooltipAPI.js.map +0 -1
  350. package/dist/components/Tooltip/context.d.ts +0 -5
  351. package/dist/components/Tooltip/context.d.ts.map +0 -1
  352. package/dist/components/Tooltip/context.js +0 -18
  353. package/dist/components/Tooltip/context.js.map +0 -1
  354. package/dist/components/Tooltip/index.d.ts +0 -3
  355. package/dist/components/Tooltip/index.d.ts.map +0 -1
  356. package/dist/components/Tooltip/index.js +0 -3
  357. package/dist/components/Tooltip/index.js.map +0 -1
  358. package/dist/components/Tooltip/style.d.ts +0 -4
  359. package/dist/components/Tooltip/style.d.ts.map +0 -1
  360. package/dist/components/Tooltip/style.js +0 -22
  361. package/dist/components/Tooltip/style.js.map +0 -1
  362. package/dist/components/Tooltip/types.d.ts +0 -27
  363. package/dist/components/Tooltip/types.d.ts.map +0 -1
  364. package/dist/components/Tooltip/types.js +0 -2
  365. package/dist/components/Tooltip/types.js.map +0 -1
  366. package/src/components/Accordion.tsx +0 -75
  367. package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -71
  368. package/src/components/FallbackBoundary/Loading.tsx +0 -14
  369. package/src/components/FallbackBoundary/index.tsx +0 -26
  370. package/src/components/IconInput.tsx +0 -73
  371. package/src/components/OverlayMenu.tsx +0 -133
  372. package/src/components/ProgressBar.tsx +0 -183
  373. package/src/components/Tooltip/Tooltip.tsx +0 -78
  374. package/src/components/Tooltip/TooltipAPI.ts +0 -101
  375. package/src/components/Tooltip/context.tsx +0 -24
  376. package/src/components/Tooltip/index.ts +0 -2
  377. package/src/components/Tooltip/style.tsx +0 -24
  378. package/src/components/Tooltip/types.ts +0 -28
@@ -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
- })
@@ -1,101 +0,0 @@
1
- import { delay } from '@stack-spot/portal-components'
2
- import { animationTimeMS } from './style'
3
- import { ShowOptions } from './types'
4
-
5
- // the maximum amount of pixels a tooltip can get close to the screen edges.
6
- const MARGIN_TO_CORNERS_PX = 10
7
-
8
- function isRelative(element: HTMLElement) {
9
- return ['relative', 'absolute', 'fixed'].includes(element.computedStyleMap().get('position')?.toString() ?? '')
10
- }
11
-
12
- /**
13
- * Allows interaction with the tooltip element.
14
- *
15
- * This places the tooltip element at the correct place, shows it, hides it and manages its contents.
16
- *
17
- * This also takes into account the screen edges, making adjustments to the tooltip position if it would overflow the screen.
18
- */
19
- export class TooltipAPI {
20
- /**
21
- * A reference to the tooltip element in the HTML tree.
22
- */
23
- tooltipRef: React.RefObject<HTMLDivElement>
24
- private setContent: React.Dispatch<React.SetStateAction<React.ReactNode>>
25
- private hideTimeoutId: number | undefined
26
- private clickListener: ((e: MouseEvent) => void) | undefined
27
- private relativeTo: HTMLElement | undefined
28
-
29
- constructor(tooltipRef: React.RefObject<HTMLDivElement>, setContent: React.Dispatch<React.SetStateAction<React.ReactNode>>) {
30
- this.tooltipRef = tooltipRef
31
- this.setContent = setContent
32
- }
33
-
34
- private computeRelativeTo() {
35
- if (this.relativeTo) return
36
- this.relativeTo = this.tooltipRef.current?.parentElement as HTMLElement
37
- while (this.relativeTo && this.relativeTo !== document.body && !isRelative(this.relativeTo)) {
38
- this.relativeTo = this.relativeTo.parentElement as HTMLElement
39
- }
40
- }
41
-
42
- /**
43
- * Shows the tooltip with `content`. Its position is based on `position` and the position of the element referred by `anchor`.
44
- */
45
- async show({ content, anchor, position = 'bottom', hideOnClickOutside }: ShowOptions) {
46
- window.clearTimeout(this.hideTimeoutId)
47
- this.hideTimeoutId = undefined
48
- if (this.clickListener) document.removeEventListener('click', this.clickListener)
49
- this.setContent(content)
50
- await delay(10)
51
- if (!this.tooltipRef.current) return
52
- const anchorRect = anchor.getClientRects()[0]
53
- this.tooltipRef.current.classList.add('visible')
54
- const tooltipWidth = this.tooltipRef.current.clientWidth
55
- const tooltipHeight = this.tooltipRef.current.clientHeight
56
- let top = 0
57
- let left = 0
58
- if (position === 'left' || position === 'right') {
59
- top = anchorRect.top + anchorRect.height / 2 - tooltipHeight / 2
60
- if (position === 'left') left = anchorRect.left - tooltipWidth
61
- else left = anchorRect.left + anchorRect.width
62
- } else {
63
- left = anchorRect.left + anchorRect.width / 2 - tooltipWidth / 2
64
- if (position === 'top') top = anchorRect.top - tooltipHeight
65
- else top = anchorRect.top + anchorRect.height
66
- }
67
- // takes the parent the tooltip is positioned relative to into consideration
68
- this.computeRelativeTo()
69
- const relativeRect = this.relativeTo?.getClientRects()[0] ?? { top: 0, left: 0 }
70
- top -= relativeRect.top
71
- left -= relativeRect.left
72
- // adjusts positions in order to avoid overflowing the window and leaving a margin to the corners
73
- if (top <= 0) top += MARGIN_TO_CORNERS_PX
74
- else if (top + tooltipHeight >= document.body.clientHeight - MARGIN_TO_CORNERS_PX) {
75
- top = document.body.clientHeight - MARGIN_TO_CORNERS_PX + tooltipHeight
76
- }
77
- if (left <= 0) left += MARGIN_TO_CORNERS_PX
78
- else if (left + tooltipWidth >= document.body.clientWidth - MARGIN_TO_CORNERS_PX) {
79
- left = document.body.clientWidth - MARGIN_TO_CORNERS_PX - tooltipWidth
80
- }
81
- this.tooltipRef.current.style.top = `${top}px`
82
- this.tooltipRef.current.style.left = `${left}px`
83
- if (hideOnClickOutside) {
84
- this.clickListener = (e: MouseEvent) => {
85
- if (this.tooltipRef.current?.contains(e.target as HTMLElement)) return
86
- this.hide()
87
- }
88
- document.addEventListener('click', this.clickListener)
89
- }
90
- }
91
-
92
- /**
93
- * Hides the tooltip. After the animation, the content is removed.
94
- */
95
- hide(): void {
96
- if (!this.tooltipRef.current) return
97
- this.tooltipRef.current.classList.remove('visible')
98
- this.hideTimeoutId = window.setTimeout(() => this.setContent(undefined), animationTimeMS)
99
- if (this.clickListener) document.removeEventListener('click', this.clickListener)
100
- }
101
- }
@@ -1,24 +0,0 @@
1
- import { createContext, useContext, useMemo, useRef, useState } from 'react'
2
- import { WithChildren } from '../../types'
3
- import { TooltipBox } from './style'
4
- import { TooltipAPI } from './TooltipAPI'
5
-
6
- const Context = createContext<TooltipAPI | undefined>(undefined)
7
-
8
- export const TooltipProvider = ({ children }: Required<WithChildren>) => {
9
- const ref = useRef<HTMLDivElement>(null)
10
- const [content, setContent] = useState<React.ReactNode>()
11
- const api = useMemo(() => new TooltipAPI(ref, setContent), [])
12
- return (
13
- <Context.Provider value={api}>
14
- {children}
15
- <TooltipBox ref={ref}>{content}</TooltipBox>
16
- </Context.Provider>
17
- )
18
- }
19
-
20
- export function useTooltip() {
21
- const api = useContext(Context)
22
- if (!api) throw new Error('In order to use tooltips, you must wrap your content in a <TooltipProvider>.')
23
- return api
24
- }
@@ -1,2 +0,0 @@
1
- export { TooltipProvider } from './context'
2
- export { Tooltip } from './Tooltip'
@@ -1,24 +0,0 @@
1
- import { theme } from '@stack-spot/portal-theme'
2
- import { styled } from 'styled-components'
3
-
4
- export const animationTimeMS = 300
5
-
6
- export const TooltipBox = styled.div`
7
- position: absolute;
8
- opacity: 0;
9
- transition: opacity ${animationTimeMS/ 1000}s;
10
- top: 0;
11
- left: 0;
12
-
13
- &.visible {
14
- opacity: 1;
15
- }
16
- `
17
-
18
- export const DefaultTooltip = styled.div`
19
- padding: 4px 8px;
20
- background-color: ${theme.color.inverse[500]};
21
- color: ${theme.color.inverse.contrastText};
22
- border-radius: 6px;
23
- margin: 6px;
24
- `
@@ -1,28 +0,0 @@
1
- export type TooltipPosition = 'left' | 'right' | 'top' | 'bottom'
2
-
3
- export interface BoxPosition {
4
- x1: number,
5
- x2: number,
6
- y1: number,
7
- y2: number,
8
- }
9
-
10
- export interface ShowOptions {
11
- /**
12
- * The content of the tooltip. Can be either a string or a React Element.
13
- */
14
- content: React.ReactNode,
15
- /**
16
- * The anchor to the tooltip. This is part of what defines the position where the tooltip will appear.
17
- */
18
- anchor: HTMLElement,
19
- /**
20
- * The position relative to the element referred by `anchor`.
21
- * @default bottom
22
- */
23
- position?: TooltipPosition,
24
- /**
25
- * Whether or not to hide the tooltip when a click is detected outside of it.
26
- */
27
- hideOnClickOutside?: boolean,
28
- }