@citygross/components 0.14.8 → 0.14.10
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/@types/components/Accordion/Accordion.d.ts +2 -2
- package/build/@types/components/AddressBlock/AddressBlock.d.ts +1 -1
- package/build/@types/components/AlertBox/AlertBox.d.ts +1 -1
- package/build/@types/components/BackButton/BackButton.d.ts +2 -2
- package/build/@types/components/BackgroundImage/BackgroundImage.d.ts +2 -2
- package/build/@types/components/Badge/Badge.d.ts +1 -1
- package/build/@types/components/Box/Box.d.ts +1 -1
- package/build/@types/components/BoxArrow/BoxArrow.d.ts +2 -2
- package/build/@types/components/Button/Button.d.ts +1 -1
- package/build/@types/components/Button/Button.styles.d.ts +1 -1
- package/build/@types/components/Button/IconButton.d.ts +2 -2
- package/build/@types/components/Button/PaginationButton.d.ts +1 -1
- package/build/@types/components/Button/SaveButton.d.ts +1 -1
- package/build/@types/components/CartCard/CartCard.d.ts +1 -1
- package/build/@types/components/CartCardLabel/CartCardLabel.d.ts +2 -2
- package/build/@types/components/CartItemSummary/CartItemSummary.d.ts +2 -2
- package/build/@types/components/CartItemSummary/CartItemSummary.styles.d.ts +1 -1
- package/build/@types/components/CartSubTotal/CartSubTotal.d.ts +1 -1
- package/build/@types/components/CartSummary/CartSummary.d.ts +1 -1
- package/build/@types/components/CgButton/ButtonAsLink/ButtonAsLink.d.ts +1 -1
- package/build/@types/components/CgButton/DivAsButton/DivAsButton.d.ts +2 -2
- package/build/@types/components/Chips/Chip.d.ts +2 -2
- package/build/@types/components/Chips/Chip.styles.d.ts +1 -1
- package/build/@types/components/CouponCode/CouponCode.d.ts +2 -2
- package/build/@types/components/CustomerInfoBlock/CustomerInfoBlock.d.ts +1 -1
- package/build/@types/components/DateBox/DateBox.d.ts +1 -1
- package/build/@types/components/DeliverySlotItem/DeliverySlotItem.d.ts +1 -1
- package/build/@types/components/DeliveryTimeBlock/DeliveryTimeBlock.d.ts +1 -1
- package/build/@types/components/DotIndicator/DotIndicator.d.ts +2 -2
- package/build/@types/components/Fieldset/Fieldset.d.ts +1 -1
- package/build/@types/components/Flex/Flex.d.ts +1 -1
- package/build/@types/components/Form/Form.d.ts +1 -1
- package/build/@types/components/FormControl/FormControl.d.ts +1 -1
- package/build/@types/components/FormElements/Checkbox/Checkbox.d.ts +2 -2
- package/build/@types/components/FormElements/InputOld/InputOld.d.ts +1 -1
- package/build/@types/components/FormElements/Radio/Radio.d.ts +2 -2
- package/build/@types/components/FormElements/Select/Select.d.ts +1 -1
- package/build/@types/components/FormElements/Switch/Switch.d.ts +1 -1
- package/build/@types/components/FormElements/Switch/Switch.styles.d.ts +1 -1
- package/build/@types/components/FormElements/TextArea/TextArea.d.ts +2 -2
- package/build/@types/components/FormGroup/FormGroup.d.ts +1 -1
- package/build/@types/components/GridContainer/GridContainer.d.ts +1 -1
- package/build/@types/components/Header/Header.d.ts +2 -2
- package/build/@types/components/HeaderLink/HeaderLink.d.ts +2 -2
- package/build/@types/components/HighlightBox/HighlightBox.d.ts +2 -2
- package/build/@types/components/IconText/IconText.d.ts +1 -1
- package/build/@types/components/IconToolTip/IconToolTip.d.ts +2 -2
- package/build/@types/components/InfoTextBlock/InfoTextBlock.d.ts +1 -1
- package/build/@types/components/Links/Link.d.ts +1 -1
- package/build/@types/components/ListItemWithRadio/ListItemWithRadio.d.ts +1 -1
- package/build/@types/components/Logo/Logo.d.ts +2 -2
- package/build/@types/components/MaxHeightText/MaxHeightText.d.ts +1 -1
- package/build/@types/components/Menu/Menu.d.ts +1 -1
- package/build/@types/components/Menu/MenuItem.d.ts +1 -1
- package/build/@types/components/MenuListDropdown/MenuListDropdown.d.ts +1 -1
- package/build/@types/components/MenuListDropdown/MenuListDropdown.styles.d.ts +3 -3
- package/build/@types/components/NavMainLink/NavMainLink.d.ts +1 -1
- package/build/@types/components/Pagination/Pagination.d.ts +2 -2
- package/build/@types/components/ProgressBar/ProgressBar.d.ts +2 -2
- package/build/@types/components/QuantitySelector/QuantitySelector.d.ts +2 -2
- package/build/@types/components/RadioBox/RadioBoxItem.d.ts +1 -1
- package/build/@types/components/RadioBox/RadioBoxList.d.ts +1 -1
- package/build/@types/components/RadioBox/RadioBoxList.styles.d.ts +1 -1
- package/build/@types/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/build/@types/components/RadioListItem/RadioListItem.d.ts +2 -2
- package/build/@types/components/RadioListItem/RadioListItem.styles.d.ts +2 -2
- package/build/@types/components/RippleContainer/RippleContainer.d.ts +1 -1
- package/build/@types/components/RippleContainer/RippleContainer.styles.d.ts +1 -1
- package/build/@types/components/ScreenReader/ScreenReader.d.ts +1 -1
- package/build/@types/components/SearchListItem/SearchListItem.d.ts +1 -1
- package/build/@types/components/SelectButton/SelectButton.d.ts +2 -2
- package/build/@types/components/SideModal/SideModal.styles.d.ts +2 -2
- package/build/@types/components/SkipTo/SkipTo.d.ts +1 -1
- package/build/@types/components/SlideInOutContainer/SlideInOutContainer.d.ts +1 -1
- package/build/@types/components/SlideInOutContainer/SlideInOutContainer.styles.d.ts +1 -1
- package/build/@types/components/Spinner/Spinner.d.ts +2 -2
- package/build/@types/components/Stepper/StepperList.d.ts +1 -1
- package/build/@types/components/Stepper/StepperListItem.d.ts +1 -1
- package/build/@types/components/StepperMobile/StepperMobile.d.ts +2 -2
- package/build/@types/components/Tag/Tag.d.ts +2 -2
- package/build/@types/components/Timeline/Timeline.d.ts +2 -2
- package/build/@types/components/Timeline/Timeline.styles.d.ts +1 -1
- package/build/@types/components/ToolTip/ToolTip.d.ts +1 -1
- package/build/@types/components/ToolTipDialog/ToolTipDialog.d.ts +1 -1
- package/build/@types/components/WarningLabel/WarningLabel.d.ts +1 -1
- package/build/@types/components/WarningLabel/WarningLabel.styles.d.ts +1 -1
- package/build/@types/containers/TwoColumnsContainer/TwoColumnsPageContainer.d.ts +2 -2
- package/build/cjs/components/src/components/Button/SaveButton.js +9 -4
- package/build/cjs/components/src/components/Button/SaveButton.js.map +1 -1
- package/build/cjs/components/src/components/FormElements/Switch/Switch.styles.js +2 -2
- package/build/cjs/components/src/components/MenuListDropdown/MenuListDropdown.js +3 -2
- package/build/cjs/components/src/components/MenuListDropdown/MenuListDropdown.js.map +1 -1
- package/build/cjs/components/src/components/MenuListDropdown/MenuListDropdown.styles.js +4 -4
- package/build/cjs/components/src/components/RippleContainer/RippleContainer.styles.js +2 -2
- package/build/cjs/components/src/components/SideModal/SideModal.js +5 -7
- package/build/cjs/components/src/components/SideModal/SideModal.js.map +1 -1
- package/build/cjs/components/src/components/SideModal/SideModal.styles.js +3 -3
- package/build/cjs/components/src/components/SlideInOutContainer/SlideInOutContainer.styles.js +2 -2
- package/build/cjs/utils/build/index.js +31 -1
- package/build/cjs/utils/build/index.js.map +1 -1
- package/build/es/components/src/components/Button/SaveButton.js +9 -4
- package/build/es/components/src/components/Button/SaveButton.js.map +1 -1
- package/build/es/components/src/components/FormElements/Switch/Switch.styles.js +1 -1
- package/build/es/components/src/components/MenuListDropdown/MenuListDropdown.js +3 -2
- package/build/es/components/src/components/MenuListDropdown/MenuListDropdown.js.map +1 -1
- package/build/es/components/src/components/MenuListDropdown/MenuListDropdown.styles.js +1 -1
- package/build/es/components/src/components/RippleContainer/RippleContainer.styles.js +1 -1
- package/build/es/components/src/components/SideModal/SideModal.js +5 -7
- package/build/es/components/src/components/SideModal/SideModal.js.map +1 -1
- package/build/es/components/src/components/SideModal/SideModal.styles.js +1 -1
- package/build/es/components/src/components/SlideInOutContainer/SlideInOutContainer.styles.js +1 -1
- package/build/es/utils/build/index.js +31 -1
- package/build/es/utils/build/index.js.map +1 -1
- package/package.json +28 -28
|
@@ -4,16 +4,21 @@ import { BasePrimaryButton, Loading, LoadingContainer, LoadingSpinner, ButtonChi
|
|
|
4
4
|
import { BodyText } from '@citygross/typography';
|
|
5
5
|
|
|
6
6
|
var SaveButton = function (_a) {
|
|
7
|
-
var _b, _c;
|
|
8
|
-
var afterSaveText = _a.afterSaveText, ariaLabel = _a.ariaLabel, beforeSaveText = _a.beforeSaveText,
|
|
7
|
+
var _b, _c, _d;
|
|
8
|
+
var afterSaveText = _a.afterSaveText, ariaLabel = _a.ariaLabel, beforeSaveText = _a.beforeSaveText, _e = _a.childGap, childGap = _e === void 0 ? 4 : _e, _f = _a.color, color = _f === void 0 ? (_c = (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.secondary) !== null && _c !== void 0 ? _c : '' : _f, fullWidth = _a.fullWidth, icon = _a.icon, isDisabled = _a.isDisabled, loading = _a.loading, noWrap = _a.noWrap, onAnimationComplete = _a.onAnimationComplete, onClick = _a.onClick, _g = _a.onSavedColor, onSavedColor = _g === void 0 ? 'alertGreen' : _g, saved = _a.saved, _h = _a.size, size = _h === void 0 ? 'large' : _h, xsSize = _a.xsSize;
|
|
9
9
|
useEffect(function () {
|
|
10
10
|
var _a;
|
|
11
|
+
var timeoutId;
|
|
11
12
|
if (!loading && saved) {
|
|
12
|
-
setTimeout(function () {
|
|
13
|
+
timeoutId = setTimeout(function () {
|
|
13
14
|
onAnimationComplete();
|
|
14
15
|
}, (_a = theme === null || theme === void 0 ? void 0 : theme.animations) === null || _a === void 0 ? void 0 : _a.saveButtonAnimationComplete);
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
return function () {
|
|
18
|
+
if (timeoutId)
|
|
19
|
+
clearTimeout(timeoutId);
|
|
20
|
+
};
|
|
21
|
+
}, [saved, loading, (_d = theme === null || theme === void 0 ? void 0 : theme.animations) === null || _d === void 0 ? void 0 : _d.saveButtonAnimationComplete]);
|
|
17
22
|
return (React.createElement(BasePrimaryButton, { "aria-label": ariaLabel, color: saved ? onSavedColor : color, disabled: loading || isDisabled, fullWidth: fullWidth, icon: icon, isDisabled: loading || isDisabled, loading: loading || null, noWrap: noWrap, onClick: saved ? function () { } : function (e) { return onClick(e); }, size: size },
|
|
18
23
|
loading && (React.createElement(Loading, null,
|
|
19
24
|
React.createElement(LoadingContainer, { xsSize: xsSize, size: size },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SaveButton.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SaveButton.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __makeTemplateObject } from '../../../../../_virtual/_tslib.js';
|
|
2
|
-
import { motion } from '
|
|
2
|
+
import { motion } from 'motion/react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
var SwitchWrapper = styled(motion.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 42px;\n height: 22px;\n min-width: 42px;\n position: relative;\n"], ["\n width: 42px;\n height: 22px;\n min-width: 42px;\n position: relative;\n"])));
|
|
@@ -3,14 +3,15 @@ import { DropdownContainer, DropdownHeader, DropdownChildContainer } from './Men
|
|
|
3
3
|
|
|
4
4
|
var MenuListDropdown = function (_a) {
|
|
5
5
|
var children = _a.children, dropdownHeader = _a.dropdownHeader, isOpen = _a.isOpen, onClick = _a.onClick;
|
|
6
|
+
var easing = [0.04, 0.62, 0.23, 0.98];
|
|
6
7
|
var variants = {
|
|
7
8
|
closed: {
|
|
8
9
|
height: 0,
|
|
9
|
-
transition: { duration: 0.3, ease:
|
|
10
|
+
transition: { duration: 0.3, ease: easing }
|
|
10
11
|
},
|
|
11
12
|
open: {
|
|
12
13
|
height: 'auto',
|
|
13
|
-
transition: { duration: 0.3, ease:
|
|
14
|
+
transition: { duration: 0.3, ease: easing }
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
17
|
return (React.createElement(DropdownContainer, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuListDropdown.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MenuListDropdown.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { motion } from '
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
4
|
|
|
5
5
|
var DropdownContainer = styled(motion.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
6
6
|
var DropdownHeader = styled(motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n cursor: pointer;\n"], ["\n cursor: pointer;\n"])));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import styled, { keyframes } from 'styled-components';
|
|
3
|
-
import { motion } from '
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
4
|
|
|
5
5
|
var slide = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% { left: -100% }\n 100% { left: 120% }\n"], ["\n 0% { left: -100% }\n 100% { left: 120% }\n"])));
|
|
6
6
|
var RippleContainer = styled(motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n overflow: hidden;\n cursor: pointer;\n\n &:after {\n background: ", ";\n content: '';\n height: 200%;\n left: -100%;\n opacity: 0.2;\n position: absolute;\n top: -30%;\n transform: rotate(35deg);\n width: 50px;\n }\n\n &:hover {\n &:after {\n animation: ", "\n ", " forwards;\n }\n }\n"], ["\n position: relative;\n overflow: hidden;\n cursor: pointer;\n\n &:after {\n background: ", ";\n content: '';\n height: 200%;\n left: -100%;\n opacity: 0.2;\n position: absolute;\n top: -30%;\n transform: rotate(35deg);\n width: 50px;\n }\n\n &:hover {\n &:after {\n animation: ", "\n ", " forwards;\n }\n }\n"])), function (props) { var _a; return props.color ? props.color : (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, slide, function (props) { var _a, _b; return (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.animations) === null || _b === void 0 ? void 0 : _b.rippleTransition; });
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { __rest, __assign } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
|
-
import { AnimatePresence } from 'framer-motion';
|
|
4
3
|
import { createPortal } from 'react-dom';
|
|
5
|
-
import { SideModalOverlay, SideModalContainer } from './SideModal.styles.js';
|
|
6
4
|
import { theme } from '@citygross/design-tokens';
|
|
5
|
+
import { AnimatePresence } from 'motion/react';
|
|
6
|
+
import { SideModalOverlay, SideModalContainer } from './SideModal.styles.js';
|
|
7
7
|
|
|
8
8
|
var SideModal = forwardRef(function (_a, ref) {
|
|
9
9
|
var _b, _c, _d;
|
|
10
10
|
var _e = _a.background, background = _e === void 0 ? (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.white : _e, children = _a.children, isVisible = _a.isVisible, maxHeight = _a.maxHeight, maxWidth = _a.maxWidth, onBackdropClick = _a.onBackdropClick, _f = _a.overlayBackground, overlayBackground = _f === void 0 ? (_d = (_c = theme.palette) === null || _c === void 0 ? void 0 : _c.darkOverlay) !== null && _d !== void 0 ? _d : '' : _f, _g = _a.querySelector, querySelector = _g === void 0 ? '#root' : _g, slideFrom = _a.slideFrom, _h = _a.width, width = _h === void 0 ? 375 : _h, props = __rest(_a, ["background", "children", "isVisible", "maxHeight", "maxWidth", "onBackdropClick", "overlayBackground", "querySelector", "slideFrom", "width"]);
|
|
11
11
|
var domSafe = typeof document !== 'undefined';
|
|
12
12
|
return domSafe
|
|
13
|
-
? createPortal(React.createElement(AnimatePresence, null, isVisible && (React.createElement(SideModalOverlay, { animate: { opacity: 1 }, exit: { opacity: 0 }, initial: { opacity: 0 }, maxHeight: maxHeight, onMouseDown: function (e) {
|
|
13
|
+
? createPortal(React.createElement(AnimatePresence, null, isVisible && (React.createElement(SideModalOverlay, { key: "side-modal-overlay", animate: { opacity: 1 }, exit: { opacity: 0 }, initial: { opacity: 0 }, maxHeight: maxHeight, onMouseDown: function (e) {
|
|
14
14
|
if (e.target === e.currentTarget) {
|
|
15
15
|
onBackdropClick();
|
|
16
16
|
}
|
|
17
|
-
}, overlayBackground: overlayBackground, ref: ref, transition: {
|
|
18
|
-
|
|
19
|
-
} },
|
|
20
|
-
React.createElement(SideModalContainer, __assign({ animate: { x: 0 }, "aria-modal": "true", background: background, exit: { x: slideFrom === 'left' ? '-100%' : '100%' }, initial: { x: slideFrom === 'left' ? '-100%' : '100%' }, maxHeight: maxHeight, maxWidth: maxWidth, onClick: function (e) { return e.stopPropagation(); }, role: "dialog", slideFrom: slideFrom, transition: { type: 'just' }, width: width }, props), children)))), document.querySelector(querySelector) || document.body)
|
|
17
|
+
}, overlayBackground: overlayBackground, ref: ref, transition: { duration: 0.3, ease: 'easeOut' } },
|
|
18
|
+
React.createElement(SideModalContainer, __assign({ animate: { x: 0 }, "aria-modal": "true", background: background, exit: { x: slideFrom === 'left' ? '-100%' : '100%' }, initial: { x: slideFrom === 'left' ? '-100%' : '100%' }, maxHeight: maxHeight, maxWidth: maxWidth, onClick: function (e) { return e.stopPropagation(); }, role: "dialog", slideFrom: slideFrom, transition: { duration: 0.3, ease: 'easeOut' }, width: width }, props), children)))), document.querySelector(querySelector) || document.body)
|
|
21
19
|
: null;
|
|
22
20
|
});
|
|
23
21
|
SideModal.displayName = 'SideModal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SideModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { motion } from '
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
4
|
|
|
5
5
|
var SideModalOverlay = styled(motion.div)(templateObject_1 || (templateObject_1 = __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 ", ";\n justify-content: center;\n align-items: center;\n overscroll-behavior: none;\n @media (min-width: ", "px) {\n padding: ", "px;\n max-height: unset;\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 ", ";\n justify-content: center;\n align-items: center;\n overscroll-behavior: none;\n @media (min-width: ", "px) {\n padding: ", "px;\n max-height: unset;\n }\n"])), function (props) { var _a; return (_a = props.theme.attributes) === null || _a === void 0 ? void 0 : _a.zIndex.modal; }, function (props) { return props.overlayBackground; }, function (props) {
|
|
6
6
|
return props.maxHeight &&
|
package/build/es/components/src/components/SlideInOutContainer/SlideInOutContainer.styles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
|
|
2
|
-
import { motion } from '
|
|
2
|
+
import { motion } from 'motion/react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
5
5
|
var SideModalContainer = styled(motion.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n ", ";\n position: absolute;\n ", ";\n top: 0;\n ", "\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n"], ["\n width: 100%;\n ", ";\n position: absolute;\n ", ";\n top: 0;\n ", "\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n"])), function (_a) {
|
|
@@ -370,7 +370,15 @@ var useFixedModalScroll = function (active, querySelector) {
|
|
|
370
370
|
React.useEffect(function () {
|
|
371
371
|
var pos = window === null || window === void 0 ? void 0 : window.scrollY;
|
|
372
372
|
var selector = querySelector || (document === null || document === void 0 ? void 0 : document.body);
|
|
373
|
-
if (
|
|
373
|
+
if (!selector)
|
|
374
|
+
return;
|
|
375
|
+
var savedStyles = {
|
|
376
|
+
top: selector.style.top,
|
|
377
|
+
overflowY: selector.style.overflowY,
|
|
378
|
+
position: selector.style.position,
|
|
379
|
+
scrollY: pos
|
|
380
|
+
};
|
|
381
|
+
if (active) {
|
|
374
382
|
setPrevPosition(pos);
|
|
375
383
|
selector.style.overflowY = 'scroll';
|
|
376
384
|
selector.style.position = 'fixed';
|
|
@@ -384,6 +392,28 @@ var useFixedModalScroll = function (active, querySelector) {
|
|
|
384
392
|
window.scrollTo(0, prevPosition);
|
|
385
393
|
}
|
|
386
394
|
}
|
|
395
|
+
return function () {
|
|
396
|
+
if (selector) {
|
|
397
|
+
if (savedStyles.top) {
|
|
398
|
+
selector.style.top = savedStyles.top;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
selector.style.removeProperty('top');
|
|
402
|
+
}
|
|
403
|
+
if (savedStyles.overflowY) {
|
|
404
|
+
selector.style.overflowY = savedStyles.overflowY;
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
selector.style.overflowY = 'auto';
|
|
408
|
+
}
|
|
409
|
+
if (savedStyles.position) {
|
|
410
|
+
selector.style.position = savedStyles.position;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
selector.style.position = 'relative';
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
};
|
|
387
417
|
}, [active, querySelector]);
|
|
388
418
|
};
|
|
389
419
|
|