@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
86 lines • 3.1 kB
TypeScript
import React from 'react';
/**
* This elemProps hook resets the cursor when the list looses focus. By default,
* [useListItemRovingFocus](#use-list-item-roving-focus) will leave the last focused item as the
* focusable item in the list. Sometimes it is desireable to reset the cursor to the last selected
* item. For example, `Tabs.Item` uses this hook to reset the tab stop to the currently selected tab.
*
* ```ts
* const useMyItem = composeHooks(
* useListResetCursorOnBlur, // adds the cursor reset to selected for roving tabindex
* useListItemRovingFocus,
* useListItemRegister
* );
```
*/
export declare const useListResetCursorOnBlur: import("@workday/canvas-kit-react/common").BehaviorHook<{
state: {
selectedIds: string[] | "all";
unselectedIds: string[];
cursorId: string;
columnCount: number;
pageSizeRef: React.MutableRefObject<number>;
cursorIndexRef: {
readonly current: number;
};
UNSTABLE_virtual: {
virtualItems: import("./react-virtual").VirtualItem[];
totalSize: number;
scrollToOffset: (index: number, options?: import("./react-virtual").ScrollToOffsetOptions | undefined) => void;
scrollToIndex: (index: number, options?: import("./react-virtual").ScrollToIndexOptions | undefined) => void;
measure: () => void;
};
UNSTABLE_defaultItemHeight: number;
containerRef: React.RefObject<HTMLDivElement>;
id: string;
orientation: "horizontal" | "vertical";
indexRef: React.MutableRefObject<number>;
nonInteractiveIds: string[];
isVirtualized: boolean;
items: import("./useBaseListModel").Item<any>[];
};
events: {
select(data: {
id: string;
}): void;
selectAll(): void;
unselectAll(): void;
setSelectedIds(ids: string[] | "all"): void;
remove(data: {
id: string;
nextId?: string | undefined;
event?: Event | React.SyntheticEvent<Element, Event> | undefined;
}): void;
goTo(data: {
id: string;
}): void;
goToNext(): void;
goToPrevious(): void;
goToPreviousRow(): void;
goToNextRow(): void;
goToFirst(): void;
goToLast(): void;
goToFirstOfRow(): void;
goToLastOfRow(): void;
goToNextPage(): void;
goToPreviousPage(): void;
registerItem(data: {
id: string;
textValue: string;
}): void;
unregisterItem(data: {
id: string;
}): void;
updateItemHeight(data: {
value: number;
}): void;
};
selection: import("./useSelectionListModel").SelectionManager;
navigation: import("./useCursorListModel").NavigationManager;
getId: (item: any) => string;
}, {
readonly onKeyDown: (event: React.KeyboardEvent) => void;
readonly onFocus: () => void;
readonly onBlur: () => void;
}>;
//# sourceMappingURL=useListResetCursorOnBlur.d.ts.map