intelicoreact 1.3.67 → 1.3.68

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.
@@ -50,10 +50,11 @@ const InputCurrency = _ref => {
50
50
  const formatCurrencyInput = event => {
51
51
  let newValue = event.target.value;
52
52
  newValue = newValue.replace(currencySymbol, "");
53
- newValue = formatNumberWithCommas((0, _fieldValueFormatters.filterNumeric)(newValue, onlyNumbers));
53
+ const preparedValue = (0, _fieldValueFormatters.filterNumeric)(newValue, onlyNumbers);
54
+ newValue = formatNumberWithCommas(preparedValue);
54
55
  newValue = "".concat(currencySymbol).concat(newValue);
55
56
  setInputValue(newValue);
56
- onChange(newValue.replace(/[^0-9]/g, ""));
57
+ if (value !== parseFloat(preparedValue)) onChange(!isNaN(parseFloat(preparedValue)) ? parseFloat(preparedValue) : "");
57
58
  };
58
59
 
59
60
  const onInputClick = () => {
@@ -69,9 +70,9 @@ const InputCurrency = _ref => {
69
70
  };
70
71
 
71
72
  const checkMinMax = (event, value) => {
72
- var _event$target, _event$target$value;
73
+ var _event$target;
73
74
 
74
- const clearValue = value !== null && value !== void 0 ? value : event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$value = _event$target.value) === null || _event$target$value === void 0 ? void 0 : _event$target$value.replace(/[^0-9]/g, "");
75
+ const clearValue = value !== null && value !== void 0 ? value : (0, _fieldValueFormatters.filterNumeric)(event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.value, onlyNumbers);
75
76
  if (!clearValue) return false;
76
77
 
77
78
  if (clearValue < min) {
@@ -90,9 +91,7 @@ const InputCurrency = _ref => {
90
91
  };
91
92
 
92
93
  (0, _react.useEffect)(() => {
93
- var _inputValue$toString;
94
-
95
- if (value && value.toString() !== (inputValue === null || inputValue === void 0 ? void 0 : (_inputValue$toString = inputValue.toString()) === null || _inputValue$toString === void 0 ? void 0 : _inputValue$toString.replace(/[^0-9]/g, ""))) {
94
+ if (value && parseFloat(value) !== parseFloat((0, _fieldValueFormatters.filterNumeric)(inputValue, onlyNumbers))) {
96
95
  if (checkMinMax(null, value)) setInputValue("".concat(currencySymbol).concat(formatNumberWithCommas(value)));
97
96
  }
98
97
  }, [value]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.3.67",
3
+ "version": "1.3.68",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [