@xsolla/xui-context-menu 0.185.5 → 0.186.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/native/index.js +21 -2
- package/native/index.js.map +1 -1
- package/native/index.mjs +31 -4
- package/native/index.mjs.map +1 -1
- package/package.json +10 -10
- package/web/index.js +21 -2
- package/web/index.js.map +1 -1
- package/web/index.mjs +31 -4
- package/web/index.mjs.map +1 -1
package/web/index.mjs
CHANGED
|
@@ -263,7 +263,13 @@ var Box = React2.forwardRef(
|
|
|
263
263
|
Box.displayName = "Box";
|
|
264
264
|
|
|
265
265
|
// src/ContextMenu.tsx
|
|
266
|
-
import {
|
|
266
|
+
import {
|
|
267
|
+
useResolvedTheme as useResolvedTheme2,
|
|
268
|
+
useId as useId2,
|
|
269
|
+
useOverlayLayer as useOverlayLayer2,
|
|
270
|
+
LAYER_OFFSET as LAYER_OFFSET2,
|
|
271
|
+
useModalStackDepth
|
|
272
|
+
} from "@xsolla/xui-core";
|
|
267
273
|
import { Spinner } from "@xsolla/xui-spinner";
|
|
268
274
|
|
|
269
275
|
// src/ContextMenuContext.tsx
|
|
@@ -288,7 +294,9 @@ import React3, { useEffect, useLayoutEffect, useState } from "react";
|
|
|
288
294
|
import { createPortal } from "react-dom";
|
|
289
295
|
import {
|
|
290
296
|
useResolvedTheme,
|
|
291
|
-
useId
|
|
297
|
+
useId,
|
|
298
|
+
useOverlayLayer,
|
|
299
|
+
LAYER_OFFSET
|
|
292
300
|
} from "@xsolla/xui-core";
|
|
293
301
|
import { Typography } from "@xsolla/xui-typography";
|
|
294
302
|
import { Checkbox } from "@xsolla/xui-checkbox";
|
|
@@ -410,6 +418,7 @@ var OptionCell = ({
|
|
|
410
418
|
themeProductContext
|
|
411
419
|
});
|
|
412
420
|
const theme = rawTheme;
|
|
421
|
+
const overlayLayer = useOverlayLayer();
|
|
413
422
|
const ctx = useContextMenu();
|
|
414
423
|
const size = propSize ?? ctx?.size ?? "md";
|
|
415
424
|
const sizing = theme.sizing.contextMenu(size);
|
|
@@ -772,7 +781,9 @@ var OptionCell = ({
|
|
|
772
781
|
position: "fixed",
|
|
773
782
|
top: submenuPos.top,
|
|
774
783
|
left: submenuPos.left,
|
|
775
|
-
|
|
784
|
+
// Same band as the parent menu; the submenu portal mounts later in
|
|
785
|
+
// the DOM so it paints above it (holds for arbitrary nesting depth).
|
|
786
|
+
zIndex: overlayLayer + LAYER_OFFSET.menu
|
|
776
787
|
},
|
|
777
788
|
children: submenu
|
|
778
789
|
}
|
|
@@ -1433,6 +1444,9 @@ var ContextMenuRoot = forwardRef(
|
|
|
1433
1444
|
});
|
|
1434
1445
|
const xuiTheme = rawTheme;
|
|
1435
1446
|
const menuId = useId2();
|
|
1447
|
+
const overlayLayer = useOverlayLayer2();
|
|
1448
|
+
const modalStackDepth = useModalStackDepth();
|
|
1449
|
+
const openModalDepthRef = useRef2(null);
|
|
1436
1450
|
const [internalIsOpen, setInternalIsOpen] = useState4(false);
|
|
1437
1451
|
const [activeIndex, setActiveIndex] = useState4(-1);
|
|
1438
1452
|
const [cellsVersion, setCellsVersion] = useState4(0);
|
|
@@ -1538,6 +1552,19 @@ var ContextMenuRoot = forwardRef(
|
|
|
1538
1552
|
setActiveSubmenuId(null);
|
|
1539
1553
|
}
|
|
1540
1554
|
}, [isOpen]);
|
|
1555
|
+
useEffect3(() => {
|
|
1556
|
+
if (!isOpen) {
|
|
1557
|
+
openModalDepthRef.current = null;
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
if (openModalDepthRef.current === null) {
|
|
1561
|
+
openModalDepthRef.current = modalStackDepth;
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
if (modalStackDepth > openModalDepthRef.current) {
|
|
1565
|
+
closeMenu();
|
|
1566
|
+
}
|
|
1567
|
+
}, [isOpen, modalStackDepth, closeMenu]);
|
|
1541
1568
|
useEffect3(() => {
|
|
1542
1569
|
const timer = setTimeout(
|
|
1543
1570
|
() => setDebouncedQuery(query),
|
|
@@ -1780,7 +1807,7 @@ var ContextMenuRoot = forwardRef(
|
|
|
1780
1807
|
style: {
|
|
1781
1808
|
...positionStyle,
|
|
1782
1809
|
...style,
|
|
1783
|
-
zIndex:
|
|
1810
|
+
zIndex: overlayLayer + LAYER_OFFSET2.menu,
|
|
1784
1811
|
boxShadow: PANEL_SHADOW,
|
|
1785
1812
|
...withArrow ? {
|
|
1786
1813
|
overflow: "visible"
|