@instructure/ui-pagination 8.25.1-snapshot-10 → 8.25.1-snapshot-13
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 +11 -12
- package/es/Pagination/PaginationButton/index.js +13 -14
- package/es/Pagination/PaginationPageInput/index.js +42 -43
- package/es/Pagination/index.js +33 -39
- package/lib/Pagination/PaginationArrowButton/index.js +11 -12
- package/lib/Pagination/PaginationButton/index.js +13 -14
- package/lib/Pagination/PaginationPageInput/index.js +42 -43
- package/lib/Pagination/index.js +33 -39
- package/package.json +21 -21
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-13](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-13) (2022-06-22)
|
|
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, _class2;
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The MIT License (MIT)
|
|
@@ -41,16 +41,15 @@ id: Pagination.Navigation
|
|
|
41
41
|
@tsProps
|
|
42
42
|
**/
|
|
43
43
|
|
|
44
|
-
let PaginationArrowButton = (_dec = testable(), _dec(_class = class PaginationArrowButton extends Component {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
44
|
+
let PaginationArrowButton = (_dec = testable(), _dec(_class = (_class2 = class PaginationArrowButton extends Component {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(...arguments);
|
|
47
|
+
this.ref = null;
|
|
48
|
+
|
|
49
|
+
this.handleRef = el => {
|
|
50
|
+
this.ref = el;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
54
53
|
|
|
55
54
|
get margin() {
|
|
56
55
|
switch (this.props.direction) {
|
|
@@ -106,6 +105,6 @@ let PaginationArrowButton = (_dec = testable(), _dec(_class = class PaginationAr
|
|
|
106
105
|
}), this.Icon));
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
}) || _class);
|
|
108
|
+
}, _class2.displayName = "PaginationArrowButton", _class2.componentId = 'Pagination.Navigation', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {}, _class2)) || _class);
|
|
110
109
|
export default PaginationArrowButton;
|
|
111
110
|
export { PaginationArrowButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class;
|
|
1
|
+
var _dec, _class, _class2;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -35,18 +35,15 @@ parent: Pagination
|
|
|
35
35
|
id: Pagination.Page
|
|
36
36
|
---
|
|
37
37
|
**/
|
|
38
|
-
let PaginationButton = (_dec = testable(), _dec(_class = class PaginationButton extends Component {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
handleRef = el => {
|
|
48
|
-
this.ref = el;
|
|
49
|
-
};
|
|
38
|
+
let PaginationButton = (_dec = testable(), _dec(_class = (_class2 = class PaginationButton extends Component {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(...arguments);
|
|
41
|
+
this.ref = null;
|
|
42
|
+
|
|
43
|
+
this.handleRef = el => {
|
|
44
|
+
this.ref = el;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
50
47
|
|
|
51
48
|
render() {
|
|
52
49
|
const exclude = this.props.current ? ['onClick', 'href'] : [];
|
|
@@ -61,6 +58,8 @@ let PaginationButton = (_dec = testable(), _dec(_class = class PaginationButton
|
|
|
61
58
|
}), this.props.children);
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
}
|
|
61
|
+
}, _class2.displayName = "PaginationButton", _class2.componentId = 'Pagination.Page', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
62
|
+
current: false
|
|
63
|
+
}, _class2)) || _class);
|
|
65
64
|
export default PaginationButton;
|
|
66
65
|
export { PaginationButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class;
|
|
1
|
+
var _dec, _dec2, _class, _class2;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -41,18 +41,46 @@ id: Pagination.PageInput
|
|
|
41
41
|
---
|
|
42
42
|
@tsProps
|
|
43
43
|
**/
|
|
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
|
-
|
|
44
|
+
let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class PaginationPageInput extends Component {
|
|
54
45
|
constructor(props) {
|
|
55
46
|
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
|
+
|
|
56
84
|
this.state = this.initialState;
|
|
57
85
|
}
|
|
58
86
|
|
|
@@ -96,27 +124,6 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
96
124
|
this.setState(this.initialState);
|
|
97
125
|
}
|
|
98
126
|
|
|
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
|
-
|
|
120
127
|
handleKeyDown(event) {
|
|
121
128
|
const key = event.key;
|
|
122
129
|
|
|
@@ -134,16 +141,6 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
134
141
|
}
|
|
135
142
|
}
|
|
136
143
|
|
|
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
|
-
|
|
147
144
|
getNumberWithinRange(n) {
|
|
148
145
|
if (n < this.MIN) return this.MIN;
|
|
149
146
|
if (n > this.MAX) return this.MAX;
|
|
@@ -201,6 +198,8 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
201
198
|
})), this.renderLabel());
|
|
202
199
|
}
|
|
203
200
|
|
|
204
|
-
}
|
|
201
|
+
}, _class2.displayName = "PaginationPageInput", _class2.componentId = 'Pagination.PageInput', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
202
|
+
disabled: false
|
|
203
|
+
}, _class2)) || _class) || _class);
|
|
205
204
|
export default PaginationPageInput;
|
|
206
205
|
export { PaginationPageInput };
|
package/es/Pagination/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _dec3, _class, _span, _span2;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _class2, _span, _span2;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -61,32 +61,30 @@ 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 = 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
|
-
|
|
64
|
+
let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, null), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Pagination extends Component {
|
|
88
65
|
constructor(props) {
|
|
89
66
|
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
|
+
|
|
90
88
|
this._labelId = props.deterministicId();
|
|
91
89
|
}
|
|
92
90
|
|
|
@@ -177,19 +175,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
177
175
|
})) : children;
|
|
178
176
|
}
|
|
179
177
|
|
|
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
|
-
|
|
193
178
|
renderLabel() {
|
|
194
179
|
const display = this.props.variant === 'full' ? 'inline-block' : 'block';
|
|
195
180
|
const visibleLabel = hasVisibleChildren(this.props.label);
|
|
@@ -343,6 +328,15 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
343
328
|
}, this.renderArrowButton('first', currentPageIndex), this.renderArrowButton('prev', currentPageIndex), this.inputMode ? this.renderPageInput(currentPageIndex) : this.renderPages(currentPageIndex), this.renderArrowButton('next', currentPageIndex), this.renderArrowButton('last', currentPageIndex)));
|
|
344
329
|
}
|
|
345
330
|
|
|
346
|
-
}
|
|
331
|
+
}, _class2.displayName = "Pagination", _class2.componentId = 'Pagination', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
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);
|
|
347
341
|
export default Pagination;
|
|
348
342
|
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, _class2;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
@@ -42,16 +42,15 @@ id: Pagination.Navigation
|
|
|
42
42
|
---
|
|
43
43
|
@tsProps
|
|
44
44
|
**/
|
|
45
|
-
let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class = class PaginationArrowButton extends _react.Component {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
45
|
+
let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = class PaginationArrowButton extends _react.Component {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
this.ref = null;
|
|
49
|
+
|
|
50
|
+
this.handleRef = el => {
|
|
51
|
+
this.ref = el;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
55
54
|
|
|
56
55
|
get margin() {
|
|
57
56
|
switch (this.props.direction) {
|
|
@@ -106,7 +105,7 @@ let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class = cla
|
|
|
106
105
|
}), this.Icon));
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
}) || _class);
|
|
108
|
+
}, _class2.displayName = "PaginationArrowButton", _class2.componentId = 'Pagination.Navigation', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {}, _class2)) || _class);
|
|
110
109
|
exports.PaginationArrowButton = PaginationArrowButton;
|
|
111
110
|
var _default = PaginationArrowButton;
|
|
112
111
|
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, _class2;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
---
|
|
@@ -25,18 +25,15 @@ parent: Pagination
|
|
|
25
25
|
id: Pagination.Page
|
|
26
26
|
---
|
|
27
27
|
**/
|
|
28
|
-
let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class = class PaginationButton extends _react.Component {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
handleRef = el => {
|
|
38
|
-
this.ref = el;
|
|
39
|
-
};
|
|
28
|
+
let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = class PaginationButton extends _react.Component {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.ref = null;
|
|
32
|
+
|
|
33
|
+
this.handleRef = el => {
|
|
34
|
+
this.ref = el;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
40
37
|
|
|
41
38
|
render() {
|
|
42
39
|
const exclude = this.props.current ? ['onClick', 'href'] : [];
|
|
@@ -51,7 +48,9 @@ let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class = class Pa
|
|
|
51
48
|
}), this.props.children);
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
}
|
|
51
|
+
}, _class2.displayName = "PaginationButton", _class2.componentId = 'Pagination.Page', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
52
|
+
current: false
|
|
53
|
+
}, _class2)) || _class);
|
|
55
54
|
exports.PaginationButton = PaginationButton;
|
|
56
55
|
var _default = PaginationButton;
|
|
57
56
|
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, _class2;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
---
|
|
@@ -34,18 +34,46 @@ 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 = 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
|
-
|
|
37
|
+
let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class PaginationPageInput extends _react.Component {
|
|
47
38
|
constructor(props) {
|
|
48
39
|
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
|
+
|
|
49
77
|
this.state = this.initialState;
|
|
50
78
|
}
|
|
51
79
|
|
|
@@ -89,27 +117,6 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
89
117
|
this.setState(this.initialState);
|
|
90
118
|
}
|
|
91
119
|
|
|
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
|
-
|
|
113
120
|
handleKeyDown(event) {
|
|
114
121
|
const key = event.key;
|
|
115
122
|
|
|
@@ -127,16 +134,6 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
127
134
|
}
|
|
128
135
|
}
|
|
129
136
|
|
|
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
|
-
|
|
140
137
|
getNumberWithinRange(n) {
|
|
141
138
|
if (n < this.MIN) return this.MIN;
|
|
142
139
|
if (n > this.MAX) return this.MAX;
|
|
@@ -194,7 +191,9 @@ let PaginationPageInput = (_dec = (0, _emotion.withStyle)(_styles.default, _them
|
|
|
194
191
|
})), this.renderLabel());
|
|
195
192
|
}
|
|
196
193
|
|
|
197
|
-
}
|
|
194
|
+
}, _class2.displayName = "PaginationPageInput", _class2.componentId = 'Pagination.PageInput', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
195
|
+
disabled: false
|
|
196
|
+
}, _class2)) || _class) || _class);
|
|
198
197
|
exports.PaginationPageInput = PaginationPageInput;
|
|
199
198
|
var _default = PaginationPageInput;
|
|
200
199
|
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, _span, _span2;
|
|
47
|
+
var _dec, _dec2, _dec3, _class, _class2, _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,32 +69,30 @@ 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 = 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
|
-
|
|
72
|
+
let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, null), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class Pagination extends _react.Component {
|
|
96
73
|
constructor(props) {
|
|
97
74
|
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
|
+
|
|
98
96
|
this._labelId = props.deterministicId();
|
|
99
97
|
}
|
|
100
98
|
|
|
@@ -185,19 +183,6 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
185
183
|
})) : children;
|
|
186
184
|
}
|
|
187
185
|
|
|
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
|
-
|
|
201
186
|
renderLabel() {
|
|
202
187
|
const display = this.props.variant === 'full' ? 'inline-block' : 'block';
|
|
203
188
|
const visibleLabel = (0, _hasVisibleChildren.hasVisibleChildren)(this.props.label);
|
|
@@ -353,7 +338,16 @@ let Pagination = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2
|
|
|
353
338
|
}, this.renderArrowButton('first', currentPageIndex), this.renderArrowButton('prev', currentPageIndex), this.inputMode ? this.renderPageInput(currentPageIndex) : this.renderPages(currentPageIndex), this.renderArrowButton('next', currentPageIndex), this.renderArrowButton('last', currentPageIndex)));
|
|
354
339
|
}
|
|
355
340
|
|
|
356
|
-
}
|
|
341
|
+
}, _class2.displayName = "Pagination", _class2.componentId = 'Pagination', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
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);
|
|
357
351
|
exports.Pagination = Pagination;
|
|
358
352
|
var _default = Pagination;
|
|
359
353
|
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-13",
|
|
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-13",
|
|
27
|
+
"@instructure/ui-test-locator": "8.25.1-snapshot-13",
|
|
28
|
+
"@instructure/ui-test-queries": "8.25.1-snapshot-13",
|
|
29
|
+
"@instructure/ui-test-utils": "8.25.1-snapshot-13"
|
|
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-13",
|
|
34
|
+
"@instructure/shared-types": "8.25.1-snapshot-13",
|
|
35
|
+
"@instructure/ui-a11y-content": "8.25.1-snapshot-13",
|
|
36
|
+
"@instructure/ui-a11y-utils": "8.25.1-snapshot-13",
|
|
37
|
+
"@instructure/ui-buttons": "8.25.1-snapshot-13",
|
|
38
|
+
"@instructure/ui-dom-utils": "8.25.1-snapshot-13",
|
|
39
|
+
"@instructure/ui-icons": "8.25.1-snapshot-13",
|
|
40
|
+
"@instructure/ui-number-input": "8.25.1-snapshot-13",
|
|
41
|
+
"@instructure/ui-portal": "8.25.1-snapshot-13",
|
|
42
|
+
"@instructure/ui-prop-types": "8.25.1-snapshot-13",
|
|
43
|
+
"@instructure/ui-react-utils": "8.25.1-snapshot-13",
|
|
44
|
+
"@instructure/ui-testable": "8.25.1-snapshot-13",
|
|
45
|
+
"@instructure/ui-tooltip": "8.25.1-snapshot-13",
|
|
46
|
+
"@instructure/ui-utils": "8.25.1-snapshot-13",
|
|
47
|
+
"@instructure/ui-view": "8.25.1-snapshot-13",
|
|
48
|
+
"@instructure/uid": "8.25.1-snapshot-13",
|
|
49
49
|
"keycode": "^2",
|
|
50
50
|
"prop-types": "^15"
|
|
51
51
|
},
|