import type { FocusEventHandler, KeyboardEventHandler } from "react"; import type { ListElement } from "@react-md/list"; import type { TreeItemId, TreeProps, UnknownTreeItem } from "./types"; import type { MetadataRecord } from "./useFlattenedTreeList"; import type { NestedTreeItem } from "./useNestedTreeList"; declare type Options = Pick, "id" | "data" | "sort" | "onBlur" | "onFocus" | "onKeyDown" | "multiSelect" | "selectedIds" | "onItemSelect" | "onMultiItemSelect" | "expandedIds" | "onItemExpansion" | "onMultiItemExpansion"> & Required, "valueKey" | "getItemValue" | "rootId">>; interface ReturnValue { /** * A nested list representation of the provided tree data. This is used for * rendering all the treeitem nodes. */ items: readonly NestedTreeItem[]; /** * The current treeitem's DOM id that is currently keyboard focused. */ activeId: string; /** * A function that updates the `activeId` based on the provided `itemId`. This * should really only be used whenever an item is clicked with a mouse or * touch since the `activeId` will be updated automatically for all the other * flows. */ setActiveId(itemId: TreeItemId): void; /** * A record containing the DOM ids for each tree item along with a ref object * to provide to the itemRenderer for that item. This is just for a quick * lookup to help with all the tree traversal and keyboard movement. */ itemIdRefs: MetadataRecord; /** * A blur handler that should be passed to the tree list element that handles * removing the `aria-activedescendant` when the tree is no longer within * focus. This will also call the optional `onBlur` prop. */ handleBlur: FocusEventHandler; /** * A focus handler that should be passed to the tree element that handles * conditionally setting the default `aria-activedescendant` id on first * focus. This will also call the optional `onFocus` prop. */ handleFocus: FocusEventHandler; /** * The keydown handler that should be passed to the tree list element that * handles all the keyboard functionality and movement. * * This will also call the optional `onKeyDown` prop. */ handleKeyDown: KeyboardEventHandler; } /** * This hook handles all the complex and "fun" stuff for selecting keyboard * accessibility within a tree and enabling keyboard movement, selection, and * expansion. * * @internal */ export declare function useTreeMovement({ id, data, rootId, sort, onBlur, onFocus, onKeyDown, multiSelect, selectedIds, onItemSelect, onMultiItemSelect, expandedIds, onItemExpansion, onMultiItemExpansion, valueKey, getItemValue, }: Options): ReturnValue; export {};