@commercetools-uikit/async-select-field 19.9.0 → 19.10.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.
@@ -222,7 +222,7 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
222
222
  } : {};
223
223
 
224
224
  // NOTE: This string will be replaced on build time with the package version.
225
- var version = "19.9.0";
225
+ var version = "19.10.0";
226
226
 
227
227
  exports["default"] = AsyncSelectField;
228
228
  exports.version = version;
@@ -187,7 +187,7 @@ AsyncSelectField.getDerivedStateFromProps = (props, state) => ({
187
187
  AsyncSelectField.propTypes = {};
188
188
 
189
189
  // NOTE: This string will be replaced on build time with the package version.
190
- var version = "19.9.0";
190
+ var version = "19.10.0";
191
191
 
192
192
  exports["default"] = AsyncSelectField;
193
193
  exports.version = version;
@@ -196,6 +196,6 @@ AsyncSelectField.propTypes = process.env.NODE_ENV !== "production" ? {
196
196
  } : {};
197
197
 
198
198
  // NOTE: This string will be replaced on build time with the package version.
199
- var version = "19.9.0";
199
+ var version = "19.10.0";
200
200
 
201
201
  export { AsyncSelectField as default, version };
@@ -17,55 +17,272 @@ type TCustomEvent = {
17
17
  persist: () => void;
18
18
  };
19
19
  export type TAsyncSelectFieldProps = {
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?: ReactSelectAsyncProps['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'?: ReactSelectAsyncProps['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'?: ReactSelectAsyncProps['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?: ReactSelectAsyncProps['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?: ReactSelectAsyncProps['components'];
86
+ /**
87
+ * Control whether the selected values should be rendered in the control
88
+ * <br>
89
+ * [Props from React select was used](https://react-select.com/props)
90
+ */
33
91
  controlShouldRenderValue?: ReactSelectAsyncProps['controlShouldRenderValue'];
92
+ /**
93
+ * Custom method to filter whether an option should be displayed in the menu
94
+ * <br>
95
+ * [Props from React select was used](https://react-select.com/props)
96
+ */
34
97
  filterOption?: ReactSelectAsyncProps['filterOption'];
98
+ /**
99
+ * The id to set on the SelectContainer component
100
+ * <br>
101
+ * [Props from React select was used](https://react-select.com/props)
102
+ */
35
103
  containerId?: ReactSelectAsyncProps['id'];
104
+ /**
105
+ * Is the select value clearable
106
+ * <br>
107
+ * [Props from React select was used](https://react-select.com/props)
108
+ */
36
109
  isClearable?: ReactSelectAsyncProps['isClearable'];
110
+ /**
111
+ * Use this property to reduce the paddings of the component for a ui compact variant
112
+ */
37
113
  isCondensed?: boolean;
114
+ /**
115
+ * Is the select disabled
116
+ * <br>
117
+ * [Props from React select was used](https://react-select.com/props)
118
+ */
38
119
  isDisabled?: ReactSelectAsyncProps['isDisabled'];
120
+ /**
121
+ * Is the select read-only
122
+ */
39
123
  isReadOnly?: boolean;
124
+ /**
125
+ * Override the built-in logic to detect whether an option is disabled
126
+ * <br>
127
+ * [Props from React select was used](https://react-select.com/props)
128
+ */
40
129
  isOptionDisabled?: ReactSelectAsyncProps['isOptionDisabled'];
130
+ /**
131
+ * Support multiple selected options
132
+ * <br>
133
+ * [Props from React select was used](https://react-select.com/props)
134
+ */
41
135
  isMulti?: ReactSelectAsyncProps['isMulti'];
136
+ /**
137
+ * Whether to enable search functionality
138
+ * <br>
139
+ * [Props from React select was used](https://react-select.com/props)
140
+ */
42
141
  isSearchable?: ReactSelectAsyncProps['isSearchable'];
142
+ /**
143
+ * Indicates the input field has a warning
144
+ * @deprecated Please use the `warnings` prop instead so users know the reason why the field is in warning state.
145
+ */
43
146
  hasWarning?: boolean;
147
+ /**
148
+ * Maximum height of the menu before scrolling
149
+ * <br>
150
+ * [Props from React select was used](https://react-select.com/props)
151
+ */
44
152
  maxMenuHeight?: ReactSelectAsyncProps['maxMenuHeight'];
153
+ /**
154
+ * Dom element to portal the select menu to
155
+ * <br>
156
+ * [Props from React select was used](https://react-select.com/props)
157
+ */
45
158
  menuPortalTarget?: ReactSelectAsyncProps['menuPortalTarget'];
159
+ /**
160
+ * z-index value for the menu portal
161
+ * <br>
162
+ * Use in conjunction with `menuPortalTarget`
163
+ */
46
164
  menuPortalZIndex?: number;
165
+ /**
166
+ * whether the menu should block scroll while open
167
+ * <br>
168
+ * [Props from React select was used](https://react-select.com/props)
169
+ */
47
170
  menuShouldBlockScroll?: ReactSelectAsyncProps['menuShouldBlockScroll'];
171
+ /**
172
+ * Name of the HTML Input (optional - without this, no input will be rendered)
173
+ * <br>
174
+ * [Props from React select was used](https://react-select.com/props)
175
+ */
48
176
  name?: ReactSelectAsyncProps['name'];
177
+ /**
178
+ * 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).
179
+ * <br>
180
+ * [Props from React select was used](https://react-select.com/props)
181
+ */
49
182
  noOptionsMessage?: ReactSelectAsyncProps['noOptionsMessage'];
183
+ /**
184
+ * Handle blur events on the control
185
+ */
50
186
  onBlur?: (event: TCustomEvent) => void;
187
+ /**
188
+ * Called with a fake event when value changes.
189
+ * <br />
190
+ * 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`.
191
+ */
51
192
  onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
193
+ /**
194
+ * Handle focus events on the control
195
+ */
52
196
  onFocus?: FocusEventHandler;
197
+ /**
198
+ * Handle change events on the input
199
+ * <br>
200
+ * [Props from React select was used](https://react-select.com/props)
201
+ */
53
202
  onInputChange?: ReactSelectAsyncProps['onInputChange'];
203
+ /**
204
+ * Placeholder text for the select value
205
+ * <br>
206
+ * [Props from React select was used](https://react-select.com/props)
207
+ */
54
208
  placeholder?: ReactSelectAsyncProps['placeholder'];
209
+ /**
210
+ * loading message shown while the options are being loaded
211
+ */
55
212
  loadingMessage?: string | (() => string);
213
+ /**
214
+ * Sets the tabIndex attribute on the input
215
+ * <br>
216
+ * [Props from React select was used](https://react-select.com/props)
217
+ */
56
218
  tabIndex?: ReactSelectAsyncProps['tabIndex'];
219
+ /**
220
+ * Select the currently focused option when the user presses tab
221
+ * <br>
222
+ * [Props from React select was used](https://react-select.com/props)
223
+ */
57
224
  tabSelectsValue?: ReactSelectAsyncProps['tabSelectsValue'];
225
+ /**
226
+ * The value of the select; reflected by the selected option
227
+ * <br>
228
+ * [Props from React select was used](https://react-select.com/props)
229
+ */
58
230
  value?: ReactSelectAsyncProps['value'];
231
+ /**
232
+ * Determines if option groups will be separated by a divider
233
+ */
59
234
  showOptionGroupDivider?: boolean;
235
+ /**
236
+ * The default set of options to show before the user starts searching.
237
+ * <br />
238
+ * When set to `true`, the results for `loadOptions('')` will be autoloaded.
239
+ */
60
240
  defaultOptions?: OptionsOrGroups<unknown, GroupBase<unknown>> | boolean;
241
+ /**
242
+ * Function that returns a promise, which is the set of options to be used once the promise resolves.
243
+ * <br>
244
+ * [Props from React select was used](https://react-select.com/props)
245
+ */
61
246
  loadOptions: ReactSelectAsyncProps['loadOptions'];
247
+ /**
248
+ * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
249
+ * <br>
250
+ * [Props from React select was used](https://react-select.com/props)
251
+ */
62
252
  cacheOptions?: ReactSelectAsyncProps['cacheOptions'];
253
+ /**
254
+ * Title of the label
255
+ */
63
256
  title: string | ReactNode;
257
+ /**
258
+ * 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`.
259
+ */
64
260
  hint?: string | ReactNode;
261
+ /**
262
+ * Provides a description for the title.
263
+ */
65
264
  description?: string | ReactNode;
265
+ /**
266
+ * Function called when info button is pressed.
267
+ * <br />
268
+ * Info button will only be visible when this prop is passed.
269
+ */
66
270
  onInfoButtonClick?: () => void;
271
+ /**
272
+ * Icon to be displayed beside the hint text.
273
+ * <br />
274
+ * Will only get rendered when `hint` is passed as well.
275
+ */
67
276
  hintIcon?: ReactElement;
277
+ /**
278
+ * Badge to be displayed beside the label.
279
+ * <br />
280
+ * Might be used to display additional information about the content of the field (E.g verified email)
281
+ */
68
282
  badge?: ReactNode;
283
+ /**
284
+ * Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
285
+ */
69
286
  iconLeft?: ReactNode;
70
287
  };
71
288
  type TAsyncSelectFieldState = Pick<TAsyncSelectFieldProps, 'id'>;
@@ -78,6 +295,11 @@ export default class AsyncSelectField extends Component<TAsyncSelectFieldProps,
78
295
  static getDerivedStateFromProps: (props: TAsyncSelectFieldProps, state: TAsyncSelectFieldState) => {
79
296
  id: string;
80
297
  };
298
+ /**
299
+ * Use this function to convert the Formik `errors` object type to
300
+ * our custom field errors type.
301
+ * This is primarly useful when using TypeScript.
302
+ */
81
303
  static toFieldErrors<FormValues>(errors: unknown): TCustomFormErrors<FormValues>;
82
304
  render(): import("@emotion/react/jsx-runtime").JSX.Element;
83
305
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/async-select-field",
3
3
  "description": "A controlled input component with validation states and a label getting a selection from an asynchronously loaded list from the user.",
4
- "version": "19.9.0",
4
+ "version": "19.10.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-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-select-input": "19.10.0",
25
+ "@commercetools-uikit/constraints": "19.10.0",
26
+ "@commercetools-uikit/design-system": "19.10.0",
27
+ "@commercetools-uikit/field-errors": "19.10.0",
28
+ "@commercetools-uikit/field-label": "19.10.0",
29
+ "@commercetools-uikit/field-warnings": "19.10.0",
30
+ "@commercetools-uikit/spacings": "19.10.0",
31
+ "@commercetools-uikit/utils": "19.10.0",
32
32
  "@emotion/react": "^11.10.5",
33
33
  "@emotion/styled": "^11.10.5",
34
34
  "prop-types": "15.8.1",