@instructure/ui-pagination 10.16.0 → 10.16.1-pr-snapshot-1744893671793

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/es/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.js +3 -3
  3. package/es/Pagination/PaginationArrowButton/index.js +18 -12
  4. package/es/Pagination/PaginationButton/__new-tests__/PaginationButton.test.js +17 -13
  5. package/es/Pagination/PaginationButton/index.js +14 -11
  6. package/es/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.js +9 -9
  7. package/es/Pagination/PaginationPageInput/index.js +30 -25
  8. package/es/Pagination/__new-tests__/Pagination.test.js +238 -184
  9. package/es/Pagination/index.js +58 -49
  10. package/lib/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.js +6 -7
  11. package/lib/Pagination/PaginationArrowButton/index.js +18 -13
  12. package/lib/Pagination/PaginationButton/__new-tests__/PaginationButton.test.js +24 -21
  13. package/lib/Pagination/PaginationButton/index.js +14 -12
  14. package/lib/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.js +15 -16
  15. package/lib/Pagination/PaginationPageInput/index.js +29 -25
  16. package/lib/Pagination/__new-tests__/Pagination.test.js +314 -260
  17. package/lib/Pagination/index.js +56 -49
  18. package/package.json +21 -21
  19. package/src/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.tsx +0 -1
  20. package/src/Pagination/PaginationArrowButton/index.tsx +1 -1
  21. package/src/Pagination/PaginationButton/__new-tests__/PaginationButton.test.tsx +0 -1
  22. package/src/Pagination/PaginationButton/index.tsx +1 -1
  23. package/src/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.tsx +0 -1
  24. package/src/Pagination/PaginationPageInput/index.tsx +2 -3
  25. package/src/Pagination/__new-tests__/Pagination.test.tsx +0 -1
  26. package/src/Pagination/index.tsx +11 -5
  27. package/tsconfig.build.tsbuildinfo +1 -1
  28. package/types/Pagination/PaginationArrowButton/__new-tests__/PaginationArrowButton.test.d.ts.map +1 -1
  29. package/types/Pagination/PaginationArrowButton/index.d.ts +2 -2
  30. package/types/Pagination/PaginationArrowButton/index.d.ts.map +1 -1
  31. package/types/Pagination/PaginationButton/__new-tests__/PaginationButton.test.d.ts.map +1 -1
  32. package/types/Pagination/PaginationButton/index.d.ts +2 -2
  33. package/types/Pagination/PaginationButton/index.d.ts.map +1 -1
  34. package/types/Pagination/PaginationPageInput/__new-tests__/PaginationPageInput.test.d.ts.map +1 -1
  35. package/types/Pagination/PaginationPageInput/index.d.ts +6 -22
  36. package/types/Pagination/PaginationPageInput/index.d.ts.map +1 -1
  37. package/types/Pagination/__new-tests__/Pagination.test.d.ts.map +1 -1
  38. package/types/Pagination/index.d.ts +11 -13
  39. package/types/Pagination/index.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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-pr-snapshot-1744893671793](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-pr-snapshot-1744893671793) (2025-04-17)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-pagination
9
+
10
+
11
+
12
+
13
+
6
14
  # [10.16.0](https://github.com/instructure/instructure-ui/compare/v10.15.2...v10.16.0) (2025-04-11)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/ui-pagination
@@ -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 = /*#__PURE__*/React.createElement(PaginationArrowButton, {
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(/*#__PURE__*/React.createElement(PaginationArrowButton, {
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 React, { Component } from 'react';
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 /*#__PURE__*/React.createElement(Tooltip, {
81
+ return _jsx(Tooltip, {
81
82
  elementRef: this.handleRef,
82
83
  on: ['hover', 'focus'],
83
- renderTip: /*#__PURE__*/React.createElement(PresentationContent, null, label)
84
- }, /*#__PURE__*/React.createElement(IconButton, Object.assign({}, props, {
85
- size: "small",
86
- withBackground: false,
87
- withBorder: false,
88
- screenReaderLabel: label,
89
- rel: props.href || props.to ? direction : void 0,
90
- elementRef: buttonRef,
91
- margin: this.margin
92
- }), this.Icon));
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 = /*#__PURE__*/React.createElement(PaginationButton, {
34
- current: true
35
- }, "1")));
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(/*#__PURE__*/React.createElement(PaginationButton, {
44
- onClick: onClick
45
- }, "1"));
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(/*#__PURE__*/React.createElement(PaginationButton, {
58
+ render(_jsx(PaginationButton, {
57
59
  onClick: onClick,
58
- current: true
59
- }, "1"));
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 = /*#__PURE__*/React.createElement(PaginationButton, {
70
- href: "https://instructure.design/"
71
- }, "1")));
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 React, { Component } from 'react';
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 /*#__PURE__*/React.createElement("li", {
51
+ return _jsx("li", {
51
52
  style: {
52
53
  all: 'unset'
53
- }
54
- }, /*#__PURE__*/React.createElement(BaseButton, Object.assign({
55
- color: "primary",
56
- withBackground: this.props.current,
57
- withBorder: this.props.current
58
- }, props, {
59
- "aria-current": this.props.current ? 'page' : void 0,
60
- elementRef: this.handleRef
61
- }), this.props.children));
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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(/*#__PURE__*/React.createElement(PaginationPageInput, {
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 React, { Component } from 'react';
26
+ import { Component } from 'react';
28
27
  import { testable } from '@instructure/ui-testable';
29
- import { withStyle, jsx } from '@instructure/emotion';
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) ? jsx("span", {
144
- css: styles === null || styles === void 0 ? void 0 : styles.inputLabel
145
- }, label(numberOfPages)) : null;
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 jsx(ScreenReaderContent, null, screenReaderLabel(this.currentPage, numberOfPages));
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 jsx("span", {
160
+ return _jsxs("span", {
158
161
  css: styles === null || styles === void 0 ? void 0 : styles.paginationPageInput,
159
- ref: this.handleRef
160
- }, jsx("span", {
161
- css: styles === null || styles === void 0 ? void 0 : styles.numberInput
162
- }, jsx(NumberInput, {
163
- renderLabel: this.renderScreenReaderLabel(),
164
- onBlur: this.handleBlur,
165
- onChange: this.handleChange,
166
- onDecrement: this.handleDecrement,
167
- onIncrement: this.handleIncrement,
168
- onKeyDown: this.handleKeyDown.bind(this),
169
- interaction: disabled ? 'disabled' : 'enabled',
170
- showArrows: false,
171
- value: this.state.value,
172
- width: "100%",
173
- textAlign: "center",
174
- inputRef: this.handleInputRef
175
- })), this.renderLabel());
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