@uipath/apollo-react 3.69.1 → 3.70.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.
@@ -58,7 +58,7 @@ const external_useMarkdownShortcuts_cjs_namespaceObject = require("./useMarkdown
58
58
  const external_useScrollCapture_cjs_namespaceObject = require("./useScrollCapture.cjs");
59
59
  const minWidth = 8 * external_constants_cjs_namespaceObject.GRID_SPACING;
60
60
  const minHeight = 8 * external_constants_cjs_namespaceObject.GRID_SPACING;
61
- const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false })=>{
61
+ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false, onContentChange, onColorChange, onResize })=>{
62
62
  const { updateNodeData, deleteElements } = (0, react_cjs_namespaceObject.useReactFlow)();
63
63
  const [isEditing, setIsEditing] = (0, external_react_namespaceObject.useState)(data.autoFocus ?? false);
64
64
  const [isResizing, setIsResizing] = (0, external_react_namespaceObject.useState)(false);
@@ -116,14 +116,18 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
116
116
  ]);
117
117
  const handleBlur = (0, external_react_namespaceObject.useCallback)(()=>{
118
118
  setIsEditing(false);
119
- if (localContent !== data.content) updateNodeData(id, {
120
- content: localContent
121
- });
119
+ if (localContent !== data.content) {
120
+ onContentChange?.(localContent);
121
+ updateNodeData(id, {
122
+ content: localContent
123
+ });
124
+ }
122
125
  }, [
123
126
  id,
124
127
  localContent,
125
128
  data.content,
126
- updateNodeData
129
+ updateNodeData,
130
+ onContentChange
127
131
  ]);
128
132
  const handleChange = (0, external_react_namespaceObject.useCallback)((e)=>{
129
133
  setLocalContent(e.target.value);
@@ -179,17 +183,22 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
179
183
  const handleResizeStart = (0, external_react_namespaceObject.useCallback)(()=>{
180
184
  setIsResizing(true);
181
185
  }, []);
182
- const handleResizeEnd = (0, external_react_namespaceObject.useCallback)(()=>{
186
+ const handleResizeEnd = (0, external_react_namespaceObject.useCallback)((_event, params)=>{
183
187
  setIsResizing(false);
184
- }, []);
188
+ onResize?.(params.width, params.height);
189
+ }, [
190
+ onResize
191
+ ]);
185
192
  const handleColorChange = (0, external_react_namespaceObject.useCallback)((newColor)=>{
193
+ onColorChange?.(newColor);
186
194
  updateNodeData(id, {
187
195
  color: newColor
188
196
  });
189
197
  setIsColorPickerOpen(false);
190
198
  }, [
191
199
  id,
192
- updateNodeData
200
+ updateNodeData,
201
+ onColorChange
193
202
  ]);
194
203
  const handleToggleColorPicker = (0, external_react_namespaceObject.useCallback)(()=>{
195
204
  setIsColorPickerOpen((prev)=>!prev);
@@ -1,9 +1,12 @@
1
1
  import type { NodeProps } from '../../xyflow/react.ts';
2
- import type { StickyNoteData } from './StickyNoteNode.types';
2
+ import type { StickyNoteColor, StickyNoteData } from './StickyNoteNode.types';
3
3
  export interface StickyNoteNodeProps extends NodeProps {
4
4
  data: StickyNoteData;
5
5
  placeholder?: string;
6
6
  renderPlaceholderOnSelect?: boolean;
7
+ onContentChange?: (content: string) => void;
8
+ onColorChange?: (color: StickyNoteColor) => void;
9
+ onResize?: (width: number, height: number) => void;
7
10
  }
8
- export declare const StickyNoteNode: import("react").MemoExoticComponent<({ id, data, selected, dragging, placeholder, renderPlaceholderOnSelect, }: StickyNoteNodeProps) => import("react/jsx-runtime").JSX.Element>;
11
+ export declare const StickyNoteNode: import("react").MemoExoticComponent<({ id, data, selected, dragging, placeholder, renderPlaceholderOnSelect, onContentChange, onColorChange, onResize, }: StickyNoteNodeProps) => import("react/jsx-runtime").JSX.Element>;
9
12
  //# sourceMappingURL=StickyNoteNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StickyNoteNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AA8B1E,OAAO,KAAK,EAAmB,cAAc,EAAiB,MAAM,wBAAwB,CAAC;AAM7F,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC;AA6XD,eAAO,MAAM,cAAc,kHAjXxB,mBAAmB,6CAiXqC,CAAC"}
1
+ {"version":3,"file":"StickyNoteNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AA+B1E,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAiB,MAAM,wBAAwB,CAAC;AAM7F,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAsYD,eAAO,MAAM,cAAc,4JAvXxB,mBAAmB,6CAuXqC,CAAC"}
@@ -18,7 +18,7 @@ import { useMarkdownShortcuts } from "./useMarkdownShortcuts.js";
18
18
  import { useScrollCapture } from "./useScrollCapture.js";
19
19
  const minWidth = 8 * GRID_SPACING;
20
20
  const minHeight = 8 * GRID_SPACING;
21
- const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false })=>{
21
+ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = 'Add text', renderPlaceholderOnSelect = false, onContentChange, onColorChange, onResize })=>{
22
22
  const { updateNodeData, deleteElements } = useReactFlow();
23
23
  const [isEditing, setIsEditing] = useState(data.autoFocus ?? false);
24
24
  const [isResizing, setIsResizing] = useState(false);
@@ -76,14 +76,18 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
76
76
  ]);
