@uipath/apollo-react 6.49.0 → 6.51.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/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +3 -3
- package/dist/canvas/components/BaseNode/BaseNode.cjs +4 -3
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +4 -3
- package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +16 -3
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +1 -1
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +17 -4
- package/dist/canvas/components/BaseNode/BaseNodeOutline.cjs +131 -0
- package/dist/canvas/components/BaseNode/BaseNodeOutline.d.ts +17 -0
- package/dist/canvas/components/BaseNode/BaseNodeOutline.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/BaseNodeOutline.js +91 -0
- package/dist/canvas/components/BaseNode/NodeLabel.cjs +8 -7
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.js +8 -7
- package/dist/canvas/components/CaseFlow/case-flow.manifest.d.ts +3 -3
- package/dist/canvas/components/Guardrails/__fixtures__/dnd-geometry.d.ts +3 -0
- package/dist/canvas/components/Guardrails/__fixtures__/dnd-geometry.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/__fixtures__/guardrail-list.fixtures.d.ts +9 -0
- package/dist/canvas/components/Guardrails/__fixtures__/guardrail-list.fixtures.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-list-row.cjs +218 -0
- package/dist/canvas/components/Guardrails/components/guardrail-list-row.d.ts +26 -0
- package/dist/canvas/components/Guardrails/components/guardrail-list-row.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/guardrail-list-row.js +184 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.cjs +2 -0
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/components/guardrail-status-banner.js +2 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.cjs +1 -0
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/components/mixed-scopes-banner.js +1 -0
- package/dist/canvas/components/Guardrails/guardrail-list-utils.cjs +103 -0
- package/dist/canvas/components/Guardrails/guardrail-list-utils.d.ts +10 -0
- package/dist/canvas/components/Guardrails/guardrail-list-utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-list-utils.js +60 -0
- package/dist/canvas/components/Guardrails/guardrail-list.cjs +214 -0
- package/dist/canvas/components/Guardrails/guardrail-list.d.ts +33 -0
- package/dist/canvas/components/Guardrails/guardrail-list.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/guardrail-list.js +180 -0
- package/dist/canvas/components/Guardrails/i18n.cjs +124 -16
- package/dist/canvas/components/Guardrails/i18n.d.ts +25 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/i18n.js +110 -14
- package/dist/canvas/components/Guardrails/index.cjs +40 -3
- package/dist/canvas/components/Guardrails/index.d.ts +10 -2
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/index.js +6 -2
- package/dist/canvas/components/Guardrails/list-types.cjs +18 -0
- package/dist/canvas/components/Guardrails/list-types.d.ts +51 -0
- package/dist/canvas/components/Guardrails/list-types.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/list-types.js +0 -0
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/schema/node-definition/index.cjs +17 -5
- package/dist/canvas/schema/node-definition/index.d.ts +2 -2
- package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/index.js +2 -2
- package/dist/canvas/schema/node-definition/node-manifest.d.ts +12 -0
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/shape.cjs +29 -2
- package/dist/canvas/schema/node-definition/shape.d.ts +9 -0
- package/dist/canvas/schema/node-definition/shape.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/shape.js +17 -2
- package/dist/canvas/schema/node-instance/base.d.ts +3 -0
- package/dist/canvas/schema/node-instance/base.d.ts.map +1 -1
- package/dist/canvas/schema/node-instance/node.d.ts +3 -0
- package/dist/canvas/schema/node-instance/node.d.ts.map +1 -1
- package/dist/canvas/schema/toolbar.d.ts +15 -0
- package/dist/canvas/schema/toolbar.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +3 -3
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/styles/variables.css +8 -0
- package/dist/canvas/utils/node-size.cjs +2 -1
- package/dist/canvas/utils/node-size.d.ts +1 -1
- package/dist/canvas/utils/node-size.d.ts.map +1 -1
- package/dist/canvas/utils/node-size.js +2 -1
- package/package.json +4 -3
- package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.cjs +0 -83
- package/dist/canvas/components/Guardrails/__fixtures__/catalog-coverage.js +0 -37
- package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.cjs +0 -344
- package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.js +0 -280
- package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.cjs +0 -221
- package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.js +0 -184
|
@@ -31,7 +31,7 @@ export declare const agentFlowManifest: {
|
|
|
31
31
|
canvasLabel?: string | undefined;
|
|
32
32
|
description?: string | undefined;
|
|
33
33
|
icon?: string | undefined;
|
|
34
|
-
shape?: "square" | "circle" | "container" | "rectangle" | undefined;
|
|
34
|
+
shape?: "document" | "square" | "circle" | "container" | "rectangle" | "pill" | "clipped" | undefined;
|
|
35
35
|
color?: string | undefined;
|
|
36
36
|
background?: string | undefined;
|
|
37
37
|
iconBackground?: string | undefined;
|
|
@@ -104,7 +104,7 @@ export declare const agentFlowManifest: {
|
|
|
104
104
|
requiresPermissions?: string[] | undefined;
|
|
105
105
|
hideOnExecution?: boolean | undefined;
|
|
106
106
|
nodeTypes?: string[] | undefined;
|
|
107
|
-
shapes?: ("square" | "circle" | "container" | "rectangle")[] | undefined;
|
|
107
|
+
shapes?: ("document" | "square" | "circle" | "container" | "rectangle" | "pill" | "clipped")[] | undefined;
|
|
108
108
|
handles?: {
|
|
109
109
|
handleType: "input" | "output" | "artifact";
|
|
110
110
|
type?: "target" | "source" | undefined;
|
|
@@ -120,7 +120,7 @@ export declare const agentFlowManifest: {
|
|
|
120
120
|
requiresPermissions?: string[] | undefined;
|
|
121
121
|
hideOnExecution?: boolean | undefined;
|
|
122
122
|
nodeTypes?: string[] | undefined;
|
|
123
|
-
shapes?: ("square" | "circle" | "container" | "rectangle")[] | undefined;
|
|
123
|
+
shapes?: ("document" | "square" | "circle" | "container" | "rectangle" | "pill" | "clipped")[] | undefined;
|
|
124
124
|
handles?: {
|
|
125
125
|
handleType: "input" | "output" | "artifact";
|
|
126
126
|
type?: "target" | "source" | undefined;
|
|
@@ -32,6 +32,7 @@ const external_react_namespaceObject = require("react");
|
|
|
32
32
|
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
33
33
|
const index_cjs_namespaceObject = require("../../core/index.cjs");
|
|
34
34
|
const external_hooks_index_cjs_namespaceObject = require("../../hooks/index.cjs");
|
|
35
|
+
const external_schema_index_cjs_namespaceObject = require("../../schema/index.cjs");
|
|
35
36
|
const adornment_resolver_cjs_namespaceObject = require("../../utils/adornment-resolver.cjs");
|
|
36
37
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
37
38
|
const manifest_resolver_cjs_namespaceObject = require("../../utils/manifest-resolver.cjs");
|
|
@@ -56,7 +57,7 @@ const external_BaseNodeMissingManifest_cjs_namespaceObject = require("./BaseNode
|
|
|
56
57
|
const external_NodeLabel_cjs_namespaceObject = require("./NodeLabel.cjs");
|
|
57
58
|
const NEVER_SHOW_ADD_BUTTON = ()=>false;
|
|
58
59
|
const getContainerWidth = (shape, width)=>{
|
|
59
|
-
const defaultWidth =
|
|
60
|
+
const defaultWidth = (0, external_schema_index_cjs_namespaceObject.isWideNodeShape)(shape) ? external_constants_cjs_namespaceObject.DEFAULT_RECTANGLE_NODE_WIDTH : external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE;
|
|
60
61
|
if (width && width !== external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE && width !== external_constants_cjs_namespaceObject.DEFAULT_RECTANGLE_NODE_WIDTH) return width;
|
|
61
62
|
return defaultWidth;
|
|
62
63
|
};
|
|
@@ -242,9 +243,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
242
243
|
const effectiveH = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : numH;
|
|
243
244
|
const effectiveW = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : containerWidth;
|
|
244
245
|
const innerBasis = Math.min(effectiveH, effectiveW);
|
|
245
|
-
const innerRadius = getRadius(innerBasis, external_constants_cjs_namespaceObject.NODE_INNER_RADIUS_RATIO);
|
|
246
|
+
const innerRadius = 'pill' === displayShape ? '9999px' : getRadius(innerBasis, external_constants_cjs_namespaceObject.NODE_INNER_RADIUS_RATIO);
|
|
246
247
|
const gap = innerBasis * (1 - external_constants_cjs_namespaceObject.NODE_INNER_SHAPE_RATIO);
|
|
247
|
-
const keepSquare = 'circle' === displayShape ||
|
|
248
|
+
const keepSquare = 'circle' === displayShape || (0, external_schema_index_cjs_namespaceObject.isWideNodeShape)(displayShape);
|
|
248
249
|
const innerW = keepSquare ? innerBasis - gap : effectiveW - gap;
|
|
249
250
|
const innerH = keepSquare ? innerBasis - gap : effectiveH - gap;
|
|
250
251
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AA+ChF,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AA+ChF,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AA2sB1B,eAAO,MAAM,QAAQ,8CAtqBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAsqBmB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
4
4
|
import { DEFAULT_NODE_SIZE, DEFAULT_RECTANGLE_NODE_WIDTH, GRID_SPACING, NODE_BADGE_INSET_CIRCLE, NODE_BADGE_INSET_SQUARE, NODE_BADGE_SIZE, NODE_BORDER_SIZE, NODE_CONTAINER_RADIUS_RATIO, NODE_HEIGHT_DEFAULT, NODE_HEIGHT_FOOTER_BUTTON, NODE_HEIGHT_FOOTER_DOUBLE, NODE_HEIGHT_FOOTER_SINGLE, NODE_INNER_ICON_RATIO, NODE_INNER_RADIUS_RATIO, NODE_INNER_SHAPE_RATIO } from "../../constants.js";
|
|
5
5
|
import { useNodeTypeRegistry } from "../../core/index.js";
|
|
6
6
|
import { useElementValidationStatus, useNodeExecutionState } from "../../hooks/index.js";
|
|
7
|
+
import { isWideNodeShape } from "../../schema/index.js";
|
|
7
8
|
import { resolveAdornments } from "../../utils/adornment-resolver.js";
|
|
8
9
|
import { CanvasIcon, getIcon } from "../../utils/icon-registry.js";
|
|
9
10
|
import { resolveDisplay, resolveHandles } from "../../utils/manifest-resolver.js";
|
|
@@ -28,7 +29,7 @@ import { MissingManifestNode } from "./BaseNodeMissingManifest.js";
|
|
|
28
29
|
import { NodeLabel } from "./NodeLabel.js";
|
|
29
30
|
const NEVER_SHOW_ADD_BUTTON = ()=>false;
|
|
30
31
|
const getContainerWidth = (shape, width)=>{
|
|
31
|
-
const defaultWidth =
|
|
32
|
+
const defaultWidth = isWideNodeShape(shape) ? DEFAULT_RECTANGLE_NODE_WIDTH : DEFAULT_NODE_SIZE;
|
|
32
33
|
if (width && width !== DEFAULT_NODE_SIZE && width !== DEFAULT_RECTANGLE_NODE_WIDTH) return width;
|
|
33
34
|
return defaultWidth;
|
|
34
35
|
};
|
|
@@ -214,9 +215,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
214
215
|
const effectiveH = hasFooter ? DEFAULT_NODE_SIZE : numH;
|
|
215
216
|
const effectiveW = hasFooter ? DEFAULT_NODE_SIZE : containerWidth;
|
|
216
217
|
const innerBasis = Math.min(effectiveH, effectiveW);
|
|
217
|
-
const innerRadius = getRadius(innerBasis, NODE_INNER_RADIUS_RATIO);
|
|
218
|
+
const innerRadius = 'pill' === displayShape ? '9999px' : getRadius(innerBasis, NODE_INNER_RADIUS_RATIO);
|
|
218
219
|
const gap = innerBasis * (1 - NODE_INNER_SHAPE_RATIO);
|
|
219
|
-
const keepSquare = 'circle' === displayShape ||
|
|
220
|
+
const keepSquare = 'circle' === displayShape || isWideNodeShape(displayShape);
|
|
220
221
|
const innerW = keepSquare ? innerBasis - gap : effectiveW - gap;
|
|
221
222
|
const innerH = keepSquare ? innerBasis - gap : effectiveH - gap;
|
|
222
223
|
return {
|
|
@@ -30,6 +30,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
31
|
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
|
+
const index_cjs_namespaceObject = require("../../schema/index.cjs");
|
|
34
|
+
const external_BaseNodeOutline_cjs_namespaceObject = require("./BaseNodeOutline.cjs");
|
|
33
35
|
const getStatusBorder = (status)=>{
|
|
34
36
|
switch(status){
|
|
35
37
|
case 'InProgress':
|
|
@@ -59,7 +61,8 @@ const BaseContainer = ({ isSelected, isHovered, isStacked, shape, interactionSta
|
|
|
59
61
|
const className = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
60
62
|
const statusBorder = getStatusBorder(activeStatus);
|
|
61
63
|
const hasStatusBorder = statusBorder.length > 0;
|
|
62
|
-
|
|
64
|
+
const drawnByOutline = (0, index_cjs_namespaceObject.isOutlineDrawnShape)(shape);
|
|
65
|
+
return (0, apollo_wind_namespaceObject.cn)('relative flex items-center cursor-pointer', drawnByOutline ? 'bg-transparent border-0' : (0, apollo_wind_namespaceObject.cn)('bg-surface-overlay border border-border', 'pill' === shape ? 'rounded-full' : 'rounded-(--node-radius)'), 'w-(--node-w) h-(--node-h)', 'outline-offset-0 transition-[box-shadow,border-color] duration-150', shadow && !drawnByOutline && 'shadow-(--canvas-node-shadow-rest)', (0, index_cjs_namespaceObject.isWideNodeShape)(shape) ? 'flex-row justify-start gap-3 p-(--node-gap)' : 'flex-col justify-center', hasFooter && 'flex-wrap', !drawnByOutline && statusBorder, shadow && !drawnByOutline && isHovered && 'shadow-(--canvas-node-shadow-hover)', isHovered && !hasStatusBorder && !drawnByOutline && 'border-border-hover', isSelected && !drawnByOutline && 'outline outline-2 outline-foreground-accent-muted', 'disabled' === interactionState && 'opacity-50 cursor-not-allowed', 'drag' === interactionState && (0, apollo_wind_namespaceObject.cn)('cursor-grabbing', shadow && !drawnByOutline && 'shadow-(--canvas-node-shadow-lifted)'), isStacked && 'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-full before:rounded-[inherit] before:bg-surface-overlay before:border before:border-brand before:translate-y-[6px] before:-z-10 before:pointer-events-none');
|
|
63
66
|
}, [
|
|
64
67
|
shape,
|
|
65
68
|
hasFooter,
|
|
@@ -70,7 +73,7 @@ const BaseContainer = ({ isSelected, isHovered, isStacked, shape, interactionSta
|
|
|
70
73
|
interactionState,
|
|
71
74
|
shadow
|
|
72
75
|
]);
|
|
73
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
76
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
74
77
|
"data-testid": "base-container",
|
|
75
78
|
"data-execution-status": executionStatus,
|
|
76
79
|
"data-interaction-state": interactionState,
|
|
@@ -82,7 +85,17 @@ const BaseContainer = ({ isSelected, isHovered, isStacked, shape, interactionSta
|
|
|
82
85
|
background
|
|
83
86
|
} : void 0,
|
|
84
87
|
"aria-busy": loading || void 0,
|
|
85
|
-
children:
|
|
88
|
+
children: [
|
|
89
|
+
(0, index_cjs_namespaceObject.isOutlineDrawnShape)(shape) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeOutline_cjs_namespaceObject.BaseNodeOutline, {
|
|
90
|
+
shape: shape,
|
|
91
|
+
isSelected: isSelected,
|
|
92
|
+
isHovered: isHovered,
|
|
93
|
+
isDragging: 'drag' === interactionState,
|
|
94
|
+
shadow: shadow,
|
|
95
|
+
status: activeStatus
|
|
96
|
+
}),
|
|
97
|
+
children
|
|
98
|
+
]
|
|
86
99
|
});
|
|
87
100
|
};
|
|
88
101
|
exports.BaseContainer = __webpack_exports__.BaseContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type NodeShape } from '../../schema';
|
|
2
2
|
import type { SuggestionType } from '../../types';
|
|
3
3
|
import type { ElementStatusValues } from '../../types/execution';
|
|
4
4
|
import type { ValidationErrorSeverity } from '../../types/validation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseNodeContainer.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNodeContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BaseNodeContainer.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNodeContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGtE,eAAO,MAAM,eAAe,GAC1B,SAAS,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,KACtE,MAuBF,CAAC;AAEF,UAAU,kBAAkB;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAC3C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,GAAI,qKAc3B,kBAAkB,4CAoEpB,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@uipath/apollo-wind";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
+
import { isOutlineDrawnShape, isWideNodeShape } from "../../schema/index.js";
|
|
5
|
+
import { BaseNodeOutline } from "./BaseNodeOutline.js";
|
|
4
6
|
const getStatusBorder = (status)=>{
|
|
5
7
|
switch(status){
|
|
6
8
|
case 'InProgress':
|
|
@@ -30,7 +32,8 @@ const BaseContainer = ({ isSelected, isHovered, isStacked, shape, interactionSta
|
|
|
30
32
|
const className = useMemo(()=>{
|
|
31
33
|
const statusBorder = getStatusBorder(activeStatus);
|
|
32
34
|
const hasStatusBorder = statusBorder.length > 0;
|
|
33
|
-
|
|
35
|
+
const drawnByOutline = isOutlineDrawnShape(shape);
|
|
36
|
+
return cn('relative flex items-center cursor-pointer', drawnByOutline ? 'bg-transparent border-0' : cn('bg-surface-overlay border border-border', 'pill' === shape ? 'rounded-full' : 'rounded-(--node-radius)'), 'w-(--node-w) h-(--node-h)', 'outline-offset-0 transition-[box-shadow,border-color] duration-150', shadow && !drawnByOutline && 'shadow-(--canvas-node-shadow-rest)', isWideNodeShape(shape) ? 'flex-row justify-start gap-3 p-(--node-gap)' : 'flex-col justify-center', hasFooter && 'flex-wrap', !drawnByOutline && statusBorder, shadow && !drawnByOutline && isHovered && 'shadow-(--canvas-node-shadow-hover)', isHovered && !hasStatusBorder && !drawnByOutline && 'border-border-hover', isSelected && !drawnByOutline && 'outline outline-2 outline-foreground-accent-muted', 'disabled' === interactionState && 'opacity-50 cursor-not-allowed', 'drag' === interactionState && cn('cursor-grabbing', shadow && !drawnByOutline && 'shadow-(--canvas-node-shadow-lifted)'), isStacked && 'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-full before:rounded-[inherit] before:bg-surface-overlay before:border before:border-brand before:translate-y-[6px] before:-z-10 before:pointer-events-none');
|
|
34
37
|
}, [
|
|
35
38
|
shape,
|
|
36
39
|
hasFooter,
|
|
@@ -41,7 +44,7 @@ const BaseContainer = ({ isSelected, isHovered, isStacked, shape, interactionSta
|
|
|
41
44
|
interactionState,
|
|
42
45
|
shadow
|
|
43
46
|
]);
|
|
44
|
-
return /*#__PURE__*/
|
|
47
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
45
48
|
"data-testid": "base-container",
|
|
46
49
|
"data-execution-status": executionStatus,
|
|
47
50
|
"data-interaction-state": interactionState,
|
|
@@ -53,7 +56,17 @@ const BaseContainer = ({ isSelected, isHovered, isStacked, shape, interactionSta
|
|
|
53
56
|
background
|
|
54
57
|
} : void 0,
|
|
55
58
|
"aria-busy": loading || void 0,
|
|
56
|
-
children:
|
|
59
|
+
children: [
|
|
60
|
+
isOutlineDrawnShape(shape) && /*#__PURE__*/ jsx(BaseNodeOutline, {
|
|
61
|
+
shape: shape,
|
|
62
|
+
isSelected: isSelected,
|
|
63
|
+
isHovered: isHovered,
|
|
64
|
+
isDragging: 'drag' === interactionState,
|
|
65
|
+
shadow: shadow,
|
|
66
|
+
status: activeStatus
|
|
67
|
+
}),
|
|
68
|
+
children
|
|
69
|
+
]
|
|
57
70
|
});
|
|
58
71
|
};
|
|
59
72
|
export { BaseContainer, getStatusBorder };
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
pathFor: ()=>pathFor,
|
|
28
|
+
BaseNodeOutline: ()=>BaseNodeOutline,
|
|
29
|
+
getStatusStroke: ()=>getStatusStroke
|
|
30
|
+
});
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
|
+
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
35
|
+
const EDGE = 0.5;
|
|
36
|
+
const CUT_RATIO = 0.32;
|
|
37
|
+
const WAVE_RATIO = 0.16;
|
|
38
|
+
const pathFor = (shape, width, height)=>{
|
|
39
|
+
const right = width - EDGE;
|
|
40
|
+
const bottom = height - EDGE;
|
|
41
|
+
if ('clipped' === shape) {
|
|
42
|
+
const cut = Math.min(height * CUT_RATIO, 18);
|
|
43
|
+
return `M${cut} ${EDGE} H${right} V${bottom - cut} L${right - cut} ${bottom} H${EDGE} V${cut} Z`;
|
|
44
|
+
}
|
|
45
|
+
const wave = Math.min(height * WAVE_RATIO, 14);
|
|
46
|
+
const crest = bottom - wave;
|
|
47
|
+
return [
|
|
48
|
+
`M${EDGE} ${EDGE}`,
|
|
49
|
+
`H${right}`,
|
|
50
|
+
`V${crest}`,
|
|
51
|
+
`C${0.66 * width} ${crest} ${0.45 * width} ${bottom} ${0.2 * width} ${bottom}`,
|
|
52
|
+
`C${0.1 * width} ${bottom} ${0.04 * width} ${bottom - 0.5 * wave} ${EDGE} ${bottom - 0.8 * wave}`,
|
|
53
|
+
'Z'
|
|
54
|
+
].join(' ');
|
|
55
|
+
};
|
|
56
|
+
const getStatusStroke = (status)=>{
|
|
57
|
+
switch(status){
|
|
58
|
+
case 'InProgress':
|
|
59
|
+
return 'stroke-info animate-glow [--glow-color:var(--info)]';
|
|
60
|
+
case 'Completed':
|
|
61
|
+
case 'add':
|
|
62
|
+
return 'stroke-success';
|
|
63
|
+
case 'ActionNeeded':
|
|
64
|
+
case 'Paused':
|
|
65
|
+
case 'Warning':
|
|
66
|
+
case 'WARNING':
|
|
67
|
+
case 'update':
|
|
68
|
+
return 'stroke-warning animate-glow [--glow-color:var(--warning)]';
|
|
69
|
+
case 'Cancelled':
|
|
70
|
+
case 'Failed':
|
|
71
|
+
case 'Terminated':
|
|
72
|
+
case 'ERROR':
|
|
73
|
+
case 'CRITICAL':
|
|
74
|
+
case 'delete':
|
|
75
|
+
return 'stroke-error animate-glow [--glow-color:var(--error)]';
|
|
76
|
+
default:
|
|
77
|
+
return '';
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const outlineShadow = (isDragging, isHovered)=>{
|
|
81
|
+
if (isDragging) return '[filter:var(--canvas-node-filter-lifted)]';
|
|
82
|
+
return isHovered ? '[filter:var(--canvas-node-filter-hover)]' : '[filter:var(--canvas-node-filter-rest)]';
|
|
83
|
+
};
|
|
84
|
+
const BaseNodeOutline = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ shape, isSelected, isHovered, isDragging, shadow, status })=>{
|
|
85
|
+
const ref = (0, external_react_namespaceObject.useRef)(null);
|
|
86
|
+
const [box, setBox] = (0, external_react_namespaceObject.useState)({
|
|
87
|
+
width: external_constants_cjs_namespaceObject.DEFAULT_RECTANGLE_NODE_WIDTH,
|
|
88
|
+
height: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE
|
|
89
|
+
});
|
|
90
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
91
|
+
const element = ref.current;
|
|
92
|
+
if (!element) return;
|
|
93
|
+
const measure = ()=>{
|
|
94
|
+
const { clientWidth, clientHeight } = element;
|
|
95
|
+
if (clientWidth > 0 && clientHeight > 0) setBox({
|
|
96
|
+
width: clientWidth,
|
|
97
|
+
height: clientHeight
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
measure();
|
|
101
|
+
if ("u" < typeof ResizeObserver) return;
|
|
102
|
+
const observer = new ResizeObserver(measure);
|
|
103
|
+
observer.observe(element);
|
|
104
|
+
return ()=>observer.disconnect();
|
|
105
|
+
}, []);
|
|
106
|
+
const statusStroke = getStatusStroke(status);
|
|
107
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("svg", {
|
|
108
|
+
ref: ref,
|
|
109
|
+
"aria-hidden": true,
|
|
110
|
+
"data-testid": "base-node-outline",
|
|
111
|
+
className: (0, apollo_wind_namespaceObject.cn)('pointer-events-none absolute inset-0 -z-10 h-full w-full transition-[filter] duration-150', shadow && outlineShadow(isDragging, isHovered)),
|
|
112
|
+
viewBox: `0 0 ${box.width} ${box.height}`,
|
|
113
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
114
|
+
d: pathFor(shape, box.width, box.height),
|
|
115
|
+
className: (0, apollo_wind_namespaceObject.cn)('fill-surface-overlay transition-[stroke,stroke-width] duration-150', statusStroke || (isSelected ? 'stroke-foreground-accent-muted' : isHovered ? 'stroke-border-hover' : 'stroke-border')),
|
|
116
|
+
strokeWidth: isSelected ? 2 : 1
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
BaseNodeOutline.displayName = 'BaseNodeOutline';
|
|
121
|
+
exports.BaseNodeOutline = __webpack_exports__.BaseNodeOutline;
|
|
122
|
+
exports.getStatusStroke = __webpack_exports__.getStatusStroke;
|
|
123
|
+
exports.pathFor = __webpack_exports__.pathFor;
|
|
124
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
125
|
+
"BaseNodeOutline",
|
|
126
|
+
"getStatusStroke",
|
|
127
|
+
"pathFor"
|
|
128
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
129
|
+
Object.defineProperty(exports, '__esModule', {
|
|
130
|
+
value: true
|
|
131
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OutlineDrawnNodeShape } from '../../schema';
|
|
2
|
+
import type { SuggestionType } from '../../types';
|
|
3
|
+
import type { ElementStatusValues } from '../../types/execution';
|
|
4
|
+
import type { ValidationErrorSeverity } from '../../types/validation';
|
|
5
|
+
export declare const pathFor: (shape: OutlineDrawnNodeShape, width: number, height: number) => string;
|
|
6
|
+
export declare const getStatusStroke: (status?: ElementStatusValues | ValidationErrorSeverity | SuggestionType) => string;
|
|
7
|
+
interface BaseNodeOutlineProps {
|
|
8
|
+
shape: OutlineDrawnNodeShape;
|
|
9
|
+
isSelected?: boolean;
|
|
10
|
+
isHovered?: boolean;
|
|
11
|
+
isDragging?: boolean;
|
|
12
|
+
shadow?: boolean;
|
|
13
|
+
status?: ElementStatusValues | ValidationErrorSeverity | SuggestionType;
|
|
14
|
+
}
|
|
15
|
+
export declare const BaseNodeOutline: import("react").MemoExoticComponent<({ shape, isSelected, isHovered, isDragging, shadow, status }: BaseNodeOutlineProps) => import("react/jsx-runtime").JSX.Element>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=BaseNodeOutline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseNodeOutline.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNodeOutline.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAoBtE,eAAO,MAAM,OAAO,GAAI,OAAO,qBAAqB,EAAE,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAG,MAyBrF,CAAC;AAGF,eAAO,MAAM,eAAe,GAC1B,SAAS,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,KACtE,MAuBF,CAAC;AAgBF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,CAAC;CACzE;AAUD,eAAO,MAAM,eAAe,qGACqC,oBAAoB,6CA0DpF,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { memo, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { DEFAULT_NODE_SIZE, DEFAULT_RECTANGLE_NODE_WIDTH } from "../../constants.js";
|
|
5
|
+
const EDGE = 0.5;
|
|
6
|
+
const CUT_RATIO = 0.32;
|
|
7
|
+
const WAVE_RATIO = 0.16;
|
|
8
|
+
const pathFor = (shape, width, height)=>{
|
|
9
|
+
const right = width - EDGE;
|
|
10
|
+
const bottom = height - EDGE;
|
|
11
|
+
if ('clipped' === shape) {
|
|
12
|
+
const cut = Math.min(height * CUT_RATIO, 18);
|
|
13
|
+
return `M${cut} ${EDGE} H${right} V${bottom - cut} L${right - cut} ${bottom} H${EDGE} V${cut} Z`;
|
|
14
|
+
}
|
|
15
|
+
const wave = Math.min(height * WAVE_RATIO, 14);
|
|
16
|
+
const crest = bottom - wave;
|
|
17
|
+
return [
|
|
18
|
+
`M${EDGE} ${EDGE}`,
|
|
19
|
+
`H${right}`,
|
|
20
|
+
`V${crest}`,
|
|
21
|
+
`C${0.66 * width} ${crest} ${0.45 * width} ${bottom} ${0.2 * width} ${bottom}`,
|
|
22
|
+
`C${0.1 * width} ${bottom} ${0.04 * width} ${bottom - 0.5 * wave} ${EDGE} ${bottom - 0.8 * wave}`,
|
|
23
|
+
'Z'
|
|
24
|
+
].join(' ');
|
|
25
|
+
};
|
|
26
|
+
const getStatusStroke = (status)=>{
|
|
27
|
+
switch(status){
|
|
28
|
+
case 'InProgress':
|
|
29
|
+
return 'stroke-info animate-glow [--glow-color:var(--info)]';
|
|
30
|
+
case 'Completed':
|
|
31
|
+
case 'add':
|
|
32
|
+
return 'stroke-success';
|
|
33
|
+
case 'ActionNeeded':
|
|
34
|
+
case 'Paused':
|
|
35
|
+
case 'Warning':
|
|
36
|
+
case 'WARNING':
|
|
37
|
+
case 'update':
|
|
38
|
+
return 'stroke-warning animate-glow [--glow-color:var(--warning)]';
|
|
39
|
+
case 'Cancelled':
|
|
40
|
+
case 'Failed':
|
|
41
|
+
case 'Terminated':
|
|
42
|
+
case 'ERROR':
|
|
43
|
+
case 'CRITICAL':
|
|
44
|
+
case 'delete':
|
|
45
|
+
return 'stroke-error animate-glow [--glow-color:var(--error)]';
|
|
46
|
+
default:
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const outlineShadow = (isDragging, isHovered)=>{
|
|
51
|
+
if (isDragging) return '[filter:var(--canvas-node-filter-lifted)]';
|
|
52
|
+
return isHovered ? '[filter:var(--canvas-node-filter-hover)]' : '[filter:var(--canvas-node-filter-rest)]';
|
|
53
|
+
};
|
|
54
|
+
const BaseNodeOutline = /*#__PURE__*/ memo(({ shape, isSelected, isHovered, isDragging, shadow, status })=>{
|
|
55
|
+
const ref = useRef(null);
|
|
56
|
+
const [box, setBox] = useState({
|
|
57
|
+
width: DEFAULT_RECTANGLE_NODE_WIDTH,
|
|
58
|
+
height: DEFAULT_NODE_SIZE
|
|
59
|
+
});
|
|
60
|
+
useEffect(()=>{
|
|
61
|
+
const element = ref.current;
|
|
62
|
+
if (!element) return;
|
|
63
|
+
const measure = ()=>{
|
|
64
|
+
const { clientWidth, clientHeight } = element;
|
|
65
|
+
if (clientWidth > 0 && clientHeight > 0) setBox({
|
|
66
|
+
width: clientWidth,
|
|
67
|
+
height: clientHeight
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
measure();
|
|
71
|
+
if ("u" < typeof ResizeObserver) return;
|
|
72
|
+
const observer = new ResizeObserver(measure);
|
|
73
|
+
observer.observe(element);
|
|
74
|
+
return ()=>observer.disconnect();
|
|
75
|
+
}, []);
|
|
76
|
+
const statusStroke = getStatusStroke(status);
|
|
77
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
78
|
+
ref: ref,
|
|
79
|
+
"aria-hidden": true,
|
|
80
|
+
"data-testid": "base-node-outline",
|
|
81
|
+
className: cn('pointer-events-none absolute inset-0 -z-10 h-full w-full transition-[filter] duration-150', shadow && outlineShadow(isDragging, isHovered)),
|
|
82
|
+
viewBox: `0 0 ${box.width} ${box.height}`,
|
|
83
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
84
|
+
d: pathFor(shape, box.width, box.height),
|
|
85
|
+
className: cn('fill-surface-overlay transition-[stroke,stroke-width] duration-150', statusStroke || (isSelected ? 'stroke-foreground-accent-muted' : isHovered ? 'stroke-border-hover' : 'stroke-border')),
|
|
86
|
+
strokeWidth: isSelected ? 2 : 1
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
BaseNodeOutline.displayName = 'BaseNodeOutline';
|
|
91
|
+
export { BaseNodeOutline, getStatusStroke, pathFor };
|
|
@@ -30,10 +30,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
30
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
31
|
const external_react_namespaceObject = require("react");
|
|
32
32
|
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
33
|
+
const index_cjs_namespaceObject = require("../../schema/index.cjs");
|
|
33
34
|
const CssUtil_cjs_namespaceObject = require("../../utils/CssUtil.cjs");
|
|
34
35
|
const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
|
|
35
36
|
const BaseTextContainer = ({ hasBottomHandles, shape, children })=>{
|
|
36
|
-
if (
|
|
37
|
+
if ((0, index_cjs_namespaceObject.isWideNodeShape)(shape)) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
37
38
|
"data-node-part": "label",
|
|
38
39
|
className: "flex flex-1 min-w-0 flex-col items-start text-left",
|
|
39
40
|
children: children
|
|
@@ -62,7 +63,7 @@ const Header = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ s
|
|
|
62
63
|
ref: ref,
|
|
63
64
|
"data-testid": dataTestId,
|
|
64
65
|
onDoubleClick: onDoubleClick,
|
|
65
|
-
className: (0, CssUtil_cjs_namespaceObject.cx)('text-center text-sm leading-[18px] font-semibold text-foreground overflow-hidden', backgroundColor && 'px-1.5 py-0.5 rounded-sm',
|
|
66
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('text-center text-sm leading-[18px] font-semibold text-foreground overflow-hidden', backgroundColor && 'px-1.5 py-0.5 rounded-sm', (0, index_cjs_namespaceObject.isWideNodeShape)(shape) ? 'w-full text-left whitespace-nowrap text-ellipsis' : 'wrap-break-word line-clamp-3', className),
|
|
66
67
|
style: {
|
|
67
68
|
...style,
|
|
68
69
|
...backgroundColor ? {
|
|
@@ -77,7 +78,7 @@ const SubHeader = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)((
|
|
|
77
78
|
ref: ref,
|
|
78
79
|
"data-testid": dataTestId,
|
|
79
80
|
onDoubleClick: onDoubleClick,
|
|
80
|
-
className: (0, CssUtil_cjs_namespaceObject.cx)('text-center text-xs leading-[18px] text-foreground-muted wrap-break-word overflow-hidden whitespace-pre-line',
|
|
81
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('text-center text-xs leading-[18px] text-foreground-muted wrap-break-word overflow-hidden whitespace-pre-line', (0, index_cjs_namespaceObject.isWideNodeShape)(shape) ? 'w-full text-left line-clamp-2' : 'line-clamp-5', className),
|
|
81
82
|
style: style,
|
|
82
83
|
children: children
|
|
83
84
|
}));
|
|
@@ -91,7 +92,7 @@ const EditableLabel = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
91
92
|
onChange: onChange,
|
|
92
93
|
onKeyDown: onKeyDown,
|
|
93
94
|
onBlur: onBlur,
|
|
94
|
-
className: (0, CssUtil_cjs_namespaceObject.cx)('nodrag nowheel resize-none font-[inherit] text-foreground border-none rounded-sm outline-1 outline-dashed outline-border-de-emp max-w-full px-1.5', 'subtext' === variant ? 'text-xs leading-[18px] font-normal mb-0' : 'text-sm leading-[18px] font-semibold mb-0.5',
|
|
95
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('nodrag nowheel resize-none font-[inherit] text-foreground border-none rounded-sm outline-1 outline-dashed outline-border-de-emp max-w-full px-1.5', 'subtext' === variant ? 'text-xs leading-[18px] font-normal mb-0' : 'text-sm leading-[18px] font-semibold mb-0.5', (0, index_cjs_namespaceObject.isWideNodeShape)(shape) ? 'field-sizing-fixed w-full' : 'field-sizing-content text-center', backgroundColor && 'py-0.5'),
|
|
95
96
|
style: backgroundColor ? {
|
|
96
97
|
backgroundColor
|
|
97
98
|
} : void 0
|
|
@@ -210,7 +211,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelPlaceholder = 'Name
|
|
|
210
211
|
});
|
|
211
212
|
const headerTooltipContent = labelTooltip ?? label;
|
|
212
213
|
const subHeaderTooltipContent = labelTooltip ?? subLabel;
|
|
213
|
-
const tooltipPlacement =
|
|
214
|
+
const tooltipPlacement = (0, index_cjs_namespaceObject.isWideNodeShape)(shape) ? 'top' : 'bottom';
|
|
214
215
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(BaseTextContainer, {
|
|
215
216
|
hasBottomHandles: hasBottomHandles,
|
|
216
217
|
shape: shape,
|
|
@@ -227,7 +228,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelPlaceholder = 'Name
|
|
|
227
228
|
variant: "normal",
|
|
228
229
|
backgroundColor: labelBackgroundColor,
|
|
229
230
|
placeholder: labelPlaceholder,
|
|
230
|
-
rows:
|
|
231
|
+
rows: (0, index_cjs_namespaceObject.isWideNodeShape)(shape) ? 1 : void 0,
|
|
231
232
|
"aria-label": "Edit node name"
|
|
232
233
|
}),
|
|
233
234
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EditableLabel, {
|
|
@@ -239,7 +240,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelPlaceholder = 'Name
|
|
|
239
240
|
shape: shape,
|
|
240
241
|
variant: "subtext",
|
|
241
242
|
placeholder: subLabelPlaceholder,
|
|
242
|
-
rows:
|
|
243
|
+
rows: (0, index_cjs_namespaceObject.isWideNodeShape)(shape) ? 2 : void 0,
|
|
243
244
|
"aria-label": "Edit node description"
|
|
244
245
|
})
|
|
245
246
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/NodeLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"NodeLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/NodeLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI/D,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,4CAwBxB,CAAC;AAyKF,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,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;IAEnB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClE;AAoMD,eAAO,MAAM,SAAS,kPAnLnB,cAAc,6CAmL+B,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, memo, useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { NODE_TEXT_BOTTOM_OFFSET, NODE_TEXT_BOTTOM_OFFSET_WITH_HANDLES } from "../../constants.js";
|
|
4
|
+
import { isWideNodeShape } from "../../schema/index.js";
|
|
4
5
|
import { cx } from "../../utils/CssUtil.js";
|
|
5
6
|
import { CanvasTooltip } from "../CanvasTooltip.js";
|
|
6
7
|
const BaseTextContainer = ({ hasBottomHandles, shape, children })=>{
|
|
7
|
-
if (
|
|
8
|
+
if (isWideNodeShape(shape)) return /*#__PURE__*/ jsx("div", {
|
|
8
9
|
"data-node-part": "label",
|
|
9
10
|
className: "flex flex-1 min-w-0 flex-col items-start text-left",
|
|
10
11
|
children: children
|
|
@@ -33,7 +34,7 @@ const Header = /*#__PURE__*/ forwardRef(({ shape, backgroundColor, onDoubleClick
|
|
|
33
34
|
ref: ref,
|
|
34
35
|
"data-testid": dataTestId,
|
|
35
36
|
onDoubleClick: onDoubleClick,
|
|
36
|
-
className: cx('text-center text-sm leading-[18px] font-semibold text-foreground overflow-hidden', backgroundColor && 'px-1.5 py-0.5 rounded-sm',
|
|
37
|
+
className: cx('text-center text-sm leading-[18px] font-semibold text-foreground overflow-hidden', backgroundColor && 'px-1.5 py-0.5 rounded-sm', isWideNodeShape(shape) ? 'w-full text-left whitespace-nowrap text-ellipsis' : 'wrap-break-word line-clamp-3', className),
|
|
37
38
|
style: {
|
|
38
39
|
...style,
|
|
39
40
|
...backgroundColor ? {
|
|
@@ -48,7 +49,7 @@ const SubHeader = /*#__PURE__*/ forwardRef(({ shape, onDoubleClick, children, cl
|
|
|
48
49
|
ref: ref,
|
|
49
50
|
"data-testid": dataTestId,
|
|
50
51
|
onDoubleClick: onDoubleClick,
|
|
51
|
-
className: cx('text-center text-xs leading-[18px] text-foreground-muted wrap-break-word overflow-hidden whitespace-pre-line',
|
|
52
|
+
className: cx('text-center text-xs leading-[18px] text-foreground-muted wrap-break-word overflow-hidden whitespace-pre-line', isWideNodeShape(shape) ? 'w-full text-left line-clamp-2' : 'line-clamp-5', className),
|
|
52
53
|
style: style,
|
|
53
54
|
children: children
|
|
54
55
|
}));
|
|
@@ -62,7 +63,7 @@ const EditableLabel = /*#__PURE__*/ forwardRef(({ shape, backgroundColor, varian
|
|
|
62
63
|
onChange: onChange,
|
|
63
64
|
onKeyDown: onKeyDown,
|
|
64
65
|
onBlur: onBlur,
|
|
65
|
-
className: cx('nodrag nowheel resize-none font-[inherit] text-foreground border-none rounded-sm outline-1 outline-dashed outline-border-de-emp max-w-full px-1.5', 'subtext' === variant ? 'text-xs leading-[18px] font-normal mb-0' : 'text-sm leading-[18px] font-semibold mb-0.5',
|
|
66
|
+
className: cx('nodrag nowheel resize-none font-[inherit] text-foreground border-none rounded-sm outline-1 outline-dashed outline-border-de-emp max-w-full px-1.5', 'subtext' === variant ? 'text-xs leading-[18px] font-normal mb-0' : 'text-sm leading-[18px] font-semibold mb-0.5', isWideNodeShape(shape) ? 'field-sizing-fixed w-full' : 'field-sizing-content text-center', backgroundColor && 'py-0.5'),
|
|
66
67
|
style: backgroundColor ? {
|
|
67
68
|
backgroundColor
|
|
68
69
|
} : void 0
|
|
@@ -181,7 +182,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelPlaceholder = 'Name
|
|
|
181
182
|
});
|
|
182
183
|
const headerTooltipContent = labelTooltip ?? label;
|
|
183
184
|
const subHeaderTooltipContent = labelTooltip ?? subLabel;
|
|
184
|
-
const tooltipPlacement =
|
|
185
|
+
const tooltipPlacement = isWideNodeShape(shape) ? 'top' : 'bottom';
|
|
185
186
|
return /*#__PURE__*/ jsxs(BaseTextContainer, {
|
|
186
187
|
hasBottomHandles: hasBottomHandles,
|
|
187
188
|
shape: shape,
|
|
@@ -198,7 +199,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelPlaceholder = 'Name
|
|
|
198
199
|
variant: "normal",
|
|
199
200
|
backgroundColor: labelBackgroundColor,
|
|
200
201
|
placeholder: labelPlaceholder,
|
|
201
|
-
rows:
|
|
202
|
+
rows: isWideNodeShape(shape) ? 1 : void 0,
|
|
202
203
|
"aria-label": "Edit node name"
|
|
203
204
|
}),
|
|
204
205
|
/*#__PURE__*/ jsx(EditableLabel, {
|
|
@@ -210,7 +211,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelPlaceholder = 'Name
|
|
|
210
211
|
shape: shape,
|
|
211
212
|
variant: "subtext",
|
|
212
213
|
placeholder: subLabelPlaceholder,
|
|
213
|
-
rows:
|
|
214
|
+
rows: isWideNodeShape(shape) ? 2 : void 0,
|
|
214
215
|
"aria-label": "Edit node description"
|
|
215
216
|
})
|
|
216
217
|
]
|