@spaced-out/ui-design-system 0.1.98 → 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 +15 -0
- package/lib/components/CircularLoader/CircularLoader.js +1 -1
- package/lib/components/CircularLoader/CircularLoader.js.flow +1 -1
- package/lib/components/FileUpload/FileUpload.js +5 -2
- package/lib/components/FileUpload/FileUpload.js.flow +12 -5
- package/lib/components/Pagination/Pagination.js +16 -4
- package/lib/components/Pagination/Pagination.js.flow +18 -3
- package/lib/components/SearchInput/SearchInput.js +3 -1
- package/lib/components/SearchInput/SearchInput.js.flow +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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
|
+
|
|
13
|
+
### [0.1.99](https://github.com/spaced-out/ui-design-system/compare/v0.1.98...v0.1.99) (2024-06-03)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* minor enhancements in fileupload, search input and pagination components ([#223](https://github.com/spaced-out/ui-design-system/issues/223)) ([902a55d](https://github.com/spaced-out/ui-design-system/commit/902a55d7d968d545cda0a1addc5c915160c59561))
|
|
19
|
+
|
|
5
20
|
### [0.1.98](https://github.com/spaced-out/ui-design-system/compare/v0.1.97...v0.1.98) (2024-05-31)
|
|
6
21
|
|
|
7
22
|
|
|
@@ -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", {
|
|
@@ -85,7 +85,7 @@ const FileUploadBase = (props, ref) => {
|
|
|
85
85
|
[_FileUploadModule.default.disabled]: disabled || !shouldAcceptFiles,
|
|
86
86
|
[_FileUploadModule.default.dragActive]: isDragActive,
|
|
87
87
|
[_FileUploadModule.default.error]: error
|
|
88
|
-
})
|
|
88
|
+
}, classNames?.dropZone)
|
|
89
89
|
}), /*#__PURE__*/React.createElement("input", getInputProps()), /*#__PURE__*/React.createElement("div", {
|
|
90
90
|
className: (0, _classify.default)(_FileUploadModule.default.instruction, classNames?.instruction)
|
|
91
91
|
}, isDragActive ? draggingInstruction : instruction), /*#__PURE__*/React.createElement("div", {
|
|
@@ -97,7 +97,10 @@ const FileUploadBase = (props, ref) => {
|
|
|
97
97
|
}, /*#__PURE__*/React.createElement(_FileBlock.FileBlock, {
|
|
98
98
|
fileObject: fileObject,
|
|
99
99
|
onFileRefreshClick: onFileRefreshClick,
|
|
100
|
-
handleFileClear: handleFileDeletionExternally ? onFileClear : handleFileClear
|
|
100
|
+
handleFileClear: handleFileDeletionExternally ? onFileClear : handleFileClear,
|
|
101
|
+
classNames: {
|
|
102
|
+
wrapper: classNames?.files
|
|
103
|
+
}
|
|
101
104
|
})))));
|
|
102
105
|
};
|
|
103
106
|
const FileUpload = /*#__PURE__*/React.forwardRef(FileUploadBase);
|
|
@@ -19,6 +19,8 @@ type ClassNames = $ReadOnly<{
|
|
|
19
19
|
wrapper?: string,
|
|
20
20
|
instruction?: string,
|
|
21
21
|
secondaryInstruction?: string,
|
|
22
|
+
dropZone?: string,
|
|
23
|
+
files?: string,
|
|
22
24
|
}>;
|
|
23
25
|
|
|
24
26
|
export type FileProgress = number | 'indeterminate';
|
|
@@ -160,11 +162,15 @@ const FileUploadBase = (props: FileUploadProps, ref) => {
|
|
|
160
162
|
<UnstyledButton
|
|
161
163
|
disabled={disabled || !shouldAcceptFiles}
|
|
162
164
|
{...getRootProps()}
|
|
163
|
-
className={classify(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
className={classify(
|
|
166
|
+
css.dropzone,
|
|
167
|
+
{
|
|
168
|
+
[css.disabled]: disabled || !shouldAcceptFiles,
|
|
169
|
+
[css.dragActive]: isDragActive,
|
|
170
|
+
[css.error]: error,
|
|
171
|
+
},
|
|
172
|
+
classNames?.dropZone,
|
|
173
|
+
)}
|
|
168
174
|
>
|
|
169
175
|
<input {...getInputProps()} />
|
|
170
176
|
<div className={classify(css.instruction, classNames?.instruction)}>
|
|
@@ -190,6 +196,7 @@ const FileUploadBase = (props: FileUploadProps, ref) => {
|
|
|
190
196
|
handleFileClear={
|
|
191
197
|
handleFileDeletionExternally ? onFileClear : handleFileClear
|
|
192
198
|
}
|
|
199
|
+
classNames={{wrapper: classNames?.files}}
|
|
193
200
|
/>
|
|
194
201
|
</React.Fragment>
|
|
195
202
|
))}
|
|
@@ -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");
|
|
@@ -16,7 +17,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
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); }
|
|
20
|
+
const LARGE_LIST_DROPDOWN_OPTIONS = 50;
|
|
21
|
+
const TABLET_SCREEN_SIZE = 640;
|
|
19
22
|
const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
width
|
|
25
|
+
} = (0, _useWindowSize.useWindowSize)();
|
|
26
|
+
const showExtraSecPaginationButtons = width > TABLET_SCREEN_SIZE;
|
|
20
27
|
const {
|
|
21
28
|
classNames,
|
|
22
29
|
style = 'primary',
|
|
@@ -24,10 +31,11 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
24
31
|
currentPage = 1,
|
|
25
32
|
totalPages = 1,
|
|
26
33
|
onChange,
|
|
27
|
-
showFirstButton = style !== 'primary',
|
|
28
|
-
showLastButton = style !== 'primary',
|
|
34
|
+
showFirstButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
35
|
+
showLastButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
29
36
|
...restPaginationProps
|
|
30
37
|
} = props;
|
|
38
|
+
const showPageSelectionDropDown = style !== 'primary' && showExtraSecPaginationButtons;
|
|
31
39
|
const {
|
|
32
40
|
items
|
|
33
41
|
} = (0, _usePagination.usePagination)({
|
|
@@ -39,6 +47,9 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
39
47
|
onChange,
|
|
40
48
|
...restPaginationProps
|
|
41
49
|
});
|
|
50
|
+
const menuVirtualization = {
|
|
51
|
+
enable: totalPages > LARGE_LIST_DROPDOWN_OPTIONS ? true : false
|
|
52
|
+
};
|
|
42
53
|
const allPages = (0, _helpers.range)(1, totalPages);
|
|
43
54
|
const options = style !== 'secondary' ? [] : allPages.map(page => ({
|
|
44
55
|
key: page.toString(),
|
|
@@ -52,7 +63,7 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
52
63
|
className: (0, _classify.default)(_PaginationModule.default.childrenSlot, classNames?.children)
|
|
53
64
|
}, children), /*#__PURE__*/React.createElement("div", {
|
|
54
65
|
className: _PaginationModule.default.paginatorSlots
|
|
55
|
-
}, 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, {
|
|
56
67
|
size: "small",
|
|
57
68
|
classNames: {
|
|
58
69
|
wrapper: _PaginationModule.default.dropdownWrapper
|
|
@@ -63,7 +74,8 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
63
74
|
classNames: {
|
|
64
75
|
wrapper: _PaginationModule.default.menuWrapper
|
|
65
76
|
},
|
|
66
|
-
selectedKeys: currentPage ? [currentPage.toString()] : []
|
|
77
|
+
selectedKeys: currentPage ? [currentPage.toString()] : [],
|
|
78
|
+
virtualization: menuVirtualization
|
|
67
79
|
},
|
|
68
80
|
dropdownInputText: currentPage.toString(),
|
|
69
81
|
onChange: option => onChange?.(parseInt(option.key))
|
|
@@ -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';
|
|
@@ -57,11 +58,17 @@ export type PaginationItemProps = {
|
|
|
57
58
|
type: PaginationItemType,
|
|
58
59
|
};
|
|
59
60
|
|
|
61
|
+
const LARGE_LIST_DROPDOWN_OPTIONS = 50;
|
|
62
|
+
|
|
63
|
+
const TABLET_SCREEN_SIZE = 640;
|
|
64
|
+
|
|
60
65
|
export const Pagination: React$AbstractComponent<
|
|
61
66
|
PaginationProps,
|
|
62
67
|
HTMLDivElement,
|
|
63
68
|
> = React.forwardRef<PaginationProps, HTMLDivElement>(
|
|
64
69
|
(props: PaginationProps, ref) => {
|
|
70
|
+
const {width} = useWindowSize();
|
|
71
|
+
const showExtraSecPaginationButtons = width > TABLET_SCREEN_SIZE;
|
|
65
72
|
const {
|
|
66
73
|
classNames,
|
|
67
74
|
style = 'primary',
|
|
@@ -69,10 +76,13 @@ export const Pagination: React$AbstractComponent<
|
|
|
69
76
|
currentPage = 1,
|
|
70
77
|
totalPages = 1,
|
|
71
78
|
onChange,
|
|
72
|
-
showFirstButton = style !== 'primary',
|
|
73
|
-
showLastButton = style !== 'primary',
|
|
79
|
+
showFirstButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
80
|
+
showLastButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
74
81
|
...restPaginationProps
|
|
75
82
|
} = props;
|
|
83
|
+
const showPageSelectionDropDown =
|
|
84
|
+
style !== 'primary' && showExtraSecPaginationButtons;
|
|
85
|
+
|
|
76
86
|
const {items} = usePagination({
|
|
77
87
|
style,
|
|
78
88
|
showFirstButton,
|
|
@@ -83,6 +93,10 @@ export const Pagination: React$AbstractComponent<
|
|
|
83
93
|
...restPaginationProps,
|
|
84
94
|
});
|
|
85
95
|
|
|
96
|
+
const menuVirtualization = {
|
|
97
|
+
enable: totalPages > LARGE_LIST_DROPDOWN_OPTIONS ? true : false,
|
|
98
|
+
};
|
|
99
|
+
|
|
86
100
|
const allPages = range(1, totalPages);
|
|
87
101
|
const options =
|
|
88
102
|
style !== 'secondary'
|
|
@@ -102,7 +116,7 @@ export const Pagination: React$AbstractComponent<
|
|
|
102
116
|
{children}
|
|
103
117
|
</div>
|
|
104
118
|
<div className={css.paginatorSlots}>
|
|
105
|
-
{style === 'secondary' && (
|
|
119
|
+
{style === 'secondary' && showPageSelectionDropDown && (
|
|
106
120
|
<>
|
|
107
121
|
<Dropdown
|
|
108
122
|
size="small"
|
|
@@ -112,6 +126,7 @@ export const Pagination: React$AbstractComponent<
|
|
|
112
126
|
isFluid: true,
|
|
113
127
|
classNames: {wrapper: css.menuWrapper},
|
|
114
128
|
selectedKeys: currentPage ? [currentPage.toString()] : [],
|
|
129
|
+
virtualization: menuVirtualization,
|
|
115
130
|
}}
|
|
116
131
|
dropdownInputText={currentPage.toString()}
|
|
117
132
|
onChange={(option) => onChange?.(parseInt(option.key))}
|
|
@@ -27,7 +27,9 @@ const SearchInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
27
27
|
...searchInputProps
|
|
28
28
|
} = _ref;
|
|
29
29
|
const handleClearClick = () => {
|
|
30
|
-
|
|
30
|
+
if (value && !(disabled || locked)) {
|
|
31
|
+
onClear?.();
|
|
32
|
+
}
|
|
31
33
|
};
|
|
32
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
35
|
className: (0, _classify.default)(_SearchInputModule.default.searchInputWrapper, classNames?.wrapper)
|