@citygross/components 0.16.17 → 0.16.18

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.
@@ -20,11 +20,13 @@ export declare type TCartSummary = {
20
20
  totalDiscount: number;
21
21
  totalLabel?: string;
22
22
  totalTaxAmount: number;
23
+ pickingFeeFromLabel?: string;
23
24
  };
24
25
  export declare type TSummaryItem = {
25
26
  amount: number;
26
27
  cancelledAmount: number;
27
28
  cancelledQuantity: number;
29
+ color?: string;
28
30
  info?: React.ReactNode;
29
31
  name?: string;
30
32
  quantity: number;
@@ -7,10 +7,10 @@ declare type TSummaryHeader = {
7
7
  export declare const CartSummaryContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
8
8
  export declare const CartPaymentContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
9
9
  export declare const CartSummaryContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TSummaryHeader, never>;
10
+ export declare const ChargesContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
11
  export declare const CartLine: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TCartLine, never>;
11
12
  export declare const AmountWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
13
  export declare const LabelWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
13
14
  export declare const CartSummaryTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
15
  export declare const QuantitySpan: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
15
- export declare const TotalLine: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TCartLine, never>;
16
16
  export {};
@@ -36,6 +36,7 @@ function CartSummary(_a) {
36
36
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
37
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"]);
38
38
  var charges = (_b = cartSummary.charges) !== null && _b !== void 0 ? _b : [];
39
+ var pickingFeeFromLabel = cartSummary.pickingFeeFromLabel;
39
40
  var bags = (_c = cartSummary.bags) !== null && _c !== void 0 ? _c : [];
40
41
  var groceries = (_d = cartSummary.groceries) !== null && _d !== void 0 ? _d : [];
41
42
  var cateredMeals = (_e = cartSummary === null || cartSummary === void 0 ? void 0 : cartSummary.cateredMeals) !== null && _e !== void 0 ? _e : [];
@@ -54,25 +55,33 @@ function CartSummary(_a) {
54
55
  summaryParts.push("".concat(charges.length, " avgifter"));
55
56
  }
56
57
  var ChargeLine = function (_a) {
57
- var _b, _c;
58
+ var _b, _c, _d;
58
59
  var charge = _a.charge;
59
- var _d = React.useState(false), infoOpen = _d[0], setInfoOpen = _d[1];
60
+ var _e = React.useState(false), infoOpen = _e[0], setInfoOpen = _e[1];
60
61
  var tooltipId = "tooltip-".concat((_b = charge.name) === null || _b === void 0 ? void 0 : _b.toLowerCase().replace(/ /g, '-'));
61
62
  var toggleInfoOpen = function () {
62
63
  setInfoOpen(!infoOpen);
63
64
  };
64
- var chargeName = charge.name
65
+ var baseChargeName = charge.name
65
66
  ? charge.name.charAt(0).toUpperCase() + charge.name.slice(1).toLowerCase()
66
67
  : '';
68
+ var isPickingFee = ((_c = charge.name) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'plockavgift';
69
+ var fromLabel = isPickingFee && pickingFeeFromLabel
70
+ ? pickingFeeFromLabel.trim()
71
+ : undefined;
72
+ var chargeColor = charge.color;
67
73
  return (React__default["default"].createElement(CartSummary_styles.CartLine, { key: charge.name, role: "listitem" },
68
74
  React__default["default"].createElement(CartSummary_styles.LabelWrapper, null,
69
- React__default["default"].createElement(typography.BodyText, null, chargeName),
75
+ React__default["default"].createElement(typography.BodyText, null, baseChargeName),
70
76
  charge.info && (React__default["default"].createElement(React.Fragment, null,
71
- React__default["default"].createElement(ToolTipButton.ToolTipButton, { "aria-expanded": infoOpen, "aria-label": charge.tooltipAriaLabel || "Mer information om ".concat(chargeName), "aria-describedby": infoOpen ? tooltipId : undefined, onClick: toggleInfoOpen }),
77
+ React__default["default"].createElement(ToolTipButton.ToolTipButton, { "aria-expanded": infoOpen, "aria-label": charge.tooltipAriaLabel ||
78
+ "Mer information om ".concat(baseChargeName), "aria-describedby": infoOpen ? tooltipId : undefined, onClick: toggleInfoOpen }),
72
79
  infoOpen && (React__default["default"].createElement(ToolTipDialog.ToolTipDialog, { id: tooltipId, toggle: toggleInfoOpen }, charge.info))))),
73
80
  React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
74
- charge.cancelledAmount > 0 && (React__default["default"].createElement(typography.BodyText, { lineThrough: true, color: (_c = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _c === void 0 ? void 0 : _c.dark }, utils.formatPrice(charge.cancelledAmount))),
75
- React__default["default"].createElement(typography.BodyText, null, utils.formatPrice(charge.amount)))));
81
+ charge.cancelledAmount > 0 && (React__default["default"].createElement(typography.BodyText, { lineThrough: true, color: chargeColor !== null && chargeColor !== void 0 ? chargeColor : (_d = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _d === void 0 ? void 0 : _d.dark }, utils.formatPrice(charge.cancelledAmount))),
82
+ React__default["default"].createElement(typography.BodyText, { color: chargeColor }, fromLabel
83
+ ? "".concat(fromLabel, " ").concat(utils.formatPrice(charge.amount))
84
+ : utils.formatPrice(charge.amount)))));
76
85
  };
77
86
  return (React__default["default"].createElement(CartSummary_styles.CartSummaryContainer, { role: "region" },
78
87
  React__default["default"].createElement(CartSummary_styles.CartPaymentContainer, null,
@@ -81,7 +90,7 @@ function CartSummary(_a) {
81
90
  React__default["default"].createElement(typography.BodyText, null, cartSummary.subtitle))),
82
91
  React__default["default"].createElement(CartSummary_styles.CartSummaryContent, { title: cartSummary.title, role: "list", "aria-label": "Order summary" },
83
92
  ((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, { role: "listitem" },
84
- React__default["default"].createElement(typography.BodyText, null,
93
+ React__default["default"].createElement(typography.BodyText, { fontWeight: "medium" },
85
94
  itemsLabel,
86
95
  React__default["default"].createElement(CartSummary_styles.QuantitySpan, null, " (".concat(((_h = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.quantity) !== null && _h !== void 0 ? _h : 0) + ((_j = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.quantity) !== null && _j !== void 0 ? _j : 0), ")"))),
87
96
  React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
@@ -97,14 +106,16 @@ function CartSummary(_a) {
97
106
  ")")),
98
107
  React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
99
108
  sumOfBags.cancelledAmount > 0 && (React__default["default"].createElement(typography.BodyText, { lineThrough: true, color: (_o = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _o === void 0 ? void 0 : _o.dark }, utils.formatPrice(sumOfBags.cancelledAmount))),
100
- React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, utils.formatPrice(sumOfBags.amount))))), charges === null || charges === void 0 ? void 0 :
101
- charges.map(function (charge) { return (React__default["default"].createElement(ChargeLine, { key: charge.name, charge: charge })); }),
102
- React__default["default"].createElement(CartSummary_styles.TotalLine, { role: "listitem" },
103
- React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, totalLabel),
104
- React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, utils.formatPrice(cartSummary.totalAmount))),
105
- cartSummary.totalDiscount > 0 && (React__default["default"].createElement(CartSummary_styles.CartLine, { role: "listitem" },
106
- React__default["default"].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL }, saveLabel),
107
- React__default["default"].createElement(typography.BodyText, { color: (_p = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _p === void 0 ? void 0 : _p.alertRed, size: typography.TextTypes.TextSize.SMALL }, utils.formatPrice(cartSummary.totalDiscount))))))));
109
+ React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, utils.formatPrice(sumOfBags.amount))))),
110
+ (charges === null || charges === void 0 ? void 0 : charges.length) > 0 &&
111
+ 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 })); })),
112
+ React__default["default"].createElement(CartSummary_styles.ChargesContainer, null,
113
+ React__default["default"].createElement(CartSummary_styles.CartLine, { role: "listitem" },
114
+ React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, totalLabel),
115
+ React__default["default"].createElement(typography.BodyText, { fontWeight: "semiBold" }, utils.formatPrice(cartSummary.totalAmount))),
116
+ cartSummary.totalDiscount > 0 && (React__default["default"].createElement(CartSummary_styles.CartLine, { role: "listitem" },
117
+ React__default["default"].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL }, saveLabel),
118
+ React__default["default"].createElement(typography.BodyText, { color: (_p = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _p === void 0 ? void 0 : _p.alertRed, size: typography.TextTypes.TextSize.SMALL }, utils.formatPrice(cartSummary.totalDiscount)))))))));
108
119
  }
