@commercetools-uikit/money-input 20.3.1 → 20.5.0

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.
@@ -727,6 +727,25 @@ const currencies = {
727
727
  },
728
728
  ZWR: {
729
729
  fractionDigits: 2
730
+ },
731
+ // Zero-fraction variants (non-ISO): base currency with 0 decimal places.
732
+ CZK0: {
733
+ fractionDigits: 0
734
+ },
735
+ HUF0: {
736
+ fractionDigits: 0
737
+ },
738
+ ILS0: {
739
+ fractionDigits: 0
740
+ },
741
+ KZT0: {
742
+ fractionDigits: 0
743
+ },
744
+ TRY0: {
745
+ fractionDigits: 0
746
+ },
747
+ TWD0: {
748
+ fractionDigits: 0
730
749
  }
731
750
  };
732
751
  var allCurrencies = currencies;
@@ -1017,12 +1036,15 @@ const createMoneyValue = (rawAmount, locale, currencyCode) => {
1017
1036
  fractionDigits: currency.fractionDigits
1018
1037
  };
1019
1038
  };
1020
- const createEmptyMoneyValue = currencyCode => ({
1021
- type: 'centPrecision',
1022
- currencyCode,
1023
- centAmount: NaN,
1024
- fractionDigits: 2
1025
- });
1039
+ const createEmptyMoneyValue = currencyCode => {
1040
+ var _allCurrencies$curren;
1041
+ return {
1042
+ type: 'centPrecision',
1043
+ currencyCode,
1044
+ centAmount: NaN,
1045
+ fractionDigits: (_allCurrencies$curren = allCurrencies[currencyCode].fractionDigits) !== null && _allCurrencies$curren !== void 0 ? _allCurrencies$curren : 2
1046
+ };
1047
+ };
1026
1048
  const getAmountAsNumberFromMoneyValue = moneyValue => moneyValue.type === 'highPrecision' ? moneyValue.preciseAmount / 10 ** moneyValue.fractionDigits : moneyValue.centAmount / 10 ** allCurrencies[moneyValue.currencyCode].fractionDigits;
1027
1049
 
1028
1050
  // gets called with a string and should return a formatted string
@@ -1357,7 +1379,7 @@ MoneyInput.isTouched = touched => Boolean(touched && touched.currencyCode && tou
1357
1379
  var MoneyInput$1 = MoneyInput;
1358
1380
 
1359
1381
  // NOTE: This string will be replaced on build time with the package version.
1360
- var version = "20.3.1";
1382
+ var version = "20.5.0";
1361
1383
 
1362
1384
  exports["default"] = MoneyInput$1;
1363
1385
  exports.version = version;