@nulogy/components 8.1.5 → 8.1.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
@@ -23679,7 +23679,16 @@
23679
23679
  * http://api.jqueryui.com/category/ui-core/
23680
23680
  */
23681
23681
 
23682
- var tabbableNode = /input|select|textarea|button|object/;
23682
+ var DISPLAY_NONE = "none";
23683
+ var DISPLAY_CONTENTS = "contents";
23684
+
23685
+ var tabbableNode = /input|select|textarea|button|object|iframe/;
23686
+
23687
+ function isNotOverflowing(element, style) {
23688
+ return style.getPropertyValue("overflow") !== "visible" ||
23689
+ // if 'overflow: visible' set, check if there is actually any overflow
23690
+ element.scrollWidth <= 0 && element.scrollHeight <= 0;
23691
+ }
23683
23692
 
23684
23693
  function hidesContents(element) {
23685
23694
  var zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;
@@ -23690,9 +23699,8 @@
23690
23699
  try {
23691
23700
  // Otherwise we need to check some styles
23692
23701
  var style = window.getComputedStyle(element);
23693
- return zeroSize ? style.getPropertyValue("overflow") !== "visible" ||
23694
- // if 'overflow: visible' set, check if there is actually any overflow
23695
- element.scrollWidth <= 0 && element.scrollHeight <= 0 : style.getPropertyValue("display") == "none";
23702
+ var displayValue = style.getPropertyValue("display");
23703
+ return zeroSize ? displayValue !== DISPLAY_CONTENTS && isNotOverflowing(element, style) : displayValue === DISPLAY_NONE;
23696
23704
  } catch (exception) {
23697
23705
  // eslint-disable-next-line no-console
23698
23706
  console.warn("Failed to inspect element style");
@@ -23702,8 +23710,13 @@
23702
23710
 
23703
23711
  function visible(element) {
23704
23712
  var parentElement = element;
23713
+ var rootNode = element.getRootNode && element.getRootNode();
23705
23714
  while (parentElement) {
23706
23715
  if (parentElement === document.body) break;
23716
+
23717
+ // if we are not hidden yet, skip to checking outside the Web Component
23718
+ if (rootNode && parentElement === rootNode) parentElement = rootNode.host.parentNode;
23719
+
23707
23720
  if (hidesContents(parentElement)) return false;
23708
23721
  parentElement = parentElement.parentNode;
23709
23722
  }
@@ -23724,7 +23737,10 @@
23724
23737
  }
23725
23738
 
23726
23739
  function findTabbableDescendants(element) {
23727
- return [].slice.call(element.querySelectorAll("*"), 0).filter(tabbable);
23740
+ var descendants = [].slice.call(element.querySelectorAll("*"), 0).reduce(function (finished, el) {
23741
+ return finished.concat(!el.shadowRoot ? [el] : findTabbableDescendants(el.shadowRoot));
23742
+ }, []);
23743
+ return descendants.filter(tabbable);
23728
23744
  }
23729
23745
  module.exports = exports["default"];
23730
23746
  });
@@ -23764,13 +23780,14 @@
23764
23780
 
23765
23781
  /* istanbul ignore next */
23766
23782
  function log() {
23767
- if (process.env.NODE_ENV === "production") return;
23768
- console.log("focusManager ----------");
23769
- focusLaterElements.forEach(function (f) {
23770
- var check = f || {};
23771
- console.log(check.nodeName, check.className, check.id);
23772
- });
23773
- console.log("end focusManager ----------");
23783
+ if (process.env.NODE_ENV !== "production") {
23784
+ console.log("focusManager ----------");
23785
+ focusLaterElements.forEach(function (f) {
23786
+ var check = f || {};
23787
+ console.log(check.nodeName, check.className, check.id);
23788
+ });
23789
+ console.log("end focusManager ----------");
23790
+ }
23774
23791
  }
23775
23792
  /* eslint-enable no-console */
23776
23793
 
@@ -23873,6 +23890,12 @@
23873
23890
 
23874
23891
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23875
23892
 
