@atlaskit/datetime-picker 15.5.2 → 15.7.0

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.
@@ -8,14 +8,13 @@ import { forwardRef, useCallback, useEffect, useReducer, useRef, useState } from
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { isValid, parseISO } from 'date-fns';
11
- // This is a deprecated component but we will be able to use the actual hook
12
- // version very soon from converting this to functional. And also React 18 is on
13
- // the horizon
14
- import { useUID } from 'react-uid';
15
11
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
16
- import CalendarIcon from '@atlaskit/icon/glyph/calendar';
12
+ import { useId } from '@atlaskit/ds-lib/use-id';
13
+ import CalendarIconNew from '@atlaskit/icon/core/migration/calendar';
14
+ import CalendarIconOld from '@atlaskit/icon/glyph/calendar';
17
15
  import { createLocalizationProvider } from '@atlaskit/locale';
18
- import { Pressable, xcss } from '@atlaskit/primitives';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
17
+ import { Box, Pressable, xcss } from '@atlaskit/primitives';
19
18
  import Select, { mergeStyles } from '@atlaskit/select';
20
19
  import { N500, N70 } from '@atlaskit/theme/colors';
21
20
  import VisuallyHidden from '@atlaskit/visually-hidden';
@@ -26,7 +25,7 @@ import { Menu } from '../internal/menu';
26
25
  import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
27
26
  import { makeSingleValue } from '../internal/single-value';
28
27
  const packageName = "@atlaskit/datetime-picker";
