@citygross/components 0.8.56 → 0.8.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/components/ListItem/ListItem.d.ts +1 -1
- package/build/@types/components/PriceBanner/PriceBanner.d.ts +11 -0
- package/build/@types/components/PriceBanner/PriceBanner.styles.d.ts +3 -0
- package/build/@types/components/PriceTag/PriceTag.d.ts +1 -19
- package/build/@types/components/PriceTag/PriceTag.styles.d.ts +21 -15
- package/build/@types/components/PriceTag/PriceTag.types.d.ts +31 -0
- package/build/@types/components/SearchListItem/SearchListItem.d.ts +2 -1
- package/build/@types/helpers/price.d.ts +10 -0
- package/build/@types/index.d.ts +1 -0
- package/build/cjs/components/src/components/AddressBlock/AddressBlock.js +3 -1
- package/build/cjs/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
- package/build/cjs/components/src/components/ListItem/ListItem.js +12 -10
- package/build/cjs/components/src/components/ListItem/ListItem.js.map +1 -1
- package/build/cjs/components/src/components/PriceBanner/PriceBanner.js +25 -0
- package/build/cjs/components/src/components/PriceBanner/PriceBanner.js.map +1 -0
- package/build/cjs/components/src/components/PriceBanner/PriceBanner.styles.js +37 -0
- package/build/cjs/components/src/components/PriceBanner/PriceBanner.styles.js.map +1 -0
- package/build/cjs/components/src/components/PriceTag/PriceTag.js +20 -56
- package/build/cjs/components/src/components/PriceTag/PriceTag.js.map +1 -1
- package/build/cjs/components/src/components/PriceTag/PriceTag.styles.js +61 -23
- package/build/cjs/components/src/components/PriceTag/PriceTag.styles.js.map +1 -1
- package/build/cjs/components/src/components/PriceTag/PriceTag.types.js +18 -0
- package/build/cjs/components/src/components/PriceTag/PriceTag.types.js.map +1 -0
- package/build/cjs/components/src/components/SearchListItem/SearchListItem.js +2 -2
- package/build/cjs/components/src/components/WarningLabel/WarningLabel.js +3 -1
- package/build/cjs/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
- package/build/cjs/components/src/helpers/price.js +97 -0
- package/build/cjs/components/src/helpers/price.js.map +1 -0
- package/build/cjs/components/src/index.js +2 -4
- package/build/cjs/components/src/index.js.map +1 -1
- package/build/cjs/design-tokens/build/index.js +1 -1
- package/build/cjs/design-tokens/build/index.js.map +1 -1
- package/build/es/components/src/components/AddressBlock/AddressBlock.js +3 -1
- package/build/es/components/src/components/AddressBlock/AddressBlock.js.map +1 -1
- package/build/es/components/src/components/ListItem/ListItem.js +12 -10
- package/build/es/components/src/components/ListItem/ListItem.js.map +1 -1
- package/build/es/components/src/components/PriceBanner/PriceBanner.js +17 -0
- package/build/es/components/src/components/PriceBanner/PriceBanner.js.map +1 -0
- package/build/es/components/src/components/PriceBanner/PriceBanner.styles.js +29 -0
- package/build/es/components/src/components/PriceBanner/PriceBanner.styles.js.map +1 -0
- package/build/es/components/src/components/PriceTag/PriceTag.js +19 -55
- package/build/es/components/src/components/PriceTag/PriceTag.js.map +1 -1
- package/build/es/components/src/components/PriceTag/PriceTag.styles.js +61 -17
- package/build/es/components/src/components/PriceTag/PriceTag.styles.js.map +1 -1
- package/build/es/components/src/components/PriceTag/PriceTag.types.js +16 -0
- package/build/es/components/src/components/PriceTag/PriceTag.types.js.map +1 -0
- package/build/es/components/src/components/SearchListItem/SearchListItem.js +2 -2
- package/build/es/components/src/components/WarningLabel/WarningLabel.js +3 -1
- package/build/es/components/src/components/WarningLabel/WarningLabel.js.map +1 -1
- package/build/es/components/src/helpers/price.js +92 -0
- package/build/es/components/src/helpers/price.js.map +1 -0
- package/build/es/components/src/index.js +2 -1
- package/build/es/components/src/index.js.map +1 -1
- package/build/es/design-tokens/build/index.js +1 -1
- package/build/es/design-tokens/build/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -22,4 +22,4 @@ export declare type TListItem = {
|
|
|
22
22
|
alignment?: EListItemAlignment;
|
|
23
23
|
textColor?: string;
|
|
24
24
|
};
|
|
25
|
-
export declare
|
|
25
|
+
export declare const ListItem: ({ item, loading, isSmall, fallBackImage, imageAutoHeight, boldHeader, smallSkeleton, children, alignment, textColor, usedInSearch }: TListItem) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EPriceSize, EPriceVariant } from '../PriceTag/PriceTag.types';
|
|
3
|
+
export declare type TPriceBannerSizeAttributes = {
|
|
4
|
+
fontSize?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare type TPriceBanner = {
|
|
7
|
+
multiPrice?: number;
|
|
8
|
+
size?: EPriceSize;
|
|
9
|
+
variant?: EPriceVariant;
|
|
10
|
+
};
|
|
11
|
+
export declare const PriceBanner: React.FunctionComponent<TPriceBanner>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TPriceBannerSizeAttributes } from './PriceBanner';
|
|
2
|
+
import { TPriceVariantAttributes } from '../PriceTag/PriceTag.types';
|
|
3
|
+
export declare const PriceBanner: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPriceBannerSizeAttributes & Pick<TPriceVariantAttributes, "backgroundColor" | "fontColor">, never>;
|
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
KLIPP = "klipp",
|
|
4
|
-
PRIO = "prio",
|
|
5
|
-
REGULAR_OFFER = "regular-offer"
|
|
6
|
-
}
|
|
7
|
-
export declare type TPriceTag = {
|
|
8
|
-
multiPrice?: number;
|
|
9
|
-
pant?: boolean;
|
|
10
|
-
price: number;
|
|
11
|
-
priceVariant?: EPriceVariant;
|
|
12
|
-
unit: string;
|
|
13
|
-
isInSmallContainer?: boolean;
|
|
14
|
-
};
|
|
15
|
-
export declare type TSplash = {
|
|
16
|
-
backgroundColor?: string;
|
|
17
|
-
badgeStr?: string;
|
|
18
|
-
fontColor?: string;
|
|
19
|
-
isInSmallContainer?: boolean;
|
|
20
|
-
};
|
|
2
|
+
import { TPriceTag } from './PriceTag.types';
|
|
21
3
|
export declare const PriceTag: React.FunctionComponent<TPriceTag>;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { TPriceTag,
|
|
1
|
+
import { TPriceTag, TPriceVariantAttributes } from './PriceTag.types';
|
|
2
|
+
declare type TBackgroundColor = Pick<TPriceVariantAttributes, 'backgroundColor'>;
|
|
3
|
+
declare type TFontColor = Pick<TPriceVariantAttributes, 'fontColor'>;
|
|
4
|
+
declare type TFontSize = {
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
};
|
|
7
|
+
declare type TIsSmall = {
|
|
8
|
+
isSmall?: boolean;
|
|
9
|
+
};
|
|
2
10
|
declare type TPant = Pick<TPriceTag, 'pant'>;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const PriceTagContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
-
export declare const PriceTagContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
-
export declare const MultiPriceContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPant, never>;
|
|
11
|
+
export declare const PriceTagWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TFontColor, never>;
|
|
12
|
+
export declare const PriceBannerContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
13
|
+
export declare const PriceTagContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TBackgroundColor, never>;
|
|
9
14
|
export declare const PriceTag: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
-
export declare const PriceBase: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme,
|
|
11
|
-
export declare const PriceDetails: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const PriceIndicatorContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export declare const
|
|
15
|
+
export declare const PriceBase: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, TFontSize, never>;
|
|
16
|
+
export declare const PriceDetails: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
17
|
+
width?: number | undefined;
|
|
18
|
+
} & TPant, never>;
|
|
19
|
+
export declare const PriceIndicatorContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
20
|
+
showUnit: boolean;
|
|
21
|
+
} & TIsSmall, never>;
|
|
22
|
+
export declare const PriceDecimals: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, TFontSize & TIsSmall, never>;
|
|
23
|
+
export declare const PriceUnit: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, TFontSize & TIsSmall & TPant, never>;
|
|
18
24
|
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare enum EPriceSize {
|
|
2
|
+
LARGE = "large",
|
|
3
|
+
MEDIUM = "medium",
|
|
4
|
+
SMALL = "small"
|
|
5
|
+
}
|
|
6
|
+
export declare enum EPriceVariant {
|
|
7
|
+
CAMPAIGN = "Kampanj",
|
|
8
|
+
KLIPP = "Klipp!",
|
|
9
|
+
PRIO = "Prio-pris",
|
|
10
|
+
REGULAR = "Ordinarie"
|
|
11
|
+
}
|
|
12
|
+
export declare type TPriceTag = {
|
|
13
|
+
multiPrice?: number;
|
|
14
|
+
pant?: boolean;
|
|
15
|
+
price: number;
|
|
16
|
+
variant?: EPriceVariant;
|
|
17
|
+
size?: EPriceSize;
|
|
18
|
+
unit: string;
|
|
19
|
+
};
|
|
20
|
+
export declare type TPriceVariantAttributes = {
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
fontColor?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare type TPriceTagSizeAttributes = {
|
|
25
|
+
baseFontSize?: number;
|
|
26
|
+
decimalsFontSize?: number;
|
|
27
|
+
detailsPantWidth?: number;
|
|
28
|
+
indicatorSize?: number;
|
|
29
|
+
padding?: number;
|
|
30
|
+
unitFontSize?: number;
|
|
31
|
+
};
|
|
@@ -11,5 +11,6 @@ export declare type TSearchListItem = {
|
|
|
11
11
|
price: React.ReactNode;
|
|
12
12
|
item: TItem;
|
|
13
13
|
markings?: TMarking[];
|
|
14
|
+
fallBackImage?: string;
|
|
14
15
|
};
|
|
15
|
-
export declare const SearchListItem: ({ item, button, loading, price, markings }: TSearchListItem) => JSX.Element;
|
|
16
|
+
export declare const SearchListItem: ({ item, button, loading, price, markings, fallBackImage }: TSearchListItem) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EPriceSize, EPriceVariant, TPriceTagSizeAttributes, TPriceVariantAttributes } from '../components/PriceTag/PriceTag.types';
|
|
2
|
+
import { TPriceBannerSizeAttributes } from '../components/PriceBanner/PriceBanner';
|
|
3
|
+
export declare const getPriceBannerAttributes: (priceSize?: EPriceSize, priceVariant?: EPriceVariant) => {
|
|
4
|
+
sizeAttributes: TPriceBannerSizeAttributes;
|
|
5
|
+
variantAttributes: TPriceVariantAttributes;
|
|
6
|
+
};
|
|
7
|
+
export declare const getPriceTagAttributes: (priceSize?: EPriceSize, priceVariant?: EPriceVariant) => {
|
|
8
|
+
sizeAttributes: TPriceTagSizeAttributes;
|
|
9
|
+
variantAttributes: TPriceVariantAttributes;
|
|
10
|
+
};
|
package/build/@types/index.d.ts
CHANGED
|
@@ -81,5 +81,6 @@ export * from './components/CgButton/CgButton';
|
|
|
81
81
|
export * from './components/CartCardLabel/CartCardLabel';
|
|
82
82
|
export * from './components/CartCard/CartCard';
|
|
83
83
|
export * from './components/PriceTag/PriceTag';
|
|
84
|
+
export * from './components/PriceBanner/PriceBanner';
|
|
84
85
|
export * from './components/Pill/Pill';
|
|
85
86
|
export * from './components/SelectButton/SelectButton';
|
|
@@ -95,7 +95,9 @@ 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
|
+
require('../PriceTag/PriceTag.types.js');
|
|
99
|
+
require('../PriceBanner/PriceBanner.styles.js');
|
|
100
|
+
require('../PriceTag/PriceTag.styles.js');
|
|
99
101
|
require('../Pill/Pill.styles.js');
|
|
100
102
|
require('../SelectButton/SelectButton.styles.js');
|
|
101
103
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var typography = require('@citygross/typography');
|
|
7
7
|
var Skeleton = require('react-loading-skeleton');
|
|
8
|
-
var fallback_grocery = require('./assets/fallback_grocery.svg.js');
|
|
9
8
|
var ListItem_styles = require('./ListItem.styles.js');
|
|
10
9
|
var index = require('../../../../design-tokens/build/index.js');
|
|
11
10
|
|
|
@@ -19,26 +18,29 @@ exports.EListItemAlignment = void 0;
|
|
|
19
18
|
EListItemAlignment["CENTER"] = "center";
|
|
20
19
|
EListItemAlignment["TOP"] = "flex-start";
|
|
21
20
|
})(exports.EListItemAlignment || (exports.EListItemAlignment = {}));
|
|
22
|
-
function
|
|
21
|
+
var ListItem = function (_a) {
|
|
23
22
|
var _b, _c;
|
|
24
23
|
var item = _a.item, loading = _a.loading, isSmall = _a.isSmall, fallBackImage = _a.fallBackImage, imageAutoHeight = _a.imageAutoHeight, boldHeader = _a.boldHeader, smallSkeleton = _a.smallSkeleton, children = _a.children, _d = _a.alignment, alignment = _d === void 0 ? exports.EListItemAlignment.CENTER : _d, textColor = _a.textColor, usedInSearch = _a.usedInSearch;
|
|
25
24
|
return (React__default["default"].createElement(ListItem_styles.ListItemContainer, null,
|
|
26
25
|
React__default["default"].createElement(ListItem_styles.ListLeft, { usedInSearch: usedInSearch, alignment: alignment },
|
|
27
26
|
React__default["default"].createElement(ListItem_styles.ListImageContainer, { isSmall: isSmall },
|
|
28
|
-
React__default["default"].createElement(ListItem_styles.ListImage, { autoHeight: imageAutoHeight, src:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
React__default["default"].createElement(ListItem_styles.ListImage, { autoHeight: imageAutoHeight, src: item === null || item === void 0 ? void 0 : item.image, alt: item === null || item === void 0 ? void 0 : item.name, isSmall: isSmall, onError: function (e) {
|
|
28
|
+
if (fallBackImage) {
|
|
29
|
+
var target = e.target;
|
|
30
|
+
if (!target.dataset.fallback) {
|
|
31
|
+
target.dataset.fallback = 'true';
|
|
32
|
+
target.onerror = null;
|
|
33
|
+
target.src = fallBackImage;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
32
36
|
} })),
|
|
33
37
|
React__default["default"].createElement(ListItem_styles.ItemInformationContainer, { usedInSearch: usedInSearch, alignment: alignment },
|
|
34
|
-
React__default["default"].createElement(typography.BodyText, { fontWeight: boldHeader ? 'semiBold' : 'regular', color: textColor || ((_b = index.theme.palette) === null || _b === void 0 ? void 0 : _b.darkest), size: isSmall
|
|
35
|
-
? typography.TextTypes.TextSize.EXTRASMALL
|
|
36
|
-
: typography.TextTypes.TextSize.REGULAR }, (item === null || item === void 0 ? void 0 : item.name) || React__default["default"].createElement(Skeleton__default["default"], { width: smallSkeleton ? 150 : 250 })),
|
|
38
|
+
React__default["default"].createElement(typography.BodyText, { fontWeight: boldHeader ? 'semiBold' : 'regular', color: textColor || ((_b = index.theme.palette) === null || _b === void 0 ? void 0 : _b.darkest), size: isSmall ? typography.TextTypes.TextSize.EXTRASMALL : typography.TextTypes.TextSize.REGULAR }, (item === null || item === void 0 ? void 0 : item.name) || React__default["default"].createElement(Skeleton__default["default"], { width: smallSkeleton ? 150 : 250 })),
|
|
37
39
|
loading ? (React__default["default"].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL },
|
|
38
40
|
React__default["default"].createElement(Skeleton__default["default"], { width: smallSkeleton ? 150 : 250 }))) : (item === null || item === void 0 ? void 0 : item.description) ? (React__default["default"].createElement(typography.BodyText, { size: isSmall ? typography.TextTypes.TextSize.TINY : typography.TextTypes.TextSize.SMALL, color: textColor || ((_c = index.theme.palette) === null || _c === void 0 ? void 0 : _c.dark) }, item === null || item === void 0 ? void 0 : item.description)) : null,
|
|
39
41
|
(item === null || item === void 0 ? void 0 : item.secondaryDescription) && item.secondaryDescription)),
|
|
40
42
|
children && (React__default["default"].createElement(ListItem_styles.ListRight, { alignment: alignment }, children))));
|
|
41
|
-
}
|
|
43
|
+
};
|
|
42
44
|
|
|
43
45
|
exports.ListItem = ListItem;
|
|
44
46
|
//# sourceMappingURL=ListItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var price = require('../../helpers/price.js');
|
|
7
|
+
var PriceBanner_styles = require('./PriceBanner.styles.js');
|
|
8
|
+
var PriceTag_types = require('../PriceTag/PriceTag.types.js');
|
|
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
|
+
var PriceBanner = function (_a) {
|
|
15
|
+
var multiPrice = _a.multiPrice, _b = _a.size, size = _b === void 0 ? PriceTag_types.EPriceSize.MEDIUM : _b, variant = _a.variant;
|
|
16
|
+
var _c = price.getPriceBannerAttributes(size, variant), sizeAttributes = _c.sizeAttributes, variantAttributes = _c.variantAttributes;
|
|
17
|
+
var isMultiPrice = multiPrice && multiPrice > 1;
|
|
18
|
+
var bannerText = isMultiPrice
|
|
19
|
+
? "".concat(variant === PriceTag_types.EPriceVariant.KLIPP ? variant + ' ' : '').concat(multiPrice, " f\u00F6r")
|
|
20
|
+
: variant;
|
|
21
|
+
return (React__default["default"].createElement(PriceBanner_styles.PriceBanner, { backgroundColor: variantAttributes.backgroundColor, fontColor: variantAttributes.fontColor, fontSize: sizeAttributes.fontSize }, bannerText));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.PriceBanner = PriceBanner;
|
|
25
|
+
//# sourceMappingURL=PriceBanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PriceBanner.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 PriceBanner = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", "px;\n font-weight: ", ";\n padding: 0 ", "px;\n width: fit-content;\n"], ["\n background-color: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", "px;\n font-weight: ", ";\n padding: 0 ", "px;\n width: fit-content;\n"])), function (_a) {
|
|
13
|
+
var backgroundColor = _a.backgroundColor;
|
|
14
|
+
return backgroundColor;
|
|
15
|
+
}, function (_a) {
|
|
16
|
+
var fontColor = _a.fontColor;
|
|
17
|
+
return fontColor;
|
|
18
|
+
}, function (_a) {
|
|
19
|
+
var _b;
|
|
20
|
+
var theme = _a.theme;
|
|
21
|
+
return (_b = theme.typography) === null || _b === void 0 ? void 0 : _b.type.primary;
|
|
22
|
+
}, function (_a) {
|
|
23
|
+
var fontSize = _a.fontSize;
|
|
24
|
+
return fontSize;
|
|
25
|
+
}, function (_a) {
|
|
26
|
+
var _b;
|
|
27
|
+
var theme = _a.theme;
|
|
28
|
+
return (_b = theme.typography) === null || _b === void 0 ? void 0 : _b.weight.bold;
|
|
29
|
+
}, function (_a) {
|
|
30
|
+
var _b;
|
|
31
|
+
var theme = _a.theme;
|
|
32
|
+
return (_b = theme.spacings) === null || _b === void 0 ? void 0 : _b.xxs;
|
|
33
|
+
});
|
|
34
|
+
var templateObject_1;
|
|
35
|
+
|
|
36
|
+
exports.PriceBanner = PriceBanner;
|
|
37
|
+
//# sourceMappingURL=PriceBanner.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PriceBanner.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,71 +3,35 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var PriceTag_styles = require('./PriceTag.styles.js');
|
|
7
6
|
var icons = require('@citygross/icons');
|
|
8
|
-
var
|
|
7
|
+
var price = require('../../helpers/price.js');
|
|
8
|
+
var PriceBanner = require('../PriceBanner/PriceBanner.js');
|
|
9
|
+
var PriceTag_styles = require('./PriceTag.styles.js');
|
|
10
|
+
var PriceTag_types = require('./PriceTag.types.js');
|
|
9
11
|
|
|
10
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
13
|
|
|
12
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
15
|
|
|
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
|
-
badgeStr: 'Klipp!',
|
|
27
|
-
fontColor: (_b = designTokens.theme.palette) === null || _b === void 0 ? void 0 : _b.white
|
|
28
|
-
};
|
|
29
|
-
case exports.EPriceVariant.PRIO:
|
|
30
|
-
return {
|
|
31
|
-
backgroundColor: (_c = designTokens.theme.palette) === null || _c === void 0 ? void 0 : _c.brandPrio,
|
|
32
|
-
badgeStr: 'PRIO',
|
|
33
|
-
fontColor: (_d = designTokens.theme.palette) === null || _d === void 0 ? void 0 : _d.white
|
|
34
|
-
};
|
|
35
|
-
case exports.EPriceVariant.REGULAR_OFFER:
|
|
36
|
-
return {
|
|
37
|
-
backgroundColor: (_e = designTokens.theme.palette) === null || _e === void 0 ? void 0 : _e.brandYellow,
|
|
38
|
-
fontColor: (_f = designTokens.theme.palette) === null || _f === void 0 ? void 0 : _f.alertRed
|
|
39
|
-
};
|
|
40
|
-
default:
|
|
41
|
-
return {
|
|
42
|
-
fontColor: (_g = designTokens.theme.palette) === null || _g === void 0 ? void 0 : _g.darkest
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
16
|
var PriceTag = function (_a) {
|
|
47
|
-
var _b = _a.multiPrice, multiPrice = _b === void 0 ? 0 : _b, _c = _a.pant, pant = _c === void 0 ? false : _c, price = _a.price,
|
|
48
|
-
var
|
|
49
|
-
var priceBase = Math.floor(price);
|
|
50
|
-
var priceDecimals = (price % 1).toFixed(2).split('.')[1];
|
|
17
|
+
var _b = _a.multiPrice, multiPrice = _b === void 0 ? 0 : _b, _c = _a.pant, pant = _c === void 0 ? false : _c, price$1 = _a.price, _d = _a.variant, variant = _d === void 0 ? PriceTag_types.EPriceVariant.REGULAR : _d, _e = _a.size, size = _e === void 0 ? PriceTag_types.EPriceSize.MEDIUM : _e, unit = _a.unit;
|
|
18
|
+
var _f = price.getPriceTagAttributes(size, variant), sizeAttributes = _f.sizeAttributes, variantAttributes = _f.variantAttributes;
|
|
19
|
+
var priceBase = Math.floor(price$1);
|
|
20
|
+
var priceDecimals = (price$1 % 1).toFixed(2).split('.')[1];
|
|
51
21
|
var isMultiPrice = multiPrice > 1;
|
|
52
|
-
var showPriceIndicator = priceDecimals === '00'
|
|
53
|
-
var
|
|
54
|
-
var priceIndicator = ':-';
|
|
22
|
+
var showPriceIndicator = priceDecimals === '00';
|
|
23
|
+
var showUnit = pant || unit !== 'st';
|
|
55
24
|
var pantStr = '+pant';
|
|
56
|
-
return (React__default["default"].createElement(PriceTag_styles.
|
|
57
|
-
React__default["default"].createElement(PriceTag_styles.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
React__default["default"].createElement(PriceTag_styles.
|
|
61
|
-
React__default["default"].createElement(PriceTag_styles.
|
|
62
|
-
|
|
63
|
-
React__default["default"].createElement(PriceTag_styles.
|
|
64
|
-
React__default["default"].createElement(PriceTag_styles.
|
|
65
|
-
|
|
66
|
-
React__default["default"].createElement(PriceTag_styles.PriceIndicator, { pant: pant }, priceIndicator),
|
|
67
|
-
pant && React__default["default"].createElement(PriceTag_styles.Pant, null, pantStr))) : (React__default["default"].createElement(PriceTag_styles.PriceDetails, null,
|
|
68
|
-
React__default["default"].createElement(PriceTag_styles.PriceDecimals, null, priceDecimals),
|
|
69
|
-
React__default["default"].createElement(PriceTag_styles.PriceUnit, null, pant ? pantStr : isMultiPrice ? '' : "/".concat(unit))))))),
|
|
70
|
-
splash.badgeStr && (React__default["default"].createElement(PriceTag_styles.PriceVariantBadge, { backgroundColor: splash.backgroundColor, isInSmallContainer: isInSmallContainer }, splash.badgeStr)))));
|
|
25
|
+
return (React__default["default"].createElement(PriceTag_styles.PriceTagWrapper, { fontColor: variantAttributes.fontColor },
|
|
26
|
+
variant !== PriceTag_types.EPriceVariant.REGULAR && (React__default["default"].createElement(PriceTag_styles.PriceBannerContainer, null,
|
|
27
|
+
React__default["default"].createElement(PriceBanner.PriceBanner, { multiPrice: multiPrice, size: size, variant: variant }))),
|
|
28
|
+
React__default["default"].createElement(PriceTag_styles.PriceTagContainer, { backgroundColor: variantAttributes.backgroundColor },
|
|
29
|
+
React__default["default"].createElement(PriceTag_styles.PriceTag, null,
|
|
30
|
+
React__default["default"].createElement(PriceTag_styles.PriceBase, { fontSize: sizeAttributes.baseFontSize }, priceBase),
|
|
31
|
+
React__default["default"].createElement(PriceTag_styles.PriceDetails, { pant: pant, width: sizeAttributes.detailsPantWidth },
|
|
32
|
+
showPriceIndicator ? (React__default["default"].createElement(PriceTag_styles.PriceIndicatorContainer, { isSmall: size === PriceTag_types.EPriceSize.SMALL, showUnit: showUnit },
|
|
33
|
+
React__default["default"].createElement(icons.Icons.PriceIndicator, { fill: variantAttributes.fontColor, size: sizeAttributes.indicatorSize }))) : (React__default["default"].createElement(PriceTag_styles.PriceDecimals, { fontSize: sizeAttributes.decimalsFontSize, isSmall: size === PriceTag_types.EPriceSize.SMALL }, priceDecimals)),
|
|
34
|
+
showUnit && (React__default["default"].createElement(PriceTag_styles.PriceUnit, { fontSize: sizeAttributes.unitFontSize, isSmall: size === PriceTag_types.EPriceSize.SMALL, pant: pant }, pant ? pantStr : isMultiPrice ? '' : "/".concat(unit))))))));
|
|
71
35
|
};
|
|
72
36
|
|
|
73
37
|
exports.PriceTag = PriceTag;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceTag.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PriceTag.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -9,36 +9,74 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
12
|
+
var PriceTagWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n color: ", ";\n display: inline-flex;\n align-items: flex-start;\n flex-direction: column;\n font-family: ", ";\n font-weight: ", ";\n"], ["\n color: ", ";\n display: inline-flex;\n align-items: flex-start;\n flex-direction: column;\n font-family: ", ";\n font-weight: ", ";\n"])), function (_a) {
|
|
13
|
+
var fontColor = _a.fontColor;
|
|
14
|
+
return fontColor;
|
|
15
|
+
}, function (_a) {
|
|
16
|
+
var _b;
|
|
17
|
+
var theme = _a.theme;
|
|
18
|
+
return (_b = theme.typography) === null || _b === void 0 ? void 0 : _b.type.primary;
|
|
19
|
+
}, function (_a) {
|
|
20
|
+
var _b;
|
|
21
|
+
var theme = _a.theme;
|
|
22
|
+
return (_b = theme.typography) === null || _b === void 0 ? void 0 : _b.weight.bold;
|
|
23
|
+
});
|
|
24
|
+
var PriceBannerContainer = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n margin-bottom: 1px;\n transform: rotate(-", "deg);\n"], ["\n margin-bottom: 1px;\n transform: rotate(-", "deg);\n"])), function (props) { var _a; return (_a = props.theme.constants) === null || _a === void 0 ? void 0 : _a.priceRotate; });
|
|
25
|
+
var PriceTagContainer = styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n background-color: ", ";\n padding: ", "px;\n position: relative;\n"], ["\n background-color: ", ";\n padding: ", "px;\n position: relative;\n"])), function (_a) {
|
|
26
|
+
var backgroundColor = _a.backgroundColor;
|
|
27
|
+
return backgroundColor;
|
|
28
|
+
}, function (_a) {
|
|
29
|
+
var _b;
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return (_b = theme.spacings) === null || _b === void 0 ? void 0 : _b.xxs;
|
|
32
|
+
});
|
|
33
|
+
var PriceTag = styled__default["default"].div(templateObject_4 || (templateObject_4 = _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 (_a) {
|
|
34
|
+
var _b;
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return (_b = theme.spacings) === null || _b === void 0 ? void 0 : _b.xxxs;
|
|
37
|
+
});
|
|
38
|
+
var PriceBase = styled__default["default"].span(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n line-height: 1;\n"], ["\n font-size: ", "px;\n line-height: 1;\n"])), function (_a) {
|
|
39
|
+
var fontSize = _a.fontSize;
|
|
40
|
+
return fontSize;
|
|
41
|
+
});
|
|
42
|
+
var PriceDetails = styled__default["default"].div(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n width: ", ";\n"])), function (_a) {
|
|
43
|
+
var pant = _a.pant, width = _a.width;
|
|
44
|
+
return (pant ? width + 'px' : 'fit-content');
|
|
45
|
+
});
|
|
46
|
+
var PriceIndicatorContainer = styled__default["default"].div(templateObject_7 || (templateObject_7 = _tslib.__makeTemplateObject(["\n margin-top: ", "px;\n padding-right: ", "px;\n"], ["\n margin-top: ", "px;\n padding-right: ", "px;\n"])), function (_a) {
|
|
47
|
+
var isSmall = _a.isSmall, showUnit = _a.showUnit;
|
|
48
|
+
return showUnit ? (isSmall ? -4 : -5) : isSmall ? 3 : 5;
|
|
49
|
+
}, function (_a) {
|
|
50
|
+
var _b;
|
|
51
|
+
var theme = _a.theme;
|
|
52
|
+
return (_b = theme.spacings) === null || _b === void 0 ? void 0 : _b.xxs;
|
|
53
|
+
});
|
|
54
|
+
var PriceDecimals = styled__default["default"].span(templateObject_8 || (templateObject_8 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n margin-top: ", "px;\n"], ["\n font-size: ", "px;\n margin-top: ", "px;\n"])), function (_a) {
|
|
55
|
+
var fontSize = _a.fontSize;
|
|
56
|
+
return fontSize;
|
|
57
|
+
}, function (_a) {
|
|
58
|
+
var isSmall = _a.isSmall;
|
|
59
|
+
return (isSmall ? -10 : -14);
|
|
60
|
+
});
|
|
61
|
+
var PriceUnit = styled__default["default"].span(templateObject_9 || (templateObject_9 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n position: absolute;\n bottom: ", "px;\n right: ", "px;\n"], ["\n font-size: ", "px;\n position: absolute;\n bottom: ", "px;\n right: ", "px;\n"])), function (_a) {
|
|
62
|
+
var fontSize = _a.fontSize;
|
|
63
|
+
return fontSize;
|
|
64
|
+
}, function (_a) {
|
|
65
|
+
var isSmall = _a.isSmall;
|
|
66
|
+
return (isSmall ? 4 : 6);
|
|
67
|
+
}, function (_a) {
|
|
68
|
+
var pant = _a.pant;
|
|
69
|
+
return (pant ? 3 : 5);
|
|
70
|
+
});
|
|
71
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
28
72
|
|
|
29
|
-
exports.
|
|
30
|
-
exports.Pant = Pant;
|
|
73
|
+
exports.PriceBannerContainer = PriceBannerContainer;
|
|
31
74
|
exports.PriceBase = PriceBase;
|
|
32
75
|
exports.PriceDecimals = PriceDecimals;
|
|
33
76
|
exports.PriceDetails = PriceDetails;
|
|
34
|
-
exports.PriceIndicator = PriceIndicator;
|
|
35
77
|
exports.PriceIndicatorContainer = PriceIndicatorContainer;
|
|
36
|
-
exports.PriceSplashContainer = PriceSplashContainer;
|
|
37
78
|
exports.PriceTag = PriceTag;
|
|
38
|
-
exports.PriceTagComponent = PriceTagComponent;
|
|
39
79
|
exports.PriceTagContainer = PriceTagContainer;
|
|
40
|
-
exports.PriceTagContent = PriceTagContent;
|
|
41
80
|
exports.PriceTagWrapper = PriceTagWrapper;
|
|
42
81
|
exports.PriceUnit = PriceUnit;
|
|
43
|
-
exports.PriceVariantBadge = PriceVariantBadge;
|
|
44
82
|
//# sourceMappingURL=PriceTag.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceTag.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PriceTag.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
exports.EPriceSize = void 0;
|
|
6
|
+
(function (EPriceSize) {
|
|
7
|
+
EPriceSize["LARGE"] = "large";
|
|
8
|
+
EPriceSize["MEDIUM"] = "medium";
|
|
9
|
+
EPriceSize["SMALL"] = "small";
|
|
10
|
+
})(exports.EPriceSize || (exports.EPriceSize = {}));
|
|
11
|
+
exports.EPriceVariant = void 0;
|
|
12
|
+
(function (EPriceVariant) {
|
|
13
|
+
EPriceVariant["CAMPAIGN"] = "Kampanj";
|
|
14
|
+
EPriceVariant["KLIPP"] = "Klipp!";
|
|
15
|
+
EPriceVariant["PRIO"] = "Prio-pris";
|
|
16
|
+
EPriceVariant["REGULAR"] = "Ordinarie";
|
|
17
|
+
})(exports.EPriceVariant || (exports.EPriceVariant = {}));
|
|
18
|
+
//# sourceMappingURL=PriceTag.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PriceTag.types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -11,13 +11,13 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
12
|
|
|
13
13
|
var SearchListItem = function (_a) {
|
|
14
|
-
var item = _a.item, button = _a.button, loading = _a.loading, price = _a.price, markings = _a.markings;
|
|
14
|
+
var item = _a.item, button = _a.button, loading = _a.loading, price = _a.price, markings = _a.markings, fallBackImage = _a.fallBackImage;
|
|
15
15
|
return (React__default["default"].createElement(SearchListItem_styles.SearchListItemWrapper, null,
|
|
16
16
|
markings && (React__default["default"].createElement(SearchListItem_styles.MarkingWrapper, null, markings === null || markings === void 0 ? void 0 : markings.map(function (marking, index) { return (React__default["default"].createElement(SearchListItem_styles.Marking, { key: index },
|
|
17
17
|
React__default["default"].createElement(SearchListItem_styles.ToolTip, { backgroundColor: marking === null || marking === void 0 ? void 0 : marking.backgroundColor, left: (index + 1) * 25 }, marking.tooltipText),
|
|
18
18
|
marking.image)); }))),
|
|
19
19
|
React__default["default"].createElement(SearchListItem_styles.ListItemWrapper, null,
|
|
20
|
-
React__default["default"].createElement(ListItem.ListItem, { usedInSearch: true, loading: loading, item: item })),
|
|
20
|
+
React__default["default"].createElement(ListItem.ListItem, { usedInSearch: true, loading: loading, item: item, fallBackImage: fallBackImage })),
|
|
21
21
|
React__default["default"].createElement(SearchListItem_styles.PriceTagWrapper, null, price),
|
|
22
22
|
React__default["default"].createElement(SearchListItem_styles.ButtonWrapper, null, button)));
|
|
23
23
|
};
|
|
@@ -95,7 +95,9 @@ 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
|
+
require('../PriceTag/PriceTag.types.js');
|
|
99
|
+
require('../PriceBanner/PriceBanner.styles.js');
|
|
100
|
+
require('../PriceTag/PriceTag.styles.js');
|
|
99
101
|
require('../Pill/Pill.styles.js');
|
|
100
102
|
require('../SelectButton/SelectButton.styles.js');
|
|
101
103
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WarningLabel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|