From d78f68a0936f542e96218628a16d205079bb70f1 Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Sat, 16 Dec 2023 15:09:52 +0900 Subject: [PATCH 1/3] number -> number | null --- typings/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/typings/index.d.ts b/typings/index.d.ts index 7b4302a7f..9add1bb08 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -255,7 +255,7 @@ export interface Actions { cb?: Callback, ) => void setHighlightedIndex: ( - index: number, + index: number | null, otherStateToSet?: Partial>, cb?: Callback, ) => void @@ -459,7 +459,7 @@ export interface UseSelectActions { closeMenu: () => void toggleMenu: () => void selectItem: (item: Item | null) => void - setHighlightedIndex: (index: number) => void + setHighlightedIndex: (index: number | null) => void } export type UseSelectReturnValue = UseSelectState & @@ -666,7 +666,7 @@ export interface UseComboboxActions { closeMenu: () => void toggleMenu: () => void selectItem: (item: Item | null) => void - setHighlightedIndex: (index: number) => void + setHighlightedIndex: (index: number | null) => void setInputValue: (inputValue: string) => void } From e143dd3405e153e3414fd44da9ad895dd95b2b1b Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Sat, 16 Dec 2023 15:47:47 +0900 Subject: [PATCH 2/3] fix docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b5ca04a0..b77951960 100644 --- a/README.md +++ b/README.md @@ -906,7 +906,7 @@ These are functions you can call to change the state of the downshift component. | `selectHighlightedItem` | `function(otherStateToSet: object, cb: Function)` | selects the item that is currently highlighted | | `selectItem` | `function(item: any, otherStateToSet: object, cb: Function)` | selects the given item | | `selectItemAtIndex` | `function(index: number, otherStateToSet: object, cb: Function)` | selects the item at the given index | -| `setHighlightedIndex` | `function(index: number, otherStateToSet: object, cb: Function)` | call to set a new highlighted index | +| `setHighlightedIndex` | `function(index: number / null, otherStateToSet: object, cb: Function)` | call to set a new highlighted index | | `toggleMenu` | `function(otherStateToSet: object, cb: Function)` | toggle the menu open state | | `reset` | `function(otherStateToSet: object, cb: Function)` | this resets downshift's state to a reasonable default | | `setItemCount` | `function(count: number)` | this sets the `itemCount`. Handy in situations where you're using windowing and the items are loaded asynchronously from within downshift (so you can't use the `itemCount` prop. | From d1c0b9c4c903e0b3c966e5d099d378c0816fe579 Mon Sep 17 00:00:00 2001 From: Shun Miyazawa Date: Sat, 16 Dec 2023 15:48:25 +0900 Subject: [PATCH 3/3] fix docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b77951960..54807e997 100644 --- a/README.md +++ b/README.md @@ -906,7 +906,7 @@ These are functions you can call to change the state of the downshift component. | `selectHighlightedItem` | `function(otherStateToSet: object, cb: Function)` | selects the item that is currently highlighted | | `selectItem` | `function(item: any, otherStateToSet: object, cb: Function)` | selects the given item | | `selectItemAtIndex` | `function(index: number, otherStateToSet: object, cb: Function)` | selects the item at the given index | -| `setHighlightedIndex` | `function(index: number / null, otherStateToSet: object, cb: Function)` | call to set a new highlighted index | +| `setHighlightedIndex` | `function(index: number | null, otherStateToSet: object, cb: Function)` | call to set a new highlighted index | | `toggleMenu` | `function(otherStateToSet: object, cb: Function)` | toggle the menu open state | | `reset` | `function(otherStateToSet: object, cb: Function)` | this resets downshift's state to a reasonable default | | `setItemCount` | `function(count: number)` | this sets the `itemCount`. Handy in situations where you're using windowing and the items are loaded asynchronously from within downshift (so you can't use the `itemCount` prop. |