@hyphen/hyphen-components 2.15.5 → 2.16.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.
- package/dist/components/SelectInput/SelectInput.d.ts +32 -6
- package/dist/components/SelectInput/SelectInput.stories.d.ts +2 -0
- package/dist/css/index.css +8 -8
- package/dist/css/utilities.css +7 -1
- package/dist/css/variables.css +4 -2
- package/dist/hyphen-components.cjs.development.js +54 -47
- 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 +54 -47
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/lib/tokens.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/FormLabel/FormLabel.module.scss +1 -1
- package/src/components/SelectInput/SelectInput.mdx +12 -0
- package/src/components/SelectInput/SelectInput.module.scss +5 -6
- package/src/components/SelectInput/SelectInput.stories.tsx +86 -0
- package/src/components/SelectInput/SelectInput.test.tsx +32 -1
- package/src/components/SelectInput/SelectInput.tsx +74 -33
- package/src/components/SelectInputInset/SelectInputInset.module.scss +3 -12
- package/src/components/SelectInputNative/SelectInputNative.module.scss +3 -8
- package/src/components/TextInput/TextInput.module.scss +3 -12
- package/src/components/TextInputInset/TextInputInset.module.scss +3 -12
- package/src/components/TextareaInput/TextareaInput.module.scss +4 -8
- package/src/components/TextareaInputInset/TextareaInputInset.module.scss +3 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FocusEvent, ReactNode } from 'react';
|
|
2
2
|
import { OptionsOrGroups, OnChangeValue } from 'react-select';
|
|
3
3
|
import { ResponsiveProp } from '../../types';
|
|
4
4
|
import { GroupBase } from 'react-select/dist/declarations/src/types';
|
|
@@ -25,10 +25,6 @@ export interface SelectInputProps {
|
|
|
25
25
|
* Callback function to call on change event.
|
|
26
26
|
*/
|
|
27
27
|
onChange: (event: SimulatedEventPayloadType) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Options for dropdown list.
|
|
30
|
-
*/
|
|
31
|
-
options: SelectInputOptions;
|
|
32
28
|
/**
|
|
33
29
|
* The value(s) of select.
|
|
34
30
|
*/
|
|
@@ -110,5 +106,35 @@ export interface SelectInputProps {
|
|
|
110
106
|
*/
|
|
111
107
|
[x: string]: any;
|
|
112
108
|
}
|
|
113
|
-
|
|
109
|
+
type AsyncOptions = (inputValue: string) => Promise<SelectInputOptions>;
|
|
110
|
+
type AsyncSelectInputProps = SelectInputProps & {
|
|
111
|
+
/**
|
|
112
|
+
* Load the input asynchronously.
|
|
113
|
+
*/
|
|
114
|
+
isAsync: true;
|
|
115
|
+
/**
|
|
116
|
+
* Load options asynchronously.
|
|
117
|
+
*/
|
|
118
|
+
options: AsyncOptions;
|
|
119
|
+
/**
|
|
120
|
+
* If cacheOptions is passed, then the loaded data will be cached.
|
|
121
|
+
*/
|
|
122
|
+
cacheOptions?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* The default set of options to show before the user starts searching.
|
|
125
|
+
*/
|
|
126
|
+
defaultOptions?: boolean;
|
|
127
|
+
};
|
|
128
|
+
type SyncSelectInputProps = SelectInputProps & {
|
|
129
|
+
/**
|
|
130
|
+
* Load the input synchronously.
|
|
131
|
+
*/
|
|
132
|
+
isAsync?: false;
|
|
133
|
+
/**
|
|
134
|
+
* Options for dropdown list.
|
|
135
|
+
*/
|
|
136
|
+
options: SelectInputOptions;
|
|
137
|
+
};
|
|
138
|
+
export declare function SelectInput(props: AsyncSelectInputProps): JSX.Element;
|
|
139
|
+
export declare function SelectInput(props: SyncSelectInputProps): JSX.Element;
|
|
114
140
|
export {};
|
|
@@ -9,6 +9,8 @@ export declare const HelpText: () => React.JSX.Element;
|
|
|
9
9
|
export declare const Placeholder: () => React.JSX.Element;
|
|
10
10
|
export declare const HiddenLabel: () => React.JSX.Element;
|
|
11
11
|
export declare const CreatableSelect: () => React.JSX.Element;
|
|
12
|
+
export declare const AsyncSelect: () => React.JSX.Element;
|
|
13
|
+
export declare const AsyncCreatableSelect: () => React.JSX.Element;
|
|
12
14
|
export declare const MultiSelect: () => React.JSX.Element;
|
|
13
15
|
export declare const MultiSelectAndPreSelected: () => React.JSX.Element;
|
|
14
16
|
export declare const MultiSelectCreatable: () => React.JSX.Element;
|