@semcore/pagination 4.53.0-prerelease.5 → 4.53.0-prerelease.7
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/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/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/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/index.d.ts +17 -10
- package/package.json +11 -11
package/lib/esm/Pagination.mjs
CHANGED
|
@@ -2,18 +2,21 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
-
import
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import { sstyled
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
13
|
-
import ChevronDoubleLeft from "@semcore/icon/ChevronDoubleLeft/m";
|
|
9
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
10
|
+
import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
11
|
+
import React from "react";
|
|
12
|
+
import { Flex, ScreenReaderOnly } from "@semcore/flex-box";
|
|
14
13
|
import InputNumber from "@semcore/input-number";
|
|
15
14
|
import { Text } from "@semcore/typography";
|
|
16
|
-
import
|
|
15
|
+
import Button, { ButtonLink } from "@semcore/button";
|
|
16
|
+
import { Hint } from "@semcore/tooltip";
|
|
17
|
+
import ChevronDoubleLeft from "@semcore/icon/ChevronDoubleLeft/m";
|
|
18
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
19
|
+
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
17
20
|
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
18
21
|
var _excluded = ["styles", "getI18nText", "totalPages", "isLastOrSingle", "children"];
|
|
19
22
|
/*!__reshadow-styles__:"./style/pagination.shadow.css"*/
|
|
@@ -21,46 +24,54 @@ var style = (
|
|
|
21
24
|
/*__reshadow_css_start__*/
|
|
22
25
|
(sstyled.insert(
|
|
23
26
|
/*__inner_css_start__*/
|
|
24
|
-
".
|
|
27
|
+
".___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%)}",
|
|
25
28
|
/*__inner_css_end__*/
|
|
26
|
-
"
|
|
29
|
+
"q0c8m_gg_"
|
|
27
30
|
), /*__reshadow_css_end__*/
|
|
28
31
|
{
|
|
29
|
-
"__SPagination": "
|
|
30
|
-
"__SLabel": "
|
|
31
|
-
"_size_l": "
|
|
32
|
-
"__STotalPages": "
|
|
33
|
-
"__STotalPagesLabel": "
|
|
34
|
-
"__SPageInput": "
|
|
35
|
-
"__SPageInputAddon": "
|
|
36
|
-
"_withGap": "
|
|
37
|
-
"__SNextPage": "
|
|
38
|
-
"__SPrevPage": "
|
|
39
|
-
"__STotalLastPages": "
|
|
32
|
+
"__SPagination": "___SPagination_q0c8m_gg_",
|
|
33
|
+
"__SLabel": "___SLabel_q0c8m_gg_",
|
|
34
|
+
"_size_l": "_size_l_q0c8m_gg_",
|
|
35
|
+
"__STotalPages": "___STotalPages_q0c8m_gg_",
|
|
36
|
+
"__STotalPagesLabel": "___STotalPagesLabel_q0c8m_gg_",
|
|
37
|
+
"__SPageInput": "___SPageInput_q0c8m_gg_",
|
|
38
|
+
"__SPageInputAddon": "___SPageInputAddon_q0c8m_gg_",
|
|
39
|
+
"_withGap": "__withGap_q0c8m_gg_",
|
|
40
|
+
"__SNextPage": "___SNextPage_q0c8m_gg_",
|
|
41
|
+
"__SPrevPage": "___SPrevPage_q0c8m_gg_",
|
|
42
|
+
"__STotalLastPages": "___STotalLastPages_q0c8m_gg_"
|
|
40
43
|
})
|
|
41
44
|
);
|
|
42
|
-
var PaginationRoot = /* @__PURE__ */
|
|
45
|
+
var PaginationRoot = /* @__PURE__ */ function(_Component) {
|
|
46
|
+
_inherits(PaginationRoot2, _Component);
|
|
47
|
+
var _super = _createSuper(PaginationRoot2);
|
|
43
48
|
function PaginationRoot2() {
|
|
44
49
|
var _this;
|
|
45
50
|
_classCallCheck(this, PaginationRoot2);
|
|
46
51
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
52
|
args[_key] = arguments[_key];
|
|
48
53
|
}
|
|
49
|
-
_this =
|
|
50
|
-
_defineProperty(_this, "nextPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
51
|
-
_defineProperty(_this, "prevPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
52
|
-
_defineProperty(_this, "state", {
|
|
54
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "nextPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "prevPageButtonRef", /* @__PURE__ */ React.createRef());
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
53
58
|
// Crutch, so as not to take out `dirtyCurrentPage` in props
|
|
54
59
|
dirtyCurrentPage: void 0
|
|
55
60
|
});
|
|
56
|
-
_defineProperty(_this, "pageInputAddonRef", /* @__PURE__ */ React.createRef());
|
|
57
|
-
_defineProperty(_this, "
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "pageInputAddonRef", /* @__PURE__ */ React.createRef());
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "returnLostFocus", function() {
|
|
63
|
+
setTimeout(function() {
|
|
64
|
+
if (document.activeElement !== document.body) return;
|
|
65
|
+
var prevPageButton = _this.prevPageButtonRef.current;
|
|
66
|
+
var nextPageButton = _this.nextPageButtonRef.current;
|
|
67
|
+
if (prevPageButton && !prevPageButton.disabled) {
|
|
68
|
+
prevPageButton.focus();
|
|
69
|
+
} else if (nextPageButton && !nextPageButton.disabled) {
|
|
70
|
+
nextPageButton.focus();
|
|
71
|
+
}
|
|
72
|
+
}, 0);
|
|
62
73
|
});
|
|
63
|
-
_defineProperty(_this, "handlePageChange", function(currentPage) {
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageChange", function(currentPage) {
|
|
64
75
|
currentPage = Number(currentPage);
|
|
65
76
|
if (Number.isNaN(currentPage)) {
|
|
66
77
|
return;
|
|
@@ -69,8 +80,9 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
69
80
|
_this.setState({
|
|
70
81
|
dirtyCurrentPage: void 0
|
|
71
82
|
});
|
|
83
|
+
_this.returnLostFocus();
|
|
72
84
|
});
|
|
73
|
-
_defineProperty(_this, "handlePageValueChange", function(value) {
|
|
85
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageValueChange", function(value) {
|
|
74
86
|
var dirtyCurrentPage = _this.state.dirtyCurrentPage;
|
|
75
87
|
if (Number.isNaN(Number(value))) {
|
|
76
88
|
value = dirtyCurrentPage;
|
|
@@ -79,7 +91,7 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
79
91
|
dirtyCurrentPage: value
|
|
80
92
|
});
|
|
81
93
|
});
|
|
82
|
-
_defineProperty(_this, "handlePageValueBlur", function() {
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageValueBlur", function() {
|
|
83
95
|
setTimeout(function() {
|
|
84
96
|
if (_this.pageInputAddonRef.current !== document.activeElement) {
|
|
85
97
|
var currentPage = _this.asProps.currentPage;
|
|
@@ -89,82 +101,77 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
89
101
|
}
|
|
90
102
|
}, 0);
|
|
91
103
|
});
|
|
92
|
-
_defineProperty(_this, "getDirtyCurrentPage", function() {
|
|
104
|
+
_defineProperty(_assertThisInitialized(_this), "getDirtyCurrentPage", function() {
|
|
93
105
|
var dirtyCurrentPage = _this.state.dirtyCurrentPage;
|
|
94
106
|
var totalPages = _this.asProps.totalPages;
|
|
95
107
|
var finalValue = dirtyCurrentPage > totalPages ? totalPages : dirtyCurrentPage;
|
|
96
108
|
return finalValue <= 0 ? 1 : finalValue;
|
|
97
109
|
});
|
|
98
|
-
_defineProperty(_this, "
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageInputIconClick", function() {
|
|
111
|
+
var dirtyCurrentPage = _this.getDirtyCurrentPage();
|
|
112
|
+
_this.handlePageChange(dirtyCurrentPage);
|
|
113
|
+
});
|
|
114
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageInputKeyDown", function(event) {
|
|
99
115
|
if (event.key !== "Enter") return;
|
|
100
116
|
var dirtyCurrentPage = _this.getDirtyCurrentPage();
|
|
101
117
|
_this.handlePageChange(dirtyCurrentPage);
|
|
102
118
|
});
|
|
103
|
-
_defineProperty(_this, "getFirstPageProps", function() {
|
|
119
|
+
_defineProperty(_assertThisInitialized(_this), "getFirstPageProps", function() {
|
|
104
120
|
var _this$asProps = _this.asProps, currentPage = _this$asProps.currentPage, getI18nText = _this$asProps.getI18nText, size = _this$asProps.size;
|
|
105
121
|
var disabled = currentPage <= 1;
|
|
106
122
|
return {
|
|
107
123
|
disabled,
|
|
108
124
|
onClick: function onClick() {
|
|
109
|
-
_this.handlePageChange(1);
|
|
110
|
-
_this.returnLostFocusTo(_this.nextPageButtonRef);
|
|
125
|
+
return _this.handlePageChange(1);
|
|
111
126
|
},
|
|
112
127
|
getI18nText,
|
|
113
128
|
size
|
|
114
129
|
};
|
|
115
130
|
});
|
|
116
|
-
_defineProperty(_this, "getPrevPageProps", function() {
|
|
131
|
+
_defineProperty(_assertThisInitialized(_this), "getPrevPageProps", function() {
|
|
117
132
|
var _this$asProps2 = _this.asProps, currentPage = _this$asProps2.currentPage, getI18nText = _this$asProps2.getI18nText, size = _this$asProps2.size;
|
|
118
133
|
var disabled = currentPage <= 1;
|
|
119
134
|
return {
|
|
120
135
|
currentPage,
|
|
121
136
|
disabled,
|
|
122
137
|
onClick: function onClick() {
|
|
123
|
-
|
|
124
|
-
_this.handlePageChange(followingPage);
|
|
125
|
-
if (followingPage <= 1) {
|
|
126
|
-
_this.returnLostFocusTo(_this.nextPageButtonRef);
|
|
127
|
-
}
|
|
138
|
+
return _this.handlePageChange(currentPage - 1);
|
|
128
139
|
},
|
|
129
140
|
getI18nText,
|
|
130
|
-
ref: _this.
|
|
141
|
+
ref: _this.nextPageButtonRef,
|
|
131
142
|
size
|
|
132
143
|
};
|
|
133
144
|
});
|
|
134
|
-
_defineProperty(_this, "getNextPageProps", function() {
|
|
145
|
+
_defineProperty(_assertThisInitialized(_this), "getNextPageProps", function() {
|
|
135
146
|
var _this$asProps3 = _this.asProps, currentPage = _this$asProps3.currentPage, totalPages = _this$asProps3.totalPages, getI18nText = _this$asProps3.getI18nText, size = _this$asProps3.size;
|
|
136
|
-
var disabled = currentPage
|
|
147
|
+
var disabled = !(currentPage < totalPages);
|
|
137
148
|
return {
|
|
138
149
|
currentPage,
|
|
139
150
|
disabled,
|
|
140
151
|
onClick: function onClick() {
|
|
141
|
-
|
|
142
|
-
_this.handlePageChange(followingPage);
|
|
143
|
-
if (followingPage >= totalPages) {
|
|
144
|
-
_this.returnLostFocusTo(_this.prevPageButtonRef);
|
|
145
|
-
}
|
|
152
|
+
return _this.handlePageChange(currentPage + 1);
|
|
146
153
|
},
|
|
147
154
|
getI18nText,
|
|
148
|
-
ref: _this.
|
|
155
|
+
ref: _this.prevPageButtonRef,
|
|
149
156
|
size
|
|
150
157
|
};
|
|
151
158
|
});
|
|
152
|
-
_defineProperty(_this, "getPageInputProps", function() {
|
|
159
|
+
_defineProperty(_assertThisInitialized(_this), "getPageInputProps", function() {
|
|
153
160
|
var _this$asProps4 = _this.asProps, getI18nText = _this$asProps4.getI18nText, locale = _this$asProps4.locale, size = _this$asProps4.size;
|
|
154
161
|
return {
|
|
155
162
|
getI18nText,
|
|
156
163
|
locale,
|
|
157
|
-
size
|
|
158
|
-
paginationInputId: _this.paginationInputId
|
|
164
|
+
size
|
|
159
165
|
};
|
|
160
166
|
});
|
|
161
|
-
_defineProperty(_this, "getPageInputAddonProps", function() {
|
|
167
|
+
_defineProperty(_assertThisInitialized(_this), "getPageInputAddonProps", function() {
|
|
162
168
|
return {
|
|
169
|
+
onClick: _this.handlePageInputIconClick,
|
|
163
170
|
ref: _this.pageInputAddonRef,
|
|
164
171
|
onBlur: _this.handlePageValueBlur
|
|
165
172
|
};
|
|
166
173
|
});
|
|
167
|
-
_defineProperty(_this, "getPageInputValueProps", function() {
|
|
174
|
+
_defineProperty(_assertThisInitialized(_this), "getPageInputValueProps", function() {
|
|
168
175
|
var dirtyCurrentPage = _this.state.dirtyCurrentPage;
|
|
169
176
|
var _this$asProps5 = _this.asProps, currentPage = _this$asProps5.currentPage, totalPages = _this$asProps5.totalPages, getI18nText = _this$asProps5.getI18nText, size = _this$asProps5.size;
|
|
170
177
|
return {
|
|
@@ -176,11 +183,10 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
176
183
|
onChange: _this.handlePageValueChange,
|
|
177
184
|
onKeyDown: _this.handlePageInputKeyDown,
|
|
178
185
|
getI18nText,
|
|
179
|
-
size
|
|
180
|
-
id: _this.paginationInputId
|
|
186
|
+
size
|
|
181
187
|
};
|
|
182
188
|
});
|
|
183
|
-
_defineProperty(_this, "getTotalPagesProps", function() {
|
|
189
|
+
_defineProperty(_assertThisInitialized(_this), "getTotalPagesProps", function() {
|
|
184
190
|
var _this$asProps6 = _this.asProps, currentPage = _this$asProps6.currentPage, totalPages = _this$asProps6.totalPages, getI18nText = _this$asProps6.getI18nText, locale = _this$asProps6.locale, size = _this$asProps6.size;
|
|
185
191
|
var formatter = new Intl.NumberFormat(locale, {
|
|
186
192
|
style: "decimal"
|
|
@@ -190,8 +196,7 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
190
196
|
children: formatter.format(totalPages),
|
|
191
197
|
isLastOrSingle: currentPage === totalPages,
|
|
192
198
|
onClick: function onClick() {
|
|
193
|
-
_this.handlePageChange(totalPages);
|
|
194
|
-
_this.returnLostFocusTo(_this.prevPageButtonRef);
|
|
199
|
+
return _this.handlePageChange(totalPages);
|
|
195
200
|
},
|
|
196
201
|
getI18nText,
|
|
197
202
|
size
|
|
@@ -199,8 +204,7 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
199
204
|
});
|
|
200
205
|
return _this;
|
|
201
206
|
}
|
|
202
|
-
|
|
203
|
-
return _createClass(PaginationRoot2, [{
|
|
207
|
+
_createClass(PaginationRoot2, [{
|
|
204
208
|
key: "uncontrolledProps",
|
|
205
209
|
value: function uncontrolledProps() {
|
|
206
210
|
return {
|
|
@@ -217,19 +221,13 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
217
221
|
});
|
|
218
222
|
}
|
|
219
223
|
}
|
|
220
|
-
}, {
|
|
221
|
-
key: "paginationInputId",
|
|
222
|
-
get: function get() {
|
|
223
|
-
var uid = this.asProps.uid;
|
|
224
|
-
return "pagination-input-".concat(uid);
|
|
225
|
-
}
|
|
226
224
|
}, {
|
|
227
225
|
key: "render",
|
|
228
226
|
value: function render() {
|
|
229
227
|
var _ref = this.asProps, _ref9;
|
|
230
228
|
var SPagination = Flex;
|
|
231
229
|
var _this$asProps7 = this.asProps, Children = _this$asProps7.Children, hasChildren = _this$asProps7.children, getI18nText = _this$asProps7.getI18nText, currentPage = _this$asProps7.currentPage, _this$asProps7$totalP = _this$asProps7.totalPages, totalPages = _this$asProps7$totalP === void 0 ? 1 : _this$asProps7$totalP;
|
|
232
|
-
return _ref9 = sstyled(this.asProps.styles), /* @__PURE__ */ React.createElement(SPagination, _ref9.cn("SPagination", _objectSpread({}, assignProps({
|
|
230
|
+
return _ref9 = sstyled$1(this.asProps.styles), /* @__PURE__ */ React.createElement(SPagination, _ref9.cn("SPagination", _objectSpread({}, assignProps({
|
|
233
231
|
"flexWrap": "wrap",
|
|
234
232
|
"withGap": !hasChildren,
|
|
235
233
|
"tag": "nav",
|
|
@@ -242,7 +240,8 @@ var PaginationRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
242
240
|
}), getI18nText("pageInputLabel"), " ", currentPage));
|
|
243
241
|
}
|
|
244
242
|
}]);
|
|
245
|
-
|
|
243
|
+
return PaginationRoot2;
|
|
244
|
+
}(Component);
|
|
246
245
|
_defineProperty(PaginationRoot, "displayName", "Pagination");
|
|
247
246
|
_defineProperty(PaginationRoot, "defaultProps", function() {
|
|
248
247
|
return {
|
|
@@ -254,149 +253,158 @@ _defineProperty(PaginationRoot, "defaultProps", function() {
|
|
|
254
253
|
};
|
|
255
254
|
});
|
|
256
255
|
_defineProperty(PaginationRoot, "style", style);
|
|
257
|
-
_defineProperty(PaginationRoot, "enhance", [i18nEnhance(localizedMessages)
|
|
258
|
-
var FirstPage = /* @__PURE__ */
|
|
256
|
+
_defineProperty(PaginationRoot, "enhance", [i18nEnhance(localizedMessages)]);
|
|
257
|
+
var FirstPage = /* @__PURE__ */ function(_Component2) {
|
|
258
|
+
_inherits(FirstPage2, _Component2);
|
|
259
|
+
var _super2 = _createSuper(FirstPage2);
|
|
259
260
|
function FirstPage2() {
|
|
260
|
-
var _this2;
|
|
261
261
|
_classCallCheck(this, FirstPage2);
|
|
262
|
-
|
|
263
|
-
args[_key2] = arguments[_key2];
|
|
264
|
-
}
|
|
265
|
-
_this2 = _callSuper(this, FirstPage2, [].concat(args));
|
|
266
|
-
_defineProperty(_this2, "buttonRef", /* @__PURE__ */ React.createRef());
|
|
267
|
-
return _this2;
|
|
262
|
+
return _super2.apply(this, arguments);
|
|
268
263
|
}
|
|
269
|
-
|
|
270
|
-
return _createClass(FirstPage2, [{
|
|
264
|
+
_createClass(FirstPage2, [{
|
|
271
265
|
key: "render",
|
|
272
266
|
value: function render() {
|
|
273
267
|
var _ref2 = this.asProps;
|
|
274
|
-
var
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
"aria-label": getI18nText("firstPage"),
|
|
279
|
-
"ref": this.buttonRef
|
|
280
|
-
}, _ref2), isAdvanced ? /* @__PURE__ */ React.createElement(Children, null) : /* @__PURE__ */ React.createElement(Button.Addon, {
|
|
281
|
-
tag: ChevronDoubleLeft
|
|
282
|
-
})), !isAdvanced && /* @__PURE__ */ React.createElement(Hint, {
|
|
283
|
-
triggerRef: this.buttonRef,
|
|
284
|
-
timeout: [250, 50]
|
|
285
|
-
}, hintContent));
|
|
268
|
+
var getI18nText = this.asProps.getI18nText;
|
|
269
|
+
return /* @__PURE__ */ React.createElement(Button, assignProps({
|
|
270
|
+
"aria-label": getI18nText("firstPage")
|
|
271
|
+
}, _ref2));
|
|
286
272
|
}
|
|
287
273
|
}]);
|
|
288
|
-
|
|
289
|
-
|
|
274
|
+
return FirstPage2;
|
|
275
|
+
}(Component);
|
|
276
|
+
_defineProperty(FirstPage, "defaultProps", function(props) {
|
|
277
|
+
var hintContent = props.getI18nText("firstPage");
|
|
278
|
+
return {
|
|
279
|
+
children: /* @__PURE__ */ React.createElement(Button.Addon, {
|
|
280
|
+
tag: Hint,
|
|
281
|
+
title: hintContent,
|
|
282
|
+
timeout: [250, 50],
|
|
283
|
+
__excludeProps: ["aria-label"]
|
|
284
|
+
}, /* @__PURE__ */ React.createElement(ChevronDoubleLeft, null))
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
var PrevPage = /* @__PURE__ */ function(_Component3) {
|
|
288
|
+
_inherits(PrevPage2, _Component3);
|
|
289
|
+
var _super3 = _createSuper(PrevPage2);
|
|
290
290
|
function PrevPage2() {
|
|
291
291
|
_classCallCheck(this, PrevPage2);
|
|
292
|
-
return
|
|
292
|
+
return _super3.apply(this, arguments);
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
return _createClass(PrevPage2, [{
|
|
294
|
+
_createClass(PrevPage2, [{
|
|
296
295
|
key: "render",
|
|
297
296
|
value: function render() {
|
|
298
|
-
var _ref3 = this.asProps,
|
|
297
|
+
var _ref3 = this.asProps, _ref10;
|
|
299
298
|
var SPrevPage = Button;
|
|
300
|
-
return
|
|
299
|
+
return _ref10 = sstyled$1(this.asProps.styles), /* @__PURE__ */ React.createElement(SPrevPage, _ref10.cn("SPrevPage", _objectSpread({}, assignProps({}, _ref3))));
|
|
301
300
|
}
|
|
302
301
|
}]);
|
|
303
|
-
|
|
302
|
+
return PrevPage2;
|
|
303
|
+
}(Component);
|
|
304
304
|
_defineProperty(PrevPage, "defaultProps", function(props) {
|
|
305
305
|
return {
|
|
306
306
|
children: props.getI18nText("prevPageLabel")
|
|
307
307
|
};
|
|
308
308
|
});
|
|
309
|
-
var NextPage = /* @__PURE__ */
|
|
309
|
+
var NextPage = /* @__PURE__ */ function(_Component4) {
|
|
310
|
+
_inherits(NextPage2, _Component4);
|
|
311
|
+
var _super4 = _createSuper(NextPage2);
|
|
310
312
|
function NextPage2() {
|
|
311
313
|
_classCallCheck(this, NextPage2);
|
|
312
|
-
return
|
|
314
|
+
return _super4.apply(this, arguments);
|
|
313
315
|
}
|
|
314
|
-
|
|
315
|
-
return _createClass(NextPage2, [{
|
|
316
|
+
_createClass(NextPage2, [{
|
|
316
317
|
key: "render",
|
|
317
318
|
value: function render() {
|
|
318
|
-
var _ref4 = this.asProps,
|
|
319
|
+
var _ref4 = this.asProps, _ref11;
|
|
319
320
|
var SNextPage = Button;
|
|
320
|
-
return
|
|
321
|
+
return _ref11 = sstyled$1(this.asProps.styles), /* @__PURE__ */ React.createElement(SNextPage, _ref11.cn("SNextPage", _objectSpread({}, assignProps({
|
|
321
322
|
"use": "primary",
|
|
322
323
|
"theme": "info"
|
|
323
324
|
}, _ref4))));
|
|
324
325
|
}
|
|
325
326
|
}]);
|
|
326
|
-
|
|
327
|
+
return NextPage2;
|
|
328
|
+
}(Component);
|
|
327
329
|
_defineProperty(NextPage, "defaultProps", function(props) {
|
|
328
330
|
return {
|
|
329
331
|
children: props.getI18nText("nextPageLabel")
|
|
330
332
|
};
|
|
331
333
|
});
|
|
332
|
-
var TotalPages = /* @__PURE__ */
|
|
334
|
+
var TotalPages = /* @__PURE__ */ function(_Component5) {
|
|
335
|
+
_inherits(TotalPages2, _Component5);
|
|
336
|
+
var _super5 = _createSuper(TotalPages2);
|
|
333
337
|
function TotalPages2() {
|
|
334
338
|
_classCallCheck(this, TotalPages2);
|
|
335
|
-
return
|
|
339
|
+
return _super5.apply(this, arguments);
|
|
336
340
|
}
|
|
337
|
-
|
|
338
|
-
return _createClass(TotalPages2, [{
|
|
341
|
+
_createClass(TotalPages2, [{
|
|
339
342
|
key: "render",
|
|
340
343
|
value: function render() {
|
|
341
|
-
var _ref5 = this.asProps,
|
|
344
|
+
var _ref5 = this.asProps, _ref12;
|
|
342
345
|
var STotalPages = ButtonLink;
|
|
343
346
|
var STotalPagesLabel = Text;
|
|
344
347
|
var STotalLastPages = Text;
|
|
345
|
-
var _this$
|
|
348
|
+
var _this$asProps8 = this.asProps, styles = _this$asProps8.styles, getI18nText = _this$asProps8.getI18nText, totalPages = _this$asProps8.totalPages, isLastOrSingle = _this$asProps8.isLastOrSingle, children = _this$asProps8.children, other = _objectWithoutProperties(_this$asProps8, _excluded);
|
|
346
349
|
var textSize = other.size === "l" ? "300" : "200";
|
|
347
|
-
return
|
|
350
|
+
return _ref12 = sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(STotalPagesLabel, _ref12.cn("STotalPagesLabel", {
|
|
348
351
|
"size": textSize
|
|
349
|
-
}), getI18nText("totalPagesLabel")), isLastOrSingle ? /* @__PURE__ */ React.createElement(STotalLastPages,
|
|
352
|
+
}), getI18nText("totalPagesLabel")), isLastOrSingle ? /* @__PURE__ */ React.createElement(STotalLastPages, _ref12.cn("STotalLastPages", _objectSpread({
|
|
350
353
|
"size": textSize,
|
|
351
354
|
"aria-label": getI18nText("lastPage", {
|
|
352
355
|
lastPageNumber: totalPages
|
|
353
356
|
})
|
|
354
|
-
}, other)), children) : /* @__PURE__ */ React.createElement(STotalPages,
|
|
357
|
+
}, other)), children) : /* @__PURE__ */ React.createElement(STotalPages, _ref12.cn("STotalPages", _objectSpread({}, assignProps({
|
|
355
358
|
"aria-label": getI18nText("lastPage", {
|
|
356
359
|
lastPageNumber: totalPages
|
|
357
360
|
})
|
|
358
361
|
}, _ref5)))));
|
|
359
362
|
}
|
|
360
363
|
}]);
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
+
return TotalPages2;
|
|
365
|
+
}(Component);
|
|
366
|
+
var PageInputValue = function PageInputValue2(props) {
|
|
367
|
+
var _ref6 = arguments[0], _ref13;
|
|
364
368
|
var SPageInputValue = InputNumber.Value;
|
|
365
|
-
return
|
|
369
|
+
return _ref13 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SPageInputValue, _ref13.cn("SPageInputValue", _objectSpread({}, assignProps({
|
|
366
370
|
"onBlur": function onBlur() {
|
|
367
371
|
return false;
|
|
368
372
|
}
|
|
369
373
|
}, _ref6))));
|
|
370
|
-
}
|
|
371
|
-
function
|
|
372
|
-
var _ref7 = arguments[0],
|
|
374
|
+
};
|
|
375
|
+
var PageInputAddon = function PageInputAddon2(props) {
|
|
376
|
+
var _ref7 = arguments[0], _ref14;
|
|
373
377
|
var SPageInputAddon = InputNumber.Addon;
|
|
374
|
-
return
|
|
375
|
-
}
|
|
376
|
-
var PageInput = /* @__PURE__ */
|
|
378
|
+
return _ref14 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SPageInputAddon, _ref14.cn("SPageInputAddon", _objectSpread({}, assignProps({}, _ref7))));
|
|
379
|
+
};
|
|
380
|
+
var PageInput = /* @__PURE__ */ function(_Component6) {
|
|
381
|
+
_inherits(PageInput2, _Component6);
|
|
382
|
+
var _super6 = _createSuper(PageInput2);
|
|
377
383
|
function PageInput2() {
|
|
378
384
|
_classCallCheck(this, PageInput2);
|
|
379
|
-
return
|
|
385
|
+
return _super6.apply(this, arguments);
|
|
380
386
|
}
|
|
381
|
-
|
|
382
|
-
return _createClass(PageInput2, [{
|
|
387
|
+
_createClass(PageInput2, [{
|
|
383
388
|
key: "render",
|
|
384
389
|
value: function render() {
|
|
385
|
-
var _ref8 = this.asProps,
|
|
390
|
+
var _ref8 = this.asProps, _ref15;
|
|
386
391
|
var SPageInput = InputNumber;
|
|
387
392
|
var SLabel = Text;
|
|
388
|
-
var _this$
|
|
389
|
-
return
|
|
393
|
+
var _this$asProps9 = this.asProps, Children = _this$asProps9.Children, getI18nText = _this$asProps9.getI18nText, styles = _this$asProps9.styles, uid = _this$asProps9.uid, locale = _this$asProps9.locale, size = _this$asProps9.size;
|
|
394
|
+
return _ref15 = sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SLabel, _ref15.cn("SLabel", {
|
|
390
395
|
"tag": "label",
|
|
391
|
-
"htmlFor":
|
|
396
|
+
"htmlFor": "pagination-input-".concat(uid),
|
|
392
397
|
"size": size
|
|
393
|
-
}), getI18nText("pageInputLabel")), /* @__PURE__ */ React.createElement(SPageInput,
|
|
398
|
+
}), getI18nText("pageInputLabel")), /* @__PURE__ */ React.createElement(SPageInput, _ref15.cn("SPageInput", _objectSpread({}, assignProps({
|
|
394
399
|
"controlsLength": Children.origin ? void 0 : 2,
|
|
395
400
|
"locale": locale
|
|
396
|
-
}, _ref8))), Children.origin ? /* @__PURE__ */ React.createElement(Children,
|
|
401
|
+
}, _ref8))), Children.origin ? /* @__PURE__ */ React.createElement(Children, _ref15.cn("Children", {})) : /* @__PURE__ */ React.createElement(Pagination.PageInput.Value, {
|
|
402
|
+
id: "pagination-input-".concat(uid)
|
|
403
|
+
})));
|
|
397
404
|
}
|
|
398
405
|
}]);
|
|
399
|
-
|
|
406
|
+
return PageInput2;
|
|
407
|
+
}(Component);
|
|
400
408
|
_defineProperty(PageInput, "enhance", [uniqueIDEnhancement()]);
|
|
401
409
|
var Pagination = createComponent(PaginationRoot, {
|
|
402
410
|
PrevPage,
|
|
@@ -6,13 +6,13 @@ import it from "./it.json.mjs";
|
|
|
6
6
|
import ja from "./ja.json.mjs";
|
|
7
7
|
import ko from "./ko.json.mjs";
|
|
8
8
|
import nl from "./nl.json.mjs";
|
|
9
|
-
import pl from "./pl.json.mjs";
|
|
10
9
|
import pt from "./pt.json.mjs";
|
|
11
10
|
import ru from "./ru.json.mjs";
|
|
12
|
-
import sv from "./sv.json.mjs";
|
|
13
11
|
import tr from "./tr.json.mjs";
|
|
14
12
|
import vi from "./vi.json.mjs";
|
|
15
13
|
import zh from "./zh.json.mjs";
|
|
14
|
+
import pl from "./pl.json.mjs";
|
|
15
|
+
import sv from "./sv.json.mjs";
|
|
16
16
|
var localizedMessages = {
|
|
17
17
|
de,
|
|
18
18
|
en,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import type { NSText } from '@semcore/typography';
|
|
1
|
+
import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
|
|
2
|
+
import { BoxProps } from '@semcore/flex-box';
|
|
3
|
+
import Input, { InputProps } from '@semcore/input';
|
|
4
|
+
import { TextProps } from '@semcore/typography';
|
|
5
|
+
import Button from '@semcore/button';
|
|
6
|
+
import { WithI18nEnhanceProps } from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
8
7
|
|
|
8
|
+
/** @deprecated */
|
|
9
|
+
export interface IPaginationProps extends PaginationProps, UnknownProperties {}
|
|
9
10
|
export type PaginationProps = BoxProps &
|
|
10
11
|
WithI18nEnhanceProps & {
|
|
11
12
|
/**
|
|
@@ -23,7 +24,6 @@ export type PaginationProps = BoxProps &
|
|
|
23
24
|
* @param pageNumber
|
|
24
25
|
*/
|
|
25
26
|
onCurrentPageChange?: (pageNumber: number) => void;
|
|
26
|
-
/** Specifies the locale for i18n support */
|
|
27
27
|
locale?: string;
|
|
28
28
|
/**
|
|
29
29
|
* Sizes for pagination panel
|
|
@@ -32,10 +32,16 @@ export type PaginationProps = BoxProps &
|
|
|
32
32
|
size?: 'm' | 'l';
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
/** @deprecated */
|
|
36
|
+
export interface ITotalPagesProps extends TotalPagesProps, UnknownProperties {}
|
|
37
|
+
export type TotalPagesProps = TextProps & WithI18nEnhanceProps & {};
|
|
36
38
|
|
|
39
|
+
/** @deprecated */
|
|
40
|
+
export interface IPageInputProps extends PageInputProps, UnknownProperties {}
|
|
37
41
|
export type PageInputProps = InputProps & WithI18nEnhanceProps & {};
|
|
38
42
|
|
|
43
|
+
/** @deprecated */
|
|
44
|
+
export interface IPaginationContext extends PaginationContext, UnknownProperties {}
|
|
39
45
|
export type PaginationContext = {
|
|
40
46
|
getFirstPageProps: PropGetterFn;
|
|
41
47
|
getPrevPageProps: PropGetterFn;
|
|
@@ -44,6 +50,8 @@ export type PaginationContext = {
|
|
|
44
50
|
getTotalPagesProps: PropGetterFn;
|
|
45
51
|
};
|
|
46
52
|
|
|
53
|
+
/** @deprecated */
|
|
54
|
+
export interface IPaginationHandlers extends PaginationHandlers, UnknownProperties {}
|
|
47
55
|
export type PaginationHandlers = {
|
|
48
56
|
totalPages: (value: number) => void;
|
|
49
57
|
currentPage: (value: number) => void;
|
|
@@ -66,7 +74,6 @@ declare const Pagination: Intergalactic.Component<
|
|
|
66
74
|
>;
|
|
67
75
|
PageInput: Intergalactic.Component<'div', PageInputProps, {}, [handlers: PaginationHandlers]> & {
|
|
68
76
|
Value: typeof Input.Value;
|
|
69
|
-
Addon: typeof Input.Addon;
|
|
70
77
|
};
|
|
71
78
|
};
|
|
72
79
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/pagination",
|
|
3
3
|
"description": "Semrush Pagination Component",
|
|
4
|
-
"version": "4.53.0-prerelease.
|
|
4
|
+
"version": "4.53.0-prerelease.7",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/input": "4.43.0-prerelease.
|
|
18
|
-
"@semcore/button": "5.44.0-prerelease.
|
|
19
|
-
"@semcore/flex-box": "5.42.0-prerelease.
|
|
20
|
-
"@semcore/icon": "4.63.0-prerelease.
|
|
21
|
-
"@semcore/input-number": "5.42.0-prerelease.
|
|
22
|
-
"@semcore/link": "5.45.0-prerelease.
|
|
23
|
-
"@semcore/tooltip": "6.50.0-prerelease.
|
|
24
|
-
"@semcore/typography": "5.54.0-prerelease.
|
|
25
|
-
"@semcore/utils": "4.49.0-prerelease.
|
|
17
|
+
"@semcore/input": "4.43.0-prerelease.7",
|
|
18
|
+
"@semcore/button": "5.44.0-prerelease.7",
|
|
19
|
+
"@semcore/flex-box": "5.42.0-prerelease.7",
|
|
20
|
+
"@semcore/icon": "4.63.0-prerelease.7",
|
|
21
|
+
"@semcore/input-number": "5.42.0-prerelease.7",
|
|
22
|
+
"@semcore/link": "5.45.0-prerelease.7",
|
|
23
|
+
"@semcore/tooltip": "6.50.0-prerelease.7",
|
|
24
|
+
"@semcore/typography": "5.54.0-prerelease.7",
|
|
25
|
+
"@semcore/utils": "4.49.0-prerelease.7"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@semcore/core": "^2.40.0-prerelease.
|
|
28
|
+
"@semcore/core": "^2.40.0-prerelease.7",
|
|
29
29
|
"react": "16.8 - 18",
|
|
30
30
|
"react-dom": "16.8 - 18"
|
|
31
31
|
},
|