@stack-spot/ai-chat-widget 1.36.1-betacitric.1 → 1.36.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.
- package/CHANGELOG.md +36 -0
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +7 -6
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +17 -13
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +9 -3
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/components/Accordion.d.ts +20 -0
- package/dist/components/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion.js +51 -0
- package/dist/components/Accordion.js.map +1 -0
- package/dist/components/AdaptiveTextArea.d.ts +1 -1
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +1 -1
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.js +3 -3
- package/dist/components/AgentCard/AgentCardCreate.js.map +1 -1
- package/dist/components/AgentCard/index.d.ts.map +1 -1
- package/dist/components/AgentCard/index.js +6 -5
- package/dist/components/AgentCard/index.js.map +1 -1
- package/dist/components/ButtonFavorite.d.ts +7 -8
- package/dist/components/ButtonFavorite.d.ts.map +1 -1
- package/dist/components/ButtonFavorite.js +14 -5
- package/dist/components/ButtonFavorite.js.map +1 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +9 -11
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts.map +1 -1
- package/dist/components/ComponentNavigator.js +4 -2
- package/dist/components/ComponentNavigator.js.map +1 -1
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +4 -3
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +33 -0
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/FallbackBoundary/ErrorBoundary.js +52 -0
- package/dist/components/FallbackBoundary/ErrorBoundary.js.map +1 -0
- package/dist/components/FallbackBoundary/Loading.d.ts +2 -0
- package/dist/components/FallbackBoundary/Loading.d.ts.map +1 -0
- package/dist/components/FallbackBoundary/Loading.js +12 -0
- package/dist/components/FallbackBoundary/Loading.js.map +1 -0
- package/dist/components/FallbackBoundary/index.d.ts +17 -0
- package/dist/components/FallbackBoundary/index.d.ts.map +1 -0
- package/dist/components/FallbackBoundary/index.js +9 -0
- package/dist/components/FallbackBoundary/index.js.map +1 -0
- package/dist/components/FileDescription.d.ts.map +1 -1
- package/dist/components/FileDescription.js +4 -3
- package/dist/components/FileDescription.js.map +1 -1
- package/dist/components/HistoryList.js +1 -1
- package/dist/components/HistoryList.js.map +1 -1
- package/dist/components/IconInput.d.ts +10 -0
- package/dist/components/IconInput.d.ts.map +1 -0
- package/dist/components/IconInput.js +61 -0
- package/dist/components/IconInput.js.map +1 -0
- package/dist/components/ListResource.js +3 -3
- package/dist/components/ListResource.js.map +1 -1
- package/dist/components/Markdown.js +1 -1
- package/dist/components/Markdown.js.map +1 -1
- package/dist/components/Modal.d.ts.map +1 -1
- package/dist/components/Modal.js +4 -2
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/OverlayMenu.d.ts +21 -0
- package/dist/components/OverlayMenu.d.ts.map +1 -0
- package/dist/components/OverlayMenu.js +79 -0
- package/dist/components/OverlayMenu.js.map +1 -0
- package/dist/components/ProgressBar.d.ts +37 -0
- package/dist/components/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar.js +131 -0
- package/dist/components/ProgressBar.js.map +1 -0
- package/dist/components/QuickStartButton.d.ts +3 -2
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +3 -4
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +13 -20
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +4 -1
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +16 -4
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +8 -5
- package/dist/components/Selector/index.js.map +1 -1
- package/dist/components/Selector/styled.d.ts.map +1 -1
- package/dist/components/Selector/styled.js +5 -8
- package/dist/components/Selector/styled.js.map +1 -1
- package/dist/components/StackedBadge.js +5 -5
- package/dist/components/StackedBadge.js.map +1 -1
- package/dist/components/TabManager.d.ts.map +1 -1
- package/dist/components/TabManager.js +30 -5
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/ToolBadge.d.ts +8 -3
- package/dist/components/ToolBadge.d.ts.map +1 -1
- package/dist/components/ToolBadge.js +99 -21
- package/dist/components/ToolBadge.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +37 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +30 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/TooltipAPI.d.ts +29 -0
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +1 -0
- package/dist/components/Tooltip/TooltipAPI.js +107 -0
- package/dist/components/Tooltip/TooltipAPI.js.map +1 -0
- package/dist/components/Tooltip/context.d.ts +5 -0
- package/dist/components/Tooltip/context.d.ts.map +1 -0
- package/dist/components/Tooltip/context.js +18 -0
- package/dist/components/Tooltip/context.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/Tooltip/style.d.ts +4 -0
- package/dist/components/Tooltip/style.d.ts.map +1 -0
- package/dist/components/Tooltip/style.js +22 -0
- package/dist/components/Tooltip/style.js.map +1 -0
- package/dist/components/Tooltip/types.d.ts +27 -0
- package/dist/components/Tooltip/types.d.ts.map +1 -0
- package/dist/components/Tooltip/types.js +2 -0
- package/dist/components/Tooltip/types.js.map +1 -0
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
- package/dist/components/WorkspaceTabNavigator.js +9 -7
- package/dist/components/WorkspaceTabNavigator.js.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts +2 -24
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +29 -46
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +4 -24
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +18 -39
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.css +26 -0
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +4 -2
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +4 -3
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/constants.js +2 -2
- package/dist/state/constants.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +2 -1
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +12 -1
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/upload/FileUpload.d.ts.map +1 -1
- package/dist/utils/upload/FileUpload.js +1 -2
- package/dist/utils/upload/FileUpload.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +6 -5
- package/dist/views/Agents/AgentDescription.js.map +1 -1
- package/dist/views/Agents/AgentsPanel.d.ts.map +1 -1
- package/dist/views/Agents/AgentsPanel.js +7 -7
- package/dist/views/Agents/AgentsPanel.js.map +1 -1
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -1
- package/dist/views/Agents/AgentsTab.js +28 -29
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +5 -3
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +36 -28
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts.map +1 -1
- package/dist/views/Chat/StepsList.js +10 -10
- package/dist/views/Chat/StepsList.js.map +1 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +2 -8
- package/dist/views/Chat/styled.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +14 -7
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/index.js +1 -1
- package/dist/views/ChatHistory/index.js.map +1 -1
- package/dist/views/ChatHistory/styled.d.ts.map +1 -1
- package/dist/views/ChatHistory/styled.js +5 -3
- package/dist/views/ChatHistory/styled.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +3 -2
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +12 -6
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
- package/dist/views/Home/BuiltInAgent.js +3 -2
- package/dist/views/Home/BuiltInAgent.js.map +1 -1
- package/dist/views/Home/CustomAgent.js +3 -3
- package/dist/views/Home/CustomAgent.js.map +1 -1
- package/dist/views/Home/index.js +1 -1
- package/dist/views/Home/index.js.map +1 -1
- package/dist/views/Home/styled.d.ts.map +1 -1
- package/dist/views/Home/styled.js +22 -21
- package/dist/views/Home/styled.js.map +1 -1
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +4 -3
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +36 -14
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +5 -7
- package/dist/views/MessageInput/AgentSelector.js.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonAgent.js +5 -4
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -1
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ButtonBar.js +4 -2
- package/dist/views/MessageInput/ButtonBar.js.map +1 -1
- package/dist/views/MessageInput/ContextBar.d.ts.map +1 -1
- package/dist/views/MessageInput/ContextBar.js +6 -4
- package/dist/views/MessageInput/ContextBar.js.map +1 -1
- package/dist/views/MessageInput/QuickCommandSelector.js +2 -2
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -1
- package/dist/views/MessageInput/SelectContent.d.ts.map +1 -1
- package/dist/views/MessageInput/SelectContent.js +35 -30
- package/dist/views/MessageInput/SelectContent.js.map +1 -1
- package/dist/views/MessageInput/UploadBar.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadBar.js +24 -2
- package/dist/views/MessageInput/UploadBar.js.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.js +3 -2
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
- package/dist/views/MessageInput/dictionary.js +4 -0
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +4 -3
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +3 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +27 -11
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +4 -2
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +28 -23
- package/dist/views/Stacks.js.map +1 -1
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -1
- package/dist/views/Steps/FlowChart/NodeStep.js +3 -3
- package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -1
- package/dist/views/Steps/StepModal.d.ts.map +1 -1
- package/dist/views/Steps/StepModal.js +6 -4
- package/dist/views/Steps/StepModal.js.map +1 -1
- package/dist/views/Steps/dictionary.d.ts +1 -1
- package/dist/views/Steps/index.d.ts.map +1 -1
- package/dist/views/Steps/index.js +4 -3
- package/dist/views/Steps/index.js.map +1 -1
- package/dist/views/Steps/utils.d.ts +1 -2
- package/dist/views/Steps/utils.d.ts.map +1 -1
- package/dist/views/Steps/utils.js +8 -8
- package/dist/views/Steps/utils.js.map +1 -1
- package/dist/views/Tools.js +4 -2
- package/dist/views/Tools.js.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.js +10 -7
- package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
- package/dist/views/Workspaces/index.js +2 -4
- package/dist/views/Workspaces/index.js.map +1 -1
- package/package.json +13 -12
- package/src/StackspotAIWidget.tsx +33 -30
- package/src/app-metadata.json +17 -13
- package/src/chat-interceptors/quick-commands.ts +11 -5
- package/src/components/Accordion.tsx +75 -0
- package/src/components/AdaptiveTextArea.tsx +1 -1
- package/src/components/AgentCard/AgentCardCreate.tsx +5 -3
- package/src/components/AgentCard/index.tsx +7 -7
- package/src/components/ButtonFavorite.tsx +47 -20
- package/src/components/Code.tsx +36 -31
- package/src/components/ComponentNavigator.tsx +8 -4
- package/src/components/FadingOverflow.tsx +7 -6
- package/src/components/FallbackBoundary/ErrorBoundary.tsx +71 -0
- package/src/components/FallbackBoundary/Loading.tsx +14 -0
- package/src/components/FallbackBoundary/index.tsx +26 -0
- package/src/components/FileDescription.tsx +10 -14
- package/src/components/HistoryList.tsx +1 -1
- package/src/components/IconInput.tsx +73 -0
- package/src/components/ListResource.tsx +5 -5
- package/src/components/Markdown.tsx +1 -1
- package/src/components/Modal.tsx +4 -2
- package/src/components/OverlayMenu.tsx +133 -0
- package/src/components/ProgressBar.tsx +183 -0
- package/src/components/QuickStartButton.tsx +4 -5
- package/src/components/RightPanelForm.tsx +13 -20
- package/src/components/RightPanelTabs.tsx +32 -4
- package/src/components/Selector/index.tsx +13 -17
- package/src/components/Selector/styled.ts +5 -8
- package/src/components/StackedBadge.tsx +5 -5
- package/src/components/TabManager.tsx +36 -8
- package/src/components/ToolBadge.tsx +129 -39
- package/src/components/Tooltip/Tooltip.tsx +78 -0
- package/src/components/Tooltip/TooltipAPI.ts +101 -0
- package/src/components/Tooltip/context.tsx +24 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/Tooltip/style.tsx +24 -0
- package/src/components/Tooltip/types.ts +28 -0
- package/src/components/WorkspaceTabNavigator.tsx +25 -22
- package/src/components/form/DescribedCheckboxGroup.tsx +65 -90
- package/src/components/form/DescribedRadioGroup.tsx +46 -79
- package/src/index.ts +2 -1
- package/src/layout.css +26 -0
- package/src/right-panel/DefaultPanel.tsx +7 -3
- package/src/state/ChatEntry.ts +4 -3
- package/src/state/constants.ts +2 -2
- package/src/types.ts +3 -4
- package/src/utils/tools.ts +23 -2
- package/src/utils/upload/FileUpload.ts +1 -2
- package/src/views/Agents/AgentDescription.tsx +7 -6
- package/src/views/Agents/AgentsPanel.tsx +12 -11
- package/src/views/Agents/AgentsTab.tsx +56 -37
- package/src/views/Chat/AgentInfo.tsx +6 -7
- package/src/views/Chat/ChatMessage.tsx +118 -109
- package/src/views/Chat/StepsList.tsx +11 -10
- package/src/views/Chat/styled.ts +2 -8
- package/src/views/ChatHistory/HistoryItem.tsx +19 -12
- package/src/views/ChatHistory/index.tsx +1 -1
- package/src/views/ChatHistory/styled.ts +5 -3
- package/src/views/ChatTabSelection.tsx +3 -2
- package/src/views/Editor.tsx +14 -9
- package/src/views/Home/BuiltInAgent.tsx +8 -7
- package/src/views/Home/CustomAgent.tsx +3 -3
- package/src/views/Home/index.tsx +1 -1
- package/src/views/Home/styled.ts +22 -21
- package/src/views/KSDocument.tsx +8 -7
- package/src/views/KnowledgeSources.tsx +66 -24
- package/src/views/MessageInput/AgentSelector.tsx +8 -10
- package/src/views/MessageInput/ButtonAgent.tsx +12 -24
- package/src/views/MessageInput/ButtonBar.tsx +21 -25
- package/src/views/MessageInput/ContextBar.tsx +14 -12
- package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +68 -39
- package/src/views/MessageInput/UploadBar.tsx +34 -2
- package/src/views/MessageInput/UploadDragNDrop.tsx +5 -2
- package/src/views/MessageInput/dictionary.ts +4 -0
- package/src/views/MessageInput/index.tsx +7 -5
- package/src/views/MessageInput/styled.ts +28 -12
- package/src/views/MinimizedHeader.tsx +7 -4
- package/src/views/Stacks.tsx +54 -31
- package/src/views/Steps/FlowChart/NodeStep.tsx +4 -6
- package/src/views/Steps/StepModal.tsx +18 -14
- package/src/views/Steps/index.tsx +5 -4
- package/src/views/Steps/utils.tsx +9 -9
- package/src/views/Tools.tsx +19 -12
- package/src/views/Workspaces/WorkspacesTab.tsx +21 -17
- package/src/views/Workspaces/index.tsx +2 -4
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
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,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { IconBox, Text } from '@citric/core'
|
|
2
|
+
import { Document, Sync, TimesMini } from '@citric/icons'
|
|
3
|
+
import { IconButton, LoadingCircular } from '@citric/ui'
|
|
3
4
|
import { theme } from '@stack-spot/portal-theme'
|
|
4
5
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
5
6
|
import { styled } from 'styled-components'
|
|
@@ -78,26 +79,21 @@ export const FileDescription = ({ fileName, icon, status, onRemove, onRetry }: F
|
|
|
78
79
|
return (
|
|
79
80
|
<Styled className={status} aria-busy={status === 'pending'}>
|
|
80
81
|
<div className="image">
|
|
81
|
-
{icon ?? <
|
|
82
|
+
{icon ?? <IconBox><Document /></IconBox>}
|
|
82
83
|
{status === 'pending' && <div className="status" aria-label={t.loading}>
|
|
83
|
-
<
|
|
84
|
+
<LoadingCircular size="xs" />
|
|
84
85
|
</div>}
|
|
85
86
|
{status === 'error' && <div className="status" aria-label={t.error}>
|
|
86
|
-
<IconButton
|
|
87
|
+
<IconButton appearance="circle" color="danger" title={t.retry} aria-label={t.retry} onClick={onRetry}><Sync /></IconButton>
|
|
87
88
|
</div>}
|
|
88
89
|
</div>
|
|
89
90
|
<div className="details">
|
|
90
91
|
<Text appearance="microtext1" className="name" title={name}>{name}</Text>
|
|
91
|
-
<Text appearance="microtext1"
|
|
92
|
+
<Text appearance="microtext1" colorScheme="light.700">{extension.toUpperCase()}</Text>
|
|
92
93
|
</div>
|
|
93
|
-
{onRemove && <IconButton
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
title={t.remove}
|
|
97
|
-
arial-label={`${t.remove} ${name}`}
|
|
98
|
-
style={{ alignSelf: 'start' }}
|
|
99
|
-
size="xs"
|
|
100
|
-
/>}
|
|
94
|
+
{onRemove && <IconButton onClick={onRemove} title={t.remove} aria-label={`${t.remove} ${name}`}>
|
|
95
|
+
<TimesMini />
|
|
96
|
+
</IconButton>}
|
|
101
97
|
</Styled>
|
|
102
98
|
)
|
|
103
99
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Box, Flex, Text } from '@citric/core'
|
|
2
2
|
import { WithStyle } from '@stack-spot/portal-theme'
|
|
3
3
|
import { useMemo } from 'react'
|
|
4
4
|
|
|
@@ -43,18 +43,18 @@ export function ListResource<T>({ list, renderLabel, renderBeforeElement, render
|
|
|
43
43
|
const content = typeof label === 'string' ? <Text>{label}</Text> : label
|
|
44
44
|
return (
|
|
45
45
|
<li key={keygen(listItem)}>
|
|
46
|
-
<
|
|
46
|
+
<Flex alignItems="center">
|
|
47
47
|
{renderBeforeElement?.(listItem)}
|
|
48
48
|
{content}
|
|
49
49
|
{renderAfterElement?.(listItem)}
|
|
50
|
-
</
|
|
50
|
+
</Flex>
|
|
51
51
|
</li>
|
|
52
52
|
)
|
|
53
53
|
}), [list])
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
|
-
<ul
|
|
56
|
+
<Box as="ul" m={0} p={0} w={12} style={style} className={className}>
|
|
57
57
|
{items}
|
|
58
|
-
</
|
|
58
|
+
</Box>
|
|
59
59
|
)
|
|
60
60
|
}
|
|
@@ -32,7 +32,7 @@ export const Markdown = (
|
|
|
32
32
|
) => (
|
|
33
33
|
<>
|
|
34
34
|
<ReactMarkdown
|
|
35
|
-
className="markdown
|
|
35
|
+
className="markdown"
|
|
36
36
|
remarkPlugins={[[remarkGfm]]}
|
|
37
37
|
components={{
|
|
38
38
|
a: props => <a target="_blank" rel="noopener noreferrer" style={{ textDecoration: 'underline' }} {...props} />,
|
package/src/components/Modal.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Text } from '@citric/core'
|
|
2
|
+
import { Times } from '@citric/icons'
|
|
3
|
+
import { IconButton } from '@citric/ui'
|
|
2
4
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
3
5
|
import { useEffect, useRef, useState } from 'react'
|
|
4
6
|
import { createPortal } from 'react-dom'
|
|
@@ -17,7 +19,7 @@ const ModalContent = ({ title, children, onClose }: Omit<Props, 'open'>) => {
|
|
|
17
19
|
<div className="chat-modal">
|
|
18
20
|
<header>
|
|
19
21
|
{typeof title === 'string' ? <Text appearance="h6">{title}</Text> : title}
|
|
20
|
-
<IconButton
|
|
22
|
+
<IconButton aria-label={t.close} title={t.close} appearance="circle" onClick={onClose}><Times /></IconButton>
|
|
21
23
|
</header>
|
|
22
24
|
<article>{children}</article>
|
|
23
25
|
</div>
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
})
|
|
@@ -0,0 +1,183 @@
|
|
|
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,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Button, Text } from '@stack-spot/citric-react'
|
|
1
|
+
import { Button, IconBox, Text } from '@citric/core'
|
|
3
2
|
import { WithStyle } from '@stack-spot/portal-theme'
|
|
4
3
|
import { ButtonAction } from '../types'
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
interface Props extends ButtonAction, WithStyle { }
|
|
7
6
|
|
|
8
|
-
export const QuickStartButton = ({ label, onClick, className,
|
|
7
|
+
export const QuickStartButton = ({ label, onClick, className, icon, style }: Props) => {
|
|
9
8
|
const content = <>
|
|
10
|
-
{icon && <
|
|
9
|
+
{icon && <IconBox color="light" aria-hidden>{icon}</IconBox>}
|
|
11
10
|
<Text nowrapEllipsis>{label}</Text>
|
|
12
11
|
</>
|
|
13
12
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Card } from '@citric/ui'
|
|
2
2
|
import { theme } from '@stack-spot/portal-theme'
|
|
3
3
|
import { styled } from 'styled-components'
|
|
4
4
|
import { panelAnimationTime } from '../right-panel/constants'
|
|
5
5
|
import { PropsOf } from '../types'
|
|
6
6
|
import { AutoFocus } from './AutoFocus'
|
|
7
|
+
import { FallbackBoundary } from './FallbackBoundary'
|
|
7
8
|
|
|
8
9
|
const Form = styled.form`
|
|
9
10
|
display: flex;
|
|
@@ -13,7 +14,7 @@ const Form = styled.form`
|
|
|
13
14
|
flex: 1;
|
|
14
15
|
gap: 20px;
|
|
15
16
|
|
|
16
|
-
> .content, .content-navigator
|
|
17
|
+
> .content, .content-navigator .content, .content-navigator:not(.full) {
|
|
17
18
|
display: flex;
|
|
18
19
|
flex-direction: column;
|
|
19
20
|
gap: 8px;
|
|
@@ -51,30 +52,22 @@ const Form = styled.form`
|
|
|
51
52
|
> button {
|
|
52
53
|
margin-right: auto;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
|
|
56
|
+
.search {
|
|
57
|
+
margin-bottom: 8px;
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
.option-list {
|
|
56
61
|
overflow: auto;
|
|
57
|
-
> .row {
|
|
58
|
-
gap: 6px;
|
|
59
|
-
align-items: start;
|
|
60
|
-
}
|
|
61
|
-
[data-citric="accordion"] {
|
|
62
|
-
background-color: ${theme.color.light[400]};
|
|
63
|
-
flex: 1;
|
|
64
|
-
> header {
|
|
65
|
-
min-height: 24px;
|
|
66
|
-
padding: 8px 10px;
|
|
67
|
-
align-items: center;
|
|
68
|
-
p {
|
|
69
|
-
flex: 1;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
62
|
}
|
|
74
63
|
|
|
75
|
-
.filtered-out {
|
|
64
|
+
li.filtered-out {
|
|
76
65
|
opacity: 0.5;
|
|
77
66
|
}
|
|
67
|
+
|
|
68
|
+
${Card} svg {
|
|
69
|
+
fill: transparent;
|
|
70
|
+
}
|
|
78
71
|
`
|
|
79
72
|
|
|
80
73
|
/**
|