import { useTableState as useStatelyTableState, TableStateProps as StatelyTableStateProps, } from "@react-stately/table"; import { TableState } from "../Table.types"; import { TableStateExtensionsProps, useTableStateExtensions, } from "./useTableStateExtensions"; import { TableCollection } from '../TableCollection'; export interface TableStateProps extends Omit, "children" | "collection">, TableStateExtensionsProps { children?: React.ReactNode; collection: TableCollection; } export function useTableState( props: TableStateProps ): TableState { const state = useStatelyTableState(props as StatelyTableStateProps); const stateExtensions = useTableStateExtensions(props, state); return { ...state, ...stateExtensions, collection: props.collection, }; }