29
- const packageVersion = "15.5.2";
28
+ const packageVersion = "15.7.0";
30
29
  const analyticsAttributes = {
31
30
  componentName: 'datePicker',
32
31
  packageName,
@@ -35,6 +34,16 @@ const analyticsAttributes = {
35
34
  const pickerContainerStyles = css({
36
35
  position: 'relative'
37
36
  });
37
+ const dropdownIndicatorStyles = xcss({
38
+ minWidth: "var(--ds-space-300, 24px)",
39
+ minHeight: "var(--ds-space-300, 24px)",
40
+ display: 'flex',
41
+ alignItems: 'center',
42
+ justifyContent: 'center'
43
+ });
44
+ const CalendarIcon = fg('platform-visual-refresh-icon-ads-migration') ? CalendarIconNew :
45
+ // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
46
+ CalendarIconOld;
38
47
  const iconContainerStyles = css({
39
48
  display: 'flex',
40
49
  height: '100%',
@@ -52,9 +61,16 @@ const iconContainerStyles = css({
52
61
  const iconSpacingWithClearButtonStyles = css({
53
62
  marginInlineEnd: "var(--ds-space-400, 2rem)"
54
63
  });
64
+ const iconSpacingWithoutClearButtonStylesNew = css({
65
+ marginInlineEnd: "var(--ds-space-050, 0.25rem)"
66
+ });
55
67
  const iconSpacingWithoutClearButtonStyles = css({
56
68
  marginInlineEnd: "var(--ds-space-025, 0.125rem)"
57
69
  });
70
+ const calendarButtonFixedSizeStyles = xcss({
71
+ width: `${32 / 14}em`,
72
+ height: `${32 / 14}em`
73
+ });
58
74
  const calendarButtonStyles = xcss({
59
75
  borderRadius: 'border.radius',
60
76
  ':hover': {
@@ -80,13 +96,14 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
80
96
  const {
81
97
  appearance = 'default',
82
98
  autoFocus = false,
99
+ clearControlLabel = 'Clear',
83
100
  hideIcon = false,
84
101
  openCalendarLabel = 'Open calendar',
85
102
  defaultIsOpen = false,
86
103
  defaultValue = '',
87
104
  disabled = [],
88
105
  disabledDateFilter = _ => false,
89
- icon = CalendarIcon,
106
+ icon: Icon = CalendarIcon,
90
107
  id = '',
91
108
  innerProps = {},
92
109
  inputLabel = 'Date picker',
@@ -385,7 +402,15 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
385
402
  actualSelectInputValue = selectInputValue;
386
403
  const menuIsOpen = getIsOpen() && !isDisabled;
387
404
  const showClearIndicator = Boolean((getterValue || selectInputValue) && !hideIcon);
388
- const dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
405
+ let clearIndicator = Icon;
406
+
407
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
408
+ if (fg('platform-visual-refresh-icons') && fg('platform-visual-refresh-icon-ads-migration')) {
409
+ clearIndicator = props => jsx(Box, {
410
+ xcss: dropdownIndicatorStyles
411
+ }, jsx(Icon, props));
412
+ }
413
+ const dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
389
414
  const SingleValue = makeSingleValue({
390
415
  lang: propLocale
391
416
  });
@@ -451,7 +476,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
451
476
 
452
477
  // `label` takes precedence of the `inputLabel`
453
478
  const fullopenCalendarLabel = label || inputLabel ? `${label || inputLabel} , ${openCalendarLabel}` : openCalendarLabel;
454
- const openCalendarLabelId = `open-calendar-label--${useUID()}`;
479
+ const openCalendarLabelId = `open-calendar-label--${useId()}`;
455
480
  return (
456
481
  // These event handlers must be on this element because the events come
457
482
  // from different child elements.
@@ -475,6 +500,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
475
500
  "aria-describedby": ariaDescribedBy,
476
501
  "aria-label": label || undefined,
477
502
  autoFocus: autoFocus,
503
+ clearControlLabel: clearControlLabel,
478
504
  closeMenuOnSelect: true
479
505
  // For some reason, this and the below `styles` type error _only_ show
480
506
  // up when you alter some of the properties in the `selectComponents`
@@ -526,7 +552,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
526
552
  previousMonthLabel: previousMonthLabel,
527
553
  shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
528
554
  })), shouldShowCalendarButton && !isDisabled ? jsx("div", {
529
- css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
555
+ css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : fg('platform-visual-refresh-icon-ads-migration') ? iconSpacingWithoutClearButtonStylesNew : iconSpacingWithoutClearButtonStyles]
530
556
  }, inputLabelId && jsx(VisuallyHidden, {
531
557
  id: openCalendarLabelId
532
558
  }, ", ", openCalendarLabel), jsx(Pressable, _extends({}, inputLabelId ? {
@@ -540,12 +566,15 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
540
566
  testId: testId && `${testId}--open-calendar-button`,
541
567
  type: "button",
542
568
  backgroundColor: "color.background.neutral.subtle",
543
- padding: "space.050",
544
- xcss: calendarButtonStyles
545
- }), jsx(CalendarIcon, {
546
- label: "",
569
+ padding: fg('platform-visual-refresh-icon-ads-migration') ? 'space.0' : 'space.050',
570
+ xcss: [calendarButtonStyles, fg('platform-visual-refresh-icon-ads-migration') && calendarButtonFixedSizeStyles]
571
+ }), jsx(CalendarIcon, _extends({
572
+ label: ""
573
+ }, fg('platform-visual-refresh-icon-ads-migration') ? {
574
+ color: "var(--ds-icon, #44546F)"
575
+ } : {
547
576
  primaryColor: "var(--ds-icon, #44546F)"
548
- }))) : null)
577
+ })))) : null)
549
578
  );
550
579
  });
551
580
  export default DatePicker;
@@ -9,7 +9,7 @@ import React from 'react';
9
9
  import { css, jsx } from '@emotion/react';
10
10
  import { format, isValid, parseISO } from 'date-fns';
11
11
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
12
- import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
12
+ import SelectClearIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
14
  import { mergeStyles } from '@atlaskit/select';
15
15
  import { N500, N70 } from '@atlaskit/theme/colors';
@@ -22,7 +22,7 @@ import DatePickerNew from './date-picker-fc';
22
22
  import TimePicker from './time-picker';
