react-router-pagination 3.2.23 → 3.2.25
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.
- package/package.json +11 -10
- package/src/index.d.mts +42 -0
- package/src/index.tsx +1 -3
- package/src/pagination/centered/index.tsx +2 -12
- package/src/pagination/component.tsx +2 -13
- package/src/pagination/standard/index.tsx +2 -16
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router-pagination",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.25",
|
|
4
4
|
"description": "A React Router Pagination component",
|
|
5
5
|
"main": "./src/index.mjs",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"types": "./src/index.d.mts",
|
|
7
8
|
"author": {
|
|
8
9
|
"name": "Jonathan Perry for Sequence Media Limited",
|
|
9
10
|
"email": "sequencemedia@sequencemedia.net",
|
|
@@ -37,20 +38,20 @@
|
|
|
37
38
|
"@babel/preset-react": "^7.22.15",
|
|
38
39
|
"@babel/preset-typescript": "^7.23.2",
|
|
39
40
|
"@babel/register": "^7.22.15",
|
|
40
|
-
"@sequencemedia/hooks": "^1.0.
|
|
41
|
-
"@storybook/addon-essentials": "^7.5.
|
|
42
|
-
"@storybook/react": "^7.5.
|
|
43
|
-
"@storybook/react-webpack5": "^7.5.
|
|
41
|
+
"@sequencemedia/hooks": "^1.0.460",
|
|
42
|
+
"@storybook/addon-essentials": "^7.5.2",
|
|
43
|
+
"@storybook/react": "^7.5.2",
|
|
44
|
+
"@storybook/react-webpack5": "^7.5.2",
|
|
44
45
|
"@types/debug": "^4.1.10",
|
|
45
|
-
"@types/jest": "^29.5.
|
|
46
|
+
"@types/jest": "^29.5.7",
|
|
46
47
|
"@types/react": "^18.2.33",
|
|
47
48
|
"@types/react-router": "^5.1.20",
|
|
48
49
|
"@types/react-router-dom": "^5.3.3",
|
|
49
50
|
"@types/react-test-renderer": "^18.0.5",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "^6.9.
|
|
51
|
-
"@typescript-eslint/parser": "^6.9.
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
52
|
+
"@typescript-eslint/parser": "^6.9.1",
|
|
52
53
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
53
|
-
"core-js": "^3.33.
|
|
54
|
+
"core-js": "^3.33.2",
|
|
54
55
|
"cross-env": "^7.0.3",
|
|
55
56
|
"eslint": "^8.52.0",
|
|
56
57
|
"eslint-config-standard": "^17.1.0",
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"react-router": "^6.17.0",
|
|
67
68
|
"react-router-dom": "^6.17.0",
|
|
68
69
|
"react-test-renderer": "^18.2.0",
|
|
69
|
-
"storybook": "^7.5.
|
|
70
|
+
"storybook": "^7.5.2",
|
|
70
71
|
"typescript": "^5.2.2"
|
|
71
72
|
},
|
|
72
73
|
"imports": {
|
package/src/index.d.mts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare namespace ReactRouterPaginationTypes {
|
|
2
|
+
export interface AbstractPaginationProps {
|
|
3
|
+
onClick: (pageNumber: number) => void
|
|
4
|
+
pageNumber: string | number
|
|
5
|
+
totalPages: string | number
|
|
6
|
+
match: {
|
|
7
|
+
path?: string
|
|
8
|
+
params?: object
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface AbstractPaginationState {
|
|
13
|
+
pageNumber: number
|
|
14
|
+
totalPages: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CenteredProps extends AbstractPaginationProps {
|
|
18
|
+
spread: string | number
|
|
19
|
+
onChange: (pageNumber: number) => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CenteredState extends AbstractPaginationState {
|
|
23
|
+
spread: number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface StandardProps extends AbstractPaginationProps {
|
|
27
|
+
pageNumber: string | number
|
|
28
|
+
totalPages: string | number
|
|
29
|
+
spread: string | number
|
|
30
|
+
onChange: (pageNumber: number) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface StandardState extends AbstractPaginationState {
|
|
34
|
+
pageNumber: number
|
|
35
|
+
totalPages: number
|
|
36
|
+
spread: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface PaginationProps {
|
|
40
|
+
format?: string
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -13,9 +13,7 @@ import {
|
|
|
13
13
|
calculatePageNumber
|
|
14
14
|
} from './pagination/common/index.mts'
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
format?: string
|
|
18
|
-
}
|
|
16
|
+
type PaginationProps = ReactRouterPaginationTypes.PaginationProps
|
|
19
17
|
|
|
20
18
|
export default class Pagination extends Component<PaginationProps> {
|
|
21
19
|
static calculateTotalPages = calculateTotalPages
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
AbstractPaginationProps,
|
|
5
|
-
AbstractPaginationState
|
|
6
|
-
} from '#pagination/component'
|
|
7
|
-
|
|
8
3
|
import AbstractPagination, {
|
|
9
4
|
toInteger,
|
|
10
5
|
calculateTotalPages,
|
|
@@ -19,14 +14,9 @@ export {
|
|
|
19
14
|
calculatePageNumber
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
spread: string | number
|
|
24
|
-
onChange: (pageNumber: number) => void
|
|
25
|
-
}
|
|
17
|
+
type CenteredProps = ReactRouterPaginationTypes.CenteredProps
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
spread: number
|
|
29
|
-
}
|
|
19
|
+
type CenteredState = ReactRouterPaginationTypes.CenteredState
|
|
30
20
|
|
|
31
21
|
export class Centered extends AbstractPagination<CenteredProps, CenteredState> {
|
|
32
22
|
static defaultProps = {
|
|
@@ -33,20 +33,9 @@ export {
|
|
|
33
33
|
calculatePageNumber
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
onClick: (pageNumber: number) => void
|
|
38
|
-
pageNumber: string | number
|
|
39
|
-
totalPages: string | number
|
|
40
|
-
match: {
|
|
41
|
-
path?: string
|
|
42
|
-
params?: object
|
|
43
|
-
}
|
|
44
|
-
}
|
|
36
|
+
type AbstractPaginationProps = ReactRouterPaginationTypes.AbstractPaginationProps
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
pageNumber: number
|
|
48
|
-
totalPages: number
|
|
49
|
-
}
|
|
38
|
+
type AbstractPaginationState = ReactRouterPaginationTypes.AbstractPaginationState
|
|
50
39
|
|
|
51
40
|
export default abstract class AbstractPagination<P, S> extends Component<P & AbstractPaginationProps, S & AbstractPaginationState> {
|
|
52
41
|
static defaultProps = {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
AbstractPaginationProps,
|
|
5
|
-
AbstractPaginationState
|
|
6
|
-
} from '#pagination/component'
|
|
7
|
-
|
|
8
3
|
import AbstractPagination, {
|
|
9
4
|
toInteger,
|
|
10
5
|
calculateTotalPages,
|
|
@@ -19,18 +14,9 @@ export {
|
|
|
19
14
|
calculatePageNumber
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
pageNumber: string | number
|
|
24
|
-
totalPages: string | number
|
|
25
|
-
spread: string | number
|
|
26
|
-
onChange: (pageNumber: number) => void
|
|
27
|
-
}
|
|
17
|
+
type StandardProps = ReactRouterPaginationTypes.StandardProps
|
|
28
18
|
|
|
29
|
-
|
|
30
|
-
pageNumber: number
|
|
31
|
-
totalPages: number
|
|
32
|
-
spread: number
|
|
33
|
-
}
|
|
19
|
+
type StandardState = ReactRouterPaginationTypes.StandardState
|
|
34
20
|
|
|
35
21
|
export class Standard extends AbstractPagination<StandardProps, StandardState> {
|
|
36
22
|
static defaultProps = {
|