downshift 9.4.0-alpha.1 → 9.4.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.
Files changed (49) hide show
  1. package/dist/downshift.cjs.cjs +134 -128
  2. package/dist/downshift.d.ts +60 -56
  3. package/dist/downshift.esm.mjs +134 -128
  4. package/dist/downshift.native.cjs.cjs +131 -128
  5. package/dist/downshift.nativeweb.cjs.cjs +134 -128
  6. package/dist/downshift.types.d.ts +5 -4
  7. package/dist/downshift.umd.js +134 -128
  8. package/dist/downshift.umd.js.map +1 -1
  9. package/dist/downshift.umd.min.js +1 -1
  10. package/dist/downshift.umd.min.js.map +1 -1
  11. package/dist/hooks/testUtils/interactions.d.ts +7 -7
  12. package/dist/hooks/useCombobox/__tests__/utils/renderCombobox.d.ts +3 -59
  13. package/dist/hooks/useCombobox/__tests__/utils/renderUseCombobox.d.ts +1 -1
  14. package/dist/hooks/useCombobox/index.types.d.ts +8 -9
  15. package/dist/hooks/useCombobox/utils/getInitialState.d.ts +1 -6
  16. package/dist/hooks/useCombobox/utils/propTypes.d.ts +1 -43
  17. package/dist/hooks/useMultipleSelection/index.types.d.ts +5 -5
  18. package/dist/hooks/useSelect/__tests__/utils/getItemIndexByCharacter.d.ts +1 -1
  19. package/dist/hooks/useSelect/__tests__/utils/renderSelect.d.ts +2 -58
  20. package/dist/hooks/useSelect/__tests__/utils/renderUseSelect.d.ts +1 -1
  21. package/dist/hooks/useSelect/__tests__/utils/stateChangeTestCases.d.ts +29 -50
  22. package/dist/hooks/useSelect/index.types.d.ts +7 -7
  23. package/dist/hooks/useSelect/utils/propTypes.d.ts +1 -38
  24. package/dist/hooks/useTagGroup/__tests__/utils/renderTagGroup.d.ts +1 -63
  25. package/dist/hooks/useTagGroup/__tests__/utils/renderUseTagGroup.d.ts +2 -2
  26. package/dist/hooks/useTagGroup/index.types.d.ts +5 -5
  27. package/dist/hooks/utils/dropdownDefaultProps.d.ts +3 -4
  28. package/dist/hooks/utils/isDropdownStateEqual.d.ts +1 -1
  29. package/dist/hooks/utils/useMouseAndTouchTracker.d.ts +3 -3
  30. package/dist/hooks/utils/useScrollIntoView.d.ts +4 -3
  31. package/dist/utils/getHighlightedIndex.d.ts +1 -1
  32. package/dist/utils/getNonDisabledIndex.d.ts +1 -1
  33. package/dist/utils/index.d.ts +1 -0
  34. package/dist/utils/useIsomorphicLayoutEffect.d.ts +2 -0
  35. package/dist/utils/useLatestRef.d.ts +1 -1
  36. package/package.json +39 -20
  37. package/preact/dist/downshift.cjs.cjs +134 -128
  38. package/preact/dist/downshift.esm.mjs +134 -128
  39. package/preact/dist/downshift.umd.js +134 -128
  40. package/preact/dist/downshift.umd.js.map +1 -1
  41. package/preact/dist/downshift.umd.min.js +1 -1
  42. package/preact/dist/downshift.umd.min.js.map +1 -1
  43. package/typings/index.d.ts +6 -6
  44. package/dist/hooks/useMultipleSelection/index.d.ts +0 -50
  45. package/dist/hooks/useMultipleSelection/reducer.d.ts +0 -1
  46. package/dist/hooks/useMultipleSelection/stateChangeTypes.d.ts +0 -13
  47. package/dist/hooks/useMultipleSelection/utils.d.ts +0 -44
  48. package/preact/dist/downshift.cjs.js +0 -4265
  49. package/preact/dist/downshift.esm.js +0 -4238
