tg-core-components 6.1.16 → 6.1.17
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.
|
@@ -12,7 +12,7 @@ var fractionDigits = {
|
|
|
12
12
|
LTC: { min: 5, max: 5 },
|
|
13
13
|
XBC: { min: 5, max: 5 },
|
|
14
14
|
XRP: { min: 5, max: 5 },
|
|
15
|
-
|
|
15
|
+
ETH: { min: 5, max: 5 },
|
|
16
16
|
BCH: { min: 5, max: 5 }
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -21,8 +21,8 @@ var fractionDigits = {
|
|
|
21
21
|
*/
|
|
22
22
|
var Money = function Money(props) {
|
|
23
23
|
return React.createElement(FormattedNumber, _extends({
|
|
24
|
-
minimumFractionDigits: props.decimals ? fractionDigits[props.currency] || 2 : 0,
|
|
25
|
-
maximumFractionDigits: props.decimals ? fractionDigits[props.currency] || 2 : 0
|
|
24
|
+
minimumFractionDigits: props.decimals && fractionDigits[props.currency] ? fractionDigits[props.currency].min || 2 : 0,
|
|
25
|
+
maximumFractionDigits: props.decimals && fractionDigits[props.currency] ? fractionDigits[props.currency].max || 2 : 0
|
|
26
26
|
}, props, {
|
|
27
27
|
style: 'currency'
|
|
28
28
|
}));
|
|
@@ -47,7 +47,10 @@ Money.defaultProps = {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
export var format = function format(currency) {
|
|
50
|
-
|
|
50
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
51
|
+
return new Intl.NumberFormat(locale, {
|
|
52
|
+
style: 'currency',
|
|
53
|
+
currency: currency,
|
|
51
54
|
minimumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].min : null,
|
|
52
55
|
maximumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].max : null
|
|
53
56
|
});
|
|
@@ -27,7 +27,7 @@ var fractionDigits = {
|
|
|
27
27
|
LTC: { min: 5, max: 5 },
|
|
28
28
|
XBC: { min: 5, max: 5 },
|
|
29
29
|
XRP: { min: 5, max: 5 },
|
|
30
|
-
|
|
30
|
+
ETH: { min: 5, max: 5 },
|
|
31
31
|
BCH: { min: 5, max: 5 }
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -36,8 +36,8 @@ var fractionDigits = {
|
|
|
36
36
|
*/
|
|
37
37
|
var Money = function Money(props) {
|
|
38
38
|
return _react2.default.createElement(_reactIntl.FormattedNumber, _extends({
|
|
39
|
-
minimumFractionDigits: props.decimals ? fractionDigits[props.currency] || 2 : 0,
|
|
40
|
-
maximumFractionDigits: props.decimals ? fractionDigits[props.currency] || 2 : 0
|
|
39
|
+
minimumFractionDigits: props.decimals && fractionDigits[props.currency] ? fractionDigits[props.currency].min || 2 : 0,
|
|
40
|
+
maximumFractionDigits: props.decimals && fractionDigits[props.currency] ? fractionDigits[props.currency].max || 2 : 0
|
|
41
41
|
}, props, {
|
|
42
42
|
style: 'currency'
|
|
43
43
|
}));
|
|
@@ -62,7 +62,10 @@ Money.defaultProps = {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
var format = exports.format = function format(currency) {
|
|
65
|
-
|
|
65
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
66
|
+
return new Intl.NumberFormat(locale, {
|
|
67
|
+
style: 'currency',
|
|
68
|
+
currency: currency,
|
|
66
69
|
minimumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].min : null,
|
|
67
70
|
maximumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].max : null
|
|
68
71
|
});
|