UNPKG

hightable

Version:

A dynamic windowed scrolling table component for react

39 lines (38 loc) 1.44 kB
import { KeyboardEvent, ReactNode, RefObject } from 'react'; export interface CellPosition { colIndex: number; rowIndex: number; } interface CellsNavigationContextType { cellPosition: CellPosition; shouldFocus: boolean; enterCellsNavigation?: boolean; onTableKeyDown?: (event: KeyboardEvent) => void; onScrollKeyDown?: (event: KeyboardEvent) => void; setColIndex?: (colIndex: number) => void; setRowIndex?: (rowIndex: number) => void; setShouldFocus?: (shouldFocus: boolean) => void; setEnterCellsNavigation?: (enterCellsNavigation: boolean) => void; focusFirstCell?: () => void; } export declare const CellsNavigationContext: import("react").Context<CellsNavigationContextType>; interface CellsNavigationProviderProps { colCount: number; rowCount: number; rowPadding: number; children: ReactNode; } export declare function CellsNavigationProvider({ colCount, rowCount, rowPadding, children }: CellsNavigationProviderProps): import("react/jsx-runtime").JSX.Element; interface CellData { ref: RefObject<HTMLElement | null>; ariaColIndex: number; ariaRowIndex: number; } type TabIndex = -1 | 0; interface CellFocus { tabIndex: TabIndex; navigateToCell: () => void; } export declare function useCellNavigation({ ref, ariaColIndex, ariaRowIndex }: CellData): CellFocus; export declare function useCellsNavigation(): CellsNavigationContextType; export {};