UNPKG

@yamada-ui/pagination

Version:

Yamada UI pagination component

71 lines (68 loc) 2.08 kB
import * as react from 'react'; import { Token, CSSUIObject } from '@yamada-ui/core'; interface PaginationContext { [key: string]: CSSUIObject | undefined; } declare const PaginationProvider: react.Provider<PaginationContext>; declare const usePaginationContext: () => PaginationContext; declare const computedRange: (start: number, end: number) => number[]; interface UsePaginationProps { /** * The total number of pages in pagination. */ total: number; /** * Number of elements visible on the left/right edges. * * @default 1 */ boundaries?: Token<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; /** * If `true`, the pagination all item will be disabled. * * @default false * * @deprecated Use `disabled` instead. */ isDisabled?: 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?: Token<number>; /** * The callback invoked when the page changes. */ onChange?: (page: number) => void; } declare const usePagination: ({ boundaries: _boundaries, defaultPage, isDisabled, disabled, page, siblings: _siblings, total, onChange: onChangeProp, }: UsePaginationProps) => { currentPage: number; disabled: boolean; range: (number | "ellipsis")[]; total: number; onChange: (page: number) => void; onFirst: () => void; onLast: () => void; onNext: () => void; onPrev: () => void; }; type UsePaginationReturn = ReturnType<typeof usePagination>; export { PaginationProvider, type UsePaginationProps, type UsePaginationReturn, computedRange, usePagination, usePaginationContext };