@instructure/ui-pagination 8.25.1-snapshot-7 → 8.25.1-snapshot-10
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 +1 -1
- package/es/Pagination/PaginationArrowButton/index.js +12 -11
- package/es/Pagination/PaginationButton/index.js +14 -13
- package/es/Pagination/PaginationPageInput/index.js +43 -42
- package/es/Pagination/index.js +39 -33
- package/lib/Pagination/PaginationArrowButton/index.js +12 -11
- package/lib/Pagination/PaginationButton/index.js +14 -13
- package/lib/Pagination/PaginationPageInput/index.js +43 -42
- package/lib/Pagination/index.js +39 -33
- package/package.json +21 -21
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Pagination/PaginationArrowButton/PaginationArrowButtonLocator.d.ts +4 -4
- package/types/Pagination/PaginationLocator.d.ts +24 -24
- package/types/Pagination/PaginationPageInput/PaginationPageInputLocator.d.ts +4 -4
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.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-10](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-10) (2022-06-20)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-pagination
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["label", "direction", "buttonRef"];
|
|
3
3
|
|
|
4
|
-
var _dec, _class
|
|
4
|
+
var _dec, _class;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -41,15 +41,16 @@ id: Pagination.Navigation
|
|
|
41
41
|
@tsProps
|
|
42
42
|
**/
|
|
43
43
|
|
|
44
|
-
let PaginationArrowButton = (_dec = testable(), _dec(_class =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
let PaginationArrowButton = (_dec = testable(), _dec(_class = class PaginationArrowButton extends Component {
|
|
45
|
+
static displayName = "PaginationArrowButton";
|
|
46
|
+
static componentId = 'Pagination.Navigation';
|
|
47
|
+
static allowedProps = allowedProps;
|
|
48
|
+
static propTypes = propTypes;
|
|
49
|
+
static defaultProps = {};
|
|
50
|
+
ref = null;
|
|
51
|
+
handleRef = el => {
|
|
52
|
+
this.ref = el;
|
|
53
|
+
};
|
|
53
54
|
|
|
54
55
|
get margin() {
|
|
55
56
|
switch (this.props.direction) {
|
|
@@ -105,6 +106,6 @@ let PaginationArrowButton = (_dec = testable(), _dec(_class = (_class2 = class P
|
|
|
105
106
|
}), this.Icon));
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
}
|
|
109
|
+
}) || _class);
|
|
109
110
|
export default PaginationArrowButton;
|
|
110
111
|
export { PaginationArrowButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
1
|
+
var _dec, _class;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -35,15 +35,18 @@ parent: Pagination
|
|
|
35
35
|
id: Pagination.Page
|
|
36
36
|
---
|
|
37
37
|
**/
|
|
38
|
-
let PaginationButton = (_dec = testable(), _dec(_class =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
let PaginationButton = (_dec = testable(), _dec(_class = class PaginationButton extends Component {
|
|
39
|
+
static displayName = "PaginationButton";
|
|
40
|
+
static componentId = 'Pagination.Page';
|
|
41
|
+
static propTypes = propTypes;
|
|
42
|
+
static allowedProps = allowedProps;
|
|
43
|
+
static defaultProps = {
|
|
44
|
+
current: false
|
|
45
|
+
};
|
|
46
|
+
ref = null;
|
|
47
|
+
handleRef = el => {
|
|
48
|
+
this.ref = el;
|
|
49
|
+
};
|
|
47
50
|
|
|
48
51
|
render() {
|
|
49
52
|
const exclude = this.props.current ? ['onClick', 'href'] : [];
|
|
@@ -58,8 +61,6 @@ let PaginationButton = (_dec = testable(), _dec(_class = (_class2 = class Pagina
|
|
|
58
61
|
}), this.props.children);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
}
|
|
62
|
-
current: false
|
|
63
|
-
}, _class2)) || _class);
|
|
64
|
+
}) || _class);
|
|
64
65
|
export default PaginationButton;
|
|
65
66
|
export { PaginationButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class
|
|
1
|
+
var _dec, _dec2, _class;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -41,46 +41,18 @@ id: Pagination.PageInput
|
|
|
41
41
|
---
|
|
42
42
|
@tsProps
|
|
43
43
|
**/
|
|
44
|
-
let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class =
|
|
44
|
+
let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = class PaginationPageInput extends Component {
|
|
45
|
+
static displayName = "PaginationPageInput";
|
|
46
|
+
static componentId = 'Pagination.PageInput';
|
|
47
|
+
static propTypes = propTypes;
|
|
48
|
+
static allowedProps = allowedProps;
|
|
49
|
+
static defaultProps = {
|
|
50
|
+
disabled: false
|
|
51
|
+
};
|
|
52
|
+
ref = null;
|
|
53
|
+
|
|
45
54
|
constructor(props) {
|
|
46
55
|
super(props);
|
|
47
|
-
this.ref = null;
|
|
48
|
-
|
|
49
|
-
this.handleRef = el => {
|
|
50
|
-
this.ref = el;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
this.handleInputRef = el => {
|
|
54
|
-
if (typeof this.props.inputRef === 'function') {
|
|
55
|
-
this.props.inputRef(el);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
this.handleChange = (_event, value) => {
|
|
60
|
-
let newValue = value; // if the last character was not a number, don't accept it
|
|
61
|
-
|
|
62
|
-
if (value.length > 0 && isNaN(value.slice(-1))) {
|
|
63
|
-
newValue = value.slice(0, -1);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
this.setState({
|
|
67
|
-
number: newValue ? Number(newValue) : this.MIN,
|
|
68
|
-
value: newValue
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
this.handleDecrement = event => {
|
|
73
|
-
this.setNewPage(event, Math.floor(this.currentPage - 1));
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
this.handleIncrement = event => {
|
|
77
|
-
this.setNewPage(event, Math.floor(this.currentPage + 1));
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
this.handleBlur = event => {
|
|
81
|
-
this.setNewPage(event, Math.round(this.state.number));
|
|
82
|
-
};
|
|
83
|
-
|
|
84
56
|
this.state = this.initialState;
|
|
85
57
|
}
|
|
86
58
|
|
|
@@ -124,6 +96,27 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
124
96
|
this.setState(this.initialState);
|
|
125
97
|
}
|
|
126
98
|
|
|
99
|
+
handleRef = el => {
|
|
100
|
+
this.ref = el;
|
|
101
|
+
};
|
|
102
|
+
handleInputRef = el => {
|
|
103
|
+
if (typeof this.props.inputRef === 'function') {
|
|
104
|
+
this.props.inputRef(el);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
handleChange = (_event, value) => {
|
|
108
|
+
let newValue = value; // if the last character was not a number, don't accept it
|
|
109
|
+
|
|
110
|
+
if (value.length > 0 && isNaN(value.slice(-1))) {
|
|
111
|
+
newValue = value.slice(0, -1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
this.setState({
|
|
115
|
+
number: newValue ? Number(newValue) : this.MIN,
|
|
116
|
+
value: newValue
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
|
|
127
120
|
handleKeyDown(event) {
|
|
128
121
|
const key = event.key;
|
|
129
122
|
|
|
@@ -141,6 +134,16 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
141
134
|
}
|
|
142
135
|
}
|
|
143
136
|
|
|
137
|
+
handleDecrement = event => {
|
|
138
|
+
this.setNewPage(event, Math.floor(this.currentPage - 1));
|
|
139
|
+
};
|
|
140
|
+
handleIncrement = event => {
|
|
141
|
+
this.setNewPage(event, Math.floor(this.currentPage + 1));
|
|
142
|
+
};
|
|
143
|
+
handleBlur = event => {
|
|
144
|
+
this.setNewPage(event, Math.round(this.state.number));
|
|
145
|
+
};
|
|
146
|
+
|
|
144
147
|
getNumberWithinRange(n) {
|
|
145
148
|
if (n < this.MIN) return this.MIN;
|
|
146
149
|
if (n > this.MAX) return this.MAX;
|
|
@@ -198,8 +201,6 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
198
201
|
})), this.renderLabel());
|
|
199
202
|
}
|
|
200
203
|
|
|
201
|
-
}
|
|
202
|
-
disabled: false
|
|
203
|
-
}, _class2)) || _class) || _class);
|
|
204
|
+
}) || _class) || _class);
|
|
204
205
|
export default PaginationPageInput;
|
|
205
206
|
export { PaginationPageInput };
|
package/es/Pagination/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _dec3, _class,
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _span, _span2;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -61,30 +61,32 @@ category: components
|
|
|
61
61
|
---
|
|
62
62
|
@tsProps
|
|
63
63
|
**/
|
|
64
|
-
let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class =
|
|
64
|
+
let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = class Pagination extends Component {
|
|
65
|
+
static displayName = "Pagination";
|
|
66
|
+
static componentId = 'Pagination';
|
|
67
|
+
static propTypes = propTypes;
|
|
68
|
+
static allowedProps = allowedProps;
|
|
69
|
+
static defaultProps = {
|
|
70
|
+
disabled: false,
|
|
71
|
+
withFirstAndLastButton: false,
|
|
72
|
+
showDisabledButtons: false,
|
|
73
|
+
variant: 'full',
|
|
74
|
+
as: 'div',
|
|
75
|
+
labelNumberInput: numberOfPages => `of ${numberOfPages}`,
|
|
76
|
+
screenReaderLabelNumberInput: (currentPage, numberOfPages) => `Select page (${currentPage} of ${numberOfPages})`,
|
|
77
|
+
shouldHandleFocus: true
|
|
78
|
+
};
|
|
79
|
+
static Page = PaginationButton;
|
|
80
|
+
static Navigation = PaginationArrowButton;
|
|
81
|
+
_labelId;
|
|
82
|
+
_firstButton = null;
|
|
83
|
+
_prevButton = null;
|
|
84
|
+
_nextButton = null;
|
|
85
|
+
_lastButton = null;
|
|
86
|
+
ref = null;
|
|
87
|
+
|
|
65
88
|
constructor(props) {
|
|
66
89
|
super(props);
|
|
67
|
-
this._labelId = void 0;
|
|
68
|
-
this._firstButton = null;
|
|
69
|
-
this._prevButton = null;
|
|
70
|
-
this._nextButton = null;
|
|
71
|
-
this._lastButton = null;
|
|
72
|
-
this.ref = null;
|
|
73
|
-
|
|
74
|
-
this.handleElementRef = el => {
|
|
75
|
-
this.ref = el;
|
|
76
|
-
|
|
77
|
-
if (el && typeof this.props.elementRef === 'function') {
|
|
78
|
-
this.props.elementRef(el);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
this.handleInputRef = el => {
|
|
83
|
-
if (typeof this.props.inputRef === 'function') {
|
|
84
|
-
this.props.inputRef(el);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
90
|
this._labelId = props.deterministicId();
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -175,6 +177,19 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
175
177
|
})) : children;
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
handleElementRef = el => {
|
|
181
|
+
this.ref = el;
|
|
182
|
+
|
|
183
|
+
if (el && typeof this.props.elementRef === 'function') {
|
|
184
|
+
this.props.elementRef(el);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
handleInputRef = el => {
|
|
188
|
+
if (typeof this.props.inputRef === 'function') {
|
|
189
|
+
this.props.inputRef(el);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
178
193
|
renderLabel() {
|
|
179
194
|
const display = this.props.variant === 'full' ? 'inline-block' : 'block';
|
|
180
195
|
const visibleLabel = hasVisibleChildren(this.props.label);
|
|
@@ -328,15 +343,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
328
343
|
}, this.renderArrowButton('first', currentPageIndex), this.renderArrowButton('prev', currentPageIndex), this.inputMode ? this.renderPageInput(currentPageIndex) : this.renderPages(currentPageIndex), this.renderArrowButton('next', currentPageIndex), this.renderArrowButton('last', currentPageIndex)));
|
|
329
344
|
}
|
|
330
345
|
|
|
331
|
-
}
|
|
332
|
-
disabled: false,
|
|
333
|
-
withFirstAndLastButton: false,
|
|
334
|
-
showDisabledButtons: false,
|
|
335
|
-
variant: 'full',
|
|
336
|
-
as: 'div',
|
|
337
|
-
labelNumberInput: numberOfPages => `of ${numberOfPages}`,
|
|
338
|
-
screenReaderLabelNumberInput: (currentPage, numberOfPages) => `Select page (${currentPage} of ${numberOfPages})`,
|
|
339
|
-
shouldHandleFocus: true
|
|
340
|
-
}, _class2.Page = PaginationButton, _class2.Navigation = PaginationArrowButton, _class2)) || _class) || _class) || _class);
|
|
346
|
+
}) || _class) || _class) || _class);
|
|
341
347
|
export default Pagination;
|
|
342
348
|
export { Pagination, PaginationButton };
|
|
@@ -33,7 +33,7 @@ var _props = require("./props");
|
|
|
33
33
|
|
|
34
34
|
const _excluded = ["label", "direction", "buttonRef"];
|
|
35
35
|
|
|
36
|
-
var _dec, _class
|
|
36
|
+
var _dec, _class;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
@@ -42,15 +42,16 @@ id: Pagination.Navigation
|
|
|
42
42
|
---
|
|
43
43
|
@tsProps
|
|
44
44
|
**/
|
|
45
|
-
let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class = class PaginationArrowButton extends _react.Component {
|
|
46
|
+
static displayName = "PaginationArrowButton";
|
|
47
|
+
static componentId = 'Pagination.Navigation';
|
|
48
|
+
static allowedProps = _props.allowedProps;
|
|
49
|
+
static propTypes = _props.propTypes;
|
|
50
|
+
static defaultProps = {};
|
|
51
|
+
ref = null;
|
|
52
|
+
handleRef = el => {
|
|
53
|
+
this.ref = el;
|
|
54
|
+
};
|
|
54
55
|
|
|
55
56
|
get margin() {
|
|
56
57
|
switch (this.props.direction) {
|
|
@@ -105,7 +106,7 @@ let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class = (_c
|
|
|
105
106
|
}), this.Icon));
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
}
|
|
109
|
+
}) || _class);
|
|
109
110
|
exports.PaginationArrowButton = PaginationArrowButton;
|
|
110
111
|
var _default = PaginationArrowButton;
|
|
111
112
|
exports.default = _default;
|
|
@@ -17,7 +17,7 @@ var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
|
17
17
|
|
|
18
18
|
var _props = require("./props");
|
|
19
19
|
|
|
20
|
-
var _dec, _class
|
|
20
|
+
var _dec, _class;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
---
|
|
@@ -25,15 +25,18 @@ parent: Pagination
|
|
|
25
25
|
id: Pagination.Page
|
|
26
26
|
---
|
|
27
27
|
**/
|
|
28
|
-
let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class = class PaginationButton extends _react.Component {
|
|
29
|
+
static displayName = "PaginationButton";
|
|
30
|
+
static componentId = 'Pagination.Page';
|
|
31
|
+
static propTypes = _props.propTypes;
|
|
32
|
+
static allowedProps = _props.allowedProps;
|
|
33
|
+
static defaultProps = {
|
|
34
|
+
current: false
|
|
35
|
+
};
|
|
36
|
+
ref = null;
|
|
37
|
+
handleRef = el => {
|
|
38
|
+
this.ref = el;
|
|
39
|
+
};
|
|
37
40
|
|
|
38
41
|
render() {
|
|
39
42
|
const exclude = this.props.current ? ['onClick', 'href'] : [];
|
|
@@ -48,9 +51,7 @@ let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class = (_class2
|
|
|
48
51
|
}), this.props.children);
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
}
|
|
52
|
-
current: false
|
|
53
|
-
}, _class2)) || _class);
|
|
54
|
+
}) || _class);
|
|
54
55
|
exports.PaginationButton = PaginationButton;
|
|
55
56
|
var _default = PaginationButton;
|
|
56
57
|
exports.default = _default;
|
|
@@ -25,7 +25,7 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
25
25
|
|
|
26
26
|
var _props = require("./props");
|
|
27
27
|
|
|
28
|
-
var _dec, _dec2, _class
|
|
28
|
+
var _dec, _dec2, _class;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
---
|
|
@@ -34,46 +34,18 @@ id: Pagination.PageInput
|
|
|
34
34
|
---
|
|
35
35
|
@tsProps
|
|
36
36
|
**/
|
|
37
|
-
let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class =
|
|
37
|
+
let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = class PaginationPageInput extends _react.Component {
|
|
38
|
+
static displayName = "PaginationPageInput";
|
|
39
|
+
static componentId = 'Pagination.PageInput';
|
|
40
|
+
static propTypes = _props.propTypes;
|
|
41
|
+
static allowedProps = _props.allowedProps;
|
|
42
|
+
static defaultProps = {
|
|
43
|
+
disabled: false
|
|
44
|
+
};
|
|
45
|
+
ref = null;
|
|
46
|
+
|
|
38
47
|
constructor(props) {
|
|
39
48
|
super(props);
|
|
40
|
-
this.ref = null;
|
|
41
|
-
|
|
42
|
-
this.handleRef = el => {
|
|
43
|
-
this.ref = el;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
this.handleInputRef = el => {
|
|
47
|
-
if (typeof this.props.inputRef === 'function') {
|
|
48
|
-
this.props.inputRef(el);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
this.handleChange = (_event, value) => {
|
|
53
|
-
let newValue = value; // if the last character was not a number, don't accept it
|
|
54
|
-
|
|
55
|
-
if (value.length > 0 && isNaN(value.slice(-1))) {
|
|
56
|
-
newValue = value.slice(0, -1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
this.setState({
|
|
60
|
-
number: newValue ? Number(newValue) : this.MIN,
|
|
61
|
-
value: newValue
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
this.handleDecrement = event => {
|
|
66
|
-
this.setNewPage(event, Math.floor(this.currentPage - 1));
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
this.handleIncrement = event => {
|
|
70
|
-
this.setNewPage(event, Math.floor(this.currentPage + 1));
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
this.handleBlur = event => {
|
|
74
|
-
this.setNewPage(event, Math.round(this.state.number));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
49
|
this.state = this.initialState;
|
|
78
50
|
}
|
|
79
51
|
|
|
@@ -117,6 +89,27 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
117
89
|
this.setState(this.initialState);
|
|
118
90
|
}
|
|
119
91
|
|
|
92
|
+
handleRef = el => {
|
|
93
|
+
this.ref = el;
|
|
94
|
+
};
|
|
95
|
+
handleInputRef = el => {
|
|
96
|
+
if (typeof this.props.inputRef === 'function') {
|
|
97
|
+
this.props.inputRef(el);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
handleChange = (_event, value) => {
|
|
101
|
+
let newValue = value; // if the last character was not a number, don't accept it
|
|
102
|
+
|
|
103
|
+
if (value.length > 0 && isNaN(value.slice(-1))) {
|
|
104
|
+
newValue = value.slice(0, -1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
this.setState({
|
|
108
|
+
number: newValue ? Number(newValue) : this.MIN,
|
|
109
|
+
value: newValue
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
120
113
|
handleKeyDown(event) {
|
|
121
114
|
const key = event.key;
|
|
122
115
|
|
|
@@ -134,6 +127,16 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
134
127
|
}
|
|
135
128
|
}
|
|
136
129
|
|
|
130
|
+
handleDecrement = event => {
|
|
131
|
+
this.setNewPage(event, Math.floor(this.currentPage - 1));
|
|
132
|
+
};
|
|
133
|
+
handleIncrement = event => {
|
|
134
|
+
this.setNewPage(event, Math.floor(this.currentPage + 1));
|
|
135
|
+
};
|
|
136
|
+
handleBlur = event => {
|
|
137
|
+
this.setNewPage(event, Math.round(this.state.number));
|
|
138
|
+
};
|
|
139
|
+
|
|
137
140
|
getNumberWithinRange(n) {
|
|
138
141
|
if (n < this.MIN) return this.MIN;
|
|
139
142
|
if (n > this.MAX) return this.MAX;
|
|
@@ -191,9 +194,7 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
191
194
|
})), this.renderLabel());
|
|
192
195
|
}
|
|
193
196
|
|
|
194
|
-
}
|
|
195
|
-
disabled: false
|
|
196
|
-
}, _class2)) || _class) || _class);
|
|
197
|
+
}) || _class) || _class);
|
|
197
198
|
exports.PaginationPageInput = PaginationPageInput;
|
|
198
199
|
var _default = PaginationPageInput;
|
|
199
200
|
exports.default = _default;
|
package/lib/Pagination/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
44
44
|
|
|
45
45
|
var _props = require("./props");
|
|
46
46
|
|
|
47
|
-
var _dec, _dec2, _dec3, _class,
|
|
47
|
+
var _dec, _dec2, _dec3, _class, _span, _span2;
|
|
48
48
|
|
|
49
49
|
/** This is an [].findIndex optimized to work on really big, but sparse, arrays */
|
|
50
50
|
const fastFindIndex = (arr, fn) => Number(Object.keys(arr).find(k => fn(arr[Number(k)])));
|
|
@@ -69,30 +69,32 @@ category: components
|
|
|
69
69
|
---
|
|
70
70
|
@tsProps
|
|
71
71
|
**/
|
|
72
|
-
let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class =
|
|
72
|
+
let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = class Pagination extends _react.Component {
|
|
73
|
+
static displayName = "Pagination";
|
|
74
|
+
static componentId = 'Pagination';
|
|
75
|
+
static propTypes = _props.propTypes;
|
|
76
|
+
static allowedProps = _props.allowedProps;
|
|
77
|
+
static defaultProps = {
|
|
78
|
+
disabled: false,
|
|
79
|
+
withFirstAndLastButton: false,
|
|
80
|
+
showDisabledButtons: false,
|
|
81
|
+
variant: 'full',
|
|
82
|
+
as: 'div',
|
|
83
|
+
labelNumberInput: numberOfPages => `of ${numberOfPages}`,
|
|
84
|
+
screenReaderLabelNumberInput: (currentPage, numberOfPages) => `Select page (${currentPage} of ${numberOfPages})`,
|
|
85
|
+
shouldHandleFocus: true
|
|
86
|
+
};
|
|
87
|
+
static Page = _PaginationButton.PaginationButton;
|
|
88
|
+
static Navigation = _PaginationArrowButton.PaginationArrowButton;
|
|
89
|
+
_labelId;
|
|
90
|
+
_firstButton = null;
|
|
91
|
+
_prevButton = null;
|
|
92
|
+
_nextButton = null;
|
|
93
|
+
_lastButton = null;
|
|
94
|
+
ref = null;
|
|
95
|
+
|
|
73
96
|
constructor(props) {
|
|
74
97
|
super(props);
|
|
75
|
-
this._labelId = void 0;
|
|
76
|
-
this._firstButton = null;
|
|
77
|
-
this._prevButton = null;
|
|
78
|
-
this._nextButton = null;
|
|
79
|
-
this._lastButton = null;
|
|
80
|
-
this.ref = null;
|
|
81
|
-
|
|
82
|
-
this.handleElementRef = el => {
|
|
83
|
-
this.ref = el;
|
|
84
|
-
|
|
85
|
-
if (el && typeof this.props.elementRef === 'function') {
|
|
86
|
-
this.props.elementRef(el);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
this.handleInputRef = el => {
|
|
91
|
-
if (typeof this.props.inputRef === 'function') {
|
|
92
|
-
this.props.inputRef(el);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
98
|
this._labelId = props.deterministicId();
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -183,6 +185,19 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
183
185
|
})) : children;
|
|
184
186
|
}
|
|
185
187
|
|
|
188
|
+
handleElementRef = el => {
|
|
189
|
+
this.ref = el;
|
|
190
|
+
|
|
191
|
+
if (el && typeof this.props.elementRef === 'function') {
|
|
192
|
+
this.props.elementRef(el);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
handleInputRef = el => {
|
|
196
|
+
if (typeof this.props.inputRef === 'function') {
|
|
197
|
+
this.props.inputRef(el);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
186
201
|
renderLabel() {
|
|
187
202
|
const display = this.props.variant === 'full' ? 'inline-block' : 'block';
|
|
188
203
|
const visibleLabel = (0, _hasVisibleChildren.hasVisibleChildren)(this.props.label);
|
|
@@ -338,16 +353,7 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
338
353
|
}, this.renderArrowButton('first', currentPageIndex), this.renderArrowButton('prev', currentPageIndex), this.inputMode ? this.renderPageInput(currentPageIndex) : this.renderPages(currentPageIndex), this.renderArrowButton('next', currentPageIndex), this.renderArrowButton('last', currentPageIndex)));
|
|
339
354
|
}
|
|
340
355
|
|
|
341
|
-
}
|
|
342
|
-
disabled: false,
|
|
343
|
-
withFirstAndLastButton: false,
|
|
344
|
-
showDisabledButtons: false,
|
|
345
|
-
variant: 'full',
|
|
346
|
-
as: 'div',
|
|
347
|
-
labelNumberInput: numberOfPages => `of ${numberOfPages}`,
|
|
348
|
-
screenReaderLabelNumberInput: (currentPage, numberOfPages) => `Select page (${currentPage} of ${numberOfPages})`,
|
|
349
|
-
shouldHandleFocus: true
|
|
350
|
-
}, _class2.Page = _PaginationButton.PaginationButton, _class2.Navigation = _PaginationArrowButton.PaginationArrowButton, _class2)) || _class) || _class) || _class);
|
|
356
|
+
}) || _class) || _class) || _class);
|
|
351
357
|
exports.Pagination = Pagination;
|
|
352
358
|
var _default = Pagination;
|
|
353
359
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-pagination",
|
|
3
|
-
"version": "8.25.1-snapshot-
|
|
3
|
+
"version": "8.25.1-snapshot-10",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,29 +23,29 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.25.1-snapshot-
|
|
27
|
-
"@instructure/ui-test-locator": "8.25.1-snapshot-
|
|
28
|
-
"@instructure/ui-test-queries": "8.25.1-snapshot-
|
|
29
|
-
"@instructure/ui-test-utils": "8.25.1-snapshot-
|
|
26
|
+
"@instructure/ui-babel-preset": "8.25.1-snapshot-10",
|
|
27
|
+
"@instructure/ui-test-locator": "8.25.1-snapshot-10",
|
|
28
|
+
"@instructure/ui-test-queries": "8.25.1-snapshot-10",
|
|
29
|
+
"@instructure/ui-test-utils": "8.25.1-snapshot-10"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "^7.13.10",
|
|
33
|
-
"@instructure/emotion": "8.25.1-snapshot-
|
|
34
|
-
"@instructure/shared-types": "8.25.1-snapshot-
|
|
35
|
-
"@instructure/ui-a11y-content": "8.25.1-snapshot-
|
|
36
|
-
"@instructure/ui-a11y-utils": "8.25.1-snapshot-
|
|
37
|
-
"@instructure/ui-buttons": "8.25.1-snapshot-
|
|
38
|
-
"@instructure/ui-dom-utils": "8.25.1-snapshot-
|
|
39
|
-
"@instructure/ui-icons": "8.25.1-snapshot-
|
|
40
|
-
"@instructure/ui-number-input": "8.25.1-snapshot-
|
|
41
|
-
"@instructure/ui-portal": "8.25.1-snapshot-
|
|
42
|
-
"@instructure/ui-prop-types": "8.25.1-snapshot-
|
|
43
|
-
"@instructure/ui-react-utils": "8.25.1-snapshot-
|
|
44
|
-
"@instructure/ui-testable": "8.25.1-snapshot-
|
|
45
|
-
"@instructure/ui-tooltip": "8.25.1-snapshot-
|
|
46
|
-
"@instructure/ui-utils": "8.25.1-snapshot-
|
|
47
|
-
"@instructure/ui-view": "8.25.1-snapshot-
|
|
48
|
-
"@instructure/uid": "8.25.1-snapshot-
|
|
33
|
+
"@instructure/emotion": "8.25.1-snapshot-10",
|
|
34
|
+
"@instructure/shared-types": "8.25.1-snapshot-10",
|
|
35
|
+
"@instructure/ui-a11y-content": "8.25.1-snapshot-10",
|
|
36
|
+
"@instructure/ui-a11y-utils": "8.25.1-snapshot-10",
|
|
37
|
+
"@instructure/ui-buttons": "8.25.1-snapshot-10",
|
|
38
|
+
"@instructure/ui-dom-utils": "8.25.1-snapshot-10",
|
|
39
|
+
"@instructure/ui-icons": "8.25.1-snapshot-10",
|
|
40
|
+
"@instructure/ui-number-input": "8.25.1-snapshot-10",
|
|
41
|
+
"@instructure/ui-portal": "8.25.1-snapshot-10",
|
|
42
|
+
"@instructure/ui-prop-types": "8.25.1-snapshot-10",
|
|
43
|
+
"@instructure/ui-react-utils": "8.25.1-snapshot-10",
|
|
44
|
+
"@instructure/ui-testable": "8.25.1-snapshot-10",
|
|
45
|
+
"@instructure/ui-tooltip": "8.25.1-snapshot-10",
|
|
46
|
+
"@instructure/ui-utils": "8.25.1-snapshot-10",
|
|
47
|
+
"@instructure/ui-view": "8.25.1-snapshot-10",
|
|
48
|
+
"@instructure/uid": "8.25.1-snapshot-10",
|
|
49
49
|
"keycode": "^2",
|
|
50
50
|
"prop-types": "^15"
|
|
51
51
|
},
|