77
77
  const handleBlur = useCallback(()=>{
78
78
  setIsEditing(false);
79
- if (localContent !== data.content) updateNodeData(id, {
80
- content: localContent
81
- });
79
+ if (localContent !== data.content) {
80
+ onContentChange?.(localContent);
81
+ updateNodeData(id, {
82
+ content: localContent
83
+ });
84
+ }
82
85
  }, [
83
86
  id,
84
87
  localContent,
85
88
  data.content,
86
- updateNodeData
89
+ updateNodeData,
90
+ onContentChange
87
91
  ]);
88
92
  const handleChange = useCallback((e)=>{
89
93
  setLocalContent(e.target.value);
@@ -139,17 +143,22 @@ const StickyNoteNodeComponent = ({ id, data, selected, dragging, placeholder = '
139
143
  const handleResizeStart = useCallback(()=>{
140
144
  setIsResizing(true);
141
145
  }, []);
142
- const handleResizeEnd = useCallback(()=>{
146
+ const handleResizeEnd = useCallback((_event, params)=>{
143
147
  setIsResizing(false);
144
- }, []);
148
+ onResize?.(params.width, params.height);
149
+ }, [
150
+ onResize
151
+ ]);
145
152
  const handleColorChange = useCallback((newColor)=>{
153
+ onColorChange?.(newColor);
146
154
  updateNodeData(id, {
147
155
  color: newColor
148
156
  });
149
157
  setIsColorPickerOpen(false);
150
158
  }, [
151
159
  id,
152
- updateNodeData
160
+ updateNodeData,
161
+ onColorChange
153
162
  ]);
154
163
  const handleToggleColorPicker = useCallback(()=>{
155
164
  setIsColorPickerOpen((prev)=>!prev);
@@ -24,9 +24,10 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- WithBaseNodes: ()=>WithBaseNodes,
27
+ WithCallbacks: ()=>WithCallbacks,
28
+ Default: ()=>Default,
28
29
  default: ()=>StickyNoteNode_stories,
29
- Default: ()=>Default
30
+ WithBaseNodes: ()=>WithBaseNodes
30
31
  });
31
32
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
33
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
@@ -46,9 +47,42 @@ const meta = {
46
47
  ]
47
48
  };
48
49
  const StickyNoteNode_stories = meta;
50
+ const StickyNoteWithCallbacks = (props)=>{
51
+ const handleContentChange = (content)=>{
52
+ console.log('📝 Content changed:', {
53
+ nodeId: props.id,
54
+ content,
55
+ timestamp: new Date().toISOString()
56
+ });
57
+ };
58
+ const handleColorChange = (color)=>{
59
+ console.log('🎨 Color changed:', {
60
+ nodeId: props.id,
61
+ color,
62
+ timestamp: new Date().toISOString()
63
+ });
64
+ };
65
+ const handleResize = (width, height)=>{
66
+ console.log('📏 Resized:', {
67
+ nodeId: props.id,
68
+ width,
69
+ height,
70
+ timestamp: new Date().toISOString()
71
+ });
72
+ };
73
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StickyNoteNode_cjs_namespaceObject.StickyNoteNode, {
74
+ ...props,
75
+ onContentChange: handleContentChange,
76
+ onColorChange: handleColorChange,
77
+ onResize: handleResize
78
+ });
79
+ };
49
80
  const nodeTypes = {
50
81
  stickyNote: external_StickyNoteNode_cjs_namespaceObject.StickyNoteNode
51
82
  };
83
+ const nodeTypesWithCallbacks = {
84
+ stickyNote: StickyNoteWithCallbacks
85
+ };
52
86
  function createStickyNote(id, color, content, position, size = {
53
87
  width: 250,
54
88
  height: 150
@@ -469,18 +503,48 @@ function WithBaseNodesStory() {
469
503
  })
470
504
  });
471
505
  }
