@commercetools-uikit/async-creatable-select-input 16.0.0 → 16.1.1

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.
@@ -21,7 +21,6 @@ var Constraints = require('@commercetools-uikit/constraints');
21
21
  var LoadingSpinner = require('@commercetools-uikit/loading-spinner');
22
22
  var selectUtils = require('@commercetools-uikit/select-utils');
23
23
  var utils = require('@commercetools-uikit/utils');
24
- var designSystem = require('@commercetools-uikit/design-system');
25
24
  var jsxRuntime = require('@emotion/react/jsx-runtime');
26
25
 
27
26
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -42,13 +41,10 @@ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
42
41
  var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
43
42
 
44
43
  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; }
45
-
46
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; }
47
-
48
45
  const LoadingIndicator = () => jsxRuntime.jsx(LoadingSpinner__default["default"], {
49
46
  scale: "s"
50
47
  });
51
-
52
48
  LoadingIndicator.displayName = 'LoadingIndicator';
53
49
  const customizedComponents = {
54
50
  DropdownIndicator: selectUtils.DropdownIndicator,
@@ -63,23 +59,15 @@ const defaultProps = {
63
59
  isSearchable: true,
64
60
  menuPortalZIndex: 1
65
61
  };
66
-
67
62
  const AsyncCreatableSelectInput = props => {
68
63
  const intl = reactIntl.useIntl();
69
-
70
- const _useTheme = designSystem.useTheme(),
71
- isNewTheme = _useTheme.isNewTheme;
72
-
73
64
  const placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
74
-
75
65
  if (!props.isReadOnly) {
76
66
  process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'AsyncCreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
77
67
  }
78
-
79
68
  if (props.isMulti) {
80
69
  process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](props.value), 'AsyncCreatableSelectInput: `value` is expected to be an array when isMulti is true') : void 0;
81
70
  }
82
-
83
71
  selectUtils.warnIfMenuPortalPropsAreMissing({
84
72
  menuPortalZIndex: props.menuPortalZIndex,
85
73
  menuPortalTarget: props.menuPortalTarget,
@@ -110,10 +98,10 @@ const AsyncCreatableSelectInput = props => {
110
98
  isReadOnly: props.isReadOnly,
111
99
  iconLeft: props.iconLeft,
112
100
  isMulti: props.isMulti,
113
- hasValue: !isEmpty__default["default"](props.value),
114
- isNewTheme
101
+ hasValue: !isEmpty__default["default"](props.value)
115
102
  }),
116
- filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
103
+ filterOption: props.filterOption
104
+ // react-select uses "id" (for the container) and "inputId" (for the input),
117
105
  // but we use "id" (for the input) and "containerId" (for the container)
118
106
  // instead.
119
107
  // This makes it easier to less confusing to use with <label />s.
@@ -143,11 +131,11 @@ const AsyncCreatableSelectInput = props => {
143
131
  id: props.id,
144
132
  name: (() => {
145
133
  if (!props.name) return undefined;
146
- if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
134
+ if (!props.isMulti) return props.name;
135
+ // We append the ".0" to make Formik set the touched
147
136
  // state as an array instead of a boolean only.
148
137
  // Otherwise the shapes would clash on submission, as
149
138
  // Formik will create an array on submission anyways.
150
-
151
139
  return "".concat(props.name, ".0");
152
140
  })()
153
141
  },
@@ -157,14 +145,11 @@ const AsyncCreatableSelectInput = props => {
157
145
  } : undefined,
158
146
  onChange: (value, info) => {
159
147
  var _props$onChange;
160
-
161
148
  // wrapping breaking changes made in react-select v3
162
149
  let newValue = value;
163
-
164
150
  if (props.isMulti && !newValue) {
165
151
  newValue = [];
166
152
  }
167
-
168
153
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
169
154
  target: {
170
155
  id: props.id,
@@ -179,11 +164,13 @@ const AsyncCreatableSelectInput = props => {
179
164
  placeholder: placeholder,
180
165
  tabIndex: props.tabIndex,
181
166
  tabSelectsValue: props.tabSelectsValue,
182
- value: props.value // Async react-select props
167
+ value: props.value
168
+ // Async react-select props
183
169
  ,
184
170
  defaultOptions: props.defaultOptions,
185
171
  loadOptions: props.loadOptions,
186
- cacheOptions: props.cacheOptions // Creatable props
172
+ cacheOptions: props.cacheOptions
173
+ // Creatable props
187
174
  ,
188
175
  allowCreateWhileLoading: props.allowCreateWhileLoading,
189
176
  formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(selectUtils.messages.createLabel, {
@@ -192,14 +179,14 @@ const AsyncCreatableSelectInput = props => {
192
179
  isValidNewOption: props.isValidNewOption,
193
180
  getNewOptionData: props.getNewOptionData,
194
181
  onCreateOption: props.onCreateOption,
195
- createOptionPosition: props.createOptionPosition // @ts-ignore
182
+ createOptionPosition: props.createOptionPosition
183
+ // @ts-ignore
196
184
  ,
197
185
  iconLeft: props.iconLeft
198
186
  })
199
187
  }))
200
188
  });
