/// <reference types="react" />
import useAsyncControl from "./useAsyncControl";
type UpdateEvent<I extends any> = {
    finished: boolean;
    items: I[];
    totalItems: number;
};
/**
 * This hook helps manage loading and showing items in pages.
 * It handles fetching new items when the user scrolls or clicks next page,
 * and keeps track of whether all items have been loaded.
 */
export default function usePagination<I extends any>(request: (page: number, pageSize: number | "all", currItems?: I[]) => Promise<UpdateEvent<I>>, paginationId?: object | any[] | (() => string), startingItems?: I[]): Paginable<I>;
export type Paginable<I extends any, E extends any = any> = {
    updateItems: (cb: (prevItems?: I) => UpdateEvent<I>["items"]) => void;
    getNextPage: (pageSize: number) => void;
    refreshCurrentPage: (pageSize: number) => void;
    getPage: (page: number, pageSize: number) => void;
    getAll: () => void;
    totalItems: () => number | undefined;
    loading: boolean;
    error: E | Error | undefined;
    items: I[] | undefined;
    setError: ReturnType<typeof useAsyncControl>["setError"];
    id: () => string;
};
export type LocalPaginable<I extends any, E extends any = any> = Paginable<I, E> & {
    src: I;
};
/**
 * This returns a ref to be bound to an elements so it can be able to detect when a pagination whould occur
 */
export declare function useContainerPagination(cb: (pageSize: number) => void, pageSize: number, direction?: "h" | "v"): {
    scrollableRef: import("react").RefObject<HTMLDivElement | undefined>;
    customOptionsRef: import("react").RefObject<(() => {
        offsetBottom?: number;
        offsetLeft?: number;
    }) | undefined>;
};
/**
 * This function receives an amount of local instances and paginates it
 */
export declare function useLocalPagination<L>(items: L[] | undefined): {
    loading: boolean;
    src: L[] | undefined;
    updateItems: (cb: (prevItems?: L | undefined) => L[]) => void;
    getNextPage: (pageSize: number) => void;
    refreshCurrentPage: (pageSize: number) => void;
    getPage: (page: number, pageSize: number) => void;
    getAll: () => void;
    totalItems: () => number | undefined;
    error: any;
    items: L[] | undefined;
    setError: import("react").Dispatch<unknown>;
    id: () => string;
};
export {};
