@uipath/apollo-react 6.9.0 → 6.11.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/AlignmentGuides/AlignmentGuides.types.cjs +18 -0
- package/dist/canvas/components/AlignmentGuides/AlignmentGuides.types.d.ts +21 -0
- package/dist/canvas/components/AlignmentGuides/AlignmentGuides.types.d.ts.map +1 -0
- package/dist/canvas/components/AlignmentGuides/AlignmentGuides.types.js +0 -0
- package/dist/canvas/components/AlignmentGuides/AlignmentGuidesOverlay.cjs +75 -0
- package/dist/canvas/components/AlignmentGuides/AlignmentGuidesOverlay.d.ts +7 -0
- package/dist/canvas/components/AlignmentGuides/AlignmentGuidesOverlay.d.ts.map +1 -0
- package/dist/canvas/components/AlignmentGuides/AlignmentGuidesOverlay.js +41 -0
- package/dist/canvas/components/AlignmentGuides/index.cjs +72 -0
- package/dist/canvas/components/AlignmentGuides/index.d.ts +4 -0
- package/dist/canvas/components/AlignmentGuides/index.d.ts.map +1 -0
- package/dist/canvas/components/AlignmentGuides/index.js +3 -0
- package/dist/canvas/components/AlignmentGuides/useAlignmentGuides.cjs +256 -0
- package/dist/canvas/components/AlignmentGuides/useAlignmentGuides.d.ts +35 -0
- package/dist/canvas/components/AlignmentGuides/useAlignmentGuides.d.ts.map +1 -0
- package/dist/canvas/components/AlignmentGuides/useAlignmentGuides.js +204 -0
- package/dist/canvas/components/NodePropertyPanel/ExpressionField.cjs +2 -2
- package/dist/canvas/components/NodePropertyPanel/ExpressionField.js +2 -2
- package/dist/canvas/components/NodePropertyPanel/NodePropertyPanel.cjs +2 -2
- package/dist/canvas/components/NodePropertyPanel/NodePropertyPanel.d.ts.map +1 -1
- package/dist/canvas/components/NodePropertyPanel/NodePropertyPanel.js +2 -2
- package/dist/canvas/components/NodePropertyPanel/PanelField.cjs +95 -0
- package/dist/canvas/components/NodePropertyPanel/PanelField.d.ts +23 -0
- package/dist/canvas/components/NodePropertyPanel/PanelField.d.ts.map +1 -0
- package/dist/canvas/components/NodePropertyPanel/PanelField.js +58 -0
- package/dist/canvas/components/NodePropertyPanel/index.cjs +8 -1
- package/dist/canvas/components/NodePropertyPanel/index.d.ts +2 -0
- package/dist/canvas/components/NodePropertyPanel/index.d.ts.map +1 -1
- package/dist/canvas/components/NodePropertyPanel/index.js +2 -1
- package/dist/canvas/components/index.cjs +65 -58
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { useViewport } from "../../xyflow/react.js";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { DEFAULT_NODE_SIZE } from "../../constants.js";
|
|
4
|
+
import { getAbsolutePosition } from "../../utils/NodeUtils.js";
|
|
5
|
+
function toBounds(node, allNodes = [
|
|
6
|
+
node
|
|
7
|
+
]) {
|
|
8
|
+
const width = node.measured?.width ?? node.width ?? DEFAULT_NODE_SIZE;
|
|
9
|
+
const height = node.measured?.height ?? node.height ?? DEFAULT_NODE_SIZE;
|
|
10
|
+
const absolutePosition = node.internals?.positionAbsolute ?? (node.parentId ? getAbsolutePosition(node, allNodes) : node.position);
|
|
11
|
+
const x1 = absolutePosition.x;
|
|
12
|
+
const y1 = absolutePosition.y;
|
|
13
|
+
const x2 = x1 + width;
|
|
14
|
+
const y2 = y1 + height;
|
|
15
|
+
return {
|
|
16
|
+
id: node.id,
|
|
17
|
+
x1,
|
|
18
|
+
y1,
|
|
19
|
+
x2,
|
|
20
|
+
y2,
|
|
21
|
+
cx: (x1 + x2) / 2,
|
|
22
|
+
cy: (y1 + y2) / 2
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function getAxisAnchors(bounds, orientation) {
|
|
26
|
+
return 'vertical' === orientation ? [
|
|
27
|
+
bounds.x1,
|
|
28
|
+
bounds.cx,
|
|
29
|
+
bounds.x2
|
|
30
|
+
] : [
|
|
31
|
+
bounds.y1,
|
|
32
|
+
bounds.cy,
|
|
33
|
+
bounds.y2
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
function resolveAxisCandidate(dragged, others, threshold, orientation) {
|
|
37
|
+
const draggedAnchors = getAxisAnchors(dragged, orientation);
|
|
38
|
+
const candidates = [];
|
|
39
|
+
for (const other of others){
|
|
40
|
+
const otherAnchors = getAxisAnchors(other, orientation);
|
|
41
|
+
candidates.push({
|
|
42
|
+
delta: otherAnchors[1] - draggedAnchors[1],
|
|
43
|
+
kind: 'center',
|
|
44
|
+
matchedNodeId: other.id,
|
|
45
|
+
position: otherAnchors[1],
|
|
46
|
+
priority: 0
|
|
47
|
+
});
|
|
48
|
+
for (const draggedIndex of [
|
|
49
|
+
0,
|
|
50
|
+
2
|
|
51
|
+
])for (const otherIndex of [
|
|
52
|
+
0,
|
|
53
|
+
2
|
|
54
|
+
])candidates.push({
|
|
55
|
+
delta: otherAnchors[otherIndex] - draggedAnchors[draggedIndex],
|
|
56
|
+
kind: 'edge',
|
|
57
|
+
matchedNodeId: other.id,
|
|
58
|
+
position: otherAnchors[otherIndex],
|
|
59
|
+
priority: draggedIndex === otherIndex ? 1 : 2
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return candidates.filter(({ delta })=>Math.abs(delta) <= threshold).sort((a, b)=>Math.abs(a.delta) - Math.abs(b.delta) || a.priority - b.priority || a.position - b.position || a.matchedNodeId.localeCompare(b.matchedNodeId))[0];
|
|
63
|
+
}
|
|
64
|
+
function buildGuide(candidate, dragged, others, orientation) {
|
|
65
|
+
const matchingOthers = others.filter((other)=>{
|
|
66
|
+
const anchors = getAxisAnchors(other, orientation);
|
|
67
|
+
const candidateAnchors = 'center' === candidate.kind ? [
|
|
68
|
+
anchors[1]
|
|
69
|
+
] : [
|
|
70
|
+
anchors[0],
|
|
71
|
+
anchors[2]
|
|
72
|
+
];
|
|
73
|
+
return candidateAnchors.some((anchor)=>Math.abs(anchor - candidate.position) < 0.5);
|
|
74
|
+
});
|
|
75
|
+
const ranges = [
|
|
76
|
+
dragged,
|
|
77
|
+
...matchingOthers
|
|
78
|
+
].map((bounds)=>'vertical' === orientation ? [
|
|
79
|
+
bounds.y1,
|
|
80
|
+
bounds.y2
|
|
81
|
+
] : [
|
|
82
|
+
bounds.x1,
|
|
83
|
+
bounds.x2
|
|
84
|
+
]);
|
|
85
|
+
return {
|
|
86
|
+
id: `${orientation}-${candidate.position}`,
|
|
87
|
+
orientation,
|
|
88
|
+
position: candidate.position,
|
|
89
|
+
start: Math.min(...ranges.map(([rangeStart])=>rangeStart)),
|
|
90
|
+
end: Math.max(...ranges.map(([, rangeEnd])=>rangeEnd)),
|
|
91
|
+
kind: candidate.kind,
|
|
92
|
+
matchedNodeIds: matchingOthers.map(({ id })=>id)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function computeAlignmentResult(dragged, others, threshold) {
|
|
96
|
+
const vertical = resolveAxisCandidate(dragged, others, threshold, 'vertical');
|
|
97
|
+
const horizontal = resolveAxisCandidate(dragged, others, threshold, 'horizontal');
|
|
98
|
+
const delta = {
|
|
99
|
+
dx: vertical?.delta ?? 0,
|
|
100
|
+
dy: horizontal?.delta ?? 0
|
|
101
|
+
};
|
|
102
|
+
const snapped = {
|
|
103
|
+
...dragged,
|
|
104
|
+
x1: dragged.x1 + delta.dx,
|
|
105
|
+
x2: dragged.x2 + delta.dx,
|
|
106
|
+
cx: dragged.cx + delta.dx,
|
|
107
|
+
y1: dragged.y1 + delta.dy,
|
|
108
|
+
y2: dragged.y2 + delta.dy,
|
|
109
|
+
cy: dragged.cy + delta.dy
|
|
110
|
+
};
|
|
111
|
+
const guides = [
|
|
112
|
+
...vertical ? [
|
|
113
|
+
buildGuide(vertical, snapped, others, 'vertical')
|
|
114
|
+
] : [],
|
|
115
|
+
...horizontal ? [
|
|
116
|
+
buildGuide(horizontal, snapped, others, 'horizontal')
|
|
117
|
+
] : []
|
|
118
|
+
];
|
|
119
|
+
return {
|
|
120
|
+
guides,
|
|
121
|
+
delta
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function computeAlignmentGuides(dragged, others, threshold) {
|
|
125
|
+
return computeAlignmentResult(dragged, others, threshold).guides;
|
|
126
|
+
}
|
|
127
|
+
function computeAlignmentSnapDelta(dragged, others, threshold) {
|
|
128
|
+
return computeAlignmentResult(dragged, others, threshold).delta;
|
|
129
|
+
}
|
|
130
|
+
function toGroupBounds(nodes, allNodes = nodes) {
|
|
131
|
+
const bounds = nodes.map((node)=>toBounds(node, allNodes));
|
|
132
|
+
const x1 = Math.min(...bounds.map((item)=>item.x1));
|
|
133
|
+
const y1 = Math.min(...bounds.map((item)=>item.y1));
|
|
134
|
+
const x2 = Math.max(...bounds.map((item)=>item.x2));
|
|
135
|
+
const y2 = Math.max(...bounds.map((item)=>item.y2));
|
|
136
|
+
return {
|
|
137
|
+
id: bounds.map(({ id })=>id).join(','),
|
|
138
|
+
x1,
|
|
139
|
+
y1,
|
|
140
|
+
x2,
|
|
141
|
+
y2,
|
|
142
|
+
cx: (x1 + x2) / 2,
|
|
143
|
+
cy: (y1 + y2) / 2
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function createAlignmentPositionUpdates(nodes, delta) {
|
|
147
|
+
return nodes.map(({ id, position })=>({
|
|
148
|
+
id,
|
|
149
|
+
position: {
|
|
150
|
+
x: position.x + delta.dx,
|
|
151
|
+
y: position.y + delta.dy
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
function useAlignmentGuides(nodes, options = {}) {
|
|
156
|
+
const { thresholdPx = 8, onSnap } = options;
|
|
157
|
+
const { zoom } = useViewport();
|
|
158
|
+
const [guides, setGuides] = useState([]);
|
|
159
|
+
const [draggedBounds, setDraggedBounds] = useState(null);
|
|
160
|
+
const resolveDrag = useCallback((draggedNode, draggedNodes, showGuides)=>{
|
|
161
|
+
const activeNodes = draggedNodes.length > 0 ? draggedNodes : [
|
|
162
|
+
draggedNode
|
|
163
|
+
];
|
|
164
|
+
const activeIds = new Set(activeNodes.map(({ id })=>id));
|
|
165
|
+
const others = nodes.filter(({ id })=>!activeIds.has(id)).map((node)=>toBounds(node, nodes));
|
|
166
|
+
const activeBounds = toGroupBounds(activeNodes, nodes);
|
|
167
|
+
const result = computeAlignmentResult(activeBounds, others, thresholdPx / zoom);
|
|
168
|
+
setDraggedBounds(showGuides ? {
|
|
169
|
+
...activeBounds,
|
|
170
|
+
x1: activeBounds.x1 + result.delta.dx,
|
|
171
|
+
x2: activeBounds.x2 + result.delta.dx,
|
|
172
|
+
cx: activeBounds.cx + result.delta.dx,
|
|
173
|
+
y1: activeBounds.y1 + result.delta.dy,
|
|
174
|
+
y2: activeBounds.y2 + result.delta.dy,
|
|
175
|
+
cy: activeBounds.cy + result.delta.dy
|
|
176
|
+
} : null);
|
|
177
|
+
setGuides(showGuides ? result.guides : []);
|
|
178
|
+
if (!onSnap || 0 === result.delta.dx && 0 === result.delta.dy) return;
|
|
179
|
+
onSnap(createAlignmentPositionUpdates(activeNodes, result.delta));
|
|
180
|
+
}, [
|
|
181
|
+
nodes,
|
|
182
|
+
onSnap,
|
|
183
|
+
thresholdPx,
|
|
184
|
+
zoom
|
|
185
|
+
]);
|
|
186
|
+
const onNodeDrag = useCallback((_event, draggedNode, draggedNodes)=>resolveDrag(draggedNode, draggedNodes, true), [
|
|
187
|
+
resolveDrag
|
|
188
|
+
]);
|
|
189
|
+
const onNodeDragStop = useCallback((_event, draggedNode, draggedNodes)=>resolveDrag(draggedNode, draggedNodes, false), [
|
|
190
|
+
resolveDrag
|
|
191
|
+
]);
|
|
192
|
+
return useMemo(()=>({
|
|
193
|
+
guides,
|
|
194
|
+
draggedBounds,
|
|
195
|
+
onNodeDrag,
|
|
196
|
+
onNodeDragStop
|
|
197
|
+
}), [
|
|
198
|
+
guides,
|
|
199
|
+
draggedBounds,
|
|
200
|
+
onNodeDrag,
|
|
201
|
+
onNodeDragStop
|
|
202
|
+
]);
|
|
203
|
+
}
|
|
204
|
+
export { computeAlignmentGuides, computeAlignmentResult, computeAlignmentSnapDelta, createAlignmentPositionUpdates, toBounds, toGroupBounds, useAlignmentGuides };
|
|
@@ -32,13 +32,13 @@ function ExpressionField({ label, value, mode = 'expr', description, onModeChang
|
|
|
32
32
|
const expression = value ?? '';
|
|
33
33
|
const activeMode = mode;
|
|
34
34
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
35
|
-
className: "flex flex-col gap-
|
|
35
|
+
className: "flex flex-col gap-1.5",
|
|
36
36
|
children: [
|
|
37
37
|
label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
38
38
|
className: "flex items-center justify-between",
|
|
39
39
|
children: [
|
|
40
40
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
41
|
-
className: "text-xs font-medium text-foreground
|
|
41
|
+
className: "text-xs font-medium leading-4 text-foreground",
|
|
42
42
|
children: label
|
|
43
43
|
}),
|
|
44
44
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
@@ -4,13 +4,13 @@ function ExpressionField({ label, value, mode = 'expr', description, onModeChang
|
|
|
4
4
|
const expression = value ?? '';
|
|
5
5
|
const activeMode = mode;
|
|
6
6
|
return /*#__PURE__*/ jsxs("div", {
|
|
7
|
-
className: "flex flex-col gap-
|
|
7
|
+
className: "flex flex-col gap-1.5",
|
|
8
8
|
children: [
|
|
9
9
|
label && /*#__PURE__*/ jsxs("div", {
|
|
10
10
|
className: "flex items-center justify-between",
|
|
11
11
|
children: [
|
|
12
12
|
/*#__PURE__*/ jsx("span", {
|
|
13
|
-
className: "text-xs font-medium text-foreground
|
|
13
|
+
className: "text-xs font-medium leading-4 text-foreground",
|
|
14
14
|
children: label
|
|
15
15
|
}),
|
|
16
16
|
/*#__PURE__*/ jsxs("div", {
|
|
@@ -118,7 +118,7 @@ function NodePropertyPanel({ panelTitle, onClose, nodeIcon, nodeLabel, nodeCateg
|
|
|
118
118
|
}) : formSchema ? formSchema.steps ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
119
119
|
className: "flex min-h-0 flex-1 flex-col",
|
|
120
120
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
121
|
-
className: (0, apollo_wind_namespaceObject.cn)(
|
|
121
|
+
className: (0, apollo_wind_namespaceObject.cn)("flex min-h-0 flex-1 flex-col [&_[data-slot=form-description]]:text-xs [&_[data-slot=form-description]]:leading-4 [&_[data-slot=form-description]]:text-foreground-muted [&_[data-slot=form-label]]:text-xs [&_[data-slot=form-label]]:font-medium [&_[data-slot=form-label]]:leading-4 [&_[data-slot=form-label]]:text-foreground", SURFACE_REMAP),
|
|
122
122
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.MetadataForm, {
|
|
123
123
|
schema: formSchema,
|
|
124
124
|
plugins: plugins,
|
|
@@ -135,7 +135,7 @@ function NodePropertyPanel({ panelTitle, onClose, nodeIcon, nodeLabel, nodeCateg
|
|
|
135
135
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
136
136
|
className: "min-h-0 flex-1 overflow-auto",
|
|
137
137
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
138
|
-
className: (0, apollo_wind_namespaceObject.cn)(
|
|
138
|
+
className: (0, apollo_wind_namespaceObject.cn)("[&_[data-slot=form-description]]:text-xs [&_[data-slot=form-description]]:leading-4 [&_[data-slot=form-description]]:text-foreground-muted [&_[data-slot=form-label]]:text-xs [&_[data-slot=form-label]]:font-medium [&_[data-slot=form-label]]:leading-4 [&_[data-slot=form-label]]:text-foreground", SURFACE_REMAP),
|
|
139
139
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.MetadataForm, {
|
|
140
140
|
schema: formSchema,
|
|
141
141
|
plugins: plugins,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodePropertyPanel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/NodePropertyPanel/NodePropertyPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAmCxE,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,YAAuB,EACvB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"NodePropertyPanel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/NodePropertyPanel/NodePropertyPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAmCxE,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,YAAuB,EACvB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,YAAY,EACZ,kBAAkB,GACnB,EAAE,sBAAsB,2CAgIxB"}
|
|
@@ -90,7 +90,7 @@ function NodePropertyPanel({ panelTitle, onClose, nodeIcon, nodeLabel, nodeCateg
|
|
|
90
90
|
}) : formSchema ? formSchema.steps ? /*#__PURE__*/ jsx("div", {
|
|
91
91
|
className: "flex min-h-0 flex-1 flex-col",
|
|
92
92
|
children: /*#__PURE__*/ jsx("div", {
|
|
93
|
-
className: cn(
|
|
93
|
+
className: cn("flex min-h-0 flex-1 flex-col [&_[data-slot=form-description]]:text-xs [&_[data-slot=form-description]]:leading-4 [&_[data-slot=form-description]]:text-foreground-muted [&_[data-slot=form-label]]:text-xs [&_[data-slot=form-label]]:font-medium [&_[data-slot=form-label]]:leading-4 [&_[data-slot=form-label]]:text-foreground", SURFACE_REMAP),
|
|
94
94
|
children: /*#__PURE__*/ jsx(MetadataForm, {
|
|
95
95
|
schema: formSchema,
|
|
96
96
|
plugins: plugins,
|
|
@@ -107,7 +107,7 @@ function NodePropertyPanel({ panelTitle, onClose, nodeIcon, nodeLabel, nodeCateg
|
|
|
107
107
|
}) : /*#__PURE__*/ jsx("div", {
|
|
108
108
|
className: "min-h-0 flex-1 overflow-auto",
|
|
109
109
|
children: /*#__PURE__*/ jsx("div", {
|
|
110
|
-
className: cn(
|
|
110
|
+
className: cn("[&_[data-slot=form-description]]:text-xs [&_[data-slot=form-description]]:leading-4 [&_[data-slot=form-description]]:text-foreground-muted [&_[data-slot=form-label]]:text-xs [&_[data-slot=form-label]]:font-medium [&_[data-slot=form-label]]:leading-4 [&_[data-slot=form-label]]:text-foreground", SURFACE_REMAP),
|
|
111
111
|
children: /*#__PURE__*/ jsx(MetadataForm, {
|
|
112
112
|
schema: formSchema,
|
|
113
113
|
plugins: plugins,
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
PanelFieldLabel: ()=>PanelFieldLabel,
|
|
28
|
+
PanelField: ()=>PanelField
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const PanelFieldLabel = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ children, className, required = false, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.Label, {
|
|
34
|
+
ref: ref,
|
|
35
|
+
"data-slot": "panel-field-label",
|
|
36
|
+
className: (0, apollo_wind_namespaceObject.cn)('text-xs font-medium text-foreground', className),
|
|
37
|
+
...props,
|
|
38
|
+
children: [
|
|
39
|
+
children,
|
|
40
|
+
required && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
41
|
+
className: "ml-0.5 text-destructive",
|
|
42
|
+
children: "*"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}));
|
|
46
|
+
PanelFieldLabel.displayName = 'PanelFieldLabel';
|
|
47
|
+
function PanelField({ label, htmlFor, description, error, required = false, children, className }) {
|
|
48
|
+
const generatedId = (0, external_react_namespaceObject.useId)();
|
|
49
|
+
const controlId = htmlFor ?? children.props.id ?? generatedId;
|
|
50
|
+
const descriptionId = description ? `${controlId}-description` : void 0;
|
|
51
|
+
const errorId = error ? `${controlId}-error` : void 0;
|
|
52
|
+
const describedBy = [
|
|
53
|
+
children.props['aria-describedby'],
|
|
54
|
+
descriptionId,
|
|
55
|
+
errorId
|
|
56
|
+
].filter(Boolean).join(' ');
|
|
57
|
+
const control = /*#__PURE__*/ (0, external_react_namespaceObject.isValidElement)(children) ? /*#__PURE__*/ (0, external_react_namespaceObject.cloneElement)(children, {
|
|
58
|
+
id: controlId,
|
|
59
|
+
'aria-describedby': describedBy || void 0,
|
|
60
|
+
'aria-invalid': error ? true : children.props['aria-invalid']
|
|
61
|
+
}) : children;
|
|
62
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
63
|
+
className: (0, apollo_wind_namespaceObject.cn)('grid gap-1.5', className),
|
|
64
|
+
"data-slot": "panel-field",
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PanelFieldLabel, {
|
|
67
|
+
htmlFor: controlId,
|
|
68
|
+
required: required,
|
|
69
|
+
children: label
|
|
70
|
+
}),
|
|
71
|
+
control,
|
|
72
|
+
description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
73
|
+
id: descriptionId,
|
|
74
|
+
"data-slot": "panel-field-description",
|
|
75
|
+
className: "text-xs leading-4 text-foreground-muted",
|
|
76
|
+
children: description
|
|
77
|
+
}),
|
|
78
|
+
error && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
79
|
+
id: errorId,
|
|
80
|
+
"data-slot": "panel-field-error",
|
|
81
|
+
className: "text-xs leading-4 text-destructive",
|
|
82
|
+
children: error
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.PanelField = __webpack_exports__.PanelField;
|
|
88
|
+
exports.PanelFieldLabel = __webpack_exports__.PanelFieldLabel;
|
|
89
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
90
|
+
"PanelField",
|
|
91
|
+
"PanelFieldLabel"
|
|
92
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
93
|
+
Object.defineProperty(exports, '__esModule', {
|
|
94
|
+
value: true
|
|
95
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type LabelProps } from '@uipath/apollo-wind';
|
|
2
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
3
|
+
type PanelControlProps = {
|
|
4
|
+
id?: string;
|
|
5
|
+
'aria-describedby'?: string;
|
|
6
|
+
'aria-invalid'?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export interface PanelFieldProps {
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
htmlFor?: string;
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
error?: ReactNode;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
children: ReactElement<PanelControlProps>;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PanelFieldLabelProps extends LabelProps {
|
|
18
|
+
required?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const PanelFieldLabel: import("react").ForwardRefExoticComponent<PanelFieldLabelProps & import("react").RefAttributes<HTMLLabelElement>>;
|
|
21
|
+
export declare function PanelField({ label, htmlFor, description, error, required, children, className, }: PanelFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=PanelField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelField.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/NodePropertyPanel/PanelField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,KAAK,iBAAiB,GAAG;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,eAAe;IAE9B,KAAK,EAAE,SAAS,CAAC;IAEjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAqB,SAAQ,UAAU;IAEtD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAGD,eAAO,MAAM,eAAe,mHAY3B,CAAC;AASF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,OAAO,EACP,WAAW,EACX,KAAK,EACL,QAAgB,EAChB,QAAQ,EACR,SAAS,GACV,EAAE,eAAe,2CA0CjB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Label, cn } from "@uipath/apollo-wind";
|
|
3
|
+
import { cloneElement, forwardRef, isValidElement, useId } from "react";
|
|
4
|
+
const PanelFieldLabel = /*#__PURE__*/ forwardRef(({ children, className, required = false, ...props }, ref)=>/*#__PURE__*/ jsxs(Label, {
|
|
5
|
+
ref: ref,
|
|
6
|
+
"data-slot": "panel-field-label",
|
|
7
|
+
className: cn('text-xs font-medium text-foreground', className),
|
|
8
|
+
...props,
|
|
9
|
+
children: [
|
|
10
|
+
children,
|
|
11
|
+
required && /*#__PURE__*/ jsx("span", {
|
|
12
|
+
className: "ml-0.5 text-destructive",
|
|
13
|
+
children: "*"
|
|
14
|
+
})
|
|
15
|
+
]
|
|
16
|
+
}));
|
|
17
|
+
PanelFieldLabel.displayName = 'PanelFieldLabel';
|
|
18
|
+
function PanelField({ label, htmlFor, description, error, required = false, children, className }) {
|
|
19
|
+
const generatedId = useId();
|
|
20
|
+
const controlId = htmlFor ?? children.props.id ?? generatedId;
|
|
21
|
+
const descriptionId = description ? `${controlId}-description` : void 0;
|
|
22
|
+
const errorId = error ? `${controlId}-error` : void 0;
|
|
23
|
+
const describedBy = [
|
|
24
|
+
children.props['aria-describedby'],
|
|
25
|
+
descriptionId,
|
|
26
|
+
errorId
|
|
27
|
+
].filter(Boolean).join(' ');
|
|
28
|
+
const control = /*#__PURE__*/ isValidElement(children) ? /*#__PURE__*/ cloneElement(children, {
|
|
29
|
+
id: controlId,
|
|
30
|
+
'aria-describedby': describedBy || void 0,
|
|
31
|
+
'aria-invalid': error ? true : children.props['aria-invalid']
|
|
32
|
+
}) : children;
|
|
33
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
34
|
+
className: cn('grid gap-1.5', className),
|
|
35
|
+
"data-slot": "panel-field",
|
|
36
|
+
children: [
|
|
37
|
+
/*#__PURE__*/ jsx(PanelFieldLabel, {
|
|
38
|
+
htmlFor: controlId,
|
|
39
|
+
required: required,
|
|
40
|
+
children: label
|
|
41
|
+
}),
|
|
42
|
+
control,
|
|
43
|
+
description && /*#__PURE__*/ jsx("p", {
|
|
44
|
+
id: descriptionId,
|
|
45
|
+
"data-slot": "panel-field-description",
|
|
46
|
+
className: "text-xs leading-4 text-foreground-muted",
|
|
47
|
+
children: description
|
|
48
|
+
}),
|
|
49
|
+
error && /*#__PURE__*/ jsx("p", {
|
|
50
|
+
id: errorId,
|
|
51
|
+
"data-slot": "panel-field-error",
|
|
52
|
+
className: "text-xs leading-4 text-destructive",
|
|
53
|
+
children: error
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export { PanelField, PanelFieldLabel };
|
|
@@ -24,16 +24,23 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
PanelFieldLabel: ()=>external_PanelField_cjs_namespaceObject.PanelFieldLabel,
|
|
27
28
|
NodePropertyPanel: ()=>external_NodePropertyPanel_cjs_namespaceObject.NodePropertyPanel,
|
|
29
|
+
PanelField: ()=>external_PanelField_cjs_namespaceObject.PanelField,
|
|
28
30
|
ExpressionField: ()=>external_ExpressionField_cjs_namespaceObject.ExpressionField
|
|
29
31
|
});
|
|
30
32
|
const external_ExpressionField_cjs_namespaceObject = require("./ExpressionField.cjs");
|
|
31
33
|
const external_NodePropertyPanel_cjs_namespaceObject = require("./NodePropertyPanel.cjs");
|
|
34
|
+
const external_PanelField_cjs_namespaceObject = require("./PanelField.cjs");
|
|
32
35
|
exports.ExpressionField = __webpack_exports__.ExpressionField;
|
|
33
36
|
exports.NodePropertyPanel = __webpack_exports__.NodePropertyPanel;
|
|
37
|
+
exports.PanelField = __webpack_exports__.PanelField;
|
|
38
|
+
exports.PanelFieldLabel = __webpack_exports__.PanelFieldLabel;
|
|
34
39
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
35
40
|
"ExpressionField",
|
|
36
|
-
"NodePropertyPanel"
|
|
41
|
+
"NodePropertyPanel",
|
|
42
|
+
"PanelField",
|
|
43
|
+
"PanelFieldLabel"
|
|
37
44
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
38
45
|
Object.defineProperty(exports, '__esModule', {
|
|
39
46
|
value: true
|
|
@@ -2,4 +2,6 @@ export type { ExpressionFieldProps, ExpressionMode } from './ExpressionField';
|
|
|
2
2
|
export { ExpressionField } from './ExpressionField';
|
|
3
3
|
export { NodePropertyPanel } from './NodePropertyPanel';
|
|
4
4
|
export type { NodePropertyPanelProps } from './NodePropertyPanel.types';
|
|
5
|
+
export type { PanelFieldLabelProps, PanelFieldProps } from './PanelField';
|
|
6
|
+
export { PanelField, PanelFieldLabel } from './PanelField';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/NodePropertyPanel/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/NodePropertyPanel/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ExpressionField } from "./ExpressionField.js";
|
|
2
2
|
import { NodePropertyPanel } from "./NodePropertyPanel.js";
|
|
3
|
-
|
|
3
|
+
import { PanelField, PanelFieldLabel } from "./PanelField.js";
|
|
4
|
+
export { ExpressionField, NodePropertyPanel, PanelField, PanelFieldLabel };
|