@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.
- package/dist/main.js +185 -257
- package/dist/main.module.js +185 -257
- package/dist/src/Layout/Sidebar.d.ts +1 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/testing/useUrlProps.d.ts +6 -0
- package/dist/src/utils/useScrollLock.d.ts +55 -0
- package/package.json +1 -1
- package/dist/src/utils/PreventBodyElementScrolling.d.ts +0 -8
- /package/dist/src/utils/{testHelpers → testing}/createMatchMedia.d.ts +0 -0
package/dist/main.js
CHANGED
|
@@ -355,12 +355,12 @@
|
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
var isBrowser$7 = typeof window !== "undefined";
|
|
358
|
-
var useIsomorphicLayoutEffect$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
12982
|
+
useIsomorphicLayoutEffect$4(function () {
|
|
13202
12983
|
if (popperInstanceRef.current) {
|
|
13203
12984
|
popperInstanceRef.current.setOptions(popperOptions);
|
|
13204
12985
|
}
|
|
13205
12986
|
}, [popperOptions]);
|
|
13206
|
-
useIsomorphicLayoutEffect$
|
|
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) {
|
|
@@ -24111,6 +23892,14 @@
|
|
|
24111
23892
|
}), /*#__PURE__*/React__default["default"].createElement(Wrapper, null, errorMessage && /*#__PURE__*/React__default["default"].createElement(Text, null, errorMessage), mapErrorsToList(errorList), children)) : null;
|
|
24112
23893
|
}
|
|
24113
23894
|
|
|
23895
|
+
/**
|
|
23896
|
+
* Returns the number from a [CSS dimension]{@link https://developer.mozilla.org/en-US/docs/Web/CSS/dimension}.
|
|
23897
|
+
* @param {string} dimension - A css dimension
|
|
23898
|
+
*/
|
|
23899
|
+
function numberFromDimension (dimension) {
|
|
23900
|
+
return parseInt(String(dimension), 10);
|
|
23901
|
+
}
|
|
23902
|
+
|
|
24114
23903
|
var getBorderColor = function getBorderColor(_ref) {
|
|
24115
23904
|
var errored = _ref.errored,
|
|
24116
23905
|
disabled = _ref.disabled,
|
|
@@ -24362,7 +24151,7 @@
|
|
|
24362
24151
|
return Object.assign(Object.assign({}, provided), {
|
|
24363
24152
|
minWidth: "fit-content",
|
|
24364
24153
|
padding: 0,
|
|
24365
|
-
maxHeight:
|
|
24154
|
+
maxHeight: numberFromDimension(maxHeight),
|
|
24366
24155
|
borderRadius: theme.radii.medium,
|
|
24367
24156
|
marginTop: windowed ? "-4px" : 0,
|
|
24368
24157
|
marginBottom: windowed ? "-4px" : 0
|
|
@@ -24742,7 +24531,7 @@
|
|
|
24742
24531
|
* @param deps
|
|
24743
24532
|
*/
|
|
24744
24533
|
|
|
24745
|
-
var useIsomorphicLayoutEffect$
|
|
24534
|
+
var useIsomorphicLayoutEffect$3 = /*#__PURE__*/canUseDOM() ? React.useLayoutEffect : React.useEffect;
|
|
24746
24535
|
|
|
24747
24536
|
/**
|
|
24748
24537
|
* Forces a re-render, similar to `forceUpdate` in class components.
|
|
@@ -24817,7 +24606,7 @@
|
|
|
24817
24606
|
}, [containerRef]);
|
|
24818
24607
|
}
|
|
24819
24608
|
|
|
24820
|
-
useIsomorphicLayoutEffect$
|
|
24609
|
+
useIsomorphicLayoutEffect$3(function () {
|
|
24821
24610
|
// This ref may be null when a hot-loader replaces components on the page
|
|
24822
24611
|
if (!mountNode.current) return; // It's possible that the content of the portal has, itself, been portaled.
|
|
24823
24612
|
// In that case, it's important to append to the correct document element.
|
|
@@ -25138,7 +24927,7 @@
|
|
|
25138
24927
|
return ref.facade;
|
|
25139
24928
|
}
|
|
25140
24929
|
|
|
25141
|
-
var useIsomorphicLayoutEffect$
|
|
24930
|
+
var useIsomorphicLayoutEffect$2 = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
25142
24931
|
var currentValues = new WeakMap();
|
|
25143
24932
|
/**
|
|
25144
24933
|
* Merges two or more refs together providing a single interface to set their value
|
|
@@ -25159,7 +24948,7 @@
|
|
|
25159
24948
|
return refs.forEach(function (ref) { return assignRef(ref, newValue); });
|
|
25160
24949
|
});
|
|
25161
24950
|
// handle refs changes - added or removed
|
|
25162
|
-
useIsomorphicLayoutEffect$
|
|
24951
|
+
useIsomorphicLayoutEffect$2(function () {
|
|
25163
24952
|
var oldValue = currentValues.get(callbackRef);
|
|
25164
24953
|
if (oldValue) {
|
|
25165
24954
|
var prevRefs_1 = new Set(oldValue);
|
|
@@ -27977,14 +27766,6 @@
|
|
|
27977
27766
|
}))))))));
|
|
27978
27767
|
}
|
|
27979
27768
|
|
|
27980
|
-
/**
|
|
27981
|
-
* Returns the number from a [CSS dimension]{@link https://developer.mozilla.org/en-US/docs/Web/CSS/dimension}.
|
|
27982
|
-
* @param {string} dimension - A css dimension
|
|
27983
|
-
*/
|
|
27984
|
-
function numberFromDimension (dimension) {
|
|
27985
|
-
return parseInt(String(dimension), 10);
|
|
27986
|
-
}
|
|
27987
|
-
|
|
27988
27769
|
var getMenuMargin = function getMenuMargin(placement, showArrow) {
|
|
27989
27770
|
var direction = String(placement).split("-")[0];
|
|
27990
27771
|
|
|
@@ -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(
|
|
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)
|
|
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(
|
|
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:
|
|
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
|
|
|
@@ -53085,12 +52996,10 @@
|
|
|
53085
52996
|
}
|
|
53086
52997
|
|
|
53087
52998
|
var NDSSelect = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
53088
|
-
var
|
|
53089
|
-
value = _a.value,
|
|
52999
|
+
var value = _a.value,
|
|
53090
53000
|
_onChange = _a.onChange,
|
|
53091
53001
|
defaultValue = _a.defaultValue,
|
|
53092
53002
|
labelText = _a.labelText,
|
|
53093
|
-
required = _a.required,
|
|
53094
53003
|
requirementText = _a.requirementText,
|
|
53095
53004
|
helpText = _a.helpText,
|
|
53096
53005
|
disabled = _a.disabled,
|
|
@@ -53098,14 +53007,28 @@
|
|
|
53098
53007
|
errorList = _a.errorList,
|
|
53099
53008
|
id = _a.id,
|
|
53100
53009
|
initialIsOpen = _a.initialIsOpen,
|
|
53101
|
-
maxHeight = _a.maxHeight,
|
|
53102
53010
|
multiselect = _a.multiselect,
|
|
53103
53011
|
placeholder = _a.placeholder,
|
|
53104
53012
|
components = _a.components,
|
|
53105
|
-
windowThreshold = _a.windowThreshold,
|
|
53106
53013
|
options = _a.options,
|
|
53107
53014
|
styles = _a.styles,
|
|
53108
|
-
|
|
53015
|
+
_a$windowThreshold = _a.windowThreshold,
|
|
53016
|
+
windowThreshold = _a$windowThreshold === void 0 ? 300 : _a$windowThreshold,
|
|
53017
|
+
_a$autocomplete = _a.autocomplete,
|
|
53018
|
+
autocomplete = _a$autocomplete === void 0 ? true : _a$autocomplete,
|
|
53019
|
+
_a$maxHeight = _a.maxHeight,
|
|
53020
|
+
maxHeight = _a$maxHeight === void 0 ? "248px" : _a$maxHeight,
|
|
53021
|
+
_a$required = _a.required,
|
|
53022
|
+
required = _a$required === void 0 ? false : _a$required,
|
|
53023
|
+
_a$menuPosition = _a.menuPosition,
|
|
53024
|
+
menuPosition = _a$menuPosition === void 0 ? "absolute" : _a$menuPosition,
|
|
53025
|
+
_a$menuPlacement = _a.menuPlacement,
|
|
53026
|
+
menuPlacement = _a$menuPlacement === void 0 ? "bottom" : _a$menuPlacement,
|
|
53027
|
+
_a$classNamePrefix = _a.classNamePrefix,
|
|
53028
|
+
classNamePrefix = _a$classNamePrefix === void 0 ? "ndsSelect" : _a$classNamePrefix,
|
|
53029
|
+
_a$closeMenuOnSelect = _a.closeMenuOnSelect,
|
|
53030
|
+
closeMenuOnSelect = _a$closeMenuOnSelect === void 0 ? true : _a$closeMenuOnSelect,
|
|
53031
|
+
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"]);
|
|
53109
53032
|
|
|
53110
53033
|
var _useTranslation = useTranslation(),
|
|
53111
53034
|
t = _useTranslation.t;
|
|
@@ -53168,7 +53091,12 @@
|
|
|
53168
53091
|
Input: SelectInput
|
|
53169
53092
|
}, isWindowed ? {
|
|
53170
53093
|
MenuList: MenuList
|
|
53171
|
-
} : {}), components)
|
|
53094
|
+
} : {}), components),
|
|
53095
|
+
closeMenuOnSelect: closeMenuOnSelect,
|
|
53096
|
+
classNamePrefix: classNamePrefix,
|
|
53097
|
+
menuPosition: menuPosition,
|
|
53098
|
+
menuPlacement: menuPlacement,
|
|
53099
|
+
maxMenuHeight: numberFromDimension(maxHeight)
|
|
53172
53100
|
}, props)), /*#__PURE__*/React__default["default"].createElement(InlineValidation, {
|
|
53173
53101
|
mt: "x1",
|
|
53174
53102
|
errorMessage: errorMessage,
|