1 | import * as React from 'react';
|
2 |
|
3 | export interface UsePaginationProps {
|
4 | /**
|
5 | * Number of always visible pages at the beginning and end.
|
6 | * @default 1
|
7 | */
|
8 | boundaryCount?: number;
|
9 | /**
|
10 | * The name of the component where this hook is used.
|
11 | */
|
12 | componentName?: string;
|
13 | /**
|
14 | * The total number of pages.
|
15 | * @default 1
|
16 | */
|
17 | count?: number;
|
18 | /**
|
19 | * The page selected by default when the component is uncontrolled.
|
20 | * @default 1
|
21 | */
|
22 | defaultPage?: number;
|
23 | /**
|
24 | * If `true`, the pagination component will be disabled.
|
25 | * @default false
|
26 | */
|
27 | disabled?: boolean;
|
28 | /**
|
29 | * If `true`, hide the next-page button.
|
30 | * @default false
|
31 | */
|
32 | hideNextButton?: boolean;
|
33 | /**
|
34 | * If `true`, hide the previous-page button.
|
35 | * @default false
|
36 | */
|
37 | hidePrevButton?: boolean;
|
38 | /**
|
39 | * Callback fired when the page is changed.
|
40 | *
|
41 | * @param {object} event The event source of the callback.
|
42 | * @param {number} page The page selected.
|
43 | */
|
44 | onChange?: (event: React.ChangeEvent<unknown>, page: number) => void;
|
45 | /**
|
46 | * The current page.
|
47 | */
|
48 | page?: number;
|
49 | /**
|
50 | * If `true`, show the first-page button.
|
51 | * @default false
|
52 | */
|
53 | showFirstButton?: boolean;
|
54 | /**
|
55 | * If `true`, show the last-page button.
|
56 | * @default false
|
57 | */
|
58 | showLastButton?: boolean;
|
59 | /**
|
60 | * Number of always visible pages before and after the current page.
|
61 | * @default 1
|
62 | */
|
63 | siblingCount?: number;
|
64 | }
|
65 |
|
66 | export interface UsePaginationItem {
|
67 | onClick: React.ReactEventHandler;
|
68 | type: 'page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis';
|
69 | page: number;
|
70 | selected: boolean;
|
71 | disabled: boolean;
|
72 | }
|
73 |
|
74 | export interface UsePaginationResult {
|
75 | items: UsePaginationItem[];
|
76 | }
|
77 |
|
78 | export default function usePagination(props: UsePaginationProps): UsePaginationResult;
|