@uipath/apollo-react 4.12.2 → 4.13.0-pr556.154baf8

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.
Files changed (121) hide show
  1. package/dist/canvas/components/AddNodePanel/AddNodeManager.cjs +26 -7
  2. package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
  3. package/dist/canvas/components/AddNodePanel/AddNodeManager.js +26 -7
  4. package/dist/canvas/components/AddNodePanel/index.cjs +2 -6
  5. package/dist/canvas/components/AddNodePanel/index.d.ts +0 -1
  6. package/dist/canvas/components/AddNodePanel/index.d.ts.map +1 -1
  7. package/dist/canvas/components/AddNodePanel/index.js +1 -2
  8. package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +1 -0
  9. package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
  10. package/dist/canvas/components/BaseNode/BaseNode.cjs +10 -3
  11. package/dist/canvas/components/BaseNode/BaseNode.d.ts +2 -1
  12. package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
  13. package/dist/canvas/components/BaseNode/BaseNode.js +7 -3
  14. package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +4 -2
  15. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +2 -1
  16. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +1 -1
  17. package/dist/canvas/components/BaseNode/BaseNodeContainer.js +4 -2
  18. package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +115 -34
  19. package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +4 -2
  20. package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
  21. package/dist/canvas/components/ButtonHandle/ButtonHandle.js +117 -36
  22. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +48 -1
  23. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +4 -0
  24. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
  25. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +36 -1
  26. package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +1 -1
  27. package/dist/canvas/components/ButtonHandle/SmartHandle.js +1 -1
  28. package/dist/canvas/components/Edges/SequenceEdge.cjs +3 -2
  29. package/dist/canvas/components/Edges/SequenceEdge.d.ts +11 -2
  30. package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
  31. package/dist/canvas/components/Edges/SequenceEdge.js +4 -3
  32. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +23 -15
  33. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +2 -0
  34. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
  35. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +24 -16
  36. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +11 -8
  37. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
  38. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +11 -8
  39. package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +112 -0
  40. package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +6 -0
  41. package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +1 -0
  42. package/dist/canvas/components/LoopNode/LoopCanvasNode.js +78 -0
  43. package/dist/canvas/components/LoopNode/LoopNode.cjs +430 -0
  44. package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +77 -0
  45. package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +12 -0
  46. package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +1 -0
  47. package/dist/canvas/components/LoopNode/LoopNode.constants.js +13 -0
  48. package/dist/canvas/components/LoopNode/LoopNode.d.ts +5 -0
  49. package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -0
  50. package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +137 -0
  51. package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +26 -0
  52. package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +1 -0
  53. package/dist/canvas/components/LoopNode/LoopNode.helpers.js +94 -0
  54. package/dist/canvas/components/LoopNode/LoopNode.js +396 -0
  55. package/dist/canvas/components/LoopNode/LoopNode.types.cjs +18 -0
  56. package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +11 -0
  57. package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +1 -0
  58. package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
  59. package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +61 -0
  60. package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +9 -0
  61. package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +1 -0
  62. package/dist/canvas/components/LoopNode/LoopNodePreview.js +27 -0
  63. package/dist/canvas/components/LoopNode/index.cjs +72 -0
  64. package/dist/canvas/components/LoopNode/index.d.ts +4 -0
  65. package/dist/canvas/components/LoopNode/index.d.ts.map +1 -0
  66. package/dist/canvas/components/LoopNode/index.js +3 -0
  67. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +27 -24
  68. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +2 -1
  69. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
  70. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +28 -25
  71. package/dist/canvas/components/index.cjs +27 -20
  72. package/dist/canvas/components/index.d.ts +1 -0
  73. package/dist/canvas/components/index.d.ts.map +1 -1
  74. package/dist/canvas/components/index.js +1 -0
  75. package/dist/canvas/constants.cjs +8 -0
  76. package/dist/canvas/constants.d.ts +2 -0
  77. package/dist/canvas/constants.d.ts.map +1 -1
  78. package/dist/canvas/constants.js +3 -1
  79. package/dist/canvas/core/NodeTypeRegistry.cjs +39 -23
  80. package/dist/canvas/core/NodeTypeRegistry.d.ts +8 -4
  81. package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
  82. package/dist/canvas/core/NodeTypeRegistry.js +39 -23
  83. package/dist/canvas/core/useNodeTypeRegistry.cjs +4 -3
  84. package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
  85. package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
  86. package/dist/canvas/core/useNodeTypeRegistry.js +4 -3
  87. package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +10 -3
  88. package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
  89. package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +10 -3
  90. package/dist/canvas/hooks/usePreviewNode.cjs +4 -2
  91. package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
  92. package/dist/canvas/hooks/usePreviewNode.js +4 -2
  93. package/dist/canvas/schema/node-definition/handle.cjs +10 -2
  94. package/dist/canvas/schema/node-definition/handle.d.ts +9 -0
  95. package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
  96. package/dist/canvas/schema/node-definition/handle.js +6 -1
  97. package/dist/canvas/schema/node-definition/index.cjs +4 -1
  98. package/dist/canvas/schema/node-definition/index.d.ts +3 -3
  99. package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
  100. package/dist/canvas/schema/node-definition/index.js +2 -2
  101. package/dist/canvas/schema/node-definition/node-manifest.d.ts +4 -0
  102. package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
  103. package/dist/canvas/storybook-utils/manifests/index.d.ts +1 -0
  104. package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
  105. package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
  106. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  107. package/dist/canvas/utils/{createPreviewNode.cjs → createPreviewGraph.cjs} +115 -41
  108. package/dist/canvas/utils/createPreviewGraph.d.ts +43 -0
  109. package/dist/canvas/utils/createPreviewGraph.d.ts.map +1 -0
  110. package/dist/canvas/utils/{createPreviewNode.js → createPreviewGraph.js} +95 -36
  111. package/dist/canvas/utils/index.cjs +10 -10
  112. package/dist/canvas/utils/index.d.ts +2 -2
  113. package/dist/canvas/utils/index.d.ts.map +1 -1
  114. package/dist/canvas/utils/index.js +2 -2
  115. package/package.json +3 -3
  116. package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +0 -41
  117. package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +0 -3
  118. package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +0 -1
  119. package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +0 -7
  120. package/dist/canvas/utils/createPreviewNode.d.ts +0 -17
  121. package/dist/canvas/utils/createPreviewNode.d.ts.map +0 -1
