@semcore/pagination 16.1.12 → 17.0.0-prerelease.17

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