@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.
- package/CHANGELOG.md +23 -0
- package/dist/cjs/components/date-picker-class.js +50 -19
- package/dist/cjs/components/date-picker-fc.js +48 -16
- package/dist/cjs/components/date-time-picker-class.js +6 -6
- package/dist/cjs/components/date-time-picker-fc.js +6 -6
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/es2019/components/date-picker-class.js +49 -18
- package/dist/es2019/components/date-picker-fc.js +45 -16
- package/dist/es2019/components/date-time-picker-class.js +5 -5
- package/dist/es2019/components/date-time-picker-fc.js +5 -5
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/esm/components/date-picker-class.js +51 -20
- package/dist/esm/components/date-picker-fc.js +49 -17
- package/dist/esm/components/date-time-picker-class.js +5 -5
- package/dist/esm/components/date-time-picker-fc.js +5 -5
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/types/components/date-picker-class.d.ts +2 -2
- package/dist/types/components/date-picker-fc.d.ts +1 -1
- package/dist/types/components/date-picker.d.ts +3 -3
- package/dist/types/types.d.ts +9 -2
- package/dist/types-ts4.5/components/date-picker-class.d.ts +2 -2
- package/dist/types-ts4.5/components/date-picker-fc.d.ts +1 -1
- package/dist/types-ts4.5/components/date-picker.d.ts +3 -3
- package/dist/types-ts4.5/types.d.ts +9 -2
- package/package.json +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 15.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#158791](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/158791)
|
|
8
|
+
[`2dcea88bcb6c7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2dcea88bcb6c7) -
|
|
9
|
+
Support React 18 SSR by removing use of react-uid
|
|
10
|
+
|
|
11
|
+
## 15.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#157307](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157307)
|
|
16
|
+
[`a1e80ec0a5e4a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a1e80ec0a5e4a) -
|
|
17
|
+
Enable new icons behind a feature flag.
|
|
18
|
+
- [#157307](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157307)
|
|
19
|
+
[`e6c2d403fadd0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e6c2d403fadd0) -
|
|
20
|
+
Add clearControlLabel to datepicker component.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 15.5.2
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -17,10 +17,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
17
17
|
var _react = require("react");
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
19
|
var _dateFns = require("date-fns");
|
|
20
|
-
var _reactUid = require("react-uid");
|
|
21
20
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
22
|
-
var
|
|
21
|
+
var _useId = require("@atlaskit/ds-lib/use-id");
|
|
22
|
+
var _calendar = _interopRequireDefault(require("@atlaskit/icon/core/migration/calendar"));
|
|
23
|
+
var _calendar2 = _interopRequireDefault(require("@atlaskit/icon/glyph/calendar"));
|
|
23
24
|
var _locale = require("@atlaskit/locale");
|
|
25
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
26
|
var _primitives = require("@atlaskit/primitives");
|
|
25
27
|
var _select = _interopRequireWildcard(require("@atlaskit/select"));
|
|
26
28
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -40,11 +42,18 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
40
42
|
* @jsxRuntime classic
|
|
41
43
|
* @jsx jsx
|
|
42
44
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
43
|
-
// This is a deprecated component but we will be able to use the actual hook
|
|
44
|
-
// version very soon from converting this to functional. And also React 18 is on
|
|
45
|
-
// the horizon
|
|
46
45
|
var packageName = "@atlaskit/datetime-picker";
|
|
47
|
-
var packageVersion = "15.
|
|
46
|
+
var packageVersion = "15.7.0";
|
|
47
|
+
var dropdownIndicatorStyles = (0, _primitives.xcss)({
|
|
48
|
+
minWidth: "var(--ds-space-300, 24px)",
|
|
49
|
+
minHeight: "var(--ds-space-300, 24px)",
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'center'
|
|
53
|
+
});
|
|
54
|
+
var CalendarIcon = (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? _calendar.default :
|
|
55
|
+
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
56
|
+
_calendar2.default;
|
|
48
57
|
var datePickerDefaultProps = {
|
|
49
58
|
defaultIsOpen: false,
|
|
50
59
|
defaultValue: '',
|
|
@@ -83,9 +92,16 @@ var iconContainerStyles = (0, _react2.css)({
|
|
|
83
92
|
var iconSpacingWithClearButtonStyles = (0, _react2.css)({
|
|
84
93
|
marginInlineEnd: "var(--ds-space-400, 2rem)"
|
|
85
94
|
});
|
|
95
|
+
var iconSpacingWithoutClearButtonStylesNew = (0, _react2.css)({
|
|
96
|
+
marginInlineEnd: "var(--ds-space-050, 0.25rem)"
|
|
97
|
+
});
|
|
86
98
|
var iconSpacingWithoutClearButtonStyles = (0, _react2.css)({
|
|
87
99
|
marginInlineEnd: "var(--ds-space-025, 0.125rem)"
|
|
88
100
|
});
|
|
101
|
+
var calendarButtonFixedSizeStyles = (0, _primitives.xcss)({
|
|
102
|
+
width: "".concat(32 / 14, "em"),
|
|
103
|
+
height: "".concat(32 / 14, "em")
|
|
104
|
+
});
|
|
89
105
|
var calendarButtonStyles = (0, _primitives.xcss)({
|
|
90
106
|
borderRadius: 'border.radius',
|
|
91
107
|
':hover': {
|
|
@@ -422,6 +438,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
422
438
|
ariaDescribedBy = _this$props['aria-describedby'],
|
|
423
439
|
_this$props$autoFocus = _this$props.autoFocus,
|
|
424
440
|
autoFocus = _this$props$autoFocus === void 0 ? false : _this$props$autoFocus,
|
|
441
|
+
_this$props$clearCont = _this$props.clearControlLabel,
|
|
442
|
+
clearControlLabel = _this$props$clearCont === void 0 ? 'Clear' : _this$props$clearCont,
|
|
425
443
|
_this$props$hideIcon = _this$props.hideIcon,
|
|
426
444
|
hideIcon = _this$props$hideIcon === void 0 ? false : _this$props$hideIcon,
|
|
427
445
|
_this$props$openCalen = _this$props.openCalendarLabel,
|
|
@@ -429,7 +447,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
429
447
|
disabled = _this$props.disabled,
|
|
430
448
|
disabledDateFilter = _this$props.disabledDateFilter,
|
|
431
449
|
_this$props$icon = _this$props.icon,
|
|
432
|
-
|
|
450
|
+
Icon = _this$props$icon === void 0 ? CalendarIcon : _this$props$icon,
|
|
433
451
|
_this$props$id = _this$props.id,
|
|
434
452
|
id = _this$props$id === void 0 ? '' : _this$props$id,
|
|
435
453
|
_this$props$innerProp = _this$props.innerProps,
|
|
@@ -467,7 +485,17 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
467
485
|
actualSelectInputValue = selectInputValue;
|
|
468
486
|
var menuIsOpen = this.getIsOpen() && !isDisabled;
|
|
469
487
|
var showClearIndicator = Boolean((value || selectInputValue) && !hideIcon);
|
|
470
|
-
var
|
|
488
|
+
var clearIndicator = Icon;
|
|
489
|
+
|
|
490
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
491
|
+
if ((0, _platformFeatureFlags.fg)('platform-visual-refresh-icons') && (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration')) {
|
|
492
|
+
clearIndicator = function clearIndicator(props) {
|
|
493
|
+
return (0, _react2.jsx)(_primitives.Box, {
|
|
494
|
+
xcss: dropdownIndicatorStyles
|
|
495
|
+
}, (0, _react2.jsx)(Icon, props));
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
|
|
471
499
|
var SingleValue = (0, _singleValue.makeSingleValue)({
|
|
472
500
|
lang: this.props.locale
|
|
473
501
|
});
|
|
@@ -554,6 +582,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
554
582
|
"aria-describedby": ariaDescribedBy,
|
|
555
583
|
"aria-label": label || undefined,
|
|
556
584
|
autoFocus: autoFocus,
|
|
585
|
+
clearControlLabel: clearControlLabel,
|
|
557
586
|
closeMenuOnSelect: true
|
|
558
587
|
// FOr some reason, this and the below `styles` type error _only_ show
|
|
559
588
|
// up when you alter some of the properties in the `selectComponents`
|
|
@@ -604,13 +633,12 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
604
633
|
onCalendarSelect: calendarProps.onCalendarSelect,
|
|
605
634
|
previousMonthLabel: previousMonthLabel,
|
|
606
635
|
shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
|
|
607
|
-
})), shouldShowCalendarButton && !isDisabled ? (0, _react2.jsx)(
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}, function (openCalendarLabelId) {
|
|
636
|
+
})), shouldShowCalendarButton && !isDisabled ? (0, _react2.jsx)(_useId.IdProvider, {
|
|
637
|
+
prefix: "open-calendar-label--"
|
|
638
|
+
}, function (_ref3) {
|
|
639
|
+
var openCalendarLabelId = _ref3.id;
|
|
612
640
|
return (0, _react2.jsx)("div", {
|
|
613
|
-
css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
|
|
641
|
+
css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? iconSpacingWithoutClearButtonStylesNew : iconSpacingWithoutClearButtonStyles]
|
|
614
642
|
}, inputLabelId && (0, _react2.jsx)(_visuallyHidden.default, {
|
|
615
643
|
id: openCalendarLabelId
|
|
616
644
|
}, ", ", openCalendarLabel), (0, _react2.jsx)(_primitives.Pressable, (0, _extends2.default)({}, inputLabelId ? {
|
|
@@ -624,12 +652,15 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
624
652
|
testId: testId && "".concat(testId, "--open-calendar-button"),
|
|
625
653
|
type: "button",
|
|
626
654
|
backgroundColor: "color.background.neutral.subtle",
|
|
627
|
-
padding:
|
|
628
|
-
xcss: calendarButtonStyles
|
|
629
|
-
}), (0, _react2.jsx)(
|
|
630
|
-
label: ""
|
|
655
|
+
padding: (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? 'space.0' : 'space.050',
|
|
656
|
+
xcss: [calendarButtonStyles, (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') && calendarButtonFixedSizeStyles]
|
|
657
|
+
}), (0, _react2.jsx)(CalendarIcon, (0, _extends2.default)({
|
|
658
|
+
label: ""
|
|
659
|
+
}, (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? {
|
|
660
|
+
color: "var(--ds-icon, #44546F)"
|
|
661
|
+
} : {
|
|
631
662
|
primaryColor: "var(--ds-icon, #44546F)"
|
|
632
|
-
})));
|
|
663
|
+
}))));
|
|
633
664
|
}) : null)
|
|
634
665
|
);
|
|
635
666
|
}
|
|
@@ -13,10 +13,12 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
var _react = require("react");
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
15
|
var _dateFns = require("date-fns");
|
|
16
|
-
var _reactUid = require("react-uid");
|
|
17
16
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
18
|
-
var
|
|
17
|
+
var _useId = require("@atlaskit/ds-lib/use-id");
|
|
18
|
+
var _calendar = _interopRequireDefault(require("@atlaskit/icon/core/migration/calendar"));
|
|
19
|
+
var _calendar2 = _interopRequireDefault(require("@atlaskit/icon/glyph/calendar"));
|
|
19
20
|
var _locale = require("@atlaskit/locale");
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
22
|
var _primitives = require("@atlaskit/primitives");
|
|
21
23
|
var _select = _interopRequireWildcard(require("@atlaskit/select"));
|
|
22
24
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -27,21 +29,18 @@ var _indicatorsContainer = require("../internal/indicators-container");
|
|
|
27
29
|
var _menu = require("../internal/menu");
|
|
28
30
|
var _parseDate = require("../internal/parse-date");
|
|
29
31
|
var _singleValue = require("../internal/single-value");
|
|
30
|
-
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"];
|
|
32
|
+
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"];
|
|
31
33
|
/**
|
|
32
34
|
* @jsxRuntime classic
|
|
33
35
|
* @jsx jsx
|
|
34
36
|
*/
|
|
35
37
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
36
|
-
// This is a deprecated component but we will be able to use the actual hook
|
|
37
|
-
// version very soon from converting this to functional. And also React 18 is on
|
|
38
|
-
// the horizon
|
|
39
38
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
40
39
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
41
40
|
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; }
|
|
42
41
|
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) { (0, _defineProperty2.default)(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; }
|
|
43
42
|
var packageName = "@atlaskit/datetime-picker";
|
|
44
|
-
var packageVersion = "15.
|
|
43
|
+
var packageVersion = "15.7.0";
|
|
45
44
|
var analyticsAttributes = {
|
|
46
45
|
componentName: 'datePicker',
|
|
47
46
|
packageName: packageName,
|
|
@@ -50,6 +49,16 @@ var analyticsAttributes = {
|
|
|
50
49
|
var pickerContainerStyles = (0, _react2.css)({
|
|
51
50
|
position: 'relative'
|
|
52
51
|
});
|
|
52
|
+
var dropdownIndicatorStyles = (0, _primitives.xcss)({
|
|
53
|
+
minWidth: "var(--ds-space-300, 24px)",
|
|
54
|
+
minHeight: "var(--ds-space-300, 24px)",
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center'
|
|
58
|
+
});
|
|
59
|
+
var CalendarIcon = (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? _calendar.default :
|
|
60
|
+
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
61
|
+
_calendar2.default;
|
|
53
62
|
var iconContainerStyles = (0, _react2.css)({
|
|
54
63
|
display: 'flex',
|
|
55
64
|
height: '100%',
|
|
@@ -67,9 +76,16 @@ var iconContainerStyles = (0, _react2.css)({
|
|
|
67
76
|
var iconSpacingWithClearButtonStyles = (0, _react2.css)({
|
|
68
77
|
marginInlineEnd: "var(--ds-space-400, 2rem)"
|
|
69
78
|
});
|
|
79
|
+
var iconSpacingWithoutClearButtonStylesNew = (0, _react2.css)({
|
|
80
|
+
marginInlineEnd: "var(--ds-space-050, 0.25rem)"
|
|
81
|
+
});
|
|
70
82
|
var iconSpacingWithoutClearButtonStyles = (0, _react2.css)({
|
|
71
83
|
marginInlineEnd: "var(--ds-space-025, 0.125rem)"
|
|
72
84
|
});
|
|
85
|
+
var calendarButtonFixedSizeStyles = (0, _primitives.xcss)({
|
|
86
|
+
width: "".concat(32 / 14, "em"),
|
|
87
|
+
height: "".concat(32 / 14, "em")
|
|
88
|
+
});
|
|
73
89
|
var calendarButtonStyles = (0, _primitives.xcss)({
|
|
74
90
|
borderRadius: 'border.radius',
|
|
75
91
|
':hover': {
|
|
@@ -96,6 +112,8 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
96
112
|
appearance = _props$appearance === void 0 ? 'default' : _props$appearance,
|
|
97
113
|
_props$autoFocus = props.autoFocus,
|
|
98
114
|
autoFocus = _props$autoFocus === void 0 ? false : _props$autoFocus,
|
|
115
|
+
_props$clearControlLa = props.clearControlLabel,
|
|
116
|
+
clearControlLabel = _props$clearControlLa === void 0 ? 'Clear' : _props$clearControlLa,
|
|
99
117
|
_props$hideIcon = props.hideIcon,
|
|
100
118
|
hideIcon = _props$hideIcon === void 0 ? false : _props$hideIcon,
|
|
101
119
|
_props$openCalendarLa = props.openCalendarLabel,
|
|
@@ -111,7 +129,7 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
111
129
|
return false;
|
|
112
130
|
} : _props$disabledDateFi,
|
|
113
131
|
_props$icon = props.icon,
|
|
114
|
-
|
|
132
|
+
Icon = _props$icon === void 0 ? CalendarIcon : _props$icon,
|
|
115
133
|
_props$id = props.id,
|
|
116
134
|
id = _props$id === void 0 ? '' : _props$id,
|
|
117
135
|
_props$innerProps = props.innerProps,
|
|
@@ -458,7 +476,17 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
458
476
|
actualSelectInputValue = selectInputValue;
|
|
459
477
|
var menuIsOpen = getIsOpen() && !isDisabled;
|
|
460
478
|
var showClearIndicator = Boolean((getterValue || selectInputValue) && !hideIcon);
|
|
461
|
-
var
|
|
479
|
+
var clearIndicator = Icon;
|
|
480
|
+
|
|
481
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
482
|
+
if ((0, _platformFeatureFlags.fg)('platform-visual-refresh-icons') && (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration')) {
|
|
483
|
+
clearIndicator = function clearIndicator(props) {
|
|
484
|
+
return (0, _react2.jsx)(_primitives.Box, {
|
|
485
|
+
xcss: dropdownIndicatorStyles
|
|
486
|
+
}, (0, _react2.jsx)(Icon, props));
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
|
|
462
490
|
var SingleValue = (0, _singleValue.makeSingleValue)({
|
|
463
491
|
lang: propLocale
|
|
464
492
|
});
|
|
@@ -522,7 +550,7 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
522
550
|
|
|
523
551
|
// `label` takes precedence of the `inputLabel`
|
|
524
552
|
var fullopenCalendarLabel = label || inputLabel ? "".concat(label || inputLabel, " , ").concat(openCalendarLabel) : openCalendarLabel;
|
|
525
|
-
var openCalendarLabelId = "open-calendar-label--".concat((0,
|
|
553
|
+
var openCalendarLabelId = "open-calendar-label--".concat((0, _useId.useId)());
|
|
526
554
|
return (
|
|
527
555
|
// These event handlers must be on this element because the events come
|
|
528
556
|
// from different child elements.
|
|
@@ -546,6 +574,7 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
546
574
|
"aria-describedby": ariaDescribedBy,
|
|
547
575
|
"aria-label": label || undefined,
|
|
548
576
|
autoFocus: autoFocus,
|
|
577
|
+
clearControlLabel: clearControlLabel,
|
|
549
578
|
closeMenuOnSelect: true
|
|
550
579
|
// For some reason, this and the below `styles` type error _only_ show
|
|
551
580
|
// up when you alter some of the properties in the `selectComponents`
|
|
@@ -597,7 +626,7 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
597
626
|
previousMonthLabel: previousMonthLabel,
|
|
598
627
|
shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
|
|
599
628
|
})), shouldShowCalendarButton && !isDisabled ? (0, _react2.jsx)("div", {
|
|
600
|
-
css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
|
|
629
|
+
css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? iconSpacingWithoutClearButtonStylesNew : iconSpacingWithoutClearButtonStyles]
|
|
601
630
|
}, inputLabelId && (0, _react2.jsx)(_visuallyHidden.default, {
|
|
602
631
|
id: openCalendarLabelId
|
|
603
632
|
}, ", ", openCalendarLabel), (0, _react2.jsx)(_primitives.Pressable, (0, _extends2.default)({}, inputLabelId ? {
|
|
@@ -611,12 +640,15 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
611
640
|
testId: testId && "".concat(testId, "--open-calendar-button"),
|
|
612
641
|
type: "button",
|
|
613
642
|
backgroundColor: "color.background.neutral.subtle",
|
|
614
|
-
padding:
|
|
615
|
-
xcss: calendarButtonStyles
|
|
616
|
-
}), (0, _react2.jsx)(
|
|
617
|
-
label: ""
|
|
643
|
+
padding: (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? 'space.0' : 'space.050',
|
|
644
|
+
xcss: [calendarButtonStyles, (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') && calendarButtonFixedSizeStyles]
|
|
645
|
+
}), (0, _react2.jsx)(CalendarIcon, (0, _extends2.default)({
|
|
646
|
+
label: ""
|
|
647
|
+
}, (0, _platformFeatureFlags.fg)('platform-visual-refresh-icon-ads-migration') ? {
|
|
648
|
+
color: "var(--ds-icon, #44546F)"
|
|
649
|
+
} : {
|
|
618
650
|
primaryColor: "var(--ds-icon, #44546F)"
|
|
619
|
-
}))) : null)
|
|
651
|
+
})))) : null)
|
|
620
652
|
);
|
|
621
653
|
});
|
|
622
654
|
var _default = exports.default = DatePicker;
|
|
@@ -16,7 +16,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
17
|
var _dateFns = require("date-fns");
|
|
18
18
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
19
|
-
var
|
|
19
|
+
var _crossCircleSelectClear = _interopRequireDefault(require("@atlaskit/icon/utility/migration/cross-circle--select-clear"));
|
|
20
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
21
|
var _select = require("@atlaskit/select");
|
|
22
22
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -38,7 +38,7 @@ var DatePicker = (0, _ffComponent.componentWithCondition)(function () {
|
|
|
38
38
|
return (0, _platformFeatureFlags.fg)('dst-date-picker-use-functional-component');
|
|
39
39
|
}, _datePickerFc.default, _datePickerClass.default);
|
|
40
40
|
var packageName = "@atlaskit/datetime-picker";
|
|
41
|
-
var packageVersion = "15.
|
|
41
|
+
var packageVersion = "15.7.0";
|
|
42
42
|
// Make DatePicker 50% the width of DateTimePicker
|
|
43
43
|
// If rendering an icon container, shrink the TimePicker
|
|
44
44
|
var datePickerContainerStyles = (0, _react2.css)({
|
|
@@ -402,11 +402,11 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
402
402
|
"data-testid": testId && "".concat(testId, "--icon--container"),
|
|
403
403
|
tabIndex: -1,
|
|
404
404
|
type: "button"
|
|
405
|
-
}, (0, _react2.jsx)(
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
}, (0, _react2.jsx)(_crossCircleSelectClear.default, {
|
|
406
|
+
LEGACY_size: "small",
|
|
407
|
+
color: "currentColor",
|
|
408
408
|
label: clearControlLabel
|
|
409
|
-
})) : null);
|
|
409
|
+
}), ' ') : null);
|
|
410
410
|
}
|
|
411
411
|
}]);
|
|
412
412
|
return DateTimePickerComponent;
|
|
@@ -13,7 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _react2 = require("@emotion/react");
|
|
14
14
|
var _dateFns = require("date-fns");
|
|
15
15
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
16
|
-
var
|
|
16
|
+
var _crossCircleSelectClear = _interopRequireDefault(require("@atlaskit/icon/utility/migration/cross-circle--select-clear"));
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
18
|
var _select = require("@atlaskit/select");
|
|
19
19
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -37,7 +37,7 @@ var DatePicker = (0, _ffComponent.componentWithCondition)(function () {
|
|
|
37
37
|
return (0, _platformFeatureFlags.fg)('dst-date-picker-use-functional-component');
|
|
38
38
|
}, _datePickerFc.default, _datePickerClass.default);
|
|
39
39
|
var packageName = "@atlaskit/datetime-picker";
|
|
40
|
-
var packageVersion = "15.
|
|
40
|
+
var packageVersion = "15.7.0";
|
|
41
41
|
var analyticsAttributes = {
|
|
42
42
|
componentName: 'dateTimePicker',
|
|
43
43
|
packageName: packageName,
|
|
@@ -389,10 +389,10 @@ var DateTimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
389
389
|
"data-testid": testId && "".concat(testId, "--icon--container"),
|
|
390
390
|
tabIndex: -1,
|
|
391
391
|
type: "button"
|
|
392
|
-
}, (0, _react2.jsx)(
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
}, (0, _react2.jsx)(_crossCircleSelectClear.default, {
|
|
393
|
+
LEGACY_size: "small",
|
|
394
|
+
color: "currentColor",
|
|
395
395
|
label: clearControlLabel
|
|
396
|
-
})) : null);
|
|
396
|
+
}), ' ') : null);
|
|
397
397
|
});
|
|
398
398
|
var _default = exports.default = DateTimePicker;
|
|
@@ -27,7 +27,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
27
27
|
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; }
|
|
28
28
|
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) { (0, _defineProperty2.default)(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; }
|
|
29
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
var packageVersion = "15.
|
|
30
|
+
var packageVersion = "15.7.0";
|
|
31
31
|
var menuStyles = {
|
|
32
32
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
33
33
|
position: 'static',
|
|
@@ -9,14 +9,13 @@ import { Component, createRef } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { isValid, parseISO } from 'date-fns';
|
|
12
|
-
// This is a deprecated component but we will be able to use the actual hook
|
|
13
|
-
// version very soon from converting this to functional. And also React 18 is on
|
|
14
|
-
// the horizon
|
|
15
|
-
import { UID } from 'react-uid';
|
|
16
12
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
17
|
-
import
|
|
13
|
+
import { IdProvider } from '@atlaskit/ds-lib/use-id';
|
|
14
|
+
import CalendarIconNew from '@atlaskit/icon/core/migration/calendar';
|
|
15
|
+
import CalendarIconOld from '@atlaskit/icon/glyph/calendar';
|
|
18
16
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
19
|
-
import {
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
|
+
import { Box, Pressable, xcss } from '@atlaskit/primitives';
|
|
20
19
|
import Select, { mergeStyles } from '@atlaskit/select';
|
|
21
20
|
import { N500, N70 } from '@atlaskit/theme/colors';
|
|
22
21
|
import VisuallyHidden from '@atlaskit/visually-hidden';
|
|
@@ -27,7 +26,17 @@ import { Menu } from '../internal/menu';
|
|
|
27
26
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
28
27
|
import { makeSingleValue } from '../internal/single-value';
|
|
29
28
|
const packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
const packageVersion = "15.
|
|
29
|
+
const packageVersion = "15.7.0";
|
|
30
|
+
const dropdownIndicatorStyles = xcss({
|
|
31
|
+
minWidth: "var(--ds-space-300, 24px)",
|
|
32
|
+
minHeight: "var(--ds-space-300, 24px)",
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center'
|
|
36
|
+
});
|
|
37
|
+
const CalendarIcon = fg('platform-visual-refresh-icon-ads-migration') ? CalendarIconNew :
|
|
38
|
+
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
|
|
39
|
+
CalendarIconOld;
|
|
31
40
|
const datePickerDefaultProps = {
|
|
32
41
|
defaultIsOpen: false,
|
|
33
42
|
defaultValue: '',
|
|
@@ -64,9 +73,16 @@ const iconContainerStyles = css({
|
|
|
64
73
|
const iconSpacingWithClearButtonStyles = css({
|
|
65
74
|
marginInlineEnd: "var(--ds-space-400, 2rem)"
|
|
66
75
|
});
|
|
76
|
+
const iconSpacingWithoutClearButtonStylesNew = css({
|
|
77
|
+
marginInlineEnd: "var(--ds-space-050, 0.25rem)"
|
|
78
|
+
});
|
|
67
79
|
const iconSpacingWithoutClearButtonStyles = css({
|
|
68
80
|
marginInlineEnd: "var(--ds-space-025, 0.125rem)"
|
|
69
81
|
});
|
|
82
|
+
const calendarButtonFixedSizeStyles = xcss({
|
|
83
|
+
width: `${32 / 14}em`,
|
|
84
|
+
height: `${32 / 14}em`
|
|
85
|
+
});
|
|
70
86
|
const calendarButtonStyles = xcss({
|
|
71
87
|
borderRadius: 'border.radius',
|
|
72
88
|
':hover': {
|
|
@@ -410,11 +426,12 @@ class DatePickerComponent extends Component {
|
|
|
410
426
|
appearance = 'default',
|
|
411
427
|
'aria-describedby': ariaDescribedBy,
|
|
412
428
|
autoFocus = false,
|
|
429
|
+
clearControlLabel = 'Clear',
|
|
413
430
|
hideIcon = false,
|
|
414
431
|
openCalendarLabel = 'Open calendar',
|
|
415
432
|
disabled,
|
|
416
433
|
disabledDateFilter,
|
|
417
|
-
icon = CalendarIcon,
|
|
434
|
+
icon: Icon = CalendarIcon,
|
|
418
435
|
id = '',
|
|
419
436
|
innerProps = {},
|
|
420
437
|
inputLabel = 'Date picker',
|
|
@@ -444,7 +461,15 @@ class DatePickerComponent extends Component {
|
|
|
444
461
|
actualSelectInputValue = selectInputValue;
|
|
445
462
|
const menuIsOpen = this.getIsOpen() && !isDisabled;
|
|
446
463
|
const showClearIndicator = Boolean((value || selectInputValue) && !hideIcon);
|
|
447
|
-
|
|
464
|
+
let clearIndicator = Icon;
|
|
465
|
+
|
|
466
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
467
|
+
if (fg('platform-visual-refresh-icons') && fg('platform-visual-refresh-icon-ads-migration')) {
|
|
468
|
+
clearIndicator = props => jsx(Box, {
|
|
469
|
+
xcss: dropdownIndicatorStyles
|
|
470
|
+
}, jsx(Icon, props));
|
|
471
|
+
}
|
|
472
|
+
const dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : clearIndicator;
|
|
448
473
|
const SingleValue = makeSingleValue({
|
|
449
474
|
lang: this.props.locale
|
|
450
475
|
});
|
|
@@ -533,6 +558,7 @@ class DatePickerComponent extends Component {
|
|
|
533
558
|
"aria-describedby": ariaDescribedBy,
|
|
534
559
|
"aria-label": label || undefined,
|
|
535
560
|
autoFocus: autoFocus,
|
|
561
|
+
clearControlLabel: clearControlLabel,
|
|
536
562
|
closeMenuOnSelect: true
|
|
537
563
|
// FOr some reason, this and the below `styles` type error _only_ show
|
|
538
564
|
// up when you alter some of the properties in the `selectComponents`
|
|
@@ -583,10 +609,12 @@ class DatePickerComponent extends Component {
|
|
|
583
609
|
onCalendarSelect: calendarProps.onCalendarSelect,
|
|
584
610
|
previousMonthLabel: previousMonthLabel,
|
|
585
611
|
shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
|
|
586
|
-
})), shouldShowCalendarButton && !isDisabled ? jsx(
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
|
|
612
|
+
})), shouldShowCalendarButton && !isDisabled ? jsx(IdProvider, {
|
|
613
|
+
prefix: "open-calendar-label--"
|
|
614
|
+
}, ({
|
|
615
|
+
id: openCalendarLabelId
|
|
616
|
+
}) => jsx("div", {
|
|
617
|
+
css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : fg('platform-visual-refresh-icon-ads-migration') ? iconSpacingWithoutClearButtonStylesNew : iconSpacingWithoutClearButtonStyles]
|
|
590
618
|
}, inputLabelId && jsx(VisuallyHidden, {
|
|
591
619
|
id: openCalendarLabelId
|
|
592
620
|
}, ", ", openCalendarLabel), jsx(Pressable, _extends({}, inputLabelId ? {
|
|
@@ -600,12 +628,15 @@ class DatePickerComponent extends Component {
|
|
|
600
628
|
testId: testId && `${testId}--open-calendar-button`,
|
|
601
629
|
type: "button",
|
|
602
630
|
backgroundColor: "color.background.neutral.subtle",
|
|
603
|
-
padding:
|
|
604
|
-
xcss: calendarButtonStyles
|
|
605
|
-
}), jsx(CalendarIcon, {
|
|
606
|
-
label: ""
|
|
631
|
+
padding: fg('platform-visual-refresh-icon-ads-migration') ? 'space.0' : 'space.050',
|
|
632
|
+
xcss: [calendarButtonStyles, fg('platform-visual-refresh-icon-ads-migration') && calendarButtonFixedSizeStyles]
|
|
633
|
+
}), jsx(CalendarIcon, _extends({
|
|
634
|
+
label: ""
|
|
635
|
+
}, fg('platform-visual-refresh-icon-ads-migration') ? {
|
|
636
|
+
color: "var(--ds-icon, #44546F)"
|
|
637
|
+
} : {
|
|
607
638
|
primaryColor: "var(--ds-icon, #44546F)"
|
|
608
|
-
})))) : null)
|
|
639
|
+
}))))) : null)
|
|
609
640
|
);
|
|
610
641
|
}
|
|
611
642
|
}
|