@citygross/components 0.8.22 → 0.8.24
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/build/cjs/components/src/components/Modal/Modal.styles.js +1 -1
- package/build/cjs/utils/build/index.js +23 -0
- package/build/cjs/utils/build/index.js.map +1 -1
- package/build/es/components/src/components/Modal/Modal.styles.js +1 -1
- package/build/es/utils/build/index.js +23 -0
- package/build/es/utils/build/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -9,7 +9,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
11
|
|
|
12
|
-
var ModalOverlay = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n display: flex;\n z-index: ", ";\n background: ", ";\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n height: 100%;\n justify-content: center;\n align-items: center;\n\n @media (min-width: ", "px) {\n padding: ", "px;\n }\n"], ["\n display: flex;\n z-index: ", ";\n background: ", ";\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n height: 100%;\n justify-content: center;\n align-items: center;\n\n @media (min-width: ", "px) {\n padding: ", "px;\n }\n"])), function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.zIndex.modal; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.darkOverlay; }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.lg; });
|
|
12
|
+
var ModalOverlay = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n display: flex;\n z-index: ", ";\n background: ", ";\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n height: 100%;\n justify-content: center;\n align-items: center;\n\n padding: ", "px;\n @media (min-width: ", "px) {\n padding: ", "px;\n }\n"], ["\n display: flex;\n z-index: ", ";\n background: ", ";\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n height: 100%;\n justify-content: center;\n align-items: center;\n\n padding: ", "px;\n @media (min-width: ", "px) {\n padding: ", "px;\n }\n"])), function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.zIndex.modal; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.darkOverlay; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.lg; });
|
|
13
13
|
var ModalContainer = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n overflow: auto;\n display: flex;\n flex-direction: column;\n ", ";\n max-width: 100%;\n max-height: 100vh;\n padding: ", "px;\n border-radius: ", "px;\n @media (min-width: ", "px) {\n padding: ", "px;\n width: 100%;\n max-width: ", ";\n max-height: 90vh;\n }\n"], ["\n overflow: auto;\n display: flex;\n flex-direction: column;\n ", ";\n max-width: 100%;\n max-height: 100vh;\n padding: ", "px;\n border-radius: ", "px;\n @media (min-width: ", "px) {\n padding: ", "px;\n width: 100%;\n max-width: ", ";\n max-height: 90vh;\n }\n"])), function (props) { return props.background && "background: ".concat(props.background); }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.md; }, function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.borderRadius.small; }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.lg; }, function (props) {
|
|
14
14
|
var _a, _b;
|
|
15
15
|
return props.maxWidth
|
|
@@ -368,6 +368,28 @@ var useOutsideClick = function (ref, callback) {
|
|
|
368
368
|
});
|
|
369
369
|
};
|
|
370
370
|
|
|
371
|
+
var useFixedModalScroll = function (active, querySelector) {
|
|
372
|
+
var _a = React.useState(0), prevPosition = _a[0], setPrevPosition = _a[1];
|
|
373
|
+
React.useEffect(function () {
|
|
374
|
+
var pos = window === null || window === void 0 ? void 0 : window.scrollY;
|
|
375
|
+
var selector = querySelector || (document === null || document === void 0 ? void 0 : document.body);
|
|
376
|
+
if (active && selector) {
|
|
377
|
+
setPrevPosition(pos);
|
|
378
|
+
selector.style.overflowY = 'scroll';
|
|
379
|
+
selector.style.position = 'fixed';
|
|
380
|
+
selector.style.top = -pos + 'px';
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
selector.style.removeProperty('top');
|
|
384
|
+
selector.style.overflowY = 'auto';
|
|
385
|
+
selector.style.position = 'relative';
|
|
386
|
+
if (prevPosition) {
|
|
387
|
+
window.scrollTo(0, prevPosition);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}, [active, querySelector]);
|
|
391
|
+
};
|
|
392
|
+
|
|
371
393
|
function comparisonTypes(type) {
|
|
372
394
|
switch (type) {
|
|
373
395
|
case 'KGM':
|
|
@@ -18734,6 +18756,7 @@ index.__exports.moment = moment;
|
|
|
18734
18756
|
index.__exports.nameRegex = nameRegex;
|
|
18735
18757
|
index.__exports.phoneRegex = phoneRegex;
|
|
18736
18758
|
index.__exports.useDetectDevice = useDetectDevice;
|
|
18759
|
+
index.__exports.useFixedModalScroll = useFixedModalScroll;
|
|
18737
18760
|
index.__exports.useOutsideClick = useOutsideClick;
|
|
18738
18761
|
var useWindowSize_1 = index.__exports.useWindowSize = useWindowSize;
|
|
18739
18762
|
index.__exports.validateInput = validateInput;
|