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