201
189
  };
202
-
203
190
  AsyncCreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
204
191
  horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
205
192
  hasError: _pt__default["default"].bool,
@@ -214,33 +201,34 @@ AsyncCreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
214
201
  } : {};
215
202
  AsyncCreatableSelectInput.displayName = 'AsyncCreatableSelectInput';
216
203
  AsyncCreatableSelectInput.defaultProps = defaultProps;
204
+
217
205
  /**
218
206
  * Expose static helper methods.
219
207
  */
208
+
220
209
  // Formik will set the field to an array on submission, so we always have to
221
210
  // deal with an array. The touched state ends up being an empty array in case
222
211
  // values were removed only. So we have to treat any array we receive as
223
212
  // a signal of the field having been touched.
224
-
225
213
  AsyncCreatableSelectInput.isTouched = touched => Boolean(touched);
214
+
226
215
  /**
227
216
  * Expose react-select components for customization purposes.
228
217
  */
229
- // custom
230
-
231
218
 
219
+ // custom
232
220
  AsyncCreatableSelectInput.ClearIndicator = customizedComponents.ClearIndicator;
233
221
  AsyncCreatableSelectInput.Control = reactSelect.components.Control;
234
222
  AsyncCreatableSelectInput.CrossIcon = reactSelect.components.CrossIcon;
235
- AsyncCreatableSelectInput.DownChevron = reactSelect.components.DownChevron; // custom
236
-
223
+ AsyncCreatableSelectInput.DownChevron = reactSelect.components.DownChevron;
224
+ // custom
237
225
  AsyncCreatableSelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
238
226
  AsyncCreatableSelectInput.Group = reactSelect.components.Group;
239
227
  AsyncCreatableSelectInput.GroupHeading = reactSelect.components.GroupHeading;
240
228
  AsyncCreatableSelectInput.IndicatorSeparator = reactSelect.components.IndicatorSeparator;
241
229
  AsyncCreatableSelectInput.IndicatorsContainer = reactSelect.components.IndicatorsContainer;
242
- AsyncCreatableSelectInput.Input = reactSelect.components.Input; // custom
243
-
230
+ AsyncCreatableSelectInput.Input = reactSelect.components.Input;
231
+ // custom
244
232
  AsyncCreatableSelectInput.LoadingIndicator = customizedComponents.LoadingIndicator;
245
233
  AsyncCreatableSelectInput.LoadingMessage = reactSelect.components.LoadingMessage;
246
234
  AsyncCreatableSelectInput.Menu = reactSelect.components.Menu;
@@ -248,8 +236,8 @@ AsyncCreatableSelectInput.MenuList = reactSelect.components.MenuList;
248
236
  AsyncCreatableSelectInput.MenuPortal = reactSelect.components.MenuPortal;
