@nulogy/components 10.2.7 → 10.2.8

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/dist/main.js CHANGED
@@ -21218,7 +21218,15 @@
21218
21218
  showArrow = _ref.showArrow,
21219
21219
  openAriaLabel = _ref.openAriaLabel,
21220
21220
  closeAriaLabel = _ref.closeAriaLabel;
21221
- var timeoutID;
21221
+ // We're going to manage the ID of the timeout in a ref so that we can examine
21222
+ // it without causing a re-render. Note that "0" will denote "no jobs running",
21223
+ // whereas positive values are the ID of the running job.
21224
+ var timeoutId = React.useRef(0);
21225
+
21226
+ var resetTimeoutId = function resetTimeoutId() {
21227
+ clearTimeout(timeoutId.current);
21228
+ timeoutId.current = 0;
21229
+ };
21222
21230
 
21223
21231
  var _useState = React.useState(defaultOpen),
21224
21232
  isOpen = _useState[0],
@@ -21230,14 +21238,14 @@
21230
21238
  }
21231
21239
 
21232
21240
  if (!skipDelay) {
21233
- timeoutID = setTimeout(fnc, delay);
21241
+ timeoutId.current = setTimeout(fnc, delay);
21234
21242
  } else {
21235
21243
  fnc();
21236
21244
  }
21237
21245
  };
21238
21246
 
21239
21247
  var setPopUpState = function setPopUpState(nextIsOpenState, skipDelay) {
21240
- clearTimeout(timeoutID);
21248
+ resetTimeoutId();
21241
21249
  conditionallyApplyDelay(function () {
21242
21250
  return setIsOpen(nextIsOpenState);
21243
21251
  }, nextIsOpenState ? showDelay : hideDelay, skipDelay);
@@ -21248,19 +21256,17 @@
21248
21256
  };
21249
21257
 
21250
21258
  React.useEffect(function () {
21251
- var handleKeyDown = function handleKeyDown(event) {
21252
- switch (event.keyCode) {
21253
- case keyCodes.ESC:
21254
- closePopUp();
21255
- break;
21259
+ function handleKeyDown(event) {
21260
+ if (event.code === "Escape") {
21261
+ closePopUp();
21256
21262
  }
21257
- };
21263
+ }
21258
21264
 
21259
21265
  document.addEventListener("keydown", handleKeyDown);
21260
21266
 
21261
21267
  var cleanup = function cleanup() {
21262
21268
  document.removeEventListener("keydown", handleKeyDown);
21263
- clearTimeout(timeoutID);
21269
+ resetTimeoutId();
21264
21270
  };
21265
21271
 
21266
21272
  return cleanup;
@@ -21201,7 +21201,15 @@ var Popper$2 = /*#__PURE__*/React__default.forwardRef(function (_ref, popperRef)
21201
21201
  showArrow = _ref.showArrow,
21202
21202
  openAriaLabel = _ref.openAriaLabel,
21203
21203
  closeAriaLabel = _ref.closeAriaLabel;
21204
- var timeoutID;
21204
+ // We're going to manage the ID of the timeout in a ref so that we can examine
21205
+ // it without causing a re-render. Note that "0" will denote "no jobs running",
21206
+ // whereas positive values are the ID of the running job.
21207
+ var timeoutId = useRef(0);
21208
+
21209
+ var resetTimeoutId = function resetTimeoutId() {
21210
+ clearTimeout(timeoutId.current);
21211
+ timeoutId.current = 0;
21212
+ };
21205
21213
 
21206
21214
  var _useState = useState(defaultOpen),
21207
21215
  isOpen = _useState[0],
@@ -21213,14 +21221,14 @@ var Popper$2 = /*#__PURE__*/React__default.forwardRef(function (_ref, popperRef)
21213
21221
  }
21214
21222
 
21215
21223
  if (!skipDelay) {
21216
- timeoutID = setTimeout(fnc, delay);
21224
+ timeoutId.current = setTimeout(fnc, delay);
21217
21225
  } else {
21218
21226
  fnc();
21219
21227
  }
21220
21228
  };
21221
21229
 
21222
21230
  var setPopUpState = function setPopUpState(nextIsOpenState, skipDelay) {
21223
- clearTimeout(timeoutID);
21231
+ resetTimeoutId();
21224
21232
  conditionallyApplyDelay(function () {
21225
21233
  return setIsOpen(nextIsOpenState);
21226
21234
  }, nextIsOpenState ? showDelay : hideDelay, skipDelay);
@@ -21231,19 +21239,17 @@ var Popper$2 = /*#__PURE__*/React__default.forwardRef(function (_ref, popperRef)
21231
21239
  };
21232
21240
 
21233
21241
  useEffect(function () {
21234
- var handleKeyDown = function handleKeyDown(event) {
21235
- switch (event.keyCode) {
21236
- case keyCodes.ESC:
21237
- closePopUp();
21238
- break;
21242
+ function handleKeyDown(event) {
21243
+ if (event.code === "Escape") {
21244
+ closePopUp();
21239
21245
  }
21240
- };
21246
+ }
21241
21247
 
21242
21248
  document.addEventListener("keydown", handleKeyDown);
21243
21249
 
21244
21250
  var cleanup = function cleanup() {
21245
21251
  document.removeEventListener("keydown", handleKeyDown);
21246
- clearTimeout(timeoutID);
21252
+ resetTimeoutId();
21247
21253
  };
21248
21254
 
21249
21255
  return cleanup;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "10.2.7",
3
+ "version": "10.2.8",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {