@instructure/ui-pagination 8.8.1-snapshot.3 → 8.9.0
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 +6 -0
- package/es/Pagination/PaginationArrowButton/index.js +3 -8
- package/{src/Pagination/PaginationArrowButton/types.ts → es/Pagination/PaginationArrowButton/props.js} +8 -8
- package/es/Pagination/PaginationButton/index.js +2 -12
- package/{src/Pagination/PaginationButton/types.ts → es/Pagination/PaginationButton/props.js} +13 -3
- package/es/Pagination/index.js +7 -71
- package/es/Pagination/props.js +86 -0
- package/lib/Pagination/PaginationArrowButton/index.js +3 -8
- package/lib/Pagination/PaginationArrowButton/props.js +42 -0
- package/lib/Pagination/PaginationButton/index.js +3 -15
- package/{src/Pagination/types.ts → lib/Pagination/PaginationButton/props.js} +24 -17
- package/lib/Pagination/index.js +7 -72
- package/lib/Pagination/props.js +100 -0
- package/package.json +21 -22
- package/src/Pagination/PaginationArrowButton/index.tsx +4 -8
- package/src/Pagination/PaginationArrowButton/props.ts +51 -0
- package/src/Pagination/PaginationButton/index.tsx +5 -13
- package/src/Pagination/PaginationButton/props.ts +55 -0
- package/src/Pagination/index.tsx +8 -63
- package/src/Pagination/props.ts +118 -0
- package/src/index.ts +3 -3
- package/types/Pagination/PaginationArrowButton/index.d.ts +12 -9
- package/types/Pagination/PaginationArrowButton/index.d.ts.map +1 -1
- package/types/Pagination/PaginationArrowButton/props.d.ts +15 -0
- package/types/Pagination/PaginationArrowButton/props.d.ts.map +1 -0
- package/types/Pagination/PaginationButton/index.d.ts +10 -13
- package/types/Pagination/PaginationButton/index.d.ts.map +1 -1
- package/types/Pagination/PaginationButton/props.d.ts +14 -0
- package/types/Pagination/PaginationButton/props.d.ts.map +1 -0
- package/types/Pagination/index.d.ts +26 -60
- package/types/Pagination/index.d.ts.map +1 -1
- package/types/Pagination/props.d.ts +23 -0
- package/types/Pagination/props.d.ts.map +1 -0
- package/types/index.d.ts +3 -3
- package/LICENSE.md +0 -27
- package/es/Pagination/PaginationArrowButton/types.js +0 -1
- package/es/Pagination/PaginationButton/types.js +0 -1
- package/es/Pagination/types.js +0 -1
- package/lib/Pagination/PaginationArrowButton/types.js +0 -1
- package/lib/Pagination/PaginationButton/types.js +0 -1
- package/lib/Pagination/types.js +0 -1
- package/types/Pagination/PaginationArrowButton/types.d.ts +0 -7
- package/types/Pagination/PaginationArrowButton/types.d.ts.map +0 -1
- package/types/Pagination/PaginationButton/types.d.ts +0 -4
- package/types/Pagination/PaginationButton/types.d.ts.map +0 -1
- package/types/Pagination/types.d.ts +0 -17
- package/types/Pagination/types.d.ts.map +0 -1
package/lib/Pagination/index.js
CHANGED
|
@@ -17,8 +17,6 @@ exports.Pagination = exports.default = void 0;
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
-
|
|
22
20
|
var _View = require("@instructure/ui-view/lib/View");
|
|
23
21
|
|
|
24
22
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
@@ -27,8 +25,6 @@ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
|
27
25
|
|
|
28
26
|
var _uid = require("@instructure/uid");
|
|
29
27
|
|
|
30
|
-
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
31
|
-
|
|
32
28
|
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
33
29
|
|
|
34
30
|
var _findTabbable = require("@instructure/ui-dom-utils/lib/findTabbable.js");
|
|
@@ -43,6 +39,8 @@ var _PaginationArrowButton = require("./PaginationArrowButton");
|
|
|
43
39
|
|
|
44
40
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
45
41
|
|
|
42
|
+
var _props = require("./props");
|
|
43
|
+
|
|
46
44
|
var _dec, _dec2, _class, _class2, _temp, _span, _span2;
|
|
47
45
|
|
|
48
46
|
/** This is an [].findIndex optimized to work on really big, but sparse, arrays */
|
|
@@ -191,6 +189,8 @@ let Pagination = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 =
|
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
render() {
|
|
192
|
+
var _this$props$styles, _this$props$styles2;
|
|
193
|
+
|
|
194
194
|
if (!this.props.children) return null;
|
|
195
195
|
const currentPageIndex = fastFindIndex(this.props.children, p => p && p.props && p.props.current);
|
|
196
196
|
|
|
@@ -201,81 +201,16 @@ let Pagination = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 =
|
|
|
201
201
|
as: this.props.as,
|
|
202
202
|
elementRef: this.handleElementRef,
|
|
203
203
|
margin: this.props.margin,
|
|
204
|
-
css: this.props.styles.pagination,
|
|
204
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.pagination,
|
|
205
205
|
"aria-labelledby": this.props.label && this._labelId
|
|
206
206
|
}), this.props.label && this.renderLabel(), (0, _emotion.jsx)(_View.View, {
|
|
207
207
|
display: "inline-block",
|
|
208
|
-
css: this.props.styles.pages
|
|
208
|
+
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.pages
|
|
209
209
|
}, shouldShowPrevButton(this.props, currentPageIndex) && this.renderArrowButton(this.props.labelPrev, -1, currentPageIndex), this.renderPages(currentPageIndex), shouldShowNextButton(this.props, currentPageIndex) && this.renderArrowButton(this.props.labelNext, 1, currentPageIndex)));
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
}, _class2.displayName = "Pagination", _class2.componentId = 'Pagination', _class2.propTypes = {
|
|
213
|
-
// eslint-disable-next-line react/require-default-props
|
|
214
|
-
makeStyles: _propTypes.default.func,
|
|
215
|
-
// eslint-disable-next-line react/require-default-props
|
|
216
|
-
styles: _propTypes.default.object,
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* children of type Pagination.Page
|
|
220
|
-
*/
|
|
221
|
-
children: _Children.Children.oneOf([_PaginationButton.PaginationButton]),
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Disables interaction with all pages
|
|
225
|
-
*/
|
|
226
|
-
disabled: _propTypes.default.bool,
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Visible label for component
|
|
230
|
-
*/
|
|
231
|
-
label: _propTypes.default.node,
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Accessible label for next button
|
|
235
|
-
*/
|
|
236
|
-
labelNext: _propTypes.default.string,
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Accessible label for previous button
|
|
240
|
-
*/
|
|
241
|
-
labelPrev: _propTypes.default.string,
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* The compact variant truncates the page navigation to show only the first,
|
|
245
|
-
* last, and pages immediately surrounding the current page. Fewer than 5 pages,
|
|
246
|
-
* no next/previous arrow buttons will be shown, and all pages will be listed
|
|
247
|
-
*/
|
|
248
|
-
variant: _propTypes.default.oneOf(['full', 'compact']),
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
252
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
253
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
254
|
-
*/
|
|
255
|
-
margin: _emotion.ThemeablePropTypes.spacing,
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* the element type to render as
|
|
259
|
-
*/
|
|
260
|
-
as: _propTypes.default.elementType,
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* provides a reference to the underlying html root element
|
|
264
|
-
*/
|
|
265
|
-
elementRef: _propTypes.default.func,
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* For accessibility, Pagination sets focus on the first or last Pagination.Pages,
|
|
269
|
-
* respectively, when the Previous or Next arrow buttons are removed from the DOM.
|
|
270
|
-
* Set this property to `false` to prevent this behavior.
|
|
271
|
-
*/
|
|
272
|
-
shouldHandleFocus: _propTypes.default.bool
|
|
273
|
-
}, _class2.defaultProps = {
|
|
212
|
+
}, _class2.displayName = "Pagination", _class2.componentId = 'Pagination', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
274
213
|
children: null,
|
|
275
|
-
label: void 0,
|
|
276
|
-
labelNext: void 0,
|
|
277
|
-
labelPrev: void 0,
|
|
278
|
-
margin: void 0,
|
|
279
214
|
disabled: false,
|
|
280
215
|
variant: 'full',
|
|
281
216
|
as: 'div',
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
13
|
+
|
|
14
|
+
var _emotion = require("@instructure/emotion");
|
|
15
|
+
|
|
16
|
+
var _PaginationButton = require("./PaginationButton");
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* The MIT License (MIT)
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
22
|
+
*
|
|
23
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
24
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
25
|
+
* in the Software without restriction, including without limitation the rights
|
|
26
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
27
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
28
|
+
* furnished to do so, subject to the following conditions:
|
|
29
|
+
*
|
|
30
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
31
|
+
* copies or substantial portions of the Software.
|
|
32
|
+
*
|
|
33
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
34
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
35
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
36
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
37
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
38
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
|
+
* SOFTWARE.
|
|
40
|
+
*/
|
|
41
|
+
const propTypes = {
|
|
42
|
+
/**
|
|
43
|
+
* children of type Pagination.Page
|
|
44
|
+
*/
|
|
45
|
+
children: _Children.Children.oneOf([_PaginationButton.PaginationButton]),
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Disables interaction with all pages
|
|
49
|
+
*/
|
|
50
|
+
disabled: _propTypes.default.bool,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Visible label for component
|
|
54
|
+
*/
|
|
55
|
+
label: _propTypes.default.node,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Accessible label for next button
|
|
59
|
+
*/
|
|
60
|
+
labelNext: _propTypes.default.string,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Accessible label for previous button
|
|
64
|
+
*/
|
|
65
|
+
labelPrev: _propTypes.default.string,
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The compact variant truncates the page navigation to show only the first,
|
|
69
|
+
* last, and pages immediately surrounding the current page. Fewer than 5 pages,
|
|
70
|
+
* no next/previous arrow buttons will be shown, and all pages will be listed
|
|
71
|
+
*/
|
|
72
|
+
variant: _propTypes.default.oneOf(['full', 'compact']),
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
76
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
77
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
78
|
+
*/
|
|
79
|
+
margin: _emotion.ThemeablePropTypes.spacing,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* the element type to render as
|
|
83
|
+
*/
|
|
84
|
+
as: _propTypes.default.elementType,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* provides a reference to the underlying html root element
|
|
88
|
+
*/
|
|
89
|
+
elementRef: _propTypes.default.func,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* For accessibility, Pagination sets focus on the first or last Pagination.Pages,
|
|
93
|
+
* respectively, when the Previous or Next arrow buttons are removed from the DOM.
|
|
94
|
+
* Set this property to `false` to prevent this behavior.
|
|
95
|
+
*/
|
|
96
|
+
shouldHandleFocus: _propTypes.default.bool
|
|
97
|
+
};
|
|
98
|
+
exports.propTypes = propTypes;
|
|
99
|
+
const allowedProps = ['children', 'disabled', 'label', 'labelNext', 'labelPrev', 'variant', 'margin', 'as', 'elementRef', 'shouldHandleFocus'];
|
|
100
|
+
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-pagination",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
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,28 +24,28 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-test-
|
|
30
|
-
"@instructure/ui-test-
|
|
31
|
-
"@instructure/ui-test-utils": "8.8.1-snapshot.3+d5d6d4cd8"
|
|
27
|
+
"@instructure/ui-babel-preset": "8.9.0",
|
|
28
|
+
"@instructure/ui-test-locator": "8.9.0",
|
|
29
|
+
"@instructure/ui-test-queries": "8.9.0",
|
|
30
|
+
"@instructure/ui-test-utils": "8.9.0"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
33
|
"@babel/runtime": "^7.13.10",
|
|
35
|
-
"@instructure/emotion": "8.
|
|
36
|
-
"@instructure/
|
|
37
|
-
"@instructure/ui-a11y-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-
|
|
40
|
-
"@instructure/ui-
|
|
41
|
-
"@instructure/ui-
|
|
42
|
-
"@instructure/ui-
|
|
43
|
-
"@instructure/ui-
|
|
44
|
-
"@instructure/ui-
|
|
45
|
-
"@instructure/ui-
|
|
46
|
-
"@instructure/ui-
|
|
47
|
-
"@instructure/ui-
|
|
48
|
-
"@instructure/
|
|
34
|
+
"@instructure/emotion": "8.9.0",
|
|
35
|
+
"@instructure/shared-types": "8.9.0",
|
|
36
|
+
"@instructure/ui-a11y-content": "8.9.0",
|
|
37
|
+
"@instructure/ui-a11y-utils": "8.9.0",
|
|
38
|
+
"@instructure/ui-buttons": "8.9.0",
|
|
39
|
+
"@instructure/ui-dom-utils": "8.9.0",
|
|
40
|
+
"@instructure/ui-icons": "8.9.0",
|
|
41
|
+
"@instructure/ui-portal": "8.9.0",
|
|
42
|
+
"@instructure/ui-prop-types": "8.9.0",
|
|
43
|
+
"@instructure/ui-react-utils": "8.9.0",
|
|
44
|
+
"@instructure/ui-testable": "8.9.0",
|
|
45
|
+
"@instructure/ui-tooltip": "8.9.0",
|
|
46
|
+
"@instructure/ui-utils": "8.9.0",
|
|
47
|
+
"@instructure/ui-view": "8.9.0",
|
|
48
|
+
"@instructure/uid": "8.9.0",
|
|
49
49
|
"prop-types": "^15"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -54,6 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"sideEffects": false
|
|
58
|
-
"gitHead": "d5d6d4cd8f300e8635c69248f5d794c002269e08"
|
|
57
|
+
"sideEffects": false
|
|
59
58
|
}
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React, { Component } from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
27
|
import { IconButton } from '@instructure/ui-buttons'
|
|
29
28
|
import { PresentationContent } from '@instructure/ui-a11y-content'
|
|
@@ -33,7 +32,8 @@ import {
|
|
|
33
32
|
IconArrowOpenEndSolid
|
|
34
33
|
} from '@instructure/ui-icons'
|
|
35
34
|
import { testable } from '@instructure/ui-testable'
|
|
36
|
-
import { PaginationNavigationProps } from './
|
|
35
|
+
import type { PaginationNavigationProps } from './props'
|
|
36
|
+
import { allowedProps, propTypes } from './props'
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
---
|
|
@@ -45,14 +45,10 @@ id: Pagination.Navigation
|
|
|
45
45
|
class PaginationArrowButton extends Component<PaginationNavigationProps> {
|
|
46
46
|
static readonly componentId = 'Pagination.Navigation'
|
|
47
47
|
|
|
48
|
-
static
|
|
49
|
-
|
|
50
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
51
|
-
buttonRef: PropTypes.func
|
|
52
|
-
}
|
|
48
|
+
static allowedProps = allowedProps
|
|
49
|
+
static propTypes = propTypes
|
|
53
50
|
|
|
54
51
|
static defaultProps = {
|
|
55
|
-
direction: undefined,
|
|
56
52
|
// @ts-expect-error ts-migrate(6133) FIXME: 'el' is declared but its value is never read.
|
|
57
53
|
buttonRef: (el) => {}
|
|
58
54
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
29
|
+
|
|
30
|
+
type PaginationNavigationOwnProps = {
|
|
31
|
+
direction?: 'next' | 'prev'
|
|
32
|
+
label: string | React.ReactNode
|
|
33
|
+
buttonRef?: (...args: any[]) => any
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type PropKeys = keyof PaginationNavigationOwnProps
|
|
37
|
+
|
|
38
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
39
|
+
|
|
40
|
+
type PaginationNavigationProps = PaginationNavigationOwnProps
|
|
41
|
+
|
|
42
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
43
|
+
direction: PropTypes.oneOf(['next', 'prev']),
|
|
44
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
45
|
+
buttonRef: PropTypes.func
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const allowedProps: AllowedPropKeys = ['direction', 'label', 'buttonRef']
|
|
49
|
+
|
|
50
|
+
export type { PaginationNavigationProps }
|
|
51
|
+
export { propTypes, allowedProps }
|
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React, { Component } from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
27
|
import { BaseButton } from '@instructure/ui-buttons'
|
|
29
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
30
29
|
import { testable } from '@instructure/ui-testable'
|
|
31
|
-
|
|
30
|
+
|
|
31
|
+
import { propTypes, allowedProps } from './props'
|
|
32
|
+
import type { PaginationPageProps } from './props'
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
---
|
|
@@ -41,17 +42,8 @@ id: Pagination.Page
|
|
|
41
42
|
class PaginationButton extends Component<PaginationPageProps> {
|
|
42
43
|
static readonly componentId = 'Pagination.Page'
|
|
43
44
|
|
|
44
|
-
static propTypes =
|
|
45
|
-
|
|
46
|
-
* Content to render as page selection
|
|
47
|
-
*/
|
|
48
|
-
children: PropTypes.node.isRequired,
|
|
49
|
-
/**
|
|
50
|
-
* Whether the page is currently displayed
|
|
51
|
-
*/
|
|
52
|
-
current: PropTypes.bool
|
|
53
|
-
}
|
|
54
|
-
|
|
45
|
+
static propTypes = propTypes
|
|
46
|
+
static allowedProps = allowedProps
|
|
55
47
|
static defaultProps = {
|
|
56
48
|
current: false
|
|
57
49
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
29
|
+
|
|
30
|
+
type PaginationPageOwnProps = {
|
|
31
|
+
children: React.ReactNode
|
|
32
|
+
current?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type PropKeys = keyof PaginationPageOwnProps
|
|
36
|
+
|
|
37
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
38
|
+
|
|
39
|
+
type PaginationPageProps = PaginationPageOwnProps
|
|
40
|
+
|
|
41
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
42
|
+
/**
|
|
43
|
+
* Content to render as page selection
|
|
44
|
+
*/
|
|
45
|
+
children: PropTypes.node.isRequired,
|
|
46
|
+
/**
|
|
47
|
+
* Whether the page is currently displayed
|
|
48
|
+
*/
|
|
49
|
+
current: PropTypes.bool
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const allowedProps: AllowedPropKeys = ['children', 'current']
|
|
53
|
+
|
|
54
|
+
export type { PaginationPageProps }
|
|
55
|
+
export { propTypes, allowedProps }
|