506
+ function WithCallbacksStory() {
507
+ const initialNodes = (0, external_react_namespaceObject.useMemo)(()=>[
508
+ createStickyNote('sticky-test-1', 'yellow', '**Test Callbacks!**\n\n1. Double-click to edit content\n2. Click the color button to change color\n3. Drag corners to resize\n\nOpen the browser console to see logs! 🔍', {
509
+ x: 480,
510
+ y: 480
511
+ }, {
512
+ width: 320,
513
+ height: 320
514
+ })
515
+ ], []);
516
+ const { canvasProps } = (0, index_cjs_namespaceObject.useCanvasStory)({
517
+ initialNodes,
518
+ additionalNodeTypes: nodeTypesWithCallbacks
519
+ });
520
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
521
+ ...canvasProps,
522
+ mode: "design",
523
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Panel, {
524
+ position: "bottom-right",
525
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasPositionControls_cjs_namespaceObject.CanvasPositionControls, {
526
+ translations: external_types_cjs_namespaceObject.DefaultCanvasTranslations
527
+ })
528
+ })
529
+ });
530
+ }
472
531
  const Default = {
473
532
  render: ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DefaultStory, {})
474
533
  };
475
534
  const WithBaseNodes = {
476
535
  render: ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WithBaseNodesStory, {})
477
536
  };
537
+ const WithCallbacks = {
538
+ render: ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WithCallbacksStory, {})
539
+ };
478
540
  exports.Default = __webpack_exports__.Default;
479
541
  exports.WithBaseNodes = __webpack_exports__.WithBaseNodes;
542
+ exports.WithCallbacks = __webpack_exports__.WithCallbacks;
480
543
  exports["default"] = __webpack_exports__["default"];
