@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,24 @@
|
|
|
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
|
+
`
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Box, Flex, IconBox, Image, Text } from '@citric/core'
|
|
2
|
+
import { ArrowRight, Search, Spaces, Times } from '@citric/icons'
|
|
3
|
+
import { Avatar, IconButton } from '@citric/ui'
|
|
3
4
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
4
5
|
import { workspaceAiClient } from '@stack-spot/portal-network'
|
|
5
6
|
import { WorkspaceResponse, WorkspaceVisibilityLevelEnum } from '@stack-spot/portal-network/api/workspace-ai'
|
|
@@ -8,6 +9,7 @@ import { memo, useMemo, useState } from 'react'
|
|
|
8
9
|
import { useRightPanel } from '../right-panel/hooks'
|
|
9
10
|
import { ButtonFavorite } from './ButtonFavorite'
|
|
10
11
|
import { ComponentNavigator, ComponentNavigatorProps, NavigationComponent, NavigationMap, useComponentNavigation } from './ComponentNavigator'
|
|
12
|
+
import { IconInput } from './IconInput'
|
|
11
13
|
import { ListResource } from './ListResource'
|
|
12
14
|
|
|
13
15
|
interface CardSpaceProps {
|
|
@@ -18,24 +20,25 @@ interface CardSpaceProps {
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export const CardSpace = ({ onClick, name, icon, logoUrl }: CardSpaceProps) =>
|
|
21
|
-
<
|
|
23
|
+
<Flex
|
|
22
24
|
onClick={onClick}
|
|
23
25
|
flex={1}
|
|
26
|
+
alignItems="center"
|
|
24
27
|
justifyContent="space-between"
|
|
25
28
|
mr={2}
|
|
26
29
|
bg="light.400"
|
|
27
|
-
|
|
30
|
+
r="sm"
|
|
28
31
|
p={3}
|
|
29
|
-
|
|
32
|
+
sx={{ cursor: 'pointer' }}
|
|
30
33
|
>
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
{logoUrl ? <
|
|
34
|
-
</
|
|
34
|
+
<Flex alignContent="center" alignItems="center" sx={{ gap: '8px', m: 1 }} >
|
|
35
|
+
<Avatar size="xxs" appearance="square" sx={{ bg: 'light.600', r: 'xxs' }}>
|
|
36
|
+
{logoUrl ? <Image src={logoUrl} /> : <IconBox> {icon} </IconBox>}
|
|
37
|
+
</Avatar>
|
|
35
38
|
<Text appearance="body2">{name}</Text>
|
|
36
|
-
</
|
|
37
|
-
<IconButton
|
|
38
|
-
</
|
|
39
|
+
</Flex>
|
|
40
|
+
<IconButton><ArrowRight /></IconButton>
|
|
41
|
+
</Flex>
|
|
39
42
|
|
|
40
43
|
interface WorkspaceSourcesTabProps {
|
|
41
44
|
visibility: WorkspaceVisibilityLevelEnum,
|
|
@@ -88,17 +91,16 @@ const WorkspaceSourcesTab = ({ visibility, onClick }: WorkspaceSourcesTabProps)
|
|
|
88
91
|
|
|
89
92
|
return (
|
|
90
93
|
<>
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
</FieldGroup>
|
|
94
|
+
<Box w={12}>
|
|
95
|
+
<IconInput icon={<Search />} value={filter} onChange={setFilter} className="search" />
|
|
96
|
+
</Box>
|
|
95
97
|
|
|
96
98
|
{!!filtered.length &&
|
|
97
99
|
<ListResource
|
|
98
100
|
list={filtered}
|
|
99
101
|
keygen={w => w.id}
|
|
100
102
|
style={{ gap: '6px', display: 'flex', flexDirection: 'column' }}
|
|
101
|
-
renderLabel={w => <CardSpace name={w.name} logoUrl={w.logo} icon={<
|
|
103
|
+
renderLabel={w => <CardSpace name={w.name} logoUrl={w.logo} icon={<Spaces />} onClick={() => onClick(w)} />}
|
|
102
104
|
renderAfterElement={(w) =>
|
|
103
105
|
<ButtonFavorite favorite={{ idOrSlug: w?.id, listFavorites, onAddFavorite, onRemoveFavorite }} />}
|
|
104
106
|
optionClassName={w => (filter && !w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
@@ -108,25 +110,26 @@ const WorkspaceSourcesTab = ({ visibility, onClick }: WorkspaceSourcesTabProps)
|
|
|
108
110
|
className="option-list"
|
|
109
111
|
/>
|
|
110
112
|
}
|
|
111
|
-
<
|
|
113
|
+
<Box w={12}>
|
|
112
114
|
{!!workspaces.length && !filtered.length &&
|
|
113
115
|
<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />}
|
|
114
116
|
{!workspaces.length && <Placeholder title={t.noData} description={t.noDataDescription} />}
|
|
115
|
-
</
|
|
117
|
+
</Box>
|
|
116
118
|
</>
|
|
117
119
|
)
|
|
118
120
|
}
|
|
119
121
|
|
|
122
|
+
|
|
120
123
|
const WorkspaceHeader = <T extends NavigationMap, K extends keyof T>({ data }: { data: NavigationComponent<T, K> }) => {
|
|
121
124
|
const { close: closeRightPanel } = useRightPanel()
|
|
122
125
|
const workspaceId = (data.props as any)['workspaceId']
|
|
123
126
|
if (!workspaceId) return
|
|
124
127
|
|
|
125
128
|
const workspace = workspaceAiClient.workspaceAi.useQuery({ id: workspaceId })
|
|
126
|
-
return <
|
|
129
|
+
return <Flex justifyContent="space-between" alignItems="center" flex={1}>
|
|
127
130
|
{data.component === 'workspaceResource' ? 'Spots' : workspace.name}
|
|
128
|
-
{data.fullScreen && <IconButton
|
|
129
|
-
</
|
|
131
|
+
{data.fullScreen && <IconButton title={'t.close'} aria-label={'t.close'} onClick={closeRightPanel}> <Times /> </IconButton>}
|
|
132
|
+
</Flex>
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
interface WorkspaceTabNavigatorProps {
|
|
@@ -1,106 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Checkbox, Flex, Text } from '@citric/core'
|
|
2
|
+
import { listToClass } from '@stack-spot/portal-theme'
|
|
3
3
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
interface Props<T> {
|
|
10
|
-
initialValue?: T[],
|
|
11
|
-
options: T[],
|
|
12
|
-
/**
|
|
13
|
-
* Must return the data needed by the component, given the option.
|
|
14
|
-
*/
|
|
15
|
-
data: (option: T) => { name: string, description: string } & Favorite<any>,
|
|
16
|
-
/**
|
|
17
|
-
* Use this when the selection must be kept at a global level, managed by a React Ref.
|
|
18
|
-
*/
|
|
19
|
-
globalSelection?: React.MutableRefObject<Labeled[] | undefined>,
|
|
20
|
-
emptyResults: React.ReactNode,
|
|
21
|
-
emptyDataset: React.ReactNode,
|
|
22
|
-
onChange?: (value: T[]) => void,
|
|
23
|
-
}
|
|
4
|
+
import { useMemo } from 'react'
|
|
5
|
+
import { Accordion } from '../Accordion'
|
|
6
|
+
import { RadioCheckBox } from './styled'
|
|
7
|
+
import { CheckProps } from './types'
|
|
24
8
|
|
|
25
9
|
/**
|
|
26
10
|
* Renders a checkbox group where each option has a label and a description.
|
|
27
11
|
* The description in placed under the label and checkbox as an accordion.
|
|
28
|
-
*
|
|
29
|
-
* Also renders a search input and a select all checkbox.
|
|
30
12
|
*/
|
|
31
|
-
export function DescribedCheckboxGroup<T>(
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
export function DescribedCheckboxGroup<T>({
|
|
14
|
+
keygen,
|
|
15
|
+
onChange,
|
|
16
|
+
options,
|
|
17
|
+
renderDescription,
|
|
18
|
+
renderLabel,
|
|
19
|
+
renderBeforeElement,
|
|
20
|
+
renderAfterElement,
|
|
21
|
+
optionClassName,
|
|
22
|
+
optionStyle,
|
|
23
|
+
value,
|
|
24
|
+
className,
|
|
25
|
+
style }: CheckProps<T>) {
|
|
34
26
|
const t = useTranslate(dictionary)
|
|
35
|
-
const
|
|
27
|
+
const allSelected = options.length > 0 && options.every(option => value.includes(option))
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
29
|
+
const handleSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
30
|
+
if (e.target.checked) {
|
|
31
|
+
onChange(options)
|
|
32
|
+
} else {
|
|
33
|
+
onChange([])
|
|
34
|
+
}
|
|
35
|
+
}
|
|
40
36
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
const items = useMemo(() => options.map((option) => {
|
|
38
|
+
const label = renderLabel(option)
|
|
39
|
+
const description = renderDescription(option)
|
|
40
|
+
const header = (
|
|
41
|
+
<label>
|
|
42
|
+
<Checkbox
|
|
43
|
+
checked={value.includes(option)}
|
|
44
|
+
onChange={(e) => {
|
|
45
|
+
if (e.target.checked && !value.includes(option)) onChange([...value, option])
|
|
46
|
+
else onChange(value.filter(item => item !== option))
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
{typeof label === 'string' ? <Text>{label}</Text> : label}
|
|
50
|
+
</label>
|
|
50
51
|
)
|
|
51
|
-
}, [])
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<li key={keygen(option)} className={listToClass(['radio-group-item', optionClassName?.(option)])} style={optionStyle?.(option)}>
|
|
56
|
+
{renderBeforeElement?.(option)}
|
|
57
|
+
<Accordion header={header}>
|
|
58
|
+
{typeof description === 'string'
|
|
59
|
+
? <Text appearance="microtext1" colorScheme="light.700">{description}</Text>
|
|
60
|
+
: description as any
|
|
61
|
+
}
|
|
62
|
+
</Accordion>
|
|
63
|
+
{renderAfterElement?.(option)}
|
|
64
|
+
</li>
|
|
65
|
+
</>
|
|
66
|
+
)
|
|
67
|
+
}), [options, value])
|
|
60
68
|
|
|
61
|
-
return
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{controls.options.length ? <>
|
|
67
|
-
<Row tag="label" gap="10px" p="11px">
|
|
68
|
-
<Checkbox value={controls.isAllSelected} onChange={v => v ? controls.selectAll() : controls.removeSelection()} />
|
|
69
|
-
<Text>{controls.isAllSelected ? t.removeAll : t.selectAll}</Text>
|
|
70
|
-
</Row>
|
|
71
|
-
<CheckboxGroup
|
|
72
|
-
options={controls.options}
|
|
73
|
-
value={controls.value}
|
|
74
|
-
onChange={controls.setValue}
|
|
75
|
-
renderKey={controls.renderKey}
|
|
76
|
-
className="option-list"
|
|
77
|
-
renderItem={(checkbox, o) => {
|
|
78
|
-
const { description, idOrSlug, name, listFavorites, onAddFavorite, onRemoveFavorite } = data(o)
|
|
79
|
-
return (
|
|
80
|
-
<Row className={controls.isUnfilteredButChecked(o) ? 'filtered-out' : ''}>
|
|
81
|
-
<Accordion header={btn => <>{checkbox}<Text>{name}</Text>{btn}</>} appearance="card" maxHeight={100}>
|
|
82
|
-
<Text appearance="microtext1" color="light.700">{description}</Text>
|
|
83
|
-
</Accordion>
|
|
84
|
-
{onAddFavorite && <ButtonFavorite favorite={{
|
|
85
|
-
idOrSlug: idOrSlug,
|
|
86
|
-
listFavorites,
|
|
87
|
-
onAddFavorite: async (...args) => {
|
|
88
|
-
const res = await onAddFavorite(...args)
|
|
89
|
-
setOptions([...options]) // forces options re-rendering
|
|
90
|
-
return res
|
|
91
|
-
},
|
|
92
|
-
onRemoveFavorite: async (...args) => {
|
|
93
|
-
const res = await onRemoveFavorite?.(...args)
|
|
94
|
-
setOptions([...options]) // forces options re-rendering
|
|
95
|
-
return res ?? false
|
|
96
|
-
},
|
|
97
|
-
}} />}
|
|
98
|
-
</Row>
|
|
99
|
-
)
|
|
100
|
-
}}
|
|
69
|
+
return <RadioCheckBox style={style} className={className}>
|
|
70
|
+
<Flex as="li" alignItems="center" ml={3} pl={1}>
|
|
71
|
+
<Checkbox
|
|
72
|
+
checked={allSelected}
|
|
73
|
+
onChange={handleSelectAll}
|
|
101
74
|
/>
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
<Text>{allSelected ? t.removeAll : t.selectAll}</Text>
|
|
76
|
+
</Flex>
|
|
77
|
+
{items}
|
|
78
|
+
</RadioCheckBox>
|
|
104
79
|
}
|
|
105
80
|
|
|
106
81
|
const dictionary = {
|
|
@@ -1,85 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
initialValue?: T,
|
|
8
|
-
options: T[],
|
|
9
|
-
/**
|
|
10
|
-
* Must return the data needed by the component, given the option.
|
|
11
|
-
* @param option
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
data: (option: T) => { name: string, description: React.ReactNode, image?: React.ReactElement } & Favorite<any>,
|
|
15
|
-
emptyResults: React.ReactNode,
|
|
16
|
-
emptyDataset: React.ReactNode,
|
|
17
|
-
onChange?: (value: T | undefined) => void,
|
|
18
|
-
}
|
|
1
|
+
import { Radio, Text } from '@citric/core'
|
|
2
|
+
import { listToClass } from '@stack-spot/portal-theme'
|
|
3
|
+
import { useMemo } from 'react'
|
|
4
|
+
import { Accordion } from '../Accordion'
|
|
5
|
+
import { RadioCheckBox } from './styled'
|
|
6
|
+
import { RadioProps } from './types'
|
|
19
7
|
|
|
20
8
|
/**
|
|
21
|
-
* Renders a radio group where each option has a label and a description.
|
|
22
|
-
* The description in placed under the label and
|
|
23
|
-
*
|
|
24
|
-
* Also renders a search input.
|
|
9
|
+
* Renders a radio button group where each option has a label and a description.
|
|
10
|
+
* The description in placed under the label and radio button as an accordion.
|
|
25
11
|
*/
|
|
26
|
-
export function DescribedRadioGroup<T>(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
options,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
12
|
+
export function DescribedRadioGroup<T>(
|
|
13
|
+
{
|
|
14
|
+
keygen,
|
|
15
|
+
onChange,
|
|
16
|
+
options,
|
|
17
|
+
renderDescription,
|
|
18
|
+
renderLabel,
|
|
19
|
+
renderBeforeElement,
|
|
20
|
+
renderAfterElement,
|
|
21
|
+
optionClassName,
|
|
22
|
+
optionStyle,
|
|
23
|
+
value,
|
|
24
|
+
className,
|
|
25
|
+
style }: RadioProps<T>,
|
|
26
|
+
) {
|
|
27
|
+
const items = useMemo(() => options.map((option) => {
|
|
28
|
+
const label = renderLabel(option)
|
|
29
|
+
const description = renderDescription(option)
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
const header = (
|
|
32
|
+
<label>
|
|
33
|
+
<Radio checked={option === value} onChange={() => onChange(option)} />
|
|
34
|
+
{typeof label === 'string' ? <Text>{label}</Text> : label}
|
|
35
|
+
</label>
|
|
36
|
+
)
|
|
37
|
+
return (
|
|
38
|
+
<li key={keygen(option)} className={listToClass(['radio-group-item', optionClassName?.(option)])} style={optionStyle?.(option)}>
|
|
39
|
+
{renderBeforeElement?.(option)}
|
|
40
|
+
<Accordion header={header}>
|
|
41
|
+
{typeof description === 'string'
|
|
42
|
+
? <Text appearance="microtext1" colorScheme="light.700">{description}</Text>
|
|
43
|
+
: description as any
|
|
44
|
+
}
|
|
45
|
+
</Accordion>
|
|
46
|
+
{renderAfterElement?.(option)}
|
|
47
|
+
</li>
|
|
48
|
+
)
|
|
49
|
+
}), [options, value])
|
|
39
50
|
|
|
40
|
-
return
|
|
41
|
-
<FieldGroup fullWidth>
|
|
42
|
-
<Icon icon="Search" />
|
|
43
|
-
<Input type="search" value={controls.filter} onChange={controls.setFilter} />
|
|
44
|
-
</FieldGroup>
|
|
45
|
-
{controls.options.length ? <RadioGroup
|
|
46
|
-
options={controls.options}
|
|
47
|
-
value={controls.value}
|
|
48
|
-
onChange={controls.setValue}
|
|
49
|
-
renderKey={controls.renderKey}
|
|
50
|
-
className="option-list"
|
|
51
|
-
renderItem={(radio, o) => {
|
|
52
|
-
const { description, idOrSlug, name, image, listFavorites, onAddFavorite, onRemoveFavorite } = data(o)
|
|
53
|
-
return (
|
|
54
|
-
<Row className={controls.isUnfilteredButChecked(o) ? 'filtered-out' : ''}>
|
|
55
|
-
<Accordion
|
|
56
|
-
header={btn => <>
|
|
57
|
-
{radio}
|
|
58
|
-
{image && <ImageBox size="xs" style={{ fontSize: '16px' }}>{image}</ImageBox>}
|
|
59
|
-
<Text>{name}</Text>{btn}</>
|
|
60
|
-
}
|
|
61
|
-
appearance="card"
|
|
62
|
-
maxHeight={100}
|
|
63
|
-
>
|
|
64
|
-
{typeof description === 'string' ? <Text appearance="microtext1" color="light.700">{description}</Text> : description}
|
|
65
|
-
</Accordion>
|
|
66
|
-
{onAddFavorite && <ButtonFavorite favorite={{
|
|
67
|
-
idOrSlug: idOrSlug,
|
|
68
|
-
listFavorites,
|
|
69
|
-
onAddFavorite: async (...args) => {
|
|
70
|
-
const res = await onAddFavorite(...args)
|
|
71
|
-
setOptions([...options]) // forces options re-rendering
|
|
72
|
-
return res
|
|
73
|
-
},
|
|
74
|
-
onRemoveFavorite: async (...args) => {
|
|
75
|
-
const res = await onRemoveFavorite?.(...args)
|
|
76
|
-
setOptions([...options]) // forces options re-rendering
|
|
77
|
-
return res ?? false
|
|
78
|
-
},
|
|
79
|
-
}} />}
|
|
80
|
-
</Row>
|
|
81
|
-
)
|
|
82
|
-
}}
|
|
83
|
-
/> : emptyResults}
|
|
84
|
-
</> : emptyDataset
|
|
51
|
+
return <RadioCheckBox style={style} className={className}>{items}</RadioCheckBox>
|
|
85
52
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* Attention: in order for the package "page" to work without linking the lib, we must export types separately, using the "type" keyword */
|
|
2
2
|
|
|
3
|
+
export { ProgressBar } from './components/ProgressBar'
|
|
3
4
|
export { QuickStartButton } from './components/QuickStartButton'
|
|
4
5
|
export { AIWidgetProvider } from './context/AIWidgetProvider'
|
|
5
6
|
export * from './context/hooks'
|
|
@@ -11,8 +12,8 @@ export type { ChatAction } from './state/ChatEntry'
|
|
|
11
12
|
export { ChatState } from './state/ChatState'
|
|
12
13
|
export type { MessageInterceptor } from './state/ChatState'
|
|
13
14
|
export { ChatTabsController } from './state/ChatTabsController'
|
|
14
|
-
export { acceptedFileTypes } from './state/constants'
|
|
15
15
|
export { ObservableState } from './state/ObservableState'
|
|
16
16
|
export type { Labeled, LabeledAgent, LabeledWithImage } from './state/types'
|
|
17
17
|
export { WidgetState } from './state/WidgetState'
|
|
18
18
|
export { defaultLanguage, languages } from './utils/programming-languages'
|
|
19
|
+
export { acceptedFileTypes } from './state/constants'
|
package/src/layout.css
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "San Francisco";
|
|
3
|
+
font-weight: 400;
|
|
4
|
+
src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff");
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Scroll bars */
|
|
8
|
+
|
|
9
|
+
::-webkit-scrollbar-track {
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
::-webkit-scrollbar {
|
|
14
|
+
width: 0.25rem;
|
|
15
|
+
height: 0.5rem;
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::-webkit-scrollbar-thumb {
|
|
20
|
+
background-color: var(--light-600);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
::-webkit-scrollbar-corner {
|
|
24
|
+
background-color: transparent;
|
|
25
|
+
}
|
|
26
|
+
|
|
1
27
|
/* Classes */
|
|
2
28
|
|
|
3
29
|
.ai-chat-widget {
|
|
@@ -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 { styled } from 'styled-components'
|
|
4
6
|
import { WithChildren } from '../types'
|
|
@@ -49,9 +51,11 @@ export const DefaultPanel = ({ description, onClose, title, children }: Props) =
|
|
|
49
51
|
<header>
|
|
50
52
|
<div className="title">
|
|
51
53
|
{typeof title === 'string' ? <Text appearance="h5">{title}</Text> : title}
|
|
52
|
-
{typeof description === 'string' ? <Text
|
|
54
|
+
{typeof description === 'string' ? <Text colorScheme="light.700">{description}</Text> : description}
|
|
53
55
|
</div>
|
|
54
|
-
<IconButton
|
|
56
|
+
<IconButton title={t.close} aria-label={t.close} onClick={onClose}>
|
|
57
|
+
<Times />
|
|
58
|
+
</IconButton>
|
|
55
59
|
</header>
|
|
56
60
|
<article>{children}</article>
|
|
57
61
|
</PanelBox>
|
package/src/state/ChatEntry.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { OneOfColorSchemes } from '@citric/core'
|
|
1
2
|
import { ChatStep } from '@stack-spot/portal-network'
|
|
2
|
-
import { ColorPaletteName
|
|
3
|
+
import { ColorPaletteName } from '@stack-spot/portal-theme'
|
|
3
4
|
import { pull } from 'lodash'
|
|
4
5
|
import { LabeledAgent } from './types'
|
|
5
6
|
|
|
@@ -31,7 +32,7 @@ export interface ChatAction extends SerializableAction {
|
|
|
31
32
|
/**
|
|
32
33
|
* @default inverse
|
|
33
34
|
*/
|
|
34
|
-
colorScheme?:
|
|
35
|
+
colorScheme?: OneOfColorSchemes,
|
|
35
36
|
/**
|
|
36
37
|
* @default false
|
|
37
38
|
*/
|
|
@@ -149,7 +150,7 @@ export interface TextChatEntry {
|
|
|
149
150
|
/*
|
|
150
151
|
* Options for radio, checkbox or button type.
|
|
151
152
|
*/
|
|
152
|
-
options?: { color?:
|
|
153
|
+
options?: { color?: OneOfColorSchemes, label: string, value?: string, hasInput?: boolean}[],
|
|
153
154
|
/**
|
|
154
155
|
* Name to be used in input type fields.
|
|
155
156
|
*/
|
package/src/state/constants.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FileSize } from './types'
|
|
2
2
|
|
|
3
3
|
export const acceptedFileTypes = [
|
|
4
|
-
'json', 'yaml', 'txt', 'md', 'json', 'yaml', 'pdf', /*'xls'
|
|
4
|
+
'json', 'yaml', 'txt', 'md', 'json', 'yaml', 'pdf', /*'xls',*/ 'xlsx', 'csv', 'cbl', 'cpp', 'cxx', 'cc', 'c', 'hpp', 'hxx', 'hh', 'h',
|
|
5
5
|
'cs', 'go', 'html', 'htm', 'kt', 'kts', 'md', 'php', 'proto', 'py', 'java', 'js', 'jsx', 'ts', 'tsx', 'rst', 'rb', 'rs', 'scala', 'swift',
|
|
6
6
|
'sql', 'yaml', 'yml', 'tf', 'sh', 'ps1', 'psd1', 'psm1', 'bat', 'cmd', 'rego', 'f', 'for', 'r', 'pl', 'vb', 'dart', 'hs', 'lua',
|
|
7
|
-
'asm', 'groovy', 'gvy', 'gy', 'mat', 'clj', 'lisp', 'm', 'cls', 'css', 'scss', 'json', 'jpg', 'jpeg', 'png',
|
|
7
|
+
'asm', 'groovy', 'gvy', 'gy', 'mat', 'clj', 'lisp', 'm', 'cls', 'css', 'scss', 'json', 'jpg', 'jpeg', 'png', 'docx', 'pptx',
|
|
8
8
|
]
|
|
9
9
|
|
|
10
10
|
export const maxFileSize: FileSize = { value: 10, unit: 'MB' }
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WithIcon } from '@stack-spot/citric-icons'
|
|
2
1
|
import { WithStyle } from '@stack-spot/portal-theme'
|
|
3
2
|
|
|
4
3
|
export interface WithChildren<T = React.ReactNode> {
|
|
@@ -7,13 +6,13 @@ export interface WithChildren<T = React.ReactNode> {
|
|
|
7
6
|
|
|
8
7
|
export type PropsOf<T extends React.FunctionComponent> = T extends React.FunctionComponent<infer P> ? P : never
|
|
9
8
|
|
|
10
|
-
export
|
|
9
|
+
export interface ButtonAction extends WithStyle {
|
|
10
|
+
icon?: React.ReactElement,
|
|
11
11
|
color?: string,
|
|
12
12
|
label?: string,
|
|
13
13
|
ariaLabel?: string,
|
|
14
14
|
onClick: () => any,
|
|
15
|
-
}
|
|
16
|
-
|
|
15
|
+
}
|
|
17
16
|
|
|
18
17
|
export interface MinimizedActions {
|
|
19
18
|
/**
|
package/src/utils/tools.ts
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
import { BuiltinToolkitResponse, BuiltinToolResponse } from '@stack-spot/portal-network/api/agent'
|
|
2
|
+
import { CustomToolkitDto } from '@stack-spot/portal-network/api/agent-tools'
|
|
2
3
|
import { keyBy } from 'lodash'
|
|
3
4
|
|
|
4
5
|
export type ToolWithImage = BuiltinToolResponse & { id: string, image?: string }
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
function isBuiltinToolkit(
|
|
8
|
+
toolkit: BuiltinToolkitResponse | CustomToolkitDto,
|
|
9
|
+
): toolkit is BuiltinToolkitResponse {
|
|
10
|
+
return 'image_url' in toolkit
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
export function toolById(
|
|
15
|
+
id: string,
|
|
16
|
+
toolkits: (BuiltinToolkitResponse | CustomToolkitDto)[] | undefined,
|
|
17
|
+
): ToolWithImage | undefined {
|
|
18
|
+
const tools = toolkits
|
|
19
|
+
?.map((toolkit) =>
|
|
20
|
+
toolkit.tools?.map((tool) => ({
|
|
21
|
+
...tool,
|
|
22
|
+
id: tool.id!,
|
|
23
|
+
image: isBuiltinToolkit(toolkit)
|
|
24
|
+
? toolkit.image_url ?? undefined
|
|
25
|
+
: (toolkit as CustomToolkitDto).avatar ?? undefined,
|
|
26
|
+
})),
|
|
27
|
+
)
|
|
28
|
+
.flat()
|
|
8
29
|
return keyBy(tools, 'id')[id]
|
|
9
30
|
}
|
|
@@ -2,7 +2,6 @@ import { dataIntegrationClient } from '@stack-spot/portal-network'
|
|
|
2
2
|
import { FileUploadType } from '@stack-spot/portal-network/api/dataIntegration'
|
|
3
3
|
import { pull } from 'lodash'
|
|
4
4
|
import { FileUploadStatus } from './types'
|
|
5
|
-
import { getFileId } from './utils'
|
|
6
5
|
|
|
7
6
|
export type FileUploadChangeListener = (status: FileUploadStatus) => void
|
|
8
7
|
|
|
@@ -18,8 +17,8 @@ export class FileUpload {
|
|
|
18
17
|
|
|
19
18
|
constructor(file: File, type: FileUploadType = 'CONTEXT') {
|
|
20
19
|
this.file = file
|
|
21
|
-
this.id = getFileId(file)
|
|
22
20
|
this.type = type
|
|
21
|
+
this.id = `${Date.now()}-${Math.random()}`
|
|
23
22
|
this.upload()
|
|
24
23
|
}
|
|
25
24
|
|