best-react-pagination 0.0.1-alpha.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintignore +1 -1
  3. package/.eslintrc.js +3 -1
  4. package/.husky/commit-msg +4 -0
  5. package/.husky/pre-commit +7 -0
  6. package/.lintstagedrc.json +3 -0
  7. package/LICENCE +12 -12
  8. package/README.md +50 -48
  9. package/commitlint.config.js +1 -0
  10. package/demo/public/index.html +17 -17
  11. package/demo/src/App.tsx +19 -10
  12. package/demo/src/Pagination/components/Item/Item.tsx +19 -0
  13. package/demo/src/Pagination/components/Item/index.ts +1 -0
  14. package/demo/src/Pagination/components/ItemList/ItemList.tsx +17 -0
  15. package/demo/src/Pagination/components/ItemList/index.ts +1 -0
  16. package/demo/src/Pagination/components/Wrapper/Wrapper.tsx +17 -0
  17. package/demo/src/Pagination/components/Wrapper/index.ts +1 -0
  18. package/demo/src/Pagination/components/constants.ts +49 -0
  19. package/demo/src/Pagination/components/index.ts +3 -0
  20. package/demo/src/Pagination/components/utils.ts +3 -0
  21. package/demo/src/Pagination/index.tsx +356 -0
  22. package/demo/tsconfig.json +17 -17
  23. package/dist/components/Item/Item.d.ts +10 -0
  24. package/dist/components/Item/index.d.ts +1 -0
  25. package/dist/components/ItemList/ItemList.d.ts +7 -0
  26. package/dist/components/ItemList/index.d.ts +1 -0
  27. package/dist/components/Wrapper/Wrapper.d.ts +7 -0
  28. package/dist/components/Wrapper/index.d.ts +1 -0
  29. package/dist/components/constants.d.ts +9 -0
  30. package/dist/components/index.d.ts +3 -0
  31. package/dist/components/utils.d.ts +1 -0
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.js +1 -1
  34. package/husky.config.js +4 -4
  35. package/lib/components/Item/Item.tsx +19 -0
  36. package/lib/components/Item/index.ts +1 -0
  37. package/lib/components/ItemList/ItemList.tsx +17 -0
  38. package/lib/components/ItemList/index.ts +1 -0
  39. package/lib/components/Wrapper/Wrapper.tsx +17 -0
  40. package/lib/components/Wrapper/index.ts +1 -0
  41. package/lib/components/constants.ts +49 -0
  42. package/lib/components/index.ts +3 -0
  43. package/lib/components/utils.ts +3 -0
  44. package/lib/index.tsx +356 -368
  45. package/package.json +17 -6
  46. package/tsconfig.json +24 -23
  47. package/webpack.config.ts +53 -45
  48. package/demo/src/pagination/index.tsx +0 -369
