UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

14 lines 1.62 kB
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<TSeriesType extends ChartSeriesType, OutputSeriesType extends ChartSeriesType = ChartSeriesType> = (currentItem: (TSeriesType extends any ? FocusedItemIdentifier<TSeriesType> : never) | null, state: TSeriesType extends CartesianChartSeriesType ? Pick<ChartState<[UseChartKeyboardNavigationSignature], [UseChartCartesianAxisSignature], TSeriesType>, 'series' | 'cartesianAxis'> : Pick<ChartState<[UseChartKeyboardNavigationSignature], [], TSeriesType>, 'series'>) => FocusedItemIdentifier<OutputSeriesType> | null; /** * Get the next focusable item in the chart. * @param {SeriesItemIdentifier<TSeriesType> | 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 {SeriesItemIdentifier<ChartSeriesType> | null} The next focusable item or null if none found. */ export type KeyboardFocusHandler<TSeriesType extends ChartSeriesType, OutputSeriesType extends ChartSeriesType = ChartSeriesType> = (event: KeyboardEvent) => FocusedItemUpdater<TSeriesType, OutputSeriesType> | null;