intelicoreact 1.3.12 → 1.3.13

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.
@@ -36,7 +36,7 @@ var InputCurrency = function InputCurrency(_ref) {
36
36
  max = _ref.max,
37
37
  error = _ref.error;
38
38
 
39
- var _useState = (0, _react.useState)(value || currencySymbol || '$'),
39
+ var _useState = (0, _react.useState)(currencySymbol || '$'),
40
40
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
41
41
  inputValue = _useState2[0],
42
42
  setInputValue = _useState2[1];
@@ -68,10 +68,10 @@ var InputCurrency = function InputCurrency(_ref) {
68
68
  }
69
69
  };
70
70
 
71
- var checkMinMax = function checkMinMax(event) {
71
+ var checkMinMax = function checkMinMax(event, value) {
72
72
  var _event$target, _event$target$value;
73
73
 
74
- var clearValue = 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, '');
74
+ var 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
75
  if (!clearValue) return false;
76
76
 
77
77
  if (clearValue < min) {
@@ -86,10 +86,12 @@ var InputCurrency = function InputCurrency(_ref) {
86
86
  };
87
87
 
88
88
  (0, _react.useEffect)(function () {
89
- if (value) {
90
- setInputValue("".concat(currencySymbol || '$').concat(value));
89
+ var _inputValue$toString;
90
+
91
+ if (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, ''))) {
92
+ checkMinMax(null, value);
91
93
  }
92
- }, []);
94
+ }, [value]);
93
95
  return /*#__PURE__*/_react.default.createElement("div", {
94
96
  className: (0, _classnames.default)('input-currency-box', className, {
95
97
  disabled: disabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.3.12",
3
+ "version": "1.3.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [