@uipath/apollo-react 4.6.1 → 4.6.2-pr525.30a5d08

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 -75
  2. package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
  3. package/dist/canvas/components/BaseNode/BaseNode.js +69 -70
  4. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.cjs +68 -0
  5. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts +9 -0
  6. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.d.ts.map +1 -0
  7. package/dist/canvas/components/BaseNode/BaseNodeBadgeSlot.js +34 -0
  8. package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts +2 -1
  9. package/dist/canvas/components/BaseNode/BaseNodeConfigContext.d.ts.map +1 -1
  10. package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +88 -0
  11. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +21 -0
  12. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +1 -0
  13. package/dist/canvas/components/BaseNode/BaseNodeContainer.js +51 -0
  14. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.cjs +49 -0
  15. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts +9 -0
  16. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.d.ts.map +1 -0
  17. package/dist/canvas/components/BaseNode/BaseNodeInnerShape.js +15 -0
  18. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.cjs +62 -0
  19. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts +9 -0
  20. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.d.ts.map +1 -0
  21. package/dist/canvas/components/BaseNode/BaseNodeMissingManifest.js +28 -0
  22. package/dist/canvas/components/BaseNode/NodeLabel.cjs +64 -18
  23. package/dist/canvas/components/BaseNode/NodeLabel.d.ts +8 -1
  24. package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
  25. package/dist/canvas/components/BaseNode/NodeLabel.js +58 -15
  26. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +4 -7
  27. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
  28. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +4 -7
  29. package/dist/canvas/components/CodedAgent/CodedAgentFlow.cjs +4 -4
  30. package/dist/canvas/components/CodedAgent/CodedAgentFlow.js +4 -4
  31. package/dist/canvas/components/StageNode/StageNode.cjs +3 -8
  32. package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
  33. package/dist/canvas/components/StageNode/StageNode.js +3 -8
  34. package/dist/canvas/constants.cjs +60 -0
  35. package/dist/canvas/constants.d.ts +15 -0
  36. package/dist/canvas/constants.d.ts.map +1 -1
  37. package/dist/canvas/constants.js +16 -1
  38. package/dist/canvas/index.cjs +39 -35
  39. package/dist/canvas/index.d.ts +1 -0
  40. package/dist/canvas/index.d.ts.map +1 -1
  41. package/dist/canvas/index.js +1 -0
  42. package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
  43. package/dist/canvas/styles/reactflow-reset.css +12 -0
  44. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  45. package/package.json +3 -3
  46. package/dist/canvas/components/BaseNode/BaseNode.styles.cjs +0 -410
  47. package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts +0 -75
  48. package/dist/canvas/components/BaseNode/BaseNode.styles.d.ts.map +0 -1
  49. package/dist/canvas/components/BaseNode/BaseNode.styles.js +0 -342
@@ -27,11 +27,10 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  BaseNode: ()=>BaseNode
28
28
  });
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
- const index_cjs_namespaceObject = require("../../utils/index.cjs");
31
30
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
32
31
  const external_react_namespaceObject = require("react");
33
32
  const external_constants_cjs_namespaceObject = require("../../constants.cjs");
34
- const external_core_index_cjs_namespaceObject = require("../../core/index.cjs");
33
+ const index_cjs_namespaceObject = require("../../core/index.cjs");
35
34
  const external_hooks_index_cjs_namespaceObject = require("../../hooks/index.cjs");
36
35
  const adornment_resolver_cjs_namespaceObject = require("../../utils/adornment-resolver.cjs");
37
36
  const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
