@stack-spot/ai-chat-widget 1.37.0-beta.1 → 2.0.0-betacitric.2
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 +1 -71
- package/dist/StackspotAIWidget.d.ts +6 -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 -17
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +3 -9
- 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 +0 -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.js +1 -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 +8 -31
- 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 +21 -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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layout.css +1 -27
- 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.js +2 -2
- package/dist/state/constants.js.map +1 -1
- package/dist/types.d.ts +7 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/tools.d.ts +1 -2
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +1 -12
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/upload/FileUpload.d.ts.map +1 -1
- package/dist/utils/upload/FileUpload.js +2 -1
- package/dist/utils/upload/FileUpload.js.map +1 -1
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -1
- package/dist/views/Agents/AgentDescription.js +5 -6
- 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 +29 -28
- package/dist/views/Agents/AgentsTab.js.map +1 -1
- package/dist/views/Agents/dictionary.d.ts +1 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +3 -5
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +28 -36
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts.map +1 -1
- package/dist/views/Chat/StepsList.js +10 -10
- package/dist/views/Chat/StepsList.js.map +1 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +8 -2
- 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 +7 -14
- 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/ChatTabSelection.d.ts +6 -1
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +12 -7
- 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 -35
- package/dist/views/MessageInput/SelectContent.js.map +1 -1
- package/dist/views/MessageInput/UploadBar.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadBar.js +2 -29
- package/dist/views/MessageInput/UploadBar.js.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -1
- package/dist/views/MessageInput/UploadDragNDrop.js +2 -3
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -1
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
- package/dist/views/MessageInput/dictionary.js +0 -4
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +3 -4
- 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 -27
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +2 -4
- package/dist/views/MinimizedHeader.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 +2 -4
- 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 +12 -13
- package/src/StackspotAIWidget.tsx +36 -34
- package/src/app-metadata.json +13 -17
- package/src/chat-interceptors/quick-commands.ts +5 -11
- 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 -11
- package/src/components/HistoryList.tsx +1 -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 +28 -54
- package/src/components/ToolBadge.tsx +39 -129
- package/src/components/WorkspaceTabNavigator.tsx +22 -25
- package/src/components/form/DescribedCheckboxGroup.tsx +90 -65
- package/src/components/form/DescribedRadioGroup.tsx +79 -46
- package/src/index.ts +1 -2
- package/src/layout.css +1 -27
- package/src/right-panel/DefaultPanel.tsx +3 -7
- package/src/state/ChatEntry.ts +3 -4
- package/src/state/constants.ts +2 -2
- package/src/types.ts +8 -3
- package/src/utils/tools.ts +2 -23
- package/src/utils/upload/FileUpload.ts +2 -1
- package/src/views/Agents/AgentDescription.tsx +6 -7
- package/src/views/Agents/AgentsPanel.tsx +11 -12
- package/src/views/Agents/AgentsTab.tsx +37 -56
- package/src/views/Chat/AgentInfo.tsx +7 -6
- package/src/views/Chat/ChatMessage.tsx +109 -118
- package/src/views/Chat/StepsList.tsx +10 -11
- package/src/views/Chat/styled.ts +8 -2
- package/src/views/ChatHistory/HistoryItem.tsx +12 -19
- package/src/views/ChatHistory/index.tsx +1 -1
- package/src/views/ChatHistory/styled.ts +3 -5
- package/src/views/ChatTabSelection.tsx +17 -9
- 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 +17 -14
- package/src/views/MessageInput/QuickCommandSelector.tsx +2 -2
- package/src/views/MessageInput/SelectContent.tsx +39 -68
- package/src/views/MessageInput/UploadBar.tsx +2 -40
- package/src/views/MessageInput/UploadDragNDrop.tsx +2 -5
- package/src/views/MessageInput/dictionary.ts +0 -4
- package/src/views/MessageInput/index.tsx +5 -7
- package/src/views/MessageInput/styled.ts +12 -28
- package/src/views/MinimizedHeader.tsx +4 -7
- 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 +12 -19
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayMenu.d.ts","sourceRoot":"","sources":["../../src/components/OverlayMenu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAS,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAG3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,UAAU,KAAM,SAAQ,SAAS,EAAE,YAAY;IAC7C;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAoFD;;;;GAIG;AACH,eAAO,MAAM,WAAW,kGAuBtB,CAAA"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/display-name */
|
|
3
|
-
import { IconBox, Text } from '@citric/core';
|
|
4
|
-
import { useKeyboardControls } from '@stack-spot/portal-components';
|
|
5
|
-
import { theme } from '@stack-spot/portal-theme';
|
|
6
|
-
import { forwardRef, useCallback, useRef } from 'react';
|
|
7
|
-
import { styled } from 'styled-components';
|
|
8
|
-
import { Tooltip } from './Tooltip/index.js';
|
|
9
|
-
import { useTooltip } from './Tooltip/context.js';
|
|
10
|
-
const MenuList = styled.ul `
|
|
11
|
-
margin: 0;
|
|
12
|
-
padding: 0;
|
|
13
|
-
list-style: none;
|
|
14
|
-
border-radius: 8px;
|
|
15
|
-
background-color: ${theme.color.light[400]};
|
|
16
|
-
overflow: hidden;
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: column;
|
|
19
|
-
|
|
20
|
-
> li {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
|
|
24
|
-
> button {
|
|
25
|
-
padding: 8px 12px;
|
|
26
|
-
transition: background-color 0.2s;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: row;
|
|
30
|
-
align-items: center;
|
|
31
|
-
gap: 8px;
|
|
32
|
-
background-color: transparent;
|
|
33
|
-
border: none;
|
|
34
|
-
outline: none;
|
|
35
|
-
|
|
36
|
-
&:hover, &:focus {
|
|
37
|
-
background-color: ${theme.color.light[500]};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
const StyledButton = styled.button `
|
|
43
|
-
color: ${({ $color }) => $color || theme.color.light.contrastText};
|
|
44
|
-
|
|
45
|
-
svg {
|
|
46
|
-
fill: ${({ $color }) => $color || theme.color.light.contrastText};
|
|
47
|
-
}
|
|
48
|
-
`;
|
|
49
|
-
const Menu = ({ actions, trigger }) => {
|
|
50
|
-
const tooltip = useTooltip();
|
|
51
|
-
const ref = useRef(null);
|
|
52
|
-
useKeyboardControls({
|
|
53
|
-
querySelectors: 'button',
|
|
54
|
-
onPressEscape: () => {
|
|
55
|
-
tooltip.hide();
|
|
56
|
-
trigger.current?.focus();
|
|
57
|
-
},
|
|
58
|
-
ref,
|
|
59
|
-
}, []);
|
|
60
|
-
return (_jsx(MenuList, { ref: ref, children: actions.map(({ label, onClick, className, color, icon, style }) => (_jsx("li", { className: className, style: style, children: _jsxs(StyledButton, { "$color": color, onClick: () => {
|
|
61
|
-
onClick();
|
|
62
|
-
tooltip.hide();
|
|
63
|
-
}, children: [_jsx(IconBox, { children: icon }), _jsx(Text, { children: label })] }) }, label))) }));
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* A floating menu that shows up when the user clicks the children.
|
|
67
|
-
*
|
|
68
|
-
* This uses the tooltip component to build the menu.
|
|
69
|
-
*/
|
|
70
|
-
export const OverlayMenu = forwardRef(({ actions, children, className, position, style }, externalRef) => {
|
|
71
|
-
const localRef = useRef(null);
|
|
72
|
-
const ref = externalRef ?? localRef;
|
|
73
|
-
const tooltip = useTooltip();
|
|
74
|
-
const onShow = useCallback(() => {
|
|
75
|
-
tooltip.tooltipRef.current?.querySelector('button')?.focus();
|
|
76
|
-
}, []);
|
|
77
|
-
return (_jsx(Tooltip, { content: _jsx(Menu, { actions: actions, trigger: ref }), custom: true, position: position, className: className, style: style, triggeredBy: "click", onShow: onShow, ref: ref, children: children }));
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=OverlayMenu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayMenu.js","sourceRoot":"","sources":["../../src/components/OverlayMenu.tsx"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,KAAK,EAAa,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAa,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAyB9C,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAA;;;;;sBAKJ,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;4BAsBhB,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;;;;CAIjD,CAAA;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAgC;WACvD,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,IAAI,KAAK,CA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Q,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC7C,MAAM,GAAG,GAAG,WAAwC,IAAI,QAAQ,CAAA;IAChE,MAAM,OAAO,GAAG,UAAU,EAAE,CAAA;IAE5B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAA;IAC9D,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,KAAC,OAAO,IACN,OAAO,EAAE,KAAC,IAAI,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,GAAI,EACjD,MAAM,QACN,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,YAEP,QAAQ,GACD,CACX,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { WithStyle } from '@stack-spot/portal-theme';
|
|
2
|
-
interface Props extends WithStyle {
|
|
3
|
-
/**
|
|
4
|
-
* Apply animation effects to the progress bar.
|
|
5
|
-
*/
|
|
6
|
-
animate?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Whether or not the progress bar is visible.
|
|
9
|
-
*/
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* When true, the progress bar becomes very colorful and bright.
|
|
13
|
-
*/
|
|
14
|
-
shimmer?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Color to use in the progress bar that appears in the foreground. Arrays create linear gradients.
|
|
17
|
-
* @default primary.500 if shimmer is false, white otherwise.
|
|
18
|
-
*/
|
|
19
|
-
foregroundColor?: string | string[];
|
|
20
|
-
/**
|
|
21
|
-
* Color to use in the progress bar that appears in the background. Arrays create linear gradients.
|
|
22
|
-
* @default light.500 if shimmer is false, a transparent white otherwise.
|
|
23
|
-
*/
|
|
24
|
-
backgroundColor?: string | string[];
|
|
25
|
-
/**
|
|
26
|
-
* Only useful if `shimmer` is true. This allows to customize the colors in the shimmering effect. Arrays create linear gradients.
|
|
27
|
-
* @default ['#ff6633', '#d668cd', '#ff6633', '#FFF8', '#299cf4']
|
|
28
|
-
*/
|
|
29
|
-
shimmerColor?: string | string[];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* A progress bar with indefinite progress report. This renders a narrower bar on top of larger one that animates from the left to the
|
|
33
|
-
* right.
|
|
34
|
-
*/
|
|
35
|
-
export declare const ProgressBar: ({ animate, visible, shimmer, backgroundColor, foregroundColor, shimmerColor, className, style, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAGxE,UAAU,KAAM,SAAQ,SAAS;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC;AAqHD;;;GAGG;AACH,eAAO,MAAM,WAAW,qGASrB,KAAK,4CAqBP,CAAA"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { listToClass, theme } from '@stack-spot/portal-theme';
|
|
3
|
-
import { styled } from 'styled-components';
|
|
4
|
-
function gradientFromColorArray(colors) {
|
|
5
|
-
if (colors.length === 1)
|
|
6
|
-
return colors[0];
|
|
7
|
-
const step = 100 / (colors.length - 1);
|
|
8
|
-
const partials = [];
|
|
9
|
-
let current = 0;
|
|
10
|
-
for (const color of colors) {
|
|
11
|
-
partials.push(`${color} ${Math.ceil(current)}%`);
|
|
12
|
-
current += step;
|
|
13
|
-
}
|
|
14
|
-
return `linear-gradient(to right, ${partials.join(', ')})`;
|
|
15
|
-
}
|
|
16
|
-
// the shimmering effect requires more space
|
|
17
|
-
const SHIMMER_PADDING = '10px';
|
|
18
|
-
const Styled = styled.div `
|
|
19
|
-
/* margin: ${({ $shimmer }) => $shimmer.length > 0 ? '7px 0' : '0'}; */
|
|
20
|
-
opacity: 0;
|
|
21
|
-
transition: opacity 0.5s;
|
|
22
|
-
|
|
23
|
-
&.visible {
|
|
24
|
-
opacity: 1;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.shimmer {
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
justify-content: center;
|
|
31
|
-
height: 10px;
|
|
32
|
-
position: relative;
|
|
33
|
-
padding: 0 ${SHIMMER_PADDING};
|
|
34
|
-
margin: 3px 0;
|
|
35
|
-
|
|
36
|
-
.progress-glow {
|
|
37
|
-
filter: blur(2px);
|
|
38
|
-
position: absolute;
|
|
39
|
-
top: 0;
|
|
40
|
-
left: ${SHIMMER_PADDING};
|
|
41
|
-
bottom: 0;
|
|
42
|
-
right: ${SHIMMER_PADDING};
|
|
43
|
-
display: flex;
|
|
44
|
-
flex-direction: column;
|
|
45
|
-
justify-content: center;
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
|
|
48
|
-
&::before {
|
|
49
|
-
content: '';
|
|
50
|
-
height: 3px;
|
|
51
|
-
display: block;
|
|
52
|
-
width: 33%;
|
|
53
|
-
display: block;
|
|
54
|
-
animation: slide 3s infinite forwards;
|
|
55
|
-
background: ${({ $fg }) => gradientFromColorArray($fg)};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.colors {
|
|
60
|
-
position: absolute;
|
|
61
|
-
top: 0;
|
|
62
|
-
bottom: 0;
|
|
63
|
-
left: 0;
|
|
64
|
-
right: 0;
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
filter: blur(10px);
|
|
67
|
-
|
|
68
|
-
${({ $shimmer }) => `
|
|
69
|
-
&:before {
|
|
70
|
-
content: '';
|
|
71
|
-
position: absolute;
|
|
72
|
-
top: 0;
|
|
73
|
-
bottom: 0;
|
|
74
|
-
width: ${$shimmer.length * 100}%;
|
|
75
|
-
background: ${gradientFromColorArray($shimmer)};
|
|
76
|
-
${$shimmer.length > 2 ? `animation: shimmer-slide ${$shimmer.length}s ease-in infinite alternate;` : ''}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@keyframes shimmer-slide {
|
|
80
|
-
from {
|
|
81
|
-
left: 0;
|
|
82
|
-
}
|
|
83
|
-
to {
|
|
84
|
-
left: -${($shimmer.length - 1) * 100}%;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
`}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.progress-bar {
|
|
92
|
-
height: 2px;
|
|
93
|
-
width: 100%;
|
|
94
|
-
background: ${({ $bg }) => gradientFromColorArray($bg)};
|
|
95
|
-
position: relative;
|
|
96
|
-
overflow-x: clip;
|
|
97
|
-
|
|
98
|
-
&:before {
|
|
99
|
-
content: '';
|
|
100
|
-
display: block;
|
|
101
|
-
width: 100%;
|
|
102
|
-
height: 100%;
|
|
103
|
-
background: ${({ $fg, $animate, $bg }) => $animate ? gradientFromColorArray($fg) : $bg};
|
|
104
|
-
animation: ${({ $animate }) => $animate ? 'slide .5s infinite forwards' : 'none'};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@keyframes slide {
|
|
108
|
-
from {
|
|
109
|
-
margin-left: -100%;
|
|
110
|
-
}
|
|
111
|
-
to {
|
|
112
|
-
margin-left: 100%;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`;
|
|
117
|
-
/**
|
|
118
|
-
* A progress bar with indefinite progress report. This renders a narrower bar on top of larger one that animates from the left to the
|
|
119
|
-
* right.
|
|
120
|
-
*/
|
|
121
|
-
export const ProgressBar = ({ animate, visible = true, shimmer, backgroundColor = shimmer ? 'rgba(255, 255, 255, 0.4)' : theme.color.light[500], foregroundColor = shimmer ? ['#FFF0', '#FFF', '#FFF0'] : theme.color.primary[500], shimmerColor = ['#ff6633', '#d668cd', '#ff6633', '#FFF8', '#299cf4'], className, style, }) => {
|
|
122
|
-
const $bg = Array.isArray(backgroundColor) ? backgroundColor : [backgroundColor];
|
|
123
|
-
const $fg = Array.isArray(foregroundColor) ? foregroundColor : [...$bg, foregroundColor, ...$bg];
|
|
124
|
-
const $shimmer = Array.isArray(shimmerColor) ? shimmerColor : [shimmerColor];
|
|
125
|
-
const progress = _jsx("div", { className: "progress-bar" });
|
|
126
|
-
const result = shimmer
|
|
127
|
-
? (_jsxs("div", { className: listToClass([shimmer && 'shimmer']), children: [_jsx("div", { className: "colors" }), _jsx("div", { className: "progress-glow" }), progress] }))
|
|
128
|
-
: progress;
|
|
129
|
-
return (_jsx(Styled, { className: listToClass([className, visible && 'visible']), style: style, "$fg": $fg, "$bg": $bg, "$shimmer": $shimmer, "$animate": animate, children: result }));
|
|
130
|
-
};
|
|
131
|
-
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sourceRoot":"","sources":["../../src/components/ProgressBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAa,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,mB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QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;IAC5E,MAAM,QAAQ,GAAG,cAAK,SAAS,EAAC,cAAc,GAAO,CAAA;IACrD,MAAM,MAAM,GAAG,OAAO;QACpB,CAAC,CAAC,CACA,eAAK,SAAS,EAAE,WAAW,CAAC,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,aACjD,cAAK,SAAS,EAAC,QAAQ,GAAO,EAC9B,cAAK,SAAS,EAAC,eAAe,GAAO,EACpC,QAAQ,IACL,CACP;QACD,CAAC,CAAC,QAAQ,CAAA;IACZ,OAAO,CACL,KAAC,MAAM,IACL,SAAS,EAAE,WAAW,CAAC,CAAC,SAAS,EAAE,OAAO,IAAI,SAAS,CAAC,CAAC,EACzD,KAAK,EAAE,KAAK,SAAO,GAAG,SAAO,GAAG,cAAY,QAAQ,cAAY,OAAO,YACtE,MAAM,GACA,CACV,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { WithStyle } from '@stack-spot/portal-theme';
|
|
2
|
-
import { WithChildren } from '../../types.js';
|
|
3
|
-
import { TooltipPosition } from './types.js';
|
|
4
|
-
interface Props extends WithChildren, WithStyle {
|
|
5
|
-
/**
|
|
6
|
-
* The content of the tooltip. Can be either a string or a Rect Element.
|
|
7
|
-
*/
|
|
8
|
-
content: React.ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* Where to position the tooltip relative to the element that triggered it.
|
|
11
|
-
*/
|
|
12
|
-
position?: TooltipPosition;
|
|
13
|
-
/**
|
|
14
|
-
* A tooltip can be triggered either by hovering an element or by clicking it.
|
|
15
|
-
* @default 'hover'
|
|
16
|
-
*/
|
|
17
|
-
triggeredBy?: 'click' | 'hover';
|
|
18
|
-
/**
|
|
19
|
-
* If true, no style is applied to the tooltip, letting you customize it however you want to.
|
|
20
|
-
*/
|
|
21
|
-
custom?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Function to run whenever the tooltip is shown.
|
|
24
|
-
*/
|
|
25
|
-
onShow?: () => void;
|
|
26
|
-
/**
|
|
27
|
-
* Function to run whenever the tooltip is hidden.
|
|
28
|
-
*/
|
|
29
|
-
onHide?: () => void;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Shows a tooltip for its children. This tooltip element is always reused and placed at a root level in order to not be cut out by
|
|
33
|
-
* hidden overflows in the children and its ascendants.
|
|
34
|
-
*/
|
|
35
|
-
export declare const Tooltip: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<HTMLDivElement>>;
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEzC,UAAU,KAAM,SAAQ,YAAY,EAAE,SAAS;IAC7C;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,OAAO,kGAoClB,CAAA"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/display-name */
|
|
3
|
-
import { Text } from '@citric/core';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
|
-
import { useTooltip } from './context.js';
|
|
6
|
-
import { DefaultTooltip } from './style.js';
|
|
7
|
-
/**
|
|
8
|
-
* Shows a tooltip for its children. This tooltip element is always reused and placed at a root level in order to not be cut out by
|
|
9
|
-
* hidden overflows in the children and its ascendants.
|
|
10
|
-
*/
|
|
11
|
-
export const Tooltip = forwardRef(({ content, custom, position, triggeredBy = 'hover', onHide, onShow, children, className, style }, ref) => {
|
|
12
|
-
const api = useTooltip();
|
|
13
|
-
async function show(e, hideOnClickOutside) {
|
|
14
|
-
await api.show({
|
|
15
|
-
content: custom ? content : _jsx(DefaultTooltip, { children: _jsx(Text, { appearance: "microtext1", children: content }) }),
|
|
16
|
-
anchor: e.target,
|
|
17
|
-
position,
|
|
18
|
-
hideOnClickOutside,
|
|
19
|
-
});
|
|
20
|
-
onShow?.();
|
|
21
|
-
}
|
|
22
|
-
function hide() {
|
|
23
|
-
api.hide();
|
|
24
|
-
onHide?.();
|
|
25
|
-
}
|
|
26
|
-
return (_jsx("div", { ...(triggeredBy === 'hover'
|
|
27
|
-
? { onMouseEnter: show, onMouseLeave: hide }
|
|
28
|
-
: { onClick: (e) => show(e, true), onKeyDown: (e) => e.key === 'Enter' && show(e, true) }), className: className, style: style, tabIndex: triggeredBy === 'click' ? 0 : undefined, role: triggeredBy === 'click' ? 'button' : undefined, ref: ref, children: children }));
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,UAAU,E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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EACjD,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACpD,GAAG,EAAE,GAAG,YAEP,QAAQ,GACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ShowOptions } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Allows interaction with the tooltip element.
|
|
4
|
-
*
|
|
5
|
-
* This places the tooltip element at the correct place, shows it, hides it and manages its contents.
|
|
6
|
-
*
|
|
7
|
-
* This also takes into account the screen edges, making adjustments to the tooltip position if it would overflow the screen.
|
|
8
|
-
*/
|
|
9
|
-
export declare class TooltipAPI {
|
|
10
|
-
/**
|
|
11
|
-
* A reference to the tooltip element in the HTML tree.
|
|
12
|
-
*/
|
|
13
|
-
tooltipRef: React.RefObject<HTMLDivElement>;
|
|
14
|
-
private setContent;
|
|
15
|
-
private hideTimeoutId;
|
|
16
|
-
private clickListener;
|
|
17
|
-
private relativeTo;
|
|
18
|
-
constructor(tooltipRef: React.RefObject<HTMLDivElement>, setContent: React.Dispatch<React.SetStateAction<React.ReactNode>>);
|
|
19
|
-
private computeRelativeTo;
|
|
20
|
-
/**
|
|
21
|
-
* Shows the tooltip with `content`. Its position is based on `position` and the position of the element referred by `anchor`.
|
|
22
|
-
*/
|
|
23
|
-
show({ content, anchor, position, hideOnClickOutside }: ShowOptions): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Hides the tooltip. After the animation, the content is removed.
|
|
26
|
-
*/
|
|
27
|
-
hide(): void;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=TooltipAPI.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipAPI.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipAPI.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AASrC;;;;;;GAMG;AACH,qBAAa,UAAU;IACrB;;OAEG;IACH,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAC3C,OAAO,CAAC,UAAU,CAAuD;IACzE,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,UAAU,CAAyB;gBAE/B,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAK1H,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACG,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAmB,EAAE,kBAAkB,EAAE,EAAE,WAAW;IA+CpF;;OAEG;IACH,IAAI,IAAI,IAAI;CAMb"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { delay } from '@stack-spot/portal-components';
|
|
2
|
-
import { animationTimeMS } from './style.js';
|
|
3
|
-
// the maximum amount of pixels a tooltip can get close to the screen edges.
|
|
4
|
-
const MARGIN_TO_CORNERS_PX = 10;
|
|
5
|
-
function isRelative(element) {
|
|
6
|
-
return ['relative', 'absolute', 'fixed'].includes(element.computedStyleMap().get('position')?.toString() ?? '');
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Allows interaction with the tooltip element.
|
|
10
|
-
*
|
|
11
|
-
* This places the tooltip element at the correct place, shows it, hides it and manages its contents.
|
|
12
|
-
*
|
|
13
|
-
* This also takes into account the screen edges, making adjustments to the tooltip position if it would overflow the screen.
|
|
14
|
-
*/
|
|
15
|
-
export class TooltipAPI {
|
|
16
|
-
/**
|
|
17
|
-
* A reference to the tooltip element in the HTML tree.
|
|
18
|
-
*/
|
|
19
|
-
tooltipRef;
|
|
20
|
-
setContent;
|
|
21
|
-
hideTimeoutId;
|
|
22
|
-
clickListener;
|
|
23
|
-
relativeTo;
|
|
24
|
-
constructor(tooltipRef, setContent) {
|
|
25
|
-
this.tooltipRef = tooltipRef;
|
|
26
|
-
this.setContent = setContent;
|
|
27
|
-
}
|
|
28
|
-
computeRelativeTo() {
|
|
29
|
-
if (this.relativeTo)
|
|
30
|
-
return;
|
|
31
|
-
this.relativeTo = this.tooltipRef.current?.parentElement;
|
|
32
|
-
while (this.relativeTo && this.relativeTo !== document.body && !isRelative(this.relativeTo)) {
|
|
33
|
-
this.relativeTo = this.relativeTo.parentElement;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Shows the tooltip with `content`. Its position is based on `position` and the position of the element referred by `anchor`.
|
|
38
|
-
*/
|
|
39
|
-
async show({ content, anchor, position = 'bottom', hideOnClickOutside }) {
|
|
40
|
-
window.clearTimeout(this.hideTimeoutId);
|
|
41
|
-
this.hideTimeoutId = undefined;
|
|
42
|
-
if (this.clickListener)
|
|
43
|
-
document.removeEventListener('click', this.clickListener);
|
|
44
|
-
this.setContent(content);
|
|
45
|
-
await delay(10);
|
|
46
|
-
if (!this.tooltipRef.current)
|
|
47
|
-
return;
|
|
48
|
-
const anchorRect = anchor.getClientRects()[0];
|
|
49
|
-
this.tooltipRef.current.classList.add('visible');
|
|
50
|
-
const tooltipWidth = this.tooltipRef.current.clientWidth;
|
|
51
|
-
const tooltipHeight = this.tooltipRef.current.clientHeight;
|
|
52
|
-
let top = 0;
|
|
53
|
-
let left = 0;
|
|
54
|
-
if (position === 'left' || position === 'right') {
|
|
55
|
-
top = anchorRect.top + anchorRect.height / 2 - tooltipHeight / 2;
|
|
56
|
-
if (position === 'left')
|
|
57
|
-
left = anchorRect.left - tooltipWidth;
|
|
58
|
-
else
|
|
59
|
-
left = anchorRect.left + anchorRect.width;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
left = anchorRect.left + anchorRect.width / 2 - tooltipWidth / 2;
|
|
63
|
-
if (position === 'top')
|
|
64
|
-
top = anchorRect.top - tooltipHeight;
|
|
65
|
-
else
|
|
66
|
-
top = anchorRect.top + anchorRect.height;
|
|
67
|
-
}
|
|
68
|
-
// takes the parent the tooltip is positioned relative to into consideration
|
|
69
|
-
this.computeRelativeTo();
|
|
70
|
-
const relativeRect = this.relativeTo?.getClientRects()[0] ?? { top: 0, left: 0 };
|
|
71
|
-
top -= relativeRect.top;
|
|
72
|
-
left -= relativeRect.left;
|
|
73
|
-
// adjusts positions in order to avoid overflowing the window and leaving a margin to the corners
|
|
74
|
-
if (top <= 0)
|
|
75
|
-
top += MARGIN_TO_CORNERS_PX;
|
|
76
|
-
else if (top + tooltipHeight >= document.body.clientHeight - MARGIN_TO_CORNERS_PX) {
|
|
77
|
-
top = document.body.clientHeight - MARGIN_TO_CORNERS_PX + tooltipHeight;
|
|
78
|
-
}
|
|
79
|
-
if (left <= 0)
|
|
80
|
-
left += MARGIN_TO_CORNERS_PX;
|
|
81
|
-
else if (left + tooltipWidth >= document.body.clientWidth - MARGIN_TO_CORNERS_PX) {
|
|
82
|
-
left = document.body.clientWidth - MARGIN_TO_CORNERS_PX - tooltipWidth;
|
|
83
|
-
}
|
|
84
|
-
this.tooltipRef.current.style.top = `${top}px`;
|
|
85
|
-
this.tooltipRef.current.style.left = `${left}px`;
|
|
86
|
-
if (hideOnClickOutside) {
|
|
87
|
-
this.clickListener = (e) => {
|
|
88
|
-
if (this.tooltipRef.current?.contains(e.target))
|
|
89
|
-
return;
|
|
90
|
-
this.hide();
|
|
91
|
-
};
|
|
92
|
-
document.addEventListener('click', this.clickListener);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Hides the tooltip. After the animation, the content is removed.
|
|
97
|
-
*/
|
|
98
|
-
hide() {
|
|
99
|
-
if (!this.tooltipRef.current)
|
|
100
|
-
return;
|
|
101
|
-
this.tooltipRef.current.classList.remove('visible');
|
|
102
|
-
this.hideTimeoutId = window.setTimeout(() => this.setContent(undefined), animationTimeMS);
|
|
103
|
-
if (this.clickListener)
|
|
104
|
-
document.removeEventListener('click', this.clickListener);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=TooltipAPI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipAPI.js","sourceRoot":"","sources":["../../../src/components/Tooltip/TooltipAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGzC,4EAA4E;AAC5E,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAE/B,SAAS,UAAU,CAAC,OAAoB;IACtC,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;AACjH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,UAAU;IACrB;;OAEG;IACH,UAAU,CAAiC;IACnC,UAAU,CAAuD;IACjE,aAAa,CAAoB;IACjC,aAAa,CAAuC;IACpD,UAAU,CAAyB;IAE3C,YAAY,UAA2C,EAAE,UAAiE;QACxH,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,UAAU;YAAE,OAAM;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,aAA4B,CAAA;QACvE,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5F,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC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,GAAG,IAAI,IAAI,CAAA;QAChD,IAAI,kBAAkB,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,GAAG,CAAC,CAAa,EAAE,EAAE;gBACrC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,MAAqB,CAAC;oBAAE,OAAM;gBACtE,IAAI,CAAC,IAAI,EAAE,CAAA;YACb,CAAC,CAAA;YACD,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;QACxD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO;YAAE,OAAM;QACpC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QACnD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC,CAAA;QACzF,IAAI,IAAI,CAAC,aAAa;YAAE,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;IACnF,CAAC;CACF"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { WithChildren } from '../../types.js';
|
|
2
|
-
import { TooltipAPI } from './TooltipAPI.js';
|
|
3
|
-
export declare const TooltipProvider: ({ children }: Required<WithChildren>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare function useTooltip(): TooltipAPI;
|
|
5
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/context.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,eAAO,MAAM,eAAe,iBAAkB,QAAQ,CAAC,YAAY,CAAC,4CAUnE,CAAA;AAED,wBAAgB,UAAU,eAIzB"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { TooltipBox } from './style.js';
|
|
4
|
-
import { TooltipAPI } from './TooltipAPI.js';
|
|
5
|
-
const Context = createContext(undefined);
|
|
6
|
-
export const TooltipProvider = ({ children }) => {
|
|
7
|
-
const ref = useRef(null);
|
|
8
|
-
const [content, setContent] = useState();
|
|
9
|
-
const api = useMemo(() => new TooltipAPI(ref, setContent), []);
|
|
10
|
-
return (_jsxs(Context.Provider, { value: api, children: [children, _jsx(TooltipBox, { ref: ref, children: content })] }));
|
|
11
|
-
};
|
|
12
|
-
export function useTooltip() {
|
|
13
|
-
const api = useContext(Context);
|
|
14
|
-
if (!api)
|
|
15
|
-
throw new Error('In order to use tooltips, you must wrap your content in a <TooltipProvider>.');
|
|
16
|
-
return api;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/Tooltip/context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,OAAO,GAAG,aAAa,CAAyB,SAAS,CAAC,CAAA;AAEhE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAA0B,EAAE,EAAE;IACtE,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IACxC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAmB,CAAA;IACzD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,CAAA;IAC9D,OAAO,CACL,MAAC,OAAO,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,aACzB,QAAQ,EACT,KAAC,UAAU,IAAC,GAAG,EAAE,GAAG,YAAG,OAAO,GAAc,IAC3B,CACpB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAA;IACzG,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const animationTimeMS = 300;
|
|
2
|
-
export declare const TooltipBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
-
export declare const DefaultTooltip: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
-
//# sourceMappingURL=style.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/style.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,MAAM,CAAA;AAElC,eAAO,MAAM,UAAU,wOAUtB,CAAA;AAED,eAAO,MAAM,cAAc,wOAM1B,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { theme } from '@stack-spot/portal-theme';
|
|
2
|
-
import { styled } from 'styled-components';
|
|
3
|
-
export const animationTimeMS = 300;
|
|
4
|
-
export const TooltipBox = styled.div `
|
|
5
|
-
position: absolute;
|
|
6
|
-
opacity: 0;
|
|
7
|
-
transition: opacity ${animationTimeMS / 1000}s;
|
|
8
|
-
top: 0;
|
|
9
|
-
left: 0;
|
|
10
|
-
|
|
11
|
-
&.visible {
|
|
12
|
-
opacity: 1;
|
|
13
|
-
}
|
|
14
|
-
`;
|
|
15
|
-
export const DefaultTooltip = styled.div `
|
|
16
|
-
padding: 4px 8px;
|
|
17
|
-
background-color: ${theme.color.inverse[500]};
|
|
18
|
-
color: ${theme.color.inverse.contrastText};
|
|
19
|
-
border-radius: 6px;
|
|
20
|
-
margin: 6px;
|
|
21
|
-
`;
|
|
22
|
-
//# sourceMappingURL=style.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/components/Tooltip/style.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;wBAGZ,eAAe,GAAE,IAAI;;;;;;;CAO5C,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;sBAElB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;WACnC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY;;;CAG1C,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export type TooltipPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
2
|
-
export interface BoxPosition {
|
|
3
|
-
x1: number;
|
|
4
|
-
x2: number;
|
|
5
|
-
y1: number;
|
|
6
|
-
y2: number;
|
|
7
|
-
}
|
|
8
|
-
export interface ShowOptions {
|
|
9
|
-
/**
|
|
10
|
-
* The content of the tooltip. Can be either a string or a React Element.
|
|
11
|
-
*/
|
|
12
|
-
content: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* The anchor to the tooltip. This is part of what defines the position where the tooltip will appear.
|
|
15
|
-
*/
|
|
16
|
-
anchor: HTMLElement;
|
|
17
|
-
/**
|
|
18
|
-
* The position relative to the element referred by `anchor`.
|
|
19
|
-
* @default bottom
|
|
20
|
-
*/
|
|
21
|
-
position?: TooltipPosition;
|
|
22
|
-
/**
|
|
23
|
-
* Whether or not to hide the tooltip when a click is detected outside of it.
|
|
24
|
-
*/
|
|
25
|
-
hideOnClickOutside?: boolean;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEjE,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Tooltip/types.ts"],"names":[],"mappings":""}
|