import * as React from 'react'; import type { Group, GroupSegmentItem } from '../hooks/useGroupSegments'; export type Row = ({ type: 'group'; groupKey: K; } | { type: 'item'; item: T; index: number; }) & { taggedKey: string; }; export interface FlattenRowsResult { rows: Row[]; groupKeys: K[]; groupKeyToItems: Map; } /** * Flatten grouped data into header and item rows. * When grouping is enabled, items follow the insertion order of the group map * while preserving their original indexes. */ export default function useFlattenRows(data: T[], groupData: Map[]>, getItemKey: (item: T, index: number) => React.Key, group?: Group): FlattenRowsResult;