@@ -44,10 +43,31 @@ const SelectionStateContext_cjs_namespaceObject = require("../BaseCanvas/Selecti
44
43
  const SmartHandle_cjs_namespaceObject = require("../ButtonHandle/SmartHandle.cjs");
45
44
  const useButtonHandles_cjs_namespaceObject = require("../ButtonHandle/useButtonHandles.cjs");
46
45
  const external_Toolbar_index_cjs_namespaceObject = require("../Toolbar/index.cjs");
47
- const external_BaseNode_styles_cjs_namespaceObject = require("./BaseNode.styles.cjs");
46
+ const external_BaseNodeBadgeSlot_cjs_namespaceObject = require("./BaseNodeBadgeSlot.cjs");
48
47
  const external_BaseNodeConfigContext_cjs_namespaceObject = require("./BaseNodeConfigContext.cjs");
48
+ const external_BaseNodeContainer_cjs_namespaceObject = require("./BaseNodeContainer.cjs");
49
+ const external_BaseNodeInnerShape_cjs_namespaceObject = require("./BaseNodeInnerShape.cjs");
50
+ const external_BaseNodeMissingManifest_cjs_namespaceObject = require("./BaseNodeMissingManifest.cjs");
49
51
  const external_NodeLabel_cjs_namespaceObject = require("./NodeLabel.cjs");
50
52
  const selectIsConnecting = (state)=>!!state.connectionClickStartHandle;
53
+ const getContainerWidth = (shape, width)=>{
54
+ const defaultWidth = 'rectangle' === shape ? external_constants_cjs_namespaceObject.DEFAULT_RECTANGLE_NODE_WIDTH : external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE;
55
+ if (width && width !== external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE && width !== external_constants_cjs_namespaceObject.DEFAULT_RECTANGLE_NODE_WIDTH) return width;
56
+ return defaultWidth;
57
+ };
58
+ const getContainerHeight = (height, hasFooter, footerVariant)=>{
59
+ if (hasFooter) switch(footerVariant){
60
+ case 'button':
61
+ return external_constants_cjs_namespaceObject.NODE_HEIGHT_FOOTER_BUTTON;
62
+ case 'single':
63
+ return external_constants_cjs_namespaceObject.NODE_HEIGHT_FOOTER_SINGLE;
64
+ case 'double':
65
+ return external_constants_cjs_namespaceObject.NODE_HEIGHT_FOOTER_DOUBLE;
66
+ default:
67
+ return 'auto';
68
+ }
69
+ return height || external_constants_cjs_namespaceObject.NODE_HEIGHT_DEFAULT;
70
+ };
51
71
  const BaseNodeComponent = (props)=>{
52
72
  const { type, data, selected, id, dragging, width, height } = props;
53
73
  const { onHandleAction: onHandleActionProp, shouldShowAddButtonFn: shouldShowAddButtonFnProp, shouldShowButtonHandleNotchesFn: shouldShowButtonHandleNotchesFnProp, toolbarConfig: toolbarConfigProp, handleConfigurations: handleConfigurationsProp, adornments: adornmentsProp, suggestionType, disabled, executionStatusOverride, labelTooltip, labelBackgroundColor, footerVariant, footerComponent, subLabelComponent, iconComponent } = (0, external_BaseNodeConfigContext_cjs_namespaceObject.useBaseNodeOverrideConfig)();
@@ -59,7 +79,7 @@ const BaseNodeComponent = (props)=>{
59
79
  const originalHeightRef = (0, external_react_namespaceObject.useRef)(void 0);
60
80
  const executionState = (0, external_hooks_index_cjs_namespaceObject.useNodeExecutionState)(id);
61
81
  const validationState = (0, external_hooks_index_cjs_namespaceObject.useElementValidationStatus)(id);
62
- const nodeTypeRegistry = (0, external_core_index_cjs_namespaceObject.useNodeTypeRegistry)();
82
+ const nodeTypeRegistry = (0, index_cjs_namespaceObject.useNodeTypeRegistry)();
63
83
  const { mode } = (0, BaseCanvasModeProvider_cjs_namespaceObject.useBaseCanvasMode)();
64
84
  const connectedHandleIds = (0, ConnectedHandlesContext_cjs_namespaceObject.useConnectedHandles)(id);
65
85
  const isConnecting = (0, react_cjs_namespaceObject.useStore)(selectIsConnecting);
@@ -155,7 +175,7 @@ const BaseNodeComponent = (props)=>{
155
175
  statusContext
156
176
  ]);
157
177
  const computedHeight = (0, external_react_namespaceObject.useMemo)(()=>{
158
- const handleSpacing = 32;
178
+ const handleSpacing = 2 * external_constants_cjs_namespaceObject.GRID_SPACING;
159
179
  const leftHandles = handleConfigurations.filter((config)=>config.position === react_cjs_namespaceObject.Position.Left && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
160
180
  const rightHandles = handleConfigurations.filter((config)=>config.position === react_cjs_namespaceObject.Position.Right && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
161
181
  const leftRightHandles = Math.max(leftHandles, rightHandles);
@@ -209,6 +229,31 @@ const BaseNodeComponent = (props)=>{
209
229
  display.subLabel
210
230
  ]);
211
231
  const displayFooter = footerComponent;
232
+ const hasFooter = !!displayFooter;
233
+ const containerWidth = getContainerWidth(displayShape, width);
234
+ const containerHeight = getContainerHeight(height, hasFooter, displayFooterVariant);
235
+ const nodeVars = (0, external_react_namespaceObject.useMemo)(()=>{
236
+ const numH = 'number' == typeof containerHeight ? containerHeight : void 0;
237
+ const radiusBasis = 'rectangle' === displayShape ? numH ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : Math.min(containerWidth, numH ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE);
238
+ const nodeRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${radiusBasis * external_constants_cjs_namespaceObject.NODE_CONTAINER_RADIUS_RATIO}px`;
239
+ const effectiveH = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : numH ?? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE;
240
+ const effectiveW = hasFooter ? external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE : containerWidth;
241
+ const basis = 'rectangle' === displayShape ? effectiveH : Math.min(effectiveW, effectiveH);
242
+ const innerRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${basis * external_constants_cjs_namespaceObject.NODE_INNER_RADIUS_RATIO}px`;
243
+ return {
244
+ '--node-w': `${containerWidth}px`,
245
+ '--node-h': numH ? `${numH}px` : 'auto',
246
+ '--node-radius': nodeRadius,
247
+ '--inner-size': `${basis * external_constants_cjs_namespaceObject.NODE_INNER_SHAPE_RATIO}px`,
248
+ '--inner-radius': innerRadius,
249
+ '--icon-size': `${basis * external_constants_cjs_namespaceObject.NODE_INNER_ICON_RATIO}px`
250
+ };
251
+ }, [
252
+ containerWidth,
253
+ containerHeight,
254
+ displayShape,
255
+ hasFooter
256
+ ]);
212
257
  const interactionState = (0, external_react_namespaceObject.useMemo)(()=>{
213
258
  if (disabled) return 'disabled';
214
259
  if (dragging) return 'drag';
@@ -324,103 +369,62 @@ const BaseNodeComponent = (props)=>{
324
369
  const handleElements = useSmartHandles ? smartHandleElements : buttonHandleElements;
325
370
  if (!manifest) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
326
371
  ref: containerRef,
327
- style: {
328
- position: 'relative'
329
- },
372
+ className: "relative",
373
+ style: nodeVars,
330
374
  onMouseEnter: handleMouseEnter,
331
375
  onMouseLeave: handleMouseLeave,
332
376
  onFocus: handleFocus,
333
377
  onBlur: handleBlur,
334
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseContainer, {
335
- selected: selected,
336
- shape: "square",
337
- className: interactionState,
338
- interactionState: interactionState,
339
- children: [
340
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseIconWrapper, {
341
- backgroundColor: "var(--canvas-error-background)",
342
- shape: "square",
343
- height: height,
344
- width: width ?? height,
345
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
346
- icon: "circle-alert",
347
- size: 32,
348
- color: "var(--canvas-error-icon)"
349
- })
350
- }),
351
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseTextContainer, {
352
- shape: "square",
353
- children: [
354
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseHeader, {
355
- shape: "square",
356
- children: "Manifest not found"
357
- }),
358
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseSubHeader, {
359
- children: [
360
- 'Node type "',
361
- type,
362
- '" is not registered'
363
- ]
364
- })
365
- ]
366
- })
367
- ]
378
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeMissingManifest_cjs_namespaceObject.MissingManifestNode, {
379
+ type: data.nodeType,
380
+ isSelected: selected,
381
+ isHovered: isHovered,
382
+ interactionState: interactionState
368
383
  })
369
384
  });
