@commercetools-uikit/number-field 20.2.3 → 20.3.1
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.
|
@@ -52,14 +52,30 @@ var NumberInput__default = /*#__PURE__*/_interopDefault(NumberInput);
|
|
|
52
52
|
|
|
53
53
|
var messages = reactIntl.defineMessages({
|
|
54
54
|
belowMinError: {
|
|
55
|
-
id:
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
id: "UIKit.NumberField.belowMinError",
|
|
56
|
+
defaultMessage: [{
|
|
57
|
+
"type": 0,
|
|
58
|
+
"value": "Value must be greater than or equal to "
|
|
59
|
+
}, {
|
|
60
|
+
"type": 1,
|
|
61
|
+
"value": "min"
|
|
62
|
+
}, {
|
|
63
|
+
"type": 0,
|
|
64
|
+
"value": "."
|
|
65
|
+
}]
|
|
58
66
|
},
|
|
59
67
|
aboveMaxError: {
|
|
60
|
-
id:
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
id: "UIKit.NumberField.aboveMaxError",
|
|
69
|
+
defaultMessage: [{
|
|
70
|
+
"type": 0,
|
|
71
|
+
"value": "Value must be less than or equal to "
|
|
72
|
+
}, {
|
|
73
|
+
"type": 1,
|
|
74
|
+
"value": "max"
|
|
75
|
+
}, {
|
|
76
|
+
"type": 0,
|
|
77
|
+
"value": "."
|
|
78
|
+
}]
|
|
63
79
|
}
|
|
64
80
|
});
|
|
65
81
|
|
|
@@ -131,8 +147,8 @@ let NumberField = /*#__PURE__*/function (_Component) {
|
|
|
131
147
|
}
|
|
132
148
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
133
149
|
const hasWarning = this.props.touched && hasWarnings(this.props.warnings);
|
|
134
|
-
const errorsContainerId =
|
|
135
|
-
const warningsContainerId =
|
|
150
|
+
const errorsContainerId = "".concat(this.state.id, "-errors");
|
|
151
|
+
const warningsContainerId = "".concat(this.state.id, "-warnings");
|
|
136
152
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
137
153
|
max: this.props.horizontalConstraint,
|
|
138
154
|
children: jsxRuntime.jsxs(Stack__default["default"], {
|
|
@@ -172,9 +188,13 @@ let NumberField = /*#__PURE__*/function (_Component) {
|
|
|
172
188
|
id: errorsContainerId,
|
|
173
189
|
errors: this.props.errors,
|
|
174
190
|
isVisible: hasError,
|
|
175
|
-
renderError: (key, error) =>
|
|
176
|
-
|
|
177
|
-
|
|
191
|
+
renderError: (key, error) => {
|
|
192
|
+
var _this$props$renderErr, _this$props;
|
|
193
|
+
return (
|
|
194
|
+
// Custom errors take precedence over the default errors
|
|
195
|
+
((_this$props$renderErr = (_this$props = this.props).renderError) === null || _this$props$renderErr === void 0 ? void 0 : _this$props$renderErr.call(_this$props, key, error)) || this.renderError(key)
|
|
196
|
+
);
|
|
197
|
+
}
|
|
178
198
|
}), jsxRuntime.jsx(FieldWarnings__default["default"], {
|
|
179
199
|
id: warningsContainerId,
|
|
180
200
|
warnings: this.props.warnings,
|
|
@@ -207,7 +227,7 @@ NumberField.getDerivedStateFromProps = (props, state) => ({
|
|
|
207
227
|
var NumberField$1 = NumberField;
|
|
208
228
|
|
|
209
229
|
// NOTE: This string will be replaced on build time with the package version.
|
|
210
|
-
var version = "20.
|
|
230
|
+
var version = "20.3.1";
|
|
211
231
|
|
|
212
232
|
exports["default"] = NumberField$1;
|
|
213
233
|
exports.version = version;
|
|
@@ -52,14 +52,30 @@ var NumberInput__default = /*#__PURE__*/_interopDefault(NumberInput);
|
|
|
52
52
|
|
|
53
53
|
var messages = reactIntl.defineMessages({
|
|
54
54
|
belowMinError: {
|
|
55
|
-
id:
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
id: "UIKit.NumberField.belowMinError",
|
|
56
|
+
defaultMessage: [{
|
|
57
|
+
"type": 0,
|
|
58
|
+
"value": "Value must be greater than or equal to "
|
|
59
|
+
}, {
|
|
60
|
+
"type": 1,
|
|
61
|
+
"value": "min"
|
|
62
|
+
}, {
|
|
63
|
+
"type": 0,
|
|
64
|
+
"value": "."
|
|
65
|
+
}]
|
|
58
66
|
},
|
|
59
67
|
aboveMaxError: {
|
|
60
|
-
id:
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
id: "UIKit.NumberField.aboveMaxError",
|
|
69
|
+
defaultMessage: [{
|
|
70
|
+
"type": 0,
|
|
71
|
+
"value": "Value must be less than or equal to "
|
|
72
|
+
}, {
|
|
73
|
+
"type": 1,
|
|
74
|
+
"value": "max"
|
|
75
|
+
}, {
|
|
76
|
+
"type": 0,
|
|
77
|
+
"value": "."
|
|
78
|
+
}]
|
|
63
79
|
}
|
|
64
80
|
});
|
|
65
81
|
|
|
@@ -127,8 +143,8 @@ let NumberField = /*#__PURE__*/function (_Component) {
|
|
|
127
143
|
if (this.props.hintIcon) ;
|
|
128
144
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
129
145
|
const hasWarning = this.props.touched && hasWarnings(this.props.warnings);
|
|
130
|
-
const errorsContainerId =
|
|
131
|
-
const warningsContainerId =
|
|
146
|
+
const errorsContainerId = "".concat(this.state.id, "-errors");
|
|
147
|
+
const warningsContainerId = "".concat(this.state.id, "-warnings");
|
|
132
148
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
133
149
|
max: this.props.horizontalConstraint,
|
|
134
150
|
children: jsxRuntime.jsxs(Stack__default["default"], {
|
|
@@ -168,9 +184,13 @@ let NumberField = /*#__PURE__*/function (_Component) {
|
|
|
168
184
|
id: errorsContainerId,
|
|
169
185
|
errors: this.props.errors,
|
|
170
186
|
isVisible: hasError,
|
|
171
|
-
renderError: (key, error) =>
|
|
172
|
-
|
|
173
|
-
|
|
187
|
+
renderError: (key, error) => {
|
|
188
|
+
var _this$props$renderErr, _this$props;
|
|
189
|
+
return (
|
|
190
|
+
// Custom errors take precedence over the default errors
|
|
191
|
+
((_this$props$renderErr = (_this$props = this.props).renderError) === null || _this$props$renderErr === void 0 ? void 0 : _this$props$renderErr.call(_this$props, key, error)) || this.renderError(key)
|
|
192
|
+
);
|
|
193
|
+
}
|
|
174
194
|
}), jsxRuntime.jsx(FieldWarnings__default["default"], {
|
|
175
195
|
id: warningsContainerId,
|
|
176
196
|
warnings: this.props.warnings,
|
|
@@ -203,7 +223,7 @@ NumberField.getDerivedStateFromProps = (props, state) => ({
|
|
|
203
223
|
var NumberField$1 = NumberField;
|
|
204
224
|
|
|
205
225
|
// NOTE: This string will be replaced on build time with the package version.
|
|
206
|
-
var version = "20.
|
|
226
|
+
var version = "20.3.1";
|
|
207
227
|
|
|
208
228
|
exports["default"] = NumberField$1;
|
|
209
229
|
exports.version = version;
|
|
@@ -28,14 +28,30 @@ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
|
28
28
|
|
|
29
29
|
var messages = defineMessages({
|
|
30
30
|
belowMinError: {
|
|
31
|
-
id:
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
id: "UIKit.NumberField.belowMinError",
|
|
32
|
+
defaultMessage: [{
|
|
33
|
+
"type": 0,
|
|
34
|
+
"value": "Value must be greater than or equal to "
|
|
35
|
+
}, {
|
|
36
|
+
"type": 1,
|
|
37
|
+
"value": "min"
|
|
38
|
+
}, {
|
|
39
|
+
"type": 0,
|
|
40
|
+
"value": "."
|
|
41
|
+
}]
|
|
34
42
|
},
|
|
35
43
|
aboveMaxError: {
|
|
36
|
-
id:
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
id: "UIKit.NumberField.aboveMaxError",
|
|
45
|
+
defaultMessage: [{
|
|
46
|
+
"type": 0,
|
|
47
|
+
"value": "Value must be less than or equal to "
|
|
48
|
+
}, {
|
|
49
|
+
"type": 1,
|
|
50
|
+
"value": "max"
|
|
51
|
+
}, {
|
|
52
|
+
"type": 0,
|
|
53
|
+
"value": "."
|
|
54
|
+
}]
|
|
39
55
|
}
|
|
40
56
|
});
|
|
41
57
|
|
|
@@ -107,8 +123,8 @@ let NumberField = /*#__PURE__*/function (_Component) {
|
|
|
107
123
|
}
|
|
108
124
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
109
125
|
const hasWarning = this.props.touched && hasWarnings(this.props.warnings);
|
|
110
|
-
const errorsContainerId =
|
|
111
|
-
const warningsContainerId =
|
|
126
|
+
const errorsContainerId = "".concat(this.state.id, "-errors");
|
|
127
|
+
const warningsContainerId = "".concat(this.state.id, "-warnings");
|
|
112
128
|
return jsx(Constraints.Horizontal, {
|
|
113
129
|
max: this.props.horizontalConstraint,
|
|
114
130
|
children: jsxs(Stack, {
|
|
@@ -148,9 +164,13 @@ let NumberField = /*#__PURE__*/function (_Component) {
|
|
|
148
164
|
id: errorsContainerId,
|
|
149
165
|
errors: this.props.errors,
|
|
150
166
|
isVisible: hasError,
|
|
151
|
-
renderError: (key, error) =>
|
|
152
|
-
|
|
153
|
-
|
|
167
|
+
renderError: (key, error) => {
|
|
168
|
+
var _this$props$renderErr, _this$props;
|
|
169
|
+
return (
|
|
170
|
+
// Custom errors take precedence over the default errors
|
|
171
|
+
((_this$props$renderErr = (_this$props = this.props).renderError) === null || _this$props$renderErr === void 0 ? void 0 : _this$props$renderErr.call(_this$props, key, error)) || this.renderError(key)
|
|
172
|
+
);
|
|
173
|
+
}
|
|
154
174
|
}), jsx(FieldWarnings, {
|
|
155
175
|
id: warningsContainerId,
|
|
156
176
|
warnings: this.props.warnings,
|
|
@@ -183,6 +203,6 @@ NumberField.getDerivedStateFromProps = (props, state) => ({
|
|
|
183
203
|
var NumberField$1 = NumberField;
|
|
184
204
|
|
|
185
205
|
// NOTE: This string will be replaced on build time with the package version.
|
|
186
|
-
var version = "20.
|
|
206
|
+
var version = "20.3.1";
|
|
187
207
|
|
|
188
208
|
export { NumberField$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/number-field",
|
|
3
3
|
"description": "A controlled input component for numbers with validation states and a label.",
|
|
4
|
-
"version": "20.
|
|
4
|
+
"version": "20.3.1",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "20.
|
|
25
|
-
"@commercetools-uikit/design-system": "20.
|
|
26
|
-
"@commercetools-uikit/field-errors": "20.
|
|
27
|
-
"@commercetools-uikit/field-label": "20.
|
|
28
|
-
"@commercetools-uikit/field-warnings": "20.
|
|
29
|
-
"@commercetools-uikit/number-input": "20.
|
|
30
|
-
"@commercetools-uikit/spacings-stack": "20.
|
|
31
|
-
"@commercetools-uikit/utils": "20.
|
|
24
|
+
"@commercetools-uikit/constraints": "20.3.1",
|
|
25
|
+
"@commercetools-uikit/design-system": "20.3.1",
|
|
26
|
+
"@commercetools-uikit/field-errors": "20.3.1",
|
|
27
|
+
"@commercetools-uikit/field-label": "20.3.1",
|
|
28
|
+
"@commercetools-uikit/field-warnings": "20.3.1",
|
|
29
|
+
"@commercetools-uikit/number-input": "20.3.1",
|
|
30
|
+
"@commercetools-uikit/spacings-stack": "20.3.1",
|
|
31
|
+
"@commercetools-uikit/utils": "20.3.1",
|
|
32
32
|
"@emotion/react": "^11.10.5",
|
|
33
33
|
"@emotion/styled": "^11.10.5",
|
|
34
34
|
"react-intl": "^7.1.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"react": "19.
|
|
37
|
+
"react": "19.2.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": "19.x"
|