@itwin/core-react
Version:
A react component library of iTwin.js UI general purpose components
53 lines • 2.1 kB
TypeScript
/** @packageDocumentation
* @module Focus
*/
import { Orientation } from "../enums/Orientation.js";
/** Cross-Axis Arrow Key Callback
* @internal
*/
export type CrossAxisArrowKeyFunc = (forward: boolean) => void;
/** Keyboard Navigator for parent components
* @internal
*/
export declare class ItemKeyboardNavigator {
onFocusItem: (index: number) => void;
onActivateItem: (index: number) => void;
private _direction;
private _itemCount;
private _orientation;
private _allowWrap;
private _crossAxisArrowKeyHandler?;
constructor(onFocusItem: (index: number) => void, onActivateItem: (index: number) => void);
/** The item count */
get itemCount(): number;
set itemCount(count: number);
/** The primary orientation */
get orientation(): Orientation;
set orientation(orientation: Orientation);
/** The allow wrap property controls whether the movement will stop at the first and last items or wrap */
get allowWrap(): boolean;
set allowWrap(v: boolean);
/** Called when the arrow keys that run perpendicular to the primary orientation are pressed */
get crossAxisArrowKeyHandler(): CrossAxisArrowKeyFunc | undefined;
set crossAxisArrowKeyHandler(v: CrossAxisArrowKeyFunc | undefined);
/** Handle KeyDown on items */
handleKeyDownEvent(event: React.KeyboardEvent, index: number): void;
/** Handle KeyUp on items */
handleKeyUpEvent(event: React.KeyboardEvent, index: number): void;
private focusFirstItem;
private focusLastItem;
/** When an item list's orientation is set to vertical,
* only up and down arrow should function.
* In all other cases only left and right arrow function.
*/
private determineOrientation;
/** Either focus the next, previous, first, or last item depending on key pressed
*/
private switchItemOnArrowPress;
private activateItem;
}
/** Determines if a KeyboardEvent.key is an Item Navigation key
* @internal
*/
export declare function isNavigationKey(key: string): boolean;
//# sourceMappingURL=ItemKeyboardNavigator.d.ts.map