@@ -28,6 +28,7 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  ButtonHandle: ()=>ButtonHandle
29
29
  });
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
+ const index_cjs_namespaceObject = require("../../layouts/index.cjs");
31
32
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
32
33
  const external_react_namespaceObject = require("react");
33
34
  const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
@@ -37,7 +38,7 @@ const external_HandleButton_cjs_namespaceObject = require("./HandleButton.cjs");
37
38
  const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
38
39
  const external_HandleNotch_cjs_namespaceObject = require("./HandleNotch.cjs");
39
40
  const external_useButtonHandleSizeAndPosition_cjs_namespaceObject = require("./useButtonHandleSizeAndPosition.cjs");
40
- const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
41
+ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
41
42
  const handleRef = (0, external_react_namespaceObject.useRef)(null);
42
43
  const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
43
44
  const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
@@ -62,7 +63,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
62
63
  handleId: id,
63
64
  nodeId,
64
65
  handleType,
65
- position,
66
+ position: connectionPosition,
66
67
  originalEvent: event
67
68
  };
68
69
  onAction?.(actionEvent);
@@ -70,13 +71,13 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
70
71
  handleId: id,
71
72
  nodeId,
72
73
  handleType,
73
- position
74
+ position: connectionPosition
74
75
  });
75
76
  }, [
77
+ connectionPosition,
76
78
  id,
77
79
  nodeId,
78
80
  handleType,
79
- position,
80
81
  onAction
81
82
  ]);
82
83
  const markAsHovered = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(true), []);
@@ -87,52 +88,91 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
87
88
  numHandles: total,
88
89
  customPositionAndOffsets
89
90
  });
