@commercetools-uikit/text-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.
|
@@ -50,35 +50,26 @@ var TextInput__default = /*#__PURE__*/_interopDefault(TextInput);
|
|
|
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('text-field-');
|
|
60
57
|
const sequentialErrorsId = utils.createSequentialId('text-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
62
|
|
|
63
|
+
// Similar shape of `FormikErrors` but values are `TFieldErrors` objects.
|
|
68
64
|
let TextField = /*#__PURE__*/function (_Component) {
|
|
69
65
|
_inherits(TextField, _Component);
|
|
70
|
-
|
|
71
66
|
var _super = _createSuper(TextField);
|
|
72
|
-
|
|
73
67
|
function TextField() {
|
|
74
68
|
var _this;
|
|
75
|
-
|
|
76
69
|
_classCallCheck(this, TextField);
|
|
77
|
-
|
|
78
70
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
79
71
|
args[_key] = arguments[_key];
|
|
80
72
|
}
|
|
81
|
-
|
|
82
73
|
_this = _super.call(this, ...args);
|
|
83
74
|
_this.state = {
|
|
84
75
|
// We generate an id in case no id is provided by the parent to attach the
|
|
@@ -87,18 +78,15 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
87
78
|
};
|
|
88
79
|
return _this;
|
|
89
80
|
}
|
|
90
|
-
|
|
91
81
|
_createClass(TextField, [{
|
|
92
82
|
key: "render",
|
|
93
83
|
value: function render() {
|
|
94
84
|
if (!this.props.isReadOnly) {
|
|
95
85
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.onChange === 'function', 'TextField: `onChange` is required when field is not read only.') : void 0;
|
|
96
86
|
}
|
|
97
|
-
|
|
98
87
|
if (this.props.hintIcon) {
|
|
99
88
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'TextField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
100
89
|
}
|
|
101
|
-
|
|
102
90
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
103
91
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
104
92
|
max: this.props.horizontalConstraint,
|
|
@@ -152,19 +140,15 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
152
140
|
return errors;
|
|
153
141
|
}
|
|
154
142
|
}]);
|
|
155
|
-
|
|
156
143
|
return TextField;
|
|
157
144
|
}(react.Component);
|
|
158
|
-
|
|
159
145
|
TextField.displayName = 'TextField';
|
|
160
146
|
TextField.defaultProps = {
|
|
161
147
|
horizontalConstraint: 'scale'
|
|
162
148
|
};
|
|
163
|
-
|
|
164
149
|
TextField.getDerivedStateFromProps = (props, state) => ({
|
|
165
150
|
id: utils.getFieldId(props, state, sequentialId)
|
|
166
151
|
});
|
|
167
|
-
|
|
168
152
|
TextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
169
153
|
id: _pt__default["default"].string,
|
|
170
154
|
horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
@@ -192,7 +176,7 @@ TextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
192
176
|
var TextField$1 = TextField;
|
|
193
177
|
|
|
194
178
|
// NOTE: This string will be replaced on build time with the package version.
|
|
195
|
-
var version = "16.
|
|
179
|
+
var version = "16.1.0";
|
|
196
180
|
|
|
197
181
|
exports["default"] = TextField$1;
|
|
198
182
|
exports.version = version;
|
|
@@ -49,35 +49,26 @@ var TextInput__default = /*#__PURE__*/_interopDefault(TextInput);
|
|
|
49
49
|
var FieldErrors__default = /*#__PURE__*/_interopDefault(FieldErrors);
|
|
50
50
|
|
|
51
51
|
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; }
|
|
52
|
-
|
|
53
52
|
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; }
|
|
54
|
-
|
|
55
53
|
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); }; }
|
|
56
|
-
|
|
57
54
|
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; } }
|
|
58
55
|
const sequentialId = utils.createSequentialId('text-field-');
|
|
59
56
|
const sequentialErrorsId = utils.createSequentialId('text-field-error-')();
|
|
60
|
-
|
|
61
57
|
const hasErrors = errors => {
|
|
62
58
|
var _context;
|
|
63
|
-
|
|
64
59
|
return errors && _someInstanceProperty__default["default"](_context = _Object$values__default["default"](errors)).call(_context, Boolean);
|
|
65
60
|
};
|
|
66
61
|
|
|
62
|
+
// Similar shape of `FormikErrors` but values are `TFieldErrors` objects.
|
|
67
63
|
let TextField = /*#__PURE__*/function (_Component) {
|
|
68
64
|
_inherits(TextField, _Component);
|
|
69
|
-
|
|
70
65
|
var _super = _createSuper(TextField);
|
|
71
|
-
|
|
72
66
|
function TextField() {
|
|
73
67
|
var _this;
|
|
74
|
-
|
|
75
68
|
_classCallCheck(this, TextField);
|
|
76
|
-
|
|
77
69
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
78
70
|
args[_key] = arguments[_key];
|
|
79
71
|
}
|
|
80
|
-
|
|
81
72
|
_this = _super.call(this, ...args);
|
|
82
73
|
_this.state = {
|
|
83
74
|
// We generate an id in case no id is provided by the parent to attach the
|
|
@@ -86,14 +77,11 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
86
77
|
};
|
|
87
78
|
return _this;
|
|
88
79
|
}
|
|
89
|
-
|
|
90
80
|
_createClass(TextField, [{
|
|
91
81
|
key: "render",
|
|
92
82
|
value: function render() {
|
|
93
83
|
if (!this.props.isReadOnly) ;
|
|
94
|
-
|
|
95
84
|
if (this.props.hintIcon) ;
|
|
96
|
-
|
|
97
85
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
98
86
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
99
87
|
max: this.props.horizontalConstraint,
|
|
@@ -147,24 +135,20 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
147
135
|
return errors;
|
|
148
136
|
}
|
|
149
137
|
}]);
|
|
150
|
-
|
|
151
138
|
return TextField;
|
|
152
139
|
}(react.Component);
|
|
153
|
-
|
|
154
140
|
TextField.displayName = 'TextField';
|
|
155
141
|
TextField.defaultProps = {
|
|
156
142
|
horizontalConstraint: 'scale'
|
|
157
143
|
};
|
|
158
|
-
|
|
159
144
|
TextField.getDerivedStateFromProps = (props, state) => ({
|
|
160
145
|
id: utils.getFieldId(props, state, sequentialId)
|
|
161
146
|
});
|
|
162
|
-
|
|
163
147
|
TextField.propTypes = {};
|
|
164
148
|
var TextField$1 = TextField;
|
|
165
149
|
|
|
166
150
|
// NOTE: This string will be replaced on build time with the package version.
|
|
167
|
-
var version = "16.
|
|
151
|
+
var version = "16.1.0";
|
|
168
152
|
|
|
169
153
|
exports["default"] = TextField$1;
|
|
170
154
|
exports.version = version;
|
|
@@ -26,35 +26,26 @@ import FieldErrors from '@commercetools-uikit/field-errors';
|
|
|
26
26
|
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
27
27
|
|
|
28
28
|
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; }
|
|
29
|
-
|
|
30
29
|
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; }
|
|
31
|
-
|
|
32
30
|
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); }; }
|
|
33
|
-
|
|
34
31
|
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; } }
|
|
35
32
|
const sequentialId = createSequentialId('text-field-');
|
|
36
33
|
const sequentialErrorsId = createSequentialId('text-field-error-')();
|
|
37
|
-
|
|
38
34
|
const hasErrors = errors => {
|
|
39
35
|
var _context;
|
|
40
|
-
|
|
41
36
|
return errors && _someInstanceProperty(_context = _Object$values(errors)).call(_context, Boolean);
|
|
42
37
|
};
|
|
43
38
|
|
|
39
|
+
// Similar shape of `FormikErrors` but values are `TFieldErrors` objects.
|
|
44
40
|
let TextField = /*#__PURE__*/function (_Component) {
|
|
45
41
|
_inherits(TextField, _Component);
|
|
46
|
-
|
|
47
42
|
var _super = _createSuper(TextField);
|
|
48
|
-
|
|
49
43
|
function TextField() {
|
|
50
44
|
var _this;
|
|
51
|
-
|
|
52
45
|
_classCallCheck(this, TextField);
|
|
53
|
-
|
|
54
46
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
55
47
|
args[_key] = arguments[_key];
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
_this = _super.call(this, ...args);
|
|
59
50
|
_this.state = {
|
|
60
51
|
// We generate an id in case no id is provided by the parent to attach the
|
|
@@ -63,18 +54,15 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
63
54
|
};
|
|
64
55
|
return _this;
|
|
65
56
|
}
|
|
66
|
-
|
|
67
57
|
_createClass(TextField, [{
|
|
68
58
|
key: "render",
|
|
69
59
|
value: function render() {
|
|
70
60
|
if (!this.props.isReadOnly) {
|
|
71
61
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.onChange === 'function', 'TextField: `onChange` is required when field is not read only.') : void 0;
|
|
72
62
|
}
|
|
73
|
-
|
|
74
63
|
if (this.props.hintIcon) {
|
|
75
64
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'TextField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
76
65
|
}
|
|
77
|
-
|
|
78
66
|
const hasError = this.props.touched && hasErrors(this.props.errors);
|
|
79
67
|
return jsx(Constraints.Horizontal, {
|
|
80
68
|
max: this.props.horizontalConstraint,
|
|
@@ -128,19 +116,15 @@ let TextField = /*#__PURE__*/function (_Component) {
|
|
|
128
116
|
return errors;
|
|
129
117
|
}
|
|
130
118
|
}]);
|
|
131
|
-
|
|
132
119
|
return TextField;
|
|
133
120
|
}(Component);
|
|
134
|
-
|
|
135
121
|
TextField.displayName = 'TextField';
|
|
136
122
|
TextField.defaultProps = {
|
|
137
123
|
horizontalConstraint: 'scale'
|
|
138
124
|
};
|
|
139
|
-
|
|
140
125
|
TextField.getDerivedStateFromProps = (props, state) => ({
|
|
141
126
|
id: getFieldId(props, state, sequentialId)
|
|
142
127
|
});
|
|
143
|
-
|
|
144
128
|
TextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
145
129
|
id: _pt.string,
|
|
146
130
|
horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
@@ -168,6 +152,6 @@ TextField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
168
152
|
var TextField$1 = TextField;
|
|
169
153
|
|
|
170
154
|
// NOTE: This string will be replaced on build time with the package version.
|
|
171
|
-
var version = "16.
|
|
155
|
+
var version = "16.1.0";
|
|
172
156
|
|
|
173
157
|
export { TextField$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/text-field",
|
|
3
3
|
"description": "A controlled text input component for single-line strings 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,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/spacings-stack": "16.
|
|
29
|
-
"@commercetools-uikit/text-input": "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/spacings-stack": "16.1.0",
|
|
29
|
+
"@commercetools-uikit/text-input": "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
|
"prop-types": "15.8.1",
|