UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

95 lines 3.34 kB
import { Item } from '@workday/canvas-kit-react/collection'; /** * This elemProps hook allows for children values to be considered identifiers if the children are * strings. This can be useful for autocomplete or select components that allow string values. This * hook must be passed _after_ {@link useListItemRegister} because this hook sets the `data-id` * attribute if one hasn't been defined by the application. * * An example might look like: * * ```tsx * const useMyListItem = composeHooks( * // any other hooks here * useListItemSelect, * useListItemRegister, * useListItemAllowChildStrings // always the last in the list * ) * * * <MyList onSelect={({id}) => { * console.log(id) // will be "First" or "Second" * }}> * <MyList.Item>First</MyList.Item> * <MyList.Item>Second</MyList.Item> * </MyList> * ``` */ export declare const useListItemAllowChildStrings: import("@workday/canvas-kit-react/common").BehaviorHook<{ state: { selectedIds: string[] | "all"; unselectedIds: string[]; cursorId: string; columnCount: number; pageSizeRef: import("react").MutableRefObject<number>; cursorIndexRef: { readonly current: number; }; UNSTABLE_virtual: { virtualItems: import("@workday/canvas-kit-react/collection").VirtualItem[]; totalSize: number; scrollToOffset: (index: number, options?: import("@workday/canvas-kit-react/collection").ScrollToOffsetOptions | undefined) => void; scrollToIndex: (index: number, options?: import("./react-virtual").ScrollToIndexOptions | undefined) => void; measure: () => void; }; UNSTABLE_defaultItemHeight: number; containerRef: import("react").RefObject<HTMLDivElement>; id: string; orientation: "horizontal" | "vertical"; indexRef: import("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 | import("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("@workday/canvas-kit-react/collection").SelectionManager; navigation: import("@workday/canvas-kit-react/collection").NavigationManager; getId: (item: any) => string; }, { 'data-id'?: string | undefined; }>; //# sourceMappingURL=useListItemAllowChildStrings.d.ts.map