package/lib/index.tsx CHANGED
@@ -1,368 +1,356 @@
1
- import React, { FC } from "react";
2
-
3
- interface IPagination {
4
- paginationStart: 0 | 1;
5
- currentIndex: number;
6
- totalPages: number;
7
- setIndex: React.Dispatch<React.SetStateAction<number>>;
8
- isDefaultStyles?: boolean;
9
-
10
- wrapperClass?: string;
11
- itemListClass?: string;
12
- itemClass?: string;
13
- selectedItemClass?: string;
14
- disableItemClass?: string;
15
-
16
- className?: string;
17
- }
18
-
19
- const Pagination: FC<IPagination> = ({
20
- paginationStart,
21
- currentIndex,
22
- totalPages,
23
- setIndex,
24
- isDefaultStyles,
25
-
26
- wrapperClass = "",
27
- itemListClass = "",
28
- itemClass = "",
29
- selectedItemClass = "",
30
- disableItemClass = "",
31
- className,
32
- }) => {
33
- const countItems = [1, 2, 3, 4];
34
-
35
- enum defaultStylesEnum {
36
- wrapperClass = "wrapperClass",
37
- itemListClass = "itemListClass",
38
- itemClass = "itemClass",
39
- selectedItemClass = "selectedItemClass",
40
- disableItemClass = "disableItemClass",
41
- }
42
-
43
- const defaultStyles: Record<defaultStylesEnum, React.CSSProperties> = {
44
- wrapperClass: {
45
- position: "sticky",
46
- display: "flex",
47
- justifyContent: "center",
48
- alignItems: "center",
49
- width: "100%",
50
- bottom: 0,
51
- },
52
- itemListClass: {
53
- padding: "10px 0",
54
- },
55
- itemClass: {
56
- display: "inline",
57
- cursor: "pointer",
58
- padding: "6px 12px",
59
- borderRadius: "4px",
60
- margin: "0 2px",
61
- backgroundColor: "#45c954",
62
- },
63
- selectedItemClass: {
64
- display: "inline",
65
- cursor: "pointer",
66
- padding: "6px 12px",
67
- borderRadius: "4px",
68
- margin: "0 2px",
69
- backgroundColor: "#48bbff",
70
- },
71
- disableItemClass: {
72
- display: "inline",
73
- cursor: "not-allowed",
74
- padding: "6px 12px",
75
- borderRadius: "4px",
76
- margin: "0 2px",
77
- },
78
- };
79
-
80
- if (totalPages <= 1) {
81
- return (
82
- <div
83
- className={wrapperClass}
84
- style={isDefaultStyles ? defaultStyles.wrapperClass : undefined}
85
- >
86
- <ul
87
- className={itemListClass}
88
- style={isDefaultStyles ? defaultStyles.itemListClass : undefined}
89
- >
90
- <li
91
- className={disableItemClass}
92
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
93
- >{`<<`}</li>
94
- <li
95
- className={disableItemClass}
96
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
97
- >{`>>`}</li>
98
- </ul>
99
- </div>
100
- );
101
- }
102
-
103
- if (totalPages > 1 && totalPages < 4) {
104
- return (
105
- <div
106
- className={wrapperClass}
107
- style={isDefaultStyles ? defaultStyles.wrapperClass : undefined}
108
- >
109
- <ul
110
- className={itemListClass}
111
- style={isDefaultStyles ? defaultStyles.itemListClass : undefined}
112
- >
113
- {[1, 2, 3].map((el) => {
114
- const index = paginationStart === 0 ? el - 1 : el;
115
- if (currentIndex === index) {
116
- return (
117
- <li
118
- className={selectedItemClass}
119
- style={
120
- isDefaultStyles
121
- ? defaultStyles.selectedItemClass
122
- : undefined
123
- }
124
- key={el}
125
- >
126
- {el}
127
- </li>
128
- );
129
- }
130
- return (
131
- <li
132
- className={selectedItemClass}
133
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
134
- key={el}
135
- onClick={() => setIndex(index)}
136
- >
137
- {el}
138
- </li>
139
- );
140
- })}
141
- </ul>
142
- </div>
143
- );
144
- }
145
-
146
- if (totalPages === 4) {
147
- return (
148
- <div
149
- className={wrapperClass}
150
- style={isDefaultStyles ? defaultStyles.wrapperClass : undefined}
151
- >
152
- <ul
153
- className={itemListClass}
154
- style={isDefaultStyles ? defaultStyles.itemListClass : undefined}
155
- >
156
- {currentIndex > (paginationStart === 0 ? 0 : 1) ? (
157
- <li
158
- className={itemClass}
159
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
160
- onClick={() => setIndex(currentIndex - 1)}
161
- >{`<<`}</li>
162
- ) : (
163
- <li
164
- className={disableItemClass}
165
- style={
166
- isDefaultStyles ? defaultStyles.disableItemClass : undefined
167
- }
168
- >{`<<`}</li>
169
- )}
170
- {countItems.map((el) => {
171
- const index = paginationStart === 0 ? el - 1 : el;
172
- if (currentIndex === index) {
173
- return (
174
- <li
175
- className={selectedItemClass}
176
- style={
177
- isDefaultStyles
178
- ? defaultStyles.selectedItemClass
179
- : undefined
180
- }
181
- key={el}
182
- >
183
- {el}
184
- </li>
185
- );
186
- }
187
- return (
188
- <li
189
- className={selectedItemClass}
190
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
191
- key={el}
192
- onClick={() => setIndex(index)}
193
- >
194
- {el}
195
- </li>
196
- );
197
- })}
198
- {currentIndex < (paginationStart === 0 ? 3 : 4) ? (
199
- <li
200
- className={itemClass}
201
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
202
- >{`>>`}</li>
203
- ) : (
204
- <li
205
- className={disableItemClass}
206
- style={
207
- isDefaultStyles ? defaultStyles.disableItemClass : undefined
208
- }
209
- >{`>>`}</li>
210
- )}
211
- </ul>
212
- </div>
213
- );
214
- }
215
-
216
- return (
217
- <>
218
- <div
219
- className={wrapperClass && className}
220
- style={isDefaultStyles ? defaultStyles.wrapperClass : undefined}
221
- >
222
- <ul
223
- className={itemListClass}
224
- style={isDefaultStyles ? defaultStyles.itemListClass : undefined}
225
- >
226
- {/*Previous button*/}
227
- {currentIndex > (paginationStart === 0 ? 0 : 1) ? (
228
- <li
229
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
230
- onClick={() => setIndex(currentIndex - 1)}
231
- >{`<<`}</li>
232
- ) : (
233
- <li
234
- className={disableItemClass}
235
- style={
236
- isDefaultStyles ? defaultStyles.disableItemClass : undefined
237
- }
238
- >{`<<`}</li>
239
- )}
240
- {/*First page button*/}
241
- {currentIndex > (paginationStart == 0 ? 2 : 3) ? (
242
- <li
243
- className={itemClass}
244
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
245
- onClick={() => setIndex(paginationStart === 0 ? 0 : 1)}
246
- >{`1`}</li>
247
- ) : null}
248
-
249
- {currentIndex < (paginationStart === 0 ? 3 : 4)
250
- ? countItems.map((el) => {
251
- if (
252
- paginationStart === 0 ? currentIndex + 1 : currentIndex === el
253
- ) {
254
- return (
255
- <li
256
- className={selectedItemClass}
257
- style={
258
- isDefaultStyles
259
- ? defaultStyles.selectedItemClass
260
- : undefined
261
- }
262
- key={el}
263
- >
264
- {el}
265
- </li>
266
- );
267
- }
268
- return (
269
- <li
270
- className={itemClass}
271
- style={
272
- isDefaultStyles ? defaultStyles.itemClass : undefined
273
- }
274
- onClick={() =>
275
- setIndex(paginationStart === 0 ? el - 1 : el)
276
- }
277
- key={el}
278
- >
279
- {el}
280
- </li>
281
- );
282
- })
283
- : null}
284
-
285
- {currentIndex > (paginationStart === 0 ? 2 : 3) ? (
286
- <li
287
- className={disableItemClass}
288
- style={
289
- isDefaultStyles ? defaultStyles.disableItemClass : undefined
290
- }
291
- >{`...`}</li>
292
- ) : null}
293
-
294
- {currentIndex > (paginationStart === 0 ? 2 : 3) &&
295
- (paginationStart === 0 ? currentIndex : currentIndex - 1) <
296
- totalPages ? (
297
- <>
298
- <li
299
- className={itemClass}
300
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
301
- onClick={() => setIndex(currentIndex - 1)}
302
- >
303
- {paginationStart === 0 ? currentIndex : currentIndex - 1}
304
- </li>
305
- <li
306
- className={selectedItemClass}
307
- style={
308
- isDefaultStyles ? defaultStyles.selectedItemClass : undefined
309
- }
310
- >
311
- {paginationStart === 0 ? currentIndex + 1 : currentIndex}
312
- </li>
313
- {currentIndex <
314
- (paginationStart === 0 ? totalPages - 1 : totalPages) ? (
315
- <li
316
- className={itemClass}
317
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
318
- onClick={() => setIndex(currentIndex + 1)}
319
- >
320
- {paginationStart === 0 ? currentIndex + 2 : currentIndex + 1}
321
- </li>
322
- ) : null}
323
- </>
324
- ) : null}
325
-
326
- {currentIndex <
327
- (paginationStart === 0 ? totalPages - 3 : totalPages - 2) ? (
328
- <li
329
- className={disableItemClass}
330
- style={
331
- isDefaultStyles ? defaultStyles.disableItemClass : undefined
332
- }
333
- >{`...`}</li>
334
- ) : null}
335
-
336
- {currentIndex <
337
- (paginationStart === 0 ? totalPages - 3 : totalPages - 2) ? (
338
- <li
339
- className={itemClass}
340
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
341
- onClick={() => setIndex(totalPages - 1)}
342
- >
343
- {totalPages}
344
- </li>
345
- ) : null}
346
-
347
- {(paginationStart === 0 ? currentIndex + 1 : currentIndex) <
348
- totalPages ? (
349
- <li
350
- className={itemClass}
351
- style={isDefaultStyles ? defaultStyles.itemClass : undefined}
352
- onClick={() => setIndex(currentIndex + 1)}
353
- >{`>>`}</li>
354
- ) : (
355
- <li
356
- className={disableItemClass}
357
- style={
358
- isDefaultStyles ? defaultStyles.disableItemClass : undefined
359
- }
360
- >{`>>`}</li>
361
- )}
362
- </ul>
363
- </div>
364
- </>
365
- );
366
- };
367
-
368
- export default Pagination;
1
+ import React, { FC } from "react";
2
+ import { defaultStylesEnum } from "./components/constants";
3
+ import { Item, ItemList, Wrapper } from "./components";
4
+ import { range } from "./components/utils";
5
+
6
+ interface PaginationProps {
7
+ paginationStart: 0 | 1;
8
+ currentIndex: number;
9
+ totalPages: number;
10
+ setIndex: React.Dispatch<React.SetStateAction<number>>;
11
+ isDefaultStyles?: boolean;
12
+
13
+ wrapperClass?: string;
14
+ itemListClass?: string;
15
+ itemClass?: string;
16
+ selectedItemClass?: string;
17
+ disableItemClass?: string;
18
+
19
+ className?: string;
20
+ }
21
+
22
+ const Pagination: FC<PaginationProps> = ({
23
+ paginationStart,
24
+ currentIndex,
25
+ totalPages,
26
+ setIndex,
27
+ isDefaultStyles,
28
+
29
+ wrapperClass = "",
30
+ itemListClass = "",
31
+ itemClass = "",
32
+ selectedItemClass = "",
33
+ disableItemClass = "",
34
+ className,
35
+ }) => {
36
+ if (totalPages <= 1) {
37
+ return (
38
+ <Wrapper wrapperClass={className ? className : wrapperClass} isDefaultStyles={isDefaultStyles}>
39
+ <ItemList itemListClass={itemListClass} isDefaultStyles={isDefaultStyles}>
40
+ <Item
41
+ itemClass={disableItemClass}
42
+ itemStyle={defaultStylesEnum.disableItemClass}
43
+ isDefaultStyles={isDefaultStyles}
44
+ >
45
+ {`<<`}
46
+ </Item>
47
+
48
+ <Item
49
+ itemClass={disableItemClass}
50
+ itemStyle={defaultStylesEnum.disableItemClass}
51
+ isDefaultStyles={isDefaultStyles}
52
+ >
53
+ 1
54
+ </Item>
55
+
56
+ <Item
57
+ itemClass={disableItemClass}
58
+ itemStyle={defaultStylesEnum.disableItemClass}
59
+ isDefaultStyles={isDefaultStyles}
60
+ >
61
+ {`>>`}
62
+ </Item>
63
+ </ItemList>
64
+ </Wrapper>
65
+ );
66
+ }
67
+
68
+ if (totalPages > 1 && totalPages < 4) {
69
+ return (
70
+ <Wrapper wrapperClass={className ? className : wrapperClass} isDefaultStyles={isDefaultStyles}>
71
+ <ItemList itemListClass={itemListClass} isDefaultStyles={isDefaultStyles}>
72
+ {range(totalPages).map((el) => {
73
+ const index = paginationStart === 0 ? el : el + 1;
74
+ if (currentIndex === index) {
75
+ return (
76
+ <Item
77
+ itemClass={selectedItemClass}
78
+ itemStyle={defaultStylesEnum.selectedItemClass}
79
+ isDefaultStyles={isDefaultStyles}
80
+ key={el}
81
+ >
82
+ {el + 1}
83
+ </Item>
84
+ );
85
+ }
86
+ return (
87
+ <Item
88
+ itemClass={selectedItemClass}
89
+ itemStyle={defaultStylesEnum.itemClass}
90
+ isDefaultStyles={isDefaultStyles}
91
+ onClick={() => setIndex(index)}
92
+ key={el}
93
+ >
94
+ {el + 1}
95
+ </Item>
96
+ );
97
+ })}
98
+ </ItemList>
99
+ </Wrapper>
100
+ );
101
+ }
102
+
103
+ if (totalPages === 4) {
104
+ return (
105
+ <Wrapper wrapperClass={className ? className : wrapperClass} isDefaultStyles={isDefaultStyles}>
106
+ <ItemList itemListClass={itemListClass} isDefaultStyles={isDefaultStyles}>
107
+ {currentIndex > (paginationStart === 0 ? 0 : 1) ? (
108
+ <Item
109
+ itemClass={itemClass}
110
+ itemStyle={defaultStylesEnum.itemClass}
111
+ isDefaultStyles={isDefaultStyles}
112
+ onClick={() => setIndex(currentIndex - 1)}
113
+ >
114
+ {`<<`}
115
+ </Item>
116
+ ) : (
117
+ <Item
118
+ itemClass={disableItemClass}
119
+ itemStyle={defaultStylesEnum.disableItemClass}
120
+ isDefaultStyles={isDefaultStyles}
121
+ >
122
+ {`<<`}
123
+ </Item>
124
+ )}
125
+ {range(totalPages).map((el) => {
126
+ const index = paginationStart === 0 ? el : el + 1;
127
+ if (currentIndex === index) {
128
+ return (
129
+ <Item
130
+ itemClass={selectedItemClass}
131
+ itemStyle={defaultStylesEnum.selectedItemClass}
132
+ isDefaultStyles={isDefaultStyles}
133
+ key={el}
134
+ >
135
+ {el + 1}
136
+ </Item>
137
+ );
138
+ }
139
+ return (
140
+ <Item
141
+ itemClass={selectedItemClass}
142
+ itemStyle={defaultStylesEnum.itemClass}
143
+ isDefaultStyles={isDefaultStyles}
144
+ key={el}
145
+ onClick={() => setIndex(index)}
146
+ >
147
+ {el + 1}
148
+ </Item>
149
+ );
150
+ })}
151
+ {currentIndex < (paginationStart === 0 ? 3 : 4) ? (
152
+ <Item
153
+ itemClass={itemClass}
154
+ itemStyle={defaultStylesEnum.itemClass}
155
+ isDefaultStyles={isDefaultStyles}
156
+ onClick={() => setIndex(currentIndex + 1)}
157
+ >
158
+ {`>>`}
159
+ </Item>
160
+ ) : (
161
+ <Item
162
+ itemClass={disableItemClass}
163
+ itemStyle={defaultStylesEnum.disableItemClass}
164
+ isDefaultStyles={isDefaultStyles}
165
+ >
166
+ {`>>`}
167
+ </Item>
168
+ )}
169
+ </ItemList>
170
+ </Wrapper>
171
+ );
172
+ }
173
+
174
+ return (
175
+ <Wrapper wrapperClass={className ? className : wrapperClass} isDefaultStyles={isDefaultStyles}>
176
+ <ItemList itemListClass={itemListClass} isDefaultStyles={isDefaultStyles}>
177
+ {/*Previous button*/}
178
+ {currentIndex > (paginationStart === 0 ? 0 : 1) ? (
179
+ <Item
180
+ itemClass={itemClass}
181
+ itemStyle={defaultStylesEnum.itemClass}
182
+ isDefaultStyles={isDefaultStyles}
183
+ onClick={() => setIndex(currentIndex - 1)}
184
+ >
185
+ {`<<`}
186
+ </Item>
187
+ ) : (
188
+ <Item
189
+ itemClass={disableItemClass}
190
+ itemStyle={defaultStylesEnum.disableItemClass}
191
+ isDefaultStyles={isDefaultStyles}
192
+ >
193
+ {`<<`}
194
+ </Item>
195
+ )}
196
+ {/*First page button*/}
197
+ {currentIndex > (paginationStart == 0 ? 2 : 3) ? (
198
+ <Item
199
+ itemClass={itemClass}
200
+ itemStyle={defaultStylesEnum.itemClass}
201
+ isDefaultStyles={isDefaultStyles}
202
+ onClick={() => setIndex(paginationStart === 0 ? 0 : 1)}
203
+ >
204
+ {`1`}
205
+ </Item>
206
+ ) : null}
207
+
208
+ {currentIndex < (paginationStart === 0 ? 3 : 4)
209
+ ? range(4).map((el) => {
210
+ const index = paginationStart === 0 ? el : el + 1;
211
+ if (currentIndex === index) {
212
+ return (
213
+ <Item
214
+ itemClass={selectedItemClass}
215
+ itemStyle={defaultStylesEnum.selectedItemClass}
216
+ isDefaultStyles={isDefaultStyles}
217
+ key={el}
218
+ >
219
+ {el + 1}
220
+ </Item>
221
+ );
222
+ }
223
+ return (
224
+ <Item
225
+ itemClass={itemClass}
226
+ itemStyle={defaultStylesEnum.itemClass}
227
+ isDefaultStyles={isDefaultStyles}
228
+ onClick={() => setIndex(index)}
229
+ key={el}
230
+ >
231
+ {el + 1}
232
+ </Item>
233
+ );
234
+ })
235
+ : null}
236
+
237
+ {currentIndex > (paginationStart === 0 ? 2 : 3) ? (
238
+ <Item
239
+ itemClass={disableItemClass}
240
+ itemStyle={defaultStylesEnum.disableItemClass}
241
+ isDefaultStyles={isDefaultStyles}
242
+ >
243
+ {`...`}
244
+ </Item>
245
+ ) : null}
246
+
247
+ {currentIndex > (paginationStart === 0 ? 2 : 3) &&
248
+ (paginationStart === 0 ? currentIndex : currentIndex - 1) < totalPages ? (
249
+ <>
250
+ {currentIndex === (paginationStart === 0 ? totalPages - 2 : totalPages - 1) && (
251
+ <Item
252
+ itemClass={itemClass}
253
+ itemStyle={defaultStylesEnum.itemClass}
254
+ isDefaultStyles={isDefaultStyles}
255
+ onClick={() => setIndex(paginationStart === 0 ? totalPages - 4 : totalPages - 3)}
256
+ >
257
+ {totalPages - 3}
258
+ </Item>
259
+ )}
260
+
261
+ {currentIndex === (paginationStart === 0 ? totalPages - 1 : totalPages) && (
262
+ <>
263
+ <Item
264
+ itemClass={itemClass}
265
+ itemStyle={defaultStylesEnum.itemClass}
266
+ isDefaultStyles={isDefaultStyles}
267
+ onClick={() => setIndex(paginationStart === 0 ? totalPages - 4 : totalPages - 3)}
268
+ >
269
+ {totalPages - 3}
270
+ </Item>
271
+ <Item
272
+ itemClass={itemClass}
273
+ itemStyle={defaultStylesEnum.itemClass}
274
+ isDefaultStyles={isDefaultStyles}
275
+ onClick={() => setIndex(paginationStart === 0 ? totalPages - 3 : totalPages - 2)}
276
+ >
277
+ {totalPages - 2}
278
+ </Item>
279
+ </>
280
+ )}
281
+
282
+ <Item
283
+ itemClass={itemClass}
284
+ itemStyle={defaultStylesEnum.itemClass}
285
+ isDefaultStyles={isDefaultStyles}
286
+ onClick={() => setIndex(currentIndex - 1)}
287
+ >
288
+ {paginationStart === 0 ? currentIndex : currentIndex - 1}
289
+ </Item>
290
+
291
+ <Item
292
+ itemClass={selectedItemClass}
293
+ itemStyle={defaultStylesEnum.selectedItemClass}
294
+ isDefaultStyles={isDefaultStyles}
295
+ >
296
+ {paginationStart === 0 ? currentIndex + 1 : currentIndex}
297
+ </Item>
298
+
299
+ {currentIndex < (paginationStart === 0 ? totalPages - 1 : totalPages) ? (
300
+ <Item
301
+ itemClass={itemClass}
302
+ itemStyle={defaultStylesEnum.itemClass}
303
+ isDefaultStyles={isDefaultStyles}
304
+ onClick={() => setIndex(currentIndex + 1)}
305
+ >
306
+ {paginationStart === 0 ? currentIndex + 2 : currentIndex + 1}
307
+ </Item>
308
+ ) : null}
309
+ </>
310
+ ) : null}
311
+
312
+ {currentIndex < (paginationStart === 0 ? totalPages - 3 : totalPages - 2) ? (
313
+ <Item
314
+ itemClass={disableItemClass}
315
+ itemStyle={defaultStylesEnum.disableItemClass}
316
+ isDefaultStyles={isDefaultStyles}
317
+ >
318
+ {`...`}
319
+ </Item>
320
+ ) : null}
321
+
322
+ {currentIndex < (paginationStart === 0 ? totalPages - 2 : totalPages - 1) ? (
323
+ <Item
324
+ itemClass={itemClass}
325
+ itemStyle={defaultStylesEnum.itemClass}
326
+ isDefaultStyles={isDefaultStyles}
327
+ onClick={() => setIndex(paginationStart === 0 ? totalPages - 1 : totalPages)}
328
+ >
329
+ {totalPages}
330
+ </Item>
331
+ ) : null}
332
+
333
+ {(paginationStart === 0 ? currentIndex + 1 : currentIndex) < totalPages ? (
334
+ <Item
335
+ itemClass={itemClass}
336
+ itemStyle={defaultStylesEnum.itemClass}
337
+ isDefaultStyles={isDefaultStyles}
338
+ onClick={() => setIndex(currentIndex + 1)}
339
+ >
340
+ {`>>`}
341
+ </Item>
342
+ ) : (
343
+ <Item
344
+ itemClass={disableItemClass}
345
+ itemStyle={defaultStylesEnum.disableItemClass}
346
+ isDefaultStyles={isDefaultStyles}
347
+ >
348
+ {`>>`}
349
+ </Item>
350
+ )}
351
+ </ItemList>
352
+ </Wrapper>
353
+ );
354
+ };
355
+
356
+ export default Pagination;