@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
93 lines • 3.29 kB
TypeScript
import React from 'react';
import { Item } from './useBaseListModel';
import { VirtualItem } from './react-virtual';
/**
* This elemProps hook is the base of all item component hooks. It registers an item with a
* collection and sets the `data-id` that is used by other hooks. It should always be the last
* defined hook when using `composeHooks` (`composeHooks` executes hooks right to left and merges
* props left to right). It is used by `ListBox.Item` and all `*.Item` subcomponents.
*
* ```ts
* const useMyItem = composeHooks(
* useListItemSelect, // additional hooks go here
* useListItemRegister // always last
* );
* ```
*/
export declare const useListItemRegister: 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: 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: 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: {
item: any;
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 ref: (instance: HTMLElement | null) => void;
readonly 'data-id': string;
readonly disabled: true | undefined;
readonly item: null;
readonly virtual: null;
readonly 'aria-setsize': number | undefined;
readonly 'aria-posinset': number | undefined;
readonly style: React.CSSProperties;
readonly id: string;
}>;
//# sourceMappingURL=useListItemRegister.d.ts.map