@moda/om 21.12.0 → 21.13.0
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.
|
@@ -4,6 +4,7 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
selectedPage: number;
|
|
5
5
|
totalPages: number;
|
|
6
6
|
maximumPagesToShow?: number;
|
|
7
|
+
scrollToTopOnPageChange?: boolean;
|
|
7
8
|
onGoToPage: (page: number) => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const Paginator: React.FC<Props>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moda/om",
|
|
3
|
-
"version": "21.
|
|
3
|
+
"version": "21.13.0",
|
|
4
4
|
"description": "Moda Operandi design system",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@babel/preset-env": "^7.28.5",
|
|
73
73
|
"@babel/preset-react": "^7.28.5",
|
|
74
74
|
"@babel/preset-typescript": "^7.28.5",
|
|
75
|
-
"@commitlint/cli": "^
|
|
76
|
-
"@commitlint/config-conventional": "^
|
|
75
|
+
"@commitlint/cli": "^21.0.0",
|
|
76
|
+
"@commitlint/config-conventional": "^21.0.0",
|
|
77
77
|
"@eslint/js": "^9.39.2",
|
|
78
78
|
"@moda/rollup-plugin-postcss": "^4.0.1",
|
|
79
79
|
"@rollup/plugin-babel": "^7.0.0",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"jest": "^30.2.0",
|
|
126
126
|
"jest-environment-jsdom": "^30.2.0",
|
|
127
127
|
"jest-matchmedia-mock": "^1.1.0",
|
|
128
|
-
"lint-staged": "^
|
|
128
|
+
"lint-staged": "^17.0.2",
|
|
129
129
|
"node-sass-package-importer": "^5.3.3",
|
|
130
130
|
"pinst": "^3.0.0",
|
|
131
131
|
"postcss": "^8.5.6",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
140
140
|
"rollup-plugin-scss": "^4.0.1",
|
|
141
141
|
"sass": "^1.97.2",
|
|
142
|
-
"sass-loader": "^
|
|
142
|
+
"sass-loader": "^17.0.0",
|
|
143
143
|
"semantic-release": "^25.0.2",
|
|
144
144
|
"semantic-release-npm-github": "^6.0.0",
|
|
145
145
|
"style-loader": "^4.0.0",
|
|
@@ -10,6 +10,7 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
10
10
|
selectedPage: number;
|
|
11
11
|
totalPages: number;
|
|
12
12
|
maximumPagesToShow?: number;
|
|
13
|
+
scrollToTopOnPageChange?: boolean;
|
|
13
14
|
onGoToPage: (page: number) => void;
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -57,6 +58,7 @@ export const Paginator: React.FC<Props> = ({
|
|
|
57
58
|
selectedPage,
|
|
58
59
|
totalPages,
|
|
59
60
|
maximumPagesToShow = defaultMaximumNumberOfPagesToShow,
|
|
61
|
+
scrollToTopOnPageChange = true,
|
|
60
62
|
onGoToPage,
|
|
61
63
|
className
|
|
62
64
|
}: Props) => {
|
|
@@ -71,7 +73,7 @@ export const Paginator: React.FC<Props> = ({
|
|
|
71
73
|
disabled={!canDoPrev(selectedPage)}
|
|
72
74
|
onClick={() => {
|
|
73
75
|
prevPage(selectedPage);
|
|
74
|
-
window.scrollTo(0, 0);
|
|
76
|
+
if (scrollToTopOnPageChange) window.scrollTo(0, 0);
|
|
75
77
|
}}
|
|
76
78
|
className={classNames('Paginator__button', 'Paginator__button--previous')}
|
|
77
79
|
>
|
|
@@ -83,7 +85,7 @@ export const Paginator: React.FC<Props> = ({
|
|
|
83
85
|
<button
|
|
84
86
|
onClick={() => {
|
|
85
87
|
onGoToPage(page);
|
|
86
|
-
window.scrollTo(0, 0);
|
|
88
|
+
if (scrollToTopOnPageChange) window.scrollTo(0, 0);
|
|
87
89
|
}}
|
|
88
90
|
className={classNames('Paginator__button', {
|
|
89
91
|
'Paginator__button--currentPage': page === selectedPage
|
|
@@ -104,7 +106,7 @@ export const Paginator: React.FC<Props> = ({
|
|
|
104
106
|
disabled={!canDoNext(selectedPage, totalPages)}
|
|
105
107
|
onClick={() => {
|
|
106
108
|
nextPage(selectedPage);
|
|
107
|
-
window.scrollTo(0, 0);
|
|
109
|
+
if (scrollToTopOnPageChange) window.scrollTo(0, 0);
|
|
108
110
|
}}
|
|
109
111
|
className={classNames('Paginator__button', 'Paginator__button--next')}
|
|
110
112
|
>
|