@spaced-out/ui-design-system 0.3.40 → 0.3.42
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/.all-contributorsrc +1 -1
- package/CHANGELOG.md +25 -0
- package/README.md +26 -17
- package/lib/components/Avatar/Avatar.d.ts +0 -1
- package/lib/components/Avatar/Avatar.js.flow +0 -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/Icon/ClickableIcon.d.ts +1 -1
- package/lib/components/Icon/ClickableIcon.js +1 -1
- package/lib/components/Icon/ClickableIcon.js.flow +1 -1
- 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/DefaultRow.d.ts +1 -0
- package/lib/components/Table/DefaultRow.js +1 -0
- package/lib/components/Table/DefaultRow.js.flow +1 -0
- package/lib/components/Table/DefaultTableHeader.d.ts +1 -0
- package/lib/components/Table/DefaultTableHeader.js.flow +1 -0
- package/lib/components/Table/StaticTable.d.ts +10 -3
- package/lib/components/Table/StaticTable.js +5 -3
- package/lib/components/Table/StaticTable.js.flow +10 -4
- package/lib/components/Table/Table.d.ts +1 -0
- package/lib/components/Table/Table.docs.d.ts +12 -0
- package/lib/components/Table/Table.docs.js +11 -0
- package/lib/components/Table/Table.docs.js.flow +10 -0
- package/lib/components/Table/Table.js.flow +1 -0
- 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/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 +1 -1
package/.all-contributorsrc
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
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.42](https://github.com/spaced-out/ui-design-system/compare/v0.3.41...v0.3.42) (2025-05-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **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))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* [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))
|
|
16
|
+
* 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))
|
|
17
|
+
|
|
18
|
+
### [0.3.41](https://github.com/spaced-out/ui-design-system/compare/v0.3.40...v0.3.41) (2025-05-19)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **table:** added disabledKeys functionality in table component ([#345](https://github.com/spaced-out/ui-design-system/issues/345)) ([06b2bc3](https://github.com/spaced-out/ui-design-system/commit/06b2bc35047e50f988f552ca58d07262afdb1d10))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* formatting fixes ([a091cce](https://github.com/spaced-out/ui-design-system/commit/a091cced24908ae2d0c42a1f6b4742b238046633))
|
|
29
|
+
|
|
5
30
|
### [0.3.40](https://github.com/spaced-out/ui-design-system/compare/v0.3.40-beta.0...v0.3.40) (2025-05-16)
|
|
6
31
|
|
|
7
32
|
|
package/README.md
CHANGED
|
@@ -260,32 +260,39 @@ Check out our [**Changelog here**](https://spaced-out.github.io/ui-design-system
|
|
|
260
260
|
|
|
261
261
|
## Contributors
|
|
262
262
|
|
|
263
|
+
<div style="overflow-x: auto">
|
|
264
|
+
|
|
263
265
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
264
266
|
<!-- prettier-ignore-start -->
|
|
265
267
|
<!-- markdownlint-disable -->
|
|
266
|
-
<table
|
|
268
|
+
<table style="
|
|
269
|
+
width: -webkit-fill-available;
|
|
270
|
+
min-width: 800px;
|
|
271
|
+
">
|
|
267
272
|
<tbody>
|
|
268
273
|
<tr>
|
|
269
|
-
<td align="center" valign="top" width="
|
|
270
|
-
<td align="center" valign="top" width="
|
|
271
|
-
<td align="center" valign="top" width="
|
|
272
|
-
<td align="center" valign="top" width="
|
|
273
|
-
<td align="center" valign="top" width="
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/superrover"><img src="https://avatars.githubusercontent.com/u/86281150?v=4?s=100" width="100px;" alt="Nishant Gaurav"/><br /><sub><b>Nishant Gaurav</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=superrover" title="Code">💻</a> <a href="#infra-superrover" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
|
|
275
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/Anant-Raj"><img src="https://avatars.githubusercontent.com/u/8904071?v=4?s=100" width="100px;" alt="Anant Raj"/><br /><sub><b>Anant Raj</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=Anant-Raj" title="Code">💻</a></td>
|
|
276
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/ashwinikemshetty"><img src="https://avatars.githubusercontent.com/u/12839599?v=4?s=100" width="100px;" alt="Ashwini Kemshetty"/><br /><sub><b>Ashwini Kemshetty</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=ashwinikemshetty" title="Code">💻</a></td>
|
|
277
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/VivekJangid"><img src="https://avatars.githubusercontent.com/u/33223696?v=4?s=100" width="100px;" alt="Vivek Jangid"/><br /><sub><b>Vivek Jangid</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=VivekJangid" title="Code">💻</a></td>
|
|
278
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/sharad-kushwah"><img src="https://avatars.githubusercontent.com/u/161806585?v=4?s=100" width="100px;" alt="Sharad Kushwah"/><br /><sub><b>Sharad Kushwah</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=sharad-kushwah" title="Code">💻</a></td>
|
|
279
|
+
</tr>
|
|
280
|
+
<tr>
|
|
281
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/sanskar-s"><img src="https://avatars.githubusercontent.com/u/137482980?v=4?s=100" width="100px;" alt="Sanskar Saxena"/><br /><sub><b>Sanskar Saxena</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=sanskar-s" title="Code">💻</a></td>
|
|
282
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/aditya-kaushal"><img src="https://avatars.githubusercontent.com/u/141118827?v=4?s=100" width="100px;" alt="aditya-kaushal"/><br /><sub><b>aditya-kaushal</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=aditya-kaushal" title="Code">💻</a></td>
|
|
283
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/bhatiarush27"><img src="https://avatars.githubusercontent.com/u/161808754?v=4?s=100" width="100px;" alt="Arush Bhatia"/><br /><sub><b>Arush Bhatia</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=bhatiarush27" title="Code">💻</a></td>
|
|
284
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/LakshayKumar-1"><img src="https://avatars.githubusercontent.com/u/183346574?v=4?s=100" width="100px;" alt="LakshayKumar-1"/><br /><sub><b>LakshayKumar-1</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=LakshayKumar-1" title="Code">💻</a></td>
|
|
285
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/Swatantramishra1"><img src="https://avatars.githubusercontent.com/u/5427027?v=4?s=100" width="100px;" alt="Swatantra Mishra"/><br /><sub><b>Swatantra Mishra</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=Swatantramishra1" title="Code">💻</a></td>
|
|
276
286
|
</tr>
|
|
277
287
|
<tr>
|
|
278
|
-
<td align="center" valign="top" width="
|
|
279
|
-
<td align="center" valign="top" width="
|
|
280
|
-
<td align="center" valign="top" width="
|
|
281
|
-
<td align="center" valign="top" width="
|
|
282
|
-
<td align="center" valign="top" width="
|
|
283
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/pearel-sense"><img src="https://avatars.githubusercontent.com/u/113005498?v=4?s=100" width="100px;" alt="Pearel Nazareth"/><br /><sub><b>Pearel Nazareth</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=pearel-sense" title="Code">💻</a></td>
|
|
284
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/deepak-rao-96"><img src="https://avatars.githubusercontent.com/u/185754227?v=4?s=100" width="100px;" alt="deepak-rao-96"/><br /><sub><b>deepak-rao-96</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=deepak-rao-96" title="Code">💻</a></td>
|
|
288
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/VishalBarnawal"><img src="https://avatars.githubusercontent.com/u/113020105?v=4?s=100" width="100px;" alt="Vishal-sense"/><br /><sub><b>Vishal-sense</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=VishalBarnawal" title="Code">💻</a></td>
|
|
289
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/vish-sah"><img src="https://avatars.githubusercontent.com/u/108925162?v=4?s=100" width="100px;" alt="Vishwanath Sah"/><br /><sub><b>Vishwanath Sah</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=vish-sah" title="Code">💻</a></td>
|
|
290
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/pearel-sense"><img src="https://avatars.githubusercontent.com/u/113005498?v=4?s=100" width="100px;" alt="Pearel Nazareth"/><br /><sub><b>Pearel Nazareth</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=pearel-sense" title="Code">💻</a></td>
|
|
291
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/deepak-rao-96"><img src="https://avatars.githubusercontent.com/u/185754227?v=4?s=100" width="100px;" alt="deepak-rao-96"/><br /><sub><b>deepak-rao-96</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=deepak-rao-96" title="Code">💻</a></td>
|
|
292
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/darsh-mecwan-sense"><img src="https://avatars.githubusercontent.com/u/186684223?v=4?s=100" width="100px;" alt="Darsh Mecwan"/><br /><sub><b>Darsh Mecwan</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=darsh-mecwan-sense" title="Code">💻</a></td>
|
|
285
293
|
</tr>
|
|
286
294
|
<tr>
|
|
287
|
-
<td align="center" valign="top" width="
|
|
288
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/diwakersurya"><img src="https://avatars.githubusercontent.com/u/7386665?v=4?s=100" width="100px;" alt="Diwaker Singh"/><br /><sub><b>Diwaker Singh</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=diwakersurya" title="Code">💻</a></td>
|
|
295
|
+
<td align="center" valign="top" width="20%"><a href="https://github.com/diwakersurya"><img src="https://avatars.githubusercontent.com/u/7386665?v=4?s=100" width="100px;" alt="Diwaker Singh"/><br /><sub><b>Diwaker Singh</b></sub></a><br /><a href="https://github.com/Spaced-Out/ui-design-system/commits?author=diwakersurya" title="Code">💻</a></td>
|
|
289
296
|
</tr>
|
|
290
297
|
</tbody>
|
|
291
298
|
</table>
|
|
@@ -294,3 +301,5 @@ Check out our [**Changelog here**](https://spaced-out.github.io/ui-design-system
|
|
|
294
301
|
<!-- prettier-ignore-end -->
|
|
295
302
|
|
|
296
303
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
304
|
+
|
|
305
|
+
</div>
|
|
@@ -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)(),
|
|
@@ -18,6 +18,7 @@ import classify from '../../utils/classify';
|
|
|
18
18
|
import {
|
|
19
19
|
addTimezoneEndOfDay,
|
|
20
20
|
addTimezoneStartOfDay,
|
|
21
|
+
getFormattedDate,
|
|
21
22
|
isAfter,
|
|
22
23
|
isSameOrAfter,
|
|
23
24
|
isSameOrBefore,
|
|
@@ -33,7 +34,8 @@ import {
|
|
|
33
34
|
} from '../Card';
|
|
34
35
|
import {Dropdown, SimpleDropdown} from '../Dropdown';
|
|
35
36
|
import {FocusManager} from '../FocusManager';
|
|
36
|
-
import {ClickableIcon} from '../Icon';
|
|
37
|
+
import {ClickableIcon, Icon, ICON_SIZE, ICON_TYPE} from '../Icon';
|
|
38
|
+
import {BodySmall, TEXT_COLORS} from '../Text';
|
|
37
39
|
|
|
38
40
|
import {Calendar} from './Calendar.js';
|
|
39
41
|
|
|
@@ -79,6 +81,8 @@ type DateRangeWrapperProps = {
|
|
|
79
81
|
) => void,
|
|
80
82
|
},
|
|
81
83
|
today: string,
|
|
84
|
+
startDateLabel?: string,
|
|
85
|
+
endDateLabel?: string,
|
|
82
86
|
};
|
|
83
87
|
|
|
84
88
|
const CalendarHeader = ({
|
|
@@ -184,6 +188,8 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
184
188
|
cardWrapperClass,
|
|
185
189
|
hideTimezone,
|
|
186
190
|
today,
|
|
191
|
+
startDateLabel = 'Start Date',
|
|
192
|
+
endDateLabel = 'End Date',
|
|
187
193
|
}: DateRangeWrapperProps,
|
|
188
194
|
ref,
|
|
189
195
|
): React.Node => {
|
|
@@ -228,6 +234,35 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
228
234
|
ref={ref}
|
|
229
235
|
>
|
|
230
236
|
<CardHeader className={css.cardHeader}>
|
|
237
|
+
<BodySmall
|
|
238
|
+
className={css.selectedDate}
|
|
239
|
+
color={TEXT_COLORS.secondary}
|
|
240
|
+
>
|
|
241
|
+
{`${startDateLabel}: ${getFormattedDate(
|
|
242
|
+
MARKERS.DATE_RANGE_START,
|
|
243
|
+
dateRange,
|
|
244
|
+
)}`}
|
|
245
|
+
</BodySmall>
|
|
246
|
+
|
|
247
|
+
<Icon
|
|
248
|
+
name="minus"
|
|
249
|
+
size={ICON_SIZE.small}
|
|
250
|
+
type={ICON_TYPE.regular}
|
|
251
|
+
color={TEXT_COLORS.secondary}
|
|
252
|
+
/>
|
|
253
|
+
|
|
254
|
+
<BodySmall
|
|
255
|
+
className={css.selectedDate}
|
|
256
|
+
color={TEXT_COLORS.secondary}
|
|
257
|
+
>
|
|
258
|
+
{`${endDateLabel}: ${getFormattedDate(
|
|
259
|
+
MARKERS.DATE_RANGE_END,
|
|
260
|
+
dateRange,
|
|
261
|
+
)}`}
|
|
262
|
+
</BodySmall>
|
|
263
|
+
</CardHeader>
|
|
264
|
+
|
|
265
|
+
<div className={css.calendarMenuContainer}>
|
|
231
266
|
<CalendarHeader
|
|
232
267
|
marker={MARKERS.DATE_RANGE_START}
|
|
233
268
|
rangeStartMonth={rangeStartMonth}
|
|
@@ -268,7 +303,8 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
268
303
|
onMonthNavigate(MARKERS.DATE_RANGE_END, NAVIGATION_ACTION.PREV)
|
|
269
304
|
}
|
|
270
305
|
/>
|
|
271
|
-
</
|
|
306
|
+
</div>
|
|
307
|
+
|
|
272
308
|
<CardContent className={css.dateRangeCalendars}>
|
|
273
309
|
<Calendar
|
|
274
310
|
marker={MARKERS.DATE_RANGE_START}
|
|
@@ -282,7 +318,7 @@ export const DateRangeWrapper: React$AbstractComponent<
|
|
|
282
318
|
{...commonProps}
|
|
283
319
|
/>
|
|
284
320
|
</CardContent>
|
|
285
|
-
<CardFooter>
|
|
321
|
+
<CardFooter className={css.cardFooter}>
|
|
286
322
|
<CardTitle className={css.timezoneDropdownContainer}>
|
|
287
323
|
{!hideTimezone && (
|
|
288
324
|
<SimpleDropdown
|
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
@value (
|
|
7
7
|
spaceNone,
|
|
8
8
|
spaceSmall,
|
|
9
|
-
spaceXSmall
|
|
9
|
+
spaceXSmall,
|
|
10
|
+
spaceMedium
|
|
10
11
|
) from '../../styles/variables/_space.css';
|
|
12
|
+
@value (borderRadiusMedium) from '../../styles/variables/_border.css';
|
|
13
|
+
@value (colorBackgroundPrimary) from '../../styles/variables/_color.css';
|
|
11
14
|
|
|
12
15
|
.dateRangeWrapper {
|
|
13
16
|
display: flex;
|
|
@@ -18,6 +21,15 @@
|
|
|
18
21
|
width: sizeFluid;
|
|
19
22
|
padding: spaceXSmall;
|
|
20
23
|
gap: spaceSmall;
|
|
24
|
+
background-color: colorBackgroundPrimary;
|
|
25
|
+
border-top-left-radius: borderRadiusMedium;
|
|
26
|
+
border-top-right-radius: borderRadiusMedium;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.cardFooter {
|
|
30
|
+
background-color: colorBackgroundPrimary;
|
|
31
|
+
border-bottom-left-radius: borderRadiusMedium;
|
|
32
|
+
border-bottom-right-radius: borderRadiusMedium;
|
|
21
33
|
}
|
|
22
34
|
|
|
23
35
|
.calendarHeader {
|
|
@@ -62,3 +74,22 @@
|
|
|
62
74
|
.mainContainer {
|
|
63
75
|
width: sizeFluid;
|
|
64
76
|
}
|
|
77
|
+
|
|
78
|
+
.selectedDateContainer {
|
|
79
|
+
display: flex;
|
|
80
|
+
gap: spaceMedium;
|
|
81
|
+
padding: spaceXSmall spaceSmall;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.selectedDate {
|
|
85
|
+
display: flex;
|
|
86
|
+
width: 100%;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.calendarMenuContainer {
|
|
91
|
+
display: flex;
|
|
92
|
+
gap: spaceSmall;
|
|
93
|
+
width: sizeFluid;
|
|
94
|
+
padding: spaceXSmall;
|
|
95
|
+
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
motionDurationNormal,
|
|
14
14
|
motionDurationSlow,
|
|
15
15
|
} from '../../styles/variables/_motion';
|
|
16
|
+
import {opacity0, opacity100} from '../../styles/variables/_opacity';
|
|
16
17
|
import {spaceNegHalfFluid} from '../../styles/variables/_space';
|
|
17
18
|
import classify from '../../utils/classify';
|
|
18
19
|
import {uuid} from '../../utils/helpers';
|
|
@@ -82,12 +83,15 @@ const DEFAULT_MODAL_ANIMATION = {
|
|
|
82
83
|
},
|
|
83
84
|
initial: {
|
|
84
85
|
transform: `translate(${spaceNegHalfFluid}, ${spaceNegHalfFluid}) scale(0.95)`,
|
|
86
|
+
opacity: opacity0,
|
|
85
87
|
},
|
|
86
88
|
open: {
|
|
87
89
|
transform: `translate(${spaceNegHalfFluid}, ${spaceNegHalfFluid}) scale(1)`,
|
|
90
|
+
opacity: opacity100,
|
|
88
91
|
},
|
|
89
92
|
close: {
|
|
90
93
|
transform: `translate(${spaceNegHalfFluid}, ${spaceNegHalfFluid}) scale(0.95)`,
|
|
94
|
+
opacity: opacity0,
|
|
91
95
|
},
|
|
92
96
|
};
|
|
93
97
|
export const ModalHeader = ({
|
|
@@ -270,7 +274,7 @@ export const Modal = ({
|
|
|
270
274
|
};
|
|
271
275
|
}, [isOpen, onClose]);
|
|
272
276
|
|
|
273
|
-
if (!
|
|
277
|
+
if (!isOpen && !isMounted) {
|
|
274
278
|
// Check overflow after resetting the DOM for modal. This should always happen after DOM reset
|
|
275
279
|
// TODO(Nishant): Better way to do this?
|
|
276
280
|
setTimeout(() => {
|
|
@@ -311,6 +315,10 @@ export const Modal = ({
|
|
|
311
315
|
classNames?.backdrop,
|
|
312
316
|
)}
|
|
313
317
|
onClick={onBackdropClick}
|
|
318
|
+
style={{
|
|
319
|
+
opacity: styles?.opacity,
|
|
320
|
+
transition: styles?.transition,
|
|
321
|
+
}}
|
|
314
322
|
/>
|
|
315
323
|
)}
|
|
316
324
|
|
|
@@ -9,6 +9,7 @@ var _reactDom = require("react-dom");
|
|
|
9
9
|
var _react2 = require("@floating-ui/react");
|
|
10
10
|
var _useMountTransition = _interopRequireDefault(require("../../hooks/useMountTransition"));
|
|
11
11
|
var _motion = require("../../styles/variables/_motion");
|
|
12
|
+
var _opacity = require("../../styles/variables/_opacity");
|
|
12
13
|
var _space = require("../../styles/variables/_space");
|
|
13
14
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
14
15
|
var _helpers = require("../../utils/helpers");
|
|
@@ -25,13 +26,16 @@ const DEFAULT_MODAL_ANIMATION = {
|
|
|
25
26
|
close: parseInt(_motion.motionDurationNormal)
|
|
26
27
|
},
|
|
27
28
|
initial: {
|
|
28
|
-
transform: `translate(${_space.spaceNegHalfFluid}, ${_space.spaceNegHalfFluid}) scale(0.95)
|
|
29
|
+
transform: `translate(${_space.spaceNegHalfFluid}, ${_space.spaceNegHalfFluid}) scale(0.95)`,
|
|
30
|
+
opacity: _opacity.opacity0
|
|
29
31
|
},
|
|
30
32
|
open: {
|
|
31
|
-
transform: `translate(${_space.spaceNegHalfFluid}, ${_space.spaceNegHalfFluid}) scale(1)
|
|
33
|
+
transform: `translate(${_space.spaceNegHalfFluid}, ${_space.spaceNegHalfFluid}) scale(1)`,
|
|
34
|
+
opacity: _opacity.opacity100
|
|
32
35
|
},
|
|
33
36
|
close: {
|
|
34
|
-
transform: `translate(${_space.spaceNegHalfFluid}, ${_space.spaceNegHalfFluid}) scale(0.95)
|
|
37
|
+
transform: `translate(${_space.spaceNegHalfFluid}, ${_space.spaceNegHalfFluid}) scale(0.95)`,
|
|
38
|
+
opacity: _opacity.opacity0
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
41
|
const ModalHeader = _ref => {
|
|
@@ -193,7 +197,7 @@ const Modal = _ref4 => {
|
|
|
193
197
|
window.removeEventListener('keyup', onKeyPress);
|
|
194
198
|
};
|
|
195
199
|
}, [isOpen, onClose]);
|
|
196
|
-
if (!
|
|
200
|
+
if (!isOpen && !isMounted) {
|
|
197
201
|
// Check overflow after resetting the DOM for modal. This should always happen after DOM reset
|
|
198
202
|
// TODO(Nishant): Better way to do this?
|
|
199
203
|
setTimeout(() => {
|
|
@@ -222,7 +226,11 @@ const Modal = _ref4 => {
|
|
|
222
226
|
className: (0, _classify.default)(_ModalModule.default.backdrop, {
|
|
223
227
|
[_ModalModule.default.darkBackdrop]: !hideBackdrop
|
|
224
228
|
}, classNames?.backdrop),
|
|
225
|
-
onClick: onBackdropClick
|
|
229
|
+
onClick: onBackdropClick,
|
|
230
|
+
style: {
|
|
231
|
+
opacity: styles?.opacity,
|
|
232
|
+
transition: styles?.transition
|
|
233
|
+
}
|
|
226
234
|
}), isMounted && /*#__PURE__*/React.createElement("div", {
|
|
227
235
|
className: (0, _classify.default)(_ModalModule.default.modal, {
|
|
228
236
|
[_ModalModule.default.small]: size === 'small',
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
motionDurationNormal,
|
|
18
18
|
motionDurationSlow,
|
|
19
19
|
} from '../../styles/variables/_motion';
|
|
20
|
+
import {opacity0, opacity100} from '../../styles/variables/_opacity';
|
|
20
21
|
import {spaceNegHalfFluid} from '../../styles/variables/_space';
|
|
21
22
|
import classify from '../../utils/classify';
|
|
22
23
|
import {uuid} from '../../utils/helpers';
|
|
@@ -88,12 +89,15 @@ const DEFAULT_MODAL_ANIMATION = {
|
|
|
88
89
|
},
|
|
89
90
|
initial: {
|
|
90
91
|
transform: `translate(${spaceNegHalfFluid}, ${spaceNegHalfFluid}) scale(0.95)`,
|
|
92
|
+
opacity: opacity0,
|
|
91
93
|
},
|
|
92
94
|
open: {
|
|
93
95
|
transform: `translate(${spaceNegHalfFluid}, ${spaceNegHalfFluid}) scale(1)`,
|
|
96
|
+
opacity: opacity100,
|
|
94
97
|
},
|
|
95
98
|
close: {
|
|
96
99
|
transform: `translate(${spaceNegHalfFluid}, ${spaceNegHalfFluid}) scale(0.95)`,
|
|
100
|
+
opacity: opacity0,
|
|
97
101
|
},
|
|
98
102
|
};
|
|
99
103
|
|
|
@@ -276,7 +280,7 @@ export const Modal = ({
|
|
|
276
280
|
};
|
|
277
281
|
}, [isOpen, onClose]);
|
|
278
282
|
|
|
279
|
-
if (!
|
|
283
|
+
if (!isOpen && !isMounted) {
|
|
280
284
|
// Check overflow after resetting the DOM for modal. This should always happen after DOM reset
|
|
281
285
|
// TODO(Nishant): Better way to do this?
|
|
282
286
|
setTimeout(() => {
|
|
@@ -318,6 +322,10 @@ export const Modal = ({
|
|
|
318
322
|
classNames?.backdrop,
|
|
319
323
|
)}
|
|
320
324
|
onClick={onBackdropClick}
|
|
325
|
+
style={{
|
|
326
|
+
opacity: styles?.opacity,
|
|
327
|
+
transition: styles?.transition,
|
|
328
|
+
}}
|
|
321
329
|
/>
|
|
322
330
|
)}
|
|
323
331
|
|
|
@@ -55,6 +55,7 @@ export function StaticTable<
|
|
|
55
55
|
sortKey,
|
|
56
56
|
sortDirection,
|
|
57
57
|
selectedKeys,
|
|
58
|
+
disabledKeys = [],
|
|
58
59
|
onSelect,
|
|
59
60
|
isLoading,
|
|
60
61
|
idName = 'id',
|
|
@@ -159,7 +160,13 @@ export function StaticTable<
|
|
|
159
160
|
|
|
160
161
|
data as Data;
|
|
161
162
|
const selected =
|
|
162
|
-
selectedKeys
|
|
163
|
+
selectedKeys && Array.isArray(selectedKeys)
|
|
164
|
+
? selectedKeys.includes(get(data, idName))
|
|
165
|
+
: undefined;
|
|
166
|
+
const isRowDisabled =
|
|
167
|
+
disabledKeys && Array.isArray(disabledKeys)
|
|
168
|
+
? disabledKeys.includes(get(data, idName))
|
|
169
|
+
: false;
|
|
163
170
|
return TableRow ? (
|
|
164
171
|
<TableRow
|
|
165
172
|
key={key}
|
|
@@ -168,7 +175,7 @@ export function StaticTable<
|
|
|
168
175
|
extras={extras}
|
|
169
176
|
sortedKeys={rowKeys ?? mappedKeys}
|
|
170
177
|
selected={selected}
|
|
171
|
-
disabled={disabled}
|
|
178
|
+
disabled={disabled || isRowDisabled}
|
|
172
179
|
/>
|
|
173
180
|
) : (
|
|
174
181
|
<DefaultRow
|
|
@@ -182,7 +189,7 @@ export function StaticTable<
|
|
|
182
189
|
? (_v) => onSelect?.(xor(selectedKeys ?? [], [key]))
|
|
183
190
|
: undefined
|
|
184
191
|
}
|
|
185
|
-
disabled={disabled}
|
|
192
|
+
disabled={disabled || isRowDisabled}
|
|
186
193
|
classNames={{
|
|
187
194
|
tableRow: classNames?.tableRow,
|
|
188
195
|
checkbox: classNames?.checkbox,
|
|
@@ -51,6 +51,7 @@ function StaticTable(props) {
|
|
|
51
51
|
sortKey,
|
|
52
52
|
sortDirection,
|
|
53
53
|
selectedKeys,
|
|
54
|
+
disabledKeys = [],
|
|
54
55
|
onSelect,
|
|
55
56
|
isLoading,
|
|
56
57
|
idName = 'id',
|
|
@@ -128,7 +129,8 @@ function StaticTable(props) {
|
|
|
128
129
|
return null;
|
|
129
130
|
}
|
|
130
131
|
data;
|
|
131
|
-
const selected = selectedKeys
|
|
132
|
+
const selected = selectedKeys && Array.isArray(selectedKeys) ? selectedKeys.includes((0, _get.default)(data, idName)) : undefined;
|
|
133
|
+
const isRowDisabled = disabledKeys && Array.isArray(disabledKeys) ? disabledKeys.includes((0, _get.default)(data, idName)) : false;
|
|
132
134
|
return TableRow ? /*#__PURE__*/React.createElement(TableRow, {
|
|
133
135
|
key: key,
|
|
134
136
|
data: data,
|
|
@@ -138,7 +140,7 @@ function StaticTable(props) {
|
|
|
138
140
|
extras: extras,
|
|
139
141
|
sortedKeys: rowKeys ?? mappedKeys,
|
|
140
142
|
selected: selected,
|
|
141
|
-
disabled: disabled
|
|
143
|
+
disabled: disabled || isRowDisabled
|
|
142
144
|
}) : /*#__PURE__*/React.createElement(_DefaultRow.DefaultRow, {
|
|
143
145
|
key: key,
|
|
144
146
|
data: data,
|
|
@@ -146,7 +148,7 @@ function StaticTable(props) {
|
|
|
146
148
|
headers: headers,
|
|
147
149
|
selected: selected,
|
|
148
150
|
onSelect: selectedKeys != null ? _v => onSelect?.((0, _xor.default)(selectedKeys ?? [], [key])) : undefined,
|
|
149
|
-
disabled: disabled,
|
|
151
|
+
disabled: disabled || isRowDisabled,
|
|
150
152
|
classNames: {
|
|
151
153
|
tableRow: classNames?.tableRow,
|
|
152
154
|
checkbox: classNames?.checkbox
|
|
@@ -60,6 +60,7 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
|
|
|
60
60
|
sortKey,
|
|
61
61
|
sortDirection,
|
|
62
62
|
selectedKeys,
|
|
63
|
+
disabledKeys = [],
|
|
63
64
|
onSelect,
|
|
64
65
|
isLoading,
|
|
65
66
|
idName = 'id',
|
|
@@ -104,7 +105,6 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
|
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
: undefined;
|
|
107
|
-
|
|
108
108
|
return (
|
|
109
109
|
<div
|
|
110
110
|
className={classify(css.tableContainer, classNames?.wrapper)}
|
|
@@ -165,7 +165,13 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
|
|
|
165
165
|
}
|
|
166
166
|
(data: Data);
|
|
167
167
|
const selected =
|
|
168
|
-
selectedKeys
|
|
168
|
+
selectedKeys && Array.isArray(selectedKeys)
|
|
169
|
+
? selectedKeys.includes(get(data, idName))
|
|
170
|
+
: undefined;
|
|
171
|
+
const isRowDisabled =
|
|
172
|
+
disabledKeys && Array.isArray(disabledKeys)
|
|
173
|
+
? disabledKeys.includes(get(data, idName))
|
|
174
|
+
: false;
|
|
169
175
|
|
|
170
176
|
return TableRow ? (
|
|
171
177
|
<TableRow
|
|
@@ -176,7 +182,7 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
|
|
|
176
182
|
extras={extras}
|
|
177
183
|
sortedKeys={rowKeys ?? mappedKeys}
|
|
178
184
|
selected={selected}
|
|
179
|
-
disabled={disabled}
|
|
185
|
+
disabled={disabled || isRowDisabled}
|
|
180
186
|
/>
|
|
181
187
|
) : (
|
|
182
188
|
<DefaultRow
|
|
@@ -190,7 +196,7 @@ export function StaticTable<Data: GenericObject, Extras: GenericObject>(props: {
|
|
|
190
196
|
? (_v) => onSelect?.(xor(selectedKeys ?? [], [key]))
|
|
191
197
|
: undefined
|
|
192
198
|
}
|
|
193
|
-
disabled={disabled}
|
|
199
|
+
disabled={disabled || isRowDisabled}
|
|
194
200
|
classNames={{
|
|
195
201
|
tableRow: classNames?.tableRow,
|
|
196
202
|
checkbox: classNames?.checkbox,
|
|
@@ -31,6 +31,7 @@ export type TableProps<T, U> = {
|
|
|
31
31
|
// Please start using this prop if you want internal sorting to work in the table
|
|
32
32
|
enableInternalSorting?: boolean;
|
|
33
33
|
selectedKeys?: string[];
|
|
34
|
+
disabledKeys?: string[];
|
|
34
35
|
onSelect?: (keys: string[]) => unknown;
|
|
35
36
|
idName?: $Keys<T>;
|
|
36
37
|
onSort?: (key: $Keys<T>, direction: SortDirection) => void;
|
|
@@ -116,6 +116,18 @@ export const TABLE_DOCS = {
|
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
|
+
disabledKeys: {
|
|
120
|
+
description:
|
|
121
|
+
'array of keys which are disabled. This prop is used to disable the checkbox and its events for particular rows.',
|
|
122
|
+
control: {
|
|
123
|
+
type: 'object',
|
|
124
|
+
},
|
|
125
|
+
table: {
|
|
126
|
+
type: {
|
|
127
|
+
summary: 'string[]',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
119
131
|
//onSelect?: (keys: string[]) => mixed
|
|
120
132
|
onSelect: {
|
|
121
133
|
description: 'callback function when any row is selected',
|
|
@@ -114,6 +114,17 @@ const TABLE_DOCS = {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
+
disabledKeys: {
|
|
118
|
+
description: 'array of keys which are disabled. This prop is used to disable the checkbox and its events for particular rows.',
|
|
119
|
+
control: {
|
|
120
|
+
type: 'object'
|
|
121
|
+
},
|
|
122
|
+
table: {
|
|
123
|
+
type: {
|
|
124
|
+
summary: 'string[]'
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
117
128
|
//onSelect?: (keys: string[]) => mixed
|
|
118
129
|
onSelect: {
|
|
119
130
|
description: 'callback function when any row is selected',
|
|
@@ -97,6 +97,16 @@ export const TABLE_DOCS = {
|
|
|
97
97
|
type: {summary: 'string[]'},
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
|
+
disabledKeys: {
|
|
101
|
+
description:
|
|
102
|
+
'array of keys which are disabled. This prop is used to disable the checkbox and its events for particular rows.',
|
|
103
|
+
control: {
|
|
104
|
+
type: 'object',
|
|
105
|
+
},
|
|
106
|
+
table: {
|
|
107
|
+
type: {summary: 'string[]'},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
100
110
|
//onSelect?: (keys: string[]) => mixed
|
|
101
111
|
onSelect: {
|
|
102
112
|
description: 'callback function when any row is selected',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import {elevationMenu} from '../../styles/variables/_elevation';
|
|
2
3
|
import {Chip} from '../Chip';
|
|
3
4
|
import {Tooltip} from '../Tooltip';
|
|
4
5
|
type Props<T> = {
|
|
@@ -23,7 +24,7 @@ function defaultResolveTokenValue<T>({
|
|
|
23
24
|
// $FlowFixMe[prop-missing] - assumes token has label and key
|
|
24
25
|
return (
|
|
25
26
|
// $FlowFixMe - assumes token has label and key
|
|
26
|
-
<Tooltip body={token?.label}>
|
|
27
|
+
<Tooltip body={token?.label} elevation={elevationMenu}>
|
|
27
28
|
<Chip // $FlowFixMe - assumes token has key
|
|
28
29
|
key={token?.key}
|
|
29
30
|
onDismiss={(_) => onDismiss?.(token)}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TokenValueChips = TokenValueChips;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _elevation = require("../../styles/variables/_elevation");
|
|
8
9
|
var _Chip = require("../Chip");
|
|
9
10
|
var _Tooltip = require("../Tooltip");
|
|
10
11
|
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); }
|
|
@@ -22,7 +23,8 @@ function defaultResolveTokenValue(_ref) {
|
|
|
22
23
|
/*#__PURE__*/
|
|
23
24
|
// $FlowFixMe - assumes token has label and key
|
|
24
25
|
React.createElement(_Tooltip.Tooltip, {
|
|
25
|
-
body: token?.label
|
|
26
|
+
body: token?.label,
|
|
27
|
+
elevation: _elevation.elevationMenu
|
|
26
28
|
}, /*#__PURE__*/React.createElement(_Chip.Chip
|
|
27
29
|
// $FlowFixMe - assumes token has key
|
|
28
30
|
, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow strict
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
+
import {elevationMenu} from '../../styles/variables/_elevation';
|
|
4
5
|
import {Chip} from '../Chip';
|
|
5
6
|
import {Tooltip} from '../Tooltip';
|
|
6
7
|
|
|
@@ -29,7 +30,7 @@ function defaultResolveTokenValue<T>({
|
|
|
29
30
|
|
|
30
31
|
return (
|
|
31
32
|
// $FlowFixMe - assumes token has label and key
|
|
32
|
-
<Tooltip body={token?.label}>
|
|
33
|
+
<Tooltip body={token?.label} elevation={elevationMenu}>
|
|
33
34
|
<Chip
|
|
34
35
|
// $FlowFixMe - assumes token has key
|
|
35
36
|
key={token?.key}
|
|
@@ -116,8 +116,10 @@ export const wrangleMoment = (date?: string | Date): Date => {
|
|
|
116
116
|
|
|
117
117
|
return date instanceof moment ? date.toDate() : parseISO(date);
|
|
118
118
|
};
|
|
119
|
-
export const formatIsoDate = (
|
|
120
|
-
|
|
119
|
+
export const formatIsoDate = (
|
|
120
|
+
date?: string | Date,
|
|
121
|
+
format: string = 'YYYY-MM-DD',
|
|
122
|
+
): string => moment.utc(date).format(format);
|
|
121
123
|
export const isStartOfRange = ({startDate}: DateRange, date: string): boolean =>
|
|
122
124
|
Boolean(startDate) && moment.utc(date).isSame(moment.utc(startDate), 'd');
|
|
123
125
|
export const isEndOfRange = ({endDate}: DateRange, date: string): boolean =>
|
|
@@ -389,3 +391,21 @@ export const isBetween = (
|
|
|
389
391
|
// If the date results in a date that exists in the calendar
|
|
390
392
|
export const isValid = (date?: string | null | undefined): boolean =>
|
|
391
393
|
moment.utc(date).isValid();
|
|
394
|
+
export const getFormattedDate = (
|
|
395
|
+
marker: string,
|
|
396
|
+
dateRange: DateRange,
|
|
397
|
+
): string => {
|
|
398
|
+
const {startDate, endDate} = dateRange;
|
|
399
|
+
|
|
400
|
+
switch (marker) {
|
|
401
|
+
case MARKERS.DATE_RANGE_START:
|
|
402
|
+
return startDate
|
|
403
|
+
? moment.utc(startDate).format('MMM DD, YYYY')
|
|
404
|
+
: 'MMM DD, YYYY';
|
|
405
|
+
|
|
406
|
+
default:
|
|
407
|
+
return endDate
|
|
408
|
+
? moment.utc(endDate).format('MMM DD, YYYY')
|
|
409
|
+
: 'MMM DD, YYYY';
|
|
410
|
+
}
|
|
411
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.wrangleMoment = exports.isValid = exports.isStartOfRange = exports.isStartDateEndDateSame = exports.isSameOrBefore = exports.isSameOrAfter = exports.isSame = exports.isEndOfRange = exports.isBetween = exports.isBefore = exports.isAfter = exports.inDateRange = exports.getValidDates = exports.getTimezones = exports.getSubtractedDate = exports.getMonthEndDate = exports.getDaysInMonth = exports.getAvailableMonths = exports.getAddedDate = exports.generateAvailableYears = exports.formatIsoDate = exports.checkRangeValidity = exports.WEEKDAYS = exports.NAVIGATION_ACTION = exports.MONTHS = exports.MARKERS = exports.DATE_RANGE_PICKER_ERRORS = void 0;
|
|
6
|
+
exports.wrangleMoment = exports.isValid = exports.isStartOfRange = exports.isStartDateEndDateSame = exports.isSameOrBefore = exports.isSameOrAfter = exports.isSame = exports.isEndOfRange = exports.isBetween = exports.isBefore = exports.isAfter = exports.inDateRange = exports.getValidDates = exports.getTimezones = exports.getSubtractedDate = exports.getMonthEndDate = exports.getFormattedDate = exports.getDaysInMonth = exports.getAvailableMonths = exports.getAddedDate = exports.generateAvailableYears = exports.formatIsoDate = exports.checkRangeValidity = exports.WEEKDAYS = exports.NAVIGATION_ACTION = exports.MONTHS = exports.MARKERS = exports.DATE_RANGE_PICKER_ERRORS = void 0;
|
|
7
7
|
var _parseISO = _interopRequireDefault(require("date-fns/parseISO"));
|
|
8
8
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
9
9
|
var _lodash = require("lodash");
|
|
@@ -104,7 +104,10 @@ const wrangleMoment = date => {
|
|
|
104
104
|
return date instanceof _moment.default ? date.toDate() : (0, _parseISO.default)(date);
|
|
105
105
|
};
|
|
106
106
|
exports.wrangleMoment = wrangleMoment;
|
|
107
|
-
const formatIsoDate =
|
|
107
|
+
const formatIsoDate = function (date) {
|
|
108
|
+
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD';
|
|
109
|
+
return _moment.default.utc(date).format(format);
|
|
110
|
+
};
|
|
108
111
|
exports.formatIsoDate = formatIsoDate;
|
|
109
112
|
const isStartOfRange = (_ref, date) => {
|
|
110
113
|
let {
|
|
@@ -323,4 +326,17 @@ const isBetween = (date, startRange, endRange) => _moment.default.utc(date).isBe
|
|
|
323
326
|
// If the date results in a date that exists in the calendar
|
|
324
327
|
exports.isBetween = isBetween;
|
|
325
328
|
const isValid = date => _moment.default.utc(date).isValid();
|
|
326
|
-
exports.isValid = isValid;
|
|
329
|
+
exports.isValid = isValid;
|
|
330
|
+
const getFormattedDate = (marker, dateRange) => {
|
|
331
|
+
const {
|
|
332
|
+
startDate,
|
|
333
|
+
endDate
|
|
334
|
+
} = dateRange;
|
|
335
|
+
switch (marker) {
|
|
336
|
+
case MARKERS.DATE_RANGE_START:
|
|
337
|
+
return startDate ? _moment.default.utc(startDate).format('MMM DD, YYYY') : 'MMM DD, YYYY';
|
|
338
|
+
default:
|
|
339
|
+
return endDate ? _moment.default.utc(endDate).format('MMM DD, YYYY') : 'MMM DD, YYYY';
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
exports.getFormattedDate = getFormattedDate;
|
|
@@ -88,8 +88,10 @@ export const wrangleMoment = (date?: string | Date): Date => {
|
|
|
88
88
|
return date instanceof moment ? date.toDate() : parseISO(date);
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
-
export const formatIsoDate = (
|
|
92
|
-
|
|
91
|
+
export const formatIsoDate = (
|
|
92
|
+
date?: string | Date,
|
|
93
|
+
format?: string = 'YYYY-MM-DD',
|
|
94
|
+
): string => moment.utc(date).format(format);
|
|
93
95
|
|
|
94
96
|
export const isStartOfRange = ({startDate}: DateRange, date: string): boolean =>
|
|
95
97
|
Boolean(startDate) && moment.utc(date).isSame(moment.utc(startDate), 'd');
|
|
@@ -370,3 +372,20 @@ export const isBetween = (
|
|
|
370
372
|
|
|
371
373
|
// If the date results in a date that exists in the calendar
|
|
372
374
|
export const isValid = (date?: ?string): boolean => moment.utc(date).isValid();
|
|
375
|
+
|
|
376
|
+
export const getFormattedDate = (
|
|
377
|
+
marker: string,
|
|
378
|
+
dateRange: DateRange,
|
|
379
|
+
): string => {
|
|
380
|
+
const {startDate, endDate} = dateRange;
|
|
381
|
+
switch (marker) {
|
|
382
|
+
case MARKERS.DATE_RANGE_START:
|
|
383
|
+
return startDate
|
|
384
|
+
? moment.utc(startDate).format('MMM DD, YYYY')
|
|
385
|
+
: 'MMM DD, YYYY';
|
|
386
|
+
default:
|
|
387
|
+
return endDate
|
|
388
|
+
? moment.utc(endDate).format('MMM DD, YYYY')
|
|
389
|
+
: 'MMM DD, YYYY';
|
|
390
|
+
}
|
|
391
|
+
};
|