-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: < GridKeyboardNavigationContext /> - migrate to TS (#1656)
- Loading branch information
1 parent
4a87218
commit df1f57f
Showing
6 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/components/GridKeyboardNavigationContext/GridKeyboardNavigationContextConstants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MutableRefObject } from "react"; | ||
import { NavDirections } from "../../hooks/useFullKeyboardListeners"; | ||
|
||
export type GridElementRef = MutableRefObject<HTMLElement> & { current?: HTMLElement & { disabled?: boolean } }; | ||
export type DirectionMap = Map<GridElementRef, GridElementRef>; | ||
export type DirectionMaps = Record<NavDirections, DirectionMap>; | ||
|
||
export type Position = VerticalPosition & HorizontalPosition; | ||
|
||
type VerticalPosition = { | ||
topElement?: GridElementRef; | ||
bottomElement?: GridElementRef; | ||
}; | ||
|
||
type HorizontalPosition = { | ||
leftElement?: GridElementRef; | ||
rightElement?: GridElementRef; | ||
}; | ||
|
||
export interface GridKeyboardNavigationContextType { | ||
onOutboundNavigation?: (ref: GridElementRef, direction: NavDirections) => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters