@alfalab/core-components-number-input 1.3.0 → 2.0.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.
Files changed (90) hide show
  1. package/Component.desktop.d.ts +1 -1
  2. package/Component.desktop.js +9 -1
  3. package/Component.mobile.d.ts +1 -1
  4. package/Component.mobile.js +9 -1
  5. package/Component.responsive.d.ts +1 -1
  6. package/Component.responsive.js +14 -1
  7. package/components/number-input/Component.d.ts +21 -46
  8. package/components/number-input/Component.js +87 -84
  9. package/components/number-input/index.css +30 -0
  10. package/components/number-input/index.js +8 -0
  11. package/components/steppers/Component.d.ts +14 -0
  12. package/components/steppers/Component.js +33 -0
  13. package/components/steppers/index.css +32 -0
  14. package/components/steppers/index.d.ts +1 -0
  15. package/components/steppers/index.js +15 -0
  16. package/cssm/Component.desktop.d.ts +1 -1
  17. package/cssm/Component.desktop.js +11 -1
  18. package/cssm/Component.mobile.d.ts +1 -1
  19. package/cssm/Component.mobile.js +11 -1
  20. package/cssm/Component.responsive.d.ts +1 -1
  21. package/cssm/Component.responsive.js +16 -1
  22. package/cssm/components/number-input/Component.d.ts +21 -46
  23. package/cssm/components/number-input/Component.js +87 -84
  24. package/cssm/components/number-input/index.js +10 -0
  25. package/cssm/components/number-input/index.module.css +29 -0
  26. package/cssm/components/steppers/Component.d.ts +14 -0
  27. package/cssm/components/steppers/Component.js +32 -0
  28. package/cssm/components/steppers/index.d.ts +1 -0
  29. package/cssm/components/steppers/index.js +16 -0
  30. package/cssm/components/steppers/index.module.css +31 -0
  31. package/cssm/desktop/index.js +10 -0
  32. package/cssm/index.js +11 -0
  33. package/cssm/mobile/index.js +10 -0
  34. package/cssm/utils.d.ts +19 -9
  35. package/cssm/utils.js +244 -21
  36. package/desktop/index.js +8 -0
  37. package/esm/Component.desktop.d.ts +1 -1
  38. package/esm/Component.desktop.js +9 -1
  39. package/esm/Component.mobile.d.ts +1 -1
  40. package/esm/Component.mobile.js +9 -1
  41. package/esm/Component.responsive.d.ts +1 -1
  42. package/esm/Component.responsive.js +15 -2
  43. package/esm/components/number-input/Component.d.ts +21 -46
  44. package/esm/components/number-input/Component.js +88 -86
  45. package/esm/components/number-input/index.css +30 -0
  46. package/esm/components/number-input/index.js +8 -0
  47. package/esm/components/steppers/Component.d.ts +14 -0
  48. package/esm/components/steppers/Component.js +24 -0
  49. package/esm/components/steppers/index.css +32 -0
  50. package/esm/components/steppers/index.d.ts +1 -0
  51. package/esm/components/steppers/index.js +7 -0
  52. package/esm/desktop/index.js +8 -0
  53. package/esm/index.js +9 -0
  54. package/esm/mobile/index.js +8 -0
  55. package/esm/utils.d.ts +19 -9
  56. package/esm/utils.js +236 -19
  57. package/index.js +9 -0
  58. package/mobile/index.js +8 -0
  59. package/modern/Component.desktop.d.ts +1 -1
  60. package/modern/Component.desktop.js +9 -1
  61. package/modern/Component.mobile.d.ts +1 -1
  62. package/modern/Component.mobile.js +9 -1
  63. package/modern/Component.responsive.d.ts +1 -1
  64. package/modern/Component.responsive.js +13 -1
  65. package/modern/components/number-input/Component.d.ts +21 -46
  66. package/modern/components/number-input/Component.js +84 -86
  67. package/modern/components/number-input/index.css +30 -0
  68. package/modern/components/number-input/index.js +8 -0
  69. package/modern/components/steppers/Component.d.ts +14 -0
  70. package/modern/components/steppers/Component.js +23 -0
  71. package/modern/components/steppers/index.css +32 -0
  72. package/modern/components/steppers/index.d.ts +1 -0
  73. package/modern/components/steppers/index.js +7 -0
  74. package/modern/desktop/index.js +8 -0
  75. package/modern/index.js +9 -0
  76. package/modern/mobile/index.js +8 -0
  77. package/modern/utils.d.ts +19 -9
  78. package/modern/utils.js +223 -18
  79. package/package.json +9 -2
  80. package/src/Component.desktop.tsx +2 -2
  81. package/src/Component.mobile.tsx +2 -2
  82. package/src/Component.responsive.tsx +16 -2
  83. package/src/components/number-input/Component.tsx +195 -129
  84. package/src/components/number-input/index.module.css +18 -0
  85. package/src/components/steppers/Component.tsx +64 -0
  86. package/src/components/steppers/index.module.css +21 -0
  87. package/src/components/steppers/index.ts +1 -0
  88. package/src/utils.ts +302 -24
  89. package/utils.d.ts +19 -9
  90. package/utils.js +244 -21