@@ -1,16 +1,16 @@
1
1
  import type userEvent from '@testing-library/user-event';
2
- export declare const waitForDebouncedA11yStatusUpdate: (shouldBeCleared?: boolean) => void;
2
+ export declare const waitForDebouncedA11yStatusUpdate: (shouldBeCleared?: boolean) => any;
3
3
  type UserEvent = ReturnType<typeof userEvent.setup>;
4
- export declare function getLabel(): HTMLElement;
5
- export declare function getMenu(): HTMLElement;
6
- export declare function getToggleButton(): HTMLElement;
7
- export declare function getItemAtIndex(index: number): HTMLElement | undefined;
8
- export declare function getItems(): HTMLElement[];
4
+ export declare function getLabel(): any;
5
+ export declare function getMenu(): any;
6
+ export declare function getToggleButton(): any;
7
+ export declare function getItemAtIndex(index: number): any;
8
+ export declare function getItems(): any;
9
9
  export declare function clickOnItemAtIndex(user: UserEvent, index: number): Promise<void>;
10
10
  export declare function clickOnToggleButton(user: UserEvent): Promise<void>;
11
11
  export declare function mouseMoveItemAtIndex(user: UserEvent, index: number): Promise<void>;
12
12
  export declare function mouseLeaveItemAtIndex(user: UserEvent, index: number): Promise<void>;
13
13
  export declare function keyDownOnToggleButton(user: UserEvent, keys: string): Promise<void>;
14
- export declare function getA11yStatusContainer(): HTMLElement | null;
14
+ export declare function getA11yStatusContainer(): any;
15
15
  export declare function tab(user: UserEvent, shiftKey?: boolean): Promise<void>;
16
16
  export {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="jest" />
1
2
  import * as React from 'react';
2
3
  import { UseComboboxProps } from '../../index.types';
3
4
  import useCombobox from '../..';
@@ -10,63 +11,6 @@ type DropdownComboboxProps = Partial<UseComboboxProps<string>> & {
10
11
  stringItem: string;
11
12
  }) => React.ReactNode;
12
13
  };
13
- export declare function renderCombobox(props?: Omit<DropdownComboboxProps, 'renderSpy'>, uiCallback?: (ui: React.ReactElement) => React.ReactElement): {
14
- renderSpy: jest.Mock<any, any, any>;
15
- rerender: (p: Omit<DropdownComboboxProps, "renderSpy">) => void;
16
- user: import("@testing-library/user-event").UserEvent;
17
- container: HTMLElement;
18
- baseElement: HTMLElement;
19
- debug: (baseElement?: ReactDOMClient.Container | any | Array<ReactDOMClient.Container | any> | undefined, maxLength?: number | undefined, options?: import("node_modules/pretty-format/build").OptionsReceived | undefined) => void;
20
- unmount: () => void;
21
- asFragment: () => DocumentFragment;
22
- getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
23
- getAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
24
- queryByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
25
- queryAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
26
- findByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
27
- findAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
28
- getByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
29
- getAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
30
- queryByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
31
- queryAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
32
- findByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
33
- findAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
34
- getByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
35
- getAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
36
- queryByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
37
- queryAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
38
- findByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
39
- findAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
40
- getByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
41
- getAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
42
- queryByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
43
- queryAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
44
- findByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
45
- findAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
46
- getByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
47
- getAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
48
- queryByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
49
- queryAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
50
- findByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
51
- findAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
52
- getByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
53
- getAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
54
- queryByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
55
- queryAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
56
- findByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
57
- findAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
58
- getByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement;
59
- getAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
60
- queryByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement | null;
61
- queryAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
62
- findByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
63
- findAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
64
- getByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
65
- getAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
66
- queryByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
67
- queryAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
68
- findByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
69
- findAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
70
- };
71
- export declare function getInput(): HTMLElement;
14
+ export declare function renderCombobox(props?: Omit<DropdownComboboxProps, 'renderSpy'>, uiCallback?: (ui: React.ReactElement) => React.ReactElement): any;
15
+ export declare function getInput(): any;
72
16
  export {};
