downshift 9.1.0-alpha.3 → 9.1.0-alpha.5
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/hooks/useTagGroup/index.types.d.ts +6 -0
- package/package.json +1 -1
- package/typings/index.d.ts +8 -118
- package/typings/index.legacy.d.ts +98 -102
|
@@ -3,6 +3,12 @@ export interface UseTagGroupState<Item> extends State {
|
|
|
3
3
|
activeIndex: number;
|
|
4
4
|
items: Item[];
|
|
5
5
|
}
|
|
6
|
+
export interface Environment {
|
|
7
|
+
addEventListener: typeof window.addEventListener;
|
|
8
|
+
removeEventListener: typeof window.removeEventListener;
|
|
9
|
+
document: Document;
|
|
10
|
+
Node: typeof window.Node;
|
|
11
|
+
}
|
|
6
12
|
export interface UseTagGroupProps<Item> extends Partial<UseTagGroupState<Item>> {
|
|
7
13
|
initialActiveIndex?: number;
|
|
8
14
|
initialItems?: Item[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "downshift",
|
|
3
|
-
"version": "9.1.0-alpha.
|
|
3
|
+
"version": "9.1.0-alpha.5",
|
|
4
4
|
"description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.",
|
|
5
5
|
"main": "dist/downshift.cjs.js",
|
|
6
6
|
"react-native": "dist/downshift.native.cjs.js",
|
package/typings/index.d.ts
CHANGED
|
@@ -1,125 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface DownshiftState<Item> extends globalThis.DownshiftState<Item> {}
|
|
6
|
-
export interface DownshiftProps<Item> extends globalThis.DownshiftProps<Item> {}
|
|
7
|
-
export interface Environment extends globalThis.Environment {}
|
|
8
|
-
export interface A11yStatusMessageOptions<Item> extends globalThis.A11yStatusMessageOptions<Item> {}
|
|
9
|
-
export interface StateChangeOptions<Item> extends globalThis.StateChangeOptions<Item> {}
|
|
10
|
-
export interface GetRootPropsOptions extends globalThis.GetRootPropsOptions {}
|
|
11
|
-
export interface GetRootPropsReturnValue extends globalThis.GetRootPropsReturnValue {}
|
|
12
|
-
export interface GetInputPropsOptions extends globalThis.GetInputPropsOptions {}
|
|
13
|
-
export interface GetInputPropsReturnValue extends globalThis.GetInputPropsReturnValue {}
|
|
14
|
-
export interface GetLabelPropsOptions extends globalThis.GetLabelPropsOptions {}
|
|
15
|
-
export interface GetLabelPropsReturnValue extends globalThis.GetLabelPropsReturnValue {}
|
|
16
|
-
export interface GetToggleButtonPropsOptions extends globalThis.GetToggleButtonPropsOptions {}
|
|
17
|
-
export interface GetMenuPropsOptions extends globalThis.GetMenuPropsOptions {}
|
|
18
|
-
export interface GetMenuPropsReturnValue extends globalThis.GetMenuPropsReturnValue {}
|
|
19
|
-
export interface GetPropsCommonOptions extends globalThis.GetPropsCommonOptions {}
|
|
20
|
-
export interface GetPropsWithRefKey extends globalThis.GetPropsWithRefKey {}
|
|
21
|
-
export interface GetItemPropsOptions<Item> extends globalThis.GetItemPropsOptions<Item> {}
|
|
22
|
-
export interface GetItemPropsReturnValue extends globalThis.GetItemPropsReturnValue {}
|
|
23
|
-
export interface PropGetters<Item> extends globalThis.PropGetters<Item> {}
|
|
24
|
-
export interface Actions<Item> extends globalThis.Actions<Item> {}
|
|
25
|
-
|
|
26
|
-
/* ---------------- Hooks / Class / Functions ---------------- */
|
|
27
|
-
|
|
28
|
-
export const Downshift: typeof globalThis.Downshift;
|
|
29
|
-
export default Downshift;
|
|
30
|
-
|
|
31
|
-
export const resetIdCounter: typeof globalThis.resetIdCounter;
|
|
32
|
-
export const useSelect: typeof globalThis.useSelect;
|
|
33
|
-
export const useCombobox: typeof globalThis.useCombobox;
|
|
34
|
-
export const useMultipleSelection: typeof globalThis.useMultipleSelection;
|
|
35
|
-
|
|
36
|
-
/* ---------------- Enums (value + type) ---------------- */
|
|
37
|
-
|
|
38
|
-
export const StateChangeTypes: typeof globalThis.StateChangeTypes;
|
|
39
|
-
export type StateChangeTypes = globalThis.StateChangeTypes;
|
|
40
|
-
|
|
41
|
-
export const UseSelectStateChangeTypes: typeof globalThis.UseSelectStateChangeTypes;
|
|
42
|
-
export type UseSelectStateChangeTypes = globalThis.UseSelectStateChangeTypes;
|
|
43
|
-
|
|
44
|
-
export const UseComboboxStateChangeTypes: typeof globalThis.UseComboboxStateChangeTypes;
|
|
45
|
-
export type UseComboboxStateChangeTypes = globalThis.UseComboboxStateChangeTypes;
|
|
46
|
-
|
|
47
|
-
export const UseMultipleSelectionStateChangeTypes: typeof globalThis.UseMultipleSelectionStateChangeTypes;
|
|
48
|
-
export type UseMultipleSelectionStateChangeTypes = globalThis.UseMultipleSelectionStateChangeTypes;
|
|
49
|
-
|
|
50
|
-
/* ---------------- useSelect interfaces ---------------- */
|
|
51
|
-
|
|
52
|
-
export interface UseSelectState<Item> extends globalThis.UseSelectState<Item> {}
|
|
53
|
-
export interface UseSelectProps<Item> extends globalThis.UseSelectProps<Item> {}
|
|
54
|
-
export interface UseSelectStateChangeOptions<Item> extends globalThis.UseSelectStateChangeOptions<Item> {}
|
|
55
|
-
export interface UseSelectDispatchAction<Item> extends globalThis.UseSelectDispatchAction<Item> {}
|
|
56
|
-
export interface UseSelectStateChange<Item> extends globalThis.UseSelectStateChange<Item> {}
|
|
57
|
-
export interface UseSelectSelectedItemChange<Item> extends globalThis.UseSelectSelectedItemChange<Item> {}
|
|
58
|
-
export interface UseSelectHighlightedIndexChange<Item> extends globalThis.UseSelectHighlightedIndexChange<Item> {}
|
|
59
|
-
export interface UseSelectIsOpenChange<Item> extends globalThis.UseSelectIsOpenChange<Item> {}
|
|
60
|
-
export interface UseSelectGetMenuPropsOptions extends globalThis.UseSelectGetMenuPropsOptions {}
|
|
61
|
-
export interface UseSelectGetMenuReturnValue extends globalThis.UseSelectGetMenuReturnValue {}
|
|
62
|
-
export interface UseSelectGetToggleButtonPropsOptions extends globalThis.UseSelectGetToggleButtonPropsOptions {}
|
|
63
|
-
export interface UseSelectGetToggleButtonReturnValue extends globalThis.UseSelectGetToggleButtonReturnValue {}
|
|
64
|
-
export interface UseSelectGetLabelPropsOptions extends globalThis.UseSelectGetLabelPropsOptions {}
|
|
65
|
-
export interface UseSelectGetLabelPropsReturnValue extends globalThis.UseSelectGetLabelPropsReturnValue {}
|
|
66
|
-
export interface UseSelectGetItemPropsOptions<Item> extends globalThis.UseSelectGetItemPropsOptions<Item> {}
|
|
67
|
-
export interface UseSelectGetItemPropsReturnValue extends globalThis.UseSelectGetItemPropsReturnValue {}
|
|
68
|
-
export interface UseSelectPropGetters<Item> extends globalThis.UseSelectPropGetters<Item> {}
|
|
69
|
-
export interface UseSelectActions<Item> extends globalThis.UseSelectActions<Item> {}
|
|
70
|
-
export interface UseSelectReturnValue<Item> extends globalThis.UseSelectReturnValue<Item> {}
|
|
71
|
-
export interface UseSelectInterface extends globalThis.UseSelectInterface {}
|
|
72
|
-
|
|
73
|
-
/* ---------------- useCombobox interfaces ---------------- */
|
|
74
|
-
|
|
75
|
-
export interface UseComboboxState<Item> extends globalThis.UseComboboxState<Item> {}
|
|
76
|
-
export interface UseComboboxProps<Item> extends globalThis.UseComboboxProps<Item> {}
|
|
77
|
-
export interface UseComboboxStateChangeOptions<Item> extends globalThis.UseComboboxStateChangeOptions<Item> {}
|
|
78
|
-
export interface UseComboboxDispatchAction<Item> extends globalThis.UseComboboxDispatchAction<Item> {}
|
|
79
|
-
export interface UseComboboxStateChange<Item> extends globalThis.UseComboboxStateChange<Item> {}
|
|
80
|
-
export interface UseComboboxSelectedItemChange<Item> extends globalThis.UseComboboxSelectedItemChange<Item> {}
|
|
81
|
-
export interface UseComboboxHighlightedIndexChange<Item> extends globalThis.UseComboboxHighlightedIndexChange<Item> {}
|
|
82
|
-
export interface UseComboboxIsOpenChange<Item> extends globalThis.UseComboboxIsOpenChange<Item> {}
|
|
83
|
-
export interface UseComboboxInputValueChange<Item> extends globalThis.UseComboboxInputValueChange<Item> {}
|
|
84
|
-
export interface UseComboboxGetMenuPropsOptions extends globalThis.UseComboboxGetMenuPropsOptions {}
|
|
85
|
-
export interface UseComboboxGetMenuPropsReturnValue extends globalThis.UseComboboxGetMenuPropsReturnValue {}
|
|
86
|
-
export interface UseComboboxGetToggleButtonPropsOptions extends globalThis.UseComboboxGetToggleButtonPropsOptions {}
|
|
87
|
-
export interface UseComboboxGetToggleButtonReturnValue extends globalThis.UseComboboxGetToggleButtonReturnValue {}
|
|
88
|
-
export interface UseComboboxGetItemPropsOptions<Item> extends globalThis.UseComboboxGetItemPropsOptions<Item> {}
|
|
89
|
-
export interface UseComboboxGetItemPropsReturnValue extends globalThis.UseComboboxGetItemPropsReturnValue {}
|
|
90
|
-
export interface UseComboboxGetInputPropsOptions extends globalThis.UseComboboxGetInputPropsOptions {}
|
|
91
|
-
export interface UseComboboxGetInputPropsReturnValue extends globalThis.UseComboboxGetInputPropsReturnValue {}
|
|
92
|
-
export interface UseComboboxPropGetters<Item> extends globalThis.UseComboboxPropGetters<Item> {}
|
|
93
|
-
export interface UseComboboxActions<Item> extends globalThis.UseComboboxActions<Item> {}
|
|
94
|
-
export interface UseComboboxReturnValue<Item> extends globalThis.UseComboboxReturnValue<Item> {}
|
|
95
|
-
export interface UseComboboxInterface extends globalThis.UseComboboxInterface {}
|
|
96
|
-
|
|
97
|
-
/* ---------------- useMultipleSelection interfaces ---------------- */
|
|
98
|
-
|
|
99
|
-
export interface UseMultipleSelectionState<Item> extends globalThis.UseMultipleSelectionState<Item> {}
|
|
100
|
-
export interface UseMultipleSelectionProps<Item> extends globalThis.UseMultipleSelectionProps<Item> {}
|
|
101
|
-
export interface UseMultipleSelectionStateChangeOptions<Item> extends globalThis.UseMultipleSelectionStateChangeOptions<Item> {}
|
|
102
|
-
export interface UseMultipleSelectionDispatchAction<Item> extends globalThis.UseMultipleSelectionDispatchAction<Item> {}
|
|
103
|
-
export interface UseMultipleSelectionStateChange<Item> extends globalThis.UseMultipleSelectionStateChange<Item> {}
|
|
104
|
-
export interface UseMultipleSelectionActiveIndexChange<Item> extends globalThis.UseMultipleSelectionActiveIndexChange<Item> {}
|
|
105
|
-
export interface UseMultipleSelectionSelectedItemsChange<Item> extends globalThis.UseMultipleSelectionSelectedItemsChange<Item> {}
|
|
106
|
-
export interface A11yRemovalMessage<Item> extends globalThis.A11yRemovalMessage<Item> {}
|
|
107
|
-
export interface UseMultipleSelectionGetSelectedItemPropsOptions<Item> extends globalThis.UseMultipleSelectionGetSelectedItemPropsOptions<Item> {}
|
|
108
|
-
export interface UseMultipleSelectionGetSelectedItemReturnValue extends globalThis.UseMultipleSelectionGetSelectedItemReturnValue {}
|
|
109
|
-
export interface UseMultipleSelectionGetDropdownPropsOptions extends globalThis.UseMultipleSelectionGetDropdownPropsOptions {}
|
|
110
|
-
export interface UseMultipleSelectionGetDropdownReturnValue extends globalThis.UseMultipleSelectionGetDropdownReturnValue {}
|
|
111
|
-
export interface UseMultipleSelectionPropGetters<Item> extends globalThis.UseMultipleSelectionPropGetters<Item> {}
|
|
112
|
-
export interface UseMultipleSelectionActions<Item> extends globalThis.UseMultipleSelectionActions<Item> {}
|
|
113
|
-
export interface UseMultipleSelectionReturnValue<Item> extends globalThis.UseMultipleSelectionReturnValue<Item> {}
|
|
114
|
-
export interface UseMultipleSelectionInterface extends globalThis.UseMultipleSelectionInterface {}
|
|
115
|
-
|
|
116
|
-
/* ------- Re-export generated TS declarations ------- */
|
|
1
|
+
export * from './index.legacy'
|
|
2
|
+
import Downshift from './index.legacy'
|
|
3
|
+
export default Downshift
|
|
117
4
|
|
|
118
5
|
export {
|
|
119
6
|
UseTagGroupState,
|
|
120
7
|
UseTagGroupProps,
|
|
121
8
|
UseTagGroupReturnValue,
|
|
122
|
-
UseTagGroupInterface,
|
|
123
9
|
GetTagGroupProps,
|
|
124
10
|
GetTagGroupPropsOptions,
|
|
125
11
|
GetTagGroupPropsReturnValue,
|
|
@@ -130,6 +16,10 @@ export {
|
|
|
130
16
|
GetTagRemovePropsOptions,
|
|
131
17
|
GetTagRemovePropsReturnValue,
|
|
132
18
|
UseTagGroupStateChangeTypes,
|
|
133
|
-
} from '../dist/
|
|
19
|
+
} from '../dist/hooks/useTagGroup/index.types'
|
|
134
20
|
|
|
21
|
+
import {UseTagGroupInterface} from '../dist/hooks/useTagGroup/index.types'
|
|
22
|
+
import Downshift from './index.legacy'
|
|
135
23
|
export const useTagGroup: UseTagGroupInterface;
|
|
24
|
+
export {UseTagGroupInterface}
|
|
25
|
+
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import {Environment} from '../dist/hooks/useTagGroup/index.types'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export {Environment}
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export type Callback = () => void
|
|
8
|
+
|
|
9
|
+
export type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U
|
|
10
|
+
|
|
11
|
+
export interface DownshiftState<Item> {
|
|
8
12
|
highlightedIndex: number | null
|
|
9
13
|
inputValue: string | null
|
|
10
14
|
isOpen: boolean
|
|
11
15
|
selectedItem: Item | null
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
export enum StateChangeTypes {
|
|
15
19
|
unknown = '__autocomplete_unknown__',
|
|
16
20
|
mouseUp = '__autocomplete_mouseup__',
|
|
17
21
|
itemMouseEnter = '__autocomplete_item_mouseenter__',
|
|
@@ -29,7 +33,7 @@ declare enum StateChangeTypes {
|
|
|
29
33
|
touchEnd = '__autocomplete_touchend__',
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
interface DownshiftProps<Item> {
|
|
36
|
+
export interface DownshiftProps<Item> {
|
|
33
37
|
initialSelectedItem?: Item
|
|
34
38
|
initialInputValue?: string
|
|
35
39
|
initialHighlightedIndex?: number | null
|
|
@@ -80,14 +84,7 @@ interface DownshiftProps<Item> {
|
|
|
80
84
|
suppressRefError?: boolean
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
interface
|
|
84
|
-
addEventListener: typeof window.addEventListener
|
|
85
|
-
removeEventListener: typeof window.removeEventListener
|
|
86
|
-
document: Document
|
|
87
|
-
Node: typeof window.Node
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface A11yStatusMessageOptions<Item> {
|
|
87
|
+
export interface A11yStatusMessageOptions<Item> {
|
|
91
88
|
highlightedIndex: number | null
|
|
92
89
|
inputValue: string
|
|
93
90
|
isOpen: boolean
|
|
@@ -98,20 +95,20 @@ interface A11yStatusMessageOptions<Item> {
|
|
|
98
95
|
selectedItem: Item | null
|
|
99
96
|
}
|
|
100
97
|
|
|
101
|
-
interface StateChangeOptions<Item> extends Partial<DownshiftState<Item>> {
|
|
98
|
+
export interface StateChangeOptions<Item> extends Partial<DownshiftState<Item>> {
|
|
102
99
|
type: StateChangeTypes
|
|
103
100
|
}
|
|
104
101
|
|
|
105
|
-
type StateChangeFunction<Item> = (
|
|
102
|
+
export type StateChangeFunction<Item> = (
|
|
106
103
|
state: DownshiftState<Item>,
|
|
107
104
|
) => Partial<StateChangeOptions<Item>>
|
|
108
105
|
|
|
109
|
-
interface GetRootPropsOptions {
|
|
106
|
+
export interface GetRootPropsOptions {
|
|
110
107
|
refKey?: string
|
|
111
108
|
ref?: React.RefObject<any>
|
|
112
109
|
}
|
|
113
110
|
|
|
114
|
-
interface GetRootPropsReturnValue {
|
|
111
|
+
export interface GetRootPropsReturnValue {
|
|
115
112
|
'aria-expanded': boolean
|
|
116
113
|
'aria-haspopup': 'listbox'
|
|
117
114
|
'aria-labelledby': string
|
|
@@ -120,11 +117,11 @@ interface GetRootPropsReturnValue {
|
|
|
120
117
|
role: 'combobox'
|
|
121
118
|
}
|
|
122
119
|
|
|
123
|
-
interface GetInputPropsOptions extends React.HTMLProps<HTMLInputElement> {
|
|
120
|
+
export interface GetInputPropsOptions extends React.HTMLProps<HTMLInputElement> {
|
|
124
121
|
disabled?: boolean
|
|
125
122
|
}
|
|
126
123
|
|
|
127
|
-
interface GetInputPropsReturnValue {
|
|
124
|
+
export interface GetInputPropsReturnValue {
|
|
128
125
|
'aria-autocomplete': 'list'
|
|
129
126
|
'aria-activedescendant': string | undefined
|
|
130
127
|
'aria-controls': string | undefined
|
|
@@ -139,19 +136,19 @@ interface GetInputPropsReturnValue {
|
|
|
139
136
|
value: string
|
|
140
137
|
}
|
|
141
138
|
|
|
142
|
-
interface GetLabelPropsOptions extends React.HTMLProps<HTMLLabelElement> {}
|
|
139
|
+
export interface GetLabelPropsOptions extends React.HTMLProps<HTMLLabelElement> {}
|
|
143
140
|
|
|
144
|
-
interface GetLabelPropsReturnValue {
|
|
141
|
+
export interface GetLabelPropsReturnValue {
|
|
145
142
|
htmlFor: string
|
|
146
143
|
id: string
|
|
147
144
|
}
|
|
148
145
|
|
|
149
|
-
interface GetToggleButtonPropsOptions extends React.HTMLProps<HTMLButtonElement> {
|
|
146
|
+
export interface GetToggleButtonPropsOptions extends React.HTMLProps<HTMLButtonElement> {
|
|
150
147
|
disabled?: boolean
|
|
151
148
|
onPress?: (event: React.BaseSyntheticEvent) => void
|
|
152
149
|
}
|
|
153
150
|
|
|
154
|
-
interface GetToggleButtonPropsReturnValue {
|
|
151
|
+
export interface GetToggleButtonPropsReturnValue {
|
|
155
152
|
'aria-label': 'close menu' | 'open menu'
|
|
156
153
|
'aria-haspopup': true
|
|
157
154
|
'data-toggle': true
|
|
@@ -164,34 +161,34 @@ interface GetToggleButtonPropsReturnValue {
|
|
|
164
161
|
type: 'button'
|
|
165
162
|
}
|
|
166
163
|
|
|
167
|
-
interface GetMenuPropsOptions
|
|
164
|
+
export interface GetMenuPropsOptions
|
|
168
165
|
extends React.HTMLProps<HTMLElement>, GetPropsWithRefKey {
|
|
169
166
|
['aria-label']?: string
|
|
170
167
|
}
|
|
171
168
|
|
|
172
|
-
interface GetMenuPropsReturnValue {
|
|
169
|
+
export interface GetMenuPropsReturnValue {
|
|
173
170
|
'aria-labelledby': string | undefined
|
|
174
171
|
ref?: React.RefObject<any>
|
|
175
172
|
role: 'listbox'
|
|
176
173
|
id: string
|
|
177
174
|
}
|
|
178
175
|
|
|
179
|
-
interface GetPropsCommonOptions {
|
|
176
|
+
export interface GetPropsCommonOptions {
|
|
180
177
|
suppressRefError?: boolean
|
|
181
178
|
}
|
|
182
179
|
|
|
183
|
-
interface GetPropsWithRefKey {
|
|
180
|
+
export interface GetPropsWithRefKey {
|
|
184
181
|
refKey?: string
|
|
185
182
|
}
|
|
186
183
|
|
|
187
|
-
interface GetItemPropsOptions<Item> extends React.HTMLProps<HTMLElement> {
|
|
184
|
+
export interface GetItemPropsOptions<Item> extends React.HTMLProps<HTMLElement> {
|
|
188
185
|
index?: number
|
|
189
186
|
item: Item
|
|
190
187
|
isSelected?: boolean
|
|
191
188
|
disabled?: boolean
|
|
192
189
|
}
|
|
193
190
|
|
|
194
|
-
interface GetItemPropsReturnValue {
|
|
191
|
+
export interface GetItemPropsReturnValue {
|
|
195
192
|
'aria-selected': boolean
|
|
196
193
|
id: string
|
|
197
194
|
onClick?: React.MouseEventHandler
|
|
@@ -201,7 +198,7 @@ interface GetItemPropsReturnValue {
|
|
|
201
198
|
role: 'option'
|
|
202
199
|
}
|
|
203
200
|
|
|
204
|
-
interface PropGetters<Item> {
|
|
201
|
+
export interface PropGetters<Item> {
|
|
205
202
|
getRootProps: <Options>(
|
|
206
203
|
options?: GetRootPropsOptions & Options,
|
|
207
204
|
otherOptions?: GetPropsCommonOptions,
|
|
@@ -224,7 +221,7 @@ interface PropGetters<Item> {
|
|
|
224
221
|
) => Omit<Overwrite<GetItemPropsReturnValue, Options>, 'index' | 'item'>
|
|
225
222
|
}
|
|
226
223
|
|
|
227
|
-
interface Actions<Item> {
|
|
224
|
+
export interface Actions<Item> {
|
|
228
225
|
reset: (
|
|
229
226
|
otherStateToSet?: Partial<StateChangeOptions<Item>>,
|
|
230
227
|
cb?: Callback,
|
|
@@ -262,19 +259,18 @@ interface Actions<Item> {
|
|
|
262
259
|
stateToSet: Partial<StateChangeOptions<Item>> | StateChangeFunction<Item>,
|
|
263
260
|
cb?: Callback,
|
|
264
261
|
) => void
|
|
265
|
-
// props
|
|
266
262
|
itemToString: (item: Item | null) => string
|
|
267
263
|
}
|
|
268
264
|
|
|
269
|
-
type ControllerStateAndHelpers<Item> = DownshiftState<Item> &
|
|
265
|
+
export type ControllerStateAndHelpers<Item> = DownshiftState<Item> &
|
|
270
266
|
PropGetters<Item> &
|
|
271
267
|
Actions<Item>
|
|
272
268
|
|
|
273
|
-
type ChildrenFunction<Item> = (
|
|
269
|
+
export type ChildrenFunction<Item> = (
|
|
274
270
|
options: ControllerStateAndHelpers<Item>,
|
|
275
271
|
) => React.ReactNode
|
|
276
272
|
|
|
277
|
-
|
|
273
|
+
export default class Downshift<Item = any> extends React.Component<
|
|
278
274
|
DownshiftProps<Item>
|
|
279
275
|
> {
|
|
280
276
|
static stateChangeTypes: {
|
|
@@ -296,18 +292,18 @@ declare class Downshift<Item = any> extends React.Component<
|
|
|
296
292
|
}
|
|
297
293
|
}
|
|
298
294
|
|
|
299
|
-
|
|
295
|
+
export function resetIdCounter(): void
|
|
300
296
|
|
|
301
297
|
/* useSelect Types */
|
|
302
298
|
|
|
303
|
-
interface UseSelectState<Item> {
|
|
299
|
+
export interface UseSelectState<Item> {
|
|
304
300
|
highlightedIndex: number
|
|
305
301
|
selectedItem: Item | null
|
|
306
302
|
isOpen: boolean
|
|
307
303
|
inputValue: string
|
|
308
304
|
}
|
|
309
305
|
|
|
310
|
-
|
|
306
|
+
export enum UseSelectStateChangeTypes {
|
|
311
307
|
ToggleButtonClick = '__togglebutton_click__',
|
|
312
308
|
ToggleButtonKeyDownArrowDown = '__togglebutton_keydown_arrow_down__',
|
|
313
309
|
ToggleButtonKeyDownArrowUp = '__togglebutton_keydown_arrow_up__',
|
|
@@ -332,7 +328,7 @@ declare enum UseSelectStateChangeTypes {
|
|
|
332
328
|
FunctionReset = '__function_reset__',
|
|
333
329
|
}
|
|
334
330
|
|
|
335
|
-
interface UseSelectProps<Item> {
|
|
331
|
+
export interface UseSelectProps<Item> {
|
|
336
332
|
items: Item[]
|
|
337
333
|
isItemDisabled?(item: Item, index: number): boolean
|
|
338
334
|
itemToString?: (item: Item | null) => string
|
|
@@ -366,13 +362,13 @@ interface UseSelectProps<Item> {
|
|
|
366
362
|
environment?: Environment
|
|
367
363
|
}
|
|
368
364
|
|
|
369
|
-
interface UseSelectStateChangeOptions<
|
|
365
|
+
export interface UseSelectStateChangeOptions<
|
|
370
366
|
Item,
|
|
371
367
|
> extends UseSelectDispatchAction<Item> {
|
|
372
368
|
changes: Partial<UseSelectState<Item>>
|
|
373
369
|
}
|
|
374
370
|
|
|
375
|
-
interface UseSelectDispatchAction<Item> {
|
|
371
|
+
export interface UseSelectDispatchAction<Item> {
|
|
376
372
|
type: UseSelectStateChangeTypes
|
|
377
373
|
altKey?: boolean
|
|
378
374
|
key?: string
|
|
@@ -382,37 +378,37 @@ interface UseSelectDispatchAction<Item> {
|
|
|
382
378
|
inputValue?: string
|
|
383
379
|
}
|
|
384
380
|
|
|
385
|
-
interface UseSelectStateChange<Item> extends Partial<UseSelectState<Item>> {
|
|
381
|
+
export interface UseSelectStateChange<Item> extends Partial<UseSelectState<Item>> {
|
|
386
382
|
type: UseSelectStateChangeTypes
|
|
387
383
|
}
|
|
388
384
|
|
|
389
|
-
interface UseSelectSelectedItemChange<Item> extends UseSelectStateChange<Item> {
|
|
385
|
+
export interface UseSelectSelectedItemChange<Item> extends UseSelectStateChange<Item> {
|
|
390
386
|
selectedItem: Item | null
|
|
391
387
|
}
|
|
392
388
|
|
|
393
|
-
interface UseSelectHighlightedIndexChange<
|
|
389
|
+
export interface UseSelectHighlightedIndexChange<
|
|
394
390
|
Item,
|
|
395
391
|
> extends UseSelectStateChange<Item> {
|
|
396
392
|
highlightedIndex: number
|
|
397
393
|
}
|
|
398
394
|
|
|
399
|
-
interface UseSelectIsOpenChange<Item> extends UseSelectStateChange<Item> {
|
|
395
|
+
export interface UseSelectIsOpenChange<Item> extends UseSelectStateChange<Item> {
|
|
400
396
|
isOpen: boolean
|
|
401
397
|
}
|
|
402
398
|
|
|
403
|
-
interface UseSelectGetMenuPropsOptions
|
|
399
|
+
export interface UseSelectGetMenuPropsOptions
|
|
404
400
|
extends GetPropsWithRefKey, GetMenuPropsOptions {}
|
|
405
401
|
|
|
406
|
-
interface UseSelectGetMenuReturnValue extends GetMenuPropsReturnValue {
|
|
402
|
+
export interface UseSelectGetMenuReturnValue extends GetMenuPropsReturnValue {
|
|
407
403
|
onMouseLeave: React.MouseEventHandler
|
|
408
404
|
}
|
|
409
405
|
|
|
410
|
-
interface UseSelectGetToggleButtonPropsOptions
|
|
406
|
+
export interface UseSelectGetToggleButtonPropsOptions
|
|
411
407
|
extends GetPropsWithRefKey, React.HTMLProps<HTMLElement> {
|
|
412
408
|
onPress?: (event: React.BaseSyntheticEvent) => void
|
|
413
409
|
}
|
|
414
410
|
|
|
415
|
-
interface UseSelectGetToggleButtonReturnValue extends Pick<
|
|
411
|
+
export interface UseSelectGetToggleButtonReturnValue extends Pick<
|
|
416
412
|
GetToggleButtonPropsReturnValue,
|
|
417
413
|
'onBlur' | 'onClick' | 'onPress' | 'onKeyDown'
|
|
418
414
|
> {
|
|
@@ -427,21 +423,21 @@ interface UseSelectGetToggleButtonReturnValue extends Pick<
|
|
|
427
423
|
tabIndex: 0
|
|
428
424
|
}
|
|
429
425
|
|
|
430
|
-
interface UseSelectGetLabelPropsOptions extends GetLabelPropsOptions {}
|
|
426
|
+
export interface UseSelectGetLabelPropsOptions extends GetLabelPropsOptions {}
|
|
431
427
|
|
|
432
|
-
interface UseSelectGetLabelPropsReturnValue extends GetLabelPropsReturnValue {
|
|
428
|
+
export interface UseSelectGetLabelPropsReturnValue extends GetLabelPropsReturnValue {
|
|
433
429
|
onClick: React.MouseEventHandler
|
|
434
430
|
}
|
|
435
431
|
|
|
436
|
-
interface UseSelectGetItemPropsOptions<Item>
|
|
432
|
+
export interface UseSelectGetItemPropsOptions<Item>
|
|
437
433
|
extends Omit<GetItemPropsOptions<Item>, 'disabled'>, GetPropsWithRefKey {}
|
|
438
434
|
|
|
439
|
-
interface UseSelectGetItemPropsReturnValue extends GetItemPropsReturnValue {
|
|
435
|
+
export interface UseSelectGetItemPropsReturnValue extends GetItemPropsReturnValue {
|
|
440
436
|
'aria-disabled': boolean
|
|
441
437
|
ref?: React.RefObject<any>
|
|
442
438
|
}
|
|
443
439
|
|
|
444
|
-
interface UseSelectPropGetters<Item> {
|
|
440
|
+
export interface UseSelectPropGetters<Item> {
|
|
445
441
|
getToggleButtonProps: <Options>(
|
|
446
442
|
options?: UseSelectGetToggleButtonPropsOptions & Options,
|
|
447
443
|
otherOptions?: GetPropsCommonOptions,
|
|
@@ -461,7 +457,7 @@ interface UseSelectPropGetters<Item> {
|
|
|
461
457
|
>
|
|
462
458
|
}
|
|
463
459
|
|
|
464
|
-
interface UseSelectActions<Item> {
|
|
460
|
+
export interface UseSelectActions<Item> {
|
|
465
461
|
reset: () => void
|
|
466
462
|
openMenu: () => void
|
|
467
463
|
closeMenu: () => void
|
|
@@ -470,11 +466,11 @@ interface UseSelectActions<Item> {
|
|
|
470
466
|
setHighlightedIndex: (index: number) => void
|
|
471
467
|
}
|
|
472
468
|
|
|
473
|
-
type UseSelectReturnValue<Item> = UseSelectState<Item> &
|
|
469
|
+
export type UseSelectReturnValue<Item> = UseSelectState<Item> &
|
|
474
470
|
UseSelectPropGetters<Item> &
|
|
475
471
|
UseSelectActions<Item>
|
|
476
472
|
|
|
477
|
-
interface UseSelectInterface {
|
|
473
|
+
export interface UseSelectInterface {
|
|
478
474
|
<Item>(props: UseSelectProps<Item>): UseSelectReturnValue<Item>
|
|
479
475
|
stateChangeTypes: {
|
|
480
476
|
ToggleButtonClick: UseSelectStateChangeTypes.ToggleButtonClick
|
|
@@ -502,18 +498,18 @@ interface UseSelectInterface {
|
|
|
502
498
|
}
|
|
503
499
|
}
|
|
504
500
|
|
|
505
|
-
|
|
501
|
+
export const useSelect: UseSelectInterface
|
|
506
502
|
|
|
507
503
|
/* useCombobox Types */
|
|
508
504
|
|
|
509
|
-
interface UseComboboxState<Item> {
|
|
505
|
+
export interface UseComboboxState<Item> {
|
|
510
506
|
highlightedIndex: number
|
|
511
507
|
selectedItem: Item | null
|
|
512
508
|
isOpen: boolean
|
|
513
509
|
inputValue: string
|
|
514
510
|
}
|
|
515
511
|
|
|
516
|
-
|
|
512
|
+
export enum UseComboboxStateChangeTypes {
|
|
517
513
|
InputKeyDownArrowDown = '__input_keydown_arrow_down__',
|
|
518
514
|
InputKeyDownArrowUp = '__input_keydown_arrow_up__',
|
|
519
515
|
InputKeyDownEscape = '__input_keydown_escape__',
|
|
@@ -539,7 +535,7 @@ declare enum UseComboboxStateChangeTypes {
|
|
|
539
535
|
ControlledPropUpdatedSelectedItem = '__controlled_prop_updated_selected_item__',
|
|
540
536
|
}
|
|
541
537
|
|
|
542
|
-
interface UseComboboxProps<Item> {
|
|
538
|
+
export interface UseComboboxProps<Item> {
|
|
543
539
|
items: Item[]
|
|
544
540
|
isItemDisabled?(item: Item, index: number): boolean
|
|
545
541
|
itemToString?: (item: Item | null) => string
|
|
@@ -578,13 +574,13 @@ interface UseComboboxProps<Item> {
|
|
|
578
574
|
environment?: Environment
|
|
579
575
|
}
|
|
580
576
|
|
|
581
|
-
interface UseComboboxStateChangeOptions<
|
|
577
|
+
export interface UseComboboxStateChangeOptions<
|
|
582
578
|
Item,
|
|
583
579
|
> extends UseComboboxDispatchAction<Item> {
|
|
584
580
|
changes: Partial<UseComboboxState<Item>>
|
|
585
581
|
}
|
|
586
582
|
|
|
587
|
-
interface UseComboboxDispatchAction<Item> {
|
|
583
|
+
export interface UseComboboxDispatchAction<Item> {
|
|
588
584
|
type: UseComboboxStateChangeTypes
|
|
589
585
|
altKey?: boolean
|
|
590
586
|
inputValue?: string
|
|
@@ -594,41 +590,41 @@ interface UseComboboxDispatchAction<Item> {
|
|
|
594
590
|
selectItem?: boolean
|
|
595
591
|
}
|
|
596
592
|
|
|
597
|
-
interface UseComboboxStateChange<Item> extends Partial<UseComboboxState<Item>> {
|
|
593
|
+
export interface UseComboboxStateChange<Item> extends Partial<UseComboboxState<Item>> {
|
|
598
594
|
type: UseComboboxStateChangeTypes
|
|
599
595
|
}
|
|
600
596
|
|
|
601
|
-
interface UseComboboxSelectedItemChange<
|
|
597
|
+
export interface UseComboboxSelectedItemChange<
|
|
602
598
|
Item,
|
|
603
599
|
> extends UseComboboxStateChange<Item> {
|
|
604
600
|
selectedItem: Item | null
|
|
605
601
|
}
|
|
606
602
|
|
|
607
|
-
interface UseComboboxHighlightedIndexChange<
|
|
603
|
+
export interface UseComboboxHighlightedIndexChange<
|
|
608
604
|
Item,
|
|
609
605
|
> extends UseComboboxStateChange<Item> {
|
|
610
606
|
highlightedIndex: number
|
|
611
607
|
}
|
|
612
608
|
|
|
613
|
-
interface UseComboboxIsOpenChange<Item> extends UseComboboxStateChange<Item> {
|
|
609
|
+
export interface UseComboboxIsOpenChange<Item> extends UseComboboxStateChange<Item> {
|
|
614
610
|
isOpen: boolean
|
|
615
611
|
}
|
|
616
612
|
|
|
617
|
-
interface UseComboboxInputValueChange<
|
|
613
|
+
export interface UseComboboxInputValueChange<
|
|
618
614
|
Item,
|
|
619
615
|
> extends UseComboboxStateChange<Item> {
|
|
620
616
|
inputValue: string
|
|
621
617
|
}
|
|
622
618
|
|
|
623
|
-
interface UseComboboxGetMenuPropsOptions
|
|
619
|
+
export interface UseComboboxGetMenuPropsOptions
|
|
624
620
|
extends GetPropsWithRefKey, GetMenuPropsOptions {}
|
|
625
621
|
|
|
626
|
-
interface UseComboboxGetMenuPropsReturnValue extends UseSelectGetMenuReturnValue {}
|
|
622
|
+
export interface UseComboboxGetMenuPropsReturnValue extends UseSelectGetMenuReturnValue {}
|
|
627
623
|
|
|
628
|
-
interface UseComboboxGetToggleButtonPropsOptions
|
|
624
|
+
export interface UseComboboxGetToggleButtonPropsOptions
|
|
629
625
|
extends GetPropsWithRefKey, GetToggleButtonPropsOptions {}
|
|
630
626
|
|
|
631
|
-
interface UseComboboxGetToggleButtonPropsReturnValue {
|
|
627
|
+
export interface UseComboboxGetToggleButtonPropsReturnValue {
|
|
632
628
|
'aria-controls': string
|
|
633
629
|
'aria-expanded': boolean
|
|
634
630
|
id: string
|
|
@@ -638,22 +634,22 @@ interface UseComboboxGetToggleButtonPropsReturnValue {
|
|
|
638
634
|
tabIndex: -1
|
|
639
635
|
}
|
|
640
636
|
|
|
641
|
-
interface UseComboboxGetLabelPropsOptions extends GetLabelPropsOptions {}
|
|
637
|
+
export interface UseComboboxGetLabelPropsOptions extends GetLabelPropsOptions {}
|
|
642
638
|
|
|
643
|
-
interface UseComboboxGetLabelPropsReturnValue extends GetLabelPropsReturnValue {}
|
|
639
|
+
export interface UseComboboxGetLabelPropsReturnValue extends GetLabelPropsReturnValue {}
|
|
644
640
|
|
|
645
|
-
interface UseComboboxGetItemPropsOptions<Item>
|
|
641
|
+
export interface UseComboboxGetItemPropsOptions<Item>
|
|
646
642
|
extends Omit<GetItemPropsOptions<Item>, 'disabled'>, GetPropsWithRefKey {}
|
|
647
643
|
|
|
648
|
-
interface UseComboboxGetItemPropsReturnValue extends GetItemPropsReturnValue {
|
|
644
|
+
export interface UseComboboxGetItemPropsReturnValue extends GetItemPropsReturnValue {
|
|
649
645
|
'aria-disabled': boolean
|
|
650
646
|
ref?: React.RefObject<any>
|
|
651
647
|
}
|
|
652
648
|
|
|
653
|
-
interface UseComboboxGetInputPropsOptions
|
|
649
|
+
export interface UseComboboxGetInputPropsOptions
|
|
654
650
|
extends GetInputPropsOptions, GetPropsWithRefKey {}
|
|
655
651
|
|
|
656
|
-
interface UseComboboxGetInputPropsReturnValue extends GetInputPropsReturnValue {
|
|
652
|
+
export interface UseComboboxGetInputPropsReturnValue extends GetInputPropsReturnValue {
|
|
657
653
|
'aria-activedescendant': string
|
|
658
654
|
'aria-controls': string
|
|
659
655
|
'aria-expanded': boolean
|
|
@@ -661,7 +657,7 @@ interface UseComboboxGetInputPropsReturnValue extends GetInputPropsReturnValue {
|
|
|
661
657
|
onClick: React.MouseEventHandler
|
|
662
658
|
}
|
|
663
659
|
|
|
664
|
-
interface UseComboboxPropGetters<Item> {
|
|
660
|
+
export interface UseComboboxPropGetters<Item> {
|
|
665
661
|
getToggleButtonProps: <Options>(
|
|
666
662
|
options?: UseComboboxGetToggleButtonPropsOptions & Options,
|
|
667
663
|
) => Overwrite<UseComboboxGetToggleButtonPropsReturnValue, Options>
|
|
@@ -684,7 +680,7 @@ interface UseComboboxPropGetters<Item> {
|
|
|
684
680
|
) => Overwrite<UseComboboxGetInputPropsReturnValue, Options>
|
|
685
681
|
}
|
|
686
682
|
|
|
687
|
-
interface UseComboboxActions<Item> {
|
|
683
|
+
export interface UseComboboxActions<Item> {
|
|
688
684
|
reset: () => void
|
|
689
685
|
openMenu: () => void
|
|
690
686
|
closeMenu: () => void
|
|
@@ -694,11 +690,11 @@ interface UseComboboxActions<Item> {
|
|
|
694
690
|
setInputValue: (inputValue: string) => void
|
|
695
691
|
}
|
|
696
692
|
|
|
697
|
-
type UseComboboxReturnValue<Item> = UseComboboxState<Item> &
|
|
693
|
+
export type UseComboboxReturnValue<Item> = UseComboboxState<Item> &
|
|
698
694
|
UseComboboxPropGetters<Item> &
|
|
699
695
|
UseComboboxActions<Item>
|
|
700
696
|
|
|
701
|
-
interface UseComboboxInterface {
|
|
697
|
+
export interface UseComboboxInterface {
|
|
702
698
|
<Item>(props: UseComboboxProps<Item>): UseComboboxReturnValue<Item>
|
|
703
699
|
stateChangeTypes: {
|
|
704
700
|
InputKeyDownArrowDown: UseComboboxStateChangeTypes.InputKeyDownArrowDown
|
|
@@ -727,16 +723,16 @@ interface UseComboboxInterface {
|
|
|
727
723
|
}
|
|
728
724
|
}
|
|
729
725
|
|
|
730
|
-
|
|
726
|
+
export const useCombobox: UseComboboxInterface
|
|
731
727
|
|
|
732
728
|
// useMultipleSelection types.
|
|
733
729
|
|
|
734
|
-
interface UseMultipleSelectionState<Item> {
|
|
730
|
+
export interface UseMultipleSelectionState<Item> {
|
|
735
731
|
selectedItems: Item[]
|
|
736
732
|
activeIndex: number
|
|
737
733
|
}
|
|
738
734
|
|
|
739
|
-
|
|
735
|
+
export enum UseMultipleSelectionStateChangeTypes {
|
|
740
736
|
SelectedItemClick = '__selected_item_click__',
|
|
741
737
|
SelectedItemKeyDownDelete = '__selected_item_keydown_delete__',
|
|
742
738
|
SelectedItemKeyDownBackspace = '__selected_item_keydown_backspace__',
|
|
@@ -752,7 +748,7 @@ declare enum UseMultipleSelectionStateChangeTypes {
|
|
|
752
748
|
FunctionReset = '__function_reset__',
|
|
753
749
|
}
|
|
754
750
|
|
|
755
|
-
interface UseMultipleSelectionProps<Item> {
|
|
751
|
+
export interface UseMultipleSelectionProps<Item> {
|
|
756
752
|
selectedItems?: Item[]
|
|
757
753
|
initialSelectedItems?: Item[]
|
|
758
754
|
defaultSelectedItems?: Item[]
|
|
@@ -777,13 +773,13 @@ interface UseMultipleSelectionProps<Item> {
|
|
|
777
773
|
environment?: Environment
|
|
778
774
|
}
|
|
779
775
|
|
|
780
|
-
interface UseMultipleSelectionStateChangeOptions<
|
|
776
|
+
export interface UseMultipleSelectionStateChangeOptions<
|
|
781
777
|
Item,
|
|
782
778
|
> extends UseMultipleSelectionDispatchAction<Item> {
|
|
783
779
|
changes: Partial<UseMultipleSelectionState<Item>>
|
|
784
780
|
}
|
|
785
781
|
|
|
786
|
-
interface UseMultipleSelectionDispatchAction<Item> {
|
|
782
|
+
export interface UseMultipleSelectionDispatchAction<Item> {
|
|
787
783
|
type: UseMultipleSelectionStateChangeTypes
|
|
788
784
|
index?: number
|
|
789
785
|
selectedItem?: Item | null
|
|
@@ -791,25 +787,25 @@ interface UseMultipleSelectionDispatchAction<Item> {
|
|
|
791
787
|
activeIndex?: number
|
|
792
788
|
}
|
|
793
789
|
|
|
794
|
-
interface UseMultipleSelectionStateChange<Item> extends Partial<
|
|
790
|
+
export interface UseMultipleSelectionStateChange<Item> extends Partial<
|
|
795
791
|
UseMultipleSelectionState<Item>
|
|
796
792
|
> {
|
|
797
793
|
type: UseMultipleSelectionStateChangeTypes
|
|
798
794
|
}
|
|
799
795
|
|
|
800
|
-
interface UseMultipleSelectionActiveIndexChange<
|
|
796
|
+
export interface UseMultipleSelectionActiveIndexChange<
|
|
801
797
|
Item,
|
|
802
798
|
> extends UseMultipleSelectionStateChange<Item> {
|
|
803
799
|
activeIndex: number
|
|
804
800
|
}
|
|
805
801
|
|
|
806
|
-
interface UseMultipleSelectionSelectedItemsChange<
|
|
802
|
+
export interface UseMultipleSelectionSelectedItemsChange<
|
|
807
803
|
Item,
|
|
808
804
|
> extends UseMultipleSelectionStateChange<Item> {
|
|
809
805
|
selectedItems: Item[]
|
|
810
806
|
}
|
|
811
807
|
|
|
812
|
-
interface A11yRemovalMessage<Item> {
|
|
808
|
+
export interface A11yRemovalMessage<Item> {
|
|
813
809
|
itemToString: (item: Item) => string
|
|
814
810
|
resultCount: number
|
|
815
811
|
activeSelectedItem: Item
|
|
@@ -817,30 +813,30 @@ interface A11yRemovalMessage<Item> {
|
|
|
817
813
|
activeIndex: number
|
|
818
814
|
}
|
|
819
815
|
|
|
820
|
-
interface UseMultipleSelectionGetSelectedItemPropsOptions<Item>
|
|
816
|
+
export interface UseMultipleSelectionGetSelectedItemPropsOptions<Item>
|
|
821
817
|
extends React.HTMLProps<HTMLElement>, GetPropsWithRefKey {
|
|
822
818
|
index?: number
|
|
823
819
|
selectedItem: Item
|
|
824
820
|
}
|
|
825
821
|
|
|
826
|
-
interface UseMultipleSelectionGetSelectedItemReturnValue {
|
|
822
|
+
export interface UseMultipleSelectionGetSelectedItemReturnValue {
|
|
827
823
|
ref?: React.RefObject<any>
|
|
828
824
|
tabIndex: 0 | -1
|
|
829
825
|
onClick: React.MouseEventHandler
|
|
830
826
|
onKeyDown: React.KeyboardEventHandler
|
|
831
827
|
}
|
|
832
828
|
|
|
833
|
-
interface UseMultipleSelectionGetDropdownPropsOptions extends React.HTMLProps<HTMLElement> {
|
|
829
|
+
export interface UseMultipleSelectionGetDropdownPropsOptions extends React.HTMLProps<HTMLElement> {
|
|
834
830
|
preventKeyAction?: boolean
|
|
835
831
|
}
|
|
836
832
|
|
|
837
|
-
interface UseMultipleSelectionGetDropdownReturnValue {
|
|
833
|
+
export interface UseMultipleSelectionGetDropdownReturnValue {
|
|
838
834
|
ref?: React.RefObject<any>
|
|
839
835
|
onClick?: React.MouseEventHandler
|
|
840
836
|
onKeyDown?: React.KeyboardEventHandler
|
|
841
837
|
}
|
|
842
838
|
|
|
843
|
-
interface UseMultipleSelectionPropGetters<Item> {
|
|
839
|
+
export interface UseMultipleSelectionPropGetters<Item> {
|
|
844
840
|
getDropdownProps: <Options>(
|
|
845
841
|
options?: UseMultipleSelectionGetDropdownPropsOptions & Options,
|
|
846
842
|
extraOptions?: GetPropsCommonOptions,
|
|
@@ -856,7 +852,7 @@ interface UseMultipleSelectionPropGetters<Item> {
|
|
|
856
852
|
>
|
|
857
853
|
}
|
|
858
854
|
|
|
859
|
-
interface UseMultipleSelectionActions<Item> {
|
|
855
|
+
export interface UseMultipleSelectionActions<Item> {
|
|
860
856
|
reset: () => void
|
|
861
857
|
addSelectedItem: (item: Item) => void
|
|
862
858
|
removeSelectedItem: (item: Item) => void
|
|
@@ -864,11 +860,11 @@ interface UseMultipleSelectionActions<Item> {
|
|
|
864
860
|
setActiveIndex: (index: number) => void
|
|
865
861
|
}
|
|
866
862
|
|
|
867
|
-
type UseMultipleSelectionReturnValue<Item> = UseMultipleSelectionState<Item> &
|
|
863
|
+
export type UseMultipleSelectionReturnValue<Item> = UseMultipleSelectionState<Item> &
|
|
868
864
|
UseMultipleSelectionPropGetters<Item> &
|
|
869
865
|
UseMultipleSelectionActions<Item>
|
|
870
866
|
|
|
871
|
-
interface UseMultipleSelectionInterface {
|
|
867
|
+
export interface UseMultipleSelectionInterface {
|
|
872
868
|
<Item>(
|
|
873
869
|
props?: UseMultipleSelectionProps<Item>,
|
|
874
870
|
): UseMultipleSelectionReturnValue<Item>
|
|
@@ -889,4 +885,4 @@ interface UseMultipleSelectionInterface {
|
|
|
889
885
|
}
|
|
890
886
|
}
|
|
891
887
|
|
|
892
|
-
|
|
888
|
+
export const useMultipleSelection: UseMultipleSelectionInterface
|