@citygross/components 0.8.99 → 0.8.101

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.
Files changed (25) hide show
  1. package/build/@types/components/Chips/Chip.styles.d.ts +4 -3
  2. package/build/@types/components/RadioBox/RadioBoxList.styles.d.ts +4 -3
  3. package/build/@types/components/RadioListItem/RadioListItem.styles.d.ts +4 -3
  4. package/build/@types/index.d.ts +1 -0
  5. package/build/cjs/components/src/components/AddressBlock/AddressBlock.js +2 -1
  6. package/build/cjs/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
  7. package/build/cjs/components/src/components/CartSummary/CartSummary.js +96 -0
  8. package/build/cjs/components/src/components/CartSummary/CartSummary.js.map +1 -0
  9. package/build/cjs/components/src/components/CartSummary/CartSummary.styles.js +28 -0
  10. package/build/cjs/components/src/components/CartSummary/CartSummary.styles.js.map +1 -0
  11. package/build/cjs/components/src/components/WarningLabel/WarningLabel.js +2 -1
  12. package/build/cjs/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
  13. package/build/cjs/components/src/index.js +2 -0
  14. package/build/cjs/components/src/index.js.map +1 -1
  15. package/build/es/components/src/components/AddressBlock/AddressBlock.js +2 -1
  16. package/build/es/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
  17. package/build/es/components/src/components/CartSummary/CartSummary.js +88 -0
  18. package/build/es/components/src/components/CartSummary/CartSummary.js.map +1 -0
  19. package/build/es/components/src/components/CartSummary/CartSummary.styles.js +14 -0
  20. package/build/es/components/src/components/CartSummary/CartSummary.styles.js.map +1 -0
  21. package/build/es/components/src/components/WarningLabel/WarningLabel.js +2 -1
  22. package/build/es/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
  23. package/build/es/components/src/index.js +1 -0
  24. package/build/es/components/src/index.js.map +1 -1
  25. package/package.json +3 -3
@@ -9,11 +9,12 @@ export declare type TChip = {
9
9
  };
10
10
  export declare const BaseChip: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TChip, never>;
11
11
  export declare const ChipCheckbox: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
