linear-react-components-ui 1.0.17-beta.1 → 1.0.17-beta.3

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.
@@ -82,6 +82,7 @@ interface IFieldProps extends WithFieldProps {
82
82
  autoFocus?: boolean;
83
83
  autoCompleteMask?: 'left' | 'right';
84
84
  mask?: string;
85
+ removeZeroLeft?: boolean;
85
86
  }
86
87
  interface CustomEvent {
87
88
  target: {
@@ -38,7 +38,9 @@ var NumberField = function NumberField(props) {
38
38
  min = props.min,
39
39
  max = props.max,
40
40
  _props$value = props.value,
41
- value = _props$value === void 0 ? '' : _props$value;
41
+ value = _props$value === void 0 ? '' : _props$value,
42
+ _props$removeZeroLeft = props.removeZeroLeft,
43
+ removeZeroLeft = _props$removeZeroLeft === void 0 ? true : _props$removeZeroLeft;
42
44
  var _useState = (0, _react.useState)(value === null || value === void 0 ? void 0 : value.toString()),
43
45
  _useState2 = _slicedToArray(_useState, 2),
44
46
  numberValue = _useState2[0],
@@ -50,8 +52,12 @@ var NumberField = function NumberField(props) {
50
52
  if (min && parseInt(numericValue, 10) < min || max && parseInt(numericValue, 10) > max) {
51
53
  return;
52
54
  }
55
+ if (removeZeroLeft && numericValue.charAt(0) === '0' && numericValue.length > 1) {
56
+ setNumberValue(numericValue.substring(1));
57
+ } else {
58
+ setNumberValue(numericValue);
59
+ }
53
60
  if (props.onChange) props.onChange(event);
54
- setNumberValue(numericValue);
55
61
  }
56
62
  };
57
63
  (0, _react.useEffect)(function () {
@@ -12,6 +12,7 @@ import '../../icons/helper.js';
12
12
 
13
13
  interface INumberFieldProps extends IMaskHOCProps {
14
14
  onChange?: (e?: CustomInputEvent) => void;
15
+ removeZeroLeft?: boolean;
15
16
  }
16
17
  interface IBaseNumberProps extends IMaskHOCProps {
17
18
  returnFormattedValueOnBlur?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.0.17-beta.1",
3
+ "version": "1.0.17-beta.3",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",