/** * Framework-free keyboard interaction logic for the composite widgets. * * A component translates a DOM event into one of these pure decisions and applies the target it * returns to its own state. Nothing here touches the DOM, so the same key means the same thing * wherever the widget is drawn. */ import { CalendarDate } from "@modyra/core/datetime"; /** * Listbox navigation (WAI-ARIA listbox pattern): returns the next active * option index for a navigation key, or `null` when the key does not * navigate (selection/close keys are the caller's business). * * `activeIndex` may be -1 (no active option yet): ArrowDown enters the list * at 0, ArrowUp at the last option. */ export declare function listboxNextIndex(key: string, activeIndex: number, optionCount: number): number | null; /** * Where the reading position goes in a row that clamps at its ends. * * A listbox laid out horizontally — the colour presets — walked with either axis: `ArrowLeft` and * `ArrowRight` because the row runs that way, `ArrowUp` and `ArrowDown` because a person reading it * as a list reaches for them, `Home` and `End` for its ends. It clamps rather than wraps, which is * what tells a person they have reached the end without their having to notice they are back at the * start. * * `by` is the binding's direction where the caller has one: the row runs in the writing direction, so * `ArrowLeft` is *later* in a right-to-left document and a renderer reading the key alone would be * wrong there. Absent, the key decides. * * Published because three renderers each had this arithmetic, which is three chances for one of them * to clamp where the others wrap. */ export declare function rowRovingIndex(key: string, at: number, count: number, by?: -1 | 1): number | null; /** * Calendar grid navigation (WAI-ARIA grid pattern): returns the date that * should receive focus for a navigation key, or `null` when the key does * not move focus. Month/year jumps clamp the day (Jan 31 → Feb 28), and * `shiftKey` upgrades PageUp/PageDown to year jumps. */ export declare function calendarKeyboardTarget(key: string, focused: CalendarDate, shiftKey?: boolean): CalendarDate | null;