intelicoreact 1.3.47 → 1.3.49

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.
@@ -23,6 +23,7 @@ const RC = "textarea";
23
23
 
24
24
  const Textarea = _ref => {
25
25
  let {
26
+ id,
26
27
  value,
27
28
  onChange,
28
29
  placeholder,
@@ -55,6 +56,7 @@ const Textarea = _ref => {
55
56
  return /*#__PURE__*/_react.default.createElement("div", {
56
57
  className: (0, _classnames.default)("".concat(RC), className)
57
58
  }, /*#__PURE__*/_react.default.createElement("textarea", {
59
+ id: id !== null && id !== void 0 ? id : Math.random().toString(16).slice(2),
58
60
  "data-testid": "textarea-".concat(testId),
59
61
  className: "".concat(RC, "__textarea"),
60
62
  value: value,
@@ -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", {
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.3.47",
3
+ "version": "1.3.49",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [