@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
79 lines (78 loc) • 2.33 kB
TypeScript
import { HTMLProps, PropGetter } from "../../core/components/index.types.js";
import "../../core/index.js";
import * as react2629 from "react";
//#region src/components/pagination/use-pagination.d.ts
type Page = "ellipsis" | number;
interface PaginationContext extends Omit<UsePaginationReturn, "getRootProps"> {}
declare const PaginationContext: react2629.Context<PaginationContext>, usePaginationContext: () => PaginationContext;
interface UsePaginationProps extends Omit<HTMLProps, "onChange" | "page"> {
/**
* The total number of pages in pagination.
*/
total: number;
/**
* Number of elements visible on the left/right edges.
*
* @default 1
*/
boundaries?: number;
/**
* The initial page of the pagination.
* Should be less than `total` and greater than `1`.
*
* @default 1
*/
defaultPage?: number;
/**
* If `true`, the pagination all item will be disabled.
*
* @default false
*/
disabled?: boolean;
/**
* The page of the pagination.
* Should be less than `total` and greater than `1`.
*/
page?: number;
/** Number of siblings displayed on the left/right side of selected page.
*
* @default 1
*/
siblings?: number;
/**
* The callback invoked when the page changes.
*/
onChange?: (page: number) => void;
}
declare const usePagination: ({
boundaries,
defaultPage,
disabled,
page,
siblings,
total,
onChange: onChangeProp,
...rest
}: UsePaginationProps) => {
currentPage: number;
disabled: boolean;
range: Page[];
total: number;
getEndTriggerProps: PropGetter<"button", undefined, undefined>;
getItemProps: PropGetter<"button", {
page?: Page;
}, undefined>;
getNextTriggerProps: PropGetter<"button", undefined, undefined>;
getPrevTriggerProps: PropGetter<"button", undefined, undefined>;
getRootProps: PropGetter<"div", undefined, undefined>;
getStartTriggerProps: PropGetter<"button", undefined, undefined>;
onChange: (page: number) => void;
onChangeEnd: () => void;
onChangeNext: () => void;
onChangePrev: () => void;
onChangeStart: () => void;
};
type UsePaginationReturn = ReturnType<typeof usePagination>;
//#endregion
export { Page, PaginationContext, UsePaginationProps, UsePaginationReturn, usePagination, usePaginationContext };
//# sourceMappingURL=use-pagination.d.ts.map