/**
 * @file useTableGroupedRows.tsx
 * @input React, StyleX, Icon, Table types + the flat data array
 * @output Exports useTableGroupedRows hook + config/result types
 * @position Grouped-rows plugin; consumed by Table via plugins prop
 *
 * SYNC: When modified, update these files to stay in sync:
 * - /packages/core/src/Table/index.ts (exports)
 */
import { type ReactNode } from 'react';
import type { TablePlugin } from '../../types';
/** Configuration for {@link useTableGroupedRows}. */
export interface UseTableGroupedRowsConfig<T extends Record<string, unknown>> {
    /** The flat data to group. */
    data: T[];
    /** Derive the group key for a row. Rows with the same key share a section. */
    groupBy: (item: T) => string;
    /** Set of currently-collapsed group keys. */
    collapsedGroups: Set<string>;
    /** Called with a group key when its header is toggled. */
    onToggleGroup: (groupKey: string) => void;
    /**
     * Custom renderer for a group header's content (right of the chevron).
     * Defaults to `<groupKey> (<count>)`.
     */
    renderGroupHeader?: (groupKey: string, count: number, collapsed: boolean) => ReactNode;
    /** Stable key for a real row. Falls back to a positional key when omitted. */
    getRowKey?: (item: T) => string;
    /** Explicit group ordering; groups not listed keep first-seen order after these. */
    groupOrder?: string[];
}
export interface UseTableGroupedRowsResult<T extends Record<string, unknown>> {
    /** Ready-to-use plugin for `<Table plugins>`. */
    plugin: TablePlugin<T>;
    /** Flattened rows: `[header, ...visibleRows, header, ...visibleRows]`. */
    data: T[];
    /**
     * Row-key resolver (also keys synthetic headers as `__group_<key>`). Pass to
     * `<Table idKey>` — named for parallelism with the Table prop:
     * `<Table idKey={grouped.idKey} />`.
     */
    idKey: (item: T) => string;
}
/**
 * Groups a flat data array into collapsible section rows. Each distinct
 * `groupBy` value becomes a full-width section-header row with a chevron
 * toggle, the group label, and a member count; collapsing hides that group's
 * data rows while keeping the header visible.
 *
 * Mirrors other controlled Table state helpers: the consumer owns the
 * `collapsedGroups` set and this hook returns `{data, plugin, idKey}` —
 * pass all three to `<Table>`.
 *
 * @example
 * ```
 * const [collapsed, setCollapsed] = useState<Set<string>>(new Set());
 * const grouped = useTableGroupedRows({
 *   data: rows,
 *   groupBy: r => r.team,
 *   collapsedGroups: collapsed,
 *   onToggleGroup: key =>
 *     setCollapsed(prev => {
 *       const next = new Set(prev);
 *       next.has(key) ? next.delete(key) : next.add(key);
 *       return next;
 *     }),
 *   getRowKey: r => r.id,
 * });
 * <Table
 *   data={grouped.data}
 *   columns={columns}
 *   idKey={grouped.idKey}
 *   plugins={{grouped: grouped.plugin}}
 * />;
 * ```
 */
export declare function useTableGroupedRows<T extends Record<string, unknown>>(config: UseTableGroupedRowsConfig<T>): UseTableGroupedRowsResult<T>;
//# sourceMappingURL=useTableGroupedRows.d.ts.map