90
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_cjs_namespaceObject.Handle, {
91
+ const hasInwardLabel = Boolean(label && connectionPosition !== position);
92
+ const { inwardLabelRef, rootWidth, rootHeight, rootTransform } = useInwardLabelLayout({
93
+ hasInwardLabel,
94
+ isVertical,
95
+ position,
96
+ handleType,
97
+ handleWidth,
98
+ handleHeight,
99
+ transform
100
+ });
101
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Handle, {
91
102
  ref: handleRef,
92
103
  type: type,
93
- position: position,
104
+ position: connectionPosition,
94
105
  id: id,
95
106
  onMouseEnter: markAsHovered,
96
107
  onMouseLeave: unmarkAsHovered,
97
108
  onMouseDown: unmarkAsHovered,
98
109
  className: (0, CssUtil_cjs_namespaceObject.cx)('flex! items-center! justify-center! border-0! rounded-none! bg-transparent!', visible ? 'cursor-crosshair! pointer-events-auto! opacity-100' : 'cursor-default! pointer-events-none! opacity-0'),
99
110
  style: {
100
- width: handleWidth,
101
- height: handleHeight,
111
+ width: rootWidth,
112
+ height: rootHeight,
102
113
  top,
103
114
  bottom,
104
115
  left,
105
116
  right,
106
- transform
117
+ transform: rootTransform
107
118
  },
108
- children: [
109
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
110
- handleType: handleType,
111
- isVertical: isVertical,
112
- selected: selected,
113
- hovered: isHovered,
114
- showNotch: showNotches
115
- }),
116
- onAction && 'source' === type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
117
- visible: showButton,
118
- labelVisible: visible,
119
- position: position,
120
- onAction: handleButtonClick,
121
- handleRef: handleRef,
122
- label: label,
123
- labelIcon: labelIcon,
124
- labelBackgroundColor: labelBackgroundColor
125
- }) : label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleLabel_cjs_namespaceObject.HandleLabel, {
126
- position: position,
127
- backgroundColor: labelBackgroundColor,
128
- label: label,
129
- labelIcon: labelIcon
130
- })
131
- ]
119
+ children: hasInwardLabel ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
120
+ children: [
121
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
122
+ className: (0, CssUtil_cjs_namespaceObject.cx)('flex h-full w-full items-center', (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardNotchLayout)(position)),
123
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
124
+ handleType: handleType,
125
+ isVertical: isVertical,
126
+ selected: selected,
127
+ hovered: isHovered,
128
+ showNotch: showNotches
129
+ })
130
+ }),
131
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ButtonHandle_InwardHandleLabel, {
132
+ ref: inwardLabelRef,
133
+ connectionPosition: connectionPosition,
134
+ label: label,
135
+ labelIcon: labelIcon,
136
+ backgroundColor: labelBackgroundColor
137
+ }),
138
+ onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
139
+ visible: showButton,
140
+ labelVisible: visible,
141
+ position: position,
142
+ onAction: handleButtonClick,
143
+ handleRef: handleRef
144
+ }) : null
145
+ ]
146
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
147
+ children: [
148
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
149
+ handleType: handleType,
150
+ isVertical: isVertical,
151
+ selected: selected,
152
+ hovered: isHovered,
153
+ showNotch: showNotches
154
+ }),
155
+ onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
156
+ visible: showButton,
157
+ labelVisible: visible,
158
+ position: position,
159
+ onAction: handleButtonClick,
160
+ handleRef: handleRef,
161
+ label: label,
162
+ labelIcon: labelIcon,
163
+ labelBackgroundColor: labelBackgroundColor
164
+ }) : label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleLabel_cjs_namespaceObject.HandleLabel, {
165
+ position: position,
166
+ backgroundColor: labelBackgroundColor,
167
+ label: label,
168
+ labelIcon: labelIcon
169
+ })
170
+ ]
171
+ })
132
172
  });
133
173
  };
134
174
  const ButtonHandle = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(ButtonHandleBase);
135
- const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
175
+ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
136
176
  const finalSelected = shouldShowAddButtonFn({
137
177
  showAddButton,
138
178
  selected,
@@ -151,6 +191,7 @@ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovere
151
191
  nodeId: nodeId,
152
192
  type: handle.type,
153
193
  position: position,
194
+ connectionPosition: connectionPosition,
154
195
  handleType: handle.handleType,
155
196
  label: handle.label,
156
197
  labelIcon: handle.labelIcon,
@@ -170,6 +211,46 @@ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovere
170
211
  });
171
212
  };
172
213
  const ButtonHandles = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(ButtonHandlesBase);