249
237
  AsyncCreatableSelectInput.MultiValue = reactSelect.components.MultiValue;
250
238
  AsyncCreatableSelectInput.MultiValueContainer = reactSelect.components.MultiValueContainer;
251
- AsyncCreatableSelectInput.MultiValueLabel = reactSelect.components.MultiValueLabel; // custom
252
-
239
+ AsyncCreatableSelectInput.MultiValueLabel = reactSelect.components.MultiValueLabel;
240
+ // custom
253
241
  AsyncCreatableSelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
254
242
  AsyncCreatableSelectInput.NoOptionsMessage = reactSelect.components.NoOptionsMessage;
255
243
  AsyncCreatableSelectInput.Option = reactSelect.components.Option;
@@ -260,7 +248,7 @@ AsyncCreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer
260
248
  var AsyncCreatableSelectInput$1 = AsyncCreatableSelectInput;
261
249
 
262
250
  // NOTE: This string will be replaced on build time with the package version.
263
- var version = "16.0.0";
251
+ var version = "16.1.1";
264
252
 
265
253
  exports["default"] = AsyncCreatableSelectInput$1;
266
254
  exports.version = version;
@@ -21,7 +21,6 @@ var Constraints = require('@commercetools-uikit/constraints');
21
21
  var LoadingSpinner = require('@commercetools-uikit/loading-spinner');
22
22
  var selectUtils = require('@commercetools-uikit/select-utils');
23
23
  var utils = require('@commercetools-uikit/utils');
24
- var designSystem = require('@commercetools-uikit/design-system');
25
24
  var jsxRuntime = require('@emotion/react/jsx-runtime');
26
25
 
27
26
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -40,13 +39,10 @@ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
40
39
  var LoadingSpinner__default = /*#__PURE__*/_interopDefault(LoadingSpinner);
41
40
 
42
41
  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; }
43
-
44
42
  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
-
46
43
  const LoadingIndicator = () => jsxRuntime.jsx(LoadingSpinner__default["default"], {
47
44
  scale: "s"
48
45
  });
49
-
50
46
  LoadingIndicator.displayName = 'LoadingIndicator';
