@atlaskit/datetime-picker 15.1.4 → 15.3.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 +21 -0
- package/dist/cjs/components/date-picker.js +178 -30
- package/dist/cjs/components/date-time-picker.js +6 -1
- package/dist/cjs/components/time-picker.js +6 -2
- package/dist/cjs/internal/menu.js +1 -0
- package/dist/es2019/components/date-picker.js +171 -32
- package/dist/es2019/components/date-time-picker.js +5 -1
- package/dist/es2019/components/time-picker.js +5 -2
- package/dist/es2019/internal/menu.js +1 -0
- package/dist/esm/components/date-picker.js +180 -32
- package/dist/esm/components/date-time-picker.js +6 -1
- package/dist/esm/components/time-picker.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 +54 -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 +54 -0
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 15.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#132971](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132971)
|
|
8
|
+
[`eca12e4531487`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eca12e4531487) -
|
|
9
|
+
add isRequired prop
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#150734](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/150734)
|
|
14
|
+
[`8a55d1695e74a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8a55d1695e74a) -
|
|
15
|
+
Use proper icon color for calendar button.
|
|
16
|
+
|
|
17
|
+
## 15.2.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`6f45e454d44fe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6f45e454d44fe) -
|
|
22
|
+
[ux] Adds a dedicated button to open the calendar.
|
|
23
|
+
|
|
3
24
|
## 15.1.4
|
|
4
25
|
|
|
5
26
|
### 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.3.0";
|
|
40
47
|
var datePickerDefaultProps = {
|
|
41
48
|
defaultIsOpen: false,
|
|
42
49
|
defaultValue: '',
|
|
@@ -55,6 +62,40 @@ 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
|
+
});
|
|
97
|
+
|
|
98
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
58
99
|
var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/function (_Component) {
|
|
59
100
|
(0, _inherits2.default)(DatePickerComponent, _Component);
|
|
60
101
|
var _super = _createSuper(DatePickerComponent);
|
|
@@ -64,6 +105,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
64
105
|
(0, _classCallCheck2.default)(this, DatePickerComponent);
|
|
65
106
|
_this = _super.call(this, props);
|
|
66
107
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "containerRef", null);
|
|
108
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calendarRef", /*#__PURE__*/(0, _react.createRef)());
|
|
109
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calendarButtonRef", /*#__PURE__*/(0, _react.createRef)());
|
|
67
110
|
// All state needs to be accessed via this function so that the state is mapped from props
|
|
68
111
|
// correctly to allow controlled/uncontrolled usage.
|
|
69
112
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getValue", function () {
|
|
@@ -83,23 +126,30 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
83
126
|
});
|
|
84
127
|
});
|
|
85
128
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCalendarSelect", function (_ref2) {
|
|
86
|
-
var _this$containerRef;
|
|
87
129
|
var iso = _ref2.iso;
|
|
88
130
|
_this.setState({
|
|
89
131
|
selectInputValue: '',
|
|
90
132
|
isOpen: false,
|
|
91
133
|
calendarValue: iso,
|
|
92
|
-
value: iso
|
|
134
|
+
value: iso,
|
|
135
|
+
wasOpenedFromCalendarButton: false
|
|
93
136
|
});
|
|
94
137
|
_this.props.onChange(iso);
|
|
95
138
|
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
139
|
+
// Yes, this is not ideal. The alternative is to be able to place a ref
|
|
140
|
+
// on the inner input of Select itself, which would require a lot of
|
|
141
|
+
// extra stuff in the Select component for only this one thing. While
|
|
142
|
+
// this would be more "React-y", it doesn't seem to pose any other
|
|
143
|
+
// benefits. Performance-wise, we are only searching within the
|
|
144
|
+
// container, so it's quick.
|
|
145
|
+
if (_this.state.wasOpenedFromCalendarButton) {
|
|
146
|
+
var _this$calendarButtonR;
|
|
147
|
+
(_this$calendarButtonR = _this.calendarButtonRef.current) === null || _this$calendarButtonR === void 0 || _this$calendarButtonR.focus();
|
|
148
|
+
} else {
|
|
149
|
+
var _this$containerRef;
|
|
150
|
+
var innerCombobox = (_this$containerRef = _this.containerRef) === null || _this$containerRef === void 0 ? void 0 : _this$containerRef.querySelector('[role="combobox"]');
|
|
151
|
+
innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
|
|
152
|
+
}
|
|
103
153
|
_this.setState({
|
|
104
154
|
isOpen: false
|
|
105
155
|
});
|
|
@@ -107,7 +157,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
107
157
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputClick", function () {
|
|
108
158
|
if (!_this.props.isDisabled && !_this.getIsOpen()) {
|
|
109
159
|
_this.setState({
|
|
110
|
-
isOpen: true
|
|
160
|
+
isOpen: true,
|
|
161
|
+
wasOpenedFromCalendarButton: false
|
|
111
162
|
});
|
|
112
163
|
}
|
|
113
164
|
});
|
|
@@ -117,7 +168,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
117
168
|
if (!((_this$containerRef2 = _this.containerRef) !== null && _this$containerRef2 !== void 0 && _this$containerRef2.contains(newlyFocusedElement))) {
|
|
118
169
|
_this.setState({
|
|
119
170
|
isOpen: false,
|
|
120
|
-
shouldSetFocusOnCurrentDay: false
|
|
171
|
+
shouldSetFocusOnCurrentDay: false,
|
|
172
|
+
wasOpenedFromCalendarButton: false
|
|
121
173
|
});
|
|
122
174
|
_this.props.onBlur(event);
|
|
123
175
|
}
|
|
@@ -140,7 +192,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
140
192
|
// container. Makes keyboard accessibility of calendar possible
|
|
141
193
|
_this.setState({
|
|
142
194
|
isOpen: false,
|
|
143
|
-
isFocused: false
|
|
195
|
+
isFocused: false,
|
|
196
|
+
wasOpenedFromCalendarButton: false
|
|
144
197
|
});
|
|
145
198
|
}
|
|
146
199
|
});
|
|
@@ -154,9 +207,11 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
154
207
|
});
|
|
155
208
|
} else {
|
|
156
209
|
_this.setState({
|
|
157
|
-
|
|
210
|
+
// Don't open when focused into via keyboard if the calendar button is present
|
|
211
|
+
isOpen: !_this.props.shouldShowCalendarButton,
|
|
158
212
|
calendarValue: value,
|
|
159
|
-
isFocused: true
|
|
213
|
+
isFocused: true,
|
|
214
|
+
wasOpenedFromCalendarButton: false
|
|
160
215
|
});
|
|
161
216
|
}
|
|
162
217
|
_this.props.onFocus(event);
|
|
@@ -179,11 +234,11 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
179
234
|
}
|
|
180
235
|
}
|
|
181
236
|
_this.setState({
|
|
182
|
-
isOpen: true
|
|
237
|
+
isOpen: true,
|
|
238
|
+
wasOpenedFromCalendarButton: false
|
|
183
239
|
});
|
|
184
240
|
});
|
|
185
241
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onInputKeyDown", function (event) {
|
|
186
|
-
var _this$containerRef4;
|
|
187
242
|
var calendarValue = _this.state.calendarValue;
|
|
188
243
|
var value = _this.getValue();
|
|
189
244
|
var keyPressed = event.key.toLowerCase();
|
|
@@ -191,7 +246,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
191
246
|
// If the input is focused and the calendar is not visible, handle space and enter clicks
|
|
192
247
|
if (!_this.state.isOpen && (keyPressed === 'enter' || keyPressed === ' ')) {
|
|
193
248
|
_this.setState({
|
|
194
|
-
isOpen: true
|
|
249
|
+
isOpen: true,
|
|
250
|
+
wasOpenedFromCalendarButton: false
|
|
195
251
|
});
|
|
196
252
|
}
|
|
197
253
|
switch (keyPressed) {
|
|
@@ -202,11 +258,18 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
202
258
|
// this would be more "React-y", it doesn't seem to pose any other
|
|
203
259
|
// benefits. Performance-wise, we are only searching within the
|
|
204
260
|
// container, so it's quick.
|
|
205
|
-
|
|
206
|
-
|
|
261
|
+
if (_this.state.wasOpenedFromCalendarButton) {
|
|
262
|
+
var _this$calendarButtonR2;
|
|
263
|
+
(_this$calendarButtonR2 = _this.calendarButtonRef.current) === null || _this$calendarButtonR2 === void 0 || _this$calendarButtonR2.focus();
|
|
264
|
+
} else {
|
|
265
|
+
var _this$containerRef4;
|
|
266
|
+
var innerCombobox = (_this$containerRef4 = _this.containerRef) === null || _this$containerRef4 === void 0 ? void 0 : _this$containerRef4.querySelector('[role="combobox"]');
|
|
267
|
+
innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
|
|
268
|
+
}
|
|
207
269
|
_this.setState({
|
|
208
270
|
isOpen: false,
|
|
209
|
-
shouldSetFocusOnCurrentDay: false
|
|
271
|
+
shouldSetFocusOnCurrentDay: false,
|
|
272
|
+
wasOpenedFromCalendarButton: false
|
|
210
273
|
});
|
|
211
274
|
break;
|
|
212
275
|
case 'backspace':
|
|
@@ -241,7 +304,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
241
304
|
selectInputValue: '',
|
|
242
305
|
isOpen: false,
|
|
243
306
|
value: safeCalendarValue,
|
|
244
|
-
calendarValue: safeCalendarValue
|
|
307
|
+
calendarValue: safeCalendarValue,
|
|
308
|
+
wasOpenedFromCalendarButton: false
|
|
245
309
|
});
|
|
246
310
|
if (valueChanged) {
|
|
247
311
|
_this.props.onChange(safeCalendarValue);
|
|
@@ -260,6 +324,38 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
260
324
|
break;
|
|
261
325
|
}
|
|
262
326
|
});
|
|
327
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCalendarButtonKeyDown", function (e) {
|
|
328
|
+
// We want to stop this from triggering other keydown events, particularly
|
|
329
|
+
// for space and enter presses. Otherwise, it opens and then closes
|
|
330
|
+
// immediately.
|
|
331
|
+
if (e.type === 'keydown') {
|
|
332
|
+
e.stopPropagation();
|
|
333
|
+
}
|
|
334
|
+
_this.setState({
|
|
335
|
+
isKeyDown: true,
|
|
336
|
+
wasOpenedFromCalendarButton: true
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
// This event handler is triggered from both keydown and click. It's weird.
|
|
340
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCalendarButtonClick", function (e) {
|
|
341
|
+
_this.setState({
|
|
342
|
+
isOpen: !_this.state.isOpen,
|
|
343
|
+
wasOpenedFromCalendarButton: true
|
|
344
|
+
}, function () {
|
|
345
|
+
var _this$calendarRef;
|
|
346
|
+
// We don't want the focus to move if this is a click event
|
|
347
|
+
if (!_this.state.isKeyDown) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
_this.setState({
|
|
351
|
+
isKeyDown: false
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// Focus on the first button within the calendar
|
|
355
|
+
(_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();
|
|
356
|
+
});
|
|
357
|
+
e.stopPropagation();
|
|
358
|
+
});
|
|
263
359
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onClear", function () {
|
|
264
360
|
var changedState = {
|
|
265
361
|
value: '',
|
|
@@ -301,6 +397,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
301
397
|
}
|
|
302
398
|
});
|
|
303
399
|
_this.state = {
|
|
400
|
+
isKeyDown: false,
|
|
304
401
|
isOpen: _this.props.defaultIsOpen,
|
|
305
402
|
isFocused: false,
|
|
306
403
|
clearingFromIcon: false,
|
|
@@ -309,33 +406,42 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
309
406
|
calendarValue: _this.props.value || _this.props.defaultValue || (0, _parseDate.getShortISOString)(new Date()),
|
|
310
407
|
l10n: (0, _locale.createLocalizationProvider)(_this.props.locale),
|
|
311
408
|
locale: _this.props.locale,
|
|
312
|
-
shouldSetFocusOnCurrentDay: false
|
|
409
|
+
shouldSetFocusOnCurrentDay: false,
|
|
410
|
+
wasOpenedFromCalendarButton: false
|
|
313
411
|
};
|
|
314
412
|
return _this;
|
|
315
413
|
}
|
|
316
414
|
(0, _createClass2.default)(DatePickerComponent, [{
|
|
317
415
|
key: "render",
|
|
318
416
|
value: function render() {
|
|
417
|
+
var _this2 = this;
|
|
319
418
|
var _this$props = this.props,
|
|
320
419
|
_this$props$appearanc = _this$props.appearance,
|
|
321
420
|
appearance = _this$props$appearanc === void 0 ? 'default' : _this$props$appearanc,
|
|
322
421
|
ariaDescribedBy = _this$props['aria-describedby'],
|
|
323
422
|
_this$props$autoFocus = _this$props.autoFocus,
|
|
324
423
|
autoFocus = _this$props$autoFocus === void 0 ? false : _this$props$autoFocus,
|
|
325
|
-
disabled = _this$props.disabled,
|
|
326
|
-
disabledDateFilter = _this$props.disabledDateFilter,
|
|
327
424
|
_this$props$hideIcon = _this$props.hideIcon,
|
|
328
425
|
hideIcon = _this$props$hideIcon === void 0 ? false : _this$props$hideIcon,
|
|
426
|
+
_this$props$openCalen = _this$props.openCalendarLabel,
|
|
427
|
+
openCalendarLabel = _this$props$openCalen === void 0 ? 'Open calendar' : _this$props$openCalen,
|
|
428
|
+
disabled = _this$props.disabled,
|
|
429
|
+
disabledDateFilter = _this$props.disabledDateFilter,
|
|
329
430
|
_this$props$icon = _this$props.icon,
|
|
330
431
|
icon = _this$props$icon === void 0 ? _calendar.default : _this$props$icon,
|
|
331
432
|
_this$props$id = _this$props.id,
|
|
332
433
|
id = _this$props$id === void 0 ? '' : _this$props$id,
|
|
333
434
|
_this$props$innerProp = _this$props.innerProps,
|
|
334
435
|
innerProps = _this$props$innerProp === void 0 ? {} : _this$props$innerProp,
|
|
436
|
+
_this$props$inputLabe = _this$props.inputLabel,
|
|
437
|
+
inputLabel = _this$props$inputLabe === void 0 ? 'Date picker' : _this$props$inputLabe,
|
|
438
|
+
inputLabelId = _this$props.inputLabelId,
|
|
335
439
|
_this$props$isDisable = _this$props.isDisabled,
|
|
336
440
|
isDisabled = _this$props$isDisable === void 0 ? false : _this$props$isDisable,
|
|
337
441
|
_this$props$isInvalid = _this$props.isInvalid,
|
|
338
442
|
isInvalid = _this$props$isInvalid === void 0 ? false : _this$props$isInvalid,
|
|
443
|
+
_this$props$isRequire = _this$props.isRequired,
|
|
444
|
+
isRequired = _this$props$isRequire === void 0 ? false : _this$props$isRequire,
|
|
339
445
|
_this$props$label = _this$props.label,
|
|
340
446
|
label = _this$props$label === void 0 ? '' : _this$props$label,
|
|
341
447
|
locale = _this$props.locale,
|
|
@@ -347,6 +453,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
347
453
|
previousMonthLabel = _this$props.previousMonthLabel,
|
|
348
454
|
_this$props$selectPro3 = _this$props.selectProps,
|
|
349
455
|
selectProps = _this$props$selectPro3 === void 0 ? {} : _this$props$selectPro3,
|
|
456
|
+
shouldShowCalendarButton = _this$props.shouldShowCalendarButton,
|
|
350
457
|
_this$props$spacing = _this$props.spacing,
|
|
351
458
|
spacing = _this$props$spacing === void 0 ? 'default' : _this$props$spacing,
|
|
352
459
|
testId = _this$props.testId,
|
|
@@ -364,7 +471,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
364
471
|
lang: this.props.locale
|
|
365
472
|
});
|
|
366
473
|
var selectComponents = _objectSpread({
|
|
367
|
-
DropdownIndicator: dropDownIcon,
|
|
474
|
+
DropdownIndicator: shouldShowCalendarButton ? _internal.EmptyComponent : dropDownIcon,
|
|
368
475
|
Menu: _menu.Menu,
|
|
369
476
|
SingleValue: SingleValue
|
|
370
477
|
}, !showClearIndicator && {
|
|
@@ -382,6 +489,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
382
489
|
calendarDisabledDateFilter: disabledDateFilter,
|
|
383
490
|
calendarMaxDate: maxDate,
|
|
384
491
|
calendarMinDate: minDate,
|
|
492
|
+
calendarRef: this.calendarRef,
|
|
385
493
|
calendarValue: value && (0, _parseDate.getShortISOString)((0, _dateFns.parseISO)(value)),
|
|
386
494
|
calendarView: calendarValue,
|
|
387
495
|
onCalendarChange: this.onCalendarChange,
|
|
@@ -390,7 +498,8 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
390
498
|
calendarWeekStartDay: weekStartDay,
|
|
391
499
|
shouldSetFocusOnCurrentDay: this.state.shouldSetFocusOnCurrentDay
|
|
392
500
|
};
|
|
393
|
-
|
|
501
|
+
|
|
502
|
+
// @ts-ignore -- Argument of type 'StylesConfig<OptionType, false, GroupBase<OptionType>>' is not assignable to parameter of type 'StylesConfig<OptionType, boolean, GroupBase<OptionType>>'.
|
|
394
503
|
var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
|
|
395
504
|
control: function control(base) {
|
|
396
505
|
return _objectSpread(_objectSpread({}, base), disabledStyle);
|
|
@@ -411,10 +520,14 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
411
520
|
}),
|
|
412
521
|
value: value
|
|
413
522
|
} : null;
|
|
523
|
+
|
|
524
|
+
// `label` takes precedence of the `inputLabel`
|
|
525
|
+
var fullopenCalendarLabel = label || inputLabel ? "".concat(label || inputLabel, " , ").concat(openCalendarLabel) : openCalendarLabel;
|
|
414
526
|
return (
|
|
415
527
|
// These event handlers must be on this element because the events come
|
|
416
528
|
// from different child elements.
|
|
417
529
|
(0, _react2.jsx)("div", (0, _extends2.default)({}, innerProps, {
|
|
530
|
+
css: pickerContainerStyles,
|
|
418
531
|
role: "presentation",
|
|
419
532
|
onBlur: this.onContainerBlur,
|
|
420
533
|
onFocus: this.onContainerFocus,
|
|
@@ -433,12 +546,20 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
433
546
|
"aria-describedby": ariaDescribedBy,
|
|
434
547
|
"aria-label": label || undefined,
|
|
435
548
|
autoFocus: autoFocus,
|
|
436
|
-
closeMenuOnSelect: true
|
|
549
|
+
closeMenuOnSelect: true
|
|
550
|
+
// FOr some reason, this and the below `styles` type error _only_ show
|
|
551
|
+
// up when you alter some of the properties in the `selectComponents`
|
|
552
|
+
// object. These errors are still present, and I suspect have always
|
|
553
|
+
// been present, without changing the unrelated code. Ignoring as the
|
|
554
|
+
// component still works as expected despite this error. And also
|
|
555
|
+
// because the select refresh team may solve it later.
|
|
556
|
+
,
|
|
437
557
|
components: selectComponents,
|
|
438
558
|
enableAnimation: false,
|
|
439
559
|
inputId: id,
|
|
440
560
|
inputValue: actualSelectInputValue,
|
|
441
561
|
isDisabled: isDisabled,
|
|
562
|
+
isRequired: isRequired,
|
|
442
563
|
menuIsOpen: menuIsOpen,
|
|
443
564
|
onBlur: this.onSelectBlur,
|
|
444
565
|
onChange: this.onSelectChange,
|
|
@@ -458,7 +579,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
458
579
|
spacing: spacing,
|
|
459
580
|
testId: testId
|
|
460
581
|
// These aren't part of `Select`'s API, but we're using them here.
|
|
461
|
-
|
|
582
|
+
// @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<...> & { ...; }>'.
|
|
462
583
|
,
|
|
463
584
|
calendarContainerRef: calendarProps.calendarContainerRef,
|
|
464
585
|
calendarDisabled: calendarProps.calendarDisabled,
|
|
@@ -466,6 +587,7 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
466
587
|
calendarLocale: calendarProps.calendarLocale,
|
|
467
588
|
calendarMaxDate: calendarProps.calendarMaxDate,
|
|
468
589
|
calendarMinDate: calendarProps.calendarMinDate,
|
|
590
|
+
calendarRef: calendarProps.calendarRef,
|
|
469
591
|
calendarValue: calendarProps.calendarValue,
|
|
470
592
|
calendarView: calendarProps.calendarView,
|
|
471
593
|
calendarWeekStartDay: calendarProps.calendarWeekStartDay,
|
|
@@ -474,7 +596,33 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
474
596
|
onCalendarSelect: calendarProps.onCalendarSelect,
|
|
475
597
|
previousMonthLabel: previousMonthLabel,
|
|
476
598
|
shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
|
|
477
|
-
})))
|
|
599
|
+
})), shouldShowCalendarButton && !isDisabled ? (0, _react2.jsx)(_reactUid.UID, {
|
|
600
|
+
name: function name(id) {
|
|
601
|
+
return "open-calendar-label--".concat(id);
|
|
602
|
+
}
|
|
603
|
+
}, function (openCalendarLabelId) {
|
|
604
|
+
return (0, _react2.jsx)("div", {
|
|
605
|
+
css: [iconContainerStyles, value && !hideIcon ? iconSpacingWithClearButtonStyles : iconSpacingWithoutClearButtonStyles]
|
|
606
|
+
}, inputLabelId && (0, _react2.jsx)(_visuallyHidden.default, {
|
|
607
|
+
id: openCalendarLabelId
|
|
608
|
+
}, ", ", openCalendarLabel), (0, _react2.jsx)(_primitives.Pressable, (0, _extends2.default)({}, inputLabelId ? {
|
|
609
|
+
'aria-labelledby': "".concat(inputLabelId, " ").concat(openCalendarLabelId)
|
|
610
|
+
} : {
|
|
611
|
+
'aria-label': fullopenCalendarLabel
|
|
612
|
+
}, {
|
|
613
|
+
onClick: _this2.onCalendarButtonClick,
|
|
614
|
+
onKeyDown: _this2.onCalendarButtonKeyDown,
|
|
615
|
+
ref: _this2.calendarButtonRef,
|
|
616
|
+
testId: testId && "".concat(testId, "--open-calendar-button"),
|
|
617
|
+
type: "button",
|
|
618
|
+
backgroundColor: "color.background.neutral.subtle",
|
|
619
|
+
padding: "space.050",
|
|
620
|
+
xcss: calendarButtonStyles
|
|
621
|
+
}), (0, _react2.jsx)(_calendar.default, {
|
|
622
|
+
label: "",
|
|
623
|
+
primaryColor: "var(--ds-icon, #44546F)"
|
|
624
|
+
})));
|
|
625
|
+
}) : null)
|
|
478
626
|
);
|
|
479
627
|
}
|
|
480
628
|
}], [{
|
|
@@ -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.3.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)({
|
|
@@ -277,6 +277,8 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
277
277
|
isDisabled = _this$props7$isDisabl === void 0 ? false : _this$props7$isDisabl,
|
|
278
278
|
_this$props7$isInvali = _this$props7.isInvalid,
|
|
279
279
|
isInvalid = _this$props7$isInvali === void 0 ? false : _this$props7$isInvali,
|
|
280
|
+
_this$props7$isRequir = _this$props7.isRequired,
|
|
281
|
+
isRequired = _this$props7$isRequir === void 0 ? false : _this$props7$isRequir,
|
|
280
282
|
_this$props7$locale = _this$props7.locale,
|
|
281
283
|
locale = _this$props7$locale === void 0 ? 'en-US' : _this$props7$locale,
|
|
282
284
|
_this$props7$name = _this$props7.name,
|
|
@@ -337,6 +339,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
337
339
|
innerProps: datePickerProps.innerProps,
|
|
338
340
|
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
339
341
|
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
342
|
+
isRequired: datePickerProps.isRequired || isRequired,
|
|
340
343
|
isOpen: datePickerProps.isOpen,
|
|
341
344
|
label: datePickerLabel,
|
|
342
345
|
locale: datePickerProps.locale || locale,
|
|
@@ -351,6 +354,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
351
354
|
placeholder: datePickerProps.placeholder,
|
|
352
355
|
previousMonthLabel: datePickerProps.previousMonthLabel,
|
|
353
356
|
selectProps: mergedDatePickerSelectProps,
|
|
357
|
+
shouldShowCalendarButton: datePickerProps.shouldShowCalendarButton,
|
|
354
358
|
spacing: datePickerProps.spacing || spacing,
|
|
355
359
|
testId: testId && "".concat(testId, "--datepicker") || datePickerProps.testId,
|
|
356
360
|
value: dateValue,
|
|
@@ -370,6 +374,7 @@ var DateTimePickerComponent = exports.DateTimePickerWithoutAnalytics = /*#__PURE
|
|
|
370
374
|
isDisabled: timePickerProps.isDisabled || isDisabled,
|
|
371
375
|
isInvalid: timePickerProps.isInvalid || isInvalid,
|
|
372
376
|
isOpen: timePickerProps.isOpen,
|
|
377
|
+
isRequired: timePickerProps.isRequired || isRequired,
|
|
373
378
|
label: timePickerLabel,
|
|
374
379
|
locale: timePickerProps.locale || locale,
|
|
375
380
|
name: timePickerProps.name,
|
|
@@ -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.3.0";
|
|
31
31
|
var menuStyles = {
|
|
32
32
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
33
33
|
position: 'static',
|
|
@@ -72,6 +72,8 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
72
72
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
73
73
|
_ref$isInvalid = _ref.isInvalid,
|
|
74
74
|
isInvalid = _ref$isInvalid === void 0 ? false : _ref$isInvalid,
|
|
75
|
+
_ref$isRequired = _ref.isRequired,
|
|
76
|
+
isRequired = _ref$isRequired === void 0 ? false : _ref$isRequired,
|
|
75
77
|
providedIsOpen = _ref.isOpen,
|
|
76
78
|
_ref$label = _ref.label,
|
|
77
79
|
label = _ref$label === void 0 ? '' : _ref$label,
|
|
@@ -281,7 +283,8 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
281
283
|
ClearIndicator: _internal.EmptyComponent
|
|
282
284
|
});
|
|
283
285
|
var renderIconContainer = Boolean(!hideIcon && value);
|
|
284
|
-
|
|
286
|
+
|
|
287
|
+
// @ts-ignore -- Argument of type 'StylesConfig<OptionType, false, GroupBase<OptionType>>' is not assignable to parameter of type 'StylesConfig<OptionType, boolean, GroupBase<OptionType>>'.
|
|
285
288
|
var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
|
|
286
289
|
control: function control(base) {
|
|
287
290
|
return _objectSpread({}, base);
|
|
@@ -318,6 +321,7 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
318
321
|
inputId: id,
|
|
319
322
|
isClearable: true,
|
|
320
323
|
isDisabled: isDisabled,
|
|
324
|
+
isRequired: isRequired,
|
|
321
325
|
menuIsOpen: isOpen && !isDisabled,
|
|
322
326
|
menuPlacement: "auto",
|
|
323
327
|
openMenuOnFocus: true,
|
|
@@ -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,
|