370
385
  const nodeContent = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
371
386
  ref: containerRef,
372
- style: {
373
- position: 'relative'
374
- },
387
+ className: "relative",
388
+ style: nodeVars,
375
389
  onMouseEnter: handleMouseEnter,
376
390
  onMouseLeave: handleMouseLeave,
377
391
  onFocus: handleFocus,
378
392
  onBlur: handleBlur,
379
393
  children: [
380
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNode_styles_cjs_namespaceObject.BaseContainer, {
381
- selected: selected,
394
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_BaseNodeContainer_cjs_namespaceObject.BaseContainer, {
382
395
  shape: displayShape,
383
- className: (0, index_cjs_namespaceObject.cx)(executionStatus, interactionState),
396
+ isSelected: selected,
397
+ isHovered: isHovered,
384
398
  interactionState: interactionState,
385
399
  executionStatus: executionStatus,
386
400
  validationStatus: validationState?.validationStatus,
387
401
  suggestionType: suggestionType,
388
- width: width,
389
- height: height,
390
- backgroundColor: displayBackground,
391
- hasFooter: !!displayFooter,
392
- footerVariant: displayFooterVariant,
393
- "aria-busy": data.loading || void 0,
402
+ hasFooter: hasFooter,
403
+ background: displayBackground,
404
+ loading: data.loading,
394
405
  children: [
395
- data.loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseSkeletonIcon, {
396
- "data-testid": "skeleton-icon",
397
- shape: displayShape,
398
- nodeHeight: displayFooter ? void 0 : height,
399
- nodeWidth: displayFooter ? void 0 : width ?? height
400
- }) : Icon && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseIconWrapper, {
401
- shape: displayShape,
406
+ (Icon || data.loading) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeInnerShape_cjs_namespaceObject.BaseInnerShape, {
402
407
  color: displayColor,
403
- backgroundColor: displayIconBackground,
404
- height: displayFooter ? void 0 : height,
405
- width: displayFooter ? void 0 : width ?? height,
406
- children: Icon
408
+ background: displayIconBackground,
409
+ loading: data.loading,
410
+ children: data.loading ? null : Icon
407
411
  }),
408
- adornments?.topLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
412
+ adornments?.topLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeBadgeSlot_cjs_namespaceObject.BaseBadgeSlot, {
409
413
  position: "top-left",
410
414
  shape: displayShape,
411
415
  children: adornments.topLeft
412
416
  }),
413
- adornments?.topRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
417
+ adornments?.topRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeBadgeSlot_cjs_namespaceObject.BaseBadgeSlot, {
414
418
  position: "top-right",
415
419
  shape: displayShape,
416
420
  children: adornments.topRight
417
421
  }),
418
- adornments?.bottomRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
422
+ adornments?.bottomRight && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeBadgeSlot_cjs_namespaceObject.BaseBadgeSlot, {
419
423
  position: "bottom-right",
420
424
  shape: displayShape,
421
425
  children: adornments.bottomRight
422
426
  }),