51
47
  const customizedComponents = {
52
48
  DropdownIndicator: selectUtils.DropdownIndicator,
@@ -61,19 +57,11 @@ const defaultProps = {
61
57
  isSearchable: true,
62
58
  menuPortalZIndex: 1
63
59
  };
64
-
65
60
  const AsyncCreatableSelectInput = props => {
66
61
  const intl = reactIntl.useIntl();
67
-
68
- const _useTheme = designSystem.useTheme(),
69
- isNewTheme = _useTheme.isNewTheme;
70
-
71
62
  const placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
72
-
73
63
  if (!props.isReadOnly) ;
74
-
75
64
  if (props.isMulti) ;
76
-
77
65
  selectUtils.warnIfMenuPortalPropsAreMissing({
78
66
  menuPortalZIndex: props.menuPortalZIndex,
79
67
  menuPortalTarget: props.menuPortalTarget,
@@ -104,10 +92,10 @@ const AsyncCreatableSelectInput = props => {
104
92
  isReadOnly: props.isReadOnly,
105
93
  iconLeft: props.iconLeft,
106
94
  isMulti: props.isMulti,
107
- hasValue: !isEmpty__default["default"](props.value),
108
- isNewTheme
95
+ hasValue: !isEmpty__default["default"](props.value)
109
96
  }),
110
- filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
97
+ filterOption: props.filterOption
98
+ // react-select uses "id" (for the container) and "inputId" (for the input),
111
99
  // but we use "id" (for the input) and "containerId" (for the container)
112
100
  // instead.
113
101
  // This makes it easier to less confusing to use with <label />s.
@@ -137,11 +125,11 @@ const AsyncCreatableSelectInput = props => {
137
125
  id: props.id,
138
126
  name: (() => {
139
127
  if (!props.name) return undefined;
140
- if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
128
+ if (!props.isMulti) return props.name;
129
+ // We append the ".0" to make Formik set the touched
141
130
  // state as an array instead of a boolean only.
142
131
  // Otherwise the shapes would clash on submission, as
143
132
  // Formik will create an array on submission anyways.
144
-
145
133
  return "".concat(props.name, ".0");
146
134
  })()
147
135
  },
@@ -151,14 +139,11 @@ const AsyncCreatableSelectInput = props => {
151
139
  } : undefined,
152
140
  onChange: (value, info) => {
153
141
  var _props$onChange;
154
-
155
142
  // wrapping breaking changes made in react-select v3
156
143
  let newValue = value;
157
-
158
144
  if (props.isMulti && !newValue) {
159
145
  newValue = [];
160
146
  }
161
-
162
147
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
163
148
  target: {
164
149
  id: props.id,
@@ -173,11 +158,13 @@ const AsyncCreatableSelectInput = props => {
173
158
  placeholder: placeholder,
174
159
  tabIndex: props.tabIndex,
175
160
  tabSelectsValue: props.tabSelectsValue,
176
- value: props.value // Async react-select props
161
+ value: props.value
162
+ // Async react-select props
177
163
  ,
178
164
  defaultOptions: props.defaultOptions,
179
165
  loadOptions: props.loadOptions,
180
- cacheOptions: props.cacheOptions // Creatable props
166
+ cacheOptions: props.cacheOptions
167
+ // Creatable props
181
168
  ,
182
169
  allowCreateWhileLoading: props.allowCreateWhileLoading,
183
170
  formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(selectUtils.messages.createLabel, {
@@ -186,44 +173,45 @@ const AsyncCreatableSelectInput = props => {
186
173
  isValidNewOption: props.isValidNewOption,
187
174
  getNewOptionData: props.getNewOptionData,
188
175
  onCreateOption: props.onCreateOption,
189
- createOptionPosition: props.createOptionPosition // @ts-ignore
176
+ createOptionPosition: props.createOptionPosition
177
+ // @ts-ignore
190
178
  ,
191
179
  iconLeft: props.iconLeft
192
180
  })
193
181
  }))
194
182
  });
195
183
  };
196
-
197
184
  AsyncCreatableSelectInput.propTypes = {};
198
185
  AsyncCreatableSelectInput.displayName = 'AsyncCreatableSelectInput';
199
186
  AsyncCreatableSelectInput.defaultProps = defaultProps;
187
+
200
188
  /**
201
189
  * Expose static helper methods.
202
190
  */
191
+
203
192
  // Formik will set the field to an array on submission, so we always have to
204
193
  // deal with an array. The touched state ends up being an empty array in case
205
194
  // values were removed only. So we have to treat any array we receive as
206
195
  // a signal of the field having been touched.
207
-
208
196
  AsyncCreatableSelectInput.isTouched = touched => Boolean(touched);
197
+
209
198
  /**
210
199
  * Expose react-select components for customization purposes.
211
200
  */
212
- // custom
213
-
214
201
 
202
+ // custom
215
203
  AsyncCreatableSelectInput.ClearIndicator = customizedComponents.ClearIndicator;
216
204
  AsyncCreatableSelectInput.Control = reactSelect.components.Control;
217
205
  AsyncCreatableSelectInput.CrossIcon = reactSelect.components.CrossIcon;
218
- AsyncCreatableSelectInput.DownChevron = reactSelect.components.DownChevron; // custom
219
-
206
+ AsyncCreatableSelectInput.DownChevron = reactSelect.components.DownChevron;
207
+ // custom
220
208
  AsyncCreatableSelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
221
209
  AsyncCreatableSelectInput.Group = reactSelect.components.Group;
222
210
  AsyncCreatableSelectInput.GroupHeading = reactSelect.components.GroupHeading;
223
211
  AsyncCreatableSelectInput.IndicatorSeparator = reactSelect.components.IndicatorSeparator;
224
212
  AsyncCreatableSelectInput.IndicatorsContainer = reactSelect.components.IndicatorsContainer;
225
- AsyncCreatableSelectInput.Input = reactSelect.components.Input; // custom
226
-
213
+ AsyncCreatableSelectInput.Input = reactSelect.components.Input;
214
+ // custom
227
215
  AsyncCreatableSelectInput.LoadingIndicator = customizedComponents.LoadingIndicator;
228
216
  AsyncCreatableSelectInput.LoadingMessage = reactSelect.components.LoadingMessage;
229
217
  AsyncCreatableSelectInput.Menu = reactSelect.components.Menu;
@@ -231,8 +219,8 @@ AsyncCreatableSelectInput.MenuList = reactSelect.components.MenuList;
231
219
  AsyncCreatableSelectInput.MenuPortal = reactSelect.components.MenuPortal;
232
220
  AsyncCreatableSelectInput.MultiValue = reactSelect.components.MultiValue;
233
221
  AsyncCreatableSelectInput.MultiValueContainer = reactSelect.components.MultiValueContainer;
234
- AsyncCreatableSelectInput.MultiValueLabel = reactSelect.components.MultiValueLabel; // custom
235
-
222
+ AsyncCreatableSelectInput.MultiValueLabel = reactSelect.components.MultiValueLabel;
223
+ // custom
236
224
  AsyncCreatableSelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
237
225
  AsyncCreatableSelectInput.NoOptionsMessage = reactSelect.components.NoOptionsMessage;
238
226
  AsyncCreatableSelectInput.Option = reactSelect.components.Option;
@@ -243,7 +231,7 @@ AsyncCreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer
243
231
  var AsyncCreatableSelectInput$1 = AsyncCreatableSelectInput;
244
232
 
245
233
  // NOTE: This string will be replaced on build time with the package version.
246
- var version = "16.0.0";
234
+ var version = "16.1.1";
247
235
 
248
236
  exports["default"] = AsyncCreatableSelectInput$1;
249
237
  exports.version = version;
@@ -17,17 +17,13 @@ import Constraints from '@commercetools-uikit/constraints';
17
17
  import LoadingSpinner from '@commercetools-uikit/loading-spinner';
18
18
  import { messages, warnIfMenuPortalPropsAreMissing, customComponentsWithIcons, createSelectStyles, DropdownIndicator, ClearIndicator, TagRemove } from '@commercetools-uikit/select-utils';
19
19
  import { warning, filterDataAttributes } from '@commercetools-uikit/utils';
20
- import { useTheme } from '@commercetools-uikit/design-system';
21
20
  import { jsx } from '@emotion/react/jsx-runtime';
22
21
 
23
22
  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; }
