@commercetools-uikit/number-input 16.0.0 → 16.1.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.
|
@@ -33,17 +33,14 @@ var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceP
|
|
|
33
33
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
34
34
|
|
|
35
35
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
36
|
-
|
|
37
36
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
38
37
|
const defaultProps = {
|
|
39
38
|
horizontalConstraint: 'scale'
|
|
40
39
|
};
|
|
41
|
-
|
|
42
40
|
const NumberInput = props => {
|
|
43
41
|
if (!props.isReadOnly) {
|
|
44
42
|
process.env.NODE_ENV !== "production" ? utils.warning(Boolean(props.onChange), 'NumberInput: `onChange` is required when input is not read only.') : void 0;
|
|
45
43
|
}
|
|
46
|
-
|
|
47
44
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
48
45
|
max: props.horizontalConstraint,
|
|
49
46
|
children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
|
|
@@ -72,7 +69,6 @@ const NumberInput = props => {
|
|
|
72
69
|
}))
|
|
73
70
|
});
|
|
74
71
|
};
|
|
75
|
-
|
|
76
72
|
NumberInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
77
73
|
id: _pt__default["default"].string,
|
|
78
74
|
name: _pt__default["default"].string,
|
|
@@ -96,31 +92,26 @@ NumberInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
96
92
|
} : {};
|
|
97
93
|
NumberInput.displayName = 'NumberInput';
|
|
98
94
|
NumberInput.defaultProps = defaultProps;
|
|
99
|
-
|
|
100
95
|
NumberInput.toFormValue = numberOrString => {
|
|
101
96
|
if (typeof numberOrString === 'number' || typeof numberOrString === 'string') {
|
|
102
97
|
return numberOrString;
|
|
103
98
|
}
|
|
104
|
-
|
|
105
99
|
return '';
|
|
106
100
|
};
|
|
107
|
-
|
|
108
101
|
NumberInput.isEmpty = value => {
|
|
109
102
|
if (typeof value === 'string') return _trimInstanceProperty__default["default"](value).call(value).length === 0;
|
|
110
103
|
if (typeof value === 'number') return isNaN(value);
|
|
111
104
|
return true;
|
|
112
105
|
};
|
|
113
|
-
|
|
114
106
|
NumberInput.hasFractionDigits = number => {
|
|
115
107
|
const fraction = Number(number) % 1;
|
|
116
108
|
process.env.NODE_ENV !== "production" ? utils.warning(!isNaN(fraction), 'NumberInput.hasFractionDigits may only be called with valid numbers (either as string or number).') : void 0;
|
|
117
109
|
return fraction !== 0;
|
|
118
110
|
};
|
|
119
|
-
|
|
120
111
|
var NumberInput$1 = NumberInput;
|
|
121
112
|
|
|
122
113
|
// NOTE: This string will be replaced on build time with the package version.
|
|
123
|
-
var version = "16.
|
|
114
|
+
var version = "16.1.0";
|
|
124
115
|
|
|
125
116
|
exports["default"] = NumberInput$1;
|
|
126
117
|
exports.version = version;
|
|
@@ -32,15 +32,12 @@ var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceP
|
|
|
32
32
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
33
33
|
|
|
34
34
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
-
|
|
36
35
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
37
36
|
const defaultProps = {
|
|
38
37
|
horizontalConstraint: 'scale'
|
|
39
38
|
};
|
|
40
|
-
|
|
41
39
|
const NumberInput = props => {
|
|
42
40
|
if (!props.isReadOnly) ;
|
|
43
|
-
|
|
44
41
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
45
42
|
max: props.horizontalConstraint,
|
|
46
43
|
children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
|
|
@@ -69,34 +66,28 @@ const NumberInput = props => {
|
|
|
69
66
|
}))
|
|
70
67
|
});
|
|
71
68
|
};
|
|
72
|
-
|
|
73
69
|
NumberInput.propTypes = {};
|
|
74
70
|
NumberInput.displayName = 'NumberInput';
|
|
75
71
|
NumberInput.defaultProps = defaultProps;
|
|
76
|
-
|
|
77
72
|
NumberInput.toFormValue = numberOrString => {
|
|
78
73
|
if (typeof numberOrString === 'number' || typeof numberOrString === 'string') {
|
|
79
74
|
return numberOrString;
|
|
80
75
|
}
|
|
81
|
-
|
|
82
76
|
return '';
|
|
83
77
|
};
|
|
84
|
-
|
|
85
78
|
NumberInput.isEmpty = value => {
|
|
86
79
|
if (typeof value === 'string') return _trimInstanceProperty__default["default"](value).call(value).length === 0;
|
|
87
80
|
if (typeof value === 'number') return isNaN(value);
|
|
88
81
|
return true;
|
|
89
82
|
};
|
|
90
|
-
|
|
91
83
|
NumberInput.hasFractionDigits = number => {
|
|
92
84
|
const fraction = Number(number) % 1;
|
|
93
85
|
return fraction !== 0;
|
|
94
86
|
};
|
|
95
|
-
|
|
96
87
|
var NumberInput$1 = NumberInput;
|
|
97
88
|
|
|
98
89
|
// NOTE: This string will be replaced on build time with the package version.
|
|
99
|
-
var version = "16.
|
|
90
|
+
var version = "16.1.0";
|
|
100
91
|
|
|
101
92
|
exports["default"] = NumberInput$1;
|
|
102
93
|
exports.version = version;
|
|
@@ -15,17 +15,14 @@ import { getInputStyles } from '@commercetools-uikit/input-utils';
|
|
|
15
15
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
16
16
|
|
|
17
17
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
-
|
|
19
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
19
|
const defaultProps = {
|
|
21
20
|
horizontalConstraint: 'scale'
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
const NumberInput = props => {
|
|
25
23
|
if (!props.isReadOnly) {
|
|
26
24
|
process.env.NODE_ENV !== "production" ? warning(Boolean(props.onChange), 'NumberInput: `onChange` is required when input is not read only.') : void 0;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
return jsx(Constraints.Horizontal, {
|
|
30
27
|
max: props.horizontalConstraint,
|
|
31
28
|
children: jsx("input", _objectSpread(_objectSpread({
|
|
@@ -54,7 +51,6 @@ const NumberInput = props => {
|
|
|
54
51
|
}))
|
|
55
52
|
});
|
|
56
53
|
};
|
|
57
|
-
|
|
58
54
|
NumberInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
59
55
|
id: _pt.string,
|
|
60
56
|
name: _pt.string,
|
|
@@ -78,30 +74,25 @@ NumberInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
78
74
|
} : {};
|
|
79
75
|
NumberInput.displayName = 'NumberInput';
|
|
80
76
|
NumberInput.defaultProps = defaultProps;
|
|
81
|
-
|
|
82
77
|
NumberInput.toFormValue = numberOrString => {
|
|
83
78
|
if (typeof numberOrString === 'number' || typeof numberOrString === 'string') {
|
|
84
79
|
return numberOrString;
|
|
85
80
|
}
|
|
86
|
-
|
|
87
81
|
return '';
|
|
88
82
|
};
|
|
89
|
-
|
|
90
83
|
NumberInput.isEmpty = value => {
|
|
91
84
|
if (typeof value === 'string') return _trimInstanceProperty(value).call(value).length === 0;
|
|
92
85
|
if (typeof value === 'number') return isNaN(value);
|
|
93
86
|
return true;
|
|
94
87
|
};
|
|
95
|
-
|
|
96
88
|
NumberInput.hasFractionDigits = number => {
|
|
97
89
|
const fraction = Number(number) % 1;
|
|
98
90
|
process.env.NODE_ENV !== "production" ? warning(!isNaN(fraction), 'NumberInput.hasFractionDigits may only be called with valid numbers (either as string or number).') : void 0;
|
|
99
91
|
return fraction !== 0;
|
|
100
92
|
};
|
|
101
|
-
|
|
102
93
|
var NumberInput$1 = NumberInput;
|
|
103
94
|
|
|
104
95
|
// NOTE: This string will be replaced on build time with the package version.
|
|
105
|
-
var version = "16.
|
|
96
|
+
var version = "16.1.0";
|
|
106
97
|
|
|
107
98
|
export { NumberInput$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/number-input",
|
|
3
3
|
"description": "A controlled input component for numbers with validation states.",
|
|
4
|
-
"version": "16.
|
|
4
|
+
"version": "16.1.0",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "16.
|
|
25
|
-
"@commercetools-uikit/design-system": "16.
|
|
26
|
-
"@commercetools-uikit/input-utils": "16.
|
|
27
|
-
"@commercetools-uikit/utils": "16.
|
|
24
|
+
"@commercetools-uikit/constraints": "16.1.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "16.1.0",
|
|
26
|
+
"@commercetools-uikit/input-utils": "16.1.0",
|
|
27
|
+
"@commercetools-uikit/utils": "16.1.0",
|
|
28
28
|
"@emotion/react": "^11.10.5",
|
|
29
29
|
"@emotion/styled": "^11.10.5",
|
|
30
30
|
"prop-types": "15.8.1"
|