@citygross/components 0.7.113 → 0.7.115
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/index.d.ts +1 -0
- package/build/cjs/components/src/components/AddressBlock/AddressBlock.js +1 -1
- package/build/cjs/components/src/components/SideModal/SideModal.js +19 -9
- package/build/cjs/components/src/components/SideModal/SideModal.js.map +1 -1
- package/build/cjs/components/src/components/SideModal/SideModal.styles.js +2 -2
- package/build/cjs/components/src/components/WarningLabel/WarningLabel.js +1 -1
- package/build/cjs/components/src/components/ZipCodeInput/ZipCodeInput.js +69 -0
- package/build/cjs/components/src/components/ZipCodeInput/ZipCodeInput.js.map +1 -0
- package/build/cjs/components/src/components/ZipCodeInput/ZipCodeInput.styles.js +32 -0
- package/build/cjs/components/src/components/ZipCodeInput/ZipCodeInput.styles.js.map +1 -0
- package/build/cjs/components/src/index.js +2 -0
- package/build/cjs/components/src/index.js.map +1 -1
- package/build/es/components/src/components/AddressBlock/AddressBlock.js +1 -1
- package/build/es/components/src/components/SideModal/SideModal.js +19 -9
- package/build/es/components/src/components/SideModal/SideModal.js.map +1 -1
- package/build/es/components/src/components/SideModal/SideModal.styles.js +2 -2
- package/build/es/components/src/components/WarningLabel/WarningLabel.js +1 -1
- package/build/es/components/src/components/ZipCodeInput/ZipCodeInput.js +61 -0
- package/build/es/components/src/components/ZipCodeInput/ZipCodeInput.js.map +1 -0
- package/build/es/components/src/components/ZipCodeInput/ZipCodeInput.styles.js +23 -0
- package/build/es/components/src/components/ZipCodeInput/ZipCodeInput.styles.js.map +1 -0
- package/build/es/components/src/index.js +1 -0
- package/build/es/components/src/index.js.map +1 -1
- package/package.json +2 -2
package/build/@types/index.d.ts
CHANGED
|
@@ -71,3 +71,4 @@ export * from './components/MenuListItem/MenuListHeader';
|
|
|
71
71
|
export * from './components/MenuListItem/MenuListItem';
|
|
72
72
|
export * from './components/SlideInOutContainer/SlideInOutContainer';
|
|
73
73
|
export * from './components/SearchSuggestionChip/SearchSuggestionChip';
|
|
74
|
+
export * from './components/ZipCodeInput/ZipCodeInput';
|
|
@@ -77,7 +77,6 @@ require('styled-components');
|
|
|
77
77
|
require('../SearchBar/SearchBar.styles.js');
|
|
78
78
|
require('../Nav/Nav.styles.js');
|
|
79
79
|
require('../NavMainLink/NavMainLink.styled.js');
|
|
80
|
-
require('framer-motion');
|
|
81
80
|
require('../SideModal/SideModal.styles.js');
|
|
82
81
|
require('../IconText/IconText.styles.js');
|
|
83
82
|
require('../Dropdown/Dropdown.styles.js');
|
|
@@ -85,6 +84,7 @@ require('../SearchListItem/SearchListItem.styles.js');
|
|
|
85
84
|
require('../MenuListItem/MenuListItem.styles.js');
|
|
86
85
|
require('../SlideInOutContainer/SlideInOutContainer.styles.js');
|
|
87
86
|
require('../SearchSuggestionChip/SearchSuggestionChip.styles.js');
|
|
87
|
+
require('../ZipCodeInput/ZipCodeInput.styles.js');
|
|
88
88
|
|
|
89
89
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
90
90
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var framerMotion = require('framer-motion');
|
|
7
6
|
var reactDom = require('react-dom');
|
|
8
7
|
var SideModal_styles = require('./SideModal.styles.js');
|
|
9
8
|
var designTokens = require('@citygross/design-tokens');
|
|
@@ -16,16 +15,27 @@ var SideModal = function (_a) {
|
|
|
16
15
|
var _b, _c;
|
|
17
16
|
var onBackdropClick = _a.onBackdropClick, _d = _a.background, background = _d === void 0 ? '#fff' : _d, _e = _a.overlayBackground, overlayBackground = _e === void 0 ? (_c = (_b = designTokens.theme.palette) === null || _b === void 0 ? void 0 : _b.darkOverlay) !== null && _c !== void 0 ? _c : '' : _e, _f = _a.width, width = _f === void 0 ? 375 : _f, isVisible = _a.isVisible, slideFrom = _a.slideFrom, _g = _a.querySelector, querySelector = _g === void 0 ? '#root' : _g, maxWidth = _a.maxWidth, children = _a.children;
|
|
18
17
|
var ref = React.useRef(null);
|
|
18
|
+
var variants = {
|
|
19
|
+
hide: {
|
|
20
|
+
x: slideFrom === 'left' ? '-100%' : '100%',
|
|
21
|
+
transition: { duration: 0.3, delay: 0, ease: 'linear' }
|
|
22
|
+
},
|
|
23
|
+
show: {
|
|
24
|
+
x: 0,
|
|
25
|
+
transition: { duration: 0.3, delay: 0, ease: 'linear' }
|
|
26
|
+
}
|
|
27
|
+
};
|
|
19
28
|
var domSafe = typeof document !== 'undefined';
|
|
20
29
|
return domSafe
|
|
21
|
-
? reactDom.createPortal(React__default["default"].createElement(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
? reactDom.createPortal(React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
31
|
+
isVisible && (React__default["default"].createElement(SideModal_styles.SideModalOverlay, { ref: ref, onMouseDown: function (e) {
|
|
32
|
+
if (ref && e.target === (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
33
|
+
onBackdropClick();
|
|
34
|
+
}
|
|
35
|
+
}, overlayBackground: overlayBackground, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: {
|
|
36
|
+
type: 'just'
|
|
37
|
+
} })),
|
|
38
|
+
React__default["default"].createElement(SideModal_styles.SideModalContainer, { slideFrom: slideFrom, maxWidth: maxWidth, transition: { type: 'just' }, width: width, onClick: function (e) { return e.stopPropagation(); }, background: background, variants: variants, animate: isVisible ? 'show' : 'hide' }, children)), document.querySelector(querySelector) || document.body)
|
|
29
39
|
: null;
|
|
30
40
|
};
|
|
31
41
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SideModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -11,10 +11,10 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
12
12
|
|
|
13
13
|
var SideModalOverlay = styled__default["default"](framerMotion.motion.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) { return props.overlayBackground; }, 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; });
|
|
14
|
-
var SideModalContainer = styled__default["default"](framerMotion.motion.div)(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n height: 100vh;\n background: ", ";\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 @media (min-width: ", "px) {\n width: ", "px;\n }\n"], ["\n height: 100vh;\n background: ", ";\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 @media (min-width: ", "px) {\n width: ", "px;\n }\n"])), function (props) { return props.background; }, function (_a) {
|
|
14
|
+
var SideModalContainer = styled__default["default"](framerMotion.motion.div)(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n height: 100vh;\n background: ", ";\n width: 100%;\n ", ";\n position: absolute;\n ", ";\n top: 0;\n z-index: ", ";\n\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n\n @media (min-width: ", "px) {\n width: ", "px;\n }\n"], ["\n height: 100vh;\n background: ", ";\n width: 100%;\n ", ";\n position: absolute;\n ", ";\n top: 0;\n z-index: ", ";\n\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n\n @media (min-width: ", "px) {\n width: ", "px;\n }\n"])), function (props) { return props.background; }, function (_a) {
|
|
15
15
|
var maxWidth = _a.maxWidth;
|
|
16
16
|
return maxWidth && "max-width:".concat(maxWidth);
|
|
17
|
-
}, function (props) { return ((props === null || props === void 0 ? void 0 : props.slideFrom) === 'left' ? "left: 0px" : 'right: 0px'); }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.sm; }, function (props) { return props.width; });
|
|
17
|
+
}, function (props) { return ((props === null || props === void 0 ? void 0 : props.slideFrom) === 'left' ? "left: 0px" : 'right: 0px'); }, 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.breakpoints) === null || _a === void 0 ? void 0 : _a.sm; }, function (props) { return props.width; });
|
|
18
18
|
var templateObject_1, templateObject_2;
|
|
19
19
|
|
|
20
20
|
exports.SideModalContainer = SideModalContainer;
|
|
@@ -77,7 +77,6 @@ require('styled-components');
|
|
|
77
77
|
require('../SearchBar/SearchBar.styles.js');
|
|
78
78
|
require('../Nav/Nav.styles.js');
|
|
79
79
|
require('../NavMainLink/NavMainLink.styled.js');
|
|
80
|
-
require('framer-motion');
|
|
81
80
|
require('../SideModal/SideModal.styles.js');
|
|
82
81
|
require('../IconText/IconText.styles.js');
|
|
83
82
|
require('../Dropdown/Dropdown.styles.js');
|
|
@@ -85,6 +84,7 @@ require('../SearchListItem/SearchListItem.styles.js');
|
|
|
85
84
|
require('../MenuListItem/MenuListItem.styles.js');
|
|
86
85
|
require('../SlideInOutContainer/SlideInOutContainer.styles.js');
|
|
87
86
|
require('../SearchSuggestionChip/SearchSuggestionChip.styles.js');
|
|
87
|
+
require('../ZipCodeInput/ZipCodeInput.styles.js');
|
|
88
88
|
|
|
89
89
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
90
90
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var ZipCodeInput_styles = require('./ZipCodeInput.styles.js');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
11
|
+
|
|
12
|
+
var ZipCodeInput = function (_a) {
|
|
13
|
+
var setZipCode = _a.setZipCode, verified = _a.verified, setVerified = _a.setVerified, backgroundColor = _a.backgroundColor, verifiedBackground = _a.verifiedBackground;
|
|
14
|
+
var inputRefs = React.useRef([]);
|
|
15
|
+
var createZipCode = function () {
|
|
16
|
+
var zipCode = 0;
|
|
17
|
+
inputRefs.current.forEach(function (i) {
|
|
18
|
+
if (zipCode === 0) {
|
|
19
|
+
zipCode = i.value;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
zipCode += i.value;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return zipCode;
|
|
26
|
+
};
|
|
27
|
+
var clamp = function (min, max, val) {
|
|
28
|
+
return Math.max(min, Math.min(val, max));
|
|
29
|
+
};
|
|
30
|
+
var handleInput = function (index, e) {
|
|
31
|
+
var nextIndex = clamp(0, 5 - 1, index + 1);
|
|
32
|
+
var prevIndex = clamp(0, 5 - 1, index - 1);
|
|
33
|
+
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
34
|
+
inputRefs.current[index].value = null;
|
|
35
|
+
setVerified(false);
|
|
36
|
+
inputRefs.current[prevIndex].focus();
|
|
37
|
+
}
|
|
38
|
+
else if (e.key === 'ArrowLeft') {
|
|
39
|
+
inputRefs.current[prevIndex].focus();
|
|
40
|
+
}
|
|
41
|
+
else if (e.key === 'ArrowRight') {
|
|
42
|
+
inputRefs.current[nextIndex].focus();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (inputRefs.current[index].value) {
|
|
46
|
+
if (e.key >= '1' && e.key <= '9') {
|
|
47
|
+
inputRefs.current[index].value = e.key;
|
|
48
|
+
inputRefs.current[nextIndex].focus();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var counter = 0;
|
|
53
|
+
inputRefs.current.forEach(function (ref) {
|
|
54
|
+
if (ref.value) {
|
|
55
|
+
counter++;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
if (counter === 5) {
|
|
59
|
+
setVerified(true);
|
|
60
|
+
setZipCode(createZipCode());
|
|
61
|
+
inputRefs.current[index].blur();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return (React__default["default"].createElement(ZipCodeInput_styles.InputWrapper, null, Array.from(Array(5).keys()).map(function (index) { return (React__default["default"].createElement("div", { key: index },
|
|
65
|
+
React__default["default"].createElement(ZipCodeInput_styles.ZipCodeInputBox, { type: "number", onInput: function (e) { return (e.currentTarget.value = e.currentTarget.value.slice(0, 1)); }, onKeyUp: function (e) { return handleInput(index, e); }, verified: verified, backgroundColor: backgroundColor, verifiedBackground: verifiedBackground, marginLeft: index === 3, ref: function (ref) { return (inputRefs.current[index] = ref); } }))); })));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.ZipCodeInput = ZipCodeInput;
|
|
69
|
+
//# sourceMappingURL=ZipCodeInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZipCodeInput.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../_virtual/_tslib.js');
|
|
6
|
+
var styled = require('styled-components');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
|
+
|
|
12
|
+
var InputWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n display: flex;\n justify-content: center;\n gap: ", "px;\n"], ["\n display: flex;\n justify-content: center;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
13
|
+
var ZipCodeInputBox = styled__default["default"].input(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n font-weight: ", ";\n border: solid 1px\n ", ";\n border-radius: ", "px;\n text-align: center;\n background-color: ", ";\n margin-left: ", ";\n\n :focus {\n border: solid 1px ", ";\n outline: none;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n"], ["\n width: ", "px;\n height: ", "px;\n font-weight: ", ";\n border: solid 1px\n ", ";\n border-radius: ", "px;\n text-align: center;\n background-color: ", ";\n margin-left: ", ";\n\n :focus {\n border: solid 1px ", ";\n outline: none;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n"])), function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.zipCodeInputSize; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.zipCodeInputSize; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight.semiBold; }, function (props) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return props.verified === false
|
|
16
|
+
? (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.dark
|
|
17
|
+
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.greenMedium;
|
|
18
|
+
}, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; }, function (props) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return props.verified === false
|
|
21
|
+
? props.backgroundColor
|
|
22
|
+
? props.backgroundColor
|
|
23
|
+
: (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white
|
|
24
|
+
: props.verifiedBackground
|
|
25
|
+
? props.verifiedBackground
|
|
26
|
+
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.greenLight;
|
|
27
|
+
}, function (props) { var _a; return props.marginLeft ? "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm, "px") : 0; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.alertBlue; });
|
|
28
|
+
var templateObject_1, templateObject_2;
|
|
29
|
+
|
|
30
|
+
exports.InputWrapper = InputWrapper;
|
|
31
|
+
exports.ZipCodeInputBox = ZipCodeInputBox;
|
|
32
|
+
//# sourceMappingURL=ZipCodeInput.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZipCodeInput.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -76,6 +76,7 @@ var MenuListHeader = require('./components/MenuListItem/MenuListHeader.js');
|
|
|
76
76
|
var MenuListItem = require('./components/MenuListItem/MenuListItem.js');
|
|
77
77
|
var SlideInOutContainer = require('./components/SlideInOutContainer/SlideInOutContainer.js');
|
|
78
78
|
var SearchSuggestionChip = require('./components/SearchSuggestionChip/SearchSuggestionChip.js');
|
|
79
|
+
var ZipCodeInput = require('./components/ZipCodeInput/ZipCodeInput.js');
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
|
|
@@ -184,4 +185,5 @@ exports.MenuListHeader = MenuListHeader.MenuListHeader;
|
|
|
184
185
|
exports.MenuListItem = MenuListItem.MenuListItem;
|
|
185
186
|
exports.SlideInOutContainer = SlideInOutContainer.SlideInOutContainer;
|
|
186
187
|
exports.SearchSuggestionChip = SearchSuggestionChip.SearchSuggestionChip;
|
|
188
|
+
exports.ZipCodeInput = ZipCodeInput.ZipCodeInput;
|
|
187
189
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -73,7 +73,6 @@ import 'styled-components';
|
|
|
73
73
|
import '../SearchBar/SearchBar.styles.js';
|
|
74
74
|
import '../Nav/Nav.styles.js';
|
|
75
75
|
import '../NavMainLink/NavMainLink.styled.js';
|
|
76
|
-
import 'framer-motion';
|
|
77
76
|
import '../SideModal/SideModal.styles.js';
|
|
78
77
|
import '../IconText/IconText.styles.js';
|
|
79
78
|
import '../Dropdown/Dropdown.styles.js';
|
|
@@ -81,6 +80,7 @@ import '../SearchListItem/SearchListItem.styles.js';
|
|
|
81
80
|
import '../MenuListItem/MenuListItem.styles.js';
|
|
82
81
|
import '../SlideInOutContainer/SlideInOutContainer.styles.js';
|
|
83
82
|
import '../SearchSuggestionChip/SearchSuggestionChip.styles.js';
|
|
83
|
+
import '../ZipCodeInput/ZipCodeInput.styles.js';
|
|
84
84
|
|
|
85
85
|
function AddressBlock(_a) {
|
|
86
86
|
var _b = _a.deliverOption, deliverOption = _b === void 0 ? 'Address' : _b, icon = _a.icon, storeName = _a.storeName, customerName = _a.customerName, street = _a.street, zipCode = _a.zipCode, city = _a.city, doorCode = _a.doorCode, floor = _a.floor, deliveryInstructions = _a.deliveryInstructions, xsSpacing = _a.xsSpacing, lgSpacing = _a.lgSpacing;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
|
-
import { AnimatePresence } from 'framer-motion';
|
|
3
2
|
import { createPortal } from 'react-dom';
|
|
4
3
|
import { SideModalOverlay, SideModalContainer } from './SideModal.styles.js';
|
|
5
4
|
import { theme } from '@citygross/design-tokens';
|
|
@@ -8,16 +7,27 @@ var SideModal = function (_a) {
|
|
|
8
7
|
var _b, _c;
|
|
9
8
|
var onBackdropClick = _a.onBackdropClick, _d = _a.background, background = _d === void 0 ? '#fff' : _d, _e = _a.overlayBackground, overlayBackground = _e === void 0 ? (_c = (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.darkOverlay) !== null && _c !== void 0 ? _c : '' : _e, _f = _a.width, width = _f === void 0 ? 375 : _f, isVisible = _a.isVisible, slideFrom = _a.slideFrom, _g = _a.querySelector, querySelector = _g === void 0 ? '#root' : _g, maxWidth = _a.maxWidth, children = _a.children;
|
|
10
9
|
var ref = useRef(null);
|
|
10
|
+
var variants = {
|
|
11
|
+
hide: {
|
|
12
|
+
x: slideFrom === 'left' ? '-100%' : '100%',
|
|
13
|
+
transition: { duration: 0.3, delay: 0, ease: 'linear' }
|
|
14
|
+
},
|
|
15
|
+
show: {
|
|
16
|
+
x: 0,
|
|
17
|
+
transition: { duration: 0.3, delay: 0, ease: 'linear' }
|
|
18
|
+
}
|
|
19
|
+
};
|
|
11
20
|
var domSafe = typeof document !== 'undefined';
|
|
12
21
|
return domSafe
|
|
13
|
-
? createPortal(React.createElement(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
? createPortal(React.createElement(React.Fragment, null,
|
|
23
|
+
isVisible && (React.createElement(SideModalOverlay, { ref: ref, onMouseDown: function (e) {
|
|
24
|
+
if (ref && e.target === (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
25
|
+
onBackdropClick();
|
|
26
|
+
}
|
|
27
|
+
}, overlayBackground: overlayBackground, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: {
|
|
28
|
+
type: 'just'
|
|
29
|
+
} })),
|
|
30
|
+
React.createElement(SideModalContainer, { slideFrom: slideFrom, maxWidth: maxWidth, transition: { type: 'just' }, width: width, onClick: function (e) { return e.stopPropagation(); }, background: background, variants: variants, animate: isVisible ? 'show' : 'hide' }, children)), document.querySelector(querySelector) || document.body)
|
|
21
31
|
: null;
|
|
22
32
|
};
|
|
23
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SideModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,10 +3,10 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
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 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) { return props.overlayBackground; }, 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; });
|
|
6
|
-
var SideModalContainer = styled(motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 100vh;\n background: ", ";\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 @media (min-width: ", "px) {\n width: ", "px;\n }\n"], ["\n height: 100vh;\n background: ", ";\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 @media (min-width: ", "px) {\n width: ", "px;\n }\n"])), function (props) { return props.background; }, function (_a) {
|
|
6
|
+
var SideModalContainer = styled(motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 100vh;\n background: ", ";\n width: 100%;\n ", ";\n position: absolute;\n ", ";\n top: 0;\n z-index: ", ";\n\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n\n @media (min-width: ", "px) {\n width: ", "px;\n }\n"], ["\n height: 100vh;\n background: ", ";\n width: 100%;\n ", ";\n position: absolute;\n ", ";\n top: 0;\n z-index: ", ";\n\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n }\n\n @media (min-width: ", "px) {\n width: ", "px;\n }\n"])), function (props) { return props.background; }, function (_a) {
|
|
7
7
|
var maxWidth = _a.maxWidth;
|
|
8
8
|
return maxWidth && "max-width:".concat(maxWidth);
|
|
9
|
-
}, function (props) { return ((props === null || props === void 0 ? void 0 : props.slideFrom) === 'left' ? "left: 0px" : 'right: 0px'); }, function (props) { var _a; return (_a = props.theme.breakpoints) === null || _a === void 0 ? void 0 : _a.sm; }, function (props) { return props.width; });
|
|
9
|
+
}, function (props) { return ((props === null || props === void 0 ? void 0 : props.slideFrom) === 'left' ? "left: 0px" : 'right: 0px'); }, 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.breakpoints) === null || _a === void 0 ? void 0 : _a.sm; }, function (props) { return props.width; });
|
|
10
10
|
var templateObject_1, templateObject_2;
|
|
11
11
|
|
|
12
12
|
export { SideModalContainer, SideModalOverlay };
|
|
@@ -73,7 +73,6 @@ import 'styled-components';
|
|
|
73
73
|
import '../SearchBar/SearchBar.styles.js';
|
|
74
74
|
import '../Nav/Nav.styles.js';
|
|
75
75
|
import '../NavMainLink/NavMainLink.styled.js';
|
|
76
|
-
import 'framer-motion';
|
|
77
76
|
import '../SideModal/SideModal.styles.js';
|
|
78
77
|
import '../IconText/IconText.styles.js';
|
|
79
78
|
import '../Dropdown/Dropdown.styles.js';
|
|
@@ -81,6 +80,7 @@ import '../SearchListItem/SearchListItem.styles.js';
|
|
|
81
80
|
import '../MenuListItem/MenuListItem.styles.js';
|
|
82
81
|
import '../SlideInOutContainer/SlideInOutContainer.styles.js';
|
|
83
82
|
import '../SearchSuggestionChip/SearchSuggestionChip.styles.js';
|
|
83
|
+
import '../ZipCodeInput/ZipCodeInput.styles.js';
|
|
84
84
|
|
|
85
85
|
function WarningLabel(_a) {
|
|
86
86
|
var children = _a.children, background = _a.background, toolTip = _a.toolTip;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { InputWrapper, ZipCodeInputBox } from './ZipCodeInput.styles.js';
|
|
3
|
+
|
|
4
|
+
var ZipCodeInput = function (_a) {
|
|
5
|
+
var setZipCode = _a.setZipCode, verified = _a.verified, setVerified = _a.setVerified, backgroundColor = _a.backgroundColor, verifiedBackground = _a.verifiedBackground;
|
|
6
|
+
var inputRefs = useRef([]);
|
|
7
|
+
var createZipCode = function () {
|
|
8
|
+
var zipCode = 0;
|
|
9
|
+
inputRefs.current.forEach(function (i) {
|
|
10
|
+
if (zipCode === 0) {
|
|
11
|
+
zipCode = i.value;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
zipCode += i.value;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return zipCode;
|
|
18
|
+
};
|
|
19
|
+
var clamp = function (min, max, val) {
|
|
20
|
+
return Math.max(min, Math.min(val, max));
|
|
21
|
+
};
|
|
22
|
+
var handleInput = function (index, e) {
|
|
23
|
+
var nextIndex = clamp(0, 5 - 1, index + 1);
|
|
24
|
+
var prevIndex = clamp(0, 5 - 1, index - 1);
|
|
25
|
+
if (e.key === 'Backspace' || e.key === 'Delete') {
|
|
26
|
+
inputRefs.current[index].value = null;
|
|
27
|
+
setVerified(false);
|
|
28
|
+
inputRefs.current[prevIndex].focus();
|
|
29
|
+
}
|
|
30
|
+
else if (e.key === 'ArrowLeft') {
|
|
31
|
+
inputRefs.current[prevIndex].focus();
|
|
32
|
+
}
|
|
33
|
+
else if (e.key === 'ArrowRight') {
|
|
34
|
+
inputRefs.current[nextIndex].focus();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (inputRefs.current[index].value) {
|
|
38
|
+
if (e.key >= '1' && e.key <= '9') {
|
|
39
|
+
inputRefs.current[index].value = e.key;
|
|
40
|
+
inputRefs.current[nextIndex].focus();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var counter = 0;
|
|
45
|
+
inputRefs.current.forEach(function (ref) {
|
|
46
|
+
if (ref.value) {
|
|
47
|
+
counter++;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (counter === 5) {
|
|
51
|
+
setVerified(true);
|
|
52
|
+
setZipCode(createZipCode());
|
|
53
|
+
inputRefs.current[index].blur();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return (React.createElement(InputWrapper, null, Array.from(Array(5).keys()).map(function (index) { return (React.createElement("div", { key: index },
|
|
57
|
+
React.createElement(ZipCodeInputBox, { type: "number", onInput: function (e) { return (e.currentTarget.value = e.currentTarget.value.slice(0, 1)); }, onKeyUp: function (e) { return handleInput(index, e); }, verified: verified, backgroundColor: backgroundColor, verifiedBackground: verifiedBackground, marginLeft: index === 3, ref: function (ref) { return (inputRefs.current[index] = ref); } }))); })));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { ZipCodeInput };
|
|
61
|
+
//# sourceMappingURL=ZipCodeInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZipCodeInput.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
var InputWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n gap: ", "px;\n"], ["\n display: flex;\n justify-content: center;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
5
|
+
var ZipCodeInputBox = styled.input(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n font-weight: ", ";\n border: solid 1px\n ", ";\n border-radius: ", "px;\n text-align: center;\n background-color: ", ";\n margin-left: ", ";\n\n :focus {\n border: solid 1px ", ";\n outline: none;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n"], ["\n width: ", "px;\n height: ", "px;\n font-weight: ", ";\n border: solid 1px\n ", ";\n border-radius: ", "px;\n text-align: center;\n background-color: ", ";\n margin-left: ", ";\n\n :focus {\n border: solid 1px ", ";\n outline: none;\n }\n\n ::-webkit-inner-spin-button,\n ::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n"])), function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.zipCodeInputSize; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.zipCodeInputSize; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight.semiBold; }, function (props) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
return props.verified === false
|
|
8
|
+
? (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.dark
|
|
9
|
+
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.greenMedium;
|
|
10
|
+
}, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; }, function (props) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
return props.verified === false
|
|
13
|
+
? props.backgroundColor
|
|
14
|
+
? props.backgroundColor
|
|
15
|
+
: (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white
|
|
16
|
+
: props.verifiedBackground
|
|
17
|
+
? props.verifiedBackground
|
|
18
|
+
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.greenLight;
|
|
19
|
+
}, function (props) { var _a; return props.marginLeft ? "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm, "px") : 0; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.alertBlue; });
|
|
20
|
+
var templateObject_1, templateObject_2;
|
|
21
|
+
|
|
22
|
+
export { InputWrapper, ZipCodeInputBox };
|
|
23
|
+
//# sourceMappingURL=ZipCodeInput.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZipCodeInput.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -72,4 +72,5 @@ export { MenuListHeader } from './components/MenuListItem/MenuListHeader.js';
|
|
|
72
72
|
export { MenuListItem } from './components/MenuListItem/MenuListItem.js';
|
|
73
73
|
export { SlideInOutContainer } from './components/SlideInOutContainer/SlideInOutContainer.js';
|
|
74
74
|
export { SearchSuggestionChip } from './components/SearchSuggestionChip/SearchSuggestionChip.js';
|
|
75
|
+
export { ZipCodeInput } from './components/ZipCodeInput/ZipCodeInput.js';
|
|
75
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.115",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./build/cjs/components/src/index.js",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"moment": "^2.29.1",
|
|
72
72
|
"react-loading-skeleton": "^2.2.0"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "410b15c9ebb2e7874d723f81e412f43f97d45db6"
|
|
75
75
|
}
|