import type { TableSortState, UseTableSortableConfig } from './useTableSortable';
/**
 * Custom comparator for a single sort key.
 * Receives two row values and returns a standard comparison number.
 * Direction (ascending/descending) is applied automatically by the hook —
 * comparators should always sort in ascending order.
 */
export type TableSortComparator<T> = (a: T, b: T) => number;
/**
 * Configuration for useTableSortableState.
 *
 * @template T - The row data type
 * @template TSortKey - Union of valid sort key strings
 *
 * @example
 * ```
 * const { sortedData, sortConfig } = useTableSortableState({
 *   data: users,
 *   defaultSort: [{ sortKey: 'name', direction: 'ascending' }],
 * });
 * const sortPlugin = useTableSortable(sortConfig);
 * <Table data={sortedData} plugins={{ sort: sortPlugin }} />
 * ```
 */
export interface UseTableSortableStateConfig<T extends Record<string, unknown>, TSortKey extends string = string> {
    /**
     * The data array to sort.
     * The hook returns a new sorted copy — the original is never mutated.
     */
    data: T[];
    /**
     * Initial sort state for uncontrolled mode.
     * Ignored when `sort` is provided.
     * @default []
     */
    defaultSort?: TableSortState<TSortKey>;
    /**
     * Controlled sort state. When provided, the hook uses this instead of
     * internal state. Must be paired with `onSortChange`.
     */
    sort?: TableSortState<TSortKey>;
    /**
     * Called when the sort state changes. Required when `sort` is provided.
     */
    onSortChange?: (sort: TableSortState<TSortKey>) => void;
    /**
     * Custom comparators per sort key.
     * Keys are sort key strings; values are comparator functions that receive
     * two row items. Comparators should sort ascending — the hook flips the
     * sign for descending.
     *
     * For keys not in this map, the hook falls back to `localeCompare` with
     * `{ numeric: true }` on the stringified values.
     *
     * @example
     * ```
     * comparators: {
     *   age: (a, b) => a.age - b.age,
     *   name: (a, b) => a.name.localeCompare(b.name),
     * }
     * ```
     */
    comparators?: Partial<Record<TSortKey, TableSortComparator<T>>>;
    /**
     * Allow returning to unsorted state.
     * Passed through to the sortable plugin config.
     * @default true
     */
    allowUnsortedState?: boolean;
    /**
     * Enable multi-sort via modifier key.
     * Passed through to the sortable plugin config.
     * @default false
     */
    isMultiSortEnabled?: boolean;
}
export interface UseTableSortableStateResult<T extends Record<string, unknown>, TSortKey extends string = string> {
    /** Sorted copy of the input data. Memoized — stable when sort state and data don't change. */
    sortedData: T[];
    /** Current sort state. */
    sort: TableSortState<TSortKey>;
    /** Ready-to-use config for useTableSortable. */
    sortConfig: UseTableSortableConfig<TSortKey>;
    /**
     * Apply the current sort state to arbitrary data.
     * Useful when you have multiple data sources or need to sort a subset.
     */
    applySort: (data: T[]) => T[];
}
/**
 * useTableSortableState — manages sort state and applies local sort to data.
 *
 * Convenience layer over useTableSortable. Owns sort state internally
 * (or accepts controlled state), sorts the data, and produces a ready-to-use
 * config for the headless sortable plugin.
 *
 * @example
 * ```
 * const { sortedData, sortConfig } = useTableSortableState({
 *   data: employees,
 *   defaultSort: [{ sortKey: 'name', direction: 'ascending' }],
 *   comparators: { age: (a, b) => a.age - b.age },
 * });
 * const sortPlugin = useTableSortable(sortConfig);
 * <Table data={sortedData} columns={columns} plugins={{ sort: sortPlugin }} />
 * ```
 */
export declare function useTableSortableState<T extends Record<string, unknown>, TSortKey extends string = string>(config: UseTableSortableStateConfig<T, TSortKey>): UseTableSortableStateResult<T, TSortKey>;
//# sourceMappingURL=useTableSortableState.d.ts.map