intelicoreact 1.2.25 → 1.2.27
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.
|
@@ -62,8 +62,8 @@ function useMobileModal(_ref) {
|
|
|
62
62
|
var bodyTop = modalMobileBodyRef === null || modalMobileBodyRef === void 0 ? void 0 : (_modalMobileBodyRef$c = modalMobileBodyRef.current) === null || _modalMobileBodyRef$c === void 0 ? void 0 : (_modalMobileBodyRef$c2 = _modalMobileBodyRef$c.getBoundingClientRect()) === null || _modalMobileBodyRef$c2 === void 0 ? void 0 : _modalMobileBodyRef$c2.top;
|
|
63
63
|
var modal = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current;
|
|
64
64
|
var modalStyle = modal ? modal.currentStyle || window.getComputedStyle(modal) : {};
|
|
65
|
-
var modalHeight = modal ? (modal === null || modal === void 0 ? void 0 : (_modal$getBoundingCli = modal.getBoundingClientRect()) === null || _modal$getBoundingCli === void 0 ? void 0 : _modal$getBoundingCli.height) + parseFloat(modalStyle === null || modalStyle === void 0 ? void 0 : modalStyle.marginTop) : 0;
|
|
66
|
-
var windowHeight = window.screen.availHeight;
|
|
65
|
+
var modalHeight = modal ? (modal === null || modal === void 0 ? void 0 : (_modal$getBoundingCli = modal.getBoundingClientRect()) === null || _modal$getBoundingCli === void 0 ? void 0 : _modal$getBoundingCli.height) + parseFloat((modalStyle === null || modalStyle === void 0 ? void 0 : modalStyle.marginTop) || 0) : 0;
|
|
66
|
+
var windowHeight = document.documentElement.clientHeight || window.screen.availHeight || window.screen.height;
|
|
67
67
|
var modalContainer = modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current;
|
|
68
68
|
/* MODALS LOGIC | BEGIN */
|
|
69
69
|
// Detect Mobile
|
|
@@ -90,16 +90,18 @@ function useMobileModal(_ref) {
|
|
|
90
90
|
}, [scrollTop, scrollTopPrev]); // Dynamic Modal Positioning
|
|
91
91
|
|
|
92
92
|
(0, _react.useEffect)(function () {
|
|
93
|
-
if (
|
|
93
|
+
if (modalHeight && modalMobileContainerRef !== null && modalMobileContainerRef !== void 0 && modalMobileContainerRef.current) {
|
|
94
94
|
if (modalHeight <= windowHeight) {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
modalMobileContainerRef.current.style.display = 'flex';
|
|
96
|
+
modalMobileContainerRef.current.style.alignItems = 'flex-end';
|
|
97
97
|
} else {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
var _modalContainer$style, _modalContainer$style2;
|
|
99
|
+
|
|
100
|
+
modalContainer === null || modalContainer === void 0 ? void 0 : (_modalContainer$style = modalContainer.style) === null || _modalContainer$style === void 0 ? void 0 : _modalContainer$style.removeProperty('display');
|
|
101
|
+
modalContainer === null || modalContainer === void 0 ? void 0 : (_modalContainer$style2 = modalContainer.style) === null || _modalContainer$style2 === void 0 ? void 0 : _modalContainer$style2.removeProperty('align-items');
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
|
-
}, [modalHeight, windowHeight,
|
|
104
|
+
}, [modalHeight, windowHeight, modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current]);
|
|
103
105
|
var MODALS_LOGIC = {
|
|
104
106
|
IS_HEADER_HIDDEN: !isMobile || noMobileModalLogic ? false : footerBottom * -1 <= footerHeight || scrollDirection === SCROLL_DIRECTION.DOWN,
|
|
105
107
|
IS_HEADER_STICKY: !isMobile || noMobileModalLogic ? false : headerTop <= 0,
|