23893
+ function getActiveElement() {
23894
+ var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
23895
+
23896
+ return el.activeElement.shadowRoot ? getActiveElement(el.activeElement.shadowRoot) : el.activeElement;
23897
+ }
23898
+
23876
23899
  function scopeTab(node, event) {
23877
23900
  var tabbable = (0, _tabbable2.default)(node);
23878
23901
 
@@ -23887,19 +23910,20 @@
23887
23910
  var shiftKey = event.shiftKey;
23888
23911
  var head = tabbable[0];
23889
23912
  var tail = tabbable[tabbable.length - 1];
23913
+ var activeElement = getActiveElement();
23890
23914
 
23891
23915
  // proceed with default browser behavior on tab.
23892
23916
  // Focus on last element on shift + tab.
23893
- if (node === document.activeElement) {
23917
+ if (node === activeElement) {
23894
23918
  if (!shiftKey) return;
23895
23919
  target = tail;
23896
23920
  }
23897
23921
 
23898
- if (tail === document.activeElement && !shiftKey) {
23922
+ if (tail === activeElement && !shiftKey) {
23899
23923
  target = head;
23900
23924
  }
23901
23925
 
23902
- if (head === document.activeElement && shiftKey) {
23926
+ if (head === activeElement && shiftKey) {
23903
23927
  target = tail;
23904
23928
  }
23905
23929
 
@@ -23927,7 +23951,7 @@
23927
23951
  // the focus
23928
23952
  if (!isSafariDesktop) return;
23929
23953
 
23930
- var x = tabbable.indexOf(document.activeElement);
23954
+ var x = tabbable.indexOf(activeElement);
23931
23955
 
23932
23956
  if (x > -1) {
23933
23957
  x += shiftKey ? -1 : 1;
@@ -24029,11 +24053,12 @@
24029
24053
 
24030
24054
  /* istanbul ignore next */
24031
24055
  function log() {
24032
- if (process.env.NODE_ENV === "production") return;
24033
- var check = globalElement || {};
24034
- console.log("ariaAppHider ----------");
24035
- console.log(check.nodeName, check.className, check.id);
24036
- console.log("end ariaAppHider ----------");
24056
+ if (process.env.NODE_ENV !== "production") {
24057
+ var check = globalElement || {};
24058
+ console.log("ariaAppHider ----------");
24059
+ console.log(check.nodeName, check.className, check.id);
24060
+ console.log("end ariaAppHider ----------");
24061
+ }
24037
24062
  }
24038
24063
  /* eslint-enable no-console */
24039
24064
 
@@ -24168,26 +24193,26 @@
24168
24193
 
24169
24194
  /* istanbul ignore next */
24170
24195
  function log() {
24171
- if (process.env.NODE_ENV === "production") return;
24172
-
24173
- var classes = document.getElementsByTagName("html")[0].className;
24174
- var buffer = "Show tracked classes:\n\n";
24196
+ if (process.env.NODE_ENV !== "production") {
24197
+ var classes = document.getElementsByTagName("html")[0].className;
24198
+ var buffer = "Show tracked classes:\n\n";
24175
24199
 
24176
- buffer += "<html /> (" + classes + "):\n";
24177
- for (var x in htmlClassList) {
24178
- buffer += " " + x + " " + htmlClassList[x] + "\n";
24179
- }
24200
+ buffer += "<html /> (" + classes + "):\n ";
24201
+ for (var x in htmlClassList) {
24202
+ buffer += " " + x + " " + htmlClassList[x] + "\n ";
24203
+ }
24180
24204
 
24181
- classes = document.body.className;
24205
+ classes = document.body.className;
24182
24206
 
24183
- buffer += "\n\ndoc.body (" + classes + "):\n";
24184
- for (var _x in docBodyClassList) {
24185
- buffer += " " + _x + " " + docBodyClassList[_x] + "\n";
24186
- }
24207
+ buffer += "\n\ndoc.body (" + classes + "):\n ";
24208
+ for (var _x in docBodyClassList) {
24209
+ buffer += " " + _x + " " + docBodyClassList[_x] + "\n ";
24210
+ }
24187
24211
 
24188
- buffer += "\n";
24212
+ buffer += "\n";
24189
24213
 
24190
- console.log(buffer);
24214
+ console.log(buffer);
24215
+ }
24191
24216
  }
24192
24217
  /* eslint-enable no-console */
24193
24218
 
@@ -24515,8 +24540,17 @@
24515
24540
  content: "ReactModal__Content"
24516
24541
  };
24517
24542
 
24518
- var TAB_KEY = 9;
24519
- var ESC_KEY = 27;
24543
+ /**
24544
+ * We need to support the deprecated `KeyboardEvent.keyCode` in addition to
24545
+ * `KeyboardEvent.code` for apps that still support IE11. Can be removed when
24546
+ * `react-modal` only supports React >18 (which dropped IE support).
24547
+ */
24548
+ var isTabKey = function isTabKey(event) {
24549
+ return event.code === "Tab" || event.keyCode === 9;
24550
+ };
24551
+ var isEscKey = function isEscKey(event) {
24552
+ return event.code === "Escape" || event.keyCode === 27;
24553
+ };
24520
24554
 
24521
24555
  var ariaHiddenInstances = 0;
24522
24556
 
@@ -24543,13 +24577,16 @@
24543
24577
  appElement = _this$props.appElement,
24544
24578
  ariaHideApp = _this$props.ariaHideApp,
24545
24579
  htmlOpenClassName = _this$props.htmlOpenClassName,
24546
- bodyOpenClassName = _this$props.bodyOpenClassName;
24580
+ bodyOpenClassName = _this$props.bodyOpenClassName,
24581
+ parentSelector = _this$props.parentSelector;
24547
24582
 
24548
- // Remove classes.
24549
24583
 
24550
- bodyOpenClassName && classList$1.remove(document.body, bodyOpenClassName);
24584
+ var parentDocument = parentSelector && parentSelector().ownerDocument || document;
24551
24585
 
24552
- htmlOpenClassName && classList$1.remove(document.getElementsByTagName("html")[0], htmlOpenClassName);
24586
+ // Remove classes.
24587
+ bodyOpenClassName && classList$1.remove(parentDocument.body, bodyOpenClassName);
24588
+
24589
+ htmlOpenClassName && classList$1.remove(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
24553
24590
 
24554
24591
  // Reset aria-hidden attribute if all modals have been removed
24555
24592
  if (ariaHideApp && ariaHiddenInstances > 0) {
@@ -24631,11 +24668,11 @@
24631
24668
  };
24632
24669
 
24633
24670
  _this.handleKeyDown = function (event) {
24634
- if (event.keyCode === TAB_KEY) {
24671
+ if (isTabKey(event)) {
24635
24672
  (0, _scopeTab2.default)(_this.content, event);
24636
24673
  }
24637
24674
 
24638
- if (_this.props.shouldCloseOnEsc && event.keyCode === ESC_KEY) {
24675
+ if (_this.props.shouldCloseOnEsc && isEscKey(event)) {
24639
24676
  event.stopPropagation();
24640
24677
  _this.requestClose(event);
24641
24678
  }
@@ -24771,13 +24808,16 @@
24771
24808
  appElement = _props.appElement,
24772
24809
  ariaHideApp = _props.ariaHideApp,
24773
24810
  htmlOpenClassName = _props.htmlOpenClassName,
24774
- bodyOpenClassName = _props.bodyOpenClassName;
24811
+ bodyOpenClassName = _props.bodyOpenClassName,
24812
+ parentSelector = _props.parentSelector;
24775
24813
 
24776
- // Add classes.
24777
24814
 
24778
- bodyOpenClassName && classList$1.add(document.body, bodyOpenClassName);
24815
+ var parentDocument = parentSelector && parentSelector().ownerDocument || document;
24779
24816
 
24780
- htmlOpenClassName && classList$1.add(document.getElementsByTagName("html")[0], htmlOpenClassName);
24817
+ // Add classes.
24818
+ bodyOpenClassName && classList$1.add(parentDocument.body, bodyOpenClassName);
24819
+
24820
+ htmlOpenClassName && classList$1.add(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
24781
24821
 
24782
24822
  if (ariaHideApp) {
24783
24823
  ariaHiddenInstances += 1;
@@ -24857,6 +24897,7 @@
24857
24897
  }),
24858
24898
  className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
24859
24899
  overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
24900
+ parentSelector: _propTypes2.default.func,
24860
24901
  bodyOpenClassName: _propTypes2.default.string,
24861
24902
  htmlOpenClassName: _propTypes2.default.string,
24862
24903
  ariaHideApp: _propTypes2.default.bool,
@@ -25529,7 +25570,8 @@
25529
25570
  appElement = _ref4.appElement,
25530
25571
  ariaHideApp = _ref4.ariaHideApp,
25531
25572
  footerContent = _ref4.footerContent,
25532
- closeAriaLabel = _ref4.closeAriaLabel;
25573
+ closeAriaLabel = _ref4.closeAriaLabel,
25574
+ parentSelector = _ref4.parentSelector;
25533
25575
  var modalHasHeader = onRequestClose || title;
25534
25576
  var themeContext = React.useContext(styled.ThemeContext);
25535
25577
  return /*#__PURE__*/React__default['default'].createElement(StyledReactModal, {
@@ -25554,9 +25596,10 @@
25554
25596
  overlay: overlayStyle(themeContext)
25555
25597
  },
25556
25598
  appElement: appElement,
25557
- ariaHideApp: ariaHideApp
25599
+ ariaHideApp: ariaHideApp,
25600
+ parentSelector: parentSelector
25558
25601
  }, /*#__PURE__*/React__default['default'].createElement(PreventBodyElementScrolling, null, modalHasHeader && /*#__PURE__*/React__default['default'].createElement(ModalHeader, {
25559
- hasCloseButton: onRequestClose
25602
+ hasCloseButton: Boolean(onRequestClose)
25560
25603
  }, title ? /*#__PURE__*/React__default['default'].createElement(Heading2, {
25561
25604
  id: "modal-title",
25562
25605
  mb: "none"
@@ -25576,7 +25619,6 @@
25576
25619
  isOpen: true,
25577
25620
  title: undefined,
25578
25621
  ariaLabel: undefined,
25579
- children: undefined,
25580
25622
  onRequestClose: undefined,
25581
25623
  closeAriaLabel: undefined,
25582
25624
  onAfterOpen: undefined,
@@ -25590,7 +25632,8 @@
25590
25632
  id: undefined,
25591
25633
  appElement: undefined,
25592
25634
  ariaHideApp: true,
25593
- footerContent: undefined
25635
+ footerContent: undefined,
25636
+ parentSelector: undefined
25594
25637
  };
25595
25638
  Modal.setAppElement = ReactModal.setAppElement;
25596
25639
 
@@ -23653,7 +23653,16 @@ exports.default = findTabbableDescendants;
23653
23653
  * http://api.jqueryui.com/category/ui-core/
23654
23654
  */
23655
23655
 
23656
- var tabbableNode = /input|select|textarea|button|object/;
23656
+ var DISPLAY_NONE = "none";
23657
+ var DISPLAY_CONTENTS = "contents";
23658
+
23659
+ var tabbableNode = /input|select|textarea|button|object|iframe/;
23660
+
23661
+ function isNotOverflowing(element, style) {
23662
+ return style.getPropertyValue("overflow") !== "visible" ||
23663
+ // if 'overflow: visible' set, check if there is actually any overflow
23664
+ element.scrollWidth <= 0 && element.scrollHeight <= 0;
23665
+ }
23657
23666
 
23658
23667
  function hidesContents(element) {
23659
23668
  var zeroSize = element.offsetWidth <= 0 && element.offsetHeight <= 0;
@@ -23664,9 +23673,8 @@ function hidesContents(element) {
23664
23673
  try {
23665
23674
  // Otherwise we need to check some styles
23666
23675
  var style = window.getComputedStyle(element);
23667
- return zeroSize ? style.getPropertyValue("overflow") !== "visible" ||
23668
- // if 'overflow: visible' set, check if there is actually any overflow
23669
- element.scrollWidth <= 0 && element.scrollHeight <= 0 : style.getPropertyValue("display") == "none";
23676
+ var displayValue = style.getPropertyValue("display");
23677
+ return zeroSize ? displayValue !== DISPLAY_CONTENTS && isNotOverflowing(element, style) : displayValue === DISPLAY_NONE;
23670
23678
  } catch (exception) {
23671
23679
  // eslint-disable-next-line no-console
23672
23680
  console.warn("Failed to inspect element style");
@@ -23676,8 +23684,13 @@ function hidesContents(element) {
23676
23684
 
23677
23685
  function visible(element) {
23678
23686
  var parentElement = element;
23687
+ var rootNode = element.getRootNode && element.getRootNode();
23679
23688
  while (parentElement) {
23680
23689
  if (parentElement === document.body) break;
23690
+
23691
+ // if we are not hidden yet, skip to checking outside the Web Component
23692
+ if (rootNode && parentElement === rootNode) parentElement = rootNode.host.parentNode;
23693
+
23681
23694
  if (hidesContents(parentElement)) return false;
23682
23695
  parentElement = parentElement.parentNode;
23683
23696
  }
@@ -23698,7 +23711,10 @@ function tabbable(element) {
23698
23711
  }
23699
23712
 
23700
23713
  function findTabbableDescendants(element) {
23701
- return [].slice.call(element.querySelectorAll("*"), 0).filter(tabbable);
23714
+ var descendants = [].slice.call(element.querySelectorAll("*"), 0).reduce(function (finished, el) {
23715
+ return finished.concat(!el.shadowRoot ? [el] : findTabbableDescendants(el.shadowRoot));
23716
+ }, []);
23717
+ return descendants.filter(tabbable);
23702
23718
  }
23703
23719
  module.exports = exports["default"];
23704
23720
  });
@@ -23738,13 +23754,14 @@ function resetState() {
23738
23754
 
23739
23755
  /* istanbul ignore next */
23740
23756
  function log() {
23741
- if (process.env.NODE_ENV === "production") return;
23742
- console.log("focusManager ----------");
23743
- focusLaterElements.forEach(function (f) {
23744
- var check = f || {};
23745
- console.log(check.nodeName, check.className, check.id);
23746
- });
23747
- console.log("end focusManager ----------");
23757
+ if (process.env.NODE_ENV !== "production") {
23758
+ console.log("focusManager ----------");
23759
+ focusLaterElements.forEach(function (f) {
23760
+ var check = f || {};
23761
+ console.log(check.nodeName, check.className, check.id);
23762
+ });
23763
+ console.log("end focusManager ----------");
23764
+ }
23748
23765
  }
23749
23766
  /* eslint-enable no-console */
23750
23767
 
@@ -23847,6 +23864,12 @@ var _tabbable2 = _interopRequireDefault(tabbable_1);
23847
23864
 
23848
23865
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23849
23866
 
23867
+ function getActiveElement() {
23868
+ var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
23869
+
23870
+ return el.activeElement.shadowRoot ? getActiveElement(el.activeElement.shadowRoot) : el.activeElement;
23871
+ }
23872
+
23850
23873
  function scopeTab(node, event) {
23851
23874
  var tabbable = (0, _tabbable2.default)(node);
23852
23875
 
@@ -23861,19 +23884,20 @@ function scopeTab(node, event) {
23861
23884
  var shiftKey = event.shiftKey;
23862
23885
  var head = tabbable[0];
23863
23886
  var tail = tabbable[tabbable.length - 1];
23887
+ var activeElement = getActiveElement();
23864
23888
 
23865
23889
  // proceed with default browser behavior on tab.
23866
23890
  // Focus on last element on shift + tab.
23867
- if (node === document.activeElement) {
23891
+ if (node === activeElement) {
23868
23892
  if (!shiftKey) return;
23869
23893
  target = tail;
23870
23894
  }
23871
23895
 
23872
- if (tail === document.activeElement && !shiftKey) {
23896
+ if (tail === activeElement && !shiftKey) {
23873
23897
  target = head;
23874
23898
  }
23875
23899
 
23876
- if (head === document.activeElement && shiftKey) {
23900
+ if (head === activeElement && shiftKey) {
23877
23901
  target = tail;
23878
23902
  }
23879
23903
 
@@ -23901,7 +23925,7 @@ function scopeTab(node, event) {
23901
23925
  // the focus
23902
23926
  if (!isSafariDesktop) return;
23903
23927
 
23904
- var x = tabbable.indexOf(document.activeElement);
23928
+ var x = tabbable.indexOf(activeElement);
23905
23929
 
23906
23930
  if (x > -1) {
23907
23931
  x += shiftKey ? -1 : 1;
@@ -24003,11 +24027,12 @@ function resetState() {
24003
24027
 
24004
24028
  /* istanbul ignore next */
24005
24029
  function log() {
24006
- if (process.env.NODE_ENV === "production") return;
24007
- var check = globalElement || {};
24008
- console.log("ariaAppHider ----------");
24009
- console.log(check.nodeName, check.className, check.id);
24010
- console.log("end ariaAppHider ----------");
24030
+ if (process.env.NODE_ENV !== "production") {
24031
+ var check = globalElement || {};
24032
+ console.log("ariaAppHider ----------");
24033
+ console.log(check.nodeName, check.className, check.id);
24034
+ console.log("end ariaAppHider ----------");
24035
+ }
24011
24036
  }
24012
24037
  /* eslint-enable no-console */
24013
24038
 
@@ -24142,26 +24167,26 @@ function resetState() {
24142
24167
 
24143
24168
  /* istanbul ignore next */
24144
24169
  function log() {
24145
- if (process.env.NODE_ENV === "production") return;
24146
-
24147
- var classes = document.getElementsByTagName("html")[0].className;
24148
- var buffer = "Show tracked classes:\n\n";
24170
+ if (process.env.NODE_ENV !== "production") {
24171
+ var classes = document.getElementsByTagName("html")[0].className;
24172
+ var buffer = "Show tracked classes:\n\n";
24149
24173
 
24150
- buffer += "<html /> (" + classes + "):\n";
24151
- for (var x in htmlClassList) {
24152
- buffer += " " + x + " " + htmlClassList[x] + "\n";
24153
- }
24174
+ buffer += "<html /> (" + classes + "):\n ";
24175
+ for (var x in htmlClassList) {
24176
+ buffer += " " + x + " " + htmlClassList[x] + "\n ";
24177
+ }
24154
24178
 
24155
- classes = document.body.className;
24179
+ classes = document.body.className;
24156
24180
 
24157
- buffer += "\n\ndoc.body (" + classes + "):\n";
24158
- for (var _x in docBodyClassList) {
24159
- buffer += " " + _x + " " + docBodyClassList[_x] + "\n";
24160
- }
24181
+ buffer += "\n\ndoc.body (" + classes + "):\n ";
24182
+ for (var _x in docBodyClassList) {
24183
+ buffer += " " + _x + " " + docBodyClassList[_x] + "\n ";
24184
+ }
24161
24185
 
24162
- buffer += "\n";
24186
+ buffer += "\n";
24163
24187
 
24164
- console.log(buffer);
24188
+ console.log(buffer);
24189
+ }
24165
24190
  }
24166
24191
  /* eslint-enable no-console */
24167
24192
 
@@ -24489,8 +24514,17 @@ var CLASS_NAMES = {
24489
24514
  content: "ReactModal__Content"
24490
24515
  };
24491
24516
 
24492
- var TAB_KEY = 9;
24493
- var ESC_KEY = 27;
24517
+ /**
24518
+ * We need to support the deprecated `KeyboardEvent.keyCode` in addition to
24519
+ * `KeyboardEvent.code` for apps that still support IE11. Can be removed when
24520
+ * `react-modal` only supports React >18 (which dropped IE support).
24521
+ */
24522
+ var isTabKey = function isTabKey(event) {
24523
+ return event.code === "Tab" || event.keyCode === 9;
24524
+ };
24525
+ var isEscKey = function isEscKey(event) {
24526
+ return event.code === "Escape" || event.keyCode === 27;
24527
+ };
24494
24528
 
24495
24529
  var ariaHiddenInstances = 0;
24496
24530
 
@@ -24517,13 +24551,16 @@ var ModalPortal = function (_Component) {
24517
24551
  appElement = _this$props.appElement,
24518
24552
  ariaHideApp = _this$props.ariaHideApp,
24519
24553
  htmlOpenClassName = _this$props.htmlOpenClassName,
24520
- bodyOpenClassName = _this$props.bodyOpenClassName;
24554
+ bodyOpenClassName = _this$props.bodyOpenClassName,
24555
+ parentSelector = _this$props.parentSelector;
24521
24556
 
24522
- // Remove classes.
24523
24557
 
24524
- bodyOpenClassName && classList$1.remove(document.body, bodyOpenClassName);
24558
+ var parentDocument = parentSelector && parentSelector().ownerDocument || document;
24525
24559
 
24526
- htmlOpenClassName && classList$1.remove(document.getElementsByTagName("html")[0], htmlOpenClassName);
24560
+ // Remove classes.
24561
+ bodyOpenClassName && classList$1.remove(parentDocument.body, bodyOpenClassName);
24562
+
24563
+ htmlOpenClassName && classList$1.remove(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
24527
24564
 
24528
24565
  // Reset aria-hidden attribute if all modals have been removed
24529
24566
  if (ariaHideApp && ariaHiddenInstances > 0) {
@@ -24605,11 +24642,11 @@ var ModalPortal = function (_Component) {
24605
24642
  };
24606
24643
 
24607
24644
  _this.handleKeyDown = function (event) {
24608
- if (event.keyCode === TAB_KEY) {
24645
+ if (isTabKey(event)) {
24609
24646
  (0, _scopeTab2.default)(_this.content, event);
24610
24647
  }
24611
24648
 
24612
- if (_this.props.shouldCloseOnEsc && event.keyCode === ESC_KEY) {
24649
+ if (_this.props.shouldCloseOnEsc && isEscKey(event)) {
24613
24650
  event.stopPropagation();
24614
24651
  _this.requestClose(event);
24615
24652
  }
@@ -24745,13 +24782,16 @@ var ModalPortal = function (_Component) {
24745
24782
  appElement = _props.appElement,
24746
24783
  ariaHideApp = _props.ariaHideApp,
24747
24784
  htmlOpenClassName = _props.htmlOpenClassName,
24748
- bodyOpenClassName = _props.bodyOpenClassName;
24785
+ bodyOpenClassName = _props.bodyOpenClassName,
24786
+ parentSelector = _props.parentSelector;
24749
24787
 
24750
- // Add classes.
24751
24788
 
24752
- bodyOpenClassName && classList$1.add(document.body, bodyOpenClassName);
24789
+ var parentDocument = parentSelector && parentSelector().ownerDocument || document;
24753
24790
 
24754
- htmlOpenClassName && classList$1.add(document.getElementsByTagName("html")[0], htmlOpenClassName);
24791
+ // Add classes.
24792
+ bodyOpenClassName && classList$1.add(parentDocument.body, bodyOpenClassName);
24793
+
24794
+ htmlOpenClassName && classList$1.add(parentDocument.getElementsByTagName("html")[0], htmlOpenClassName);
24755
24795
 
24756
24796
  if (ariaHideApp) {
24757
24797
  ariaHiddenInstances += 1;
@@ -24831,6 +24871,7 @@ ModalPortal.propTypes = {
24831
24871
  }),
24832
24872
  className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
24833
24873
  overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
24874
+ parentSelector: _propTypes2.default.func,
24834
24875
  bodyOpenClassName: _propTypes2.default.string,
24835
24876
  htmlOpenClassName: _propTypes2.default.string,
24836
24877
  ariaHideApp: _propTypes2.default.bool,
@@ -25503,7 +25544,8 @@ var Modal = function Modal(_ref4) {
25503
25544
  appElement = _ref4.appElement,
25504
25545
  ariaHideApp = _ref4.ariaHideApp,
25505
25546
  footerContent = _ref4.footerContent,
25506
- closeAriaLabel = _ref4.closeAriaLabel;
25547
+ closeAriaLabel = _ref4.closeAriaLabel,
25548
+ parentSelector = _ref4.parentSelector;
25507
25549
  var modalHasHeader = onRequestClose || title;
25508
25550
  var themeContext = useContext(ThemeContext$1);
25509
25551
  return /*#__PURE__*/React__default.createElement(StyledReactModal, {
@@ -25528,9 +25570,10 @@ var Modal = function Modal(_ref4) {
25528
25570
  overlay: overlayStyle(themeContext)
25529
25571
  },
25530
25572
  appElement: appElement,
25531
- ariaHideApp: ariaHideApp
25573
+ ariaHideApp: ariaHideApp,
25574
+ parentSelector: parentSelector
25532
25575
  }, /*#__PURE__*/React__default.createElement(PreventBodyElementScrolling, null, modalHasHeader && /*#__PURE__*/React__default.createElement(ModalHeader, {
25533
- hasCloseButton: onRequestClose
25576
+ hasCloseButton: Boolean(onRequestClose)
25534
25577
  }, title ? /*#__PURE__*/React__default.createElement(Heading2, {
25535
25578
  id: "modal-title",
25536
25579
  mb: "none"
@@ -25550,7 +25593,6 @@ Modal.defaultProps = {
25550
25593
  isOpen: true,
25551
25594
  title: undefined,
25552
25595
  ariaLabel: undefined,
25553
- children: undefined,
25554
25596
  onRequestClose: undefined,
25555
25597
  closeAriaLabel: undefined,
25556
25598
  onAfterOpen: undefined,
@@ -25564,7 +25606,8 @@ Modal.defaultProps = {
25564
25606
  id: undefined,
25565
25607
  appElement: undefined,
25566
25608
  ariaHideApp: true,
25567
- footerContent: undefined
25609
+ footerContent: undefined,
25610
+ parentSelector: undefined
25568
25611
  };
25569
25612
  Modal.setAppElement = ReactModal.setAppElement;
25570
25613
 
@@ -1,3 +1,25 @@
1
- import ReactModal from "react-modal";
2
- declare const Modal: ReactModal;
1
+ import React from "react";
2
+ declare type ModalProps = {
3
+ isOpen?: boolean;
4
+ title?: string;
5
+ ariaLabel?: string;
6
+ onRequestClose?: (...args: any[]) => any;
7
+ closeAriaLabel?: string;
8
+ onAfterOpen?: (...args: any[]) => any;
9
+ shouldFocusAfterRender?: boolean;
10
+ shouldReturnFocusAfterClose?: boolean;
11
+ ariaDescribedBy?: string;
12
+ maxWidth?: string;
13
+ portalClassName?: string;
14
+ overlayClassName?: string;
15
+ className?: string;
16
+ id?: string;
17
+ appElement?: JSX.Element;
18
+ ariaHideApp?: boolean;
19
+ footerContent?: React.ReactNode;
20
+ parentSelector?: (...args: any) => HTMLElement;
21
+ };
22
+ declare const Modal: React.FC<ModalProps> & {
23
+ setAppElement: (element: string | HTMLElement) => void;
24
+ };
3
25
  export default Modal;
@@ -52,6 +52,12 @@ export declare const WithSelectAndScrollingContent: {
52
52
  name: string;
53
53
  };
54
54
  };
55
+ export declare const WithParentSelector: {
56
+ (): JSX.Element;
57
+ story: {
58
+ name: string;
59
+ };
60
+ };
55
61
  export declare const ExampleControlledModal: {
56
62
  (): JSX.Element;
57
63
  story: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "8.1.5",
3
+ "version": "8.1.8",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -154,9 +154,9 @@
154
154
  "react-fast-compare": "^3.2.0",
155
155
  "react-i18next": "^11.14.2",
156
156
  "react-input-autosize": "^2.2.2",
157
- "react-modal": "^3.10.1",
157
+ "react-modal": "^3.14.4",
158
158
  "react-popper": "1.3.7",
159
- "react-popper-latest": "npm:react-popper@2.2.4",
159
+ "react-popper-2": "npm:react-popper@2.2.4",
160
160
  "react-resize-detector": "^7.1.2",
161
161
  "react-windowed-select": "2.0.2",
162
162
  "smoothscroll-polyfill": "^0.4.4",