@citygross/components 0.7.55 → 0.7.59
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/CartItemSummary/CartItemSummary.d.ts +3 -1
- package/build/@types/components/RadioListItem/RadioListItem.d.ts +1 -1
- package/build/@types/components/RadioListItem/RadioListItem.stories.d.ts +0 -8
- package/build/cjs/components/src/components/CartItemSummary/CartItemSummary.js +4 -4
- package/build/cjs/components/src/components/RadioListItem/RadioListItem.js +4 -5
- package/build/cjs/components/src/components/RadioListItem/RadioListItem.js.map +1 -1
- package/build/cjs/utils/build/index.js +5 -3
- package/build/cjs/utils/build/index.js.map +1 -1
- package/build/es/components/src/components/CartItemSummary/CartItemSummary.js +4 -4
- package/build/es/components/src/components/RadioListItem/RadioListItem.js +4 -5
- package/build/es/components/src/components/RadioListItem/RadioListItem.js.map +1 -1
- package/build/es/utils/build/index.js +5 -3
- package/build/es/utils/build/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TSummaryItem } from '../CartSummary/CartSummary';
|
|
2
2
|
export declare type TCartItemSummary = {
|
|
3
3
|
product: TSummaryItem;
|
|
4
|
+
withParenthesis?: boolean;
|
|
5
|
+
unit?: string;
|
|
4
6
|
};
|
|
5
|
-
export declare function CartItemSummary({ product }: TCartItemSummary): JSX.Element;
|
|
7
|
+
export declare function CartItemSummary({ product, withParenthesis, unit }: TCartItemSummary): JSX.Element;
|
|
@@ -5,7 +5,7 @@ export declare type TRadioListItemProps = styles.TBaseRadioItemInputWrapper & {
|
|
|
5
5
|
onClick: (value: string | number) => void;
|
|
6
6
|
radioColor?: keyof TRadioColor;
|
|
7
7
|
name: string;
|
|
8
|
-
selected?:
|
|
8
|
+
selected?: boolean;
|
|
9
9
|
defaultDisabledString?: string;
|
|
10
10
|
dotIndicator?: TDot;
|
|
11
11
|
transparent?: boolean;
|
|
@@ -4,14 +4,6 @@ declare const _default: {
|
|
|
4
4
|
component: typeof RadioListItem;
|
|
5
5
|
subComponents: typeof RadioListItem;
|
|
6
6
|
title: string;
|
|
7
|
-
argTypes: {
|
|
8
|
-
selected: {
|
|
9
|
-
options: (string | null)[];
|
|
10
|
-
control: {
|
|
11
|
-
type: string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
7
|
};
|
|
16
8
|
export default _default;
|
|
17
9
|
export declare const Default: Story<TRadioListItemProps>;
|
|
@@ -14,17 +14,17 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
14
14
|
var Skeleton__default = /*#__PURE__*/_interopDefaultLegacy(Skeleton);
|
|
15
15
|
|
|
16
16
|
function CartItemSummary(_a) {
|
|
17
|
-
var product = _a.product;
|
|
17
|
+
var product = _a.product, withParenthesis = _a.withParenthesis, _b = _a.unit, unit = _b === void 0 ? "st" : _b;
|
|
18
18
|
return (React__default['default'].createElement(CartItemSummary_styles.CartItemSummaryWrapper, null,
|
|
19
19
|
product &&
|
|
20
20
|
(product.amount === 0 || product.amount) &&
|
|
21
21
|
(product === null || product === void 0 ? void 0 : product.cancelledQuantity) !== 0 &&
|
|
22
22
|
(product === null || product === void 0 ? void 0 : product.cancelledQuantity) && (React__default['default'].createElement(CartItemSummary_styles.CancelledWrapper, null,
|
|
23
23
|
React__default['default'].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL, lineThrough: true }, (product === null || product === void 0 ? void 0 : product.cancelledQuantity) ? (product.cancelledQuantity + " st") : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))),
|
|
24
|
-
React__default['default'].createElement(CartItemSummary_styles.AmountText, { lineThrough: true }, product ? (utils.formatPrice(product.cancelledAmount)) : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))))),
|
|
24
|
+
React__default['default'].createElement(CartItemSummary_styles.AmountText, { lineThrough: true, fontWeight: withParenthesis ? 'regular' : 'semiBold' }, product ? (utils.formatPrice(product.cancelledAmount, withParenthesis)) : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))))),
|
|
25
25
|
React__default['default'].createElement(CartItemSummary_styles.ItemInformationContainer, null,
|
|
26
|
-
React__default['default'].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL }, (product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.quantity) === 0 ? (product.quantity + "
|
|
27
|
-
React__default['default'].createElement(CartItemSummary_styles.AmountText,
|
|
26
|
+
React__default['default'].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL }, (product === null || product === void 0 ? void 0 : product.quantity) || (product === null || product === void 0 ? void 0 : product.quantity) === 0 ? (product.quantity + " " + unit) : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))),
|
|
27
|
+
React__default['default'].createElement(CartItemSummary_styles.AmountText, { fontWeight: withParenthesis ? 'regular' : 'semiBold' }, product ? (utils.formatPrice(product.amount, withParenthesis)) : (React__default['default'].createElement(Skeleton__default['default'], { width: 100 }))))));
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
exports.CartItemSummary = CartItemSummary;
|
|
@@ -16,22 +16,21 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
16
16
|
function RadioListItem(_a) {
|
|
17
17
|
var _b, _c, _d, _e;
|
|
18
18
|
var onClick = _a.onClick, selected = _a.selected, name = _a.name, _f = _a.radioColor, radioColor = _f === void 0 ? 'alertBlue' : _f, defaultDisabledString = _a.defaultDisabledString, _g = _a.flexGrow, flexGrow = _g === void 0 ? 1 : _g, isDisabled = _a.isDisabled, dotIndicator = _a.dotIndicator, transparent = _a.transparent, noPadding = _a.noPadding, label = _a.label, disabledText = _a.disabledText, secondaryLabel = _a.secondaryLabel, textOnSelected = _a.textOnSelected, value = _a.value, children = _a.children;
|
|
19
|
-
var checked = value === selected;
|
|
20
19
|
return (React__default['default'].createElement(RadioListItem_styles.BaseRadioListItemContainer, { background: transparent
|
|
21
20
|
? (_b = designTokens.theme.palette) === null || _b === void 0 ? void 0 : _b.transparent
|
|
22
21
|
: designTokens.theme && designTokens.theme.palette
|
|
23
|
-
?
|
|
22
|
+
? selected
|
|
24
23
|
? (_c = designTokens.theme.palette) === null || _c === void 0 ? void 0 : _c.blueLight
|
|
25
24
|
: (_d = designTokens.theme.palette) === null || _d === void 0 ? void 0 : _d.white
|
|
26
25
|
: 'white', noPadding: noPadding, onClick: isDisabled ? function () { } : function () { return onClick(value); } },
|
|
27
26
|
React__default['default'].createElement(RadioListItem_styles.RadioFlex, null,
|
|
28
27
|
React__default['default'].createElement(RadioListItem_styles.BaseRadioItemLeftWrapper, { isDisabled: isDisabled, flexGrow: flexGrow },
|
|
29
|
-
React__default['default'].createElement(Radio.Radio, { customColor: radioColor, checked:
|
|
28
|
+
React__default['default'].createElement(Radio.Radio, { customColor: radioColor, checked: selected, disabled: isDisabled, name: name, onChange: function () { return onClick(value); }, value: value }),
|
|
30
29
|
React__default['default'].createElement(RadioListItem_styles.StyledH3, { lineThrough: isDisabled }, label)),
|
|
31
30
|
React__default['default'].createElement(RadioListItem_styles.RadioSecondaryWrapper, null,
|
|
32
|
-
React__default['default'].createElement("span", null, dotIndicator &&
|
|
31
|
+
React__default['default'].createElement("span", null, dotIndicator && selected && (React__default['default'].createElement(DotIndicator.Dot, { color: dotIndicator.color, shadow: dotIndicator.shadow }))),
|
|
33
32
|
isDisabled ? (React__default['default'].createElement(typography.BodyText, null, disabledText || defaultDisabledString)) : (children || secondaryLabel))),
|
|
34
|
-
textOnSelected &&
|
|
33
|
+
textOnSelected && selected && (React__default['default'].createElement(RadioListItem_styles.ExtraTextContainer, null,
|
|
35
34
|
React__default['default'].createElement(typography.BodyText, { size: typography.TextTypes.TextSize.SMALL, color: (_e = designTokens.theme.palette) === null || _e === void 0 ? void 0 : _e.dark }, textOnSelected)))));
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioListItem.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioListItem.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -18,12 +18,14 @@ function _interopDefaultLegacy$1 (e) { return e && typeof e === 'object' && 'def
|
|
|
18
18
|
|
|
19
19
|
var React__default = /*#__PURE__*/_interopDefaultLegacy$1(React);
|
|
20
20
|
|
|
21
|
-
var formatPrice = function (price) {
|
|
21
|
+
var formatPrice = function (price, withParenthesis) {
|
|
22
22
|
if (price === null || price === undefined) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
var formattedPrice = (Math.round(price * 100) / 100)
|
|
26
|
-
|
|
25
|
+
var formattedPrice = (Math.round(price * 100) / 100)
|
|
26
|
+
.toFixed(2)
|
|
27
|
+
.replace('.', ',');
|
|
28
|
+
return "" + (withParenthesis ? "(" + formattedPrice + " kr)" : formattedPrice + " kr");
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
var capitalizeFirstLetter = function (string) {
|