@citygross/components 0.8.35 → 0.8.37

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 (24) hide show
  1. package/build/@types/components/PriceTag/PriceTag.d.ts +4 -0
  2. package/build/@types/components/PriceTag/PriceTag.styles.d.ts +5 -5
  3. package/build/@types/index.d.ts +1 -0
  4. package/build/cjs/components/src/components/AddressBlock/AddressBlock.js +1 -0
  5. package/build/cjs/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
  6. package/build/cjs/components/src/components/PriceTag/PriceTag.js +76 -0
  7. package/build/cjs/components/src/components/PriceTag/PriceTag.js.map +1 -0
  8. package/build/cjs/components/src/components/PriceTag/PriceTag.styles.js +42 -0
  9. package/build/cjs/components/src/components/PriceTag/PriceTag.styles.js.map +1 -0
  10. package/build/cjs/components/src/components/WarningLabel/WarningLabel.js +1 -0
  11. package/build/cjs/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
  12. package/build/cjs/components/src/index.js +6 -0
  13. package/build/cjs/components/src/index.js.map +1 -1
  14. package/build/es/components/src/components/AddressBlock/AddressBlock.js +1 -0
  15. package/build/es/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
  16. package/build/es/components/src/components/PriceTag/PriceTag.js +68 -0
  17. package/build/es/components/src/components/PriceTag/PriceTag.js.map +1 -0
  18. package/build/es/components/src/components/PriceTag/PriceTag.styles.js +21 -0
  19. package/build/es/components/src/components/PriceTag/PriceTag.styles.js.map +1 -0
  20. package/build/es/components/src/components/WarningLabel/WarningLabel.js +1 -0
  21. package/build/es/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
  22. package/build/es/components/src/index.js +1 -0
  23. package/build/es/components/src/index.js.map +1 -1
  24. package/package.json +3 -3
@@ -11,4 +11,8 @@ export declare type TPriceTag = {
11
11
  priceVariant?: EPriceVariant;
12
12
  unit: string;
13
13
  };
14
+ export declare type TSplash = {
15
+ backgroundColor?: string;
16
+ fontColor?: string;
17
+ };
14
18
  export declare const PriceTag: React.FunctionComponent<TPriceTag>;
@@ -1,8 +1,8 @@
1
- import { TPriceTag } from './PriceTag';
1
+ import { TPriceTag, TSplash } from './PriceTag';
2
2
  declare type TPant = Pick<TPriceTag, 'pant'>;
3
- declare type TPriceVariant = Pick<TPriceTag, 'priceVariant'>;
4
- export declare const PriceTagComponent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPriceVariant, never>;
5
- export declare const PriceTagWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPant & TPriceVariant, never>;
3
+ export declare const PriceTagWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TSplash, never>;
4
+ export declare const PriceSplashContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const PriceTagContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
6
  export declare const PriceTagContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
7
  export declare const MultiPriceContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPant, never>;
8
8
  export declare const PriceTag: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -13,5 +13,5 @@ export declare const PriceUnit: import("styled-components").StyledComponent<"spa
13
13
  export declare const PriceIndicatorContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
14
  export declare const PriceIndicator: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, TPant, never>;
15
15
  export declare const Pant: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
16
- export declare const PriceVariantBadge: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPriceVariant, never>;
16
+ export declare const PriceVariantBadge: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TSplash, never>;
17
17
  export {};
@@ -80,3 +80,4 @@ export * from './components/CouponCode/CouponCode';
80
80
  export * from './components/CgButton/CgButton';
81
81
  export * from './components/CartCardLabel/CartCardLabel';
82
82
  export * from './components/CartCard/CartCard';
83
+ export * from './components/PriceTag/PriceTag';
@@ -95,6 +95,7 @@ require('../CartSubTotal/CartSubTotal.js');
95
95
  require('../CouponCode/CouponCode.js');
96
96
  require('../CartCardLabel/CartCardLabel.styles.js');
97
97
  require('../CartCard/CartCard.styles.js');
98
+ require('../PriceTag/PriceTag.js');
98
99
 
99
100
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
100
101
 
