@toptal/picasso-pagination 3.0.10 → 3.0.11
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/dist-package/src/Pagination/Pagination.d.ts.map +1 -1
- package/dist-package/src/Pagination/Pagination.js +1 -7
- package/dist-package/src/Pagination/Pagination.js.map +1 -1
- package/package.json +2 -4
- package/src/Pagination/Pagination.tsx +1 -9
- package/src/Pagination/__snapshots__/test.tsx.snap +4 -4
- package/dist-package/src/Pagination/styles.d.ts +0 -3
- package/dist-package/src/Pagination/styles.d.ts.map +0 -1
- package/dist-package/src/Pagination/styles.js +0 -8
- package/dist-package/src/Pagination/styles.js.map +0 -1
- package/src/Pagination/styles.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAA8B,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAQvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uDAAuD;IACvD,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAA;IAClB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gDAAgD;IAChD,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAChC;AAED,eAAO,MAAM,UAAU,8EA6ErB,CAAA;AAUF,eAAe,UAAU,CAAA"}
|
|
@@ -10,19 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { forwardRef, useMemo } from 'react';
|
|
13
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
14
13
|
import { Button } from '@toptal/picasso-button';
|
|
15
14
|
import { Container } from '@toptal/picasso-container';
|
|
16
15
|
import { Typography } from '@toptal/picasso-typography';
|
|
17
16
|
import { getRange, ELLIPSIS } from './utils';
|
|
18
|
-
import styles from './styles';
|
|
19
17
|
import { PaginationButton } from '../PaginationButton';
|
|
20
|
-
const useStyles = makeStyles(styles, {
|
|
21
|
-
name: 'PicassoPagination',
|
|
22
|
-
});
|
|
23
18
|
export const Pagination = forwardRef(function Pagination(props, ref) {
|
|
24
19
|
const { activePage, disabled, totalPages, onPageChange, siblingCount = 2, variant } = props, rest = __rest(props, ["activePage", "disabled", "totalPages", "onPageChange", "siblingCount", "variant"]);
|
|
25
|
-
const classes = useStyles();
|
|
26
20
|
const pages = useMemo(() => getRange({ activePage, totalPages, siblingCount }), [activePage, totalPages, siblingCount]);
|
|
27
21
|
if (pages.length <= 1) {
|
|
28
22
|
return null;
|
|
@@ -33,7 +27,7 @@ export const Pagination = forwardRef(function Pagination(props, ref) {
|
|
|
33
27
|
const handleNextClick = () => onPageChange(activePage + 1);
|
|
34
28
|
const pageButtons = pages.map((page, index) => {
|
|
35
29
|
if (page === ELLIPSIS) {
|
|
36
|
-
return (React.createElement(Container, { key: index, className:
|
|
30
|
+
return (React.createElement(Container, { key: index, className: 'py-0 px-[0.5em] cursor-default' },
|
|
37
31
|
React.createElement(Typography, { size: 'xsmall', weight: 'semibold', color: 'black' }, ELLIPSIS)));
|
|
38
32
|
}
|
|
39
33
|
return (React.createElement(PaginationButton, { key: index, className: '[&+&]:ml-2', page: Number(page), activePage: activePage, disabled: disabled, onClick: onPageChange }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../src/Pagination/Pagination.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../../src/Pagination/Pagination.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAiBtD,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAwB,SAAS,UAAU,CAC7E,KAAK,EACL,GAAG;IAEH,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,YAAY,GAAG,CAAC,EAChB,OAAO,KAEL,KAAK,EADJ,IAAI,UACL,KAAK,EARH,mFAQL,CAAQ,CAAA;IAET,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,EACxD,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,CACvC,CAAA;IAED,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;QACrB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,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AAE,YAAY,IAAI,QAAQ,EAClC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,OAAO,WAGL,CACC,CACb,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,UAAU,CAAC,YAAY,GAAG;IACxB,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,SAAS;CACnB,CAAA;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAA;AAErC,eAAe,UAAU,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-pagination",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"description": "Toptal UI components library - Pagination",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,15 +25,13 @@
|
|
|
25
25
|
"@toptal/picasso-button": "3.0.10",
|
|
26
26
|
"@toptal/picasso-container": "2.0.0",
|
|
27
27
|
"@toptal/picasso-typography": "3.0.0",
|
|
28
|
-
"@toptal/picasso-utils": "1.0.3"
|
|
29
|
-
"classnames": "^2.5.1"
|
|
28
|
+
"@toptal/picasso-utils": "1.0.3"
|
|
30
29
|
},
|
|
31
30
|
"sideEffects": [
|
|
32
31
|
"**/styles.ts",
|
|
33
32
|
"**/styles.js"
|
|
34
33
|
],
|
|
35
34
|
"peerDependencies": {
|
|
36
|
-
"@material-ui/core": "4.12.4",
|
|
37
35
|
"react": ">=16.12.0 < 19.0.0",
|
|
38
36
|
"@toptal/picasso-tailwind-merge": "^1.0.1",
|
|
39
37
|
"@toptal/picasso-tailwind": ">=2.7"
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
/* eslint-disable react/no-array-index-key */
|
|
2
2
|
import type { HTMLAttributes } from 'react'
|
|
3
3
|
import React, { forwardRef, useMemo } from 'react'
|
|
4
|
-
import type { Theme } from '@material-ui/core/styles'
|
|
5
|
-
import { makeStyles } from '@material-ui/core/styles'
|
|
6
4
|
import type { BaseProps } from '@toptal/picasso-shared'
|
|
7
5
|
import { Button } from '@toptal/picasso-button'
|
|
8
6
|
import { Container } from '@toptal/picasso-container'
|
|
9
7
|
import { Typography } from '@toptal/picasso-typography'
|
|
10
8
|
|
|
11
9
|
import { getRange, ELLIPSIS } from './utils'
|
|
12
|
-
import styles from './styles'
|
|
13
10
|
import { PaginationButton } from '../PaginationButton'
|
|
14
11
|
|
|
15
|
-
const useStyles = makeStyles<Theme>(styles, {
|
|
16
|
-
name: 'PicassoPagination',
|
|
17
|
-
})
|
|
18
|
-
|
|
19
12
|
export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
|
|
20
13
|
/** Value of the current highlighted page */
|
|
21
14
|
activePage: number
|
|
@@ -44,7 +37,6 @@ export const Pagination = forwardRef<HTMLDivElement, Props>(function Pagination(
|
|
|
44
37
|
variant,
|
|
45
38
|
...rest
|
|
46
39
|
} = props
|
|
47
|
-
const classes = useStyles()
|
|
48
40
|
|
|
49
41
|
const pages = useMemo(
|
|
50
42
|
() => getRange({ activePage, totalPages, siblingCount }),
|
|
@@ -64,7 +56,7 @@ export const Pagination = forwardRef<HTMLDivElement, Props>(function Pagination(
|
|
|
64
56
|
const pageButtons = pages.map((page, index) => {
|
|
65
57
|
if (page === ELLIPSIS) {
|
|
66
58
|
return (
|
|
67
|
-
<Container key={index} className=
|
|
59
|
+
<Container key={index} className='py-0 px-[0.5em] cursor-default'>
|
|
68
60
|
<Typography size='xsmall' weight='semibold' color='black'>
|
|
69
61
|
{ELLIPSIS}
|
|
70
62
|
</Typography>
|
|
@@ -38,7 +38,7 @@ exports[`Pagination renders 1`] = `
|
|
|
38
38
|
</span>
|
|
39
39
|
</button>
|
|
40
40
|
<div
|
|
41
|
-
class="
|
|
41
|
+
class="py-0 px-[0.5em] cursor-default"
|
|
42
42
|
>
|
|
43
43
|
<p
|
|
44
44
|
class="m-0 text-xxs text-black font-semibold"
|
|
@@ -122,7 +122,7 @@ exports[`Pagination renders 1`] = `
|
|
|
122
122
|
</span>
|
|
123
123
|
</button>
|
|
124
124
|
<div
|
|
125
|
-
class="
|
|
125
|
+
class="py-0 px-[0.5em] cursor-default"
|
|
126
126
|
>
|
|
127
127
|
<p
|
|
128
128
|
class="m-0 text-xxs text-black font-semibold"
|
|
@@ -204,7 +204,7 @@ exports[`Pagination renders disabled 1`] = `
|
|
|
204
204
|
</span>
|
|
205
205
|
</button>
|
|
206
206
|
<div
|
|
207
|
-
class="
|
|
207
|
+
class="py-0 px-[0.5em] cursor-default"
|
|
208
208
|
>
|
|
209
209
|
<p
|
|
210
210
|
class="m-0 text-xxs text-black font-semibold"
|
|
@@ -293,7 +293,7 @@ exports[`Pagination renders disabled 1`] = `
|
|
|
293
293
|
</span>
|
|
294
294
|
</button>
|
|
295
295
|
<div
|
|
296
|
-
class="
|
|
296
|
+
class="py-0 px-[0.5em] cursor-default"
|
|
297
297
|
>
|
|
298
298
|
<p
|
|
299
299
|
class="m-0 text-xxs text-black font-semibold"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Pagination/styles.ts"],"names":[],"mappings":";AAEA,wBAMI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/Pagination/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,GAAG,EAAE,CAClB,YAAY,CAAC;IACX,QAAQ,EAAE;QACR,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,SAAS;KAClB;CACF,CAAC,CAAA"}
|