214
+ function useInwardLabelLayout({ hasInwardLabel, isVertical, position, handleType, handleWidth, handleHeight, transform }) {
215
+ const inwardLabelRef = (0, external_react_namespaceObject.useRef)(null);
216
+ const [inwardLabelInset, setInwardLabelInset] = (0, external_react_namespaceObject.useState)(0);
217
+ (0, external_react_namespaceObject.useLayoutEffect)(()=>{
218
+ if (!hasInwardLabel) return void setInwardLabelInset((current)=>0 === current ? current : 0);
219
+ const rect = inwardLabelRef.current?.getBoundingClientRect();
220
+ const nextInset = isVertical ? rect?.height ?? 0 : rect?.width ?? 0;
221
+ setInwardLabelInset((current)=>current === nextInset ? current : nextInset);
222
+ }, [
223
+ hasInwardLabel,
224
+ isVertical
225
+ ]);
226
+ const inwardHandleSize = (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardHandleSize)(handleType);
227
+ return {
228
+ inwardLabelRef,
229
+ rootWidth: hasInwardLabel && !isVertical ? inwardHandleSize : handleWidth,
230
+ rootHeight: hasInwardLabel && isVertical ? inwardHandleSize : handleHeight,
231
+ rootTransform: hasInwardLabel ? (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardHandleTransform)(position, inwardLabelInset) : transform
232
+ };
233
+ }
234
+ const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(function({ connectionPosition, label, labelIcon, backgroundColor }, ref) {
235
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
236
+ ref: ref,
237
+ className: (0, CssUtil_cjs_namespaceObject.cx)('pointer-events-none absolute flex h-6 items-center whitespace-nowrap rounded-full border border-border-subtle px-2.5', external_ButtonHandleStyleUtils_cjs_namespaceObject.INWARD_LABEL_POSITION[connectionPosition]),
238
+ style: {
239
+ backgroundColor
240
+ },
241
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
242
+ align: "center",
243
+ gap: 3,
244
+ children: [
245
+ labelIcon,
246
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
247
+ className: "text-xs font-medium text-foreground",
248
+ children: label
249
+ })
250
+ ]
251
+ })
252
+ });
253
+ });
173
254
  exports.ButtonHandle = __webpack_exports__.ButtonHandle;
174
255
  exports.ButtonHandles = __webpack_exports__.ButtonHandles;
175
256
  for(var __rspack_i in __webpack_exports__)if (-1 === [
@@ -12,6 +12,7 @@ type ButtonHandleProps = {
12
12
  nodeId: string;
13
13
  type: 'source' | 'target';
14
14
  position: Position;
15
+ connectionPosition?: Position;
15
16
  handleType: 'artifact' | 'input' | 'output';
16
17
  label?: string;
17
18
  labelIcon?: React.ReactNode;
@@ -27,7 +28,7 @@ type ButtonHandleProps = {
27
28
  nodeWidth?: number;
28
29
  nodeHeight?: number;
29
30
  };
30
- export declare const ButtonHandle: import("react").MemoExoticComponent<({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor, visible, showButton, selected, index, total, onAction, showNotches, customPositionAndOffsets, nodeWidth, nodeHeight, }: ButtonHandleProps) => import("react/jsx-runtime").JSX.Element>;
31
+ export declare const ButtonHandle: import("react").MemoExoticComponent<({ id, nodeId, type, position, connectionPosition, handleType, label, labelIcon, labelBackgroundColor, visible, showButton, selected, index, total, onAction, showNotches, customPositionAndOffsets, nodeWidth, nodeHeight, }: ButtonHandleProps) => import("react/jsx-runtime").JSX.Element>;
31
32
  export interface ButtonHandleConfig {
32
33
  id: string;
33
34
  type: 'source' | 'target';
@@ -41,10 +42,11 @@ export interface ButtonHandleConfig {
41
42
  onAction?: (event: HandleActionEvent) => void;
42
43
  customPositionAndOffsets?: HandleConfigurationSpecificPosition;
43
44
  }
44
- export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position, selected, hovered, visible, showAddButton, showNotches, customPositionAndOffsets, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
45
+ export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position, connectionPosition, selected, hovered, visible, showAddButton, showNotches, customPositionAndOffsets, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
45
46
  nodeId: string;
46
47
  handles: ButtonHandleConfig[];
47
48
  position: Position;
49
+ connectionPosition?: Position;
48
50
  selected?: boolean;
49
51
  hovered?: boolean;
50
52
  visible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonHandle.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAE5E,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAS/F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,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AO,CAAC;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,wBAAwB,CAAC,EAAE,mCAAmC,CAAC;CAChE;AA0FD,eAAO,MAAM,aAAa,2NAzEvB;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wBAAwB,CAAC,EAAE,mCAAmC,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAUpB,qBAAqB,CAAC,EAAE,CAAC,EACvB,aAAa,EACb,QAAQ,EACR,OAAO,GACR,EAAE;QACD,aAAa,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,OAAO,CAAC;CACf,6CA0CmD,CAAC"}
@@ -1,14 +1,15 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Row } from "../../layouts/index.js";
2
3
  import { Handle, Position } from "../../xyflow/react.js";
3
- import { memo, useCallback, useMemo, useRef, useState } from "react";
4
+ import { forwardRef, memo, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
4
5
  import { canvasEventBus } from "../../utils/CanvasEventBus.js";
5
6
  import { cx } from "../../utils/CssUtil.js";
6
- import { calculateGridAlignedHandlePositions, pixelToPercent } from "./ButtonHandleStyleUtils.js";
7
+ import { INWARD_LABEL_POSITION, calculateGridAlignedHandlePositions, getInwardHandleSize, getInwardHandleTransform, getInwardNotchLayout, pixelToPercent } from "./ButtonHandleStyleUtils.js";
7
8
  import { HandleButton, HandleHoverBridge } from "./HandleButton.js";
8
9
  import { HandleLabel } from "./HandleLabel.js";
9
10
  import { HandleNotch } from "./HandleNotch.js";
10
11
  import { useButtonHandleSizeAndPosition } from "./useButtonHandleSizeAndPosition.js";
11
- const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
12
+ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
12
13
  const handleRef = useRef(null);
13
14
  const [isHovered, setIsHovered] = useState(false);
14
15
  const isVertical = position === Position.Top || position === Position.Bottom;
@@ -33,7 +34,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
33
34
  handleId: id,
34
35
  nodeId,
35
36
  handleType,
36
- position,
37
+ position: connectionPosition,
37
38
  originalEvent: event
38
39
  };
39
40
  onAction?.(actionEvent);
@@ -41,13 +42,13 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
41
42
  handleId: id,
42
43
  nodeId,
43
44
  handleType,
44
- position
45
+ position: connectionPosition
45
46
  });
46
47
  }, [
48
+ connectionPosition,
47
49
  id,
48
50
  nodeId,
49
51
  handleType,
50
- position,
51
52
  onAction
52
53
  ]);
