@commercetools-uikit/creatable-select-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 CreatableSelectInput__default = /*#__PURE__*/_interopDefault(CreatableSelect
|
|
|
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('creatable-select-field-');
|
|
62
59
|
const sequentialErrorsId = utils.createSequentialId('creatable-select-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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
71
65
|
_inherits(CreatableSelectField, _Component);
|
|
72
|
-
|
|
73
66
|
var _super = _createSuper(CreatableSelectField);
|
|
74
|
-
|
|
75
67
|
function CreatableSelectField() {
|
|
76
68
|
var _this;
|
|
77
|
-
|
|
78
69
|
_classCallCheck(this, CreatableSelectField);
|
|
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,25 +78,20 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
89
78
|
};
|
|
90
79
|
return _this;
|
|
91
80
|
}
|
|
92
|
-
|
|
93
81
|
_createClass(CreatableSelectField, [{
|
|
94
82
|
key: "render",
|
|
95
83
|
value: function render() {
|
|
96
84
|
const hasError = CreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
97
|
-
|
|
98
85
|
if (!this.props.isReadOnly) {
|
|
99
86
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.onChange === 'function', 'CreatableSelectField: `onChange` is required when field is not read only.') : void 0;
|
|
100
87
|
}
|
|
101
|
-
|
|
102
88
|
if (this.props.hintIcon) {
|
|
103
89
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'CreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
104
90
|
}
|
|
105
|
-
|
|
106
91
|
if (this.props.isMulti) {
|
|
107
92
|
process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](this.props.value), 'CreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
108
93
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.touched === 'undefined' || _Array$isArray__default["default"](this.props.touched), 'CreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : 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, {
|
|
@@ -154,7 +138,8 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
154
138
|
placeholder: this.props.placeholder,
|
|
155
139
|
tabIndex: this.props.tabIndex,
|
|
156
140
|
tabSelectsValue: this.props.tabSelectsValue,
|
|
157
|
-
value: this.props.value
|
|
141
|
+
value: this.props.value
|
|
142
|
+
// Creatable props
|
|
158
143
|
,
|
|
159
144
|
allowCreateWhileLoading: this.props.allowCreateWhileLoading,
|
|
160
145
|
formatCreateLabel: this.props.formatCreateLabel,
|
|
@@ -185,15 +170,12 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
185
170
|
return errors;
|
|
186
171
|
}
|
|
187
172
|
}]);
|
|
188
|
-
|
|
189
173
|
return CreatableSelectField;
|
|
190
174
|
}(react.Component);
|
|
191
|
-
|
|
192
175
|
CreatableSelectField.displayName = 'CreatableSelectField';
|
|
193
176
|
CreatableSelectField.defaultProps = {
|
|
194
177
|
horizontalConstraint: 'scale'
|
|
195
178
|
};
|
|
196
|
-
|
|
197
179
|
CreatableSelectField.getDerivedStateFromProps = (props, state) => ({
|
|
198
180
|
id: utils.getFieldId(props, state, sequentialId)
|
|
199
181
|
});
|
|
@@ -229,7 +211,7 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
229
211
|
} : {};
|
|
230
212
|
|
|
231
213
|
// NOTE: This string will be replaced on build time with the package version.
|
|
232
|
-
var version = "16.
|
|
214
|
+
var version = "16.1.0";
|
|
233
215
|
|
|
234
216
|
exports["default"] = CreatableSelectField;
|
|
235
217
|
exports.version = version;
|
|
@@ -50,35 +50,24 @@ var CreatableSelectInput__default = /*#__PURE__*/_interopDefault(CreatableSelect
|
|
|
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('creatable-select-field-');
|
|
60
57
|
const sequentialErrorsId = utils.createSequentialId('creatable-select-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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
69
63
|
_inherits(CreatableSelectField, _Component);
|
|
70
|
-
|
|
71
64
|
var _super = _createSuper(CreatableSelectField);
|
|
72
|
-
|
|
73
65
|
function CreatableSelectField() {
|
|
74
66
|
var _this;
|
|
75
|
-
|
|
76
67
|
_classCallCheck(this, CreatableSelectField);
|
|
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,18 +76,13 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
87
76
|
};
|
|
88
77
|
return _this;
|
|
89
78
|
}
|
|
90
|
-
|
|
91
79
|
_createClass(CreatableSelectField, [{
|
|
92
80
|
key: "render",
|
|
93
81
|
value: function render() {
|
|
94
82
|
const hasError = CreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
95
|
-
|
|
96
83
|
if (!this.props.isReadOnly) ;
|
|
97
|
-
|
|
98
84
|
if (this.props.hintIcon) ;
|
|
99
|
-
|
|
100
85
|
if (this.props.isMulti) ;
|
|
101
|
-
|
|
102
86
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
103
87
|
max: this.props.horizontalConstraint,
|
|
104
88
|
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
@@ -145,7 +129,8 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
145
129
|
placeholder: this.props.placeholder,
|
|
146
130
|
tabIndex: this.props.tabIndex,
|
|
147
131
|
tabSelectsValue: this.props.tabSelectsValue,
|
|
148
|
-
value: this.props.value
|
|
132
|
+
value: this.props.value
|
|
133
|
+
// Creatable props
|
|
149
134
|
,
|
|
150
135
|
allowCreateWhileLoading: this.props.allowCreateWhileLoading,
|
|
151
136
|
formatCreateLabel: this.props.formatCreateLabel,
|
|
@@ -176,22 +161,19 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
176
161
|
return errors;
|
|
177
162
|
}
|
|
178
163
|
}]);
|
|
179
|
-
|
|
180
164
|
return CreatableSelectField;
|
|
181
165
|
}(react.Component);
|
|
182
|
-
|
|
183
166
|
CreatableSelectField.displayName = 'CreatableSelectField';
|
|
184
167
|
CreatableSelectField.defaultProps = {
|
|
185
168
|
horizontalConstraint: 'scale'
|
|
186
169
|
};
|
|
187
|
-
|
|
188
170
|
CreatableSelectField.getDerivedStateFromProps = (props, state) => ({
|
|
189
171
|
id: utils.getFieldId(props, state, sequentialId)
|
|
190
172
|
});
|
|
191
173
|
CreatableSelectField.propTypes = {};
|
|
192
174
|
|
|
193
175
|
// NOTE: This string will be replaced on build time with the package version.
|
|
194
|
-
var version = "16.
|
|
176
|
+
var version = "16.1.0";
|
|
195
177
|
|
|
196
178
|
exports["default"] = CreatableSelectField;
|
|
197
179
|
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('creatable-select-field-');
|
|
37
34
|
const sequentialErrorsId = createSequentialId('creatable-select-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 CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
46
40
|
_inherits(CreatableSelectField, _Component);
|
|
47
|
-
|
|
48
41
|
var _super = _createSuper(CreatableSelectField);
|
|
49
|
-
|
|
50
42
|
function CreatableSelectField() {
|
|
51
43
|
var _this;
|
|
52
|
-
|
|
53
44
|
_classCallCheck(this, CreatableSelectField);
|
|
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,25 +53,20 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
64
53
|
};
|
|
65
54
|
return _this;
|
|
66
55
|
}
|
|
67
|
-
|
|
68
56
|
_createClass(CreatableSelectField, [{
|
|
69
57
|
key: "render",
|
|
70
58
|
value: function render() {
|
|
71
59
|
const hasError = CreatableSelectInput.isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
72
|
-
|
|
73
60
|
if (!this.props.isReadOnly) {
|
|
74
61
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.onChange === 'function', 'CreatableSelectField: `onChange` is required when field is not read only.') : void 0;
|
|
75
62
|
}
|
|
76
|
-
|
|
77
63
|
if (this.props.hintIcon) {
|
|
78
64
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'CreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
79
65
|
}
|
|
80
|
-
|
|
81
66
|
if (this.props.isMulti) {
|
|
82
67
|
process.env.NODE_ENV !== "production" ? warning(_Array$isArray(this.props.value), 'CreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
83
68
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.touched === 'undefined' || _Array$isArray(this.props.touched), 'CreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
84
69
|
}
|
|
85
|
-
|
|
86
70
|
return jsx(Constraints.Horizontal, {
|
|
87
71
|
max: this.props.horizontalConstraint,
|
|
88
72
|
children: jsxs(Spacings.Stack, {
|
|
@@ -129,7 +113,8 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
129
113
|
placeholder: this.props.placeholder,
|
|
130
114
|
tabIndex: this.props.tabIndex,
|
|
131
115
|
tabSelectsValue: this.props.tabSelectsValue,
|
|
132
|
-
value: this.props.value
|
|
116
|
+
value: this.props.value
|
|
117
|
+
// Creatable props
|
|
133
118
|
,
|
|
134
119
|
allowCreateWhileLoading: this.props.allowCreateWhileLoading,
|
|
135
120
|
formatCreateLabel: this.props.formatCreateLabel,
|
|
@@ -160,15 +145,12 @@ let CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
160
145
|
return errors;
|
|
161
146
|
}
|
|
162
147
|
}]);
|
|
163
|
-
|
|
164
148
|
return CreatableSelectField;
|
|
165
149
|
}(Component);
|
|
166
|
-
|
|
167
150
|
CreatableSelectField.displayName = 'CreatableSelectField';
|
|
168
151
|
CreatableSelectField.defaultProps = {
|
|
169
152
|
horizontalConstraint: 'scale'
|
|
170
153
|
};
|
|
171
|
-
|
|
172
154
|
CreatableSelectField.getDerivedStateFromProps = (props, state) => ({
|
|
173
155
|
id: getFieldId(props, state, sequentialId)
|
|
174
156
|
});
|
|
@@ -204,6 +186,6 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
204
186
|
} : {};
|
|
205
187
|
|
|
206
188
|
// NOTE: This string will be replaced on build time with the package version.
|
|
207
|
-
var version = "16.
|
|
189
|
+
var version = "16.1.0";
|
|
208
190
|
|
|
209
191
|
export { CreatableSelectField as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/creatable-select-field",
|
|
3
3
|
"description": "A controlled input component with validation states and a label getting a selection from the user, and where options can also be created by the user.",
|
|
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/creatable-select-input": "16.
|
|
26
|
-
"@commercetools-uikit/design-system": "16.
|
|
27
|
-
"@commercetools-uikit/field-errors": "16.
|
|
28
|
-
"@commercetools-uikit/field-label": "16.
|
|
29
|
-
"@commercetools-uikit/spacings": "16.
|
|
30
|
-
"@commercetools-uikit/utils": "16.
|
|
24
|
+
"@commercetools-uikit/constraints": "16.1.0",
|
|
25
|
+
"@commercetools-uikit/creatable-select-input": "16.1.0",
|
|
26
|
+
"@commercetools-uikit/design-system": "16.1.0",
|
|
27
|
+
"@commercetools-uikit/field-errors": "16.1.0",
|
|
28
|
+
"@commercetools-uikit/field-label": "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
|
"prop-types": "15.8.1",
|