@uipath/apollo-react 4.5.4-pr525.f7c19ae → 4.6.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.
Files changed (49) hide show
  1. package/dist/canvas/components/BaseNode/BaseNode.cjs +74 -55
  2. package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
  3. package/dist/canvas/components/BaseNode/BaseNode.js +69 -50
  4. package/dist/canvas/components/BaseNode/BaseNode.styles.cjs +410 -0
  5. package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts +75 -0
  6. package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts.map +1 -0
  7. package/dist/canvas/components/BaseNode/BaseNode.styles.js +342 -0
  8. package/dist/canvas/components/BaseNode/NodeLabel.cjs +18 -63
  9. package/dist/canvas/components/BaseNode/NodeLabel.d.ts +1 -8
  10. package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
  11. package/dist/canvas/components/BaseNode/NodeLabel.js +15 -57
  12. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +7 -4
  13. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
  14. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +7 -4
  15. package/dist/canvas/components/FloatingCanvasPanel/FloatingCanvasPanel.cjs +3 -2
  16. package/dist/canvas/components/FloatingCanvasPanel/FloatingCanvasPanel.d.ts +2 -1
  17. package/dist/canvas/components/FloatingCanvasPanel/FloatingCanvasPanel.d.ts.map +1 -1
  18. package/dist/canvas/components/FloatingCanvasPanel/FloatingCanvasPanel.js +3 -2
  19. package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.cjs +4 -2
  20. package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.d.ts +2 -1
  21. package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.d.ts.map +1 -1
  22. package/dist/canvas/components/FloatingCanvasPanel/useFloatingPosition.js +4 -2
  23. package/dist/canvas/constants.cjs +0 -60
  24. package/dist/canvas/constants.d.ts +0 -15
  25. package/dist/canvas/constants.d.ts.map +1 -1
  26. package/dist/canvas/constants.js +1 -16
  27. package/dist/canvas/index.cjs +35 -39
  28. package/dist/canvas/index.d.ts +0 -1
  29. package/dist/canvas/index.d.ts.map +1 -1
  30. package/dist/canvas/index.js +0 -1
  31. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  32. package/package.json +1 -1
  33. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.cjs +0 -67
  34. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts +0 -9
  35. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts.map +0 -1
  36. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.js +0 -33
  37. package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +0 -87
  38. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +0 -23
  39. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +0 -1
  40. package/dist/canvas/components/BaseNode/BaseNodeContainer.js +0 -50
  41. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.cjs +0 -65
  42. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts +0 -14
  43. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts.map +0 -1
  44. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.js +0 -31
  45. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.cjs +0 -67
  46. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts +0 -9
  47. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts.map +0 -1
  48. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.js +0 -33
  49. package/dist/canvas/styles/reactflow-reset.css +0 -12
