@commercetools-uikit/async-creatable-select-field 14.0.1 → 15.0.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.
- package/README.md +3 -3
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.dev.js +7 -3
- package/dist/commercetools-uikit-async-creatable-select-field.cjs.prod.js +3 -1
- package/dist/commercetools-uikit-async-creatable-select-field.esm.js +7 -3
- package/dist/declarations/src/async-creatable-select-field.d.ts +4 -3
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ export default Example;
|
|
|
81
81
|
| `name` | `AsyncCreatableProps['name']` | | | Name of the HTML Input (optional - without this, no input will be rendered)
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
82
82
|
| `noOptionsMessage` | `AsyncCreatableProps['noOptionsMessage']` | | | Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place).
<br/>
Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
83
83
|
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
|
|
84
|
-
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) |
|
|
84
|
+
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) | | | Called with a fake event when value changes.
<br />
The event's `target.name` will be the name supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
85
85
|
| `onFocus` | `AsyncCreatableProps['onFocus']` | | | Handle focus events on the control
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
86
86
|
| `onInputChange` | `AsyncCreatableProps['onInputChange']` | | | Handle change events on the input
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
87
87
|
| `placeholder` | `AsyncCreatableProps['placeholder']` | | | Placeholder text for the select value
<br>
[Props from React select was used](https://react-select.com/props) |
|
|
@@ -117,13 +117,13 @@ export default Example;
|
|
|
117
117
|
### Signature `onBlur`
|
|
118
118
|
|
|
119
119
|
```ts
|
|
120
|
-
(event:
|
|
120
|
+
(event: TCustomEvent) => void
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
### Signature `onChange`
|
|
124
124
|
|
|
125
125
|
```ts
|
|
126
|
-
(event:
|
|
126
|
+
(event: TCustomEvent, info: ActionMeta<unknown>) => void
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### Signature `onInfoButtonClick`
|
|
@@ -99,13 +99,17 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
99
99
|
value: function render() {
|
|
100
100
|
var hasError = AsyncCreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
101
101
|
|
|
102
|
+
if (!this.props.isReadOnly) {
|
|
103
|
+
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.onChange === 'function', 'AsyncCreatableSelectField: `onChange` is required when field is not read only.') : void 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
102
106
|
if (this.props.hintIcon) {
|
|
103
107
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.hint === 'string' || /*#__PURE__*/react.isValidElement(this.props.hint), 'AsyncCreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
if (this.props.isMulti) {
|
|
107
111
|
process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](this.props.value), 'AsyncCreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
108
|
-
process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](this.props.touched), 'AsyncCreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
112
|
+
process.env.NODE_ENV !== "production" ? utils.warning(typeof this.props.touched === 'undefined' || _Array$isArray__default["default"](this.props.touched), 'AsyncCreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
@@ -214,7 +218,7 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
214
218
|
hasWarning: _pt__default["default"].bool,
|
|
215
219
|
menuPortalZIndex: _pt__default["default"].number,
|
|
216
220
|
onBlur: _pt__default["default"].func,
|
|
217
|
-
onChange: _pt__default["default"].func
|
|
221
|
+
onChange: _pt__default["default"].func,
|
|
218
222
|
showOptionGroupDivider: _pt__default["default"].bool,
|
|
219
223
|
title: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]).isRequired,
|
|
220
224
|
hint: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].node]),
|
|
@@ -226,7 +230,7 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
226
230
|
} : {};
|
|
227
231
|
|
|
228
232
|
// NOTE: This string will be replaced on build time with the package version.
|
|
229
|
-
var version = "
|
|
233
|
+
var version = "15.0.0";
|
|
230
234
|
|
|
231
235
|
exports["default"] = AsyncCreatableSelectField;
|
|
232
236
|
exports.version = version;
|
|
@@ -97,6 +97,8 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
97
97
|
value: function render() {
|
|
98
98
|
var hasError = AsyncCreatableSelectInput__default["default"].isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
99
99
|
|
|
100
|
+
if (!this.props.isReadOnly) ;
|
|
101
|
+
|
|
100
102
|
if (this.props.hintIcon) ;
|
|
101
103
|
|
|
102
104
|
if (this.props.isMulti) ;
|
|
@@ -199,7 +201,7 @@ AsyncCreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
199
201
|
AsyncCreatableSelectField.propTypes = {};
|
|
200
202
|
|
|
201
203
|
// NOTE: This string will be replaced on build time with the package version.
|
|
202
|
-
var version = "
|
|
204
|
+
var version = "15.0.0";
|
|
203
205
|
|
|
204
206
|
exports["default"] = AsyncCreatableSelectField;
|
|
205
207
|
exports.version = version;
|
|
@@ -73,13 +73,17 @@ var AsyncCreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
73
73
|
value: function render() {
|
|
74
74
|
var hasError = AsyncCreatableSelectInput.isTouched(this.props.touched) && hasErrors(this.props.errors);
|
|
75
75
|
|
|
76
|
+
if (!this.props.isReadOnly) {
|
|
77
|
+
process.env.NODE_ENV !== "production" ? warning(typeof this.props.onChange === 'function', 'AsyncCreatableSelectField: `onChange` is required when field is not read only.') : void 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
76
80
|
if (this.props.hintIcon) {
|
|
77
81
|
process.env.NODE_ENV !== "production" ? warning(typeof this.props.hint === 'string' || /*#__PURE__*/isValidElement(this.props.hint), 'AsyncCreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
if (this.props.isMulti) {
|
|
81
85
|
process.env.NODE_ENV !== "production" ? warning(_Array$isArray(this.props.value), 'AsyncCreatableSelectField: `value` is expected to be an array of string when isMulti is true') : void 0;
|
|
82
|
-
process.env.NODE_ENV !== "production" ? warning(_Array$isArray(this.props.touched), 'AsyncCreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
86
|
+
process.env.NODE_ENV !== "production" ? warning(typeof this.props.touched === 'undefined' || _Array$isArray(this.props.touched), 'AsyncCreatableSelectField: `touched` is expected to be an array of boolean when isMulti is true') : void 0;
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
return jsx(Constraints.Horizontal, {
|
|
@@ -188,7 +192,7 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
188
192
|
hasWarning: _pt.bool,
|
|
189
193
|
menuPortalZIndex: _pt.number,
|
|
190
194
|
onBlur: _pt.func,
|
|
191
|
-
onChange: _pt.func
|
|
195
|
+
onChange: _pt.func,
|
|
192
196
|
showOptionGroupDivider: _pt.bool,
|
|
193
197
|
title: _pt.oneOfType([_pt.string, _pt.node]).isRequired,
|
|
194
198
|
hint: _pt.oneOfType([_pt.string, _pt.node]),
|
|
@@ -200,6 +204,6 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
200
204
|
} : {};
|
|
201
205
|
|
|
202
206
|
// NOTE: This string will be replaced on build time with the package version.
|
|
203
|
-
var version = "
|
|
207
|
+
var version = "15.0.0";
|
|
204
208
|
|
|
205
209
|
export { AsyncCreatableSelectField as default, version };
|
|
@@ -7,8 +7,9 @@ declare type TFieldErrors = Record<string, boolean>;
|
|
|
7
7
|
declare type TCustomFormErrors<Values> = {
|
|
8
8
|
[K in keyof Values]?: TFieldErrors;
|
|
9
9
|
};
|
|
10
|
-
declare type
|
|
10
|
+
declare type TCustomEvent = {
|
|
11
11
|
target: {
|
|
12
|
+
id?: string;
|
|
12
13
|
name?: string;
|
|
13
14
|
value?: unknown;
|
|
14
15
|
};
|
|
@@ -41,8 +42,8 @@ declare type TAsyncCreatableSelectFieldProps = {
|
|
|
41
42
|
menuShouldBlockScroll?: ReactSelectAsyncCreatableProps['menuShouldBlockScroll'];
|
|
42
43
|
name?: ReactSelectAsyncCreatableProps['name'];
|
|
43
44
|
noOptionsMessage?: ReactSelectAsyncCreatableProps['noOptionsMessage'];
|
|
44
|
-
onBlur?: (event:
|
|
45
|
-
onChange
|
|
45
|
+
onBlur?: (event: TCustomEvent) => void;
|
|
46
|
+
onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
|
|
46
47
|
onFocus?: ReactSelectAsyncCreatableProps['onFocus'];
|
|
47
48
|
onInputChange?: ReactSelectAsyncCreatableProps['onInputChange'];
|
|
48
49
|
placeholder?: ReactSelectAsyncCreatableProps['placeholder'];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/async-creatable-select-field",
|
|
3
3
|
"description": "An input component with validation states and a label getting a selection from an asynchronously loaded list from the user, and where options can be created by the user.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "15.0.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.17.2",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.17.2",
|
|
24
|
-
"@commercetools-uikit/async-creatable-select-input": "
|
|
25
|
-
"@commercetools-uikit/constraints": "
|
|
26
|
-
"@commercetools-uikit/design-system": "
|
|
27
|
-
"@commercetools-uikit/field-errors": "
|
|
28
|
-
"@commercetools-uikit/field-label": "
|
|
29
|
-
"@commercetools-uikit/spacings": "
|
|
30
|
-
"@commercetools-uikit/utils": "
|
|
24
|
+
"@commercetools-uikit/async-creatable-select-input": "15.0.0",
|
|
25
|
+
"@commercetools-uikit/constraints": "15.0.0",
|
|
26
|
+
"@commercetools-uikit/design-system": "15.0.0",
|
|
27
|
+
"@commercetools-uikit/field-errors": "15.0.0",
|
|
28
|
+
"@commercetools-uikit/field-label": "15.0.0",
|
|
29
|
+
"@commercetools-uikit/spacings": "15.0.0",
|
|
30
|
+
"@commercetools-uikit/utils": "15.0.0",
|
|
31
31
|
"@emotion/react": "^11.4.0",
|
|
32
32
|
"@emotion/styled": "^11.3.0",
|
|
33
33
|
"prop-types": "15.8.1",
|