import { type ComponentProps, type ReactNode, type RefObject } from 'react'; import { type PaginationState } from '../core/pagination.js'; /** * Unstyled Carbon `Pagination` (core/pagination), the behaviour of the styled Pagination without a * single class: `Root` holds the page, the page size and the total; a `PageSizeSelect` (a new size * goes back to page 1, as Carbon), a `PageSelect` ("page N" of the known pages) and `Prev` / `Next`. * Reaching the first or last page with an arrow moves focus to the other one (the pressed one is * disabled now), as Carbon. With `pagesUnknown` there is no page select and Next disables only with * `isLastPage`. `usePaginationContext()` gives the range (`min`, `max`), the page count and more for * the texts. * * State shows as data attributes to style on: `data-disabled` on `Root`, the selects and the buttons. * * ```tsx * * * ‹ * › * * ``` */ export interface PaginationChange { page: number; pageSize: number; } export interface RootProps extends Omit, 'onChange' | 'defaultValue'> { /** 1-based (controlled). */ page?: number; defaultPage?: number; pageSize?: number; defaultPageSize?: number; totalItems?: number; /** Cursor-based APIs: no page count, Next stops only with `isLastPage`. */ pagesUnknown?: boolean; /** With `pagesUnknown`: this is the last page. */ isLastPage?: boolean; /** Every select and button disabled. */ disabled?: boolean; /** After the user changed the page or the page size. */ onChange?: (change: PaginationChange) => void; } interface PaginationContextValue { state: PaginationState; page: number; pageSize: number; totalItems: number; /** The known pages (at least 1; the total counted even with `pagesUnknown`). */ pageCount: number; /** The first and last item number the page shows. */ min: number; max: number; atFirst: boolean; atLast: boolean; pagesUnknown: boolean; disabled: boolean; /** Goes to `page` (kept within the pages). */ goTo: (page: number) => void; /** A new page size: back to page 1. */ setPageSize: (pageSize: number) => void; /** Steps one page with an arrow (focus moves to the other arrow at an end). */ step: (delta: 1 | -1) => void; prev: RefObject; next: RefObject; } /** The state of the enclosing `Pagination.Root` (page, page size, range, ends …). */ export declare function usePaginationContext(part?: string): PaginationContextValue; export declare function Root({ page, defaultPage, pageSize, defaultPageSize, totalItems, pagesUnknown, isLastPage, disabled, onChange, children, ...rest }: Readonly): import("react").JSX.Element; export interface PageSizeSelectProps extends Omit, 'value' | 'defaultValue'> { /** The choices (each an `