23
23
  const DatePicker = componentWithCondition(() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
24
24
  const packageName = "@atlaskit/datetime-picker";
25
- const packageVersion = "15.5.2";
25
+ const packageVersion = "15.7.0";
26
26
  // Make DatePicker 50% the width of DateTimePicker
27
27
  // If rendering an icon container, shrink the TimePicker
28
28
  const datePickerContainerStyles = css({
@@ -364,10 +364,10 @@ class DateTimePickerComponent extends React.Component {
364
364
  tabIndex: -1,
365
365
  type: "button"
366
366
  }, jsx(SelectClearIcon, {
367
- size: "small",
368
- primaryColor: "inherit",
367
+ LEGACY_size: "small",
368
+ color: "currentColor",
369
369
  label: clearControlLabel
370
- })) : null);
370
+ }), ' ') : null);
371
371
  }
372
372
  }
373
373
  _defineProperty(DateTimePickerComponent, "defaultProps", dateTimePickerDefaultProps);
@@ -8,7 +8,7 @@ import React, { forwardRef, useCallback, useEffect, useState } from 'react';
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { format, isValid, parseISO } from 'date-fns';
10
10
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
11
- import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
11
+ import SelectClearIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
12
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
13
  import { mergeStyles } from '@atlaskit/select';
14
14
  import { N500, N70 } from '@atlaskit/theme/colors';
@@ -21,7 +21,7 @@ import DatePickerNew from './date-picker-fc';
21
21
  import TimePicker from './time-picker';
22
22
  const DatePicker = componentWithCondition(() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
23
23
  const packageName = "@atlaskit/datetime-picker";
24
- const packageVersion = "15.5.2";
24
+ const packageVersion = "15.7.0";
25
25
  const analyticsAttributes = {
26
26
  componentName: 'dateTimePicker',
27
27
  packageName,
@@ -355,9 +355,9 @@ const DateTimePicker = /*#__PURE__*/forwardRef(({
355
355
  tabIndex: -1,
356
356
  type: "button"
357
357
  }, jsx(SelectClearIcon, {
358
- size: "small",
359
- primaryColor: "inherit",
358
+ LEGACY_size: "small",
359
+ color: "currentColor",
360
360
  label: clearControlLabel
361
- })) : null);
361
+ }), ' ') : null);
362
362
  });
363
363
  export default DateTimePicker;
@@ -11,7 +11,7 @@ import parseTime from '../internal/parse-time';
11
11
  import { convertTokens } from '../internal/parse-tokens';
12
12
  import { makeSingleValue } from '../internal/single-value';
13
13
  const packageName = "@atlaskit/datetime-picker";