423
- adornments?.bottomLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_styles_cjs_namespaceObject.BaseBadgeSlot, {
427
+ adornments?.bottomLeft && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNodeBadgeSlot_cjs_namespaceObject.BaseBadgeSlot, {
424
428
  position: "bottom-left",
425
429
  shape: displayShape,
426
430
  children: adornments.bottomLeft
@@ -438,12 +442,7 @@ const BaseNodeComponent = (props)=>{
438
442
  onChange: handleLabelChange
439
443
  }),
440
444
  displayFooter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
441
- style: {
442
- flexBasis: '100%',
443
- paddingTop: '2px',
444
- minWidth: 0,
445
- overflow: 'hidden'
446
- },
445
+ className: "basis-full pt-0.5 min-w-0 overflow-hidden",
447
446
  children: displayFooter
448
447
  })
449
448
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAkB,MAAM,0CAA0C,CAAC;AAkChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AA+hB1B,eAAO,MAAM,QAAQ,8CAzhBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAyhBhB,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,EAAkB,MAAM,0CAA0C,CAAC;AAqChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AAqlB1B,eAAO,MAAM,QAAQ,8CA7iBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CA6iBhB,CAAC"}
@@ -1,12 +1,11 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { cx } from "../../utils/index.js";
3
2
  import { Position, useReactFlow, useStore, useUpdateNodeInternals } from "../../xyflow/react.js";
