@true-engineering/true-react-common-ui-kit 1.4.0 → 1.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.
- package/dist/components/FiltersPane/FilterMultiSelect/FilterMultiSelect.d.ts +0 -1
- package/dist/components/FiltersPane/FilterValueView/FilterValueView.d.ts +0 -1
- package/dist/components/FiltersPane/FiltersPane.d.ts +0 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +0 -1
- package/dist/components/NumberInput/NumberInput.d.ts +5 -4
- package/dist/components/NumberInput/helpers.d.ts +2 -0
- package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/true-react-common-ui-kit.js +19 -7
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +19 -7
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/NumberInput/NumberInput.stories.tsx +1 -0
- package/src/components/NumberInput/NumberInput.tsx +30 -18
- package/src/components/NumberInput/helpers.ts +19 -0
- package/src/index.ts +1 -0
- package/src/types.ts +106 -106
|
@@ -10235,6 +10235,13 @@
|
|
|
10235
10235
|
var val = formatNumber(value);
|
|
10236
10236
|
return isNotEmpty(val) ? val : formatNumber(defaultValue);
|
|
10237
10237
|
};
|
|
10238
|
+
var constructRegExp = function(param) {
|
|
10239
|
+
var canBeFloat = param.canBeFloat, canBeNegative = param.canBeNegative, intPartPrecision = param.intPartPrecision, precision = param.precision;
|
|
10240
|
+
var basePart = "\\d{0,".concat(intPartPrecision, "}");
|
|
10241
|
+
var floatPart = "(\\.\\d{0,".concat(precision, "})?");
|
|
10242
|
+
var negativePart = "(\\-)?";
|
|
10243
|
+
return "^".concat(canBeNegative ? negativePart : "").concat(basePart).concat(canBeFloat ? floatPart : "", "$");
|
|
10244
|
+
};
|
|
10238
10245
|
function _array_like_to_array$e(arr, len) {
|
|
10239
10246
|
if (len == null || len > arr.length)
|
|
10240
10247
|
len = arr.length;
|
|
@@ -10485,9 +10492,10 @@
|
|
|
10485
10492
|
}
|
|
10486
10493
|
};
|
|
10487
10494
|
var NumberInput = /* @__PURE__ */ React.forwardRef(function(_param, ref) {
|
|
10488
|
-
var value = _param.value, _param_canBeFloat = _param.canBeFloat, canBeFloat = _param_canBeFloat === void 0 ? false : _param_canBeFloat, defaultValue = _param.defaultValue, _param_precision = _param.precision, precision = _param_precision === void 0 ? 3 : _param_precision, _param_intPartPrecision = _param.intPartPrecision, intPartPrecision = _param_intPartPrecision === void 0 ? 7 : _param_intPartPrecision, onChange = _param.onChange, onBlur = _param.onBlur, min2 = _param.min, max2 = _param.max, props = _object_without_properties$3(_param, [
|
|
10495
|
+
var value = _param.value, _param_canBeFloat = _param.canBeFloat, canBeFloat = _param_canBeFloat === void 0 ? false : _param_canBeFloat, _param_canBeNegative = _param.canBeNegative, canBeNegative = _param_canBeNegative === void 0 ? false : _param_canBeNegative, defaultValue = _param.defaultValue, _param_precision = _param.precision, precision = _param_precision === void 0 ? 3 : _param_precision, _param_intPartPrecision = _param.intPartPrecision, intPartPrecision = _param_intPartPrecision === void 0 ? 7 : _param_intPartPrecision, onChange = _param.onChange, onBlur = _param.onBlur, min2 = _param.min, max2 = _param.max, props = _object_without_properties$3(_param, [
|
|
10489
10496
|
"value",
|
|
10490
10497
|
"canBeFloat",
|
|
10498
|
+
"canBeNegative",
|
|
10491
10499
|
"defaultValue",
|
|
10492
10500
|
"precision",
|
|
10493
10501
|
"intPartPrecision",
|
|
@@ -10508,7 +10516,7 @@
|
|
|
10508
10516
|
};
|
|
10509
10517
|
var handleChange = function() {
|
|
10510
10518
|
var _ref = _async_to_generator$2(function(inputValue, event) {
|
|
10511
|
-
var oldValue, target, _target_selectionStart, defaultCaretPos, numString,
|
|
10519
|
+
var oldValue, target, _target_selectionStart, defaultCaretPos, numString, numberRegexp, hasDot, formattedValue, newValue;
|
|
10512
10520
|
return __generator$2(this, function(_state) {
|
|
10513
10521
|
switch (_state.label) {
|
|
10514
10522
|
case 0:
|
|
@@ -10523,10 +10531,13 @@
|
|
|
10523
10531
|
2
|
|
10524
10532
|
];
|
|
10525
10533
|
}
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10534
|
+
numberRegexp = new RegExp(constructRegExp({
|
|
10535
|
+
precision,
|
|
10536
|
+
intPartPrecision,
|
|
10537
|
+
canBeNegative,
|
|
10538
|
+
canBeFloat
|
|
10539
|
+
}));
|
|
10540
|
+
if (!!numberRegexp.test(numString))
|
|
10530
10541
|
return [
|
|
10531
10542
|
3,
|
|
10532
10543
|
2
|
|
@@ -10542,7 +10553,7 @@
|
|
|
10542
10553
|
2
|
|
10543
10554
|
];
|
|
10544
10555
|
case 2:
|
|
10545
|
-
hasDot = canBeFloat &&
|
|
10556
|
+
hasDot = canBeFloat && /^[-]*[\d\s]*[.,]$/.test(inputValue);
|
|
10546
10557
|
formattedValue = formatStringNumber(numString);
|
|
10547
10558
|
newValue = hasDot ? "".concat(formattedValue, ".") : formattedValue;
|
|
10548
10559
|
return [
|
|
@@ -27130,6 +27141,7 @@
|
|
|
27130
27141
|
exports2.minWidthModifier = minWidthModifier;
|
|
27131
27142
|
exports2.phoneInfo = phoneInfo;
|
|
27132
27143
|
exports2.removeStringFormat = removeStringFormat;
|
|
27144
|
+
exports2.renderIcon = renderIcon;
|
|
27133
27145
|
exports2.rgba = rgba;
|
|
27134
27146
|
exports2.setCaretPosition = setCaretPosition;
|
|
27135
27147
|
exports2.sortCountriesByLocale = sortCountriesByLocale;
|