@mui/x-charts
Version:
The community edition of MUI X Charts components.
14 lines • 1.63 kB
TypeScript
import type { CartesianChartSeriesType, ChartSeriesType } from "../../../../models/seriesType/config.js";
import type { FocusedItemIdentifier } from "../../../../models/seriesType/index.js";
import type { UseChartKeyboardNavigationSignature } from "./useChartKeyboardNavigation.types.js";
import type { ChartState } from "../../models/chart.js";
import type { UseChartCartesianAxisSignature } from "../useChartCartesianAxis/index.js";
export type FocusedItemUpdater<SeriesType extends ChartSeriesType, OutputSeriesType extends ChartSeriesType = ChartSeriesType> = (currentItem: (SeriesType extends any ? FocusedItemIdentifier<SeriesType> : never) | null, state: SeriesType extends CartesianChartSeriesType ? Pick<ChartState<[UseChartKeyboardNavigationSignature], [UseChartCartesianAxisSignature], SeriesType>, 'series' | 'cartesianAxis'> : Pick<ChartState<[UseChartKeyboardNavigationSignature], [], SeriesType>, 'series'>) => FocusedItemIdentifier<OutputSeriesType> | null;
/**
* Get the next focusable item in the chart.
* @param {SeriesItemIdentifierWithType<SeriesType> | null} currentItem The current focused item.
* @param {KeyboardEvent} event The keyboard event that triggered the navigation.
* @param {ChartState<[UseChartKeyboardNavigationSignature], []>} state The current chart state.
* @returns {SeriesItemIdentifierWithType<ChartSeriesType> | null} The next focusable item or null if none found.
*/
export type KeyboardFocusHandler<SeriesType extends ChartSeriesType, OutputSeriesType extends ChartSeriesType = ChartSeriesType> = (event: KeyboardEvent) => FocusedItemUpdater<SeriesType, OutputSeriesType> | null;