@instructure/ui-pagination 8.33.1-snapshot-1 → 8.33.2-snapshot-5
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/CHANGELOG.md +4 -8
- package/es/Pagination/PaginationArrowButton/PaginationArrowButtonLocator.js +5 -4
- package/es/Pagination/PaginationArrowButton/index.js +6 -19
- package/es/Pagination/PaginationArrowButton/props.js +5 -1
- package/es/Pagination/PaginationButton/index.js +1 -5
- package/es/Pagination/PaginationButton/props.js +5 -1
- package/es/Pagination/PaginationLocator.js +4 -2
- package/es/Pagination/PaginationPageInput/PaginationPageInputLocator.js +5 -2
- package/es/Pagination/PaginationPageInput/index.js +15 -40
- package/es/Pagination/PaginationPageInput/props.js +1 -0
- package/es/Pagination/PaginationPageInput/styles.js +0 -1
- package/es/Pagination/PaginationPageInput/theme.js +2 -2
- package/es/Pagination/index.js +11 -57
- package/es/Pagination/locator.js +1 -0
- package/es/Pagination/props.js +1 -0
- package/es/Pagination/styles.js +0 -1
- package/es/index.js +1 -0
- package/lib/Pagination/PaginationArrowButton/PaginationArrowButtonLocator.js +4 -7
- package/lib/Pagination/PaginationArrowButton/index.js +4 -31
- package/lib/Pagination/PaginationArrowButton/locator.js +0 -2
- package/lib/Pagination/PaginationArrowButton/props.js +4 -4
- package/lib/Pagination/PaginationButton/index.js +0 -11
- package/lib/Pagination/PaginationButton/props.js +4 -4
- package/lib/Pagination/PaginationLocator.js +3 -6
- package/lib/Pagination/PaginationPageInput/PaginationPageInputLocator.js +4 -5
- package/lib/Pagination/PaginationPageInput/index.js +14 -49
- package/lib/Pagination/PaginationPageInput/props.js +1 -3
- package/lib/Pagination/PaginationPageInput/styles.js +0 -2
- package/lib/Pagination/PaginationPageInput/theme.js +2 -3
- package/lib/Pagination/index.js +11 -74
- package/lib/Pagination/locator.js +0 -2
- package/lib/Pagination/props.js +1 -6
- package/lib/Pagination/styles.js +0 -2
- package/lib/index.js +0 -1
- package/package.json +21 -21
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.33.
|
|
6
|
+
## [8.33.2-snapshot-5](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2-snapshot-5) (2023-01-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-pagination
|
|
9
9
|
|
|
@@ -11,22 +11,18 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## [8.33.1](https://github.com/instructure/instructure-ui/compare/v8.33.0...v8.33.1) (2023-01-06)
|
|
15
15
|
|
|
16
16
|
**Note:** Version bump only for package @instructure/ui-pagination
|
|
17
17
|
|
|
18
|
+
# [8.33.0](https://github.com/instructure/instructure-ui/compare/v8.32.1...v8.33.0) (2023-01-04)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
**Note:** Version bump only for package @instructure/ui-pagination
|
|
21
21
|
|
|
22
22
|
## [8.32.1](https://github.com/instructure/instructure-ui/compare/v8.30.0...v8.32.1) (2022-12-01)
|
|
23
23
|
|
|
24
24
|
**Note:** Version bump only for package @instructure/ui-pagination
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
26
|
# [8.32.0](https://github.com/instructure/instructure-ui/compare/v8.31.0...v8.32.0) (2022-11-23)
|
|
31
27
|
|
|
32
28
|
**Note:** Version bump only for package @instructure/ui-pagination
|
|
@@ -21,13 +21,15 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
|
-
import { find } from '@instructure/ui-test-queries';
|
|
26
|
+
import { find } from '@instructure/ui-test-queries';
|
|
27
|
+
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
26
28
|
// eslint-disable-next-line no-restricted-imports
|
|
27
|
-
|
|
28
29
|
import { TooltipLocator } from '@instructure/ui-tooltip/es/Tooltip/TooltipLocator';
|
|
29
30
|
import { PaginationArrowButton } from './index';
|
|
30
|
-
export const PaginationArrowButtonLocator = locator(
|
|
31
|
+
export const PaginationArrowButtonLocator = locator(
|
|
32
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
31
33
|
PaginationArrowButton.selector, {
|
|
32
34
|
findTooltipContent: function () {
|
|
33
35
|
return TooltipLocator.findContent(...arguments);
|
|
@@ -36,7 +38,6 @@ PaginationArrowButton.selector, {
|
|
|
36
38
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
37
39
|
args[_key - 1] = arguments[_key];
|
|
38
40
|
}
|
|
39
|
-
|
|
40
41
|
return (await find(element, 'a,button,[role="button"]')).click(...args);
|
|
41
42
|
}
|
|
42
43
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["label", "direction", "buttonRef"];
|
|
3
|
-
|
|
4
3
|
var _dec, _class, _class2;
|
|
5
|
-
|
|
6
4
|
/*
|
|
7
5
|
* The MIT License (MIT)
|
|
8
6
|
*
|
|
@@ -26,6 +24,7 @@ var _dec, _class, _class2;
|
|
|
26
24
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
25
|
* SOFTWARE.
|
|
28
26
|
*/
|
|
27
|
+
|
|
29
28
|
import React, { Component } from 'react';
|
|
30
29
|
import { IconButton } from '@instructure/ui-buttons';
|
|
31
30
|
import { PresentationContent } from '@instructure/ui-a11y-content';
|
|
@@ -33,6 +32,7 @@ import { Tooltip } from '@instructure/ui-tooltip';
|
|
|
33
32
|
import { IconArrowOpenStartSolid, IconArrowOpenEndSolid, IconArrowDoubleStartSolid, IconArrowDoubleEndSolid } from '@instructure/ui-icons';
|
|
34
33
|
import { testable } from '@instructure/ui-testable';
|
|
35
34
|
import { allowedProps, propTypes } from './props';
|
|
35
|
+
|
|
36
36
|
/**
|
|
37
37
|
---
|
|
38
38
|
parent: Pagination
|
|
@@ -40,56 +40,44 @@ id: Pagination.Navigation
|
|
|
40
40
|
---
|
|
41
41
|
@tsProps
|
|
42
42
|
**/
|
|
43
|
-
|
|
44
43
|
let PaginationArrowButton = (_dec = testable(), _dec(_class = (_class2 = class PaginationArrowButton extends Component {
|
|
45
44
|
constructor() {
|
|
46
45
|
super(...arguments);
|
|
47
46
|
this.ref = null;
|
|
48
|
-
|
|
49
47
|
this.handleRef = el => {
|
|
50
48
|
this.ref = el;
|
|
51
49
|
};
|
|
52
50
|
}
|
|
53
|
-
|
|
54
51
|
get margin() {
|
|
55
52
|
switch (this.props.direction) {
|
|
56
53
|
case 'first':
|
|
57
54
|
return '0 xx-small 0 0';
|
|
58
|
-
|
|
59
55
|
case 'last':
|
|
60
56
|
return '0 0 0 xx-small';
|
|
61
|
-
|
|
62
57
|
default:
|
|
63
58
|
return void 0;
|
|
64
59
|
}
|
|
65
60
|
}
|
|
66
|
-
|
|
67
61
|
get Icon() {
|
|
68
62
|
switch (this.props.direction) {
|
|
69
63
|
case 'first':
|
|
70
64
|
return IconArrowDoubleStartSolid;
|
|
71
|
-
|
|
72
65
|
case 'prev':
|
|
73
66
|
return IconArrowOpenStartSolid;
|
|
74
|
-
|
|
75
67
|
case 'next':
|
|
76
68
|
return IconArrowOpenEndSolid;
|
|
77
|
-
|
|
78
69
|
case 'last':
|
|
79
70
|
return IconArrowDoubleEndSolid;
|
|
80
|
-
|
|
81
71
|
default:
|
|
82
72
|
return null;
|
|
83
73
|
}
|
|
84
74
|
}
|
|
85
|
-
|
|
86
75
|
render() {
|
|
87
76
|
const _this$props = this.props,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
label = _this$props.label,
|
|
78
|
+
direction = _this$props.direction,
|
|
79
|
+
buttonRef = _this$props.buttonRef,
|
|
80
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
93
81
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
94
82
|
elementRef: this.handleRef,
|
|
95
83
|
on: ['hover', 'focus'],
|
|
@@ -104,7 +92,6 @@ let PaginationArrowButton = (_dec = testable(), _dec(_class = (_class2 = class P
|
|
|
104
92
|
margin: this.margin
|
|
105
93
|
}), this.Icon));
|
|
106
94
|
}
|
|
107
|
-
|
|
108
95
|
}, _class2.displayName = "PaginationArrowButton", _class2.componentId = 'Pagination.Navigation', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {}, _class2)) || _class);
|
|
109
96
|
export default PaginationArrowButton;
|
|
110
97
|
export { PaginationArrowButton };
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
const propTypes = {
|
|
26
27
|
direction: PropTypes.oneOf(['first', 'prev', 'next', 'last']),
|
|
@@ -28,7 +29,10 @@ const propTypes = {
|
|
|
28
29
|
buttonRef: PropTypes.func,
|
|
29
30
|
onClick: PropTypes.func
|
|
30
31
|
};
|
|
31
|
-
const allowedProps = ['direction', 'label', 'buttonRef'
|
|
32
|
+
const allowedProps = ['direction', 'label', 'buttonRef'
|
|
33
|
+
|
|
34
|
+
// we don't want to pass onClick
|
|
32
35
|
// 'onClick'
|
|
33
36
|
];
|
|
37
|
+
|
|
34
38
|
export { propTypes, allowedProps };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -23,12 +22,12 @@ var _dec, _class, _class2;
|
|
|
23
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
23
|
* SOFTWARE.
|
|
25
24
|
*/
|
|
25
|
+
|
|
26
26
|
import React, { Component } from 'react';
|
|
27
27
|
import { BaseButton } from '@instructure/ui-buttons';
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
29
29
|
import { testable } from '@instructure/ui-testable';
|
|
30
30
|
import { propTypes, allowedProps } from './props';
|
|
31
|
-
|
|
32
31
|
/**
|
|
33
32
|
---
|
|
34
33
|
parent: Pagination
|
|
@@ -39,12 +38,10 @@ let PaginationButton = (_dec = testable(), _dec(_class = (_class2 = class Pagina
|
|
|
39
38
|
constructor() {
|
|
40
39
|
super(...arguments);
|
|
41
40
|
this.ref = null;
|
|
42
|
-
|
|
43
41
|
this.handleRef = el => {
|
|
44
42
|
this.ref = el;
|
|
45
43
|
};
|
|
46
44
|
}
|
|
47
|
-
|
|
48
45
|
render() {
|
|
49
46
|
const exclude = this.props.current ? ['onClick', 'href'] : [];
|
|
50
47
|
const props = omitProps(this.props, PaginationButton.allowedProps, exclude);
|
|
@@ -57,7 +54,6 @@ let PaginationButton = (_dec = testable(), _dec(_class = (_class2 = class Pagina
|
|
|
57
54
|
elementRef: this.handleRef
|
|
58
55
|
}), this.props.children);
|
|
59
56
|
}
|
|
60
|
-
|
|
61
57
|
}, _class2.displayName = "PaginationButton", _class2.componentId = 'Pagination.Page', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
62
58
|
current: false
|
|
63
59
|
}, _class2)) || _class);
|
|
@@ -21,13 +21,17 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
const propTypes = {
|
|
26
27
|
children: PropTypes.node.isRequired,
|
|
27
28
|
current: PropTypes.bool,
|
|
28
29
|
onClick: PropTypes.func
|
|
29
30
|
};
|
|
30
|
-
const allowedProps = ['children', 'current'
|
|
31
|
+
const allowedProps = ['children', 'current'
|
|
32
|
+
|
|
33
|
+
// we don't want to pass onClick
|
|
31
34
|
// 'onClick'
|
|
32
35
|
];
|
|
36
|
+
|
|
33
37
|
export { propTypes, allowedProps };
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
import { locator } from '@instructure/ui-test-locator';
|
|
25
25
|
import { PaginationPageInputLocator } from './PaginationPageInput/PaginationPageInputLocator';
|
|
26
26
|
import { PaginationArrowButtonLocator } from './PaginationArrowButton/PaginationArrowButtonLocator';
|
|
27
|
-
import { Pagination } from './index';
|
|
27
|
+
import { Pagination } from './index';
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
30
|
+
const PaginationButtonLocator = locator(Pagination.Page.selector);
|
|
30
31
|
|
|
32
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
31
33
|
export const PaginationLocator = locator(Pagination.selector, {
|
|
32
34
|
findAllPageButtons: async function () {
|
|
33
35
|
return PaginationButtonLocator.findAll(...arguments);
|
|
@@ -21,12 +21,15 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
import { locator } from '@instructure/ui-test-locator'; // @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
25
24
|
|
|
25
|
+
import { locator } from '@instructure/ui-test-locator';
|
|
26
|
+
|
|
27
|
+
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
26
28
|
import { NumberInputLocator } from '@instructure/ui-number-input/es/NumberInput/NumberInputLocator'; // eslint-disable-line no-restricted-imports
|
|
27
29
|
|
|
28
30
|
import { PaginationPageInput } from './index';
|
|
29
|
-
export const PaginationPageInputLocator = locator(
|
|
31
|
+
export const PaginationPageInputLocator = locator(
|
|
32
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
30
33
|
PaginationPageInput.selector, {
|
|
31
34
|
findInput: function () {
|
|
32
35
|
return NumberInputLocator.findInput(...arguments);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _class, _class2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -23,8 +22,8 @@ var _dec, _dec2, _class, _class2;
|
|
|
23
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
23
|
* SOFTWARE.
|
|
25
24
|
*/
|
|
26
|
-
|
|
27
25
|
/** @jsx jsx */
|
|
26
|
+
|
|
28
27
|
import React, { Component } from 'react';
|
|
29
28
|
import { testable } from '@instructure/ui-testable';
|
|
30
29
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
@@ -33,7 +32,6 @@ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
|
33
32
|
import generateStyle from './styles';
|
|
34
33
|
import generateComponentTheme from './theme';
|
|
35
34
|
import { propTypes, allowedProps } from './props';
|
|
36
|
-
|
|
37
35
|
/**
|
|
38
36
|
---
|
|
39
37
|
parent: Pagination
|
|
@@ -45,108 +43,89 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
45
43
|
constructor(props) {
|
|
46
44
|
super(props);
|
|
47
45
|
this.ref = null;
|
|
48
|
-
|
|
49
46
|
this.handleRef = el => {
|
|
50
47
|
this.ref = el;
|
|
51
48
|
};
|
|
52
|
-
|
|
53
49
|
this.handleInputRef = el => {
|
|
54
50
|
if (typeof this.props.inputRef === 'function') {
|
|
55
51
|
this.props.inputRef(el);
|
|
56
52
|
}
|
|
57
53
|
};
|
|
58
|
-
|
|
59
54
|
this.handleChange = (_event, value) => {
|
|
60
|
-
let newValue = value;
|
|
55
|
+
let newValue = value;
|
|
61
56
|
|
|
57
|
+
// if the last character was not a number, don't accept it
|
|
62
58
|
if (value.length > 0 && isNaN(value.slice(-1))) {
|
|
63
59
|
newValue = value.slice(0, -1);
|
|
64
60
|
}
|
|
65
|
-
|
|
66
61
|
this.setState({
|
|
67
62
|
number: newValue ? Number(newValue) : this.MIN,
|
|
68
63
|
value: newValue
|
|
69
64
|
});
|
|
70
65
|
};
|
|
71
|
-
|
|
72
66
|
this.handleDecrement = event => {
|
|
73
67
|
this.setNewPage(event, Math.floor(this.currentPage - 1));
|
|
74
68
|
};
|
|
75
|
-
|
|
76
69
|
this.handleIncrement = event => {
|
|
77
70
|
this.setNewPage(event, Math.floor(this.currentPage + 1));
|
|
78
71
|
};
|
|
79
|
-
|
|
80
72
|
this.handleBlur = event => {
|
|
81
73
|
this.setNewPage(event, Math.round(this.state.number));
|
|
82
74
|
};
|
|
83
|
-
|
|
84
75
|
this.state = this.initialState;
|
|
85
76
|
}
|
|
86
|
-
|
|
87
77
|
get currentPage() {
|
|
88
78
|
return this.props.currentPageIndex + 1;
|
|
89
79
|
}
|
|
90
|
-
|
|
91
80
|
get initialState() {
|
|
92
81
|
return {
|
|
93
82
|
number: this.currentPage,
|
|
94
83
|
value: `${this.currentPage}`
|
|
95
84
|
};
|
|
96
85
|
}
|
|
97
|
-
|
|
98
86
|
get MIN() {
|
|
99
87
|
return 1;
|
|
100
88
|
}
|
|
101
|
-
|
|
102
89
|
get MAX() {
|
|
103
90
|
return this.props.numberOfPages;
|
|
104
91
|
}
|
|
105
|
-
|
|
106
92
|
componentDidMount() {
|
|
107
93
|
var _this$props$makeStyle, _this$props;
|
|
108
|
-
|
|
109
94
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
110
95
|
}
|
|
111
|
-
|
|
112
96
|
componentDidUpdate(prevProps) {
|
|
113
97
|
var _this$props$makeStyle2, _this$props2;
|
|
98
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
114
99
|
|
|
115
|
-
|
|
100
|
+
// when the current page changes from outside (e.g.: from arrow buttons),
|
|
116
101
|
// we update the initial state
|
|
117
|
-
|
|
118
102
|
if (this.props.currentPageIndex !== prevProps.currentPageIndex) {
|
|
119
103
|
this.resetInitialState();
|
|
120
104
|
}
|
|
121
105
|
}
|
|
122
|
-
|
|
123
106
|
resetInitialState() {
|
|
124
107
|
this.setState(this.initialState);
|
|
125
108
|
}
|
|
126
|
-
|
|
127
109
|
handleKeyDown(event) {
|
|
128
110
|
const key = event.key;
|
|
129
|
-
|
|
130
111
|
if (key.toLowerCase() === 'enter') {
|
|
131
112
|
const _this$state = this.state,
|
|
132
|
-
|
|
133
|
-
|
|
113
|
+
value = _this$state.value,
|
|
114
|
+
number = _this$state.number;
|
|
134
115
|
|
|
116
|
+
// If it is invalid, we reset the input to the current page
|
|
135
117
|
if (value === '' || isNaN(value)) {
|
|
136
118
|
this.resetInitialState();
|
|
137
119
|
return;
|
|
138
120
|
}
|
|
139
|
-
|
|
140
121
|
this.setNewPage(event, number);
|
|
141
122
|
}
|
|
142
123
|
}
|
|
143
|
-
|
|
144
124
|
getNumberWithinRange(n) {
|
|
145
125
|
if (n < this.MIN) return this.MIN;
|
|
146
126
|
if (n > this.MAX) return this.MAX;
|
|
147
127
|
return n;
|
|
148
128
|
}
|
|
149
|
-
|
|
150
129
|
setNewPage(event, n) {
|
|
151
130
|
const number = this.getNumberWithinRange(n);
|
|
152
131
|
this.setState({
|
|
@@ -155,28 +134,25 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
155
134
|
});
|
|
156
135
|
this.props.onChange(event, number - 1);
|
|
157
136
|
}
|
|
158
|
-
|
|
159
137
|
renderLabel() {
|
|
160
138
|
const _this$props3 = this.props,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
label = _this$props3.label,
|
|
140
|
+
numberOfPages = _this$props3.numberOfPages,
|
|
141
|
+
styles = _this$props3.styles;
|
|
164
142
|
return typeof label === 'function' && label(numberOfPages) ? jsx("span", {
|
|
165
143
|
css: styles === null || styles === void 0 ? void 0 : styles.inputLabel
|
|
166
144
|
}, label(numberOfPages)) : null;
|
|
167
145
|
}
|
|
168
|
-
|
|
169
146
|
renderScreenReaderLabel() {
|
|
170
147
|
const _this$props4 = this.props,
|
|
171
|
-
|
|
172
|
-
|
|
148
|
+
screenReaderLabel = _this$props4.screenReaderLabel,
|
|
149
|
+
numberOfPages = _this$props4.numberOfPages;
|
|
173
150
|
return jsx(ScreenReaderContent, null, screenReaderLabel(this.currentPage, numberOfPages));
|
|
174
151
|
}
|
|
175
|
-
|
|
176
152
|
render() {
|
|
177
153
|
const _this$props5 = this.props,
|
|
178
|
-
|
|
179
|
-
|
|
154
|
+
styles = _this$props5.styles,
|
|
155
|
+
disabled = _this$props5.disabled;
|
|
180
156
|
return jsx("span", {
|
|
181
157
|
css: styles === null || styles === void 0 ? void 0 : styles.paginationPageInput,
|
|
182
158
|
ref: this.handleRef
|
|
@@ -197,7 +173,6 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
197
173
|
inputRef: this.handleInputRef
|
|
198
174
|
})), this.renderLabel());
|
|
199
175
|
}
|
|
200
|
-
|
|
201
176
|
}, _class2.displayName = "PaginationPageInput", _class2.componentId = 'Pagination.PageInput', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
202
177
|
disabled: false
|
|
203
178
|
}, _class2)) || _class) || _class);
|