@topconsultnpm/sdkui-react 6.20.0-dev1.68 → 6.20.0-dev1.69

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.
@@ -77,27 +77,16 @@ const TMContextMenu = ({ items, trigger = 'right', children, target, externalCon
77
77
  // Haptic feedback
78
78
  if ('vibrate' in navigator)
79
79
  navigator.vibrate(50);
80
- // First, trigger a click to select/focus the item
81
- const clickEvent = new MouseEvent('click', {
80
+ const syntheticEvent = new MouseEvent('contextmenu', {
82
81
  bubbles: true,
83
82
  cancelable: true,
84
83
  clientX: touch.clientX,
85
84
  clientY: touch.clientY,
86
85
  });
87
- element.dispatchEvent(clickEvent);
88
- // Small delay to ensure click is processed before opening context menu
89
- setTimeout(() => {
90
- const syntheticEvent = new MouseEvent('contextmenu', {
91
- bubbles: true,
92
- cancelable: true,
93
- clientX: touch.clientX,
94
- clientY: touch.clientY,
95
- });
96
- element.dispatchEvent(syntheticEvent);
97
- }, 10);
86
+ element.dispatchEvent(syntheticEvent);
98
87
  if (state)
99
88
  state.timeout = null;
100
- }, 400);
89
+ }, 500);
101
90
  };
102
91
  const handleTouchMove = (e) => {
103
92
  const touchEvent = e;
@@ -132,6 +121,12 @@ const TMContextMenu = ({ items, trigger = 'right', children, target, externalCon
132
121
  state.longPressTriggered = false;
133
122
  }
134
123
  };
124
+ // Prevent default iOS context menu
125
+ const handleContextMenu = (e) => {
126
+ e.preventDefault();
127
+ e.stopPropagation();
128
+ return false;
129
+ };
135
130
  // Attach listeners to all matching elements
136
131
  elements.forEach(element => {
137
132
  const el = element;
@@ -140,11 +135,11 @@ const TMContextMenu = ({ items, trigger = 'right', children, target, externalCon
140
135
  style.webkitTouchCallout = 'none';
141
136
  style.webkitUserSelect = 'none';
142
137
  style.userSelect = 'none';
143
- el.addEventListener('touchstart', handleTouchStart, { passive: false });
138
+ el.addEventListener('touchstart', handleTouchStart, { passive: true });
144
139
  el.addEventListener('touchmove', handleTouchMove, { passive: true });
145
140
  el.addEventListener('touchend', handleTouchEnd);
146
141
  el.addEventListener('touchcancel', handleTouchEnd);
147
- el.addEventListener('contextmenu', (e) => e.preventDefault(), { capture: true });
142
+ el.addEventListener('contextmenu', handleContextMenu);
148
143
  el.addEventListener('click', handleClick, { capture: true });
149
144
  });
150
145
  return () => {
@@ -158,6 +153,7 @@ const TMContextMenu = ({ items, trigger = 'right', children, target, externalCon
158
153
  el.removeEventListener('touchmove', handleTouchMove);
159
154
  el.removeEventListener('touchend', handleTouchEnd);
160
155
  el.removeEventListener('touchcancel', handleTouchEnd);
156
+ el.removeEventListener('contextmenu', handleContextMenu);
161
157
  el.removeEventListener('click', handleClick, { capture: true });
162
158
  });
163
159
  };
@@ -284,7 +280,7 @@ const TMContextMenu = ({ items, trigger = 'right', children, target, externalCon
284
280
  parentNames: [],
285
281
  });
286
282
  }
287
- }, 400);
283
+ }, 500);
288
284
  };
289
285
  const handleTouchMove = (e) => {
290
286
  if (!isIOS || trigger !== 'right' || !touchStartPos.current)
@@ -427,7 +423,6 @@ const TMContextMenu = ({ items, trigger = 'right', children, target, externalCon
427
423
  display: 'inline-block',
428
424
  WebkitTouchCallout: isIOS ? 'none' : undefined,
429
425
  WebkitUserSelect: isIOS ? 'none' : undefined,
430
- userSelect: isIOS ? 'none' : undefined,
431
426
  }, children: children })), menuState.visible && createPortal(_jsxs(_Fragment, { children: [_jsxs(S.MenuContainer, { ref: menuRef, "$x": menuState.position.x, "$y": menuState.position.y, "$openLeft": openLeft, "$openUp": openUp, "$isPositioned": isCalculated, "$externalControl": !!externalControl, children: [isMobile && menuState.parentNames.length > 0 && (_jsxs(S.MobileMenuHeader, { children: [_jsx(S.BackButton, { onClick: handleBack, "aria-label": "Go back", children: _jsx(IconArrowLeft, {}) }), _jsx(S.HeaderTitle, { children: currentParentName })] })), renderMenuItems(currentMenu, 0)] }), !isMobile && hoveredSubmenus.map((submenu, idx) => (_jsx(S.Submenu, { "$parentRect": submenu.parentRect, "$openUp": submenu.openUp, "data-submenu": "true", onMouseEnter: handleSubmenuMouseEnter, onMouseLeave: () => handleMouseLeave(submenu.depth), children: renderMenuItems(submenu.items, submenu.depth) }, `submenu-${submenu.depth}-${idx}`)))] }), document.body)] }));
432
427
  };
433
428
  export default TMContextMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.68",
3
+ "version": "6.20.0-dev1.69",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",