@nulogy/components 13.1.3 → 13.1.5

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.
@@ -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) {
@@ -24094,6 +23875,14 @@ function InlineValidation(_a) {
24094
23875
  }), /*#__PURE__*/React__default.createElement(Wrapper, null, errorMessage && /*#__PURE__*/React__default.createElement(Text, null, errorMessage), mapErrorsToList(errorList), children)) : null;
24095
23876
  }
24096
23877
 
23878
+ /**
23879
+ * Returns the number from a [CSS dimension]{@link https://developer.mozilla.org/en-US/docs/Web/CSS/dimension}.
23880
+ * @param {string} dimension - A css dimension
23881
+ */
23882
+ function numberFromDimension (dimension) {
23883
+ return parseInt(String(dimension), 10);
23884
+ }
23885
+
24097
23886
  var getBorderColor = function getBorderColor(_ref) {
24098
23887
  var errored = _ref.errored,
24099
23888
  disabled = _ref.disabled,
@@ -24345,7 +24134,7 @@ var customStyles = function customStyles(_ref6) {
24345
24134
  return Object.assign(Object.assign({}, provided), {
24346
24135
  minWidth: "fit-content",
24347
24136
  padding: 0,
24348
- maxHeight: parseInt(maxHeight, 10),
24137
+ maxHeight: numberFromDimension(maxHeight),
24349
24138
  borderRadius: theme.radii.medium,
24350
24139
  marginTop: windowed ? "-4px" : 0,
24351
24140
  marginBottom: windowed ? "-4px" : 0
@@ -24725,7 +24514,7 @@ function canUseDOM() {
24725
24514
  * @param deps
24726
24515
  */
24727
24516
 
24728
- var useIsomorphicLayoutEffect$2 = /*#__PURE__*/canUseDOM() ? useLayoutEffect : useEffect;
24517
+ var useIsomorphicLayoutEffect$3 = /*#__PURE__*/canUseDOM() ? useLayoutEffect : useEffect;
24729
24518
 
24730
24519
  /**
24731
24520
  * Forces a re-render, similar to `forceUpdate` in class components.
@@ -24800,7 +24589,7 @@ var PortalImpl = function PortalImpl(_ref) {
24800
24589
  }, [containerRef]);
24801
24590
  }
24802
24591
 
24803
- useIsomorphicLayoutEffect$2(function () {
24592
+ useIsomorphicLayoutEffect$3(function () {
24804
24593
  // This ref may be null when a hot-loader replaces components on the page
24805
24594
  if (!mountNode.current) return; // It's possible that the content of the portal has, itself, been portaled.
24806
24595
  // In that case, it's important to append to the correct document element.
@@ -25121,7 +24910,7 @@ function useCallbackRef(initialValue, callback) {
25121
24910
  return ref.facade;
25122
24911
  }
25123
24912
 
25124
- var useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
24913
+ var useIsomorphicLayoutEffect$2 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
25125
24914
  var currentValues = new WeakMap();
25126
24915
  /**
25127
24916
  * Merges two or more refs together providing a single interface to set their value
@@ -25142,7 +24931,7 @@ function useMergeRefs(refs, defaultValue) {
25142
24931
  return refs.forEach(function (ref) { return assignRef(ref, newValue); });
25143
24932
  });
25144
24933
  // handle refs changes - added or removed
25145
- useIsomorphicLayoutEffect$1(function () {
24934
+ useIsomorphicLayoutEffect$2(function () {
25146
24935
  var oldValue = currentValues.get(callbackRef);
25147
24936
  if (oldValue) {
25148
24937
  var prevRefs_1 = new Set(oldValue);
@@ -27960,14 +27749,6 @@ function BottomSheet(_a) {
27960
27749
  }))))))));
27961
27750
  }
27962
27751
 
27963
- /**
27964
- * Returns the number from a [CSS dimension]{@link https://developer.mozilla.org/en-US/docs/Web/CSS/dimension}.
27965
- * @param {string} dimension - A css dimension
27966
- */
27967
- function numberFromDimension (dimension) {
27968
- return parseInt(String(dimension), 10);
27969
- }
27970
-
27971
27752
  var getMenuMargin = function getMenuMargin(placement, showArrow) {
27972
27753
  var direction = String(placement).split("-")[0];
27973
27754
 
@@ -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
 
@@ -53068,12 +52979,10 @@ function MenuItem$1(_ref4) {
53068
52979
  }
53069
52980
 
53070
52981
  var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
53071
- var autocomplete = _a.autocomplete,
53072
- value = _a.value,
52982
+ var value = _a.value,
53073
52983
  _onChange = _a.onChange,
53074
52984
  defaultValue = _a.defaultValue,
53075
52985
  labelText = _a.labelText,
53076
- required = _a.required,
53077
52986
  requirementText = _a.requirementText,
53078
52987
  helpText = _a.helpText,
53079
52988
  disabled = _a.disabled,
@@ -53081,14 +52990,28 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
53081
52990
  errorList = _a.errorList,
53082
52991
  id = _a.id,
53083
52992
  initialIsOpen = _a.initialIsOpen,
53084
- maxHeight = _a.maxHeight,
53085
52993
  multiselect = _a.multiselect,
53086
52994
  placeholder = _a.placeholder,
53087
52995
  components = _a.components,
53088
- windowThreshold = _a.windowThreshold,
53089
52996
  options = _a.options,
53090
52997
  styles = _a.styles,
53091
- props = __rest$3(_a, ["autocomplete", "value", "onChange", "defaultValue", "labelText", "required", "requirementText", "helpText", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "maxHeight", "multiselect", "placeholder", "components", "windowThreshold", "options", "styles"]);
52998
+ _a$windowThreshold = _a.windowThreshold,
52999
+ windowThreshold = _a$windowThreshold === void 0 ? 300 : _a$windowThreshold,
53000
+ _a$autocomplete = _a.autocomplete,
53001
+ autocomplete = _a$autocomplete === void 0 ? true : _a$autocomplete,
53002
+ _a$maxHeight = _a.maxHeight,
53003
+ maxHeight = _a$maxHeight === void 0 ? "248px" : _a$maxHeight,
53004
+ _a$required = _a.required,
53005
+ required = _a$required === void 0 ? false : _a$required,
53006
+ _a$menuPosition = _a.menuPosition,
53007
+ menuPosition = _a$menuPosition === void 0 ? "absolute" : _a$menuPosition,
53008
+ _a$menuPlacement = _a.menuPlacement,
53009
+ menuPlacement = _a$menuPlacement === void 0 ? "bottom" : _a$menuPlacement,
53010
+ _a$classNamePrefix = _a.classNamePrefix,
53011
+ classNamePrefix = _a$classNamePrefix === void 0 ? "ndsSelect" : _a$classNamePrefix,
53012
+ _a$closeMenuOnSelect = _a.closeMenuOnSelect,
53013
+ closeMenuOnSelect = _a$closeMenuOnSelect === void 0 ? true : _a$closeMenuOnSelect,
53014
+ props = __rest$3(_a, ["value", "onChange", "defaultValue", "labelText", "requirementText", "helpText", "disabled", "errorMessage", "errorList", "id", "initialIsOpen", "multiselect", "placeholder", "components", "options", "styles", "windowThreshold", "autocomplete", "maxHeight", "required", "menuPosition", "menuPlacement", "classNamePrefix", "closeMenuOnSelect"]);
53092
53015
 
53093
53016
  var _useTranslation = useTranslation(),
53094
53017
  t = _useTranslation.t;
@@ -53151,7 +53074,12 @@ var NDSSelect = /*#__PURE__*/forwardRef(function (_a, ref) {
53151
53074
  Input: SelectInput
53152
53075
  }, isWindowed ? {
53153
53076
  MenuList: MenuList
53154
- } : {}), components)
53077
+ } : {}), components),
53078
+ closeMenuOnSelect: closeMenuOnSelect,
53079
+ classNamePrefix: classNamePrefix,
53080
+ menuPosition: menuPosition,
53081
+ menuPlacement: menuPlacement,
53082
+ maxMenuHeight: numberFromDimension(maxHeight)
53155
53083
  }, props)), /*#__PURE__*/React__default.createElement(InlineValidation, {
53156
53084
  mt: "x1",
53157
53085
  errorMessage: errorMessage,
@@ -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;