109
120
 
110
121
  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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -11,13 +11,13 @@ 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
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) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; });
14
- 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) { var _a; return props.title && "padding-top: ".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm, "px"); }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
15
- var CartLine = styled__default["default"].div(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"])), function (props) { return props.cancelled && 'line-through'; });
16
- var AmountWrapper = styled__default["default"].div(templateObject_5 || (templateObject_5 = _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; });
17
- var LabelWrapper = styled__default["default"].div(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
18
- var CartSummaryTitle = styled__default["default"].div(templateObject_7 || (templateObject_7 = _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; });
19
- var QuantitySpan = styled__default["default"].span(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\n color: ", ";\n font-size: ", "px;\n"], ["\n color: ", ";\n font-size: ", "px;\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; });
20
- var TotalLine = styled__default["default"](CartLine)(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n margin-top: ", "px;\n"], ["\n margin-top: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.md; });
14
+ 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) { var _a; return props.title && "padding-top: ".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm, "px"); }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm; });
15
+ var ChargesContainer = styled__default["default"].div(templateObject_4 || (templateObject_4 = _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; });
16
+ var CartLine = styled__default["default"].div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"])), function (props) { return props.cancelled && 'line-through'; });
17
+ var AmountWrapper = styled__default["default"].div(templateObject_6 || (templateObject_6 = _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; });
18
+ var LabelWrapper = styled__default["default"].div(templateObject_7 || (templateObject_7 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
19
+ var CartSummaryTitle = styled__default["default"].div(templateObject_8 || (templateObject_8 = _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; });
20
+ var QuantitySpan = styled__default["default"].span(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\n"], ["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\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; });
21
21
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
22
22
 
23
23
  exports.AmountWrapper = AmountWrapper;
@@ -26,7 +26,7 @@ exports.CartPaymentContainer = CartPaymentContainer;
26
26
  exports.CartSummaryContainer = CartSummaryContainer;
27
27
  exports.CartSummaryContent = CartSummaryContent;
28
28
  exports.CartSummaryTitle = CartSummaryTitle;
29
+ exports.ChargesContainer = ChargesContainer;
29
30
  exports.LabelWrapper = LabelWrapper;
30
31
  exports.QuantitySpan = QuantitySpan;
31
- exports.TotalLine = TotalLine;
32
32
  //# sourceMappingURL=CartSummary.styles.js.map
@@ -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, CartLine, QuantitySpan, AmountWrapper, TotalLine, LabelWrapper } from './CartSummary.styles.js';
8
+ import { CartSummaryContainer, CartPaymentContainer, CartSummaryTitle, CartSummaryContent, CartLine, QuantitySpan, AmountWrapper, ChargesContainer, LabelWrapper } 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) {
@@ -28,6 +28,7 @@ function CartSummary(_a) {
28
28
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
29
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"]);
30
30
  var charges = (_b = cartSummary.charges) !== null && _b !== void 0 ? _b : [];
31
+ var pickingFeeFromLabel = cartSummary.pickingFeeFromLabel;
31
32
  var bags = (_c = cartSummary.bags) !== null && _c !== void 0 ? _c : [];
32
33
  var groceries = (_d = cartSummary.groceries) !== null && _d !== void 0 ? _d : [];
33
34
  var cateredMeals = (_e = cartSummary === null || cartSummary === void 0 ? void 0 : cartSummary.cateredMeals) !== null && _e !== void 0 ? _e : [];
@@ -46,25 +47,33 @@ function CartSummary(_a) {
46
47
  summaryParts.push("".concat(charges.length, " avgifter"));
47
48
  }
48
49
  var ChargeLine = function (_a) {
49
- var _b, _c;
50
+ var _b, _c, _d;
50
51
  var charge = _a.charge;
51
- var _d = useState(false), infoOpen = _d[0], setInfoOpen = _d[1];
52
+ var _e = useState(false), infoOpen = _e[0], setInfoOpen = _e[1];
52
53
  var tooltipId = "tooltip-".concat((_b = charge.name) === null || _b === void 0 ? void 0 : _b.toLowerCase().replace(/ /g, '-'));
53
54
  var toggleInfoOpen = function () {
54
55
  setInfoOpen(!infoOpen);
55
56
  };
56
- var chargeName = charge.name
57
+ var baseChargeName = charge.name
57
58
  ? charge.name.charAt(0).toUpperCase() + charge.name.slice(1).toLowerCase()
58
59
  : '';
60
+ var isPickingFee = ((_c = charge.name) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'plockavgift';
61
+ var fromLabel = isPickingFee && pickingFeeFromLabel
62
+ ? pickingFeeFromLabel.trim()
63
+ : undefined;
64
+ var chargeColor = charge.color;
59
65
  return (React.createElement(CartLine, { key: charge.name, role: "listitem" },
60
66
  React.createElement(LabelWrapper, null,
61
- React.createElement(BodyText, null, chargeName),
67
+ React.createElement(BodyText, null, baseChargeName),
62
68
  charge.info && (React.createElement(Fragment, null,
63
- React.createElement(ToolTipButton, { "aria-expanded": infoOpen, "aria-label": charge.tooltipAriaLabel || "Mer information om ".concat(chargeName), "aria-describedby": infoOpen ? tooltipId : undefined, onClick: toggleInfoOpen }),
69
+ React.createElement(ToolTipButton, { "aria-expanded": infoOpen, "aria-label": charge.tooltipAriaLabel ||
70
+ "Mer information om ".concat(baseChargeName), "aria-describedby": infoOpen ? tooltipId : undefined, onClick: toggleInfoOpen }),
64
71
  infoOpen && (React.createElement(ToolTipDialog, { id: tooltipId, toggle: toggleInfoOpen }, charge.info))))),
65
72
  React.createElement(AmountWrapper, null,
66
- charge.cancelledAmount > 0 && (React.createElement(BodyText, { lineThrough: true, color: (_c = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _c === void 0 ? void 0 : _c.dark }, formatPrice(charge.cancelledAmount))),
67
- React.createElement(BodyText, null, formatPrice(charge.amount)))));
73
+ charge.cancelledAmount > 0 && (React.createElement(BodyText, { lineThrough: true, color: chargeColor !== null && chargeColor !== void 0 ? chargeColor : (_d = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _d === void 0 ? void 0 : _d.dark }, formatPrice(charge.cancelledAmount))),
74
+ React.createElement(BodyText, { color: chargeColor }, fromLabel
75
+ ? "".concat(fromLabel, " ").concat(formatPrice(charge.amount))
76
+ : formatPrice(charge.amount)))));
68
77
  };
69
78
  return (React.createElement(CartSummaryContainer, { role: "region" },
70
79
  React.createElement(CartPaymentContainer, null,
@@ -73,7 +82,7 @@ function CartSummary(_a) {
73
82
  React.createElement(BodyText, null, cartSummary.subtitle))),
74
83
  React.createElement(CartSummaryContent, { title: cartSummary.title, role: "list", "aria-label": "Order summary" },
75
84
  ((groceries === null || groceries === void 0 ? void 0 : groceries.length) > 0 || (cateredMeals === null || cateredMeals === void 0 ? void 0 : cateredMeals.length) > 0) && (React.createElement(CartLine, { role: "listitem" },
76
- React.createElement(BodyText, null,
85
+ React.createElement(BodyText, { fontWeight: "medium" },
77
86
  itemsLabel,
78
87
  React.createElement(QuantitySpan, null, " (".concat(((_h = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.quantity) !== null && _h !== void 0 ? _h : 0) + ((_j = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.quantity) !== null && _j !== void 0 ? _j : 0), ")"))),
79
88
  React.createElement(AmountWrapper, null,
@@ -89,14 +98,16 @@ function CartSummary(_a) {
89
98
  ")")),
90
99
  React.createElement(AmountWrapper, null,
91
100
  sumOfBags.cancelledAmount > 0 && (React.createElement(BodyText, { lineThrough: true, color: (_o = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _o === void 0 ? void 0 : _o.dark }, formatPrice(sumOfBags.cancelledAmount))),
92
- React.createElement(BodyText, { fontWeight: "semiBold" }, formatPrice(sumOfBags.amount))))), charges === null || charges === void 0 ? void 0 :
93
- charges.map(function (charge) { return (React.createElement(ChargeLine, { key: charge.name, charge: charge })); }),
94
- React.createElement(TotalLine, { role: "listitem" },
95
- React.createElement(BodyText, { fontWeight: "semiBold" }, totalLabel),
96
- React.createElement(BodyText, { fontWeight: "semiBold" }, formatPrice(cartSummary.totalAmount))),
97
- cartSummary.totalDiscount > 0 && (React.createElement(CartLine, { role: "listitem" },
98
- React.createElement(BodyText, { size: TextTypes.TextSize.SMALL }, saveLabel),
99
- React.createElement(BodyText, { color: (_p = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _p === void 0 ? void 0 : _p.alertRed, size: TextTypes.TextSize.SMALL }, formatPrice(cartSummary.totalDiscount))))))));
101
+ React.createElement(BodyText, { fontWeight: "semiBold" }, formatPrice(sumOfBags.amount))))),
102
+ (charges === null || charges === void 0 ? void 0 : charges.length) > 0 &&
103
+ React.createElement(ChargesContainer, null, charges === null || charges === void 0 ? void 0 : charges.map(function (charge) { return (React.createElement(ChargeLine, { key: charge.name, charge: charge })); })),
104
+ React.createElement(ChargesContainer, null,
105
+ React.createElement(CartLine, { role: "listitem" },
106
+ React.createElement(BodyText, { fontWeight: "semiBold" }, totalLabel),
107
+ React.createElement(BodyText, { fontWeight: "semiBold" }, formatPrice(cartSummary.totalAmount))),
108
+ cartSummary.totalDiscount > 0 && (React.createElement(CartLine, { role: "listitem" },
109
+ React.createElement(BodyText, { size: TextTypes.TextSize.SMALL }, saveLabel),
110
+ React.createElement(BodyText, { color: (_p = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _p === void 0 ? void 0 : _p.alertRed, size: TextTypes.TextSize.SMALL }, formatPrice(cartSummary.totalDiscount)))))))));
100
111
  }