@@ -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,76 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var PriceTag_styles = require('./PriceTag.styles.js');
7
+ var icons = require('@citygross/icons');
8
+ var designTokens = require('@citygross/design-tokens');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
+
14
+ exports.EPriceVariant = void 0;
15
+ (function (EPriceVariant) {
16
+ EPriceVariant["KLIPP"] = "klipp";
17
+ EPriceVariant["PRIO"] = "prio";
18
+ EPriceVariant["REGULAR_OFFER"] = "regular-offer";
19
+ })(exports.EPriceVariant || (exports.EPriceVariant = {}));
20
+ var getSplash = function (priceVariant) {
21
+ var _a, _b, _c, _d, _e, _f, _g;
22
+ switch (priceVariant) {
23
+ case exports.EPriceVariant.KLIPP:
24
+ return {
25
+ backgroundColor: (_a = designTokens.theme.palette) === null || _a === void 0 ? void 0 : _a.alertRed,
26
+ fontColor: (_b = designTokens.theme.palette) === null || _b === void 0 ? void 0 : _b.white
27
+ };
28
+ case exports.EPriceVariant.PRIO:
29
+ return {
30
+ backgroundColor: (_c = designTokens.theme.palette) === null || _c === void 0 ? void 0 : _c.brandPrio,
31
+ fontColor: (_d = designTokens.theme.palette) === null || _d === void 0 ? void 0 : _d.white
32
+ };
33
+ case exports.EPriceVariant.REGULAR_OFFER:
34
+ return {
35
+ backgroundColor: (_e = designTokens.theme.palette) === null || _e === void 0 ? void 0 : _e.brandYellow,
36
+ fontColor: (_f = designTokens.theme.palette) === null || _f === void 0 ? void 0 : _f.alertRed
37
+ };
38
+ default:
39
+ return {
40
+ fontColor: (_g = designTokens.theme.palette) === null || _g === void 0 ? void 0 : _g.darkest
41
+ };
42
+ }
43
+ };
44
+ var PriceTag = function (_a) {
45
+ var _b = _a.multiPrice, multiPrice = _b === void 0 ? 0 : _b, _c = _a.pant, pant = _c === void 0 ? false : _c, price = _a.price, priceVariant = _a.priceVariant, unit = _a.unit;
46
+ var splash = getSplash(priceVariant);
47
+ var priceBase = Math.floor(price);
48
+ var priceDecimals = (price % 1).toFixed(2).split('.')[1];
49
+ var isMultiPrice = multiPrice > 1;
50
+ var showPriceIndicator = isMultiPrice || (priceDecimals === '00' && unit === 'st');
51
+ var multiPriceStr = multiPrice + ' för';
52
+ var priceIndicator = ':-';
53
+ var pantStr = '+pant';
54
+ var priceVariantBadgeStr = priceVariant === exports.EPriceVariant.KLIPP
55
+ ? 'Klipp!'
56
+ : priceVariant === exports.EPriceVariant.PRIO
57
+ ? 'PRIO'
58
+ : null;
59
+ return (React__default["default"].createElement(PriceTag_styles.PriceTagWrapper, { fontColor: splash.fontColor },
60
+ splash.backgroundColor && (React__default["default"].createElement(PriceTag_styles.PriceSplashContainer, null,
61
+ React__default["default"].createElement(icons.Icons.PriceSplash, { backgroundColor: splash.backgroundColor }))),
62
+ React__default["default"].createElement(PriceTag_styles.PriceTagContainer, null,
63
+ React__default["default"].createElement(PriceTag_styles.PriceTagContent, null,
64
+ isMultiPrice && (React__default["default"].createElement(PriceTag_styles.MultiPriceContainer, { pant: pant }, multiPriceStr)),
65
+ React__default["default"].createElement(PriceTag_styles.PriceTag, null,
66
+ React__default["default"].createElement(PriceTag_styles.PriceBase, null, priceBase),
67
+ showPriceIndicator ? (React__default["default"].createElement(PriceTag_styles.PriceIndicatorContainer, null,
68
+ React__default["default"].createElement(PriceTag_styles.PriceIndicator, { pant: pant }, priceIndicator),
69
+ pant && React__default["default"].createElement(PriceTag_styles.Pant, null, pantStr))) : (React__default["default"].createElement(PriceTag_styles.PriceDetails, null,
70
+ React__default["default"].createElement(PriceTag_styles.PriceDecimals, null, priceDecimals),
71
+ React__default["default"].createElement(PriceTag_styles.PriceUnit, null, pant ? pantStr : "/".concat(unit))))))),
72
+ priceVariantBadgeStr && (React__default["default"].createElement(PriceTag_styles.PriceVariantBadge, { backgroundColor: splash.backgroundColor }, priceVariantBadgeStr))));
73
+ };
74
+
75
+ exports.PriceTag = PriceTag;
76
+ //# sourceMappingURL=PriceTag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PriceTag.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,42 @@
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 PriceTagWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n color: ", ";\n display: grid;\n font-family: ", ";\n height: fit-content;\n width: fit-content;\n position: relative;\n"], ["\n color: ", ";\n display: grid;\n font-family: ", ";\n height: fit-content;\n width: fit-content;\n position: relative;\n"])), function (props) { return props.fontColor; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.type.display; });
13
+ var PriceSplashContainer = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n grid-area: 1 / 1 / 1 / 1;\n position: absolute;\n bottom: 0;\n top: 0;\n right: 0;\n left: 0;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"], ["\n grid-area: 1 / 1 / 1 / 1;\n position: absolute;\n bottom: 0;\n top: 0;\n right: 0;\n left: 0;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"])));
14
+ var PriceTagContainer = styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n grid-area: 1 / 1 / 1 / 1;\n padding: 0 ", "px\n ", "px\n ", "px;\n position: relative;\n z-index: 1;\n"], ["\n grid-area: 1 / 1 / 1 / 1;\n padding: 0 ", "px\n ", "px\n ", "px;\n position: relative;\n z-index: 1;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs2; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
15
+ var PriceTagContent = styled__default["default"].div(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n padding: ", "px;\n"], ["\n display: flex;\n flex-direction: column;\n padding: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
16
+ var MultiPriceContainer = styled__default["default"].div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n margin-bottom: -", "px;\n margin-left: ", "px;\n padding-top: ", "px;\n transform: rotate(-", "deg);\n width: fit-content;\n"], ["\n font-size: ", "px;\n margin-bottom: -", "px;\n margin-left: ", "px;\n padding-top: ", "px;\n transform: rotate(-", "deg);\n width: fit-content;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm; }, function (props) { var _a, _b; return (props.pant ? (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs2 : (_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.xxs2); }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs2; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceRotate; });
17
+ var PriceTag = styled__default["default"].div(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", "px;\n"], ["\n display: flex;\n align-items: center;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; });
18
+ var PriceBase = styled__default["default"].span(templateObject_7 || (templateObject_7 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n line-height: 1;\n"], ["\n font-size: ", "px;\n line-height: 1;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.l1; });
19
+ var PriceDetails = styled__default["default"].div(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
20
+ var PriceDecimals = styled__default["default"].span(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n margin-top: ", "px;\n"], ["\n font-size: ", "px;\n margin-top: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s4; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; });
21
+ var PriceUnit = styled__default["default"].span(templateObject_10 || (templateObject_10 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n"], ["\n font-size: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s3; });
22
+ var PriceIndicatorContainer = styled__default["default"].div(templateObject_11 || (templateObject_11 = _tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
23
+ var PriceIndicator = styled__default["default"].span(templateObject_12 || (templateObject_12 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n margin-top: -", "px;\n transform: rotate(", "deg);\n"], ["\n font-size: ", "px;\n margin-top: -", "px;\n transform: rotate(", "deg);\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.l1; }, function (props) { return (props.pant ? 0 : function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs2; }); }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceIndicatorRotate; });
24
+ var Pant = styled__default["default"].span(templateObject_13 || (templateObject_13 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n margin-top: -", "px;\n"], ["\n font-size: ", "px;\n margin-top: -", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s3; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
25
+ var PriceVariantBadge = styled__default["default"].div(templateObject_14 || (templateObject_14 = _tslib.__makeTemplateObject(["\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n height: ", "px;\n width: ", "px;\n position: absolute;\n right: -", "px;\n top: -", "px;\n"], ["\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n height: ", "px;\n width: ", "px;\n position: absolute;\n right: -", "px;\n top: -", "px;\n"])), function (props) { return props.backgroundColor; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceVariantBadgeSize; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceVariantBadgeSize; }, 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.lg; });
26
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
27
+
28
+ exports.MultiPriceContainer = MultiPriceContainer;
29
+ exports.Pant = Pant;
30
+ exports.PriceBase = PriceBase;
31
+ exports.PriceDecimals = PriceDecimals;
32
+ exports.PriceDetails = PriceDetails;
33
+ exports.PriceIndicator = PriceIndicator;
34
+ exports.PriceIndicatorContainer = PriceIndicatorContainer;
35
+ exports.PriceSplashContainer = PriceSplashContainer;
36
+ exports.PriceTag = PriceTag;
37
+ exports.PriceTagContainer = PriceTagContainer;
38
+ exports.PriceTagContent = PriceTagContent;
39
+ exports.PriceTagWrapper = PriceTagWrapper;
40
+ exports.PriceUnit = PriceUnit;
41
+ exports.PriceVariantBadge = PriceVariantBadge;
42
+ //# sourceMappingURL=PriceTag.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PriceTag.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -95,6 +95,7 @@ require('../CartSubTotal/CartSubTotal.js');
95
95
  require('../CouponCode/CouponCode.js');
96
96
  require('../CartCardLabel/CartCardLabel.styles.js');
97
97
  require('../CartCard/CartCard.styles.js');
98
+ require('../PriceTag/PriceTag.js');
98
99
 
99
100
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
100
101
 
@@ -1 +1 @@
1
- {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -86,6 +86,7 @@ var CgButton = require('./components/CgButton/CgButton.js');
86
86
  var CouponCode = require('./components/CouponCode/CouponCode.js');
87
87
  var CartCardLabel = require('./components/CartCardLabel/CartCardLabel.js');
88
88
  var CartCard = require('./components/CartCard/CartCard.js');
89
+ var PriceTag = require('./components/PriceTag/PriceTag.js');
89
90
 
90
91
 
91
92
 
@@ -224,4 +225,9 @@ Object.defineProperty(exports, 'ECouponCodeStatus', {
224
225
  });
225
226
  exports.CartCardLabel = CartCardLabel.CartCardLabel;
226
227
  exports.CartCard = CartCard.CartCard;
228
+ Object.defineProperty(exports, 'EPriceVariant', {
229
+ enumerable: true,
230
+ get: function () { return PriceTag.EPriceVariant; }
231
+ });
232
+ exports.PriceTag = PriceTag.PriceTag;
227
233
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -91,6 +91,7 @@ import '../CartSubTotal/CartSubTotal.js';
91
91
  import '../CouponCode/CouponCode.js';
92
92
  import '../CartCardLabel/CartCardLabel.styles.js';
93
93
  import '../CartCard/CartCard.styles.js';
94
+ import '../PriceTag/PriceTag.js';
94
95
 
95
96
  function AddressBlock(_a) {
96
97
  var _b = _a.deliverOption, deliverOption = _b === void 0 ? 'Address' : _b, icon = _a.icon, storeName = _a.storeName, customerName = _a.customerName, street = _a.street, zipCode = _a.zipCode, city = _a.city, doorCode = _a.doorCode, floor = _a.floor, deliveryInstructions = _a.deliveryInstructions, xsSpacing = _a.xsSpacing, lgSpacing = _a.lgSpacing;
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { PriceTagWrapper, PriceSplashContainer, PriceTagContainer, PriceTagContent, MultiPriceContainer, PriceTag as PriceTag$1, PriceBase, PriceIndicatorContainer, PriceIndicator, Pant, PriceDetails, PriceDecimals, PriceUnit, PriceVariantBadge } from './PriceTag.styles.js';
3
+ import { Icons } from '@citygross/icons';
4
+ import { theme } from '@citygross/design-tokens';
5
+
6
+ var EPriceVariant;
7
+ (function (EPriceVariant) {
8
+ EPriceVariant["KLIPP"] = "klipp";
9
+ EPriceVariant["PRIO"] = "prio";
10
+ EPriceVariant["REGULAR_OFFER"] = "regular-offer";
11
+ })(EPriceVariant || (EPriceVariant = {}));
12
+ var getSplash = function (priceVariant) {
13
+ var _a, _b, _c, _d, _e, _f, _g;
14
+ switch (priceVariant) {
15
+ case EPriceVariant.KLIPP:
16
+ return {
17
+ backgroundColor: (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.alertRed,
18
+ fontColor: (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.white
19
+ };
20
+ case EPriceVariant.PRIO:
21
+ return {
22
+ backgroundColor: (_c = theme.palette) === null || _c === void 0 ? void 0 : _c.brandPrio,
23
+ fontColor: (_d = theme.palette) === null || _d === void 0 ? void 0 : _d.white
24
+ };
25
+ case EPriceVariant.REGULAR_OFFER:
26
+ return {
27
+ backgroundColor: (_e = theme.palette) === null || _e === void 0 ? void 0 : _e.brandYellow,
28
+ fontColor: (_f = theme.palette) === null || _f === void 0 ? void 0 : _f.alertRed
29
+ };
30
+ default:
31
+ return {
32
+ fontColor: (_g = theme.palette) === null || _g === void 0 ? void 0 : _g.darkest
33
+ };
34
+ }
35
+ };
36
+ var PriceTag = function (_a) {
37
+ var _b = _a.multiPrice, multiPrice = _b === void 0 ? 0 : _b, _c = _a.pant, pant = _c === void 0 ? false : _c, price = _a.price, priceVariant = _a.priceVariant, unit = _a.unit;
38
+ var splash = getSplash(priceVariant);
39
+ var priceBase = Math.floor(price);
40
+ var priceDecimals = (price % 1).toFixed(2).split('.')[1];
41
+ var isMultiPrice = multiPrice > 1;
42
+ var showPriceIndicator = isMultiPrice || (priceDecimals === '00' && unit === 'st');
43
+ var multiPriceStr = multiPrice + ' för';
44
+ var priceIndicator = ':-';
45
+ var pantStr = '+pant';
46
+ var priceVariantBadgeStr = priceVariant === EPriceVariant.KLIPP
47
+ ? 'Klipp!'
48
+ : priceVariant === EPriceVariant.PRIO
49
+ ? 'PRIO'
50
+ : null;
51
+ return (React.createElement(PriceTagWrapper, { fontColor: splash.fontColor },
52
+ splash.backgroundColor && (React.createElement(PriceSplashContainer, null,
53
+ React.createElement(Icons.PriceSplash, { backgroundColor: splash.backgroundColor }))),
54
+ React.createElement(PriceTagContainer, null,
55
+ React.createElement(PriceTagContent, null,
56
+ isMultiPrice && (React.createElement(MultiPriceContainer, { pant: pant }, multiPriceStr)),
57
+ React.createElement(PriceTag$1, null,
58
+ React.createElement(PriceBase, null, priceBase),
59
+ showPriceIndicator ? (React.createElement(PriceIndicatorContainer, null,
60
+ React.createElement(PriceIndicator, { pant: pant }, priceIndicator),
61
+ pant && React.createElement(Pant, null, pantStr))) : (React.createElement(PriceDetails, null,
62
+ React.createElement(PriceDecimals, null, priceDecimals),
63
+ React.createElement(PriceUnit, null, pant ? pantStr : "/".concat(unit))))))),
64
+ priceVariantBadgeStr && (React.createElement(PriceVariantBadge, { backgroundColor: splash.backgroundColor }, priceVariantBadgeStr))));
65
+ };
66
+
67
+ export { EPriceVariant, PriceTag };
68
+ //# sourceMappingURL=PriceTag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PriceTag.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
2
+ import styled from 'styled-components';
3
+
4
+ var PriceTagWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n display: grid;\n font-family: ", ";\n height: fit-content;\n width: fit-content;\n position: relative;\n"], ["\n color: ", ";\n display: grid;\n font-family: ", ";\n height: fit-content;\n width: fit-content;\n position: relative;\n"])), function (props) { return props.fontColor; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.type.display; });
5
+ var PriceSplashContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n grid-area: 1 / 1 / 1 / 1;\n position: absolute;\n bottom: 0;\n top: 0;\n right: 0;\n left: 0;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"], ["\n grid-area: 1 / 1 / 1 / 1;\n position: absolute;\n bottom: 0;\n top: 0;\n right: 0;\n left: 0;\n\n svg {\n width: 100%;\n height: 100%;\n }\n"])));
6
+ var PriceTagContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n grid-area: 1 / 1 / 1 / 1;\n padding: 0 ", "px\n ", "px\n ", "px;\n position: relative;\n z-index: 1;\n"], ["\n grid-area: 1 / 1 / 1 / 1;\n padding: 0 ", "px\n ", "px\n ", "px;\n position: relative;\n z-index: 1;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs2; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; });
7
+ var PriceTagContent = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n padding: ", "px;\n"], ["\n display: flex;\n flex-direction: column;\n padding: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
8
+ var MultiPriceContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size: ", "px;\n margin-bottom: -", "px;\n margin-left: ", "px;\n padding-top: ", "px;\n transform: rotate(-", "deg);\n width: fit-content;\n"], ["\n font-size: ", "px;\n margin-bottom: -", "px;\n margin-left: ", "px;\n padding-top: ", "px;\n transform: rotate(-", "deg);\n width: fit-content;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.sm; }, function (props) { var _a, _b; return (props.pant ? (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs2 : (_b = props.theme.spacings) === null || _b === void 0 ? void 0 : _b.xxs2); }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs2; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceRotate; });
9
+ var PriceTag = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: ", "px;\n"], ["\n display: flex;\n align-items: center;\n gap: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; });
10
+ var PriceBase = styled.span(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: ", "px;\n line-height: 1;\n"], ["\n font-size: ", "px;\n line-height: 1;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.l1; });
11
+ var PriceDetails = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
12
+ var PriceDecimals = styled.span(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n font-size: ", "px;\n margin-top: ", "px;\n"], ["\n font-size: ", "px;\n margin-top: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s4; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxxs; });
13
+ var PriceUnit = styled.span(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n font-size: ", "px;\n"], ["\n font-size: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s3; });
14
+ var PriceIndicatorContainer = styled.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
15
+ var PriceIndicator = styled.span(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-size: ", "px;\n margin-top: -", "px;\n transform: rotate(", "deg);\n"], ["\n font-size: ", "px;\n margin-top: -", "px;\n transform: rotate(", "deg);\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.l1; }, function (props) { return (props.pant ? 0 : function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs2; }); }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceIndicatorRotate; });
16
+ var Pant = styled.span(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n font-size: ", "px;\n margin-top: -", "px;\n"], ["\n font-size: ", "px;\n margin-top: -", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s3; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
17
+ var PriceVariantBadge = styled.div(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n height: ", "px;\n width: ", "px;\n position: absolute;\n right: -", "px;\n top: -", "px;\n"], ["\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n height: ", "px;\n width: ", "px;\n position: absolute;\n right: -", "px;\n top: -", "px;\n"])), function (props) { return props.backgroundColor; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceVariantBadgeSize; }, function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceVariantBadgeSize; }, 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.lg; });
18
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
19
+
20
+ export { MultiPriceContainer, Pant, PriceBase, PriceDecimals, PriceDetails, PriceIndicator, PriceIndicatorContainer, PriceSplashContainer, PriceTag, PriceTagContainer, PriceTagContent, PriceTagWrapper, PriceUnit, PriceVariantBadge };
21
+ //# sourceMappingURL=PriceTag.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PriceTag.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -91,6 +91,7 @@ import '../CartSubTotal/CartSubTotal.js';
91
91
  import '../CouponCode/CouponCode.js';
92
92
  import '../CartCardLabel/CartCardLabel.styles.js';
93
93
  import '../CartCard/CartCard.styles.js';
94
+ import '../PriceTag/PriceTag.js';
94
95
 
95
96
  function WarningLabel(_a) {
96
97
  var children = _a.children, background = _a.background, toolTip = _a.toolTip;
@@ -1 +1 @@
1
- {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -82,4 +82,5 @@ export { CgButton, EButtonVariant, ECgButtonSize } from './components/CgButton/C
82
82
  export { CouponCode, ECouponCodeStatus } from './components/CouponCode/CouponCode.js';
83
83
  export { CartCardLabel } from './components/CartCardLabel/CartCardLabel.js';
84
84
  export { CartCard } from './components/CartCard/CartCard.js';
85
+ export { EPriceVariant, PriceTag } from './components/PriceTag/PriceTag.js';
85
86
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components",
3
- "version": "0.8.35",
3
+ "version": "0.8.37",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./build/cjs/components/src/index.js",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@citygross/design-tokens": "^0.2.67",
69
- "@citygross/icons": "^0.1.10",
69
+ "@citygross/icons": "^0.1.11",
70
70
  "@citygross/react-use-bg-wizard": "^0.0.8",
71
71
  "@citygross/typography": "^0.0.89",
72
72
  "@citygross/utils": "^0.0.37",
@@ -76,5 +76,5 @@
76
76
  "react-slick": "^0.30.1",
77
77
  "slick-carousel": "^1.8.1"
78
78
  },
79
- "gitHead": "5f6071db73ddb76eacd44801b1a252c29dae7c62"
79
+ "gitHead": "623be645912e25bedfbb2538e3fe9a0072affc30"
80
80
  }