53
54
  const markAsHovered = useCallback(()=>setIsHovered(true), []);
@@ -58,52 +59,91 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
58
59
  numHandles: total,
59
60
  customPositionAndOffsets
60
61
  });
61
- return /*#__PURE__*/ jsxs(Handle, {
62
+ const hasInwardLabel = Boolean(label && connectionPosition !== position);
63
+ const { inwardLabelRef, rootWidth, rootHeight, rootTransform } = useInwardLabelLayout({
64
+ hasInwardLabel,
65
+ isVertical,
66
+ position,
67
+ handleType,
68
+ handleWidth,
69
+ handleHeight,
70
+ transform
71
+ });
72
+ return /*#__PURE__*/ jsx(Handle, {
62
73
  ref: handleRef,
63
74
  type: type,
64
- position: position,
75
+ position: connectionPosition,
65
76
  id: id,
66
77
  onMouseEnter: markAsHovered,
67
78
  onMouseLeave: unmarkAsHovered,
68
79
  onMouseDown: unmarkAsHovered,
69
80
  className: cx('flex! items-center! justify-center! border-0! rounded-none! bg-transparent!', visible ? 'cursor-crosshair! pointer-events-auto! opacity-100' : 'cursor-default! pointer-events-none! opacity-0'),
70
81
  style: {
71
- width: handleWidth,
72
- height: handleHeight,
82
+ width: rootWidth,
83
+ height: rootHeight,
73
84
  top,
74
85
  bottom,
75
86
  left,
76
87
  right,
77
- transform
88
+ transform: rootTransform
78
89
  },
79
- children: [
80
- /*#__PURE__*/ jsx(HandleNotch, {
81
- handleType: handleType,
82
- isVertical: isVertical,
83
- selected: selected,
84
- hovered: isHovered,
85
- showNotch: showNotches
86
- }),
87
- onAction && 'source' === type ? /*#__PURE__*/ jsx(HandleButton, {
88
- visible: showButton,
89
- labelVisible: visible,
90
- position: position,
91
- onAction: handleButtonClick,
92
- handleRef: handleRef,
93
- label: label,
94
- labelIcon: labelIcon,
95
- labelBackgroundColor: labelBackgroundColor
96
- }) : label && /*#__PURE__*/ jsx(HandleLabel, {
97
- position: position,
98
- backgroundColor: labelBackgroundColor,
99
- label: label,
100
- labelIcon: labelIcon
101
- })
102
- ]
90
+ children: hasInwardLabel ? /*#__PURE__*/ jsxs(Fragment, {
91
+ children: [
92
+ /*#__PURE__*/ jsx("div", {
93
+ className: cx('flex h-full w-full items-center', getInwardNotchLayout(position)),
94
+ children: /*#__PURE__*/ jsx(HandleNotch, {
95
+ handleType: handleType,
96
+ isVertical: isVertical,
97
+ selected: selected,
98
+ hovered: isHovered,
99
+ showNotch: showNotches
100
+ })
101
+ }),
102
+ /*#__PURE__*/ jsx(ButtonHandle_InwardHandleLabel, {
103
+ ref: inwardLabelRef,
104
+ connectionPosition: connectionPosition,
105
+ label: label,
106
+ labelIcon: labelIcon,
107
+ backgroundColor: labelBackgroundColor
108
+ }),
109
+ onAction && 'source' === type && showButton ? /*#__PURE__*/ jsx(HandleButton, {
110
+ visible: showButton,
111
+ labelVisible: visible,
112
+ position: position,
113
+ onAction: handleButtonClick,
114
+ handleRef: handleRef
115
+ }) : null
116
+ ]
117
+ }) : /*#__PURE__*/ jsxs(Fragment, {
118
+ children: [
119
+ /*#__PURE__*/ jsx(HandleNotch, {
120
+ handleType: handleType,
121
+ isVertical: isVertical,
122
+ selected: selected,
123
+ hovered: isHovered,
124
+ showNotch: showNotches
125
+ }),
126
+ onAction && 'source' === type && showButton ? /*#__PURE__*/ jsx(HandleButton, {
127
+ visible: showButton,
128
+ labelVisible: visible,
129
+ position: position,
130
+ onAction: handleButtonClick,
131
+ handleRef: handleRef,
132
+ label: label,
133
+ labelIcon: labelIcon,
134
+ labelBackgroundColor: labelBackgroundColor
135
+ }) : label && /*#__PURE__*/ jsx(HandleLabel, {
136
+ position: position,
137
+ backgroundColor: labelBackgroundColor,
138
+ label: label,
139
+ labelIcon: labelIcon
140
+ })
141
+ ]
142
+ })
103
143
  });
104
144
  };
105
145
  const ButtonHandle = /*#__PURE__*/ memo(ButtonHandleBase);
106
- const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
146
+ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
107
147
  const finalSelected = shouldShowAddButtonFn({
108
148
  showAddButton,
109
149
  selected,
@@ -122,6 +162,7 @@ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovere
122
162
  nodeId: nodeId,
123
163
  type: handle.type,
124
164
  position: position,
165
+ connectionPosition: connectionPosition,
125
166
  handleType: handle.handleType,
126
167
  label: handle.label,
127
168
  labelIcon: handle.labelIcon,
@@ -141,4 +182,44 @@ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovere
141
182
  });
142
183
  };