12
- export declare const ChipLabel: import("styled-components").StyledComponent<({ size, color, children, lineThrough, fontWeight, textAlign, ...props }: {
12
+ export declare const ChipLabel: import("styled-components").StyledComponent<({ children, color, fontWeight, id, lineThrough, size, textAlign, ...props }: {
13
13
  children: import("react").ReactNode;
14
- size?: import("@citygross/typography/build/types/textTypes").TextSize | undefined;
15
14
  color?: string | undefined;
16
- lineThrough?: boolean | undefined;
17
15
  fontWeight?: "regular" | "medium" | "semiBold" | "bold" | undefined;
16
+ id?: string | undefined;
17
+ lineThrough?: boolean | undefined;
18
+ size?: import("@citygross/typography/build/types/textTypes").TextSize | undefined;
18
19
  textAlign?: "center" | "left" | "right" | undefined;
19
20
  }) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
@@ -3,11 +3,12 @@ import { TBaseRadioBox } from './RadioBoxItem.styles';
3
3
  export declare const BaseRadioBoxList: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TBaseRadioBox, never>;
4
4
  export declare const RadioBoxListChildContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TBaseRadioBox, never>;
5
5
  export declare const DividerPadding: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
- export declare const RadioBoxListParagraph: import("styled-components").StyledComponent<({ size, color, children, lineThrough, fontWeight, textAlign, ...props }: {
6
+ export declare const RadioBoxListParagraph: import("styled-components").StyledComponent<({ children, color, fontWeight, id, lineThrough, size, textAlign, ...props }: {
7
7
  children: import("react").ReactNode;
8
- size?: import("@citygross/typography/build/types/textTypes").TextSize | undefined;
9
8
  color?: string | undefined;
10
- lineThrough?: boolean | undefined;
11
9
  fontWeight?: "regular" | "medium" | "semiBold" | "bold" | undefined;
10
+ id?: string | undefined;
11
+ lineThrough?: boolean | undefined;
12
+ size?: import("@citygross/typography/build/types/textTypes").TextSize | undefined;
12
13
  textAlign?: "center" | "left" | "right" | undefined;
13
14
  }) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
@@ -20,12 +20,13 @@ export declare const StyledH3: import("styled-components").StyledComponent<({ ch
20
20
  as: string;
21
21
  } & TBaseRadioItemInputWrapper, "as">;
22
22
  export declare const RadioRightWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
23
- export declare const DisableText: import("styled-components").StyledComponent<({ size, color, children, lineThrough, fontWeight, textAlign, ...props }: {
23
+ export declare const DisableText: import("styled-components").StyledComponent<({ children, color, fontWeight, id, lineThrough, size, textAlign, ...props }: {
24
24
  children: import("react").ReactNode;
25
- size?: import("@citygross/typography/build/types/textTypes").TextSize | undefined;
26
25
  color?: string | undefined;
27
- lineThrough?: boolean | undefined;
28
26
  fontWeight?: "bold" | "regular" | "medium" | "semiBold" | undefined;
27
+ id?: string | undefined;
28
+ lineThrough?: boolean | undefined;
29
+ size?: import("@citygross/typography/build/types/textTypes").TextSize | undefined;
29
30
  textAlign?: "left" | "center" | "right" | undefined;
30
31
  }) => JSX.Element, import("styled-components").DefaultTheme, TWrapMobile, never>;
31
32
  export declare const RadioFlex: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TWrapMobile, never>;
@@ -10,6 +10,7 @@ export * from './components/CartCard/CartCard';
10
10
  export * from './components/CartCardLabel/CartCardLabel';
11
11
  export * from './components/CartItemSummary/CartItemSummary';
12
12
  export * from './components/CartSubTotal/CartSubTotal';
13
+ export * from './components/CartSummary/CartSummary';
13
14
  export * from './components/CgButton/CgButton';
14
15
  export * from './components/Chips/Chip';
15
16
  export * from './components/Collapsable/Collapsable';
@@ -24,6 +24,8 @@ require('@citygross/utils');
24
24
  require('react-loading-skeleton');
25
25
  require('../CartItemSummary/CartItemSummary.styles.js');
26
26
  require('../CartSubTotal/CartSubTotal.js');
27
+ require('../Divider/Divider.styles.js');
28
+ require('../CartSummary/CartSummary.styles.js');
27
29
  require('../Chips/Chip.styles.js');
28
30
  require('../Spinner/Spinner.styles.js');
29
31
  require('../Collapsable/Collapsable.styles.js');
@@ -32,7 +34,6 @@ require('../CustomerInfoBlock/CustomerInfoBlock.styles.js');
32
34
  require('../DateBox/DateBox.styles.js');
33
35
  require('../DeliverySlotItem/DeliverySlotItem.styles.js');
34
36
  require('../DeliveryTimeBlock/DeliveryTimeBlock.styles.js');
35
- require('../Divider/Divider.styles.js');
36
37
  require('../DotIndicator/DotIndicator.styles.js');
37
38
  require('../Dropdown/Dropdown.styles.js');
38
39
  require('../Form/Form.styles.js');
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,96 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('../../../../_virtual/_tslib.js');
6
+ var utils = require('@citygross/utils');
7
+ var React = require('react');
8
+ var Divider = require('../Divider/Divider.js');
9
+ var CartSummary_styles = require('./CartSummary.styles.js');
10
+ var typography = require('@citygross/typography');
11
+ var index = require('../../../../design-tokens/build/index.js');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
+
17
+ var calculateSummaryLine = function (items) {
18
+ var sumOfItems = items === null || items === void 0 ? void 0 : items.reduce(function (prev, curr) {
19
+ var _a, _b, _c;
20
+ return {
21
+ cancelledQuantity: prev.cancelledQuantity + ((_a = curr === null || curr === void 0 ? void 0 : curr.cancelledQuantity) !== null && _a !== void 0 ? _a : 0),
22
+ quantity: prev.quantity + curr.quantity,
23
+ amount: prev.amount + ((_b = curr === null || curr === void 0 ? void 0 : curr.amount) !== null && _b !== void 0 ? _b : 0),
24
+ cancelledAmount: prev.cancelledAmount + ((_c = curr === null || curr === void 0 ? void 0 : curr.cancelledAmount) !== null && _c !== void 0 ? _c : 0)
25
+ };
26
+ }, {
27
+ cancelledQuantity: 0,
28
+ quantity: 0,
29
+ amount: 0,
30
+ cancelledAmount: 0
31
+ });
32
+ return sumOfItems;
33
+ };
34
+ function CartSummary(_a) {
35
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
36
+ var _s = _a.saveLabel, saveLabel = _s === void 0 ? 'rabatter' : _s, _t = _a.shippingLabel, shippingLabel = _t === void 0 ? 'frakt' : _t, _u = _a.totalLabel, totalLabel = _u === void 0 ? 'totalt' : _u, _v = _a.taxLabel, taxLabel = _v === void 0 ? 'varav moms' : _v, cartSummary = _tslib.__rest(_a, ["saveLabel", "shippingLabel", "totalLabel", "taxLabel"]);
37
+ var charges = (_b = cartSummary.charges) !== null && _b !== void 0 ? _b : [];
38
+ var bags = (_c = cartSummary.bags) !== null && _c !== void 0 ? _c : [];
39
+ var groceries = (_d = cartSummary.groceries) !== null && _d !== void 0 ? _d : [];
40
+ var cateredMeals = (_e = cartSummary === null || cartSummary === void 0 ? void 0 : cartSummary.cateredMeals) !== null && _e !== void 0 ? _e : [];
41
+ var sumOfBags = calculateSummaryLine(bags);
42
+ var sumOfGroceries = calculateSummaryLine(groceries);
43
+ var sumOfCateredMeals = calculateSummaryLine(cateredMeals);
44
+ return (React__default["default"].createElement(CartSummary_styles.CartSummaryContainer, null,
45
+ React__default["default"].createElement(CartSummary_styles.CartPaymentContainer, null,
46
+ cartSummary.title && (React__default["default"].createElement(CartSummary_styles.CartSummaryTitle, null,
47
+ React__default["default"].createElement(typography.H3, null, cartSummary.title),
48
+ React__default["default"].createElement(typography.BodyText, null, cartSummary.subTitle))),
49
+ React__default["default"].createElement(CartSummary_styles.CartSummaryHeader, { title: cartSummary.title },
50
+ ((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,
51
+ React__default["default"].createElement(typography.BodyText, null,
52
+ "varor",
53
+ ' ',
54
+ ((_f = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.quantity) !== null && _f !== void 0 ? _f : 0) +
55
+ ((_g = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.quantity) !== null && _g !== void 0 ? _g : 0),
56
+ ' ',
57
+ "st"),
58
+ React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
59
+ (sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) > 0 && (React__default["default"].createElement(typography.BodyText, { lineThrough: true, color: (_h = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _h === void 0 ? void 0 : _h.dark }, utils.formatPrice(((_j = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) !== null && _j !== void 0 ? _j : 0) +
60
+ ((_k = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.cancelledAmount) !== null && _k !== void 0 ? _k : 0)))),
61
+ React__default["default"].createElement(typography.H3, { fontWeight: 'semiBold' }, utils.formatPrice(sumOfGroceries.amount + sumOfCateredMeals.amount))))),
62
+ bags.length > 0 && (React__default["default"].createElement(CartSummary_styles.CartLine, null,
63
+ React__default["default"].createElement(typography.BodyText, null,
64
+ "matkassar ",
65
+ sumOfBags.quantity,
66
+ " st"),
67
+ React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
68
+ sumOfBags.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(sumOfBags.cancelledAmount))),
69
+ React__default["default"].createElement(typography.H3, { fontWeight: 'semiBold' }, utils.formatPrice(sumOfBags.amount))))),
70
+ (charges === null || charges === void 0 ? void 0 : charges.length) > 0 && (React__default["default"].createElement(Divider.Divider, { xsSpacing: (_m = index.theme.spacings) === null || _m === void 0 ? void 0 : _m.xs, lgSpacing: (_o = index.theme.spacings) === null || _o === void 0 ? void 0 : _o.xs })), charges === null || charges === void 0 ? void 0 :
71
+ charges.map(function (charge) {
72
+ var _a, _b;
73
+ return (React__default["default"].createElement(CartSummary_styles.CartLine, { key: charge.name },
74
+ React__default["default"].createElement(typography.BodyText, null, (_a = charge === null || charge === void 0 ? void 0 : charge.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()),
75
+ React__default["default"].createElement(CartSummary_styles.AmountWrapper, null,
76
+ charge.cancelledAmount > 0 && (React__default["default"].createElement(typography.BodyText, { lineThrough: true, color: (_b = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _b === void 0 ? void 0 : _b.dark }, utils.formatPrice(charge.cancelledAmount))),
77
+ React__default["default"].createElement(typography.BodyText, null, utils.formatPrice(charge.amount)))));
78
+ }),
79
+ cartSummary.totalDiscount > 0 && (React__default["default"].createElement(CartSummary_styles.CartLine, null,
80
+ 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 }, saveLabel),
81
+ React__default["default"].createElement(typography.BodyText, { color: (_q = index.theme === null || index.theme === void 0 ? void 0 : index.theme.palette) === null || _q === void 0 ? void 0 : _q.alertRed }, utils.formatPrice(cartSummary.totalDiscount))))),
82
+ React__default["default"].createElement(CartSummary_styles.CartSummaryFooter, null,
83
+ ((_r = cartSummary.deliveryFee) === null || _r === void 0 ? void 0 : _r.amount) &&
84
+ cartSummary.deliveryFee.amount > 0 && (React__default["default"].createElement(CartSummary_styles.CartLine, null,
85
+ React__default["default"].createElement(typography.BodyText, null, shippingLabel),
86
+ React__default["default"].createElement(typography.BodyText, null, utils.formatPrice(cartSummary.deliveryFee.amount)))),
87
+ React__default["default"].createElement(CartSummary_styles.CartLine, null,
88
+ React__default["default"].createElement(typography.H3, { fontWeight: 'semiBold' }, totalLabel),
89
+ React__default["default"].createElement(typography.H3, { fontWeight: 'semiBold' }, utils.formatPrice(cartSummary.totalAmount))),
90
+ React__default["default"].createElement(CartSummary_styles.CartLine, null,
91
+ React__default["default"].createElement(typography.BodyText, null, taxLabel),
92
+ React__default["default"].createElement(typography.BodyText, null, utils.formatPrice(cartSummary.totalTaxAmount)))))));
93
+ }
94
+
95
+ exports.CartSummary = CartSummary;
96
+ //# sourceMappingURL=CartSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('../../../../_virtual/_tslib.js');
6
+ var styled = require('styled-components');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
+
12
+ var CartSummaryContainer = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject([""], [""])));
13
+ var CartPaymentContainer = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.yellowLighter; });
14
+ var CartSummaryHeader = styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n padding: ", "px;\n ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n padding: ", "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.md; }, 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.xs; });
15
+ 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; });
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 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 templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
20
+
21
+ exports.AmountWrapper = AmountWrapper;
22
+ exports.CartLine = CartLine;
23
+ exports.CartPaymentContainer = CartPaymentContainer;
24
+ exports.CartSummaryContainer = CartSummaryContainer;
25
+ exports.CartSummaryFooter = CartSummaryFooter;
26
+ exports.CartSummaryHeader = CartSummaryHeader;
27
+ exports.CartSummaryTitle = CartSummaryTitle;
28
+ //# sourceMappingURL=CartSummary.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartSummary.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -24,6 +24,8 @@ require('@citygross/utils');
24
24
  require('react-loading-skeleton');
