@instructure/ui-pagination 11.7.3-snapshot-7 → 11.7.3-snapshot-26
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 +5 -2
- package/es/Pagination/v1/PaginationArrowButton/index.js +16 -20
- package/es/Pagination/v1/PaginationButton/index.js +11 -14
- package/es/Pagination/v1/PaginationPageInput/index.js +66 -58
- package/es/Pagination/v1/PaginationPageInput/theme.js +5 -4
- package/es/Pagination/v1/index.js +212 -206
- package/es/Pagination/v1/theme.js +3 -1
- package/es/Pagination/v2/PaginationArrowButton/index.js +16 -20
- package/es/Pagination/v2/PaginationButton/index.js +11 -14
- package/es/Pagination/v2/PaginationPageInput/index.js +66 -58
- package/es/Pagination/v2/index.js +217 -210
- package/lib/Pagination/v1/PaginationArrowButton/index.js +18 -23
- package/lib/Pagination/v1/PaginationButton/index.js +11 -14
- package/lib/Pagination/v1/PaginationPageInput/index.js +66 -58
- package/lib/Pagination/v1/PaginationPageInput/theme.js +5 -4
- package/lib/Pagination/v1/index.js +212 -206
- package/lib/Pagination/v1/theme.js +3 -1
- package/lib/Pagination/v2/PaginationArrowButton/index.js +18 -23
- package/lib/Pagination/v2/PaginationButton/index.js +11 -14
- package/lib/Pagination/v2/PaginationPageInput/index.js +66 -58
- package/lib/Pagination/v2/index.js +217 -210
- package/package.json +20 -20
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
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
|
-
## [11.7.3-snapshot-
|
|
6
|
+
## [11.7.3-snapshot-26](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-26) (2026-05-05)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **many:** update dependencies, remove lots of Babel plugins, remove Webpack 4 support ([f916fca](https://github.com/instructure/instructure-ui/commit/f916fcafdddcb2d7de401f93e8ff92cfdfa47bba))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
const _excluded = ["label", "direction", "buttonRef"];
|
|
3
1
|
/*
|
|
4
2
|
* The MIT License (MIT)
|
|
5
3
|
*
|
|
@@ -38,13 +36,14 @@ id: Pagination.Navigation
|
|
|
38
36
|
**/
|
|
39
37
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
40
38
|
class PaginationArrowButton extends Component {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
static displayName = "PaginationArrowButton";
|
|
40
|
+
static componentId = 'Pagination.Navigation';
|
|
41
|
+
static allowedProps = allowedProps;
|
|
42
|
+
static defaultProps = {};
|
|
43
|
+
ref = null;
|
|
44
|
+
handleRef = el => {
|
|
45
|
+
this.ref = el;
|
|
46
|
+
};
|
|
48
47
|
get margin() {
|
|
49
48
|
switch (this.props.direction) {
|
|
50
49
|
case 'first':
|
|
@@ -52,7 +51,7 @@ class PaginationArrowButton extends Component {
|
|
|
52
51
|
case 'last':
|
|
53
52
|
return '0 0 0 xx-small';
|
|
54
53
|
default:
|
|
55
|
-
return
|
|
54
|
+
return undefined;
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
get Icon() {
|
|
@@ -70,11 +69,12 @@ class PaginationArrowButton extends Component {
|
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
render() {
|
|
73
|
-
const
|
|
74
|
-
label
|
|
75
|
-
direction
|
|
76
|
-
buttonRef
|
|
77
|
-
props
|
|
72
|
+
const {
|
|
73
|
+
label,
|
|
74
|
+
direction,
|
|
75
|
+
buttonRef,
|
|
76
|
+
...props
|
|
77
|
+
} = this.props;
|
|
78
78
|
return _jsx(Tooltip, {
|
|
79
79
|
elementRef: this.handleRef,
|
|
80
80
|
on: ['hover', 'focus'],
|
|
@@ -87,7 +87,7 @@ class PaginationArrowButton extends Component {
|
|
|
87
87
|
withBackground: false,
|
|
88
88
|
withBorder: false,
|
|
89
89
|
screenReaderLabel: label,
|
|
90
|
-
rel: props.href || props.to ? direction :
|
|
90
|
+
rel: props.href || props.to ? direction : undefined,
|
|
91
91
|
elementRef: buttonRef,
|
|
92
92
|
margin: this.margin,
|
|
93
93
|
"data-cid": "PaginationArrowButton",
|
|
@@ -96,9 +96,5 @@ class PaginationArrowButton extends Component {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
PaginationArrowButton.displayName = "PaginationArrowButton";
|
|
100
|
-
PaginationArrowButton.componentId = 'Pagination.Navigation';
|
|
101
|
-
PaginationArrowButton.allowedProps = allowedProps;
|
|
102
|
-
PaginationArrowButton.defaultProps = {};
|
|
103
99
|
export default PaginationArrowButton;
|
|
104
100
|
export { PaginationArrowButton };
|
|
@@ -35,13 +35,16 @@ id: Pagination.Page
|
|
|
35
35
|
**/
|
|
36
36
|
|
|
37
37
|
class PaginationButton extends Component {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
static displayName = "PaginationButton";
|
|
39
|
+
static componentId = 'Pagination.Page';
|
|
40
|
+
static allowedProps = allowedProps;
|
|
41
|
+
static defaultProps = {
|
|
42
|
+
current: false
|
|
43
|
+
};
|
|
44
|
+
ref = null;
|
|
45
|
+
handleRef = el => {
|
|
46
|
+
this.ref = el;
|
|
47
|
+
};
|
|
45
48
|
render() {
|
|
46
49
|
const exclude = this.props.current ? ['onClick', 'href'] : [];
|
|
47
50
|
const props = omitProps(this.props, PaginationButton.allowedProps, exclude);
|
|
@@ -57,7 +60,7 @@ class PaginationButton extends Component {
|
|
|
57
60
|
withBackground: this.props.current,
|
|
58
61
|
withBorder: this.props.current,
|
|
59
62
|
...props,
|
|
60
|
-
"aria-current": this.props.current ? 'page' :
|
|
63
|
+
"aria-current": this.props.current ? 'page' : undefined,
|
|
61
64
|
elementRef: this.handleRef,
|
|
62
65
|
...(this.props.screenReaderLabel ? {
|
|
63
66
|
'aria-label': this.props.screenReaderLabel
|
|
@@ -67,11 +70,5 @@ class PaginationButton extends Component {
|
|
|
67
70
|
});
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
PaginationButton.displayName = "PaginationButton";
|
|
71
|
-
PaginationButton.componentId = 'Pagination.Page';
|
|
72
|
-
PaginationButton.allowedProps = allowedProps;
|
|
73
|
-
PaginationButton.defaultProps = {
|
|
74
|
-
current: false
|
|
75
|
-
};
|
|
76
73
|
export default PaginationButton;
|
|
77
74
|
export { PaginationButton };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
1
|
+
var _dec, _class;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -37,41 +37,16 @@ parent: Pagination
|
|
|
37
37
|
id: Pagination.PageInput
|
|
38
38
|
---
|
|
39
39
|
**/
|
|
40
|
-
let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
40
|
+
let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class PaginationPageInput extends Component {
|
|
41
|
+
static displayName = "PaginationPageInput";
|
|
42
|
+
static componentId = 'Pagination.PageInput';
|
|
43
|
+
static allowedProps = allowedProps;
|
|
44
|
+
static defaultProps = {
|
|
45
|
+
disabled: false
|
|
46
|
+
};
|
|
47
|
+
ref = null;
|
|
41
48
|
constructor(props) {
|
|
42
49
|
super(props);
|
|
43
|
-
this.ref = null;
|
|
44
|
-
this.handleRef = el => {
|
|
45
|
-
this.ref = el;
|
|
46
|
-
};
|
|
47
|
-
this.handleInputRef = el => {
|
|
48
|
-
if (typeof this.props.inputRef === 'function') {
|
|
49
|
-
this.props.inputRef(el);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
this.handleChange = (_event, value) => {
|
|
53
|
-
let newValue = value;
|
|
54
|
-
|
|
55
|
-
// if the last character was not a number, don't accept it
|
|
56
|
-
if (value.length > 0 && isNaN(value.slice(-1))) {
|
|
57
|
-
newValue = value.slice(0, -1);
|
|
58
|
-
}
|
|
59
|
-
this.setState({
|
|
60
|
-
number: newValue ? Number(newValue) : this.MIN,
|
|
61
|
-
value: newValue
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
this.handleDecrement = event => {
|
|
65
|
-
this.setNewPage(event, Math.floor(this.currentPage - 1));
|
|
66
|
-
};
|
|
67
|
-
this.handleIncrement = event => {
|
|
68
|
-
this.setNewPage(event, Math.floor(this.currentPage + 1));
|
|
69
|
-
};
|
|
70
|
-
this.handleBlur = event => {
|
|
71
|
-
if (Math.round(this.state.number) !== this.currentPage) {
|
|
72
|
-
this.setNewPage(event, Math.round(this.state.number));
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
50
|
this.state = this.initialState;
|
|
76
51
|
}
|
|
77
52
|
get currentPage() {
|
|
@@ -90,12 +65,10 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
90
65
|
return this.props.numberOfPages;
|
|
91
66
|
}
|
|
92
67
|
componentDidMount() {
|
|
93
|
-
|
|
94
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
68
|
+
this.props.makeStyles?.();
|
|
95
69
|
}
|
|
96
70
|
componentDidUpdate(prevProps) {
|
|
97
|
-
|
|
98
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
71
|
+
this.props.makeStyles?.();
|
|
99
72
|
|
|
100
73
|
// when the current page changes from outside (e.g.: from arrow buttons),
|
|
101
74
|
// we update the initial state
|
|
@@ -106,12 +79,35 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
106
79
|
resetInitialState() {
|
|
107
80
|
this.setState(this.initialState);
|
|
108
81
|
}
|
|
82
|
+
handleRef = el => {
|
|
83
|
+
this.ref = el;
|
|
84
|
+
};
|
|
85
|
+
handleInputRef = el => {
|
|
86
|
+
if (typeof this.props.inputRef === 'function') {
|
|
87
|
+
this.props.inputRef(el);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
handleChange = (_event, value) => {
|
|
91
|
+
let newValue = value;
|
|
92
|
+
|
|
93
|
+
// if the last character was not a number, don't accept it
|
|
94
|
+
if (value.length > 0 && isNaN(value.slice(-1))) {
|
|
95
|
+
newValue = value.slice(0, -1);
|
|
96
|
+
}
|
|
97
|
+
this.setState({
|
|
98
|
+
number: newValue ? Number(newValue) : this.MIN,
|
|
99
|
+
value: newValue
|
|
100
|
+
});
|
|
101
|
+
};
|
|
109
102
|
handleKeyDown(event) {
|
|
110
|
-
const
|
|
103
|
+
const {
|
|
104
|
+
key
|
|
105
|
+
} = event;
|
|
111
106
|
if (key.toLowerCase() === 'enter') {
|
|
112
|
-
const
|
|
113
|
-
value
|
|
114
|
-
number
|
|
107
|
+
const {
|
|
108
|
+
value,
|
|
109
|
+
number
|
|
110
|
+
} = this.state;
|
|
115
111
|
|
|
116
112
|
// If it is invalid, we reset the input to the current page
|
|
117
113
|
if (value === '' || isNaN(value)) {
|
|
@@ -121,6 +117,17 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
121
117
|
this.setNewPage(event, number);
|
|
122
118
|
}
|
|
123
119
|
}
|
|
120
|
+
handleDecrement = event => {
|
|
121
|
+
this.setNewPage(event, Math.floor(this.currentPage - 1));
|
|
122
|
+
};
|
|
123
|
+
handleIncrement = event => {
|
|
124
|
+
this.setNewPage(event, Math.floor(this.currentPage + 1));
|
|
125
|
+
};
|
|
126
|
+
handleBlur = event => {
|
|
127
|
+
if (Math.round(this.state.number) !== this.currentPage) {
|
|
128
|
+
this.setNewPage(event, Math.round(this.state.number));
|
|
129
|
+
}
|
|
130
|
+
};
|
|
124
131
|
getNumberWithinRange(n) {
|
|
125
132
|
if (n < this.MIN) return this.MIN;
|
|
126
133
|
if (n > this.MAX) return this.MAX;
|
|
@@ -135,33 +142,36 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
135
142
|
this.props.onChange(event, number - 1);
|
|
136
143
|
}
|
|
137
144
|
renderLabel() {
|
|
138
|
-
const
|
|
139
|
-
label
|
|
140
|
-
numberOfPages
|
|
141
|
-
styles
|
|
145
|
+
const {
|
|
146
|
+
label,
|
|
147
|
+
numberOfPages,
|
|
148
|
+
styles
|
|
149
|
+
} = this.props;
|
|
142
150
|
return typeof label === 'function' && label(numberOfPages) ? _jsx("span", {
|
|
143
|
-
css: styles
|
|
151
|
+
css: styles?.inputLabel,
|
|
144
152
|
children: label(numberOfPages)
|
|
145
153
|
}) : null;
|
|
146
154
|
}
|
|
147
155
|
renderScreenReaderLabel() {
|
|
148
|
-
const
|
|
149
|
-
screenReaderLabel
|
|
150
|
-
numberOfPages
|
|
156
|
+
const {
|
|
157
|
+
screenReaderLabel,
|
|
158
|
+
numberOfPages
|
|
159
|
+
} = this.props;
|
|
151
160
|
return _jsx(ScreenReaderContent, {
|
|
152
161
|
children: screenReaderLabel(this.currentPage, numberOfPages)
|
|
153
162
|
});
|
|
154
163
|
}
|
|
155
164
|
render() {
|
|
156
|
-
const
|
|
157
|
-
styles
|
|
158
|
-
disabled
|
|
165
|
+
const {
|
|
166
|
+
styles,
|
|
167
|
+
disabled
|
|
168
|
+
} = this.props;
|
|
159
169
|
return _jsxs("span", {
|
|
160
|
-
css: styles
|
|
170
|
+
css: styles?.paginationPageInput,
|
|
161
171
|
ref: this.handleRef,
|
|
162
172
|
"data-cid": "PaginationPageInput",
|
|
163
173
|
children: [_jsx("span", {
|
|
164
|
-
css: styles
|
|
174
|
+
css: styles?.numberInput,
|
|
165
175
|
children: _jsx(NumberInput, {
|
|
166
176
|
renderLabel: this.renderScreenReaderLabel(),
|
|
167
177
|
onBlur: this.handleBlur,
|
|
@@ -179,8 +189,6 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
179
189
|
}), this.renderLabel()]
|
|
180
190
|
});
|
|
181
191
|
}
|
|
182
|
-
}
|
|
183
|
-
disabled: false
|
|
184
|
-
}, _PaginationPageInput)) || _class);
|
|
192
|
+
}) || _class);
|
|
185
193
|
export default PaginationPageInput;
|
|
186
194
|
export { PaginationPageInput };
|
|
@@ -28,13 +28,14 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
colors
|
|
31
|
+
const {
|
|
32
|
+
spacing,
|
|
33
|
+
colors
|
|
34
|
+
} = theme;
|
|
34
35
|
const componentVariables = {
|
|
35
36
|
inputSpacing: spacing.xSmall,
|
|
36
37
|
inputWidth: '4.5rem',
|
|
37
|
-
labelColor: colors
|
|
38
|
+
labelColor: colors?.contrasts?.grey125125
|
|
38
39
|
};
|
|
39
40
|
return {
|
|
40
41
|
...componentVariables
|