24
-
25
23
  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
-
27
24
  const LoadingIndicator = () => jsx(LoadingSpinner, {
28
25
  scale: "s"
29
26
  });
30
-
31
27
  LoadingIndicator.displayName = 'LoadingIndicator';
32
28
  const customizedComponents = {
33
29
  DropdownIndicator,
@@ -42,23 +38,15 @@ const defaultProps = {
42
38
  isSearchable: true,
43
39
  menuPortalZIndex: 1
44
40
  };
45
-
46
41
  const AsyncCreatableSelectInput = props => {
47
42
  const intl = useIntl();
48
-
49
- const _useTheme = useTheme(),
50
- isNewTheme = _useTheme.isNewTheme;
51
-
52
43
  const placeholder = props.placeholder || intl.formatMessage(messages.placeholder);
53
-
54
44
  if (!props.isReadOnly) {
55
45
  process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'AsyncCreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
56
46
  }
57
-
58
47
  if (props.isMulti) {
59
48
  process.env.NODE_ENV !== "production" ? warning(_Array$isArray(props.value), 'AsyncCreatableSelectInput: `value` is expected to be an array when isMulti is true') : void 0;
60
49
  }
61
-
62
50
  warnIfMenuPortalPropsAreMissing({
63
51
  menuPortalZIndex: props.menuPortalZIndex,
64
52
  menuPortalTarget: props.menuPortalTarget,
@@ -89,10 +77,10 @@ const AsyncCreatableSelectInput = props => {
89
77
  isReadOnly: props.isReadOnly,
90
78
  iconLeft: props.iconLeft,
91
79
  isMulti: props.isMulti,
92
- hasValue: !isEmpty(props.value),
93
- isNewTheme
80
+ hasValue: !isEmpty(props.value)
94
81
  }),
95
- filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
82
+ filterOption: props.filterOption
83
+ // react-select uses "id" (for the container) and "inputId" (for the input),
96
84
  // but we use "id" (for the input) and "containerId" (for the container)
97
85
  // instead.
98
86
  // This makes it easier to less confusing to use with <label />s.
@@ -122,11 +110,11 @@ const AsyncCreatableSelectInput = props => {
122
110
  id: props.id,
123
111
  name: (() => {
124
112
  if (!props.name) return undefined;
125
- if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
113
+ if (!props.isMulti) return props.name;
114
+ // We append the ".0" to make Formik set the touched
126
115
  // state as an array instead of a boolean only.
127
116
  // Otherwise the shapes would clash on submission, as
128
117
  // Formik will create an array on submission anyways.
129
-
130
118
  return "".concat(props.name, ".0");
131
119
  })()
132
120
  },
@@ -136,14 +124,11 @@ const AsyncCreatableSelectInput = props => {
136
124
  } : undefined,
137
125
  onChange: (value, info) => {
138
126
  var _props$onChange;
139
-
140
127
  // wrapping breaking changes made in react-select v3
141
128
  let newValue = value;
142
-
143
129
  if (props.isMulti && !newValue) {
144
130
  newValue = [];
145
131
  }
146
-
147
132
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
148
133
  target: {
149
134
  id: props.id,
@@ -158,11 +143,13 @@ const AsyncCreatableSelectInput = props => {
158
143
  placeholder: placeholder,
159
144
  tabIndex: props.tabIndex,
160
145
  tabSelectsValue: props.tabSelectsValue,
161
- value: props.value // Async react-select props
146
+ value: props.value
147
+ // Async react-select props
162
148
  ,
163
149
  defaultOptions: props.defaultOptions,
164
150
  loadOptions: props.loadOptions,
165
- cacheOptions: props.cacheOptions // Creatable props
151
+ cacheOptions: props.cacheOptions
152
+ // Creatable props
166
153
  ,
167
154
  allowCreateWhileLoading: props.allowCreateWhileLoading,
168
155
  formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(messages.createLabel, {
@@ -171,14 +158,14 @@ const AsyncCreatableSelectInput = props => {
171
158
  isValidNewOption: props.isValidNewOption,
172
159
  getNewOptionData: props.getNewOptionData,
173
160
  onCreateOption: props.onCreateOption,
174
- createOptionPosition: props.createOptionPosition // @ts-ignore
161
+ createOptionPosition: props.createOptionPosition
162
+ // @ts-ignore
175
163
  ,
176
164
  iconLeft: props.iconLeft
177
165
  })
178
166
  }))
179
167
  });
180
168
  };
181
-
182
169
  AsyncCreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
183
170
  horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
184
171
  hasError: _pt.bool,
@@ -193,33 +180,34 @@ AsyncCreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
193
180
  } : {};
