@commercetools-uikit/creatable-select-field 14.0.1 → 14.0.2
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-creatable-select-field.cjs.dev.js +6 -2
- package/dist/commercetools-uikit-creatable-select-field.cjs.prod.js +3 -1
- package/dist/commercetools-uikit-creatable-select-field.esm.js +6 -2
- package/dist/declarations/src/creatable-select-field.d.ts +4 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ export default Example;
|
|
|
78
78
|
| `name` | `CreatableProps['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#creatable-props) |
|
|
79
79
|
| `noOptionsMessage` | `CreatableProps['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#creatable-props) |
|
|
80
80
|
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
|
|
81
|
-
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) |
|
|
81
|
+
| `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`. |
|
|
82
82
|
| `onFocus` | `CreatableProps['onFocus']` | | | Handle focus events on the control
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
83
83
|
| `onInputChange` | `CreatableProps['onInputChange']` | | | Handle change events on the input
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
84
84
|
| `options` | `union`<br/>Possible values:<br/>`TValue[] , { options: TValue[] }[]` | | | Array of options that populate the select menu |
|
|
@@ -112,13 +112,13 @@ export default Example;
|
|
|
112
112
|
### Signature `onBlur`
|
|
113
113
|
|
|
114
114
|
```ts
|
|
115
|
-
(event:
|
|
115
|
+
(event: TCustomEvent) => void
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
### Signature `onChange`
|
|
119
119
|
|
|
120
120
|
```ts
|
|
121
|
-
(event:
|
|
121
|
+
(event: TCustomEvent, info: ActionMeta<unknown>) => void
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
### Signature `onInfoButtonClick`
|
|
@@ -99,6 +99,10 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
99
99
|
value: function render() {
|
|
100
100
|
var hasError = CreatableSelectInput__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', 'CreatableSelectField: `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), 'CreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
104
108
|
}
|
|
@@ -210,7 +214,7 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
210
214
|
hasWarning: _pt__default["default"].bool,
|
|
211
215
|
menuPortalZIndex: _pt__default["default"].number,
|
|
212
216
|
onBlur: _pt__default["default"].func,
|
|
213
|
-
onChange: _pt__default["default"].func
|
|
217
|
+
onChange: _pt__default["default"].func,
|
|
214
218
|
options: _pt__default["default"].oneOfType([_pt__default["default"].arrayOf(_pt__default["default"].shape({
|
|
215
219
|
value: _pt__default["default"].string.isRequired
|
|
216
220
|
})), _pt__default["default"].arrayOf(_pt__default["default"].shape({
|
|
@@ -229,7 +233,7 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
229
233
|
} : {};
|
|
230
234
|
|
|
231
235
|
// NOTE: This string will be replaced on build time with the package version.
|
|
232
|
-
var version = "14.0.
|
|
236
|
+
var version = "14.0.2";
|
|
233
237
|
|
|
234
238
|
exports["default"] = CreatableSelectField;
|
|
235
239
|
exports.version = version;
|
|
@@ -97,6 +97,8 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
97
97
|
value: function render() {
|
|
98
98
|
var hasError = CreatableSelectInput__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) ;
|
|
@@ -195,7 +197,7 @@ CreatableSelectField.getDerivedStateFromProps = function (props, state) {
|
|
|
195
197
|
CreatableSelectField.propTypes = {};
|
|
196
198
|
|
|
197
199
|
// NOTE: This string will be replaced on build time with the package version.
|
|
198
|
-
var version = "14.0.
|
|
200
|
+
var version = "14.0.2";
|
|
199
201
|
|
|
200
202
|
exports["default"] = CreatableSelectField;
|
|
201
203
|
exports.version = version;
|
|
@@ -73,6 +73,10 @@ var CreatableSelectField = /*#__PURE__*/function (_Component) {
|
|
|
73
73
|
value: function render() {
|
|
74
74
|
var hasError = CreatableSelectInput.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', 'CreatableSelectField: `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), 'CreatableSelectField: `hint` is required to be string or ReactNode if hintIcon is present') : void 0;
|
|
78
82
|
}
|
|
@@ -184,7 +188,7 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
184
188
|
hasWarning: _pt.bool,
|
|
185
189
|
menuPortalZIndex: _pt.number,
|
|
186
190
|
onBlur: _pt.func,
|
|
187
|
-
onChange: _pt.func
|
|
191
|
+
onChange: _pt.func,
|
|
188
192
|
options: _pt.oneOfType([_pt.arrayOf(_pt.shape({
|
|
189
193
|
value: _pt.string.isRequired
|
|
190
194
|
})), _pt.arrayOf(_pt.shape({
|
|
@@ -203,6 +207,6 @@ CreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
203
207
|
} : {};
|
|
204
208
|
|
|
205
209
|
// NOTE: This string will be replaced on build time with the package version.
|
|
206
|
-
var version = "14.0.
|
|
210
|
+
var version = "14.0.2";
|
|
207
211
|
|
|
208
212
|
export { CreatableSelectField as default, version };
|
|
@@ -13,8 +13,9 @@ declare type TValue = {
|
|
|
13
13
|
declare type TOptions = TValue[] | {
|
|
14
14
|
options: TValue[];
|
|
15
15
|
}[];
|
|
16
|
-
declare type
|
|
16
|
+
declare type TCustomEvent = {
|
|
17
17
|
target: {
|
|
18
|
+
id?: string;
|
|
18
19
|
name?: string;
|
|
19
20
|
value?: unknown;
|
|
20
21
|
};
|
|
@@ -47,8 +48,8 @@ declare type TCreatableSelectFieldProps = {
|
|
|
47
48
|
menuShouldBlockScroll?: ReactSelectCreatableProps['menuShouldBlockScroll'];
|
|
48
49
|
name?: ReactSelectCreatableProps['name'];
|
|
49
50
|
noOptionsMessage?: ReactSelectCreatableProps['noOptionsMessage'];
|
|
50
|
-
onBlur?: (event:
|
|
51
|
-
onChange
|
|
51
|
+
onBlur?: (event: TCustomEvent) => void;
|
|
52
|
+
onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
|
|
52
53
|
onFocus?: ReactSelectCreatableProps['onFocus'];
|
|
53
54
|
onInputChange?: ReactSelectCreatableProps['onInputChange'];
|
|
54
55
|
options?: TOptions;
|
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": "14.0.
|
|
4
|
+
"version": "14.0.2",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"@babel/runtime": "^7.17.2",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.17.2",
|
|
24
24
|
"@commercetools-uikit/constraints": "14.0.1",
|
|
25
|
-
"@commercetools-uikit/creatable-select-input": "14.0.
|
|
25
|
+
"@commercetools-uikit/creatable-select-input": "14.0.2",
|
|
26
26
|
"@commercetools-uikit/design-system": "14.0.0",
|
|
27
27
|
"@commercetools-uikit/field-errors": "14.0.1",
|
|
28
|
-
"@commercetools-uikit/field-label": "14.0.
|
|
28
|
+
"@commercetools-uikit/field-label": "14.0.2",
|
|
29
29
|
"@commercetools-uikit/spacings": "14.0.1",
|
|
30
30
|
"@commercetools-uikit/utils": "14.0.1",
|
|
31
31
|
"@emotion/react": "^11.4.0",
|