forked from AdeleD/react-paginate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
247 lines (204 loc) · 6.2 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// Type definitions for react-paginate 8.0.1
import * as React from 'react';
export interface ReactPaginateProps {
/**
* The total number of pages.
*/
pageCount: number;
/**
* The range of pages displayed.
* Default to 2.
*/
pageRangeDisplayed?: number | undefined;
/**
* The number of pages to display for margins.
* Default to 3.
*/
marginPagesDisplayed?: number | undefined;
/**
* Label for the `previous` button.
*/
previousLabel?: string | React.ReactNode | undefined;
/**
* Aria label for the `previous` button.
*/
previousAriaLabel?: string | undefined;
/**
* The `rel` property on the `a` tag just before the selected page.
* Default value `prev`. Set to `null` to disable.
*/
prevPageRel?: string | null | undefined;
/**
* The `rel` property on the `a` tag for the prev page control.
* Default value `prev`. Set to `null` to disable.
*/
prevRel?: string | null | undefined;
/**
* Label for the `next` button.
*/
nextLabel?: string | React.ReactNode | undefined;
/**
* Aria label for the `next` button.
*/
nextAriaLabel?: string | undefined;
/**
* The `rel` property on the `a` tag just after the selected page.
* Default value `next`. Set to `null` to disable.
*/
nextPageRel?: string | null | undefined;
/**
* The `rel` property on the `a` tag for the next page control.
* Default value `next`. Set to `null` to disable.
*/
nextRel?: string | null | undefined;
/**
* Label for ellipsis.
*/
breakLabel?: string | React.ReactNode | undefined;
/**
* The classname on tag `li` of the ellipsis element.
*/
breakClassName?: string | undefined;
/**
* The classname on tag `a` of the ellipsis element.
*/
breakLinkClassName?: string | undefined;
/**
* The method to call when a page is clicked. Exposes the current page object as an argument.
*/
onPageChange?(selectedItem: { selected: number }): void;
/**
* The method to call when an active page is clicked. Exposes the active page object as an argument.
*/
onPageActive?(selectedItem: { selected: number }): void;
/**
* The method to call when an active page is clicked. Exposes the active page object as an argument.
*/
onClick?(clickEvent: {
index: number | null;
selected: number;
nextSelectedPage: number | undefined;
event: object;
isPrevious: boolean;
isNext: boolean;
isBreak: boolean;
isActive: boolean;
}): boolean | number | void;
/**
* The initial page selected.
*/
initialPage?: number | undefined;
/**
* To override selected page with parent prop.
*
* Use this if you want to [control](https://reactjs.org/docs/forms.html#controlled-components) the page from your app state.
*/
forcePage?: number | undefined;
/**
* Disable onPageChange callback with initial page.
* Default: false
*/
disableInitialCallback?: boolean | undefined;
/**
* Same as `containerClassName`.
* For use with [styled-components](https://styled-components.com/) & other CSS-in-JS.
*/
className?: string | undefined;
/**
* The classname of the pagination container.
*/
containerClassName?: string | undefined;
/**
* The classname on tag `li` of each page element.
*/
pageClassName?: string | undefined;
/**
* The classname on tag `a` of each page element.
*/
pageLinkClassName?: string | undefined;
/**
* Function to set the text on page links. Defaults to `(page) => page`
*/
pageLabelBuilder?(page: number): string | React.ReactNode;
/**
* The classname for the active page.
*/
activeClassName?: string | undefined;
/**
* The classname for the active link.
*/
activeLinkClassName?: string | undefined;
/**
* The classname on tag `li` of the `previous` button.
*/
previousClassName?: string | undefined;
/**
* The classname on tag `li` of the `next` button.
*/
nextClassName?: string | undefined;
/**
* The classname on tag `a` of the `previous` button.
*/
previousLinkClassName?: string | undefined;
/**
* The classname on tag `a` of the `next` button.
*/
nextLinkClassName?: string | undefined;
/**
* The classname for disabled `previous` and `next` buttons.
*/
disabledClassName?: string | undefined;
/**
* The classname on tag `a` for disabled `previous` and `next` buttons.
*/
disabledLinkClassName?: string | undefined;
/**
* The method is called to generate the href attribute value on tag a of each page element.
*/
hrefBuilder?(
pageIndex: number,
pageCount: number,
selectedPage: number
): void;
/**
* By default the `hrefBuilder` add `href` only to active controls.
* Set this prop to `true` so `href` are generated on all controls
* ([see](https://github.com/AdeleD/react-paginate/issues/242))
* Default to `false`
*/
hrefAllControls?: boolean | undefined;
/**
* Extra context to add to the aria-label HTML attribute.
*/
extraAriaContext?: string | undefined;
/**
* The method is called to generate the `aria-label` attribute value on each page link
*/
ariaLabelBuilder?(pageIndex: number, selectedPage: number): void;
/**
* By default the pagination link will have an 'aria-label' attribute of 'Jump forward'
* when the break is after the current index, and an 'aria-label' attribute of 'Jump
* backward' when the break is before the current index. This optional prop can be used
* to provide alternative 'aria-label' attributes.
*/
breakAriaLabels?: {
forward: string;
backward: string;
};
/**
* The event to listen onto before changing the selected page. Default is: `onClick`.
*/
eventListener?: string | undefined;
/**
* A render function called when `pageCount` is zero. Let the Previous / Next buttons displayed by default (`undefined`).
* Display nothing when `null` is provided.
*/
renderOnZeroPageCount?: ((props: ReactPaginateProps) => void) | null;
/**
* The `rel` propery on the `a` tag for the selected page.
* Default value `canonical`. Set to `null` to disable.
*/
selectedPageRel?: string | null | undefined;
}
declare const ReactPaginate: React.ComponentClass<ReactPaginateProps>;
export default ReactPaginate;