@festo-ui/react 11.1.0-dev.994 → 11.1.0-dev.997
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './Pagination.scss';
|
|
2
|
-
export type PaginationType = 'SIMPLE' | 'NUMERIC' | 'DOTS';
|
|
2
|
+
export type PaginationType = 'basic' | 'numeric' | 'dots' | 'dots-lg' | 'SIMPLE' | 'NUMERIC' | 'DOTS';
|
|
3
3
|
export interface PaginationProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> {
|
|
4
4
|
readonly type?: PaginationType;
|
|
5
5
|
readonly onChange?: (page: number, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "./Pagination.css";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import { forwardRef, useEffect, useState } from "react";
|
|
5
|
-
const Pagination = /*#__PURE__*/ forwardRef(({ pageMax, onChange, pageCurrent, defaultPageCurrent = 1, type = '
|
|
5
|
+
const Pagination = /*#__PURE__*/ forwardRef(({ pageMax, onChange, pageCurrent, defaultPageCurrent = 1, type = 'numeric', className, ...props }, ref)=>{
|
|
6
6
|
const controlled = void 0 !== pageCurrent;
|
|
7
7
|
const dotArray = Array.from(new Array(pageMax).keys());
|
|
8
8
|
const [innerPageCurrent, setInnerPageCurrent] = useState(controlled ? pageCurrent : defaultPageCurrent);
|
|
@@ -32,66 +32,63 @@ const Pagination = /*#__PURE__*/ forwardRef(({ pageMax, onChange, pageCurrent, d
|
|
|
32
32
|
const newPageCurrent = index + 1;
|
|
33
33
|
handleChange(newPageCurrent, event);
|
|
34
34
|
}
|
|
35
|
-
return /*#__PURE__*/
|
|
36
|
-
children:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
className: classnames('fwe-navigate-btn-down', {
|
|
46
|
-
'fwe-disabled': innerPageCurrent <= 1
|
|
47
|
-
}),
|
|
48
|
-
onClick: onBtnDown,
|
|
35
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
36
|
+
children: 'dots' === type || 'dots-lg' === type || 'DOTS' === type ? /*#__PURE__*/ jsx("div", {
|
|
37
|
+
...props,
|
|
38
|
+
className: classnames({
|
|
39
|
+
'fwe-d-none': pageMax < 2
|
|
40
|
+
}, className),
|
|
41
|
+
ref: ref,
|
|
42
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
43
|
+
className: "fwe-pagination",
|
|
44
|
+
children: dotArray.map((index)=>/*#__PURE__*/ jsx("button", {
|
|
49
45
|
type: "button",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
className: classnames(`fwe-page-dot${'dots-lg' === type ? '-lg' : ''}`, {
|
|
47
|
+
'fwe-selected': index + 1 === innerPageCurrent
|
|
48
|
+
}),
|
|
49
|
+
onClick: (e)=>onDotClick(index, e),
|
|
50
|
+
"aria-label": `Go to page ${index + 1}`,
|
|
51
|
+
"aria-current": index + 1 === innerPageCurrent ? 'page' : void 0
|
|
52
|
+
}, index))
|
|
53
|
+
})
|
|
54
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
55
|
+
...props,
|
|
56
|
+
className: classnames('fwe-pagination', {
|
|
57
|
+
'fwe-d-none': pageMax < 2
|
|
58
|
+
}, className),
|
|
59
|
+
ref: ref,
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ jsx("button", {
|
|
62
|
+
className: classnames('fwe-navigate-btn-down', {
|
|
63
|
+
'fwe-disabled': innerPageCurrent <= 1
|
|
63
64
|
}),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
onClick: onBtnDown,
|
|
66
|
+
type: "button",
|
|
67
|
+
"aria-label": "navigate-btn-down"
|
|
68
|
+
}),
|
|
69
|
+
('numeric' === type || 'NUMERIC' === type) && /*#__PURE__*/ jsxs(Fragment, {
|
|
70
|
+
children: [
|
|
71
|
+
/*#__PURE__*/ jsx("span", {
|
|
72
|
+
className: "fwe-page-current",
|
|
73
|
+
children: innerPageCurrent
|
|
68
74
|
}),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
children: dotArray.map((index)=>/*#__PURE__*/ jsx("button", {
|
|
84
|
-
type: "button",
|
|
85
|
-
className: classnames('fwe-page-dot', {
|
|
86
|
-
'fwe-selected': index + 1 === innerPageCurrent
|
|
87
|
-
}),
|
|
88
|
-
onClick: (e)=>onDotClick(index, e),
|
|
89
|
-
"aria-label": `Go to page ${index + 1}`,
|
|
90
|
-
"aria-current": index + 1 === innerPageCurrent ? 'page' : void 0
|
|
91
|
-
}, index))
|
|
75
|
+
/*#__PURE__*/ jsx("span", {
|
|
76
|
+
className: "fwe-page-max",
|
|
77
|
+
children: pageMax
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ jsx("button", {
|
|
82
|
+
className: classnames('fwe-navigate-btn-up', {
|
|
83
|
+
'fwe-disabled': innerPageCurrent >= pageMax,
|
|
84
|
+
'fwe-ml-4': 'SIMPLE' === type
|
|
85
|
+
}),
|
|
86
|
+
onClick: onBtnUp,
|
|
87
|
+
type: "button",
|
|
88
|
+
"aria-label": "navigate-btn-up"
|
|
92
89
|
})
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
]
|
|
91
|
+
})
|
|
95
92
|
});
|
|
96
93
|
});
|
|
97
94
|
Pagination.displayName = 'Pagination';
|
package/package.json
CHANGED