@stack-spot/ai-chat-widget 0.11.0 → 1.0.0-dev.1768324407795
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 +972 -0
- package/README.md +1 -0
- package/dist/StackspotAIWidget.d.ts +48 -7
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +22 -23
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +175 -0
- package/dist/assets/placeholder.png +0 -0
- package/dist/chat-interceptors/CustomInputs.d.ts +4 -1
- package/dist/chat-interceptors/CustomInputs.d.ts.map +1 -1
- package/dist/chat-interceptors/CustomInputs.js +10 -1
- package/dist/chat-interceptors/CustomInputs.js.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.d.ts +10 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.js +12 -2
- package/dist/chat-interceptors/quick-command-questions.js.map +1 -1
- package/dist/chat-interceptors/quick-commands.d.ts +11 -0
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +241 -48
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.d.ts +26 -1
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +227 -26
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/components/AdaptiveTextArea.d.ts +15 -3
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +22 -10
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts +4 -0
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -0
- package/dist/components/AgentCard/AgentCardCreate.js +33 -0
- package/dist/components/AgentCard/AgentCardCreate.js.map +1 -0
- package/dist/components/AgentCard/dictionary.d.ts +23 -0
- package/dist/components/AgentCard/dictionary.d.ts.map +1 -0
- package/dist/components/AgentCard/dictionary.js +23 -0
- package/dist/components/AgentCard/dictionary.js.map +1 -0
- package/dist/components/AgentCard/index.d.ts +5 -0
- package/dist/components/AgentCard/index.d.ts.map +1 -0
- package/dist/components/AgentCard/index.js +55 -0
- package/dist/components/AgentCard/index.js.map +1 -0
- package/dist/components/AnimatedOpacity.d.ts +8 -0
- package/dist/components/AnimatedOpacity.d.ts.map +1 -0
- package/dist/components/AnimatedOpacity.js +46 -0
- package/dist/components/AnimatedOpacity.js.map +1 -0
- package/dist/components/AutoFocus.d.ts +23 -0
- package/dist/components/AutoFocus.d.ts.map +1 -0
- package/dist/components/AutoFocus.js +23 -0
- package/dist/components/AutoFocus.js.map +1 -0
- package/dist/components/ButtonFavorite.d.ts +40 -0
- package/dist/components/ButtonFavorite.d.ts.map +1 -0
- package/dist/components/ButtonFavorite.js +25 -0
- package/dist/components/ButtonFavorite.js.map +1 -0
- package/dist/components/Code.d.ts +2 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +52 -24
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts +38 -0
- package/dist/components/ComponentNavigator.d.ts.map +1 -0
- package/dist/components/ComponentNavigator.js +31 -0
- package/dist/components/ComponentNavigator.js.map +1 -0
- package/dist/components/Fading.d.ts +32 -0
- package/dist/components/Fading.d.ts.map +1 -0
- package/dist/components/Fading.js +33 -0
- package/dist/components/Fading.js.map +1 -0
- package/dist/components/FadingOverflow.d.ts +25 -0
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +16 -8
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FileDescription.d.ts +10 -0
- package/dist/components/FileDescription.d.ts.map +1 -0
- package/dist/components/FileDescription.js +84 -0
- package/dist/components/FileDescription.js.map +1 -0
- package/dist/components/HistoryList.d.ts +15 -0
- package/dist/components/HistoryList.d.ts.map +1 -1
- package/dist/components/HistoryList.js +6 -2
- package/dist/components/HistoryList.js.map +1 -1
- package/dist/components/ListResource.d.ts +29 -0
- package/dist/components/ListResource.d.ts.map +1 -0
- package/dist/components/ListResource.js +17 -0
- package/dist/components/ListResource.js.map +1 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +2 -2
- package/dist/components/Markdown.js.map +1 -1
- package/dist/components/Modal.d.ts +9 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +56 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/QuickStartButton.d.ts +2 -4
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +7 -39
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelContentList.d.ts +10 -0
- package/dist/components/RightPanelContentList.d.ts.map +1 -0
- package/dist/components/RightPanelContentList.js +7 -0
- package/dist/components/RightPanelContentList.js.map +1 -0
- package/dist/components/RightPanelForm.d.ts +3 -0
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +57 -17
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +4 -4
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +7 -16
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/Selector/index.d.ts +54 -0
- package/dist/components/Selector/index.d.ts.map +1 -0
- package/dist/components/Selector/index.js +143 -0
- package/dist/components/Selector/index.js.map +1 -0
- package/dist/components/Selector/styled.d.ts +4 -0
- package/dist/components/Selector/styled.d.ts.map +1 -0
- package/dist/components/Selector/styled.js +157 -0
- package/dist/components/Selector/styled.js.map +1 -0
- package/dist/components/StackedBadge.d.ts +14 -0
- package/dist/components/StackedBadge.d.ts.map +1 -0
- package/dist/components/StackedBadge.js +56 -0
- package/dist/components/StackedBadge.js.map +1 -0
- package/dist/components/TabManager.d.ts +6 -0
- package/dist/components/TabManager.d.ts.map +1 -1
- package/dist/components/TabManager.js +16 -28
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/ToolBadge.d.ts +9 -0
- package/dist/components/ToolBadge.d.ts.map +1 -0
- package/dist/components/ToolBadge.js +34 -0
- package/dist/components/ToolBadge.js.map +1 -0
- package/dist/components/WorkspaceTabNavigator.d.ts +17 -0
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -0
- package/dist/components/WorkspaceTabNavigator.js +93 -0
- package/dist/components/WorkspaceTabNavigator.js.map +1 -0
- package/dist/components/form/DescribedCheckboxGroup.d.ts +30 -2
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +75 -21
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +31 -2
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +65 -16
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/components/form/dictionary.d.ts +19 -0
- package/dist/components/form/dictionary.d.ts.map +1 -0
- package/dist/components/form/dictionary.js +19 -0
- package/dist/components/form/dictionary.js.map +1 -0
- package/dist/components/form/styled.d.ts.map +1 -1
- package/dist/components/form/styled.js +1 -2
- package/dist/components/form/styled.js.map +1 -1
- package/dist/components/form/types.d.ts +42 -0
- package/dist/components/form/types.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.d.ts +19 -0
- package/dist/context/AIWidgetProvider.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.js +19 -0
- package/dist/context/AIWidgetProvider.js.map +1 -1
- package/dist/context/hooks.d.ts +61 -4
- package/dist/context/hooks.d.ts.map +1 -1
- package/dist/context/hooks.js +83 -13
- package/dist/context/hooks.js.map +1 -1
- package/dist/features.d.ts +72 -10
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +23 -8
- package/dist/features.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 +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/layout.css +95 -28
- package/dist/regex.d.ts +3 -0
- package/dist/regex.d.ts.map +1 -0
- package/dist/regex.js +3 -0
- package/dist/regex.js.map +1 -0
- package/dist/right-panel/DefaultPanel.d.ts +3 -0
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +5 -4
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/right-panel/RightPanel.d.ts +3 -0
- package/dist/right-panel/RightPanel.d.ts.map +1 -1
- package/dist/right-panel/RightPanel.js +3 -0
- package/dist/right-panel/RightPanel.js.map +1 -1
- package/dist/right-panel/RightPanelProvider.d.ts +15 -0
- package/dist/right-panel/RightPanelProvider.d.ts.map +1 -1
- package/dist/right-panel/RightPanelProvider.js.map +1 -1
- package/dist/right-panel/constants.d.ts +2 -0
- package/dist/right-panel/constants.d.ts.map +1 -0
- package/dist/right-panel/constants.js +2 -0
- package/dist/right-panel/constants.js.map +1 -0
- package/dist/right-panel/hooks.d.ts +6 -0
- package/dist/right-panel/hooks.d.ts.map +1 -1
- package/dist/right-panel/hooks.js +8 -1
- package/dist/right-panel/hooks.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +182 -8
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +26 -3
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +116 -14
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js +49 -8
- package/dist/state/ChatState.js.map +1 -1
- package/dist/state/ChatTabsController.d.ts +50 -1
- package/dist/state/ChatTabsController.d.ts.map +1 -1
- package/dist/state/ChatTabsController.js +77 -8
- package/dist/state/ChatTabsController.js.map +1 -1
- package/dist/state/ObservableState.d.ts +14 -0
- package/dist/state/ObservableState.d.ts.map +1 -1
- package/dist/state/ObservableState.js +14 -0
- package/dist/state/ObservableState.js.map +1 -1
- package/dist/state/WidgetState.d.ts +62 -2
- package/dist/state/WidgetState.d.ts.map +1 -1
- package/dist/state/WidgetState.js +49 -2
- package/dist/state/WidgetState.js.map +1 -1
- package/dist/state/constants.d.ts +5 -0
- package/dist/state/constants.d.ts.map +1 -0
- package/dist/state/constants.js +10 -0
- package/dist/state/constants.js.map +1 -0
- package/dist/state/types.d.ts +10 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/types.d.ts +20 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/chat.d.ts +11 -4
- package/dist/utils/chat.d.ts.map +1 -1
- package/dist/utils/chat.js +13 -11
- package/dist/utils/chat.js.map +1 -1
- package/dist/utils/check-is-trial.d.ts +2 -0
- package/dist/utils/check-is-trial.d.ts.map +1 -0
- package/dist/utils/check-is-trial.js +6 -0
- package/dist/utils/check-is-trial.js.map +1 -0
- package/dist/utils/copy-to-clipboard.d.ts +6 -0
- package/dist/utils/copy-to-clipboard.d.ts.map +1 -0
- package/dist/utils/copy-to-clipboard.js +30 -0
- package/dist/utils/copy-to-clipboard.js.map +1 -0
- package/dist/utils/date.d.ts +26 -2
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +28 -3
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/download.d.ts +5 -0
- package/dist/utils/download.d.ts.map +1 -1
- package/dist/utils/download.js +5 -0
- package/dist/utils/download.js.map +1 -1
- package/dist/utils/error.d.ts +2 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +54 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/knowledge-source.d.ts +12 -2
- package/dist/utils/knowledge-source.d.ts.map +1 -1
- package/dist/utils/knowledge-source.js +16 -0
- package/dist/utils/knowledge-source.js.map +1 -1
- package/dist/utils/planning-tool.d.ts +17 -0
- package/dist/utils/planning-tool.d.ts.map +1 -0
- package/dist/utils/planning-tool.js +32 -0
- package/dist/utils/planning-tool.js.map +1 -0
- package/dist/utils/programming-languages.d.ts.map +1 -1
- package/dist/utils/programming-languages.js +10 -0
- package/dist/utils/programming-languages.js.map +1 -1
- package/dist/utils/string.d.ts +5 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +5 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/tools.d.ts +23 -0
- package/dist/utils/tools.d.ts.map +1 -0
- package/dist/utils/tools.js +23 -0
- package/dist/utils/tools.js.map +1 -0
- package/dist/utils/update-tool-step.d.ts +3 -0
- package/dist/utils/update-tool-step.d.ts.map +1 -0
- package/dist/utils/update-tool-step.js +23 -0
- package/dist/utils/update-tool-step.js.map +1 -0
- package/dist/utils/upload/FileUpload.d.ts +21 -0
- package/dist/utils/upload/FileUpload.d.ts.map +1 -0
- package/dist/utils/upload/FileUpload.js +54 -0
- package/dist/utils/upload/FileUpload.js.map +1 -0
- package/dist/utils/upload/UploadManager.d.ts +42 -0
- package/dist/utils/upload/UploadManager.d.ts.map +1 -0
- package/dist/utils/upload/UploadManager.js +138 -0
- package/dist/utils/upload/UploadManager.js.map +1 -0
- package/dist/utils/upload/context.d.ts +15 -0
- package/dist/utils/upload/context.d.ts.map +1 -0
- package/dist/utils/upload/context.js +37 -0
- package/dist/utils/upload/context.js.map +1 -0
- package/dist/utils/upload/errors.d.ts +17 -0
- package/dist/utils/upload/errors.d.ts.map +1 -0
- package/dist/utils/upload/errors.js +27 -0
- package/dist/utils/upload/errors.js.map +1 -0
- package/dist/utils/upload/types.d.ts +7 -0
- package/dist/utils/upload/types.d.ts.map +1 -0
- package/dist/{components/Tooltip → utils/upload}/types.js.map +1 -1
- package/dist/utils/upload/use-paste-upload.d.ts +8 -0
- package/dist/utils/upload/use-paste-upload.d.ts.map +1 -0
- package/dist/utils/upload/use-paste-upload.js +19 -0
- package/dist/utils/upload/use-paste-upload.js.map +1 -0
- package/dist/utils/upload/utils.d.ts +4 -0
- package/dist/utils/upload/utils.d.ts.map +1 -0
- package/dist/utils/upload/utils.js +10 -0
- package/dist/utils/upload/utils.js.map +1 -0
- package/dist/utils/url.d.ts +2 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +8 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/views/Agents/AgentDescription.d.ts +4 -0
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -0
- package/dist/views/Agents/AgentDescription.js +38 -0
- package/dist/views/Agents/AgentDescription.js.map +1 -0
- package/dist/views/Agents/AgentsPanel.d.ts +5 -0
- package/dist/views/Agents/AgentsPanel.d.ts.map +1 -0
- package/dist/views/Agents/AgentsPanel.js +45 -0
- package/dist/views/Agents/AgentsPanel.js.map +1 -0
- package/dist/views/Agents/AgentsTab.d.ts +11 -0
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -0
- package/dist/views/Agents/AgentsTab.js +82 -0
- package/dist/views/Agents/AgentsTab.js.map +1 -0
- package/dist/views/Agents/dictionary.d.ts +2 -0
- package/dist/views/Agents/dictionary.d.ts.map +1 -0
- package/dist/views/Agents/dictionary.js +43 -0
- package/dist/views/Agents/dictionary.js.map +1 -0
- package/dist/views/Agents/index.d.ts +5 -0
- package/dist/views/Agents/index.d.ts.map +1 -0
- package/dist/views/Agents/index.js +21 -0
- package/dist/views/Agents/index.js.map +1 -0
- package/dist/views/Agents/styled.d.ts +3 -0
- package/dist/views/Agents/styled.d.ts.map +1 -0
- package/dist/views/Agents/styled.js +68 -0
- package/dist/views/Agents/styled.js.map +1 -0
- package/dist/views/Agents/useAgentFavorites.d.ts +8 -0
- package/dist/views/Agents/useAgentFavorites.d.ts.map +1 -0
- package/dist/views/Agents/useAgentFavorites.js +59 -0
- package/dist/views/Agents/useAgentFavorites.js.map +1 -0
- package/dist/views/Chat/AgentInfo.d.ts +5 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +6 -5
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ButtonExecutionDetail.d.ts +5 -0
- package/dist/views/Chat/ButtonExecutionDetail.d.ts.map +1 -0
- package/dist/views/Chat/ButtonExecutionDetail.js +34 -0
- package/dist/views/Chat/ButtonExecutionDetail.js.map +1 -0
- package/dist/views/Chat/ChatMessage.d.ts +56 -4
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +160 -24
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/ChatMessages.d.ts +6 -2
- package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessages.js +5 -2
- package/dist/views/Chat/ChatMessages.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts +14 -0
- package/dist/views/Chat/StepsList.d.ts.map +1 -0
- package/dist/views/Chat/StepsList.js +192 -0
- package/dist/views/Chat/StepsList.js.map +1 -0
- package/dist/views/Chat/chat-scroll.d.ts +1 -1
- package/dist/views/Chat/chat-scroll.js +1 -1
- package/dist/views/Chat/events.d.ts +22 -0
- package/dist/views/Chat/events.d.ts.map +1 -0
- package/dist/views/Chat/events.js +67 -0
- package/dist/views/Chat/events.js.map +1 -0
- package/dist/views/Chat/index.d.ts +9 -2
- package/dist/views/Chat/index.d.ts.map +1 -1
- package/dist/views/Chat/index.js +5 -2
- package/dist/views/Chat/index.js.map +1 -1
- package/dist/views/Chat/styled.d.ts +3 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +152 -31
- package/dist/views/Chat/styled.js.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts +4 -4
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.js +6 -2
- package/dist/views/ChatHistory/ChatHistoryPanel.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts +4 -3
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +16 -37
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/dictionary.d.ts +1 -1
- package/dist/views/ChatHistory/index.d.ts +4 -4
- package/dist/views/ChatHistory/index.d.ts.map +1 -1
- package/dist/views/ChatHistory/index.js +6 -3
- 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 +17 -2
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +140 -9
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts +6 -4
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +40 -15
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts +3 -0
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +23 -16
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts +6 -0
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -0
- package/dist/views/Home/BuiltInAgent.js +37 -0
- package/dist/views/Home/BuiltInAgent.js.map +1 -0
- package/dist/views/Home/CustomAgent.d.ts +5 -0
- package/dist/views/Home/CustomAgent.d.ts.map +1 -0
- package/dist/views/Home/CustomAgent.js +23 -0
- package/dist/views/Home/CustomAgent.js.map +1 -0
- package/dist/views/Home/index.d.ts +8 -0
- package/dist/views/Home/index.d.ts.map +1 -0
- package/dist/views/Home/index.js +34 -0
- package/dist/views/Home/index.js.map +1 -0
- package/dist/views/Home/styled.d.ts +2 -0
- package/dist/views/Home/styled.d.ts.map +1 -0
- package/dist/views/Home/styled.js +74 -0
- package/dist/views/Home/styled.js.map +1 -0
- package/dist/views/Home/types.d.ts +16 -0
- package/dist/views/Home/types.d.ts.map +1 -0
- package/dist/views/Home/types.js +2 -0
- package/dist/views/Home/types.js.map +1 -0
- package/dist/views/KSDocument.d.ts +3 -0
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +7 -4
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts +12 -0
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +123 -33
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts +5 -0
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -0
- package/dist/views/MessageInput/AgentSelector.js +66 -0
- package/dist/views/MessageInput/AgentSelector.js.map +1 -0
- package/dist/views/MessageInput/ButtonAgent.d.ts +2 -0
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -0
- package/dist/views/MessageInput/ButtonAgent.js +35 -0
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -0
- package/dist/views/MessageInput/ButtonBar.d.ts +13 -0
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -0
- package/dist/views/MessageInput/ButtonBar.js +15 -0
- package/dist/views/MessageInput/ButtonBar.js.map +1 -0
- package/dist/views/MessageInput/ContextBar.d.ts +9 -0
- package/dist/views/MessageInput/ContextBar.d.ts.map +1 -0
- package/dist/views/MessageInput/ContextBar.js +51 -0
- package/dist/views/MessageInput/ContextBar.js.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts +2 -0
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js +25 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts +30 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js +91 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js.map +1 -0
- package/dist/views/MessageInput/QuickCommandSelector.d.ts +5 -0
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -0
- package/dist/views/MessageInput/QuickCommandSelector.js +104 -0
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -0
- package/dist/views/MessageInput/SelectContent.d.ts +2 -0
- package/dist/views/MessageInput/SelectContent.d.ts.map +1 -0
- package/dist/views/MessageInput/SelectContent.js +84 -0
- package/dist/views/MessageInput/SelectContent.js.map +1 -0
- package/dist/views/MessageInput/UploadBar.d.ts +2 -0
- package/dist/views/MessageInput/UploadBar.d.ts.map +1 -0
- package/dist/views/MessageInput/UploadBar.js +74 -0
- package/dist/views/MessageInput/UploadBar.js.map +1 -0
- package/dist/views/MessageInput/UploadDragNDrop.d.ts +14 -0
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -0
- package/dist/views/MessageInput/UploadDragNDrop.js +51 -0
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -0
- package/dist/views/MessageInput/chat-entry-history.d.ts +11 -0
- package/dist/views/MessageInput/chat-entry-history.d.ts.map +1 -0
- package/dist/views/MessageInput/chat-entry-history.js +78 -0
- package/dist/views/MessageInput/chat-entry-history.js.map +1 -0
- 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 +52 -10
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts +9 -6
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +112 -20
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +13 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +223 -85
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts +4 -0
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +9 -7
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Resources.d.ts +2 -0
- package/dist/views/Resources.d.ts.map +1 -0
- package/dist/views/Resources.js +69 -0
- package/dist/views/Resources.js.map +1 -0
- package/dist/views/Stacks.d.ts +12 -0
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +117 -21
- package/dist/views/Stacks.js.map +1 -1
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts +10 -0
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/HandleGroup.js +4 -0
- package/dist/views/Steps/FlowChart/HandleGroup.js.map +1 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts +15 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js +41 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js.map +1 -0
- package/dist/views/Steps/FlowChart/NodeStep.d.ts +10 -0
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/NodeStep.js +13 -0
- package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -0
- package/dist/views/Steps/FlowChart/hooks.d.ts +7 -0
- package/dist/views/Steps/FlowChart/hooks.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/hooks.js +31 -0
- package/dist/views/Steps/FlowChart/hooks.js.map +1 -0
- package/dist/views/Steps/FlowChart/index.d.ts +12 -0
- package/dist/views/Steps/FlowChart/index.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/index.js +78 -0
- package/dist/views/Steps/FlowChart/index.js.map +1 -0
- package/dist/views/Steps/FlowChart/layout.d.ts +8 -0
- package/dist/views/Steps/FlowChart/layout.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/layout.js +59 -0
- package/dist/views/Steps/FlowChart/layout.js.map +1 -0
- package/dist/views/Steps/FlowChart/styled.d.ts +14 -0
- package/dist/views/Steps/FlowChart/styled.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/styled.js +156 -0
- package/dist/views/Steps/FlowChart/styled.js.map +1 -0
- package/dist/views/Steps/FlowChart/types.d.ts +25 -0
- package/dist/views/Steps/FlowChart/types.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/types.js +2 -0
- package/dist/views/Steps/FlowChart/types.js.map +1 -0
- package/dist/views/Steps/StepModal.d.ts +10 -0
- package/dist/views/Steps/StepModal.d.ts.map +1 -0
- package/dist/views/Steps/StepModal.js +139 -0
- package/dist/views/Steps/StepModal.js.map +1 -0
- package/dist/views/Steps/StepsPanel.d.ts +6 -0
- package/dist/views/Steps/StepsPanel.d.ts.map +1 -0
- package/dist/views/Steps/StepsPanel.js +18 -0
- package/dist/views/Steps/StepsPanel.js.map +1 -0
- package/dist/views/Steps/dictionary.d.ts +43 -0
- package/dist/views/Steps/dictionary.d.ts.map +1 -0
- package/dist/views/Steps/dictionary.js +45 -0
- package/dist/views/Steps/dictionary.js.map +1 -0
- package/dist/views/Steps/index.d.ts +5 -0
- package/dist/views/Steps/index.d.ts.map +1 -0
- package/dist/views/Steps/index.js +30 -0
- package/dist/views/Steps/index.js.map +1 -0
- package/dist/views/Steps/utils.d.ts +7 -0
- package/dist/views/Steps/utils.d.ts.map +1 -0
- package/dist/views/Steps/utils.js +32 -0
- package/dist/views/Steps/utils.js.map +1 -0
- package/dist/views/Tools.d.ts +2 -0
- package/dist/views/Tools.d.ts.map +1 -0
- package/dist/views/Tools.js +53 -0
- package/dist/views/Tools.js.map +1 -0
- package/dist/views/Workspaces/WorkspacesTab.d.ts +20 -0
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -0
- package/dist/views/Workspaces/WorkspacesTab.js +61 -0
- package/dist/views/Workspaces/WorkspacesTab.js.map +1 -0
- package/dist/views/Workspaces/index.d.ts +5 -0
- package/dist/views/Workspaces/index.d.ts.map +1 -0
- package/dist/views/Workspaces/index.js +69 -0
- package/dist/views/Workspaces/index.js.map +1 -0
- package/package.dev.json +3 -0
- package/package.json +21 -13
- package/package.stg.json +4 -0
- package/src/StackspotAIWidget.tsx +96 -37
- package/src/app-metadata.json +175 -0
- package/src/assets/placeholder.png +0 -0
- package/src/chat-interceptors/CustomInputs.ts +14 -1
- package/src/chat-interceptors/quick-command-questions.ts +12 -2
- package/src/chat-interceptors/quick-commands.ts +286 -52
- package/src/chat-interceptors/send-message.ts +253 -25
- package/src/components/AdaptiveTextArea.tsx +36 -11
- package/src/components/AgentCard/AgentCardCreate.tsx +42 -0
- package/src/components/AgentCard/dictionary.ts +25 -0
- package/src/components/AgentCard/index.tsx +82 -0
- package/src/components/AnimatedOpacity.tsx +55 -0
- package/src/components/AutoFocus.tsx +42 -0
- package/src/components/ButtonFavorite.tsx +78 -0
- package/src/components/Code.tsx +94 -59
- package/src/components/ComponentNavigator.tsx +99 -0
- package/src/components/Fading.tsx +66 -0
- package/src/components/FadingOverflow.tsx +39 -12
- package/src/components/FileDescription.tsx +118 -0
- package/src/components/HistoryList.tsx +19 -2
- package/src/components/ListResource.tsx +60 -0
- package/src/components/Markdown.tsx +2 -1
- package/src/components/Modal.tsx +85 -0
- package/src/components/QuickStartButton.tsx +15 -47
- package/src/components/RightPanelContentList.tsx +15 -0
- package/src/components/RightPanelForm.tsx +64 -22
- package/src/components/RightPanelTabs.tsx +7 -32
- package/src/components/Selector/index.tsx +312 -0
- package/src/components/Selector/styled.ts +158 -0
- package/src/components/StackedBadge.tsx +77 -0
- package/src/components/TabManager.tsx +36 -36
- package/src/components/ToolBadge.tsx +67 -0
- package/src/components/WorkspaceTabNavigator.tsx +172 -0
- package/src/components/form/DescribedCheckboxGroup.tsx +135 -33
- package/src/components/form/DescribedRadioGroup.tsx +136 -32
- package/src/components/form/dictionary.ts +18 -0
- package/src/components/form/styled.ts +1 -2
- package/src/components/form/types.ts +45 -1
- package/src/context/AIWidgetProvider.tsx +19 -0
- package/src/context/hooks.ts +86 -16
- package/src/features.ts +90 -16
- package/src/hooks/midnight-update-view.ts +36 -0
- package/src/images.d.ts +5 -0
- package/src/index.ts +16 -0
- package/src/layout.css +95 -28
- package/src/regex.ts +2 -0
- package/src/right-panel/DefaultPanel.tsx +7 -7
- package/src/right-panel/RightPanel.tsx +3 -0
- package/src/right-panel/RightPanelProvider.tsx +15 -0
- package/src/right-panel/constants.ts +1 -0
- package/src/right-panel/hooks.tsx +8 -1
- package/src/state/ChatEntry.ts +189 -9
- package/src/state/ChatState.ts +131 -14
- package/src/state/ChatTabsController.ts +78 -8
- package/src/state/ObservableState.ts +14 -0
- package/src/state/WidgetState.ts +86 -3
- package/src/state/constants.ts +13 -0
- package/src/state/types.ts +12 -1
- package/src/types.ts +21 -4
- package/src/utils/chat.ts +15 -14
- package/src/utils/check-is-trial.ts +6 -0
- package/src/utils/copy-to-clipboard.ts +29 -0
- package/src/utils/date.ts +28 -4
- package/src/utils/download.ts +5 -0
- package/src/utils/error.ts +56 -0
- package/src/utils/knowledge-source.ts +18 -2
- package/src/utils/planning-tool.ts +41 -0
- package/src/utils/programming-languages.ts +10 -0
- package/src/utils/string.ts +5 -1
- package/src/utils/tools.ts +32 -0
- package/src/utils/update-tool-step.tsx +27 -0
- package/src/utils/upload/FileUpload.ts +63 -0
- package/src/utils/upload/UploadManager.ts +156 -0
- package/src/utils/upload/context.tsx +44 -0
- package/src/utils/upload/errors.ts +34 -0
- package/src/utils/upload/types.ts +7 -0
- package/src/utils/upload/use-paste-upload.tsx +30 -0
- package/src/utils/upload/utils.ts +12 -0
- package/src/utils/url.ts +8 -0
- package/src/views/Agents/AgentDescription.tsx +107 -0
- package/src/views/Agents/AgentsPanel.tsx +57 -0
- package/src/views/Agents/AgentsTab.tsx +126 -0
- package/src/views/Agents/dictionary.ts +45 -0
- package/src/views/Agents/index.tsx +26 -0
- package/src/views/Agents/styled.ts +69 -0
- package/src/views/Agents/useAgentFavorites.ts +63 -0
- package/src/views/Chat/AgentInfo.tsx +13 -8
- package/src/views/Chat/ButtonExecutionDetail.tsx +46 -0
- package/src/views/Chat/ChatMessage.tsx +465 -79
- package/src/views/Chat/ChatMessages.tsx +15 -4
- package/src/views/Chat/StepsList.tsx +394 -0
- package/src/views/Chat/chat-scroll.ts +1 -1
- package/src/views/Chat/events.ts +71 -0
- package/src/views/Chat/index.tsx +17 -3
- package/src/views/Chat/styled.ts +158 -32
- package/src/views/ChatHistory/ChatHistoryPanel.tsx +8 -5
- package/src/views/ChatHistory/HistoryItem.tsx +23 -44
- package/src/views/ChatHistory/index.tsx +6 -4
- package/src/views/ChatHistory/styled.ts +3 -5
- package/src/views/ChatHistory/utils.ts +144 -11
- package/src/views/ChatTabSelection.tsx +47 -20
- package/src/views/Editor.tsx +28 -18
- package/src/views/Home/BuiltInAgent.tsx +67 -0
- package/src/views/Home/CustomAgent.tsx +36 -0
- package/src/views/Home/index.tsx +48 -0
- package/src/views/Home/styled.ts +74 -0
- package/src/views/Home/types.ts +16 -0
- package/src/views/KSDocument.tsx +11 -8
- package/src/views/KnowledgeSources.tsx +169 -62
- package/src/views/MessageInput/AgentSelector.tsx +92 -0
- package/src/views/MessageInput/ButtonAgent.tsx +73 -0
- package/src/views/MessageInput/ButtonBar.tsx +57 -0
- package/src/views/MessageInput/ContextBar.tsx +117 -0
- package/src/views/MessageInput/ModelSwitcher/index.tsx +69 -0
- package/src/views/MessageInput/ModelSwitcher/utils.tsx +143 -0
- package/src/views/MessageInput/QuickCommandSelector.tsx +137 -0
- package/src/views/MessageInput/SelectContent.tsx +99 -0
- package/src/views/MessageInput/UploadBar.tsx +107 -0
- package/src/views/MessageInput/UploadDragNDrop.tsx +79 -0
- package/src/views/MessageInput/chat-entry-history.ts +97 -0
- package/src/views/MessageInput/dictionary.ts +52 -10
- package/src/views/MessageInput/index.tsx +154 -51
- package/src/views/MessageInput/styled.ts +226 -85
- package/src/views/MinimizedHeader.tsx +11 -10
- package/src/views/Resources.tsx +108 -0
- package/src/views/Stacks.tsx +152 -39
- package/src/views/Steps/FlowChart/HandleGroup.tsx +14 -0
- package/src/views/Steps/FlowChart/NodeDynamic.tsx +97 -0
- package/src/views/Steps/FlowChart/NodeStep.tsx +49 -0
- package/src/views/Steps/FlowChart/hooks.ts +41 -0
- package/src/views/Steps/FlowChart/index.tsx +111 -0
- package/src/views/Steps/FlowChart/layout.ts +73 -0
- package/src/views/Steps/FlowChart/styled.ts +157 -0
- package/src/views/Steps/FlowChart/types.ts +28 -0
- package/src/views/Steps/StepModal.tsx +233 -0
- package/src/views/Steps/StepsPanel.tsx +31 -0
- package/src/views/Steps/dictionary.ts +48 -0
- package/src/views/Steps/index.tsx +36 -0
- package/src/views/Steps/utils.tsx +34 -0
- package/src/views/Tools.tsx +77 -0
- package/src/views/Workspaces/WorkspacesTab.tsx +116 -0
- package/src/views/Workspaces/index.tsx +78 -0
- package/tsconfig.json +8 -3
- package/dist/components/Accordion.d.ts +0 -10
- package/dist/components/Accordion.d.ts.map +0 -1
- package/dist/components/Accordion.js +0 -46
- package/dist/components/Accordion.js.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -30
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -38
- 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 -6
- 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 -7
- package/dist/components/IconInput.d.ts.map +0 -1
- package/dist/components/IconInput.js +0 -58
- package/dist/components/IconInput.js.map +0 -1
- package/dist/components/OverlayMenu.d.ts +0 -10
- package/dist/components/OverlayMenu.d.ts.map +0 -1
- package/dist/components/OverlayMenu.js +0 -58
- package/dist/components/OverlayMenu.js.map +0 -1
- package/dist/components/ProgressBar.d.ts +0 -11
- package/dist/components/ProgressBar.d.ts.map +0 -1
- package/dist/components/ProgressBar.js +0 -126
- package/dist/components/ProgressBar.js.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js +0 -17
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.d.ts +0 -13
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.js +0 -90
- 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 -14
- package/dist/components/Tooltip/types.d.ts.map +0 -1
- package/dist/views/Agents.d.ts +0 -2
- package/dist/views/Agents.d.ts.map +0 -1
- package/dist/views/Agents.js +0 -143
- package/dist/views/Agents.js.map +0 -1
- package/dist/views/Home.d.ts +0 -6
- package/dist/views/Home.d.ts.map +0 -1
- package/dist/views/Home.js +0 -68
- package/dist/views/Home.js.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.d.ts +0 -12
- package/dist/views/MessageInput/ButtonGroup.d.ts.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.js +0 -24
- package/dist/views/MessageInput/ButtonGroup.js.map +0 -1
- package/dist/views/MessageInput/InfoBar.d.ts +0 -2
- package/dist/views/MessageInput/InfoBar.d.ts.map +0 -1
- package/dist/views/MessageInput/InfoBar.js +0 -35
- package/dist/views/MessageInput/InfoBar.js.map +0 -1
- package/dist/views/Workspaces.d.ts +0 -2
- package/dist/views/Workspaces.d.ts.map +0 -1
- package/dist/views/Workspaces.js +0 -62
- package/dist/views/Workspaces.js.map +0 -1
- package/src/components/Accordion.tsx +0 -64
- package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -48
- package/src/components/FallbackBoundary/Loading.tsx +0 -14
- package/src/components/FallbackBoundary/index.tsx +0 -15
- package/src/components/IconInput.tsx +0 -70
- package/src/components/OverlayMenu.tsx +0 -77
- package/src/components/ProgressBar.tsx +0 -153
- package/src/components/Tooltip/Tooltip.tsx +0 -36
- package/src/components/Tooltip/TooltipAPI.ts +0 -84
- 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 -15
- package/src/views/Agents.tsx +0 -200
- package/src/views/Home.tsx +0 -109
- package/src/views/MessageInput/ButtonGroup.tsx +0 -91
- package/src/views/MessageInput/InfoBar.tsx +0 -82
- package/src/views/Workspaces.tsx +0 -92
- /package/dist/{components/Tooltip → utils/upload}/types.js +0 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { FallbackBoundary, IconLink, Text } from '@stack-spot/citric-react'
|
|
2
|
+
import { useKeyboardControls } from '@stack-spot/portal-components'
|
|
3
|
+
import { InfiniteScroll } from '@stack-spot/portal-components/InfiniteScroll'
|
|
4
|
+
import { AgentVisibilityLevel } from '@stack-spot/portal-network'
|
|
5
|
+
import { VisibilityLevelEnum } from '@stack-spot/portal-network/api/ai'
|
|
6
|
+
import { Dictionary, interpolate, useTranslate } from '@stack-spot/portal-translate'
|
|
7
|
+
import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
8
|
+
import { debounce } from 'lodash'
|
|
9
|
+
import { useCurrentChatState, useWidgetState } from '../../context/hooks'
|
|
10
|
+
import { getUrlToStackSpotAI } from '../../utils/url'
|
|
11
|
+
import { ButtonFavorite } from '../ButtonFavorite'
|
|
12
|
+
import { Fading } from '../Fading'
|
|
13
|
+
import { SelectorBox } from './styled'
|
|
14
|
+
|
|
15
|
+
type SectionVisibility = AgentVisibilityLevel | VisibilityLevelEnum
|
|
16
|
+
type SelectorShortcut = '/' | '@'
|
|
17
|
+
|
|
18
|
+
interface Item {
|
|
19
|
+
id: string,
|
|
20
|
+
slug: string,
|
|
21
|
+
description: string,
|
|
22
|
+
visibility_level: SectionVisibility,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Favorite<T> {
|
|
26
|
+
/**
|
|
27
|
+
* A react hook or a simple function that returns the selectable items that have been set as favorite.
|
|
28
|
+
*
|
|
29
|
+
* Supports suspended hooks.
|
|
30
|
+
*
|
|
31
|
+
* @returns the favorite items in the selector.
|
|
32
|
+
*/
|
|
33
|
+
useFavorites?: () => T[],
|
|
34
|
+
onAddFavorite?: (idOrSlug?: string) => Promise<boolean>,
|
|
35
|
+
onRemoveFavorite?: (idOrSlug?: string) => Promise<boolean>,
|
|
36
|
+
favoriteIsSlug?: boolean,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface ListProps<T> {
|
|
40
|
+
filter?: string,
|
|
41
|
+
visibility?: SectionVisibility,
|
|
42
|
+
selectorConfig: SelectorConfig<T>,
|
|
43
|
+
onSelect: (item: T) => void,
|
|
44
|
+
favorite?: Favorite<T>,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface ListItemProps<T> extends ListProps<T> {
|
|
48
|
+
item: T,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface ContentProps<T> {
|
|
52
|
+
filter?: string,
|
|
53
|
+
onClose: () => void,
|
|
54
|
+
inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement>,
|
|
55
|
+
selectorConfig: SelectorConfig<T>,
|
|
56
|
+
favorite?: Favorite<T>,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface PropsUseData<T> {
|
|
60
|
+
data: T[],
|
|
61
|
+
fetchNextPage?: () => void,
|
|
62
|
+
hasNextPage?: boolean,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface SelectorConfig<T> {
|
|
66
|
+
resourceName: string,
|
|
67
|
+
shortcut: SelectorShortcut,
|
|
68
|
+
icon: React.ReactElement,
|
|
69
|
+
regex: RegExp,
|
|
70
|
+
urlBuilder: (item: T) => string,
|
|
71
|
+
searchProp: keyof T,
|
|
72
|
+
isEnabled: boolean,
|
|
73
|
+
sections: SectionVisibility[],
|
|
74
|
+
renderComponentItem: FC<T>,
|
|
75
|
+
onSelect: (item: T) => void,
|
|
76
|
+
/**
|
|
77
|
+
* A react hook or a simple function that returns the selectable items.
|
|
78
|
+
*
|
|
79
|
+
* Supports suspended hooks.
|
|
80
|
+
*
|
|
81
|
+
* @returns the data to render in the selector.
|
|
82
|
+
*/
|
|
83
|
+
useData: (props: {filter?: string, visibility?: SectionVisibility[]}) => PropsUseData<T>,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface SelectorProps<T> {
|
|
87
|
+
selectorConfig: SelectorConfig<T>,
|
|
88
|
+
inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement>,
|
|
89
|
+
favorite?: Favorite<T>,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const ListItem = <T extends Item>({ item, selectorConfig, onSelect, favorite }: ListItemProps<T>) => {
|
|
93
|
+
const t = useTranslate(dictionary)
|
|
94
|
+
const { urlBuilder, renderComponentItem } = selectorConfig
|
|
95
|
+
const linkTitle = interpolate(t.open, item.slug)
|
|
96
|
+
const listFavorites = favorite?.useFavorites?.()
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<li>
|
|
100
|
+
<button
|
|
101
|
+
className="selector"
|
|
102
|
+
onClick={() => onSelect(item)}
|
|
103
|
+
onKeyDown={(e) => e.key === 'Enter' && e.preventDefault()}
|
|
104
|
+
onFocus={(e) => e.target.closest('li')?.classList.add('focus')}
|
|
105
|
+
onBlur={(e) => e.target.closest('li')?.classList.remove('focus')}
|
|
106
|
+
>
|
|
107
|
+
{renderComponentItem(item)}
|
|
108
|
+
</button>
|
|
109
|
+
<IconLink
|
|
110
|
+
icon="ExternalLink"
|
|
111
|
+
title={linkTitle}
|
|
112
|
+
aria-label={linkTitle}
|
|
113
|
+
href={`${getUrlToStackSpotAI()}${urlBuilder(item)}`}
|
|
114
|
+
target="_blank"
|
|
115
|
+
/>
|
|
116
|
+
<ButtonFavorite
|
|
117
|
+
appearance="text"
|
|
118
|
+
favorite={{ ...favorite, idOrSlug: favorite?.favoriteIsSlug ? item.slug : item?.id, listFavorites }}
|
|
119
|
+
/>
|
|
120
|
+
</li>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const List = <T extends Item>({ selectorConfig, filter, visibility, onSelect, favorite }: ListProps<T>) => {
|
|
125
|
+
const t = useTranslate(dictionary)
|
|
126
|
+
const { data: items, fetchNextPage, hasNextPage } = selectorConfig.useData({ filter, visibility: visibility ? [visibility] : undefined })
|
|
127
|
+
|
|
128
|
+
if (!items.length && !filter) return <Text className="empty" color="light.700">{interpolate(t.noData, selectorConfig.resourceName)}</Text>
|
|
129
|
+
if (!items?.length) return <Text className="empty" color="light.700">{interpolate(t.noResults, selectorConfig.resourceName)}</Text>
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<ul className="selector-list" id="selector-list">
|
|
133
|
+
<InfiniteScroll scrollableTarget="selector-list"
|
|
134
|
+
dataLength={items?.length ?? 0}
|
|
135
|
+
next={fetchNextPage as any ?? undefined}
|
|
136
|
+
hasMore={hasNextPage ?? false}>
|
|
137
|
+
{items?.map((item, i) => (
|
|
138
|
+
<ListItem
|
|
139
|
+
key={`${item.id}${item.visibility_level}${i}`}
|
|
140
|
+
item={item}
|
|
141
|
+
selectorConfig={selectorConfig}
|
|
142
|
+
onSelect={onSelect}
|
|
143
|
+
favorite={favorite}
|
|
144
|
+
/>
|
|
145
|
+
))}
|
|
146
|
+
</InfiniteScroll>
|
|
147
|
+
</ul>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const SelectorContent = ({ filter, onClose, selectorConfig, favorite }: ContentProps<any>) => {
|
|
152
|
+
const t = useTranslate(dictionary)
|
|
153
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
154
|
+
const [visibility, setVisibility] = useState<SectionVisibility | undefined>()
|
|
155
|
+
const isGroupResourcesByScope = useWidgetState('features')?.groupResourcesByScope
|
|
156
|
+
const { resourceName, icon, onSelect, sections } = selectorConfig
|
|
157
|
+
const onSelectItem = useCallback((slug: string) => {
|
|
158
|
+
onSelect(slug)
|
|
159
|
+
onClose()
|
|
160
|
+
}, [])
|
|
161
|
+
|
|
162
|
+
useKeyboardControls({
|
|
163
|
+
querySelectors: '.tabs button, button.selector',
|
|
164
|
+
disableTabBehavior: true,
|
|
165
|
+
onPressEscape: onClose,
|
|
166
|
+
onPressArrowLeft: () => (ref.current?.querySelector('.tabs button.active') as HTMLElement)?.focus(),
|
|
167
|
+
onPressArrowRight: () => (ref.current?.querySelector('button.selector') as HTMLElement)?.focus(),
|
|
168
|
+
ref,
|
|
169
|
+
}, [])
|
|
170
|
+
|
|
171
|
+
function createSectionItem(action?: SectionVisibility) {
|
|
172
|
+
return (
|
|
173
|
+
<li key={action ?? 'all'}>
|
|
174
|
+
<button className={visibility === action ? 'active' : ''} onFocus={() => setVisibility(action)}>
|
|
175
|
+
{t[action?.toLowerCase() as keyof typeof t ?? 'all']}
|
|
176
|
+
</button>
|
|
177
|
+
</li>
|
|
178
|
+
)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<div ref={ref}>
|
|
183
|
+
<header>
|
|
184
|
+
{icon}
|
|
185
|
+
<Text tag="h3">{resourceName}</Text>
|
|
186
|
+
</header>
|
|
187
|
+
<div className="body">
|
|
188
|
+
{isGroupResourcesByScope && (
|
|
189
|
+
<ul className="tabs">
|
|
190
|
+
{createSectionItem()}
|
|
191
|
+
{sections.map(createSectionItem)}
|
|
192
|
+
</ul>
|
|
193
|
+
)}
|
|
194
|
+
<FallbackBoundary message={interpolate(t.error, selectorConfig.resourceName)}>
|
|
195
|
+
<List filter={filter} visibility={visibility} selectorConfig={selectorConfig} onSelect={onSelectItem} favorite={favorite} />
|
|
196
|
+
</FallbackBoundary>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const Selector = <T, >({ inputRef, selectorConfig, favorite }: SelectorProps<T>) => {
|
|
203
|
+
const { shortcut, regex, isEnabled } = selectorConfig
|
|
204
|
+
const [isClosed, setClosed] = useState(false)
|
|
205
|
+
const selectorRef = useRef<HTMLDivElement>(null)
|
|
206
|
+
const [debouncedFilter, setDebouncedFilter] = useState<string | undefined>(undefined)
|
|
207
|
+
const value = useCurrentChatState('nextMessage') ?? ''
|
|
208
|
+
const filter = useMemo(() => value === shortcut || regex.test(value) ? value.substring(1) : undefined, [value])
|
|
209
|
+
const shouldRender = isEnabled && filter !== undefined && !isClosed
|
|
210
|
+
|
|
211
|
+
const debouncedSetFilter = useCallback(
|
|
212
|
+
debounce((filterValue: string | undefined) => {
|
|
213
|
+
setDebouncedFilter(filterValue)
|
|
214
|
+
}, 300),
|
|
215
|
+
[],
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
useEffect(() => {
|
|
219
|
+
debouncedSetFilter(filter)
|
|
220
|
+
return () => {
|
|
221
|
+
debouncedSetFilter.cancel()
|
|
222
|
+
}
|
|
223
|
+
}, [filter, debouncedSetFilter])
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
// Resets the closed state whenever the message input is cleared
|
|
227
|
+
useEffect(() => {
|
|
228
|
+
if (!value) setClosed(false)
|
|
229
|
+
}, [value])
|
|
230
|
+
|
|
231
|
+
// Creates the following behavior while the user types in the message input:
|
|
232
|
+
// auto-complete on tab; move focus to the resource panel on press up or down; and close the resource panel on esc.
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
function getFirst() {
|
|
235
|
+
return selectorRef.current?.querySelector('.selector') as HTMLElement | null
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function onKeyDown(event: Event) {
|
|
239
|
+
const key = (event as KeyboardEvent).key
|
|
240
|
+
if (!selectorRef.current) return
|
|
241
|
+
if (key === 'Tab') {
|
|
242
|
+
getFirst()?.click()
|
|
243
|
+
event.preventDefault()
|
|
244
|
+
} else if (key === 'ArrowDown' || key === 'ArrowUp') {
|
|
245
|
+
getFirst()?.focus()
|
|
246
|
+
event.preventDefault()
|
|
247
|
+
}
|
|
248
|
+
if (key === 'Escape') {
|
|
249
|
+
setClosed(true)
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
inputRef.current?.addEventListener('keydown', onKeyDown)
|
|
254
|
+
return () => inputRef.current?.removeEventListener('keydown', onKeyDown)
|
|
255
|
+
}, [])
|
|
256
|
+
|
|
257
|
+
// Closes the panel when the user clicks outside the panel or the message input.
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (!shouldRender) return
|
|
260
|
+
function onClickOut(e: Event) {
|
|
261
|
+
const target = e.target as HTMLElement | null
|
|
262
|
+
if (!selectorRef.current?.contains(target) && !inputRef.current?.contains(target)) setClosed(true)
|
|
263
|
+
}
|
|
264
|
+
document.addEventListener('click', onClickOut)
|
|
265
|
+
return () => document.removeEventListener('click', onClickOut)
|
|
266
|
+
}, [shouldRender])
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
<SelectorBox $tabsCount={selectorConfig.sections.length}>
|
|
270
|
+
<Fading visible={shouldRender} ref={selectorRef} className="box-selector">
|
|
271
|
+
<SelectorContent
|
|
272
|
+
favorite={favorite}
|
|
273
|
+
selectorConfig={selectorConfig}
|
|
274
|
+
filter={debouncedFilter}
|
|
275
|
+
onClose={() => setClosed(true)}
|
|
276
|
+
inputRef={inputRef}
|
|
277
|
+
/>
|
|
278
|
+
</Fading>
|
|
279
|
+
</SelectorBox>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const dictionary = {
|
|
284
|
+
en: {
|
|
285
|
+
all: 'All',
|
|
286
|
+
personal: 'Personal',
|
|
287
|
+
account: 'Account',
|
|
288
|
+
shared: 'Shared',
|
|
289
|
+
'built_in': 'Built-in',
|
|
290
|
+
'recently_used': 'Recent',
|
|
291
|
+
workspace: 'Spot',
|
|
292
|
+
error: 'Could not load the $0s.',
|
|
293
|
+
noData: 'You don\'t have any $0 yet.',
|
|
294
|
+
noResults: 'There are no $0s to show here.',
|
|
295
|
+
open: 'Open this $0 settings in a new tab.',
|
|
296
|
+
favorite: 'Favorites',
|
|
297
|
+
},
|
|
298
|
+
pt: {
|
|
299
|
+
all: 'Todos',
|
|
300
|
+
personal: 'Pessoal',
|
|
301
|
+
account: 'Conta',
|
|
302
|
+
shared: 'Compartilhado',
|
|
303
|
+
workspace: 'Spot',
|
|
304
|
+
'built_in': 'Embutido',
|
|
305
|
+
'recently_used': 'Recente',
|
|
306
|
+
error: 'Não foi possível carregar os $0s.',
|
|
307
|
+
noData: 'Você ainda não possui $0s.',
|
|
308
|
+
noResults: 'Não $0s para mostrar aqui.',
|
|
309
|
+
open: 'Abra as configurações deste $0 em uma nova aba.',
|
|
310
|
+
favorite: 'Favoritos',
|
|
311
|
+
},
|
|
312
|
+
} satisfies Dictionary
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
2
|
+
import { styled } from 'styled-components'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const SelectorBox = styled.div<{ $tabsCount: number }>`
|
|
6
|
+
position: absolute;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
|
|
9
|
+
.box-selector {
|
|
10
|
+
position: absolute;
|
|
11
|
+
border-radius: 4px;
|
|
12
|
+
border: 1px solid ${theme.color.light[600]};
|
|
13
|
+
background-color: ${theme.color.light[400]};
|
|
14
|
+
box-shadow: 0px 2px 16px 0px #0000005C;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
width: 480px;
|
|
18
|
+
bottom: 54px;
|
|
19
|
+
left: 0;
|
|
20
|
+
|
|
21
|
+
.loading, .error {
|
|
22
|
+
padding-bottom: 26px;
|
|
23
|
+
p {
|
|
24
|
+
width: 200px;
|
|
25
|
+
text-align: center;
|
|
26
|
+
line-height: 20px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.empty {
|
|
31
|
+
padding-bottom: 26px;
|
|
32
|
+
width: 200px;
|
|
33
|
+
text-align: center;
|
|
34
|
+
line-height: 20px;
|
|
35
|
+
margin: auto;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
header {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
gap: 8px;
|
|
42
|
+
align-items: center;
|
|
43
|
+
padding: 0 8px;
|
|
44
|
+
margin-bottom: 4px;
|
|
45
|
+
background-color: ${theme.color.light[500]};
|
|
46
|
+
height: 40px;
|
|
47
|
+
h3 {
|
|
48
|
+
text-transform: uppercase;
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
margin: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.body {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
align-items: center;
|
|
59
|
+
align-items: flex-start;
|
|
60
|
+
height: ${({ $tabsCount }) => 34 + ($tabsCount * 34)}px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ul {
|
|
64
|
+
margin: 0;
|
|
65
|
+
padding: 0;
|
|
66
|
+
list-style: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
ul.tabs {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
min-width: 100px;
|
|
73
|
+
|
|
74
|
+
li {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
button {
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
color: ${theme.color.light[700]};
|
|
82
|
+
text-align: left;
|
|
83
|
+
padding: 10px;
|
|
84
|
+
font-weight: 600;
|
|
85
|
+
font-size: 12px;
|
|
86
|
+
transition: background-color 0.3s;
|
|
87
|
+
border-left: 1px solid transparent;
|
|
88
|
+
border-top-right-radius: 4px;
|
|
89
|
+
border-bottom-right-radius: 4px;
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
border: none;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
outline: none;
|
|
94
|
+
|
|
95
|
+
&:hover, &.active, &:focus {
|
|
96
|
+
background-color: ${theme.color.light[600]};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.active {
|
|
100
|
+
border-left: 1px solid ${theme.color.light.contrastText};
|
|
101
|
+
color: ${theme.color.light.contrastText};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
ul.selector-list {
|
|
107
|
+
align-self: stretch;
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
gap: 2px;
|
|
111
|
+
overflow-y: auto;
|
|
112
|
+
flex: 1;
|
|
113
|
+
|
|
114
|
+
li {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
align-items: center;
|
|
118
|
+
gap: 8px;
|
|
119
|
+
padding: 8px;
|
|
120
|
+
border-radius: 4px;
|
|
121
|
+
|
|
122
|
+
&:hover, &.focus {
|
|
123
|
+
background-color: ${theme.color.light[600]};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
button.selector {
|
|
127
|
+
display: flex;
|
|
128
|
+
flex-direction: column;
|
|
129
|
+
flex: 1;
|
|
130
|
+
gap: 4px;
|
|
131
|
+
border: none;
|
|
132
|
+
text-align: left;
|
|
133
|
+
background-color: transparent;
|
|
134
|
+
text-align: left;
|
|
135
|
+
outline: none;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
padding: 0;
|
|
139
|
+
|
|
140
|
+
.selector-title {
|
|
141
|
+
font-size: 12px;
|
|
142
|
+
color: ${theme.color.light.contrastText};
|
|
143
|
+
font-weight: 500;
|
|
144
|
+
text-overflow: ellipsis;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
margin: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.selector-description {
|
|
150
|
+
color: ${theme.color.light[700]};
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
margin: 0;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
`
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Text } from '@stack-spot/citric-react'
|
|
2
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
3
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react'
|
|
4
|
+
import { styled } from 'styled-components'
|
|
5
|
+
import { FastOmit } from 'styled-components/dist/types'
|
|
6
|
+
|
|
7
|
+
interface Props extends FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> {
|
|
8
|
+
label: string,
|
|
9
|
+
images: { key?: React.Key, name: string, url?: string, icon?: React.ReactElement }[],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const Styled = styled.div`
|
|
13
|
+
border-radius: 25px;
|
|
14
|
+
background-color: ${theme.color.light[600]};
|
|
15
|
+
border: 1px solid ${theme.color.light[500]};
|
|
16
|
+
color: ${theme.color.light[700]};
|
|
17
|
+
padding: 2px 7px;
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: 5px;
|
|
20
|
+
align-items: center;
|
|
21
|
+
|
|
22
|
+
small {
|
|
23
|
+
line-height: 0.75rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
ul {
|
|
27
|
+
list-style: none;
|
|
28
|
+
margin: 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
|
|
33
|
+
li {
|
|
34
|
+
border: 1px solid ${theme.color.light[600]};
|
|
35
|
+
background-color: ${theme.color.light[400]};
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
width: 16px;
|
|
38
|
+
height: 16px;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
|
|
44
|
+
&:not(:first-child) {
|
|
45
|
+
margin-left: -12px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.citric-icon {
|
|
50
|
+
margin: 1px;
|
|
51
|
+
font-size: 10px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
img, svg {
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100%;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
|
|
61
|
+
export const StackedBadge = ({ label, images, ...props }: Props) => (
|
|
62
|
+
<Styled {...props}>
|
|
63
|
+
<Text appearance="microtext1">{label}</Text>
|
|
64
|
+
<ul>
|
|
65
|
+
{images.map(
|
|
66
|
+
({ key, name, url, icon }, i) => (
|
|
67
|
+
<li key={key || i}>
|
|
68
|
+
{url
|
|
69
|
+
? <img alt={name} aria-label={name} title={name} src={url} />
|
|
70
|
+
: <span aria-label={name} title={name}>{icon}</span>
|
|
71
|
+
}
|
|
72
|
+
</li>
|
|
73
|
+
),
|
|
74
|
+
)}
|
|
75
|
+
</ul>
|
|
76
|
+
</Styled>
|
|
77
|
+
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Tabs to select chat and add new chats */
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { IconButton } from '@citric
|
|
3
|
+
import { Icon } from '@stack-spot/citric-icons'
|
|
4
|
+
import { Button, IconButton } from '@stack-spot/citric-react'
|
|
5
5
|
import { listToClass, theme } from '@stack-spot/portal-theme'
|
|
6
6
|
import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
|
|
7
7
|
import { last } from 'lodash'
|
|
@@ -41,7 +41,9 @@ interface Props<T, Key extends React.Key> {
|
|
|
41
41
|
renderLabel: (tab: T) => React.ReactElement,
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// The size of extra buttons placed after the tabs.
|
|
44
45
|
const EXTRA_BTN_SIZE = 24
|
|
46
|
+
// The margin of extra buttons placed after the tabs.
|
|
45
47
|
const EXTRA_BTN_MARGIN = 8
|
|
46
48
|
|
|
47
49
|
const Tabs = styled.nav<{ $numberOfExtraButtons: number }>`
|
|
@@ -68,14 +70,6 @@ const Tabs = styled.nav<{ $numberOfExtraButtons: number }>`
|
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
${IconButton} {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
justify-content: center;
|
|
75
|
-
background-color: transparent;
|
|
76
|
-
border: none;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
73
|
.list-overflow {
|
|
80
74
|
max-width: ${({ $numberOfExtraButtons }) => `calc(100% - ${$numberOfExtraButtons * (EXTRA_BTN_SIZE + EXTRA_BTN_MARGIN * 2)}px)`};
|
|
81
75
|
}
|
|
@@ -142,25 +136,16 @@ const Tabs = styled.nav<{ $numberOfExtraButtons: number }>`
|
|
|
142
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%);
|
|
143
137
|
}
|
|
144
138
|
}
|
|
145
|
-
|
|
146
|
-
${IconButton} {
|
|
147
|
-
padding: 0;
|
|
148
|
-
width: 18px;
|
|
149
|
-
height: 18px;
|
|
150
|
-
transition: background-color 0.3s;
|
|
151
|
-
|
|
152
|
-
svg {
|
|
153
|
-
height: 14px;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
&:hover {
|
|
157
|
-
background-color: ${theme.color.light[600]};
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
139
|
}
|
|
161
140
|
}
|
|
162
141
|
`
|
|
163
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Renders and manages a list of tabs. With this, tabs can be selected and removed. Furthermore, extra buttons can be placed after all tabs,
|
|
145
|
+
* e.g. a button to add more tabs.
|
|
146
|
+
*
|
|
147
|
+
* Used for the chat tabs.
|
|
148
|
+
*/
|
|
164
149
|
export function TabManager<T, Key extends React.Key>(
|
|
165
150
|
{ active, tabs, keygen, onRemove, onSelect, renderLabel, buttons = [] }: Props<T, Key>,
|
|
166
151
|
) {
|
|
@@ -176,22 +161,37 @@ export function TabManager<T, Key extends React.Key>(
|
|
|
176
161
|
const tabItems = useMemo(() => tabs.map((tab) => (
|
|
177
162
|
<li key={keygen(tab)} className={keygen(tab) === active ? 'active' : undefined} onClick={onClickTab}>
|
|
178
163
|
<button className="label" onClick={() => onSelect(tab)}><FadingOverflow>{renderLabel(tab)}</FadingOverflow></button>
|
|
179
|
-
{tabs.length > 1 &&
|
|
164
|
+
{tabs.length > 1 &&
|
|
165
|
+
<IconButton appearance="text" icon="TimesMini" aria-label={t.close} title={t.close} onClick={() => onRemove(tab)} />}
|
|
180
166
|
</li>
|
|
181
167
|
)), [tabs, active])
|
|
182
168
|
|
|
183
|
-
const extras = useMemo(() => buttons.map(({
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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}
|
|
188
190
|
className={listToClass([className, 'extra'])}
|
|
189
191
|
style={style}
|
|
190
192
|
onClick={onClick}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
</IconButton>
|
|
194
|
-
)), [buttons])
|
|
193
|
+
appearance={appearance}
|
|
194
|
+
/>), [buttons])
|
|
195
195
|
|
|
196
196
|
// when a new tab is added, we should scroll to it if there are more tabs that we can show.
|
|
197
197
|
useEffect(() => {
|
|
@@ -203,7 +203,7 @@ export function TabManager<T, Key extends React.Key>(
|
|
|
203
203
|
}, [tabs])
|
|
204
204
|
|
|
205
205
|
return (
|
|
206
|
-
<Tabs $numberOfExtraButtons={buttons.length}>
|
|
206
|
+
<Tabs $numberOfExtraButtons={buttons.length} className="tabs">
|
|
207
207
|
<FadingOverflow className="list-overflow" scroll="arrows" enableHorizontalScrollWithVerticalWheel>
|
|
208
208
|
<ul ref={tabList}>{tabItems}</ul>
|
|
209
209
|
</FadingOverflow>
|