@instructure/ui-pagination 8.33.1 → 8.33.2
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 +4 -0
- package/es/Pagination/PaginationArrowButton/PaginationArrowButtonLocator.js +5 -4
- package/es/Pagination/PaginationArrowButton/index.js +6 -19
- package/es/Pagination/PaginationArrowButton/props.js +5 -1
- package/es/Pagination/PaginationButton/index.js +1 -5
- package/es/Pagination/PaginationButton/props.js +5 -1
- package/es/Pagination/PaginationLocator.js +4 -2
- package/es/Pagination/PaginationPageInput/PaginationPageInputLocator.js +5 -2
- package/es/Pagination/PaginationPageInput/index.js +15 -40
- package/es/Pagination/PaginationPageInput/props.js +1 -0
- package/es/Pagination/PaginationPageInput/styles.js +0 -1
- package/es/Pagination/PaginationPageInput/theme.js +2 -2
- package/es/Pagination/index.js +11 -57
- package/es/Pagination/locator.js +1 -0
- package/es/Pagination/props.js +1 -0
- package/es/Pagination/styles.js +0 -1
- package/es/index.js +1 -0
- package/lib/Pagination/PaginationArrowButton/PaginationArrowButtonLocator.js +4 -7
- package/lib/Pagination/PaginationArrowButton/index.js +4 -31
- package/lib/Pagination/PaginationArrowButton/locator.js +0 -2
- package/lib/Pagination/PaginationArrowButton/props.js +4 -4
- package/lib/Pagination/PaginationButton/index.js +0 -11
- package/lib/Pagination/PaginationButton/props.js +4 -4
- package/lib/Pagination/PaginationLocator.js +3 -6
- package/lib/Pagination/PaginationPageInput/PaginationPageInputLocator.js +4 -5
- package/lib/Pagination/PaginationPageInput/index.js +14 -49
- package/lib/Pagination/PaginationPageInput/props.js +1 -3
- package/lib/Pagination/PaginationPageInput/styles.js +0 -2
- package/lib/Pagination/PaginationPageInput/theme.js +2 -3
- package/lib/Pagination/index.js +11 -74
- package/lib/Pagination/locator.js +0 -2
- package/lib/Pagination/props.js +1 -6
- package/lib/Pagination/styles.js +0 -2
- package/lib/index.js +0 -1
- package/package.json +21 -21
- package/tsconfig.build.tsbuildinfo +1 -1
package/es/Pagination/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var _dec, _dec2, _dec3, _class, _class2, _span, _span2;
|
|
2
|
-
|
|
3
2
|
/*
|
|
4
3
|
* The MIT License (MIT)
|
|
5
4
|
*
|
|
@@ -23,7 +22,6 @@ var _dec, _dec2, _dec3, _class, _class2, _span, _span2;
|
|
|
23
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
23
|
* SOFTWARE.
|
|
25
24
|
*/
|
|
26
|
-
|
|
27
25
|
/** @jsx jsx */
|
|
28
26
|
import React, { Component } from 'react';
|
|
29
27
|
import { View } from '@instructure/ui-view';
|
|
@@ -37,24 +35,18 @@ import { PaginationArrowButton } from './PaginationArrowButton';
|
|
|
37
35
|
import { PaginationPageInput } from './PaginationPageInput';
|
|
38
36
|
import generateStyle from './styles';
|
|
39
37
|
import { propTypes, allowedProps } from './props';
|
|
40
|
-
|
|
41
38
|
/** This is an [].findIndex optimized to work on really big, but sparse, arrays */
|
|
42
39
|
const fastFindIndex = (arr, fn) => Number(Object.keys(arr).find(k => fn(arr[Number(k)])));
|
|
43
|
-
|
|
44
40
|
const childrenArray = props => {
|
|
45
41
|
const children = props.children;
|
|
46
|
-
|
|
47
42
|
if (!children) {
|
|
48
43
|
return [];
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
return Array.isArray(children) ? children : [children];
|
|
52
46
|
};
|
|
53
|
-
|
|
54
47
|
function propsHaveCompactView(props) {
|
|
55
48
|
return props.variant === 'compact' && childrenArray(props).length > 5;
|
|
56
49
|
}
|
|
57
|
-
|
|
58
50
|
/**
|
|
59
51
|
---
|
|
60
52
|
category: components
|
|
@@ -70,47 +62,36 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
70
62
|
this._nextButton = null;
|
|
71
63
|
this._lastButton = null;
|
|
72
64
|
this.ref = null;
|
|
73
|
-
|
|
74
65
|
this.handleElementRef = el => {
|
|
75
66
|
this.ref = el;
|
|
76
|
-
|
|
77
67
|
if (el && typeof this.props.elementRef === 'function') {
|
|
78
68
|
this.props.elementRef(el);
|
|
79
69
|
}
|
|
80
70
|
};
|
|
81
|
-
|
|
82
71
|
this.handleInputRef = el => {
|
|
83
72
|
if (typeof this.props.inputRef === 'function') {
|
|
84
73
|
this.props.inputRef(el);
|
|
85
74
|
}
|
|
86
75
|
};
|
|
87
|
-
|
|
88
76
|
this._labelId = props.deterministicId();
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
get _root() {
|
|
92
79
|
return this.ref;
|
|
93
80
|
}
|
|
94
|
-
|
|
95
81
|
get inputMode() {
|
|
96
82
|
return this.props.variant === 'input';
|
|
97
83
|
}
|
|
98
|
-
|
|
99
84
|
get childPages() {
|
|
100
85
|
return childrenArray(this.props);
|
|
101
86
|
}
|
|
102
|
-
|
|
103
87
|
get withFirstAndLastButton() {
|
|
104
88
|
return this.inputMode || this.props.withFirstAndLastButton;
|
|
105
89
|
}
|
|
106
|
-
|
|
107
90
|
get showDisabledButtons() {
|
|
108
91
|
return this.inputMode || this.props.showDisabledButtons;
|
|
109
92
|
}
|
|
110
|
-
|
|
111
93
|
getSnapshotBeforeUpdate() {
|
|
112
94
|
const activeElement = getActiveElement();
|
|
113
|
-
|
|
114
95
|
if (activeElement === this._firstButton || activeElement === this._prevButton || activeElement === this._nextButton || activeElement === this._lastButton) {
|
|
115
96
|
return {
|
|
116
97
|
lastFocusedButton: activeElement
|
|
@@ -121,60 +102,50 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
121
102
|
};
|
|
122
103
|
}
|
|
123
104
|
}
|
|
124
|
-
|
|
125
105
|
componentDidMount() {
|
|
126
106
|
var _this$props$makeStyle, _this$props;
|
|
127
|
-
|
|
128
107
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
129
108
|
}
|
|
130
|
-
|
|
131
109
|
componentDidUpdate(prevProps, _prevState, snapshot) {
|
|
132
110
|
var _this$props$makeStyle2, _this$props2;
|
|
133
|
-
|
|
134
111
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
135
|
-
|
|
136
112
|
if (!this.props.shouldHandleFocus || !propsHaveCompactView(prevProps) && !propsHaveCompactView(this.props)) {
|
|
137
113
|
return;
|
|
138
114
|
} else {
|
|
139
115
|
this.focusElementAfterUpdate(snapshot);
|
|
140
116
|
}
|
|
141
117
|
}
|
|
142
|
-
|
|
143
118
|
focusElementAfterUpdate(snapshot) {
|
|
144
119
|
const lastFocusedButton = snapshot.lastFocusedButton;
|
|
145
|
-
|
|
146
120
|
if (lastFocusedButton) {
|
|
147
121
|
const focusable = findTabbable(this.ref);
|
|
148
|
-
const direction = lastFocusedButton.dataset.direction;
|
|
122
|
+
const direction = lastFocusedButton.dataset.direction;
|
|
149
123
|
|
|
150
|
-
|
|
151
|
-
|
|
124
|
+
// By default we want to focus the previously focused button
|
|
125
|
+
let nextFocusElement = lastFocusedButton;
|
|
152
126
|
|
|
127
|
+
// In case the button is not focusable anymore
|
|
128
|
+
// (disabled or not in the DOM), we focus to the next available page
|
|
153
129
|
if (!focusable.includes(nextFocusElement)) {
|
|
154
130
|
if (direction === 'first' || direction === 'prev') {
|
|
155
131
|
nextFocusElement = focusable[0];
|
|
156
132
|
}
|
|
157
|
-
|
|
158
133
|
if (direction === 'next' || direction === 'last') {
|
|
159
134
|
nextFocusElement = focusable[focusable.length - 1];
|
|
160
135
|
}
|
|
161
136
|
}
|
|
162
|
-
|
|
163
137
|
;
|
|
164
138
|
nextFocusElement.focus();
|
|
165
139
|
}
|
|
166
140
|
}
|
|
167
|
-
|
|
168
141
|
get compactView() {
|
|
169
142
|
return propsHaveCompactView(this.props);
|
|
170
143
|
}
|
|
171
|
-
|
|
172
144
|
transferDisabledPropToChildren(children) {
|
|
173
145
|
return children && this.props.disabled ? React.Children.map(children, page => /*#__PURE__*/React.cloneElement(page, {
|
|
174
146
|
disabled: this.props.disabled
|
|
175
147
|
})) : children;
|
|
176
148
|
}
|
|
177
|
-
|
|
178
149
|
renderLabel() {
|
|
179
150
|
const display = this.props.variant === 'full' ? 'inline-block' : 'block';
|
|
180
151
|
const visibleLabel = hasVisibleChildren(this.props.label);
|
|
@@ -185,7 +156,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
185
156
|
id: this._labelId
|
|
186
157
|
}, this.props.label);
|
|
187
158
|
}
|
|
188
|
-
|
|
189
159
|
renderPageInput(currentPageIndex) {
|
|
190
160
|
return jsx(PaginationPageInput, {
|
|
191
161
|
numberOfPages: this.childPages.length,
|
|
@@ -197,17 +167,13 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
197
167
|
inputRef: this.handleInputRef
|
|
198
168
|
});
|
|
199
169
|
}
|
|
200
|
-
|
|
201
170
|
handleInputChange(event, pageIndex) {
|
|
202
171
|
var _this$childPages$page, _this$childPages$page2;
|
|
203
|
-
|
|
204
172
|
(_this$childPages$page = (_this$childPages$page2 = this.childPages[pageIndex].props).onClick) === null || _this$childPages$page === void 0 ? void 0 : _this$childPages$page.call(_this$childPages$page2, event);
|
|
205
173
|
}
|
|
206
|
-
|
|
207
174
|
renderPages(currentPageIndex) {
|
|
208
175
|
const allPages = this.childPages;
|
|
209
176
|
let visiblePages = allPages;
|
|
210
|
-
|
|
211
177
|
if (this.compactView) {
|
|
212
178
|
const firstIndex = 0;
|
|
213
179
|
const lastIndex = allPages.length - 1;
|
|
@@ -227,12 +193,10 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
227
193
|
}, "\u2026")));
|
|
228
194
|
if (lastIndex - sliceEnd + 1 > 0) visiblePages.push(lastPage);
|
|
229
195
|
}
|
|
230
|
-
|
|
231
196
|
return jsx(View, {
|
|
232
197
|
display: "inline-block"
|
|
233
198
|
}, this.transferDisabledPropToChildren(visiblePages));
|
|
234
199
|
}
|
|
235
|
-
|
|
236
200
|
getArrowVariant(direction, currentPageIndex, pagesCount) {
|
|
237
201
|
switch (direction) {
|
|
238
202
|
case 'first':
|
|
@@ -244,7 +208,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
244
208
|
this._firstButton = el;
|
|
245
209
|
}
|
|
246
210
|
};
|
|
247
|
-
|
|
248
211
|
case 'prev':
|
|
249
212
|
return {
|
|
250
213
|
pageIndex: currentPageIndex - 1,
|
|
@@ -254,7 +217,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
254
217
|
this._prevButton = el;
|
|
255
218
|
}
|
|
256
219
|
};
|
|
257
|
-
|
|
258
220
|
case 'next':
|
|
259
221
|
return {
|
|
260
222
|
pageIndex: currentPageIndex + 1,
|
|
@@ -264,7 +226,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
264
226
|
this._nextButton = el;
|
|
265
227
|
}
|
|
266
228
|
};
|
|
267
|
-
|
|
268
229
|
case 'last':
|
|
269
230
|
return {
|
|
270
231
|
pageIndex: pagesCount - 1,
|
|
@@ -276,26 +237,22 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
276
237
|
};
|
|
277
238
|
}
|
|
278
239
|
}
|
|
279
|
-
|
|
280
240
|
renderArrowButton(direction, currentPageIndex) {
|
|
281
241
|
var _page$props, _page$props2;
|
|
242
|
+
const childPages = this.childPages;
|
|
282
243
|
|
|
283
|
-
|
|
284
|
-
|
|
244
|
+
// We don't display the arrows in "compact" variant under 6 items
|
|
285
245
|
if (!(propsHaveCompactView(this.props) || this.inputMode)) {
|
|
286
246
|
return null;
|
|
287
247
|
}
|
|
288
|
-
|
|
289
248
|
if (!this.withFirstAndLastButton && (direction === 'first' || direction === 'last')) {
|
|
290
249
|
return null;
|
|
291
250
|
}
|
|
292
|
-
|
|
293
251
|
const _this$getArrowVariant = this.getArrowVariant(direction, currentPageIndex, childPages.length),
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
252
|
+
pageIndex = _this$getArrowVariant.pageIndex,
|
|
253
|
+
label = _this$getArrowVariant.label,
|
|
254
|
+
shouldEnableIcon = _this$getArrowVariant.shouldEnableIcon,
|
|
255
|
+
handleButtonRef = _this$getArrowVariant.handleButtonRef;
|
|
299
256
|
const page = childPages[pageIndex];
|
|
300
257
|
const disabled = (page === null || page === void 0 ? void 0 : (_page$props = page.props) === null || _page$props === void 0 ? void 0 : _page$props.disabled) || this.props.disabled || !shouldEnableIcon;
|
|
301
258
|
const onClick = page === null || page === void 0 ? void 0 : (_page$props2 = page.props) === null || _page$props2 === void 0 ? void 0 : _page$props2.onClick;
|
|
@@ -308,10 +265,8 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
308
265
|
buttonRef: handleButtonRef
|
|
309
266
|
}) : null;
|
|
310
267
|
}
|
|
311
|
-
|
|
312
268
|
render() {
|
|
313
269
|
var _this$props$styles, _this$props$styles2;
|
|
314
|
-
|
|
315
270
|
if (!this.props.children) return null;
|
|
316
271
|
const currentPageIndex = fastFindIndex(this.childPages, p => p && p.props && p.props.current);
|
|
317
272
|
const passthroughProps = View.omitViewProps(omitProps(this.props, Pagination.allowedProps), Pagination);
|
|
@@ -327,7 +282,6 @@ let Pagination = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle,
|
|
|
327
282
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.pages
|
|
328
283
|
}, this.renderArrowButton('first', currentPageIndex), this.renderArrowButton('prev', currentPageIndex), this.inputMode ? this.renderPageInput(currentPageIndex) : this.renderPages(currentPageIndex), this.renderArrowButton('next', currentPageIndex), this.renderArrowButton('last', currentPageIndex)));
|
|
329
284
|
}
|
|
330
|
-
|
|
331
285
|
}, _class2.displayName = "Pagination", _class2.componentId = 'Pagination', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
332
286
|
disabled: false,
|
|
333
287
|
withFirstAndLastButton: false,
|
package/es/Pagination/locator.js
CHANGED
package/es/Pagination/props.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
|
|
24
25
|
import PropTypes from 'prop-types';
|
|
25
26
|
import { Children } from '@instructure/ui-prop-types';
|
|
26
27
|
import { ThemeablePropTypes } from '@instructure/emotion';
|
package/es/Pagination/styles.js
CHANGED
package/es/index.js
CHANGED
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PaginationArrowButtonLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
11
|
-
|
|
12
9
|
var _TooltipLocator = require("@instructure/ui-tooltip/lib/Tooltip/TooltipLocator");
|
|
13
|
-
|
|
14
10
|
var _index = require("./index");
|
|
15
|
-
|
|
16
11
|
/*
|
|
17
12
|
* The MIT License (MIT)
|
|
18
13
|
*
|
|
@@ -36,9 +31,12 @@ var _index = require("./index");
|
|
|
36
31
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
32
|
* SOFTWARE.
|
|
38
33
|
*/
|
|
34
|
+
|
|
39
35
|
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
40
36
|
// eslint-disable-next-line no-restricted-imports
|
|
41
|
-
|
|
37
|
+
|
|
38
|
+
const PaginationArrowButtonLocator = (0, _locator.locator)(
|
|
39
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
42
40
|
_index.PaginationArrowButton.selector, {
|
|
43
41
|
findTooltipContent: function () {
|
|
44
42
|
return _TooltipLocator.TooltipLocator.findContent(...arguments);
|
|
@@ -47,7 +45,6 @@ _index.PaginationArrowButton.selector, {
|
|
|
47
45
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
48
46
|
args[_key - 1] = arguments[_key];
|
|
49
47
|
}
|
|
50
|
-
|
|
51
48
|
return (await (0, _uiTestQueries.find)(element, 'a,button,[role="button"]')).click(...args);
|
|
52
49
|
}
|
|
53
50
|
});
|
|
@@ -1,40 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.PaginationArrowButton = void 0;
|
|
11
|
-
|
|
12
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
|
|
17
|
-
|
|
18
12
|
var _PresentationContent = require("@instructure/ui-a11y-content/lib/PresentationContent");
|
|
19
|
-
|
|
20
13
|
var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
|
|
21
|
-
|
|
22
14
|
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenStartSolid.js");
|
|
23
|
-
|
|
24
15
|
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
25
|
-
|
|
26
16
|
var _IconArrowDoubleStartSolid = require("@instructure/ui-icons/lib/IconArrowDoubleStartSolid.js");
|
|
27
|
-
|
|
28
17
|
var _IconArrowDoubleEndSolid = require("@instructure/ui-icons/lib/IconArrowDoubleEndSolid.js");
|
|
29
|
-
|
|
30
18
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
31
|
-
|
|
32
19
|
var _props = require("./props");
|
|
33
|
-
|
|
34
20
|
const _excluded = ["label", "direction", "buttonRef"];
|
|
35
|
-
|
|
36
21
|
var _dec, _class, _class2;
|
|
37
|
-
|
|
38
22
|
/**
|
|
39
23
|
---
|
|
40
24
|
parent: Pagination
|
|
@@ -46,50 +30,40 @@ let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class = (_c
|
|
|
46
30
|
constructor() {
|
|
47
31
|
super(...arguments);
|
|
48
32
|
this.ref = null;
|
|
49
|
-
|
|
50
33
|
this.handleRef = el => {
|
|
51
34
|
this.ref = el;
|
|
52
35
|
};
|
|
53
36
|
}
|
|
54
|
-
|
|
55
37
|
get margin() {
|
|
56
38
|
switch (this.props.direction) {
|
|
57
39
|
case 'first':
|
|
58
40
|
return '0 xx-small 0 0';
|
|
59
|
-
|
|
60
41
|
case 'last':
|
|
61
42
|
return '0 0 0 xx-small';
|
|
62
|
-
|
|
63
43
|
default:
|
|
64
44
|
return void 0;
|
|
65
45
|
}
|
|
66
46
|
}
|
|
67
|
-
|
|
68
47
|
get Icon() {
|
|
69
48
|
switch (this.props.direction) {
|
|
70
49
|
case 'first':
|
|
71
50
|
return _IconArrowDoubleStartSolid.IconArrowDoubleStartSolid;
|
|
72
|
-
|
|
73
51
|
case 'prev':
|
|
74
52
|
return _IconArrowOpenStartSolid.IconArrowOpenStartSolid;
|
|
75
|
-
|
|
76
53
|
case 'next':
|
|
77
54
|
return _IconArrowOpenEndSolid.IconArrowOpenEndSolid;
|
|
78
|
-
|
|
79
55
|
case 'last':
|
|
80
56
|
return _IconArrowDoubleEndSolid.IconArrowDoubleEndSolid;
|
|
81
|
-
|
|
82
57
|
default:
|
|
83
58
|
return null;
|
|
84
59
|
}
|
|
85
60
|
}
|
|
86
|
-
|
|
87
61
|
render() {
|
|
88
62
|
const _this$props = this.props,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
63
|
+
label = _this$props.label,
|
|
64
|
+
direction = _this$props.direction,
|
|
65
|
+
buttonRef = _this$props.buttonRef,
|
|
66
|
+
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
93
67
|
return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, {
|
|
94
68
|
elementRef: this.handleRef,
|
|
95
69
|
on: ['hover', 'focus'],
|
|
@@ -104,7 +78,6 @@ let PaginationArrowButton = (_dec = (0, _testable.testable)(), _dec(_class = (_c
|
|
|
104
78
|
margin: this.margin
|
|
105
79
|
}), this.Icon));
|
|
106
80
|
}
|
|
107
|
-
|
|
108
81
|
}, _class2.displayName = "PaginationArrowButton", _class2.componentId = 'Pagination.Navigation', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {}, _class2)) || _class);
|
|
109
82
|
exports.PaginationArrowButton = PaginationArrowButton;
|
|
110
83
|
var _default = PaginationArrowButton;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
direction: _propTypes.default.oneOf(['first', 'prev', 'next', 'last']),
|
|
37
35
|
label: _propTypes.default.string.isRequired,
|
|
@@ -39,7 +37,9 @@ const propTypes = {
|
|
|
39
37
|
onClick: _propTypes.default.func
|
|
40
38
|
};
|
|
41
39
|
exports.propTypes = propTypes;
|
|
42
|
-
const allowedProps = ['direction', 'label', 'buttonRef'
|
|
40
|
+
const allowedProps = ['direction', 'label', 'buttonRef'
|
|
41
|
+
|
|
42
|
+
// we don't want to pass onClick
|
|
43
43
|
// 'onClick'
|
|
44
44
|
];
|
|
45
45
|
exports.allowedProps = allowedProps;
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.PaginationButton = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _BaseButton = require("@instructure/ui-buttons/lib/BaseButton");
|
|
13
|
-
|
|
14
10
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
15
|
-
|
|
16
11
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
17
|
-
|
|
18
12
|
var _props = require("./props");
|
|
19
|
-
|
|
20
13
|
var _dec, _class, _class2;
|
|
21
|
-
|
|
22
14
|
/**
|
|
23
15
|
---
|
|
24
16
|
parent: Pagination
|
|
@@ -29,12 +21,10 @@ let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class = (_class2
|
|
|
29
21
|
constructor() {
|
|
30
22
|
super(...arguments);
|
|
31
23
|
this.ref = null;
|
|
32
|
-
|
|
33
24
|
this.handleRef = el => {
|
|
34
25
|
this.ref = el;
|
|
35
26
|
};
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
render() {
|
|
39
29
|
const exclude = this.props.current ? ['onClick', 'href'] : [];
|
|
40
30
|
const props = (0, _omitProps.omitProps)(this.props, PaginationButton.allowedProps, exclude);
|
|
@@ -47,7 +37,6 @@ let PaginationButton = (_dec = (0, _testable.testable)(), _dec(_class = (_class2
|
|
|
47
37
|
elementRef: this.handleRef
|
|
48
38
|
}), this.props.children);
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
}, _class2.displayName = "PaginationButton", _class2.componentId = 'Pagination.Page', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
|
|
52
41
|
current: false
|
|
53
42
|
}, _class2)) || _class);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,13 +29,16 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const propTypes = {
|
|
36
34
|
children: _propTypes.default.node.isRequired,
|
|
37
35
|
current: _propTypes.default.bool,
|
|
38
36
|
onClick: _propTypes.default.func
|
|
39
37
|
};
|
|
40
38
|
exports.propTypes = propTypes;
|
|
41
|
-
const allowedProps = ['children', 'current'
|
|
39
|
+
const allowedProps = ['children', 'current'
|
|
40
|
+
|
|
41
|
+
// we don't want to pass onClick
|
|
42
42
|
// 'onClick'
|
|
43
43
|
];
|
|
44
44
|
exports.allowedProps = allowedProps;
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PaginationLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _PaginationPageInputLocator = require("./PaginationPageInput/PaginationPageInputLocator");
|
|
11
|
-
|
|
12
9
|
var _PaginationArrowButtonLocator = require("./PaginationArrowButton/PaginationArrowButtonLocator");
|
|
13
|
-
|
|
14
10
|
var _index = require("./index");
|
|
15
|
-
|
|
16
11
|
/*
|
|
17
12
|
* The MIT License (MIT)
|
|
18
13
|
*
|
|
@@ -36,9 +31,11 @@ var _index = require("./index");
|
|
|
36
31
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
32
|
* SOFTWARE.
|
|
38
33
|
*/
|
|
34
|
+
|
|
39
35
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
40
|
-
const PaginationButtonLocator = (0, _locator.locator)(_index.Pagination.Page.selector);
|
|
36
|
+
const PaginationButtonLocator = (0, _locator.locator)(_index.Pagination.Page.selector);
|
|
41
37
|
|
|
38
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
42
39
|
const PaginationLocator = (0, _locator.locator)(_index.Pagination.selector, {
|
|
43
40
|
findAllPageButtons: async function () {
|
|
44
41
|
return PaginationButtonLocator.findAll(...arguments);
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PaginationPageInputLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _NumberInputLocator = require("@instructure/ui-number-input/lib/NumberInput/NumberInputLocator");
|
|
11
|
-
|
|
12
9
|
var _index = require("./index");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,9 +30,12 @@ var _index = require("./index");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
33
|
+
|
|
37
34
|
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module '@ins... Remove this comment to see the full error message
|
|
38
35
|
// eslint-disable-line no-restricted-imports
|
|
39
|
-
|
|
36
|
+
|
|
37
|
+
const PaginationPageInputLocator = (0, _locator.locator)(
|
|
38
|
+
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
40
39
|
_index.PaginationPageInput.selector, {
|
|
41
40
|
findInput: function () {
|
|
42
41
|
return _NumberInputLocator.NumberInputLocator.findInput(...arguments);
|