481
544
  for(var __rspack_i in __webpack_exports__)if (-1 === [
482
545
  "Default",
483
546
  "WithBaseNodes",
547
+ "WithCallbacks",
484
548
  "default"
485
549
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
486
550
  Object.defineProperty(exports, '__esModule', {
@@ -4,4 +4,5 @@ export default meta;
4
4
  type Story = StoryObj<typeof meta>;
5
5
  export declare const Default: Story;
6
6
  export declare const WithBaseNodes: Story;
7
+ export declare const WithCallbacks: Story;
7
8
  //# sourceMappingURL=StickyNoteNode.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StickyNoteNode.stories.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAwWnC,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC"}
1
+ {"version":3,"file":"StickyNoteNode.stories.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StickyNoteNode/StickyNoteNode.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAe5D,QAAA,MAAM,IAAI,EAAE,IAIX,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AA6anC,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC"}
@@ -16,9 +16,42 @@ const meta = {
16
16
  ]
17
17
  };
18
18
  const StickyNoteNode_stories = meta;
19
+ const StickyNoteWithCallbacks = (props)=>{
20
+ const handleContentChange = (content)=>{
21
+ console.log('📝 Content changed:', {
22
+ nodeId: props.id,
23
+ content,
24
+ timestamp: new Date().toISOString()
25
+ });
26
+ };
27
+ const handleColorChange = (color)=>{
28
+ console.log('🎨 Color changed:', {
29
+ nodeId: props.id,
30
+ color,
31
+ timestamp: new Date().toISOString()
32
+ });
33
+ };
34
+ const handleResize = (width, height)=>{
35
+ console.log('📏 Resized:', {
36
+ nodeId: props.id,
37
+ width,
38
+ height,
39
+ timestamp: new Date().toISOString()
40
+ });
41
+ };
42
+ return /*#__PURE__*/ jsx(StickyNoteNode, {
43
+ ...props,
44
+ onContentChange: handleContentChange,
45
+ onColorChange: handleColorChange,
46
+ onResize: handleResize
47
+ });
48
+ };
19
49
  const nodeTypes = {
20
50
  stickyNote: StickyNoteNode
21
51
  };
52
+ const nodeTypesWithCallbacks = {
53
+ stickyNote: StickyNoteWithCallbacks
54
+ };
22
55
  function createStickyNote(id, color, content, position, size = {
23
56
  width: 250,
24
57
  height: 150
@@ -439,10 +472,38 @@ function WithBaseNodesStory() {
439
472
  })
440
473
  });
441
474
  }
475
+ function WithCallbacksStory() {
476
+ const initialNodes = useMemo(()=>[
477
+ createStickyNote('sticky-test-1', 'yellow', '**Test Callbacks!**\n\n1. Double-click to edit content\n2. Click the color button to change color\n3. Drag corners to resize\n\nOpen the browser console to see logs! 🔍', {
478
+ x: 480,
479
+ y: 480
480
+ }, {
481
+ width: 320,
482
+ height: 320
483
+ })
484
+ ], []);
485
+ const { canvasProps } = useCanvasStory({
486
+ initialNodes,
487
+ additionalNodeTypes: nodeTypesWithCallbacks
488
+ });
489
+ return /*#__PURE__*/ jsx(BaseCanvas, {
490
+ ...canvasProps,
491
+ mode: "design",
492
+ children: /*#__PURE__*/ jsx(Panel, {
493
+ position: "bottom-right",
494
+ children: /*#__PURE__*/ jsx(CanvasPositionControls, {
495
+ translations: DefaultCanvasTranslations
496
+ })
497
+ })
498
+ });
499
+ }
442
500
  const Default = {
443
501
  render: ()=>/*#__PURE__*/ jsx(DefaultStory, {})
444
502
  };
445
503
  const WithBaseNodes = {
446
504
  render: ()=>/*#__PURE__*/ jsx(WithBaseNodesStory, {})
447
505
  };
448
- export { Default, WithBaseNodes, StickyNoteNode_stories as default };
506
+ const WithCallbacks = {
507
+ render: ()=>/*#__PURE__*/ jsx(WithCallbacksStory, {})
508
+ };
509
+ export { Default, WithBaseNodes, WithCallbacks, StickyNoteNode_stories as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/apollo-react",
3
- "version": "3.69.1",
3
+ "version": "3.70.0",
4
4
  "description": "Apollo Design System - React component library with Material UI theming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -201,8 +201,8 @@
201
201
  "use-sync-external-store": "^1.2.0",
202
202
  "zod": "^4.3.5",
203
203
  "zustand": "^5.0.9",
204
- "@uipath/apollo-wind": "2.0.0",
205
- "@uipath/apollo-core": "5.9.0"
204
+ "@uipath/apollo-core": "5.9.0",
205
+ "@uipath/apollo-wind": "2.0.0"
206
206
  },
207
207
  "devDependencies": {
208
208
  "@lingui/cli": "^5.6.1",