143
184
  const ButtonHandles = /*#__PURE__*/ memo(ButtonHandlesBase);
185
+ function useInwardLabelLayout({ hasInwardLabel, isVertical, position, handleType, handleWidth, handleHeight, transform }) {
186
+ const inwardLabelRef = useRef(null);
187
+ const [inwardLabelInset, setInwardLabelInset] = useState(0);
188
+ useLayoutEffect(()=>{
189
+ if (!hasInwardLabel) return void setInwardLabelInset((current)=>0 === current ? current : 0);
190
+ const rect = inwardLabelRef.current?.getBoundingClientRect();
191
+ const nextInset = isVertical ? rect?.height ?? 0 : rect?.width ?? 0;
192
+ setInwardLabelInset((current)=>current === nextInset ? current : nextInset);
193
+ }, [
194
+ hasInwardLabel,
195
+ isVertical
196
+ ]);
197
+ const inwardHandleSize = getInwardHandleSize(handleType);
198
+ return {
199
+ inwardLabelRef,
200
+ rootWidth: hasInwardLabel && !isVertical ? inwardHandleSize : handleWidth,
201
+ rootHeight: hasInwardLabel && isVertical ? inwardHandleSize : handleHeight,
202
+ rootTransform: hasInwardLabel ? getInwardHandleTransform(position, inwardLabelInset) : transform
203
+ };
204
+ }
205
+ const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ forwardRef(function({ connectionPosition, label, labelIcon, backgroundColor }, ref) {
206
+ return /*#__PURE__*/ jsx("div", {
207
+ ref: ref,
208
+ className: cx('pointer-events-none absolute flex h-6 items-center whitespace-nowrap rounded-full border border-border-subtle px-2.5', INWARD_LABEL_POSITION[connectionPosition]),
209
+ style: {
210
+ backgroundColor
211
+ },
212
+ children: /*#__PURE__*/ jsxs(Row, {
213
+ align: "center",
214
+ gap: 3,
215
+ children: [
216
+ labelIcon,
217
+ /*#__PURE__*/ jsx("span", {
218
+ className: "text-xs font-medium text-foreground",
219
+ children: label
220
+ })
221
+ ]
222
+ })
223
+ });
224
+ });
144
225
  export { ButtonHandle, ButtonHandles };
@@ -25,14 +25,18 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  leftPositionForHandle: ()=>leftPositionForHandle,
28
+ getInwardHandleSize: ()=>getInwardHandleSize,
28
29
  topPositionForHandle: ()=>topPositionForHandle,
29
30
  transformForHandle: ()=>transformForHandle,
