@ainias42/react-bootstrap-mobile 0.2.14 → 0.2.15
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* @ainias42/react-bootstrap-mobile v0.2.
|
|
3
|
+
* @ainias42/react-bootstrap-mobile v0.2.14
|
|
4
4
|
* git+https://github.com/Ainias/Bootstrap-React-Mobile.git
|
|
5
5
|
* Copyright (c) Silas Günther and project contributors.
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
@@ -7581,35 +7581,35 @@ const Menu = withMemo(withRenderBrowserOnly(function Menu({
|
|
|
7581
7581
|
elem === null || elem === void 0 ? void 0 : elem.appendChild(portalContainer);
|
|
7582
7582
|
}, [isOpen, portalContainer, window === null || window === void 0 ? void 0 : window.document.body]);
|
|
7583
7583
|
useClientLayoutEffect(() => {
|
|
7584
|
-
var _a;
|
|
7585
7584
|
if (!menuRef.current) {
|
|
7586
|
-
return;
|
|
7587
|
-
}
|
|
7588
|
-
const width = parseFloat(getComputedStyle(menuRef.current).width);
|
|
7589
|
-
let newX = x;
|
|
7590
|
-
if (newX > ((_a = window === null || window === void 0 ? void 0 : window.innerWidth) !== null && _a !== void 0 ? _a : 0) - width) {
|
|
7591
|
-
newX -= width + offsetX;
|
|
7592
|
-
}
|
|
7593
|
-
if (newX < 0) {
|
|
7594
|
-
newX = 0;
|
|
7595
|
-
}
|
|
7596
|
-
setInnerX(newX);
|
|
7597
|
-
}, [offsetX, window === null || window === void 0 ? void 0 : window.innerWidth, x]);
|
|
7598
|
-
useClientLayoutEffect(() => {
|
|
7599
|
-
var _a;
|
|
7600
|
-
if (!menuRef.current) {
|
|
7601
|
-
return;
|
|
7602
|
-
}
|
|
7603
|
-
const height = parseFloat(getComputedStyle(menuRef.current).height);
|
|
7604
|
-
let newY = y;
|
|
7605
|
-
if (newY > ((_a = window === null || window === void 0 ? void 0 : window.innerHeight) !== null && _a !== void 0 ? _a : 0) - height) {
|
|
7606
|
-
newY -= height + offsetY;
|
|
7607
|
-
}
|
|
7608
|
-
if (newY < 0) {
|
|
7609
|
-
newY = 0;
|
|
7585
|
+
return undefined;
|
|
7610
7586
|
}
|
|
7611
|
-
|
|
7612
|
-
|
|
7587
|
+
const menuElement = menuRef.current;
|
|
7588
|
+
const updateInnerPositions = () => {
|
|
7589
|
+
var _a, _b;
|
|
7590
|
+
const computedStyle = getComputedStyle(menuElement);
|
|
7591
|
+
const height = parseFloat(computedStyle.height);
|
|
7592
|
+
let newY = y;
|
|
7593
|
+
if (newY > ((_a = window === null || window === void 0 ? void 0 : window.innerHeight) !== null && _a !== void 0 ? _a : 0) - height) {
|
|
7594
|
+
newY -= height + offsetY;
|
|
7595
|
+
}
|
|
7596
|
+
setInnerY(Math.max(0, newY));
|
|
7597
|
+
const width = parseFloat(computedStyle.width);
|
|
7598
|
+
let newX = x;
|
|
7599
|
+
if (newX > ((_b = window === null || window === void 0 ? void 0 : window.innerWidth) !== null && _b !== void 0 ? _b : 0) - width) {
|
|
7600
|
+
newX -= width + offsetX;
|
|
7601
|
+
}
|
|
7602
|
+
setInnerX(Math.max(0, newX));
|
|
7603
|
+
};
|
|
7604
|
+
const observer = new ResizeObserver(() => {
|
|
7605
|
+
updateInnerPositions();
|
|
7606
|
+
});
|
|
7607
|
+
observer.observe(menuElement);
|
|
7608
|
+
updateInnerPositions();
|
|
7609
|
+
return () => {
|
|
7610
|
+
observer.disconnect();
|
|
7611
|
+
};
|
|
7612
|
+
}, [window, x, y, offsetX, offsetY]);
|
|
7613
7613
|
// Other
|
|
7614
7614
|
// Render Functions
|
|
7615
7615
|
if (!isOpen) {
|
|
@@ -8735,7 +8735,6 @@ const Switch = withMemo(function Switch(_a) {
|
|
|
8735
8735
|
}, [onChange, onChangeChecked]);
|
|
8736
8736
|
const checkStopPropagation = (0,external_react_.useCallback)(ev => {
|
|
8737
8737
|
if (stopPropagation) {
|
|
8738
|
-
console.log("LOG-d stopPropagation inside checkStopPropagation", ev);
|
|
8739
8738
|
ev.stopPropagation();
|
|
8740
8739
|
ev.nativeEvent.stopPropagation();
|
|
8741
8740
|
}
|