import "./reorder_item.css"; import { type ReactNode } from "react"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import type { ReorderControls } from "./reorder_list"; import { type StyleProps } from "./style_props"; /** The rail column (12) plus the row's own gap (10) — the measuring form of the * `buttons` rail geometry, for content that must line up UNDER the rows (an * "Add" button, a caption) rather than beside them. Exported so a caller never * hand-picks a number that drifts from the rail. */ export declare const REORDER_ITEM_INSET = 22; export interface ReorderItemLabels { /** a11y name of the up control, and its tooltip with no label. Default * `Move ${label} up` / `Move up`. */ moveUp?: (label: string | undefined) => string; moveDown?: (label: string | undefined) => string; remove?: (label: string | undefined) => string; } export interface ReorderItemProps extends StyleProps { /** The bundle `ReorderList` hands `renderItem` for this row. It carries the * affordance too: a list that reorders by buttons hands no drag props, and * the row then draws the rail instead of a grip. */ reorder: ReorderControls; /** * What this row IS — the field, app, option or place name. Required, and not * optional for a reason: it is the only thing that tells ten identical "move * up" buttons apart to a screen reader. */ itemLabel: string; /** The row's own content. */ children: ReactNode; /** What this POSITION is, derived by the caller from its index (`Origin`, * `Via`, `Destination`). Derive it, never store it — a stored position lies * the moment the list is reordered. */ positionLabel?: string; /** Width of the position column. Default 74. */ positionWidth?: number; /** * Drop this row. * * Left out, the row draws no ✕ — a list nobody removes from should not carry * a dead control on every row. `null` draws it DISABLED, which is what a row * that cannot go among rows that can takes, so the right edge never jogs * between siblings. */ onRemove?: (() => void) | null; labels?: ReorderItemLabels; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** * ONE ROW of a {@link ReorderList} — the affordance that moves it, its content, * and the controls that reorder or drop it. * * The up/down pair is not a redundant alternative to the grip. A drag has no * keyboard equivalent (WCAG 2.1.1), so without the pair the operation is * unreachable for anyone not using a pointer — and for a pointer user who can * click but cannot hold and drag. It lives HERE, in the row itself, so a caller * cannot render a draggable row and forget it; the pair renders DISABLED at the * ends of the list rather than absent, so the row's right edge never shifts. * * The leading edge is the list's affordance: a grip where the list drags, and * the connected rail where it reorders by buttons — a run whose ORDER is the * data reads as one line through its positions, with no label saying "first". */ export declare function ReorderItem(props: ReorderItemProps): React.ReactElement>;