@uipath/apollo-react 4.5.3 → 4.5.4-pr525.f7c19ae
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/dist/canvas/components/BaseNode/BaseNode.cjs +55 -74
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +50 -69
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.cjs +67 -0
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts +9 -0
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.js +33 -0
- package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +87 -0
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +23 -0
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +50 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.cjs +65 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts +14 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeInnerShape.js +31 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.cjs +67 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts +9 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.js +33 -0
- package/dist/canvas/components/BaseNode/NodeLabel.cjs +63 -18
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts +8 -1
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.js +57 -15
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +4 -7
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +4 -7
- package/dist/canvas/components/StageNode/AdhocTask.cjs +4 -3
- package/dist/canvas/components/StageNode/AdhocTask.d.ts +2 -1
- package/dist/canvas/components/StageNode/AdhocTask.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/AdhocTask.js +4 -3
- package/dist/canvas/components/StageNode/DraggableTask.cjs +4 -3
- package/dist/canvas/components/StageNode/DraggableTask.d.ts +1 -1
- package/dist/canvas/components/StageNode/DraggableTask.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/DraggableTask.js +4 -3
- package/dist/canvas/components/StageNode/DraggableTask.types.d.ts +1 -0
- package/dist/canvas/components/StageNode/DraggableTask.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.cjs +9 -6
- package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.js +9 -6
- package/dist/canvas/components/StageNode/StageNode.types.d.ts +1 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/TaskMenu.cjs +9 -4
- package/dist/canvas/components/StageNode/TaskMenu.d.ts +1 -0
- package/dist/canvas/components/StageNode/TaskMenu.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/TaskMenu.js +9 -4
- package/dist/canvas/components/shared/CanvasDropdownMenu.cjs +2 -1
- package/dist/canvas/components/shared/CanvasDropdownMenu.d.ts +2 -1
- package/dist/canvas/components/shared/CanvasDropdownMenu.d.ts.map +1 -1
- package/dist/canvas/components/shared/CanvasDropdownMenu.js +2 -1
- package/dist/canvas/constants.cjs +60 -0
- package/dist/canvas/constants.d.ts +15 -0
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +16 -1
- package/dist/canvas/index.cjs +39 -35
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.d.ts.map +1 -1
- package/dist/canvas/index.js +1 -0
- package/dist/canvas/styles/reactflow-reset.css +12 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.styles.cjs +0 -410
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts +0 -75
- package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts.map +0 -1
- package/dist/canvas/components/BaseNode/BaseNode.styles.js +0 -342
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { DEFAULT_NODE_SIZE, NODE_CONTAINER_RADIUS_RATIO } from "../../constants.js";
|
|
4
|
+
const getStatusBorder = (status)=>{
|
|
5
|
+
switch(status){
|
|
6
|
+
case 'InProgress':
|
|
7
|
+
return 'border-info animate-glow [--glow-color:var(--info)]';
|
|
8
|
+
case 'Completed':
|
|
9
|
+
case 'add':
|
|
10
|
+
return 'border-success animate-glow [--glow-color:var(--success)]';
|
|
11
|
+
case 'Paused':
|
|
12
|
+
case 'Warning':
|
|
13
|
+
case 'WARNING':
|
|
14
|
+
case 'update':
|
|
15
|
+
return 'border-warning animate-glow [--glow-color:var(--warning)]';
|
|
16
|
+
case 'Cancelled':
|
|
17
|
+
case 'Failed':
|
|
18
|
+
case 'Terminated':
|
|
19
|
+
case 'ERROR':
|
|
20
|
+
case 'CRITICAL':
|
|
21
|
+
case 'delete':
|
|
22
|
+
return 'border-error animate-glow [--glow-color:var(--error)]';
|
|
23
|
+
default:
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const BaseContainer = ({ isSelected, isHovered, shape, interactionState, executionStatus, validationStatus, suggestionType, width, height, hasFooter, background, loading, children })=>{
|
|
28
|
+
const numericWidth = 'number' == typeof width ? width : void 0;
|
|
29
|
+
const numericHeight = 'number' == typeof height ? height : void 0;
|
|
30
|
+
const radiusBasis = 'rectangle' === shape ? numericHeight ?? DEFAULT_NODE_SIZE : Math.min(numericWidth ?? DEFAULT_NODE_SIZE, numericHeight ?? DEFAULT_NODE_SIZE);
|
|
31
|
+
const containerRadius = radiusBasis * NODE_CONTAINER_RADIUS_RATIO;
|
|
32
|
+
const activeStatus = suggestionType ?? validationStatus ?? executionStatus;
|
|
33
|
+
return /*#__PURE__*/ jsx("div", {
|
|
34
|
+
"data-testid": "base-container",
|
|
35
|
+
"data-execution-status": executionStatus,
|
|
36
|
+
"data-interaction-state": interactionState,
|
|
37
|
+
"data-validation-status": validationStatus,
|
|
38
|
+
"data-suggestion-type": suggestionType,
|
|
39
|
+
className: cn('relative flex items-center cursor-pointer bg-surface-overlay border-2 border-border', 'circle' === shape ? 'rounded-full' : '', 'rectangle' === shape ? 'flex-row justify-start gap-3 p-2' : 'flex-col justify-center', hasFooter && 'flex-wrap rounded-2xl', getStatusBorder(activeStatus), !isSelected && isHovered && 'border-foreground-muted', isSelected && 'border-brand', isSelected && isHovered && 'border-foreground-accent-muted', 'disabled' === interactionState && 'opacity-50 cursor-not-allowed', 'drag' === interactionState && 'cursor-grabbing opacity-80'),
|
|
40
|
+
style: {
|
|
41
|
+
width,
|
|
42
|
+
height,
|
|
43
|
+
background,
|
|
44
|
+
borderRadius: 'circle' === shape || hasFooter ? void 0 : containerRadius
|
|
45
|
+
},
|
|
46
|
+
"aria-busy": loading || void 0,
|
|
47
|
+
children: children
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export { BaseContainer, getStatusBorder };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
BaseInnerShape: ()=>BaseInnerShape
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
32
|
+
const BaseInnerShape = ({ shape, color, background, hasFooter, loading, containerWidth = external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE, containerHeight = external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE, children })=>{
|
|
33
|
+
const effectiveContainerHeight = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : containerHeight;
|
|
34
|
+
const effectiveContainerWidth = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : containerWidth;
|
|
35
|
+
const basis = 'rectangle' === shape ? effectiveContainerHeight : Math.min(effectiveContainerWidth, effectiveContainerHeight);
|
|
36
|
+
const innerSize = basis * external_constants_cjs_namespaceObject.NODE_INNER_SHAPE_RATIO;
|
|
37
|
+
const iconSize = basis * external_constants_cjs_namespaceObject.NODE_INNER_ICON_RATIO;
|
|
38
|
+
const innerRadius = basis * external_constants_cjs_namespaceObject.NODE_INNER_RADIUS_RATIO;
|
|
39
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
40
|
+
className: (0, apollo_wind_namespaceObject.cn)('flex items-center justify-center overflow-hidden bg-surface text-foreground', 'circle' === shape ? 'rounded-full' : '', hasFooter ? 'rounded-2xl' : '', '[&>svg]:w-(--canvas-icon-size) [&>svg]:h-(--canvas-icon-size)', '[&>img]:w-(--canvas-icon-size) [&>img]:h-(--canvas-icon-size) [&>img]:object-contain'),
|
|
41
|
+
style: {
|
|
42
|
+
width: innerSize,
|
|
43
|
+
height: innerSize,
|
|
44
|
+
borderRadius: 'circle' === shape || hasFooter ? void 0 : innerRadius,
|
|
45
|
+
color,
|
|
46
|
+
background,
|
|
47
|
+
'--canvas-icon-size': `${iconSize}px`
|
|
48
|
+
},
|
|
49
|
+
children: loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Skeleton, {
|
|
50
|
+
"data-testid": "skeleton-icon",
|
|
51
|
+
className: "rounded-lg",
|
|
52
|
+
style: {
|
|
53
|
+
width: iconSize,
|
|
54
|
+
height: iconSize
|
|
55
|
+
}
|
|
56
|
+
}) : children
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
exports.BaseInnerShape = __webpack_exports__.BaseInnerShape;
|
|
60
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
61
|
+
"BaseInnerShape"
|
|
62
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
63
|
+
Object.defineProperty(exports, '__esModule', {
|
|
64
|
+
value: true
|
|
65
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NodeShape } from '../../schema';
|
|
2
|
+
interface BaseInnerShapeProps {
|
|
3
|
+
shape?: NodeShape;
|
|
4
|
+
color?: string;
|
|
5
|
+
background?: string;
|
|
6
|
+
hasFooter?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
containerWidth?: number;
|
|
9
|
+
containerHeight?: number;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const BaseInnerShape: ({ shape, color, background, hasFooter, loading, containerWidth, containerHeight, children, }: BaseInnerShapeProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=BaseNodeInnerShape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseNodeInnerShape.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNodeInnerShape.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AACD,eAAO,MAAM,cAAc,GAAI,8FAS5B,mBAAmB,4CAgDrB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Skeleton, cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { DEFAULT_NODE_SIZE, NODE_INNER_ICON_RATIO, NODE_INNER_RADIUS_RATIO, NODE_INNER_SHAPE_RATIO } from "../../constants.js";
|
|
4
|
+
const BaseInnerShape = ({ shape, color, background, hasFooter, loading, containerWidth = DEFAULT_NODE_SIZE, containerHeight = DEFAULT_NODE_SIZE, children })=>{
|
|
5
|
+
const effectiveContainerHeight = hasFooter ? DEFAULT_NODE_SIZE : containerHeight;
|
|
6
|
+
const effectiveContainerWidth = hasFooter ? DEFAULT_NODE_SIZE : containerWidth;
|
|
7
|
+
const basis = 'rectangle' === shape ? effectiveContainerHeight : Math.min(effectiveContainerWidth, effectiveContainerHeight);
|
|
8
|
+
const innerSize = basis * NODE_INNER_SHAPE_RATIO;
|
|
9
|
+
const iconSize = basis * NODE_INNER_ICON_RATIO;
|
|
10
|
+
const innerRadius = basis * NODE_INNER_RADIUS_RATIO;
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
|
+
className: cn('flex items-center justify-center overflow-hidden bg-surface text-foreground', 'circle' === shape ? 'rounded-full' : '', hasFooter ? 'rounded-2xl' : '', '[&>svg]:w-(--canvas-icon-size) [&>svg]:h-(--canvas-icon-size)', '[&>img]:w-(--canvas-icon-size) [&>img]:h-(--canvas-icon-size) [&>img]:object-contain'),
|
|
13
|
+
style: {
|
|
14
|
+
width: innerSize,
|
|
15
|
+
height: innerSize,
|
|
16
|
+
borderRadius: 'circle' === shape || hasFooter ? void 0 : innerRadius,
|
|
17
|
+
color,
|
|
18
|
+
background,
|
|
19
|
+
'--canvas-icon-size': `${iconSize}px`
|
|
20
|
+
},
|
|
21
|
+
children: loading ? /*#__PURE__*/ jsx(Skeleton, {
|
|
22
|
+
"data-testid": "skeleton-icon",
|
|
23
|
+
className: "rounded-lg",
|
|
24
|
+
style: {
|
|
25
|
+
width: iconSize,
|
|
26
|
+
height: iconSize
|
|
27
|
+
}
|
|
28
|
+
}) : children
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export { BaseInnerShape };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
MissingManifestNode: ()=>MissingManifestNode
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
31
|
+
const index_cjs_namespaceObject = require("../../utils/index.cjs");
|
|
32
|
+
const external_BaseNodeContainer_cjs_namespaceObject = require("./BaseNodeContainer.cjs");
|
|
33
|
+
const external_BaseNodeInnerShape_cjs_namespaceObject = require("./BaseNodeInnerShape.cjs");
|
|
34
|
+
const external_NodeLabel_cjs_namespaceObject = require("./NodeLabel.cjs");
|
|
35
|
+
const MissingManifestNode = ({ type, isSelected, isHovered, interactionState })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNodeContainer_cjs_namespaceObject.BaseContainer, {
|
|
36
|
+
shape: "square",
|
|
37
|
+
isSelected: isSelected,
|
|
38
|
+
isHovered: isHovered,
|
|
39
|
+
interactionState: interactionState,
|
|
40
|
+
width: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE,
|
|
41
|
+
height: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE,
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeInnerShape_cjs_namespaceObject.BaseInnerShape, {
|
|
44
|
+
shape: "square",
|
|
45
|
+
containerWidth: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE,
|
|
46
|
+
containerHeight: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE,
|
|
47
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.CanvasIcon, {
|
|
48
|
+
icon: "circle-alert",
|
|
49
|
+
size: external_constants_cjs_namespaceObject.NODE_ERROR_ICON_SIZE,
|
|
50
|
+
color: "var(--color-error-icon)"
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_NodeLabel_cjs_namespaceObject.NodeLabel, {
|
|
54
|
+
label: "Manifest Undefined",
|
|
55
|
+
subLabel: type,
|
|
56
|
+
shape: "square",
|
|
57
|
+
readonly: true
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
exports.MissingManifestNode = __webpack_exports__.MissingManifestNode;
|
|
62
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
63
|
+
"MissingManifestNode"
|
|
64
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
65
|
+
Object.defineProperty(exports, '__esModule', {
|
|
66
|
+
value: true
|
|
67
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface MissingManifestNodeProps {
|
|
2
|
+
type?: string;
|
|
3
|
+
isSelected?: boolean;
|
|
4
|
+
isHovered?: boolean;
|
|
5
|
+
interactionState?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const MissingManifestNode: ({ type, isSelected, isHovered, interactionState, }: MissingManifestNodeProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=BaseNodeMissingManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseNodeMissingManifest.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNodeMissingManifest.tsx"],"names":[],"mappings":"AAMA,UAAU,wBAAwB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,GAAI,oDAKjC,wBAAwB,4CAmB1B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DEFAULT_NODE_SIZE, NODE_ERROR_ICON_SIZE } from "../../constants.js";
|
|
3
|
+
import { CanvasIcon } from "../../utils/index.js";
|
|
4
|
+
import { BaseContainer } from "./BaseNodeContainer.js";
|
|
5
|
+
import { BaseInnerShape } from "./BaseNodeInnerShape.js";
|
|
6
|
+
import { NodeLabel } from "./NodeLabel.js";
|
|
7
|
+
const MissingManifestNode = ({ type, isSelected, isHovered, interactionState })=>/*#__PURE__*/ jsxs(BaseContainer, {
|
|
8
|
+
shape: "square",
|
|
9
|
+
isSelected: isSelected,
|
|
10
|
+
isHovered: isHovered,
|
|
11
|
+
interactionState: interactionState,
|
|
12
|
+
width: DEFAULT_NODE_SIZE,
|
|
13
|
+
height: DEFAULT_NODE_SIZE,
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ jsx(BaseInnerShape, {
|
|
16
|
+
shape: "square",
|
|
17
|
+
containerWidth: DEFAULT_NODE_SIZE,
|
|
18
|
+
containerHeight: DEFAULT_NODE_SIZE,
|
|
19
|
+
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
20
|
+
icon: "circle-alert",
|
|
21
|
+
size: NODE_ERROR_ICON_SIZE,
|
|
22
|
+
color: "var(--color-error-icon)"
|
|
23
|
+
})
|
|
24
|
+
}),
|
|
25
|
+
/*#__PURE__*/ jsx(NodeLabel, {
|
|
26
|
+
label: "Manifest Undefined",
|
|
27
|
+
subLabel: type,
|
|
28
|
+
shape: "square",
|
|
29
|
+
readonly: true
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
export { MissingManifestNode };
|
|
@@ -24,12 +24,27 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
BaseTextContainer: ()=>BaseTextContainer,
|
|
27
28
|
NodeLabel: ()=>NodeLabel
|
|
28
29
|
});
|
|
29
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
30
32
|
const external_react_namespaceObject = require("react");
|
|
33
|
+
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
31
34
|
const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
|
|
32
|
-
const
|
|
35
|
+
const BaseTextContainer = ({ hasBottomHandles, shape, children })=>{
|
|
36
|
+
if ('rectangle' === shape) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
37
|
+
className: "flex flex-1 min-w-0 flex-col items-start text-left",
|
|
38
|
+
children: children
|
|
39
|
+
});
|
|
40
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
41
|
+
className: (0, apollo_wind_namespaceObject.cn)('absolute left-1/2 w-[150%] flex flex-col z-10 transition-transform duration-200', hasBottomHandles ? 'items-start text-left translate-x-[20%] translate-y-1/2' : 'items-center text-center -translate-x-1/2 translate-y-full'),
|
|
42
|
+
style: {
|
|
43
|
+
bottom: hasBottomHandles ? external_constants_cjs_namespaceObject.NODE_TEXT_BOTTOM_OFFSET_WITH_HANDLES : external_constants_cjs_namespaceObject.NODE_TEXT_BOTTOM_OFFSET
|
|
44
|
+
},
|
|
45
|
+
children: children
|
|
46
|
+
});
|
|
47
|
+
};
|
|
33
48
|
const ConditionalTooltip = ({ content, children })=>{
|
|
34
49
|
if (!content) return children;
|
|
35
50
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
|
|
@@ -40,6 +55,42 @@ const ConditionalTooltip = ({ content, children })=>{
|
|
|
40
55
|
children: children
|
|
41
56
|
});
|
|
42
57
|
};
|
|
58
|
+
const Header = ({ shape, backgroundColor, onDoubleClick, children, 'data-testid': dataTestId })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
59
|
+
"data-testid": dataTestId,
|
|
60
|
+
onDoubleClick: onDoubleClick,
|
|
61
|
+
className: (0, apollo_wind_namespaceObject.cn)('text-center text-sm leading-[18px] font-semibold text-foreground overflow-hidden', backgroundColor && 'px-1.5 py-0.5 rounded-sm', 'rectangle' === shape ? 'w-full text-left whitespace-nowrap text-ellipsis' : 'break-all line-clamp-3'),
|
|
62
|
+
style: backgroundColor ? {
|
|
63
|
+
backgroundColor
|
|
64
|
+
} : void 0,
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
const SubHeader = ({ shape, onDoubleClick, children, 'data-testid': dataTestId })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
68
|
+
"data-testid": dataTestId,
|
|
69
|
+
onDoubleClick: onDoubleClick,
|
|
70
|
+
className: (0, apollo_wind_namespaceObject.cn)('text-center text-xs leading-[18px] text-foreground-muted break-all overflow-hidden', 'rectangle' === shape ? 'w-full text-left line-clamp-2' : 'line-clamp-5'),
|
|
71
|
+
children: children
|
|
72
|
+
});
|
|
73
|
+
const EditableLabel = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ shape, backgroundColor, variant, value, placeholder, rows, onChange, onKeyDown, onBlur, 'aria-label': ariaLabel }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("textarea", {
|
|
74
|
+
ref: ref,
|
|
75
|
+
value: value,
|
|
76
|
+
placeholder: placeholder,
|
|
77
|
+
rows: rows,
|
|
78
|
+
"aria-label": ariaLabel,
|
|
79
|
+
onChange: onChange,
|
|
80
|
+
onKeyDown: onKeyDown,
|
|
81
|
+
onBlur: onBlur,
|
|
82
|
+
className: (0, apollo_wind_namespaceObject.cn)('nodrag nowheel resize-none font-[inherit] text-foreground border-none rounded-sm outline-1 outline-dashed outline-border-de-emp max-w-full', 'subtext' === variant ? 'text-xs leading-[18px] font-normal mb-0' : 'text-sm leading-[18px] font-semibold mb-0.5', 'rectangle' === shape ? 'field-sizing-fixed w-full' : 'field-sizing-content text-center', backgroundColor && 'px-1.5 py-0.5'),
|
|
83
|
+
style: backgroundColor ? {
|
|
84
|
+
backgroundColor
|
|
85
|
+
} : void 0
|
|
86
|
+
}));
|
|
87
|
+
EditableLabel.displayName = 'EditableLabel';
|
|
88
|
+
const EmptyLabelPlaceholder = ({ onDoubleClick })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
89
|
+
onDoubleClick: onDoubleClick,
|
|
90
|
+
className: "nodrag nowheel text-sm leading-[18px] font-semibold text-foreground-muted bg-transparent border border-dashed border-border-de-emp rounded-sm cursor-pointer opacity-0 transition-opacity duration-200 min-w-5 min-h-5 hover:opacity-100",
|
|
91
|
+
"aria-description": "Add node label",
|
|
92
|
+
"data-testid": "empty-label-placeholder"
|
|
93
|
+
});
|
|
43
94
|
const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackgroundColor, shape, hasBottomHandles, selected, dragging, centerAdornment, readonly, onChange })=>{
|
|
44
95
|
const [isEditing, setIsEditing] = (0, external_react_namespaceObject.useState)(false);
|
|
45
96
|
const [localLabel, setLocalLabel] = (0, external_react_namespaceObject.useState)('');
|
|
@@ -50,7 +101,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
50
101
|
const handleSave = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
51
102
|
setIsEditing(false);
|
|
52
103
|
setFocusTarget(null);
|
|
53
|
-
if (localLabel !== label || localSubLabel !== subLabel) onChange({
|
|
104
|
+
if (localLabel !== label || localSubLabel !== subLabel) onChange?.({
|
|
54
105
|
label: localLabel,
|
|
55
106
|
subLabel: localSubLabel
|
|
56
107
|
});
|
|
@@ -124,27 +175,23 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
124
175
|
}, [
|
|
125
176
|
handleSave
|
|
126
177
|
]);
|
|
127
|
-
if (!label && !subLabel && !isEditing) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(
|
|
178
|
+
if (!label && !subLabel && !isEditing) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(BaseTextContainer, {
|
|
128
179
|
hasBottomHandles: hasBottomHandles,
|
|
129
180
|
shape: shape,
|
|
130
181
|
children: [
|
|
131
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
132
|
-
onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef)
|
|
133
|
-
className: "nodrag nowheel",
|
|
134
|
-
role: "button",
|
|
135
|
-
"aria-label": "Add node label",
|
|
136
|
-
"data-testid": "empty-label-placeholder"
|
|
182
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyLabelPlaceholder, {
|
|
183
|
+
onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef)
|
|
137
184
|
}),
|
|
138
185
|
centerAdornment
|
|
139
186
|
]
|
|
140
187
|
});
|
|
141
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(
|
|
188
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(BaseTextContainer, {
|
|
142
189
|
hasBottomHandles: hasBottomHandles,
|
|
143
190
|
shape: shape,
|
|
144
191
|
children: [
|
|
145
192
|
isEditing ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
146
193
|
children: [
|
|
147
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
194
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EditableLabel, {
|
|
148
195
|
ref: labelInputRef,
|
|
149
196
|
value: localLabel,
|
|
150
197
|
onChange: (e)=>setLocalLabel(e.target.value),
|
|
@@ -153,13 +200,11 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
153
200
|
shape: shape,
|
|
154
201
|
variant: "normal",
|
|
155
202
|
backgroundColor: labelBackgroundColor,
|
|
156
|
-
className: "nodrag nowheel",
|
|
157
203
|
placeholder: "Name",
|
|
158
204
|
rows: 'rectangle' === shape ? 1 : void 0,
|
|
159
|
-
role: "textbox",
|
|
160
205
|
"aria-label": "Edit node name"
|
|
161
206
|
}),
|
|
162
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
207
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EditableLabel, {
|
|
163
208
|
ref: subLabelInputRef,
|
|
164
209
|
value: localSubLabel,
|
|
165
210
|
onChange: (e)=>setLocalSubLabel(e.target.value),
|
|
@@ -167,24 +212,22 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
167
212
|
onBlur: handleBlur,
|
|
168
213
|
shape: shape,
|
|
169
214
|
variant: "subtext",
|
|
170
|
-
className: "nodrag nowheel",
|
|
171
215
|
placeholder: "Description",
|
|
172
216
|
rows: 'rectangle' === shape ? 2 : void 0,
|
|
173
|
-
role: "textbox",
|
|
174
217
|
"aria-label": "Edit node description"
|
|
175
218
|
})
|
|
176
219
|
]
|
|
177
220
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(ConditionalTooltip, {
|
|
178
221
|
content: labelTooltip,
|
|
179
222
|
children: [
|
|
180
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
223
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Header, {
|
|
181
224
|
shape: shape,
|
|
182
225
|
backgroundColor: labelBackgroundColor,
|
|
183
226
|
onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef),
|
|
184
227
|
"data-testid": "node-label",
|
|
185
228
|
children: label
|
|
186
229
|
}),
|
|
187
|
-
subLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
230
|
+
subLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SubHeader, {
|
|
188
231
|
shape: shape,
|
|
189
232
|
onDoubleClick: readonly ? void 0 : handleDoubleClick(subLabelInputRef),
|
|
190
233
|
"data-testid": "node-sublabel",
|
|
@@ -197,8 +240,10 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
197
240
|
});
|
|
198
241
|
};
|
|
199
242
|
const NodeLabel = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(NodeLabelInternal);
|
|
243
|
+
exports.BaseTextContainer = __webpack_exports__.BaseTextContainer;
|
|
200
244
|
exports.NodeLabel = __webpack_exports__.NodeLabel;
|
|
201
245
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
246
|
+
"BaseTextContainer",
|
|
202
247
|
"NodeLabel"
|
|
203
248
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
204
249
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { NodeShape } from '../../schema';
|
|
2
|
+
interface BaseTextContainerProps {
|
|
3
|
+
hasBottomHandles?: boolean;
|
|
4
|
+
shape?: NodeShape;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const BaseTextContainer: ({ hasBottomHandles, shape, children, }: BaseTextContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
8
|
export interface NodeLabelProps {
|
|
3
9
|
label?: string;
|
|
4
10
|
subLabel?: string;
|
|
@@ -10,10 +16,11 @@ export interface NodeLabelProps {
|
|
|
10
16
|
dragging?: boolean;
|
|
11
17
|
centerAdornment?: React.ReactNode;
|
|
12
18
|
readonly?: boolean;
|
|
13
|
-
onChange
|
|
19
|
+
onChange?: (values: {
|
|
14
20
|
label: string;
|
|
15
21
|
subLabel: string;
|
|
16
22
|
}) => void;
|
|
17
23
|
}
|
|
18
24
|
export declare const NodeLabel: import("react").MemoExoticComponent<({ label, subLabel, labelTooltip, labelBackgroundColor, shape, hasBottomHandles, selected, dragging, centerAdornment, readonly, onChange, }: NodeLabelProps) => import("react/jsx-runtime").JSX.Element>;
|
|
25
|
+
export {};
|
|
19
26
|
//# sourceMappingURL=NodeLabel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/NodeLabel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NodeLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/NodeLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,UAAU,sBAAsB;IAC9B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,GAAI,wCAI/B,sBAAsB,4CAmBxB,CAAC;AA+IF,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClE;AA+KD,eAAO,MAAM,SAAS,mLAjKnB,cAAc,6CAiK+B,CAAC"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { forwardRef, memo, useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { NODE_TEXT_BOTTOM_OFFSET, NODE_TEXT_BOTTOM_OFFSET_WITH_HANDLES } from "../../constants.js";
|
|
3
5
|
import { CanvasTooltip } from "../CanvasTooltip.js";
|
|
4
|
-
|
|
6
|
+
const BaseTextContainer = ({ hasBottomHandles, shape, children })=>{
|
|
7
|
+
if ('rectangle' === shape) return /*#__PURE__*/ jsx("div", {
|
|
8
|
+
className: "flex flex-1 min-w-0 flex-col items-start text-left",
|
|
9
|
+
children: children
|
|
10
|
+
});
|
|
11
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12
|
+
className: cn('absolute left-1/2 w-[150%] flex flex-col z-10 transition-transform duration-200', hasBottomHandles ? 'items-start text-left translate-x-[20%] translate-y-1/2' : 'items-center text-center -translate-x-1/2 translate-y-full'),
|
|
13
|
+
style: {
|
|
14
|
+
bottom: hasBottomHandles ? NODE_TEXT_BOTTOM_OFFSET_WITH_HANDLES : NODE_TEXT_BOTTOM_OFFSET
|
|
15
|
+
},
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
};
|
|
5
19
|
const ConditionalTooltip = ({ content, children })=>{
|
|
6
20
|
if (!content) return children;
|
|
7
21
|
return /*#__PURE__*/ jsx(CanvasTooltip, {
|
|
@@ -12,6 +26,42 @@ const ConditionalTooltip = ({ content, children })=>{
|
|
|
12
26
|
children: children
|
|
13
27
|
});
|
|
14
28
|
};
|
|
29
|
+
const Header = ({ shape, backgroundColor, onDoubleClick, children, 'data-testid': dataTestId })=>/*#__PURE__*/ jsx("div", {
|
|
30
|
+
"data-testid": dataTestId,
|
|
31
|
+
onDoubleClick: onDoubleClick,
|
|
32
|
+
className: cn('text-center text-sm leading-[18px] font-semibold text-foreground overflow-hidden', backgroundColor && 'px-1.5 py-0.5 rounded-sm', 'rectangle' === shape ? 'w-full text-left whitespace-nowrap text-ellipsis' : 'break-all line-clamp-3'),
|
|
33
|
+
style: backgroundColor ? {
|
|
34
|
+
backgroundColor
|
|
35
|
+
} : void 0,
|
|
36
|
+
children: children
|
|
37
|
+
});
|
|
38
|
+
const SubHeader = ({ shape, onDoubleClick, children, 'data-testid': dataTestId })=>/*#__PURE__*/ jsx("div", {
|
|
39
|
+
"data-testid": dataTestId,
|
|
40
|
+
onDoubleClick: onDoubleClick,
|
|
41
|
+
className: cn('text-center text-xs leading-[18px] text-foreground-muted break-all overflow-hidden', 'rectangle' === shape ? 'w-full text-left line-clamp-2' : 'line-clamp-5'),
|
|
42
|
+
children: children
|
|
43
|
+
});
|
|
44
|
+
const EditableLabel = /*#__PURE__*/ forwardRef(({ shape, backgroundColor, variant, value, placeholder, rows, onChange, onKeyDown, onBlur, 'aria-label': ariaLabel }, ref)=>/*#__PURE__*/ jsx("textarea", {
|
|
45
|
+
ref: ref,
|
|
46
|
+
value: value,
|
|
47
|
+
placeholder: placeholder,
|
|
48
|
+
rows: rows,
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
onChange: onChange,
|
|
51
|
+
onKeyDown: onKeyDown,
|
|
52
|
+
onBlur: onBlur,
|
|
53
|
+
className: cn('nodrag nowheel resize-none font-[inherit] text-foreground border-none rounded-sm outline-1 outline-dashed outline-border-de-emp max-w-full', 'subtext' === variant ? 'text-xs leading-[18px] font-normal mb-0' : 'text-sm leading-[18px] font-semibold mb-0.5', 'rectangle' === shape ? 'field-sizing-fixed w-full' : 'field-sizing-content text-center', backgroundColor && 'px-1.5 py-0.5'),
|
|
54
|
+
style: backgroundColor ? {
|
|
55
|
+
backgroundColor
|
|
56
|
+
} : void 0
|
|
57
|
+
}));
|
|
58
|
+
EditableLabel.displayName = 'EditableLabel';
|
|
59
|
+
const EmptyLabelPlaceholder = ({ onDoubleClick })=>/*#__PURE__*/ jsx("div", {
|
|
60
|
+
onDoubleClick: onDoubleClick,
|
|
61
|
+
className: "nodrag nowheel text-sm leading-[18px] font-semibold text-foreground-muted bg-transparent border border-dashed border-border-de-emp rounded-sm cursor-pointer opacity-0 transition-opacity duration-200 min-w-5 min-h-5 hover:opacity-100",
|
|
62
|
+
"aria-description": "Add node label",
|
|
63
|
+
"data-testid": "empty-label-placeholder"
|
|
64
|
+
});
|
|
15
65
|
const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackgroundColor, shape, hasBottomHandles, selected, dragging, centerAdornment, readonly, onChange })=>{
|
|
16
66
|
const [isEditing, setIsEditing] = useState(false);
|
|
17
67
|
const [localLabel, setLocalLabel] = useState('');
|
|
@@ -22,7 +72,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
22
72
|
const handleSave = useCallback(()=>{
|
|
23
73
|
setIsEditing(false);
|
|
24
74
|
setFocusTarget(null);
|
|
25
|
-
if (localLabel !== label || localSubLabel !== subLabel) onChange({
|
|
75
|
+
if (localLabel !== label || localSubLabel !== subLabel) onChange?.({
|
|
26
76
|
label: localLabel,
|
|
27
77
|
subLabel: localSubLabel
|
|
28
78
|
});
|
|
@@ -101,11 +151,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
101
151
|
shape: shape,
|
|
102
152
|
children: [
|
|
103
153
|
/*#__PURE__*/ jsx(EmptyLabelPlaceholder, {
|
|
104
|
-
onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef)
|
|
105
|
-
className: "nodrag nowheel",
|
|
106
|
-
role: "button",
|
|
107
|
-
"aria-label": "Add node label",
|
|
108
|
-
"data-testid": "empty-label-placeholder"
|
|
154
|
+
onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef)
|
|
109
155
|
}),
|
|
110
156
|
centerAdornment
|
|
111
157
|
]
|
|
@@ -125,10 +171,8 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
125
171
|
shape: shape,
|
|
126
172
|
variant: "normal",
|
|
127
173
|
backgroundColor: labelBackgroundColor,
|
|
128
|
-
className: "nodrag nowheel",
|
|
129
174
|
placeholder: "Name",
|
|
130
175
|
rows: 'rectangle' === shape ? 1 : void 0,
|
|
131
|
-
role: "textbox",
|
|
132
176
|
"aria-label": "Edit node name"
|
|
133
177
|
}),
|
|
134
178
|
/*#__PURE__*/ jsx(EditableLabel, {
|
|
@@ -139,24 +183,22 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
139
183
|
onBlur: handleBlur,
|
|
140
184
|
shape: shape,
|
|
141
185
|
variant: "subtext",
|
|
142
|
-
className: "nodrag nowheel",
|
|
143
186
|
placeholder: "Description",
|
|
144
187
|
rows: 'rectangle' === shape ? 2 : void 0,
|
|
145
|
-
role: "textbox",
|
|
146
188
|
"aria-label": "Edit node description"
|
|
147
189
|
})
|
|
148
190
|
]
|
|
149
191
|
}) : /*#__PURE__*/ jsxs(ConditionalTooltip, {
|
|
150
192
|
content: labelTooltip,
|
|
151
193
|
children: [
|
|
152
|
-
/*#__PURE__*/ jsx(
|
|
194
|
+
/*#__PURE__*/ jsx(Header, {
|
|
153
195
|
shape: shape,
|
|
154
196
|
backgroundColor: labelBackgroundColor,
|
|
155
197
|
onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef),
|
|
156
198
|
"data-testid": "node-label",
|
|
157
199
|
children: label
|
|
158
200
|
}),
|
|
159
|
-
subLabel && /*#__PURE__*/ jsx(
|
|
201
|
+
subLabel && /*#__PURE__*/ jsx(SubHeader, {
|
|
160
202
|
shape: shape,
|
|
161
203
|
onDoubleClick: readonly ? void 0 : handleDoubleClick(subLabelInputRef),
|
|
162
204
|
"data-testid": "node-sublabel",
|
|
@@ -169,4 +211,4 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
|
|
|
169
211
|
});
|
|
170
212
|
};
|
|
171
213
|
const NodeLabel = /*#__PURE__*/ memo(NodeLabelInternal);
|
|
172
|
-
export { NodeLabel };
|
|
214
|
+
export { BaseTextContainer, NodeLabel };
|
|
@@ -40,19 +40,16 @@ const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
|
40
40
|
const isHorizontalEdge = (position)=>position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
41
41
|
const isVerticalEdge = (position)=>position === react_cjs_namespaceObject.Position.Left || position === react_cjs_namespaceObject.Position.Right;
|
|
42
42
|
const snapToGrid = (value, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>Math.round(value / gridSize) * gridSize;
|
|
43
|
-
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>{
|
|
43
|
+
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING / 2)=>{
|
|
44
44
|
if (0 === numHandles) return [];
|
|
45
45
|
if (nodeSize <= 0) return [];
|
|
46
46
|
const idealSpacing = nodeSize / (numHandles + 1);
|
|
47
|
-
const
|
|
47
|
+
const roundedSpacing = Math.round(idealSpacing / gridSize) * gridSize;
|
|
48
|
+
const gridAlignedSpacing = Math.max(gridSize, roundedSpacing);
|
|
48
49
|
const totalSpan = (numHandles - 1) * gridAlignedSpacing;
|
|
49
50
|
const startPosition = (nodeSize - totalSpan) / 2;
|
|
50
51
|
const positions = [];
|
|
51
|
-
for(let i = 0; i < numHandles; i++)
|
|
52
|
-
const position = startPosition + i * gridAlignedSpacing;
|
|
53
|
-
const snappedPosition = snapToGrid(position, gridSize);
|
|
54
|
-
positions.push(snappedPosition);
|
|
55
|
-
}
|
|
52
|
+
for(let i = 0; i < numHandles; i++)positions.push(startPosition + i * gridAlignedSpacing);
|
|
56
53
|
return positions;
|
|
57
54
|
};
|
|
58
55
|
const pixelToPercent = (pixelPosition, nodeSize)=>{
|