@commercetools-uikit/async-creatable-select-field 19.9.0 → 19.11.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.
@@ -223,7 +223,7 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
223
223
  } : {};
224
224
 
225
225
  // NOTE: This string will be replaced on build time with the package version.
226
- var version = "19.9.0";
226
+ var version = "19.11.0";
227
227
 
228
228
  exports["default"] = AsyncCreatableSelectField;
229
229
  exports.version = version;
@@ -191,7 +191,7 @@ AsyncCreatableSelectField.getDerivedStateFromProps = (props, state) => ({
191
191
  AsyncCreatableSelectField.propTypes = {};
192
192
 
193
193
  // NOTE: This string will be replaced on build time with the package version.
194
- var version = "19.9.0";
194
+ var version = "19.11.0";
195
195
 
196
196
  exports["default"] = AsyncCreatableSelectField;
197
197
  exports.version = version;
@@ -197,6 +197,6 @@ AsyncCreatableSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
197
197
  } : {};
198
198
 
199
199
  // NOTE: This string will be replaced on build time with the package version.
200
- var version = "19.9.0";
200
+ var version = "19.11.0";
201
201
 
202
202
  export { AsyncCreatableSelectField as default, version };
@@ -17,59 +17,306 @@ type TCustomEvent = {
17
17
  persist: () => void;
18
18
  };
19
19
  export type TAsyncCreatableSelectFieldProps = {
20
+ /**
21
+ * Used as HTML id property. An id is auto-generated when it is not specified.
22
+ * <br>
23
+ * [Props from React select was used](https://react-select.com/props)
24
+ */
20
25
  id?: ReactSelectAsyncCreatableProps['inputId'];
26
+ /**
27
+ * Horizontal size limit of the input fields.
28
+ */
21
29
  horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
30
+ /**
31
+ * A map of errors. Error messages for known errors are rendered automatically.
32
+ * <br />
33
+ * Unknown errors will be forwarded to `renderError`
34
+ */
22
35
  errors?: TFieldErrors;
36
+ /**
37
+ * Called with custom errors. This function can return a message which will be wrapped in an ErrorMessage. It can also return null to show no error.
38
+ */
23
39
  renderError?: TErrorRenderer;
40
+ /**
41
+ * A map of warnings. Warning messages for known warnings are rendered automatically.
42
+ * <br />
43
+ * Unknown warnings will be forwarded to `renderWarning`
44
+ */
24
45
  warnings?: TFieldWarnings;
46
+ /**
47
+ * Called with custom warnings. This function can return a message which will be wrapped in an WarningMessage. It can also return null to show no warning.
48
+ */
25
49
  renderWarning?: (key: string, warning?: boolean) => ReactNode;
50
+ /**
51
+ * Indicates if the value is required. Shows an the "required asterisk" if so.
52
+ */
26
53
  isRequired?: boolean;
54
+ /**
55
+ * Indicates whether the field was touched. Errors will only be shown when the field was touched.
56
+ */
27
57
  touched?: boolean[] | boolean;
58
+ /**
59
+ * Aria label (for assistive tech)
60
+ * <br>
61
+ * [Props from React select was used](https://react-select.com/props)
62
+ */
28
63
  'aria-label'?: ReactSelectAsyncCreatableProps['aria-label'];
64
+ /**
65
+ * HTML ID of an element that should be used as the label (for assistive tech)
66
+ * <br>
67
+ * [Props from React select was used](https://react-select.com/props)
68
+ */
29
69
  'aria-labelledby'?: ReactSelectAsyncCreatableProps['aria-labelledby'];
70
+ /**
71
+ * Focus the control when it is mounted
72
+ */
30
73
  isAutofocussed?: boolean;
74
+ /**
75
+ * Remove the currently focused option when the user presses backspace
76
+ * <br>
77
+ * [Props from React select was used](https://react-select.com/props)
78
+ */
31
79
  backspaceRemovesValue?: ReactSelectAsyncCreatableProps['backspaceRemovesValue'];
80
+ /**
81
+ * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
82
+ * <br>
83
+ * [Props from React select was used](https://react-select.com/props)
84
+ */
32
85
  components?: ReactSelectAsyncCreatableProps['components'];
86
+ /**
87
+ * Custom method to filter whether an option should be displayed in the menu
88
+ * <br>
89
+ * [Props from React select was used](https://react-select.com/props)
90
+ */
33
91
  filterOption?: ReactSelectAsyncCreatableProps['filterOption'];
92
+ /**
93
+ * The id to set on the SelectContainer component
94
+ * <br>
95
+ * [Props from React select was used](https://react-select.com/props)
96
+ */
34
97
  containerId?: ReactSelectAsyncCreatableProps['id'];
98
+ /**
99
+ * Is the select value clearable
100
+ * <br>
101
+ * [Props from React select was used](https://react-select.com/props)
102
+ */
35
103
  isClearable?: ReactSelectAsyncCreatableProps['isClearable'];
104
+ /**
105
+ * Use this property to reduce the paddings of the component for a ui compact variant
106
+ */
36
107
  isCondensed?: boolean;
108
+ /**
109
+ * Is the select disabled
110
+ * <br>
111
+ * [Props from React select was used](https://react-select.com/props)
112
+ */
37
113
  isDisabled?: ReactSelectAsyncCreatableProps['isDisabled'];
114
+ /**
115
+ * Is the select read-only
116
+ */
38
117
  isReadOnly?: boolean;
118
+ /**
119
+ * Override the built-in logic to detect whether an option is disabled
120
+ * <br>
121
+ * [Props from React select was used](https://react-select.com/props)
122
+ */
39
123
  isOptionDisabled?: ReactSelectAsyncCreatableProps['isOptionDisabled'];
124
+ /**
125
+ * Support multiple selected options
126
+ * <br>
127
+ * [Props from React select was used](https://react-select.com/props)
128
+ */
40
129
  isMulti?: ReactSelectAsyncCreatableProps['isMulti'];
130
+ /**
131
+ * Whether to enable search functionality
132
+ * <br>
133
+ * [Props from React select was used](https://react-select.com/props)
134
+ */
41
135
  isSearchable?: ReactSelectAsyncCreatableProps['isSearchable'];
136
+ /**
137
+ * Indicates the input field has a warning
138
+ * @deprecated Please use the `warnings` prop instead so users know the reason why the field is in warning state.
139
+ */
42
140
  hasWarning?: boolean;
141
+ /**
142
+ * Maximum height of the menu before scrolling
143
+ * <br>
144
+ * [Props from React select was used](https://react-select.com/props)
145
+ */
43
146
  maxMenuHeight?: ReactSelectAsyncCreatableProps['maxMenuHeight'];
147
+ /**
148
+ * Dom element to portal the select menu to
149
+ * <br>
150
+ * [Props from React select was used](https://react-select.com/props)
151
+ */
44
152
  menuPortalTarget?: ReactSelectAsyncCreatableProps['menuPortalTarget'];
153
+ /**
154
+ * z-index value for the menu portal
155
+ * <br>
156
+ * Use in conjunction with `menuPortalTarget`
157
+ */
45
158
  menuPortalZIndex?: number;
159
+ /**
160
+ * whether the menu should block scroll while open
161
+ * <br>
162
+ * [Props from React select was used](https://react-select.com/props)
163
+ */
46
164
  menuShouldBlockScroll?: ReactSelectAsyncCreatableProps['menuShouldBlockScroll'];
165
+ /**
166
+ * Name of the HTML Input (optional - without this, no input will be rendered)
167
+ * <br>
168
+ * [Props from React select was used](https://react-select.com/props)
169
+ */
47
170
  name?: ReactSelectAsyncCreatableProps['name'];
171
+ /**
172
+ * 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).
173
+ * <br/>
174
+ * Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
175
+ * <br>
176
+ * [Props from React select was used](https://react-select.com/props)
177
+ */
48
178
  noOptionsMessage?: ReactSelectAsyncCreatableProps['noOptionsMessage'];
179
+ /**
180
+ * Handle blur events on the control
181
+ */
49
182
  onBlur?: (event: TCustomEvent) => void;
183
+ /**
184
+ * Called with a fake event when value changes.
185
+ * <br />
186
+ * 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`.
187
+ * <br>
188
+ * [Props from React select was used](https://react-select.com/props)
189
+ */
50
190
  onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
191
+ /**
192
+ * Handle focus events on the control
193
+ * <br>
194
+ * [Props from React select was used](https://react-select.com/props)
195
+ */
51
196
  onFocus?: ReactSelectAsyncCreatableProps['onFocus'];
197
+ /**
198
+ * Handle change events on the input
199
+ * <br>
200
+ * [Props from React select was used](https://react-select.com/props)
201
+ */
52
202
  onInputChange?: ReactSelectAsyncCreatableProps['onInputChange'];
203
+ /**
204
+ * Placeholder text for the select value
205
+ * <br>
206
+ * [Props from React select was used](https://react-select.com/props)
207
+ */
53
208
  placeholder?: ReactSelectAsyncCreatableProps['placeholder'];
209
+ /**
210
+ * Sets the tabIndex attribute on the input
211
+ * <br>
212
+ * [Props from React select was used](https://react-select.com/props)
213
+ */
54
214
  tabIndex?: ReactSelectAsyncCreatableProps['tabIndex'];
215
+ /**
216
+ * Select the currently focused option when the user presses tab
217
+ * <br>
218
+ * [Props from React select was used](https://react-select.com/props)
219
+ */
55
220
  tabSelectsValue?: ReactSelectAsyncCreatableProps['tabSelectsValue'];
221
+ /**
222
+ * The value of the select; reflected by the selected option
223
+ * <br>
224
+ * [Props from React select was used](https://react-select.com/props)
225
+ */
56
226
  value?: ReactSelectAsyncCreatableProps['value'];
227
+ /**
228
+ * Determines if option groups will be separated by a divider
229
+ */
57
230
  showOptionGroupDivider?: boolean;
231
+ /**
232
+ * The default set of options to show before the user starts searching.
233
+ * <br/>
234
+ * When set to `true`, the results for `loadOptions('')` will be autoloaded.
235
+ * <br>
236
+ * [Props from React select was used](https://react-select.com/props)
237
+ */
58
238
  defaultOptions?: ReactSelectAsyncCreatableProps['defaultOptions'];
239
+ /**
240
+ * Function that returns a promise, which is the set of options to be used once the promise resolves.
241
+ * <br />
242
+ * [Props from React select was used](https://react-select.com/props)
243
+ */
59
244
  loadOptions: ReactSelectAsyncCreatableProps['loadOptions'];
245
+ /**
246
+ * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
247
+ * <br>
248
+ * [Props from React select was used](https://react-select.com/props)
249
+ */
60
250
  cacheOptions?: ReactSelectAsyncCreatableProps['cacheOptions'];
251
+ /**
252
+ * Allow options to be created while the isLoading prop is true. Useful to prevent the "create new ..." option being displayed while async results are still being loaded.
253
+ * <br>
254
+ * [Props from React select was used](https://react-select.com/props)
255
+ */
61
256
  allowCreateWhileLoading?: ReactSelectAsyncCreatableProps['allowCreateWhileLoading'];
257
+ /**
258
+ * Gets the label for the "create new ..." option in the menu. Is given the current input value.
259
+ * <br>
260
+ * [Props from React select was used](https://react-select.com/props)
261
+ */
62
262
  formatCreateLabel?: ReactSelectAsyncCreatableProps['formatCreateLabel'];
263
+ /**
264
+ * Determines whether the "create new ..." option should be displayed based on the current input value, select value and options array.
265
+ * <br>
266
+ * [Props from React select was used](https://react-select.com/props)
267
+ */
63
268
  isValidNewOption?: ReactSelectAsyncCreatableProps['isValidNewOption'];
269
+ /**
270
+ * Returns the data for the new option when it is created. Used to display the value, and is passed to onChange.
271
+ * <br>
272
+ * [Props from React select was used](https://react-select.com/props)
273
+ */
64
274
  getNewOptionData?: ReactSelectAsyncCreatableProps['getNewOptionData'];
275
+ /**
276
+ * If provided, this will be called with the input value when a new option is created, and onChange will not be called. Use this when you need more control over what happens when new options are created.
277
+ * <br>
278
+ * [Props from React select was used](https://react-select.com/props)
279
+ */
65
280
  onCreateOption?: ReactSelectAsyncCreatableProps['onCreateOption'];
281
+ /**
282
+ * Sets the position of the createOption element in your options list.
283
+ * <br>
284
+ * [Props from React select was used](https://react-select.com/props)
285
+ */
66
286
  createOptionPosition?: ReactSelectAsyncCreatableProps['createOptionPosition'];
287
+ /**
288
+ * Title of the label
289
+ */
67
290
  title: string | ReactNode;
291
+ /**
292
+ * Hint for the label. Provides a supplementary but important information regarding the behaviour of the input (e.g warn about uniqueness of a field, when it can only be set once), whereas `description` can describe it in more depth. Can also receive a `hintIcon`.
293
+ */
68
294
  hint?: string | ReactNode;
295
+ /**
296
+ * Provides a description for the title.
297
+ */
69
298
  description?: string | ReactNode;
299
+ /**
300
+ * Function called when info button is pressed.
301
+ * <br />
302
+ * Info button will only be visible when this prop is passed.
303
+ */
70
304
  onInfoButtonClick?: () => void;
305
+ /**
306
+ * Icon to be displayed beside the hint text.
307
+ * <br />
308
+ * Will only get rendered when `hint` is passed as well.
309
+ */
71
310
  hintIcon?: ReactElement;
311
+ /**
312
+ * Badge to be displayed beside the label.
313
+ * <br />
314
+ * Might be used to display additional information about the content of the field (E.g verified email)
315
+ */
72
316
  badge?: ReactNode;
317
+ /**
318
+ * Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
319
+ */
73
320
  iconLeft?: ReactNode;
74
321
  };
75
322
  type TAsyncCreatableSelectFieldState = Pick<TAsyncCreatableSelectFieldProps, 'id'>;
@@ -82,6 +329,11 @@ export default class AsyncCreatableSelectField extends Component<TAsyncCreatable
82
329
  static getDerivedStateFromProps: (props: TAsyncCreatableSelectFieldProps, state: TAsyncCreatableSelectFieldState) => {
83
330
  id: string;
84
331
  };
332
+ /**
333
+ * Use this function to convert the Formik `errors` object type to
334
+ * our custom field errors type.
335
+ * This is primarly useful when using TypeScript.
336
+ */
85
337
  static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
86
338
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
87
339
  }
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": "19.9.0",
4
+ "version": "19.11.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,14 +21,14 @@
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.20.13",
23
23
  "@babel/runtime-corejs3": "^7.20.13",
24
- "@commercetools-uikit/async-creatable-select-input": "19.9.0",
25
- "@commercetools-uikit/constraints": "19.9.0",
26
- "@commercetools-uikit/design-system": "19.9.0",
27
- "@commercetools-uikit/field-errors": "19.9.0",
28
- "@commercetools-uikit/field-label": "19.9.0",
29
- "@commercetools-uikit/field-warnings": "19.9.0",
30
- "@commercetools-uikit/spacings": "19.9.0",
31
- "@commercetools-uikit/utils": "19.9.0",
24
+ "@commercetools-uikit/async-creatable-select-input": "19.11.0",
25
+ "@commercetools-uikit/constraints": "19.11.0",
26
+ "@commercetools-uikit/design-system": "19.11.0",
27
+ "@commercetools-uikit/field-errors": "19.11.0",
28
+ "@commercetools-uikit/field-label": "19.11.0",
29
+ "@commercetools-uikit/field-warnings": "19.11.0",
30
+ "@commercetools-uikit/spacings": "19.11.0",
31
+ "@commercetools-uikit/utils": "19.11.0",
32
32
  "@emotion/react": "^11.10.5",
33
33
  "@emotion/styled": "^11.10.5",
34
34
  "prop-types": "15.8.1",