import * as React from 'react'; type WithIndex = T & { index: number; }; type DescendantContextProvider = React.FC[]; onItemsChange?: (i: WithIndex[] | ((prev: WithIndex[]) => WithIndex[])) => void; }>>; type UseDescendantsHook = (childName: string) => WithIndex[]; type UseDescendantHook = (childName: string, descendant: T) => WithIndex<{}>; /** * Creates new context for registering descendants and returns a tuple with: * - `DescendantsProvider`: provide state to a collection of descendants * - `useDescendants`: hook for getting descendants * - `useDescendant`: hook for registering a descendant and retrieving its index */ declare function createDescendantContext(rootName: string, defaultContext?: DescendantContextValue): [ DescendantContextProvider, UseDescendantsHook, UseDescendantHook ]; interface DescendantContextValue { descendants: WithIndex[]; register(descendant: T): void; } type Descendant = { ref: React.MutableRefObject; }; export { Descendant, DescendantContextValue, createDescendantContext };