@@ -0,0 +1,342 @@
1
+ import { css } from "@emotion/react";
2
+ import styled from "@emotion/styled";
3
+ import { Skeleton } from "@uipath/apollo-wind";
4
+ import { getExecutionStatusBorder, pulseAnimation } from "../../styles/execution-status.js";
5
+ const GRID_UNIT = 16;
6
+ const NODE_HEIGHT_DEFAULT = 6 * GRID_UNIT;
7
+ const NODE_HEIGHT_FOOTER_BUTTON = 9 * GRID_UNIT;
8
+ const NODE_HEIGHT_FOOTER_SINGLE = 10 * GRID_UNIT;
9
+ const NODE_HEIGHT_FOOTER_DOUBLE = 11 * GRID_UNIT;
10
+ const getIconDimensions = (shape, nodeHeight, nodeWidth)=>{
11
+ const height = nodeHeight ?? 96;
12
+ const width = nodeWidth ?? 96;
13
+ const widthDimension = height !== width && 'rectangle' === shape ? height : width;
14
+ const widthScaleFactor = widthDimension / 96;
15
+ const iconWidth = 72 * widthScaleFactor;
16
+ const heightScaleFactor = height / 96;
17
+ const isExpandable = height !== width && 'rectangle' !== shape;
18
+ const iconHeight = isExpandable ? 84 * heightScaleFactor : 72 * heightScaleFactor;
19
+ return {
20
+ iconWidth,
21
+ iconHeight
22
+ };
23
+ };
24
+ const getValidationStatusBorder = (validationStatus)=>{
25
+ switch(validationStatus){
26
+ case 'ERROR':
27
+ case 'CRITICAL':
28
+ return css`
29
+ border-color: var(--canvas-error-icon);
30
+ background: var(--canvas-error-background);
31
+ animation: ${pulseAnimation('--canvas-error-icon')} 2s infinite;
32
+ `;
33
+ default:
34
+ return null;
35
+ }
36
+ };
37
+ const getInteractionStateBorder = (interactionState)=>{
38
+ switch(interactionState){
39
+ case 'hover':
40
+ return css`
41
+ outline: 4px solid var(--canvas-secondary-focused);
42
+ `;
43
+ case 'disabled':
44
+ return css`
45
+ opacity: 0.5;
46
+ cursor: not-allowed;
47
+ `;
48
+ case 'drag':
49
+ return css`
50
+ cursor: grabbing;
51
+ opacity: 0.8;
52
+ `;
53
+ default:
54
+ return null;
55
+ }
56
+ };
57
+ const getSuggestionTypeBorder = (suggestionType)=>{
58
+ const borderColorVar = getSuggestionTypeBorderColorVar(suggestionType);
59
+ const backgroundColorVar = getSuggestionTypeBackgroundColorVar(suggestionType);
60
+ if (!borderColorVar || !backgroundColorVar) return null;
61
+ return css`
62
+ border-color: var(${borderColorVar});
63
+ background: var(${backgroundColorVar});
64
+ animation: ${pulseAnimation(borderColorVar)} 2s infinite;
65
+ `;
66
+ };
67
+ const getSuggestionTypeBorderColorVar = (suggestionType)=>{
68
+ switch(suggestionType){
69
+ case 'add':
70
+ return '--canvas-success-icon';
71
+ case 'update':
72
+ return '--canvas-warning-icon';
73
+ case 'delete':
74
+ return '--canvas-error-icon';
75
+ default:
76
+ return null;
77
+ }
78
+ };
79
+ const getSuggestionTypeBackgroundColorVar = (suggestionType)=>{
80
+ switch(suggestionType){
81
+ case 'add':
82
+ return '--canvas-success-background';
83
+ case 'update':
84
+ return '--canvas-warning-background';
85
+ case 'delete':
86
+ return '--canvas-error-background';
87
+ default:
88
+ return null;
89
+ }
90
+ };
91
+ const BaseContainer = styled.div`
92
+ position: relative;
93
+ width: ${({ shape, width })=>{
94
+ const defaultWidth = 'rectangle' === shape ? 288 : 96;
95
+ if (width && 96 !== width && 288 !== width) return `${width}px`;
96
+ return `${defaultWidth}px`;
97
+ }};
98
+ height: ${({ height, hasFooter, footerVariant })=>{
99
+ if (hasFooter) switch(footerVariant){
100
+ case 'button':
101
+ return `${NODE_HEIGHT_FOOTER_BUTTON}px`;
102
+ case 'single':
103
+ return `${NODE_HEIGHT_FOOTER_SINGLE}px`;
104
+ case 'double':
105
+ return `${NODE_HEIGHT_FOOTER_DOUBLE}px`;
106
+ default:
107
+ return 'auto';
108
+ }
109
+ return height ? `${height}px` : `${NODE_HEIGHT_DEFAULT}px`;
110
+ }};
111
+ background: ${({ backgroundColor })=>backgroundColor || 'var(--canvas-background)'};
112
+ border: 1.5px solid var(--canvas-border-de-emp);
113
+ border-radius: ${({ shape })=>{
114
+ if ('circle' === shape) return '50%';
115
+ return '16px';
116
+ }};
117
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
118
+ display: flex;
119
+ flex-direction: ${({ shape })=>'rectangle' === shape ? 'row' : 'column'};
120
+ flex-wrap: ${({ hasFooter })=>hasFooter ? 'wrap' : 'nowrap'};
121
+ align-items: center;
122
+ justify-content: ${({ shape })=>'rectangle' === shape ? 'flex-start' : 'center'};
123
+ gap: ${({ shape })=>'rectangle' === shape ? '12px' : '0'};
124
+ padding: ${({ shape, height, hasFooter })=>{
125
+ if ('rectangle' === shape) {
126
+ if (hasFooter) return '16px';
127
+ const scaleFactor = height ? height / 100 : 1;
128
+ return `${14 * scaleFactor}px`;
129
+ }
130
+ return '0';
131
+ }};
132
+ cursor: pointer;
133
+
134
+ ${({ executionStatus })=>getExecutionStatusBorder(executionStatus)}
135
+ ${({ validationStatus })=>getValidationStatusBorder(validationStatus)}
136
+ ${({ interactionState })=>getInteractionStateBorder(interactionState)}
137
+ ${({ suggestionType })=>getSuggestionTypeBorder(suggestionType)}
138
+
139
+ ${({ selected, suggestionType })=>{
140
+ if (selected && suggestionType) {
141
+ const borderColorVar = getSuggestionTypeBorderColorVar(suggestionType);
142
+ return css`
143
+ border-color: var(${borderColorVar});
144
+ outline: 4px solid color-mix(in srgb, var(${borderColorVar}) 40%, transparent);
145
+ `;
146
+ }
147
+ if (selected) return css`
148
+ border-color: var(--canvas-primary);
149
+ outline: 4px solid var(--canvas-secondary-pressed);
150
+ `;
151
+ return '';
152
+ }}
153
+ `;
154
+ const BaseIconWrapper = styled.div`
155
+ ${({ height, width, shape })=>{
156
+ const { iconWidth, iconHeight } = getIconDimensions(shape, height, width);
157
+ return css`
158
+ width: ${iconWidth}px;
159
+ height: ${iconHeight}px;
160
+ `;
161
+ }}
162
+ display: flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ color: ${({ color })=>color || 'var(--canvas-foreground)'};
166
+ background: ${({ backgroundColor })=>backgroundColor || 'var(--canvas-background-secondary)'};
167
+ border-radius: ${({ shape })=>{
168
+ if ('circle' === shape) return '50%';
169
+ return '8px';
170
+ }};
171
+
172
+ svg {
173
+ width: ${({ width })=>{
174
+ const scaleFactor = width ? width / 96 : 1;
175
+ return `${40 * scaleFactor}px`;
176
+ }};
177
+ height: ${({ height })=>{
178
+ const scaleFactor = height ? height / 96 : 1;
179
+ return `${40 * scaleFactor}px`;
180
+ }};
181
+ }
182
+
183
+ img {
184
+ width: ${({ width })=>{
185
+ const scaleFactor = width ? width / 96 : 1;
186
+ return `${40 * scaleFactor}px`;
187
+ }};
188
+ height: ${({ height })=>{
189
+ const scaleFactor = height ? height / 96 : 1;
190
+ return `${40 * scaleFactor}px`;
191
+ }};
192
+ object-fit: contain;
193
+ }
194
+ `;
195
+ const BaseTextContainer = styled.div`
196
+ ${({ shape, hasBottomHandles })=>'rectangle' === shape ? css`
197
+ flex: 1;
198
+ min-width: 0;
199
+ display: flex;
200
+ flex-direction: column;
201
+ align-items: flex-start;
202
+ text-align: left;
203
+ ` : css`
204
+ position: absolute;
205
+ bottom: ${hasBottomHandles ? '-40px' : '-8px'};
206
+ width: 150%;
207
+ left: 50%;
208
+ transform: translateX(-50%) translateY(100%);
209
+ display: flex;
210
+ flex-direction: column;
211
+ align-items: center;
212
+ text-align: center;
213
+ z-index: 10;
214
+ transition: transform 0.2s ease-in-out;
215
+
216
+ /* When there's a bottom handle, offset text to the right to avoid overlapping */
217
+ ${hasBottomHandles && css`
218
+ transform: translateX(20%) translateY(50%);
219
+ text-align: left;
220
+ `}
221
+ `}
222
+ `;
223
+ const BaseHeader = styled.div`
224
+ font-weight: 600;
225
+ font-size: 13px;
226
+ color: var(--canvas-foreground);
227
+ ${({ backgroundColor })=>backgroundColor && css`
228
+ background-color: ${backgroundColor};
229
+ padding: 2px 6px;
230
+ border-radius: 4px;
231
+ `}
232
+ line-height: 1.4;
233
+ margin-bottom: 2px;
234
+ overflow: hidden;
235
+ ${({ shape })=>'rectangle' === shape ? css`
236
+ width: 100%;
237
+ white-space: nowrap;
238
+ text-overflow: ellipsis;
239
+ ` : css`
240
+ word-break: break-word;
241
+ display: -webkit-box;
242
+ -webkit-box-orient: vertical;
243
+ -webkit-line-clamp: 3;
244
+ `}
245
+ `;
246
+ const BaseSubHeader = styled.div`
247
+ font-size: 11px;
248
+ color: var(--canvas-foreground-de-emp);
249
+ line-height: 1.3;
250
+ word-break: break-word;
251
+ overflow: hidden;
252
+ display: -webkit-box;
253
+ -webkit-box-orient: vertical;
254
+ ${({ shape })=>'rectangle' === shape ? css`
255
+ width: 100%;
256
+ -webkit-line-clamp: 2;
257
+ ` : css`
258
+ -webkit-line-clamp: 5;
259
+ `}
260
+ `;
261
+ const EditableLabel = styled.textarea`
262
+ resize: none;
263
+ field-sizing: ${({ shape })=>'rectangle' === shape ? 'fixed' : 'content'};
264
+ font-weight: ${({ variant })=>'subtext' === variant ? '400' : '600'};
265
+ font-size: ${({ variant })=>'subtext' === variant ? '11px' : '13px'};
266
+ line-height: ${({ variant })=>'subtext' === variant ? '1.3' : '1.4'};
267
+ font-family: inherit;
268
+ color: var(--canvas-foreground);
269
+ border: none;
270
+ border-radius: 4px;
271
+ outline: 1px dashed var(--canvas-border-de-emp);
272
+ margin-bottom: ${({ variant })=>'subtext' === variant ? 0 : '2px'};
273
+ max-width: 100%;
274
+
275
+ ${({ backgroundColor })=>backgroundColor ? css`
276
+ background-color: ${backgroundColor};
277
+ padding: 2px 6px;
278
+ ` : 'background-color: color-mix(in srgb, var(--canvas-background) 10%, transparent);'}
279
+
280
+ ${({ shape })=>'rectangle' === shape ? css`
281
+ width: 100%;
282
+ ` : css`
283
+ text-align: center;
284
+ `}
285
+ `;
286
+ const EmptyLabelPlaceholder = styled.div`
287
+ font-weight: 600;
288
+ font-size: 13px;
289
+ line-height: 1.4;
290
+ color: var(--canvas-foreground-de-emp);
291
+ background: transparent;
292
+ border: 1px dashed var(--canvas-border-de-emp);
293
+ border-radius: 4px;
294
+ cursor: pointer;
295
+ opacity: 0;
296
+ transition: opacity 0.2s ease;
297
+ min-width: 20px;
298
+ min-height: 20px;
299
+
300
+ &:hover {
301
+ opacity: 1;
302
+ background-color: color-mix(in srgb, var(--canvas-background) 10%, transparent);
303
+ }
304
+ `;
305
+ const BaseBadgeSlot = styled.div`
306
+ display: flex;
307
+ align-items: center;
308
+ justify-content: center;
309
+ width: 20px;
310
+ height: 20px;
311
+ background: transparent;
312
+ position: absolute;
313
+ ${({ position, shape })=>{
314
+ const offset = 'circle' === shape ? '12px' : '6px';
315
+ switch(position){
316
+ case 'top-left':
317
+ return `top: ${offset}; left: ${offset};`;
318
+ case 'top-right':
319
+ return `top: ${offset}; right: ${offset};`;
320
+ case 'bottom-left':
321
+ return `bottom: ${offset}; left: ${offset};`;
322
+ case 'bottom-right':
323
+ return `bottom: ${offset}; right: ${offset};`;
324
+ }
325
+ }}
326
+ `;
327
+ const BaseSkeletonIcon = styled(Skeleton, {
328
+ shouldForwardProp: (prop)=>'shape' !== prop && 'nodeHeight' !== prop && 'nodeWidth' !== prop
329
+ })`
330
+ flex-grow: 0;
331
+ flex-shrink: 0;
332
+ ${({ shape, nodeHeight, nodeWidth })=>{
333
+ const { iconWidth, iconHeight } = getIconDimensions(shape, nodeHeight, nodeWidth);
334
+ const isCircle = 'circle' === shape;
335
+ return css`
336
+ width: ${iconWidth}px;
337
+ height: ${iconHeight}px;
338
+ border-radius: ${isCircle ? '50%' : '8px'};
339
+ `;
340
+ }}
341
+ `;
342
+ export { BaseBadgeSlot, BaseContainer, BaseHeader, BaseIconWrapper, BaseSkeletonIcon, BaseSubHeader, BaseTextContainer, EditableLabel, EmptyLabelPlaceholder };
@@ -24,27 +24,12 @@ 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,
28
27
  NodeLabel: ()=>NodeLabel