30
- snapToGrid: ()=>snapToGrid,
31
+ getInwardNotchLayout: ()=>getInwardNotchLayout,
31
32
  heightForHandleWithPosition: ()=>heightForHandleWithPosition,
33
+ snapToGrid: ()=>snapToGrid,
34
+ INWARD_LABEL_POSITION: ()=>INWARD_LABEL_POSITION,
32
35
  bottomPositionForHandle: ()=>bottomPositionForHandle,
33
36
  calculateGridAlignedHandlePositions: ()=>calculateGridAlignedHandlePositions,
34
37
  pixelToPercent: ()=>pixelToPercent,
35
38
  rightPositionForHandle: ()=>rightPositionForHandle,
39
+ getInwardHandleTransform: ()=>getInwardHandleTransform,
36
40
  widthForHandleWithPosition: ()=>widthForHandleWithPosition
37
41
  });
38
42
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
@@ -121,8 +125,47 @@ const transformForHandle = ({ position, customPositionAndOffsets })=>{
121
125
  const horizontalPercent = hasCustomHorizontal ? '0%' : position === react_cjs_namespaceObject.Position.Right ? '50%' : '-50%';
122
126
  return `translate(${horizontalPercent}, ${verticalPercent})`;
123
127
  };
128
+ const getInwardHandleSize = (handleType)=>{
129
+ if ('input' === handleType) return '14px';
130
+ if ('artifact' === handleType) return '16px';
131
+ return '18px';
132
+ };
133
+ const getInwardHandleTransform = (position, inset)=>{
134
+ switch(position){
135
+ case react_cjs_namespaceObject.Position.Left:
136
+ return `translate(${inset}px, -50%)`;
137
+ case react_cjs_namespaceObject.Position.Right:
138
+ return `translate(${-inset}px, -50%)`;
139
+ case react_cjs_namespaceObject.Position.Top:
140
+ return `translate(-50%, ${inset}px)`;
141
+ case react_cjs_namespaceObject.Position.Bottom:
142
+ return `translate(-50%, ${-inset}px)`;
143
+ }
144
+ };
145
+ const getInwardNotchLayout = (position)=>{
146
+ switch(position){
147
+ case react_cjs_namespaceObject.Position.Top:
148
+ return 'flex-col justify-start';
149
+ case react_cjs_namespaceObject.Position.Bottom:
150
+ return 'flex-col justify-end';
151
+ case react_cjs_namespaceObject.Position.Left:
152
+ return 'justify-start';
153
+ case react_cjs_namespaceObject.Position.Right:
154
+ return 'justify-end';
155
+ }
156
+ };
157
+ const INWARD_LABEL_POSITION = {
158
+ [react_cjs_namespaceObject.Position.Top]: 'top-full left-1/2 -translate-x-1/2',
159
+ [react_cjs_namespaceObject.Position.Bottom]: 'bottom-full left-1/2 -translate-x-1/2',
160
+ [react_cjs_namespaceObject.Position.Left]: 'left-full top-1/2 -translate-y-1/2',
161
+ [react_cjs_namespaceObject.Position.Right]: 'right-full top-1/2 -translate-y-1/2'
162
+ };
163
+ exports.INWARD_LABEL_POSITION = __webpack_exports__.INWARD_LABEL_POSITION;
124
164
  exports.bottomPositionForHandle = __webpack_exports__.bottomPositionForHandle;
125
165
  exports.calculateGridAlignedHandlePositions = __webpack_exports__.calculateGridAlignedHandlePositions;
166
+ exports.getInwardHandleSize = __webpack_exports__.getInwardHandleSize;
167
+ exports.getInwardHandleTransform = __webpack_exports__.getInwardHandleTransform;
168
+ exports.getInwardNotchLayout = __webpack_exports__.getInwardNotchLayout;
126
169
  exports.heightForHandleWithPosition = __webpack_exports__.heightForHandleWithPosition;
127
170
  exports.leftPositionForHandle = __webpack_exports__.leftPositionForHandle;
128
171
  exports.pixelToPercent = __webpack_exports__.pixelToPercent;
@@ -132,8 +175,12 @@ exports.topPositionForHandle = __webpack_exports__.topPositionForHandle;
132
175
  exports.transformForHandle = __webpack_exports__.transformForHandle;
133
176
  exports.widthForHandleWithPosition = __webpack_exports__.widthForHandleWithPosition;
