@spaced-out/ui-design-system 0.3.41 → 0.3.43
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 +32 -0
- package/CONTRIBUTING.md +19 -0
- package/dts-generator/package.json +1 -1
- package/lib/components/Chip/Chip.d.ts +5 -2
- package/lib/components/Chip/Chip.js +2 -2
- package/lib/components/Chip/Chip.js.flow +5 -2
- package/lib/components/DateRangePicker/Calendar.d.ts +1 -23
- package/lib/components/DateRangePicker/Calendar.js +1 -16
- package/lib/components/DateRangePicker/Calendar.js.flow +1 -20
- package/lib/components/DateRangePicker/DateRangeWrapper.d.ts +39 -3
- package/lib/components/DateRangePicker/DateRangeWrapper.js +20 -2
- package/lib/components/DateRangePicker/DateRangeWrapper.js.flow +39 -3
- package/lib/components/DateRangePicker/DateRangeWrapper.module.css +32 -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/Modal/Modal.d.ts +9 -1
- package/lib/components/Modal/Modal.js +13 -5
- package/lib/components/Modal/Modal.js.flow +9 -1
- 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/TokenListInput/TokenValueChips.d.ts +2 -1
- package/lib/components/TokenListInput/TokenValueChips.js +3 -1
- package/lib/components/TokenListInput/TokenValueChips.js.flow +2 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +22 -0
- package/lib/components/index.js.flow +2 -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/lib/utils/date-range-picker/date-range-picker.d.ts +22 -2
- package/lib/utils/date-range-picker/date-range-picker.js +19 -3
- package/lib/utils/date-range-picker/date-range-picker.js.flow +21 -2
- 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,38 @@
|
|
|
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.43](https://github.com/spaced-out/ui-design-system/compare/v0.3.42...v0.3.43) (2025-06-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 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))
|
|
11
|
+
* **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))
|
|
12
|
+
* **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))
|
|
13
|
+
* 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))
|
|
14
|
+
* **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))
|
|
15
|
+
* 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))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* added new node version ([3aa3152](https://github.com/spaced-out/ui-design-system/commit/3aa3152529d5e976be6b0d1f27a0442e24f6df21))
|
|
21
|
+
* added user to release job ([fd3c071](https://github.com/spaced-out/ui-design-system/commit/fd3c071677f3335eea45fd9f2dbb8286090099df))
|
|
22
|
+
* fixes the copy issue in the prerelease version ([cee9be4](https://github.com/spaced-out/ui-design-system/commit/cee9be469888914330e9dd8478933c6c701677d5))
|
|
23
|
+
|
|
24
|
+
### [0.3.42](https://github.com/spaced-out/ui-design-system/compare/v0.3.41...v0.3.42) (2025-05-22)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **GDS-511:** updated ux for date range picker ([#348](https://github.com/spaced-out/ui-design-system/issues/348)) ([04d12e5](https://github.com/spaced-out/ui-design-system/commit/04d12e5b0db0d7e8797e613350ac4d32001c95d9))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* [GDS-522 & GDS-523]tooltip error in tokenListInput & glitch in Modal ([#349](https://github.com/spaced-out/ui-design-system/issues/349)) ([0482a91](https://github.com/spaced-out/ui-design-system/commit/0482a91ea01a10481224ef64af6c9c9125be9c84))
|
|
35
|
+
* fixes chip accessibility ([#347](https://github.com/spaced-out/ui-design-system/issues/347)) ([ea2d231](https://github.com/spaced-out/ui-design-system/commit/ea2d231ff0508b13aeb3af2581405393077b72c1))
|
|
36
|
+
|
|
5
37
|
### [0.3.41](https://github.com/spaced-out/ui-design-system/compare/v0.3.40...v0.3.41) (2025-05-19)
|
|
6
38
|
|
|
7
39
|
|
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`**.
|
|
@@ -128,13 +128,16 @@ export const Chip: React$AbstractComponent<ChipProps, HTMLDivElement> =
|
|
|
128
128
|
[css.dismissable]: dismissable,
|
|
129
129
|
[css.withIcon]: !!iconName && size !== 'small',
|
|
130
130
|
[css.disabled]: disabled,
|
|
131
|
-
[css.noHoverState]:
|
|
131
|
+
[css.noHoverState]:
|
|
132
|
+
showStatusIndicator || disableHoverState || disabled,
|
|
132
133
|
},
|
|
133
134
|
classNames?.wrapper,
|
|
134
135
|
)}
|
|
135
136
|
onClick={onClick}
|
|
136
137
|
onKeyDown={handleKeyDown}
|
|
137
|
-
tabIndex={
|
|
138
|
+
tabIndex={
|
|
139
|
+
showStatusIndicator || disableHoverState || disabled ? undefined : 0
|
|
140
|
+
}
|
|
138
141
|
role={showStatusIndicator || disableHoverState ? undefined : 'button'}
|
|
139
142
|
>
|
|
140
143
|
{showStatusIndicator && size !== 'small' && (
|
|
@@ -84,11 +84,11 @@ const Chip = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
84
84
|
[_ChipModule.default.dismissable]: dismissable,
|
|
85
85
|
[_ChipModule.default.withIcon]: !!iconName && size !== 'small',
|
|
86
86
|
[_ChipModule.default.disabled]: disabled,
|
|
87
|
-
[_ChipModule.default.noHoverState]: showStatusIndicator || disableHoverState
|
|
87
|
+
[_ChipModule.default.noHoverState]: showStatusIndicator || disableHoverState || disabled
|
|
88
88
|
}, classNames?.wrapper),
|
|
89
89
|
onClick: onClick,
|
|
90
90
|
onKeyDown: handleKeyDown,
|
|
91
|
-
tabIndex: showStatusIndicator || disableHoverState ? undefined : 0,
|
|
91
|
+
tabIndex: showStatusIndicator || disableHoverState || disabled ? undefined : 0,
|
|
92
92
|
role: showStatusIndicator || disableHoverState ? undefined : 'button'
|
|
93
93
|
}), showStatusIndicator && size !== 'small' && /*#__PURE__*/React.createElement(_StatusIndicator.StatusIndicator, {
|
|
94
94
|
status: semantic,
|
|
@@ -129,13 +129,16 @@ export const Chip: React$AbstractComponent<ChipProps, HTMLDivElement> =
|
|
|
129
129
|
[css.dismissable]: dismissable,
|
|
130
130
|
[css.withIcon]: !!iconName && size !== 'small',
|
|
131
131
|
[css.disabled]: disabled,
|
|
132
|
-
[css.noHoverState]:
|
|
132
|
+
[css.noHoverState]:
|
|
133
|
+
showStatusIndicator || disableHoverState || disabled,
|
|
133
134
|
},
|
|
134
135
|
classNames?.wrapper,
|
|
135
136
|
)}
|
|
136
137
|
onClick={onClick}
|
|
137
138
|
onKeyDown={handleKeyDown}
|
|
138
|
-
tabIndex={
|
|
139
|
+
tabIndex={
|
|
140
|
+
showStatusIndicator || disableHoverState || disabled ? undefined : 0
|
|
141
|
+
}
|
|
139
142
|
role={showStatusIndicator || disableHoverState ? undefined : 'button'}
|
|
140
143
|
>
|
|
141
144
|
{showStatusIndicator && size !== 'small' && (
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
WEEKDAYS,
|
|
16
16
|
} from '../../utils';
|
|
17
17
|
import {isAfter, isBefore, isSame} from '../../utils/date-range-picker';
|
|
18
|
-
import {BodySmall,
|
|
18
|
+
import {BodySmall, TEXT_COLORS} from '../Text';
|
|
19
19
|
import {Day} from './Day';
|
|
20
20
|
import css from './Calendar.module.css';
|
|
21
21
|
type CalendarProps = {
|
|
@@ -36,21 +36,6 @@ type CalendarProps = {
|
|
|
36
36
|
};
|
|
37
37
|
today: string;
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
const getFormattedDate = (marker: string, dateRange: DateRange) => {
|
|
41
|
-
const {startDate, endDate} = dateRange;
|
|
42
|
-
|
|
43
|
-
switch (marker) {
|
|
44
|
-
case MARKERS.DATE_RANGE_START:
|
|
45
|
-
return startDate
|
|
46
|
-
? moment.utc(startDate).format('MMMM D, YYYY')
|
|
47
|
-
: 'Start Date';
|
|
48
|
-
|
|
49
|
-
default:
|
|
50
|
-
return endDate ? moment.utc(endDate).format('MMMM D, YYYY') : 'End Date';
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
39
|
export const Calendar = ({
|
|
55
40
|
value,
|
|
56
41
|
marker,
|
|
@@ -63,13 +48,6 @@ export const Calendar = ({
|
|
|
63
48
|
today,
|
|
64
49
|
}: CalendarProps): React.ReactNode => (
|
|
65
50
|
<div className={css.calendar}>
|
|
66
|
-
<SubTitleExtraSmall
|
|
67
|
-
className={css.selectedDate}
|
|
68
|
-
color={TEXT_COLORS.secondary}
|
|
69
|
-
>
|
|
70
|
-
{getFormattedDate(marker, dateRange)}
|
|
71
|
-
</SubTitleExtraSmall>
|
|
72
|
-
|
|
73
51
|
<div className={css.calendarRow}>
|
|
74
52
|
{WEEKDAYS.map((day) => (
|
|
75
53
|
<BodySmall
|
|
@@ -17,18 +17,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
17
17
|
|
|
18
18
|
// $FlowFixMe[untyped-import]
|
|
19
19
|
|
|
20
|
-
const getFormattedDate = (marker, dateRange) => {
|
|
21
|
-
const {
|
|
22
|
-
startDate,
|
|
23
|
-
endDate
|
|
24
|
-
} = dateRange;
|
|
25
|
-
switch (marker) {
|
|
26
|
-
case _utils.MARKERS.DATE_RANGE_START:
|
|
27
|
-
return startDate ? _moment.default.utc(startDate).format('MMMM D, YYYY') : 'Start Date';
|
|
28
|
-
default:
|
|
29
|
-
return endDate ? _moment.default.utc(endDate).format('MMMM D, YYYY') : 'End Date';
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
20
|
const Calendar = _ref => {
|
|
33
21
|
let {
|
|
34
22
|
value,
|
|
@@ -43,10 +31,7 @@ const Calendar = _ref => {
|
|
|
43
31
|
} = _ref;
|
|
44
32
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
33
|
className: _CalendarModule.default.calendar
|
|
46
|
-
}, /*#__PURE__*/React.createElement(
|
|
47
|
-
className: _CalendarModule.default.selectedDate,
|
|
48
|
-
color: _Text.TEXT_COLORS.secondary
|
|
49
|
-
}, getFormattedDate(marker, dateRange)), /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
35
|
className: _CalendarModule.default.calendarRow
|
|
51
36
|
}, _utils.WEEKDAYS.map(day => /*#__PURE__*/React.createElement(_Text.BodySmall, {
|
|
52
37
|
key: day,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
WEEKDAYS,
|
|
18
18
|
} from '../../utils';
|
|
19
19
|
import {isAfter, isBefore, isSame} from '../../utils/date-range-picker';
|
|
20
|
-
import {BodySmall,
|
|
20
|
+
import {BodySmall, TEXT_COLORS} from '../Text';
|
|
21
21
|
|
|
22
22
|
import {Day} from './Day';
|
|
23
23
|
|
|
@@ -43,18 +43,6 @@ type CalendarProps = {
|
|
|
43
43
|
today: string,
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const getFormattedDate = (marker: string, dateRange: DateRange) => {
|
|
47
|
-
const {startDate, endDate} = dateRange;
|
|
48
|
-
switch (marker) {
|
|
49
|
-
case MARKERS.DATE_RANGE_START:
|
|
50
|
-
return startDate
|
|
51
|
-
? moment.utc(startDate).format('MMMM D, YYYY')
|
|
52
|
-
: 'Start Date';
|
|
53
|
-
default:
|
|
54
|
-
return endDate ? moment.utc(endDate).format('MMMM D, YYYY') : 'End Date';
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
46
|
export const Calendar = ({
|
|
59
47
|
value,
|
|
60
48
|
marker,
|
|
@@ -67,13 +55,6 @@ export const Calendar = ({
|
|
|
67
55
|
today,
|
|
68
56
|
}: CalendarProps): React.Node => (
|
|
69
57
|
<div className={css.calendar}>
|
|
70
|
-
<SubTitleExtraSmall
|
|
71
|
-
className={css.selectedDate}
|
|
72
|
-
color={TEXT_COLORS.secondary}
|
|
73
|
-
>
|
|
74
|
-
{getFormattedDate(marker, dateRange)}
|
|
75
|
-
</SubTitleExtraSmall>
|
|
76
|
-
|
|
77
58
|
<div className={css.calendarRow}>
|
|
78
59
|
{WEEKDAYS.map((day) => (
|
|
79
60
|
<BodySmall
|
|
@@ -16,6 +16,7 @@ import classify from '../../utils/classify';
|
|
|
16
16
|
import {
|
|
17
17
|
addTimezoneEndOfDay,
|
|
18
18
|
addTimezoneStartOfDay,
|
|
19
|
+
getFormattedDate,
|
|
19
20
|
isAfter,
|
|
20
21
|
isSameOrAfter,
|
|
21
22
|
isSameOrBefore,
|
|
@@ -31,7 +32,8 @@ import {
|
|
|
31
32
|
} from '../Card';
|
|
32
33
|
import {Dropdown, SimpleDropdown} from '../Dropdown';
|
|
33
34
|
import {FocusManager} from '../FocusManager';
|
|
34
|
-
import {ClickableIcon} from '../Icon';
|
|
35
|
+
import {ClickableIcon, Icon, ICON_SIZE, ICON_TYPE} from '../Icon';
|
|
36
|
+
import {BodySmall, TEXT_COLORS} from '../Text';
|
|
35
37
|
import {Calendar} from './Calendar';
|
|
36
38
|
import css from './DateRangeWrapper.module.css';
|
|
37
39
|
type HeaderProps = {
|
|
@@ -72,6 +74,8 @@ type DateRangeWrapperProps = {
|
|
|
72
74
|
) => void;
|
|
73
75
|
};
|
|
74
76
|
today: string;
|
|
77
|
+
startDateLabel?: string;
|
|
78
|
+
endDateLabel?: string;
|
|
75
79
|
};
|
|
76
80
|
|
|
77
81
|
const CalendarHeader = ({
|
|
@@ -176,6 +180,8 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
176
180
|
cardWrapperClass,
|
|
177
181
|
hideTimezone,
|
|
178
182
|
today,
|
|
183
|
+
startDateLabel = 'Start Date',
|
|
184
|
+
endDateLabel = 'End Date',
|
|
179
185
|
}: DateRangeWrapperProps,
|
|
180
186
|
ref,
|
|
181
187
|
): React.ReactNode => {
|
|
@@ -218,6 +224,35 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
218
224
|
ref={ref}
|
|
219
225
|
>
|
|
220
226
|
<CardHeader className={css.cardHeader}>
|
|
227
|
+
<BodySmall
|
|
228
|
+
className={css.selectedDate}
|
|
229
|
+
color={TEXT_COLORS.secondary}
|
|
230
|
+
>
|
|
231
|
+
{`${startDateLabel}: ${getFormattedDate(
|
|
232
|
+
MARKERS.DATE_RANGE_START,
|
|
233
|
+
dateRange,
|
|
234
|
+
)}`}
|
|
235
|
+
</BodySmall>
|
|
236
|
+
|
|
237
|
+
<Icon
|
|
238
|
+
name="minus"
|
|
239
|
+
size={ICON_SIZE.small}
|
|
240
|
+
type={ICON_TYPE.regular}
|
|
241
|
+
color={TEXT_COLORS.secondary}
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
<BodySmall
|
|
245
|
+
className={css.selectedDate}
|
|
246
|
+
color={TEXT_COLORS.secondary}
|
|
247
|
+
>
|
|
248
|
+
{`${endDateLabel}: ${getFormattedDate(
|
|
249
|
+
MARKERS.DATE_RANGE_END,
|
|
250
|
+
dateRange,
|
|
251
|
+
)}`}
|
|
252
|
+
</BodySmall>
|
|
253
|
+
</CardHeader>
|
|
254
|
+
|
|
255
|
+
<div className={css.calendarMenuContainer}>
|
|
221
256
|
<CalendarHeader
|
|
222
257
|
marker={MARKERS.DATE_RANGE_START}
|
|
223
258
|
rangeStartMonth={rangeStartMonth}
|
|
@@ -258,7 +293,8 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
258
293
|
onMonthNavigate(MARKERS.DATE_RANGE_END, NAVIGATION_ACTION.PREV)
|
|
259
294
|
}
|
|
260
295
|
/>
|
|
261
|
-
</
|
|
296
|
+
</div>
|
|
297
|
+
|
|
262
298
|
<CardContent className={css.dateRangeCalendars}>
|
|
263
299
|
<Calendar
|
|
264
300
|
marker={MARKERS.DATE_RANGE_START}
|
|
@@ -272,7 +308,7 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
272
308
|
{...commonProps}
|
|
273
309
|
/>
|
|
274
310
|
</CardContent>
|
|
275
|
-
<CardFooter>
|
|
311
|
+
<CardFooter className={css.cardFooter}>
|
|
276
312
|
<CardTitle className={css.timezoneDropdownContainer}>
|
|
277
313
|
{!hideTimezone && (
|
|
278
314
|
<SimpleDropdown
|
|
@@ -14,6 +14,7 @@ var _Card = require("../Card");
|
|
|
14
14
|
var _Dropdown = require("../Dropdown");
|
|
15
15
|
var _FocusManager = require("../FocusManager");
|
|
16
16
|
var _Icon = require("../Icon");
|
|
17
|
+
var _Text = require("../Text");
|
|
17
18
|
var _Calendar = require("./Calendar.js");
|
|
18
19
|
var _DateRangeWrapperModule = _interopRequireDefault(require("./DateRangeWrapper.module.css"));
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -112,7 +113,9 @@ const DateRangeWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
112
113
|
setRangeEndMonth,
|
|
113
114
|
cardWrapperClass,
|
|
114
115
|
hideTimezone,
|
|
115
|
-
today
|
|
116
|
+
today,
|
|
117
|
+
startDateLabel = 'Start Date',
|
|
118
|
+
endDateLabel = 'End Date'
|
|
116
119
|
} = _ref2;
|
|
117
120
|
const canNavigateCloser = _moment.default.utc(rangeStartMonth).year() !== _moment.default.utc(rangeEndMonth).year() || Math.abs(_moment.default.utc(rangeStartMonth).month() - _moment.default.utc(rangeEndMonth).month()) > 1;
|
|
118
121
|
const handleApplyClick = () => {
|
|
@@ -149,6 +152,19 @@ const DateRangeWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
149
152
|
ref: ref
|
|
150
153
|
}, /*#__PURE__*/React.createElement(_Card.CardHeader, {
|
|
151
154
|
className: _DateRangeWrapperModule.default.cardHeader
|
|
155
|
+
}, /*#__PURE__*/React.createElement(_Text.BodySmall, {
|
|
156
|
+
className: _DateRangeWrapperModule.default.selectedDate,
|
|
157
|
+
color: _Text.TEXT_COLORS.secondary
|
|
158
|
+
}, `${startDateLabel}: ${(0, _dateRangePicker.getFormattedDate)(_utils.MARKERS.DATE_RANGE_START, dateRange)}`), /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
159
|
+
name: "minus",
|
|
160
|
+
size: _Icon.ICON_SIZE.small,
|
|
161
|
+
type: _Icon.ICON_TYPE.regular,
|
|
162
|
+
color: _Text.TEXT_COLORS.secondary
|
|
163
|
+
}), /*#__PURE__*/React.createElement(_Text.BodySmall, {
|
|
164
|
+
className: _DateRangeWrapperModule.default.selectedDate,
|
|
165
|
+
color: _Text.TEXT_COLORS.secondary
|
|
166
|
+
}, `${endDateLabel}: ${(0, _dateRangePicker.getFormattedDate)(_utils.MARKERS.DATE_RANGE_END, dateRange)}`)), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
className: _DateRangeWrapperModule.default.calendarMenuContainer
|
|
152
168
|
}, /*#__PURE__*/React.createElement(CalendarHeader, {
|
|
153
169
|
marker: _utils.MARKERS.DATE_RANGE_START,
|
|
154
170
|
rangeStartMonth: rangeStartMonth,
|
|
@@ -183,7 +199,9 @@ const DateRangeWrapper = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
183
199
|
}), /*#__PURE__*/React.createElement(_Calendar.Calendar, _extends({
|
|
184
200
|
marker: _utils.MARKERS.DATE_RANGE_END,
|
|
185
201
|
value: rangeEndMonth
|
|
186
|
-
}, commonProps))), /*#__PURE__*/React.createElement(_Card.CardFooter,
|
|
202
|
+
}, commonProps))), /*#__PURE__*/React.createElement(_Card.CardFooter, {
|
|
203
|
+
className: _DateRangeWrapperModule.default.cardFooter
|
|
204
|
+
}, /*#__PURE__*/React.createElement(_Card.CardTitle, {
|
|
187
205
|
className: _DateRangeWrapperModule.default.timezoneDropdownContainer
|
|
188
206
|
}, !hideTimezone && /*#__PURE__*/React.createElement(_Dropdown.SimpleDropdown, {
|
|
189
207
|
options: (0, _utils.getTimezones)(),
|