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 = (currentItem: (SeriesType extends any ? FocusedItemIdentifier : never) | null, state: SeriesType extends CartesianChartSeriesType ? Pick, 'series' | 'cartesianAxis'> : Pick, 'series'>) => FocusedItemIdentifier | null; /** * Get the next focusable item in the chart. * @param {SeriesItemIdentifierWithType | 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 | null} The next focusable item or null if none found. */ export type KeyboardFocusHandler = (event: KeyboardEvent) => FocusedItemUpdater | null;