@commercetools-uikit/money-input 12.2.3 → 12.2.7

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.
@@ -756,13 +756,13 @@ var messages = reactIntl.defineMessages({
756
756
 
757
757
  var _excluded = ["id"];
758
758
 
759
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
759
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
760
760
 
761
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context14; _forEachInstanceProperty__default['default'](_context14 = ownKeys(Object(source), true)).call(_context14, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context15; _forEachInstanceProperty__default['default'](_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
761
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context14; _forEachInstanceProperty__default["default"](_context14 = ownKeys(Object(source), true)).call(_context14, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context15; _forEachInstanceProperty__default["default"](_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
762
762
 
763
763
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
764
764
 
765
- var TooltipWrapper = _styled__default['default']("div", process.env.NODE_ENV === "production" ? {
765
+ var TooltipWrapper = _styled__default["default"]("div", process.env.NODE_ENV === "production" ? {
766
766
  target: "elvjg270"
767
767
  } : {
768
768
  target: "elvjg270",
@@ -787,7 +787,7 @@ var getPortalNode = function getPortalNode(id) {
787
787
 
788
788
  var Portal = function Portal(props) {
789
789
  var domNode = getPortalNode(props.id);
790
- return /*#__PURE__*/ReactDOM__default['default'].createPortal(props.children, domNode);
790
+ return /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, domNode);
791
791
  };
792
792
 
793
793
  var CurrencyLabel = function CurrencyLabel(props) {
@@ -800,8 +800,8 @@ var CurrencyLabel = function CurrencyLabel(props) {
800
800
 
801
801
  CurrencyLabel.displayName = 'CurrencyLabel';
802
802
  CurrencyLabel.propTypes = process.env.NODE_ENV !== "production" ? {
803
- id: PropTypes__default['default'].string,
804
- children: PropTypes__default['default'].node
803
+ id: PropTypes__default["default"].string,
804
+ children: PropTypes__default["default"].node
805
805
  } : {};
806
806
 
807
807
  var _SingleValue = function SingleValue(_ref3) {
@@ -818,8 +818,8 @@ var _SingleValue = function SingleValue(_ref3) {
818
818
 
819
819
  _SingleValue.displayName = 'SingleValue';
820
820
  _SingleValue.propTypes = process.env.NODE_ENV !== "production" ? {
821
- id: PropTypes__default['default'].string,
822
- children: PropTypes__default['default'].node
821
+ id: PropTypes__default["default"].string,
822
+ children: PropTypes__default["default"].node
823
823
  } : {}; // overwrite styles of createSelectStyles
824
824
 
825
825
  var createCurrencySelectStyles = function createCurrencySelectStyles(_ref4, theme) {
@@ -948,14 +948,15 @@ var parseRawAmountToNumber = function parseRawAmountToNumber(rawAmount, locale)
948
948
  var fractionsSeparator;
949
949
 
950
950
  if (locale) {
951
- fractionsSeparator = 2.5.toLocaleString(locale) // "symbol" for the provided locale
951
+ fractionsSeparator = 2.5 // we need any number with fractions, so that we know what is the fraction
952
+ .toLocaleString(locale) // "symbol" for the provided locale
952
953
  .replace(/\d/g, ''); // then we remove the numbers and keep the "symbol"
953
954
  } else {
954
955
  var _context, _context2;
955
956
 
956
- var lastDot = _lastIndexOfInstanceProperty__default['default'](_context = String(rawAmount)).call(_context, '.');
957
+ var lastDot = _lastIndexOfInstanceProperty__default["default"](_context = String(rawAmount)).call(_context, '.');
957
958
 
958
- var lastComma = _lastIndexOfInstanceProperty__default['default'](_context2 = String(rawAmount)).call(_context2, ',');
959
+ var lastComma = _lastIndexOfInstanceProperty__default["default"](_context2 = String(rawAmount)).call(_context2, ',');
959
960
 
960
961
  fractionsSeparator = lastComma > lastDot ? ',' : '.';
961
962
  }
@@ -966,7 +967,7 @@ var parseRawAmountToNumber = function parseRawAmountToNumber(rawAmount, locale)
966
967
  var normalizedAmount = String(rawAmount).replace(new RegExp("[^0-9".concat(fractionsSeparator, "]"), 'g'), '') // we just keep the numbers and the fraction symbol
967
968
  .replace(fractionsSeparator, '.'); // then we change whatever `fractionsSeparator` was to `.` so we can parse it as float
968
969
 
969
- return _parseFloat__default['default'](normalizedAmount, 10);
970
+ return _parseFloat__default["default"](normalizedAmount, 10);
970
971
  }; // Turns the user input into a value the MoneyInput can pass up through onChange
971
972
  // In case the number of fraction digits contained in "amount" exceeds the
972
973
  // number of fraction digits the currency uses, it will emit a price of
@@ -1001,18 +1002,18 @@ var createMoneyValue = function createMoneyValue(currencyCode, rawAmount, locale
1001
1002
  // to the nearest decimal value
1002
1003
  // ref: https://github.com/commercetools/merchant-center-frontend/pull/770
1003
1004
 
1004
- var centAmount = _Math$trunc__default['default'](Math.round(amountAsNumber * Math.pow(10, currency.fractionDigits)));
1005
+ var centAmount = _Math$trunc__default["default"](Math.round(amountAsNumber * Math.pow(10, currency.fractionDigits)));
1005
1006
 
1006
1007
  var fractionDigitsOfAmount = // The conversion to a string will always use a dot as the separator.
1007
1008
  // That means we don't have to handle a comma.
1008
- _indexOfInstanceProperty__default['default'](_context3 = String(amountAsNumber)).call(_context3, '.') === -1 ? 0 : String(amountAsNumber).length - _indexOfInstanceProperty__default['default'](_context4 = String(amountAsNumber)).call(_context4, '.') - 1;
1009
+ _indexOfInstanceProperty__default["default"](_context3 = String(amountAsNumber)).call(_context3, '.') === -1 ? 0 : String(amountAsNumber).length - _indexOfInstanceProperty__default["default"](_context4 = String(amountAsNumber)).call(_context4, '.') - 1;
1009
1010
 
1010
1011
  if (fractionDigitsOfAmount > currency.fractionDigits) {
1011
1012
  return {
1012
1013
  type: 'highPrecision',
1013
1014
  currencyCode: currencyCode,
1014
1015
  centAmount: centAmount,
1015
- preciseAmount: _parseInt__default['default']( // Here we need to convert a number like 8.066652 to its centamount
1016
+ preciseAmount: _parseInt__default["default"]( // Here we need to convert a number like 8.066652 to its centamount
1016
1017
  // We could do that by multiplying it with 10 ** number-of-fraction-digits
1017
1018
  // but then we'll run into problems with JavaScript's floating point
1018
1019
  // number precision and end up with 8066651.9999999, and then parseInt
@@ -1113,7 +1114,7 @@ var MoneyInput = function MoneyInput(props) {
1113
1114
  var handleAmountBlur = react$1.useCallback(function () {
1114
1115
  var _context5;
1115
1116
 
1116
- var amount = _trimInstanceProperty__default['default'](_context5 = props.value.amount).call(_context5);
1117
+ var amount = _trimInstanceProperty__default["default"](_context5 = props.value.amount).call(_context5);
1117
1118
 
1118
1119
  toggleAmountHasFocus(false); // Skip formatting for empty value or when the input is used with an
1119
1120
  // unknown currency.
@@ -1162,7 +1163,7 @@ var MoneyInput = function MoneyInput(props) {
1162
1163
  // currency's number of fraction digits.
1163
1164
  // When the currency was a high-precision price, then no digits should
1164
1165
  // be lost
1165
- var formattedAmount = formatAmount(_trimInstanceProperty__default['default'](_context6 = props.value.amount).call(_context6), currencyCode, intl.locale); // The user could be changing the currency before entering any amount,
1166
+ var formattedAmount = formatAmount(_trimInstanceProperty__default["default"](_context6 = props.value.amount).call(_context6), currencyCode, intl.locale); // The user could be changing the currency before entering any amount,
1166
1167
  // or while the amount is invalid. In these cases, we don't attempt to
1167
1168
  // format the amount.
1168
1169
 
@@ -1218,7 +1219,7 @@ var MoneyInput = function MoneyInput(props) {
1218
1219
  menuPortalZIndex: props.menuPortalZIndex
1219
1220
  }, theme);
1220
1221
 
1221
- var options = _mapInstanceProperty__default['default'](_context7 = props.currencies).call(_context7, function (currencyCode) {
1222
+ var options = _mapInstanceProperty__default["default"](_context7 = props.currencies).call(_context7, function (currencyCode) {
1222
1223
  return {
1223
1224
  label: currencyCode,
1224
1225
  value: currencyCode
@@ -1228,14 +1229,14 @@ var MoneyInput = function MoneyInput(props) {
1228
1229
  var option = function () {
1229
1230
  var _context8;
1230
1231
 
1231
- var matchedOption = _findInstanceProperty__default['default'](options).call(options, function (optionCandidate) {
1232
+ var matchedOption = _findInstanceProperty__default["default"](options).call(options, function (optionCandidate) {
1232
1233
  return optionCandidate.value === props.value.currencyCode;
1233
1234
  });
1234
1235
 
1235
1236
  if (matchedOption) return matchedOption; // ensure an option is found, even when the currencies don't include
1236
1237
  // the money value's currencyCode
1237
1238
 
1238
- if (_trimInstanceProperty__default['default'](_context8 = props.value.currencyCode).call(_context8) !== '') return {
1239
+ if (_trimInstanceProperty__default["default"](_context8 = props.value.currencyCode).call(_context8) !== '') return {
1239
1240
  label: props.value.currencyCode,
1240
1241
  value: props.value.currencyCode
1241
1242
  };
@@ -1268,7 +1269,7 @@ var MoneyInput = function MoneyInput(props) {
1268
1269
  id: props.id
1269
1270
  }));
1270
1271
  }, [props.id]);
1271
- return jsxRuntime.jsx(Constraints__default['default'].Horizontal, {
1272
+ return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
1272
1273
  max: props.horizontalConstraint,
1273
1274
  children: jsxRuntime.jsxs("div", {
1274
1275
  ref: containerRef,
@@ -1279,7 +1280,7 @@ var MoneyInput = function MoneyInput(props) {
1279
1280
  id: MoneyInput.getAmountInputId(props.id),
1280
1281
  isDisabled: props.isDisabled,
1281
1282
  children: option && option.label
1282
- }) : jsxRuntime.jsx(Select__default['default'], {
1283
+ }) : jsxRuntime.jsx(Select__default["default"], {
1283
1284
  inputId: id,
1284
1285
  name: getCurrencyDropdownName(props.name),
1285
1286
  value: option,
@@ -1341,14 +1342,14 @@ var MoneyInput = function MoneyInput(props) {
1341
1342
  isDisabled: props.isDisabled
1342
1343
  });
1343
1344
  },
1344
- children: jsxRuntime.jsx(Tooltip__default['default'], {
1345
+ children: jsxRuntime.jsx(Tooltip__default["default"], {
1345
1346
  off: props.isDisabled,
1346
1347
  placement: "top-end" // we use negative margin to make up for the padding in the Tooltip Wrapper
1347
1348
  // so that the tooltip is flush with the component
1348
1349
  ,
1349
1350
  styles: {
1350
1351
  body: {
1351
- margin: _concatInstanceProperty__default['default'](_context9 = _concatInstanceProperty__default['default'](_context10 = "".concat(designSystem.customProperties.spacingS, " -")).call(_context10, designSystem.customProperties.spacingXs, " ")).call(_context9, designSystem.customProperties.spacingS, " 0")
1352
+ margin: _concatInstanceProperty__default["default"](_context9 = _concatInstanceProperty__default["default"](_context10 = "".concat(designSystem.customProperties.spacingS, " -")).call(_context10, designSystem.customProperties.spacingXs, " ")).call(_context9, designSystem.customProperties.spacingS, " 0")
1352
1353
  }
1353
1354
  },
1354
1355
  title: intl.formatMessage(messages.highPrecision),
@@ -1374,7 +1375,7 @@ MoneyInput.getCurrencyDropdownId = getCurrencyDropdownName;
1374
1375
  MoneyInput.convertToMoneyValue = function (value, locale) {
1375
1376
  var _context11;
1376
1377
 
1377
- return createMoneyValue(value.currencyCode, typeof value.amount === 'string' ? _trimInstanceProperty__default['default'](_context11 = value.amount).call(_context11) : '', locale);
1378
+ return createMoneyValue(value.currencyCode, typeof value.amount === 'string' ? _trimInstanceProperty__default["default"](_context11 = value.amount).call(_context11) : '', locale);
1378
1379
  };
1379
1380
 
1380
1381
  MoneyInput.parseMoneyValue = function (moneyValue, locale) {
@@ -1385,7 +1386,7 @@ MoneyInput.parseMoneyValue = function (moneyValue, locale) {
1385
1386
  process.env.NODE_ENV !== "production" ? utils.warning(typeof locale === 'string', 'MoneyInput.parseMoneyValue: A locale must be passed as the second argument') : void 0;
1386
1387
  process.env.NODE_ENV !== "production" ? utils.warning(_typeof(moneyValue) === 'object', 'MoneyInput.parseMoneyValue: Value must be passed as an object or be undefined') : void 0;
1387
1388
  process.env.NODE_ENV !== "production" ? utils.warning(typeof moneyValue.currencyCode === 'string', 'MoneyInput.parseMoneyValue: Value must contain "currencyCode"') : void 0;
1388
- process.env.NODE_ENV !== "production" ? utils.warning(has__default['default'](currencies, moneyValue.currencyCode), 'MoneyInput.parseMoneyValue: Value must use known currency code') : void 0;
1389
+ process.env.NODE_ENV !== "production" ? utils.warning(has__default["default"](currencies, moneyValue.currencyCode), 'MoneyInput.parseMoneyValue: Value must use known currency code') : void 0;
1389
1390
  process.env.NODE_ENV !== "production" ? utils.warning( // highPrecision or centPrecision values must be set
1390
1391
  typeof moneyValue.centAmount === 'number' || typeof moneyValue.preciseAmount === 'number' && typeof moneyValue.fractionDigits === 'number', 'MoneyInput.parseMoneyValue: Value must contain "amount"') : void 0;
1391
1392
  var amount = formatAmount(getAmountAsNumberFromMoneyValue(moneyValue).toLocaleString(locale, {
@@ -1400,7 +1401,7 @@ MoneyInput.parseMoneyValue = function (moneyValue, locale) {
1400
1401
  MoneyInput.isEmpty = function (formValue) {
1401
1402
  var _context12, _context13;
1402
1403
 
1403
- return !formValue || _trimInstanceProperty__default['default'](_context12 = formValue.amount).call(_context12) === '' || _trimInstanceProperty__default['default'](_context13 = formValue.currencyCode).call(_context13) === '';
1404
+ return !formValue || _trimInstanceProperty__default["default"](_context12 = formValue.amount).call(_context12) === '' || _trimInstanceProperty__default["default"](_context13 = formValue.currencyCode).call(_context13) === '';
1404
1405
  };
1405
1406
 
1406
1407
  MoneyInput.isHighPrecision = function (formValue, locale) {
@@ -1417,104 +1418,104 @@ MoneyInput.propTypes = process.env.NODE_ENV !== "production" ? {
1417
1418
  /**
1418
1419
  * Used as HTML id property. An id is auto-generated when it is not specified.
1419
1420
  */
1420
- id: PropTypes__default['default'].string,
1421
+ id: PropTypes__default["default"].string,
1421
1422
 
1422
1423
  /**
1423
1424
  * Used as HTML `autocomplete` property
1424
1425
  */
1425
- autoComplete: PropTypes__default['default'].string,
1426
+ autoComplete: PropTypes__default["default"].string,
1426
1427
 
1427
1428
  /**
1428
1429
  * The prefix used to create a HTML `name` property for the amount input field (`${name}.amount`) and the currency dropdown (`${name}.currencyCode`).
1429
1430
  */
1430
- name: PropTypes__default['default'].string,
1431
+ name: PropTypes__default["default"].string,
1431
1432
 
1432
1433
  /**
1433
1434
  * Value of the input. Consists of the currency code and an amount. `amount` is a string representing the amount. A dot has to be used as the decimal separator.
1434
1435
  */
1435
- value: PropTypes__default['default'].shape({
1436
- amount: PropTypes__default['default'].string.isRequired,
1437
- currencyCode: PropTypes__default['default'].string.isRequired
1436
+ value: PropTypes__default["default"].shape({
1437
+ amount: PropTypes__default["default"].string.isRequired,
1438
+ currencyCode: PropTypes__default["default"].string.isRequired
1438
1439
  }).isRequired,
1439
1440
 
1440
1441
  /**
1441
1442
  * List of possible currencies. When not provided or empty, the component renders a label with the value's currency instead of a dropdown.
1442
1443
  */
1443
- currencies: PropTypes__default['default'].arrayOf(PropTypes__default['default'].string).isRequired,
1444
+ currencies: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string).isRequired,
1444
1445
 
1445
1446
  /**
1446
1447
  * Placeholder text for the input
1447
1448
  */
1448
- placeholder: PropTypes__default['default'].string,
1449
+ placeholder: PropTypes__default["default"].string,
1449
1450
 
1450
1451
  /**
1451
1452
  * Called when input is blurred
1452
1453
  */
1453
- onBlur: PropTypes__default['default'].func,
1454
+ onBlur: PropTypes__default["default"].func,
1454
1455
 
1455
1456
  /**
1456
1457
  * Called when input is focused
1457
1458
  */
1458
- onFocus: PropTypes__default['default'].func,
1459
+ onFocus: PropTypes__default["default"].func,
1459
1460
 
1460
1461
  /**
1461
1462
  * Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
1462
1463
  */
1463
- isDisabled: PropTypes__default['default'].bool,
1464
+ isDisabled: PropTypes__default["default"].bool,
1464
1465
 
1465
1466
  /**
1466
1467
  * Indicates that the field is displaying read-only content
1467
1468
  */
1468
- isReadOnly: PropTypes__default['default'].bool,
1469
+ isReadOnly: PropTypes__default["default"].bool,
1469
1470
 
1470
1471
  /**
1471
1472
  * Focus the input on initial render
1472
1473
  */
1473
- isAutofocussed: PropTypes__default['default'].bool,
1474
+ isAutofocussed: PropTypes__default["default"].bool,
1474
1475
 
1475
1476
  /**
1476
1477
  * Called with the event of the input or dropdown when either the currency or the amount have changed.
1477
1478
  * <br />
1478
1479
  * Signature: `(event) => void`
1479
1480
  */
1480
- onChange: requiredIf__default['default'](PropTypes__default['default'].func, function (props) {
1481
+ onChange: requiredIf__default["default"](PropTypes__default["default"].func, function (props) {
1481
1482
  return !props.isReadOnly;
1482
1483
  }),
1483
1484
 
1484
1485
  /**
1485
1486
  * Dom element to portal the currency select menu to
1486
1487
  */
1487
- menuPortalTarget: PropTypes__default['default'].instanceOf(utils.SafeHTMLElement),
1488
+ menuPortalTarget: PropTypes__default["default"].instanceOf(utils.SafeHTMLElement),
1488
1489
 
1489
1490
  /**
1490
1491
  * z-index value for the currency select menu portal
1491
1492
  */
1492
- menuPortalZIndex: PropTypes__default['default'].number,
1493
+ menuPortalZIndex: PropTypes__default["default"].number,
1493
1494
 
1494
1495
  /**
1495
1496
  * whether the menu should block scroll while open
1496
1497
  */
1497
- menuShouldBlockScroll: PropTypes__default['default'].bool,
1498
+ menuShouldBlockScroll: PropTypes__default["default"].bool,
1498
1499
 
1499
1500
  /**
1500
1501
  * Indicates that input has errors
1501
1502
  */
1502
- hasError: PropTypes__default['default'].bool,
1503
+ hasError: PropTypes__default["default"].bool,
1503
1504
 
1504
1505
  /**
1505
1506
  * Control to indicate on the input if there are selected values that are potentially invalid
1506
1507
  */
1507
- hasWarning: PropTypes__default['default'].bool,
1508
+ hasWarning: PropTypes__default["default"].bool,
1508
1509
 
1509
1510
  /**
1510
1511
  * Shows high precision badge in case current value uses high precision.
1511
1512
  */
1512
- hasHighPrecisionBadge: PropTypes__default['default'].bool,
1513
+ hasHighPrecisionBadge: PropTypes__default["default"].bool,
1513
1514
 
1514
1515
  /**
1515
1516
  * Horizontal size limit of the input fields.
1516
1517
  */
1517
- horizontalConstraint: PropTypes__default['default'].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
1518
+ horizontalConstraint: PropTypes__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
1518
1519
  } : {};
1519
1520
  MoneyInput.defaultProps = {
1520
1521
  currencies: [],
@@ -1523,8 +1524,8 @@ MoneyInput.defaultProps = {
1523
1524
  };
1524
1525
  var MoneyInput$1 = MoneyInput;
1525
1526
 
1526
- // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
1527
- var version = '12.2.3';
1527
+ // NOTE: This string will be replaced on build time with the package version.
1528
+ var version = "12.2.7";
1528
1529
 
1529
- exports['default'] = MoneyInput$1;
1530
+ exports["default"] = MoneyInput$1;
1530
1531
  exports.version = version;
@@ -753,11 +753,11 @@ var messages = reactIntl.defineMessages({
753
753
 
754
754
  var _excluded = ["id"];
755
755
 
756
- function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
756
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
757
757
 
758
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context14; _forEachInstanceProperty__default['default'](_context14 = ownKeys(Object(source), true)).call(_context14, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context15; _forEachInstanceProperty__default['default'](_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
758
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context14; _forEachInstanceProperty__default["default"](_context14 = ownKeys(Object(source), true)).call(_context14, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context15; _forEachInstanceProperty__default["default"](_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
759
759
 
760
- var TooltipWrapper = _styled__default['default']("div", {
760
+ var TooltipWrapper = _styled__default["default"]("div", {
761
761
  target: "elvjg270"
762
762
  } )({
763
763
  name: "zjik7",
@@ -774,7 +774,7 @@ var getPortalNode = function getPortalNode(id) {
774
774
 
775
775
  var Portal = function Portal(props) {
776
776
  var domNode = getPortalNode(props.id);
777
- return /*#__PURE__*/ReactDOM__default['default'].createPortal(props.children, domNode);
777
+ return /*#__PURE__*/ReactDOM__default["default"].createPortal(props.children, domNode);
778
778
  };
779
779
 
780
780
  var CurrencyLabel = function CurrencyLabel(props) {
@@ -929,14 +929,15 @@ var parseRawAmountToNumber = function parseRawAmountToNumber(rawAmount, locale)
929
929
  var fractionsSeparator;
930
930
 
931
931
  if (locale) {
932
- fractionsSeparator = 2.5.toLocaleString(locale) // "symbol" for the provided locale
932
+ fractionsSeparator = 2.5 // we need any number with fractions, so that we know what is the fraction
933
+ .toLocaleString(locale) // "symbol" for the provided locale
933
934
  .replace(/\d/g, ''); // then we remove the numbers and keep the "symbol"
934
935
  } else {
935
936
  var _context, _context2;
936
937
 
937
- var lastDot = _lastIndexOfInstanceProperty__default['default'](_context = String(rawAmount)).call(_context, '.');
938
+ var lastDot = _lastIndexOfInstanceProperty__default["default"](_context = String(rawAmount)).call(_context, '.');
938
939
 
939
- var lastComma = _lastIndexOfInstanceProperty__default['default'](_context2 = String(rawAmount)).call(_context2, ',');
940
+ var lastComma = _lastIndexOfInstanceProperty__default["default"](_context2 = String(rawAmount)).call(_context2, ',');
940
941
 
941
942
  fractionsSeparator = lastComma > lastDot ? ',' : '.';
942
943
  }
@@ -947,7 +948,7 @@ var parseRawAmountToNumber = function parseRawAmountToNumber(rawAmount, locale)
947
948
  var normalizedAmount = String(rawAmount).replace(new RegExp("[^0-9".concat(fractionsSeparator, "]"), 'g'), '') // we just keep the numbers and the fraction symbol
948
949
  .replace(fractionsSeparator, '.'); // then we change whatever `fractionsSeparator` was to `.` so we can parse it as float
949
950
 
950
- return _parseFloat__default['default'](normalizedAmount, 10);
951
+ return _parseFloat__default["default"](normalizedAmount, 10);
951
952
  }; // Turns the user input into a value the MoneyInput can pass up through onChange
952
953
  // In case the number of fraction digits contained in "amount" exceeds the
953
954
  // number of fraction digits the currency uses, it will emit a price of
@@ -981,18 +982,18 @@ var createMoneyValue = function createMoneyValue(currencyCode, rawAmount, locale
981
982
  // to the nearest decimal value
982
983
  // ref: https://github.com/commercetools/merchant-center-frontend/pull/770
983
984
 
984
- var centAmount = _Math$trunc__default['default'](Math.round(amountAsNumber * Math.pow(10, currency.fractionDigits)));
985
+ var centAmount = _Math$trunc__default["default"](Math.round(amountAsNumber * Math.pow(10, currency.fractionDigits)));
985
986
 
986
987
  var fractionDigitsOfAmount = // The conversion to a string will always use a dot as the separator.
987
988
  // That means we don't have to handle a comma.
988
- _indexOfInstanceProperty__default['default'](_context3 = String(amountAsNumber)).call(_context3, '.') === -1 ? 0 : String(amountAsNumber).length - _indexOfInstanceProperty__default['default'](_context4 = String(amountAsNumber)).call(_context4, '.') - 1;
989
+ _indexOfInstanceProperty__default["default"](_context3 = String(amountAsNumber)).call(_context3, '.') === -1 ? 0 : String(amountAsNumber).length - _indexOfInstanceProperty__default["default"](_context4 = String(amountAsNumber)).call(_context4, '.') - 1;
989
990
 
990
991
  if (fractionDigitsOfAmount > currency.fractionDigits) {
991
992
  return {
992
993
  type: 'highPrecision',
993
994
  currencyCode: currencyCode,
994
995
  centAmount: centAmount,
995
- preciseAmount: _parseInt__default['default']( // Here we need to convert a number like 8.066652 to its centamount
996
+ preciseAmount: _parseInt__default["default"]( // Here we need to convert a number like 8.066652 to its centamount
996
997
  // We could do that by multiplying it with 10 ** number-of-fraction-digits
997
998
  // but then we'll run into problems with JavaScript's floating point
998
999
  // number precision and end up with 8066651.9999999, and then parseInt
@@ -1083,7 +1084,7 @@ var MoneyInput = function MoneyInput(props) {
1083
1084
  var handleAmountBlur = react$1.useCallback(function () {
1084
1085
  var _context5;
1085
1086
 
1086
- var amount = _trimInstanceProperty__default['default'](_context5 = props.value.amount).call(_context5);
1087
+ var amount = _trimInstanceProperty__default["default"](_context5 = props.value.amount).call(_context5);
1087
1088
 
1088
1089
  toggleAmountHasFocus(false); // Skip formatting for empty value or when the input is used with an
1089
1090
  // unknown currency.
@@ -1132,7 +1133,7 @@ var MoneyInput = function MoneyInput(props) {
1132
1133
  // currency's number of fraction digits.
1133
1134
  // When the currency was a high-precision price, then no digits should
1134
1135
  // be lost
1135
- var formattedAmount = formatAmount(_trimInstanceProperty__default['default'](_context6 = props.value.amount).call(_context6), currencyCode, intl.locale); // The user could be changing the currency before entering any amount,
1136
+ var formattedAmount = formatAmount(_trimInstanceProperty__default["default"](_context6 = props.value.amount).call(_context6), currencyCode, intl.locale); // The user could be changing the currency before entering any amount,
1136
1137
  // or while the amount is invalid. In these cases, we don't attempt to
1137
1138
  // format the amount.
1138
1139
 
@@ -1188,7 +1189,7 @@ var MoneyInput = function MoneyInput(props) {
1188
1189
  menuPortalZIndex: props.menuPortalZIndex
1189
1190
  }, theme);
1190
1191
 
1191
- var options = _mapInstanceProperty__default['default'](_context7 = props.currencies).call(_context7, function (currencyCode) {
1192
+ var options = _mapInstanceProperty__default["default"](_context7 = props.currencies).call(_context7, function (currencyCode) {
1192
1193
  return {
1193
1194
  label: currencyCode,
1194
1195
  value: currencyCode
@@ -1198,14 +1199,14 @@ var MoneyInput = function MoneyInput(props) {
1198
1199
  var option = function () {
1199
1200
  var _context8;
1200
1201
 
1201
- var matchedOption = _findInstanceProperty__default['default'](options).call(options, function (optionCandidate) {
1202
+ var matchedOption = _findInstanceProperty__default["default"](options).call(options, function (optionCandidate) {
1202
1203
  return optionCandidate.value === props.value.currencyCode;
1203
1204
  });
1204
1205
 
1205
1206
  if (matchedOption) return matchedOption; // ensure an option is found, even when the currencies don't include
1206
1207
  // the money value's currencyCode
1207
1208
 
1208
- if (_trimInstanceProperty__default['default'](_context8 = props.value.currencyCode).call(_context8) !== '') return {
1209
+ if (_trimInstanceProperty__default["default"](_context8 = props.value.currencyCode).call(_context8) !== '') return {
1209
1210
  label: props.value.currencyCode,
1210
1211
  value: props.value.currencyCode
1211
1212
  };
@@ -1238,7 +1239,7 @@ var MoneyInput = function MoneyInput(props) {
1238
1239
  id: props.id
1239
1240
  }));
1240
1241
  }, [props.id]);
1241
- return jsxRuntime.jsx(Constraints__default['default'].Horizontal, {
1242
+ return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
1242
1243
  max: props.horizontalConstraint,
1243
1244
  children: jsxRuntime.jsxs("div", {
1244
1245
  ref: containerRef,
@@ -1249,7 +1250,7 @@ var MoneyInput = function MoneyInput(props) {
1249
1250
  id: MoneyInput.getAmountInputId(props.id),
1250
1251
  isDisabled: props.isDisabled,
1251
1252
  children: option && option.label
1252
- }) : jsxRuntime.jsx(Select__default['default'], {
1253
+ }) : jsxRuntime.jsx(Select__default["default"], {
1253
1254
  inputId: id,
1254
1255
  name: getCurrencyDropdownName(props.name),
1255
1256
  value: option,
@@ -1311,14 +1312,14 @@ var MoneyInput = function MoneyInput(props) {
1311
1312
  isDisabled: props.isDisabled
1312
1313
  });
1313
1314
  },
1314
- children: jsxRuntime.jsx(Tooltip__default['default'], {
1315
+ children: jsxRuntime.jsx(Tooltip__default["default"], {
1315
1316
  off: props.isDisabled,
1316
1317
  placement: "top-end" // we use negative margin to make up for the padding in the Tooltip Wrapper
1317
1318
  // so that the tooltip is flush with the component
1318
1319
  ,
1319
1320
  styles: {
1320
1321
  body: {
1321
- margin: _concatInstanceProperty__default['default'](_context9 = _concatInstanceProperty__default['default'](_context10 = "".concat(designSystem.customProperties.spacingS, " -")).call(_context10, designSystem.customProperties.spacingXs, " ")).call(_context9, designSystem.customProperties.spacingS, " 0")
1322
+ margin: _concatInstanceProperty__default["default"](_context9 = _concatInstanceProperty__default["default"](_context10 = "".concat(designSystem.customProperties.spacingS, " -")).call(_context10, designSystem.customProperties.spacingXs, " ")).call(_context9, designSystem.customProperties.spacingS, " 0")
1322
1323
  }
1323
1324
  },
1324
1325
  title: intl.formatMessage(messages.highPrecision),
@@ -1344,7 +1345,7 @@ MoneyInput.getCurrencyDropdownId = getCurrencyDropdownName;
1344
1345
  MoneyInput.convertToMoneyValue = function (value, locale) {
1345
1346
  var _context11;
1346
1347
 
1347
- return createMoneyValue(value.currencyCode, typeof value.amount === 'string' ? _trimInstanceProperty__default['default'](_context11 = value.amount).call(_context11) : '', locale);
1348
+ return createMoneyValue(value.currencyCode, typeof value.amount === 'string' ? _trimInstanceProperty__default["default"](_context11 = value.amount).call(_context11) : '', locale);
1348
1349
  };
1349
1350
 
1350
1351
  MoneyInput.parseMoneyValue = function (moneyValue, locale) {
@@ -1364,7 +1365,7 @@ MoneyInput.parseMoneyValue = function (moneyValue, locale) {
1364
1365
  MoneyInput.isEmpty = function (formValue) {
1365
1366
  var _context12, _context13;
1366
1367
 
1367
- return !formValue || _trimInstanceProperty__default['default'](_context12 = formValue.amount).call(_context12) === '' || _trimInstanceProperty__default['default'](_context13 = formValue.currencyCode).call(_context13) === '';
1368
+ return !formValue || _trimInstanceProperty__default["default"](_context12 = formValue.amount).call(_context12) === '' || _trimInstanceProperty__default["default"](_context13 = formValue.currencyCode).call(_context13) === '';
1368
1369
  };
1369
1370
 
1370
1371
  MoneyInput.isHighPrecision = function (formValue, locale) {
@@ -1384,8 +1385,8 @@ MoneyInput.defaultProps = {
1384
1385
  };
1385
1386
  var MoneyInput$1 = MoneyInput;
1386
1387
 
1387
- // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
1388
- var version = '12.2.3';
1388
+ // NOTE: This string will be replaced on build time with the package version.
1389
+ var version = "12.2.7";
1389
1390
 
1390
- exports['default'] = MoneyInput$1;
1391
+ exports["default"] = MoneyInput$1;
1391
1392
  exports.version = version;
@@ -916,7 +916,8 @@ var parseRawAmountToNumber = function parseRawAmountToNumber(rawAmount, locale)
916
916
  var fractionsSeparator;
917
917
 
918
918
  if (locale) {
919
- fractionsSeparator = 2.5.toLocaleString(locale) // "symbol" for the provided locale
919
+ fractionsSeparator = 2.5 // we need any number with fractions, so that we know what is the fraction
920
+ .toLocaleString(locale) // "symbol" for the provided locale
920
921
  .replace(/\d/g, ''); // then we remove the numbers and keep the "symbol"
921
922
  } else {
922
923
  var _context, _context2;
@@ -1491,7 +1492,7 @@ MoneyInput.defaultProps = {
1491
1492
  };
1492
1493
  var MoneyInput$1 = MoneyInput;
1493
1494
 
1494
- // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
1495
- var version = '12.2.3';
1495
+ // NOTE: This string will be replaced on build time with the package version.
1496
+ var version = "12.2.7";
1496
1497
 
1497
1498
  export { MoneyInput$1 as default, version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/money-input",
3
3
  "description": "A controlled input component for money values with validation states.",
4
- "version": "12.2.3",
4
+ "version": "12.2.7",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -11,7 +11,6 @@
11
11
  "homepage": "https://uikit.commercetools.com",
12
12
  "keywords": ["javascript", "design system", "react", "uikit"],
13
13
  "license": "MIT",
14
- "private": false,
15
14
  "publishConfig": {
16
15
  "access": "public"
17
16
  },
@@ -19,20 +18,17 @@
19
18
  "main": "dist/commercetools-uikit-money-input.cjs.js",
20
19
  "module": "dist/commercetools-uikit-money-input.esm.js",
21
20
  "files": ["dist"],
22
- "scripts": {
23
- "prepare": "../../../../scripts/version.js replace"
24
- },
25
21
  "dependencies": {
26
- "@babel/runtime": "7.14.8",
27
- "@babel/runtime-corejs3": "7.14.9",
28
- "@commercetools-uikit/constraints": "12.2.3",
29
- "@commercetools-uikit/design-system": "12.2.3",
30
- "@commercetools-uikit/hooks": "12.2.3",
31
- "@commercetools-uikit/icons": "12.2.3",
32
- "@commercetools-uikit/input-utils": "12.2.3",
33
- "@commercetools-uikit/select-utils": "12.2.3",
34
- "@commercetools-uikit/tooltip": "12.2.3",
35
- "@commercetools-uikit/utils": "12.2.0",
22
+ "@babel/runtime": "7.16.3",
23
+ "@babel/runtime-corejs3": "7.16.3",
24
+ "@commercetools-uikit/constraints": "12.2.5",
25
+ "@commercetools-uikit/design-system": "12.2.5",
26
+ "@commercetools-uikit/hooks": "12.2.5",
27
+ "@commercetools-uikit/icons": "12.2.7",
28
+ "@commercetools-uikit/input-utils": "12.2.7",
29
+ "@commercetools-uikit/select-utils": "12.2.7",
30
+ "@commercetools-uikit/tooltip": "12.2.5",
31
+ "@commercetools-uikit/utils": "12.2.5",
36
32
  "@emotion/react": "^11.4.0",
37
33
  "@emotion/styled": "^11.3.0",
38
34
  "lodash": "4.17.21",
@@ -43,7 +39,7 @@
43
39
  "devDependencies": {
44
40
  "react": "17.0.2",
45
41
  "react-dom": "17.0.2",
46
- "react-intl": "5.20.7"
42
+ "react-intl": "5.21.2"
47
43
  },
48
44
  "peerDependencies": {
49
45
  "react": "17.x",