@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/dist/components/SelectInput/SelectInput.d.ts +8 -0
- package/dist/hyphen-components.cjs.development.js +6 -5
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +6 -5
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/SelectInput/SelectInput.tsx +13 -1
package/package.json
CHANGED
|
@@ -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
|
-
{...
|
|
275
|
+
{...selectOptions}
|
|
264
276
|
inputId={id}
|
|
265
277
|
aria-label={label}
|
|
266
278
|
components={{ ClearIndicator }}
|