194
181
  AsyncCreatableSelectInput.displayName = 'AsyncCreatableSelectInput';
195
182
  AsyncCreatableSelectInput.defaultProps = defaultProps;
183
+
196
184
  /**
197
185
  * Expose static helper methods.
198
186
  */
187
+
199
188
  // Formik will set the field to an array on submission, so we always have to
200
189
  // deal with an array. The touched state ends up being an empty array in case
201
190
  // values were removed only. So we have to treat any array we receive as
202
191
  // a signal of the field having been touched.
203
-
204
192
  AsyncCreatableSelectInput.isTouched = touched => Boolean(touched);
193
+
205
194
  /**
206
195
  * Expose react-select components for customization purposes.
207
196
  */
208
- // custom
209
-
210
197
 
198
+ // custom
211
199
  AsyncCreatableSelectInput.ClearIndicator = customizedComponents.ClearIndicator;
212
200
  AsyncCreatableSelectInput.Control = components.Control;
213
201
  AsyncCreatableSelectInput.CrossIcon = components.CrossIcon;
214
- AsyncCreatableSelectInput.DownChevron = components.DownChevron; // custom
215
-
202
+ AsyncCreatableSelectInput.DownChevron = components.DownChevron;
203
+ // custom
216
204
  AsyncCreatableSelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
