import "./sort_header.css"; import type * as React from "react"; import { Button as Base } from "@base-ui/react/button"; import { type StyleProps } from "./style_props"; export type SortDir = "asc" | "desc"; export interface SortState { key: string; dir: SortDir; } /** * Cycle a SINGLE-column sort on press: none → asc → desc → none (the third * toggle clears it). The parent holds one `SortState | null`. */ export declare function cycleSort(current: SortState | null, key: string): SortState | null; /** * Order a COPY of `items` by the active column. `getValue` maps (item, key) to a * comparable. Returns `items` unchanged when nothing is sorted. * * Strings are compared with `localeCompare`, NOT `<`/`>`: those order by code * point, which puts every accented letter after the whole unaccented alphabet. */ export declare function sortBy(items: T[], sort: SortState | null, getValue: (item: T, key: string) => string | number): T[]; /** * Localizable a11y fragments for `SortHeader` — only the screen-reader * announcement is built here. Omit any field to keep the English default. */ export interface SortHeaderLabels { /** a11y prefix around the column label. Default `(label) => `Sort by ${label}``. */ sortBy?: (label: string) => string; /** Appended when sorted ascending. Default ", ascending". */ ascending?: string; /** Appended when sorted descending. Default ", descending". */ descending?: string; } export interface SortHeaderProps extends StyleProps { label: string; sortKey: string; sort: SortState | null; onSort: (key: string) => void; /** Right-align for numeric columns — the arrow then sits LEFT of the label. */ align?: "left" | "right"; /** Override the English a11y strings for localization. Omit to keep defaults. */ labels?: SortHeaderLabels; testID?: string; ref?: React.Ref; render?: Base.Props["render"]; } /** * A sortable column header. Press cycles a single-column sort via `cycleSort`; * the parent orders rows with `sortBy`. */ export declare function SortHeader(props: SortHeaderProps): React.JSX.Element;