@spaced-out/ui-design-system 0.4.1 → 0.4.2
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/.github/workflows/publish_to_npm.yml +1 -1
- package/CHANGELOG.md +13 -0
- package/lib/components/Pagination/Pagination.js +2 -1
- package/lib/components/Pagination/Pagination.js.flow +5 -1
- package/lib/hooks/useWindowSize/useWindowSize.js +22 -14
- package/lib/hooks/useWindowSize/useWindowSize.js.flow +17 -13
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
- name: Check Permissions
|
|
23
23
|
id: check-permissions
|
|
24
24
|
env:
|
|
25
|
-
ALLOWED_USERS: superrover, Anant-Raj, diwakersurya, ashwini-sensehq, vish-sah, VishalBarnawal, sanskar-s, VivekJangid, sharad-kushwah, Swatantramishra1, bhatiarush27, darsh-mecwan-sense, keshavsensehq, SahilShrivastava1
|
|
25
|
+
ALLOWED_USERS: superrover, Anant-Raj, diwakersurya, ashwini-sensehq, vish-sah, VishalBarnawal, sanskar-s, VivekJangid, sharad-kushwah, Swatantramishra1, bhatiarush27, darsh-mecwan-sense, keshavsensehq, SahilShrivastava1, aditya-kaushal
|
|
26
26
|
if: ${{ !contains(env.ALLOWED_USERS, github.actor) }}
|
|
27
27
|
run: |
|
|
28
28
|
echo "You don't have correct permissions to do this release"
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
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.4.2](https://github.com/spaced-out/ui-design-system/compare/v0.4.1...v0.4.2) (2025-07-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added language support labels in pagination ([#368](https://github.com/spaced-out/ui-design-system/issues/368)) ([9d37138](https://github.com/spaced-out/ui-design-system/commit/9d37138315427b41a28820a92ee466ea544d9ded))
|
|
11
|
+
* pagination static labels ([#370](https://github.com/spaced-out/ui-design-system/issues/370)) ([241bb9d](https://github.com/spaced-out/ui-design-system/commit/241bb9d56dc016f97971e0f2a060a40d6d8d918a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* fixes the depth issue while using useWindowSize ([#369](https://github.com/spaced-out/ui-design-system/issues/369)) ([cc27012](https://github.com/spaced-out/ui-design-system/commit/cc27012f1075e8f435c8d045dd221f66bcc88f2a))
|
|
17
|
+
|
|
5
18
|
### [0.4.1](https://github.com/spaced-out/ui-design-system/compare/v0.4.0...v0.4.1) (2025-07-15)
|
|
6
19
|
|
|
7
20
|
|
|
@@ -32,6 +32,7 @@ const Pagination = exports.Pagination = /*#__PURE__*/React.forwardRef((props, re
|
|
|
32
32
|
onChange,
|
|
33
33
|
showFirstButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
34
34
|
showLastButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
35
|
+
staticPaginationLabel,
|
|
35
36
|
...restPaginationProps
|
|
36
37
|
} = props;
|
|
37
38
|
const showPageSelectionDropDown = style !== 'primary' && showExtraSecPaginationButtons;
|
|
@@ -81,7 +82,7 @@ const Pagination = exports.Pagination = /*#__PURE__*/React.forwardRef((props, re
|
|
|
81
82
|
}), !!totalPages && !!currentPage && /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, {
|
|
82
83
|
color: "tertiary",
|
|
83
84
|
className: _PaginationModule.default.secondaryLabel
|
|
84
|
-
},
|
|
85
|
+
}, staticPaginationLabel ? staticPaginationLabel : `of ${totalPages} ${totalPages > 1 ? 'Pages' : 'Page'}`)), /*#__PURE__*/React.createElement("div", {
|
|
85
86
|
className: (0, _classify.default)(_PaginationModule.default.paginatorSlot, classNames?.paginator)
|
|
86
87
|
}, items?.map(item => /*#__PURE__*/React.createElement(_PaginationItem.PaginationItem, _extends({
|
|
87
88
|
key: item.id
|
|
@@ -41,6 +41,7 @@ export type PaginationBaseProps = {
|
|
|
41
41
|
boundaryCount?: number,
|
|
42
42
|
siblingCount?: number,
|
|
43
43
|
style?: 'primary' | 'secondary',
|
|
44
|
+
staticPaginationLabel?: string,
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
export type PaginationProps = {
|
|
@@ -78,6 +79,7 @@ export const Pagination: React$AbstractComponent<
|
|
|
78
79
|
onChange,
|
|
79
80
|
showFirstButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
80
81
|
showLastButton = style !== 'primary' && showExtraSecPaginationButtons,
|
|
82
|
+
staticPaginationLabel,
|
|
81
83
|
...restPaginationProps
|
|
82
84
|
} = props;
|
|
83
85
|
const showPageSelectionDropDown =
|
|
@@ -136,7 +138,9 @@ export const Pagination: React$AbstractComponent<
|
|
|
136
138
|
color="tertiary"
|
|
137
139
|
className={css.secondaryLabel}
|
|
138
140
|
>
|
|
139
|
-
|
|
141
|
+
{staticPaginationLabel
|
|
142
|
+
? staticPaginationLabel
|
|
143
|
+
: `of ${totalPages} ${totalPages > 1 ? 'Pages' : 'Page'}`}
|
|
140
144
|
</SubTitleExtraSmall>
|
|
141
145
|
)}
|
|
142
146
|
</>
|
|
@@ -5,26 +5,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useWindowSize = useWindowSize;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _lodash = require("lodash");
|
|
9
|
+
const THROTTLE_DURATION = 200;
|
|
8
10
|
function useWindowSize() {
|
|
9
11
|
const [windowSize, setWindowSize] = (0, _react.useState)({
|
|
10
|
-
width: 0,
|
|
11
|
-
height: 0
|
|
12
|
+
width: typeof window !== 'undefined' ? window.innerWidth : 0,
|
|
13
|
+
height: typeof window !== 'undefined' ? window.innerHeight : 0
|
|
12
14
|
});
|
|
13
15
|
(0, _react.useEffect)(() => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const updateSize = (0, _lodash.throttle)(() => {
|
|
17
|
+
const {
|
|
18
|
+
innerWidth,
|
|
19
|
+
innerHeight
|
|
20
|
+
} = window;
|
|
21
|
+
setWindowSize(prevSize => {
|
|
22
|
+
if (prevSize.width !== innerWidth || prevSize.height !== innerHeight) {
|
|
23
|
+
return {
|
|
24
|
+
width: innerWidth,
|
|
25
|
+
height: innerHeight
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return prevSize;
|
|
18
29
|
});
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
handler();
|
|
23
|
-
window.addEventListener('resize', handler);
|
|
24
|
-
|
|
25
|
-
// Remove event listener on cleanup
|
|
30
|
+
}, THROTTLE_DURATION);
|
|
31
|
+
window.addEventListener('resize', updateSize);
|
|
32
|
+
updateSize();
|
|
26
33
|
return () => {
|
|
27
|
-
window.removeEventListener('resize',
|
|
34
|
+
window.removeEventListener('resize', updateSize);
|
|
35
|
+
updateSize.cancel();
|
|
28
36
|
};
|
|
29
37
|
}, []);
|
|
30
38
|
return windowSize;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
|
|
3
3
|
import {useEffect, useState} from 'react';
|
|
4
|
+
import {throttle} from 'lodash';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
type WindowSize = {
|
|
@@ -8,28 +9,31 @@ type WindowSize = {
|
|
|
8
9
|
height: number,
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
const THROTTLE_DURATION = 200;
|
|
13
|
+
|
|
11
14
|
export function useWindowSize(): WindowSize {
|
|
12
15
|
const [windowSize, setWindowSize] = useState<WindowSize>({
|
|
13
|
-
width: 0,
|
|
14
|
-
height: 0,
|
|
16
|
+
width: typeof window !== 'undefined' ? window.innerWidth : 0,
|
|
17
|
+
height: typeof window !== 'undefined' ? window.innerHeight : 0,
|
|
15
18
|
});
|
|
16
19
|
|
|
17
20
|
useEffect(() => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
height
|
|
21
|
+
const updateSize = throttle(() => {
|
|
22
|
+
const {innerWidth, innerHeight} = window;
|
|
23
|
+
setWindowSize((prevSize) => {
|
|
24
|
+
if (prevSize.width !== innerWidth || prevSize.height !== innerHeight) {
|
|
25
|
+
return {width: innerWidth, height: innerHeight};
|
|
26
|
+
}
|
|
27
|
+
return prevSize;
|
|
22
28
|
});
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// Set size at the first client-side load
|
|
26
|
-
handler();
|
|
29
|
+
}, THROTTLE_DURATION);
|
|
27
30
|
|
|
28
|
-
window.addEventListener('resize',
|
|
31
|
+
window.addEventListener('resize', updateSize);
|
|
32
|
+
updateSize();
|
|
29
33
|
|
|
30
|
-
// Remove event listener on cleanup
|
|
31
34
|
return () => {
|
|
32
|
-
window.removeEventListener('resize',
|
|
35
|
+
window.removeEventListener('resize', updateSize);
|
|
36
|
+
updateSize.cancel();
|
|
33
37
|
};
|
|
34
38
|
}, []);
|
|
35
39
|
|