@semcore/pagination 16.1.12 → 17.0.0-prerelease.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/lib/cjs/Pagination.js +310 -347
- package/lib/cjs/Pagination.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +17 -17
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/Pagination.js +302 -339
- package/lib/es6/Pagination.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +16 -16
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/Pagination.mjs +278 -272
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/types/index.d.ts +3 -12
- package/package.json +11 -11
package/lib/esm/Pagination.mjs
CHANGED
|
@@ -1,256 +1,275 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
-
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import { createComponent, sstyled,
|
|
2
|
+
import { createComponent, sstyled, Component, assignProps } from "@semcore/core";
|
|
3
|
+
import { Flex, ScreenReaderOnly, Hint } from "@semcore/base-components";
|
|
9
4
|
import Button, { ButtonLink } from "@semcore/button";
|
|
10
5
|
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
11
6
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
12
|
-
import { Flex, ScreenReaderOnly } from "@semcore/flex-box";
|
|
13
7
|
import ChevronDoubleLeft from "@semcore/icon/ChevronDoubleLeft/m";
|
|
14
8
|
import InputNumber from "@semcore/input-number";
|
|
15
|
-
import { Hint } from "@semcore/tooltip";
|
|
16
9
|
import { Text } from "@semcore/typography";
|
|
17
10
|
import React from "react";
|
|
18
11
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
19
|
-
var _excluded = ["styles", "getI18nText", "totalPages", "isLastOrSingle", "children"];
|
|
20
12
|
/*!__reshadow-styles__:"./style/pagination.shadow.css"*/
|
|
21
|
-
|
|
13
|
+
const style = (
|
|
22
14
|
/*__reshadow_css_start__*/
|
|
23
15
|
(sstyled.insert(
|
|
24
16
|
/*__inner_css_start__*/
|
|
25
|
-
".
|
|
17
|
+
".___SPagination_4tsjh_gg_{justify-content:flex-start;align-items:center}.___SPagination_4tsjh_gg_.__withGap_4tsjh_gg_{gap:var(--intergalactic-spacing-4x, 16px)}.___SPagination_4tsjh_gg_.__withGap_4tsjh_gg_._size_l_4tsjh_gg_{gap:var(--intergalactic-spacing-5x, 20px)}.___SNextPage_4tsjh_gg_,.___SPrevPage_4tsjh_gg_{align-self:center;margin-left:var(--intergalactic-spacing-2x, 8px)}.___SNextPage_4tsjh_gg_._size_l_4tsjh_gg_,.___SPrevPage_4tsjh_gg_._size_l_4tsjh_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SLabel_4tsjh_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SLabel_4tsjh_gg_:not(:first-child){margin-left:var(--intergalactic-spacing-4x, 16px)}.___SLabel_4tsjh_gg_._size_l_4tsjh_gg_:not(:first-child){margin-left:var(--intergalactic-spacing-5x, 20px)}.___STotalPages_4tsjh_gg_{align-self:center;line-height:normal;color:var(--intergalactic-text-link, #006dca)}.___STotalPagesLabel_4tsjh_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-1x, 4px);color:var(--intergalactic-text-primary, #191b23)}.___STotalLastPages_4tsjh_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);color:var(--intergalactic-text-primary, #191b23)}.___STotalLastPages_4tsjh_gg_._size_l_4tsjh_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SPageInput_4tsjh_gg_{max-width:68px;margin-left:var(--intergalactic-spacing-1x, 4px)}.___SPageInput_4tsjh_gg_._size_l_4tsjh_gg_{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPageInput_4tsjh_gg_:focus-within .___SPageInputAddon_4tsjh_gg_{opacity:1;clip:initial;position:static}.___SPageInputAddon_4tsjh_gg_{opacity:0;clip:rect(1px,1px,1px,1px);position:absolute}.___SLabel_4tsjh_gg_,.___STotalPagesLabel_4tsjh_gg_,.___STotalPages_4tsjh_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SLabel_4tsjh_gg_._size_l_4tsjh_gg_,.___STotalPagesLabel_4tsjh_gg_._size_l_4tsjh_gg_,.___STotalPages_4tsjh_gg_._size_l_4tsjh_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}",
|
|
26
18
|
/*__inner_css_end__*/
|
|
27
|
-
"
|
|
19
|
+
"4tsjh_gg_"
|
|
28
20
|
), /*__reshadow_css_end__*/
|
|
29
21
|
{
|
|
30
|
-
"__SPagination": "
|
|
31
|
-
"__SLabel": "
|
|
32
|
-
"_size_l": "
|
|
33
|
-
"__STotalPages": "
|
|
34
|
-
"__STotalPagesLabel": "
|
|
35
|
-
"__SPageInput": "
|
|
36
|
-
"__SPageInputAddon": "
|
|
37
|
-
"_withGap": "
|
|
38
|
-
"__SNextPage": "
|
|
39
|
-
"__SPrevPage": "
|
|
40
|
-
"__STotalLastPages": "
|
|
22
|
+
"__SPagination": "___SPagination_4tsjh_gg_",
|
|
23
|
+
"__SLabel": "___SLabel_4tsjh_gg_",
|
|
24
|
+
"_size_l": "_size_l_4tsjh_gg_",
|
|
25
|
+
"__STotalPages": "___STotalPages_4tsjh_gg_",
|
|
26
|
+
"__STotalPagesLabel": "___STotalPagesLabel_4tsjh_gg_",
|
|
27
|
+
"__SPageInput": "___SPageInput_4tsjh_gg_",
|
|
28
|
+
"__SPageInputAddon": "___SPageInputAddon_4tsjh_gg_",
|
|
29
|
+
"_withGap": "__withGap_4tsjh_gg_",
|
|
30
|
+
"__SNextPage": "___SNextPage_4tsjh_gg_",
|
|
31
|
+
"__SPrevPage": "___SPrevPage_4tsjh_gg_",
|
|
32
|
+
"__STotalLastPages": "___STotalLastPages_4tsjh_gg_"
|
|
41
33
|
})
|
|
42
34
|
);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
_this = _callSuper(this, PaginationRoot2, [].concat(args));
|
|
51
|
-
_defineProperty(_this, "nextPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
52
|
-
_defineProperty(_this, "prevPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
53
|
-
_defineProperty(_this, "state", {
|
|
35
|
+
class PaginationRoot extends Component {
|
|
36
|
+
constructor(...args) {
|
|
37
|
+
super(...args);
|
|
38
|
+
_defineProperty(this, "nextPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
39
|
+
_defineProperty(this, "prevPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
40
|
+
_defineProperty(this, "state", {
|
|
54
41
|
// Crutch, so as not to take out `dirtyCurrentPage` in props
|
|
55
42
|
dirtyCurrentPage: void 0
|
|
56
43
|
});
|
|
57
|
-
_defineProperty(
|
|
58
|
-
_defineProperty(
|
|
59
|
-
requestAnimationFrame(
|
|
60
|
-
var
|
|
61
|
-
(
|
|
44
|
+
_defineProperty(this, "pageInputAddonRef", /* @__PURE__ */ React.createRef());
|
|
45
|
+
_defineProperty(this, "returnLostFocusTo", (ref) => {
|
|
46
|
+
requestAnimationFrame(() => {
|
|
47
|
+
var _a;
|
|
48
|
+
(_a = ref.current) == null ? void 0 : _a.focus();
|
|
62
49
|
});
|
|
63
50
|
});
|
|
64
|
-
_defineProperty(
|
|
51
|
+
_defineProperty(this, "handlePageChange", (currentPage) => {
|
|
65
52
|
currentPage = Number(currentPage);
|
|
66
53
|
if (Number.isNaN(currentPage)) {
|
|
67
54
|
return;
|
|
68
55
|
}
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
this.handlers.currentPage(currentPage);
|
|
57
|
+
this.setState({
|
|
71
58
|
dirtyCurrentPage: void 0
|
|
72
59
|
});
|
|
73
60
|
});
|
|
74
|
-
_defineProperty(
|
|
75
|
-
|
|
61
|
+
_defineProperty(this, "handlePageValueChange", (value) => {
|
|
62
|
+
const {
|
|
63
|
+
dirtyCurrentPage
|
|
64
|
+
} = this.state;
|
|
76
65
|
if (Number.isNaN(Number(value))) {
|
|
77
66
|
value = dirtyCurrentPage;
|
|
78
67
|
}
|
|
79
|
-
|
|
68
|
+
this.setState({
|
|
80
69
|
dirtyCurrentPage: value
|
|
81
70
|
});
|
|
82
71
|
});
|
|
83
|
-
_defineProperty(
|
|
84
|
-
setTimeout(
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
_defineProperty(this, "handlePageValueBlur", () => {
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
if (this.pageInputAddonRef.current !== document.activeElement) {
|
|
75
|
+
const {
|
|
76
|
+
currentPage
|
|
77
|
+
} = this.asProps;
|
|
78
|
+
this.setState({
|
|
88
79
|
dirtyCurrentPage: currentPage
|
|
89
80
|
});
|
|
90
81
|
}
|
|
91
82
|
}, 0);
|
|
92
83
|
});
|
|
93
|
-
_defineProperty(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
_defineProperty(this, "getDirtyCurrentPage", () => {
|
|
85
|
+
const {
|
|
86
|
+
dirtyCurrentPage
|
|
87
|
+
} = this.state;
|
|
88
|
+
const {
|
|
89
|
+
totalPages
|
|
90
|
+
} = this.asProps;
|
|
91
|
+
const finalValue = dirtyCurrentPage > totalPages ? totalPages : dirtyCurrentPage;
|
|
97
92
|
return finalValue <= 0 ? 1 : finalValue;
|
|
98
93
|
});
|
|
99
|
-
_defineProperty(
|
|
100
|
-
var dirtyCurrentPage = _this.getDirtyCurrentPage();
|
|
101
|
-
_this.handlePageChange(dirtyCurrentPage);
|
|
102
|
-
});
|
|
103
|
-
_defineProperty(_this, "handlePageInputKeyDown", function(event) {
|
|
94
|
+
_defineProperty(this, "handlePageInputKeyDown", (event) => {
|
|
104
95
|
if (event.key !== "Enter") return;
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
const dirtyCurrentPage = this.getDirtyCurrentPage();
|
|
97
|
+
this.handlePageChange(dirtyCurrentPage);
|
|
107
98
|
});
|
|
108
|
-
_defineProperty(
|
|
109
|
-
|
|
110
|
-
|
|
99
|
+
_defineProperty(this, "getFirstPageProps", () => {
|
|
100
|
+
const {
|
|
101
|
+
currentPage,
|
|
102
|
+
getI18nText,
|
|
103
|
+
size
|
|
104
|
+
} = this.asProps;
|
|
105
|
+
const disabled = currentPage <= 1;
|
|
111
106
|
return {
|
|
112
107
|
disabled,
|
|
113
|
-
onClick:
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
onClick: () => {
|
|
109
|
+
this.handlePageChange(1);
|
|
110
|
+
this.returnLostFocusTo(this.nextPageButtonRef);
|
|
116
111
|
},
|
|
117
112
|
getI18nText,
|
|
118
113
|
size
|
|
119
114
|
};
|
|
120
115
|
});
|
|
121
|
-
_defineProperty(
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
_defineProperty(this, "getPrevPageProps", () => {
|
|
117
|
+
const {
|
|
118
|
+
currentPage,
|
|
119
|
+
getI18nText,
|
|
120
|
+
size
|
|
121
|
+
} = this.asProps;
|
|
122
|
+
const disabled = currentPage <= 1;
|
|
124
123
|
return {
|
|
125
124
|
currentPage,
|
|
126
125
|
disabled,
|
|
127
|
-
onClick:
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
onClick: () => {
|
|
127
|
+
const followingPage = currentPage - 1;
|
|
128
|
+
this.handlePageChange(followingPage);
|
|
130
129
|
if (followingPage <= 1) {
|
|
131
|
-
|
|
130
|
+
this.returnLostFocusTo(this.nextPageButtonRef);
|
|
132
131
|
}
|
|
133
132
|
},
|
|
134
133
|
getI18nText,
|
|
135
|
-
ref:
|
|
134
|
+
ref: this.prevPageButtonRef,
|
|
136
135
|
size
|
|
137
136
|
};
|
|
138
137
|
});
|
|
139
|
-
_defineProperty(
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
_defineProperty(this, "getNextPageProps", () => {
|
|
139
|
+
const {
|
|
140
|
+
currentPage,
|
|
141
|
+
totalPages,
|
|
142
|
+
getI18nText,
|
|
143
|
+
size
|
|
144
|
+
} = this.asProps;
|
|
145
|
+
const disabled = currentPage >= totalPages;
|
|
142
146
|
return {
|
|
143
147
|
currentPage,
|
|
144
148
|
disabled,
|
|
145
|
-
onClick:
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
onClick: () => {
|
|
150
|
+
const followingPage = currentPage + 1;
|
|
151
|
+
this.handlePageChange(followingPage);
|
|
148
152
|
if (followingPage >= totalPages) {
|
|
149
|
-
|
|
153
|
+
this.returnLostFocusTo(this.prevPageButtonRef);
|
|
150
154
|
}
|
|
151
155
|
},
|
|
152
156
|
getI18nText,
|
|
153
|
-
ref:
|
|
157
|
+
ref: this.nextPageButtonRef,
|
|
154
158
|
size
|
|
155
159
|
};
|
|
156
160
|
});
|
|
157
|
-
_defineProperty(
|
|
158
|
-
|
|
161
|
+
_defineProperty(this, "getPageInputProps", () => {
|
|
162
|
+
const {
|
|
163
|
+
getI18nText,
|
|
164
|
+
locale,
|
|
165
|
+
size
|
|
166
|
+
} = this.asProps;
|
|
159
167
|
return {
|
|
160
168
|
getI18nText,
|
|
161
169
|
locale,
|
|
162
170
|
size,
|
|
163
|
-
paginationInputId:
|
|
171
|
+
paginationInputId: this.paginationInputId
|
|
164
172
|
};
|
|
165
173
|
});
|
|
166
|
-
_defineProperty(
|
|
174
|
+
_defineProperty(this, "getPageInputAddonProps", () => {
|
|
167
175
|
return {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onBlur: _this.handlePageValueBlur
|
|
176
|
+
ref: this.pageInputAddonRef,
|
|
177
|
+
onBlur: this.handlePageValueBlur
|
|
171
178
|
};
|
|
172
179
|
});
|
|
173
|
-
_defineProperty(
|
|
174
|
-
|
|
175
|
-
|
|
180
|
+
_defineProperty(this, "getPageInputValueProps", () => {
|
|
181
|
+
const {
|
|
182
|
+
dirtyCurrentPage
|
|
183
|
+
} = this.state;
|
|
184
|
+
const {
|
|
185
|
+
currentPage,
|
|
186
|
+
totalPages,
|
|
187
|
+
getI18nText,
|
|
188
|
+
size
|
|
189
|
+
} = this.asProps;
|
|
176
190
|
return {
|
|
177
191
|
min: 1,
|
|
178
192
|
max: totalPages,
|
|
179
193
|
disabled: totalPages === 1,
|
|
180
194
|
value: dirtyCurrentPage === void 0 ? currentPage : dirtyCurrentPage,
|
|
181
|
-
onBlur:
|
|
182
|
-
onChange:
|
|
183
|
-
onKeyDown:
|
|
195
|
+
onBlur: this.handlePageValueBlur,
|
|
196
|
+
onChange: this.handlePageValueChange,
|
|
197
|
+
onKeyDown: this.handlePageInputKeyDown,
|
|
184
198
|
getI18nText,
|
|
185
199
|
size,
|
|
186
|
-
id:
|
|
200
|
+
id: this.paginationInputId
|
|
187
201
|
};
|
|
188
202
|
});
|
|
189
|
-
_defineProperty(
|
|
190
|
-
|
|
191
|
-
|
|
203
|
+
_defineProperty(this, "getTotalPagesProps", () => {
|
|
204
|
+
const {
|
|
205
|
+
currentPage,
|
|
206
|
+
totalPages,
|
|
207
|
+
getI18nText,
|
|
208
|
+
locale,
|
|
209
|
+
size
|
|
210
|
+
} = this.asProps;
|
|
211
|
+
const formatter = new Intl.NumberFormat(locale, {
|
|
192
212
|
style: "decimal"
|
|
193
213
|
});
|
|
194
214
|
return {
|
|
195
215
|
totalPages,
|
|
196
216
|
children: formatter.format(totalPages),
|
|
197
217
|
isLastOrSingle: currentPage === totalPages,
|
|
198
|
-
onClick:
|
|
199
|
-
|
|
200
|
-
|
|
218
|
+
onClick: () => {
|
|
219
|
+
this.handlePageChange(totalPages);
|
|
220
|
+
this.returnLostFocusTo(this.prevPageButtonRef);
|
|
201
221
|
},
|
|
202
222
|
getI18nText,
|
|
203
223
|
size
|
|
204
224
|
};
|
|
205
225
|
});
|
|
206
|
-
return _this;
|
|
207
226
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
value: function componentDidUpdate(prevProps) {
|
|
220
|
-
if (prevProps.currentPage !== void 0 && prevProps.currentPage !== this.asProps.currentPage) {
|
|
221
|
-
this.setState({
|
|
222
|
-
dirtyCurrentPage: void 0
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}, {
|
|
227
|
-
key: "paginationInputId",
|
|
228
|
-
get: function get() {
|
|
229
|
-
var uid = this.asProps.uid;
|
|
230
|
-
return "pagination-input-".concat(uid);
|
|
227
|
+
uncontrolledProps() {
|
|
228
|
+
return {
|
|
229
|
+
totalPages: null,
|
|
230
|
+
currentPage: null
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
componentDidUpdate(prevProps) {
|
|
234
|
+
if (prevProps.currentPage !== void 0 && prevProps.currentPage !== this.asProps.currentPage) {
|
|
235
|
+
this.setState({
|
|
236
|
+
dirtyCurrentPage: void 0
|
|
237
|
+
});
|
|
231
238
|
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
+
}
|
|
240
|
+
get paginationInputId() {
|
|
241
|
+
const {
|
|
242
|
+
uid
|
|
243
|
+
} = this.asProps;
|
|
244
|
+
return `pagination-input-${uid}`;
|
|
245
|
+
}
|
|
246
|
+
render() {
|
|
247
|
+
var _ref = this.asProps, _ref9;
|
|
248
|
+
const SPagination = Flex;
|
|
249
|
+
const {
|
|
250
|
+
Children,
|
|
251
|
+
children: hasChildren,
|
|
252
|
+
getI18nText,
|
|
253
|
+
currentPage,
|
|
254
|
+
totalPages = 1
|
|
255
|
+
} = this.asProps;
|
|
256
|
+
return _ref9 = sstyled(this.asProps.styles), /* @__PURE__ */ React.createElement(SPagination, _ref9.cn("SPagination", {
|
|
257
|
+
...assignProps({
|
|
239
258
|
"flexWrap": "wrap",
|
|
240
259
|
"withGap": !hasChildren,
|
|
241
260
|
"tag": "nav",
|
|
242
261
|
"aria-label": getI18nText("pagination")
|
|
243
|
-
}, _ref)
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
262
|
+
}, _ref)
|
|
263
|
+
}), hasChildren ? /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})) : /* @__PURE__ */ React.createElement(React.Fragment, null, totalPages === 1 ? null : /* @__PURE__ */ React.createElement(Flex, _ref9.cn("Flex", {}), /* @__PURE__ */ React.createElement(Pagination.FirstPage, null), /* @__PURE__ */ React.createElement(Pagination.PrevPage, null), /* @__PURE__ */ React.createElement(Pagination.NextPage, null)), /* @__PURE__ */ React.createElement(Flex, _ref9.cn("Flex", {
|
|
264
|
+
"alignItems": "center"
|
|
265
|
+
}), /* @__PURE__ */ React.createElement(Pagination.PageInput, null), /* @__PURE__ */ React.createElement(Pagination.TotalPages, null))), /* @__PURE__ */ React.createElement(ScreenReaderOnly, _ref9.cn("ScreenReaderOnly", {
|
|
266
|
+
"aria-live": "polite",
|
|
267
|
+
"role": "status"
|
|
268
|
+
}), getI18nText("pageInputLabel"), " ", currentPage));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
252
271
|
_defineProperty(PaginationRoot, "displayName", "Pagination");
|
|
253
|
-
_defineProperty(PaginationRoot, "defaultProps",
|
|
272
|
+
_defineProperty(PaginationRoot, "defaultProps", () => {
|
|
254
273
|
return {
|
|
255
274
|
defaultCurrentPage: 1,
|
|
256
275
|
defaultTotalPages: 1,
|
|
@@ -261,147 +280,134 @@ _defineProperty(PaginationRoot, "defaultProps", function() {
|
|
|
261
280
|
});
|
|
262
281
|
_defineProperty(PaginationRoot, "style", style);
|
|
263
282
|
_defineProperty(PaginationRoot, "enhance", [i18nEnhance(localizedMessages), uniqueIDEnhancement()]);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
283
|
+
class FirstPage extends Component {
|
|
284
|
+
constructor(...args) {
|
|
285
|
+
super(...args);
|
|
286
|
+
_defineProperty(this, "buttonRef", /* @__PURE__ */ React.createRef());
|
|
268
287
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
__excludeProps: ["aria-label"]
|
|
289
|
-
}, /* @__PURE__ */ React.createElement(ChevronDoubleLeft, null))
|
|
290
|
-
};
|
|
291
|
-
});
|
|
292
|
-
var PrevPage = /* @__PURE__ */ (function(_Component3) {
|
|
293
|
-
function PrevPage2() {
|
|
294
|
-
_classCallCheck(this, PrevPage2);
|
|
295
|
-
return _callSuper(this, PrevPage2, arguments);
|
|
288
|
+
render() {
|
|
289
|
+
var _ref2 = this.asProps;
|
|
290
|
+
const {
|
|
291
|
+
getI18nText,
|
|
292
|
+
Children,
|
|
293
|
+
children,
|
|
294
|
+
disabled
|
|
295
|
+
} = this.asProps;
|
|
296
|
+
const hintContent = getI18nText("firstPage");
|
|
297
|
+
const isAdvanced = children !== void 0;
|
|
298
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, assignProps({
|
|
299
|
+
"aria-label": getI18nText("firstPage"),
|
|
300
|
+
"ref": this.buttonRef
|
|
301
|
+
}, _ref2), isAdvanced ? /* @__PURE__ */ React.createElement(Children, null) : /* @__PURE__ */ React.createElement(Button.Addon, {
|
|
302
|
+
tag: ChevronDoubleLeft
|
|
303
|
+
})), !isAdvanced && /* @__PURE__ */ React.createElement(Hint, {
|
|
304
|
+
triggerRef: this.buttonRef,
|
|
305
|
+
timeout: [250, 50]
|
|
306
|
+
}, hintContent));
|
|
296
307
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
}]);
|
|
306
|
-
})(Component);
|
|
307
|
-
_defineProperty(PrevPage, "defaultProps", function(props) {
|
|
308
|
-
return {
|
|
309
|
-
children: props.getI18nText("prevPageLabel")
|
|
310
|
-
};
|
|
311
|
-
});
|
|
312
|
-
var NextPage = /* @__PURE__ */ (function(_Component4) {
|
|
313
|
-
function NextPage2() {
|
|
314
|
-
_classCallCheck(this, NextPage2);
|
|
315
|
-
return _callSuper(this, NextPage2, arguments);
|
|
308
|
+
}
|
|
309
|
+
class PrevPage extends Component {
|
|
310
|
+
render() {
|
|
311
|
+
var _ref3 = this.asProps, _ref0;
|
|
312
|
+
const SPrevPage = Button;
|
|
313
|
+
return _ref0 = sstyled(this.asProps.styles), /* @__PURE__ */ React.createElement(SPrevPage, _ref0.cn("SPrevPage", {
|
|
314
|
+
...assignProps({}, _ref3)
|
|
315
|
+
}));
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
317
|
+
}
|
|
318
|
+
_defineProperty(PrevPage, "defaultProps", (props) => ({
|
|
319
|
+
children: props.getI18nText("prevPageLabel")
|
|
320
|
+
}));
|
|
321
|
+
class NextPage extends Component {
|
|
322
|
+
render() {
|
|
323
|
+
var _ref4 = this.asProps, _ref1;
|
|
324
|
+
const SNextPage = Button;
|
|
325
|
+
return _ref1 = sstyled(this.asProps.styles), /* @__PURE__ */ React.createElement(SNextPage, _ref1.cn("SNextPage", {
|
|
326
|
+
...assignProps({
|
|
324
327
|
"use": "primary",
|
|
325
328
|
"theme": "info"
|
|
326
|
-
}, _ref4)
|
|
327
|
-
}
|
|
328
|
-
}]);
|
|
329
|
-
})(Component);
|
|
330
|
-
_defineProperty(NextPage, "defaultProps", function(props) {
|
|
331
|
-
return {
|
|
332
|
-
children: props.getI18nText("nextPageLabel")
|
|
333
|
-
};
|
|
334
|
-
});
|
|
335
|
-
var TotalPages = /* @__PURE__ */ (function(_Component5) {
|
|
336
|
-
function TotalPages2() {
|
|
337
|
-
_classCallCheck(this, TotalPages2);
|
|
338
|
-
return _callSuper(this, TotalPages2, arguments);
|
|
329
|
+
}, _ref4)
|
|
330
|
+
}));
|
|
339
331
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
332
|
+
}
|
|
333
|
+
_defineProperty(NextPage, "defaultProps", (props) => ({
|
|
334
|
+
children: props.getI18nText("nextPageLabel")
|
|
335
|
+
}));
|
|
336
|
+
class TotalPages extends Component {
|
|
337
|
+
render() {
|
|
338
|
+
var _ref5 = this.asProps, _ref10;
|
|
339
|
+
const STotalPages = ButtonLink;
|
|
340
|
+
const STotalPagesLabel = Text;
|
|
341
|
+
const STotalLastPages = Text;
|
|
342
|
+
const {
|
|
343
|
+
styles,
|
|
344
|
+
getI18nText,
|
|
345
|
+
totalPages,
|
|
346
|
+
isLastOrSingle,
|
|
347
|
+
children,
|
|
348
|
+
...other
|
|
349
|
+
} = this.asProps;
|
|
350
|
+
const textSize = other.size === "l" ? "300" : "200";
|
|
351
|
+
return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(STotalPagesLabel, _ref10.cn("STotalPagesLabel", {
|
|
352
|
+
"size": textSize
|
|
353
|
+
}), getI18nText("totalPagesLabel")), isLastOrSingle ? /* @__PURE__ */ React.createElement(STotalLastPages, _ref10.cn("STotalLastPages", {
|
|
354
|
+
"size": textSize,
|
|
355
|
+
"aria-label": getI18nText("lastPage", {
|
|
356
|
+
lastPageNumber: totalPages
|
|
357
|
+
}),
|
|
358
|
+
...other
|
|
359
|
+
}), children) : /* @__PURE__ */ React.createElement(STotalPages, _ref10.cn("STotalPages", {
|
|
360
|
+
...assignProps({
|
|
354
361
|
"aria-label": getI18nText("lastPage", {
|
|
355
362
|
lastPageNumber: totalPages
|
|
356
363
|
})
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
}]);
|
|
364
|
-
})(Component);
|
|
365
|
-
var PageInputValue = function PageInputValue2(props) {
|
|
364
|
+
}, _ref5)
|
|
365
|
+
})));
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function PageInputValue(props) {
|
|
366
369
|
var _ref6 = arguments[0], _ref11;
|
|
367
|
-
|
|
368
|
-
return _ref11 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SPageInputValue, _ref11.cn("SPageInputValue",
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
370
|
+
const SPageInputValue = InputNumber.Value;
|
|
371
|
+
return _ref11 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SPageInputValue, _ref11.cn("SPageInputValue", {
|
|
372
|
+
...assignProps({
|
|
373
|
+
"onBlur": () => false
|
|
374
|
+
}, _ref6)
|
|
375
|
+
}));
|
|
376
|
+
}
|
|
377
|
+
function PageInputAddon(props) {
|
|
375
378
|
var _ref7 = arguments[0], _ref12;
|
|
376
|
-
|
|
377
|
-
return _ref12 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SPageInputAddon, _ref12.cn("SPageInputAddon",
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
379
|
+
const SPageInputAddon = InputNumber.Addon;
|
|
380
|
+
return _ref12 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SPageInputAddon, _ref12.cn("SPageInputAddon", {
|
|
381
|
+
...assignProps({}, _ref7)
|
|
382
|
+
}));
|
|
383
|
+
}
|
|
384
|
+
class PageInput extends Component {
|
|
385
|
+
render() {
|
|
386
|
+
var _ref8 = this.asProps, _ref13;
|
|
387
|
+
const SPageInput = InputNumber;
|
|
388
|
+
const SLabel = Text;
|
|
389
|
+
const {
|
|
390
|
+
Children,
|
|
391
|
+
getI18nText,
|
|
392
|
+
styles,
|
|
393
|
+
locale,
|
|
394
|
+
size,
|
|
395
|
+
paginationInputId
|
|
396
|
+
} = this.asProps;
|
|
397
|
+
return _ref13 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SLabel, _ref13.cn("SLabel", {
|
|
398
|
+
"tag": "label",
|
|
399
|
+
"htmlFor": paginationInputId,
|
|
400
|
+
"size": size
|
|
401
|
+
}), getI18nText("pageInputLabel")), /* @__PURE__ */ React.createElement(SPageInput, _ref13.cn("SPageInput", {
|
|
402
|
+
...assignProps({
|
|
397
403
|
"controlsLength": Children.origin ? void 0 : 2,
|
|
398
404
|
"locale": locale
|
|
399
|
-
}, _ref8)
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
405
|
+
}, _ref8)
|
|
406
|
+
}), Children.origin ? /* @__PURE__ */ React.createElement(Children, _ref13.cn("Children", {})) : /* @__PURE__ */ React.createElement(Pagination.PageInput.Value, null)));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
403
409
|
_defineProperty(PageInput, "enhance", [uniqueIDEnhancement()]);
|
|
404
|
-
|
|
410
|
+
const Pagination = createComponent(PaginationRoot, {
|
|
405
411
|
PrevPage,
|
|
406
412
|
NextPage,
|
|
407
413
|
FirstPage,
|