intelicoreact 1.3.48 → 1.3.50
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.
|
@@ -89,7 +89,8 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
89
89
|
customFooter,
|
|
90
90
|
testId,
|
|
91
91
|
noHeaderCloseBtn,
|
|
92
|
-
withMobileLogic
|
|
92
|
+
withMobileLogic,
|
|
93
|
+
withFixedFooter
|
|
93
94
|
} = _ref2;
|
|
94
95
|
const modalRef = ref || (0, _react.useRef)(null);
|
|
95
96
|
const {
|
|
@@ -104,6 +105,7 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
104
105
|
} = (0, _useMobileModal.default)({
|
|
105
106
|
modalRef,
|
|
106
107
|
withMobileLogic,
|
|
108
|
+
withFixedFooter,
|
|
107
109
|
isOpen,
|
|
108
110
|
children
|
|
109
111
|
});
|
|
@@ -119,7 +121,8 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
119
121
|
};
|
|
120
122
|
(0, _useHandleKeyPress.default)({
|
|
121
123
|
enterCallback: submitOnEnter && typeof onConfirm === "function" ? () => handle.confirm() : null,
|
|
122
|
-
escCallback: closeOnEsc && typeof closeModal === "function" ? () => closeModal() : null
|
|
124
|
+
escCallback: closeOnEsc && typeof closeModal === "function" ? () => closeModal() : null,
|
|
125
|
+
withClamping: false
|
|
123
126
|
});
|
|
124
127
|
|
|
125
128
|
const render = () => !isOpen ? null : /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -128,11 +131,11 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
128
131
|
},
|
|
129
132
|
"data-testid": testId,
|
|
130
133
|
className: "modal-box j5"
|
|
131
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
134
|
+
}, renderModal( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
132
135
|
"data-testid": "modal-closeOverlay",
|
|
133
136
|
className: isOpen ? "modal-overlay" : "hidden",
|
|
134
137
|
onClick: closeModal
|
|
135
|
-
}),
|
|
138
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
136
139
|
ref: modalRef,
|
|
137
140
|
style: {
|
|
138
141
|
width: size
|
|
@@ -190,7 +193,7 @@ const Modal = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
190
193
|
disabled: confirmBtnDisable,
|
|
191
194
|
icon: confirmBtnIcon,
|
|
192
195
|
isIconRight: isConfirmBtnIconPositionRight
|
|
193
|
-
})))))));
|
|
196
|
+
}))))))));
|
|
194
197
|
|
|
195
198
|
return render();
|
|
196
199
|
});
|
|
@@ -26,6 +26,7 @@ function useMobileModal(_ref) {
|
|
|
26
26
|
let {
|
|
27
27
|
modalRef = null,
|
|
28
28
|
withMobileLogic = false,
|
|
29
|
+
withFixedFooter,
|
|
29
30
|
isOpen
|
|
30
31
|
} = _ref;
|
|
31
32
|
const modalMobileContainerRef = (0, _react.useRef)(null);
|
|
@@ -111,8 +112,8 @@ function useMobileModal(_ref) {
|
|
|
111
112
|
setModalsLogic(prevStickyLogic => ({
|
|
112
113
|
IS_HEADER_HIDDEN: scrollDirection === SCROLL_DIRECTION.DOWN || scrollTop === 0,
|
|
113
114
|
IS_HEADER_STICKY: scrollDirection === SCROLL_DIRECTION.UP && scrollTop !== 0 && (scrollTop >= headerHeight || prevStickyLogic.IS_HEADER_STICKY),
|
|
114
|
-
IS_FOOTER_HIDDEN: scrollDirection === SCROLL_DIRECTION.UP || scrollHeight === Math.round(scrollTop),
|
|
115
|
-
IS_FOOTER_STICKY: scrollDirection === SCROLL_DIRECTION.DOWN && (scrollHeight - Math.round(scrollTop) >= footerHeight || prevStickyLogic.IS_FOOTER_STICKY)
|
|
115
|
+
IS_FOOTER_HIDDEN: !withFixedFooter && (scrollDirection === SCROLL_DIRECTION.UP || scrollHeight === Math.round(scrollTop)),
|
|
116
|
+
IS_FOOTER_STICKY: withFixedFooter && scrollHeight > 1 || scrollDirection === SCROLL_DIRECTION.DOWN && (scrollHeight - Math.round(scrollTop) >= footerHeight || prevStickyLogic.IS_FOOTER_STICKY)
|
|
116
117
|
}));
|
|
117
118
|
}
|
|
118
119
|
}, [scrollTop, scrollHeight, isMobile, withMobileLogic, scrollDirection, modalsLogicProps, modalHeight, window.innerHeight]);
|
|
@@ -36,10 +36,11 @@ var _useKeyPress = _interopRequireDefault(require("./useKeyPress"));
|
|
|
36
36
|
const useHandleKeyPress = _ref => {
|
|
37
37
|
let {
|
|
38
38
|
escCallback,
|
|
39
|
-
enterCallback
|
|
39
|
+
enterCallback,
|
|
40
|
+
withClamping = true
|
|
40
41
|
} = _ref;
|
|
41
|
-
const isPressEnter = (0, _useKeyPress.default)("Enter");
|
|
42
|
-
const isPressEscape = (0, _useKeyPress.default)("Escape");
|
|
42
|
+
const isPressEnter = (0, _useKeyPress.default)("Enter", withClamping);
|
|
43
|
+
const isPressEscape = (0, _useKeyPress.default)("Escape", withClamping);
|
|
43
44
|
(0, _react.useEffect)(() => {
|
|
44
45
|
if (isPressEnter && typeof enterCallback === "function") enterCallback();
|
|
45
46
|
if (isPressEscape && typeof escCallback === "function") escCallback();
|
|
@@ -7,26 +7,31 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
-
const useKeyPress = targetKey
|
|
10
|
+
const useKeyPress = function (targetKey) {
|
|
11
|
+
let clamping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
11
12
|
const [keyPressed, setKeyPressed] = (0, _react.useState)(false);
|
|
12
13
|
const downHandler = (0, _react.useCallback)(_ref => {
|
|
13
14
|
let {
|
|
14
|
-
key
|
|
15
|
+
key,
|
|
16
|
+
repeat
|
|
15
17
|
} = _ref;
|
|
16
18
|
|
|
17
19
|
if (key === targetKey) {
|
|
20
|
+
if (!clamping && repeat) return;
|
|
18
21
|
setKeyPressed(true);
|
|
19
22
|
}
|
|
20
|
-
}, [targetKey]);
|
|
23
|
+
}, [clamping, targetKey]);
|
|
21
24
|
const upHandler = (0, _react.useCallback)(_ref2 => {
|
|
22
25
|
let {
|
|
23
|
-
key
|
|
26
|
+
key,
|
|
27
|
+
repeat
|
|
24
28
|
} = _ref2;
|
|
25
29
|
|
|
26
30
|
if (key === targetKey) {
|
|
31
|
+
if (!clamping && repeat) return;
|
|
27
32
|
setKeyPressed(false);
|
|
28
33
|
}
|
|
29
|
-
}, [targetKey]);
|
|
34
|
+
}, [clamping, targetKey]);
|
|
30
35
|
(0, _react.useEffect)(() => {
|
|
31
36
|
const handleDown = event => downHandler(event);
|
|
32
37
|
|