217
205
  AsyncCreatableSelectInput.Group = components.Group;
218
206
  AsyncCreatableSelectInput.GroupHeading = components.GroupHeading;
219
207
  AsyncCreatableSelectInput.IndicatorSeparator = components.IndicatorSeparator;
220
208
  AsyncCreatableSelectInput.IndicatorsContainer = components.IndicatorsContainer;
221
- AsyncCreatableSelectInput.Input = components.Input; // custom
222
-
209
+ AsyncCreatableSelectInput.Input = components.Input;
210
+ // custom
223
211
  AsyncCreatableSelectInput.LoadingIndicator = customizedComponents.LoadingIndicator;
224
212
  AsyncCreatableSelectInput.LoadingMessage = components.LoadingMessage;
225
213
  AsyncCreatableSelectInput.Menu = components.Menu;
@@ -227,8 +215,8 @@ AsyncCreatableSelectInput.MenuList = components.MenuList;
227
215
  AsyncCreatableSelectInput.MenuPortal = components.MenuPortal;
228
216
  AsyncCreatableSelectInput.MultiValue = components.MultiValue;
229
217
  AsyncCreatableSelectInput.MultiValueContainer = components.MultiValueContainer;
230
- AsyncCreatableSelectInput.MultiValueLabel = components.MultiValueLabel; // custom
231
-
218
+ AsyncCreatableSelectInput.MultiValueLabel = components.MultiValueLabel;
219
+ // custom
232
220
  AsyncCreatableSelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
233
221
  AsyncCreatableSelectInput.NoOptionsMessage = components.NoOptionsMessage;
234
222
  AsyncCreatableSelectInput.Option = components.Option;
@@ -239,6 +227,6 @@ AsyncCreatableSelectInput.ValueContainer = components.ValueContainer;
239
227
  var AsyncCreatableSelectInput$1 = AsyncCreatableSelectInput;
240
228
 
241
229
  // NOTE: This string will be replaced on build time with the package version.
242
- var version = "16.0.0";
230
+ var version = "16.1.1";
243
231
 
244
232
  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": "16.0.0",
4
+ "version": "16.1.1",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,20 +21,20 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
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
- "@emotion/is-prop-valid": "1.2.0",
24
+ "@commercetools-uikit/constraints": "16.1.1",
25
+ "@commercetools-uikit/design-system": "16.1.1",
26
+ "@commercetools-uikit/icons": "16.1.1",
27
+ "@commercetools-uikit/loading-spinner": "16.1.1",
28
+ "@commercetools-uikit/select-utils": "16.1.1",
29
+ "@commercetools-uikit/spacings": "16.1.1",
30
+ "@commercetools-uikit/text": "16.1.1",
31
+ "@commercetools-uikit/utils": "16.1.1",
32
+ "@emotion/is-prop-valid": "1.2.1",
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.2"
37
+ "react-select": "5.7.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "react": "17.0.2",