File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,7 @@ class Pagination extends Component<PaginationProps> {
331331 ref = { ( e ) => ( i === currentPage ? ( this . currentPageRef = e ) : null ) }
332332 key = { i }
333333 onClick = { ( ) => this . handleNavigation ( i , currentPage ) }
334+ onMouseEnter = { ( ) => this . handleOnMouseEnter ( i ) }
334335 current = { i === currentPage }
335336 { ...( this . props . screenReaderLabelPageButton
336337 ? {
@@ -615,6 +616,12 @@ class Pagination extends Component<PaginationProps> {
615616 ) : null
616617 }
617618
619+ handleOnMouseEnter = ( page : number ) => {
620+ if ( typeof this . props . onMouseEnter === 'function' ) {
621+ this . props . onMouseEnter ( page )
622+ }
623+ }
624+
618625 render ( ) {
619626 const currentPageIndex = fastFindIndex (
620627 this . childPages ,
Original file line number Diff line number Diff line change @@ -182,6 +182,11 @@ type PaginationOwnProps = {
182182 */
183183 onPageChange ?: ( next : number , prev : number ) => void
184184
185+ /**
186+ * Called when a page is hovered.
187+ */
188+ onMouseEnter ?: ( page : number ) => void
189+
185190 /**
186191 * Renders the visible pages
187192 */
@@ -234,6 +239,7 @@ const propTypes: PropValidators<PropKeys> = {
234239 siblingCount : PropTypes . number ,
235240 boundaryCount : PropTypes . number ,
236241 onPageChange : PropTypes . func ,
242+ onMouseEnter : PropTypes . func ,
237243 renderPageIndicator : PropTypes . func ,
238244 ellipsis : PropTypes . node
239245}
@@ -263,7 +269,8 @@ const allowedProps: AllowedPropKeys = [
263269 'siblingCount' ,
264270 'boundaryCount' ,
265271 'renderPageIndicator' ,
266- 'ellipsis'
272+ 'ellipsis' ,
273+ 'onMouseEnter'
267274]
268275
269276type PaginationSnapshot = {
You can’t perform that action at this time.
0 commit comments