@spaced-out/ui-design-system 0.3.41 → 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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.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
+
5
18
  ### [0.3.41](https://github.com/spaced-out/ui-design-system/compare/v0.3.40...v0.3.41) (2025-05-19)
6
19
 
7
20
 
@@ -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]: showStatusIndicator || disableHoverState,
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={showStatusIndicator || disableHoverState ? undefined : 0}
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]: showStatusIndicator || disableHoverState,
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={showStatusIndicator || disableHoverState ? undefined : 0}
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, SubTitleExtraSmall, TEXT_COLORS} from '../Text';
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(_Text.SubTitleExtraSmall, {
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, SubTitleExtraSmall, TEXT_COLORS} from '../Text';
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
- </CardHeader>
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, null, /*#__PURE__*/React.createElement(_Card.CardTitle, {
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
- </CardHeader>
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 (!isTransitioning && !isOpen) {
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 (!isTransitioning && !isOpen) {
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 (!isTransitioning && !isOpen) {
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
 
@@ -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 = (date?: string | Date): string =>
120
- moment.utc(date).format('YYYY-MM-DD');
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 = date => _moment.default.utc(date).format('YYYY-MM-DD');
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 = (date?: string | Date): string =>
92
- moment.utc(date).format('YYYY-MM-DD');
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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.3.41",
3
+ "version": "0.3.42",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {