import "./reorder_list.css"; import { type PointerEvent, type ReactNode } from "react"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type StyleProps } from "./style_props"; /** Spread onto the row's grip; `ReorderItem` does it. */ export interface ReorderDragHandleProps { onPointerDown: (event: PointerEvent) => void; onPointerMove: (event: PointerEvent) => void; onPointerUp: (event: PointerEvent) => void; onPointerCancel: (event: PointerEvent) => void; } /** Everything a row needs to reorder, passed to `ReorderItem`. The move pair is the only non-pointer way * to reorder (WCAG 2.1.1), so every consumer gets it; a grip without the pair is a defect. */ export interface ReorderControls { /** Null for a buttons list, whose row draws the rail. */ dragHandleProps: ReorderDragHandleProps | null; /** Null at the top; the control renders disabled. */ moveUp: (() => void) | null; moveDown: (() => void) | null; } export interface ReorderRow { item: T; index: number; isDragging: boolean; reorder: ReorderControls; } interface ReorderListBase extends StyleProps { testID?: string; data: T[]; /** Keyed by index, a row loses its place mid-drag. */ keyExtractor: (item: T, index: number) => string; renderItem: (row: ReorderRow) => ReactNode; /** The whole new order. */ onReorder: (data: T[]) => void; ref?: React.Ref; render?: useRender.RenderProp; } /** A drag list: rows wear a grip, and the fixed row height is stated because the drag reads it. */ interface ReorderListDragProps extends ReorderListBase { reorder?: "drag"; /** Measurements, not rungs, because a drop target is pointer travel over one row's total height. Take * the gap from the 8-grid (`SPACE`, `@lotics/ui/spacing`). */ gap?: number; itemHeight: number; /** The hold before a drag starts, so a click is not a drag; 0 where the grip does nothing else. */ activationDelay?: number; } /** A buttons list: an ordered run whose order is data (route stops, an approval chain), moved by each * row's pair and drawn as one rail. Rows size to content with no gap, so the rail reaches the next row. */ interface ReorderListButtonsProps extends ReorderListBase { reorder: "buttons"; gap?: never; itemHeight?: never; activationDelay?: never; } export type ReorderListProps = ReorderListDragProps | ReorderListButtonsProps; /** A list whose order the reader sets, by grip or by each row's pair, via one `reorder` bundle. A drag * list renders in data order and moves rows by transform, so nothing reflows mid-gesture and the opened * slot previews the drop; a buttons list draws the rail and sizes rows to content. It owns no data: * `onReorder` gets the new array and nothing moves until the caller's state returns. A read-only run is a * plain list; a feed is a `Timeline`. */ export declare function ReorderList(props: ReorderListProps): React.ReactElement>; export {};