@@ -1,101 +1,103 @@
1
1
  import { __rest, __assign } from 'tslib';
2
- import React, { useRef, useState } from 'react';
2
+ import React, { forwardRef, useMemo, useState, useEffect } from 'react';
3
3
  import mergeRefs from 'react-merge-refs';
4
- import { createSeparatorsRegExp, getAllowedValue, SEPARATORS, SIGNS } from '../../utils.js';
4
+ import { maskitoTransform } from '@maskito/core';
5
+ import { useMaskito } from '@maskito/react';
6
+ import cn from 'classnames';
7
+ import { fnUtils, os } from '@alfalab/core-components-shared/esm';
8
+ import { createMaskOptions, parseNumber, stringifyNumberWithoutExp, MAX_DIGITS, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER, MINUS_SIGN } from '../../utils.js';
9
+ import { Steppers } from '../steppers/Component.js';
10
+ import '@alfalab/core-components-icon-button/esm';
11
+ import '@alfalab/icons-glyph/MinusMIcon';
12
+ import '@alfalab/icons-glyph/PlusMediumMIcon';
5
13
 
6
- var NumberInput = React.forwardRef(function (_a, ref) {
7
- var propValue = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, _b = _a.allowSigns, allowSigns = _b === void 0 ? true : _b, _c = _a.separator, separator = _c === void 0 ? ',' : _c, fractionLength = _a.fractionLength, defaultValue = _a.defaultValue, Input = _a.Input, restProps = __rest(_a, ["value", "onChange", "onBlur", "allowSigns", "separator", "fractionLength", "defaultValue", "Input"]);
8
- var uncontrolled = propValue === undefined;
9
- var inputRef = useRef(null);
10
- var _d = useState(defaultValue || ''), value = _d[0], setValue = _d[1];
11
- var getNumberValueFromStr = function (valueString) {
12
- if (valueString === '')
13
- return null;
14
- if (valueString.includes(',')) {
15
- return parseFloat(valueString.replace(',', '.'));
16
- }
17
- return parseFloat(valueString);
18
- };
19
- var restoreCaret = function (target) {
20
- setTimeout(function () {
21
- var input = target;
22
- var positionCursor = input.selectionStart || 0;
23
- var isEndPosition = input.value.length === positionCursor;
24
- var enteredSign = SIGNS.some(function (s) { return s === input.value[positionCursor - 1]; });
25
- var enteredSeparator = SEPARATORS.filter(function (s) { return s !== separator; }).some(function (s) { return s === input.value[positionCursor - 1]; });
26
- var shouldRestore = enteredSeparator || enteredSign;
27
- if (!isEndPosition && shouldRestore) {
28
- input.selectionStart = positionCursor;
29
- input.selectionEnd = positionCursor;
30
- }
31
- });
32
- };
33
- var handleChange = function (event) {
34
- var input = event.target;
35
- var newValue = input.value.replace(createSeparatorsRegExp(), separator);
36
- var allowedValue = getAllowedValue({
37
- value: newValue,
38
- fractionLength: fractionLength,
39
- allowSigns: allowSigns,
14
+ var styles = {"steppers":"number-input__steppers_1g1qu","steppersFocused":"number-input__steppersFocused_1g1qu","steppersDisable":"number-input__steppersDisable_1g1qu","s":"number-input__s_1g1qu","m":"number-input__m_1g1qu"};
15
+ require('./index.css')
16
+
17
+ var NumberInput = forwardRef(function (_a, ref) {
18
+ var _b;
19
+ var propValue = _a.value, onChange = _a.onChange, _c = _a.separator, separator = _c === void 0 ? ',' : _c, _d = _a.fractionLength, fractionLength = _d === void 0 ? MAX_DIGITS : _d, defaultValue = _a.defaultValue, Input = _a.Input, minProp = _a.min, maxProp = _a.max, rightAddons = _a.rightAddons, dataTestId = _a.dataTestId, disabled = _a.disabled, onBlur = _a.onBlur, onFocus = _a.onFocus; _a.view; var stepProp = _a.step, _e = _a.size, size = _e === void 0 ? 's' : _e, disableUserInput = _a.disableUserInput, clearProp = _a.clear, restProps = __rest(_a, ["value", "onChange", "separator", "fractionLength", "defaultValue", "Input", "min", "max", "rightAddons", "dataTestId", "disabled", "onBlur", "onFocus", "view", "step", "size", "disableUserInput", "clear"]);
20
+ var min = Math.max(MIN_SAFE_INTEGER, minProp !== null && minProp !== void 0 ? minProp : MIN_SAFE_INTEGER);
21
+ var max = Math.min(MAX_SAFE_INTEGER, maxProp !== null && maxProp !== void 0 ? maxProp : MAX_SAFE_INTEGER);
22
+ var withStepper = stepProp !== undefined;
23
+ var maskOptions = useMemo(function () {
24
+ return createMaskOptions({
40
25
  separator: separator,
26
+ fractionLength: withStepper ? 0 : fractionLength,
27
+ min: min,
28
+ max: max,
41
29
  });
42
- if (onChange) {
43
- onChange(event, {
44
- value: getNumberValueFromStr(allowedValue),
45
- valueString: allowedValue,
46
- });
47
- }
48
- if (uncontrolled) {
49
- setValue(allowedValue);
50
- }
51
- restoreCaret(input);
52
- };
53
- var handleKeyDown = function (event) {
54
- var disallowedSymbols = /[/|?!@#$%^&*()_=A-Za-zА-Яа-яЁё ]/;
55
- var oneKeyPress = !event.altKey && !event.metaKey && !event.ctrlKey;
56
- var target = event.target;
57
- // Запрещаем вводить неразрешенные символы за исключением комбинаций клавиш
58
- if (oneKeyPress && event.key.length === 1 && disallowedSymbols.test(event.key)) {
59
- return event.preventDefault();
30
+ }, [separator, fractionLength, min, max, withStepper]);
31
+ var _f = useState(false), focused = _f[0], setFocused = _f[1];
32
+ var _g = useState(function () {
33
+ if (defaultValue == null) {
34
+ return withStepper ? fnUtils.clamp(0, min, max).toString() : '';
60
35
  }
61
- var val = target.value;
62
- var hasSeparator = (val.match(createSeparatorsRegExp()) || []).length > 0;
63
- // Запрещаем вводить второй сепаратор
64
- if (hasSeparator && SEPARATORS.some(function (s) { return s === event.key; })) {
65
- return event.preventDefault();
66
- }
67
- // Запрещаем вводить лишний знак
68
- if ((!allowSigns || SIGNS.some(function (s) { return s === val[0]; })) &&
69
- SIGNS.some(function (s) { return s === event.key; })) {
70
- return event.preventDefault();
71
- }
72
- var selectionStart = target.selectionStart || 0;
73
- // Запрещаем вводить цифры в дробную часть, если кол-во цифр больше fractionLength
74
- if (hasSeparator &&
75
- fractionLength &&
76
- event.key.length === 1 &&
77
- selectionStart > val.indexOf(separator) &&
78
- val.split(separator)[1].length >= fractionLength) {
79
- return event.preventDefault();
36
+ return fnUtils
37
+ .clamp(parseNumber(maskitoTransform(defaultValue.toString(), maskOptions)), min, max)
38
+ .toString();
39
+ }), value = _g[0], setValue = _g[1];
40
+ var maskRef = useMaskito({ options: maskOptions });
41
+ useEffect(function () {
42
+ if (propValue !== undefined) {
43
+ setValue(function (prev) {
44
+ var parsedNumber = parseNumber(propValue);
45
+ if (parsedNumber !== parseNumber(prev)) {
46
+ return maskitoTransform(stringifyNumberWithoutExp(parsedNumber), maskOptions);
47
+ }
48
+ return prev;
49
+ });
80
50
  }
81
- return undefined;
51
+ }, [maskOptions, propValue, separator]);
52
+ var getMaxLength = function (valueString) {
53
+ var hasSeparator = valueString === null || valueString === void 0 ? void 0 : valueString.includes(separator);
54
+ var hasSigns = valueString === null || valueString === void 0 ? void 0 : valueString.startsWith(MINUS_SIGN);
55
+ return MAX_DIGITS + (hasSeparator ? 1 : 0) + (hasSigns ? 1 : 0);
82
56
  };
83
- var handleBlur = function (event) {
84
- var valueBlur = event.target.value.replace(new RegExp("\\".concat(separator, "$")), '');
85
- if (onChange) {
86
- onChange(event, {
87
- value: getNumberValueFromStr(valueBlur),
88
- valueString: valueBlur,
57
+ var getStep = function () { return Math.round(stepProp !== null && stepProp !== void 0 ? stepProp : 1); };
58
+ var changeValue = function (event, newValue) {
59
+ var _a, _b;
60
+ var isNaNValue = Number.isNaN(newValue);
61
+ var valueString = (_b = (_a = event === null || event === void 0 ? void 0 : event.target.value) !== null && _a !== void 0 ? _a : newValue === null || newValue === void 0 ? void 0 : newValue.toString()) !== null && _b !== void 0 ? _b : '';
62
+ setValue(valueString);
63
+ if (valueString === '' || !isNaNValue) {
64
+ onChange === null || onChange === void 0 ? void 0 : onChange(event, {
65
+ value: isNaNValue ? null : newValue,
89
66
  });
90
67
  }
91
- if (uncontrolled) {
92
- setValue(valueBlur);
68
+ };
69
+ var handleChange = function (event) {
70
+ var valueString = event.target.value;
71
+ changeValue(event, parseNumber(valueString));
72
+ };
73
+ var handleIncrement = function () {
74
+ var parsed = parseNumber(value);
75
+ var nextValue = maskitoTransform((Number.isNaN(parsed) ? min : parsed + getStep()).toString(), maskOptions);
76
+ changeValue(null, parseNumber(nextValue));
77
+ };
78
+ var handleDecrement = function () {
79
+ var parsed = parseNumber(value);
80
+ var nextValue = maskitoTransform((Number.isNaN(parsed) ? max : parsed - getStep()).toString(), maskOptions);
81
+ changeValue(null, parseNumber(nextValue));
82
+ };
83
+ var handleFocus = function (e) {
84
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
85
+ if (!disableUserInput) {
86
+ setFocused(true);
93
87
  }
94
- if (onBlur)
95
- onBlur(event);
96
88
  };
97
- var visibleValue = uncontrolled ? value : propValue === null || propValue === void 0 ? void 0 : propValue.toString();
98
- return (React.createElement(Input, __assign({ ref: mergeRefs([ref, inputRef]), value: visibleValue, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleKeyDown, inputMode: 'decimal' }, restProps)));
89
+ var handleBlur = function (e) {
90
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
91
+ setFocused(false);
92
+ };
93
+ return (React.createElement(Input, __assign({ maxLength: getMaxLength(value) }, restProps, {
94
+ // В iOS в цифровой клавиатуре невозможно ввести минус.
95
+ inputMode: min < 0 && os.isIOS() ? 'text' : 'decimal', ref: mergeRefs([ref, maskRef]), value: value, onInput: handleChange, dataTestId: dataTestId, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, size: size, disableUserInput: disableUserInput, clear: clearProp && /\d/.test(value), rightAddons: withStepper ? (React.createElement(React.Fragment, null,
96
+ rightAddons,
97
+ React.createElement(Steppers, { dataTestId: dataTestId, disabled: disabled, value: parseNumber(value), min: min, max: max, className: cn(styles.steppers, styles[size], (_b = {},
98
+ _b[styles.steppersFocused] = focused,
99
+ _b[styles.steppersDisable] = disabled,
100
+ _b)), onIncrement: handleIncrement, onDecrement: handleDecrement }))) : (rightAddons) })));
99
101
  });
100
102
 
101
103
  export { NumberInput };
@@ -0,0 +1,30 @@
1
+ /* hash: ppwj9 */
2
+ :root {
3
+ } /* deprecated */ :root {
4
+ --color-light-neutral-0: #fff;
5
+ --color-light-neutral-translucent-200: rgba(30, 43, 68, 0.08); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
7
+ } :root {
8
+ } :root {
9
+
10
+ /* Hard */
11
+
12
+ /* Up */
13
+
14
+ /* Hard up */
15
+ } :root {
16
+ } :root {
17
+ --gap-2xs-neg: -4px;
18
+ --gap-xs-neg: -8px;
19
+ } :root {
20
+ } :root {
21
+ } .number-input__steppers_1g1qu {
22
+ background-color: var(--color-light-neutral-0);
23
+ } .number-input__steppersFocused_1g1qu,
24
+ .number-input__steppersDisable_1g1qu {
25
+ background-color: var(--color-light-neutral-translucent-200);
26
+ } .number-input__s_1g1qu {
27
+ margin-right: var(--gap-xs-neg);
28
+ } .number-input__m_1g1qu {
29
+ margin-right: var(--gap-2xs-neg);
30
+ }
@@ -2,4 +2,12 @@ export { NumberInput } from './Component.js';
2
2
  import 'tslib';
3
3
  import 'react';
4
4
  import 'react-merge-refs';
5
+ import '@maskito/core';
6
+ import '@maskito/react';
7
+ import 'classnames';
8
+ import '@alfalab/core-components-shared/esm';
5
9
  import '../../utils.js';
10
+ import '../steppers/Component.js';
11
+ import '@alfalab/core-components-icon-button/esm';
12
+ import '@alfalab/icons-glyph/MinusMIcon';
13
+ import '@alfalab/icons-glyph/PlusMediumMIcon';
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ type SteppersProps = {
4
+ value: number;
5
+ min: number;
6
+ max: number;
7
+ className?: string;
8
+ disabled?: boolean;
9
+ onIncrement: () => void;
10
+ onDecrement: () => void;
11
+ dataTestId?: string;
12
+ };
13
+ declare const Steppers: React.FC<SteppersProps>;
14
+ export { SteppersProps, Steppers };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import cn from 'classnames';
3
+ import { IconButton } from '@alfalab/core-components-icon-button/esm';
4
+ import { getDataTestId } from '@alfalab/core-components-shared/esm';
5
+ import { MinusMIcon } from '@alfalab/icons-glyph/MinusMIcon';
6
+ import { PlusMediumMIcon } from '@alfalab/icons-glyph/PlusMediumMIcon';
7
+
8
+ var styles = {"component":"number-input__component_1k8eq","separator":"number-input__separator_1k8eq","button":"number-input__button_1k8eq"};
9
+ require('./index.css')
10
+
11
+ function preventDefault(e) {
12
+ e.preventDefault();
13
+ }
14
+ var Steppers = function (_a) {
15
+ var className = _a.className, onIncrement = _a.onIncrement, onDecrement = _a.onDecrement, value = _a.value, min = _a.min, max = _a.max, disabled = _a.disabled, dataTestId = _a.dataTestId;
16
+ var decButtonDisabled = disabled || value <= min;
17
+ var incButtonDisabled = disabled || value >= max;
18
+ return (React.createElement("div", { className: cn(styles.component, className) },
19
+ React.createElement(IconButton, { disabled: decButtonDisabled, className: styles.button, icon: React.createElement(MinusMIcon, null), "aria-label": '\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C', onMouseDown: preventDefault, onClick: onDecrement, dataTestId: getDataTestId(dataTestId, 'decrement-button'), view: 'secondary' }),
20
+ React.createElement("div", { className: styles.separator }),
21
+ React.createElement(IconButton, { disabled: incButtonDisabled, className: styles.button, icon: React.createElement(PlusMediumMIcon, null), "aria-label": '\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C', onMouseDown: preventDefault, onClick: onIncrement, dataTestId: getDataTestId(dataTestId, 'increment-button'), view: 'secondary' })));
22
+ };
23
+
24
+ export { Steppers };
@@ -0,0 +1,32 @@
1
+ /* hash: 1x7ch */
2
+ :root {
3
+ } /* deprecated */ :root {
4
+ --color-light-neutral-translucent-300: rgba(15, 25, 55, 0.1); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
+ } :root {
7
+ } :root {
8
+
9
+ /* Hard */
10
+
11
+ /* Up */
12
+
13
+ /* Hard up */
14
+ } :root {
15
+ } :root {
16
+ } :root {
17
+ } :root {
18
+ } .number-input__component_1k8eq {
19
+ display: flex;
20
+ flex-flow: row nowrap;
21
+ align-items: center;
22
+ border-radius: 5px;
23
+ transition: background-color 0.2s ease;
24
+ overflow: visible;
25
+ } .number-input__separator_1k8eq {
26
+ height: 18px;
27
+ width: 1px;
28
+ background-color: var(--color-light-neutral-translucent-300);
29
+ } .number-input__button_1k8eq {
30
+ width: 40px;
31
+ height: 40px;
32
+ }
@@ -0,0 +1 @@
1
+ export * from "./Component";
@@ -0,0 +1,7 @@
1
+ export { Steppers } from './Component.js';
2
+ import 'react';
3
+ import 'classnames';
4
+ import '@alfalab/core-components-icon-button/esm';
5
+ import '@alfalab/core-components-shared/esm';
6
+ import '@alfalab/icons-glyph/MinusMIcon';
7
+ import '@alfalab/icons-glyph/PlusMediumMIcon';
@@ -4,4 +4,12 @@ import 'react';
4
4
  import '@alfalab/core-components-input/esm/desktop';
5
5
  import '../components/number-input/Component.js';
6
6
  import 'react-merge-refs';
7
+ import '@maskito/core';
8
+ import '@maskito/react';
9
+ import 'classnames';
10
+ import '@alfalab/core-components-shared/esm';
7
11
  import '../utils.js';
12
+ import '../components/steppers/Component.js';
13
+ import '@alfalab/core-components-icon-button/esm';
14
+ import '@alfalab/icons-glyph/MinusMIcon';
15
+ import '@alfalab/icons-glyph/PlusMediumMIcon';
package/esm/index.js CHANGED
@@ -2,6 +2,15 @@ export { NumberInputResponsive as NumberInput } from './Component.responsive.js'
2
2
  import 'tslib';
3
3
  import 'react';
4
4
  import '@alfalab/core-components-input/esm';
5
+ import '@alfalab/core-components-mq/esm';
5
6
  import './components/number-input/Component.js';
6
7
  import 'react-merge-refs';
8
+ import '@maskito/core';
9
+ import '@maskito/react';
10
+ import 'classnames';
11
+ import '@alfalab/core-components-shared/esm';
7
12
  import './utils.js';
13
+ import './components/steppers/Component.js';
14
+ import '@alfalab/core-components-icon-button/esm';
15
+ import '@alfalab/icons-glyph/MinusMIcon';
16
+ import '@alfalab/icons-glyph/PlusMediumMIcon';
@@ -4,4 +4,12 @@ import 'react';
4
4
  import '@alfalab/core-components-input/esm/mobile';
5
5
  import '../components/number-input/Component.js';
6
6
  import 'react-merge-refs';
7
+ import '@maskito/core';
8
+ import '@maskito/react';
9
+ import 'classnames';
10
+ import '@alfalab/core-components-shared/esm';
7
11
  import '../utils.js';
12
+ import '../components/steppers/Component.js';
13
+ import '@alfalab/core-components-icon-button/esm';
14
+ import '@alfalab/icons-glyph/MinusMIcon';
15
+ import '@alfalab/icons-glyph/PlusMediumMIcon';
package/esm/utils.d.ts CHANGED
@@ -1,13 +1,23 @@
1
- declare const SIGNS: string[];
1
+ import { MaskitoOptions, MaskitoPlugin } from '@maskito/core';
2
+ declare const MINUS_SIGN = "-";
2
3
  declare const SEPARATORS: string[];
3
- declare function createSeparatorsRegExp(): RegExp;
4
+ declare const MAX_SAFE_INTEGER: number;
5
+ declare const MIN_SAFE_INTEGER: number;
6
+ declare const MAX_DIGITS = 15;
7
+ declare function parseNumber(value?: string | number | null): number;
4
8
  /**
5
- * Проверка вводимых значений.
9
+ * Преобразовать число в строку с заменой экспоненты на десятичную дробь
6
10
  */
7
- declare const getAllowedValue: ({ value, fractionLength, separator, allowSigns, }: {
8
- value: string;
9
- fractionLength?: number | undefined;
11
+ declare function stringifyNumberWithoutExp(value: number): string;
12
+ declare function createMaskOptions({ separator, fractionLength, min, max, }: {
10
13
  separator: string;
11
- allowSigns: boolean;
12
- }) => string;
13
- export { SIGNS, SEPARATORS, createSeparatorsRegExp, getAllowedValue };
14
+ fractionLength: number;
15
+ min: number;
16
+ max: number;
17
+ }): MaskitoOptions;
18
+ declare function createMinMaxPlugin({ min, max }: {
19
+ min: number;
20
+ max: number;
21
+ }): MaskitoPlugin;
22
+ declare function createNotEmptyPartsPlugin(separator: string): MaskitoPlugin;
23
+ export { MINUS_SIGN, SEPARATORS, MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, MAX_DIGITS, parseNumber, stringifyNumberWithoutExp, createMaskOptions, createMinMaxPlugin, createNotEmptyPartsPlugin };