@nulogy/components 13.1.3 → 13.1.4

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
@@ -355,12 +355,12 @@
355
355
  }
356
356
 
357
357
  var isBrowser$7 = typeof window !== "undefined";
358
- var useIsomorphicLayoutEffect$4 = isBrowser$7 ? React.useLayoutEffect : React.useEffect;
358
+ var useIsomorphicLayoutEffect$5 = isBrowser$7 ? React.useLayoutEffect : React.useEffect;
359
359
 
360
360
  function useSnapshotOnUnmount(visualElement) {
361
361
  var syncLayout = React.useContext(SharedLayoutContext);
362
362
  var framerSyncLayout = React.useContext(FramerTreeLayoutContext);
363
- useIsomorphicLayoutEffect$4(function () { return function () {
363
+ useIsomorphicLayoutEffect$5(function () { return function () {
364
364
  if (isSharedLayout(syncLayout)) {
365
365
  syncLayout.remove(visualElement);
366
366
  }
@@ -391,7 +391,7 @@
391
391
  blockInitialAnimation: (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false,
392
392
  });
393
393
  });
394
- useIsomorphicLayoutEffect$4(function () {
394
+ useIsomorphicLayoutEffect$5(function () {
395
395
  visualElement.setProps(__assign$3(__assign$3(__assign$3({}, config), props), { layoutId: layoutId }));
396
396
  visualElement.isPresent = isPresent(presenceContext);
397
397
  visualElement.isPresenceRoot =
@@ -10719,225 +10719,6 @@
10719
10719
  };
10720
10720
  }
10721
10721
 
10722
- function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
10723
-
10724
- // Older browsers don't support event options, feature detect it.
10725
-
10726
- // Adopted and modified solution from Bohdan Didukh (2017)
10727
- // https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
10728
-
10729
- var hasPassiveEvents = false;
10730
- if (typeof window !== 'undefined') {
10731
- var passiveTestOptions = {
10732
- get passive() {
10733
- hasPassiveEvents = true;
10734
- return undefined;
10735
- }
10736
- };
10737
- window.addEventListener('testPassive', null, passiveTestOptions);
10738
- window.removeEventListener('testPassive', null, passiveTestOptions);
10739
- }
10740
-
10741
- var isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);
10742
-
10743
-
10744
- var locks = [];
10745
- var documentListenerAdded = false;
10746
- var initialClientY = -1;
10747
- var previousBodyOverflowSetting = void 0;
10748
- var previousBodyPaddingRight = void 0;
10749
-
10750
- // returns true if `el` should be allowed to receive touchmove events.
10751
- var allowTouchMove$1 = function allowTouchMove(el) {
10752
- return locks.some(function (lock) {
10753
- if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
10754
- return true;
10755
- }
10756
-
10757
- return false;
10758
- });
10759
- };
10760
-
10761
- var preventDefault = function preventDefault(rawEvent) {
10762
- var e = rawEvent || window.event;
10763
-
10764
- // For the case whereby consumers adds a touchmove event listener to document.
10765
- // Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
10766
- // in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
10767
- // the touchmove event on document will break.
10768
- if (allowTouchMove$1(e.target)) {
10769
- return true;
10770
- }
10771
-
10772
- // Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
10773
- if (e.touches.length > 1) return true;
10774
-
10775
- if (e.preventDefault) e.preventDefault();
10776
-
10777
- return false;
10778
- };
10779
-
10780
- var setOverflowHidden = function setOverflowHidden(options) {
10781
- // If previousBodyPaddingRight is already set, don't set it again.
10782
- if (previousBodyPaddingRight === undefined) {
10783
- var _reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
10784
- var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
10785
-
10786
- if (_reserveScrollBarGap && scrollBarGap > 0) {
10787
- previousBodyPaddingRight = document.body.style.paddingRight;
10788
- document.body.style.paddingRight = scrollBarGap + 'px';
10789
- }
10790
- }
10791
-
10792
- // If previousBodyOverflowSetting is already set, don't set it again.
10793
- if (previousBodyOverflowSetting === undefined) {
10794
- previousBodyOverflowSetting = document.body.style.overflow;
10795
- document.body.style.overflow = 'hidden';
10796
- }
10797
- };
10798
-
10799
- var restoreOverflowSetting = function restoreOverflowSetting() {
10800
- if (previousBodyPaddingRight !== undefined) {
10801
- document.body.style.paddingRight = previousBodyPaddingRight;
10802
-
10803
- // Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
10804
- // can be set again.
10805
- previousBodyPaddingRight = undefined;
10806
- }
10807
-
10808
- if (previousBodyOverflowSetting !== undefined) {
10809
- document.body.style.overflow = previousBodyOverflowSetting;
10810
-
10811
- // Restore previousBodyOverflowSetting to undefined
10812
- // so setOverflowHidden knows it can be set again.
10813
- previousBodyOverflowSetting = undefined;
10814
- }
10815
- };
10816
-
10817
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
10818
- var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
10819
- return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
10820
- };
10821
-
10822
- var handleScroll$1 = function handleScroll(event, targetElement) {
10823
- var clientY = event.targetTouches[0].clientY - initialClientY;
10824
-
10825
- if (allowTouchMove$1(event.target)) {
10826
- return false;
10827
- }
10828
-
10829
- if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
10830
- // element is at the top of its scroll.
10831
- return preventDefault(event);
10832
- }
10833
-
10834
- if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
10835
- // element is at the bottom of its scroll.
10836
- return preventDefault(event);
10837
- }
10838
-
10839
- event.stopPropagation();
10840
- return true;
10841
- };
10842
-
10843
- var disableBodyScroll = function disableBodyScroll(targetElement, options) {
10844
- // targetElement must be provided
10845
- if (!targetElement) {
10846
- // eslint-disable-next-line no-console
10847
- console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
10848
- return;
10849
- }
10850
-
10851
- // disableBodyScroll must not have been called on this targetElement before
10852
- if (locks.some(function (lock) {
10853
- return lock.targetElement === targetElement;
10854
- })) {
10855
- return;
10856
- }
10857
-
10858
- var lock = {
10859
- targetElement: targetElement,
10860
- options: options || {}
10861
- };
10862
-
10863
- locks = [].concat(_toConsumableArray$1(locks), [lock]);
10864
-
10865
- if (isIosDevice) {
10866
- targetElement.ontouchstart = function (event) {
10867
- if (event.targetTouches.length === 1) {
10868
- // detect single touch.
10869
- initialClientY = event.targetTouches[0].clientY;
10870
- }
10871
- };
10872
- targetElement.ontouchmove = function (event) {
10873
- if (event.targetTouches.length === 1) {
10874
- // detect single touch.
10875
- handleScroll$1(event, targetElement);
10876
- }
10877
- };
10878
-
10879
- if (!documentListenerAdded) {
10880
- document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
10881
- documentListenerAdded = true;
10882
- }
10883
- } else {
10884
- setOverflowHidden(options);
10885
- }
10886
- };
10887
-
10888
- var clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {
10889
- if (isIosDevice) {
10890
- // Clear all locks ontouchstart/ontouchmove handlers, and the references.
10891
- locks.forEach(function (lock) {
10892
- lock.targetElement.ontouchstart = null;
10893
- lock.targetElement.ontouchmove = null;
10894
- });
10895
-
10896
- if (documentListenerAdded) {
10897
- document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
10898
- documentListenerAdded = false;
10899
- }
10900
-
10901
- // Reset initial clientY.
10902
- initialClientY = -1;
10903
- } else {
10904
- restoreOverflowSetting();
10905
- }
10906
-
10907
- locks = [];
10908
- };
10909
-
10910
- var PreventBodyElementScrolling = /*#__PURE__*/function (_React$Component) {
10911
- _inheritsLoose__default["default"](PreventBodyElementScrolling, _React$Component);
10912
-
10913
- function PreventBodyElementScrolling() {
10914
- return _React$Component.apply(this, arguments) || this;
10915
- }
10916
-
10917
- var _proto = PreventBodyElementScrolling.prototype;
10918
-
10919
- _proto.componentDidMount = function componentDidMount() {
10920
- var scrollableRef = this.props.scrollableRef;
10921
- var refs = Array.isArray(scrollableRef) ? scrollableRef : [scrollableRef];
10922
- refs.every(function (ref) {
10923
- if (ref && ref.current) {
10924
- disableBodyScroll(ref.current);
10925
- }
10926
- });
10927
- };
10928
-
10929
- _proto.componentWillUnmount = function componentWillUnmount() {
10930
- clearAllBodyScrollLocks();
10931
- };
10932
-
10933
- _proto.render = function render() {
10934
- var children = this.props.children;
10935
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, children);
10936
- };
10937
-
10938
- return PreventBodyElementScrolling;
10939
- }(React__default["default"].Component);
10940
-
10941
10722
  var convertPxToNumber = function convertPxToNumber(px) {
10942
10723
  return parseFloat(px);
10943
10724
  };
