@semcore/pagination 4.53.0-prerelease.0 → 4.53.0-prerelease.4
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/lib/cjs/Pagination.js +159 -152
- package/lib/cjs/Pagination.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/pagination.shadow.css +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/Pagination.js +153 -147
- package/lib/es6/Pagination.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/pagination.shadow.css +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/Pagination.mjs +150 -142
- package/lib/esm/style/pagination.shadow.css +1 -1
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/index.d.ts +17 -10
- package/package.json +11 -11
package/lib/es6/Pagination.js
CHANGED
|
@@ -2,10 +2,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
|
+
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
9
10
|
import { assignProps as _assignProps8 } from "@semcore/core";
|
|
10
11
|
import { assignProps as _assignProps7 } from "@semcore/core";
|
|
11
12
|
import { assignProps as _assignProps6 } from "@semcore/core";
|
|
@@ -15,54 +16,64 @@ import { assignProps as _assignProps3 } from "@semcore/core";
|
|
|
15
16
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
16
17
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
17
18
|
var _excluded = ["styles", "getI18nText", "totalPages", "isLastOrSingle", "children"];
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
22
|
-
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
23
|
-
import ChevronDoubleLeft from '@semcore/icon/ChevronDoubleLeft/m';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
21
|
+
import { Flex } from '@semcore/flex-box';
|
|
24
22
|
import InputNumber from '@semcore/input-number';
|
|
25
23
|
import { Text } from '@semcore/typography';
|
|
26
|
-
import
|
|
24
|
+
import Button, { ButtonLink } from '@semcore/button';
|
|
25
|
+
import { Hint } from '@semcore/tooltip';
|
|
26
|
+
import ChevronDoubleLeft from '@semcore/icon/ChevronDoubleLeft/m';
|
|
27
|
+
import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
28
|
+
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
29
|
+
import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
|
|
27
30
|
/*!__reshadow-styles__:"./style/pagination.shadow.css"*/
|
|
28
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
31
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPagination_q0c8m_gg_{justify-content:flex-start;align-items:center}.___SPagination_q0c8m_gg_.__withGap_q0c8m_gg_{gap:var(--intergalactic-spacing-4x, 16px)}.___SPagination_q0c8m_gg_.__withGap_q0c8m_gg_._size_l_q0c8m_gg_{gap:var(--intergalactic-spacing-5x, 20px)}.___SNextPage_q0c8m_gg_,.___SPrevPage_q0c8m_gg_{align-self:center;margin-left:var(--intergalactic-spacing-2x, 8px)}.___SNextPage_q0c8m_gg_._size_l_q0c8m_gg_,.___SPrevPage_q0c8m_gg_._size_l_q0c8m_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SLabel_q0c8m_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SLabel_q0c8m_gg_:not(:first-child){margin-left:var(--intergalactic-spacing-4x, 16px)}.___SLabel_q0c8m_gg_._size_l_q0c8m_gg_:not(:first-child){margin-left:var(--intergalactic-spacing-5x, 20px)}.___STotalPages_q0c8m_gg_{align-self:center;line-height:normal;color:var(--intergalactic-text-link, rgb(35, 95, 226))}.___STotalPagesLabel_q0c8m_gg_{margin-left:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-1x, 4px);color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___STotalLastPages_q0c8m_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___STotalLastPages_q0c8m_gg_._size_l_q0c8m_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SPageInput_q0c8m_gg_{max-width:68px;margin-left:var(--intergalactic-spacing-1x, 4px)}.___SPageInput_q0c8m_gg_._size_l_q0c8m_gg_{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SPageInput_q0c8m_gg_:focus-within .___SPageInputAddon_q0c8m_gg_{opacity:1;clip:initial;position:static}.___SPageInputAddon_q0c8m_gg_{opacity:0;clip:rect(1px,1px,1px,1px);position:absolute}.___SLabel_q0c8m_gg_,.___STotalPagesLabel_q0c8m_gg_,.___STotalPages_q0c8m_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SLabel_q0c8m_gg_._size_l_q0c8m_gg_,.___STotalPagesLabel_q0c8m_gg_._size_l_q0c8m_gg_,.___STotalPages_q0c8m_gg_._size_l_q0c8m_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}", /*__inner_css_end__*/"q0c8m_gg_"),
|
|
29
32
|
/*__reshadow_css_end__*/
|
|
30
33
|
{
|
|
31
|
-
"__SPagination": "
|
|
32
|
-
"__SLabel": "
|
|
33
|
-
"_size_l": "
|
|
34
|
-
"__STotalPages": "
|
|
35
|
-
"__STotalPagesLabel": "
|
|
36
|
-
"__SPageInput": "
|
|
37
|
-
"__SPageInputAddon": "
|
|
38
|
-
"_withGap": "
|
|
39
|
-
"__SNextPage": "
|
|
40
|
-
"__SPrevPage": "
|
|
41
|
-
"__STotalLastPages": "
|
|
34
|
+
"__SPagination": "___SPagination_q0c8m_gg_",
|
|
35
|
+
"__SLabel": "___SLabel_q0c8m_gg_",
|
|
36
|
+
"_size_l": "_size_l_q0c8m_gg_",
|
|
37
|
+
"__STotalPages": "___STotalPages_q0c8m_gg_",
|
|
38
|
+
"__STotalPagesLabel": "___STotalPagesLabel_q0c8m_gg_",
|
|
39
|
+
"__SPageInput": "___SPageInput_q0c8m_gg_",
|
|
40
|
+
"__SPageInputAddon": "___SPageInputAddon_q0c8m_gg_",
|
|
41
|
+
"_withGap": "__withGap_q0c8m_gg_",
|
|
42
|
+
"__SNextPage": "___SNextPage_q0c8m_gg_",
|
|
43
|
+
"__SPrevPage": "___SPrevPage_q0c8m_gg_",
|
|
44
|
+
"__STotalLastPages": "___STotalLastPages_q0c8m_gg_"
|
|
42
45
|
});
|
|
43
|
-
import {
|
|
46
|
+
import { ScreenReaderOnly } from '@semcore/flex-box';
|
|
44
47
|
var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
48
|
+
_inherits(PaginationRoot, _Component);
|
|
49
|
+
var _super = _createSuper(PaginationRoot);
|
|
45
50
|
function PaginationRoot() {
|
|
46
51
|
var _this;
|
|
47
52
|
_classCallCheck(this, PaginationRoot);
|
|
48
53
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
49
54
|
args[_key] = arguments[_key];
|
|
50
55
|
}
|
|
51
|
-
_this =
|
|
52
|
-
_defineProperty(_this, "nextPageButtonRef", /*#__PURE__*/React.createRef());
|
|
53
|
-
_defineProperty(_this, "prevPageButtonRef", /*#__PURE__*/React.createRef());
|
|
54
|
-
_defineProperty(_this, "state", {
|
|
56
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "nextPageButtonRef", /*#__PURE__*/React.createRef());
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "prevPageButtonRef", /*#__PURE__*/React.createRef());
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
55
60
|
// Crutch, so as not to take out `dirtyCurrentPage` in props
|
|
56
61
|
dirtyCurrentPage: undefined
|
|
57
62
|
});
|
|
58
|
-
_defineProperty(_this, "pageInputAddonRef", /*#__PURE__*/React.createRef());
|
|
59
|
-
_defineProperty(_this, "
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "pageInputAddonRef", /*#__PURE__*/React.createRef());
|
|
64
|
+
_defineProperty(_assertThisInitialized(_this), "returnLostFocus", function () {
|
|
65
|
+
setTimeout(function () {
|
|
66
|
+
if (document.activeElement !== document.body) return;
|
|
67
|
+
var prevPageButton = _this.prevPageButtonRef.current;
|
|
68
|
+
var nextPageButton = _this.nextPageButtonRef.current;
|
|
69
|
+
if (prevPageButton && !prevPageButton.disabled) {
|
|
70
|
+
prevPageButton.focus();
|
|
71
|
+
} else if (nextPageButton && !nextPageButton.disabled) {
|
|
72
|
+
nextPageButton.focus();
|
|
73
|
+
}
|
|
74
|
+
}, 0);
|
|
64
75
|
});
|
|
65
|
-
_defineProperty(_this, "handlePageChange", function (currentPage) {
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageChange", function (currentPage) {
|
|
66
77
|
currentPage = Number(currentPage);
|
|
67
78
|
if (Number.isNaN(currentPage)) {
|
|
68
79
|
return;
|
|
@@ -71,8 +82,9 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
71
82
|
_this.setState({
|
|
72
83
|
dirtyCurrentPage: undefined
|
|
73
84
|
});
|
|
85
|
+
_this.returnLostFocus();
|
|
74
86
|
});
|
|
75
|
-
_defineProperty(_this, "handlePageValueChange", function (value) {
|
|
87
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageValueChange", function (value) {
|
|
76
88
|
var dirtyCurrentPage = _this.state.dirtyCurrentPage;
|
|
77
89
|
if (Number.isNaN(Number(value))) {
|
|
78
90
|
value = dirtyCurrentPage;
|
|
@@ -81,7 +93,7 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
81
93
|
dirtyCurrentPage: value
|
|
82
94
|
});
|
|
83
95
|
});
|
|
84
|
-
_defineProperty(_this, "handlePageValueBlur", function () {
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageValueBlur", function () {
|
|
85
97
|
setTimeout(function () {
|
|
86
98
|
if (_this.pageInputAddonRef.current !== document.activeElement) {
|
|
87
99
|
var currentPage = _this.asProps.currentPage;
|
|
@@ -91,18 +103,23 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
91
103
|
}
|
|
92
104
|
}, 0);
|
|
93
105
|
});
|
|
94
|
-
_defineProperty(_this, "getDirtyCurrentPage", function () {
|
|
106
|
+
_defineProperty(_assertThisInitialized(_this), "getDirtyCurrentPage", function () {
|
|
95
107
|
var dirtyCurrentPage = _this.state.dirtyCurrentPage;
|
|
96
108
|
var totalPages = _this.asProps.totalPages;
|
|
97
109
|
var finalValue = dirtyCurrentPage > totalPages ? totalPages : dirtyCurrentPage;
|
|
98
110
|
return finalValue <= 0 ? 1 : finalValue;
|
|
99
111
|
});
|
|
100
|
-
|
|
112
|
+
/** @deprecated */
|
|
113
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageInputIconClick", function () {
|
|
114
|
+
var dirtyCurrentPage = _this.getDirtyCurrentPage();
|
|
115
|
+
_this.handlePageChange(dirtyCurrentPage);
|
|
116
|
+
});
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageInputKeyDown", function (event) {
|
|
101
118
|
if (event.key !== 'Enter') return;
|
|
102
119
|
var dirtyCurrentPage = _this.getDirtyCurrentPage();
|
|
103
120
|
_this.handlePageChange(dirtyCurrentPage);
|
|
104
121
|
});
|
|
105
|
-
_defineProperty(_this, "getFirstPageProps", function () {
|
|
122
|
+
_defineProperty(_assertThisInitialized(_this), "getFirstPageProps", function () {
|
|
106
123
|
var _this$asProps = _this.asProps,
|
|
107
124
|
currentPage = _this$asProps.currentPage,
|
|
108
125
|
getI18nText = _this$asProps.getI18nText,
|
|
@@ -111,14 +128,13 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
111
128
|
return {
|
|
112
129
|
disabled: disabled,
|
|
113
130
|
onClick: function onClick() {
|
|
114
|
-
_this.handlePageChange(1);
|
|
115
|
-
_this.returnLostFocusTo(_this.nextPageButtonRef);
|
|
131
|
+
return _this.handlePageChange(1);
|
|
116
132
|
},
|
|
117
133
|
getI18nText: getI18nText,
|
|
118
134
|
size: size
|
|
119
135
|
};
|
|
120
136
|
});
|
|
121
|
-
_defineProperty(_this, "getPrevPageProps", function () {
|
|
137
|
+
_defineProperty(_assertThisInitialized(_this), "getPrevPageProps", function () {
|
|
122
138
|
var _this$asProps2 = _this.asProps,
|
|
123
139
|
currentPage = _this$asProps2.currentPage,
|
|
124
140
|
getI18nText = _this$asProps2.getI18nText,
|
|
@@ -128,40 +144,32 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
128
144
|
currentPage: currentPage,
|
|
129
145
|
disabled: disabled,
|
|
130
146
|
onClick: function onClick() {
|
|
131
|
-
|
|
132
|
-
_this.handlePageChange(followingPage);
|
|
133
|
-
if (followingPage <= 1) {
|
|
134
|
-
_this.returnLostFocusTo(_this.nextPageButtonRef);
|
|
135
|
-
}
|
|
147
|
+
return _this.handlePageChange(currentPage - 1);
|
|
136
148
|
},
|
|
137
149
|
getI18nText: getI18nText,
|
|
138
|
-
ref: _this.
|
|
150
|
+
ref: _this.nextPageButtonRef,
|
|
139
151
|
size: size
|
|
140
152
|
};
|
|
141
153
|
});
|
|
142
|
-
_defineProperty(_this, "getNextPageProps", function () {
|
|
154
|
+
_defineProperty(_assertThisInitialized(_this), "getNextPageProps", function () {
|
|
143
155
|
var _this$asProps3 = _this.asProps,
|
|
144
156
|
currentPage = _this$asProps3.currentPage,
|
|
145
157
|
totalPages = _this$asProps3.totalPages,
|
|
146
158
|
getI18nText = _this$asProps3.getI18nText,
|
|
147
159
|
size = _this$asProps3.size;
|
|
148
|
-
var disabled = currentPage
|
|
160
|
+
var disabled = !(currentPage < totalPages);
|
|
149
161
|
return {
|
|
150
162
|
currentPage: currentPage,
|
|
151
163
|
disabled: disabled,
|
|
152
164
|
onClick: function onClick() {
|
|
153
|
-
|
|
154
|
-
_this.handlePageChange(followingPage);
|
|
155
|
-
if (followingPage >= totalPages) {
|
|
156
|
-
_this.returnLostFocusTo(_this.prevPageButtonRef);
|
|
157
|
-
}
|
|
165
|
+
return _this.handlePageChange(currentPage + 1);
|
|
158
166
|
},
|
|
159
167
|
getI18nText: getI18nText,
|
|
160
|
-
ref: _this.
|
|
168
|
+
ref: _this.prevPageButtonRef,
|
|
161
169
|
size: size
|
|
162
170
|
};
|
|
163
171
|
});
|
|
164
|
-
_defineProperty(_this, "getPageInputProps", function () {
|
|
172
|
+
_defineProperty(_assertThisInitialized(_this), "getPageInputProps", function () {
|
|
165
173
|
var _this$asProps4 = _this.asProps,
|
|
166
174
|
getI18nText = _this$asProps4.getI18nText,
|
|
167
175
|
locale = _this$asProps4.locale,
|
|
@@ -169,17 +177,18 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
169
177
|
return {
|
|
170
178
|
getI18nText: getI18nText,
|
|
171
179
|
locale: locale,
|
|
172
|
-
size: size
|
|
173
|
-
paginationInputId: _this.paginationInputId
|
|
180
|
+
size: size
|
|
174
181
|
};
|
|
175
182
|
});
|
|
176
|
-
|
|
183
|
+
/** @deprecated */
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this), "getPageInputAddonProps", function () {
|
|
177
185
|
return {
|
|
186
|
+
onClick: _this.handlePageInputIconClick,
|
|
178
187
|
ref: _this.pageInputAddonRef,
|
|
179
188
|
onBlur: _this.handlePageValueBlur
|
|
180
189
|
};
|
|
181
190
|
});
|
|
182
|
-
_defineProperty(_this, "getPageInputValueProps", function () {
|
|
191
|
+
_defineProperty(_assertThisInitialized(_this), "getPageInputValueProps", function () {
|
|
183
192
|
var dirtyCurrentPage = _this.state.dirtyCurrentPage;
|
|
184
193
|
var _this$asProps5 = _this.asProps,
|
|
185
194
|
currentPage = _this$asProps5.currentPage,
|
|
@@ -195,11 +204,10 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
195
204
|
onChange: _this.handlePageValueChange,
|
|
196
205
|
onKeyDown: _this.handlePageInputKeyDown,
|
|
197
206
|
getI18nText: getI18nText,
|
|
198
|
-
size: size
|
|
199
|
-
id: _this.paginationInputId
|
|
207
|
+
size: size
|
|
200
208
|
};
|
|
201
209
|
});
|
|
202
|
-
_defineProperty(_this, "getTotalPagesProps", function () {
|
|
210
|
+
_defineProperty(_assertThisInitialized(_this), "getTotalPagesProps", function () {
|
|
203
211
|
var _this$asProps6 = _this.asProps,
|
|
204
212
|
currentPage = _this$asProps6.currentPage,
|
|
205
213
|
totalPages = _this$asProps6.totalPages,
|
|
@@ -214,8 +222,7 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
214
222
|
children: formatter.format(totalPages),
|
|
215
223
|
isLastOrSingle: currentPage === totalPages,
|
|
216
224
|
onClick: function onClick() {
|
|
217
|
-
_this.handlePageChange(totalPages);
|
|
218
|
-
_this.returnLostFocusTo(_this.prevPageButtonRef);
|
|
225
|
+
return _this.handlePageChange(totalPages);
|
|
219
226
|
},
|
|
220
227
|
getI18nText: getI18nText,
|
|
221
228
|
size: size
|
|
@@ -223,8 +230,7 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
223
230
|
});
|
|
224
231
|
return _this;
|
|
225
232
|
}
|
|
226
|
-
|
|
227
|
-
return _createClass(PaginationRoot, [{
|
|
233
|
+
_createClass(PaginationRoot, [{
|
|
228
234
|
key: "uncontrolledProps",
|
|
229
235
|
value: function uncontrolledProps() {
|
|
230
236
|
return {
|
|
@@ -241,12 +247,6 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
241
247
|
});
|
|
242
248
|
}
|
|
243
249
|
}
|
|
244
|
-
}, {
|
|
245
|
-
key: "paginationInputId",
|
|
246
|
-
get: function get() {
|
|
247
|
-
var uid = this.asProps.uid;
|
|
248
|
-
return "pagination-input-".concat(uid);
|
|
249
|
-
}
|
|
250
250
|
}, {
|
|
251
251
|
key: "render",
|
|
252
252
|
value: function render() {
|
|
@@ -270,9 +270,10 @@ var PaginationRoot = /*#__PURE__*/function (_Component) {
|
|
|
270
270
|
}), /*#__PURE__*/React.createElement(Pagination.PageInput, null), /*#__PURE__*/React.createElement(Pagination.TotalPages, null))), /*#__PURE__*/React.createElement(ScreenReaderOnly, _ref9.cn("ScreenReaderOnly", {
|
|
271
271
|
"aria-live": 'polite',
|
|
272
272
|
"role": 'status'
|
|
273
|
-
}), getI18nText('pageInputLabel'),
|
|
273
|
+
}), getI18nText('pageInputLabel'), " ", currentPage));
|
|
274
274
|
}
|
|
275
275
|
}]);
|
|
276
|
+
return PaginationRoot;
|
|
276
277
|
}(Component);
|
|
277
278
|
_defineProperty(PaginationRoot, "displayName", 'Pagination');
|
|
278
279
|
_defineProperty(PaginationRoot, "defaultProps", function () {
|
|
@@ -285,57 +286,54 @@ _defineProperty(PaginationRoot, "defaultProps", function () {
|
|
|
285
286
|
};
|
|
286
287
|
});
|
|
287
288
|
_defineProperty(PaginationRoot, "style", style);
|
|
288
|
-
_defineProperty(PaginationRoot, "enhance", [i18nEnhance(localizedMessages)
|
|
289
|
+
_defineProperty(PaginationRoot, "enhance", [i18nEnhance(localizedMessages)]);
|
|
289
290
|
var FirstPage = /*#__PURE__*/function (_Component2) {
|
|
291
|
+
_inherits(FirstPage, _Component2);
|
|
292
|
+
var _super2 = _createSuper(FirstPage);
|
|
290
293
|
function FirstPage() {
|
|
291
|
-
var _this2;
|
|
292
294
|
_classCallCheck(this, FirstPage);
|
|
293
|
-
|
|
294
|
-
args[_key2] = arguments[_key2];
|
|
295
|
-
}
|
|
296
|
-
_this2 = _callSuper(this, FirstPage, [].concat(args));
|
|
297
|
-
_defineProperty(_this2, "buttonRef", /*#__PURE__*/React.createRef());
|
|
298
|
-
return _this2;
|
|
295
|
+
return _super2.apply(this, arguments);
|
|
299
296
|
}
|
|
300
|
-
|
|
301
|
-
return _createClass(FirstPage, [{
|
|
297
|
+
_createClass(FirstPage, [{
|
|
302
298
|
key: "render",
|
|
303
299
|
value: function render() {
|
|
304
300
|
var _ref2 = this.asProps;
|
|
305
|
-
var
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
disabled = _this$asProps8.disabled;
|
|
310
|
-
var hintContent = getI18nText('firstPage');
|
|
311
|
-
var isAdvanced = children !== undefined;
|
|
312
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _assignProps2({
|
|
313
|
-
"aria-label": getI18nText('firstPage'),
|
|
314
|
-
"ref": this.buttonRef
|
|
315
|
-
}, _ref2), isAdvanced ? /*#__PURE__*/React.createElement(Children, null) : /*#__PURE__*/React.createElement(Button.Addon, {
|
|
316
|
-
tag: ChevronDoubleLeft
|
|
317
|
-
})), !isAdvanced && /*#__PURE__*/React.createElement(Hint, {
|
|
318
|
-
triggerRef: this.buttonRef,
|
|
319
|
-
timeout: [250, 50]
|
|
320
|
-
}, hintContent));
|
|
301
|
+
var getI18nText = this.asProps.getI18nText;
|
|
302
|
+
return /*#__PURE__*/React.createElement(Button, _assignProps2({
|
|
303
|
+
"aria-label": getI18nText('firstPage')
|
|
304
|
+
}, _ref2));
|
|
321
305
|
}
|
|
322
306
|
}]);
|
|
307
|
+
return FirstPage;
|
|
323
308
|
}(Component);
|
|
309
|
+
_defineProperty(FirstPage, "defaultProps", function (props) {
|
|
310
|
+
var hintContent = props.getI18nText('firstPage');
|
|
311
|
+
return {
|
|
312
|
+
children: /*#__PURE__*/React.createElement(Button.Addon, {
|
|
313
|
+
tag: Hint,
|
|
314
|
+
title: hintContent,
|
|
315
|
+
timeout: [250, 50],
|
|
316
|
+
__excludeProps: ['aria-label']
|
|
317
|
+
}, /*#__PURE__*/React.createElement(ChevronDoubleLeft, null))
|
|
318
|
+
};
|
|
319
|
+
});
|
|
324
320
|
var PrevPage = /*#__PURE__*/function (_Component3) {
|
|
321
|
+
_inherits(PrevPage, _Component3);
|
|
322
|
+
var _super3 = _createSuper(PrevPage);
|
|
325
323
|
function PrevPage() {
|
|
326
324
|
_classCallCheck(this, PrevPage);
|
|
327
|
-
return
|
|
325
|
+
return _super3.apply(this, arguments);
|
|
328
326
|
}
|
|
329
|
-
|
|
330
|
-
return _createClass(PrevPage, [{
|
|
327
|
+
_createClass(PrevPage, [{
|
|
331
328
|
key: "render",
|
|
332
329
|
value: function render() {
|
|
333
330
|
var _ref3 = this.asProps,
|
|
334
|
-
|
|
331
|
+
_ref10;
|
|
335
332
|
var SPrevPage = Button;
|
|
336
|
-
return
|
|
333
|
+
return _ref10 = sstyled(this.asProps.styles), /*#__PURE__*/React.createElement(SPrevPage, _ref10.cn("SPrevPage", _objectSpread({}, _assignProps3({}, _ref3))));
|
|
337
334
|
}
|
|
338
335
|
}]);
|
|
336
|
+
return PrevPage;
|
|
339
337
|
}(Component);
|
|
340
338
|
_defineProperty(PrevPage, "defaultProps", function (props) {
|
|
341
339
|
return {
|
|
@@ -343,23 +341,25 @@ _defineProperty(PrevPage, "defaultProps", function (props) {
|
|
|
343
341
|
};
|
|
344
342
|
});
|
|
345
343
|
var NextPage = /*#__PURE__*/function (_Component4) {
|
|
344
|
+
_inherits(NextPage, _Component4);
|
|
345
|
+
var _super4 = _createSuper(NextPage);
|
|
346
346
|
function NextPage() {
|
|
347
347
|
_classCallCheck(this, NextPage);
|
|
348
|
-
return
|
|
348
|
+
return _super4.apply(this, arguments);
|
|
349
349
|
}
|
|
350
|
-
|
|
351
|
-
return _createClass(NextPage, [{
|
|
350
|
+
_createClass(NextPage, [{
|
|
352
351
|
key: "render",
|
|
353
352
|
value: function render() {
|
|
354
353
|
var _ref4 = this.asProps,
|
|
355
|
-
|
|
354
|
+
_ref11;
|
|
356
355
|
var SNextPage = Button;
|
|
357
|
-
return
|
|
356
|
+
return _ref11 = sstyled(this.asProps.styles), /*#__PURE__*/React.createElement(SNextPage, _ref11.cn("SNextPage", _objectSpread({}, _assignProps4({
|
|
358
357
|
"use": 'primary',
|
|
359
358
|
"theme": 'info'
|
|
360
359
|
}, _ref4))));
|
|
361
360
|
}
|
|
362
361
|
}]);
|
|
362
|
+
return NextPage;
|
|
363
363
|
}(Component);
|
|
364
364
|
_defineProperty(NextPage, "defaultProps", function (props) {
|
|
365
365
|
return {
|
|
@@ -367,88 +367,94 @@ _defineProperty(NextPage, "defaultProps", function (props) {
|
|
|
367
367
|
};
|
|
368
368
|
});
|
|
369
369
|
var TotalPages = /*#__PURE__*/function (_Component5) {
|
|
370
|
+
_inherits(TotalPages, _Component5);
|
|
371
|
+
var _super5 = _createSuper(TotalPages);
|
|
370
372
|
function TotalPages() {
|
|
371
373
|
_classCallCheck(this, TotalPages);
|
|
372
|
-
return
|
|
374
|
+
return _super5.apply(this, arguments);
|
|
373
375
|
}
|
|
374
|
-
|
|
375
|
-
return _createClass(TotalPages, [{
|
|
376
|
+
_createClass(TotalPages, [{
|
|
376
377
|
key: "render",
|
|
377
378
|
value: function render() {
|
|
378
379
|
var _ref5 = this.asProps,
|
|
379
|
-
|
|
380
|
+
_ref12;
|
|
380
381
|
var STotalPages = ButtonLink;
|
|
381
382
|
var STotalPagesLabel = Text;
|
|
382
383
|
var STotalLastPages = Text;
|
|
383
|
-
var _this$
|
|
384
|
-
styles = _this$
|
|
385
|
-
getI18nText = _this$
|
|
386
|
-
totalPages = _this$
|
|
387
|
-
isLastOrSingle = _this$
|
|
388
|
-
children = _this$
|
|
389
|
-
other = _objectWithoutProperties(_this$
|
|
384
|
+
var _this$asProps8 = this.asProps,
|
|
385
|
+
styles = _this$asProps8.styles,
|
|
386
|
+
getI18nText = _this$asProps8.getI18nText,
|
|
387
|
+
totalPages = _this$asProps8.totalPages,
|
|
388
|
+
isLastOrSingle = _this$asProps8.isLastOrSingle,
|
|
389
|
+
children = _this$asProps8.children,
|
|
390
|
+
other = _objectWithoutProperties(_this$asProps8, _excluded);
|
|
390
391
|
var textSize = other.size === 'l' ? '300' : '200';
|
|
391
|
-
return
|
|
392
|
+
return _ref12 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(STotalPagesLabel, _ref12.cn("STotalPagesLabel", {
|
|
392
393
|
"size": textSize
|
|
393
|
-
}), getI18nText('totalPagesLabel')), isLastOrSingle ? /*#__PURE__*/React.createElement(STotalLastPages,
|
|
394
|
+
}), getI18nText('totalPagesLabel')), isLastOrSingle ? /*#__PURE__*/React.createElement(STotalLastPages, _ref12.cn("STotalLastPages", _objectSpread({
|
|
394
395
|
"size": textSize,
|
|
395
396
|
"aria-label": getI18nText('lastPage', {
|
|
396
397
|
lastPageNumber: totalPages
|
|
397
398
|
})
|
|
398
|
-
}, other)), children) : /*#__PURE__*/React.createElement(STotalPages,
|
|
399
|
+
}, other)), children) : /*#__PURE__*/React.createElement(STotalPages, _ref12.cn("STotalPages", _objectSpread({}, _assignProps5({
|
|
399
400
|
"aria-label": getI18nText('lastPage', {
|
|
400
401
|
lastPageNumber: totalPages
|
|
401
402
|
})
|
|
402
403
|
}, _ref5)))));
|
|
403
404
|
}
|
|
404
405
|
}]);
|
|
406
|
+
return TotalPages;
|
|
405
407
|
}(Component);
|
|
406
|
-
function PageInputValue(props) {
|
|
408
|
+
var PageInputValue = function PageInputValue(props) {
|
|
407
409
|
var _ref6 = arguments[0],
|
|
408
|
-
|
|
410
|
+
_ref13;
|
|
409
411
|
var SPageInputValue = InputNumber.Value;
|
|
410
|
-
return
|
|
412
|
+
return _ref13 = sstyled(props.styles), /*#__PURE__*/React.createElement(SPageInputValue, _ref13.cn("SPageInputValue", _objectSpread({}, _assignProps6({
|
|
411
413
|
"onBlur": function onBlur() {
|
|
412
414
|
return false;
|
|
413
415
|
}
|
|
414
416
|
}, _ref6))));
|
|
415
|
-
}
|
|
416
|
-
function PageInputAddon(props) {
|
|
417
|
+
};
|
|
418
|
+
var PageInputAddon = function PageInputAddon(props) {
|
|
417
419
|
var _ref7 = arguments[0],
|
|
418
|
-
|
|
420
|
+
_ref14;
|
|
419
421
|
var SPageInputAddon = InputNumber.Addon;
|
|
420
|
-
return
|
|
421
|
-
}
|
|
422
|
+
return _ref14 = sstyled(props.styles), /*#__PURE__*/React.createElement(SPageInputAddon, _ref14.cn("SPageInputAddon", _objectSpread({}, _assignProps7({}, _ref7))));
|
|
423
|
+
};
|
|
422
424
|
var PageInput = /*#__PURE__*/function (_Component6) {
|
|
425
|
+
_inherits(PageInput, _Component6);
|
|
426
|
+
var _super6 = _createSuper(PageInput);
|
|
423
427
|
function PageInput() {
|
|
424
428
|
_classCallCheck(this, PageInput);
|
|
425
|
-
return
|
|
429
|
+
return _super6.apply(this, arguments);
|
|
426
430
|
}
|
|
427
|
-
|
|
428
|
-
return _createClass(PageInput, [{
|
|
431
|
+
_createClass(PageInput, [{
|
|
429
432
|
key: "render",
|
|
430
433
|
value: function render() {
|
|
431
434
|
var _ref8 = this.asProps,
|
|
432
|
-
|
|
435
|
+
_ref15;
|
|
433
436
|
var SPageInput = InputNumber;
|
|
434
437
|
var SLabel = Text;
|
|
435
|
-
var _this$
|
|
436
|
-
Children = _this$
|
|
437
|
-
getI18nText = _this$
|
|
438
|
-
styles = _this$
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
return
|
|
438
|
+
var _this$asProps9 = this.asProps,
|
|
439
|
+
Children = _this$asProps9.Children,
|
|
440
|
+
getI18nText = _this$asProps9.getI18nText,
|
|
441
|
+
styles = _this$asProps9.styles,
|
|
442
|
+
uid = _this$asProps9.uid,
|
|
443
|
+
locale = _this$asProps9.locale,
|
|
444
|
+
size = _this$asProps9.size;
|
|
445
|
+
return _ref15 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SLabel, _ref15.cn("SLabel", {
|
|
443
446
|
"tag": 'label',
|
|
444
|
-
"htmlFor":
|
|
447
|
+
"htmlFor": "pagination-input-".concat(uid),
|
|
445
448
|
"size": size
|
|
446
|
-
}), getI18nText('pageInputLabel')), /*#__PURE__*/React.createElement(SPageInput,
|
|
449
|
+
}), getI18nText('pageInputLabel')), /*#__PURE__*/React.createElement(SPageInput, _ref15.cn("SPageInput", _objectSpread({}, _assignProps8({
|
|
447
450
|
"controlsLength": Children.origin ? undefined : 2,
|
|
448
451
|
"locale": locale
|
|
449
|
-
}, _ref8))), Children.origin ? /*#__PURE__*/React.createElement(Children,
|
|
452
|
+
}, _ref8))), Children.origin ? /*#__PURE__*/React.createElement(Children, _ref15.cn("Children", {})) : /*#__PURE__*/React.createElement(Pagination.PageInput.Value, {
|
|
453
|
+
id: "pagination-input-".concat(uid)
|
|
454
|
+
})));
|
|
450
455
|
}
|
|
451
456
|
}]);
|
|
457
|
+
return PageInput;
|
|
452
458
|
}(Component);
|
|
453
459
|
_defineProperty(PageInput, "enhance", [uniqueIDEnhancement()]);
|
|
454
460
|
var Pagination = createComponent(PaginationRoot, {
|