@commercetools-uikit/money-field 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.
|
@@ -52,35 +52,24 @@ var MoneyInput__default = /*#__PURE__*/_interopDefault(MoneyInput);
|
|
|
52
52
|
var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
|
|
53
53
|
|
|
54
54
|
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; }
|
|
55
|
-
|
|
56
55
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
57
|
-
|
|
58
56
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
59
|
-
|
|
60
57
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
58
|
const sequentialId = utils.createSequentialId('money-field-');
|
|
62
59
|
const sequentialErrorsId = utils.createSequentialId('money-field-error-')();
|
|
63
|
-
|
|
64
60
|
const hasErrors = errors => {
|
|
65
61
|
var _context;
|
|
66
|
-
|
|
67
62
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
68
63
|
};
|
|
69
|
-
|
|
70
64
|
let MoneyField = /*#__PURE__*/function (_Component) {
|
|
71
65
|
_inherits(MoneyField, _Component);
|
|
72
|
-
|
|
73
66
|
var _super = _createSuper(MoneyField);
|
|
74
|
-
|
|
75
67
|
function MoneyField() {
|
|
76
68
|
var _this;
|
|
77
|
-
|
|
78
69
|
_classCallCheck(this, MoneyField);
|
|
79
|
-
|
|
80
70
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
81
71
|
args[_key] = arguments[_key];
|
|
82
72
|
}
|
|
83
|
-
|
|
84
73
|
_this = _super.call(this, ...args);
|
|
85
74
|
_this.state = {
|
|
86
75
|
// We generate an id in case no id is provided by the parent to attach the
|
|
@@ -89,7 +78,6 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
89
78
|
};
|
|
90
79
|
return _this;
|
|
91
80
|
}
|
|
92
|
-
|
|
93
81
|
_createClass(MoneyField, [{
|
|
94
82
|
key: "render",
|
|
95
83
|
value: function render() {
|
|
@@ -97,17 +85,13 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
97
85
|
// This avoids showing an error when the user just selected a language but
|
|
98
86
|
// didn't add an amount yet.
|
|
99
87
|
const hasError = MoneyInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
100
|
-
|
|
101
88
|
if (!this.props.isReadOnly) {
|
|
102
89
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.onChange === 'function', 'MoneyField: `onChange` is required when field is not read only.') : void 0;
|
|
103
90
|
}
|
|
104
|
-
|
|
105
91
|
process.env.NODE_ENV !== "production" ? utils.warning(!has__default["default"](this.props, 'isTouched'), 'MoneyField: Invalid prop isTouched supplied to MoneyField. Use touched instead.') : void 0;
|
|
106
|
-
|
|
107
92
|
if (this.props.hintIcon) {
|
|
108
93
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'MoneyField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
109
94
|
}
|
|
110
|
-
|
|
111
95
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
112
96
|
max: this.props.horizontalConstraint,
|
|
113
97
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
@@ -162,19 +146,15 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
162
146
|
return errors;
|
|
163
147
|
}
|
|
164
148
|
}]);
|
|
165
|
-
|
|
166
149
|
return MoneyField;
|
|
167
150
|
}(react.Component);
|
|
168
|
-
|
|
169
151
|
MoneyField.displayName = 'MoneyField';
|
|
170
152
|
MoneyField.defaultProps = {
|
|
171
153
|
horizontalConstraint: 'scale'
|
|
172
154
|
};
|
|
173
|
-
|
|
174
155
|
MoneyField.getDerivedStateFromProps = (props, state) => ({
|
|
175
156
|
id: utils.getFieldId(props, state, sequentialId)
|
|
176
157
|
});
|
|
177
|
-
|
|
178
158
|
MoneyField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
179
159
|
id: _pt__default["default"].string,
|
|
180
160
|
horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
@@ -211,7 +191,7 @@ MoneyField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
211
191
|
var MoneyField$1 = MoneyField;
|
|
212
192
|
|
|
213
193
|
// NOTE: This string will be replaced on build time with the package version.
|
|
214
|
-
var version = "16.
|
|
194
|
+
var version = "16.1.0";
|
|
215
195
|
|
|
216
196
|
exports["default"] = MoneyField$1;
|
|
217
197
|
exports.version = version;
|
|
@@ -50,35 +50,24 @@ var MoneyInput__default = /*#__PURE__*/_interopDefault(MoneyInput);
|
|
|
50
50
|
var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
|
|
51
51
|
|
|
52
52
|
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; }
|
|
53
|
-
|
|
54
53
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
55
|
-
|
|
56
54
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
57
|
-
|
|
58
55
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
59
56
|
const sequentialId = utils.createSequentialId('money-field-');
|
|
60
57
|
const sequentialErrorsId = utils.createSequentialId('money-field-error-')();
|
|
61
|
-
|
|
62
58
|
const hasErrors = errors => {
|
|
63
59
|
var _context;
|
|
64
|
-
|
|
65
60
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
66
61
|
};
|
|
67
|
-
|
|
68
62
|
let MoneyField = /*#__PURE__*/function (_Component) {
|
|
69
63
|
_inherits(MoneyField, _Component);
|
|
70
|
-
|
|
71
64
|
var _super = _createSuper(MoneyField);
|
|
72
|
-
|
|
73
65
|
function MoneyField() {
|
|
74
66
|
var _this;
|
|
75
|
-
|
|
76
67
|
_classCallCheck(this, MoneyField);
|
|
77
|
-
|
|
78
68
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
79
69
|
args[_key] = arguments[_key];
|
|
80
70
|
}
|
|
81
|
-
|
|
82
71
|
_this = _super.call(this, ...args);
|
|
83
72
|
_this.state = {
|
|
84
73
|
// We generate an id in case no id is provided by the parent to attach the
|
|
@@ -87,7 +76,6 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
87
76
|
};
|
|
88
77
|
return _this;
|
|
89
78
|
}
|
|
90
|
-
|
|
91
79
|
_createClass(MoneyField, [{
|
|
92
80
|
key: "render",
|
|
93
81
|
value: function render() {
|
|
@@ -95,11 +83,8 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
95
83
|
// This avoids showing an error when the user just selected a language but
|
|
96
84
|
// didn't add an amount yet.
|
|
97
85
|
const hasError = MoneyInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
98
|
-
|
|
99
86
|
if (!this.props.isReadOnly) ;
|
|
100
|
-
|
|
101
87
|
if (this.props.hintIcon) ;
|
|
102
|
-
|
|
103
88
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
104
89
|
max: this.props.horizontalConstraint,
|
|
105
90
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
@@ -154,24 +139,20 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
154
139
|
return errors;
|
|
155
140
|
}
|
|
156
141
|
}]);
|
|
157
|
-
|
|
158
142
|
return MoneyField;
|
|
159
143
|
}(react.Component);
|
|
160
|
-
|
|
161
144
|
MoneyField.displayName = 'MoneyField';
|
|
162
145
|
MoneyField.defaultProps = {
|
|
163
146
|
horizontalConstraint: 'scale'
|
|
164
147
|
};
|
|
165
|
-
|
|
166
148
|
MoneyField.getDerivedStateFromProps = (props, state) => ({
|
|
167
149
|
id: utils.getFieldId(props, state, sequentialId)
|
|
168
150
|
});
|
|
169
|
-
|
|
170
151
|
MoneyField.propTypes = {};
|
|
171
152
|
var MoneyField$1 = MoneyField;
|
|
172
153
|
|
|
173
154
|
// NOTE: This string will be replaced on build time with the package version.
|
|
174
|
-
var version = "16.
|
|
155
|
+
var version = "16.1.0";
|
|
175
156
|
|
|
176
157
|
exports["default"] = MoneyField$1;
|
|
177
158
|
exports.version = version;
|
|
@@ -27,35 +27,24 @@ import FieldErrors from '@commercetools-uikit/field-errors';
|
|
|
27
27
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
28
28
|
|
|
29
29
|
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; }
|
|
30
|
-
|
|
31
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
-
|
|
33
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
34
|
-
|
|
35
32
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
36
33
|
const sequentialId = createSequentialId('money-field-');
|
|
37
34
|
const sequentialErrorsId = createSequentialId('money-field-error-')();
|
|
38
|
-
|
|
39
35
|
const hasErrors = errors => {
|
|
40
36
|
var _context;
|
|
41
|
-
|
|
42
37
|
return errors && _someInstanceProperty(_context = _Object$values(errors)).call(_context, Boolean);
|
|
43
38
|
};
|
|
44
|
-
|
|
45
39
|
let MoneyField = /*#__PURE__*/function (_Component) {
|
|
46
40
|
_inherits(MoneyField, _Component);
|
|
47
|
-
|
|
48
41
|
var _super = _createSuper(MoneyField);
|
|
49
|
-
|
|
50
42
|
function MoneyField() {
|
|
51
43
|
var _this;
|
|
52
|
-
|
|
53
44
|
_classCallCheck(this, MoneyField);
|
|
54
|
-
|
|
55
45
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
56
46
|
args[_key] = arguments[_key];
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
_this = _super.call(this, ...args);
|
|
60
49
|
_this.state = {
|
|
61
50
|
// We generate an id in case no id is provided by the parent to attach the
|
|
@@ -64,7 +53,6 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
64
53
|
};
|
|
65
54
|
return _this;
|
|
66
55
|
}
|
|
67
|
-
|
|
68
56
|
_createClass(MoneyField, [{
|
|
69
57
|
key: "render",
|
|
70
58
|
value: function render() {
|
|
@@ -72,17 +60,13 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
72
60
|
// This avoids showing an error when the user just selected a language but
|
|
73
61
|
// didn't add an amount yet.
|
|
74
62
|
const hasError = MoneyInput.isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
75
|
-
|
|
76
63
|
if (!this.props.isReadOnly) {
|
|
77
64
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.onChange === 'function', 'MoneyField: `onChange` is required when field is not read only.') : void 0;
|
|
78
65
|
}
|
|
79
|
-
|
|
80
66
|
process.env.NODE_ENV !== "production" ? warning(!has(this.props, 'isTouched'), 'MoneyField: Invalid prop isTouched supplied to MoneyField. Use touched instead.') : void 0;
|
|
81
|
-
|
|
82
67
|
if (this.props.hintIcon) {
|
|
83
68
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'MoneyField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
return jsx(Constraints.Horizontal, {
|
|
87
71
|
max: this.props.horizontalConstraint,
|
|
88
72
|
children: jsxs(Spacings.Stack, {
|
|
@@ -137,19 +121,15 @@ let MoneyField = /*#__PURE__*/function (_Component) {
|
|
|
137
121
|
return errors;
|
|
138
122
|
}
|
|
139
123
|
}]);
|
|
140
|
-
|
|
141
124
|
return MoneyField;
|
|
142
125
|
}(Component);
|
|
143
|
-
|
|
144
126
|
MoneyField.displayName = 'MoneyField';
|
|
145
127
|
MoneyField.defaultProps = {
|
|
146
128
|
horizontalConstraint: 'scale'
|
|
147
129
|
};
|
|
148
|
-
|
|
149
130
|
MoneyField.getDerivedStateFromProps = (props, state) => ({
|
|
150
131
|
id: getFieldId(props, state, sequentialId)
|
|
151
132
|
});
|
|
152
|
-
|
|
153
133
|
MoneyField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
154
134
|
id: _pt.string,
|
|
155
135
|
horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
@@ -186,6 +166,6 @@ MoneyField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
186
166
|
var MoneyField$1 = MoneyField;
|
|
187
167
|
|
|
188
168
|
// NOTE: This string will be replaced on build time with the package version.
|
|
189
|
-
var version = "16.
|
|
169
|
+
var version = "16.1.0";
|
|
190
170
|
|
|
191
171
|
export { MoneyField$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/money-field",
|
|
3
3
|
"description": "A controlled input component for money values with validation states and a label.",
|
|
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,13 +21,13 @@
|
|
|
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/field-errors": "16.
|
|
27
|
-
"@commercetools-uikit/field-label": "16.
|
|
28
|
-
"@commercetools-uikit/money-input": "16.
|
|
29
|
-
"@commercetools-uikit/spacings": "16.
|
|
30
|
-
"@commercetools-uikit/utils": "16.
|
|
24
|
+
"@commercetools-uikit/constraints": "16.1.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "16.1.0",
|
|
26
|
+
"@commercetools-uikit/field-errors": "16.1.0",
|
|
27
|
+
"@commercetools-uikit/field-label": "16.1.0",
|
|
28
|
+
"@commercetools-uikit/money-input": "16.1.0",
|
|
29
|
+
"@commercetools-uikit/spacings": "16.1.0",
|
|
30
|
+
"@commercetools-uikit/utils": "16.1.0",
|
|
31
31
|
"@emotion/react": "^11.10.5",
|
|
32
32
|
"@emotion/styled": "^11.10.5",
|
|
33
33
|
"lodash": "4.17.21",
|