@spaced-out/ui-design-system 0.3.42 → 0.3.44
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/.cspell/custom-words.txt +1 -0
- package/.github/workflows/pages.yml +1 -1
- package/.github/workflows/publish_to_npm.yml +2 -12
- package/.github/workflows/pull_request_checks.yml +1 -11
- package/.storybook/SenseTheme.js +1 -1
- package/.storybook/main.js +16 -40
- package/.storybook/manager.js +2 -3
- package/.storybook/preview.js +22 -1
- package/.vscode/settings.json +2 -1
- package/CHANGELOG.md +26 -0
- package/CONTRIBUTING.md +19 -0
- package/dts-generator/package.json +1 -1
- package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.d.ts +2 -2
- package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.js +2 -2
- package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.js.flow +2 -2
- package/lib/components/FilterButtonOverlay/FilterButtonOverlay.d.ts +130 -0
- package/lib/components/FilterButtonOverlay/FilterButtonOverlay.js +90 -0
- package/lib/components/FilterButtonOverlay/FilterButtonOverlay.js.flow +135 -0
- package/lib/components/FilterButtonOverlay/FilterButtonOverlay.module.css +35 -0
- package/lib/components/FilterButtonOverlay/index.d.ts +1 -0
- package/lib/components/FilterButtonOverlay/index.js +16 -0
- package/lib/components/FilterButtonOverlay/index.js.flow +3 -0
- package/lib/components/Icon/ClickableIcon.d.ts +2 -1
- package/lib/components/Icon/ClickableIcon.js +3 -2
- package/lib/components/Icon/ClickableIcon.js.flow +2 -1
- package/lib/components/Icon/ClickableIcon.module.css +2 -2
- package/lib/components/Icon/Icon.docs.d.ts +15 -1
- package/lib/components/Icon/Icon.docs.js +15 -1
- package/lib/components/Icon/Icon.docs.js.flow +11 -1
- package/lib/components/InfinitePagination/InfinitePagination.d.ts +112 -0
- package/lib/components/InfinitePagination/InfinitePagination.js +84 -0
- package/lib/components/InfinitePagination/InfinitePagination.js.flow +122 -0
- package/lib/components/InfinitePagination/InfinitePagination.module.css +18 -0
- package/lib/components/InfinitePagination/index.d.ts +1 -0
- package/lib/components/InfinitePagination/index.js +16 -0
- package/lib/components/InfinitePagination/index.js.flow +3 -0
- package/lib/components/SemanticAIIcon/BadgedIcon.d.ts +70 -0
- package/lib/components/SemanticAIIcon/BadgedIcon.js +54 -0
- package/lib/components/SemanticAIIcon/BadgedIcon.js.flow +73 -0
- package/lib/components/SemanticAIIcon/BadgedIcon.module.css +88 -0
- package/lib/components/SemanticAIIcon/index.d.ts +1 -0
- package/lib/components/SemanticAIIcon/index.js +16 -0
- package/lib/components/SemanticAIIcon/index.js.flow +3 -0
- package/lib/components/Table/Table.docs.d.ts +1 -1
- package/lib/components/Table/Table.docs.js +1 -1
- package/lib/components/Table/Table.docs.js.flow +1 -1
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.js +33 -0
- package/lib/components/index.js.flow +3 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +22 -0
- package/lib/hooks/index.js.flow +2 -0
- package/lib/hooks/useInfiniteScroll/index.d.ts +1 -0
- package/lib/hooks/useInfiniteScroll/index.js +16 -0
- package/lib/hooks/useInfiniteScroll/index.js.flow +3 -0
- package/lib/hooks/useInfiniteScroll/useInfiniteScroll.d.ts +77 -0
- package/lib/hooks/useInfiniteScroll/useInfiniteScroll.js +58 -0
- package/lib/hooks/useInfiniteScroll/useInfiniteScroll.js.flow +82 -0
- package/lib/hooks/useResizeObserver/index.d.ts +1 -0
- package/lib/hooks/useResizeObserver/index.js +16 -0
- package/lib/hooks/useResizeObserver/index.js.flow +3 -0
- package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +22 -0
- package/lib/hooks/useResizeObserver/useResizeObserver.js +30 -0
- package/lib/hooks/useResizeObserver/useResizeObserver.js.flow +28 -0
- package/package.json +9 -16
package/.cspell/custom-words.txt
CHANGED
|
@@ -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
|
|
25
|
+
ALLOWED_USERS: superrover, Anant-Raj, diwakersurya, ashwini-sensehq, vish-sah, VishalBarnawal, sanskar-s, VivekJangid, sharad-kushwah, Swatantramishra1, bhatiarush27, darsh-mecwan-sense, keshavsensehq
|
|
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"
|
|
@@ -36,21 +36,11 @@ jobs:
|
|
|
36
36
|
with:
|
|
37
37
|
token: ${{ secrets.NPM_PUBLISH_USER_ACCESS_TOKEN }}
|
|
38
38
|
fetch-depth: '0'
|
|
39
|
-
|
|
40
|
-
# Note(Nishant): Possible cleanup required Setup Node 18 for the base npm package
|
|
41
39
|
- name: Setup Node.js @18
|
|
42
40
|
uses: actions/setup-node@v4
|
|
43
41
|
with:
|
|
44
42
|
registry-url: https://registry.npmjs.org/
|
|
45
|
-
node-version: '
|
|
46
|
-
|
|
47
|
-
# Note(Nishant): Possible cleanup required Setup Node 20 for the dts-generator
|
|
48
|
-
# We already pin the node versions with volta so this should be fine(but not ideal)
|
|
49
|
-
- name: Setup Node.js @20
|
|
50
|
-
uses: actions/setup-node@v4
|
|
51
|
-
with:
|
|
52
|
-
registry-url: https://registry.npmjs.org/
|
|
53
|
-
node-version: '20.9.0'
|
|
43
|
+
node-version: '20.19.2'
|
|
54
44
|
|
|
55
45
|
# -------------------------------------------------------------------------------------
|
|
56
46
|
# Note(Nishant): Install isolated dependencies for app and the DTS generator tool
|
|
@@ -19,21 +19,11 @@ jobs:
|
|
|
19
19
|
steps:
|
|
20
20
|
- name: Checkout code
|
|
21
21
|
uses: actions/checkout@v3
|
|
22
|
-
|
|
23
|
-
# Note(Nishant): Possible cleanup required Setup Node 18 for the base npm package
|
|
24
22
|
- name: Setup Node.js @18
|
|
25
23
|
uses: actions/setup-node@v4
|
|
26
24
|
with:
|
|
27
25
|
registry-url: https://registry.npmjs.org/
|
|
28
|
-
node-version: '
|
|
29
|
-
|
|
30
|
-
# Note(Nishant): Possible cleanup required Setup Node 20 for the dts-generator
|
|
31
|
-
# We already pin the node versions with volta so this should be fine(but not ideal)
|
|
32
|
-
- name: Setup Node.js @20
|
|
33
|
-
uses: actions/setup-node@v4
|
|
34
|
-
with:
|
|
35
|
-
registry-url: https://registry.npmjs.org/
|
|
36
|
-
node-version: '20.9.0'
|
|
26
|
+
node-version: '20.19.2'
|
|
37
27
|
|
|
38
28
|
# Install project dependencies
|
|
39
29
|
- name: Install dependencies
|
package/.storybook/SenseTheme.js
CHANGED
package/.storybook/main.js
CHANGED
|
@@ -7,45 +7,21 @@ module.exports = {
|
|
|
7
7
|
},
|
|
8
8
|
|
|
9
9
|
// Add any Storybook addons you want here: https://storybook.js.org/addons/
|
|
10
|
-
addons: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}, 'storybook-css-modules', '@storybook/addon-a11y', '@storybook/addon-essentials', // 'storybook-vscode-component/register', This is not supported in storybook 7
|
|
19
|
-
'@storybook/testing-react', '@storybook/addon-mdx-gfm', {
|
|
20
|
-
name: '@storybook/addon-storysource',
|
|
21
|
-
options: {
|
|
22
|
-
loaderOptions: {
|
|
23
|
-
injectStoryParameters: false,
|
|
24
|
-
prettierConfig: {
|
|
25
|
-
singleQuote: true,
|
|
26
|
-
trailingComma: 'all',
|
|
27
|
-
printWidth: 80,
|
|
28
|
-
tabWidth: 2,
|
|
29
|
-
bracketSpacing: false,
|
|
30
|
-
endOfLine: 'lf',
|
|
31
|
-
overrides: [
|
|
32
|
-
{
|
|
33
|
-
files: ['*.js', '*.jsx'],
|
|
34
|
-
options: {
|
|
35
|
-
parser: 'babel-flow',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
files: ['*.css'],
|
|
40
|
-
options: {
|
|
41
|
-
parser: 'css',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
},
|
|
10
|
+
addons: [
|
|
11
|
+
{
|
|
12
|
+
name: '@storybook/addon-docs',
|
|
13
|
+
options: {
|
|
14
|
+
configureJSX: true,
|
|
15
|
+
babelOptions: {},
|
|
16
|
+
sourceLoaderOptions: null,
|
|
17
|
+
transcludeMarkdown: true,
|
|
46
18
|
},
|
|
47
|
-
},
|
|
48
|
-
|
|
19
|
+
}, // 'storybook-vscode-component/register', This is not supported in storybook 7
|
|
20
|
+
'storybook-css-modules',
|
|
21
|
+
'@storybook/addon-a11y',
|
|
22
|
+
'@storybook/addon-webpack5-compiler-babel',
|
|
23
|
+
'@chromatic-com/storybook',
|
|
24
|
+
],
|
|
49
25
|
|
|
50
26
|
babel: async (options) => ({
|
|
51
27
|
...options,
|
|
@@ -112,6 +88,6 @@ module.exports = {
|
|
|
112
88
|
},
|
|
113
89
|
|
|
114
90
|
typescript: {
|
|
115
|
-
reactDocgen: 'react-docgen-typescript'
|
|
116
|
-
}
|
|
91
|
+
reactDocgen: 'react-docgen-typescript',
|
|
92
|
+
},
|
|
117
93
|
};
|
package/.storybook/manager.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// .storybook/manager.js
|
|
2
2
|
|
|
3
|
-
import {addons} from '
|
|
4
|
-
import {themes} from '@storybook/theming';
|
|
5
|
-
|
|
3
|
+
import {addons} from 'storybook/manager-api';
|
|
6
4
|
import senseTheme from './SenseTheme';
|
|
7
5
|
|
|
6
|
+
|
|
8
7
|
addons.setConfig({
|
|
9
8
|
theme: senseTheme,
|
|
10
9
|
});
|
package/.storybook/preview.js
CHANGED
|
@@ -31,10 +31,30 @@
|
|
|
31
31
|
* You can set global parameters in this file
|
|
32
32
|
**/
|
|
33
33
|
|
|
34
|
-
import {themes} from '
|
|
34
|
+
import {themes} from 'storybook/theming';
|
|
35
35
|
import {wd} from 'paths.macro';
|
|
36
36
|
|
|
37
37
|
export const parameters = {
|
|
38
|
+
// Note(Nishant): This is a workaround to disable the a11y checks for the storybook.
|
|
39
|
+
// This is because the storybook is not a web application and does not have a viewport.
|
|
40
|
+
a11y: {
|
|
41
|
+
config: {
|
|
42
|
+
rules: [
|
|
43
|
+
{
|
|
44
|
+
id: 'landmark-one-main',
|
|
45
|
+
enabled: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'meta-viewport',
|
|
49
|
+
enabled: false,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'page-has-heading-one',
|
|
53
|
+
enabled: false,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
38
58
|
controls: {
|
|
39
59
|
disableSaveFromUI: true,
|
|
40
60
|
},
|
|
@@ -46,6 +66,7 @@ export const parameters = {
|
|
|
46
66
|
},
|
|
47
67
|
docs: {
|
|
48
68
|
theme: themes.light,
|
|
69
|
+
codePanel: true,
|
|
49
70
|
},
|
|
50
71
|
Canvas: {
|
|
51
72
|
theme: themes.light,
|
package/.vscode/settings.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
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.3.44](https://github.com/spaced-out/ui-design-system/compare/v0.3.43...v0.3.44) (2025-06-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* (GDS-526) ai icon ([#357](https://github.com/spaced-out/ui-design-system/issues/357)) ([4be6e07](https://github.com/spaced-out/ui-design-system/commit/4be6e07a9163906306250c8b35f5f335d3a0ee88))
|
|
11
|
+
|
|
12
|
+
### [0.3.43](https://github.com/spaced-out/ui-design-system/compare/v0.3.42...v0.3.43) (2025-06-16)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* added new component filter button dropdown with children support ([#356](https://github.com/spaced-out/ui-design-system/issues/356)) ([968728f](https://github.com/spaced-out/ui-design-system/commit/968728f230497825f1d7a0dc74fee925747fe656))
|
|
18
|
+
* **GDS-511:** infinite pagination with virtualised items list ([#339](https://github.com/spaced-out/ui-design-system/issues/339)) ([f10dc53](https://github.com/spaced-out/ui-design-system/commit/f10dc530f7a093aa5cf9d72d58a93975d2b4b0bc))
|
|
19
|
+
* **icon:** disabled prop in clickable icon ([#354](https://github.com/spaced-out/ui-design-system/issues/354)) ([75f647c](https://github.com/spaced-out/ui-design-system/commit/75f647c875b965bc6bcac09016fe696ebfe4b904))
|
|
20
|
+
* replaces deprecated componentSubtitle with docs.subtitle & stroke-width with strokeWidth ([#352](https://github.com/spaced-out/ui-design-system/issues/352)) ([4e0af03](https://github.com/spaced-out/ui-design-system/commit/4e0af037270ae3539a07741719d1f148b8a0874f))
|
|
21
|
+
* **scripts:** support nested paths in create-component script ([#351](https://github.com/spaced-out/ui-design-system/issues/351)) ([fe20642](https://github.com/spaced-out/ui-design-system/commit/fe20642bc988cce6a0980f018a56be8d87822b98))
|
|
22
|
+
* upgrade to storybook 9 and related changes ([#355](https://github.com/spaced-out/ui-design-system/issues/355)) ([caad155](https://github.com/spaced-out/ui-design-system/commit/caad1553f075f7e0e9f7654a9a901b38cad101bc))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* added new node version ([3aa3152](https://github.com/spaced-out/ui-design-system/commit/3aa3152529d5e976be6b0d1f27a0442e24f6df21))
|
|
28
|
+
* added user to release job ([fd3c071](https://github.com/spaced-out/ui-design-system/commit/fd3c071677f3335eea45fd9f2dbb8286090099df))
|
|
29
|
+
* fixes the copy issue in the prerelease version ([cee9be4](https://github.com/spaced-out/ui-design-system/commit/cee9be469888914330e9dd8478933c6c701677d5))
|
|
30
|
+
|
|
5
31
|
### [0.3.42](https://github.com/spaced-out/ui-design-system/compare/v0.3.41...v0.3.42) (2025-05-22)
|
|
6
32
|
|
|
7
33
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -90,6 +90,25 @@ yarn generate YourComponentName
|
|
|
90
90
|
index.js
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
For nested components (like charts), use the following format:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
yarn generate ParentFolder/YourComponentName
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
This will generate:
|
|
100
|
+
```bash
|
|
101
|
+
/src
|
|
102
|
+
/components
|
|
103
|
+
/ParentFolderName
|
|
104
|
+
/YourComponentName
|
|
105
|
+
YourComponentName.jsx
|
|
106
|
+
YourComponentName.stories.jsx
|
|
107
|
+
YourComponentName.module.css
|
|
108
|
+
YourComponentName.stories.module.css
|
|
109
|
+
index.js
|
|
110
|
+
```
|
|
111
|
+
|
|
93
112
|
> The default templates for each file can be modified under `scripts/templates`.
|
|
94
113
|
|
|
95
114
|
> This script also appends YourComponentName exports in **`src/components/index.js`**.
|
|
@@ -183,8 +183,8 @@ export const ChartEmptyImage = (): React.ReactNode => (
|
|
|
183
183
|
<path
|
|
184
184
|
d="M120 68.2411C120 82.6282 113.908 96.1623 104.213 105L25.7991 104.496C24.7996 104.496 24 103.674 24 102.647V35.8498C24 34.8221 24.7996 34 25.7991 34L104 34.5C112.796 43.0295 120 54.6762 120 68.2411Z"
|
|
185
185
|
stroke="#D3D2E0"
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
strokeWidth="2"
|
|
187
|
+
strokeMiterlimit="10"
|
|
188
188
|
/>
|
|
189
189
|
<path
|
|
190
190
|
d="M29.5054 29.1312C32.3772 29.1312 34.7054 26.8031 34.7054 23.9312C34.7054 21.0593 32.3772 18.7312 29.5054 18.7312C26.6335 18.7312 24.3054 21.0593 24.3054 23.9312C24.3054 26.8031 26.6335 29.1312 29.5054 29.1312Z"
|
|
@@ -167,8 +167,8 @@ const ChartEmptyImage = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
167
167
|
}), /*#__PURE__*/React.createElement("path", {
|
|
168
168
|
d: "M120 68.2411C120 82.6282 113.908 96.1623 104.213 105L25.7991 104.496C24.7996 104.496 24 103.674 24 102.647V35.8498C24 34.8221 24.7996 34 25.7991 34L104 34.5C112.796 43.0295 120 54.6762 120 68.2411Z",
|
|
169
169
|
stroke: "#D3D2E0",
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
strokeWidth: "2",
|
|
171
|
+
strokeMiterlimit: "10"
|
|
172
172
|
}), /*#__PURE__*/React.createElement("path", {
|
|
173
173
|
d: "M29.5054 29.1312C32.3772 29.1312 34.7054 26.8031 34.7054 23.9312C34.7054 21.0593 32.3772 18.7312 29.5054 18.7312C26.6335 18.7312 24.3054 21.0593 24.3054 23.9312C24.3054 26.8031 26.6335 29.1312 29.5054 29.1312Z",
|
|
174
174
|
fill: "#9F9FBC"
|
|
@@ -187,8 +187,8 @@ export const ChartEmptyImage = (): React.Node => (
|
|
|
187
187
|
<path
|
|
188
188
|
d="M120 68.2411C120 82.6282 113.908 96.1623 104.213 105L25.7991 104.496C24.7996 104.496 24 103.674 24 102.647V35.8498C24 34.8221 24.7996 34 25.7991 34L104 34.5C112.796 43.0295 120 54.6762 120 68.2411Z"
|
|
189
189
|
stroke="#D3D2E0"
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
strokeWidth="2"
|
|
191
|
+
strokeMiterlimit="10"
|
|
192
192
|
/>
|
|
193
193
|
<path
|
|
194
194
|
d="M29.5054 29.1312C32.3772 29.1312 34.7054 26.8031 34.7054 23.9312C34.7054 21.0593 32.3772 18.7312 29.5054 18.7312C26.6335 18.7312 24.3054 21.0593 24.3054 23.9312C24.3054 26.8031 26.6335 29.1312 29.5054 29.1312Z"
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {$ReadOnly, $Diff} from 'utility-types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
// $FlowFixMe[untyped-import]
|
|
5
|
+
autoUpdate, // $FlowFixMe[untyped-import]
|
|
6
|
+
flip, // $FlowFixMe[untyped-import]
|
|
7
|
+
offset, // $FlowFixMe[untyped-import]
|
|
8
|
+
shift, // $FlowFixMe[untyped-import]
|
|
9
|
+
useFloating,
|
|
10
|
+
} from '@floating-ui/react';
|
|
11
|
+
import {sizeFluid} from '../../styles/variables/_size';
|
|
12
|
+
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
13
|
+
import type {ClickAwayRefType} from '../../utils';
|
|
14
|
+
import {ClickAway, mergeRefs} from '../../utils';
|
|
15
|
+
import classify from '../../utils/classify';
|
|
16
|
+
import type {ButtonProps, ButtonSize} from '../Button';
|
|
17
|
+
import {Button} from '../Button';
|
|
18
|
+
import type {AnchorType, Strategy} from '../ButtonDropdown';
|
|
19
|
+
import {ANCHOR_POSITION_TYPE, STRATEGY_TYPE} from '../ButtonDropdown';
|
|
20
|
+
import css from './FilterButtonOverlay.module.css';
|
|
21
|
+
type ClassNames = $ReadOnly<{
|
|
22
|
+
wrapper?: string;
|
|
23
|
+
overlayContainer?: string;
|
|
24
|
+
}>;
|
|
25
|
+
export type FilterButtonOverlaySizeTypes = 'medium' | 'small';
|
|
26
|
+
export type NewButtonProps = $Diff<
|
|
27
|
+
ButtonProps,
|
|
28
|
+
{
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
>;
|
|
32
|
+
export type FilterButtonOverlayProps = NewButtonProps & {
|
|
33
|
+
classNames?: ClassNames;
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
positionStrategy?: Strategy;
|
|
36
|
+
anchorPosition?: AnchorType;
|
|
37
|
+
clickAwayRef?: ClickAwayRefType;
|
|
38
|
+
isFluid?: boolean;
|
|
39
|
+
size?: FilterButtonOverlaySizeTypes;
|
|
40
|
+
buttonLabel?: React.ReactNode;
|
|
41
|
+
buttonSize?: ButtonSize;
|
|
42
|
+
buttonIsFluid?: boolean;
|
|
43
|
+
};
|
|
44
|
+
export const FilterButtonOverlay: React$AbstractComponent<
|
|
45
|
+
FilterButtonOverlayProps,
|
|
46
|
+
HTMLDivElement
|
|
47
|
+
> = React.forwardRef<FilterButtonOverlayProps, HTMLDivElement>(
|
|
48
|
+
(
|
|
49
|
+
{
|
|
50
|
+
classNames,
|
|
51
|
+
anchorPosition = ANCHOR_POSITION_TYPE.bottomStart,
|
|
52
|
+
positionStrategy = STRATEGY_TYPE.absolute,
|
|
53
|
+
clickAwayRef,
|
|
54
|
+
size,
|
|
55
|
+
children,
|
|
56
|
+
isFluid,
|
|
57
|
+
buttonLabel,
|
|
58
|
+
buttonIsFluid,
|
|
59
|
+
buttonSize,
|
|
60
|
+
...restProps
|
|
61
|
+
}: FilterButtonOverlayProps,
|
|
62
|
+
ref,
|
|
63
|
+
) => {
|
|
64
|
+
const {x, y, refs, strategy} = useFloating({
|
|
65
|
+
open: true,
|
|
66
|
+
strategy: positionStrategy,
|
|
67
|
+
placement: anchorPosition,
|
|
68
|
+
whileElementsMounted: autoUpdate,
|
|
69
|
+
middleware: [shift(), flip(), offset(parseInt(spaceXXSmall))],
|
|
70
|
+
});
|
|
71
|
+
return (
|
|
72
|
+
<ClickAway clickAwayRef={clickAwayRef} closeOnEscapeKeypress>
|
|
73
|
+
{({isOpen, onOpen, boundaryRef, triggerRef}) => (
|
|
74
|
+
<div
|
|
75
|
+
data-testid="FilterButtonOverlay"
|
|
76
|
+
className={classify(
|
|
77
|
+
{
|
|
78
|
+
[css.isFluid]: buttonIsFluid,
|
|
79
|
+
},
|
|
80
|
+
classNames?.wrapper,
|
|
81
|
+
)}
|
|
82
|
+
ref={ref}
|
|
83
|
+
>
|
|
84
|
+
<Button
|
|
85
|
+
{...restProps}
|
|
86
|
+
ref={mergeRefs([refs.setReference, triggerRef])}
|
|
87
|
+
onClick={(e) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
onOpen();
|
|
90
|
+
}}
|
|
91
|
+
isFluid={buttonIsFluid}
|
|
92
|
+
size={buttonSize}
|
|
93
|
+
>
|
|
94
|
+
{buttonLabel}
|
|
95
|
+
</Button>
|
|
96
|
+
|
|
97
|
+
{isOpen && (
|
|
98
|
+
<div
|
|
99
|
+
ref={mergeRefs([refs.setFloating, boundaryRef])}
|
|
100
|
+
style={{
|
|
101
|
+
display: 'flex',
|
|
102
|
+
position: strategy,
|
|
103
|
+
top: y ?? spaceNone,
|
|
104
|
+
left: x ?? spaceNone,
|
|
105
|
+
...(isFluid && {
|
|
106
|
+
width: sizeFluid,
|
|
107
|
+
}),
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
className={classify(
|
|
112
|
+
css.overlayWrapper,
|
|
113
|
+
{
|
|
114
|
+
[css.fluid]: isFluid,
|
|
115
|
+
[css.medium]: size === 'medium',
|
|
116
|
+
[css.small]: size === 'small',
|
|
117
|
+
},
|
|
118
|
+
classNames?.overlayContainer,
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
{children}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
)}
|
|
127
|
+
</ClickAway>
|
|
128
|
+
);
|
|
129
|
+
},
|
|
130
|
+
);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FilterButtonOverlay = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _react2 = require("@floating-ui/react");
|
|
9
|
+
var _size = require("../../styles/variables/_size");
|
|
10
|
+
var _space = require("../../styles/variables/_space");
|
|
11
|
+
var _utils = require("../../utils");
|
|
12
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
13
|
+
var _Button = require("../Button");
|
|
14
|
+
var _ButtonDropdown = require("../ButtonDropdown");
|
|
15
|
+
var _FilterButtonOverlayModule = _interopRequireDefault(require("./FilterButtonOverlay.module.css"));
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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); }
|
|
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; }
|
|
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 FilterButtonOverlay = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
21
|
+
let {
|
|
22
|
+
classNames,
|
|
23
|
+
anchorPosition = _ButtonDropdown.ANCHOR_POSITION_TYPE.bottomStart,
|
|
24
|
+
positionStrategy = _ButtonDropdown.STRATEGY_TYPE.absolute,
|
|
25
|
+
clickAwayRef,
|
|
26
|
+
size,
|
|
27
|
+
children,
|
|
28
|
+
isFluid,
|
|
29
|
+
buttonLabel,
|
|
30
|
+
buttonIsFluid,
|
|
31
|
+
buttonSize,
|
|
32
|
+
...restProps
|
|
33
|
+
} = _ref;
|
|
34
|
+
const {
|
|
35
|
+
x,
|
|
36
|
+
y,
|
|
37
|
+
refs,
|
|
38
|
+
strategy
|
|
39
|
+
} = (0, _react2.useFloating)({
|
|
40
|
+
open: true,
|
|
41
|
+
strategy: positionStrategy,
|
|
42
|
+
placement: anchorPosition,
|
|
43
|
+
whileElementsMounted: _react2.autoUpdate,
|
|
44
|
+
middleware: [(0, _react2.shift)(), (0, _react2.flip)(), (0, _react2.offset)(parseInt(_space.spaceXXSmall))]
|
|
45
|
+
});
|
|
46
|
+
return /*#__PURE__*/React.createElement(_utils.ClickAway, {
|
|
47
|
+
clickAwayRef: clickAwayRef,
|
|
48
|
+
closeOnEscapeKeypress: true
|
|
49
|
+
}, _ref2 => {
|
|
50
|
+
let {
|
|
51
|
+
isOpen,
|
|
52
|
+
onOpen,
|
|
53
|
+
boundaryRef,
|
|
54
|
+
triggerRef
|
|
55
|
+
} = _ref2;
|
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
"data-testid": "FilterButtonOverlay",
|
|
58
|
+
className: (0, _classify.default)({
|
|
59
|
+
[_FilterButtonOverlayModule.default.isFluid]: buttonIsFluid
|
|
60
|
+
}, classNames?.wrapper),
|
|
61
|
+
ref: ref
|
|
62
|
+
}, /*#__PURE__*/React.createElement(_Button.Button, _extends({}, restProps, {
|
|
63
|
+
ref: (0, _utils.mergeRefs)([refs.setReference, triggerRef]),
|
|
64
|
+
onClick: e => {
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
onOpen();
|
|
67
|
+
},
|
|
68
|
+
isFluid: buttonIsFluid,
|
|
69
|
+
size: buttonSize
|
|
70
|
+
}), buttonLabel), isOpen && /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
ref: (0, _utils.mergeRefs)([refs.setFloating, boundaryRef]),
|
|
72
|
+
style: {
|
|
73
|
+
display: 'flex',
|
|
74
|
+
position: strategy,
|
|
75
|
+
top: y ?? _space.spaceNone,
|
|
76
|
+
left: x ?? _space.spaceNone,
|
|
77
|
+
...(isFluid && {
|
|
78
|
+
width: _size.sizeFluid
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: (0, _classify.default)(_FilterButtonOverlayModule.default.overlayWrapper, {
|
|
83
|
+
[_FilterButtonOverlayModule.default.fluid]: isFluid,
|
|
84
|
+
[_FilterButtonOverlayModule.default.medium]: size === 'medium',
|
|
85
|
+
[_FilterButtonOverlayModule.default.small]: size === 'small'
|
|
86
|
+
}, classNames?.overlayContainer)
|
|
87
|
+
}, children)));
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
exports.FilterButtonOverlay = FilterButtonOverlay;
|