@zendeskgarden/react-pagination 8.57.1 → 8.58.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/dist/index.cjs.js +191 -371
- package/dist/index.esm.js +191 -371
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -42,338 +42,157 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
42
42
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
43
43
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
44
44
|
|
|
45
|
-
function ownKeys(object, enumerableOnly) {
|
|
46
|
-
var keys = Object.keys(object);
|
|
47
|
-
|
|
48
|
-
if (Object.getOwnPropertySymbols) {
|
|
49
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
50
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
51
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
52
|
-
})), keys.push.apply(keys, symbols);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return keys;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _objectSpread2(target) {
|
|
59
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
60
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
61
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
62
|
-
_defineProperty(target, key, source[key]);
|
|
63
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
64
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return target;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function _defineProperty(obj, key, value) {
|
|
72
|
-
if (key in obj) {
|
|
73
|
-
Object.defineProperty(obj, key, {
|
|
74
|
-
value: value,
|
|
75
|
-
enumerable: true,
|
|
76
|
-
configurable: true,
|
|
77
|
-
writable: true
|
|
78
|
-
});
|
|
79
|
-
} else {
|
|
80
|
-
obj[key] = value;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return obj;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
45
|
function _extends$4() {
|
|
87
46
|
_extends$4 = Object.assign ? Object.assign.bind() : function (target) {
|
|
88
47
|
for (var i = 1; i < arguments.length; i++) {
|
|
89
48
|
var source = arguments[i];
|
|
90
|
-
|
|
91
49
|
for (var key in source) {
|
|
92
50
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
93
51
|
target[key] = source[key];
|
|
94
52
|
}
|
|
95
53
|
}
|
|
96
54
|
}
|
|
97
|
-
|
|
98
55
|
return target;
|
|
99
56
|
};
|
|
100
57
|
return _extends$4.apply(this, arguments);
|
|
101
58
|
}
|
|
102
59
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var target = {};
|
|
106
|
-
var sourceKeys = Object.keys(source);
|
|
107
|
-
var key, i;
|
|
108
|
-
|
|
109
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
110
|
-
key = sourceKeys[i];
|
|
111
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
112
|
-
target[key] = source[key];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return target;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function _objectWithoutProperties(source, excluded) {
|
|
119
|
-
if (source == null) return {};
|
|
120
|
-
|
|
121
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
122
|
-
|
|
123
|
-
var key, i;
|
|
124
|
-
|
|
125
|
-
if (Object.getOwnPropertySymbols) {
|
|
126
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
127
|
-
|
|
128
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
129
|
-
key = sourceSymbolKeys[i];
|
|
130
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
131
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
132
|
-
target[key] = source[key];
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return target;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function _slicedToArray(arr, i) {
|
|
140
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function _arrayWithHoles(arr) {
|
|
144
|
-
if (Array.isArray(arr)) return arr;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function _iterableToArrayLimit(arr, i) {
|
|
148
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
149
|
-
|
|
150
|
-
if (_i == null) return;
|
|
151
|
-
var _arr = [];
|
|
152
|
-
var _n = true;
|
|
153
|
-
var _d = false;
|
|
154
|
-
|
|
155
|
-
var _s, _e;
|
|
156
|
-
|
|
157
|
-
try {
|
|
158
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
159
|
-
_arr.push(_s.value);
|
|
160
|
-
|
|
161
|
-
if (i && _arr.length === i) break;
|
|
162
|
-
}
|
|
163
|
-
} catch (err) {
|
|
164
|
-
_d = true;
|
|
165
|
-
_e = err;
|
|
166
|
-
} finally {
|
|
167
|
-
try {
|
|
168
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
169
|
-
} finally {
|
|
170
|
-
if (_d) throw _e;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return _arr;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
178
|
-
if (!o) return;
|
|
179
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
180
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
181
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
182
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
183
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function _arrayLikeToArray(arr, len) {
|
|
187
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
188
|
-
|
|
189
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
190
|
-
|
|
191
|
-
return arr2;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function _nonIterableRest() {
|
|
195
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
var COMPONENT_ID$6 = 'pagination.pagination_view';
|
|
199
|
-
var StyledPagination = styled__default["default"].ul.attrs({
|
|
60
|
+
const COMPONENT_ID$6 = 'pagination.pagination_view';
|
|
61
|
+
const StyledPagination = styled__default["default"].ul.attrs({
|
|
200
62
|
'data-garden-id': COMPONENT_ID$6,
|
|
201
|
-
'data-garden-version': '8.
|
|
63
|
+
'data-garden-version': '8.58.0'
|
|
202
64
|
}).withConfig({
|
|
203
65
|
displayName: "StyledPagination",
|
|
204
66
|
componentId: "sc-1b7nye9-0"
|
|
205
|
-
})(["direction:", ";display:flex;justify-content:center;margin:0;padding:0;white-space:nowrap;color:", ";:focus{outline:none;}", ";"],
|
|
206
|
-
return props.theme.rtl && 'rtl';
|
|
207
|
-
}, function (props) {
|
|
208
|
-
return reactTheming.getColor('neutralHue', 600, props.theme);
|
|
209
|
-
}, function (props) {
|
|
210
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props);
|
|
211
|
-
});
|
|
67
|
+
})(["direction:", ";display:flex;justify-content:center;margin:0;padding:0;white-space:nowrap;color:", ";:focus{outline:none;}", ";"], props => props.theme.rtl && 'rtl', props => reactTheming.getColor('neutralHue', 600, props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
212
68
|
StyledPagination.defaultProps = {
|
|
213
69
|
theme: reactTheming.DEFAULT_THEME
|
|
214
70
|
};
|
|
215
71
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
72
|
+
const COMPONENT_ID$5 = 'pagination.page';
|
|
73
|
+
const colorStyles = props => {
|
|
74
|
+
const defaultColor = reactTheming.getColor('neutralHue', 600, props.theme);
|
|
75
|
+
const hoverForegroundColor = reactTheming.getColor('neutralHue', 700, props.theme);
|
|
76
|
+
const hoverBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.08);
|
|
77
|
+
const boxShadowColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.35);
|
|
78
|
+
const activeForegroundColor = reactTheming.getColor('neutralHue', 800, props.theme);
|
|
79
|
+
const activeBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.2);
|
|
80
|
+
const currentForegroundColor = activeForegroundColor;
|
|
81
|
+
const currentBackgroundColor = hoverBackgroundColor;
|
|
82
|
+
const currentHoverBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.16);
|
|
83
|
+
const currentActiveBackgroundColor = reactTheming.getColor('primaryHue', 600, props.theme, 0.28);
|
|
228
84
|
return styled.css(["color:", ";&:hover{background-color:", ";color:", ";}&[data-garden-focus-visible]{box-shadow:inset ", ";}&:active,&[data-garden-focus-visible]:active{background-color:", ";color:", ";}&[aria-current='true']{background-color:", ";color:", ";}&[aria-current='true']:hover{background-color:", ";}&[aria-current='true']:active{background-color:", ";}:disabled,[aria-disabled='true']{background-color:transparent;color:", ";}"], defaultColor, hoverBackgroundColor, hoverForegroundColor, props.theme.shadows.md(boxShadowColor), activeBackgroundColor, activeForegroundColor, currentBackgroundColor, currentForegroundColor, currentHoverBackgroundColor, currentActiveBackgroundColor, reactTheming.getColor('grey', 300, props.theme));
|
|
229
85
|
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
86
|
+
const sizeStyles$2 = props => {
|
|
87
|
+
const fontSize = props.theme.fontSizes.md;
|
|
88
|
+
const height = `${props.theme.space.base * 8}px`;
|
|
89
|
+
const lineHeight = reactTheming.getLineHeight(height, fontSize);
|
|
90
|
+
const padding = `${props.theme.space.base * 1.5}px`;
|
|
235
91
|
return styled.css(["padding:0 ", ";height:", ";line-height:", ";font-size:", ";"], padding, height, lineHeight, fontSize);
|
|
236
92
|
};
|
|
237
|
-
|
|
93
|
+
const StyledPageBase = styled__default["default"].li.attrs({
|
|
238
94
|
'data-garden-id': COMPONENT_ID$5,
|
|
239
|
-
'data-garden-version': '8.
|
|
95
|
+
'data-garden-version': '8.58.0'
|
|
240
96
|
}).withConfig({
|
|
241
97
|
displayName: "StyledPageBase",
|
|
242
98
|
componentId: "sc-lw1w9j-0"
|
|
243
|
-
})(["box-sizing:border-box;display:inline-block;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out;visibility:", ";border-radius:", ";cursor:pointer;overflow:hidden;text-align:center;text-overflow:ellipsis;user-select:none;", ";&:focus{outline:none;}&[aria-current='true']{font-weight:", ";}:disabled,[aria-disabled='true']{cursor:default;}", ";", ";"],
|
|
244
|
-
return props.hidden && 'hidden';
|
|
245
|
-
}, function (props) {
|
|
246
|
-
return props.theme.borderRadii.md;
|
|
247
|
-
}, function (props) {
|
|
248
|
-
return sizeStyles$2(props);
|
|
249
|
-
}, function (props) {
|
|
250
|
-
return props.theme.fontWeights.semibold;
|
|
251
|
-
}, function (props) {
|
|
252
|
-
return colorStyles(props);
|
|
253
|
-
}, function (props) {
|
|
254
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props);
|
|
255
|
-
});
|
|
99
|
+
})(["box-sizing:border-box;display:inline-block;transition:box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out;visibility:", ";border-radius:", ";cursor:pointer;overflow:hidden;text-align:center;text-overflow:ellipsis;user-select:none;", ";&:focus{outline:none;}&[aria-current='true']{font-weight:", ";}:disabled,[aria-disabled='true']{cursor:default;}", ";", ";"], props => props.hidden && 'hidden', props => props.theme.borderRadii.md, props => sizeStyles$2(props), props => props.theme.fontWeights.semibold, props => colorStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
256
100
|
StyledPageBase.defaultProps = {
|
|
257
101
|
theme: reactTheming.DEFAULT_THEME
|
|
258
102
|
};
|
|
259
103
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return styled.css(["min-width:", ";max-width:", ";&[aria-current='true']{max-width:none;}"], height, polished.math(
|
|
104
|
+
const COMPONENT_ID$4 = 'pagination.page';
|
|
105
|
+
const sizeStyles$1 = props => {
|
|
106
|
+
const height = `${props.theme.space.base * 8}px`;
|
|
107
|
+
return styled.css(["min-width:", ";max-width:", ";&[aria-current='true']{max-width:none;}"], height, polished.math(`${height} * 2`));
|
|
264
108
|
};
|
|
265
|
-
|
|
109
|
+
const StyledPage = styled__default["default"](StyledPageBase).attrs({
|
|
266
110
|
'data-garden-id': COMPONENT_ID$4,
|
|
267
|
-
'data-garden-version': '8.
|
|
111
|
+
'data-garden-version': '8.58.0'
|
|
268
112
|
}).withConfig({
|
|
269
113
|
displayName: "StyledPage",
|
|
270
114
|
componentId: "sc-1k0een3-0"
|
|
271
|
-
})(["margin-left:", ";", ";&[aria-current=\"true\"]{font-weight:", ";}&", "{margin-left:0;}", ";"],
|
|
272
|
-
return "".concat(props.theme.space.base, "px");
|
|
273
|
-
}, function (props) {
|
|
274
|
-
return sizeStyles$1(props);
|
|
275
|
-
}, function (props) {
|
|
276
|
-
return props.theme.fontWeights.semibold;
|
|
277
|
-
}, function (props) {
|
|
278
|
-
return props.theme.rtl ? ':last-of-type' : ':first-of-type';
|
|
279
|
-
}, function (props) {
|
|
280
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props);
|
|
281
|
-
});
|
|
115
|
+
})(["margin-left:", ";", ";&[aria-current=\"true\"]{font-weight:", ";}&", "{margin-left:0;}", ";"], props => `${props.theme.space.base}px`, props => sizeStyles$1(props), props => props.theme.fontWeights.semibold, props => props.theme.rtl ? ':last-of-type' : ':first-of-type', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
282
116
|
StyledPage.defaultProps = {
|
|
283
117
|
theme: reactTheming.DEFAULT_THEME
|
|
284
118
|
};
|
|
285
119
|
|
|
286
|
-
|
|
287
|
-
|
|
120
|
+
const COMPONENT_ID$3 = 'cursor_pagination';
|
|
121
|
+
const StyledCursorPagination = styled__default["default"].nav.attrs({
|
|
288
122
|
'data-garden-id': COMPONENT_ID$3,
|
|
289
|
-
'data-garden-version': '8.
|
|
123
|
+
'data-garden-version': '8.58.0'
|
|
290
124
|
}).withConfig({
|
|
291
125
|
displayName: "StyledCursorPagination",
|
|
292
126
|
componentId: "sc-qmfecg-0"
|
|
293
|
-
})(["display:flex;justify-content:center;", ";"],
|
|
294
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props);
|
|
295
|
-
});
|
|
127
|
+
})(["display:flex;justify-content:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
|
|
296
128
|
StyledCursorPagination.defaultProps = {
|
|
297
129
|
theme: reactTheming.DEFAULT_THEME
|
|
298
130
|
};
|
|
299
131
|
|
|
300
|
-
|
|
301
|
-
|
|
132
|
+
const COMPONENT_ID$2 = 'cursor_pagination.cursor';
|
|
133
|
+
const StyledCursor = styled__default["default"](StyledPageBase).attrs({
|
|
302
134
|
'data-garden-id': COMPONENT_ID$2,
|
|
303
|
-
'data-garden-version': '8.
|
|
135
|
+
'data-garden-version': '8.58.0',
|
|
304
136
|
as: 'button'
|
|
305
137
|
}).withConfig({
|
|
306
138
|
displayName: "StyledCursor",
|
|
307
139
|
componentId: "sc-507ee-0"
|
|
308
|
-
})(["display:flex;align-items:center;border:none;background:transparent;padding:", ";overflow:visible;&:not(", "-of-type){margin-right:", "px;}", ";"],
|
|
309
|
-
return "0px ".concat(props.theme.space.base * 2, "px");
|
|
310
|
-
}, function (props) {
|
|
311
|
-
return props.theme.rtl ? ':first' : ':last';
|
|
312
|
-
}, function (props) {
|
|
313
|
-
return props.theme.space.base;
|
|
314
|
-
}, function (props) {
|
|
315
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props);
|
|
316
|
-
});
|
|
140
|
+
})(["display:flex;align-items:center;border:none;background:transparent;padding:", ";overflow:visible;&:not(", "-of-type){margin-right:", "px;}", ";"], props => `0px ${props.theme.space.base * 2}px`, props => props.theme.rtl ? ':first' : ':last', props => props.theme.space.base, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
317
141
|
StyledCursor.defaultProps = {
|
|
318
142
|
theme: reactTheming.DEFAULT_THEME
|
|
319
143
|
};
|
|
320
144
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
145
|
+
const marginStyles = props => {
|
|
146
|
+
const {
|
|
147
|
+
type,
|
|
148
|
+
theme
|
|
149
|
+
} = props;
|
|
150
|
+
const margin = theme.space.base;
|
|
326
151
|
if (theme.rtl) {
|
|
327
152
|
return styled.css(["margin-", ":", "px;"], type === 'last' || type === 'next' ? 'right' : 'left', margin);
|
|
328
153
|
}
|
|
329
154
|
return styled.css(["margin-", ":", "px;"], type === 'first' || type === 'previous' ? 'right' : 'left', margin);
|
|
330
155
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
156
|
+
const StyledIcon = styled__default["default"](_ref => {
|
|
157
|
+
let {
|
|
158
|
+
children,
|
|
159
|
+
...props
|
|
160
|
+
} = _ref;
|
|
334
161
|
return React.cloneElement(React.Children.only(children), props);
|
|
335
162
|
}).withConfig({
|
|
336
163
|
displayName: "StyledIcon",
|
|
337
164
|
componentId: "sc-2vzk6e-0"
|
|
338
|
-
})(["", " transform:", ";"], marginStyles,
|
|
339
|
-
return props.theme.rtl && 'rotate(180deg)';
|
|
340
|
-
});
|
|
165
|
+
})(["", " transform:", ";"], marginStyles, props => props.theme.rtl && 'rotate(180deg)');
|
|
341
166
|
StyledIcon.defaultProps = {
|
|
342
167
|
theme: reactTheming.DEFAULT_THEME
|
|
343
168
|
};
|
|
344
169
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
170
|
+
const COMPONENT_ID$1 = 'pagination.gap';
|
|
171
|
+
const sizeStyles = props => {
|
|
172
|
+
const shift = 2;
|
|
173
|
+
const marginTop = `-${shift}px`;
|
|
174
|
+
const fontSize = polished.math(`${props.theme.fontSizes.md} + ${shift}`);
|
|
350
175
|
return styled.css(["margin-top:", ";font-size:", ";"], marginTop, fontSize);
|
|
351
176
|
};
|
|
352
|
-
|
|
177
|
+
const StyledGap = styled__default["default"](StyledPage).attrs({
|
|
353
178
|
'data-garden-id': COMPONENT_ID$1,
|
|
354
|
-
'data-garden-version': '8.
|
|
179
|
+
'data-garden-version': '8.58.0'
|
|
355
180
|
}).withConfig({
|
|
356
181
|
displayName: "StyledGap",
|
|
357
182
|
componentId: "sc-1hqjltf-0"
|
|
358
|
-
})(["cursor:default;", ";&:hover{background-color:transparent;color:inherit;}", ";"],
|
|
359
|
-
return sizeStyles(props);
|
|
360
|
-
}, function (props) {
|
|
361
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
362
|
-
});
|
|
183
|
+
})(["cursor:default;", ";&:hover{background-color:transparent;color:inherit;}", ";"], props => sizeStyles(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
363
184
|
StyledGap.defaultProps = {
|
|
364
185
|
theme: reactTheming.DEFAULT_THEME
|
|
365
186
|
};
|
|
366
187
|
|
|
367
|
-
|
|
368
|
-
|
|
188
|
+
const COMPONENT_ID = 'pagination.navigation';
|
|
189
|
+
const StyledNavigation = styled__default["default"](StyledPage).attrs({
|
|
369
190
|
'data-garden-id': COMPONENT_ID,
|
|
370
|
-
'data-garden-version': '8.
|
|
191
|
+
'data-garden-version': '8.58.0'
|
|
371
192
|
}).withConfig({
|
|
372
193
|
displayName: "StyledNavigation",
|
|
373
194
|
componentId: "sc-184uuwe-0"
|
|
374
|
-
})(["display:flex;align-items:center;justify-content:center;", ";"],
|
|
375
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
|
|
376
|
-
});
|
|
195
|
+
})(["display:flex;align-items:center;justify-content:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
377
196
|
StyledNavigation.defaultProps = {
|
|
378
197
|
theme: reactTheming.DEFAULT_THEME
|
|
379
198
|
};
|
|
@@ -389,7 +208,8 @@ var SvgChevronLeftStroke = function SvgChevronLeftStroke(props) {
|
|
|
389
208
|
height: 16,
|
|
390
209
|
focusable: "false",
|
|
391
210
|
viewBox: "0 0 16 16",
|
|
392
|
-
"aria-hidden": "true"
|
|
211
|
+
"aria-hidden": "true",
|
|
212
|
+
role: "img"
|
|
393
213
|
}, props), _path$3 || (_path$3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
394
214
|
fill: "currentColor",
|
|
395
215
|
d: "M10.39 12.688a.5.5 0 01-.718.69l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L6.641 8l3.75 4.688z"
|
|
@@ -407,85 +227,84 @@ var SvgChevronRightStroke = function SvgChevronRightStroke(props) {
|
|
|
407
227
|
height: 16,
|
|
408
228
|
focusable: "false",
|
|
409
229
|
viewBox: "0 0 16 16",
|
|
410
|
-
"aria-hidden": "true"
|
|
230
|
+
"aria-hidden": "true",
|
|
231
|
+
role: "img"
|
|
411
232
|
}, props), _path$2 || (_path$2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
412
233
|
fill: "currentColor",
|
|
413
234
|
d: "M5.61 3.312a.5.5 0 01.718-.69l.062.066 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L9.359 8l-3.75-4.688z"
|
|
414
235
|
})));
|
|
415
236
|
};
|
|
416
237
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
238
|
+
const PreviousComponent$1 = React.forwardRef((props, ref) => {
|
|
239
|
+
const ariaLabel = reactTheming.useText(PreviousComponent$1, props, 'aria-label', 'Previous page');
|
|
240
|
+
const theme = React.useContext(styled.ThemeContext);
|
|
420
241
|
return React__default["default"].createElement(StyledNavigation, _extends$4({}, props, {
|
|
421
242
|
"aria-label": ariaLabel,
|
|
422
243
|
ref: ref
|
|
423
244
|
}), theme.rtl ? React__default["default"].createElement(SvgChevronRightStroke, null) : React__default["default"].createElement(SvgChevronLeftStroke, null));
|
|
424
245
|
});
|
|
425
246
|
PreviousComponent$1.displayName = 'Pagination.Previous';
|
|
426
|
-
|
|
247
|
+
const Previous$1 = PreviousComponent$1;
|
|
427
248
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
249
|
+
const NextComponent$1 = React.forwardRef((props, ref) => {
|
|
250
|
+
const ariaLabel = reactTheming.useText(NextComponent$1, props, 'aria-label', 'Next page');
|
|
251
|
+
const theme = React.useContext(styled.ThemeContext);
|
|
431
252
|
return React__default["default"].createElement(StyledNavigation, _extends$4({}, props, {
|
|
432
253
|
"aria-label": ariaLabel,
|
|
433
254
|
ref: ref
|
|
434
255
|
}), theme.rtl ? React__default["default"].createElement(SvgChevronLeftStroke, null) : React__default["default"].createElement(SvgChevronRightStroke, null));
|
|
435
256
|
});
|
|
436
257
|
NextComponent$1.displayName = 'Pagination.Next';
|
|
437
|
-
|
|
258
|
+
const Next$1 = NextComponent$1;
|
|
438
259
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
260
|
+
const PageComponent = React.forwardRef((props, ref) => {
|
|
261
|
+
const text = props['aria-current'] ? `Current page, page ${props.children}` : `Page ${props.children}`;
|
|
262
|
+
const ariaLabel = reactTheming.useText(PageComponent, props, 'aria-label', text);
|
|
442
263
|
return React__default["default"].createElement(StyledPage, _extends$4({}, props, {
|
|
443
264
|
"aria-label": ariaLabel,
|
|
444
265
|
ref: ref
|
|
445
266
|
}));
|
|
446
267
|
});
|
|
447
268
|
PageComponent.displayName = 'Pagination.Page';
|
|
448
|
-
|
|
269
|
+
const Page = PageComponent;
|
|
449
270
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}), "\u2026");
|
|
454
|
-
});
|
|
271
|
+
const GapComponent = React.forwardRef((props, ref) => React__default["default"].createElement(StyledGap, _extends$4({}, props, {
|
|
272
|
+
ref: ref
|
|
273
|
+
}), "\u2026"));
|
|
455
274
|
GapComponent.displayName = 'Pagination.Gap';
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
275
|
+
const Gap = GapComponent;
|
|
276
|
+
|
|
277
|
+
const PREVIOUS_KEY = 'previous';
|
|
278
|
+
const NEXT_KEY = 'next';
|
|
279
|
+
const Pagination = React.forwardRef((_ref, ref) => {
|
|
280
|
+
let {
|
|
281
|
+
currentPage: controlledCurrentPage,
|
|
282
|
+
transformPageProps,
|
|
283
|
+
totalPages,
|
|
284
|
+
pagePadding,
|
|
285
|
+
pageGap,
|
|
286
|
+
onChange,
|
|
287
|
+
...otherProps
|
|
288
|
+
} = _ref;
|
|
289
|
+
const [focusedItem, setFocusedItem] = React.useState();
|
|
290
|
+
const [internalCurrentPage, setInternalCurrentPage] = React.useState(1);
|
|
291
|
+
const currentPage = containerUtilities.getControlledValue(controlledCurrentPage, internalCurrentPage);
|
|
292
|
+
const theme = React.useContext(styled.ThemeContext);
|
|
293
|
+
const {
|
|
294
|
+
getContainerProps,
|
|
295
|
+
getPageProps,
|
|
296
|
+
getPreviousPageProps,
|
|
297
|
+
getNextPageProps
|
|
298
|
+
} = containerPagination.usePagination({
|
|
480
299
|
rtl: theme.rtl,
|
|
481
|
-
focusedItem
|
|
300
|
+
focusedItem,
|
|
482
301
|
selectedItem: currentPage,
|
|
483
|
-
onFocus:
|
|
302
|
+
onFocus: item => {
|
|
484
303
|
setFocusedItem(item);
|
|
485
304
|
},
|
|
486
|
-
onSelect:
|
|
487
|
-
|
|
488
|
-
|
|
305
|
+
onSelect: item => {
|
|
306
|
+
let updatedCurrentPage = item;
|
|
307
|
+
let updatedFocusedKey = focusedItem;
|
|
489
308
|
if (updatedCurrentPage === PREVIOUS_KEY && currentPage > 1) {
|
|
490
309
|
updatedCurrentPage = currentPage - 1;
|
|
491
310
|
if (updatedCurrentPage === 1 && focusedItem === PREVIOUS_KEY) {
|
|
@@ -503,92 +322,89 @@ var Pagination = React.forwardRef(function (_ref, ref) {
|
|
|
503
322
|
setFocusedItem(updatedFocusedKey);
|
|
504
323
|
setInternalCurrentPage(updatedCurrentPage);
|
|
505
324
|
}
|
|
506
|
-
})
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
getNextPageProps = _usePagination.getNextPageProps;
|
|
511
|
-
var getTransformedProps = function getTransformedProps(pageType) {
|
|
512
|
-
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
513
|
-
var pageNumber = arguments.length > 2 ? arguments[2] : undefined;
|
|
325
|
+
});
|
|
326
|
+
const getTransformedProps = function (pageType) {
|
|
327
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
328
|
+
let pageNumber = arguments.length > 2 ? arguments[2] : undefined;
|
|
514
329
|
if (transformPageProps) {
|
|
515
330
|
return transformPageProps(pageType, props, pageNumber);
|
|
516
331
|
}
|
|
517
332
|
return props;
|
|
518
333
|
};
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
334
|
+
const renderPreviousPage = () => {
|
|
335
|
+
const isFirstPageSelected = totalPages > 0 && currentPage === 1;
|
|
336
|
+
const focusRef = React__default["default"].createRef();
|
|
337
|
+
const props = isFirstPageSelected ?
|
|
523
338
|
{
|
|
524
339
|
hidden: true
|
|
525
|
-
} :
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
340
|
+
} : {
|
|
341
|
+
...getPreviousPageProps({
|
|
342
|
+
'aria-label': '',
|
|
343
|
+
role: null,
|
|
344
|
+
item: PREVIOUS_KEY,
|
|
345
|
+
focusRef
|
|
346
|
+
}),
|
|
531
347
|
'aria-label': undefined
|
|
532
|
-
}
|
|
348
|
+
};
|
|
533
349
|
return React__default["default"].createElement(Previous$1, _extends$4({
|
|
534
350
|
isFocused: focusedItem === PREVIOUS_KEY
|
|
535
351
|
}, getTransformedProps('previous', props), {
|
|
536
352
|
ref: focusRef
|
|
537
353
|
}));
|
|
538
354
|
};
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
355
|
+
const renderNextPage = () => {
|
|
356
|
+
const isLastPageSelected = currentPage === totalPages;
|
|
357
|
+
const focusRef = React__default["default"].createRef();
|
|
358
|
+
const props = isLastPageSelected ?
|
|
543
359
|
{
|
|
544
360
|
hidden: true
|
|
545
|
-
} :
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
361
|
+
} : {
|
|
362
|
+
...getNextPageProps({
|
|
363
|
+
'aria-label': '',
|
|
364
|
+
role: null,
|
|
365
|
+
item: NEXT_KEY,
|
|
366
|
+
focusRef
|
|
367
|
+
}),
|
|
551
368
|
'aria-label': undefined
|
|
552
|
-
}
|
|
369
|
+
};
|
|
553
370
|
return React__default["default"].createElement(Next$1, _extends$4({
|
|
554
371
|
isFocused: focusedItem === NEXT_KEY
|
|
555
372
|
}, getTransformedProps('next', props), {
|
|
556
373
|
ref: focusRef
|
|
557
374
|
}));
|
|
558
375
|
};
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
})), {}, {
|
|
376
|
+
const createGap = pageIndex => React__default["default"].createElement(Gap, _extends$4({
|
|
377
|
+
key: `gap-${pageIndex}`
|
|
378
|
+
}, getTransformedProps('gap')));
|
|
379
|
+
const createPage = pageIndex => {
|
|
380
|
+
const focusRef = React__default["default"].createRef();
|
|
381
|
+
const props = {
|
|
382
|
+
...getPageProps({
|
|
383
|
+
'aria-label': '',
|
|
384
|
+
role: null,
|
|
385
|
+
item: pageIndex,
|
|
386
|
+
focusRef
|
|
387
|
+
}),
|
|
572
388
|
'aria-label': undefined,
|
|
573
389
|
title: pageIndex
|
|
574
|
-
}
|
|
390
|
+
};
|
|
575
391
|
return React__default["default"].createElement(Page, _extends$4({
|
|
576
392
|
key: pageIndex
|
|
577
393
|
}, getTransformedProps('page', props, pageIndex), {
|
|
578
394
|
ref: focusRef
|
|
579
395
|
}), pageIndex);
|
|
580
396
|
};
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
for (
|
|
397
|
+
const renderPages = () => {
|
|
398
|
+
const pages = [];
|
|
399
|
+
const PADDING = pagePadding;
|
|
400
|
+
const GAP = pageGap;
|
|
401
|
+
for (let pageIndex = 1; pageIndex <= totalPages; pageIndex++) {
|
|
586
402
|
if (pageIndex === currentPage || pageIndex < GAP || pageIndex > totalPages - GAP + 1) {
|
|
587
403
|
pages.push(createPage(pageIndex));
|
|
588
404
|
continue;
|
|
589
405
|
}
|
|
590
|
-
|
|
591
|
-
|
|
406
|
+
let minimum;
|
|
407
|
+
let maximum;
|
|
592
408
|
if (currentPage <= GAP + PADDING) {
|
|
593
409
|
minimum = GAP + 1;
|
|
594
410
|
maximum = minimum + PADDING * 2;
|
|
@@ -653,17 +469,19 @@ var SvgChevronDoubleLeftStroke = function SvgChevronDoubleLeftStroke(props) {
|
|
|
653
469
|
height: 16,
|
|
654
470
|
focusable: "false",
|
|
655
471
|
viewBox: "0 0 16 16",
|
|
656
|
-
"aria-hidden": "true"
|
|
472
|
+
"aria-hidden": "true",
|
|
473
|
+
role: "img"
|
|
657
474
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
658
475
|
fill: "currentColor",
|
|
659
476
|
d: "M7.812 13.39a.5.5 0 01-.64-.012l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L4.141 8l3.75 4.688a.5.5 0 01-.079.702zm5 0a.5.5 0 01-.64-.012l-.062-.066-4-5a.5.5 0 01-.054-.542l.054-.082 4-5a.5.5 0 01.83.55l-.05.074L9.141 8l3.75 4.688a.5.5 0 01-.079.702z"
|
|
660
477
|
})));
|
|
661
478
|
};
|
|
662
479
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
480
|
+
const FirstComponent = React.forwardRef((_ref, ref) => {
|
|
481
|
+
let {
|
|
482
|
+
children,
|
|
483
|
+
...other
|
|
484
|
+
} = _ref;
|
|
667
485
|
return React__default["default"].createElement(StyledCursor, _extends$4({
|
|
668
486
|
ref: ref
|
|
669
487
|
}, other), React__default["default"].createElement(StyledIcon, {
|
|
@@ -671,12 +489,13 @@ var FirstComponent = React.forwardRef(function (_ref, ref) {
|
|
|
671
489
|
}, React__default["default"].createElement(SvgChevronDoubleLeftStroke, null)), React__default["default"].createElement("span", null, children));
|
|
672
490
|
});
|
|
673
491
|
FirstComponent.displayName = 'CursorPagination.First';
|
|
674
|
-
|
|
492
|
+
const First = FirstComponent;
|
|
675
493
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
494
|
+
const NextComponent = React.forwardRef((_ref, ref) => {
|
|
495
|
+
let {
|
|
496
|
+
children,
|
|
497
|
+
...other
|
|
498
|
+
} = _ref;
|
|
680
499
|
return React__default["default"].createElement(StyledCursor, _extends$4({
|
|
681
500
|
ref: ref,
|
|
682
501
|
as: "button"
|
|
@@ -685,12 +504,13 @@ var NextComponent = React.forwardRef(function (_ref, ref) {
|
|
|
685
504
|
}, React__default["default"].createElement(SvgChevronRightStroke, null)));
|
|
686
505
|
});
|
|
687
506
|
NextComponent.displayName = 'CursorPagination.Next';
|
|
688
|
-
|
|
507
|
+
const Next = NextComponent;
|
|
689
508
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
509
|
+
const PreviousComponent = React.forwardRef((_ref, ref) => {
|
|
510
|
+
let {
|
|
511
|
+
children,
|
|
512
|
+
...other
|
|
513
|
+
} = _ref;
|
|
694
514
|
return React__default["default"].createElement(StyledCursor, _extends$4({
|
|
695
515
|
ref: ref,
|
|
696
516
|
as: "button"
|
|
@@ -699,7 +519,7 @@ var PreviousComponent = React.forwardRef(function (_ref, ref) {
|
|
|
699
519
|
}, React__default["default"].createElement(SvgChevronLeftStroke, null)), React__default["default"].createElement("span", null, children));
|
|
700
520
|
});
|
|
701
521
|
PreviousComponent.displayName = 'CursorPagination.Previous';
|
|
702
|
-
|
|
522
|
+
const Previous = PreviousComponent;
|
|
703
523
|
|
|
704
524
|
var _path;
|
|
705
525
|
|
|
@@ -712,17 +532,19 @@ var SvgChevronDoubleRightStroke = function SvgChevronDoubleRightStroke(props) {
|
|
|
712
532
|
height: 16,
|
|
713
533
|
focusable: "false",
|
|
714
534
|
viewBox: "0 0 16 16",
|
|
715
|
-
"aria-hidden": "true"
|
|
535
|
+
"aria-hidden": "true",
|
|
536
|
+
role: "img"
|
|
716
537
|
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
717
538
|
fill: "currentColor",
|
|
718
539
|
d: "M8.188 2.61a.5.5 0 01.64.013l.062.065 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L11.859 8l-3.75-4.688a.5.5 0 01.079-.702zm-5 0a.5.5 0 01.64.013l.062.065 4 5a.5.5 0 01.054.542l-.054.082-4 5a.5.5 0 01-.83-.55l.05-.074L6.859 8l-3.75-4.688a.5.5 0 01.079-.702z"
|
|
719
540
|
})));
|
|
720
541
|
};
|
|
721
542
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
543
|
+
const LastComponent = React.forwardRef((_ref, ref) => {
|
|
544
|
+
let {
|
|
545
|
+
children,
|
|
546
|
+
...other
|
|
547
|
+
} = _ref;
|
|
726
548
|
return React__default["default"].createElement(StyledCursor, _extends$4({
|
|
727
549
|
ref: ref,
|
|
728
550
|
as: "button"
|
|
@@ -731,15 +553,13 @@ var LastComponent = React.forwardRef(function (_ref, ref) {
|
|
|
731
553
|
}, React__default["default"].createElement(SvgChevronDoubleRightStroke, null)));
|
|
732
554
|
});
|
|
733
555
|
LastComponent.displayName = 'CursorPagination.Last';
|
|
734
|
-
|
|
556
|
+
const Last = LastComponent;
|
|
735
557
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
}, props));
|
|
740
|
-
});
|
|
558
|
+
const CursorPaginationComponent = React.forwardRef((props, ref) => React__default["default"].createElement(StyledCursorPagination, _extends$4({
|
|
559
|
+
ref: ref
|
|
560
|
+
}, props)));
|
|
741
561
|
CursorPaginationComponent.displayName = 'CursorPagination';
|
|
742
|
-
|
|
562
|
+
const CursorPagination = CursorPaginationComponent;
|
|
743
563
|
CursorPagination.First = First;
|
|
744
564
|
CursorPagination.Next = Next;
|
|
745
565
|
CursorPagination.Previous = Previous;
|