@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.
- package/CHANGELOG.md +33 -32
- package/dist/StackspotAIWidget.d.ts +14 -2
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +7 -8
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +13 -5
- package/dist/chat-interceptors/quick-commands.js +3 -3
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- 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 +4 -5
- 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 +5 -6
- package/dist/components/AgentCard/index.js.map +1 -1
- package/dist/components/ButtonFavorite.d.ts +8 -7
- package/dist/components/ButtonFavorite.d.ts.map +1 -1
- package/dist/components/ButtonFavorite.js +5 -14
- package/dist/components/ButtonFavorite.js.map +1 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +11 -9
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts.map +1 -1
- package/dist/components/ComponentNavigator.js +2 -4
- package/dist/components/ComponentNavigator.js.map +1 -1
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +3 -4
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FileDescription.d.ts.map +1 -1
- package/dist/components/FileDescription.js +3 -4
- package/dist/components/FileDescription.js.map +1 -1
- package/dist/components/HistoryList.d.ts.map +1 -1
- package/dist/components/HistoryList.js +3 -1
- package/dist/components/HistoryList.js.map +1 -1
- 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 +2 -4
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/QuickStartButton.d.ts +2 -3
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +4 -3
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +20 -13
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +1 -4
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +4 -16
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/Selector/index.d.ts.map +1 -1
- package/dist/components/Selector/index.js +5 -8
- 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 +8 -5
- 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 +9 -32
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/ToolBadge.d.ts +3 -8
- package/dist/components/ToolBadge.d.ts.map +1 -1
- package/dist/components/ToolBadge.js +23 -99
- package/dist/components/ToolBadge.js.map +1 -1
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -1
- package/dist/components/WorkspaceTabNavigator.js +7 -9
- package/dist/components/WorkspaceTabNavigator.js.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.d.ts +24 -2
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +46 -29
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +24 -4
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +39 -18
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/context/hooks.d.ts +6 -1
- package/dist/context/hooks.d.ts.map +1 -1
- package/dist/context/hooks.js +4 -1
- package/dist/context/hooks.js.map +1 -1
- package/dist/hooks/midnight-update-view.d.ts +5 -0
- package/dist/hooks/midnight-update-view.d.ts.map +1 -0
- package/dist/hooks/midnight-update-view.js +30 -0
- package/dist/hooks/midnight-update-view.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.css +0 -26
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +2 -4
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +3 -4
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/constants.d.ts.map +1 -1
- package/dist/state/constants.js +1 -0
- package/dist/state/constants.js.map +1 -1
- package/dist/types.d.ts +8 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +9 -3
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +1 -6
- package/dist/utils/tools.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +8 -13
- 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 +30 -29
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/Agents/useAgentFavorites.js +3 -3
- package/dist/views/Agents/useAgentFavorites.js.map +1 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +3 -5
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts +24 -2
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +36 -47
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/ChatMessages.d.ts +1 -1
- package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessages.js +2 -2
- package/dist/views/Chat/ChatMessages.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/index.d.ts +1 -1
- package/dist/views/Chat/index.d.ts.map +1 -1
- package/dist/views/Chat/index.js +2 -2
- package/dist/views/Chat/index.js.map +1 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +11 -16
- 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 +10 -48
- 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 +3 -5
- package/dist/views/ChatHistory/styled.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts +7 -0
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +40 -1
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts +6 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +13 -8
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +6 -12
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -1
- package/dist/views/Home/BuiltInAgent.js +2 -3
- 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 +2 -2
- 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 +21 -22
- package/dist/views/Home/styled.js.map +1 -1
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +3 -4
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +14 -36
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -1
- package/dist/views/MessageInput/AgentSelector.js +7 -5
- 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 +4 -5
- 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 +2 -4
- 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 +3 -6
- 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 +30 -29
- package/dist/views/MessageInput/SelectContent.js.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.js +2 -3
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/index.d.ts +2 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +5 -6
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +1 -3
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +11 -15
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +3 -4
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Resources.d.ts.map +1 -1
- package/dist/views/Resources.js +11 -8
- package/dist/views/Resources.js.map +1 -1
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +23 -28
- 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 +4 -6
- 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 +3 -4
- package/dist/views/Steps/index.js.map +1 -1
- package/dist/views/Steps/utils.d.ts +2 -1
- 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 +1 -1
- package/dist/views/Tools.js.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -1
- package/dist/views/Workspaces/WorkspacesTab.js +7 -10
- package/dist/views/Workspaces/WorkspacesTab.js.map +1 -1
- package/dist/views/Workspaces/index.js +4 -2
- package/dist/views/Workspaces/index.js.map +1 -1
- package/package.json +5 -3
- package/src/StackspotAIWidget.tsx +51 -37
- package/src/app-metadata.json +13 -5
- package/src/chat-interceptors/quick-commands.ts +3 -3
- package/src/components/AdaptiveTextArea.tsx +1 -1
- package/src/components/AgentCard/AgentCardCreate.tsx +4 -7
- package/src/components/AgentCard/index.tsx +7 -7
- package/src/components/ButtonFavorite.tsx +20 -47
- package/src/components/Code.tsx +31 -36
- package/src/components/ComponentNavigator.tsx +4 -8
- package/src/components/FadingOverflow.tsx +6 -7
- package/src/components/FileDescription.tsx +14 -10
- package/src/components/HistoryList.tsx +4 -1
- package/src/components/ListResource.tsx +5 -5
- package/src/components/Markdown.tsx +1 -1
- package/src/components/Modal.tsx +2 -4
- package/src/components/QuickStartButton.tsx +5 -4
- package/src/components/RightPanelForm.tsx +20 -13
- package/src/components/RightPanelTabs.tsx +4 -32
- package/src/components/Selector/index.tsx +17 -13
- package/src/components/Selector/styled.ts +8 -5
- package/src/components/StackedBadge.tsx +5 -5
- package/src/components/TabManager.tsx +31 -55
- package/src/components/ToolBadge.tsx +48 -129
- package/src/components/WorkspaceTabNavigator.tsx +22 -25
- package/src/components/form/DescribedCheckboxGroup.tsx +90 -65
- package/src/components/form/DescribedRadioGroup.tsx +78 -46
- package/src/context/hooks.ts +4 -1
- package/src/hooks/midnight-update-view.ts +36 -0
- package/src/index.ts +4 -2
- package/src/layout.css +0 -26
- package/src/right-panel/DefaultPanel.tsx +3 -7
- package/src/state/ChatEntry.ts +3 -4
- package/src/state/constants.ts +2 -1
- package/src/types.ts +9 -3
- package/src/utils/tools.ts +3 -12
- package/src/views/Agents/AgentDescription.tsx +20 -36
- package/src/views/Agents/AgentsPanel.tsx +11 -12
- package/src/views/Agents/AgentsTab.tsx +38 -57
- package/src/views/Agents/useAgentFavorites.ts +3 -3
- package/src/views/Chat/AgentInfo.tsx +7 -6
- package/src/views/Chat/ChatMessage.tsx +163 -145
- package/src/views/Chat/ChatMessages.tsx +2 -1
- package/src/views/Chat/StepsList.tsx +10 -11
- package/src/views/Chat/index.tsx +9 -2
- package/src/views/Chat/styled.ts +11 -16
- package/src/views/ChatHistory/HistoryItem.tsx +15 -54
- package/src/views/ChatHistory/index.tsx +1 -1
- package/src/views/ChatHistory/styled.ts +3 -5
- package/src/views/ChatHistory/utils.ts +43 -2
- package/src/views/ChatTabSelection.tsx +18 -10
- package/src/views/Editor.tsx +9 -14
- package/src/views/Home/BuiltInAgent.tsx +7 -8
- package/src/views/Home/CustomAgent.tsx +3 -3
- package/src/views/Home/index.tsx +2 -2
- package/src/views/Home/styled.ts +21 -22
- package/src/views/KSDocument.tsx +7 -8
- package/src/views/KnowledgeSources.tsx +24 -66
- package/src/views/MessageInput/AgentSelector.tsx +10 -8
- package/src/views/MessageInput/ButtonAgent.tsx +24 -12
- package/src/views/MessageInput/ButtonBar.tsx +25 -21
- package/src/views/MessageInput/ContextBar.tsx +16 -14
- package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +39 -62
- package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
- package/src/views/MessageInput/index.tsx +8 -9
- package/src/views/MessageInput/styled.ts +12 -16
- package/src/views/MinimizedHeader.tsx +5 -7
- package/src/views/Resources.tsx +31 -30
- package/src/views/Stacks.tsx +31 -54
- package/src/views/Steps/FlowChart/NodeStep.tsx +6 -4
- package/src/views/Steps/StepModal.tsx +14 -18
- package/src/views/Steps/index.tsx +4 -5
- package/src/views/Steps/utils.tsx +9 -9
- package/src/views/Tools.tsx +0 -1
- package/src/views/Workspaces/WorkspacesTab.tsx +17 -21
- package/src/views/Workspaces/index.tsx +4 -2
- package/dist/components/Accordion.d.ts +0 -20
- package/dist/components/Accordion.d.ts.map +0 -1
- package/dist/components/Accordion.js +0 -51
- package/dist/components/Accordion.js.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -33
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -52
- package/dist/components/FallbackBoundary/ErrorBoundary.js.map +0 -1
- package/dist/components/FallbackBoundary/Loading.d.ts +0 -2
- package/dist/components/FallbackBoundary/Loading.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/Loading.js +0 -12
- package/dist/components/FallbackBoundary/Loading.js.map +0 -1
- package/dist/components/FallbackBoundary/index.d.ts +0 -17
- package/dist/components/FallbackBoundary/index.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/index.js +0 -9
- package/dist/components/FallbackBoundary/index.js.map +0 -1
- package/dist/components/IconInput.d.ts +0 -10
- package/dist/components/IconInput.d.ts.map +0 -1
- package/dist/components/IconInput.js +0 -61
- package/dist/components/IconInput.js.map +0 -1
- package/dist/components/OverlayMenu.d.ts +0 -21
- package/dist/components/OverlayMenu.d.ts.map +0 -1
- package/dist/components/OverlayMenu.js +0 -79
- package/dist/components/OverlayMenu.js.map +0 -1
- package/dist/components/ProgressBar.d.ts +0 -37
- package/dist/components/ProgressBar.d.ts.map +0 -1
- package/dist/components/ProgressBar.js +0 -131
- package/dist/components/ProgressBar.js.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -37
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js +0 -30
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.d.ts +0 -29
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.js +0 -107
- package/dist/components/Tooltip/TooltipAPI.js.map +0 -1
- package/dist/components/Tooltip/context.d.ts +0 -5
- package/dist/components/Tooltip/context.d.ts.map +0 -1
- package/dist/components/Tooltip/context.js +0 -18
- package/dist/components/Tooltip/context.js.map +0 -1
- package/dist/components/Tooltip/index.d.ts +0 -3
- package/dist/components/Tooltip/index.d.ts.map +0 -1
- package/dist/components/Tooltip/index.js +0 -3
- package/dist/components/Tooltip/index.js.map +0 -1
- package/dist/components/Tooltip/style.d.ts +0 -4
- package/dist/components/Tooltip/style.d.ts.map +0 -1
- package/dist/components/Tooltip/style.js +0 -22
- package/dist/components/Tooltip/style.js.map +0 -1
- package/dist/components/Tooltip/types.d.ts +0 -27
- package/dist/components/Tooltip/types.d.ts.map +0 -1
- package/dist/components/Tooltip/types.js +0 -2
- package/dist/components/Tooltip/types.js.map +0 -1
- package/src/components/Accordion.tsx +0 -75
- package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -71
- package/src/components/FallbackBoundary/Loading.tsx +0 -14
- package/src/components/FallbackBoundary/index.tsx +0 -26
- package/src/components/IconInput.tsx +0 -73
- package/src/components/OverlayMenu.tsx +0 -133
- package/src/components/ProgressBar.tsx +0 -183
- package/src/components/Tooltip/Tooltip.tsx +0 -78
- package/src/components/Tooltip/TooltipAPI.ts +0 -101
- package/src/components/Tooltip/context.tsx +0 -24
- package/src/components/Tooltip/index.ts +0 -2
- package/src/components/Tooltip/style.tsx +0 -24
- package/src/components/Tooltip/types.ts +0 -28
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Tabs to select chat and add new chats */
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { IconButton } from '@citric/ui'
|
|
3
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
4
|
+
import { Button, IconButton } from '@stack-spot/citric-react'
|
|
6
5
|
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
7
6
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
8
7
|
import { last } from 'lodash'
|
|
@@ -71,14 +70,6 @@ const Tabs = styled.nav<{ $numberOfExtraButtons: number }>`
|
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
|
|
74
|
-
${IconButton} {
|
|
75
|
-
display: flex;
|
|
76
|
-
align-items: center;
|
|
77
|
-
justify-content: center;
|
|
78
|
-
background-color: transparent;
|
|
79
|
-
border: none;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
73
|
.list-overflow {
|
|
83
74
|
max-width: ${({ $numberOfExtraButtons }) => `calc(100% - ${$numberOfExtraButtons * (EXTRA_BTN_SIZE + EXTRA_BTN_MARGIN * 2)}px)`};
|
|
84
75
|
}
|
|
@@ -145,21 +136,6 @@ const Tabs = styled.nav<{ $numberOfExtraButtons: number }>`
|
|
|
145
136
|
mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
|
|
146
137
|
}
|
|
147
138
|
}
|
|
148
|
-
|
|
149
|
-
${IconButton} {
|
|
150
|
-
padding: 0;
|
|
151
|
-
width: 18px;
|
|
152
|
-
height: 18px;
|
|
153
|
-
transition: background-color 0.3s;
|
|
154
|
-
|
|
155
|
-
svg {
|
|
156
|
-
height: 14px;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
&:hover {
|
|
160
|
-
background-color: ${theme.color.light[600]};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
139
|
}
|
|
164
140
|
}
|
|
165
141
|
`
|
|
@@ -185,37 +161,37 @@ export function TabManager<T, Key extends React.Key>(
|
|
|
185
161
|
const tabItems = useMemo(() => tabs.map((tab) => (
|
|
186
162
|
<li key={keygen(tab)} className={keygen(tab) === active ? 'active' : undefined} onClick={onClickTab}>
|
|
187
163
|
<button className="label" onClick={() => onSelect(tab)}><FadingOverflow>{renderLabel(tab)}</FadingOverflow></button>
|
|
188
|
-
{tabs.length > 1 &&
|
|
164
|
+
{tabs.length > 1 &&
|
|
165
|
+
<IconButton appearance="text" icon="TimesMini" aria-label={t.close} title={t.close} onClick={() => onRemove(tab)} />}
|
|
189
166
|
</li>
|
|
190
167
|
)), [tabs, active])
|
|
191
168
|
|
|
192
|
-
const extras = useMemo(() => buttons.map(({
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</>)), [buttons])
|
|
169
|
+
const extras = useMemo(() => buttons.map(({
|
|
170
|
+
ariaLabel, title, label, onClick, group, icon, appearance, size, className, style, disabled }) => label
|
|
171
|
+
? <Button
|
|
172
|
+
style={{ marginRight: '4px', ...style }}
|
|
173
|
+
colorScheme="light"
|
|
174
|
+
size="md"
|
|
175
|
+
key={ariaLabel}
|
|
176
|
+
title={title || label}
|
|
177
|
+
onClick={onClick}
|
|
178
|
+
disabled={disabled}
|
|
179
|
+
>
|
|
180
|
+
<Icon group={group} icon={icon as any} />
|
|
181
|
+
{label}
|
|
182
|
+
</Button>
|
|
183
|
+
: <IconButton
|
|
184
|
+
key={ariaLabel}
|
|
185
|
+
group={group}
|
|
186
|
+
icon={icon as any}
|
|
187
|
+
aria-label={ariaLabel}
|
|
188
|
+
title={title}
|
|
189
|
+
size={size}
|
|
190
|
+
className={listToClass([className, 'extra'])}
|
|
191
|
+
style={style}
|
|
192
|
+
onClick={onClick}
|
|
193
|
+
appearance={appearance}
|
|
194
|
+
/>), [buttons])
|
|
219
195
|
|
|
220
196
|
// when a new tab is added, we should scroll to it if there are more tabs that we can show.
|
|
221
197
|
useEffect(() => {
|
|
@@ -227,7 +203,7 @@ export function TabManager<T, Key extends React.Key>(
|
|
|
227
203
|
}, [tabs])
|
|
228
204
|
|
|
229
205
|
return (
|
|
230
|
-
<Tabs $numberOfExtraButtons={buttons.length}>
|
|
206
|
+
<Tabs $numberOfExtraButtons={buttons.length} className="tabs">
|
|
231
207
|
<FadingOverflow className="list-overflow" scroll="arrows" enableHorizontalScrollWithVerticalWheel>
|
|
232
208
|
<ul ref={tabList}>{tabItems}</ul>
|
|
233
209
|
</FadingOverflow>
|
|
@@ -1,148 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { AnimatedHeight } from '@stack-spot/portal-components/AnimatedHeight'
|
|
5
|
-
import { ColorSchemeKey, listToClass, theme } from '@stack-spot/portal-theme'
|
|
6
|
-
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
|
-
import { get } from 'lodash'
|
|
8
|
-
import { DetailedHTMLProps, HTMLAttributes, useState } from 'react'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Accordion, Card, ImageBox, ImageWithFallback, Text } from '@stack-spot/citric-react'
|
|
3
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
9
4
|
import { styled } from 'styled-components'
|
|
10
|
-
import {
|
|
5
|
+
import { useCurrentChatState } from '../context/hooks'
|
|
11
6
|
import { toPrecision } from '../views/Steps/utils'
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
type Props = Omit<React.JSX.IntrinsicElements['div'], 'onChange'> & {
|
|
14
9
|
name: string,
|
|
15
10
|
duration?: number,
|
|
16
11
|
image?: string,
|
|
17
12
|
description?: string,
|
|
18
|
-
appearance?: 'round' | 'square',
|
|
19
|
-
backgroundColor?: ColorSchemeKey,
|
|
20
13
|
}
|
|
21
14
|
|
|
22
|
-
const Styled = styled.div
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const Styled = styled.div`
|
|
16
|
+
[data-citric="card"] {
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
gap: 8px;
|
|
19
|
+
border-radius: ${theme.radius.xl};
|
|
20
|
+
border: none;
|
|
21
|
+
align-items: center;
|
|
22
|
+
padding: 4px 16px 4px 4px;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
.tool-header {
|
|
29
|
-
padding: 4px 8px 4px 4px;
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
gap: 12px;
|
|
33
|
-
position: relative;
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
border-radius: 50%;
|
|
43
|
-
overflow: hidden;
|
|
44
|
-
flex-shrink: 0;
|
|
45
|
-
}
|
|
46
|
-
.name {
|
|
47
|
-
flex: 1;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
text-overflow: ellipsis;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.btn-expand {
|
|
54
|
-
display: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.duration {
|
|
58
|
-
opacity: 0.7;
|
|
59
|
-
text-align: right;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.with-description {
|
|
64
|
-
.tool-header {
|
|
65
|
-
&:before {
|
|
66
|
-
content: '';
|
|
67
|
-
top: 32px;
|
|
68
|
-
bottom: 8px;
|
|
69
|
-
left: 15px;
|
|
70
|
-
width: 1px;
|
|
71
|
-
background-color: ${theme.color.light[700]};
|
|
72
|
-
opacity: 0.3;
|
|
73
|
-
position: absolute;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.btn-expand {
|
|
77
|
-
display: flex;
|
|
78
|
-
transition: transform 0.3s ease-in-out;
|
|
79
|
-
&.open {
|
|
80
|
-
transform: rotate(180deg);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.description {
|
|
85
|
-
padding: 0 0 10px 20px;
|
|
86
|
-
opacity: 0.7;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
&.round {
|
|
92
|
-
.tool-header-wrapper {
|
|
93
|
-
border-radius: 30px;
|
|
94
|
-
}
|
|
95
|
-
&:not(.with-description) {
|
|
96
|
-
.tool-header-wrapper {
|
|
97
|
-
padding-right: 10px;
|
|
25
|
+
[data-citric="accordion"] {
|
|
26
|
+
background-color: ${theme.color.light[500]};
|
|
27
|
+
> header > label {
|
|
28
|
+
padding: 6px 10px 6px 6px;
|
|
29
|
+
font: ${theme.font.body2};
|
|
30
|
+
input:before {
|
|
31
|
+
font-size: 12px !important;
|
|
98
32
|
}
|
|
99
33
|
}
|
|
100
34
|
}
|
|
101
35
|
`
|
|
102
36
|
|
|
103
37
|
export const ToolBadge = (
|
|
104
|
-
{ name, duration, image, description,
|
|
38
|
+
{ name, duration, image, description, ...props }: Props,
|
|
105
39
|
) => {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
<Styled {...props} $backgroundColor={backgroundColor} className={rootClass}>
|
|
134
|
-
{description ? <AnimatedHeight className={wrapperClass}>{content}</AnimatedHeight> : <div className={wrapperClass}>{content}</div>}
|
|
135
|
-
</Styled>
|
|
136
|
-
)
|
|
40
|
+
const currentAgent = useCurrentChatState('agent')
|
|
41
|
+
|
|
42
|
+
const header = <>
|
|
43
|
+
<ImageBox><ImageWithFallback src={image} fallback={
|
|
44
|
+
<ImageWithFallback
|
|
45
|
+
src={currentAgent?.image ?? ''}
|
|
46
|
+
className="image"
|
|
47
|
+
fallback={<Icon icon="Cog" className="tool-image" />}
|
|
48
|
+
/>
|
|
49
|
+
} /></ImageBox>
|
|
50
|
+
<Text color="light.700" className="name" style={{ flex: 1 }}>{name}</Text>
|
|
51
|
+
{duration !== undefined && <Text color="light.700" className="duration">
|
|
52
|
+
{toPrecision(duration)}s
|
|
53
|
+
</Text>}
|
|
54
|
+
</>
|
|
55
|
+
|
|
56
|
+
return <Styled>
|
|
57
|
+
{description ? (
|
|
58
|
+
<Accordion
|
|
59
|
+
appearance="card"
|
|
60
|
+
header={header}
|
|
61
|
+
{...props}
|
|
62
|
+
>
|
|
63
|
+
<Text className="description" color="light.700">{description}</Text>
|
|
64
|
+
</Accordion>
|
|
65
|
+
) : <Card {...props}>{header}</Card>}
|
|
66
|
+
</Styled>
|
|
137
67
|
}
|
|
138
|
-
|
|
139
|
-
const dictionary = {
|
|
140
|
-
en: {
|
|
141
|
-
open: 'Open',
|
|
142
|
-
close: 'Close',
|
|
143
|
-
},
|
|
144
|
-
pt: {
|
|
145
|
-
open: 'Abrir',
|
|
146
|
-
close: 'Fechar',
|
|
147
|
-
},
|
|
148
|
-
} satisfies Dictionary
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Avatar, IconButton } from '@citric/ui'
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { FieldGroup, IconButton, ImageBox, Input, Row, Text } from '@stack-spot/citric-react'
|
|
4
3
|
import { Placeholder } from '@stack-spot/portal-components/Placeholder'
|
|
5
4
|
import { workspaceAiClient } from '@stack-spot/portal-network'
|
|
6
5
|
import { WorkspaceResponse, WorkspaceVisibilityLevelEnum } from '@stack-spot/portal-network/api/workspace-ai'
|
|
@@ -9,7 +8,6 @@ import { memo, useMemo, useState } from 'react'
|
|
|
9
8
|
import { useRightPanel } from '../right-panel/hooks'
|
|
10
9
|
import { ButtonFavorite } from './ButtonFavorite'
|
|
11
10
|
import { ComponentNavigator, ComponentNavigatorProps, NavigationComponent, NavigationMap, useComponentNavigation } from './ComponentNavigator'
|
|
12
|
-
import { IconInput } from './IconInput'
|
|
13
11
|
import { ListResource } from './ListResource'
|
|
14
12
|
|
|
15
13
|
interface CardSpaceProps {
|
|
@@ -20,25 +18,24 @@ interface CardSpaceProps {
|
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
export const CardSpace = ({ onClick, name, icon, logoUrl }: CardSpaceProps) =>
|
|
23
|
-
<
|
|
21
|
+
<Row
|
|
24
22
|
onClick={onClick}
|
|
25
23
|
flex={1}
|
|
26
|
-
alignItems="center"
|
|
27
24
|
justifyContent="space-between"
|
|
28
25
|
mr={2}
|
|
29
26
|
bg="light.400"
|
|
30
|
-
|
|
27
|
+
radius="sm"
|
|
31
28
|
p={3}
|
|
32
|
-
|
|
29
|
+
style={{ cursor: 'pointer' }}
|
|
33
30
|
>
|
|
34
|
-
<
|
|
35
|
-
<
|
|
36
|
-
{logoUrl ? <
|
|
37
|
-
</
|
|
31
|
+
<Row gap="8px">
|
|
32
|
+
<ImageBox appearance="square">
|
|
33
|
+
{logoUrl ? <img src={logoUrl} /> : icon}
|
|
34
|
+
</ImageBox>
|
|
38
35
|
<Text appearance="body2">{name}</Text>
|
|
39
|
-
</
|
|
40
|
-
<IconButton
|
|
41
|
-
</
|
|
36
|
+
</Row>
|
|
37
|
+
<IconButton icon="ArrowRight" />
|
|
38
|
+
</Row>
|
|
42
39
|
|
|
43
40
|
interface WorkspaceSourcesTabProps {
|
|
44
41
|
visibility: WorkspaceVisibilityLevelEnum,
|
|
@@ -91,16 +88,17 @@ const WorkspaceSourcesTab = ({ visibility, onClick }: WorkspaceSourcesTabProps)
|
|
|
91
88
|
|
|
92
89
|
return (
|
|
93
90
|
<>
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
91
|
+
<FieldGroup fullWidth style={{ alignSelf: 'stretch' }}>
|
|
92
|
+
<Icon icon="Search" />
|
|
93
|
+
<Input type="search" value={filter} onChange={setFilter} />
|
|
94
|
+
</FieldGroup>
|
|
97
95
|
|
|
98
96
|
{!!filtered.length &&
|
|
99
97
|
<ListResource
|
|
100
98
|
list={filtered}
|
|
101
99
|
keygen={w => w.id}
|
|
102
100
|
style={{ gap: '6px', display: 'flex', flexDirection: 'column' }}
|
|
103
|
-
renderLabel={w => <CardSpace name={w.name} logoUrl={w.logo} icon={<Spaces />} onClick={() => onClick(w)} />}
|
|
101
|
+
renderLabel={w => <CardSpace name={w.name} logoUrl={w.logo} icon={<Icon icon="Spaces" />} onClick={() => onClick(w)} />}
|
|
104
102
|
renderAfterElement={(w) =>
|
|
105
103
|
<ButtonFavorite favorite={{ idOrSlug: w?.id, listFavorites, onAddFavorite, onRemoveFavorite }} />}
|
|
106
104
|
optionClassName={w => (filter && !w.name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()))
|
|
@@ -110,26 +108,25 @@ const WorkspaceSourcesTab = ({ visibility, onClick }: WorkspaceSourcesTabProps)
|
|
|
110
108
|
className="option-list"
|
|
111
109
|
/>
|
|
112
110
|
}
|
|
113
|
-
<
|
|
111
|
+
<div style={{ width: '100%' }}>
|
|
114
112
|
{!!workspaces.length && !filtered.length &&
|
|
115
113
|
<Placeholder title={t.noSearchResults} description={t.noSearchResultsDescription} className="no-data-placeholder" />}
|
|
116
114
|
{!workspaces.length && <Placeholder title={t.noData} description={t.noDataDescription} />}
|
|
117
|
-
</
|
|
115
|
+
</div>
|
|
118
116
|
</>
|
|
119
117
|
)
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
|
|
123
120
|
const WorkspaceHeader = <T extends NavigationMap, K extends keyof T>({ data }: { data: NavigationComponent<T, K> }) => {
|
|
124
121
|
const { close: closeRightPanel } = useRightPanel()
|
|
125
122
|
const workspaceId = (data.props as any)['workspaceId']
|
|
126
123
|
if (!workspaceId) return
|
|
127
124
|
|
|
128
125
|
const workspace = workspaceAiClient.workspaceAi.useQuery({ id: workspaceId })
|
|
129
|
-
return <
|
|
126
|
+
return <Row justifyContent="space-between" flex={1}>
|
|
130
127
|
{data.component === 'workspaceResource' ? 'Spots' : workspace.name}
|
|
131
|
-
{data.fullScreen && <IconButton title={'t.close'} aria-label={'t.close'} onClick={closeRightPanel}
|
|
132
|
-
</
|
|
128
|
+
{data.fullScreen && <IconButton icon="Times" title={'t.close'} aria-label={'t.close'} onClick={closeRightPanel} />}
|
|
129
|
+
</Row>
|
|
133
130
|
}
|
|
134
131
|
|
|
135
132
|
interface WorkspaceTabNavigatorProps {
|
|
@@ -1,81 +1,106 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { Accordion, Checkbox, CheckboxGroup, FieldGroup, Input, Row, Text, useCheckboxGroupControls } from '@stack-spot/citric-react'
|
|
3
3
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { difference, uniqBy } from 'lodash'
|
|
5
|
+
import { useCallback, useEffect, useState } from 'react'
|
|
6
|
+
import { Labeled } from '../../state/types'
|
|
7
|
+
import { ButtonFavorite, Favorite } from '../ButtonFavorite'
|
|
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
|
+
}
|
|
8
24
|
|
|
9
25
|
/**
|
|
10
26
|
* Renders a checkbox group where each option has a label and a description.
|
|
11
27
|
* The description in placed under the label and checkbox as an accordion.
|
|
28
|
+
*
|
|
29
|
+
* Also renders a search input and a select all checkbox.
|
|
12
30
|
*/
|
|
13
|
-
export function DescribedCheckboxGroup<T>(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
options,
|
|
17
|
-
renderDescription,
|
|
18
|
-
renderLabel,
|
|
19
|
-
renderBeforeElement,
|
|
20
|
-
renderAfterElement,
|
|
21
|
-
optionClassName,
|
|
22
|
-
optionStyle,
|
|
23
|
-
value,
|
|
24
|
-
className,
|
|
25
|
-
style }: CheckProps<T>) {
|
|
31
|
+
export function DescribedCheckboxGroup<T>(
|
|
32
|
+
{ initialValue, options: opt, data, globalSelection, onChange: change, emptyDataset, emptyResults }: Props<T>,
|
|
33
|
+
) {
|
|
26
34
|
const t = useTranslate(dictionary)
|
|
27
|
-
const
|
|
35
|
+
const [options, setOptions] = useState(opt)
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
} else {
|
|
33
|
-
onChange([])
|
|
34
|
-
}
|
|
35
|
-
}
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (controls.value.length === 0 && (initialValue?.length ?? 0) > 0) controls.setValue(initialValue!)
|
|
39
|
+
}, [initialValue])
|
|
36
40
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
else onChange(value.filter(item => item !== option))
|
|
47
|
-
}}
|
|
48
|
-
/>
|
|
49
|
-
{typeof label === 'string' ? <Text>{label}</Text> : label}
|
|
50
|
-
</label>
|
|
41
|
+
const onChange = useCallback((newValue: T[], previousValue: T[]) => {
|
|
42
|
+
change?.(newValue)
|
|
43
|
+
if (!globalSelection?.current) return
|
|
44
|
+
const added = difference(newValue, previousValue)
|
|
45
|
+
const removed = difference(previousValue, newValue)
|
|
46
|
+
globalSelection.current = globalSelection.current?.filter(o => !removed.some(r => data(r).idOrSlug === o.id)) ?? []
|
|
47
|
+
globalSelection.current = uniqBy(
|
|
48
|
+
[...globalSelection.current, ...added.map(o => ({ id: data(o).idOrSlug, label: data(o).name }))],
|
|
49
|
+
'id',
|
|
51
50
|
)
|
|
51
|
+
}, [])
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
: description as any
|
|
61
|
-
}
|
|
62
|
-
</Accordion>
|
|
63
|
-
{renderAfterElement?.(option)}
|
|
64
|
-
</li>
|
|
65
|
-
</>
|
|
66
|
-
)
|
|
67
|
-
}), [options, value])
|
|
53
|
+
const controls = useCheckboxGroupControls({
|
|
54
|
+
initialValue,
|
|
55
|
+
options,
|
|
56
|
+
applyFilter: (filter, o) => data(o).name.toLocaleLowerCase().includes(filter.toLocaleLowerCase()),
|
|
57
|
+
renderKey: o => data(o).idOrSlug,
|
|
58
|
+
onChange,
|
|
59
|
+
})
|
|
68
60
|
|
|
69
|
-
return
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
return options.length ? <>
|
|
62
|
+
<FieldGroup fullWidth>
|
|
63
|
+
<Icon icon="Search" />
|
|
64
|
+
<Input type="search" value={controls.filter} onChange={controls.setFilter} />
|
|
65
|
+
</FieldGroup>
|
|
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
|
+
}}
|
|
74
101
|
/>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{items}
|
|
78
|
-
</RadioCheckBox>
|
|
102
|
+
</> : emptyResults}
|
|
103
|
+
</> : emptyDataset
|
|
79
104
|
}
|
|
80
105
|
|
|
81
106
|
const dictionary = {
|