@hyphen/hyphen-components 2.16.2 → 2.16.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyphen/hyphen-components",
3
- "version": "2.16.2",
3
+ "version": "2.16.3",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "@hyphen"
@@ -55,6 +55,10 @@ export interface SelectInputProps {
55
55
  * The value(s) of select.
56
56
  */
57
57
  value: any | any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
58
+ /**
59
+ * Options for dropdown list.
60
+ */
61
+ options: SelectInputOptions | AsyncOptions;
58
62
  /**
59
63
  * Autofocus select input on render.
60
64
  */
@@ -76,6 +80,10 @@ export interface SelectInputProps {
76
80
  * Visually hide the label.
77
81
  */
78
82
  hideLabel?: boolean;
83
+ /**
84
+ * Load the input asynchronously.
85
+ */
86
+ isAsync?: boolean;
79
87
  /**
80
88
  * If the input value is clearable programmatically.
81
89
  */
@@ -255,12 +263,16 @@ export function SelectInput(props: SelectInputProps): JSX.Element {
255
263
  ? AsyncSelect
256
264
  : Select;
257
265
 
266
+ const selectOptions = isAsync
267
+ ? ({ loadOptions: options } as { loadOptions: AsyncOptions })
268
+ : ({ options } as { options: SelectInputOptions });
269
+
258
270
  return (
259
271
  <Box width="100%" className={wrapperClasses}>
260
272
  {label && !hideLabel && <FormLabel {...labelProps}>{label}</FormLabel>}
261
273
  <Component
262
274
  {...restProps}
263
- {...(isAsync ? { loadOptions: options } : { options })}
275
+ {...selectOptions}
264
276
  inputId={id}
265
277
  aria-label={label}
266
278
  components={{ ClearIndicator }}