@@ -16,11 +16,28 @@ import PaginationItem from './PaginationItem'
1616 */
1717const Pagination = React . forwardRef ( function ( props , ref ) {
1818 const {
19- 'aria-label' : ariaLabel ,
20- boundaryRange,
19+ 'aria-label' : ariaLabel = 'Pagination Navigation' ,
20+ boundaryRange = 1 ,
2121 disabled,
22- ellipsisItem,
23- siblingRange,
22+ ellipsisItem = '...' ,
23+ firstItem = {
24+ 'aria-label' : 'First item' ,
25+ content : '«' ,
26+ } ,
27+ lastItem = {
28+ 'aria-label' : 'Last item' ,
29+ content : '»' ,
30+ } ,
31+ nextItem = {
32+ 'aria-label' : 'Next item' ,
33+ content : '⟩' ,
34+ } ,
35+ pageItem = { } ,
36+ prevItem = {
37+ 'aria-label' : 'Previous item' ,
38+ content : '⟨' ,
39+ } ,
40+ siblingRange = 1 ,
2441 totalPages,
2542 } = props
2643 const [ activePage , setActivePage ] = useAutoControlledValue ( {
@@ -63,10 +80,19 @@ const Pagination = React.forwardRef(function (props, ref) {
6380 } )
6481 const rest = getUnhandledProps ( Pagination , props )
6582
83+ const paginationItemTypes = {
84+ firstItem,
85+ lastItem,
86+ ellipsisItem,
87+ nextItem,
88+ pageItem,
89+ prevItem,
90+ }
91+
6692 return (
6793 < Menu { ...rest } aria-label = { ariaLabel } pagination role = 'navigation' ref = { ref } >
6894 { _ . map ( items , ( { active, type, value } ) =>
69- PaginationItem . create ( props [ type ] , {
95+ PaginationItem . create ( paginationItemTypes [ type ] , {
7096 defaultProps : {
7197 content : value ,
7298 disabled,
@@ -129,30 +155,6 @@ Pagination.propTypes = {
129155 totalPages : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) . isRequired ,
130156}
131157
132- Pagination . defaultProps = {
133- 'aria-label' : 'Pagination Navigation' ,
134- boundaryRange : 1 ,
135- ellipsisItem : '...' ,
136- firstItem : {
137- 'aria-label' : 'First item' ,
138- content : '«' ,
139- } ,
140- lastItem : {
141- 'aria-label' : 'Last item' ,
142- content : '»' ,
143- } ,
144- nextItem : {
145- 'aria-label' : 'Next item' ,
146- content : '⟩' ,
147- } ,
148- pageItem : { } ,
149- prevItem : {
150- 'aria-label' : 'Previous item' ,
151- content : '⟨' ,
152- } ,
153- siblingRange : 1 ,
154- }
155-
156158Pagination . Item = PaginationItem
157159
158160export default Pagination
0 commit comments