29
28
  });
30
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
- const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
32
30
  const external_react_namespaceObject = require("react");
33
- const external_constants_cjs_namespaceObject = require("../../constants.cjs");
34
31
  const external_CanvasTooltip_cjs_namespaceObject = require("../CanvasTooltip.cjs");
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
- };
32
+ const external_BaseNode_styles_cjs_namespaceObject = require("./BaseNode.styles.cjs");
48
33
  const ConditionalTooltip = ({ content, children })=>{
49
34
  if (!content) return children;
50
35
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasTooltip_cjs_namespaceObject.CanvasTooltip, {
@@ -55,42 +40,6 @@ const ConditionalTooltip = ({ content, children })=>{
55
40
  children: children
56
41
  });
57
42
  };
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
- });
94
43
  const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackgroundColor, shape, hasBottomHandles, selected, dragging, centerAdornment, readonly, onChange })=>{
95
44
  const [isEditing, setIsEditing] = (0, external_react_namespaceObject.useState)(false);
96
45
  const [localLabel, setLocalLabel] = (0, external_react_namespaceObject.useState)('');
@@ -101,7 +50,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
101
50
  const handleSave = (0, external_react_namespaceObject.useCallback)(()=>{
102
51
  setIsEditing(false);
103
52
  setFocusTarget(null);
104
- if (localLabel !== label || localSubLabel !== subLabel) onChange?.({
53
+ if (localLabel !== label || localSubLabel !== subLabel) onChange({
105
54
  label: localLabel,
106
55
  subLabel: localSubLabel
107
56
  });
@@ -175,23 +124,27 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
175
124
  }, [
176
125
  handleSave
177
126
  ]);
178
- if (!label && !subLabel && !isEditing) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(BaseTextContainer, {
127
+ if (!label && !subLabel && !isEditing) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseTextContainer, {
179
128
  hasBottomHandles: hasBottomHandles,
180
129
  shape: shape,
181
130
  children: [
182
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyLabelPlaceholder, {
183
- onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef)
131
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.EmptyLabelPlaceholder, {
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"
184
137
  }),
185
138
  centerAdornment
186
139
  ]
187
140
  });
188
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(BaseTextContainer, {
141
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseTextContainer, {
189
142
  hasBottomHandles: hasBottomHandles,
190
143
  shape: shape,
191
144
  children: [
192
145
  isEditing ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
193
146
  children: [
194
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EditableLabel, {
147
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.EditableLabel, {
195
148
  ref: labelInputRef,
196
149
  value: localLabel,
197
150
  onChange: (e)=>setLocalLabel(e.target.value),
@@ -200,11 +153,13 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
200
153
  shape: shape,
201
154
  variant: "normal",
202
155
  backgroundColor: labelBackgroundColor,
156
+ className: "nodrag nowheel",
203
157
  placeholder: "Name",
204
158
  rows: 'rectangle' === shape ? 1 : void 0,
159
+ role: "textbox",
205
160
  "aria-label": "Edit node name"
206
161
  }),
207
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EditableLabel, {
162
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.EditableLabel, {
208
163
  ref: subLabelInputRef,
209
164
  value: localSubLabel,
210
165
  onChange: (e)=>setLocalSubLabel(e.target.value),
@@ -212,22 +167,24 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
212
167
  onBlur: handleBlur,
213
168
  shape: shape,
214
169
  variant: "subtext",
170
+ className: "nodrag nowheel",
215
171
  placeholder: "Description",
216
172
  rows: 'rectangle' === shape ? 2 : void 0,
173
+ role: "textbox",
217
174
  "aria-label": "Edit node description"
218
175
  })
219
176
  ]
220
177
  }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(ConditionalTooltip, {
221
178
  content: labelTooltip,
222
179
  children: [
223
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Header, {
180
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseHeader, {
224
181
  shape: shape,
225
182
  backgroundColor: labelBackgroundColor,
226
183
  onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef),
227
184
  "data-testid": "node-label",
228
185
  children: label
229
186
  }),
230
- subLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SubHeader, {
187
+ subLabel && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseSubHeader, {
231
188
  shape: shape,
232
189
  onDoubleClick: readonly ? void 0 : handleDoubleClick(subLabelInputRef),
233
190
  "data-testid": "node-sublabel",
@@ -240,10 +197,8 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
240
197
  });
241
198
  };
242
199
  const NodeLabel = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(NodeLabelInternal);
243
- exports.BaseTextContainer = __webpack_exports__.BaseTextContainer;
244
200
  exports.NodeLabel = __webpack_exports__.NodeLabel;
245
201
  for(var __rspack_i in __webpack_exports__)if (-1 === [
246
- "BaseTextContainer",
247
202
  "NodeLabel"
248
203
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
249
204
  Object.defineProperty(exports, '__esModule', {
@@ -1,10 +1,4 @@
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;
8
2
  export interface NodeLabelProps {
9
3
  label?: string;
10
4
  subLabel?: string;
@@ -16,11 +10,10 @@ export interface NodeLabelProps {
16
10
  dragging?: boolean;
17
11
  centerAdornment?: React.ReactNode;
18
12
  readonly?: boolean;
19
- onChange?: (values: {
13
+ onChange: (values: {
20
14
  label: string;
21
15
  subLabel: string;
22
16
  }) => void;
23
17
  }
24
18
  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 {};
26
19
  //# sourceMappingURL=NodeLabel.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"NodeLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/NodeLabel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9C,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,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACjE;AAwMD,eAAO,MAAM,SAAS,mLAzKnB,cAAc,6CAyK+B,CAAC"}
@@ -1,21 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
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";
2
+ import { memo, useCallback, useEffect, useRef, useState } from "react";
5
3
  import { CanvasTooltip } from "../CanvasTooltip.js";
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
- };
4
+ import { BaseHeader, BaseSubHeader, BaseTextContainer, EditableLabel, EmptyLabelPlaceholder } from "./BaseNode.styles.js";
19
5
  const ConditionalTooltip = ({ content, children })=>{
20
6
  if (!content) return children;
21
7
  return /*#__PURE__*/ jsx(CanvasTooltip, {
@@ -26,42 +12,6 @@ const ConditionalTooltip = ({ content, children })=>{
26
12
  children: children
27
13
  });
28
14
  };
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
- });
65
15
  const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackgroundColor, shape, hasBottomHandles, selected, dragging, centerAdornment, readonly, onChange })=>{
66
16
  const [isEditing, setIsEditing] = useState(false);
67
17
  const [localLabel, setLocalLabel] = useState('');
@@ -72,7 +22,7 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
72
22
  const handleSave = useCallback(()=>{
73
23
  setIsEditing(false);
74
24
  setFocusTarget(null);
75
- if (localLabel !== label || localSubLabel !== subLabel) onChange?.({
25
+ if (localLabel !== label || localSubLabel !== subLabel) onChange({
76
26
  label: localLabel,
77
27
  subLabel: localSubLabel
78
28
  });
@@ -151,7 +101,11 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
151
101
  shape: shape,
152
102
  children: [
153
103
  /*#__PURE__*/ jsx(EmptyLabelPlaceholder, {
154
- onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef)
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"
155
109
  }),
156
110
  centerAdornment
157
111
  ]
@@ -171,8 +125,10 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
171
125
  shape: shape,
172
126
  variant: "normal",
173
127
  backgroundColor: labelBackgroundColor,
128
+ className: "nodrag nowheel",
174
129
  placeholder: "Name",
175
130
  rows: 'rectangle' === shape ? 1 : void 0,
131
+ role: "textbox",
176
132
  "aria-label": "Edit node name"
177
133
  }),
178
134
  /*#__PURE__*/ jsx(EditableLabel, {
@@ -183,22 +139,24 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
183
139
  onBlur: handleBlur,
184
140
  shape: shape,
185
141
  variant: "subtext",
142
+ className: "nodrag nowheel",
186
143
  placeholder: "Description",
187
144
  rows: 'rectangle' === shape ? 2 : void 0,
145
+ role: "textbox",
188
146
  "aria-label": "Edit node description"
189
147
  })
190
148
  ]
191
149
  }) : /*#__PURE__*/ jsxs(ConditionalTooltip, {
192
150
  content: labelTooltip,
193
151
  children: [
194
- /*#__PURE__*/ jsx(Header, {
152
+ /*#__PURE__*/ jsx(BaseHeader, {
195
153
  shape: shape,
196
154
  backgroundColor: labelBackgroundColor,
197
155
  onDoubleClick: readonly ? void 0 : handleDoubleClick(labelInputRef),
198
156
  "data-testid": "node-label",
199
157
  children: label
200
158
  }),
201
- subLabel && /*#__PURE__*/ jsx(SubHeader, {
159
+ subLabel && /*#__PURE__*/ jsx(BaseSubHeader, {
202
160
  shape: shape,
203
161
  onDoubleClick: readonly ? void 0 : handleDoubleClick(subLabelInputRef),
204
162
  "data-testid": "node-sublabel",
@@ -211,4 +169,4 @@ const NodeLabelInternal = ({ label = '', subLabel = '', labelTooltip, labelBackg
211
169
  });
212
170
  };
213
171
  const NodeLabel = /*#__PURE__*/ memo(NodeLabelInternal);
214
- export { BaseTextContainer, NodeLabel };
172
+ export { NodeLabel };