@instructure/ui-pagination 8.13.1-snapshot.44 → 8.13.1-snapshot.50
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/es/Pagination/PaginationArrowButton/props.js +5 -2
- package/es/Pagination/PaginationButton/props.js +9 -2
- package/lib/Pagination/PaginationArrowButton/props.js +5 -2
- package/lib/Pagination/PaginationButton/props.js +9 -2
- package/package.json +22 -22
- package/src/Pagination/PaginationArrowButton/props.ts +16 -2
- package/src/Pagination/PaginationButton/props.ts +18 -2
- package/src/Pagination/PaginationPageInput/index.tsx +14 -3
- package/src/Pagination/PaginationPageInput/props.ts +4 -1
- package/src/Pagination/index.tsx +7 -9
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Pagination/PaginationArrowButton/index.d.ts +2 -0
- package/types/Pagination/PaginationArrowButton/index.d.ts.map +1 -1
- package/types/Pagination/PaginationArrowButton/props.d.ts +1 -0
- package/types/Pagination/PaginationArrowButton/props.d.ts.map +1 -1
- package/types/Pagination/PaginationButton/index.d.ts +2 -0
- package/types/Pagination/PaginationButton/index.d.ts.map +1 -1
- package/types/Pagination/PaginationButton/props.d.ts +1 -0
- package/types/Pagination/PaginationButton/props.d.ts.map +1 -1
- package/types/Pagination/PaginationPageInput/index.d.ts +5 -5
- package/types/Pagination/PaginationPageInput/index.d.ts.map +1 -1
- package/types/Pagination/PaginationPageInput/props.d.ts +1 -1
- package/types/Pagination/PaginationPageInput/props.d.ts.map +1 -1
- package/types/Pagination/index.d.ts +1 -3
- package/types/Pagination/index.d.ts.map +1 -1
|
@@ -25,7 +25,10 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
const propTypes = {
|
|
26
26
|
direction: PropTypes.oneOf(['first', 'prev', 'next', 'last']),
|
|
27
27
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
28
|
-
buttonRef: PropTypes.func
|
|
28
|
+
buttonRef: PropTypes.func,
|
|
29
|
+
onClick: PropTypes.func
|
|
29
30
|
};
|
|
30
|
-
const allowedProps = ['direction', 'label', 'buttonRef'
|
|
31
|
+
const allowedProps = ['direction', 'label', 'buttonRef' // we don't want to pass onClick
|
|
32
|
+
// 'onClick'
|
|
33
|
+
];
|
|
31
34
|
export { propTypes, allowedProps };
|
|
@@ -31,7 +31,14 @@ const propTypes = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Whether the page is currently displayed
|
|
33
33
|
*/
|
|
34
|
-
current: PropTypes.bool
|
|
34
|
+
current: PropTypes.bool,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Whether the page is currently displayed
|
|
38
|
+
*/
|
|
39
|
+
onClick: PropTypes.func
|
|
35
40
|
};
|
|
36
|
-
const allowedProps = ['children', 'current'
|
|
41
|
+
const allowedProps = ['children', 'current' // we don't want to pass onClick
|
|
42
|
+
// 'onClick'
|
|
43
|
+
];
|
|
37
44
|
export { propTypes, allowedProps };
|
|
@@ -35,8 +35,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
35
35
|
const propTypes = {
|
|
36
36
|
direction: _propTypes.default.oneOf(['first', 'prev', 'next', 'last']),
|
|
37
37
|
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]).isRequired,
|
|
38
|
-
buttonRef: _propTypes.default.func
|
|
38
|
+
buttonRef: _propTypes.default.func,
|
|
39
|
+
onClick: _propTypes.default.func
|
|
39
40
|
};
|
|
40
41
|
exports.propTypes = propTypes;
|
|
41
|
-
const allowedProps = ['direction', 'label', 'buttonRef'
|
|
42
|
+
const allowedProps = ['direction', 'label', 'buttonRef' // we don't want to pass onClick
|
|
43
|
+
// 'onClick'
|
|
44
|
+
];
|
|
42
45
|
exports.allowedProps = allowedProps;
|
|
@@ -41,8 +41,15 @@ const propTypes = {
|
|
|
41
41
|
/**
|
|
42
42
|
* Whether the page is currently displayed
|
|
43
43
|
*/
|
|
44
|
-
current: _propTypes.default.bool
|
|
44
|
+
current: _propTypes.default.bool,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Whether the page is currently displayed
|
|
48
|
+
*/
|
|
49
|
+
onClick: _propTypes.default.func
|
|
45
50
|
};
|
|
46
51
|
exports.propTypes = propTypes;
|
|
47
|
-
const allowedProps = ['children', 'current'
|
|
52
|
+
const allowedProps = ['children', 'current' // we don't want to pass onClick
|
|
53
|
+
// 'onClick'
|
|
54
|
+
];
|
|
48
55
|
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-pagination",
|
|
3
|
-
"version": "8.13.1-snapshot.
|
|
3
|
+
"version": "8.13.1-snapshot.50+d36453cd0",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,29 +24,29 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.13.1-snapshot.
|
|
28
|
-
"@instructure/ui-test-locator": "8.13.1-snapshot.
|
|
29
|
-
"@instructure/ui-test-queries": "8.13.1-snapshot.
|
|
30
|
-
"@instructure/ui-test-utils": "8.13.1-snapshot.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.13.1-snapshot.50+d36453cd0",
|
|
28
|
+
"@instructure/ui-test-locator": "8.13.1-snapshot.50+d36453cd0",
|
|
29
|
+
"@instructure/ui-test-queries": "8.13.1-snapshot.50+d36453cd0",
|
|
30
|
+
"@instructure/ui-test-utils": "8.13.1-snapshot.50+d36453cd0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.13.1-snapshot.
|
|
35
|
-
"@instructure/shared-types": "8.13.1-snapshot.
|
|
36
|
-
"@instructure/ui-a11y-content": "8.13.1-snapshot.
|
|
37
|
-
"@instructure/ui-a11y-utils": "8.13.1-snapshot.
|
|
38
|
-
"@instructure/ui-buttons": "8.13.1-snapshot.
|
|
39
|
-
"@instructure/ui-dom-utils": "8.13.1-snapshot.
|
|
40
|
-
"@instructure/ui-icons": "8.13.1-snapshot.
|
|
41
|
-
"@instructure/ui-number-input": "8.13.1-snapshot.
|
|
42
|
-
"@instructure/ui-portal": "8.13.1-snapshot.
|
|
43
|
-
"@instructure/ui-prop-types": "8.13.1-snapshot.
|
|
44
|
-
"@instructure/ui-react-utils": "8.13.1-snapshot.
|
|
45
|
-
"@instructure/ui-testable": "8.13.1-snapshot.
|
|
46
|
-
"@instructure/ui-tooltip": "8.13.1-snapshot.
|
|
47
|
-
"@instructure/ui-utils": "8.13.1-snapshot.
|
|
48
|
-
"@instructure/ui-view": "8.13.1-snapshot.
|
|
49
|
-
"@instructure/uid": "8.13.1-snapshot.
|
|
34
|
+
"@instructure/emotion": "8.13.1-snapshot.50+d36453cd0",
|
|
35
|
+
"@instructure/shared-types": "8.13.1-snapshot.50+d36453cd0",
|
|
36
|
+
"@instructure/ui-a11y-content": "8.13.1-snapshot.50+d36453cd0",
|
|
37
|
+
"@instructure/ui-a11y-utils": "8.13.1-snapshot.50+d36453cd0",
|
|
38
|
+
"@instructure/ui-buttons": "8.13.1-snapshot.50+d36453cd0",
|
|
39
|
+
"@instructure/ui-dom-utils": "8.13.1-snapshot.50+d36453cd0",
|
|
40
|
+
"@instructure/ui-icons": "8.13.1-snapshot.50+d36453cd0",
|
|
41
|
+
"@instructure/ui-number-input": "8.13.1-snapshot.50+d36453cd0",
|
|
42
|
+
"@instructure/ui-portal": "8.13.1-snapshot.50+d36453cd0",
|
|
43
|
+
"@instructure/ui-prop-types": "8.13.1-snapshot.50+d36453cd0",
|
|
44
|
+
"@instructure/ui-react-utils": "8.13.1-snapshot.50+d36453cd0",
|
|
45
|
+
"@instructure/ui-testable": "8.13.1-snapshot.50+d36453cd0",
|
|
46
|
+
"@instructure/ui-tooltip": "8.13.1-snapshot.50+d36453cd0",
|
|
47
|
+
"@instructure/ui-utils": "8.13.1-snapshot.50+d36453cd0",
|
|
48
|
+
"@instructure/ui-view": "8.13.1-snapshot.50+d36453cd0",
|
|
49
|
+
"@instructure/uid": "8.13.1-snapshot.50+d36453cd0",
|
|
50
50
|
"keycode": "^2",
|
|
51
51
|
"prop-types": "^15"
|
|
52
52
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"sideEffects": false,
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "d36453cd0cdef28b46b1224a4959798a6cafe619"
|
|
61
61
|
}
|
|
@@ -36,6 +36,12 @@ type PaginationNavigationOwnProps = {
|
|
|
36
36
|
direction?: PaginationArrowDirections
|
|
37
37
|
label: string | React.ReactChild | React.ReactFragment
|
|
38
38
|
buttonRef?: (...args: any[]) => any
|
|
39
|
+
onClick?: (
|
|
40
|
+
event:
|
|
41
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
42
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
43
|
+
| React.FocusEvent<HTMLInputElement>
|
|
44
|
+
) => void
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
type PropKeys = keyof PaginationNavigationOwnProps
|
|
@@ -48,10 +54,18 @@ type PaginationNavigationProps = PaginationNavigationOwnProps &
|
|
|
48
54
|
const propTypes: PropValidators<PropKeys> = {
|
|
49
55
|
direction: PropTypes.oneOf(['first', 'prev', 'next', 'last']),
|
|
50
56
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
51
|
-
buttonRef: PropTypes.func
|
|
57
|
+
buttonRef: PropTypes.func,
|
|
58
|
+
onClick: PropTypes.func
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
const allowedProps: AllowedPropKeys = [
|
|
61
|
+
const allowedProps: AllowedPropKeys = [
|
|
62
|
+
'direction',
|
|
63
|
+
'label',
|
|
64
|
+
'buttonRef'
|
|
65
|
+
|
|
66
|
+
// we don't want to pass onClick
|
|
67
|
+
// 'onClick'
|
|
68
|
+
]
|
|
55
69
|
|
|
56
70
|
export type { PaginationNavigationProps, PaginationArrowDirections }
|
|
57
71
|
export { propTypes, allowedProps }
|
|
@@ -33,6 +33,12 @@ import type {
|
|
|
33
33
|
type PaginationPageOwnProps = {
|
|
34
34
|
children: React.ReactNode
|
|
35
35
|
current?: boolean
|
|
36
|
+
onClick?: (
|
|
37
|
+
event:
|
|
38
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
39
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
40
|
+
| React.FocusEvent<HTMLInputElement>
|
|
41
|
+
) => void
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
type PropKeys = keyof PaginationPageOwnProps
|
|
@@ -50,10 +56,20 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
50
56
|
/**
|
|
51
57
|
* Whether the page is currently displayed
|
|
52
58
|
*/
|
|
53
|
-
current: PropTypes.bool
|
|
59
|
+
current: PropTypes.bool,
|
|
60
|
+
/**
|
|
61
|
+
* Whether the page is currently displayed
|
|
62
|
+
*/
|
|
63
|
+
onClick: PropTypes.func
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
const allowedProps: AllowedPropKeys = [
|
|
66
|
+
const allowedProps: AllowedPropKeys = [
|
|
67
|
+
'children',
|
|
68
|
+
'current'
|
|
69
|
+
|
|
70
|
+
// we don't want to pass onClick
|
|
71
|
+
// 'onClick'
|
|
72
|
+
]
|
|
57
73
|
|
|
58
74
|
export type { PaginationPageProps }
|
|
59
75
|
export { propTypes, allowedProps }
|
|
@@ -151,11 +151,19 @@ class PaginationPageInput extends Component<
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
handleDecrement = (
|
|
154
|
+
handleDecrement = (
|
|
155
|
+
event:
|
|
156
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
157
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
158
|
+
) => {
|
|
155
159
|
this.setNewPage(event, Math.floor(this.currentPage - 1))
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
handleIncrement = (
|
|
162
|
+
handleIncrement = (
|
|
163
|
+
event:
|
|
164
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
165
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
166
|
+
) => {
|
|
159
167
|
this.setNewPage(event, Math.floor(this.currentPage + 1))
|
|
160
168
|
}
|
|
161
169
|
|
|
@@ -170,7 +178,10 @@ class PaginationPageInput extends Component<
|
|
|
170
178
|
}
|
|
171
179
|
|
|
172
180
|
setNewPage(
|
|
173
|
-
event:
|
|
181
|
+
event:
|
|
182
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
183
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
184
|
+
| React.FocusEvent<HTMLInputElement>,
|
|
174
185
|
n: number
|
|
175
186
|
) {
|
|
176
187
|
const number = this.getNumberWithinRange(n)
|
|
@@ -44,7 +44,10 @@ type PaginationPageInputOwnProps = {
|
|
|
44
44
|
* Fires when a new page index is selected
|
|
45
45
|
*/
|
|
46
46
|
onChange: (
|
|
47
|
-
event:
|
|
47
|
+
event:
|
|
48
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
49
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
50
|
+
| React.FocusEvent<HTMLInputElement>,
|
|
48
51
|
pageIndex: number
|
|
49
52
|
) => void
|
|
50
53
|
/**
|
package/src/Pagination/index.tsx
CHANGED
|
@@ -39,10 +39,7 @@ import { PaginationPageInput } from './PaginationPageInput'
|
|
|
39
39
|
import generateStyle from './styles'
|
|
40
40
|
|
|
41
41
|
import type { PaginationPageProps } from './PaginationButton/props'
|
|
42
|
-
import type {
|
|
43
|
-
PaginationNavigationProps,
|
|
44
|
-
PaginationArrowDirections
|
|
45
|
-
} from './PaginationArrowButton/props'
|
|
42
|
+
import type { PaginationArrowDirections } from './PaginationArrowButton/props'
|
|
46
43
|
|
|
47
44
|
import { propTypes, allowedProps } from './props'
|
|
48
45
|
import type { PaginationProps, PaginationSnapshot } from './props'
|
|
@@ -80,7 +77,6 @@ type ArrowConfig = {
|
|
|
80
77
|
category: components
|
|
81
78
|
---
|
|
82
79
|
**/
|
|
83
|
-
|
|
84
80
|
@withStyle(generateStyle, null)
|
|
85
81
|
@testable()
|
|
86
82
|
class Pagination extends Component<PaginationProps> {
|
|
@@ -267,10 +263,13 @@ class Pagination extends Component<PaginationProps> {
|
|
|
267
263
|
}
|
|
268
264
|
|
|
269
265
|
handleInputChange(
|
|
270
|
-
event:
|
|
266
|
+
event:
|
|
267
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
268
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
269
|
+
| React.FocusEvent<HTMLInputElement>,
|
|
271
270
|
pageIndex: number
|
|
272
271
|
) {
|
|
273
|
-
this.childPages[pageIndex].props.onClick?.(event
|
|
272
|
+
this.childPages[pageIndex].props.onClick?.(event)
|
|
274
273
|
}
|
|
275
274
|
|
|
276
275
|
renderPages(currentPageIndex: number) {
|
|
@@ -385,8 +384,7 @@ class Pagination extends Component<PaginationProps> {
|
|
|
385
384
|
|
|
386
385
|
const disabled =
|
|
387
386
|
page?.props?.disabled || this.props.disabled || !shouldEnableIcon
|
|
388
|
-
const onClick = page?.props
|
|
389
|
-
?.onClick as React.MouseEventHandler<PaginationNavigationProps>
|
|
387
|
+
const onClick = page?.props?.onClick
|
|
390
388
|
|
|
391
389
|
return shouldEnableIcon || this.showDisabledButtons ? (
|
|
392
390
|
<PaginationArrowButton
|