@inseefr/lunatic 2.4.4 → 2.4.5-beta
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/lib/components/input-number/html/__snapshots__/input-number.spec.tsx.snap +4 -4
- package/lib/components/input-number/html/input-number-thousand.js +21 -8
- package/lib/components/input-number/html/input-number.js +2 -23
- package/lib/components/input-number/html/input-number.spec.js +21 -27
- package/lib/src/components/input-number/html/input-number-thousand.d.ts +1 -1
- package/lib/src/components/input-number/html/input-number.d.ts +1 -1
- package/lib/stories/input-number/input-number.stories.js +1 -1
- package/package.json +1 -1
- package/lib/components/input-number/html/__snapshots__/inpute-number.spec.jsx.snap +0 -92
- package/lib/components/input-number/html/input-number-default.js +0 -57
- package/lib/src/components/input-number/html/input-number-default.d.ts +0 -13
|
@@ -16,8 +16,8 @@ exports[`InputNumber > renders without crashing 1`] = `
|
|
|
16
16
|
lang="en"
|
|
17
17
|
required=""
|
|
18
18
|
step="1"
|
|
19
|
-
type="
|
|
20
|
-
value="
|
|
19
|
+
type="text"
|
|
20
|
+
value=""
|
|
21
21
|
/>
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
@@ -34,8 +34,8 @@ exports[`InputNumber > renders without crashing 1`] = `
|
|
|
34
34
|
lang="en"
|
|
35
35
|
required=""
|
|
36
36
|
step="1"
|
|
37
|
-
type="
|
|
38
|
-
value="
|
|
37
|
+
type="text"
|
|
38
|
+
value=""
|
|
39
39
|
/>
|
|
40
40
|
</div>
|
|
41
41
|
</div>,
|
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports["default"] = void 0;
|
|
8
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
10
9
|
var _reactNumberFormat = require("react-number-format");
|
|
11
10
|
var _i18n = require("../../../i18n");
|
|
12
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
19
|
var InputNumberThousand = function InputNumberThousand(_ref) {
|
|
17
20
|
var id = _ref.id,
|
|
18
|
-
value = _ref.value,
|
|
19
21
|
onChange = _ref.onChange,
|
|
22
|
+
value = _ref.value,
|
|
20
23
|
disabled = _ref.disabled,
|
|
24
|
+
required = _ref.required,
|
|
21
25
|
labelId = _ref.labelId,
|
|
22
26
|
min = _ref.min,
|
|
23
27
|
max = _ref.max,
|
|
24
28
|
decimals = _ref.decimals;
|
|
29
|
+
// Decimals is a number indicates the number behind the separator of decimals
|
|
30
|
+
// Computing step attribute of input according to decimal number
|
|
31
|
+
var _useState = (0, _react.useState)(decimals ? 1 / Math.pow(10, decimals) : 1),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
33
|
+
step = _useState2[0];
|
|
25
34
|
var handleChange = (0, _react.useCallback)(function (e) {
|
|
26
35
|
var _e$floatValue;
|
|
27
36
|
var val = (_e$floatValue = e.floatValue) !== null && _e$floatValue !== void 0 ? _e$floatValue : null;
|
|
@@ -29,9 +38,9 @@ var InputNumberThousand = function InputNumberThousand(_ref) {
|
|
|
29
38
|
}, [onChange]);
|
|
30
39
|
var isAllowed = (0, _react.useCallback)(function (values) {
|
|
31
40
|
var floatValue = values.floatValue;
|
|
32
|
-
if (Number.isInteger(
|
|
41
|
+
if (Number.isInteger(max) && floatValue && max) return floatValue <= max || false;
|
|
33
42
|
return true;
|
|
34
|
-
}, [max
|
|
43
|
+
}, [max]);
|
|
35
44
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNumberFormat.NumericFormat, {
|
|
36
45
|
id: id,
|
|
37
46
|
className: (0, _classnames["default"])({
|
|
@@ -39,8 +48,12 @@ var InputNumberThousand = function InputNumberThousand(_ref) {
|
|
|
39
48
|
}),
|
|
40
49
|
onValueChange: handleChange,
|
|
41
50
|
value: value !== null && value !== void 0 ? value : '',
|
|
42
|
-
|
|
51
|
+
min: min,
|
|
52
|
+
max: max,
|
|
53
|
+
step: step,
|
|
54
|
+
"aria-labelledby": labelId,
|
|
43
55
|
disabled: disabled,
|
|
56
|
+
required: required,
|
|
44
57
|
lang: "en",
|
|
45
58
|
isAllowed: isAllowed,
|
|
46
59
|
allowedDecimalSeparators: _i18n.inputNumberPropsI18N.allDecimalSeparators,
|
|
@@ -4,20 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _function = require("../../../utils/function");
|
|
8
8
|
var _commons = require("../../commons");
|
|
9
|
-
var _inputNumberDefault = _interopRequireDefault(require("./input-number-default"));
|
|
10
9
|
var _inputNumberThousand = _interopRequireDefault(require("./input-number-thousand"));
|
|
11
10
|
require("./input-number.scss");
|
|
12
|
-
var _function = require("../../../utils/function");
|
|
13
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
19
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
13
|
function InputNumber(_ref) {
|
|
22
14
|
var id = _ref.id,
|
|
23
15
|
_ref$value = _ref.value,
|
|
@@ -37,9 +29,6 @@ function InputNumber(_ref) {
|
|
|
37
29
|
required = _ref$required === void 0 ? true : _ref$required,
|
|
38
30
|
description = _ref.description;
|
|
39
31
|
var labelId = "label-".concat(id);
|
|
40
|
-
var _useState = (0, _react.useState)(max && max > 1000),
|
|
41
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
42
|
-
useThousandSeparator = _useState2[0];
|
|
43
32
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
44
33
|
className: "lunatic-input-number",
|
|
45
34
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_commons.Label, {
|
|
@@ -47,25 +36,15 @@ function InputNumber(_ref) {
|
|
|
47
36
|
id: labelId,
|
|
48
37
|
description: description,
|
|
49
38
|
children: label
|
|
50
|
-
}),
|
|
39
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumberThousand["default"], {
|
|
51
40
|
id: id,
|
|
52
41
|
value: value,
|
|
53
42
|
onChange: onChange,
|
|
54
43
|
disabled: disabled,
|
|
55
44
|
required: required,
|
|
56
45
|
labelId: labelId,
|
|
57
|
-
max: max,
|
|
58
46
|
min: min,
|
|
59
|
-
decimals: decimals
|
|
60
|
-
}), !useThousandSeparator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumberDefault["default"], {
|
|
61
|
-
id: id,
|
|
62
|
-
value: value,
|
|
63
|
-
onChange: onChange,
|
|
64
|
-
disabled: disabled,
|
|
65
|
-
required: required,
|
|
66
|
-
labelId: labelId,
|
|
67
47
|
max: max,
|
|
68
|
-
min: min,
|
|
69
48
|
decimals: decimals
|
|
70
49
|
}), unit && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
71
50
|
children: unit
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _react = require("@testing-library/react");
|
|
4
|
-
var _inputNumber = _interopRequireDefault(require("./input-number"));
|
|
5
4
|
var _vitest = require("vitest");
|
|
5
|
+
var _inputNumber = _interopRequireDefault(require("./input-number"));
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
8
|
(0, _vitest.describe)('InputNumber', function () {
|
|
@@ -16,7 +16,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
16
16
|
id: "input",
|
|
17
17
|
"aria-labelledby": "input"
|
|
18
18
|
}));
|
|
19
|
-
(0, _vitest.expect)(_react.screen.getByRole('spinbutton')).toBeInTheDocument();
|
|
20
19
|
(0, _vitest.expect)(container).toMatchSnapshot();
|
|
21
20
|
});
|
|
22
21
|
(0, _vitest.it)('renders label and input', function () {
|
|
@@ -28,7 +27,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
28
27
|
})),
|
|
29
28
|
container = _render.container;
|
|
30
29
|
var label = _react.screen.getByText(labelText);
|
|
31
|
-
var input = container.querySelector('input[type="
|
|
30
|
+
var input = container.querySelector('input[type="text"]');
|
|
32
31
|
(0, _vitest.expect)(label).toBeInTheDocument();
|
|
33
32
|
(0, _vitest.expect)(input).toBeInTheDocument();
|
|
34
33
|
});
|
|
@@ -38,17 +37,28 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
38
37
|
value: 10,
|
|
39
38
|
onChange: mockOnChange
|
|
40
39
|
})),
|
|
41
|
-
|
|
42
|
-
var input =
|
|
43
|
-
(0, _vitest.expect)(input).toHaveValue(10);
|
|
40
|
+
container = _render2.container;
|
|
41
|
+
var input = container.querySelector('input[type="text"]');
|
|
42
|
+
(0, _vitest.expect)(input).toHaveValue('10');
|
|
44
43
|
});
|
|
45
|
-
(0, _vitest.it)('
|
|
44
|
+
(0, _vitest.it)('renders with big value', function () {
|
|
46
45
|
var _render3 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumber["default"], {
|
|
47
46
|
id: "number",
|
|
47
|
+
value: 10000.45,
|
|
48
|
+
decimals: 2,
|
|
48
49
|
onChange: mockOnChange
|
|
49
50
|
})),
|
|
50
51
|
container = _render3.container;
|
|
51
|
-
var input = container.querySelector('input[type="
|
|
52
|
+
var input = container.querySelector('input[type="text"]');
|
|
53
|
+
(0, _vitest.expect)(input).toHaveValue('10,000.45');
|
|
54
|
+
});
|
|
55
|
+
(0, _vitest.it)('calls onChange with parsed value', function () {
|
|
56
|
+
var _render4 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumber["default"], {
|
|
57
|
+
id: "number",
|
|
58
|
+
onChange: mockOnChange
|
|
59
|
+
})),
|
|
60
|
+
container = _render4.container;
|
|
61
|
+
var input = container.querySelector('input[type="text"]');
|
|
52
62
|
_react.fireEvent.change(input, {
|
|
53
63
|
target: {
|
|
54
64
|
value: '10'
|
|
@@ -58,33 +68,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
58
68
|
(0, _vitest.expect)(mockOnChange).toHaveBeenCalledWith(10);
|
|
59
69
|
});
|
|
60
70
|
(0, _vitest.it)('renders unit element if provided', function () {
|
|
61
|
-
var
|
|
71
|
+
var _render5 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumber["default"], {
|
|
62
72
|
id: "input-number-test",
|
|
63
73
|
value: 5,
|
|
64
74
|
label: "Input Number",
|
|
65
75
|
labelId: "input-number-label",
|
|
66
76
|
unit: "kg"
|
|
67
77
|
})),
|
|
68
|
-
getByText =
|
|
78
|
+
getByText = _render5.getByText;
|
|
69
79
|
var unit = getByText('kg');
|
|
70
80
|
(0, _vitest.expect)(unit).toBeInTheDocument();
|
|
71
81
|
});
|
|
72
|
-
(0, _vitest.it)('calls onChange with new value when input value changes', function () {
|
|
73
|
-
var handleChange = _vitest.vi.fn();
|
|
74
|
-
var _render5 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumber["default"], {
|
|
75
|
-
id: "input-number-test",
|
|
76
|
-
value: 5,
|
|
77
|
-
onChange: handleChange
|
|
78
|
-
})),
|
|
79
|
-
getByRole = _render5.getByRole;
|
|
80
|
-
var input = getByRole('spinbutton');
|
|
81
|
-
_react.fireEvent.change(input, {
|
|
82
|
-
target: {
|
|
83
|
-
value: '7'
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
(0, _vitest.expect)(handleChange).toHaveBeenCalledWith(7);
|
|
87
|
-
});
|
|
88
82
|
(0, _vitest.it)('disables input when disabled prop is true', function () {
|
|
89
83
|
var _render6 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_inputNumber["default"], {
|
|
90
84
|
id: "number",
|
|
@@ -92,7 +86,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
92
86
|
onChange: mockOnChange
|
|
93
87
|
})),
|
|
94
88
|
container = _render6.container;
|
|
95
|
-
var input = container.querySelector('input[type="
|
|
89
|
+
var input = container.querySelector('input[type="text"]');
|
|
96
90
|
(0, _vitest.expect)(input).toBeDisabled();
|
|
97
91
|
});
|
|
98
92
|
(0, _vitest.it)('renders with unit', function () {
|
|
@@ -9,5 +9,5 @@ type Props = {
|
|
|
9
9
|
max?: number;
|
|
10
10
|
decimals?: number;
|
|
11
11
|
};
|
|
12
|
-
declare const InputNumberThousand: ({ id,
|
|
12
|
+
declare const InputNumberThousand: ({ id, onChange, value, disabled, required, labelId, min, max, decimals, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export default InputNumberThousand;
|
package/package.json
CHANGED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1
|
|
2
|
-
|
|
3
|
-
exports[`InputNumber > renders without crashing 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"asFragment": [Function],
|
|
6
|
-
"baseElement": <body>
|
|
7
|
-
<div>
|
|
8
|
-
<div
|
|
9
|
-
class="lunatic-input-number"
|
|
10
|
-
>
|
|
11
|
-
<input
|
|
12
|
-
class=""
|
|
13
|
-
id="input"
|
|
14
|
-
inputmode="numeric"
|
|
15
|
-
labelledby="label-input"
|
|
16
|
-
lang="en"
|
|
17
|
-
step="1"
|
|
18
|
-
type="number"
|
|
19
|
-
value="input"
|
|
20
|
-
/>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</body>,
|
|
24
|
-
"container": <div>
|
|
25
|
-
<div
|
|
26
|
-
class="lunatic-input-number"
|
|
27
|
-
>
|
|
28
|
-
<input
|
|
29
|
-
class=""
|
|
30
|
-
id="input"
|
|
31
|
-
inputmode="numeric"
|
|
32
|
-
labelledby="label-input"
|
|
33
|
-
lang="en"
|
|
34
|
-
step="1"
|
|
35
|
-
type="number"
|
|
36
|
-
value="input"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
</div>,
|
|
40
|
-
"debug": [Function],
|
|
41
|
-
"findAllByAltText": [Function],
|
|
42
|
-
"findAllByDisplayValue": [Function],
|
|
43
|
-
"findAllByLabelText": [Function],
|
|
44
|
-
"findAllByPlaceholderText": [Function],
|
|
45
|
-
"findAllByRole": [Function],
|
|
46
|
-
"findAllByTestId": [Function],
|
|
47
|
-
"findAllByText": [Function],
|
|
48
|
-
"findAllByTitle": [Function],
|
|
49
|
-
"findByAltText": [Function],
|
|
50
|
-
"findByDisplayValue": [Function],
|
|
51
|
-
"findByLabelText": [Function],
|
|
52
|
-
"findByPlaceholderText": [Function],
|
|
53
|
-
"findByRole": [Function],
|
|
54
|
-
"findByTestId": [Function],
|
|
55
|
-
"findByText": [Function],
|
|
56
|
-
"findByTitle": [Function],
|
|
57
|
-
"getAllByAltText": [Function],
|
|
58
|
-
"getAllByDisplayValue": [Function],
|
|
59
|
-
"getAllByLabelText": [Function],
|
|
60
|
-
"getAllByPlaceholderText": [Function],
|
|
61
|
-
"getAllByRole": [Function],
|
|
62
|
-
"getAllByTestId": [Function],
|
|
63
|
-
"getAllByText": [Function],
|
|
64
|
-
"getAllByTitle": [Function],
|
|
65
|
-
"getByAltText": [Function],
|
|
66
|
-
"getByDisplayValue": [Function],
|
|
67
|
-
"getByLabelText": [Function],
|
|
68
|
-
"getByPlaceholderText": [Function],
|
|
69
|
-
"getByRole": [Function],
|
|
70
|
-
"getByTestId": [Function],
|
|
71
|
-
"getByText": [Function],
|
|
72
|
-
"getByTitle": [Function],
|
|
73
|
-
"queryAllByAltText": [Function],
|
|
74
|
-
"queryAllByDisplayValue": [Function],
|
|
75
|
-
"queryAllByLabelText": [Function],
|
|
76
|
-
"queryAllByPlaceholderText": [Function],
|
|
77
|
-
"queryAllByRole": [Function],
|
|
78
|
-
"queryAllByTestId": [Function],
|
|
79
|
-
"queryAllByText": [Function],
|
|
80
|
-
"queryAllByTitle": [Function],
|
|
81
|
-
"queryByAltText": [Function],
|
|
82
|
-
"queryByDisplayValue": [Function],
|
|
83
|
-
"queryByLabelText": [Function],
|
|
84
|
-
"queryByPlaceholderText": [Function],
|
|
85
|
-
"queryByRole": [Function],
|
|
86
|
-
"queryByTestId": [Function],
|
|
87
|
-
"queryByText": [Function],
|
|
88
|
-
"queryByTitle": [Function],
|
|
89
|
-
"rerender": [Function],
|
|
90
|
-
"unmount": [Function],
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
function InputNumberDefault(_ref) {
|
|
18
|
-
var id = _ref.id,
|
|
19
|
-
value = _ref.value,
|
|
20
|
-
onChange = _ref.onChange,
|
|
21
|
-
_ref$disabled = _ref.disabled,
|
|
22
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
23
|
-
_ref$required = _ref.required,
|
|
24
|
-
required = _ref$required === void 0 ? true : _ref$required,
|
|
25
|
-
labelId = _ref.labelId,
|
|
26
|
-
min = _ref.min,
|
|
27
|
-
max = _ref.max,
|
|
28
|
-
decimals = _ref.decimals;
|
|
29
|
-
// Decimals is a number indicates the number behind the separator of decimals
|
|
30
|
-
// Computing step attribute of input according to decimal number
|
|
31
|
-
var _useState = (0, _react.useState)(decimals ? 1 / Math.pow(10, decimals) : 1),
|
|
32
|
-
_useState2 = _slicedToArray(_useState, 1),
|
|
33
|
-
step = _useState2[0];
|
|
34
|
-
var handleChange = (0, _react.useCallback)(function (e) {
|
|
35
|
-
var val = e.target.valueAsNumber;
|
|
36
|
-
onChange(Number.isNaN(val) ? null : val);
|
|
37
|
-
}, [onChange]);
|
|
38
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
39
|
-
id: id,
|
|
40
|
-
className: (0, _classnames["default"])({
|
|
41
|
-
disabled: disabled
|
|
42
|
-
}),
|
|
43
|
-
type: "number",
|
|
44
|
-
inputMode: decimals ? 'decimal' : 'numeric',
|
|
45
|
-
onChange: handleChange,
|
|
46
|
-
value: value !== null && value !== void 0 ? value : '',
|
|
47
|
-
"aria-labelledby": labelId,
|
|
48
|
-
disabled: disabled,
|
|
49
|
-
required: required,
|
|
50
|
-
min: min,
|
|
51
|
-
max: max,
|
|
52
|
-
step: step,
|
|
53
|
-
lang: "en"
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
var _default = InputNumberDefault;
|
|
57
|
-
exports["default"] = _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
id?: string;
|
|
3
|
-
onChange: (n: number | null) => void;
|
|
4
|
-
value?: number | null;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
labelId?: string;
|
|
8
|
-
min?: number;
|
|
9
|
-
max?: number;
|
|
10
|
-
decimals?: number;
|
|
11
|
-
};
|
|
12
|
-
declare function InputNumberDefault({ id, value, onChange, disabled, required, labelId, min, max, decimals, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export default InputNumberDefault;
|