101
112
 
102
113
  export { CartSummary };
@@ -1 +1 @@
1
- {"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,14 +3,14 @@ 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
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) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; });
6
- 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) { var _a; return props.title && "padding-top: ".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm, "px"); }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
7
- var CartLine = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"])), function (props) { return props.cancelled && 'line-through'; });
8
- var AmountWrapper = styled.div(templateObject_5 || (templateObject_5 = __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; });
9
- var LabelWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
10
- var CartSummaryTitle = styled.div(templateObject_7 || (templateObject_7 = __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; });
11
- var QuantitySpan = styled.span(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n color: ", ";\n font-size: ", "px;\n"], ["\n color: ", ";\n font-size: ", "px;\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; });
12
- var TotalLine = styled(CartLine)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-top: ", "px;\n"], ["\n margin-top: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.md; });
6
+ 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) { var _a; return props.title && "padding-top: ".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm, "px"); }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm; });
7
+ var ChargesContainer = styled.div(templateObject_4 || (templateObject_4 = __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; });
8
+ var CartLine = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"], ["\n display: flex;\n justify-content: space-between;\n text-decoration: ", ";\n"])), function (props) { return props.cancelled && 'line-through'; });
9
+ var AmountWrapper = styled.div(templateObject_6 || (templateObject_6 = __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; });
10
+ var LabelWrapper = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n gap: ", "px;\n position: relative;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
11
+ var CartSummaryTitle = styled.div(templateObject_8 || (templateObject_8 = __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; });
12
+ var QuantitySpan = styled.span(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\n"], ["\n color: ", ";\n font-size: ", "px;\n display: inline-block;\n margin-left: ", "px;\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; });
13
13
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
14
14
 
15
- export { AmountWrapper, CartLine, CartPaymentContainer, CartSummaryContainer, CartSummaryContent, CartSummaryTitle, LabelWrapper, QuantitySpan, TotalLine };
15
+ export { AmountWrapper, CartLine, CartPaymentContainer, CartSummaryContainer, CartSummaryContent, CartSummaryTitle, ChargesContainer, LabelWrapper, QuantitySpan };
16
16
  //# sourceMappingURL=CartSummary.styles.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components",
3
- "version": "0.16.17",
3
+ "version": "0.16.18",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./build/cjs/components/src/index.js",
@@ -74,5 +74,5 @@
74
74
  "react-slick": "^0.30.1",
75
75
  "slick-carousel": "^1.8.1"
76
76
  },
77
- "gitHead": "b36794efe45edffea9fdae84f2dd63c739c56191"
77
+ "gitHead": "2f6089643fd967ddea961d93024d5e085f9549b5"
78
78
  }