@citygross/components 0.20.0 → 0.21.0
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/CartSummary/CartSummary.d.ts +5 -1
- package/build/@types/components/CartSummary/CartSummary.styles.d.ts +6 -3
- package/build/cjs/components/src/components/CartSummary/CartSummary.js +41 -29
- package/build/cjs/components/src/components/CartSummary/CartSummary.js.map +1 -1
- package/build/cjs/components/src/components/CartSummary/CartSummary.styles.js +29 -10
- package/build/cjs/components/src/components/CartSummary/CartSummary.styles.js.map +1 -1
- package/build/es/components/src/components/CartSummary/CartSummary.js +42 -30
- package/build/es/components/src/components/CartSummary/CartSummary.js.map +1 -1
- package/build/es/components/src/components/CartSummary/CartSummary.styles.js +29 -11
- package/build/es/components/src/components/CartSummary/CartSummary.styles.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export declare type TCartSummaryVariant = 'default' | 'yellow';
|
|
2
3
|
export declare type TCartSummary = {
|
|
3
4
|
bags?: TSummaryItem[];
|
|
4
5
|
cateredMeals?: TSummaryItem[];
|
|
@@ -10,6 +11,7 @@ export declare type TCartSummary = {
|
|
|
10
11
|
totalDiscountAmount: number;
|
|
11
12
|
};
|
|
12
13
|
groceries?: TSummaryItem[];
|
|
14
|
+
ariaLabel?: string;
|
|
13
15
|
itemsLabel?: string;
|
|
14
16
|
saveLabel?: string;
|
|
15
17
|
shippingLabel?: string;
|
|
@@ -18,8 +20,10 @@ export declare type TCartSummary = {
|
|
|
18
20
|
title?: string;
|
|
19
21
|
totalAmount: number;
|
|
20
22
|
totalDiscount: number;
|
|
23
|
+
totalTaxAmount?: number;
|
|
21
24
|
totalLabel?: string;
|
|
22
25
|
pickingFeeFromLabel?: string;
|
|
26
|
+
variant?: TCartSummaryVariant;
|
|
23
27
|
};
|
|
24
28
|
export declare type TSummaryItem = {
|
|
25
29
|
amount: number;
|
|
@@ -31,4 +35,4 @@ export declare type TSummaryItem = {
|
|
|
31
35
|
quantity: number;
|
|
32
36
|
tooltipAriaLabel?: string;
|
|
33
37
|
};
|
|
34
|
-
export declare function CartSummary({ saveLabel, totalLabel, itemsLabel, ...cartSummary }: TCartSummary): React.JSX.Element;
|
|
38
|
+
export declare function CartSummary({ saveLabel, totalLabel, itemsLabel, ariaLabel, taxLabel, variant, ...cartSummary }: TCartSummary): React.JSX.Element;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import type { TCartSummaryVariant } from './CartSummary';
|
|
1
2
|
declare type TCartLine = {
|
|
2
3
|
cancelled?: boolean;
|
|
3
4
|
};
|
|
4
|
-
declare type
|
|
5
|
+
declare type TCartSummaryVariantProps = {
|
|
5
6
|
title?: string;
|
|
7
|
+
variant?: TCartSummaryVariant;
|
|
6
8
|
};
|
|
7
9
|
export declare const CartSummaryContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
-
export declare const CartPaymentContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
9
|
-
export declare const CartSummaryContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
10
|
+
export declare const CartPaymentContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TCartSummaryVariantProps, never>;
|
|
11
|
+
export declare const CartSummaryContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TCartSummaryVariantProps, never>;
|
|
12
|
+
export declare const CartSummaryFooter: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
13
|
export declare const ChargesContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
11
14
|
export declare const CartLine: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TCartLine, never>;
|
|
12
15
|
export declare const AmountWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -34,7 +34,7 @@ var calculateSummaryLine = function (items) {
|
|
|
34
34
|
};
|
|
35
35
|
function CartSummary(_a) {
|
|
36
36
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
37
|
-
var _q = _a.saveLabel, saveLabel = _q === void 0 ? 'Varav rabatt' : _q, _r = _a.totalLabel, totalLabel = _r === void 0 ? 'Totalt' : _r, _s = _a.itemsLabel, itemsLabel = _s === void 0 ? 'Varor' : _s, cartSummary = _tslib.__rest(_a, ["saveLabel", "totalLabel", "itemsLabel"]);
|
|
37
|
+
var _q = _a.saveLabel, saveLabel = _q === void 0 ? 'Varav rabatt' : _q, _r = _a.totalLabel, totalLabel = _r === void 0 ? 'Totalt' : _r, _s = _a.itemsLabel, itemsLabel = _s === void 0 ? 'Varor' : _s, _t = _a.ariaLabel, ariaLabel = _t === void 0 ? 'Ordersammanfattning' : _t, _u = _a.taxLabel, taxLabel = _u === void 0 ? 'Varav moms' : _u, _v = _a.variant, variant = _v === void 0 ? 'default' : _v, cartSummary = _tslib.__rest(_a, ["saveLabel", "totalLabel", "itemsLabel", "ariaLabel", "taxLabel", "variant"]);
|
|
38
38
|
var charges = (_b = cartSummary.charges) !== null && _b !== void 0 ? _b : [];
|
|
39
39
|
var pickingFeeFromLabel = cartSummary.pickingFeeFromLabel;
|
|
40
40
|
var bags = (_c = cartSummary.bags) !== null && _c !== void 0 ? _c : [];
|
|
@@ -85,38 +85,50 @@ function CartSummary(_a) {
|
|
|
85
85
|
React__default["default"].createElement(CartSummary_styles.ChargeTooltipInfo, null,
|
|
86
86
|
React__default["default"].createElement(typography.BodyText, { color: (_e = index.theme.palette) === null || _e === void 0 ? void 0 : _e.white, size: typography.TextTypes.TextSize.SMALL }, charge.info))))));
|
|
87
87
|
};
|
|
88
|
+
var isYellowVariant = variant === 'yellow';
|
|
89
|
+
var discountLine = cartSummary.totalDiscount > 0 ? (React__default["default"].createElement(CartSummary_styles.CartLine, null,
|
|
90
|
+
React__default["default"].createElement(typography.BodyText, { size: isYellowVariant ? undefined : typography.TextTypes.TextSize.SMALL }, saveLabel),
|
|
91
|
+
React__default["default"].createElement(typography.BodyText, { color: (_h = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _h === void 0 ? void 0 : _h.alertRed, size: isYellowVariant ? undefined : typography.TextTypes.TextSize.SMALL }, utils.formatPrice(cartSummary.totalDiscount)))) : null;
|
|
92
|
+
var totalLine = (React__default["default"].createElement(CartSummary_styles.CartLine, null,
|
|
93
|
+
React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, totalLabel),
|
|
94
|
+
React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, utils.formatPrice(cartSummary.totalAmount))));
|
|
95
|
+
var taxLine = cartSummary.totalTaxAmount !== undefined ? (React__default["default"].createElement(CartSummary_styles.CartLine, null,
|
|
96
|
+
React__default["default"].createElement(typography.BodyText, null, taxLabel),
|
|
97
|
+
React__default["default"].createElement(typography.BodyText, null, utils.formatPrice(cartSummary.totalTaxAmount)))) : null;
|
|
88
98
|
return (React__default["default"].createElement(CartSummary_styles.CartSummaryContainer, { role: "region" },
|
|
89
|
-
React__default["default"].createElement(CartSummary_styles.CartPaymentContainer,
|
|
99
|
+
React__default["default"].createElement(CartSummary_styles.CartPaymentContainer, { variant: variant },
|
|
90
100
|
cartSummary.title && (React__default["default"].createElement(CartSummary_styles.CartSummaryTitle, null,
|
|
91
101
|
React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, cartSummary.title),
|
|
92
102
|
React__default["default"].createElement(typography.BodyText, null, cartSummary.subtitle))),
|
|
93
|
-
React__default["default"].createElement(
|
|
94
|
-
|
|
95
|
-
React__default["default"].createElement(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
((_m =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
React__default["default"].createElement(
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
"(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
103
|
+
React__default["default"].createElement("div", { role: "group", "aria-label": ariaLabel },
|
|
104
|
+
React__default["default"].createElement(CartSummary_styles.CartSummaryContent, { title: cartSummary.title, variant: variant },
|
|
105
|
+
((groceries === null || groceries === void 0 ? void 0 : groceries.length) > 0 || (cateredMeals === null || cateredMeals === void 0 ? void 0 : cateredMeals.length) > 0) && (React__default["default"].createElement(CartSummary_styles.CartLine, null,
|
|
106
|
+
React__default["default"].createElement(typography.BodyText, { fontWeight: "medium" },
|
|
107
|
+
itemsLabel,
|
|
108
|
+
React__default["default"].createElement(CartSummary_styles.QuantitySpan, null, " (".concat(((_j = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.quantity) !== null && _j !== void 0 ? _j : 0) + ((_k = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.quantity) !== null && _k !== void 0 ? _k : 0), ")"))),
|
|
109
|
+
React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
|
|
110
|
+
(sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) > 0 && (React__default["default"].createElement(typography.BodyText, { lineThrough: true, color: (_l = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _l === void 0 ? void 0 : _l.dark }, utils.formatPrice(((_m = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) !== null && _m !== void 0 ? _m : 0) +
|
|
111
|
+
((_o = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.cancelledAmount) !== null && _o !== void 0 ? _o : 0)))),
|
|
112
|
+
React__default["default"].createElement(typography.BodyText, null, utils.formatPrice(sumOfGroceries.amount + sumOfCateredMeals.amount))))),
|
|
113
|
+
bags.length > 0 && (React__default["default"].createElement(CartSummary_styles.CartLine, null,
|
|
114
|
+
React__default["default"].createElement(typography.BodyText, null,
|
|
115
|
+
"Matkassar",
|
|
116
|
+
React__default["default"].createElement(CartSummary_styles.QuantitySpan, null,
|
|
117
|
+
"(",
|
|
118
|
+
sumOfBags.quantity,
|
|
119
|
+
")")),
|
|
120
|
+
React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
|
|
121
|
+
sumOfBags.cancelledAmount > 0 && (React__default["default"].createElement(typography.BodyText, { lineThrough: true, color: (_p = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _p === void 0 ? void 0 : _p.dark }, utils.formatPrice(sumOfBags.cancelledAmount))),
|
|
122
|
+
React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, utils.formatPrice(sumOfBags.amount))))),
|
|
123
|
+
(charges === null || charges === void 0 ? void 0 : charges.length) > 0 && (React__default["default"].createElement(CartSummary_styles.ChargesContainer, null, charges === null || charges === void 0 ? void 0 : charges.map(function (charge) { return (React__default["default"].createElement(ChargeLine, { key: charge.name, charge: charge })); }))),
|
|
124
|
+
isYellowVariant && discountLine,
|
|
125
|
+
!isYellowVariant && (React__default["default"].createElement(CartSummary_styles.ChargesContainer, null,
|
|
126
|
+
totalLine,
|
|
127
|
+
discountLine,
|
|
128
|
+
taxLine))),
|
|
129
|
+
isYellowVariant && (React__default["default"].createElement(CartSummary_styles.CartSummaryFooter, null,
|
|
130
|
+
totalLine,
|
|
131
|
+
taxLine))))));
|
|
120
132
|
}
|
|
121
133
|
|
|
122
134
|
exports.CartSummary = CartSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,22 +10,41 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
11
|
|
|
12
12
|
var CartSummaryContainer = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n &:focus {\n outline-offset: ", "px;\n }\n &:focus:not(:focus-visible) {\n outline: none;\n }\n"], ["\n &:focus {\n outline-offset: ", "px;\n }\n &:focus:not(:focus-visible) {\n outline: none;\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; });
|
|
13
|
-
var CartPaymentContainer = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"], ["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"])), function (props) {
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
var CartPaymentContainer = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"], ["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"])), function (props) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return props.variant === 'yellow'
|
|
16
|
+
? (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.yellowLighter
|
|
17
|
+
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.white;
|
|
18
|
+
});
|
|
19
|
+
var CartSummaryContent = styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), function (props) {
|
|
20
|
+
var _a, _b, _c, _d;
|
|
21
|
+
return props.variant === 'yellow'
|
|
22
|
+
? "padding: ".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.md, "px;\n padding-top: ").concat(props.title
|
|
23
|
+
? (_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.sm
|
|
24
|
+
: (_c = props.theme.spacings) === null || _c === void 0 ? void 0 : _c.md, "px")
|
|
25
|
+
: props.title && "padding-top: ".concat((_d = props.theme.spacings) === null || _d === void 0 ? void 0 : _d.sm, "px");
|
|
26
|
+
}, function (props) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return props.variant === 'yellow'
|
|
29
|
+
? (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs
|
|
30
|
+
: (_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.sm;
|
|
31
|
+
});
|
|
32
|
+
var CartSummaryFooter = styled__default["default"].div(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n padding: ", "px;\n background: ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n padding: ", "px;\n background: ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), 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.palette) === null || _a === void 0 ? void 0 : _a.yellowLight; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
33
|
+
var ChargesContainer = styled__default["default"].div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
34
|
+
var CartLine = styled__default["default"].div(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n position: relative;\n text-decoration: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n position: relative;\n text-decoration: ", ";\n"])), function (props) { return props.cancelled && 'line-through'; });
|
|
35
|
+
var AmountWrapper = styled__default["default"].div(templateObject_7 || (templateObject_7 = _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.xs; });
|
|
36
|
+
var LabelWrapper = styled__default["default"].div(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n gap: ", "px;\n"], ["\n display: flex;\n align-items: flex-start;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
37
|
+
var ChargeTooltipInfo = styled__default["default"].div(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n flex: 1;\n line-height: normal;\n min-width: 0;\n overflow-wrap: break-word;\n white-space: pre-line;\n width: 100%;\n word-break: break-word;\n"], ["\n flex: 1;\n line-height: normal;\n min-width: 0;\n overflow-wrap: break-word;\n white-space: pre-line;\n width: 100%;\n word-break: break-word;\n"])));
|
|
38
|
+
var CartSummaryTitle = styled__default["default"].div(templateObject_10 || (templateObject_10 = _tslib.__makeTemplateObject(["\n padding: ", "px 0\n ", "px;\n margin: 0 ", "px;\n display: flex;\n gap: ", "px;\n border-bottom: 1px solid ", ";\n"], ["\n padding: ", "px 0\n ", "px;\n margin: 0 ", "px;\n display: flex;\n gap: ", "px;\n border-bottom: 1px solid ", ";\n"])), 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.spacings) === null || _a === void 0 ? void 0 : _a.sm; }, 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.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.light; });
|
|
39
|
+
var QuantitySpan = styled__default["default"].span(templateObject_11 || (templateObject_11 = _tslib.__makeTemplateObject(["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\n font-weight: ", ";\n"], ["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\n font-weight: ", ";\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.disabledDarkGray; }, 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.s1; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a, _b; return (_b = (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight) === null || _b === void 0 ? void 0 : _b.regular; });
|
|
40
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
23
41
|
|
|
24
42
|
exports.AmountWrapper = AmountWrapper;
|
|
25
43
|
exports.CartLine = CartLine;
|
|
26
44
|
exports.CartPaymentContainer = CartPaymentContainer;
|
|
27
45
|
exports.CartSummaryContainer = CartSummaryContainer;
|
|
28
46
|
exports.CartSummaryContent = CartSummaryContent;
|
|
47
|
+
exports.CartSummaryFooter = CartSummaryFooter;
|
|
29
48
|
exports.CartSummaryTitle = CartSummaryTitle;
|
|
30
49
|
exports.ChargeTooltipInfo = ChargeTooltipInfo;
|
|
31
50
|
exports.ChargesContainer = ChargesContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartSummary.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CartSummary.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,7 +5,7 @@ import { formatPrice } from '@citygross/utils';
|
|
|
5
5
|
import { theme as theme_1 } from '../../../../design-tokens/build/index.js';
|
|
6
6
|
import { ToolTipButton } from '../CgButton/ToolTipButton/ToolTipButton.js';
|
|
7
7
|
import { ToolTipDialog } from '../ToolTipDialog/ToolTipDialog.js';
|
|
8
|
-
import { CartSummaryContainer, CartPaymentContainer, CartSummaryTitle, CartSummaryContent,
|
|
8
|
+
import { CartLine, CartSummaryContainer, CartPaymentContainer, CartSummaryTitle, CartSummaryContent, QuantitySpan, AmountWrapper, ChargesContainer, CartSummaryFooter, LabelWrapper, ChargeTooltipInfo } from './CartSummary.styles.js';
|
|
9
9
|
|
|
10
10
|
var calculateSummaryLine = function (items) {
|
|
11
11
|
var sumOfItems = items === null || items === void 0 ? void 0 : items.reduce(function (prev, curr) {
|
|
@@ -26,7 +26,7 @@ var calculateSummaryLine = function (items) {
|
|
|
26
26
|
};
|
|
27
27
|
function CartSummary(_a) {
|
|
28
28
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
29
|
-
var _q = _a.saveLabel, saveLabel = _q === void 0 ? 'Varav rabatt' : _q, _r = _a.totalLabel, totalLabel = _r === void 0 ? 'Totalt' : _r, _s = _a.itemsLabel, itemsLabel = _s === void 0 ? 'Varor' : _s, cartSummary = __rest(_a, ["saveLabel", "totalLabel", "itemsLabel"]);
|
|
29
|
+
var _q = _a.saveLabel, saveLabel = _q === void 0 ? 'Varav rabatt' : _q, _r = _a.totalLabel, totalLabel = _r === void 0 ? 'Totalt' : _r, _s = _a.itemsLabel, itemsLabel = _s === void 0 ? 'Varor' : _s, _t = _a.ariaLabel, ariaLabel = _t === void 0 ? 'Ordersammanfattning' : _t, _u = _a.taxLabel, taxLabel = _u === void 0 ? 'Varav moms' : _u, _v = _a.variant, variant = _v === void 0 ? 'default' : _v, cartSummary = __rest(_a, ["saveLabel", "totalLabel", "itemsLabel", "ariaLabel", "taxLabel", "variant"]);
|
|
30
30
|
var charges = (_b = cartSummary.charges) !== null && _b !== void 0 ? _b : [];
|
|
31
31
|
var pickingFeeFromLabel = cartSummary.pickingFeeFromLabel;
|
|
32
32
|
var bags = (_c = cartSummary.bags) !== null && _c !== void 0 ? _c : [];
|
|
@@ -77,38 +77,50 @@ function CartSummary(_a) {
|
|
|
77
77
|
React.createElement(ChargeTooltipInfo, null,
|
|
78
78
|
React.createElement(BodyText, { color: (_e = theme_1.palette) === null || _e === void 0 ? void 0 : _e.white, size: TextTypes.TextSize.SMALL }, charge.info))))));
|
|
79
79
|
};
|
|
80
|
+
var isYellowVariant = variant === 'yellow';
|
|
81
|
+
var discountLine = cartSummary.totalDiscount > 0 ? (React.createElement(CartLine, null,
|
|
82
|
+
React.createElement(BodyText, { size: isYellowVariant ? undefined : TextTypes.TextSize.SMALL }, saveLabel),
|
|
83
|
+
React.createElement(BodyText, { color: (_h = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _h === void 0 ? void 0 : _h.alertRed, size: isYellowVariant ? undefined : TextTypes.TextSize.SMALL }, formatPrice(cartSummary.totalDiscount)))) : null;
|
|
84
|
+
var totalLine = (React.createElement(CartLine, null,
|
|
85
|
+
React.createElement(BodyText, { fontWeight: "semiBold" }, totalLabel),
|
|
86
|
+
React.createElement(BodyText, { fontWeight: "semiBold" }, formatPrice(cartSummary.totalAmount))));
|
|
87
|
+
var taxLine = cartSummary.totalTaxAmount !== undefined ? (React.createElement(CartLine, null,
|
|
88
|
+
React.createElement(BodyText, null, taxLabel),
|
|
89
|
+
React.createElement(BodyText, null, formatPrice(cartSummary.totalTaxAmount)))) : null;
|
|
80
90
|
return (React.createElement(CartSummaryContainer, { role: "region" },
|
|
81
|
-
React.createElement(CartPaymentContainer,
|
|
91
|
+
React.createElement(CartPaymentContainer, { variant: variant },
|
|
82
92
|
cartSummary.title && (React.createElement(CartSummaryTitle, null,
|
|
83
93
|
React.createElement(BodyText, { fontWeight: "semiBold" }, cartSummary.title),
|
|
84
94
|
React.createElement(BodyText, null, cartSummary.subtitle))),
|
|
85
|
-
React.createElement(
|
|
86
|
-
(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
((_m =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
React.createElement(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
React.createElement("div", { role: "group", "aria-label": ariaLabel },
|
|
96
|
+
React.createElement(CartSummaryContent, { title: cartSummary.title, variant: variant },
|
|
97
|
+
((groceries === null || groceries === void 0 ? void 0 : groceries.length) > 0 || (cateredMeals === null || cateredMeals === void 0 ? void 0 : cateredMeals.length) > 0) && (React.createElement(CartLine, null,
|
|
98
|
+
React.createElement(BodyText, { fontWeight: "medium" },
|
|
99
|
+
itemsLabel,
|
|
100
|
+
React.createElement(QuantitySpan, null, " (".concat(((_j = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.quantity) !== null && _j !== void 0 ? _j : 0) + ((_k = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.quantity) !== null && _k !== void 0 ? _k : 0), ")"))),
|
|
101
|
+
React.createElement(AmountWrapper, null,
|
|
102
|
+
(sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) > 0 && (React.createElement(BodyText, { lineThrough: true, color: (_l = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _l === void 0 ? void 0 : _l.dark }, formatPrice(((_m = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) !== null && _m !== void 0 ? _m : 0) +
|
|
103
|
+
((_o = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.cancelledAmount) !== null && _o !== void 0 ? _o : 0)))),
|
|
104
|
+
React.createElement(BodyText, null, formatPrice(sumOfGroceries.amount + sumOfCateredMeals.amount))))),
|
|
105
|
+
bags.length > 0 && (React.createElement(CartLine, null,
|
|
106
|
+
React.createElement(BodyText, null,
|
|
107
|
+
"Matkassar",
|
|
108
|
+
React.createElement(QuantitySpan, null,
|
|
109
|
+
"(",
|
|
110
|
+
sumOfBags.quantity,
|
|
111
|
+
")")),
|
|
112
|
+
React.createElement(AmountWrapper, null,
|
|
113
|
+
sumOfBags.cancelledAmount > 0 && (React.createElement(BodyText, { lineThrough: true, color: (_p = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _p === void 0 ? void 0 : _p.dark }, formatPrice(sumOfBags.cancelledAmount))),
|
|
114
|
+
React.createElement(BodyText, { fontWeight: "semiBold" }, formatPrice(sumOfBags.amount))))),
|
|
115
|
+
(charges === null || charges === void 0 ? void 0 : charges.length) > 0 && (React.createElement(ChargesContainer, null, charges === null || charges === void 0 ? void 0 : charges.map(function (charge) { return (React.createElement(ChargeLine, { key: charge.name, charge: charge })); }))),
|
|
116
|
+
isYellowVariant && discountLine,
|
|
117
|
+
!isYellowVariant && (React.createElement(ChargesContainer, null,
|
|
118
|
+
totalLine,
|
|
119
|
+
discountLine,
|
|
120
|
+
taxLine))),
|
|
121
|
+
isYellowVariant && (React.createElement(CartSummaryFooter, null,
|
|
122
|
+
totalLine,
|
|
123
|
+
taxLine))))));
|
|
112
124
|
}
|
|
113
125
|
|
|
114
126
|
export { CartSummary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,16 +2,34 @@ import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
var CartSummaryContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:focus {\n outline-offset: ", "px;\n }\n &:focus:not(:focus-visible) {\n outline: none;\n }\n"], ["\n &:focus {\n outline-offset: ", "px;\n }\n &:focus:not(:focus-visible) {\n outline: none;\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; });
|
|
5
|
-
var CartPaymentContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"], ["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"])), function (props) {
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
var CartPaymentContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"], ["\n background: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n"])), function (props) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
return props.variant === 'yellow'
|
|
8
|
+
? (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.yellowLighter
|
|
9
|
+
: (_b = props.theme.palette) === null || _b === void 0 ? void 0 : _b.white;
|
|
10
|
+
});
|
|
11
|
+
var CartSummaryContent = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), function (props) {
|
|
12
|
+
var _a, _b, _c, _d;
|
|
13
|
+
return props.variant === 'yellow'
|
|
14
|
+
? "padding: ".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.md, "px;\n padding-top: ").concat(props.title
|
|
15
|
+
? (_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.sm
|
|
16
|
+
: (_c = props.theme.spacings) === null || _c === void 0 ? void 0 : _c.md, "px")
|
|
17
|
+
: props.title && "padding-top: ".concat((_d = props.theme.spacings) === null || _d === void 0 ? void 0 : _d.sm, "px");
|
|
18
|
+
}, function (props) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return props.variant === 'yellow'
|
|
21
|
+
? (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs
|
|
22
|
+
: (_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.sm;
|
|
23
|
+
});
|
|
24
|
+
var CartSummaryFooter = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: ", "px;\n background: ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n padding: ", "px;\n background: ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), 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.palette) === null || _a === void 0 ? void 0 : _a.yellowLight; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
25
|
+
var ChargesContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
26
|
+
var CartLine = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n position: relative;\n text-decoration: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n position: relative;\n text-decoration: ", ";\n"])), function (props) { return props.cancelled && 'line-through'; });
|
|
27
|
+
var AmountWrapper = styled.div(templateObject_7 || (templateObject_7 = __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.xs; });
|
|
28
|
+
var LabelWrapper = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n gap: ", "px;\n"], ["\n display: flex;\n align-items: flex-start;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
|
|
29
|
+
var ChargeTooltipInfo = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n flex: 1;\n line-height: normal;\n min-width: 0;\n overflow-wrap: break-word;\n white-space: pre-line;\n width: 100%;\n word-break: break-word;\n"], ["\n flex: 1;\n line-height: normal;\n min-width: 0;\n overflow-wrap: break-word;\n white-space: pre-line;\n width: 100%;\n word-break: break-word;\n"])));
|
|
30
|
+
var CartSummaryTitle = styled.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n padding: ", "px 0\n ", "px;\n margin: 0 ", "px;\n display: flex;\n gap: ", "px;\n border-bottom: 1px solid ", ";\n"], ["\n padding: ", "px 0\n ", "px;\n margin: 0 ", "px;\n display: flex;\n gap: ", "px;\n border-bottom: 1px solid ", ";\n"])), 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.spacings) === null || _a === void 0 ? void 0 : _a.sm; }, 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.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.light; });
|
|
31
|
+
var QuantitySpan = styled.span(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\n font-weight: ", ";\n"], ["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\n font-weight: ", ";\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.disabledDarkGray; }, 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.s1; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a, _b; return (_b = (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight) === null || _b === void 0 ? void 0 : _b.regular; });
|
|
32
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
15
33
|
|
|
16
|
-
export { AmountWrapper, CartLine, CartPaymentContainer, CartSummaryContainer, CartSummaryContent, CartSummaryTitle, ChargeTooltipInfo, ChargesContainer, LabelWrapper, QuantitySpan };
|
|
34
|
+
export { AmountWrapper, CartLine, CartPaymentContainer, CartSummaryContainer, CartSummaryContent, CartSummaryFooter, CartSummaryTitle, ChargeTooltipInfo, ChargesContainer, LabelWrapper, QuantitySpan };
|
|
17
35
|
//# sourceMappingURL=CartSummary.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartSummary.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CartSummary.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
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": "f4cda44b6d5a413b6ea5e6f8fa5cdd34a7bd5273"
|
|
80
80
|
}
|