import { type KeyboardEvent as ReactKeyboardEvent, type PointerEvent as ReactPointerEvent, type RefObject } from 'react'; /** One move, as reported to the host. */ export interface SidebarItemMove { /** The moved item's `navId`. */ itemId: string; /** The `sectionId` of the section it lands in, or `null` for the list * outside every section. */ toSectionId: string | null; /** Its index in that section (or that list) after the move, from 0. */ index: number; } /** Where the drop indicator shows for the current target. */ export type SidebarDropIndicator = { kind: 'item'; itemId: string; edge: 'before' | 'after'; } | { kind: 'section'; sectionId: string; } | { kind: 'list'; }; interface Place { sectionId: string | null; index: number; /** Items in that section or list once the moved item is in it. */ total: number; indicator: SidebarDropIndicator; } export interface SidebarMoveState { itemId: string; /** The item's name, for the announcements. */ label: string; via: 'keyboard' | 'pointer'; origin: Place; target: Place; /** Open sections holding no item but the moved one: they show a zone. */ emptySectionIds: string[]; /** No item sits outside a section: the body shows a zone for that list. */ listEmpty: boolean; } export interface SidebarMoveContextValue { enabled: boolean; /** Id of the hidden keyboard instructions every movable item cites. */ instructionsId?: string; move: SidebarMoveState | null; onItemKeyDown?: (event: ReactKeyboardEvent, itemId: string) => void; onItemPointerDown?: (event: ReactPointerEvent, itemId: string) => void; onItemBlur?: (itemId: string) => void; /** A section's way to open itself when an item is dropped into it. */ registerSection?: (sectionId: string, open: () => void) => () => void; } export declare const SidebarMoveContext: import("react").Context; export declare const useSidebarMove: () => SidebarMoveContextValue; /** The enclosing SidebarSection: an item in one without an id cannot move. */ export declare const SidebarSectionContext: import("react").Context<{ sectionId?: string; } | null>; export declare const samePlace: (a: Pick, b: Pick) => boolean; interface Layout { places: Place[]; originIndex: number; emptySectionIds: string[]; listEmpty: boolean; sectionLabels: Map; } /** * Every place the moving item can go, in reading order: before each other * item, after the last item of each section and of the outside list, and * into an empty or collapsed section as a whole. */ export declare function readLayout(nav: HTMLElement, movingId: string): Layout | null; export declare function useSidebarMoveController({ onMoveItem, enabled, rootRef, quietFocusRef, }: { onMoveItem?: (move: SidebarItemMove) => void; enabled: boolean; rootRef: RefObject; quietFocusRef: RefObject; }): { context: SidebarMoveContextValue; message: string; instructionsId: string; restoreFocus: () => void; touchGuardRef: (node: HTMLElement | null) => void; /** True while any move runs: Escape cancels it, not the drawer. */ cancelIfMoving: () => boolean; }; export {}; //# sourceMappingURL=sidebar-move.d.ts.map