14
- const packageVersion = "15.5.2";
14
+ const packageVersion = "15.7.0";
15
15
  const menuStyles = {
16
16
  /* Need to remove default absolute positioning as that causes issues with position fixed */
17
17
  position: 'static',
@@ -19,14 +19,13 @@ import { Component, createRef } from 'react';
19
19
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
20
  import { css, jsx } from '@emotion/react';
21
21
  import { isValid, parseISO } from 'date-fns';
22
- // This is a deprecated component but we will be able to use the actual hook
23
- // version very soon from converting this to functional. And also React 18 is on
24
- // the horizon
25
- import { UID } from 'react-uid';
26
22
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
27
- import CalendarIcon from '@atlaskit/icon/glyph/calendar';
23
+ import { IdProvider } from '@atlaskit/ds-lib/use-id';
24
+ import CalendarIconNew from '@atlaskit/icon/core/migration/calendar';
25
+ import CalendarIconOld from '@atlaskit/icon/glyph/calendar';
28
26
  import { createLocalizationProvider } from '@atlaskit/locale';
29
- import { Pressable, xcss } from '@atlaskit/primitives';
27
+ import { fg } from '@atlaskit/platform-feature-flags';
28
+ import { Box, Pressable, xcss } from '@atlaskit/primitives';
30
29
  import Select, { mergeStyles } from '@atlaskit/select';
31
30
  import { N500, N70 } from '@atlaskit/theme/colors';
32
31
  import VisuallyHidden from '@atlaskit/visually-hidden';
@@ -37,7 +36,17 @@ import { Menu } from '../internal/menu';
37
36
  import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
38
37
  import { makeSingleValue } from '../internal/single-value';
39
38
  var packageName = "@atlaskit/datetime-picker";
40
- var packageVersion = "15.5.2";
39
+ var packageVersion = "15.7.0";
40
+ var dropdownIndicatorStyles = xcss({
41
+ minWidth: "var(--ds-space-300, 24px)",
42
+ minHeight: "var(--ds-space-300, 24px)",
43
+ display: 'flex',
44
+ alignItems: 'center',
45
+ justifyContent: 'center'
46
+ });
47
+ var CalendarIcon = fg('platform-visual-refresh-icon-ads-migration') ? CalendarIconNew :
48
+ // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
49
+ CalendarIconOld;
41
50
  var datePickerDefaultProps = {
42
51
  defaultIsOpen: false,
43
52
  defaultValue: '',
@@ -76,9 +85,16 @@ var iconContainerStyles = css({
76
85
  var iconSpacingWithClearButtonStyles = css({
77
86
  marginInlineEnd: "var(--ds-space-400, 2rem)"
78
87
  });
88
+ var iconSpacingWithoutClearButtonStylesNew = css({
89
+ marginInlineEnd: "var(--ds-space-050, 0.25rem)"
90
+ });
79
91
  var iconSpacingWithoutClearButtonStyles = css({
80
92
  marginInlineEnd: "var(--ds-space-025, 0.125rem)"
81
93
  });
94
+ var calendarButtonFixedSizeStyles = xcss({
95
+ width: "".concat(32 / 14, "em"),
96
+ height: "".concat(32 / 14, "em")
97
+ });
82
98
  var calendarButtonStyles = xcss({
83
99
  borderRadius: 'border.radius',
84
100
  ':hover': {
@@ -415,6 +431,8 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
415
431
  ariaDescribedBy = _this$props['aria-describedby'],
416
432
  _this$props$autoFocus = _this$props.autoFocus,
417
433
  autoFocus = _this$props$autoFocus === void 0 ? false : _this$props$autoFocus,
434
+ _this$props$clearCont = _this$props.clearControlLabel,
435
+ clearControlLabel = _this$props$clearCont === void 0 ? 'Clear' : _this$props$clearCont,
418
436
  _this$props$hideIcon = _this$props.hideIcon,
419
437
  hideIcon = _this$props$hideIcon === void 0 ? false : _this$props$hideIcon,
420
438
  _this$props$openCalen = _this$props.openCalendarLabel,
@@ -422,7 +440,7 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
422
440
  disabled = _this$props.disabled,
423
441
  disabledDateFilter = _this$props.disabledDateFilter,
424
442
  _this$props$icon = _this$props.icon,
425
- icon = _this$props$icon === void 0 ? CalendarIcon : _this$props$icon,
443
+ Icon = _this$props$icon === void 0 ? CalendarIcon : _this$props$icon,
426
444
  _this$props$id = _this$props.id,
427
445
  id = _this$props$id === void 0 ? '' : _this$props$id,
428
446
  _this$props$innerProp = _this$props.innerProps,
@@ -460,7 +478,17 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
460
478
  actualSelectInputValue = selectInputValue;
461
479
  var menuIsOpen = this.getIsOpen() && !isDisabled;
462
480
  var showClearIndicator = Boolean((value || selectInputValue) && !hideIcon);
463
- var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
481
+ var clearIndicator = Icon;
482
+
483
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
484
+ if (fg('platform-visual-refresh-icons') && fg('platform-visual-refresh-icon-ads-migration')) {
485
+ clearIndicator = function clearIndicator(props) {
486
+ return jsx(Box, {
487
+ xcss: dropdownIndicatorStyles
488
+ }, jsx(Icon, props));
489
+ };
490
+ }
491
+ var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
464
492
  var SingleValue = makeSingleValue({
465
493
  lang: this.props.locale
466
494
  });
@@ -547,6 +575,7 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
547
575
  "aria-describedby": ariaDescribedBy,
548
576
  "aria-label": label || undefined,
549
577
  autoFocus: autoFocus,
578
+ clearControlLabel: clearControlLabel,
550
579
  closeMenuOnSelect: true
551
580
  // FOr some reason, this and the below `styles` type error _only_ show
552
581
  // up when you alter some of the properties in the `selectComponents`
@@ -597,13 +626,12 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
597
626
  onCalendarSelect: calendarProps.onCalendarSelect,
598
627
  previousMonthLabel: previousMonthLabel,
599
628
  shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
600
- })), shouldShowCalendarButton && !isDisabled ? jsx(UID, {
601
- name: function name(id) {
602
- return "open-calendar-label--".concat(id);
603
- }
604
- }, function (openCalendarLabelId) {
629
+ })), shouldShowCalendarButton && !isDisabled ? jsx(IdProvider, {
630
+ prefix: "open-calendar-label--"
631
+ }, function (_ref3) {
632
+ var openCalendarLabelId = _ref3.id;
605
633
  return jsx("div", {
606
- css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
634
+ css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : fg('platform-visual-refresh-icon-ads-migration') ? iconSpacingWithoutClearButtonStylesNew : iconSpacingWithoutClearButtonStyles]
607
635
  }, inputLabelId && jsx(VisuallyHidden, {
608
636
  id: openCalendarLabelId
609
637
  }, ", ", openCalendarLabel), jsx(Pressable, _extends({}, inputLabelId ? {
@@ -617,12 +645,15 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
617
645
  testId: testId && "".concat(testId, "--open-calendar-button"),
618
646
  type: "button",
619
647
  backgroundColor: "color.background.neutral.subtle",
620
- padding: "space.050",
621
- xcss: calendarButtonStyles
622
- }), jsx(CalendarIcon, {
623
- label: "",
648
+ padding: fg('platform-visual-refresh-icon-ads-migration') ? 'space.0' : 'space.050',
649
+ xcss: [calendarButtonStyles, fg('platform-visual-refresh-icon-ads-migration') && calendarButtonFixedSizeStyles]
650
+ }), jsx(CalendarIcon, _extends({
651
+ label: ""
652
+ }, fg('platform-visual-refresh-icon-ads-migration') ? {
653
+ color: "var(--ds-icon, #44546F)"
654
+ } : {
624
655
  primaryColor: "var(--ds-icon, #44546F)"
625
- })));
656
+ }))));
626
657
  }) : null)
