@atlaskit/datetime-picker 15.1.3 → 15.2.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 +16 -0
- package/dist/cjs/components/date-picker.js +172 -28
- package/dist/cjs/components/date-time-picker.js +2 -1
- package/dist/cjs/components/time-picker.js +4 -2
- package/dist/cjs/internal/fixed-layer-menu.js +6 -2
- package/dist/cjs/internal/menu.js +1 -0
- package/dist/es2019/components/date-picker.js +166 -30
- package/dist/es2019/components/date-time-picker.js +2 -1
- package/dist/es2019/components/time-picker.js +4 -2
- package/dist/es2019/internal/fixed-layer-menu.js +6 -2
- package/dist/es2019/internal/menu.js +1 -0
- package/dist/esm/components/date-picker.js +174 -30
- package/dist/esm/components/date-time-picker.js +2 -1
- package/dist/esm/components/time-picker.js +4 -2
- package/dist/esm/internal/fixed-layer-menu.js +6 -2
- package/dist/esm/internal/menu.js +1 -0
- package/dist/types/components/date-picker.d.ts +26 -2
- package/dist/types/components/date-time-picker.d.ts +1 -1
- package/dist/types/components/time-picker.d.ts +1 -1
- package/dist/types/types.d.ts +42 -0
- package/dist/types-ts4.5/components/date-picker.d.ts +26 -2
- package/dist/types-ts4.5/components/date-time-picker.d.ts +1 -1
- package/dist/types-ts4.5/components/time-picker.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +42 -0
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 15.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`6f45e454d44fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6f45e454d44fe) -
|
|
8
|
+
[ux] Adds a dedicated button to open the calendar.
|
|
9
|
+
|
|
10
|
+
## 15.1.4
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#143559](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/143559)
|
|
15
|
+
[`56dfbfe361f96`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/56dfbfe361f96) -
|
|
16
|
+
Upgrade react-select from 5.4 to 5.8 and replace it with internal atlaskit/react-select
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 15.1.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -17,10 +17,14 @@ 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");
|
|
20
21
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
22
|
var _calendar = _interopRequireDefault(require("@atlaskit/icon/glyph/calendar"));
|
|
22
23
|
var _locale = require("@atlaskit/locale");
|
|
24
|
+
var _primitives = require("@atlaskit/primitives");
|
|
23
25
|
var _select = _interopRequireWildcard(require("@atlaskit/select"));
|
|
26
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
27
|
+
var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
|
|
24
28
|
var _internal = require("../internal");
|
|
25
29
|
var _datePickerMigration = require("../internal/date-picker-migration");
|
|
26
30
|
var _menu = require("../internal/menu");
|
|
@@ -35,8 +39,11 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
35
39
|
* @jsxRuntime classic
|
|
36
40
|
* @jsx jsx
|
|
37
41
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
42
|
+
// This is a deprecated component but we will be able to use the actual hook
|
|
43
|
+
// version very soon from converting this to functional. And also React 18 is on
|
|
44
|
+
// the horizon
|
|
38
45
|
var packageName = "@atlaskit/datetime-picker";
|
|
39
|
-
var packageVersion = "15.
|
|
46
|
+
var packageVersion = "15.2.0";
|
|
40
47
|
var datePickerDefaultProps = {
|
|
41
48
|
defaultIsOpen: false,
|
|
42
49
|
defaultValue: '',
|
|
@@ -55,6 +62,38 @@ var datePickerDefaultProps = {
|
|
|
55
62
|
// Not including a default prop for value as it will
|
|
56
63
|
// Make the component a controlled component
|
|
57
64
|
};
|
|
65
|
+
var pickerContainerStyles = (0, _react2.css)({
|
|
66
|
+
position: 'relative'
|
|
67
|
+
});
|
|
68
|
+
var iconContainerStyles = (0, _react2.css)({
|
|
69
|
+
display: 'flex',
|
|
70
|
+
height: '100%',
|
|
71
|
+
position: 'absolute',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
flexBasis: 'inherit',
|
|
74
|
+
color: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
|
|
75
|
+
insetBlockStart: 0,
|
|
76
|
+
insetInlineEnd: 0,
|
|
77
|
+
transition: "color 150ms",
|
|
78
|
+
'&:hover': {
|
|
79
|
+
color: "var(--ds-text-subtle, ".concat(_colors.N500, ")")
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var iconSpacingWithClearButtonStyles = (0, _react2.css)({
|
|
83
|
+
marginInlineEnd: "var(--ds-space-400, 2rem)"
|
|
84
|
+
});
|
|
85
|
+
var iconSpacingWithoutClearButtonStyles = (0, _react2.css)({
|
|
86
|
+
marginInlineEnd: "var(--ds-space-025, 0.125rem)"
|
|
87
|
+
});
|
|
88
|
+
var calendarButtonStyles = (0, _primitives.xcss)({
|
|
89
|
+
borderRadius: 'border.radius',
|
|
90
|
+
':hover': {
|
|
91
|
+
backgroundColor: 'color.background.neutral.subtle.hovered'
|
|
92
|
+
},
|
|
93
|
+
':active': {
|
|
94
|
+
backgroundColor: 'color.background.neutral.subtle.pressed'
|
|
95
|
+
}
|
|
96
|
+
});
|
|
58
97
|
var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Component) {
|
|
59
98
|
(0, _inherits2.default)(DatePickerComponent, _Component);
|
|
60
99
|
var _super = _createSuper(DatePickerComponent);
|
|
@@ -64,6 +103,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
64
103
|
(0, _classCallCheck2.default)(this, DatePickerComponent);
|
|
65
104
|
_this = _super.call(this, props);
|
|
66
105
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "containerRef", null);
|
|
106
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calendarRef", /*#__PURE__*/(0, _react.createRef)());
|
|
107
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calendarButtonRef", /*#__PURE__*/(0, _react.createRef)());
|
|
67
108
|
// All state needs to be accessed via this function so that the state is mapped from props
|
|
68
109
|
// correctly to allow controlled/uncontrolled usage.
|
|
69
110
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getValue", function () {
|
|
@@ -83,23 +124,30 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
83
124
|
});
|
|
84
125
|
});
|
|
85
126
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCalendarSelect", function (_ref2) {
|
|
86
|
-
var _this$containerRef;
|
|
87
127
|
var iso = _ref2.iso;
|
|
88
128
|
_this.setState({
|
|
89
129
|
selectInputValue: '',
|
|
90
130
|
isOpen: false,
|
|
91
131
|
calendarValue: iso,
|
|
92
|
-
value: iso
|
|
132
|
+
value: iso,
|
|
133
|
+
wasOpenedFromCalendarButton: false
|
|
93
134
|
});
|
|
94
135
|
_this.props.onChange(iso);
|
|
95
136
|
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
137
|
+
// Yes, this is not ideal. The alternative is to be able to place a ref
|
|
138
|
+
// on the inner input of Select itself, which would require a lot of
|
|
139
|
+
// extra stuff in the Select component for only this one thing. While
|
|
140
|
+
// this would be more "React-y", it doesn't seem to pose any other
|
|
141
|
+
// benefits. Performance-wise, we are only searching within the
|
|
142
|
+
// container, so it's quick.
|
|
143
|
+
if (_this.state.wasOpenedFromCalendarButton) {
|
|
144
|
+
var _this$calendarButtonR;
|
|
145
|
+
(_this$calendarButtonR = _this.calendarButtonRef.current) === null || _this$calendarButtonR === void 0 || _this$calendarButtonR.focus();
|
|
146
|
+
} else {
|
|
147
|
+
var _this$containerRef;
|
|
148
|
+
var innerCombobox = (_this$containerRef = _this.containerRef) === null || _this$containerRef === void 0 ? void 0 : _this$containerRef.querySelector('[role="combobox"]');
|
|
149
|
+
innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
|
|
150
|
+
}
|
|
103
151
|
_this.setState({
|
|
104
152
|
isOpen: false
|
|
105
153
|
});
|
|
@@ -107,7 +155,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
107
155
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputClick", function () {
|
|
108
156
|
if (!_this.props.isDisabled && !_this.getIsOpen()) {
|
|
109
157
|
_this.setState({
|
|
110
|
-
isOpen: true
|
|
158
|
+
isOpen: true,
|
|
159
|
+
wasOpenedFromCalendarButton: false
|
|
111
160
|
});
|
|
112
161
|
}
|
|
113
162
|
});
|
|
@@ -117,7 +166,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
117
166
|
if (!((_this$containerRef2 = _this.containerRef) !== null && _this$containerRef2 !== void 0 && _this$containerRef2.contains(newlyFocusedElement))) {
|
|
118
167
|
_this.setState({
|
|
119
168
|
isOpen: false,
|
|
120
|
-
shouldSetFocusOnCurrentDay: false
|
|
169
|
+
shouldSetFocusOnCurrentDay: false,
|
|
170
|
+
wasOpenedFromCalendarButton: false
|
|
121
171
|
});
|
|
122
172
|
_this.props.onBlur(event);
|
|
123
173
|
}
|
|
@@ -140,7 +190,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
140
190
|
// container. Makes keyboard accessibility of calendar possible
|
|
141
191
|
_this.setState({
|
|
142
192
|
isOpen: false,
|
|
143
|
-
isFocused: false
|
|
193
|
+
isFocused: false,
|
|
194
|
+
wasOpenedFromCalendarButton: false
|
|
144
195
|
});
|
|
145
196
|
}
|
|
146
197
|
});
|
|
@@ -154,9 +205,11 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
154
205
|
});
|
|
155
206
|
} else {
|
|
156
207
|
_this.setState({
|
|
157
|
-
|
|
208
|
+
// Don't open when focused into via keyboard if the calendar button is present
|
|
209
|
+
isOpen: !_this.props.shouldShowCalendarButton,
|
|
158
210
|
calendarValue: value,
|
|
159
|
-
isFocused: true
|
|
211
|
+
isFocused: true,
|
|
212
|
+
wasOpenedFromCalendarButton: false
|
|
160
213
|
});
|
|
161
214
|
}
|
|
162
215
|
_this.props.onFocus(event);
|
|
@@ -179,11 +232,11 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
179
232
|
}
|
|
180
233
|
}
|
|
181
234
|
_this.setState({
|
|
182
|
-
isOpen: true
|
|
235
|
+
isOpen: true,
|
|
236
|
+
wasOpenedFromCalendarButton: false
|
|
183
237
|
});
|
|
184
238
|
});
|
|
185
239
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputKeyDown", function (event) {
|
|
186
|
-
var _this$containerRef4;
|
|
187
240
|
var calendarValue = _this.state.calendarValue;
|
|
188
241
|
var value = _this.getValue();
|
|
189
242
|
var keyPressed = event.key.toLowerCase();
|
|
@@ -191,7 +244,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
191
244
|
// If the input is focused and the calendar is not visible, handle space and enter clicks
|
|
192
245
|
if (!_this.state.isOpen && (keyPressed === 'enter' || keyPressed === ' ')) {
|
|
193
246
|
_this.setState({
|
|
194
|
-
isOpen: true
|
|
247
|
+
isOpen: true,
|
|
248
|
+
wasOpenedFromCalendarButton: false
|
|
195
249
|
});
|
|
196
250
|
}
|
|
197
251
|
switch (keyPressed) {
|
|
@@ -202,11 +256,18 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
202
256
|
// this would be more "React-y", it doesn't seem to pose any other
|
|
203
257
|
// benefits. Performance-wise, we are only searching within the
|
|
204
258
|
// container, so it's quick.
|
|
205
|
-
|
|
206
|
-
|
|
259
|
+
if (_this.state.wasOpenedFromCalendarButton) {
|
|
260
|
+
var _this$calendarButtonR2;
|
|
261
|
+
(_this$calendarButtonR2 = _this.calendarButtonRef.current) === null || _this$calendarButtonR2 === void 0 || _this$calendarButtonR2.focus();
|
|
262
|
+
} else {
|
|
263
|
+
var _this$containerRef4;
|
|
264
|
+
var innerCombobox = (_this$containerRef4 = _this.containerRef) === null || _this$containerRef4 === void 0 ? void 0 : _this$containerRef4.querySelector('[role="combobox"]');
|
|
265
|
+
innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
|
|
266
|
+
}
|
|
207
267
|
_this.setState({
|
|
208
268
|
isOpen: false,
|
|
209
|
-
shouldSetFocusOnCurrentDay: false
|
|
269
|
+
shouldSetFocusOnCurrentDay: false,
|
|
270
|
+
wasOpenedFromCalendarButton: false
|
|
210
271
|
});
|
|
211
272
|
break;
|
|
212
273
|
case 'backspace':
|
|
@@ -241,7 +302,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
241
302
|
selectInputValue: '',
|
|
242
303
|
isOpen: false,
|
|
243
304
|
value: safeCalendarValue,
|
|
244
|
-
calendarValue: safeCalendarValue
|
|
305
|
+
calendarValue: safeCalendarValue,
|
|
306
|
+
wasOpenedFromCalendarButton: false
|
|
245
307
|
});
|
|
246
308
|
if (valueChanged) {
|
|
247
309
|
_this.props.onChange(safeCalendarValue);
|
|
@@ -260,6 +322,38 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
260
322
|
break;
|
|
261
323
|
}
|
|
262
324
|
});
|
|
325
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCalendarButtonKeyDown", function (e) {
|
|
326
|
+
// We want to stop this from triggering other keydown events, particularly
|
|
327
|
+
// for space and enter presses. Otherwise, it opens and then closes
|
|
328
|
+
// immediately.
|
|
329
|
+
if (e.type === 'keydown') {
|
|
330
|
+
e.stopPropagation();
|
|
331
|
+
}
|
|
332
|
+
_this.setState({
|
|
333
|
+
isKeyDown: true,
|
|
334
|
+
wasOpenedFromCalendarButton: true
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
// This event handler is triggered from both keydown and click. It's weird.
|
|
338
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCalendarButtonClick", function (e) {
|
|
339
|
+
_this.setState({
|
|
340
|
+
isOpen: !_this.state.isOpen,
|
|
341
|
+
wasOpenedFromCalendarButton: true
|
|
342
|
+
}, function () {
|
|
343
|
+
var _this$calendarRef;
|
|
344
|
+
// We don't want the focus to move if this is a click event
|
|
345
|
+
if (!_this.state.isKeyDown) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
_this.setState({
|
|
349
|
+
isKeyDown: false
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
// Focus on the first button within the calendar
|
|
353
|
+
(_this$calendarRef = _this.calendarRef) === null || _this$calendarRef === void 0 || (_this$calendarRef = _this$calendarRef.current) === null || _this$calendarRef === void 0 || (_this$calendarRef = _this$calendarRef.querySelector('button')) === null || _this$calendarRef === void 0 || _this$calendarRef.focus();
|
|
354
|
+
});
|
|
355
|
+
e.stopPropagation();
|
|
356
|
+
});
|
|
263
357
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClear", function () {
|
|
264
358
|
var changedState = {
|
|
265
359
|
value: '',
|
|
@@ -301,6 +395,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
301
395
|
}
|
|
302
396
|
});
|
|
303
397
|
_this.state = {
|
|
398
|
+
isKeyDown: false,
|
|
304
399
|
isOpen: _this.props.defaultIsOpen,
|
|
305
400
|
isFocused: false,
|
|
306
401
|
clearingFromIcon: false,
|
|
@@ -309,29 +404,36 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
309
404
|
calendarValue: _this.props.value || _this.props.defaultValue || (0, _parseDate.getShortISOString)(new Date()),
|
|
310
405
|
l10n: (0, _locale.createLocalizationProvider)(_this.props.locale),
|
|
311
406
|
locale: _this.props.locale,
|
|
312
|
-
shouldSetFocusOnCurrentDay: false
|
|
407
|
+
shouldSetFocusOnCurrentDay: false,
|
|
408
|
+
wasOpenedFromCalendarButton: false
|
|
313
409
|
};
|
|
314
410
|
return _this;
|
|
315
411
|
}
|
|
316
412
|
(0, _createClass2.default)(DatePickerComponent, [{
|
|
317
413
|
key: "render",
|
|
318
414
|
value: function render() {
|
|
415
|
+
var _this2 = this;
|
|
319
416
|
var _this$props = this.props,
|
|
320
417
|
_this$props$appearanc = _this$props.appearance,
|
|
321
418
|
appearance = _this$props$appearanc === void 0 ? 'default' : _this$props$appearanc,
|
|
322
419
|
ariaDescribedBy = _this$props['aria-describedby'],
|
|
323
420
|
_this$props$autoFocus = _this$props.autoFocus,
|
|
324
421
|
autoFocus = _this$props$autoFocus === void 0 ? false : _this$props$autoFocus,
|
|
325
|
-
disabled = _this$props.disabled,
|
|
326
|
-
disabledDateFilter = _this$props.disabledDateFilter,
|
|
327
422
|
_this$props$hideIcon = _this$props.hideIcon,
|
|
328
423
|
hideIcon = _this$props$hideIcon === void 0 ? false : _this$props$hideIcon,
|
|
424
|
+
_this$props$openCalen = _this$props.openCalendarLabel,
|
|
425
|
+
openCalendarLabel = _this$props$openCalen === void 0 ? 'Open calendar' : _this$props$openCalen,
|
|
426
|
+
disabled = _this$props.disabled,
|
|
427
|
+
disabledDateFilter = _this$props.disabledDateFilter,
|
|
329
428
|
_this$props$icon = _this$props.icon,
|
|
330
429
|
icon = _this$props$icon === void 0 ? _calendar.default : _this$props$icon,
|
|
331
430
|
_this$props$id = _this$props.id,
|
|
332
431
|
id = _this$props$id === void 0 ? '' : _this$props$id,
|
|
333
432
|
_this$props$innerProp = _this$props.innerProps,
|
|
334
433
|
innerProps = _this$props$innerProp === void 0 ? {} : _this$props$innerProp,
|
|
434
|
+
_this$props$inputLabe = _this$props.inputLabel,
|
|
435
|
+
inputLabel = _this$props$inputLabe === void 0 ? 'Date picker' : _this$props$inputLabe,
|
|
436
|
+
inputLabelId = _this$props.inputLabelId,
|
|
335
437
|
_this$props$isDisable = _this$props.isDisabled,
|
|
336
438
|
isDisabled = _this$props$isDisable === void 0 ? false : _this$props$isDisable,
|
|
337
439
|
_this$props$isInvalid = _this$props.isInvalid,
|
|
@@ -347,6 +449,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
347
449
|
previousMonthLabel = _this$props.previousMonthLabel,
|
|
348
450
|
_this$props$selectPro3 = _this$props.selectProps,
|
|
349
451
|
selectProps = _this$props$selectPro3 === void 0 ? {} : _this$props$selectPro3,
|
|
452
|
+
shouldShowCalendarButton = _this$props.shouldShowCalendarButton,
|
|
350
453
|
_this$props$spacing = _this$props.spacing,
|
|
351
454
|
spacing = _this$props$spacing === void 0 ? 'default' : _this$props$spacing,
|
|
352
455
|
testId = _this$props.testId,
|
|
@@ -364,7 +467,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
364
467
|
lang: this.props.locale
|
|
365
468
|
});
|
|
366
469
|
var selectComponents = _objectSpread({
|
|
367
|
-
DropdownIndicator: dropDownIcon,
|
|
470
|
+
DropdownIndicator: shouldShowCalendarButton ? _internal.EmptyComponent : dropDownIcon,
|
|
368
471
|
Menu: _menu.Menu,
|
|
369
472
|
SingleValue: SingleValue
|
|
370
473
|
}, !showClearIndicator && {
|
|
@@ -382,6 +485,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
382
485
|
calendarDisabledDateFilter: disabledDateFilter,
|
|
383
486
|
calendarMaxDate: maxDate,
|
|
384
487
|
calendarMinDate: minDate,
|
|
488
|
+
calendarRef: this.calendarRef,
|
|
385
489
|
calendarValue: value && (0, _parseDate.getShortISOString)((0, _dateFns.parseISO)(value)),
|
|
386
490
|
calendarView: calendarValue,
|
|
387
491
|
onCalendarChange: this.onCalendarChange,
|
|
@@ -390,6 +494,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
390
494
|
calendarWeekStartDay: weekStartDay,
|
|
391
495
|
shouldSetFocusOnCurrentDay: this.state.shouldSetFocusOnCurrentDay
|
|
392
496
|
};
|
|
497
|
+
|
|
498
|
+
// @ts-ignore -- Argument of type 'StylesConfig<OptionType, false, GroupBase<OptionType>>' is not assignable to parameter of type 'StylesConfig<OptionType, boolean, GroupBase<OptionType>>'.
|
|
393
499
|
var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
|
|
394
500
|
control: function control(base) {
|
|
395
501
|
return _objectSpread(_objectSpread({}, base), disabledStyle);
|
|
@@ -410,10 +516,14 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
410
516
|
}),
|
|
411
517
|
value: value
|
|
412
518
|
} : null;
|
|
519
|
+
|
|
520
|
+
// `label` takes precedence of the `inputLabel`
|
|
521
|
+
var fullopenCalendarLabel = label || inputLabel ? "".concat(label || inputLabel, " , ").concat(openCalendarLabel) : openCalendarLabel;
|
|
413
522
|
return (
|
|
414
523
|
// These event handlers must be on this element because the events come
|
|
415
524
|
// from different child elements.
|
|
416
525
|
(0, _react2.jsx)("div", (0, _extends2.default)({}, innerProps, {
|
|
526
|
+
css: pickerContainerStyles,
|
|
417
527
|
role: "presentation",
|
|
418
528
|
onBlur: this.onContainerBlur,
|
|
419
529
|
onFocus: this.onContainerFocus,
|
|
@@ -432,7 +542,14 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
432
542
|
"aria-describedby": ariaDescribedBy,
|
|
433
543
|
"aria-label": label || undefined,
|
|
434
544
|
autoFocus: autoFocus,
|
|
435
|
-
closeMenuOnSelect: true
|
|
545
|
+
closeMenuOnSelect: true
|
|
546
|
+
// FOr some reason, this and the below `styles` type error _only_ show
|
|
547
|
+
// up when you alter some of the properties in the `selectComponents`
|
|
548
|
+
// object. These errors are still present, and I suspect have always
|
|
549
|
+
// been present, without changing the unrelated code. Ignoring as the
|
|
550
|
+
// component still works as expected despite this error. And also
|
|
551
|
+
// because the select refresh team may solve it later.
|
|
552
|
+
,
|
|
436
553
|
components: selectComponents,
|
|
437
554
|
enableAnimation: false,
|
|
438
555
|
inputId: id,
|
|
@@ -457,6 +574,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
457
574
|
spacing: spacing,
|
|
458
575
|
testId: testId
|
|
459
576
|
// These aren't part of `Select`'s API, but we're using them here.
|
|
577
|
+
// @ts-ignore -- Property 'calendarContainerRef' does not exist on type 'IntrinsicAttributes & LibraryManagedAttributes<(<Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & { ...; }) => Element), AtlaskitSelectProps<...> & { ...; }>'.
|
|
460
578
|
,
|
|
461
579
|
calendarContainerRef: calendarProps.calendarContainerRef,
|
|
462
580
|
calendarDisabled: calendarProps.calendarDisabled,
|
|
@@ -464,6 +582,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
464
582
|
calendarLocale: calendarProps.calendarLocale,
|
|
465
583
|
calendarMaxDate: calendarProps.calendarMaxDate,
|
|
466
584
|
calendarMinDate: calendarProps.calendarMinDate,
|
|
585
|
+
calendarRef: calendarProps.calendarRef,
|
|
467
586
|
calendarValue: calendarProps.calendarValue,
|
|
468
587
|
calendarView: calendarProps.calendarView,
|
|
469
588
|
calendarWeekStartDay: calendarProps.calendarWeekStartDay,
|
|
@@ -472,7 +591,32 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
472
591
|
onCalendarSelect: calendarProps.onCalendarSelect,
|
|
473
592
|
previousMonthLabel: previousMonthLabel,
|
|
474
593
|
shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
|
|
475
|
-
})))
|
|
594
|
+
})), shouldShowCalendarButton && !isDisabled ? (0, _react2.jsx)(_reactUid.UID, {
|
|
595
|
+
name: function name(id) {
|
|
596
|
+
return "open-calendar-label--".concat(id);
|
|
597
|
+
}
|
|
598
|
+
}, function (openCalendarLabelId) {
|
|
599
|
+
return (0, _react2.jsx)("div", {
|
|
600
|
+
css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
|
|
601
|
+
}, inputLabelId && (0, _react2.jsx)(_visuallyHidden.default, {
|
|
602
|
+
id: openCalendarLabelId
|
|
603
|
+
}, ", ", openCalendarLabel), (0, _react2.jsx)(_primitives.Pressable, (0, _extends2.default)({}, inputLabelId ? {
|
|
604
|
+
'aria-labelledby': "".concat(inputLabelId, " ").concat(openCalendarLabelId)
|
|
605
|
+
} : {
|
|
606
|
+
'aria-label': fullopenCalendarLabel
|
|
607
|
+
}, {
|
|
608
|
+
onClick: _this2.onCalendarButtonClick,
|
|
609
|
+
onKeyDown: _this2.onCalendarButtonKeyDown,
|
|
610
|
+
ref: _this2.calendarButtonRef,
|
|
611
|
+
testId: testId && "".concat(testId, "--open-calendar-button"),
|
|
612
|
+
type: "button",
|
|
613
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
614
|
+
padding: "space.050",
|
|
615
|
+
xcss: calendarButtonStyles
|
|
616
|
+
}), (0, _react2.jsx)(_calendar.default, {
|
|
617
|
+
label: ""
|
|
618
|
+
})));
|
|
619
|
+
}) : null)
|
|
476
620
|
);
|
|
477
621
|
}
|
|
478
622
|
}], [{
|
|
@@ -32,7 +32,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
32
32
|
* @jsx jsx
|
|
33
33
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
34
34
|
var packageName = "@atlaskit/datetime-picker";
|
|
35
|
-
var packageVersion = "15.
|
|
35
|
+
var packageVersion = "15.2.0";
|
|
36
36
|
// Make DatePicker 50% the width of DateTimePicker
|
|
37
37
|
// If rendering an icon container, shrink the TimePicker
|
|
38
38
|
var datePickerContainerStyles = (0, _react2.css)({
|
|
@@ -351,6 +351,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
351
351
|
placeholder: datePickerProps.placeholder,
|
|
352
352
|
previousMonthLabel: datePickerProps.previousMonthLabel,
|
|
353
353
|
selectProps: mergedDatePickerSelectProps,
|
|
354
|
+
shouldShowCalendarButton: datePickerProps.shouldShowCalendarButton,
|
|
354
355
|
spacing: datePickerProps.spacing || spacing,
|
|
355
356
|
testId: testId && "".concat(testId, "--datepicker") || datePickerProps.testId,
|
|
356
357
|
value: dateValue,
|
|
@@ -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.2.0";
|
|
31
31
|
var menuStyles = {
|
|
32
32
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
33
33
|
position: 'static',
|
|
@@ -281,6 +281,8 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
281
281
|
ClearIndicator: _internal.EmptyComponent
|
|
282
282
|
});
|
|
283
283
|
var renderIconContainer = Boolean(!hideIcon && value);
|
|
284
|
+
|
|
285
|
+
// @ts-ignore -- Argument of type 'StylesConfig<OptionType, false, GroupBase<OptionType>>' is not assignable to parameter of type 'StylesConfig<OptionType, boolean, GroupBase<OptionType>>'.
|
|
284
286
|
var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
|
|
285
287
|
control: function control(base) {
|
|
286
288
|
return _objectSpread({}, base);
|
|
@@ -332,7 +334,7 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
332
334
|
value: initialValue,
|
|
333
335
|
spacing: spacing
|
|
334
336
|
// We need this to get things to work, even though it's not supported.
|
|
335
|
-
// @ts-ignore
|
|
337
|
+
// @ts-ignore - https://product-fabric.atlassian.net/browse/DSP-21000
|
|
336
338
|
,
|
|
337
339
|
fixedLayerRef: containerRef,
|
|
338
340
|
isInvalid: isInvalid,
|
|
@@ -45,7 +45,9 @@ var FixedLayerMenu = exports.FixedLayerMenu = function FixedLayerMenu(_ref) {
|
|
|
45
45
|
children = _ref.children,
|
|
46
46
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
47
47
|
return (0, _react.jsx)(_fixedLayer.default, {
|
|
48
|
-
inputValue: selectProps.inputValue
|
|
48
|
+
inputValue: selectProps.inputValue
|
|
49
|
+
//@ts-ignore react-select unsupported props
|
|
50
|
+
,
|
|
49
51
|
containerRef: selectProps.fixedLayerRef,
|
|
50
52
|
content: (0, _react.jsx)(_select.components.Menu, (0, _extends2.default)({}, rest, {
|
|
51
53
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -73,7 +75,9 @@ var FixedLayerMenu = exports.FixedLayerMenu = function FixedLayerMenu(_ref) {
|
|
|
73
75
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides, @atlaskit/design-system/no-unsafe-style-overrides
|
|
74
76
|
,
|
|
75
77
|
theme: theme
|
|
76
|
-
}), children)
|
|
78
|
+
}), children)
|
|
79
|
+
//@ts-ignore react-select unsupported props
|
|
80
|
+
,
|
|
77
81
|
testId: selectProps.testId
|
|
78
82
|
});
|
|
79
83
|
};
|
|
@@ -72,6 +72,7 @@ var Menu = exports.Menu = function Menu(_ref) {
|
|
|
72
72
|
onChange: selectProps.onCalendarChange,
|
|
73
73
|
onSelect: selectProps.onCalendarSelect,
|
|
74
74
|
previousMonthLabel: selectProps.previousMonthLabel,
|
|
75
|
+
ref: selectProps.calendarRef,
|
|
75
76
|
selected: [selectProps.calendarValue],
|
|
76
77
|
shouldSetFocusOnCurrentDay: selectProps.shouldSetFocusOnCurrentDay,
|
|
77
78
|
locale: selectProps.calendarLocale,
|