import { UseTreeReturn } from './useTree';
import { UseTreeLoaderReturn } from './useTreeLoader';
/**
 * Options for {@link useTreeLazyCascade}.
 *
 * @property tree - Tree state from useTree, used to read nodes and run toggles.
 * @property loader - Tree loader, used to lazy-load unloaded descendants.
 * @property isSingleSelect - Whether the consumer is in single-select mode; controls auto-close after a successful toggle.
 * @property branchesSelectable - Whether branch nodes can be selected (vs only expanded).
 * @property leavesSelectable - Whether leaf nodes can be selected.
 * @property emptyBranchesSelectable - Whether branches with an empty children array can be selected.
 * @property readOnly - When true, all toggle attempts no-op.
 * @property onCloseAfterSingleSelect - Called after a successful single-select toggle so the consumer can close its menu and restore focus.
 */
export type UseTreeLazyCascadeOptions = {
    tree: UseTreeReturn;
    loader: UseTreeLoaderReturn;
    isSingleSelect: boolean;
    branchesSelectable: boolean;
    leavesSelectable: boolean;
    emptyBranchesSelectable: boolean;
    readOnly?: boolean;
    onCloseAfterSingleSelect?: () => void;
};
/**
 * Return value of {@link useTreeLazyCascade}.
 *
 * @property handleToggleNode - Click/Space handler for a tree row that respects selectability and loads any unloaded descendants before cascading.
 * @property pendingToggleNodeId - The id of the node currently waiting on lazy loads to complete (used to render a loading checkbox), or null.
 * @property reset - Clears any in-flight pending toggle. Call from the consumer's closeMenu so reopening starts clean.
 */
export type UseTreeLazyCascadeReturn = {
    handleToggleNode: (nodeId: string | number) => void;
    pendingToggleNodeId: string | number | null;
    reset: () => void;
};
/**
 * Coordinates "toggle a tree node, but lazy-load any unloaded descendants
 * first" — the bit of orchestration that sits between useTree and
 * useTreeLoader and is shared between TreeSelectField and TreeSelectMenu.
 *
 * When the consumer clicks a branch whose subtree isn't fully loaded, the
 * hook records the pending toggle, kicks off loadChildren for every
 * unloaded descendant, and then — once all loads are complete — fires
 * tree.toggleNode so cascade selection can run against the now-complete
 * subtree. While loads are in flight, pendingToggleNodeId points at the
 * originally-clicked node so the consumer can render a loading state on
 * its checkbox.
 *
 * Non-selectable branches expand instead of toggling; non-selectable
 * leaves no-op. Read-only consumers can pass readOnly to short-circuit.
 *
 * @param options - See {@link UseTreeLazyCascadeOptions}.
 * @returns Toggle handler, current pending node id, and a reset function.
 */
export declare function useTreeLazyCascade(options: UseTreeLazyCascadeOptions): UseTreeLazyCascadeReturn;
