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