@@ -11253,7 +11034,7 @@
11253
11034
  * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
11254
11035
  */
11255
11036
 
11256
- var useIsomorphicLayoutEffect$3 = typeof window !== 'undefined' && window.document && window.document.createElement ? React__namespace.useLayoutEffect : React__namespace.useEffect;
11037
+ var useIsomorphicLayoutEffect$4 = typeof window !== 'undefined' && window.document && window.document.createElement ? React__namespace.useLayoutEffect : React__namespace.useEffect;
11257
11038
 
11258
11039
  var top = 'top';
11259
11040
  var bottom = 'bottom';
@@ -13198,12 +12979,12 @@
13198
12979
  }
13199
12980
  }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
13200
12981
  var popperInstanceRef = React__namespace.useRef();
13201
- useIsomorphicLayoutEffect$3(function () {
12982
+ useIsomorphicLayoutEffect$4(function () {
13202
12983
  if (popperInstanceRef.current) {
13203
12984
  popperInstanceRef.current.setOptions(popperOptions);
13204
12985
  }
13205
12986
  }, [popperOptions]);
13206
- useIsomorphicLayoutEffect$3(function () {
12987
+ useIsomorphicLayoutEffect$4(function () {
13207
12988
  if (referenceElement == null || popperElement == null) {
13208
12989
  return;
13209
12990
  }
@@ -18406,7 +18187,7 @@
18406
18187
  capture: false,
18407
18188
  passive: false
18408
18189
  };
18409
- function useScrollLock(_ref) {
18190
+ function useScrollLock$1(_ref) {
18410
18191
  var isEnabled = _ref.isEnabled,
18411
18192
  _ref$accountForScroll = _ref.accountForScrollbars,
18412
18193
  accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
@@ -18525,7 +18306,7 @@
18525
18306
  onTopArrive: onTopArrive,
18526
18307
  onTopLeave: onTopLeave
18527
18308
  });
18528
- var setScrollLockTarget = useScrollLock({
18309
+ var setScrollLockTarget = useScrollLock$1({
18529
18310
  isEnabled: lockEnabled
18530
18311
  });
18531
18312
  var targetRef = function targetRef(element) {
@@ -24742,7 +24523,7 @@
24742
24523
  * @param deps
24743
24524
  */
24744
24525
 
24745
- var useIsomorphicLayoutEffect$2 = /*#__PURE__*/canUseDOM() ? React.useLayoutEffect : React.useEffect;
24526
+ var useIsomorphicLayoutEffect$3 = /*#__PURE__*/canUseDOM() ? React.useLayoutEffect : React.useEffect;
24746
24527
 
24747
24528
  /**
24748
24529
  * Forces a re-render, similar to `forceUpdate` in class components.
@@ -24817,7 +24598,7 @@
24817
24598
  }, [containerRef]);
24818
24599
  }
24819
24600
 
24820
- useIsomorphicLayoutEffect$2(function () {
24601
+ useIsomorphicLayoutEffect$3(function () {
24821
24602
  // This ref may be null when a hot-loader replaces components on the page
24822
24603
  if (!mountNode.current) return; // It's possible that the content of the portal has, itself, been portaled.
24823
24604
  // In that case, it's important to append to the correct document element.
@@ -25138,7 +24919,7 @@
25138
24919
  return ref.facade;
25139
24920
  }
25140
24921
 
25141
- var useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
24922
+ var useIsomorphicLayoutEffect$2 = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
25142
24923
  var currentValues = new WeakMap();
25143
24924
  /**
25144
24925
  * Merges two or more refs together providing a single interface to set their value
@@ -25159,7 +24940,7 @@
25159
24940
  return refs.forEach(function (ref) { return assignRef(ref, newValue); });
25160
24941
  });
25161
24942
  // handle refs changes - added or removed
25162
- useIsomorphicLayoutEffect$1(function () {
24943
+ useIsomorphicLayoutEffect$2(function () {
25163
24944
  var oldValue = currentValues.get(callbackRef);
25164
24945
  if (oldValue) {
25165
24946
  var prevRefs_1 = new Set(oldValue);
@@ -29611,6 +29392,116 @@
29611
29392
  };
29612
29393
  });
29613
29394
 
29395
+ var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
29396
+ var IS_SERVER = typeof window === "undefined";
29397
+ /**
29398
+ * A custom hook that locks and unlocks scroll.
29399
+ * @param {UseScrollLockOptions} [options] - Options to configure the hook, by default it will lock the scroll automatically.
29400
+ * @returns {UseScrollLockReturn} - An object containing the lock and unlock functions.
29401
+ * @public
29402
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-scroll-lock)
29403
+ * @example
29404
+ * ```tsx
29405
+ * // Lock the scroll when the modal is mounted, and unlock it when it's unmounted
29406
+ * useScrollLock()
29407
+ * ```
29408
+ * @example
29409
+ * ```tsx
29410
+ * // Manually lock and unlock the scroll
29411
+ * const { lock, unlock } = useScrollLock({ autoLock: false })
29412
+ *
29413
+ * return (
29414
+ * <div>
29415
+ * <button onClick={lock}>Lock</button>
29416
+ * <button onClick={unlock}>Unlock</button>
29417
+ * </div>
29418
+ * )
29419
+ * ```
29420
+ */
29421
+
29422
+ function useScrollLock(options) {
29423
+ if (options === void 0) {
29424
+ options = {};
29425
+ }
29426
+
29427
+ var _options = options,
29428
+ _options$autoLock = _options.autoLock,
29429
+ autoLock = _options$autoLock === void 0 ? true : _options$autoLock,
29430
+ lockTarget = _options.lockTarget,
29431
+ _options$widthReflow = _options.widthReflow,
29432
+ widthReflow = _options$widthReflow === void 0 ? true : _options$widthReflow;
29433
+
29434
+ var _useState = React.useState(false),
29435
+ isLocked = _useState[0],
29436
+ setIsLocked = _useState[1];
29437
+
29438
+ var target = React.useRef(null);
29439
+ var originalStyle = React.useRef(null);
29440
+
29441
+ var lock = function lock() {
29442
+ if (target.current) {
29443
+ var _target$current$style = target.current.style,
29444
+ overflow = _target$current$style.overflow,
29445
+ paddingRight = _target$current$style.paddingRight; // Save the original styles
29446
+
29447
+ originalStyle.current = {
29448
+ overflow: overflow,
29449
+ paddingRight: paddingRight
29450
+ }; // Prevent width reflow
29451
+
29452
+ if (widthReflow) {
29453
+ // Use window inner width if body is the target as global scrollbar isn't part of the document
29454
+ var offsetWidth = target.current === document.body ? window.innerWidth : target.current.offsetWidth; // Get current computed padding right in pixels
29455
+
29456
+ var currentPaddingRight = parseInt(window.getComputedStyle(target.current).paddingRight, 10) || 0;
29457
+ var scrollbarWidth = offsetWidth - target.current.scrollWidth;
29458
+ target.current.style.paddingRight = scrollbarWidth + currentPaddingRight + "px";
29459
+ } // Lock the scroll
29460
+
29461
+
29462
+ target.current.style.overflow = "hidden";
29463
+ setIsLocked(true);
29464
+ }
29465
+ };
29466
+
29467
+ var unlock = function unlock() {
29468
+ if (target.current && originalStyle.current) {
29469
+ target.current.style.overflow = originalStyle.current.overflow; // Only reset padding right if we changed it
29470
+
29471
+ if (widthReflow) {
29472
+ target.current.style.paddingRight = originalStyle.current.paddingRight;
29473
+ }
29474
+ }
29475
+
29476
+ setIsLocked(false);
29477
+ };
29478
+
29479
+ useIsomorphicLayoutEffect$1(function () {
29480
+ if (IS_SERVER) return;
29481
+
29482
+ if (lockTarget) {
29483
+ target.current = typeof lockTarget === "string" ? document.querySelector(lockTarget) : lockTarget;
29484
+ }
29485
+
29486
+ if (!target.current) {
29487
+ target.current = document.body;
29488
+ }
29489
+
29490
+ if (autoLock) {
29491
+ lock();
29492
+ }
29493
+
29494
+ return function () {
29495
+ unlock();
29496
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
29497
+ }, [autoLock, lockTarget, widthReflow]);
29498
+ return {
29499
+ isLocked: isLocked,
29500
+ lock: lock,
29501
+ unlock: unlock
29502
+ };
29503
+ }
29504
+
29614
29505
  var borderStyle = "1px solid #e4e7eb";
29615
29506
  var BrandingWrap = styled__default["default"].div.withConfig({
29616
29507
  displayName: "MobileMenu__BrandingWrap",
@@ -29841,6 +29732,7 @@
29841
29732
  showNulogyLogo = _a.showNulogyLogo,
29842
29733
  props = __rest$3(_a, ["menuData", "closeMenu", "subtext", "themeColorObject", "showNulogyLogo"]);
29843
29734
 
29735
+ useScrollLock();
29844
29736
  return /*#__PURE__*/React__default["default"].createElement(Nav, Object.assign({
29845
29737
  backgroundColor: themeColorObject && themeColorObject.background
29846
29738
  }, props), /*#__PURE__*/React__default["default"].createElement(BrandingWrap, null, /*#__PURE__*/React__default["default"].createElement(BrandingText, {
@@ -29997,13 +29889,13 @@
29997
29889
  "aria-expanded": ariaExpanded
29998
29890
  }), /*#__PURE__*/React__default["default"].createElement(MenuIcon, {
29999
29891
  isOpen: isOpen
30000
- }))))), isOpen && /*#__PURE__*/React__default["default"].createElement(PreventBodyElementScrolling, null, /*#__PURE__*/React__default["default"].createElement(MobileMenu, {
29892
+ }))))), isOpen && /*#__PURE__*/React__default["default"].createElement(MobileMenu, {
30001
29893
  themeColorObject: themeColorObject,
30002
29894
  subtext: subtext,
30003
29895
  menuData: menuData,
30004
29896
  closeMenu: closeMenu,
30005
29897
  showNulogyLogo: showNulogyLogo
30006
- })));
29898
+ }));
30007
29899
  };
