@commercetools-uikit/async-creatable-select-input 15.15.0 → 16.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/dist/commercetools-uikit-async-creatable-select-input.cjs.d.ts +1 -0
- package/dist/commercetools-uikit-async-creatable-select-input.cjs.d.ts.map +1 -0
- package/dist/commercetools-uikit-async-creatable-select-input.cjs.dev.js +32 -40
- package/dist/commercetools-uikit-async-creatable-select-input.cjs.prod.js +32 -40
- package/dist/commercetools-uikit-async-creatable-select-input.esm.js +34 -42
- package/package.json +12 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commercetools-uikit-async-creatable-select-input.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -45,20 +45,18 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
45
45
|
|
|
46
46
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
};
|
|
48
|
+
const LoadingIndicator = () => jsxRuntime.jsx(LoadingSpinner__default["default"], {
|
|
49
|
+
scale: "s"
|
|
50
|
+
});
|
|
53
51
|
|
|
54
52
|
LoadingIndicator.displayName = 'LoadingIndicator';
|
|
55
|
-
|
|
53
|
+
const customizedComponents = {
|
|
56
54
|
DropdownIndicator: selectUtils.DropdownIndicator,
|
|
57
55
|
ClearIndicator: selectUtils.ClearIndicator,
|
|
58
|
-
LoadingIndicator
|
|
56
|
+
LoadingIndicator,
|
|
59
57
|
MultiValueRemove: selectUtils.TagRemove
|
|
60
58
|
};
|
|
61
|
-
|
|
59
|
+
const defaultProps = {
|
|
62
60
|
// Using "null" will ensure that the currently selected value disappears in
|
|
63
61
|
// case "undefined" gets passed as the next value
|
|
64
62
|
value: null,
|
|
@@ -66,13 +64,13 @@ var defaultProps = {
|
|
|
66
64
|
menuPortalZIndex: 1
|
|
67
65
|
};
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const AsyncCreatableSelectInput = props => {
|
|
68
|
+
const intl = reactIntl.useIntl();
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const _useTheme = designSystem.useTheme(),
|
|
71
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
74
72
|
|
|
75
|
-
|
|
73
|
+
const placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
|
|
76
74
|
|
|
77
75
|
if (!props.isReadOnly) {
|
|
78
76
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'AsyncCreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
|
|
@@ -98,11 +96,9 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
98
96
|
autoFocus: props.isAutofocussed,
|
|
99
97
|
backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
|
|
100
98
|
components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
|
|
101
|
-
Input:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
99
|
+
Input: ownProps => jsxRuntime.jsx(reactSelect.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
|
|
100
|
+
readOnly: true
|
|
101
|
+
}))
|
|
106
102
|
} : {}), props.components),
|
|
107
103
|
menuIsOpen: props.isReadOnly ? false : undefined,
|
|
108
104
|
styles: selectUtils.createSelectStyles({
|
|
@@ -115,7 +111,7 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
115
111
|
iconLeft: props.iconLeft,
|
|
116
112
|
isMulti: props.isMulti,
|
|
117
113
|
hasValue: !isEmpty__default["default"](props.value),
|
|
118
|
-
isNewTheme
|
|
114
|
+
isNewTheme
|
|
119
115
|
}),
|
|
120
116
|
filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
|
|
121
117
|
// but we use "id" (for the input) and "containerId" (for the container)
|
|
@@ -135,17 +131,17 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
135
131
|
menuShouldBlockScroll: props.menuShouldBlockScroll,
|
|
136
132
|
closeMenuOnScroll: props.closeMenuOnSelect,
|
|
137
133
|
name: props.name,
|
|
138
|
-
noOptionsMessage: props.noOptionsMessage ||
|
|
139
|
-
|
|
134
|
+
noOptionsMessage: props.noOptionsMessage || (_ref => {
|
|
135
|
+
let inputValue = _ref.inputValue;
|
|
140
136
|
return inputValue === '' ? intl.formatMessage(selectUtils.messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(selectUtils.messages.noOptionsMessageWithInputValue, {
|
|
141
|
-
inputValue
|
|
137
|
+
inputValue
|
|
142
138
|
});
|
|
143
|
-
},
|
|
144
|
-
onBlur: props.onBlur ?
|
|
145
|
-
|
|
139
|
+
}),
|
|
140
|
+
onBlur: props.onBlur ? () => {
|
|
141
|
+
const event = {
|
|
146
142
|
target: {
|
|
147
143
|
id: props.id,
|
|
148
|
-
name:
|
|
144
|
+
name: (() => {
|
|
149
145
|
if (!props.name) return undefined;
|
|
150
146
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
151
147
|
// state as an array instead of a boolean only.
|
|
@@ -153,17 +149,17 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
153
149
|
// Formik will create an array on submission anyways.
|
|
154
150
|
|
|
155
151
|
return "".concat(props.name, ".0");
|
|
156
|
-
}()
|
|
152
|
+
})()
|
|
157
153
|
},
|
|
158
|
-
persist:
|
|
154
|
+
persist: () => {}
|
|
159
155
|
};
|
|
160
156
|
props.onBlur && props.onBlur(event);
|
|
161
157
|
} : undefined,
|
|
162
|
-
onChange:
|
|
158
|
+
onChange: (value, info) => {
|
|
163
159
|
var _props$onChange;
|
|
164
160
|
|
|
165
161
|
// wrapping breaking changes made in react-select v3
|
|
166
|
-
|
|
162
|
+
let newValue = value;
|
|
167
163
|
|
|
168
164
|
if (props.isMulti && !newValue) {
|
|
169
165
|
newValue = [];
|
|
@@ -175,7 +171,7 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
175
171
|
name: props.name,
|
|
176
172
|
value: newValue
|
|
177
173
|
},
|
|
178
|
-
persist:
|
|
174
|
+
persist: () => {}
|
|
179
175
|
}, info);
|
|
180
176
|
},
|
|
181
177
|
onFocus: props.onFocus,
|
|
@@ -190,11 +186,9 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
190
186
|
cacheOptions: props.cacheOptions // Creatable props
|
|
191
187
|
,
|
|
192
188
|
allowCreateWhileLoading: props.allowCreateWhileLoading,
|
|
193
|
-
formatCreateLabel: props.formatCreateLabel ||
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
});
|
|
197
|
-
},
|
|
189
|
+
formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(selectUtils.messages.createLabel, {
|
|
190
|
+
inputValue
|
|
191
|
+
})),
|
|
198
192
|
isValidNewOption: props.isValidNewOption,
|
|
199
193
|
getNewOptionData: props.getNewOptionData,
|
|
200
194
|
onCreateOption: props.onCreateOption,
|
|
@@ -228,9 +222,7 @@ AsyncCreatableSelectInput.defaultProps = defaultProps;
|
|
|
228
222
|
// values were removed only. So we have to treat any array we receive as
|
|
229
223
|
// a signal of the field having been touched.
|
|
230
224
|
|
|
231
|
-
AsyncCreatableSelectInput.isTouched =
|
|
232
|
-
return Boolean(touched);
|
|
233
|
-
};
|
|
225
|
+
AsyncCreatableSelectInput.isTouched = touched => Boolean(touched);
|
|
234
226
|
/**
|
|
235
227
|
* Expose react-select components for customization purposes.
|
|
236
228
|
*/
|
|
@@ -268,7 +260,7 @@ AsyncCreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer
|
|
|
268
260
|
var AsyncCreatableSelectInput$1 = AsyncCreatableSelectInput;
|
|
269
261
|
|
|
270
262
|
// NOTE: This string will be replaced on build time with the package version.
|
|
271
|
-
var version = "
|
|
263
|
+
var version = "16.0.0";
|
|
272
264
|
|
|
273
265
|
exports["default"] = AsyncCreatableSelectInput$1;
|
|
274
266
|
exports.version = version;
|
|
@@ -43,20 +43,18 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["def
|
|
|
43
43
|
|
|
44
44
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
};
|
|
46
|
+
const LoadingIndicator = () => jsxRuntime.jsx(LoadingSpinner__default["default"], {
|
|
47
|
+
scale: "s"
|
|
48
|
+
});
|
|
51
49
|
|
|
52
50
|
LoadingIndicator.displayName = 'LoadingIndicator';
|
|
53
|
-
|
|
51
|
+
const customizedComponents = {
|
|
54
52
|
DropdownIndicator: selectUtils.DropdownIndicator,
|
|
55
53
|
ClearIndicator: selectUtils.ClearIndicator,
|
|
56
|
-
LoadingIndicator
|
|
54
|
+
LoadingIndicator,
|
|
57
55
|
MultiValueRemove: selectUtils.TagRemove
|
|
58
56
|
};
|
|
59
|
-
|
|
57
|
+
const defaultProps = {
|
|
60
58
|
// Using "null" will ensure that the currently selected value disappears in
|
|
61
59
|
// case "undefined" gets passed as the next value
|
|
62
60
|
value: null,
|
|
@@ -64,13 +62,13 @@ var defaultProps = {
|
|
|
64
62
|
menuPortalZIndex: 1
|
|
65
63
|
};
|
|
66
64
|
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const AsyncCreatableSelectInput = props => {
|
|
66
|
+
const intl = reactIntl.useIntl();
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
const _useTheme = designSystem.useTheme(),
|
|
69
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
72
70
|
|
|
73
|
-
|
|
71
|
+
const placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
|
|
74
72
|
|
|
75
73
|
if (!props.isReadOnly) ;
|
|
76
74
|
|
|
@@ -92,11 +90,9 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
92
90
|
autoFocus: props.isAutofocussed,
|
|
93
91
|
backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
|
|
94
92
|
components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
|
|
95
|
-
Input:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}));
|
|
99
|
-
}
|
|
93
|
+
Input: ownProps => jsxRuntime.jsx(reactSelect.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
|
|
94
|
+
readOnly: true
|
|
95
|
+
}))
|
|
100
96
|
} : {}), props.components),
|
|
101
97
|
menuIsOpen: props.isReadOnly ? false : undefined,
|
|
102
98
|
styles: selectUtils.createSelectStyles({
|
|
@@ -109,7 +105,7 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
109
105
|
iconLeft: props.iconLeft,
|
|
110
106
|
isMulti: props.isMulti,
|
|
111
107
|
hasValue: !isEmpty__default["default"](props.value),
|
|
112
|
-
isNewTheme
|
|
108
|
+
isNewTheme
|
|
113
109
|
}),
|
|
114
110
|
filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
|
|
115
111
|
// but we use "id" (for the input) and "containerId" (for the container)
|
|
@@ -129,17 +125,17 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
129
125
|
menuShouldBlockScroll: props.menuShouldBlockScroll,
|
|
130
126
|
closeMenuOnScroll: props.closeMenuOnSelect,
|
|
131
127
|
name: props.name,
|
|
132
|
-
noOptionsMessage: props.noOptionsMessage ||
|
|
133
|
-
|
|
128
|
+
noOptionsMessage: props.noOptionsMessage || (_ref => {
|
|
129
|
+
let inputValue = _ref.inputValue;
|
|
134
130
|
return inputValue === '' ? intl.formatMessage(selectUtils.messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(selectUtils.messages.noOptionsMessageWithInputValue, {
|
|
135
|
-
inputValue
|
|
131
|
+
inputValue
|
|
136
132
|
});
|
|
137
|
-
},
|
|
138
|
-
onBlur: props.onBlur ?
|
|
139
|
-
|
|
133
|
+
}),
|
|
134
|
+
onBlur: props.onBlur ? () => {
|
|
135
|
+
const event = {
|
|
140
136
|
target: {
|
|
141
137
|
id: props.id,
|
|
142
|
-
name:
|
|
138
|
+
name: (() => {
|
|
143
139
|
if (!props.name) return undefined;
|
|
144
140
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
145
141
|
// state as an array instead of a boolean only.
|
|
@@ -147,17 +143,17 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
147
143
|
// Formik will create an array on submission anyways.
|
|
148
144
|
|
|
149
145
|
return "".concat(props.name, ".0");
|
|
150
|
-
}()
|
|
146
|
+
})()
|
|
151
147
|
},
|
|
152
|
-
persist:
|
|
148
|
+
persist: () => {}
|
|
153
149
|
};
|
|
154
150
|
props.onBlur && props.onBlur(event);
|
|
155
151
|
} : undefined,
|
|
156
|
-
onChange:
|
|
152
|
+
onChange: (value, info) => {
|
|
157
153
|
var _props$onChange;
|
|
158
154
|
|
|
159
155
|
// wrapping breaking changes made in react-select v3
|
|
160
|
-
|
|
156
|
+
let newValue = value;
|
|
161
157
|
|
|
162
158
|
if (props.isMulti && !newValue) {
|
|
163
159
|
newValue = [];
|
|
@@ -169,7 +165,7 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
169
165
|
name: props.name,
|
|
170
166
|
value: newValue
|
|
171
167
|
},
|
|
172
|
-
persist:
|
|
168
|
+
persist: () => {}
|
|
173
169
|
}, info);
|
|
174
170
|
},
|
|
175
171
|
onFocus: props.onFocus,
|
|
@@ -184,11 +180,9 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
184
180
|
cacheOptions: props.cacheOptions // Creatable props
|
|
185
181
|
,
|
|
186
182
|
allowCreateWhileLoading: props.allowCreateWhileLoading,
|
|
187
|
-
formatCreateLabel: props.formatCreateLabel ||
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
});
|
|
191
|
-
},
|
|
183
|
+
formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(selectUtils.messages.createLabel, {
|
|
184
|
+
inputValue
|
|
185
|
+
})),
|
|
192
186
|
isValidNewOption: props.isValidNewOption,
|
|
193
187
|
getNewOptionData: props.getNewOptionData,
|
|
194
188
|
onCreateOption: props.onCreateOption,
|
|
@@ -211,9 +205,7 @@ AsyncCreatableSelectInput.defaultProps = defaultProps;
|
|
|
211
205
|
// values were removed only. So we have to treat any array we receive as
|
|
212
206
|
// a signal of the field having been touched.
|
|
213
207
|
|
|
214
|
-
AsyncCreatableSelectInput.isTouched =
|
|
215
|
-
return Boolean(touched);
|
|
216
|
-
};
|
|
208
|
+
AsyncCreatableSelectInput.isTouched = touched => Boolean(touched);
|
|
217
209
|
/**
|
|
218
210
|
* Expose react-select components for customization purposes.
|
|
219
211
|
*/
|
|
@@ -251,7 +243,7 @@ AsyncCreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer
|
|
|
251
243
|
var AsyncCreatableSelectInput$1 = AsyncCreatableSelectInput;
|
|
252
244
|
|
|
253
245
|
// NOTE: This string will be replaced on build time with the package version.
|
|
254
|
-
var version = "
|
|
246
|
+
var version = "16.0.0";
|
|
255
247
|
|
|
256
248
|
exports["default"] = AsyncCreatableSelectInput$1;
|
|
257
249
|
exports.version = version;
|
|
@@ -24,20 +24,18 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
|
24
24
|
|
|
25
25
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
};
|
|
27
|
+
const LoadingIndicator = () => jsx(LoadingSpinner, {
|
|
28
|
+
scale: "s"
|
|
29
|
+
});
|
|
32
30
|
|
|
33
31
|
LoadingIndicator.displayName = 'LoadingIndicator';
|
|
34
|
-
|
|
35
|
-
DropdownIndicator
|
|
36
|
-
ClearIndicator
|
|
37
|
-
LoadingIndicator
|
|
32
|
+
const customizedComponents = {
|
|
33
|
+
DropdownIndicator,
|
|
34
|
+
ClearIndicator,
|
|
35
|
+
LoadingIndicator,
|
|
38
36
|
MultiValueRemove: TagRemove
|
|
39
37
|
};
|
|
40
|
-
|
|
38
|
+
const defaultProps = {
|
|
41
39
|
// Using "null" will ensure that the currently selected value disappears in
|
|
42
40
|
// case "undefined" gets passed as the next value
|
|
43
41
|
value: null,
|
|
@@ -45,13 +43,13 @@ var defaultProps = {
|
|
|
45
43
|
menuPortalZIndex: 1
|
|
46
44
|
};
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const AsyncCreatableSelectInput = props => {
|
|
47
|
+
const intl = useIntl();
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const _useTheme = useTheme(),
|
|
50
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
const placeholder = props.placeholder || intl.formatMessage(messages.placeholder);
|
|
55
53
|
|
|
56
54
|
if (!props.isReadOnly) {
|
|
57
55
|
process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'AsyncCreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
|
|
@@ -77,11 +75,9 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
77
75
|
autoFocus: props.isAutofocussed,
|
|
78
76
|
backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
|
|
79
77
|
components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? customComponentsWithIcons : {}), props.isReadOnly ? {
|
|
80
|
-
Input:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
78
|
+
Input: ownProps => jsx(components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
|
|
79
|
+
readOnly: true
|
|
80
|
+
}))
|
|
85
81
|
} : {}), props.components),
|
|
86
82
|
menuIsOpen: props.isReadOnly ? false : undefined,
|
|
87
83
|
styles: createSelectStyles({
|
|
@@ -94,7 +90,7 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
94
90
|
iconLeft: props.iconLeft,
|
|
95
91
|
isMulti: props.isMulti,
|
|
96
92
|
hasValue: !isEmpty(props.value),
|
|
97
|
-
isNewTheme
|
|
93
|
+
isNewTheme
|
|
98
94
|
}),
|
|
99
95
|
filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
|
|
100
96
|
// but we use "id" (for the input) and "containerId" (for the container)
|
|
@@ -114,17 +110,17 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
114
110
|
menuShouldBlockScroll: props.menuShouldBlockScroll,
|
|
115
111
|
closeMenuOnScroll: props.closeMenuOnSelect,
|
|
116
112
|
name: props.name,
|
|
117
|
-
noOptionsMessage: props.noOptionsMessage ||
|
|
118
|
-
|
|
113
|
+
noOptionsMessage: props.noOptionsMessage || (_ref => {
|
|
114
|
+
let inputValue = _ref.inputValue;
|
|
119
115
|
return inputValue === '' ? intl.formatMessage(messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(messages.noOptionsMessageWithInputValue, {
|
|
120
|
-
inputValue
|
|
116
|
+
inputValue
|
|
121
117
|
});
|
|
122
|
-
},
|
|
123
|
-
onBlur: props.onBlur ?
|
|
124
|
-
|
|
118
|
+
}),
|
|
119
|
+
onBlur: props.onBlur ? () => {
|
|
120
|
+
const event = {
|
|
125
121
|
target: {
|
|
126
122
|
id: props.id,
|
|
127
|
-
name:
|
|
123
|
+
name: (() => {
|
|
128
124
|
if (!props.name) return undefined;
|
|
129
125
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
130
126
|
// state as an array instead of a boolean only.
|
|
@@ -132,17 +128,17 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
132
128
|
// Formik will create an array on submission anyways.
|
|
133
129
|
|
|
134
130
|
return "".concat(props.name, ".0");
|
|
135
|
-
}()
|
|
131
|
+
})()
|
|
136
132
|
},
|
|
137
|
-
persist:
|
|
133
|
+
persist: () => {}
|
|
138
134
|
};
|
|
139
135
|
props.onBlur && props.onBlur(event);
|
|
140
136
|
} : undefined,
|
|
141
|
-
onChange:
|
|
137
|
+
onChange: (value, info) => {
|
|
142
138
|
var _props$onChange;
|
|
143
139
|
|
|
144
140
|
// wrapping breaking changes made in react-select v3
|
|
145
|
-
|
|
141
|
+
let newValue = value;
|
|
146
142
|
|
|
147
143
|
if (props.isMulti && !newValue) {
|
|
148
144
|
newValue = [];
|
|
@@ -154,7 +150,7 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
154
150
|
name: props.name,
|
|
155
151
|
value: newValue
|
|
156
152
|
},
|
|
157
|
-
persist:
|
|
153
|
+
persist: () => {}
|
|
158
154
|
}, info);
|
|
159
155
|
},
|
|
160
156
|
onFocus: props.onFocus,
|
|
@@ -169,11 +165,9 @@ var AsyncCreatableSelectInput = function AsyncCreatableSelectInput(props) {
|
|
|
169
165
|
cacheOptions: props.cacheOptions // Creatable props
|
|
170
166
|
,
|
|
171
167
|
allowCreateWhileLoading: props.allowCreateWhileLoading,
|
|
172
|
-
formatCreateLabel: props.formatCreateLabel ||
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
});
|
|
176
|
-
},
|
|
168
|
+
formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(messages.createLabel, {
|
|
169
|
+
inputValue
|
|
170
|
+
})),
|
|
177
171
|
isValidNewOption: props.isValidNewOption,
|
|
178
172
|
getNewOptionData: props.getNewOptionData,
|
|
179
173
|
onCreateOption: props.onCreateOption,
|
|
@@ -207,9 +201,7 @@ AsyncCreatableSelectInput.defaultProps = defaultProps;
|
|
|
207
201
|
// values were removed only. So we have to treat any array we receive as
|
|
208
202
|
// a signal of the field having been touched.
|
|
209
203
|
|
|
210
|
-
AsyncCreatableSelectInput.isTouched =
|
|
211
|
-
return Boolean(touched);
|
|
212
|
-
};
|
|
204
|
+
AsyncCreatableSelectInput.isTouched = touched => Boolean(touched);
|
|
213
205
|
/**
|
|
214
206
|
* Expose react-select components for customization purposes.
|
|
215
207
|
*/
|
|
@@ -247,6 +239,6 @@ AsyncCreatableSelectInput.ValueContainer = components.ValueContainer;
|
|
|
247
239
|
var AsyncCreatableSelectInput$1 = AsyncCreatableSelectInput;
|
|
248
240
|
|
|
249
241
|
// NOTE: This string will be replaced on build time with the package version.
|
|
250
|
-
var version = "
|
|
242
|
+
var version = "16.0.0";
|
|
251
243
|
|
|
252
244
|
export { AsyncCreatableSelectInput$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/async-creatable-select-input",
|
|
3
3
|
"description": "An input component getting a selection from an asynchronously loaded list from the user, and where options can be created by the user.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "16.0.0",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,29 +21,29 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "
|
|
25
|
-
"@commercetools-uikit/design-system": "
|
|
26
|
-
"@commercetools-uikit/icons": "
|
|
27
|
-
"@commercetools-uikit/loading-spinner": "
|
|
28
|
-
"@commercetools-uikit/select-utils": "
|
|
29
|
-
"@commercetools-uikit/spacings": "
|
|
30
|
-
"@commercetools-uikit/text": "
|
|
31
|
-
"@commercetools-uikit/utils": "
|
|
24
|
+
"@commercetools-uikit/constraints": "16.0.0",
|
|
25
|
+
"@commercetools-uikit/design-system": "16.0.0",
|
|
26
|
+
"@commercetools-uikit/icons": "16.0.0",
|
|
27
|
+
"@commercetools-uikit/loading-spinner": "16.0.0",
|
|
28
|
+
"@commercetools-uikit/select-utils": "16.0.0",
|
|
29
|
+
"@commercetools-uikit/spacings": "16.0.0",
|
|
30
|
+
"@commercetools-uikit/text": "16.0.0",
|
|
31
|
+
"@commercetools-uikit/utils": "16.0.0",
|
|
32
32
|
"@emotion/is-prop-valid": "1.2.0",
|
|
33
33
|
"@emotion/react": "^11.10.5",
|
|
34
34
|
"@emotion/styled": "^11.10.5",
|
|
35
35
|
"lodash": "4.17.21",
|
|
36
36
|
"prop-types": "15.8.1",
|
|
37
|
-
"react-select": "5.7.
|
|
37
|
+
"react-select": "5.7.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"react": "17.0.2",
|
|
41
41
|
"react-dom": "17.0.2",
|
|
42
|
-
"react-intl": "^
|
|
42
|
+
"react-intl": "^6.3.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "17.x",
|
|
46
46
|
"react-dom": "17.x",
|
|
47
|
-
"react-intl": "
|
|
47
|
+
"react-intl": "6.x"
|
|
48
48
|
}
|
|
49
49
|
}
|