4
3
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
5
- import { DEFAULT_NODE_SIZE } from "../../constants.js";
4
+ import { DEFAULT_NODE_SIZE, DEFAULT_RECTANGLE_NODE_WIDTH, GRID_SPACING, 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";
6
5
  import { useNodeTypeRegistry } from "../../core/index.js";
7
6
  import { useElementValidationStatus, useNodeExecutionState } from "../../hooks/index.js";
8
7
  import { resolveAdornments } from "../../utils/adornment-resolver.js";
9
- import { CanvasIcon, getIcon } from "../../utils/icon-registry.js";
8
+ import { getIcon } from "../../utils/icon-registry.js";
10
9
  import { resolveDisplay, resolveHandles } from "../../utils/manifest-resolver.js";
11
10
  import { resolveToolbar } from "../../utils/toolbar-resolver.js";
12
11
  import { useBaseCanvasMode } from "../BaseCanvas/BaseCanvasModeProvider.js";
@@ -16,10 +15,31 @@ import { useSelectionState } from "../BaseCanvas/SelectionStateContext.js";
16
15
  import { SmartHandle, SmartHandleProvider } from "../ButtonHandle/SmartHandle.js";
17
16
  import { useButtonHandles } from "../ButtonHandle/useButtonHandles.js";
18
17
  import { NodeToolbar } from "../Toolbar/index.js";
19
- import { BaseBadgeSlot, BaseContainer, BaseHeader, BaseIconWrapper, BaseSkeletonIcon, BaseSubHeader, BaseTextContainer } from "./BaseNode.styles.js";
18
+ import { BaseBadgeSlot } from "./BaseNodeBadgeSlot.js";
20
19
  import { useBaseNodeOverrideConfig } from "./BaseNodeConfigContext.js";
20
+ import { BaseContainer } from "./BaseNodeContainer.js";
21
+ import { BaseInnerShape } from "./BaseNodeInnerShape.js";
22
+ import { MissingManifestNode } from "./BaseNodeMissingManifest.js";
21
23
  import { NodeLabel } from "./NodeLabel.js";
22
24
  const selectIsConnecting = (state)=>!!state.connectionClickStartHandle;
25
+ const getContainerWidth = (shape, width)=>{
26
+ const defaultWidth = 'rectangle' === shape ? DEFAULT_RECTANGLE_NODE_WIDTH : DEFAULT_NODE_SIZE;
27
+ if (width && width !== DEFAULT_NODE_SIZE && width !== DEFAULT_RECTANGLE_NODE_WIDTH) return width;
28
+ return defaultWidth;
29
+ };
30
+ const getContainerHeight = (height, hasFooter, footerVariant)=>{
31
+ if (hasFooter) switch(footerVariant){
32
+ case 'button':
33
+ return NODE_HEIGHT_FOOTER_BUTTON;
34
+ case 'single':
35
+ return NODE_HEIGHT_FOOTER_SINGLE;
36
+ case 'double':
37
+ return NODE_HEIGHT_FOOTER_DOUBLE;
38
+ default:
39
+ return 'auto';
40
+ }
41
+ return height || NODE_HEIGHT_DEFAULT;
42
+ };
23
43
  const BaseNodeComponent = (props)=>{
24
44
  const { type, data, selected, id, dragging, width, height } = props;
25
45
  const { onHandleAction: onHandleActionProp, shouldShowAddButtonFn: shouldShowAddButtonFnProp, shouldShowButtonHandleNotchesFn: shouldShowButtonHandleNotchesFnProp, toolbarConfig: toolbarConfigProp, handleConfigurations: handleConfigurationsProp, adornments: adornmentsProp, suggestionType, disabled, executionStatusOverride, labelTooltip, labelBackgroundColor, footerVariant, footerComponent, subLabelComponent, iconComponent } = useBaseNodeOverrideConfig();
@@ -127,7 +147,7 @@ const BaseNodeComponent = (props)=>{
127
147
  statusContext
128
148
  ]);
129
149
  const computedHeight = useMemo(()=>{
130
- const handleSpacing = 32;
150
+ const handleSpacing = 2 * GRID_SPACING;
131
151
  const leftHandles = handleConfigurations.filter((config)=>config.position === Position.Left && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
132
152
  const rightHandles = handleConfigurations.filter((config)=>config.position === Position.Right && false !== config.visible).reduce((count, config)=>count + config.handles.length, 0);
133
153
  const leftRightHandles = Math.max(leftHandles, rightHandles);
@@ -181,6 +201,31 @@ const BaseNodeComponent = (props)=>{
181
201
  display.subLabel
182
202
  ]);
183
203
  const displayFooter = footerComponent;
204
+ const hasFooter = !!displayFooter;
205
+ const containerWidth = getContainerWidth(displayShape, width);
206
+ const containerHeight = getContainerHeight(height, hasFooter, displayFooterVariant);
207
+ const nodeVars = useMemo(()=>{
208
+ const numH = 'number' == typeof containerHeight ? containerHeight : void 0;
209
+ const radiusBasis = 'rectangle' === displayShape ? numH ?? DEFAULT_NODE_SIZE : Math.min(containerWidth, numH ?? DEFAULT_NODE_SIZE);
210
+ const nodeRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${radiusBasis * NODE_CONTAINER_RADIUS_RATIO}px`;
211
+ const effectiveH = hasFooter ? DEFAULT_NODE_SIZE : numH ?? DEFAULT_NODE_SIZE;
212
+ const effectiveW = hasFooter ? DEFAULT_NODE_SIZE : containerWidth;
213
+ const basis = 'rectangle' === displayShape ? effectiveH : Math.min(effectiveW, effectiveH);
214
+ const innerRadius = 'circle' === displayShape ? '50%' : hasFooter ? '16px' : `${basis * NODE_INNER_RADIUS_RATIO}px`;
215
+ return {
216
+ '--node-w': `${containerWidth}px`,
217
+ '--node-h': numH ? `${numH}px` : 'auto',
218
+ '--node-radius': nodeRadius,
219
+ '--inner-size': `${basis * NODE_INNER_SHAPE_RATIO}px`,
220
+ '--inner-radius': innerRadius,
221
+ '--icon-size': `${basis * NODE_INNER_ICON_RATIO}px`
222
+ };
223
+ }, [
224
+ containerWidth,
225
+ containerHeight,
226
+ displayShape,
227
+ hasFooter
228
+ ]);
184
229
  const interactionState = useMemo(()=>{
185
230
  if (disabled) return 'disabled';
186
231
  if (dragging) return 'drag';
@@ -296,86 +341,45 @@ const BaseNodeComponent = (props)=>{
296
341
  const handleElements = useSmartHandles ? smartHandleElements : buttonHandleElements;
297
342
  if (!manifest) return /*#__PURE__*/ jsx("div", {
298
343
  ref: containerRef,
299
- style: {
300
- position: 'relative'
301
- },
344
+ className: "relative",
345
+ style: nodeVars,
302
346
  onMouseEnter: handleMouseEnter,
303
347
  onMouseLeave: handleMouseLeave,
304
348
  onFocus: handleFocus,
305
349
  onBlur: handleBlur,
306
- children: /*#__PURE__*/ jsxs(BaseContainer, {
307
- selected: selected,
308
- shape: "square",
309
- className: interactionState,
310
- interactionState: interactionState,
311
- children: [
312
- /*#__PURE__*/ jsx(BaseIconWrapper, {
313
- backgroundColor: "var(--canvas-error-background)",
314
- shape: "square",
315
- height: height,
316
- width: width ?? height,
317
- children: /*#__PURE__*/ jsx(CanvasIcon, {
318
- icon: "circle-alert",
319
- size: 32,
320
- color: "var(--canvas-error-icon)"
321
- })
322
- }),
323
- /*#__PURE__*/ jsxs(BaseTextContainer, {
324
- shape: "square",
325
- children: [
326
- /*#__PURE__*/ jsx(BaseHeader, {
327
- shape: "square",
328
- children: "Manifest not found"
329
- }),
330
- /*#__PURE__*/ jsxs(BaseSubHeader, {
331
- children: [
332
- 'Node type "',
333
- type,
334
- '" is not registered'
335
- ]
336
- })
337
- ]
338
- })
339
- ]
350
+ children: /*#__PURE__*/ jsx(MissingManifestNode, {
351
+ type: data.nodeType,
352
+ isSelected: selected,
353
+ isHovered: isHovered,
354
+ interactionState: interactionState
340
355
  })
341
356
  });
342
357
  const nodeContent = /*#__PURE__*/ jsxs("div", {
343
358
  ref: containerRef,
344
- style: {
345
- position: 'relative'
346
- },
359
+ className: "relative",
360
+ style: nodeVars,
347
361
  onMouseEnter: handleMouseEnter,
348
362
  onMouseLeave: handleMouseLeave,
349
363
  onFocus: handleFocus,
350
364
  onBlur: handleBlur,
351
365
  children: [
352
366
  /*#__PURE__*/ jsxs(BaseContainer, {
353
- selected: selected,
354
367
  shape: displayShape,
355
- className: cx(executionStatus, interactionState),
368
+ isSelected: selected,
369
+ isHovered: isHovered,
356
370
  interactionState: interactionState,
357
371
  executionStatus: executionStatus,
358
372
  validationStatus: validationState?.validationStatus,
359
373
  suggestionType: suggestionType,
360
- width: width,
361
- height: height,
362
- backgroundColor: displayBackground,
363
- hasFooter: !!displayFooter,
364
- footerVariant: displayFooterVariant,
365
- "aria-busy": data.loading || void 0,
374
+ hasFooter: hasFooter,
375
+ background: displayBackground,
376
+ loading: data.loading,
366
377
  children: [
367
- data.loading ? /*#__PURE__*/ jsx(BaseSkeletonIcon, {
368
- "data-testid": "skeleton-icon",
369
- shape: displayShape,
370
- nodeHeight: displayFooter ? void 0 : height,
371
- nodeWidth: displayFooter ? void 0 : width ?? height
372
- }) : Icon && /*#__PURE__*/ jsx(BaseIconWrapper, {
373
- shape: displayShape,
378
+ (Icon || data.loading) && /*#__PURE__*/ jsx(BaseInnerShape, {
374
379
  color: displayColor,
375
- backgroundColor: displayIconBackground,
376
- height: displayFooter ? void 0 : height,
377
- width: displayFooter ? void 0 : width ?? height,
378
- children: Icon
380
+ background: displayIconBackground,
381
+ loading: data.loading,
382
+ children: data.loading ? null : Icon
379
383
  }),
380
384
  adornments?.topLeft && /*#__PURE__*/ jsx(BaseBadgeSlot, {
381
385
  position: "top-left",
@@ -410,12 +414,7 @@ const BaseNodeComponent = (props)=>{
410
414
  onChange: handleLabelChange
411
415
  }),
412
416
  displayFooter && /*#__PURE__*/ jsx("div", {
413
- style: {
414
- flexBasis: '100%',
415
- paddingTop: '2px',
416
- minWidth: 0,
417
- overflow: 'hidden'
418
- },
417
+ className: "basis-full pt-0.5 min-w-0 overflow-hidden",
419
418
  children: displayFooter
420
419
  })
421
420
  ]
@@ -0,0 +1,68 @@
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
+ BaseBadgeSlot: ()=>BaseBadgeSlot
28
+ });
29
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
+ const external_react_namespaceObject = require("react");
31
+ const external_constants_cjs_namespaceObject = require("../../constants.cjs");
32
+ const BaseBadgeSlot = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ position, shape, children })=>{
33
+ const offset = 'circle' === shape ? external_constants_cjs_namespaceObject.NODE_BADGE_INSET_CIRCLE : external_constants_cjs_namespaceObject.NODE_BADGE_INSET_SQUARE;
34
+ const style = {
35
+ width: external_constants_cjs_namespaceObject.NODE_BADGE_SIZE,
36
+ height: external_constants_cjs_namespaceObject.NODE_BADGE_SIZE
37
+ };
38
+ switch(position){
39
+ case 'top-left':
40
+ style.top = offset;
41
+ style.left = offset;
42
+ break;
43
+ case 'top-right':
44
+ style.top = offset;
45
+ style.right = offset;
46
+ break;
47
+ case 'bottom-left':
48
+ style.bottom = offset;
49
+ style.left = offset;
50
+ break;
51
+ case 'bottom-right':
52
+ style.bottom = offset;
53
+ style.right = offset;
54
+ break;
55
+ }
56
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
57
+ className: "absolute flex items-center justify-center bg-transparent",
58
+ style: style,
59
+ children: children
60
+ });
61
+ });
62
+ exports.BaseBadgeSlot = __webpack_exports__.BaseBadgeSlot;
63
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
64
+ "BaseBadgeSlot"
65
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
66
+ Object.defineProperty(exports, '__esModule', {
67
+ value: true
68
+ });
@@ -0,0 +1,9 @@
1
+ import type { NodeShape } from '../../schema';
2
+ interface BaseBadgeSlotProps {
3
+ position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
4
+ shape?: NodeShape;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const BaseBadgeSlot: import("react").MemoExoticComponent<({ position, shape, children }: BaseBadgeSlotProps) => import("react/jsx-runtime").JSX.Element>;
8
+ export {};
9
+ //# sourceMappingURL=BaseNodeBadgeSlot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseNodeBadgeSlot.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNodeBadgeSlot.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;IACpE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,sEAAwC,kBAAkB,6CA0BlF,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { memo } from "react";
3
+ import { NODE_BADGE_INSET_CIRCLE, NODE_BADGE_INSET_SQUARE, NODE_BADGE_SIZE } from "../../constants.js";
4
+ const BaseBadgeSlot = /*#__PURE__*/ memo(({ position, shape, children })=>{
5
+ const offset = 'circle' === shape ? NODE_BADGE_INSET_CIRCLE : NODE_BADGE_INSET_SQUARE;
6
+ const style = {
7
+ width: NODE_BADGE_SIZE,
8
+ height: NODE_BADGE_SIZE
9
+ };
10
+ switch(position){
11
+ case 'top-left':
12
+ style.top = offset;
13
+ style.left = offset;
14
+ break;
15
+ case 'top-right':
16
+ style.top = offset;
17
+ style.right = offset;
18
+ break;
19
+ case 'bottom-left':
20
+ style.bottom = offset;
21
+ style.left = offset;
22
+ break;
23
+ case 'bottom-right':
24
+ style.bottom = offset;
25
+ style.right = offset;
26
+ break;
27
+ }
28
+ return /*#__PURE__*/ jsx("div", {
29
+ className: "absolute flex items-center justify-center bg-transparent",
30
+ style: style,
31
+ children: children
32
+ });
33
+ });
34
+ export { BaseBadgeSlot };
@@ -1,4 +1,5 @@
1
1
  import type { HandleGroupManifest } from '../../schema/node-definition';
2
+ import type { ElementStatusValues } from '../../types/execution';
2
3
  import type { HandleActionEvent } from '../ButtonHandle/ButtonHandle';
3
4
  import type { NodeToolbarConfig } from '../Toolbar';
4
5
  import type { FooterVariant, NodeAdornments } from './BaseNode.types';
@@ -18,7 +19,7 @@ export interface BaseNodeOverrideConfig {
18
19
  adornments?: NodeAdornments;
19
20
  suggestionType?: 'add' | 'update' | 'delete';
20
21
  disabled?: boolean;
21
- executionStatusOverride?: string;
22
+ executionStatusOverride?: ElementStatusValues;
22
23
  labelTooltip?: string;
23
24
  labelBackgroundColor?: string;
24
25
  footerVariant?: FooterVariant;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseNodeConfigContext.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNodeConfigContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EA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