@commercetools-uikit/number-input 19.20.1 → 19.22.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.
|
@@ -11,6 +11,7 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
|
|
|
11
11
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
14
15
|
var _pt = require('prop-types');
|
|
15
16
|
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
16
17
|
var utils = require('@commercetools-uikit/utils');
|
|
@@ -32,17 +33,18 @@ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
|
|
|
32
33
|
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
33
34
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
34
35
|
|
|
36
|
+
const _excluded = ["horizontalConstraint"];
|
|
35
37
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
36
38
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
37
|
-
const
|
|
38
|
-
horizontalConstraint
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const NumberInput = _ref => {
|
|
40
|
+
let _ref$horizontalConstr = _ref.horizontalConstraint,
|
|
41
|
+
horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
|
|
42
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
41
43
|
if (!props.isReadOnly) {
|
|
42
44
|
process.env.NODE_ENV !== "production" ? utils.warning(Boolean(props.onChange), 'NumberInput: `onChange` is required when input is not read only.') : void 0;
|
|
43
45
|
}
|
|
44
46
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
45
|
-
max:
|
|
47
|
+
max: horizontalConstraint,
|
|
46
48
|
children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
|
|
47
49
|
id: props.id,
|
|
48
50
|
name: props.name,
|
|
@@ -60,7 +62,9 @@ const NumberInput = props => {
|
|
|
60
62
|
css: inputUtils.getInputStyles(props),
|
|
61
63
|
readOnly: props.isReadOnly,
|
|
62
64
|
autoFocus: props.isAutofocussed
|
|
63
|
-
}, utils.filterDataAttributes(
|
|
65
|
+
}, utils.filterDataAttributes(_objectSpread({
|
|
66
|
+
horizontalConstraint
|
|
67
|
+
}, props))), {}, {
|
|
64
68
|
/* ARIA */
|
|
65
69
|
"aria-readonly": props.isReadOnly,
|
|
66
70
|
contentEditable: !props.isReadOnly,
|
|
@@ -92,7 +96,6 @@ NumberInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
92
96
|
horizontalConstraint: _pt__default["default"].oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
|
|
93
97
|
} : {};
|
|
94
98
|
NumberInput.displayName = 'NumberInput';
|
|
95
|
-
NumberInput.defaultProps = defaultProps;
|
|
96
99
|
NumberInput.toFormValue = numberOrString => {
|
|
97
100
|
if (typeof numberOrString === 'number' || typeof numberOrString === 'string') {
|
|
98
101
|
return numberOrString;
|
|
@@ -112,7 +115,7 @@ NumberInput.hasFractionDigits = number => {
|
|
|
112
115
|
var NumberInput$1 = NumberInput;
|
|
113
116
|
|
|
114
117
|
// NOTE: This string will be replaced on build time with the package version.
|
|
115
|
-
var version = "19.
|
|
118
|
+
var version = "19.22.0";
|
|
116
119
|
|
|
117
120
|
exports["default"] = NumberInput$1;
|
|
118
121
|
exports.version = version;
|
|
@@ -11,6 +11,7 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
|
|
|
11
11
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
14
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
14
15
|
require('prop-types');
|
|
15
16
|
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
16
17
|
var utils = require('@commercetools-uikit/utils');
|
|
@@ -31,15 +32,16 @@ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defin
|
|
|
31
32
|
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
32
33
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
33
34
|
|
|
35
|
+
const _excluded = ["horizontalConstraint"];
|
|
34
36
|
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
37
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
36
|
-
const
|
|
37
|
-
horizontalConstraint
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const NumberInput = _ref => {
|
|
39
|
+
let _ref$horizontalConstr = _ref.horizontalConstraint,
|
|
40
|
+
horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
|
|
41
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
40
42
|
if (!props.isReadOnly) ;
|
|
41
43
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
42
|
-
max:
|
|
44
|
+
max: horizontalConstraint,
|
|
43
45
|
children: jsxRuntime.jsx("input", _objectSpread(_objectSpread({
|
|
44
46
|
id: props.id,
|
|
45
47
|
name: props.name,
|
|
@@ -57,7 +59,9 @@ const NumberInput = props => {
|
|
|
57
59
|
css: inputUtils.getInputStyles(props),
|
|
58
60
|
readOnly: props.isReadOnly,
|
|
59
61
|
autoFocus: props.isAutofocussed
|
|
60
|
-
}, utils.filterDataAttributes(
|
|
62
|
+
}, utils.filterDataAttributes(_objectSpread({
|
|
63
|
+
horizontalConstraint
|
|
64
|
+
}, props))), {}, {
|
|
61
65
|
/* ARIA */
|
|
62
66
|
"aria-readonly": props.isReadOnly,
|
|
63
67
|
contentEditable: !props.isReadOnly,
|
|
@@ -69,7 +73,6 @@ const NumberInput = props => {
|
|
|
69
73
|
};
|
|
70
74
|
NumberInput.propTypes = {};
|
|
71
75
|
NumberInput.displayName = 'NumberInput';
|
|
72
|
-
NumberInput.defaultProps = defaultProps;
|
|
73
76
|
NumberInput.toFormValue = numberOrString => {
|
|
74
77
|
if (typeof numberOrString === 'number' || typeof numberOrString === 'string') {
|
|
75
78
|
return numberOrString;
|
|
@@ -88,7 +91,7 @@ NumberInput.hasFractionDigits = number => {
|
|
|
88
91
|
var NumberInput$1 = NumberInput;
|
|
89
92
|
|
|
90
93
|
// NOTE: This string will be replaced on build time with the package version.
|
|
91
|
-
var version = "19.
|
|
94
|
+
var version = "19.22.0";
|
|
92
95
|
|
|
93
96
|
exports["default"] = NumberInput$1;
|
|
94
97
|
exports.version = version;
|
|
@@ -7,6 +7,7 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
|
|
|
7
7
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
10
|
+
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/esm/objectWithoutProperties';
|
|
10
11
|
import _pt from 'prop-types';
|
|
11
12
|
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
12
13
|
import { warning, filterDataAttributes } from '@commercetools-uikit/utils';
|
|
@@ -14,17 +15,18 @@ import Constraints from '@commercetools-uikit/constraints';
|
|
|
14
15
|
import { getInputStyles } from '@commercetools-uikit/input-utils';
|
|
15
16
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
16
17
|
|
|
18
|
+
const _excluded = ["horizontalConstraint"];
|
|
17
19
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
-
const
|
|
20
|
-
horizontalConstraint
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const NumberInput = _ref => {
|
|
22
|
+
let _ref$horizontalConstr = _ref.horizontalConstraint,
|
|
23
|
+
horizontalConstraint = _ref$horizontalConstr === void 0 ? 'scale' : _ref$horizontalConstr,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
25
|
if (!props.isReadOnly) {
|
|
24
26
|
process.env.NODE_ENV !== "production" ? warning(Boolean(props.onChange), 'NumberInput: `onChange` is required when input is not read only.') : void 0;
|
|
25
27
|
}
|
|
26
28
|
return jsx(Constraints.Horizontal, {
|
|
27
|
-
max:
|
|
29
|
+
max: horizontalConstraint,
|
|
28
30
|
children: jsx("input", _objectSpread(_objectSpread({
|
|
29
31
|
id: props.id,
|
|
30
32
|
name: props.name,
|
|
@@ -42,7 +44,9 @@ const NumberInput = props => {
|
|
|
42
44
|
css: getInputStyles(props),
|
|
43
45
|
readOnly: props.isReadOnly,
|
|
44
46
|
autoFocus: props.isAutofocussed
|
|
45
|
-
}, filterDataAttributes(
|
|
47
|
+
}, filterDataAttributes(_objectSpread({
|
|
48
|
+
horizontalConstraint
|
|
49
|
+
}, props))), {}, {
|
|
46
50
|
/* ARIA */
|
|
47
51
|
"aria-readonly": props.isReadOnly,
|
|
48
52
|
contentEditable: !props.isReadOnly,
|
|
@@ -74,7 +78,6 @@ NumberInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
74
78
|
horizontalConstraint: _pt.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'])
|
|
75
79
|
} : {};
|
|
76
80
|
NumberInput.displayName = 'NumberInput';
|
|
77
|
-
NumberInput.defaultProps = defaultProps;
|
|
78
81
|
NumberInput.toFormValue = numberOrString => {
|
|
79
82
|
if (typeof numberOrString === 'number' || typeof numberOrString === 'string') {
|
|
80
83
|
return numberOrString;
|
|
@@ -94,6 +97,6 @@ NumberInput.hasFractionDigits = number => {
|
|
|
94
97
|
var NumberInput$1 = NumberInput;
|
|
95
98
|
|
|
96
99
|
// NOTE: This string will be replaced on build time with the package version.
|
|
97
|
-
var version = "19.
|
|
100
|
+
var version = "19.22.0";
|
|
98
101
|
|
|
99
102
|
export { NumberInput$1 as default, version };
|
|
@@ -80,9 +80,8 @@ export type TNumberInputProps = {
|
|
|
80
80
|
horizontalConstraint?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
|
|
81
81
|
};
|
|
82
82
|
declare const NumberInput: {
|
|
83
|
-
(props: TNumberInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
83
|
+
({ horizontalConstraint, ...props }: TNumberInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
84
84
|
displayName: string;
|
|
85
|
-
defaultProps: Pick<TNumberInputProps, "horizontalConstraint">;
|
|
86
85
|
toFormValue(numberOrString: number | string): string | number;
|
|
87
86
|
isEmpty(value: number | string): boolean;
|
|
88
87
|
hasFractionDigits(number: number | string): boolean;
|
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": "19.
|
|
4
|
+
"version": "19.22.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": "19.
|
|
25
|
-
"@commercetools-uikit/design-system": "19.
|
|
26
|
-
"@commercetools-uikit/input-utils": "19.
|
|
27
|
-
"@commercetools-uikit/utils": "19.
|
|
24
|
+
"@commercetools-uikit/constraints": "19.22.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "19.22.0",
|
|
26
|
+
"@commercetools-uikit/input-utils": "19.22.0",
|
|
27
|
+
"@commercetools-uikit/utils": "19.22.0",
|
|
28
28
|
"@emotion/react": "^11.10.5",
|
|
29
29
|
"@emotion/styled": "^11.10.5",
|
|
30
30
|
"prop-types": "15.8.1"
|