@uncinc/uncinc-react-kitchen-sink 2.20.2 → 2.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -296,7 +296,10 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
296
296
|
// This function renders the different options of checkboxes,
|
|
297
297
|
// allowing us to add more checkboxes eventually.
|
|
298
298
|
var renderChoices = function renderChoices() {
|
|
299
|
-
return /*#__PURE__*/React.createElement(
|
|
299
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
300
|
+
className: "GoogleConsentCookieBanner__choices",
|
|
301
|
+
"aria-labelledby": "cookie-banner-title"
|
|
302
|
+
}, cookieLevels.map(function (choice) {
|
|
300
303
|
return /*#__PURE__*/React.createElement("div", {
|
|
301
304
|
className: "GoogleConsentCookieBanner__category",
|
|
302
305
|
key: choice.value
|
|
@@ -336,7 +339,9 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
336
339
|
className: "row"
|
|
337
340
|
}, /*#__PURE__*/React.createElement("div", {
|
|
338
341
|
className: "col-12 GoogleConsentCookieBanner__content_header"
|
|
339
|
-
}, title && /*#__PURE__*/React.createElement("h3",
|
|
342
|
+
}, title && /*#__PURE__*/React.createElement("h3", {
|
|
343
|
+
id: "cookie-banner-title"
|
|
344
|
+
}, title), /*#__PURE__*/React.createElement("button", {
|
|
340
345
|
type: "button",
|
|
341
346
|
className: "GoogleConsentCookieBanner__close-button",
|
|
342
347
|
"aria-label": t('general.close', 'Close'),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export function Pagination({ currentPage, totalPages, pageRangeDisplayed, marginPagesDisplayed, setCurrentPage, previousLabel, nextLabel, containerClassName, disabledClassName, activeClassName, breakClassName, showWhenOnePage, controlled, scrollToTop, scrollToTopOffset, scrollToTopBehavior, }: {
|
|
1
|
+
export function Pagination({ currentPage, totalPages, pageRangeDisplayed, pageRangeDisplayedPerViewPort, marginPagesDisplayed, setCurrentPage, previousLabel, nextLabel, containerClassName, disabledClassName, activeClassName, breakClassName, showWhenOnePage, controlled, scrollToTop, scrollToTopOffset, scrollToTopBehavior, }: {
|
|
2
2
|
currentPage: any;
|
|
3
3
|
totalPages: any;
|
|
4
4
|
pageRangeDisplayed: any;
|
|
5
|
+
pageRangeDisplayedPerViewPort: any;
|
|
5
6
|
marginPagesDisplayed: any;
|
|
6
7
|
setCurrentPage: any;
|
|
7
8
|
previousLabel: any;
|
|
@@ -21,6 +22,13 @@ export namespace Pagination {
|
|
|
21
22
|
let currentPage: PropTypes.Validator<number>;
|
|
22
23
|
let totalPages: PropTypes.Validator<number>;
|
|
23
24
|
let pageRangeDisplayed: PropTypes.Requireable<number>;
|
|
25
|
+
let pageRangeDisplayedPerViewPort: PropTypes.Requireable<Required<PropTypes.InferProps<{
|
|
26
|
+
xs: PropTypes.Requireable<number>;
|
|
27
|
+
sm: PropTypes.Requireable<number>;
|
|
28
|
+
md: PropTypes.Requireable<number>;
|
|
29
|
+
lg: PropTypes.Requireable<number>;
|
|
30
|
+
xl: PropTypes.Requireable<number>;
|
|
31
|
+
}>>>;
|
|
24
32
|
let marginPagesDisplayed: PropTypes.Requireable<number>;
|
|
25
33
|
let setCurrentPage: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
34
|
let previousLabel: PropTypes.Requireable<string>;
|
|
@@ -35,6 +43,18 @@ export namespace Pagination {
|
|
|
35
43
|
let scrollToTopBehavior: PropTypes.Requireable<string>;
|
|
36
44
|
}
|
|
37
45
|
namespace defaultProps {
|
|
46
|
+
let pageRangeDisplayed_1: number;
|
|
47
|
+
export { pageRangeDisplayed_1 as pageRangeDisplayed };
|
|
48
|
+
export namespace pageRangeDisplayedPerViewPort_1 {
|
|
49
|
+
let xs: number;
|
|
50
|
+
let sm: number;
|
|
51
|
+
let md: number;
|
|
52
|
+
let lg: number;
|
|
53
|
+
let xl: number;
|
|
54
|
+
}
|
|
55
|
+
export { pageRangeDisplayedPerViewPort_1 as pageRangeDisplayedPerViewPort };
|
|
56
|
+
let marginPagesDisplayed_1: number;
|
|
57
|
+
export { marginPagesDisplayed_1 as marginPagesDisplayed };
|
|
38
58
|
let setCurrentPage_1: null;
|
|
39
59
|
export { setCurrentPage_1 as setCurrentPage };
|
|
40
60
|
let previousLabel_1: null;
|
|
@@ -47,10 +67,6 @@ export namespace Pagination {
|
|
|
47
67
|
export { disabledClassName_1 as disabledClassName };
|
|
48
68
|
let activeClassName_1: null;
|
|
49
69
|
export { activeClassName_1 as activeClassName };
|
|
50
|
-
let pageRangeDisplayed_1: number;
|
|
51
|
-
export { pageRangeDisplayed_1 as pageRangeDisplayed };
|
|
52
|
-
let marginPagesDisplayed_1: number;
|
|
53
|
-
export { marginPagesDisplayed_1 as marginPagesDisplayed };
|
|
54
70
|
let showWhenOnePage_1: boolean;
|
|
55
71
|
export { showWhenOnePage_1 as showWhenOnePage };
|
|
56
72
|
let controlled_1: boolean;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
1
7
|
import React, { useEffect } from 'react';
|
|
2
|
-
import ReactPaginate from 'react-paginate';
|
|
3
8
|
import c from 'classnames';
|
|
4
|
-
import './style.scss';
|
|
5
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import ReactPaginate from 'react-paginate';
|
|
6
11
|
import withMapping from '../../Context/withMapping';
|
|
12
|
+
import useValueForCurrentViewPort from '../../helpers/useValueForCurrentViewPort';
|
|
13
|
+
import './style.scss';
|
|
7
14
|
export var Pagination = function Pagination(_ref) {
|
|
8
15
|
var currentPage = _ref.currentPage,
|
|
9
16
|
totalPages = _ref.totalPages,
|
|
10
17
|
pageRangeDisplayed = _ref.pageRangeDisplayed,
|
|
18
|
+
pageRangeDisplayedPerViewPort = _ref.pageRangeDisplayedPerViewPort,
|
|
11
19
|
marginPagesDisplayed = _ref.marginPagesDisplayed,
|
|
12
20
|
setCurrentPage = _ref.setCurrentPage,
|
|
13
21
|
previousLabel = _ref.previousLabel,
|
|
@@ -21,6 +29,8 @@ export var Pagination = function Pagination(_ref) {
|
|
|
21
29
|
scrollToTop = _ref.scrollToTop,
|
|
22
30
|
scrollToTopOffset = _ref.scrollToTopOffset,
|
|
23
31
|
scrollToTopBehavior = _ref.scrollToTopBehavior;
|
|
32
|
+
// Calculate dynamic pageRangeDisplayed based on window width.
|
|
33
|
+
var pageRange = useValueForCurrentViewPort.apply(void 0, _toConsumableArray(pageRangeDisplayedPerViewPort ? Object.values(pageRangeDisplayedPerViewPort) : Array(5).fill(pageRangeDisplayed)));
|
|
24
34
|
useEffect(function () {
|
|
25
35
|
if (scrollToTop) {
|
|
26
36
|
window.scrollTo({
|
|
@@ -63,7 +73,7 @@ export var Pagination = function Pagination(_ref) {
|
|
|
63
73
|
breakLabel: "...",
|
|
64
74
|
breakClassName: breakClasses,
|
|
65
75
|
pageCount: totalPages,
|
|
66
|
-
pageRangeDisplayed:
|
|
76
|
+
pageRangeDisplayed: pageRange,
|
|
67
77
|
marginPagesDisplayed: marginPagesDisplayed,
|
|
68
78
|
disabledClassName: disabledClasses,
|
|
69
79
|
initialPage: !controlled && currentPage - 1,
|
|
@@ -77,6 +87,13 @@ Pagination.propTypes = {
|
|
|
77
87
|
currentPage: PropTypes.number.isRequired,
|
|
78
88
|
totalPages: PropTypes.number.isRequired,
|
|
79
89
|
pageRangeDisplayed: PropTypes.number,
|
|
90
|
+
pageRangeDisplayedPerViewPort: PropTypes.exact({
|
|
91
|
+
xs: PropTypes.number,
|
|
92
|
+
sm: PropTypes.number,
|
|
93
|
+
md: PropTypes.number,
|
|
94
|
+
lg: PropTypes.number,
|
|
95
|
+
xl: PropTypes.number
|
|
96
|
+
}),
|
|
80
97
|
marginPagesDisplayed: PropTypes.number,
|
|
81
98
|
setCurrentPage: PropTypes.func,
|
|
82
99
|
previousLabel: PropTypes.string,
|
|
@@ -91,14 +108,21 @@ Pagination.propTypes = {
|
|
|
91
108
|
scrollToTopBehavior: PropTypes.oneOf(['smooth', 'instant', 'auto'])
|
|
92
109
|
};
|
|
93
110
|
Pagination.defaultProps = {
|
|
111
|
+
pageRangeDisplayed: 5,
|
|
112
|
+
pageRangeDisplayedPerViewPort: {
|
|
113
|
+
xs: 5,
|
|
114
|
+
sm: 5,
|
|
115
|
+
md: 5,
|
|
116
|
+
lg: 5,
|
|
117
|
+
xl: 5
|
|
118
|
+
},
|
|
119
|
+
marginPagesDisplayed: 1,
|
|
94
120
|
setCurrentPage: null,
|
|
95
121
|
previousLabel: null,
|
|
96
122
|
nextLabel: null,
|
|
97
123
|
containerClassName: null,
|
|
98
124
|
disabledClassName: null,
|
|
99
125
|
activeClassName: null,
|
|
100
|
-
pageRangeDisplayed: 5,
|
|
101
|
-
marginPagesDisplayed: 1,
|
|
102
126
|
showWhenOnePage: false,
|
|
103
127
|
controlled: false,
|
|
104
128
|
scrollToTop: false,
|