30008
29900
  /* eslint-enable react/destructuring-assignment */
30009
29901
 
@@ -45493,6 +45385,9 @@
45493
45385
  var sideBarRef = React.useRef(null);
45494
45386
  var contentRef = React.useRef(null);
45495
45387
  var selectedWidth = (_b = sidebarWidths[width]) !== null && _b !== void 0 ? _b : width;
45388
+ useScrollLock({
45389
+ autoLock: overlay && disableScroll && isOpen
45390
+ });
45496
45391
  React.useEffect(function () {
45497
45392
  var _a;
45498
45393
 
@@ -45623,9 +45518,7 @@
45623
45518
  width: "100%",
45624
45519
  p: p,
45625
45520
  pt: "x2"
45626
- }, footer), overlay && disableScroll && isOpen && /*#__PURE__*/React__default["default"].createElement(PreventBodyElementScrolling, {
45627
- scrollRef: sideBarRef
45628
- })));
45521
+ }, footer)));
45629
45522
  }
45630
45523
 
45631
45524
  function LoadingAnimation(_ref) {
@@ -47683,7 +47576,7 @@
47683
47576
  footerContent = _ref4.footerContent,
47684
47577
  closeAriaLabel = _ref4.closeAriaLabel,
47685
47578
  parentSelector = _ref4.parentSelector;
47686
- var modalHasHeader = onRequestClose || title;
47579
+ var modalHasHeader = Boolean(onRequestClose || title);
47687
47580
  var themeContext = React.useContext(styled.ThemeContext);
47688
47581
  return /*#__PURE__*/React__default["default"].createElement(StyledReactModal, {
47689
47582
  maxWidth: maxWidth,
@@ -47709,22 +47602,40 @@
47709
47602
  appElement: appElement,
47710
47603
  ariaHideApp: ariaHideApp,
47711
47604
  parentSelector: parentSelector
47712
- }, /*#__PURE__*/React__default["default"].createElement(PreventBodyElementScrolling, null, modalHasHeader && /*#__PURE__*/React__default["default"].createElement(ModalHeader, {
47605
+ }, /*#__PURE__*/React__default["default"].createElement(ModalWrapper, {
47606
+ closeAriaLabel: closeAriaLabel,
47607
+ modalHasHeader: modalHasHeader,
47608
+ title: title,
47609
+ onRequestClose: onRequestClose,
47610
+ footerContent: footerContent
47611
+ }, children));
47612
+ };
47613
+
47614
+ function ModalWrapper(_ref5) {
47615
+ var modalHasHeader = _ref5.modalHasHeader,
47616
+ title = _ref5.title,
47617
+ onRequestClose = _ref5.onRequestClose,
47618
+ closeAriaLabel = _ref5.closeAriaLabel,
47619
+ children = _ref5.children,
47620
+ footerContent = _ref5.footerContent;
47621
+ var theme = styled.useTheme();
47622
+ useScrollLock();
47623
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, modalHasHeader && /*#__PURE__*/React__default["default"].createElement(ModalHeader, {
47713
47624
  hasCloseButton: Boolean(onRequestClose)
47714
47625
  }, title ? /*#__PURE__*/React__default["default"].createElement(Heading2, {
47715
47626
  id: "modal-title",
47716
47627
  mb: "none"
47717
47628
  }, title) : /*#__PURE__*/React__default["default"].createElement("div", {
47718
47629
  style: {
47719
- height: themeContext.space.x4
47630
+ height: theme.space.x4
47720
47631
  }
47721
47632
  }), onRequestClose && /*#__PURE__*/React__default["default"].createElement(ModalCloseButton, {
47722
47633
  onClick: onRequestClose,
47723
47634
  "aria-label": closeAriaLabel
47724
47635
  })), /*#__PURE__*/React__default["default"].createElement(ModalContent, {
47725
47636
  hasFooter: !!footerContent
47726
- }, children), footerContent && /*#__PURE__*/React__default["default"].createElement(ModalFooter, null, footerContent)));
47727
- };
47637
+ }, children), footerContent && /*#__PURE__*/React__default["default"].createElement(ModalFooter, null, footerContent));
47638
+ }
47728
47639
 
