@citygross/components 0.8.2 → 0.8.3
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/CouponCode/CouponCode.styles.d.ts +1 -1
- package/build/cjs/components/src/components/CgButton/CgButton.styles.js +1 -1
- package/build/cjs/components/src/components/CouponCode/CouponCode.js +9 -4
- package/build/cjs/components/src/components/CouponCode/CouponCode.js.map +1 -1
- package/build/cjs/components/src/components/CouponCode/CouponCode.styles.js +3 -3
- package/build/es/components/src/components/CgButton/CgButton.styles.js +1 -1
- package/build/es/components/src/components/CouponCode/CouponCode.js +10 -5
- package/build/es/components/src/components/CouponCode/CouponCode.js.map +1 -1
- package/build/es/components/src/components/CouponCode/CouponCode.styles.js +3 -3
- package/package.json +2 -2
|
@@ -10,5 +10,5 @@ export declare const CouponContainer: import("styled-components").StyledComponen
|
|
|
10
10
|
export declare const CouponInput: import("styled-components").StyledComponent<"input", import("styled-components").DefaultTheme, TCouponInput, never>;
|
|
11
11
|
export declare const CouponResultContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TCouponResultContainer, never>;
|
|
12
12
|
export declare const CouponResultMessage: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const CouponInputContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
14
14
|
export {};
|
|
@@ -67,7 +67,7 @@ var CgButtonContainer = styled__default["default"].button(templateObject_7 || (t
|
|
|
67
67
|
return CgPrimary;
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
-
var CgButtonContent = styled__default["default"].div(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\n"], ["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { return (props.flexReverse ? 'row-reverse' : 'row'); }, function (props) { return buttonFontSize(props.size, props.theme.typography); }, function (props) { return (props === null || props === void 0 ? void 0 : props.loading) && "opacity: 0"; });
|
|
70
|
+
var CgButtonContent = styled__default["default"].div(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\nwhite-space: nowrap;\nmin-width: max-content;\n"], ["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\nwhite-space: nowrap;\nmin-width: max-content;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { return (props.flexReverse ? 'row-reverse' : 'row'); }, function (props) { return buttonFontSize(props.size, props.theme.typography); }, function (props) { return (props === null || props === void 0 ? void 0 : props.loading) && "opacity: 0"; });
|
|
71
71
|
var CgButtonLoader = styled__default["default"].div(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: grid;\n place-content: center;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: grid;\n place-content: center;\n"])));
|
|
72
72
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
73
73
|
|
|
@@ -61,10 +61,15 @@ function CouponCode(_a) {
|
|
|
61
61
|
});
|
|
62
62
|
}); };
|
|
63
63
|
return (React__default["default"].createElement(React__default["default"].Fragment, null, (result === null || result === void 0 ? void 0 : result.status) === exports.ECouponCodeStatus.Empty ? (React__default["default"].createElement(CouponCode_styles.CouponContainer, null,
|
|
64
|
-
React__default["default"].createElement(CouponCode_styles.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
React__default["default"].createElement(CouponCode_styles.CouponInputContainer, null,
|
|
65
|
+
React__default["default"].createElement(CouponCode_styles.CouponInput, { type: "text", placeholder: placeholder, value: value, onChange: function (e) { return setValue(e.currentTarget.value); }, onMouseDown: function () {
|
|
66
|
+
setCustomFocus(true);
|
|
67
|
+
}, onKeyDown: function (event) {
|
|
68
|
+
if (event.key === 'Enter') {
|
|
69
|
+
handleSubmit();
|
|
70
|
+
}
|
|
71
|
+
}, onBlur: function () { return setCustomFocus(false); }, customFocus: customFocus })),
|
|
72
|
+
React__default["default"].createElement("div", null,
|
|
68
73
|
React__default["default"].createElement(CgButton.CgButton, { variant: CgButton.EButtonVariant.secondary, disabled: loading || !value, onClick: function () { return handleSubmit(); }, size: CgButton.ECgButtonSize.medium, fullWidth: true, loading: loading }, label)))) : (React__default["default"].createElement(CouponCode_styles.CouponResultContainer, { status: result === null || result === void 0 ? void 0 : result.status }, (result === null || result === void 0 ? void 0 : result.status) === exports.ECouponCodeStatus.Success ? (React__default["default"].createElement(CouponCode_styles.CouponResultMessage, null,
|
|
69
74
|
React__default["default"].createElement(CouponResultIcon, { status: result === null || result === void 0 ? void 0 : result.status }),
|
|
70
75
|
React__default["default"].createElement("p", null, result === null || result === void 0 ? void 0 :
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CouponCode.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CouponCode.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -12,7 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
13
13
|
|
|
14
14
|
var CouponContainer = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n display: flex;\n gap: ", "px;\n width: 100%;\n"], ["\n display: flex;\n gap: ", "px;\n width: 100%;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs2; });
|
|
15
|
-
var CouponInput = styled__default["default"].input(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n
|
|
15
|
+
var CouponInput = styled__default["default"].input(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n border-radius: ", "px;\n border: 1px solid ", ";\n background: ", ";\n padding: ", ";\n outline: none;\n background: white;\n font-size: ", "px;\n width: 100%;\n\n ", "\n &:focus-visible {\n border: 1px solid ", ";\n }\n"], ["\n border-radius: ", "px;\n border: 1px solid ", ";\n background: ", ";\n padding: ", ";\n outline: none;\n background: white;\n font-size: ", "px;\n width: 100%;\n\n ", "\n &:focus-visible {\n border: 1px solid ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.medium; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, function (props) { var _a, _b; return "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs, "px ").concat((_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.xs2, "px"); }, function (props) { var _a, _b; return (_b = (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.s3; }, function (props) { return !props.customFocus && global_styles.focusVisible; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.brandBlue; });
|
|
16
16
|
var CouponResultContainer = styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n padding: ", ";\n background: ", ";\n display: flex;\n height: ", "px;\n border-radius: ", "px;\n justify-content: space-between;\n"], ["\n font-size: ", "px;\n padding: ", ";\n background: ", ";\n display: flex;\n height: ", "px;\n border-radius: ", "px;\n justify-content: space-between;\n"])), function (props) { var _a, _b; return (_b = (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.s2; }, function (props) { var _a, _b; return "".concat((_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.couponContainerPadding, "px ").concat((_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.xs, "px"); }, function (props) {
|
|
17
17
|
var _a, _b;
|
|
18
18
|
return props.status === CouponCode.ECouponCodeStatus.Success
|
|
@@ -20,12 +20,12 @@ var CouponResultContainer = styled__default["default"].div(templateObject_3 || (
|
|
|
20
20
|
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.redLight;
|
|
21
21
|
}, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.couponContainerHeight; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
|
|
22
22
|
var CouponResultMessage = styled__default["default"].div(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n display: flex;\n gap: ", "px;\n"], ["\n display: flex;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs2; });
|
|
23
|
-
var
|
|
23
|
+
var CouponInputContainer = styled__default["default"].div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n flex: 1;\n"], ["\n flex: 1;\n"])));
|
|
24
24
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
25
25
|
|
|
26
|
-
exports.CouponButtonContainer = CouponButtonContainer;
|
|
27
26
|
exports.CouponContainer = CouponContainer;
|
|
28
27
|
exports.CouponInput = CouponInput;
|
|
28
|
+
exports.CouponInputContainer = CouponInputContainer;
|
|
29
29
|
exports.CouponResultContainer = CouponResultContainer;
|
|
30
30
|
exports.CouponResultMessage = CouponResultMessage;
|
|
31
31
|
//# sourceMappingURL=CouponCode.styles.js.map
|
|
@@ -59,7 +59,7 @@ var CgButtonContainer = styled.button(templateObject_7 || (templateObject_7 = __
|
|
|
59
59
|
return CgPrimary;
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
var CgButtonContent = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\n"], ["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { return (props.flexReverse ? 'row-reverse' : 'row'); }, function (props) { return buttonFontSize(props.size, props.theme.typography); }, function (props) { return (props === null || props === void 0 ? void 0 : props.loading) && "opacity: 0"; });
|
|
62
|
+
var CgButtonContent = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\nwhite-space: nowrap;\nmin-width: max-content;\n"], ["\ndisplay: flex;\njustify-content: center;\nalign-items: center;\ngap: ", "px;\nflex-direction: ", ";\nfont-size ", ";\n", ";\nwhite-space: nowrap;\nmin-width: max-content;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { return (props.flexReverse ? 'row-reverse' : 'row'); }, function (props) { return buttonFontSize(props.size, props.theme.typography); }, function (props) { return (props === null || props === void 0 ? void 0 : props.loading) && "opacity: 0"; });
|
|
63
63
|
var CgButtonLoader = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: grid;\n place-content: center;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: grid;\n place-content: center;\n"])));
|
|
64
64
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
65
65
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __awaiter, __generator } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import { CouponContainer,
|
|
3
|
+
import { CouponContainer, CouponInputContainer, CouponInput, CouponResultContainer, CouponResultMessage } from './CouponCode.styles.js';
|
|
4
4
|
import { CgButton, EButtonVariant, ECgButtonSize } from '../CgButton/CgButton.js';
|
|
5
5
|
import { Icons } from '@citygross/icons';
|
|
6
6
|
import { theme } from '@citygross/design-tokens';
|
|
@@ -53,10 +53,15 @@ function CouponCode(_a) {
|
|
|
53
53
|
});
|
|
54
54
|
}); };
|
|
55
55
|
return (React.createElement(React.Fragment, null, (result === null || result === void 0 ? void 0 : result.status) === ECouponCodeStatus.Empty ? (React.createElement(CouponContainer, null,
|
|
56
|
-
React.createElement(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
React.createElement(CouponInputContainer, null,
|
|
57
|
+
React.createElement(CouponInput, { type: "text", placeholder: placeholder, value: value, onChange: function (e) { return setValue(e.currentTarget.value); }, onMouseDown: function () {
|
|
58
|
+
setCustomFocus(true);
|
|
59
|
+
}, onKeyDown: function (event) {
|
|
60
|
+
if (event.key === 'Enter') {
|
|
61
|
+
handleSubmit();
|
|
62
|
+
}
|
|
63
|
+
}, onBlur: function () { return setCustomFocus(false); }, customFocus: customFocus })),
|
|
64
|
+
React.createElement("div", null,
|
|
60
65
|
React.createElement(CgButton, { variant: EButtonVariant.secondary, disabled: loading || !value, onClick: function () { return handleSubmit(); }, size: ECgButtonSize.medium, fullWidth: true, loading: loading }, label)))) : (React.createElement(CouponResultContainer, { status: result === null || result === void 0 ? void 0 : result.status }, (result === null || result === void 0 ? void 0 : result.status) === ECouponCodeStatus.Success ? (React.createElement(CouponResultMessage, null,
|
|
61
66
|
React.createElement(CouponResultIcon, { status: result === null || result === void 0 ? void 0 : result.status }),
|
|
62
67
|
React.createElement("p", null, result === null || result === void 0 ? void 0 :
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CouponCode.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CouponCode.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -4,7 +4,7 @@ import { focusVisible } from '../../shared/global.styles.js';
|
|
|
4
4
|
import { ECouponCodeStatus } from './CouponCode.js';
|
|
5
5
|
|
|
6
6
|
var CouponContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n gap: ", "px;\n width: 100%;\n"], ["\n display: flex;\n gap: ", "px;\n width: 100%;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs2; });
|
|
7
|
-
var CouponInput = styled.input(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n
|
|
7
|
+
var CouponInput = styled.input(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: ", "px;\n border: 1px solid ", ";\n background: ", ";\n padding: ", ";\n outline: none;\n background: white;\n font-size: ", "px;\n width: 100%;\n\n ", "\n &:focus-visible {\n border: 1px solid ", ";\n }\n"], ["\n border-radius: ", "px;\n border: 1px solid ", ";\n background: ", ";\n padding: ", ";\n outline: none;\n background: white;\n font-size: ", "px;\n width: 100%;\n\n ", "\n &:focus-visible {\n border: 1px solid ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.medium; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, function (props) { var _a, _b; return "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs, "px ").concat((_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.xs2, "px"); }, function (props) { var _a, _b; return (_b = (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.s3; }, function (props) { return !props.customFocus && focusVisible; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.brandBlue; });
|
|
8
8
|
var CouponResultContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: ", "px;\n padding: ", ";\n background: ", ";\n display: flex;\n height: ", "px;\n border-radius: ", "px;\n justify-content: space-between;\n"], ["\n font-size: ", "px;\n padding: ", ";\n background: ", ";\n display: flex;\n height: ", "px;\n border-radius: ", "px;\n justify-content: space-between;\n"])), function (props) { var _a, _b; return (_b = (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size) === null || _b === void 0 ? void 0 : _b.s2; }, function (props) { var _a, _b; return "".concat((_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.couponContainerPadding, "px ").concat((_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.xs, "px"); }, function (props) {
|
|
9
9
|
var _a, _b;
|
|
10
10
|
return props.status === ECouponCodeStatus.Success
|
|
@@ -12,8 +12,8 @@ var CouponResultContainer = styled.div(templateObject_3 || (templateObject_3 = _
|
|
|
12
12
|
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.redLight;
|
|
13
13
|
}, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.couponContainerHeight; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
|
|
14
14
|
var CouponResultMessage = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n gap: ", "px;\n"], ["\n display: flex;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs2; });
|
|
15
|
-
var
|
|
15
|
+
var CouponInputContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n flex: 1;\n"], ["\n flex: 1;\n"])));
|
|
16
16
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
17
17
|
|
|
18
|
-
export {
|
|
18
|
+
export { CouponContainer, CouponInput, CouponInputContainer, CouponResultContainer, CouponResultMessage };
|
|
19
19
|
//# sourceMappingURL=CouponCode.styles.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./build/cjs/components/src/index.js",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"react-slick": "^0.30.1",
|
|
77
77
|
"slick-carousel": "^1.8.1"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "c10e60eb7ba6f2588bb83d19af343a79daa77148"
|
|
80
80
|
}
|