@instructure/ui-pagination 10.16.1-snapshot-0 → 10.16.1-snapshot-1
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/__new-tests__/PaginationArrowButton.test.js +3 -3
- package/es/Pagination/PaginationArrowButton/index.js +18 -12
- package/es/Pagination/PaginationButton/__new-tests__/PaginationButton.test.js +17 -13
- package/es/Pagination/PaginationButton/index.js +14 -11
- package/es/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.js +9 -9
- package/es/Pagination/PaginationPageInput/index.js +30 -25
- package/es/Pagination/__new-tests__/Pagination.test.js +238 -184
- package/es/Pagination/index.js +58 -49
- package/lib/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.js +6 -7
- package/lib/Pagination/PaginationArrowButton/index.js +18 -13
- package/lib/Pagination/PaginationButton/__new-tests__/PaginationButton.test.js +24 -21
- package/lib/Pagination/PaginationButton/index.js +14 -12
- package/lib/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.js +15 -16
- package/lib/Pagination/PaginationPageInput/index.js +29 -25
- package/lib/Pagination/__new-tests__/Pagination.test.js +314 -260
- package/lib/Pagination/index.js +56 -49
- package/package.json +21 -21
- package/src/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.tsx +0 -1
- package/src/Pagination/PaginationArrowButton/index.tsx +1 -1
- package/src/Pagination/PaginationButton/__new-tests__/PaginationButton.test.tsx +0 -1
- package/src/Pagination/PaginationButton/index.tsx +1 -1
- package/src/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.tsx +0 -1
- package/src/Pagination/PaginationPageInput/index.tsx +2 -3
- package/src/Pagination/__new-tests__/Pagination.test.tsx +0 -1
- package/src/Pagination/index.tsx +11 -5
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.d.ts.map +1 -1
- package/types/Pagination/PaginationArrowButton/index.d.ts +2 -2
- package/types/Pagination/PaginationArrowButton/index.d.ts.map +1 -1
- package/types/Pagination/PaginationButton/__new-tests__/PaginationButton.test.d.ts.map +1 -1
- package/types/Pagination/PaginationButton/index.d.ts +2 -2
- package/types/Pagination/PaginationButton/index.d.ts.map +1 -1
- package/types/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.d.ts.map +1 -1
- package/types/Pagination/PaginationPageInput/index.d.ts +6 -22
- package/types/Pagination/PaginationPageInput/index.d.ts.map +1 -1
- package/types/Pagination/__new-tests__/Pagination.test.d.ts.map +1 -1
- package/types/Pagination/index.d.ts +11 -13
- package/types/Pagination/index.d.ts.map +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
|
-
## [10.16.1-snapshot-
|
|
6
|
+
## [10.16.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-1) (2025-04-22)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-pagination
|
|
9
9
|
|
|
@@ -23,14 +23,14 @@ var _PaginationArrowButto;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render, screen } from '@testing-library/react';
|
|
28
27
|
import { vi } from 'vitest';
|
|
29
28
|
import '@testing-library/jest-dom';
|
|
30
29
|
import { PaginationArrowButton } from '../index';
|
|
30
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
31
31
|
describe('<PaginationArrowButton />', () => {
|
|
32
32
|
it('should render', async () => {
|
|
33
|
-
render(_PaginationArrowButto || (_PaginationArrowButto =
|
|
33
|
+
render(_PaginationArrowButto || (_PaginationArrowButto = _jsx(PaginationArrowButton, {
|
|
34
34
|
direction: "prev",
|
|
35
35
|
label: "Label"
|
|
36
36
|
})));
|
|
@@ -41,7 +41,7 @@ describe('<PaginationArrowButton />', () => {
|
|
|
41
41
|
});
|
|
42
42
|
it('should provide a ref to the button element', async () => {
|
|
43
43
|
const buttonRef = vi.fn();
|
|
44
|
-
render(
|
|
44
|
+
render(_jsx(PaginationArrowButton, {
|
|
45
45
|
direction: "prev",
|
|
46
46
|
label: "Label",
|
|
47
47
|
buttonRef: buttonRef
|
|
@@ -25,7 +25,7 @@ var _dec, _class, _PaginationArrowButton;
|
|
|
25
25
|
* SOFTWARE.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
import
|
|
28
|
+
import { Component } from 'react';
|
|
29
29
|
import { IconButton } from '@instructure/ui-buttons';
|
|
30
30
|
import { PresentationContent } from '@instructure/ui-a11y-content';
|
|
31
31
|
import { Tooltip } from '@instructure/ui-tooltip';
|
|
@@ -39,6 +39,7 @@ parent: Pagination
|
|
|
39
39
|
id: Pagination.Navigation
|
|
40
40
|
---
|
|
41
41
|
**/
|
|
42
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
42
43
|
let PaginationArrowButton = (_dec = testable(), _dec(_class = (_PaginationArrowButton = class PaginationArrowButton extends Component {
|
|
43
44
|
constructor(...args) {
|
|
44
45
|
super(...args);
|
|
@@ -77,19 +78,24 @@ let PaginationArrowButton = (_dec = testable(), _dec(_class = (_PaginationArrowB
|
|
|
77
78
|
direction = _this$props.direction,
|
|
78
79
|
buttonRef = _this$props.buttonRef,
|
|
79
80
|
props = _objectWithoutProperties(_this$props, _excluded);
|
|
80
|
-
return
|
|
81
|
+
return _jsx(Tooltip, {
|
|
81
82
|
elementRef: this.handleRef,
|
|
82
83
|
on: ['hover', 'focus'],
|
|
83
|
-
renderTip:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
renderTip: _jsx(PresentationContent, {
|
|
85
|
+
children: label
|
|
86
|
+
}),
|
|
87
|
+
children: _jsx(IconButton, {
|
|
88
|
+
...props,
|
|
89
|
+
size: "small",
|
|
90
|
+
withBackground: false,
|
|
91
|
+
withBorder: false,
|
|
92
|
+
screenReaderLabel: label,
|
|
93
|
+
rel: props.href || props.to ? direction : void 0,
|
|
94
|
+
elementRef: buttonRef,
|
|
95
|
+
margin: this.margin,
|
|
96
|
+
children: this.Icon
|
|
97
|
+
})
|
|
98
|
+
});
|
|
93
99
|
}
|
|
94
100
|
}, _PaginationArrowButton.displayName = "PaginationArrowButton", _PaginationArrowButton.componentId = 'Pagination.Navigation', _PaginationArrowButton.allowedProps = allowedProps, _PaginationArrowButton.propTypes = propTypes, _PaginationArrowButton.defaultProps = {}, _PaginationArrowButton)) || _class);
|
|
95
101
|
export default PaginationArrowButton;
|
|
@@ -23,16 +23,17 @@ var _PaginationButton, _PaginationButton2;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
28
27
|
import { vi } from 'vitest';
|
|
29
28
|
import '@testing-library/jest-dom';
|
|
30
29
|
import { PaginationButton } from '../index';
|
|
30
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
31
31
|
describe('<PaginationButton />', () => {
|
|
32
32
|
it('should designate current page', async () => {
|
|
33
|
-
render(_PaginationButton || (_PaginationButton =
|
|
34
|
-
current: true
|
|
35
|
-
|
|
33
|
+
render(_PaginationButton || (_PaginationButton = _jsx(PaginationButton, {
|
|
34
|
+
current: true,
|
|
35
|
+
children: "1"
|
|
36
|
+
})));
|
|
36
37
|
const button = screen.getByRole('button', {
|
|
37
38
|
name: '1'
|
|
38
39
|
});
|
|
@@ -40,9 +41,10 @@ describe('<PaginationButton />', () => {
|
|
|
40
41
|
});
|
|
41
42
|
it('should navigate using button when onClick provided', async () => {
|
|
42
43
|
const onClick = vi.fn();
|
|
43
|
-
render(
|
|
44
|
-
onClick: onClick
|
|
45
|
-
|
|
44
|
+
render(_jsx(PaginationButton, {
|
|
45
|
+
onClick: onClick,
|
|
46
|
+
children: "1"
|
|
47
|
+
}));
|
|
46
48
|
const button = screen.getByRole('button', {
|
|
47
49
|
name: '1'
|
|
48
50
|
});
|
|
@@ -53,10 +55,11 @@ describe('<PaginationButton />', () => {
|
|
|
53
55
|
});
|
|
54
56
|
it('should disable navigation to current page', async () => {
|
|
55
57
|
const onClick = vi.fn();
|
|
56
|
-
render(
|
|
58
|
+
render(_jsx(PaginationButton, {
|
|
57
59
|
onClick: onClick,
|
|
58
|
-
current: true
|
|
59
|
-
|
|
60
|
+
current: true,
|
|
61
|
+
children: "1"
|
|
62
|
+
}));
|
|
60
63
|
const button = screen.getByRole('button', {
|
|
61
64
|
name: '1'
|
|
62
65
|
});
|
|
@@ -66,9 +69,10 @@ describe('<PaginationButton />', () => {
|
|
|
66
69
|
});
|
|
67
70
|
});
|
|
68
71
|
it('should navigate using link when href provided', async () => {
|
|
69
|
-
render(_PaginationButton2 || (_PaginationButton2 =
|
|
70
|
-
href: "https://instructure.design/"
|
|
71
|
-
|
|
72
|
+
render(_PaginationButton2 || (_PaginationButton2 = _jsx(PaginationButton, {
|
|
73
|
+
href: "https://instructure.design/",
|
|
74
|
+
children: "1"
|
|
75
|
+
})));
|
|
72
76
|
const button = screen.getByRole('link');
|
|
73
77
|
expect(button).toHaveAttribute('href', 'https://instructure.design/');
|
|
74
78
|
});
|
|
@@ -23,11 +23,12 @@ var _dec, _class, _PaginationButton;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import
|
|
26
|
+
import { 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
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
31
32
|
/**
|
|
32
33
|
---
|
|
33
34
|
parent: Pagination
|
|
@@ -47,18 +48,20 @@ let PaginationButton = (_dec = testable(), _dec(_class = (_PaginationButton = cl
|
|
|
47
48
|
const props = omitProps(this.props, PaginationButton.allowedProps, exclude);
|
|
48
49
|
|
|
49
50
|
// wrapped in an unstyled <li> for better a11y
|
|
50
|
-
return
|
|
51
|
+
return _jsx("li", {
|
|
51
52
|
style: {
|
|
52
53
|
all: 'unset'
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
},
|
|
55
|
+
children: _jsx(BaseButton, {
|
|
56
|
+
color: "primary",
|
|
57
|
+
withBackground: this.props.current,
|
|
58
|
+
withBorder: this.props.current,
|
|
59
|
+
...props,
|
|
60
|
+
"aria-current": this.props.current ? 'page' : void 0,
|
|
61
|
+
elementRef: this.handleRef,
|
|
62
|
+
children: this.props.children
|
|
63
|
+
})
|
|
64
|
+
});
|
|
62
65
|
}
|
|
63
66
|
}, _PaginationButton.displayName = "PaginationButton", _PaginationButton.componentId = 'Pagination.Page', _PaginationButton.propTypes = propTypes, _PaginationButton.allowedProps = allowedProps, _PaginationButton.defaultProps = {
|
|
64
67
|
current: false
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import React from 'react';
|
|
26
25
|
import { render, screen } from '@testing-library/react';
|
|
27
26
|
import { vi } from 'vitest';
|
|
28
27
|
import '@testing-library/jest-dom';
|
|
29
28
|
import { PaginationPageInput } from '../index';
|
|
29
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
30
30
|
const defaultSRLabel = (currentPage, numberOfPages) => `Select page (${currentPage} of ${numberOfPages})`;
|
|
31
31
|
describe('<PaginationPageInput />', () => {
|
|
32
32
|
it('should render', async () => {
|
|
33
33
|
const defaultOnChange = vi.fn();
|
|
34
|
-
render(
|
|
34
|
+
render(_jsx(PaginationPageInput, {
|
|
35
35
|
numberOfPages: 10,
|
|
36
36
|
currentPageIndex: 0,
|
|
37
37
|
onChange: defaultOnChange,
|
|
@@ -43,7 +43,7 @@ describe('<PaginationPageInput />', () => {
|
|
|
43
43
|
});
|
|
44
44
|
it('should display the current page number', async () => {
|
|
45
45
|
const defaultOnChange = vi.fn();
|
|
46
|
-
render(
|
|
46
|
+
render(_jsx(PaginationPageInput, {
|
|
47
47
|
numberOfPages: 10,
|
|
48
48
|
currentPageIndex: 3,
|
|
49
49
|
onChange: defaultOnChange,
|
|
@@ -54,7 +54,7 @@ describe('<PaginationPageInput />', () => {
|
|
|
54
54
|
});
|
|
55
55
|
it('should correctly update page number', async () => {
|
|
56
56
|
const defaultOnChange = vi.fn();
|
|
57
|
-
const _render = render(
|
|
57
|
+
const _render = render(_jsx(PaginationPageInput, {
|
|
58
58
|
numberOfPages: 10,
|
|
59
59
|
currentPageIndex: 3,
|
|
60
60
|
onChange: defaultOnChange,
|
|
@@ -65,7 +65,7 @@ describe('<PaginationPageInput />', () => {
|
|
|
65
65
|
expect(input).toHaveAttribute('value', '4');
|
|
66
66
|
|
|
67
67
|
// Set currentPageIndex: 6
|
|
68
|
-
rerender(
|
|
68
|
+
rerender(_jsx(PaginationPageInput, {
|
|
69
69
|
numberOfPages: 10,
|
|
70
70
|
currentPageIndex: 6,
|
|
71
71
|
onChange: defaultOnChange,
|
|
@@ -75,7 +75,7 @@ describe('<PaginationPageInput />', () => {
|
|
|
75
75
|
});
|
|
76
76
|
it("shouldn't display the arrow keys of NumberInput", async () => {
|
|
77
77
|
const defaultOnChange = vi.fn();
|
|
78
|
-
const _render2 = render(
|
|
78
|
+
const _render2 = render(_jsx(PaginationPageInput, {
|
|
79
79
|
numberOfPages: 10,
|
|
80
80
|
currentPageIndex: 3,
|
|
81
81
|
onChange: defaultOnChange,
|
|
@@ -89,7 +89,7 @@ describe('<PaginationPageInput />', () => {
|
|
|
89
89
|
});
|
|
90
90
|
it("should disable the input on 'disabled'", async () => {
|
|
91
91
|
const defaultOnChange = vi.fn();
|
|
92
|
-
render(
|
|
92
|
+
render(_jsx(PaginationPageInput, {
|
|
93
93
|
numberOfPages: 10,
|
|
94
94
|
currentPageIndex: 3,
|
|
95
95
|
onChange: defaultOnChange,
|
|
@@ -101,7 +101,7 @@ describe('<PaginationPageInput />', () => {
|
|
|
101
101
|
});
|
|
102
102
|
it('should set the ScreenReaderLabel for the input', async () => {
|
|
103
103
|
const defaultOnChange = vi.fn();
|
|
104
|
-
const _render3 = render(
|
|
104
|
+
const _render3 = render(_jsx(PaginationPageInput, {
|
|
105
105
|
numberOfPages: 10,
|
|
106
106
|
currentPageIndex: 3,
|
|
107
107
|
onChange: defaultOnChange,
|
|
@@ -113,7 +113,7 @@ describe('<PaginationPageInput />', () => {
|
|
|
113
113
|
});
|
|
114
114
|
it('should display the number of pages in the label', async () => {
|
|
115
115
|
const defaultOnChange = vi.fn();
|
|
116
|
-
const _render4 = render(
|
|
116
|
+
const _render4 = render(_jsx(PaginationPageInput, {
|
|
117
117
|
numberOfPages: 10,
|
|
118
118
|
currentPageIndex: 3,
|
|
119
119
|
onChange: defaultOnChange,
|
|
@@ -22,16 +22,16 @@ var _dec, _dec2, _class, _PaginationPageInput;
|
|
|
22
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
/** @jsx jsx */
|
|
26
25
|
|
|
27
|
-
import
|
|
26
|
+
import { Component } from 'react';
|
|
28
27
|
import { testable } from '@instructure/ui-testable';
|
|
29
|
-
import { withStyle
|
|
28
|
+
import { withStyle } from '@instructure/emotion';
|
|
30
29
|
import { NumberInput } from '@instructure/ui-number-input';
|
|
31
30
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
32
31
|
import generateStyle from './styles';
|
|
33
32
|
import generateComponentTheme from './theme';
|
|
34
33
|
import { propTypes, allowedProps } from './props';
|
|
34
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
35
35
|
/**
|
|
36
36
|
---
|
|
37
37
|
parent: Pagination
|
|
@@ -140,39 +140,44 @@ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
140
140
|
label = _this$props3.label,
|
|
141
141
|
numberOfPages = _this$props3.numberOfPages,
|
|
142
142
|
styles = _this$props3.styles;
|
|
143
|
-
return typeof label === 'function' && label(numberOfPages) ?
|
|
144
|
-
css: styles === null || styles === void 0 ? void 0 : styles.inputLabel
|
|
145
|
-
|
|
143
|
+
return typeof label === 'function' && label(numberOfPages) ? _jsx("span", {
|
|
144
|
+
css: styles === null || styles === void 0 ? void 0 : styles.inputLabel,
|
|
145
|
+
children: label(numberOfPages)
|
|
146
|
+
}) : null;
|
|
146
147
|
}
|
|
147
148
|
renderScreenReaderLabel() {
|
|
148
149
|
const _this$props4 = this.props,
|
|
149
150
|
screenReaderLabel = _this$props4.screenReaderLabel,
|
|
150
151
|
numberOfPages = _this$props4.numberOfPages;
|
|
151
|
-
return
|
|
152
|
+
return _jsx(ScreenReaderContent, {
|
|
153
|
+
children: screenReaderLabel(this.currentPage, numberOfPages)
|
|
154
|
+
});
|
|
152
155
|
}
|
|
153
156
|
render() {
|
|
154
157
|
const _this$props5 = this.props,
|
|
155
158
|
styles = _this$props5.styles,
|
|
156
159
|
disabled = _this$props5.disabled;
|
|
157
|
-
return
|
|
160
|
+
return _jsxs("span", {
|
|
158
161
|
css: styles === null || styles === void 0 ? void 0 : styles.paginationPageInput,
|
|
159
|
-
ref: this.handleRef
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
ref: this.handleRef,
|
|
163
|
+
children: [_jsx("span", {
|
|
164
|
+
css: styles === null || styles === void 0 ? void 0 : styles.numberInput,
|
|
165
|
+
children: _jsx(NumberInput, {
|
|
166
|
+
renderLabel: this.renderScreenReaderLabel(),
|
|
167
|
+
onBlur: this.handleBlur,
|
|
168
|
+
onChange: this.handleChange,
|
|
169
|
+
onDecrement: this.handleDecrement,
|
|
170
|
+
onIncrement: this.handleIncrement,
|
|
171
|
+
onKeyDown: this.handleKeyDown.bind(this),
|
|
172
|
+
interaction: disabled ? 'disabled' : 'enabled',
|
|
173
|
+
showArrows: false,
|
|
174
|
+
value: this.state.value,
|
|
175
|
+
width: "100%",
|
|
176
|
+
textAlign: "center",
|
|
177
|
+
inputRef: this.handleInputRef
|
|
178
|
+
})
|
|
179
|
+
}), this.renderLabel()]
|
|
180
|
+
});
|
|
176
181
|
}
|
|
177
182
|
}, _PaginationPageInput.displayName = "PaginationPageInput", _PaginationPageInput.componentId = 'Pagination.PageInput', _PaginationPageInput.propTypes = propTypes, _PaginationPageInput.allowedProps = allowedProps, _PaginationPageInput.defaultProps = {
|
|
178
183
|
disabled: false
|