47729
47640
  Modal.setAppElement = ReactModal.setAppElement;
47730
47641
 
@@ -338,12 +338,12 @@ function useVisualElementContext() {
338
338
  }
339
339
 
340
340
  var isBrowser$7 = typeof window !== "undefined";
341
- var useIsomorphicLayoutEffect$4 = isBrowser$7 ? useLayoutEffect : useEffect;
341
+ var useIsomorphicLayoutEffect$5 = isBrowser$7 ? useLayoutEffect : useEffect;
342
342
 
343
343
  function useSnapshotOnUnmount(visualElement) {
344
344
  var syncLayout = useContext(SharedLayoutContext);
345
345
  var framerSyncLayout = useContext(FramerTreeLayoutContext);
346
- useIsomorphicLayoutEffect$4(function () { return function () {
346
+ useIsomorphicLayoutEffect$5(function () { return function () {
347
347
  if (isSharedLayout(syncLayout)) {
348
348
  syncLayout.remove(visualElement);
349
349
  }
@@ -374,7 +374,7 @@ function useVisualElement(isStatic, visualState, createVisualElement, props) {
374
374
  blockInitialAnimation: (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false,
375
375
  });
376
376
  });
377
- useIsomorphicLayoutEffect$4(function () {
377
+ useIsomorphicLayoutEffect$5(function () {
378
378
  visualElement.setProps(__assign$3(__assign$3(__assign$3({}, config), props), { layoutId: layoutId }));
379
379
  visualElement.isPresent = isPresent(presenceContext);
380
380
  visualElement.isPresenceRoot =
@@ -10702,225 +10702,6 @@ function withMenuState(MenuComponent) {
10702
10702
  };
10703
10703
  }
10704
10704
 
10705
- function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
10706
-
10707
- // Older browsers don't support event options, feature detect it.
10708
-
10709
- // Adopted and modified solution from Bohdan Didukh (2017)
10710
- // https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
10711
-
10712
- var hasPassiveEvents = false;
10713
- if (typeof window !== 'undefined') {
10714
- var passiveTestOptions = {
10715
- get passive() {
10716
- hasPassiveEvents = true;
10717
- return undefined;
10718
- }
10719
- };
10720
- window.addEventListener('testPassive', null, passiveTestOptions);
10721
- window.removeEventListener('testPassive', null, passiveTestOptions);
10722
- }
10723
-
10724
- var isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);
10725
-
10726
-
10727
- var locks = [];
10728
- var documentListenerAdded = false;
10729
- var initialClientY = -1;
10730
- var previousBodyOverflowSetting = void 0;
10731
- var previousBodyPaddingRight = void 0;
10732
-
10733
- // returns true if `el` should be allowed to receive touchmove events.
10734
- var allowTouchMove$1 = function allowTouchMove(el) {
10735
- return locks.some(function (lock) {
10736
- if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
10737
- return true;
10738
- }
10739
-
10740
- return false;
10741
- });
10742
- };
10743
-
10744
- var preventDefault = function preventDefault(rawEvent) {
10745
- var e = rawEvent || window.event;
10746
-
10747
- // For the case whereby consumers adds a touchmove event listener to document.
10748
- // Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
10749
- // in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
10750
- // the touchmove event on document will break.
10751
- if (allowTouchMove$1(e.target)) {
10752
- return true;
10753
- }
10754
-
10755
- // Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
10756
- if (e.touches.length > 1) return true;
10757
-
10758
- if (e.preventDefault) e.preventDefault();
10759
-
10760
- return false;
10761
- };
10762
-
10763
- var setOverflowHidden = function setOverflowHidden(options) {
10764
- // If previousBodyPaddingRight is already set, don't set it again.
10765
- if (previousBodyPaddingRight === undefined) {
10766
- var _reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
10767
- var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
10768
-
10769
- if (_reserveScrollBarGap && scrollBarGap > 0) {
10770
- previousBodyPaddingRight = document.body.style.paddingRight;
10771
- document.body.style.paddingRight = scrollBarGap + 'px';
10772
- }
10773
- }
10774
-
10775
- // If previousBodyOverflowSetting is already set, don't set it again.
10776
- if (previousBodyOverflowSetting === undefined) {
10777
- previousBodyOverflowSetting = document.body.style.overflow;
10778
- document.body.style.overflow = 'hidden';
10779
- }
10780
- };
10781
-
10782
- var restoreOverflowSetting = function restoreOverflowSetting() {
10783
- if (previousBodyPaddingRight !== undefined) {
10784
- document.body.style.paddingRight = previousBodyPaddingRight;
10785
-
10786
- // Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
10787
- // can be set again.
10788
- previousBodyPaddingRight = undefined;
10789
- }
10790
-
10791
- if (previousBodyOverflowSetting !== undefined) {
10792
- document.body.style.overflow = previousBodyOverflowSetting;
10793
-
10794
- // Restore previousBodyOverflowSetting to undefined
10795
- // so setOverflowHidden knows it can be set again.
10796
- previousBodyOverflowSetting = undefined;
10797
- }
10798
- };
10799
-
10800
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
10801
- var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
10802
- return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
10803
- };
10804
-
10805
- var handleScroll$1 = function handleScroll(event, targetElement) {
10806
- var clientY = event.targetTouches[0].clientY - initialClientY;
10807
-
10808
- if (allowTouchMove$1(event.target)) {
10809
- return false;
10810
- }
10811
-
10812
- if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
10813
- // element is at the top of its scroll.
10814
- return preventDefault(event);
10815
- }
10816
-
10817
- if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
10818
- // element is at the bottom of its scroll.
10819
- return preventDefault(event);
10820
- }
10821
-
10822
- event.stopPropagation();
10823
- return true;
10824
- };
10825
-
10826
- var disableBodyScroll = function disableBodyScroll(targetElement, options) {
10827
- // targetElement must be provided
10828
- if (!targetElement) {
10829
- // eslint-disable-next-line no-console
10830
- console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
10831
- return;
10832
- }
10833
-
10834
- // disableBodyScroll must not have been called on this targetElement before
10835
- if (locks.some(function (lock) {
10836
- return lock.targetElement === targetElement;
10837
- })) {
10838
- return;
10839
- }
10840
-
10841
- var lock = {
10842
- targetElement: targetElement,
10843
- options: options || {}
10844
- };
10845
-
10846
- locks = [].concat(_toConsumableArray$1(locks), [lock]);
10847
-
10848
- if (isIosDevice) {
10849
- targetElement.ontouchstart = function (event) {
10850
- if (event.targetTouches.length === 1) {
10851
- // detect single touch.
10852
- initialClientY = event.targetTouches[0].clientY;
10853
- }
10854
- };
10855
- targetElement.ontouchmove = function (event) {
10856
- if (event.targetTouches.length === 1) {
10857
- // detect single touch.
10858
- handleScroll$1(event, targetElement);
10859
- }
10860
- };
10861
-
10862
- if (!documentListenerAdded) {
10863
- document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
10864
- documentListenerAdded = true;
10865
- }
10866
- } else {
10867
- setOverflowHidden(options);
10868
- }
10869
- };
10870
-
10871
- var clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {
10872
- if (isIosDevice) {
10873
- // Clear all locks ontouchstart/ontouchmove handlers, and the references.
10874
- locks.forEach(function (lock) {
10875
- lock.targetElement.ontouchstart = null;
10876
- lock.targetElement.ontouchmove = null;
10877
- });
10878
-
10879
- if (documentListenerAdded) {
10880
- document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? { passive: false } : undefined);
10881
- documentListenerAdded = false;
10882
- }
10883
-
10884
- // Reset initial clientY.
10885
- initialClientY = -1;
10886
- } else {
10887
- restoreOverflowSetting();
10888
- }
10889
-
10890
- locks = [];
10891
- };
10892
-
10893
- var PreventBodyElementScrolling = /*#__PURE__*/function (_React$Component) {
10894
- _inheritsLoose$3(PreventBodyElementScrolling, _React$Component);
10895
-
10896
- function PreventBodyElementScrolling() {
10897
- return _React$Component.apply(this, arguments) || this;
10898
- }
10899
-
10900
- var _proto = PreventBodyElementScrolling.prototype;
10901
-
10902
- _proto.componentDidMount = function componentDidMount() {
10903
- var scrollableRef = this.props.scrollableRef;
10904
- var refs = Array.isArray(scrollableRef) ? scrollableRef : [scrollableRef];
10905
- refs.every(function (ref) {
10906
- if (ref && ref.current) {
10907
- disableBodyScroll(ref.current);
10908
- }
10909
- });
10910
- };
10911
-
10912
- _proto.componentWillUnmount = function componentWillUnmount() {
10913
- clearAllBodyScrollLocks();
10914
- };
10915
-
10916
- _proto.render = function render() {
10917
- var children = this.props.children;
10918
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
10919
- };
10920
-
10921
- return PreventBodyElementScrolling;
10922
- }(React__default.Component);
10923
-
10924
10705
  var convertPxToNumber = function convertPxToNumber(px) {
10925
10706
  return parseFloat(px);
10926
10707
  };
@@ -11236,7 +11017,7 @@ var fromEntries$1 = function fromEntries(entries) {
11236
11017
  * Small wrapper around `useLayoutEffect` to get rid of the warning on SSR envs
11237
11018
  */
11238
11019
 
11239
- var useIsomorphicLayoutEffect$3 = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;
11020
+ var useIsomorphicLayoutEffect$4 = typeof window !== 'undefined' && window.document && window.document.createElement ? React.useLayoutEffect : React.useEffect;
11240
11021
 
11241
11022
  var top = 'top';
11242
11023
  var bottom = 'bottom';
@@ -13181,12 +12962,12 @@ var usePopper$1 = function usePopper(referenceElement, popperElement, options) {
13181
12962
  }
13182
12963
  }, [optionsWithDefaults.onFirstUpdate, optionsWithDefaults.placement, optionsWithDefaults.strategy, optionsWithDefaults.modifiers, updateStateModifier]);
13183
12964
  var popperInstanceRef = React.useRef();
13184
- useIsomorphicLayoutEffect$3(function () {
12965
+ useIsomorphicLayoutEffect$4(function () {
13185
12966
  if (popperInstanceRef.current) {
13186
12967
  popperInstanceRef.current.setOptions(popperOptions);
13187
12968
  }
13188
12969
  }, [popperOptions]);
13189
- useIsomorphicLayoutEffect$3(function () {
12970
+ useIsomorphicLayoutEffect$4(function () {
13190
12971
  if (referenceElement == null || popperElement == null) {
13191
12972
  return;
13192
12973
  }
@@ -18389,7 +18170,7 @@ var listenerOptions = {
18389
18170
  capture: false,
18390
18171
  passive: false
18391
18172
  };
18392
- function useScrollLock(_ref) {
18173
+ function useScrollLock$1(_ref) {
18393
18174
  var isEnabled = _ref.isEnabled,
18394
18175
  _ref$accountForScroll = _ref.accountForScrollbars,
18395
18176
  accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
@@ -18508,7 +18289,7 @@ function ScrollManager(_ref) {
18508
18289
  onTopArrive: onTopArrive,
18509
18290
  onTopLeave: onTopLeave
18510
18291
  });
18511
- var setScrollLockTarget = useScrollLock({
18292
+ var setScrollLockTarget = useScrollLock$1({
18512
18293
  isEnabled: lockEnabled
18513
18294
  });
18514
18295
  var targetRef = function targetRef(element) {
@@ -24725,7 +24506,7 @@ function canUseDOM() {
24725
24506
  * @param deps
24726
24507
  */
24727
24508
 
24728
- var useIsomorphicLayoutEffect$2 = /*#__PURE__*/canUseDOM() ? useLayoutEffect : useEffect;
24509
+ var useIsomorphicLayoutEffect$3 = /*#__PURE__*/canUseDOM() ? useLayoutEffect : useEffect;
24729
24510
 
24730
24511
  /**
24731
24512
  * Forces a re-render, similar to `forceUpdate` in class components.
@@ -24800,7 +24581,7 @@ var PortalImpl = function PortalImpl(_ref) {
24800
24581
  }, [containerRef]);
24801
24582
  }
24802
24583
 
24803
- useIsomorphicLayoutEffect$2(function () {
24584
+ useIsomorphicLayoutEffect$3(function () {
24804
24585
  // This ref may be null when a hot-loader replaces components on the page
24805
24586
  if (!mountNode.current) return; // It's possible that the content of the portal has, itself, been portaled.
24806
24587
  // In that case, it's important to append to the correct document element.
@@ -25121,7 +24902,7 @@ function useCallbackRef(initialValue, callback) {
25121
24902
  return ref.facade;
25122
24903
  }
25123
24904
 
25124
- var useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
24905
+ var useIsomorphicLayoutEffect$2 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
25125
24906
  var currentValues = new WeakMap();
25126
24907
  /**
25127
24908
  * Merges two or more refs together providing a single interface to set their value
@@ -25142,7 +24923,7 @@ function useMergeRefs(refs, defaultValue) {
25142
24923
  return refs.forEach(function (ref) { return assignRef(ref, newValue); });
25143
24924
  });
25144
24925
  // handle refs changes - added or removed
25145
- useIsomorphicLayoutEffect$1(function () {
24926
+ useIsomorphicLayoutEffect$2(function () {
25146
24927
  var oldValue = currentValues.get(callbackRef);
25147
24928
  if (oldValue) {
25148
24929
  var prevRefs_1 = new Set(oldValue);
@@ -29594,6 +29375,116 @@ var NavBarSearch = styled(BaseNavBarSearch).withConfig({
29594
29375
  };
29595
29376
  });
29596
29377
 
29378
+ var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
29379
+ var IS_SERVER = typeof window === "undefined";
29380
+ /**
29381
+ * A custom hook that locks and unlocks scroll.
29382
+ * @param {UseScrollLockOptions} [options] - Options to configure the hook, by default it will lock the scroll automatically.
29383
+ * @returns {UseScrollLockReturn} - An object containing the lock and unlock functions.
29384
+ * @public
29385
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-scroll-lock)
29386
+ * @example
29387
+ * ```tsx
29388
+ * // Lock the scroll when the modal is mounted, and unlock it when it's unmounted
29389
+ * useScrollLock()
29390
+ * ```
29391
+ * @example
29392
+ * ```tsx
29393
+ * // Manually lock and unlock the scroll
29394
+ * const { lock, unlock } = useScrollLock({ autoLock: false })
29395
+ *
29396
+ * return (
29397
+ * <div>
29398
+ * <button onClick={lock}>Lock</button>
29399
+ * <button onClick={unlock}>Unlock</button>
29400
+ * </div>
29401
+ * )
29402
+ * ```
29403
+ */
29404
+
29405
+ function useScrollLock(options) {
29406
+ if (options === void 0) {
29407
+ options = {};
29408
+ }
29409
+
29410
+ var _options = options,
29411
+ _options$autoLock = _options.autoLock,
29412
+ autoLock = _options$autoLock === void 0 ? true : _options$autoLock,
29413
+ lockTarget = _options.lockTarget,
29414
+ _options$widthReflow = _options.widthReflow,
29415
+ widthReflow = _options$widthReflow === void 0 ? true : _options$widthReflow;
29416
+
29417
+ var _useState = useState(false),
29418
+ isLocked = _useState[0],
29419
+ setIsLocked = _useState[1];
29420
+
29421
+ var target = useRef(null);
29422
+ var originalStyle = useRef(null);
29423
+
29424
+ var lock = function lock() {
29425
+ if (target.current) {
29426
+ var _target$current$style = target.current.style,
29427
+ overflow = _target$current$style.overflow,
29428
+ paddingRight = _target$current$style.paddingRight; // Save the original styles
29429
+
29430
+ originalStyle.current = {
29431
+ overflow: overflow,
29432
+ paddingRight: paddingRight
29433
+ }; // Prevent width reflow
29434
+
29435
+ if (widthReflow) {
29436
+ // Use window inner width if body is the target as global scrollbar isn't part of the document
29437
+ var offsetWidth = target.current === document.body ? window.innerWidth : target.current.offsetWidth; // Get current computed padding right in pixels
29438
+
29439
+ var currentPaddingRight = parseInt(window.getComputedStyle(target.current).paddingRight, 10) || 0;
29440
+ var scrollbarWidth = offsetWidth - target.current.scrollWidth;
29441
+ target.current.style.paddingRight = scrollbarWidth + currentPaddingRight + "px";
29442
+ } // Lock the scroll
29443
+
29444
+
29445
+ target.current.style.overflow = "hidden";
29446
+ setIsLocked(true);
29447
+ }
29448
+ };
29449
+
29450
+ var unlock = function unlock() {
29451
+ if (target.current && originalStyle.current) {
29452
+ target.current.style.overflow = originalStyle.current.overflow; // Only reset padding right if we changed it
29453
+
29454
+ if (widthReflow) {
29455
+ target.current.style.paddingRight = originalStyle.current.paddingRight;
29456
+ }
29457
+ }
29458
+
29459
+ setIsLocked(false);
29460
+ };
29461
+
29462
+ useIsomorphicLayoutEffect$1(function () {
29463
+ if (IS_SERVER) return;
29464
+
29465
+ if (lockTarget) {
29466
+ target.current = typeof lockTarget === "string" ? document.querySelector(lockTarget) : lockTarget;
29467
+ }
29468
+
29469
+ if (!target.current) {
29470
+ target.current = document.body;
29471
+ }
29472
+
29473
+ if (autoLock) {
29474
+ lock();
29475
+ }
29476
+
29477
+ return function () {
29478
+ unlock();
29479
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
29480
+ }, [autoLock, lockTarget, widthReflow]);
29481
+ return {
29482
+ isLocked: isLocked,
29483
+ lock: lock,
29484
+ unlock: unlock
29485
+ };
29486
+ }
29487
+
29597
29488
  var borderStyle = "1px solid #e4e7eb";
29598
29489
  var BrandingWrap = styled.div.withConfig({
29599
29490
  displayName: "MobileMenu__BrandingWrap",
@@ -29824,6 +29715,7 @@ var BaseMobileMenu = function BaseMobileMenu(_a) {
29824
29715
  showNulogyLogo = _a.showNulogyLogo,
29825
29716
  props = __rest$3(_a, ["menuData", "closeMenu", "subtext", "themeColorObject", "showNulogyLogo"]);
29826
29717
 
29718
+ useScrollLock();
29827
29719
  return /*#__PURE__*/React__default.createElement(Nav, Object.assign({
29828
29720
  backgroundColor: themeColorObject && themeColorObject.background
29829
29721
  }, props), /*#__PURE__*/React__default.createElement(BrandingWrap, null, /*#__PURE__*/React__default.createElement(BrandingText, {
@@ -29980,13 +29872,13 @@ var SmallNavBarNoState = function SmallNavBarNoState(_a) {
29980
29872
  "aria-expanded": ariaExpanded
29981
29873
  }), /*#__PURE__*/React__default.createElement(MenuIcon, {
29982
29874
  isOpen: isOpen
29983
- }))))), isOpen && /*#__PURE__*/React__default.createElement(PreventBodyElementScrolling, null, /*#__PURE__*/React__default.createElement(MobileMenu, {
29875
+ }))))), isOpen && /*#__PURE__*/React__default.createElement(MobileMenu, {
29984
29876
  themeColorObject: themeColorObject,
29985
29877
  subtext: subtext,
29986
29878
  menuData: menuData,
29987
29879
  closeMenu: closeMenu,
29988
29880
  showNulogyLogo: showNulogyLogo
29989
- })));
29881
+ }));
29990
29882
  };
29991
29883
  /* eslint-enable react/destructuring-assignment */
29992
29884
 
@@ -45476,6 +45368,9 @@ function Sidebar(_a) {
45476
45368
  var sideBarRef = useRef(null);
45477
45369
  var contentRef = useRef(null);
45478
45370
  var selectedWidth = (_b = sidebarWidths[width]) !== null && _b !== void 0 ? _b : width;
45371
+ useScrollLock({
45372
+ autoLock: overlay && disableScroll && isOpen
45373
+ });
45479
45374
  useEffect(function () {
45480
45375
  var _a;
45481
45376
 
@@ -45606,9 +45501,7 @@ function Sidebar(_a) {
45606
45501
  width: "100%",
45607
45502
  p: p,
45608
45503
  pt: "x2"
45609
- }, footer), overlay && disableScroll && isOpen && /*#__PURE__*/React__default.createElement(PreventBodyElementScrolling, {
45610
- scrollRef: sideBarRef
45611
- })));
45504
+ }, footer)));
45612
45505
  }
45613
45506
 
45614
45507
  function LoadingAnimation(_ref) {
@@ -47666,7 +47559,7 @@ var Modal = function Modal(_ref4) {
47666
47559
  footerContent = _ref4.footerContent,
47667
47560
  closeAriaLabel = _ref4.closeAriaLabel,
47668
47561
  parentSelector = _ref4.parentSelector;
47669
- var modalHasHeader = onRequestClose || title;
47562
+ var modalHasHeader = Boolean(onRequestClose || title);
47670
47563
  var themeContext = useContext(ThemeContext$1);
47671
47564
  return /*#__PURE__*/React__default.createElement(StyledReactModal, {
47672
47565
  maxWidth: maxWidth,
@@ -47692,22 +47585,40 @@ var Modal = function Modal(_ref4) {
47692
47585
  appElement: appElement,
47693
47586
  ariaHideApp: ariaHideApp,
47694
47587
  parentSelector: parentSelector
47695
- }, /*#__PURE__*/React__default.createElement(PreventBodyElementScrolling, null, modalHasHeader && /*#__PURE__*/React__default.createElement(ModalHeader, {
47588
+ }, /*#__PURE__*/React__default.createElement(ModalWrapper, {
47589
+ closeAriaLabel: closeAriaLabel,
47590
+ modalHasHeader: modalHasHeader,
47591
+ title: title,
47592
+ onRequestClose: onRequestClose,
47593
+ footerContent: footerContent
47594
+ }, children));
47595
+ };
47596
+
47597
+ function ModalWrapper(_ref5) {
47598
+ var modalHasHeader = _ref5.modalHasHeader,
47599
+ title = _ref5.title,
47600
+ onRequestClose = _ref5.onRequestClose,
47601
+ closeAriaLabel = _ref5.closeAriaLabel,
47602
+ children = _ref5.children,
47603
+ footerContent = _ref5.footerContent;
47604
+ var theme = useTheme();
47605
+ useScrollLock();
47606
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, modalHasHeader && /*#__PURE__*/React__default.createElement(ModalHeader, {
47696
47607
  hasCloseButton: Boolean(onRequestClose)
47697
47608
  }, title ? /*#__PURE__*/React__default.createElement(Heading2, {
47698
47609
  id: "modal-title",
47699
47610
  mb: "none"
47700
47611
  }, title) : /*#__PURE__*/React__default.createElement("div", {
47701
47612
  style: {
47702
- height: themeContext.space.x4
47613
+ height: theme.space.x4
47703
47614
  }
47704
47615
  }), onRequestClose && /*#__PURE__*/React__default.createElement(ModalCloseButton, {
47705
47616
  onClick: onRequestClose,
47706
47617
  "aria-label": closeAriaLabel
47707
47618
  })), /*#__PURE__*/React__default.createElement(ModalContent, {
47708
47619
  hasFooter: !!footerContent
47709
- }, children), footerContent && /*#__PURE__*/React__default.createElement(ModalFooter, null, footerContent)));
47710
- };
47620
+ }, children), footerContent && /*#__PURE__*/React__default.createElement(ModalFooter, null, footerContent));
47621
+ }
47711
47622
 