25
25
  require('../CartItemSummary/CartItemSummary.styles.js');
26
26
  require('../CartSubTotal/CartSubTotal.js');
27
+ require('../Divider/Divider.styles.js');
28
+ require('../CartSummary/CartSummary.styles.js');
27
29
  require('../Chips/Chip.styles.js');
28
30
  require('../Spinner/Spinner.styles.js');
29
31
  require('../Collapsable/Collapsable.styles.js');
@@ -32,7 +34,6 @@ require('../CustomerInfoBlock/CustomerInfoBlock.styles.js');
32
34
  require('../DateBox/DateBox.styles.js');
33
35
  require('../DeliverySlotItem/DeliverySlotItem.styles.js');
34
36
  require('../DeliveryTimeBlock/DeliveryTimeBlock.styles.js');
35
- require('../Divider/Divider.styles.js');
36
37
  require('../DotIndicator/DotIndicator.styles.js');
37
38
  require('../Dropdown/Dropdown.styles.js');
38
39
  require('../Form/Form.styles.js');
@@ -1 +1 @@
1
- {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -17,6 +17,7 @@ var CartCard = require('./components/CartCard/CartCard.js');
17
17
  var CartCardLabel = require('./components/CartCardLabel/CartCardLabel.js');
18
18
  var CartItemSummary = require('./components/CartItemSummary/CartItemSummary.js');
19
19
  var CartSubTotal = require('./components/CartSubTotal/CartSubTotal.js');
20
+ var CartSummary = require('./components/CartSummary/CartSummary.js');
20
21
  var CgButton = require('./components/CgButton/CgButton.js');
21
22
  var Chip = require('./components/Chips/Chip.js');
22
23
  var Collapsable = require('./components/Collapsable/Collapsable.js');
@@ -122,6 +123,7 @@ Object.defineProperty(exports, 'ECartSubTotalTypes', {
122
123
  enumerable: true,
123
124
  get: function () { return CartSubTotal.ECartSubTotalTypes; }
124
125
  });
126
+ exports.CartSummary = CartSummary.CartSummary;
125
127
  exports.CgButton = CgButton.CgButton;
126
128
  Object.defineProperty(exports, 'EButtonVariant', {
127
129
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -20,6 +20,8 @@ import '@citygross/utils';
20
20
  import 'react-loading-skeleton';
21
21
  import '../CartItemSummary/CartItemSummary.styles.js';
22
22
  import '../CartSubTotal/CartSubTotal.js';
23
+ import '../Divider/Divider.styles.js';
24
+ import '../CartSummary/CartSummary.styles.js';
23
25
  import '../Chips/Chip.styles.js';
24
26
  import '../Spinner/Spinner.styles.js';
25
27
  import '../Collapsable/Collapsable.styles.js';
@@ -28,7 +30,6 @@ import '../CustomerInfoBlock/CustomerInfoBlock.styles.js';
28
30
  import '../DateBox/DateBox.styles.js';
29
31
  import '../DeliverySlotItem/DeliverySlotItem.styles.js';
30
32
  import '../DeliveryTimeBlock/DeliveryTimeBlock.styles.js';
31
- import '../Divider/Divider.styles.js';
32
33
  import '../DotIndicator/DotIndicator.styles.js';
33
34
  import '../Dropdown/Dropdown.styles.js';
34
35
  import '../Form/Form.styles.js';
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,88 @@
1
+ import { __rest } from '../../../../_virtual/_tslib.js';
2
+ import { formatPrice } from '@citygross/utils';
3
+ import React from 'react';
4
+ import { Divider } from '../Divider/Divider.js';
5
+ import { CartSummaryContainer, CartPaymentContainer, CartSummaryTitle, CartSummaryHeader, CartLine, AmountWrapper, CartSummaryFooter } from './CartSummary.styles.js';
6
+ import { H3, BodyText } from '@citygross/typography';
7
+ import { theme as theme_1 } from '../../../../design-tokens/build/index.js';
8
+
9
+ var calculateSummaryLine = function (items) {
10
+ var sumOfItems = items === null || items === void 0 ? void 0 : items.reduce(function (prev, curr) {
11
+ var _a, _b, _c;
12
+ return {
13
+ cancelledQuantity: prev.cancelledQuantity + ((_a = curr === null || curr === void 0 ? void 0 : curr.cancelledQuantity) !== null && _a !== void 0 ? _a : 0),
14
+ quantity: prev.quantity + curr.quantity,
15
+ amount: prev.amount + ((_b = curr === null || curr === void 0 ? void 0 : curr.amount) !== null && _b !== void 0 ? _b : 0),
16
+ cancelledAmount: prev.cancelledAmount + ((_c = curr === null || curr === void 0 ? void 0 : curr.cancelledAmount) !== null && _c !== void 0 ? _c : 0)
17
+ };
18
+ }, {
19
+ cancelledQuantity: 0,
20
+ quantity: 0,
21
+ amount: 0,
22
+ cancelledAmount: 0
23
+ });
24
+ return sumOfItems;
25
+ };
26
+ function CartSummary(_a) {
27
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
28
+ var _s = _a.saveLabel, saveLabel = _s === void 0 ? 'rabatter' : _s, _t = _a.shippingLabel, shippingLabel = _t === void 0 ? 'frakt' : _t, _u = _a.totalLabel, totalLabel = _u === void 0 ? 'totalt' : _u, _v = _a.taxLabel, taxLabel = _v === void 0 ? 'varav moms' : _v, cartSummary = __rest(_a, ["saveLabel", "shippingLabel", "totalLabel", "taxLabel"]);
29
+ var charges = (_b = cartSummary.charges) !== null && _b !== void 0 ? _b : [];
30
+ var bags = (_c = cartSummary.bags) !== null && _c !== void 0 ? _c : [];
31
+ var groceries = (_d = cartSummary.groceries) !== null && _d !== void 0 ? _d : [];
32
+ var cateredMeals = (_e = cartSummary === null || cartSummary === void 0 ? void 0 : cartSummary.cateredMeals) !== null && _e !== void 0 ? _e : [];
33
+ var sumOfBags = calculateSummaryLine(bags);
34
+ var sumOfGroceries = calculateSummaryLine(groceries);
35
+ var sumOfCateredMeals = calculateSummaryLine(cateredMeals);
36
+ return (React.createElement(CartSummaryContainer, null,
37
+ React.createElement(CartPaymentContainer, null,
38
+ cartSummary.title && (React.createElement(CartSummaryTitle, null,
39
+ React.createElement(H3, null, cartSummary.title),
40
+ React.createElement(BodyText, null, cartSummary.subTitle))),
41
+ React.createElement(CartSummaryHeader, { title: cartSummary.title },
42
+ ((groceries === null || groceries === void 0 ? void 0 : groceries.length) > 0 || (cateredMeals === null || cateredMeals === void 0 ? void 0 : cateredMeals.length) > 0) && (React.createElement(CartLine, null,
43
+ React.createElement(BodyText, null,
44
+ "varor",
45
+ ' ',
46
+ ((_f = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.quantity) !== null && _f !== void 0 ? _f : 0) +
47
+ ((_g = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.quantity) !== null && _g !== void 0 ? _g : 0),
48
+ ' ',
49
+ "st"),
50
+ React.createElement(AmountWrapper, null,
51
+ (sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) > 0 && (React.createElement(BodyText, { lineThrough: true, color: (_h = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _h === void 0 ? void 0 : _h.dark }, formatPrice(((_j = sumOfGroceries === null || sumOfGroceries === void 0 ? void 0 : sumOfGroceries.cancelledAmount) !== null && _j !== void 0 ? _j : 0) +
52
+ ((_k = sumOfCateredMeals === null || sumOfCateredMeals === void 0 ? void 0 : sumOfCateredMeals.cancelledAmount) !== null && _k !== void 0 ? _k : 0)))),
53
+ React.createElement(H3, { fontWeight: 'semiBold' }, formatPrice(sumOfGroceries.amount + sumOfCateredMeals.amount))))),
54
+ bags.length > 0 && (React.createElement(CartLine, null,
55
+ React.createElement(BodyText, null,
56
+ "matkassar ",
57
+ sumOfBags.quantity,
58
+ " st"),
59
+ React.createElement(AmountWrapper, null,
60
+ sumOfBags.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(sumOfBags.cancelledAmount))),
61
+ React.createElement(H3, { fontWeight: 'semiBold' }, formatPrice(sumOfBags.amount))))),
62
+ (charges === null || charges === void 0 ? void 0 : charges.length) > 0 && (React.createElement(Divider, { xsSpacing: (_m = theme_1.spacings) === null || _m === void 0 ? void 0 : _m.xs, lgSpacing: (_o = theme_1.spacings) === null || _o === void 0 ? void 0 : _o.xs })), charges === null || charges === void 0 ? void 0 :
63
+ charges.map(function (charge) {
64
+ var _a, _b;
65
+ return (React.createElement(CartLine, { key: charge.name },
66
+ React.createElement(BodyText, null, (_a = charge === null || charge === void 0 ? void 0 : charge.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()),
67
+ React.createElement(AmountWrapper, null,
68
+ charge.cancelledAmount > 0 && (React.createElement(BodyText, { lineThrough: true, color: (_b = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _b === void 0 ? void 0 : _b.dark }, formatPrice(charge.cancelledAmount))),
69
+ React.createElement(BodyText, null, formatPrice(charge.amount)))));
70
+ }),
71
+ cartSummary.totalDiscount > 0 && (React.createElement(CartLine, null,
72
+ 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 }, saveLabel),
73
+ React.createElement(BodyText, { color: (_q = theme_1 === null || theme_1 === void 0 ? void 0 : theme_1.palette) === null || _q === void 0 ? void 0 : _q.alertRed }, formatPrice(cartSummary.totalDiscount))))),
74
+ React.createElement(CartSummaryFooter, null,
75
+ ((_r = cartSummary.deliveryFee) === null || _r === void 0 ? void 0 : _r.amount) &&
76
+ cartSummary.deliveryFee.amount > 0 && (React.createElement(CartLine, null,
77
+ React.createElement(BodyText, null, shippingLabel),
78
+ React.createElement(BodyText, null, formatPrice(cartSummary.deliveryFee.amount)))),
79
+ React.createElement(CartLine, null,
80
+ React.createElement(H3, { fontWeight: 'semiBold' }, totalLabel),
81
+ React.createElement(H3, { fontWeight: 'semiBold' }, formatPrice(cartSummary.totalAmount))),
82
+ React.createElement(CartLine, null,
83
+ React.createElement(BodyText, null, taxLabel),
84
+ React.createElement(BodyText, null, formatPrice(cartSummary.totalTaxAmount)))))));
85
+ }
86
+
87
+ export { CartSummary };
88
+ //# sourceMappingURL=CartSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartSummary.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,14 @@
1
+ import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
2
+ import styled from 'styled-components';
3
+
4
+ var CartSummaryContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
5
+ var CartPaymentContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) { var _a; return (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.yellowLighter; });
6
+ var CartSummaryHeader = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", "px;\n ", ";\n display: flex;\n flex-direction: column;\n gap: ", "px;\n"], ["\n padding: ", "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.md; }, 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.xs; });
7
+ 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; });
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 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 templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
12
+
13
+ export { AmountWrapper, CartLine, CartPaymentContainer, CartSummaryContainer, CartSummaryFooter, CartSummaryHeader, CartSummaryTitle };
14
+ //# sourceMappingURL=CartSummary.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartSummary.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
@@ -20,6 +20,8 @@ import '@citygross/utils';
20
20
  import 'react-loading-skeleton';
