downshift 9.3.4-alpha.0 → 9.3.4

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.
@@ -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 '../..';
@@ -12,11 +13,11 @@ type DropdownComboboxProps = Partial<UseComboboxProps<string>> & {
12
13
  };
13
14
  export declare function renderCombobox(props?: Omit<DropdownComboboxProps, 'renderSpy'>, uiCallback?: (ui: React.ReactElement) => React.ReactElement): {
14
15
  renderSpy: jest.Mock<any, any, any>;
15
- rerender: (p: Omit<DropdownComboboxProps, "renderSpy">) => void;
16
+ rerender: (p: Omit<DropdownComboboxProps, 'renderSpy'>) => void;
16
17
  user: import("@testing-library/user-event").UserEvent;
17
18
  container: HTMLElement;
18
19
  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
+ debug: (baseElement?: any, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
20
21
  unmount: () => void;
21
22
  asFragment: () => DocumentFragment;
22
23
  getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { AnyRef, Environment, GetPropsCommonOptions, Overwrite } from '../../downshift.types';
2
3
  export interface UseComboboxState<Item> {
3
4
  highlightedIndex: number;
@@ -2,37 +2,45 @@ export default useMultipleSelection;
2
2
  declare function useMultipleSelection(userProps?: {}): {
3
3
  getSelectedItemProps: ({ refKey, ref, onClick, onKeyDown, selectedItem: selectedItemProp, index: indexProp, ...rest }?: {
4
4
  refKey?: string | undefined;
5
+ ref: any;
6
+ onClick: any;
7
+ onKeyDown: any;
8
+ selectedItem: any;
9
+ index: any;
5
10
  }) => {
6
11
  tabIndex: number;
7
- onClick: (event: React.SyntheticEvent & {
8
- preventDownshiftDefault?: boolean;
12
+ onClick: (event: import("react").SyntheticEvent<Element, Event> & {
13
+ preventDownshiftDefault?: boolean | undefined;
9
14
  nativeEvent: {
10
- preventDownshiftDefault?: boolean;
15
+ preventDownshiftDefault?: boolean | undefined;
11
16
  };
12
17
  }, ...args: unknown[]) => boolean;
13
- onKeyDown: (event: React.SyntheticEvent & {
14
- preventDownshiftDefault?: boolean;
18
+ onKeyDown: (event: import("react").SyntheticEvent<Element, Event> & {
19
+ preventDownshiftDefault?: boolean | undefined;
15
20
  nativeEvent: {
16
- preventDownshiftDefault?: boolean;
21
+ preventDownshiftDefault?: boolean | undefined;
17
22
  };
18
23
  }, ...args: unknown[]) => boolean;
19
24
  };
20
25
  getDropdownProps: ({ refKey, ref, onKeyDown, onClick, preventKeyAction, ...rest }?: {
21
26
  refKey?: string | undefined;
27
+ ref: any;
28
+ onKeyDown: any;
29
+ onClick: any;
22
30
  preventKeyAction?: boolean | undefined;
23
31
  }, { suppressRefError }?: {
24
32
  suppressRefError?: boolean | undefined;
25
33
  }) => {
26
- onKeyDown?: ((event: React.SyntheticEvent & {
27
- preventDownshiftDefault?: boolean;
34
+ onKeyDown?: ((event: import("react").SyntheticEvent<Element, Event> & {
35
+ preventDownshiftDefault?: boolean | undefined;
28
36
  nativeEvent: {
29
- preventDownshiftDefault?: boolean;
37
+ preventDownshiftDefault?: boolean | undefined;
30
38
  };
31
39
  }, ...args: unknown[]) => boolean) | undefined;
32
- onClick?: ((event: React.SyntheticEvent & {
33
- preventDownshiftDefault?: boolean;
40
+ onClick?: ((event: import("react").SyntheticEvent<Element, Event> & {
41
+ preventDownshiftDefault?: boolean | undefined;
34
42
  nativeEvent: {
35
- preventDownshiftDefault?: boolean;
43
+ preventDownshiftDefault?: boolean | undefined;
36
44
  };
37
45
  }, ...args: unknown[]) => boolean) | undefined;
38
46
  };
@@ -47,4 +55,4 @@ declare function useMultipleSelection(userProps?: {}): {
47
55
  declare namespace useMultipleSelection {
48
56
  export { stateChangeTypes };
49
57
  }
50
- import * as stateChangeTypes from './stateChangeTypes';
58
+ import * as stateChangeTypes from "./stateChangeTypes";
@@ -1,17 +1,17 @@
1
1
  export namespace defaultStateValues {
2
- let activeIndex: number;
3
- let selectedItems: never[];
2
+ const activeIndex: number;
3
+ const selectedItems: never[];
4
4
  }
5
5
  export namespace defaultProps {
6
- let itemToKey: (item: unknown) => unknown;
7
- let stateReducer: <S, A>(_state: S, actionAndChanges: (A & {
6
+ const itemToKey: (item: unknown) => unknown;
7
+ const stateReducer: <S, A>(_state: S, actionAndChanges: A & {
8
8
  props: any;
9
- }) & {
9
+ } & {
10
10
  changes: Partial<S>;
11
11
  }) => Partial<S>;
12
- let environment: (Window & typeof globalThis) | undefined;
13
- let keyNavigationNext: string;
14
- let keyNavigationPrevious: string;
12
+ const environment: (Window & typeof globalThis) | undefined;
13
+ const keyNavigationNext: string;
14
+ const keyNavigationPrevious: string;
15
15
  }
16
16
  export let validatePropTypes: typeof noop;
17
17
  /**
@@ -41,4 +41,4 @@ export function isKeyDownOperationPermitted(event: KeyboardEvent): boolean;
41
41
  * @returns {boolean} Wheather the states are deeply equal.
42
42
  */
43
43
  export function isStateEqual(prevState: Object, newState: Object): boolean;
44
- import { noop } from '../../utils';
44
+ import { noop } from "../../utils";
@@ -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'> & {
@@ -12,11 +13,11 @@ type DropdownSelectProps = Omit<UseSelectProps<string>, 'items'> & {
12
13
  };
13
14
  export declare function renderSelect(props: Omit<DropdownSelectProps, 'renderSpy'>, uiCallback?: (ui: React.ReactElement) => React.ReactElement): {
14
15
  renderSpy: jest.Mock<any, any, any>;
15
- rerender: (p: Omit<DropdownSelectProps, "renderSpy">) => void;
16
+ rerender: (p: Omit<DropdownSelectProps, 'renderSpy'>) => void;
16
17
  user: import("@testing-library/user-event").UserEvent;
17
18
  container: HTMLElement;
18
19
  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
+ debug: (baseElement?: any, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
20
21
  unmount: () => void;
21
22
  asFragment: () => DocumentFragment;
22
23
  getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
@@ -9,7 +9,7 @@ export declare function renderTagGroup(props?: Partial<UseTagGroupProps<string>>
9
9
  user: import("@testing-library/user-event").UserEvent;
10
10
  container: HTMLElement;
11
11
  baseElement: HTMLElement;
12
- debug: (baseElement?: ReactDOMClient.Container | any | Array<ReactDOMClient.Container | any> | undefined, maxLength?: number | undefined, options?: import("node_modules/pretty-format/build").OptionsReceived | undefined) => void;
12
+ debug: (baseElement?: any, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
13
13
  rerender: (ui: React.ReactNode) => void;
14
14
  unmount: () => void;
15
15
  asFragment: () => DocumentFragment;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { AnyRef, Environment } from '../../downshift.types';
2
3
  export interface UseTagGroupState<Item> {
3
4
  activeIndex: number;
@@ -3,9 +3,9 @@ export declare const dropdownDefaultProps: {
3
3
  itemToString(item: unknown): string;
4
4
  itemToKey(item: unknown): unknown;
5
5
  isItemDisabled(_item: unknown): boolean;
6
- stateReducer: <S, A>(_state: S, actionAndChanges: (A & {
6
+ stateReducer: <S, A>(_state: S, actionAndChanges: A & {
7
7
  props: any;
8
- }) & {
8
+ } & {
9
9
  changes: Partial<S>;
10
10
  }) => Partial<S>;
11
11
  scrollIntoView: typeof scrollIntoView;
@@ -8,4 +8,4 @@
8
8
  * @param circular If the search reaches the end, if it can search again starting from the other end.
9
9
  * @returns The next highlightedIndex.
10
10
  */
11
- export declare function getHighlightedIndex<Item>(start: number, offset: number, items: Item[], isItemDisabled: (item: Item, index: number) => boolean, circular?: boolean): number;
11
+ export declare function getHighlightedIndex<Item>(start: number, offset: number, items: Item[], isItemDisabled: (item: Item, index: number) => boolean, circular?: boolean): any;
@@ -8,4 +8,4 @@
8
8
  * @param circular If the search reaches the end, if it can search again starting from the other end.
9
9
  * @returns The next non-disabled index.
10
10
  */
11
- export declare function getNonDisabledIndex<Item>(start: number, backwards: boolean, items: Item[], isItemDisabled: (item: Item, index: number) => boolean, circular?: boolean): number;
11
+ export declare function getNonDisabledIndex<Item>(start: number, backwards: boolean, items: Item[], isItemDisabled: (item: Item, index: number) => boolean, circular?: boolean): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "downshift",
3
- "version": "9.3.4-alpha.0",
3
+ "version": "9.3.4",
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.cjs",
6
6
  "react-native": "dist/downshift.native.cjs.cjs",
@@ -39,9 +39,16 @@
39
39
  },
40
40
  "husky": {
41
41
  "hooks": {
42
- "pre-commit": "unset ELECTRON_RUN_AS_NODE && kcd-scripts pre-commit"
42
+ "pre-commit": "kcd-scripts pre-commit"
43
43
  }
44
44
  },
45
+ "lint-staged": {
46
+ "*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|gql|graphql|mdx|vue)": [
47
+ "kcd-scripts format",
48
+ "kcd-scripts lint",
49
+ "kcd-scripts test --findRelatedTests --passWithNoTests"
50
+ ]
51
+ },
45
52
  "files": [
46
53
  "dist",
47
54
  "typings",