47712
47623
  Modal.setAppElement = ReactModal.setAppElement;
47713
47624
 
@@ -2,7 +2,7 @@ import React, { RefObject } from "react";
2
2
  import { AnimatedBoxProps } from "../Box/Box";
3
3
  type PredefinedSidebarWidth = "xs" | "s" | "m" | "l" | "xl";
4
4
  type SidebarWidth = PredefinedSidebarWidth | (string & {});
5
- type SidebarProps = Omit<AnimatedBoxProps, "width"> & {
5
+ export type SidebarProps = Omit<AnimatedBoxProps, "width"> & {
6
6
  children?: React.ReactNode;
7
7
  onClose?: () => void;
8
8
  title?: string;
@@ -8,5 +8,4 @@ export { default as PopperArrow } from "./PopperArrow";
8
8
  export { default as ScrollIndicators } from "./ScrollIndicators";
9
9
  export { default as withMenuState } from "./withMenuState";
10
10
  export type { WithMenuStateProps, AcceptsMenuStateProps } from "./withMenuState";
11
- export { default as PreventBodyElementScrolling } from "./PreventBodyElementScrolling";
12
11
  export { default as useWindowDimensions } from "./useWindowDimensions";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * useUrlProps is a hook that reads URL search parameters and returns them as an object.
3
+ * It is meant to be used in Storybook stories to allow for easy URL-based configuration from Cypress specs.
4
+ *
5
+ */
6
+ export declare function useUrlProps<T extends Record<string, unknown>>(defaultProps?: T): T;
@@ -0,0 +1,55 @@
1
+ import { useLayoutEffect } from "react";
2
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
3
+ /** Hook options. */
4
+ type UseScrollLockOptions = {
5
+ /**
6
+ * Whether to lock the scroll initially.
7
+ * @default true
8
+ */
9
+ autoLock?: boolean;
10
+ /**
11
+ * The target element to lock the scroll (default is the body element).
12
+ * @default document.body
13
+ */
14
+ lockTarget?: HTMLElement | string;
15
+ /**
16
+ * Whether to prevent width reflow when locking the scroll.
17
+ * @default true
18
+ */
19
+ widthReflow?: boolean;
20
+ };
21
+ /** Hook return type. */
22
+ type UseScrollLockReturn = {
23
+ /** Whether the scroll is locked. */
24
+ isLocked: boolean;
25
+ /** Lock the scroll. */
26
+ lock: () => void;
27
+ /** Unlock the scroll. */
28
+ unlock: () => void;
29
+ };
30
+ /**
31
+ * A custom hook that locks and unlocks scroll.
32
+ * @param {UseScrollLockOptions} [options] - Options to configure the hook, by default it will lock the scroll automatically.
33
+ * @returns {UseScrollLockReturn} - An object containing the lock and unlock functions.
34
+ * @public
35
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-scroll-lock)
36
+ * @example
37
+ * ```tsx
38
+ * // Lock the scroll when the modal is mounted, and unlock it when it's unmounted
39
+ * useScrollLock()
40
+ * ```
41
+ * @example
42
+ * ```tsx
43
+ * // Manually lock and unlock the scroll
44
+ * const { lock, unlock } = useScrollLock({ autoLock: false })
45
+ *
46
+ * return (
47
+ * <div>
48
+ * <button onClick={lock}>Lock</button>
49
+ * <button onClick={unlock}>Unlock</button>
50
+ * </div>
51
+ * )
52
+ * ```
53
+ */
54
+ export declare function useScrollLock(options?: UseScrollLockOptions): UseScrollLockReturn;
55
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "13.1.3",
3
+ "version": "13.1.4",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -1,8 +0,0 @@
1
- export default class PreventBodyElementScrolling extends React.Component<any, any, any> {
2
- constructor(props: any);
3
- constructor(props: any, context: any);
4
- componentDidMount(): void;
5
- componentWillUnmount(): void;
6
- render(): React.JSX.Element;
7
- }
8
- import React from "react";