21
21
  import '../CartItemSummary/CartItemSummary.styles.js';
22
22
  import '../CartSubTotal/CartSubTotal.js';
23
+ import '../Divider/Divider.styles.js';
24
+ import '../CartSummary/CartSummary.styles.js';
23
25
  import '../Chips/Chip.styles.js';
24
26
  import '../Spinner/Spinner.styles.js';
25
27
  import '../Collapsable/Collapsable.styles.js';
@@ -28,7 +30,6 @@ import '../CustomerInfoBlock/CustomerInfoBlock.styles.js';
28
30
  import '../DateBox/DateBox.styles.js';
29
31
  import '../DeliverySlotItem/DeliverySlotItem.styles.js';
30
32
  import '../DeliveryTimeBlock/DeliveryTimeBlock.styles.js';
31
- import '../Divider/Divider.styles.js';
32
33
  import '../DotIndicator/DotIndicator.styles.js';
33
34
  import '../Dropdown/Dropdown.styles.js';
34
35
  import '../Form/Form.styles.js';
@@ -1 +1 @@
1
- {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -13,6 +13,7 @@ export { CartCard } from './components/CartCard/CartCard.js';
13
13
  export { CartCardLabel } from './components/CartCardLabel/CartCardLabel.js';
14
14
  export { CartItemSummary } from './components/CartItemSummary/CartItemSummary.js';
15
15
  export { CartSubTotal, ECartSubTotalTypes } from './components/CartSubTotal/CartSubTotal.js';
16
+ export { CartSummary } from './components/CartSummary/CartSummary.js';
16
17
  export { CgButton, EButtonVariant, ECgButtonSize } from './components/CgButton/CgButton.js';
17
18
  export { Chip } from './components/Chips/Chip.js';
18
19
  export { Collapsable } from './components/Collapsable/Collapsable.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components",
3
- "version": "0.8.99",
3
+ "version": "0.8.101",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./build/cjs/components/src/index.js",
@@ -68,7 +68,7 @@
68
68
  "@citygross/design-tokens": "^0.2.70",
69
69
  "@citygross/icons": "^0.1.13",
70
70
  "@citygross/react-use-bg-wizard": "^0.0.8",
71
- "@citygross/typography": "^0.0.101",
71
+ "@citygross/typography": "^0.0.102",
72
72
  "@citygross/utils": "^0.0.42",
73
73
  "framer-motion": "^4.1.17",
74
74
  "moment": "^2.29.1",
@@ -76,5 +76,5 @@
76
76
  "react-slick": "^0.30.1",
77
77
  "slick-carousel": "^1.8.1"
78
78
  },
79
- "gitHead": "46e590444fb182878e6825d107b609690b3a2e7c"
79
+ "gitHead": "1c7f2095fea2d227c04d39e3cf2e5098417eca1f"
80
80
  }