@spaced-out/ui-design-system 0.1.99 → 0.1.100
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
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.100](https://github.com/spaced-out/ui-design-system/compare/v0.1.99...v0.1.100) (2024-06-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* circular loader default color ([#227](https://github.com/spaced-out/ui-design-system/issues/227)) ([fdf816b](https://github.com/spaced-out/ui-design-system/commit/fdf816b96e80f07d2b1c34f9f5ea58e137fca364))
|
|
11
|
+
* responsive secondary pagination controls ([#225](https://github.com/spaced-out/ui-design-system/issues/225)) ([43b8d4d](https://github.com/spaced-out/ui-design-system/commit/43b8d4da02793e85c9a453c25ded86aab2ebb605))
|
|
12
|
+
|
|
5
13
|
### [0.1.99](https://github.com/spaced-out/ui-design-system/compare/v0.1.98...v0.1.99) (2024-06-03)
|
|
6
14
|
|
|
7
15
|
|
|
@@ -16,7 +16,7 @@ const CircularLoader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
16
16
|
let {
|
|
17
17
|
size = 'medium',
|
|
18
18
|
className,
|
|
19
|
-
colorToken = '
|
|
19
|
+
colorToken = 'colorTextClickable',
|
|
20
20
|
ariaLabel = 'Loading'
|
|
21
21
|
} = _ref;
|
|
22
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Pagination = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _usePagination = require("../../hooks/usePagination");
|
|
9
|
+
var _useWindowSize = require("../../hooks/useWindowSize");
|
|
9
10
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
11
|
var _helpers = require("../../utils/helpers");
|
|
11
12
|
var _Dropdown = require("../Dropdown");
|
|
@@ -17,7 +18,12 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
17
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
20
|
const LARGE_LIST_DROPDOWN_OPTIONS = 50;
|
|
21
|
+
const TABLET_SCREEN_SIZE = 640;
|
|
20
22
|
const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
width
|
|
25
|
+
} = (0, _useWindowSize.useWindowSize)();
|
|
26
|
+
const showExtraSecPaginationButtons = width > TABLET_SCREEN_SIZE;
|
|
21
27
|
const {
|
|
22
28
|
classNames,
|
|
23
29
|
style = 'primary',
|
|
@@ -25,10 +31,11 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
25
31
|
currentPage = 1,
|
|
26
32
|
totalPages = 1,
|
|
27
33
|
onChange,
|
|
28
|
-
showFirstButton = style !== 'primary',
|
|
29
|
-
showLastButton = style !== 'primary',
|
|
34
|
+
showFirstButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
35
|
+
showLastButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
30
36
|
...restPaginationProps
|
|
31
37
|
} = props;
|
|
38
|
+
const showPageSelectionDropDown = style !== 'primary' && showExtraSecPaginationButtons;
|
|
32
39
|
const {
|
|
33
40
|
items
|
|
34
41
|
} = (0, _usePagination.usePagination)({
|
|
@@ -56,7 +63,7 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
56
63
|
className: (0, _classify.default)(_PaginationModule.default.childrenSlot, classNames?.children)
|
|
57
64
|
}, children), /*#__PURE__*/React.createElement("div", {
|
|
58
65
|
className: _PaginationModule.default.paginatorSlots
|
|
59
|
-
}, style === 'secondary' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Dropdown.Dropdown, {
|
|
66
|
+
}, style === 'secondary' && showPageSelectionDropDown && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Dropdown.Dropdown, {
|
|
60
67
|
size: "small",
|
|
61
68
|
classNames: {
|
|
62
69
|
wrapper: _PaginationModule.default.dropdownWrapper
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
5
|
import {usePagination} from '../../hooks/usePagination';
|
|
6
|
+
import {useWindowSize} from '../../hooks/useWindowSize';
|
|
6
7
|
import classify from '../../utils/classify';
|
|
7
8
|
import {range} from '../../utils/helpers';
|
|
8
9
|
import {Dropdown} from '../Dropdown';
|
|
@@ -59,11 +60,15 @@ export type PaginationItemProps = {
|
|
|
59
60
|
|
|
60
61
|
const LARGE_LIST_DROPDOWN_OPTIONS = 50;
|
|
61
62
|
|
|
63
|
+
const TABLET_SCREEN_SIZE = 640;
|
|
64
|
+
|
|
62
65
|
export const Pagination: React$AbstractComponent<
|
|
63
66
|
PaginationProps,
|
|
64
67
|
HTMLDivElement,
|
|
65
68
|
> = React.forwardRef<PaginationProps, HTMLDivElement>(
|
|
66
69
|
(props: PaginationProps, ref) => {
|
|
70
|
+
const {width} = useWindowSize();
|
|
71
|
+
const showExtraSecPaginationButtons = width > TABLET_SCREEN_SIZE;
|
|
67
72
|
const {
|
|
68
73
|
classNames,
|
|
69
74
|
style = 'primary',
|
|
@@ -71,10 +76,13 @@ export const Pagination: React$AbstractComponent<
|
|
|
71
76
|
currentPage = 1,
|
|
72
77
|
totalPages = 1,
|
|
73
78
|
onChange,
|
|
74
|
-
showFirstButton = style !== 'primary',
|
|
75
|
-
showLastButton = style !== 'primary',
|
|
79
|
+
showFirstButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
80
|
+
showLastButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
76
81
|
...restPaginationProps
|
|
77
82
|
} = props;
|
|
83
|
+
const showPageSelectionDropDown =
|
|
84
|
+
style !== 'primary' && showExtraSecPaginationButtons;
|
|
85
|
+
|
|
78
86
|
const {items} = usePagination({
|
|
79
87
|
style,
|
|
80
88
|
showFirstButton,
|
|
@@ -108,7 +116,7 @@ export const Pagination: React$AbstractComponent<
|
|
|
108
116
|
{children}
|
|
109
117
|
</div>
|
|
110
118
|
<div className={css.paginatorSlots}>
|
|
111
|
-
{style === 'secondary' && (
|
|
119
|
+
{style === 'secondary' && showPageSelectionDropDown && (
|
|
112
120
|
<>
|
|
113
121
|
<Dropdown
|
|
114
122
|
size="small"
|