@alfalab/core-components-amount
Advanced tools
Comparing version 3.6.0 to 3.7.0
@@ -9,2 +9,3 @@ 'use strict'; | ||
var utils_logWarning = require('./utils/logWarning.js'); | ||
var utils_trimTrailingZeros = require('./utils/trimTrailingZeros.js'); | ||
@@ -16,3 +17,3 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; } | ||
var styles = {"component":"amount__component_ntxu7","transparentMinor":"amount__transparentMinor_ntxu7","bold":"amount__bold_ntxu7","normalMinor":"amount__normalMinor_ntxu7","defaultStyles":"amount__defaultStyles_ntxu7","defaultMinor":"amount__defaultMinor_ntxu7","minorPartAndCurrency":"amount__minorPartAndCurrency_ntxu7"}; | ||
var styles = {"component":"amount__component_1ml96","transparentMinor":"amount__transparentMinor_1ml96","bold":"amount__bold_1ml96","normalMinor":"amount__normalMinor_1ml96","defaultStyles":"amount__defaultStyles_1ml96","defaultMinor":"amount__defaultMinor_1ml96","minorPartAndCurrency":"amount__minorPartAndCurrency_1ml96"}; | ||
require('./index.css') | ||
@@ -26,4 +27,4 @@ | ||
var _b, _c; | ||
var value = _a.value, minority = _a.minority, currency = _a.currency, _d = _a.codeFormat, codeFormat = _d === void 0 ? 'symbolic' : _d, _e = _a.view, view = _e === void 0 ? 'default' : _e, bold = _a.bold, transparentMinor = _a.transparentMinor, rightAddons = _a.rightAddons, _f = _a.showPlus, showPlus = _f === void 0 ? false : _f, className = _a.className, dataTestId = _a.dataTestId; | ||
var _g = utils.formatAmount({ | ||
var value = _a.value, minority = _a.minority, currency = _a.currency, _d = _a.codeFormat, codeFormat = _d === void 0 ? 'symbolic' : _d, _e = _a.view, view = _e === void 0 ? 'default' : _e, bold = _a.bold, transparentMinor = _a.transparentMinor, rightAddons = _a.rightAddons, _f = _a.showPlus, showPlus = _f === void 0 ? false : _f, className = _a.className, _g = _a.trimZero, trimZero = _g === void 0 ? false : _g, dataTestId = _a.dataTestId; | ||
var _h = utils.formatAmount({ | ||
value: value, | ||
@@ -34,3 +35,3 @@ currency: currency, | ||
codeFormat: codeFormat, | ||
}), majorPart = _g.majorPart, minorPart = _g.minorPart, currencySymbol = _g.currencySymbol, currencySeparator = _g.currencySeparator; | ||
}), majorPart = _h.majorPart, minorPart = _h.minorPart, currencySymbol = _h.currencySymbol, currencySeparator = _h.currencySeparator; | ||
var defaultStyles = bold === undefined && transparentMinor === undefined; | ||
@@ -50,3 +51,3 @@ utils_logWarning.logWarning(currency); | ||
minorPart && utils.AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR, | ||
minorPart, | ||
trimZero ? utils_trimTrailingZeros.trimTrailingZeros(minorPart) : minorPart, | ||
currency ? "".concat(currencySeparator).concat(currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : currency) : null, | ||
@@ -53,0 +54,0 @@ rightAddons))); |
@@ -9,2 +9,3 @@ 'use strict'; | ||
var utils_logWarning = require('./utils/logWarning.js'); | ||
var utils_trimTrailingZeros = require('./utils/trimTrailingZeros.js'); | ||
var styles = require('./index.module.css'); | ||
@@ -24,4 +25,4 @@ | ||
var _b, _c; | ||
var value = _a.value, minority = _a.minority, currency = _a.currency, _d = _a.codeFormat, codeFormat = _d === void 0 ? 'symbolic' : _d, _e = _a.view, view = _e === void 0 ? 'default' : _e, bold = _a.bold, transparentMinor = _a.transparentMinor, rightAddons = _a.rightAddons, _f = _a.showPlus, showPlus = _f === void 0 ? false : _f, className = _a.className, dataTestId = _a.dataTestId; | ||
var _g = utils.formatAmount({ | ||
var value = _a.value, minority = _a.minority, currency = _a.currency, _d = _a.codeFormat, codeFormat = _d === void 0 ? 'symbolic' : _d, _e = _a.view, view = _e === void 0 ? 'default' : _e, bold = _a.bold, transparentMinor = _a.transparentMinor, rightAddons = _a.rightAddons, _f = _a.showPlus, showPlus = _f === void 0 ? false : _f, className = _a.className, _g = _a.trimZero, trimZero = _g === void 0 ? false : _g, dataTestId = _a.dataTestId; | ||
var _h = utils.formatAmount({ | ||
value: value, | ||
@@ -32,3 +33,3 @@ currency: currency, | ||
codeFormat: codeFormat, | ||
}), majorPart = _g.majorPart, minorPart = _g.minorPart, currencySymbol = _g.currencySymbol, currencySeparator = _g.currencySeparator; | ||
}), majorPart = _h.majorPart, minorPart = _h.minorPart, currencySymbol = _h.currencySymbol, currencySeparator = _h.currencySeparator; | ||
var defaultStyles = bold === undefined && transparentMinor === undefined; | ||
@@ -48,3 +49,3 @@ utils_logWarning.logWarning(currency); | ||
minorPart && utils.AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR, | ||
minorPart, | ||
trimZero ? utils_trimTrailingZeros.trimTrailingZeros(minorPart) : minorPart, | ||
currency ? "".concat(currencySeparator).concat(currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : currency) : null, | ||
@@ -51,0 +52,0 @@ rightAddons))); |
@@ -50,3 +50,8 @@ import { ReactNode } from 'react'; | ||
dataTestId?: string; | ||
/** | ||
* Обрезать ноль в минорной части. Например: 1.70 -> 1.7 | ||
* @default false | ||
*/ | ||
trimZero?: boolean; | ||
}; | ||
export { AmountProps }; |
@@ -5,4 +5,5 @@ import React from 'react'; | ||
import { logWarning } from './utils/logWarning.js'; | ||
import { trimTrailingZeros } from './utils/trimTrailingZeros.js'; | ||
var styles = {"component":"amount__component_ntxu7","transparentMinor":"amount__transparentMinor_ntxu7","bold":"amount__bold_ntxu7","normalMinor":"amount__normalMinor_ntxu7","defaultStyles":"amount__defaultStyles_ntxu7","defaultMinor":"amount__defaultMinor_ntxu7","minorPartAndCurrency":"amount__minorPartAndCurrency_ntxu7"}; | ||
var styles = {"component":"amount__component_1ml96","transparentMinor":"amount__transparentMinor_1ml96","bold":"amount__bold_1ml96","normalMinor":"amount__normalMinor_1ml96","defaultStyles":"amount__defaultStyles_1ml96","defaultMinor":"amount__defaultMinor_1ml96","minorPartAndCurrency":"amount__minorPartAndCurrency_1ml96"}; | ||
require('./index.css') | ||
@@ -16,4 +17,4 @@ | ||
var _b, _c; | ||
var value = _a.value, minority = _a.minority, currency = _a.currency, _d = _a.codeFormat, codeFormat = _d === void 0 ? 'symbolic' : _d, _e = _a.view, view = _e === void 0 ? 'default' : _e, bold = _a.bold, transparentMinor = _a.transparentMinor, rightAddons = _a.rightAddons, _f = _a.showPlus, showPlus = _f === void 0 ? false : _f, className = _a.className, dataTestId = _a.dataTestId; | ||
var _g = formatAmount({ | ||
var value = _a.value, minority = _a.minority, currency = _a.currency, _d = _a.codeFormat, codeFormat = _d === void 0 ? 'symbolic' : _d, _e = _a.view, view = _e === void 0 ? 'default' : _e, bold = _a.bold, transparentMinor = _a.transparentMinor, rightAddons = _a.rightAddons, _f = _a.showPlus, showPlus = _f === void 0 ? false : _f, className = _a.className, _g = _a.trimZero, trimZero = _g === void 0 ? false : _g, dataTestId = _a.dataTestId; | ||
var _h = formatAmount({ | ||
value: value, | ||
@@ -24,3 +25,3 @@ currency: currency, | ||
codeFormat: codeFormat, | ||
}), majorPart = _g.majorPart, minorPart = _g.minorPart, currencySymbol = _g.currencySymbol, currencySeparator = _g.currencySeparator; | ||
}), majorPart = _h.majorPart, minorPart = _h.minorPart, currencySymbol = _h.currencySymbol, currencySeparator = _h.currencySeparator; | ||
var defaultStyles = bold === undefined && transparentMinor === undefined; | ||
@@ -40,3 +41,3 @@ logWarning(currency); | ||
minorPart && AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR, | ||
minorPart, | ||
trimZero ? trimTrailingZeros(minorPart) : minorPart, | ||
currency ? "".concat(currencySeparator).concat(currencySymbol !== null && currencySymbol !== void 0 ? currencySymbol : currency) : null, | ||
@@ -43,0 +44,0 @@ rightAddons))); |
@@ -5,3 +5,3 @@ import React from 'react'; | ||
var styles = {"component":"amount__component_4lwlo"}; | ||
var styles = {"component":"amount__component_nv3ju"}; | ||
require('./index.css') | ||
@@ -8,0 +8,0 @@ |
@@ -50,3 +50,8 @@ import { ReactNode } from 'react'; | ||
dataTestId?: string; | ||
/** | ||
* Обрезать ноль в минорной части. Например: 1.70 -> 1.7 | ||
* @default false | ||
*/ | ||
trimZero?: boolean; | ||
}; | ||
export { AmountProps }; |
@@ -5,4 +5,5 @@ import React from 'react'; | ||
import { logWarning } from './utils/logWarning.js'; | ||
import { trimTrailingZeros } from './utils/trimTrailingZeros.js'; | ||
const styles = {"component":"amount__component_ntxu7","transparentMinor":"amount__transparentMinor_ntxu7","bold":"amount__bold_ntxu7","normalMinor":"amount__normalMinor_ntxu7","defaultStyles":"amount__defaultStyles_ntxu7","defaultMinor":"amount__defaultMinor_ntxu7","minorPartAndCurrency":"amount__minorPartAndCurrency_ntxu7"}; | ||
const styles = {"component":"amount__component_1ml96","transparentMinor":"amount__transparentMinor_1ml96","bold":"amount__bold_1ml96","normalMinor":"amount__normalMinor_1ml96","defaultStyles":"amount__defaultStyles_1ml96","defaultMinor":"amount__defaultMinor_1ml96","minorPartAndCurrency":"amount__minorPartAndCurrency_1ml96"}; | ||
require('./index.css') | ||
@@ -14,3 +15,3 @@ | ||
*/ | ||
const Amount = ({ value, minority, currency, codeFormat = 'symbolic', view = 'default', bold, transparentMinor, rightAddons, showPlus = false, className, dataTestId, }) => { | ||
const Amount = ({ value, minority, currency, codeFormat = 'symbolic', view = 'default', bold, transparentMinor, rightAddons, showPlus = false, className, trimZero = false, dataTestId, }) => { | ||
const { majorPart, minorPart, currencySymbol, currencySeparator } = formatAmount({ | ||
@@ -37,3 +38,3 @@ value, | ||
minorPart && AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR, | ||
minorPart, | ||
trimZero ? trimTrailingZeros(minorPart) : minorPart, | ||
currency ? `${currencySeparator}${currencySymbol ?? currency}` : null, | ||
@@ -40,0 +41,0 @@ rightAddons))); |
@@ -5,3 +5,3 @@ import React from 'react'; | ||
const styles = {"component":"amount__component_4lwlo"}; | ||
const styles = {"component":"amount__component_nv3ju"}; | ||
require('./index.css') | ||
@@ -8,0 +8,0 @@ |
@@ -50,3 +50,8 @@ import { ReactNode } from 'react'; | ||
dataTestId?: string; | ||
/** | ||
* Обрезать ноль в минорной части. Например: 1.70 -> 1.7 | ||
* @default false | ||
*/ | ||
trimZero?: boolean; | ||
}; | ||
export { AmountProps }; |
@@ -5,2 +5,3 @@ import React from 'react'; | ||
import { logWarning } from './utils/logWarning.js'; | ||
import { trimTrailingZeros } from './utils/trimTrailingZeros.js'; | ||
import styles from './index.module.css'; | ||
@@ -12,3 +13,3 @@ | ||
*/ | ||
const Amount = ({ value, minority, currency, codeFormat = 'symbolic', view = 'default', bold, transparentMinor, rightAddons, showPlus = false, className, dataTestId, }) => { | ||
const Amount = ({ value, minority, currency, codeFormat = 'symbolic', view = 'default', bold, transparentMinor, rightAddons, showPlus = false, className, trimZero = false, dataTestId, }) => { | ||
const { majorPart, minorPart, currencySymbol, currencySeparator } = formatAmount({ | ||
@@ -35,3 +36,3 @@ value, | ||
minorPart && AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR, | ||
minorPart, | ||
trimZero ? trimTrailingZeros(minorPart) : minorPart, | ||
currency ? `${currencySeparator}${currencySymbol ?? currency}` : null, | ||
@@ -38,0 +39,0 @@ rightAddons))); |
@@ -50,3 +50,8 @@ import { ReactNode } from 'react'; | ||
dataTestId?: string; | ||
/** | ||
* Обрезать ноль в минорной части. Например: 1.70 -> 1.7 | ||
* @default false | ||
*/ | ||
trimZero?: boolean; | ||
}; | ||
export { AmountProps }; |
{ | ||
"name": "@alfalab/core-components-amount", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "", | ||
@@ -22,4 +22,4 @@ "keywords": [], | ||
}, | ||
"themesVersion": "13.1.0", | ||
"varsVersion": "9.12.0" | ||
"themesVersion": "13.2.0", | ||
"varsVersion": "9.13.0" | ||
} |
@@ -14,3 +14,3 @@ 'use strict'; | ||
var styles = {"component":"amount__component_4lwlo"}; | ||
var styles = {"component":"amount__component_nv3ju"}; | ||
require('./index.css') | ||
@@ -17,0 +17,0 @@ |
@@ -62,2 +62,8 @@ import { ReactNode } from 'react'; | ||
dataTestId?: string; | ||
/** | ||
* Обрезать ноль в минорной части. Например: 1.70 -> 1.7 | ||
* @default false | ||
*/ | ||
trimZero?: boolean; | ||
}; |
@@ -50,3 +50,8 @@ import { ReactNode } from 'react'; | ||
dataTestId?: string; | ||
/** | ||
* Обрезать ноль в минорной части. Например: 1.70 -> 1.7 | ||
* @default false | ||
*/ | ||
trimZero?: boolean; | ||
}; | ||
export { AmountProps }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104384
101
1529