@@ -1,2 +1,2 @@
1
1
  import { UseComboboxProps } from '../../index.types';
2
- export declare function renderUseCombobox(props?: Partial<UseComboboxProps<string>>): import("@testing-library/react").RenderHookResult<import("../../index.types").UseComboboxReturnValue<string>, unknown>;
2
+ export declare function renderUseCombobox(props?: Partial<UseComboboxProps<string>>): any;
@@ -1,4 +1,4 @@
1
- import { Environment, GetPropsCommonOptions, Overwrite } from '../../downshift.types';
1
+ import { AnyRef, Environment, GetPropsCommonOptions, Overwrite } from '../../downshift.types';
2
2
  export interface UseComboboxState<Item> {
3
3
  highlightedIndex: number;
4
4
  selectedItem: Item | null;
@@ -175,12 +175,12 @@ export interface UseComboboxInputValueChange<Item> extends UseComboboxStateChang
175
175
  }
176
176
  export interface UseComboboxGetMenuPropsOptions extends React.HTMLProps<HTMLElement> {
177
177
  refKey?: string;
178
- ref?: React.Ref<any>;
178
+ ref?: AnyRef;
179
179
  }
180
180
  export interface UseComboboxGetMenuPropsReturnValue {
181
181
  'aria-label': string | undefined;
182
182
  'aria-labelledby': string | undefined;
183
- ref?: React.Ref<any>;
183
+ ref?: AnyRef;
184
184
  role: 'listbox';
185
185
  id: string;
186
186
  onMouseLeave: React.MouseEventHandler;
@@ -189,7 +189,7 @@ export type UseComboboxGetMenuProps = <Options>(options?: UseComboboxGetMenuProp
189
189
  export interface UseComboboxGetToggleButtonPropsOptions extends React.HTMLProps<HTMLElement> {
190
190
  disabled?: boolean;
191
191
  refKey?: string;
192
- ref?: React.Ref<any>;
192
+ ref?: AnyRef;
193
193
  onPress?: (event: React.BaseSyntheticEvent) => void;
194
194
  }
195
195
  export interface UseComboboxGetToggleButtonPropsReturnValue {
@@ -198,7 +198,7 @@ export interface UseComboboxGetToggleButtonPropsReturnValue {
198
198
  id: string;
199
199
  onPress?: (event: React.BaseSyntheticEvent) => void;
200
200
  onClick?: React.MouseEventHandler;
201
- ref?: React.Ref<any>;
201
+ ref?: AnyRef;
202
202
  tabIndex: -1;
203
203
  }
204
204
  export type UseComboboxGetToggleButtonProps = <Options>(options?: UseComboboxGetToggleButtonPropsOptions & Options) => Overwrite<UseComboboxGetToggleButtonPropsReturnValue, Options>;
@@ -213,7 +213,7 @@ export interface UseComboboxGetItemPropsOptions<Item> extends React.HTMLProps<HT
213
213
  index?: number;
214
214
  item?: Item;
215
215
  refKey?: string;
216
- ref?: React.Ref<any>;
216
+ ref?: AnyRef;
217
217
  onPress?: (event: React.BaseSyntheticEvent) => void;
218
218
  }
219
219
  export interface UseComboboxGetItemPropsReturnValue {
@@ -224,7 +224,7 @@ export interface UseComboboxGetItemPropsReturnValue {
224
224
  onMouseDown?: React.MouseEventHandler;
225
225
  onMouseMove?: React.MouseEventHandler;
226
226
  onPress?: React.MouseEventHandler;
227
- ref?: React.Ref<any>;
227
+ ref?: AnyRef;
228
228
  role: 'option';
229
229
  }
230
230
  export type UseComboboxGetItemProps<Item> = <Options>(options?: UseComboboxGetItemPropsOptions<Item> & Options) => Omit<Overwrite<UseComboboxGetItemPropsReturnValue, Options>, 'index' | 'item'>;
@@ -234,7 +234,7 @@ export interface UseComboboxGetInputPropsOptions extends React.HTMLProps<HTMLInp
234
234
  onChangeText?: (event: React.BaseSyntheticEvent) => void;
235
235
  }
236
236
  export interface UseComboboxGetInputPropsReturnValue {
237
- ref?: React.Ref<any>;
237
+ ref?: AnyRef;
238
238
  'aria-activedescendant': string;
239
239
  'aria-autocomplete': 'list';
240
240
  'aria-controls': string;
@@ -242,7 +242,6 @@ export interface UseComboboxGetInputPropsReturnValue {
242
242
  'aria-labelledby': string | undefined;
243
243
  'aria-label': string | undefined;
244
244
  autoComplete: 'off';
245
- disabled: boolean | undefined;
246
245
  id: string;
247
246
  role: 'combobox';
248
247
  value: string;
@@ -2,9 +2,4 @@ import { GetInitialStateProps as GetInitialStatePropsCommon } from '../../utils'
2
2
  export type GetInitialStateProps<T> = GetInitialStatePropsCommon<T> & {
3
3
  itemToString: (item: T) => string;
4
4
  };
5
- export declare function getInitialState<T>(props: GetInitialStateProps<T>): {
6
- inputValue: string;
7
- highlightedIndex: number;
8
- isOpen: boolean;
9
- selectedItem: T | null;
10
- };
5
+ export declare function getInitialState<T>(props: GetInitialStateProps<T>): any;
@@ -1,43 +1 @@
1
- import PropTypes from 'prop-types';
2
- export declare const propTypes: {
3
- items: PropTypes.Validator<any[]>;
4
- isItemDisabled: PropTypes.Requireable<(...args: any[]) => any>;
5
- inputValue: PropTypes.Requireable<string>;
6
- defaultInputValue: PropTypes.Requireable<string>;
7
- initialInputValue: PropTypes.Requireable<string>;
8
- inputId: PropTypes.Requireable<string>;
9
- onInputValueChange: PropTypes.Requireable<(...args: any[]) => any>;
10
- getA11yStatusMessage: PropTypes.Requireable<(...args: any[]) => any>;
11
- highlightedIndex: PropTypes.Requireable<number>;
12
- defaultHighlightedIndex: PropTypes.Requireable<number>;
13
- initialHighlightedIndex: PropTypes.Requireable<number>;
14
- isOpen: PropTypes.Requireable<boolean>;
15
- defaultIsOpen: PropTypes.Requireable<boolean>;
16
- initialIsOpen: PropTypes.Requireable<boolean>;
17
- selectedItem: PropTypes.Requireable<any>;
18
- initialSelectedItem: PropTypes.Requireable<any>;
19
- defaultSelectedItem: PropTypes.Requireable<any>;
20
- id: PropTypes.Requireable<string>;
21
- labelId: PropTypes.Requireable<string>;
22
- menuId: PropTypes.Requireable<string>;
23
- getItemId: PropTypes.Requireable<(...args: any[]) => any>;
24
- toggleButtonId: PropTypes.Requireable<string>;
25
- onSelectedItemChange: PropTypes.Requireable<(...args: any[]) => any>;
26
- onHighlightedIndexChange: PropTypes.Requireable<(...args: any[]) => any>;
27
- onStateChange: PropTypes.Requireable<(...args: any[]) => any>;
28
- onIsOpenChange: PropTypes.Requireable<(...args: any[]) => any>;
29
- scrollIntoView: PropTypes.Requireable<(...args: any[]) => any>;
30
- environment: PropTypes.Requireable<PropTypes.InferProps<{
31
- addEventListener: PropTypes.Validator<(...args: any[]) => any>;
32
- removeEventListener: PropTypes.Validator<(...args: any[]) => any>;
33
- document: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
34
- createElement: PropTypes.Validator<(...args: any[]) => any>;
35
- getElementById: PropTypes.Validator<(...args: any[]) => any>;
36
- activeElement: PropTypes.Validator<any>;
37
- body: PropTypes.Validator<any>;
38
- }>>>;
39
- Node: PropTypes.Validator<(...args: any[]) => any>;
40
- }>>;
41
- itemToKey: PropTypes.Requireable<(...args: any[]) => any>;
42
- stateReducer: PropTypes.Requireable<(...args: any[]) => any>;
43
- };
1
+ export declare const propTypes: any;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Environment, GetPropsCommonOptions, Overwrite } from '../../downshift.types';
2
+ import { AnyRef, Environment, GetPropsCommonOptions, Overwrite } from '../../downshift.types';
3
3
  export interface UseMultipleSelectionState<Item> {
4
4
  selectedItems: Item[];
5
5
  activeIndex: number;
@@ -64,12 +64,12 @@ export interface A11yRemovalMessage<Item> {
64
64
  }
65
65
  export interface UseMultipleSelectionGetSelectedItemPropsOptions<Item> extends React.HTMLProps<HTMLElement> {
66
66
  refKey?: string;
67
- ref?: React.Ref<any>;
67
+ ref?: AnyRef;
68
68
  index?: number;
69
69
  selectedItem: Item;
70
70
  }
71
71
  export interface UseMultipleSelectionGetSelectedItemReturnValue {
72
- ref?: React.Ref<any>;
72
+ ref?: AnyRef;
73
73
  tabIndex: 0 | -1;
74
74
  onClick: React.MouseEventHandler;
75
75
  onKeyDown: React.KeyboardEventHandler;
@@ -77,10 +77,10 @@ export interface UseMultipleSelectionGetSelectedItemReturnValue {
77
77
  export interface UseMultipleSelectionGetDropdownPropsOptions extends React.HTMLProps<HTMLElement> {
78
78
  preventKeyAction?: boolean;
79
79
  refKey?: string;
80
- ref?: React.Ref<any>;
80
+ ref?: AnyRef;
81
81
  }
82
82
  export interface UseMultipleSelectionGetDropdownReturnValue {
83
- ref?: React.Ref<any>;
83
+ ref?: AnyRef;
84
84
  onClick?: React.MouseEventHandler;
85
85
  onKeyDown?: React.KeyboardEventHandler;
86
86
  }
@@ -4,4 +4,4 @@
4
4
  * @param startIndex The index to start searching.
5
5
  * @returns The index of the item.
6
6
  */
7
- export declare function getItemIndexByCharacter(character: string, startIndex?: number): number;
7
+ export declare function getItemIndexByCharacter(character: string, startIndex?: number): any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="jest" />
1
2
  import * as React from 'react';
2
3
  import { UseSelectProps, UseSelectGetItemProps } from '../../index.types';
3
4
  type DropdownSelectProps = Omit<UseSelectProps<string>, 'items'> & {
@@ -10,62 +11,5 @@ type DropdownSelectProps = Omit<UseSelectProps<string>, 'items'> & {
10
11
  stringItem: string;
11
12
  }) => React.ReactNode;
12
13
  };
13
- export declare function renderSelect(props: Omit<DropdownSelectProps, 'renderSpy'>, uiCallback?: (ui: React.ReactElement) => React.ReactElement): {
14
- renderSpy: jest.Mock<any, any, any>;
15
- rerender: (p: Omit<DropdownSelectProps, "renderSpy">) => void;
16
- user: import("@testing-library/user-event").UserEvent;
17
- container: HTMLElement;
18
- baseElement: HTMLElement;
19
- debug: (baseElement?: ReactDOMClient.Container | any | Array<ReactDOMClient.Container | any> | undefined, maxLength?: number | undefined, options?: import("node_modules/pretty-format/build").OptionsReceived | undefined) => void;
20
- unmount: () => void;
21
- asFragment: () => DocumentFragment;
22
- getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
23
- getAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
24
- queryByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
25
- queryAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
26
- findByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
27
- findAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
28
- getByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
29
- getAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
30
- queryByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
31
- queryAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
32
- findByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
33
- findAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
34
- getByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
35
- getAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
36
- queryByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
37
- queryAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
38
- findByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
39
- findAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
40
- getByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
41
- getAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
42
- queryByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
43
- queryAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
44
- findByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
45
- findAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
46
- getByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
47
- getAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
48
- queryByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
49
- queryAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
50
- findByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
51
- findAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
52
- getByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
53
- getAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
54
- queryByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
55
- queryAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
56
- findByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
57
- findAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
58
- getByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement;
59
- getAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
60
- queryByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement | null;
61
- queryAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
62
- findByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
63
- findAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
64
- getByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
65
- getAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
66
- queryByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
67
- queryAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
68
- findByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
69
- findAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
70
- };
14
+ export declare function renderSelect(props: Omit<DropdownSelectProps, 'renderSpy'>, uiCallback?: (ui: React.ReactElement) => React.ReactElement): any;
71
15
  export {};
@@ -1,2 +1,2 @@
1
1
  import { UseSelectProps } from '../../index.types';
2
- export declare function renderUseSelect(props?: Partial<UseSelectProps<string>>): import("@testing-library/react").RenderHookResult<import("../../index.types").UseSelectReturnValue<string>, unknown>;
2
+ export declare function renderUseSelect(props?: Partial<UseSelectProps<string>>): any;
@@ -1,6 +1,5 @@
1
- import { clickOnItemAtIndex, clickOnToggleButton, keyDownOnToggleButton, mouseLeaveItemAtIndex, mouseMoveItemAtIndex, tab } from '../../../testUtils';
2
1
  export declare const stateChangeTestCases: ({
3
- step: typeof keyDownOnToggleButton;
2
+ step: any;
4
3
  arg: string;
5
4
  state: {
6
5
  isOpen: boolean;
@@ -10,17 +9,7 @@ export declare const stateChangeTestCases: ({
10
9
  };
11
10
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonClick;
12
11
  } | {
13
- step: typeof keyDownOnToggleButton;
14
- arg: string;
15
- state: {
16
- isOpen: boolean;
17
- highlightedIndex: number;
18
- inputValue: string;
19
- selectedItem: null;
20
- };
21
- type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownEnter;
22
- } | {
23
- step: typeof keyDownOnToggleButton;
12
+ step: any;
24
13
  arg: string;
25
14
  state: {
26
15
  isOpen: boolean;
@@ -30,133 +19,123 @@ export declare const stateChangeTestCases: ({
30
19
  };
31
20
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownEscape;
32
21
  } | {
33
- step: typeof keyDownOnToggleButton;
34
- arg: string;
35
- state: {
36
- isOpen: boolean;
37
- highlightedIndex: number;
38
- inputValue: string;
39
- selectedItem: null;
40
- };
41
- type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownArrowDown;
42
- } | {
43
- step: typeof keyDownOnToggleButton;
22
+ step: any;
44
23
  arg: string;
45
24
  state: {
46
25
  isOpen: boolean;
47
26
  highlightedIndex: number;
48
27
  inputValue: string;
49
- selectedItem: string | undefined;
28
+ selectedItem: any;
50
29
  };
51
30
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownEnter;
52
31
  } | {
53
- step: typeof keyDownOnToggleButton;
32
+ step: any;
54
33
  arg: string;
55
34
  state: {
56
35
  isOpen: boolean;
57
36
  highlightedIndex: number;
58
37
  inputValue: string;
59
- selectedItem: string | undefined;
38
+ selectedItem: any;
60
39
  };
61
40
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownEnd;
62
41
  } | {
63
- step: typeof keyDownOnToggleButton;
42
+ step: any;
64
43
  arg: string;
65
44
  state: {
66
45
  isOpen: boolean;
67
46
  highlightedIndex: number;
68
47
  inputValue: string;
69
- selectedItem: string | undefined;
48
+ selectedItem: any;
70
49
  };
71
50
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownSpaceButton;
72
51
  } | {
73
- step: typeof clickOnToggleButton;
52
+ step: any;
74
53
  state: {
75
54
  isOpen: boolean;
76
55
  highlightedIndex: number;
77
56
  inputValue: string;
78
- selectedItem: string | undefined;
57
+ selectedItem: any;
79
58
  };
80
59
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonClick;
81
60
  arg?: undefined;
82
61
  } | {
83
- step: typeof keyDownOnToggleButton;
62
+ step: any;
84
63
  arg: string;
85
64
  state: {
86
65
  isOpen: boolean;
87
66
  highlightedIndex: number;
88
67
  inputValue: string;
89
- selectedItem: string | undefined;
68
+ selectedItem: any;
90
69
  };
91
70
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownPageUp;
92
71
  } | {
93
- step: typeof keyDownOnToggleButton;
72
+ step: any;
94
73
  arg: string;
95
74
  state: {
96
75
  isOpen: boolean;
97
76
  highlightedIndex: number;
98
77
  inputValue: string;
99
- selectedItem: string | undefined;
78
+ selectedItem: any;
100
79
  };
101
80
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownPageDown;
102
81
  } | {
103
- step: typeof mouseMoveItemAtIndex;
82
+ step: any;
104
83
  arg: number;
105
84
  state: {
106
85
  isOpen: boolean;
107
86
  highlightedIndex: number;
108
87
  inputValue: string;
109
- selectedItem: string | undefined;
88
+ selectedItem: any;
110
89
  };
111
90
  type: import("../../index.types").UseSelectStateChangeTypes.ItemMouseMove;
112
91
  } | {
113
- step: typeof mouseLeaveItemAtIndex;
92
+ step: any;
114
93
  arg: number;
115
94
  state: {
116
95
  isOpen: boolean;
117
96
  highlightedIndex: number;
118
97
  inputValue: string;
119
- selectedItem: string | undefined;
98
+ selectedItem: any;
120
99
  };
121
100
  type: import("../../index.types").UseSelectStateChangeTypes.MenuMouseLeave;
122
101
  } | {
123
- step: typeof clickOnItemAtIndex;
102
+ step: any;
124
103
  arg: number;
125
104
  state: {
126
105
  isOpen: boolean;
127
106
  highlightedIndex: number;
128
107
  inputValue: string;
129
- selectedItem: string | undefined;
108
+ selectedItem: any;
130
109
  };
131
110
  type: import("../../index.types").UseSelectStateChangeTypes.ItemClick;
132
111
  } | {
133
- step: typeof keyDownOnToggleButton;
112
+ step: any;
134
113
  arg: string;
135
114
  state: {
136
115
  isOpen: boolean;
137
116
  highlightedIndex: number;
138
117
  inputValue: string;
139
- selectedItem: string | undefined;
118
+ selectedItem: any;
140
119
  };
141
120
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownArrowDown;
142
121
  } | {
143
- step: typeof keyDownOnToggleButton;
122
+ step: any;
144
123
  arg: string;
145
124
  state: {
146
125
  isOpen: boolean;
147
126
  highlightedIndex: number;
148
127
  inputValue: string;
149
- selectedItem: string | undefined;
128
+ selectedItem: any;
150
129
  };
151
130
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownArrowUp;
152
131
  } | {
153
- step: typeof keyDownOnToggleButton;
132
+ step: any;
154
133
  arg: string;
155
134
  state: {
156
135
  isOpen: boolean;
157
136
  highlightedIndex: number;
158
137
  inputValue: string;
159
- selectedItem: string | undefined;
138
+ selectedItem: any;
160
139
  };
161
140
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonKeyDownCharacter;
162
141
  } | {
@@ -165,17 +144,17 @@ export declare const stateChangeTestCases: ({
165
144
  isOpen: boolean;
166
145
  highlightedIndex: number;
167
146
  inputValue: string;
168
- selectedItem: string | undefined;
147
+ selectedItem: any;
169
148
  };
170
149
  type: import("../../index.types").UseSelectStateChangeTypes.FunctionSetInputValue;
171
150
  arg?: undefined;
172
151
  } | {
173
- step: typeof tab;
152
+ step: any;
174
153
  state: {
175
154
  isOpen: boolean;
176
155
  highlightedIndex: number;
177
156
  inputValue: string;
178
- selectedItem: string | undefined;
157
+ selectedItem: any;
179
158
  };
180
159
  type: import("../../index.types").UseSelectStateChangeTypes.ToggleButtonBlur;
181
160
  arg?: undefined;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Environment, GetPropsCommonOptions, Overwrite } from '../../downshift.types';
2
+ import { AnyRef, Environment, GetPropsCommonOptions, Overwrite } from '../../downshift.types';
3
3
  export interface UseSelectState<Item> {
4
4
  highlightedIndex: number;
5
5
  selectedItem: Item | null;
@@ -162,19 +162,19 @@ export interface UseSelectIsOpenChange<Item> extends UseSelectStateChange<Item>
162
162
  }
163
163
  export interface UseSelectGetMenuPropsOptions extends React.HTMLProps<HTMLElement> {
164
164
  refKey?: string;
165
- ref?: React.Ref<any>;
165
+ ref?: AnyRef;
166
166
  }
167
167
  export interface UseSelectGetMenuPropsReturnValue {
168
168
  'aria-labelledby': string | undefined;
169
169
  id: string;
170
170
  onMouseLeave: React.MouseEventHandler;
171
- ref?: React.Ref<any>;
171
+ ref?: AnyRef;
172
172
  role: 'listbox';
173
173
  }
174
174
  export type UseSelectGetMenuProps = <Options>(options?: UseSelectGetMenuPropsOptions & Options, otherOptions?: GetPropsCommonOptions) => Overwrite<UseSelectGetMenuPropsReturnValue, Options>;
175
175
  export interface UseSelectGetToggleButtonPropsOptions extends React.HTMLProps<HTMLElement> {
176
176
  refKey?: string;
177
- ref?: React.Ref<any>;
177
+ ref?: AnyRef;
178
178
  onPress?: (event: React.BaseSyntheticEvent) => void;
179
179
  }
180
180
  export interface UseSelectGetToggleButtonPropsReturnValue {
@@ -188,7 +188,7 @@ export interface UseSelectGetToggleButtonPropsReturnValue {
188
188
  onClick?: React.MouseEventHandler;
189
189
  onKeyDown?: React.KeyboardEventHandler;
190
190
  onPress?: (event: React.BaseSyntheticEvent) => void;
191
- ref?: React.Ref<any>;
191
+ ref?: AnyRef;
192
192
  role: 'combobox';
193
193
  tabIndex: 0;
194
194
  }
@@ -205,7 +205,7 @@ export interface UseSelectGetItemPropsOptions<Item> extends React.HTMLProps<HTML
205
205
  item?: Item;
206
206
  index?: number;
207
207
  refKey?: string;
208
- ref?: React.Ref<any>;
208
+ ref?: AnyRef;
209
209
  onPress?: (event: React.BaseSyntheticEvent) => void;
210
210
  }
211
211
  export interface UseSelectGetItemPropsReturnValue {
@@ -216,7 +216,7 @@ export interface UseSelectGetItemPropsReturnValue {
216
216
  onMouseDown?: React.MouseEventHandler;
217
217
  onMouseMove?: React.MouseEventHandler;
218
218
  onPress?: React.MouseEventHandler;
219
- ref?: React.Ref<any>;
219
+ ref?: AnyRef;
220
220
  role: 'option';
221
221
  }
222
222
  export type UseSelectGetItemProps<Item> = <Options>(options: UseSelectGetItemPropsOptions<Item> & Options) => Omit<Overwrite<UseSelectGetItemPropsReturnValue, Options>, 'index' | 'item'>;