@uipath/apollo-react 3.71.0 → 4.0.0
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/README.md +2 -0
- package/dist/canvas/components/AddNodePanel/AddNodePreview.cjs +9 -9
- package/dist/canvas/components/AddNodePanel/AddNodePreview.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodePreview.js +9 -9
- package/dist/canvas/components/AgentCanvas/components/SuggestionGroupPanel.cjs +40 -39
- package/dist/canvas/components/AgentCanvas/components/SuggestionGroupPanel.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/components/SuggestionGroupPanel.js +41 -40
- package/dist/canvas/components/AgentCanvas/components/TimelinePlayer.cjs +13 -9
- package/dist/canvas/components/AgentCanvas/components/TimelinePlayer.js +14 -10
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.cjs +5 -5
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/AgentNode.js +5 -5
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.cjs +22 -26
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.d.ts.map +1 -1
- package/dist/canvas/components/AgentCanvas/nodes/ResourceNode.js +22 -26
- package/dist/canvas/components/BaseCanvas/CanvasProviders.cjs +15 -7
- package/dist/canvas/components/BaseCanvas/CanvasProviders.d.ts.map +1 -1
- package/dist/canvas/components/BaseCanvas/CanvasProviders.js +15 -7
- package/dist/canvas/components/BaseNode/BaseNode.cjs +5 -6
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +6 -7
- package/dist/canvas/components/BaseNode/BaseNode.styles.cjs +2 -2
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.styles.js +2 -2
- package/dist/canvas/components/BaseNode/NodeLabel.cjs +2 -2
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.js +2 -2
- package/dist/canvas/components/BlankCanvasNode/BlankCanvasNode.cjs +6 -6
- package/dist/canvas/components/BlankCanvasNode/BlankCanvasNode.js +4 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +9 -11
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +9 -11
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +6 -9
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +6 -9
- package/dist/canvas/components/CanvasPositionControls.cjs +33 -34
- package/dist/canvas/components/CanvasPositionControls.d.ts.map +1 -1
- package/dist/canvas/components/CanvasPositionControls.js +33 -24
- package/dist/canvas/components/CanvasTooltip.cjs +138 -0
- package/dist/canvas/components/CanvasTooltip.d.ts +14 -0
- package/dist/canvas/components/CanvasTooltip.d.ts.map +1 -0
- package/dist/canvas/components/CanvasTooltip.js +91 -0
- package/dist/canvas/components/CodedAgent/CodedAgentFlow.cjs +41 -48
- package/dist/canvas/components/CodedAgent/CodedAgentFlow.d.ts.map +1 -1
- package/dist/canvas/components/CodedAgent/CodedAgentFlow.js +42 -49
- package/dist/canvas/components/ExecutionStatusIcon/ExecutionStatusIcon.cjs +35 -32
- package/dist/canvas/components/ExecutionStatusIcon/ExecutionStatusIcon.d.ts.map +1 -1
- package/dist/canvas/components/ExecutionStatusIcon/ExecutionStatusIcon.js +35 -32
- package/dist/canvas/components/FloatingCanvasPanel/PanelChrome.cjs +12 -9
- package/dist/canvas/components/FloatingCanvasPanel/PanelChrome.d.ts.map +1 -1
- package/dist/canvas/components/FloatingCanvasPanel/PanelChrome.js +12 -9
- package/dist/canvas/components/GroupNode/GroupNode.cjs +10 -12
- package/dist/canvas/components/GroupNode/GroupNode.d.ts.map +1 -1
- package/dist/canvas/components/GroupNode/GroupNode.js +10 -12
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +11 -8
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +9 -6
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +79 -66
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +77 -64
- package/dist/canvas/components/NodeContextMenu/NodeContextMenu.cjs +14 -82
- package/dist/canvas/components/NodeContextMenu/NodeContextMenu.d.ts +1 -2
- package/dist/canvas/components/NodeContextMenu/NodeContextMenu.d.ts.map +1 -1
- package/dist/canvas/components/NodeContextMenu/NodeContextMenu.js +16 -84
- package/dist/canvas/components/NodeInspector.cjs +64 -68
- package/dist/canvas/components/NodeInspector.d.ts.map +1 -1
- package/dist/canvas/components/NodeInspector.js +64 -68
- package/dist/canvas/components/NodePropertiesPanel/NodePropertiesPanel.cjs +9 -5
- package/dist/canvas/components/NodePropertiesPanel/NodePropertiesPanel.d.ts.map +1 -1
- package/dist/canvas/components/NodePropertiesPanel/NodePropertiesPanel.js +9 -5
- package/dist/canvas/components/StageNode/AdhocTask.cjs +1 -9
- package/dist/canvas/components/StageNode/AdhocTask.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/AdhocTask.js +2 -10
- package/dist/canvas/components/StageNode/DraggableTask.cjs +5 -13
- package/dist/canvas/components/StageNode/DraggableTask.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/DraggableTask.js +4 -12
- package/dist/canvas/components/StageNode/StageNode.cjs +42 -41
- package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.js +43 -42
- package/dist/canvas/components/StageNode/StageNode.stories.utils.cjs +13 -1
- package/dist/canvas/components/StageNode/StageNode.stories.utils.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.stories.utils.js +13 -1
- package/dist/canvas/components/StageNode/TaskContent.cjs +36 -35
- package/dist/canvas/components/StageNode/TaskContent.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/TaskContent.js +37 -36
- package/dist/canvas/components/StageNode/TaskMenu.cjs +19 -99
- package/dist/canvas/components/StageNode/TaskMenu.d.ts +0 -2
- package/dist/canvas/components/StageNode/TaskMenu.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/TaskMenu.js +21 -91
- package/dist/canvas/components/StickyNoteNode/FormattingToolbar.cjs +17 -17
- package/dist/canvas/components/StickyNoteNode/FormattingToolbar.d.ts.map +1 -1
- package/dist/canvas/components/StickyNoteNode/FormattingToolbar.js +12 -12
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.cjs +2 -2
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.js +3 -3
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.cjs +16 -14
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.js +13 -11
- package/dist/canvas/components/Toolbar/shared/ToolbarButton.cjs +6 -6
- package/dist/canvas/components/Toolbar/shared/ToolbarButton.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/shared/ToolbarButton.js +6 -6
- package/dist/canvas/components/Toolbox/Header.cjs +11 -10
- package/dist/canvas/components/Toolbox/Header.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/Header.js +11 -10
- package/dist/canvas/components/Toolbox/ListView.cjs +22 -34
- package/dist/canvas/components/Toolbox/ListView.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/ListView.js +23 -35
- package/dist/canvas/components/Toolbox/SearchBox.cjs +7 -7
- package/dist/canvas/components/Toolbox/SearchBox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/SearchBox.js +7 -7
- package/dist/canvas/components/TriggerNode/TriggerNode.cjs +5 -10
- package/dist/canvas/components/TriggerNode/TriggerNode.d.ts.map +1 -1
- package/dist/canvas/components/TriggerNode/TriggerNode.js +5 -10
- package/dist/canvas/components/shared/CanvasDropdownMenu.cjs +80 -0
- package/dist/canvas/components/shared/CanvasDropdownMenu.d.ts +13 -0
- package/dist/canvas/components/shared/CanvasDropdownMenu.d.ts.map +1 -0
- package/dist/canvas/components/shared/CanvasDropdownMenu.js +46 -0
- package/dist/canvas/constants.cjs +4 -0
- package/dist/canvas/constants.d.ts +1 -0
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +2 -1
- package/dist/canvas/controls/Breadcrumb/Breadcrumb.cjs +12 -23
- package/dist/canvas/controls/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/canvas/controls/Breadcrumb/Breadcrumb.js +9 -20
- package/dist/canvas/storybook-utils/components/StoryInfoPanel.cjs +13 -11
- package/dist/canvas/storybook-utils/components/StoryInfoPanel.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/components/StoryInfoPanel.js +13 -11
- package/dist/canvas/storybook-utils/decorators.cjs +7 -1
- package/dist/canvas/storybook-utils/decorators.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/decorators.js +7 -1
- package/dist/canvas/styles/tailwind.canvas.css +2 -0
- package/dist/canvas/utils/adornment-resolver.cjs +11 -12
- package/dist/canvas/utils/adornment-resolver.d.ts.map +1 -1
- package/dist/canvas/utils/adornment-resolver.js +12 -13
- package/dist/canvas/utils/icon-registry.cjs +6 -2
- package/dist/canvas/utils/icon-registry.d.ts +3 -2
- package/dist/canvas/utils/icon-registry.d.ts.map +1 -1
- package/dist/canvas/utils/icon-registry.js +3 -2
- package/dist/material/components/ap-chat/locales/ro.json +3 -3
- package/dist/material/components/ap-tool-call/locales/ro.json +1 -1
- package/package.json +4 -2
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FontVariantToken } from "@uipath/apollo-core";
|
|
3
2
|
import { Row } from "../../layouts/index.js";
|
|
4
3
|
import { Position } from "../../xyflow/react.js";
|
|
5
|
-
import { ApTypography } from "../../../material/index.js";
|
|
6
|
-
import { ApIcon, ApTooltip } from "../../../material/components/index.js";
|
|
7
4
|
import { AnimatePresence } from "motion/react";
|
|
8
5
|
import { memo, useCallback, useMemo, useState } from "react";
|
|
9
6
|
import { canvasEventBus } from "../../utils/CanvasEventBus.js";
|
|
7
|
+
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
8
|
+
import { CanvasTooltip } from "../CanvasTooltip.js";
|
|
10
9
|
import { StyledAddButton, StyledHandle, StyledLabel, StyledLine, StyledNotch, StyledWrapper } from "./ButtonHandle.styles.js";
|
|
11
10
|
import { calculateGridAlignedHandlePositions, pixelToPercent } from "./ButtonHandleStyleUtils.js";
|
|
12
11
|
const AddButton = /*#__PURE__*/ memo(({ onAction })=>{
|
|
@@ -37,9 +36,9 @@ const AddButton = /*#__PURE__*/ memo(({ onAction })=>{
|
|
|
37
36
|
scale: 1.05
|
|
38
37
|
},
|
|
39
38
|
onClick: handleClick,
|
|
40
|
-
children: /*#__PURE__*/ jsx(
|
|
41
|
-
|
|
42
|
-
size:
|
|
39
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
40
|
+
icon: "plus",
|
|
41
|
+
size: 14
|
|
43
42
|
})
|
|
44
43
|
})
|
|
45
44
|
});
|
|
@@ -115,10 +114,9 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
|
|
|
115
114
|
gap: 4,
|
|
116
115
|
children: [
|
|
117
116
|
labelIcon,
|
|
118
|
-
/*#__PURE__*/ jsx(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
sx: shouldTruncateLabel ? {
|
|
117
|
+
/*#__PURE__*/ jsx("span", {
|
|
118
|
+
className: "text-xs font-bold text-foreground-muted",
|
|
119
|
+
style: shouldTruncateLabel ? {
|
|
122
120
|
overflow: 'hidden',
|
|
123
121
|
textOverflow: 'ellipsis',
|
|
124
122
|
whiteSpace: 'nowrap'
|
|
@@ -136,7 +134,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
|
|
|
136
134
|
$selected: selected,
|
|
137
135
|
$size: label ? '60px' : '16px'
|
|
138
136
|
}),
|
|
139
|
-
/*#__PURE__*/ jsx(
|
|
137
|
+
/*#__PURE__*/ jsx(CanvasTooltip, {
|
|
140
138
|
content: "Add node",
|
|
141
139
|
placement: "bottom",
|
|
142
140
|
children: /*#__PURE__*/ jsx("div", {
|
|
@@ -30,14 +30,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
SmartSourceHandle: ()=>SmartSourceHandle
|
|
31
31
|
});
|
|
32
32
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
33
|
-
const apollo_core_namespaceObject = require("@uipath/apollo-core");
|
|
34
33
|
const index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
35
|
-
const external_material_index_cjs_namespaceObject = require("../../../material/index.cjs");
|
|
36
|
-
const components_index_cjs_namespaceObject = require("../../../material/components/index.cjs");
|
|
37
34
|
const react_namespaceObject = require("@xyflow/react");
|
|
38
35
|
const external_motion_react_namespaceObject = require("motion/react");
|
|
39
36
|
const external_react_namespaceObject = require("react");
|
|
40
37
|
const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
|
|
38
|
+
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
41
39
|
const external_ButtonHandle_styles_cjs_namespaceObject = require("./ButtonHandle.styles.cjs");
|
|
42
40
|
const external_ButtonHandleStyleUtils_cjs_namespaceObject = require("./ButtonHandleStyleUtils.cjs");
|
|
43
41
|
const external_useButtonHandleSizeAndPosition_cjs_namespaceObject = require("./useButtonHandleSizeAndPosition.cjs");
|
|
@@ -81,9 +79,9 @@ const AddButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ onAc
|
|
|
81
79
|
scale: 1.05
|
|
82
80
|
},
|
|
83
81
|
onClick: handleClick,
|
|
84
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
85
|
-
|
|
86
|
-
size:
|
|
82
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
83
|
+
icon: "plus",
|
|
84
|
+
size: 14
|
|
87
85
|
})
|
|
88
86
|
})
|
|
89
87
|
});
|
|
@@ -436,9 +434,8 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? react_nam
|
|
|
436
434
|
gap: 4,
|
|
437
435
|
children: [
|
|
438
436
|
labelIcon,
|
|
439
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
440
|
-
|
|
441
|
-
variant: apollo_core_namespaceObject.FontVariantToken.fontSizeSBold,
|
|
437
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
438
|
+
className: "text-xs font-bold text-foreground-muted",
|
|
442
439
|
children: label
|
|
443
440
|
})
|
|
444
441
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartHandle.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/SmartHandle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SmartHandle.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/SmartHandle.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,WAAW,EAEhB,QAAQ,EAKT,MAAM,eAAe,CAAC;AAcvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAiBxD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;IAErE,eAAe,CAAC,EAAE,QAAQ,CAAC;IAE3B,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IAE7C,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAM9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAMlB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAuGD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,WAAW,GACxB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,2CAiEA;AAyUD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,EAAE,EACF,eAAoE,EACpE,UAAmD,EACnD,KAAK,EACL,SAAS,EACT,SAAS,EACT,UAAU,EACV,KAAK,EACL,SAAS,EACT,oBAA+D,EAC/D,UAAkB,EAClB,QAAgB,EAChB,KAAkC,EAClC,WAAkB,EAClB,QAAQ,EACR,OAAc,EACd,WAAW,EACX,GAAG,IAAI,EACR,EAAE,gBAAgB,2CAmMlB;AASD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,2CAEtE;AAKD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,2CAEtE"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FontVariantToken } from "@uipath/apollo-core";
|
|
3
2
|
import { Row } from "../../layouts/index.js";
|
|
4
|
-
import { ApTypography } from "../../../material/index.js";
|
|
5
|
-
import { ApIcon } from "../../../material/components/index.js";
|
|
6
3
|
import { Handle, Position, useNodeId, useStore, useUpdateNodeInternals } from "@xyflow/react";
|
|
7
4
|
import { AnimatePresence } from "motion/react";
|
|
8
5
|
import { createContext, memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
9
6
|
import { canvasEventBus } from "../../utils/CanvasEventBus.js";
|
|
7
|
+
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
10
8
|
import { StyledAddButton, StyledLabel, StyledLine, StyledNotch, StyledWrapper } from "./ButtonHandle.styles.js";
|
|
11
9
|
import { calculateGridAlignedHandlePositions, pixelToPercent } from "./ButtonHandleStyleUtils.js";
|
|
12
10
|
import { useButtonHandleSizeAndPosition } from "./useButtonHandleSizeAndPosition.js";
|
|
@@ -50,9 +48,9 @@ const AddButton = /*#__PURE__*/ memo(({ onAction })=>{
|
|
|
50
48
|
scale: 1.05
|
|
51
49
|
},
|
|
52
50
|
onClick: handleClick,
|
|
53
|
-
children: /*#__PURE__*/ jsx(
|
|
54
|
-
|
|
55
|
-
size:
|
|
51
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
52
|
+
icon: "plus",
|
|
53
|
+
size: 14
|
|
56
54
|
})
|
|
57
55
|
})
|
|
58
56
|
});
|
|
@@ -405,9 +403,8 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? Position.
|
|
|
405
403
|
gap: 4,
|
|
406
404
|
children: [
|
|
407
405
|
labelIcon,
|
|
408
|
-
/*#__PURE__*/ jsx(
|
|
409
|
-
|
|
410
|
-
variant: FontVariantToken.fontSizeSBold,
|
|
406
|
+
/*#__PURE__*/ jsx("span", {
|
|
407
|
+
className: "text-xs font-bold text-foreground-muted",
|
|
411
408
|
children: label
|
|
412
409
|
})
|
|
413
410
|
]
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -36,14 +27,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
36
27
|
CanvasPositionControls: ()=>CanvasPositionControls
|
|
37
28
|
});
|
|
38
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
-
const apollo_core_namespaceObject = require("@uipath/apollo-core");
|
|
40
|
-
var apollo_core_default = /*#__PURE__*/ __webpack_require__.n(apollo_core_namespaceObject);
|
|
41
30
|
const index_cjs_namespaceObject = require("../icons/index.cjs");
|
|
42
31
|
const external_layouts_index_cjs_namespaceObject = require("../layouts/index.cjs");
|
|
43
32
|
const react_cjs_namespaceObject = require("../xyflow/react.cjs");
|
|
44
|
-
const
|
|
33
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
45
34
|
const external_react_namespaceObject = require("react");
|
|
35
|
+
const icon_registry_cjs_namespaceObject = require("../utils/icon-registry.cjs");
|
|
46
36
|
const BaseCanvas_constants_cjs_namespaceObject = require("./BaseCanvas/BaseCanvas.constants.cjs");
|
|
37
|
+
const external_CanvasTooltip_cjs_namespaceObject = require("./CanvasTooltip.cjs");
|
|
47
38
|
const CanvasPositionControls = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ orientation = 'horizontal', fitViewOptions, zoomInOptions, zoomOutOptions, translations, onOrganize })=>{
|
|
48
39
|
const { zoomIn, zoomOut, fitView } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
49
40
|
const handleZoomIn = (0, external_react_namespaceObject.useCallback)(()=>zoomIn(zoomInOptions), [
|
|
@@ -71,48 +62,56 @@ const CanvasPositionControls = /*#__PURE__*/ (0, external_react_namespaceObject.
|
|
|
71
62
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(RootComponent, {
|
|
72
63
|
"data-testid": "canvas-controls",
|
|
73
64
|
children: [
|
|
74
|
-
showOrganize && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
65
|
+
showOrganize && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
|
|
75
66
|
content: translations.organize,
|
|
76
67
|
placement: placement,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
69
|
+
variant: "ghost",
|
|
70
|
+
size: "icon",
|
|
71
|
+
className: "h-8 w-8",
|
|
72
|
+
"aria-label": translations.organize,
|
|
80
73
|
onClick: handleOrganize,
|
|
81
74
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.OrganizeIcon, {})
|
|
82
75
|
})
|
|
83
76
|
}),
|
|
84
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
77
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
|
|
85
78
|
content: translations.zoomIn,
|
|
86
79
|
placement: placement,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
81
|
+
variant: "ghost",
|
|
82
|
+
size: "icon",
|
|
83
|
+
className: "h-8 w-8",
|
|
84
|
+
"aria-label": translations.zoomIn,
|
|
90
85
|
onClick: handleZoomIn,
|
|
91
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
92
|
-
|
|
93
|
-
size:
|
|
86
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
87
|
+
icon: "plus",
|
|
88
|
+
size: 16
|
|
94
89
|
})
|
|
95
90
|
})
|
|
96
91
|
}),
|
|
97
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
92
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
|
|
98
93
|
content: translations.zoomOut,
|
|
99
94
|
placement: placement,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
size: "icon",
|
|
98
|
+
className: "h-8 w-8",
|
|
99
|
+
"aria-label": translations.zoomOut,
|
|
103
100
|
onClick: handleZoomOut,
|
|
104
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
105
|
-
|
|
106
|
-
size:
|
|
101
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
102
|
+
icon: "minus",
|
|
103
|
+
size: 16
|
|
107
104
|
})
|
|
108
105
|
})
|
|
109
106
|
}),
|
|
110
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
107
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
|
|
111
108
|
content: translations.zoomToFit,
|
|
112
109
|
placement: placement,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Button, {
|
|
111
|
+
variant: "ghost",
|
|
112
|
+
size: "icon",
|
|
113
|
+
className: "h-8 w-8",
|
|
114
|
+
"aria-label": translations.zoomToFit,
|
|
116
115
|
onClick: handleFitToView,
|
|
117
116
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ZoomToFitIcon, {})
|
|
118
117
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasPositionControls.d.ts","sourceRoot":"","sources":["../../../src/canvas/components/CanvasPositionControls.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CanvasPositionControls.d.ts","sourceRoot":"","sources":["../../../src/canvas/components/CanvasPositionControls.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,6BAA6B,IAAI,qBAAqB,EAE5D,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,MAAM,WAAW,2BAA2B;IAC1C,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,cAAc,CAAC,EAAE,wBAAwB,CAAC;IAC1C,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,sBAAsB,kIAQ9B,2BAA2B,6CAuE/B,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import apollo_core from "@uipath/apollo-core";
|
|
3
2
|
import { OrganizeIcon, ZoomToFitIcon } from "../icons/index.js";
|
|
4
3
|
import { Column, Row } from "../layouts/index.js";
|
|
5
4
|
import { useReactFlow } from "../xyflow/react.js";
|
|
6
|
-
import {
|
|
5
|
+
import { Button } from "@uipath/apollo-wind";
|
|
7
6
|
import { memo, useCallback } from "react";
|
|
7
|
+
import { CanvasIcon } from "../utils/icon-registry.js";
|
|
8
8
|
import { BASE_CANVAS_DEFAULTS } from "./BaseCanvas/BaseCanvas.constants.js";
|
|
9
|
+
import { CanvasTooltip } from "./CanvasTooltip.js";
|
|
9
10
|
const CanvasPositionControls = /*#__PURE__*/ memo(({ orientation = 'horizontal', fitViewOptions, zoomInOptions, zoomOutOptions, translations, onOrganize })=>{
|
|
10
11
|
const { zoomIn, zoomOut, fitView } = useReactFlow();
|
|
11
12
|
const handleZoomIn = useCallback(()=>zoomIn(zoomInOptions), [
|
|
@@ -33,48 +34,56 @@ const CanvasPositionControls = /*#__PURE__*/ memo(({ orientation = 'horizontal',
|
|
|
33
34
|
return /*#__PURE__*/ jsxs(RootComponent, {
|
|
34
35
|
"data-testid": "canvas-controls",
|
|
35
36
|
children: [
|
|
36
|
-
showOrganize && /*#__PURE__*/ jsx(
|
|
37
|
+
showOrganize && /*#__PURE__*/ jsx(CanvasTooltip, {
|
|
37
38
|
content: translations.organize,
|
|
38
39
|
placement: placement,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
41
|
+
variant: "ghost",
|
|
42
|
+
size: "icon",
|
|
43
|
+
className: "h-8 w-8",
|
|
44
|
+
"aria-label": translations.organize,
|
|
42
45
|
onClick: handleOrganize,
|
|
43
46
|
children: /*#__PURE__*/ jsx(OrganizeIcon, {})
|
|
44
47
|
})
|
|
45
48
|
}),
|
|
46
|
-
/*#__PURE__*/ jsx(
|
|
49
|
+
/*#__PURE__*/ jsx(CanvasTooltip, {
|
|
47
50
|
content: translations.zoomIn,
|
|
48
51
|
placement: placement,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
size: "icon",
|
|
55
|
+
className: "h-8 w-8",
|
|
56
|
+
"aria-label": translations.zoomIn,
|
|
52
57
|
onClick: handleZoomIn,
|
|
53
|
-
children: /*#__PURE__*/ jsx(
|
|
54
|
-
|
|
55
|
-
size:
|
|
58
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
59
|
+
icon: "plus",
|
|
60
|
+
size: 16
|
|
56
61
|
})
|
|
57
62
|
})
|
|
58
63
|
}),
|
|
59
|
-
/*#__PURE__*/ jsx(
|
|
64
|
+
/*#__PURE__*/ jsx(CanvasTooltip, {
|
|
60
65
|
content: translations.zoomOut,
|
|
61
66
|
placement: placement,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
68
|
+
variant: "ghost",
|
|
69
|
+
size: "icon",
|
|
70
|
+
className: "h-8 w-8",
|
|
71
|
+
"aria-label": translations.zoomOut,
|
|
65
72
|
onClick: handleZoomOut,
|
|
66
|
-
children: /*#__PURE__*/ jsx(
|
|
67
|
-
|
|
68
|
-
size:
|
|
73
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
74
|
+
icon: "minus",
|
|
75
|
+
size: 16
|
|
69
76
|
})
|
|
70
77
|
})
|
|
71
78
|
}),
|
|
72
|
-
/*#__PURE__*/ jsx(
|
|
79
|
+
/*#__PURE__*/ jsx(CanvasTooltip, {
|
|
73
80
|
content: translations.zoomToFit,
|
|
74
81
|
placement: placement,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
83
|
+
variant: "ghost",
|
|
84
|
+
size: "icon",
|
|
85
|
+
className: "h-8 w-8",
|
|
86
|
+
"aria-label": translations.zoomToFit,
|
|
78
87
|
onClick: handleFitToView,
|
|
79
88
|
children: /*#__PURE__*/ jsx(ZoomToFitIcon, {})
|
|
80
89
|
})
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
CanvasTooltip: ()=>CanvasTooltip,
|
|
37
|
+
CanvasTooltipProviderMarker: ()=>CanvasTooltipProviderMarker
|
|
38
|
+
});
|
|
39
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
40
|
+
const tooltip_namespaceObject = require("@uipath/apollo-wind/components/ui/tooltip");
|
|
41
|
+
const external_react_namespaceObject = require("react");
|
|
42
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
43
|
+
const useTruncationDetection_cjs_namespaceObject = require("../../material/components/ap-tooltip/useTruncationDetection.cjs");
|
|
44
|
+
const HasTooltipProviderContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(false);
|
|
45
|
+
function CanvasTooltipProviderMarker({ children }) {
|
|
46
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(HasTooltipProviderContext.Provider, {
|
|
47
|
+
value: true,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function CanvasTooltip({ content, placement = 'top', smartTooltip = false, delay = false, isOpen, hide, children }) {
|
|
52
|
+
const childElement = (0, external_react_namespaceObject.useMemo)(()=>/*#__PURE__*/ external_react_default().isValidElement(children) ? children : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
53
|
+
children: children
|
|
54
|
+
}), [
|
|
55
|
+
children
|
|
56
|
+
]);
|
|
57
|
+
const childElementRef = (0, external_react_namespaceObject.useRef)(childElement);
|
|
58
|
+
childElementRef.current = childElement;
|
|
59
|
+
const childRef = (0, external_react_namespaceObject.useRef)(null);
|
|
60
|
+
const truncationDetection = (0, useTruncationDetection_cjs_namespaceObject.useTruncationDetection)(childRef);
|
|
61
|
+
const isTruncated = smartTooltip ? truncationDetection.isTruncated : true;
|
|
62
|
+
const [hoverOpen, setHoverOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
63
|
+
const setChildRef = (0, external_react_namespaceObject.useCallback)((node)=>{
|
|
64
|
+
childRef.current = node;
|
|
65
|
+
const childRefProp = childElementRef.current.props.ref;
|
|
66
|
+
if ('function' == typeof childRefProp) childRefProp(node);
|
|
67
|
+
else if (childRefProp && 'object' == typeof childRefProp) childRefProp.current = node;
|
|
68
|
+
}, []);
|
|
69
|
+
const handleMouseEnter = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
70
|
+
truncationDetection.check();
|
|
71
|
+
const childProps = childElementRef.current.props;
|
|
72
|
+
childProps.onMouseEnter?.(e);
|
|
73
|
+
}, [
|
|
74
|
+
truncationDetection.check
|
|
75
|
+
]);
|
|
76
|
+
const triggerWithSmartTooltipHandlers = (0, external_react_namespaceObject.useMemo)(()=>/*#__PURE__*/ external_react_default().cloneElement(childElement, {
|
|
77
|
+
ref: setChildRef,
|
|
78
|
+
onMouseEnter: handleMouseEnter
|
|
79
|
+
}), [
|
|
80
|
+
childElement,
|
|
81
|
+
setChildRef,
|
|
82
|
+
handleMouseEnter
|
|
83
|
+
]);
|
|
84
|
+
const triggerWithHandlers = smartTooltip ? triggerWithSmartTooltipHandlers : childElement;
|
|
85
|
+
const handleOpenChange = (0, external_react_namespaceObject.useCallback)((nextOpen)=>{
|
|
86
|
+
if (nextOpen && smartTooltip) truncationDetection.check();
|
|
87
|
+
setHoverOpen(nextOpen);
|
|
88
|
+
}, [
|
|
89
|
+
smartTooltip,
|
|
90
|
+
truncationDetection.check
|
|
91
|
+
]);
|
|
92
|
+
const isTooltipHidden = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
93
|
+
if (null != isOpen) return !isOpen;
|
|
94
|
+
if (null != hide) return hide;
|
|
95
|
+
if (smartTooltip && !isTruncated) return true;
|
|
96
|
+
return false;
|
|
97
|
+
}, [
|
|
98
|
+
isOpen,
|
|
99
|
+
hide,
|
|
100
|
+
smartTooltip,
|
|
101
|
+
isTruncated
|
|
102
|
+
]);
|
|
103
|
+
const effectiveOpen = isTooltipHidden ? false : isOpen ?? hoverOpen;
|
|
104
|
+
const hasProvider = (0, external_react_namespaceObject.useContext)(HasTooltipProviderContext);
|
|
105
|
+
const tooltip = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(tooltip_namespaceObject.Tooltip, {
|
|
106
|
+
open: effectiveOpen,
|
|
107
|
+
onOpenChange: handleOpenChange,
|
|
108
|
+
delayDuration: delay ? 700 : 200,
|
|
109
|
+
children: [
|
|
110
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tooltip_namespaceObject.TooltipTrigger, {
|
|
111
|
+
asChild: true,
|
|
112
|
+
children: triggerWithHandlers
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tooltip_namespaceObject.TooltipPortal, {
|
|
115
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tooltip_namespaceObject.TooltipContent, {
|
|
116
|
+
side: placement,
|
|
117
|
+
className: "max-w-xs break-words",
|
|
118
|
+
children: content
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
if (hasProvider) return tooltip;
|
|
124
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(tooltip_namespaceObject.TooltipProvider, {
|
|
125
|
+
delayDuration: 200,
|
|
126
|
+
skipDelayDuration: 100,
|
|
127
|
+
children: tooltip
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
exports.CanvasTooltip = __webpack_exports__.CanvasTooltip;
|
|
131
|
+
exports.CanvasTooltipProviderMarker = __webpack_exports__.CanvasTooltipProviderMarker;
|
|
132
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
133
|
+
"CanvasTooltip",
|
|
134
|
+
"CanvasTooltipProviderMarker"
|
|
135
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
136
|
+
Object.defineProperty(exports, '__esModule', {
|
|
137
|
+
value: true
|
|
138
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type PropsWithChildren, type ReactNode } from 'react';
|
|
2
|
+
export declare function CanvasTooltipProviderMarker({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
4
|
+
interface CanvasTooltipProps extends PropsWithChildren {
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
placement?: TooltipPlacement;
|
|
7
|
+
smartTooltip?: boolean;
|
|
8
|
+
delay?: boolean;
|
|
9
|
+
isOpen?: boolean;
|
|
10
|
+
hide?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function CanvasTooltip({ content, placement, smartTooltip, delay, isOpen, hide, children, }: Readonly<CanvasTooltipProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export type { CanvasTooltipProps };
|
|
14
|
+
//# sourceMappingURL=CanvasTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasTooltip.d.ts","sourceRoot":"","sources":["../../../src/canvas/components/CanvasTooltip.tsx"],"names":[],"mappings":"AAOA,OAAc,EAEZ,KAAK,iBAAiB,EACtB,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AASf,wBAAgB,2BAA2B,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAI1E;AAED,KAAK,gBAAgB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5D,UAAU,kBAAmB,SAAQ,iBAAiB;IAEpD,OAAO,EAAE,SAAS,CAAC;IAEnB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AASD,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,SAAiB,EACjB,YAAoB,EACpB,KAAa,EACb,MAAM,EACN,IAAI,EACJ,QAAQ,GACT,EAAE,QAAQ,CAAC,kBAAkB,CAAC,2CA2F9B;AAED,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger } from "@uipath/apollo-wind/components/ui/tooltip";
|
|
3
|
+
import react, { createContext, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { useTruncationDetection } from "../../material/components/ap-tooltip/useTruncationDetection.js";
|
|
5
|
+
const HasTooltipProviderContext = /*#__PURE__*/ createContext(false);
|
|
6
|
+
function CanvasTooltipProviderMarker({ children }) {
|
|
7
|
+
return /*#__PURE__*/ jsx(HasTooltipProviderContext.Provider, {
|
|
8
|
+
value: true,
|
|
9
|
+
children: children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function CanvasTooltip({ content, placement = 'top', smartTooltip = false, delay = false, isOpen, hide, children }) {
|
|
13
|
+
const childElement = useMemo(()=>/*#__PURE__*/ react.isValidElement(children) ? children : /*#__PURE__*/ jsx("span", {
|
|
14
|
+
children: children
|
|
15
|
+
}), [
|
|
16
|
+
children
|
|
17
|
+
]);
|
|
18
|
+
const childElementRef = useRef(childElement);
|
|
19
|
+
childElementRef.current = childElement;
|
|
20
|
+
const childRef = useRef(null);
|
|
21
|
+
const truncationDetection = useTruncationDetection(childRef);
|
|
22
|
+
const isTruncated = smartTooltip ? truncationDetection.isTruncated : true;
|
|
23
|
+
const [hoverOpen, setHoverOpen] = useState(false);
|
|
24
|
+
const setChildRef = useCallback((node)=>{
|
|
25
|
+
childRef.current = node;
|
|
26
|
+
const childRefProp = childElementRef.current.props.ref;
|
|
27
|
+
if ('function' == typeof childRefProp) childRefProp(node);
|
|
28
|
+
else if (childRefProp && 'object' == typeof childRefProp) childRefProp.current = node;
|
|
29
|
+
}, []);
|
|
30
|
+
const handleMouseEnter = useCallback((e)=>{
|
|
31
|
+
truncationDetection.check();
|
|
32
|
+
const childProps = childElementRef.current.props;
|
|
33
|
+
childProps.onMouseEnter?.(e);
|
|
34
|
+
}, [
|
|
35
|
+
truncationDetection.check
|
|
36
|
+
]);
|
|
37
|
+
const triggerWithSmartTooltipHandlers = useMemo(()=>/*#__PURE__*/ react.cloneElement(childElement, {
|
|
38
|
+
ref: setChildRef,
|
|
39
|
+
onMouseEnter: handleMouseEnter
|
|
40
|
+
}), [
|
|
41
|
+
childElement,
|
|
42
|
+
setChildRef,
|
|
43
|
+
handleMouseEnter
|
|
44
|
+
]);
|
|
45
|
+
const triggerWithHandlers = smartTooltip ? triggerWithSmartTooltipHandlers : childElement;
|
|
46
|
+
const handleOpenChange = useCallback((nextOpen)=>{
|
|
47
|
+
if (nextOpen && smartTooltip) truncationDetection.check();
|
|
48
|
+
setHoverOpen(nextOpen);
|
|
49
|
+
}, [
|
|
50
|
+
smartTooltip,
|
|
51
|
+
truncationDetection.check
|
|
52
|
+
]);
|
|
53
|
+
const isTooltipHidden = useMemo(()=>{
|
|
54
|
+
if (null != isOpen) return !isOpen;
|
|
55
|
+
if (null != hide) return hide;
|
|
56
|
+
if (smartTooltip && !isTruncated) return true;
|
|
57
|
+
return false;
|
|
58
|
+
}, [
|
|
59
|
+
isOpen,
|
|
60
|
+
hide,
|
|
61
|
+
smartTooltip,
|
|
62
|
+
isTruncated
|
|
63
|
+
]);
|
|
64
|
+
const effectiveOpen = isTooltipHidden ? false : isOpen ?? hoverOpen;
|
|
65
|
+
const hasProvider = useContext(HasTooltipProviderContext);
|
|
66
|
+
const tooltip = /*#__PURE__*/ jsxs(Tooltip, {
|
|
67
|
+
open: effectiveOpen,
|
|
68
|
+
onOpenChange: handleOpenChange,
|
|
69
|
+
delayDuration: delay ? 700 : 200,
|
|
70
|
+
children: [
|
|
71
|
+
/*#__PURE__*/ jsx(TooltipTrigger, {
|
|
72
|
+
asChild: true,
|
|
73
|
+
children: triggerWithHandlers
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ jsx(TooltipPortal, {
|
|
76
|
+
children: /*#__PURE__*/ jsx(TooltipContent, {
|
|
77
|
+
side: placement,
|
|
78
|
+
className: "max-w-xs break-words",
|
|
79
|
+
children: content
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
if (hasProvider) return tooltip;
|
|
85
|
+
return /*#__PURE__*/ jsx(TooltipProvider, {
|
|
86
|
+
delayDuration: 200,
|
|
87
|
+
skipDelayDuration: 100,
|
|
88
|
+
children: tooltip
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export { CanvasTooltip, CanvasTooltipProviderMarker };
|