134
177
  for(var __rspack_i in __webpack_exports__)if (-1 === [
178
+ "INWARD_LABEL_POSITION",
135
179
  "bottomPositionForHandle",
136
180
  "calculateGridAlignedHandlePositions",
181
+ "getInwardHandleSize",
182
+ "getInwardHandleTransform",
183
+ "getInwardNotchLayout",
137
184
  "heightForHandleWithPosition",
138
185
  "leftPositionForHandle",
139
186
  "pixelToPercent",
@@ -45,4 +45,8 @@ export declare const transformForHandle: ({ position, customPositionAndOffsets,
45
45
  position: Position;
46
46
  customPositionAndOffsets?: HandleConfigurationSpecificPosition;
47
47
  }) => string;
48
+ export declare const getInwardHandleSize: (handleType: "artifact" | "input" | "output") => string;
49
+ export declare const getInwardHandleTransform: (position: Position, inset: number) => string;
50
+ export declare const getInwardNotchLayout: (position: Position) => string;
51
+ export declare const INWARD_LABEL_POSITION: Record<Position, string>;
48
52
  //# sourceMappingURL=ButtonHandleStyleUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonHandleStyleUtils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAEpE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAoB/F,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,WAAU,MAAqB,KAAG,MAE3E,CAAC;AAmBF,eAAO,MAAM,mCAAmC,GAC9C,UAAU,MAAM,EAChB,YAAY,MAAM,EAClB,WAAU,MAAyB,KAClC,MAAM,EA4BR,CAAC;AAQF,eAAO,MAAM,cAAc,GAAI,eAAe,MAAM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= ({ position, customPositionAndOffsets })=>{
84
84
  const horizontalPercent = hasCustomHorizontal ? '0%' : position === Position.Right ? '50%' : '-50%';
85
85
  return `translate(${horizontalPercent}, ${verticalPercent})`;
86
86
  };
87
- export { bottomPositionForHandle, calculateGridAlignedHandlePositions, heightForHandleWithPosition, leftPositionForHandle, pixelToPercent, rightPositionForHandle, snapToGrid, topPositionForHandle, transformForHandle, widthForHandleWithPosition };
87
+ const getInwardHandleSize = (handleType)=>{
88
+ if ('input' === handleType) return '14px';
89
+ if ('artifact' === handleType) return '16px';
90
+ return '18px';
91
+ };
92
+ const getInwardHandleTransform = (position, inset)=>{
93
+ switch(position){
94
+ case Position.Left:
95
+ return `translate(${inset}px, -50%)`;
96
+ case Position.Right:
97
+ return `translate(${-inset}px, -50%)`;
98
+ case Position.Top:
99
+ return `translate(-50%, ${inset}px)`;
100
+ case Position.Bottom:
101
+ return `translate(-50%, ${-inset}px)`;
102
+ }
103
+ };
104
+ const getInwardNotchLayout = (position)=>{
105
+ switch(position){
106
+ case Position.Top:
107
+ return 'flex-col justify-start';
108
+ case Position.Bottom:
109
+ return 'flex-col justify-end';
110
+ case Position.Left:
111
+ return 'justify-start';
112
+ case Position.Right:
113
+ return 'justify-end';
114
+ }
115
+ };
116
+ const INWARD_LABEL_POSITION = {
117
+ [Position.Top]: 'top-full left-1/2 -translate-x-1/2',
118
+ [Position.Bottom]: 'bottom-full left-1/2 -translate-x-1/2',
119
+ [Position.Left]: 'left-full top-1/2 -translate-y-1/2',
120
+ [Position.Right]: 'right-full top-1/2 -translate-y-1/2'
121
+ };
122
+ export { INWARD_LABEL_POSITION, bottomPositionForHandle, calculateGridAlignedHandlePositions, getInwardHandleSize, getInwardHandleTransform, getInwardNotchLayout, heightForHandleWithPosition, leftPositionForHandle, pixelToPercent, rightPositionForHandle, snapToGrid, topPositionForHandle, transformForHandle, widthForHandleWithPosition };
@@ -384,7 +384,7 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? react_nam
384
384
  ...rest,
385
385
  children: visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
386
386
  children: [
387
- onAction && 'source' === type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
387
+ onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
388
388
  visible: showButton,
389
389
  labelVisible: visible,
390
390
  position: computedPosition,
@@ -353,7 +353,7 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? Position.
353
353
  ...rest,
354
354
  children: visible && /*#__PURE__*/ jsxs(Fragment, {
355
355
  children: [
356
- onAction && 'source' === type ? /*#__PURE__*/ jsx(HandleButton, {
356
+ onAction && 'source' === type && showButton ? /*#__PURE__*/ jsx(HandleButton, {
357
357
  visible: showButton,
358
358
  labelVisible: visible,
359
359
  position: computedPosition,