627
658
  );
628
659
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["appearance", "autoFocus", "hideIcon", "openCalendarLabel", "defaultIsOpen", "defaultValue", "disabled", "disabledDateFilter", "icon", "id", "innerProps", "inputLabel", "inputLabelId", "isDisabled", "isInvalid", "isRequired", "label", "name", "onBlur", "onChange", "onFocus", "selectProps", "shouldShowCalendarButton", "spacing", "locale", "value", "isOpen", "maxDate", "minDate", "weekStartDay", "formatDisplayLabel", "testId", "aria-describedby", "placeholder", "nextMonthLabel", "previousMonthLabel"];
5
+ var _excluded = ["appearance", "autoFocus", "clearControlLabel", "hideIcon", "openCalendarLabel", "defaultIsOpen", "defaultValue", "disabled", "disabledDateFilter", "icon", "id", "innerProps", "inputLabel", "inputLabelId", "isDisabled", "isInvalid", "isRequired", "label", "name", "onBlur", "onChange", "onFocus", "selectProps", "shouldShowCalendarButton", "spacing", "locale", "value", "isOpen", "maxDate", "minDate", "weekStartDay", "formatDisplayLabel", "testId", "aria-describedby", "placeholder", "nextMonthLabel", "previousMonthLabel"];
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  /**
@@ -14,14 +14,13 @@ import { forwardRef, useCallback, useEffect, useReducer, useRef, useState } from
14
14
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
15
15
  import { css, jsx } from '@emotion/react';
16
16
  import { isValid, parseISO } from 'date-fns';
17
- // This is a deprecated component but we will be able to use the actual hook
18
- // version very soon from converting this to functional. And also React 18 is on
19
- // the horizon
20
- import { useUID } from 'react-uid';
21
17
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
22
- import CalendarIcon from '@atlaskit/icon/glyph/calendar';
18
+ import { useId } from '@atlaskit/ds-lib/use-id';
19
+ import CalendarIconNew from '@atlaskit/icon/core/migration/calendar';
20
+ import CalendarIconOld from '@atlaskit/icon/glyph/calendar';
23
21
  import { createLocalizationProvider } from '@atlaskit/locale';
24
- import { Pressable, xcss } from '@atlaskit/primitives';
22
+ import { fg } from '@atlaskit/platform-feature-flags';
23
+ import { Box, Pressable, xcss } from '@atlaskit/primitives';
25
24
  import Select, { mergeStyles } from '@atlaskit/select';
26
25
  import { N500, N70 } from '@atlaskit/theme/colors';
27
26
  import VisuallyHidden from '@atlaskit/visually-hidden';
@@ -32,7 +31,7 @@ import { Menu } from '../internal/menu';
32
31
  import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
33
32
  import { makeSingleValue } from '../internal/single-value';
34
33
  var packageName = "@atlaskit/datetime-picker";
35
- var packageVersion = "15.5.2";
34
+ var packageVersion = "15.7.0";
36
35
  var analyticsAttributes = {
37
36
  componentName: 'datePicker',
38
37
  packageName: packageName,
@@ -41,6 +40,16 @@ var analyticsAttributes = {
41
40
  var pickerContainerStyles = css({
42
41
  position: 'relative'
43
42
  });
43
+ var dropdownIndicatorStyles = xcss({
44
+ minWidth: "var(--ds-space-300, 24px)",
45
+ minHeight: "var(--ds-space-300, 24px)",
46
+ display: 'flex',
47
+ alignItems: 'center',
48
+ justifyContent: 'center'
49
+ });
50
+ var CalendarIcon = fg('platform-visual-refresh-icon-ads-migration') ? CalendarIconNew :
51
+ // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
52
+ CalendarIconOld;
44
53
  var iconContainerStyles = css({
45
54
  display: 'flex',
46
55
  height: '100%',
@@ -58,9 +67,16 @@ var iconContainerStyles = css({
58
67
  var iconSpacingWithClearButtonStyles = css({
59
68
  marginInlineEnd: "var(--ds-space-400, 2rem)"
60
69
  });
70
+ var iconSpacingWithoutClearButtonStylesNew = css({
71
+ marginInlineEnd: "var(--ds-space-050, 0.25rem)"
72
+ });
61
73
  var iconSpacingWithoutClearButtonStyles = css({
62
74
  marginInlineEnd: "var(--ds-space-025, 0.125rem)"
63
75
  });
76
+ var calendarButtonFixedSizeStyles = xcss({
77
+ width: "".concat(32 / 14, "em"),
78
+ height: "".concat(32 / 14, "em")
79
+ });
64
80
  var calendarButtonStyles = xcss({
65
81
  borderRadius: 'border.radius',
66
82
  ':hover': {
@@ -87,6 +103,8 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
87
103
  appearance = _props$appearance === void 0 ? 'default' : _props$appearance,
88
104
  _props$autoFocus = props.autoFocus,
89
105
  autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,
106
+ _props$clearControlLa = props.clearControlLabel,
107
+ clearControlLabel = _props$clearControlLa === void 0 ? 'Clear' : _props$clearControlLa,
90
108
  _props$hideIcon = props.hideIcon,
91
109
  hideIcon = _props$hideIcon === void 0 ? false : _props$hideIcon,
92
110
  _props$openCalendarLa = props.openCalendarLabel,
@@ -102,7 +120,7 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
102
120
  return false;
103
121
  } : _props$disabledDateFi,
104
122
  _props$icon = props.icon,
105
- icon = _props$icon === void 0 ? CalendarIcon : _props$icon,
123
+ Icon = _props$icon === void 0 ? CalendarIcon : _props$icon,
106
124
  _props$id = props.id,
107
125
  id = _props$id === void 0 ? '' : _props$id,
108
126
  _props$innerProps = props.innerProps,
@@ -449,7 +467,17 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
449
467
  actualSelectInputValue = selectInputValue;
450
468
  var menuIsOpen = getIsOpen() && !isDisabled;
451
469
  var showClearIndicator = Boolean((getterValue || selectInputValue) && !hideIcon);
452
- var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
470
+ var clearIndicator = Icon;
471
+
472
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
473
+ if (fg('platform-visual-refresh-icons') && fg('platform-visual-refresh-icon-ads-migration')) {
474
+ clearIndicator = function clearIndicator(props) {
475
+ return jsx(Box, {
476
+ xcss: dropdownIndicatorStyles
477
+ }, jsx(Icon, props));
478
+ };
479
+ }
480
+ var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
453
481
  var SingleValue = makeSingleValue({
454
482
  lang: propLocale
455
483
  });
@@ -513,7 +541,7 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
513
541
 
514
542
  // `label` takes precedence of the `inputLabel`
515
543
  var fullopenCalendarLabel = label || inputLabel ? "".concat(label || inputLabel, " , ").concat(openCalendarLabel) : openCalendarLabel;
516
- var openCalendarLabelId = "open-calendar-label--".concat(useUID());
544
+ var openCalendarLabelId = "open-calendar-label--".concat(useId());
517
545
  return (
518
546
  // These event handlers must be on this element because the events come
519
547
  // from different child elements.
@@ -537,6 +565,7 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
537
565
  "aria-describedby": ariaDescribedBy,
538
566
  "aria-label": label || undefined,
539
567
  autoFocus: autoFocus,
568
+ clearControlLabel: clearControlLabel,
540
569
  closeMenuOnSelect: true
541
570
  // For some reason, this and the below `styles` type error _only_ show
542
571
  // up when you alter some of the properties in the `selectComponents`
@@ -588,7 +617,7 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
588
617
  previousMonthLabel: previousMonthLabel,
589
618
  shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
590
619
  })), shouldShowCalendarButton && !isDisabled ? jsx("div", {
591
- css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
620
+ css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : fg('platform-visual-refresh-icon-ads-migration') ? iconSpacingWithoutClearButtonStylesNew : iconSpacingWithoutClearButtonStyles]
592
621
  }, inputLabelId && jsx(VisuallyHidden, {
593
622
  id: openCalendarLabelId
594
623
  }, ", ", openCalendarLabel), jsx(Pressable, _extends({}, inputLabelId ? {
@@ -602,12 +631,15 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
602
631
  testId: testId && "".concat(testId, "--open-calendar-button"),
603
632
  type: "button",
604
633
  backgroundColor: "color.background.neutral.subtle",
605
- padding: "space.050",
606
- xcss: calendarButtonStyles
607
- }), jsx(CalendarIcon, {
608
- label: "",
634
+ padding: fg('platform-visual-refresh-icon-ads-migration') ? 'space.0' : 'space.050',
635
+ xcss: [calendarButtonStyles, fg('platform-visual-refresh-icon-ads-migration') && calendarButtonFixedSizeStyles]
636
+ }), jsx(CalendarIcon, _extends({
637
+ label: ""
638
+ }, fg('platform-visual-refresh-icon-ads-migration') ? {
639
+ color: "var(--ds-icon, #44546F)"
640
+ } : {
609
641
  primaryColor: "var(--ds-icon, #44546F)"
610
- }))) : null)
642
+ })))) : null)
611
643
  );
612
644
  });
613
645
  export default DatePicker;
@@ -19,7 +19,7 @@ import React from 'react';
19
19
  import { css, jsx } from '@emotion/react';
20
20
  import { format, isValid, parseISO } from 'date-fns';
21
21
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
22
- import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
22
+ import SelectClearIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
23
23
  import { fg } from '@atlaskit/platform-feature-flags';
24
24
  import { mergeStyles } from '@atlaskit/select';
25
25
  import { N500, N70 } from '@atlaskit/theme/colors';
@@ -34,7 +34,7 @@ var DatePicker = componentWithCondition(function () {
34
34
  return fg('dst-date-picker-use-functional-component');
35
35
  }, DatePickerNew, DatePickerOld);
36
36
  var packageName = "@atlaskit/datetime-picker";
37
- var packageVersion = "15.5.2";
37
+ var packageVersion = "15.7.0";
38
38
  // Make DatePicker 50% the width of DateTimePicker
39
39
  // If rendering an icon container, shrink the TimePicker
40
40
  var datePickerContainerStyles = css({
@@ -399,10 +399,10 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
399
399
  tabIndex: -1,
400
400
  type: "button"
401
401
  }, jsx(SelectClearIcon, {
402
- size: "small",
403
- primaryColor: "inherit",
402
+ LEGACY_size: "small",
403
+ color: "currentColor",
404
404
  label: clearControlLabel
405
- })) : null);
405
+ }), ' ') : null);
406
406
  }
407
407
  }]);
408
408
  return DateTimePickerComponent;
@@ -15,7 +15,7 @@ import React, { forwardRef, useCallback, useEffect, useState } from 'react';
15
15
  import { css, jsx } from '@emotion/react';
16
16
  import { format, isValid, parseISO } from 'date-fns';
17
17
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
18
- import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
18
+ import SelectClearIcon from '@atlaskit/icon/utility/migration/cross-circle--select-clear';
19
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
20
  import { mergeStyles } from '@atlaskit/select';
21
21
  import { N500, N70 } from '@atlaskit/theme/colors';
@@ -30,7 +30,7 @@ var DatePicker = componentWithCondition(function () {
30
30
  return fg('dst-date-picker-use-functional-component');
31
31
  }, DatePickerNew, DatePickerOld);
32
32
  var packageName = "@atlaskit/datetime-picker";
33
- var packageVersion = "15.5.2";
33
+ var packageVersion = "15.7.0";
34
34
  var analyticsAttributes = {
35
35
  componentName: 'dateTimePicker',
36
36
  packageName: packageName,
@@ -383,9 +383,9 @@ var DateTimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
383
383
  tabIndex: -1,
384
384
  type: "button"
385
385
  }, jsx(SelectClearIcon, {
386
- size: "small",
387
- primaryColor: "inherit",
386
+ LEGACY_size: "small",
387
+ color: "currentColor",
388
388
  label: clearControlLabel
389
- })) : null);
389
+ }), ' ') : null);
390
390
  });
391
391
  export default DateTimePicker;
@@ -17,7 +17,7 @@ import parseTime from '../internal/parse-time';
17
17
  import { convertTokens } from '../internal/parse-tokens';
18
18
  import { makeSingleValue } from '../internal/single-value';
19
19
  var packageName = "@atlaskit/datetime-picker";
20
- var packageVersion = "15.5.2";
20
+ var packageVersion = "15.7.0";
21
21
  var menuStyles = {
22
22
  /* Need to remove default absolute positioning as that causes issues with position fixed */
