@react-types/autocomplete 3.0.0-alpha.3 → 3.0.0-alpha.30
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 +6 -6
- package/src/index.d.ts +26 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/autocomplete",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.30",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"url": "https://github.com/adobe/react-spectrum"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@react-types/combobox": "^3.
|
|
13
|
-
"@react-types/searchfield": "^3.1
|
|
14
|
-
"@react-types/shared": "^3.
|
|
12
|
+
"@react-types/combobox": "^3.13.4",
|
|
13
|
+
"@react-types/searchfield": "^3.6.1",
|
|
14
|
+
"@react-types/shared": "^3.29.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
17
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
|
|
23
23
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {AsyncLoadable, CollectionBase, LoadingState, SpectrumLabelableProps, StyleProps} from '@react-types/shared';
|
|
14
|
-
import {
|
|
13
|
+
import {AriaLabelingProps, AsyncLoadable, CollectionBase, DimensionValue, DOMProps, Key, LoadingState, SpectrumFieldValidation, SpectrumLabelableProps, SpectrumTextInputBase, StyleProps} from '@react-types/shared';
|
|
14
|
+
import {AriaSearchFieldProps, SearchFieldProps} from '@react-types/searchfield';
|
|
15
15
|
import {MenuTriggerAction} from '@react-types/combobox';
|
|
16
|
-
import {
|
|
17
|
-
|
|
16
|
+
import {ReactElement} from 'react';
|
|
17
|
+
|
|
18
|
+
export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<SearchFieldProps, 'onSubmit' | 'defaultValue' | 'value'> {
|
|
18
19
|
/** The list of SearchAutocomplete items (uncontrolled). */
|
|
19
20
|
defaultItems?: Iterable<T>,
|
|
20
21
|
/** The list of SearchAutocomplete items (controlled). */
|
|
@@ -32,10 +33,20 @@ export interface SearchAutocompleteProps<T> extends CollectionBase<T>, Omit<Sear
|
|
|
32
33
|
* @default 'input'
|
|
33
34
|
*/
|
|
34
35
|
menuTrigger?: MenuTriggerAction,
|
|
35
|
-
|
|
36
|
+
/** Handler that is called when the SearchAutocomplete is submitted.
|
|
37
|
+
*
|
|
38
|
+
* A `value` will be passed if the submission is a custom value (e.g. a user types then presses enter).
|
|
39
|
+
* If the input is a selected item, `value` will be null.
|
|
40
|
+
*
|
|
41
|
+
* A `key` will be passed if the submission is a selected item (e.g. a user clicks or presses enter on an option).
|
|
42
|
+
* If the input is a custom value, `key` will be null.
|
|
43
|
+
*/
|
|
44
|
+
onSubmit?: (value: string | null, key: Key | null) => void
|
|
36
45
|
}
|
|
37
46
|
|
|
38
|
-
export interface
|
|
47
|
+
export interface AriaSearchAutocompleteProps<T> extends SearchAutocompleteProps<T>, Omit<AriaSearchFieldProps, 'onSubmit' | 'defaultValue' | 'value'>, DOMProps, AriaLabelingProps {}
|
|
48
|
+
|
|
49
|
+
export interface SpectrumSearchAutocompleteProps<T> extends SpectrumTextInputBase, Omit<AriaSearchAutocompleteProps<T>, 'menuTrigger' | 'isInvalid' | 'validationState' | 'validate'>, SpectrumFieldValidation<string>, SpectrumLabelableProps, StyleProps, Omit<AsyncLoadable, 'isLoading'> {
|
|
39
50
|
/**
|
|
40
51
|
* The interaction required to display the SearchAutocomplete menu. Note that this prop has no effect on the mobile SearchAutocomplete experience.
|
|
41
52
|
* @default 'input'
|
|
@@ -43,6 +54,10 @@ export interface SpectrumSearchAutocompleteProps<T> extends Omit<SearchAutocompl
|
|
|
43
54
|
menuTrigger?: MenuTriggerAction,
|
|
44
55
|
/** Whether the SearchAutocomplete should be displayed with a quiet style. */
|
|
45
56
|
isQuiet?: boolean,
|
|
57
|
+
/** Alignment of the menu relative to the input target.
|
|
58
|
+
* @default 'start'
|
|
59
|
+
*/
|
|
60
|
+
align?: 'start' | 'end',
|
|
46
61
|
/**
|
|
47
62
|
* Direction the menu will render relative to the SearchAutocomplete.
|
|
48
63
|
* @default 'bottom'
|
|
@@ -55,5 +70,9 @@ export interface SpectrumSearchAutocompleteProps<T> extends Omit<SearchAutocompl
|
|
|
55
70
|
* @default true
|
|
56
71
|
*/
|
|
57
72
|
shouldFlip?: boolean,
|
|
58
|
-
|
|
73
|
+
/** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */
|
|
74
|
+
menuWidth?: DimensionValue,
|
|
75
|
+
onLoadMore?: () => void,
|
|
76
|
+
/** An icon to display at the start of the input. */
|
|
77
|
+
icon?: ReactElement | null
|
|
59
78
|
}
|