diff --git a/packages/react-core/src/components/Pagination/Navigation.tsx b/packages/react-core/src/components/Pagination/Navigation.tsx index 487ccf0a681..54516b60a34 100644 --- a/packages/react-core/src/components/Pagination/Navigation.tsx +++ b/packages/react-core/src/components/Pagination/Navigation.tsx @@ -6,6 +6,7 @@ import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-do import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon'; import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon'; import { Button, ButtonVariant } from '../Button'; +import { TextInput } from '../TextInput'; import { OnSetPage } from './Pagination'; import { pluralize, PickOptional } from '../../helpers'; import { KeyTypes } from '../../helpers/constants'; @@ -28,7 +29,7 @@ export interface NavigationProps extends React.HTMLProps { /** Label for the English word "of". */ ofWord?: string; /** The number of the current page. */ - page: React.ReactText; + page: string | number; /** The title of a page displayed beside the page number. */ pagesTitle?: string; /** The title of a page displayed beside the page number (the plural form). */ @@ -102,9 +103,9 @@ export class Navigation extends React.Component, lastPage: number): void { - const inputPage = Navigation.parseInteger(event.target.value, lastPage); - this.setState({ userInputPage: Number.isNaN(inputPage as number) ? event.target.value : inputPage }); + private onChange(event: React.FormEvent, lastPage: number): void { + const inputPage = Navigation.parseInteger(event.currentTarget.value, lastPage); + this.setState({ userInputPage: Number.isNaN(inputPage as number) ? event.currentTarget.value : inputPage }); } private onKeyDown( @@ -217,11 +218,10 @@ export class Navigation extends React.Component {!isCompact && (
- = 0) || page === 0 } min={lastPage <= 0 && firstPage <= 0 ? 0 : 1} diff --git a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap index 984689fe09e..26c2defb2c4 100644 --- a/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap +++ b/packages/react-core/src/components/Pagination/__tests__/Generated/__snapshots__/Navigation.test.tsx.snap @@ -67,14 +67,21 @@ exports[`Navigation should match snapshot (auto-generated) 1`] = `
- + > + +
- + > + +
- + > + +
- + > + +
- + > + +
- + > + +
- + > + +
- + > + +