23
23
  position: 'static',
@@ -97,7 +97,7 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
97
97
  onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
98
98
  onChange: (_value: string) => void;
99
99
  onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
100
- } & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "appearance" | "isDisabled" | "innerProps" | "selectProps" | "id" | "aria-describedby" | "value" | "testId" | "icon" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
100
+ } & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "label" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "appearance" | "isDisabled" | "innerProps" | "selectProps" | "id" | "aria-describedby" | "value" | "testId" | "icon" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "autoFocus" | "clearControlLabel" | "isInvalid" | "isRequired" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
101
101
  defaultIsOpen: boolean;
102
102
  defaultValue: string;
103
103
  disabled: string[];
@@ -115,5 +115,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
115
115
  onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
116
116
  onChange: (_value: string) => void;
117
117
  onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
118
- }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "appearance" | "isDisabled" | "innerProps" | "selectProps" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "value" | "testId" | "icon" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
118
+ }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "label" | "key" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "appearance" | "isDisabled" | "innerProps" | "selectProps" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "value" | "testId" | "icon" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "autoFocus" | "clearControlLabel" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
119
119
  export default DatePicker;
@@ -26,5 +26,5 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<DatePic
26
26
  } & {
27
27
  inputValue?: string | undefined;
28
28
  }) | undefined;
29
- }, "label" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "appearance" | "isDisabled" | "innerProps" | "selectProps" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "value" | "testId" | "icon" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "autoFocus" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
29
+ }, "label" | "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "appearance" | "isDisabled" | "innerProps" | "selectProps" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "value" | "testId" | "icon" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "weekStartDay" | "createAnalyticsEvent" | "autoFocus" | "clearControlLabel" | "isInvalid" | "isRequired" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<unknown>>;
30
30
  export default DatePicker;