@atlaskit/datetime-picker 15.9.1 → 15.9.3
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 +19 -0
- package/dist/cjs/components/date-picker-class.js +8 -2
- package/dist/cjs/components/date-picker-fc.js +8 -2
- package/dist/cjs/components/date-time-picker-class.js +1 -1
- package/dist/cjs/components/date-time-picker-fc.js +5 -1
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/cjs/internal/menu.js +19 -2
- package/dist/es2019/components/date-picker-class.js +8 -2
- package/dist/es2019/components/date-picker-fc.js +8 -2
- package/dist/es2019/components/date-time-picker-class.js +1 -1
- package/dist/es2019/components/date-time-picker-fc.js +5 -1
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/es2019/internal/menu.js +20 -2
- package/dist/esm/components/date-picker-class.js +8 -2
- package/dist/esm/components/date-picker-fc.js +8 -2
- package/dist/esm/components/date-time-picker-class.js +1 -1
- package/dist/esm/components/date-time-picker-fc.js +5 -1
- package/dist/esm/components/time-picker.js +1 -1
- package/dist/esm/internal/menu.js +20 -2
- package/dist/types/internal/menu.d.ts +0 -4
- package/dist/types-ts4.5/internal/menu.d.ts +0 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 15.9.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165423](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165423)
|
|
8
|
+
[`f07cb14952573`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f07cb14952573) -
|
|
9
|
+
Update internals of datetime picker to accommodate new props.
|
|
10
|
+
- [#165989](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165989)
|
|
11
|
+
[`4e6b0a538b8a2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4e6b0a538b8a2) -
|
|
12
|
+
Fix bug that stopped down/up arrow presses from opening the menu on the input field.
|
|
13
|
+
|
|
14
|
+
## 15.9.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [#163831](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/163831)
|
|
19
|
+
[`bdee2726c1e39`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bdee2726c1e39) -
|
|
20
|
+
Fix bug in calendar date selection caused by underlying `react-select` mousedown event.
|
|
21
|
+
|
|
3
22
|
## 15.9.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -43,7 +43,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
43
43
|
* @jsx jsx
|
|
44
44
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
45
45
|
var packageName = "@atlaskit/datetime-picker";
|
|
46
|
-
var packageVersion = "15.9.
|
|
46
|
+
var packageVersion = "15.9.3";
|
|
47
47
|
var dropdownIndicatorStyles = (0, _primitives.xcss)({
|
|
48
48
|
minWidth: "var(--ds-space-300, 24px)",
|
|
49
49
|
minHeight: "var(--ds-space-300, 24px)",
|
|
@@ -331,8 +331,9 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
331
331
|
break;
|
|
332
332
|
case 'arrowdown':
|
|
333
333
|
case 'arrowup':
|
|
334
|
-
if (
|
|
334
|
+
if (!_this.state.shouldSetFocusOnCurrentDay) {
|
|
335
335
|
_this.setState({
|
|
336
|
+
isOpen: true,
|
|
336
337
|
shouldSetFocusOnCurrentDay: true
|
|
337
338
|
});
|
|
338
339
|
}
|
|
@@ -342,6 +343,11 @@ var DatePickerComponent = exports.DatePickerWithoutAnalytics = /*#__PURE__*/func
|
|
|
342
343
|
}
|
|
343
344
|
});
|
|
344
345
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCalendarButtonKeyDown", function (e) {
|
|
346
|
+
// Don't allow an arrow up or down to open the menu, since the input key
|
|
347
|
+
// down handler is actually on the parent.
|
|
348
|
+
if (e.type === 'keydown' && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
349
|
+
e.stopPropagation();
|
|
350
|
+
}
|
|
345
351
|
// We want to stop this from triggering other keydown events, particularly
|
|
346
352
|
// for space and enter presses. Otherwise, it opens and then closes
|
|
347
353
|
// immediately.
|
|
@@ -39,7 +39,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
39
39
|
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; }
|
|
40
40
|
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; }
|
|
41
41
|
var packageName = "@atlaskit/datetime-picker";
|
|
42
|
-
var packageVersion = "15.9.
|
|
42
|
+
var packageVersion = "15.9.3";
|
|
43
43
|
var analyticsAttributes = {
|
|
44
44
|
componentName: 'datePicker',
|
|
45
45
|
packageName: packageName,
|
|
@@ -414,7 +414,8 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
414
414
|
break;
|
|
415
415
|
case 'arrowdown':
|
|
416
416
|
case 'arrowup':
|
|
417
|
-
if (
|
|
417
|
+
if (!shouldSetFocusOnCurrentDay) {
|
|
418
|
+
setIsOpen(true);
|
|
418
419
|
setShouldSetFocusOnCurrentDay(true);
|
|
419
420
|
}
|
|
420
421
|
break;
|
|
@@ -423,6 +424,11 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, forwardedR
|
|
|
423
424
|
}
|
|
424
425
|
};
|
|
425
426
|
var onCalendarButtonKeyDown = function onCalendarButtonKeyDown(e) {
|
|
427
|
+
// Don't allow an arrow up or down to open the menu, since the input key
|
|
428
|
+
// down handler is actually on the parent.
|
|
429
|
+
if (e.type === 'keydown' && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
430
|
+
e.stopPropagation();
|
|
431
|
+
}
|
|
426
432
|
// We want to stop this from triggering other keydown events, particularly
|
|
427
433
|
// for space and enter presses. Otherwise, it opens and then closes
|
|
428
434
|
// immediately.
|
|
@@ -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.9.
|
|
41
|
+
var packageVersion = "15.9.3";
|
|
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)({
|
|
@@ -37,7 +37,7 @@ 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.9.
|
|
40
|
+
var packageVersion = "15.9.3";
|
|
41
41
|
var analyticsAttributes = {
|
|
42
42
|
componentName: 'dateTimePicker',
|
|
43
43
|
packageName: packageName,
|
|
@@ -319,6 +319,8 @@ var DateTimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
319
319
|
icon: datePickerProps.icon,
|
|
320
320
|
id: datePickerProps.id || id,
|
|
321
321
|
innerProps: datePickerProps.innerProps,
|
|
322
|
+
inputLabel: datePickerProps.inputLabel,
|
|
323
|
+
inputLabelId: datePickerProps.inputLabelId,
|
|
322
324
|
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
323
325
|
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
324
326
|
isOpen: datePickerProps.isOpen,
|
|
@@ -332,10 +334,12 @@ var DateTimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
332
334
|
onBlur: onDateBlur,
|
|
333
335
|
onChange: onDateChange,
|
|
334
336
|
onFocus: onDateFocus,
|
|
337
|
+
openCalendarLabel: datePickerProps.openCalendarLabel,
|
|
335
338
|
parseInputValue: datePickerProps.parseInputValue,
|
|
336
339
|
placeholder: datePickerProps.placeholder,
|
|
337
340
|
previousMonthLabel: datePickerProps.previousMonthLabel,
|
|
338
341
|
selectProps: mergedDatePickerSelectProps,
|
|
342
|
+
shouldShowCalendarButton: datePickerProps.shouldShowCalendarButton,
|
|
339
343
|
spacing: datePickerProps.spacing || spacing,
|
|
340
344
|
testId: testId && "".concat(testId, "--datepicker") || datePickerProps.testId,
|
|
341
345
|
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.9.
|
|
30
|
+
var packageVersion = "15.9.3";
|
|
31
31
|
var menuStyles = {
|
|
32
32
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
33
33
|
position: 'static',
|
|
@@ -53,14 +53,31 @@ var Menu = exports.Menu = function Menu(_ref) {
|
|
|
53
53
|
day = _getValidDate.day,
|
|
54
54
|
month = _getValidDate.month,
|
|
55
55
|
year = _getValidDate.year;
|
|
56
|
+
var onMenuMouseDown = function onMenuMouseDown(event) {
|
|
57
|
+
if (event.button !== 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
event.stopPropagation();
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
};
|
|
56
63
|
return (0, _react.jsx)(_layering.Layering, {
|
|
57
64
|
isDisabled: false
|
|
58
65
|
}, (0, _react.jsx)(_fixedLayer.default, {
|
|
59
66
|
inputValue: selectProps.inputValue,
|
|
60
67
|
containerRef: selectProps.calendarContainerRef,
|
|
61
|
-
content:
|
|
68
|
+
content:
|
|
69
|
+
// The mousedown event is required for a date selection to work when
|
|
70
|
+
// the menu is opened via the calendar button. The reason why is
|
|
71
|
+
// because there is a mousedown event on the menu inside of
|
|
72
|
+
// `react-select` that will stop the calendar select event from
|
|
73
|
+
// firing. This is passed in via the `innerProps`. Therefore, we must
|
|
74
|
+
// pass it in *after* the `innerProps` spread.
|
|
75
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
76
|
+
(0, _react.jsx)("div", (0, _extends2.default)({
|
|
62
77
|
css: menuStyles
|
|
63
|
-
}, innerProps
|
|
78
|
+
}, innerProps, {
|
|
79
|
+
onMouseDown: onMenuMouseDown
|
|
80
|
+
}), (0, _react.jsx)(_calendar.default, {
|
|
64
81
|
day: day,
|
|
65
82
|
month: month,
|
|
66
83
|
year: year,
|
|
@@ -26,7 +26,7 @@ import { Menu } from '../internal/menu';
|
|
|
26
26
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
27
27
|
import { makeSingleValue } from '../internal/single-value';
|
|
28
28
|
const packageName = "@atlaskit/datetime-picker";
|
|
29
|
-
const packageVersion = "15.9.
|
|
29
|
+
const packageVersion = "15.9.3";
|
|
30
30
|
const dropdownIndicatorStyles = xcss({
|
|
31
31
|
minWidth: "var(--ds-space-300, 24px)",
|
|
32
32
|
minHeight: "var(--ds-space-300, 24px)",
|
|
@@ -314,8 +314,9 @@ class DatePickerComponent extends Component {
|
|
|
314
314
|
break;
|
|
315
315
|
case 'arrowdown':
|
|
316
316
|
case 'arrowup':
|
|
317
|
-
if (
|
|
317
|
+
if (!this.state.shouldSetFocusOnCurrentDay) {
|
|
318
318
|
this.setState({
|
|
319
|
+
isOpen: true,
|
|
319
320
|
shouldSetFocusOnCurrentDay: true
|
|
320
321
|
});
|
|
321
322
|
}
|
|
@@ -325,6 +326,11 @@ class DatePickerComponent extends Component {
|
|
|
325
326
|
}
|
|
326
327
|
});
|
|
327
328
|
_defineProperty(this, "onCalendarButtonKeyDown", e => {
|
|
329
|
+
// Don't allow an arrow up or down to open the menu, since the input key
|
|
330
|
+
// down handler is actually on the parent.
|
|
331
|
+
if (e.type === 'keydown' && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
332
|
+
e.stopPropagation();
|
|
333
|
+
}
|
|
328
334
|
// We want to stop this from triggering other keydown events, particularly
|
|
329
335
|
// for space and enter presses. Otherwise, it opens and then closes
|
|
330
336
|
// immediately.
|
|
@@ -24,7 +24,7 @@ import { Menu } from '../internal/menu';
|
|
|
24
24
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
25
25
|
import { makeSingleValue } from '../internal/single-value';
|
|
26
26
|
const packageName = "@atlaskit/datetime-picker";
|
|
27
|
-
const packageVersion = "15.9.
|
|
27
|
+
const packageVersion = "15.9.3";
|
|
28
28
|
const analyticsAttributes = {
|
|
29
29
|
componentName: 'datePicker',
|
|
30
30
|
packageName,
|
|
@@ -340,7 +340,8 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
340
340
|
break;
|
|
341
341
|
case 'arrowdown':
|
|
342
342
|
case 'arrowup':
|
|
343
|
-
if (
|
|
343
|
+
if (!shouldSetFocusOnCurrentDay) {
|
|
344
|
+
setIsOpen(true);
|
|
344
345
|
setShouldSetFocusOnCurrentDay(true);
|
|
345
346
|
}
|
|
346
347
|
break;
|
|
@@ -349,6 +350,11 @@ const DatePicker = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
349
350
|
}
|
|
350
351
|
};
|
|
351
352
|
const onCalendarButtonKeyDown = e => {
|
|
353
|
+
// Don't allow an arrow up or down to open the menu, since the input key
|
|
354
|
+
// down handler is actually on the parent.
|
|
355
|
+
if (e.type === 'keydown' && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
356
|
+
e.stopPropagation();
|
|
357
|
+
}
|
|
352
358
|
// We want to stop this from triggering other keydown events, particularly
|
|
353
359
|
// for space and enter presses. Otherwise, it opens and then closes
|
|
354
360
|
// immediately.
|
|
@@ -22,7 +22,7 @@ import DatePickerNew from './date-picker-fc';
|
|
|
22
22
|
import TimePicker from './time-picker';
|
|
23
23
|
const DatePicker = componentWithCondition(() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
|
|
24
24
|
const packageName = "@atlaskit/datetime-picker";
|
|
25
|
-
const packageVersion = "15.9.
|
|
25
|
+
const packageVersion = "15.9.3";
|
|
26
26
|
// Make DatePicker 50% the width of DateTimePicker
|
|
27
27
|
// If rendering an icon container, shrink the TimePicker
|
|
28
28
|
const datePickerContainerStyles = css({
|
|
@@ -18,7 +18,7 @@ const DatePicker = componentWithCondition(
|
|
|
18
18
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
19
19
|
() => fg('dst-date-picker-use-functional-component'), DatePickerNew, DatePickerOld);
|
|
20
20
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "15.9.
|
|
21
|
+
const packageVersion = "15.9.3";
|
|
22
22
|
const analyticsAttributes = {
|
|
23
23
|
componentName: 'dateTimePicker',
|
|
24
24
|
packageName,
|
|
@@ -281,6 +281,8 @@ const DateTimePicker = /*#__PURE__*/forwardRef(({
|
|
|
281
281
|
icon: datePickerProps.icon,
|
|
282
282
|
id: datePickerProps.id || id,
|
|
283
283
|
innerProps: datePickerProps.innerProps,
|
|
284
|
+
inputLabel: datePickerProps.inputLabel,
|
|
285
|
+
inputLabelId: datePickerProps.inputLabelId,
|
|
284
286
|
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
285
287
|
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
286
288
|
isOpen: datePickerProps.isOpen,
|
|
@@ -294,10 +296,12 @@ const DateTimePicker = /*#__PURE__*/forwardRef(({
|
|
|
294
296
|
onBlur: onDateBlur,
|
|
295
297
|
onChange: onDateChange,
|
|
296
298
|
onFocus: onDateFocus,
|
|
299
|
+
openCalendarLabel: datePickerProps.openCalendarLabel,
|
|
297
300
|
parseInputValue: datePickerProps.parseInputValue,
|
|
298
301
|
placeholder: datePickerProps.placeholder,
|
|
299
302
|
previousMonthLabel: datePickerProps.previousMonthLabel,
|
|
300
303
|
selectProps: mergedDatePickerSelectProps,
|
|
304
|
+
shouldShowCalendarButton: datePickerProps.shouldShowCalendarButton,
|
|
301
305
|
spacing: datePickerProps.spacing || spacing,
|
|
302
306
|
testId: testId && `${testId}--datepicker` || datePickerProps.testId,
|
|
303
307
|
value: dateValue,
|
|
@@ -11,7 +11,7 @@ import parseTime from '../internal/parse-time';
|
|
|
11
11
|
import { convertTokens } from '../internal/parse-tokens';
|
|
12
12
|
import { makeSingleValue } from '../internal/single-value';
|
|
13
13
|
const packageName = "@atlaskit/datetime-picker";
|
|
14
|
-
const packageVersion = "15.9.
|
|
14
|
+
const packageVersion = "15.9.3";
|
|
15
15
|
const menuStyles = {
|
|
16
16
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
17
17
|
position: 'static',
|
|
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
+
|
|
7
8
|
import { css, jsx } from '@emotion/react';
|
|
8
9
|
import { isValid, parseISO } from 'date-fns';
|
|
9
10
|
import Calendar from '@atlaskit/calendar';
|
|
@@ -50,14 +51,31 @@ export const Menu = ({
|
|
|
50
51
|
month,
|
|
51
52
|
year
|
|
52
53
|
} = getValidDate([calendarValue, calendarView]);
|
|
54
|
+
const onMenuMouseDown = event => {
|
|
55
|
+
if (event.button !== 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
};
|
|
53
61
|
return jsx(Layering, {
|
|
54
62
|
isDisabled: false
|
|
55
63
|
}, jsx(FixedLayer, {
|
|
56
64
|
inputValue: selectProps.inputValue,
|
|
57
65
|
containerRef: selectProps.calendarContainerRef,
|
|
58
|
-
content:
|
|
66
|
+
content:
|
|
67
|
+
// The mousedown event is required for a date selection to work when
|
|
68
|
+
// the menu is opened via the calendar button. The reason why is
|
|
69
|
+
// because there is a mousedown event on the menu inside of
|
|
70
|
+
// `react-select` that will stop the calendar select event from
|
|
71
|
+
// firing. This is passed in via the `innerProps`. Therefore, we must
|
|
72
|
+
// pass it in *after* the `innerProps` spread.
|
|
73
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
74
|
+
jsx("div", _extends({
|
|
59
75
|
css: menuStyles
|
|
60
|
-
}, innerProps
|
|
76
|
+
}, innerProps, {
|
|
77
|
+
onMouseDown: onMenuMouseDown
|
|
78
|
+
}), jsx(Calendar, {
|
|
61
79
|
day: day,
|
|
62
80
|
month: month,
|
|
63
81
|
year: year,
|
|
@@ -36,7 +36,7 @@ import { Menu } from '../internal/menu';
|
|
|
36
36
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
37
37
|
import { makeSingleValue } from '../internal/single-value';
|
|
38
38
|
var packageName = "@atlaskit/datetime-picker";
|
|
39
|
-
var packageVersion = "15.9.
|
|
39
|
+
var packageVersion = "15.9.3";
|
|
40
40
|
var dropdownIndicatorStyles = xcss({
|
|
41
41
|
minWidth: "var(--ds-space-300, 24px)",
|
|
42
42
|
minHeight: "var(--ds-space-300, 24px)",
|
|
@@ -324,8 +324,9 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
|
|
|
324
324
|
break;
|
|
325
325
|
case 'arrowdown':
|
|
326
326
|
case 'arrowup':
|
|
327
|
-
if (
|
|
327
|
+
if (!_this.state.shouldSetFocusOnCurrentDay) {
|
|
328
328
|
_this.setState({
|
|
329
|
+
isOpen: true,
|
|
329
330
|
shouldSetFocusOnCurrentDay: true
|
|
330
331
|
});
|
|
331
332
|
}
|
|
@@ -335,6 +336,11 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
|
|
|
335
336
|
}
|
|
336
337
|
});
|
|
337
338
|
_defineProperty(_assertThisInitialized(_this), "onCalendarButtonKeyDown", function (e) {
|
|
339
|
+
// Don't allow an arrow up or down to open the menu, since the input key
|
|
340
|
+
// down handler is actually on the parent.
|
|
341
|
+
if (e.type === 'keydown' && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
342
|
+
e.stopPropagation();
|
|
343
|
+
}
|
|
338
344
|
// We want to stop this from triggering other keydown events, particularly
|
|
339
345
|
// for space and enter presses. Otherwise, it opens and then closes
|
|
340
346
|
// immediately.
|
|
@@ -30,7 +30,7 @@ import { Menu } from '../internal/menu';
|
|
|
30
30
|
import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date';
|
|
31
31
|
import { makeSingleValue } from '../internal/single-value';
|
|
32
32
|
var packageName = "@atlaskit/datetime-picker";
|
|
33
|
-
var packageVersion = "15.9.
|
|
33
|
+
var packageVersion = "15.9.3";
|
|
34
34
|
var analyticsAttributes = {
|
|
35
35
|
componentName: 'datePicker',
|
|
36
36
|
packageName: packageName,
|
|
@@ -405,7 +405,8 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
|
|
|
405
405
|
break;
|
|
406
406
|
case 'arrowdown':
|
|
407
407
|
case 'arrowup':
|
|
408
|
-
if (
|
|
408
|
+
if (!shouldSetFocusOnCurrentDay) {
|
|
409
|
+
setIsOpen(true);
|
|
409
410
|
setShouldSetFocusOnCurrentDay(true);
|
|
410
411
|
}
|
|
411
412
|
break;
|
|
@@ -414,6 +415,11 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, forwardedRef) {
|
|
|
414
415
|
}
|
|
415
416
|
};
|
|
416
417
|
var onCalendarButtonKeyDown = function onCalendarButtonKeyDown(e) {
|
|
418
|
+
// Don't allow an arrow up or down to open the menu, since the input key
|
|
419
|
+
// down handler is actually on the parent.
|
|
420
|
+
if (e.type === 'keydown' && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
|
|
421
|
+
e.stopPropagation();
|
|
422
|
+
}
|
|
417
423
|
// We want to stop this from triggering other keydown events, particularly
|
|
418
424
|
// for space and enter presses. Otherwise, it opens and then closes
|
|
419
425
|
// immediately.
|
|
@@ -34,7 +34,7 @@ var DatePicker = componentWithCondition(function () {
|
|
|
34
34
|
return fg('dst-date-picker-use-functional-component');
|
|
35
35
|
}, DatePickerNew, DatePickerOld);
|
|
36
36
|
var packageName = "@atlaskit/datetime-picker";
|
|
37
|
-
var packageVersion = "15.9.
|
|
37
|
+
var packageVersion = "15.9.3";
|
|
38
38
|
// Make DatePicker 50% the width of DateTimePicker
|
|
39
39
|
// If rendering an icon container, shrink the TimePicker
|
|
40
40
|
var datePickerContainerStyles = css({
|
|
@@ -27,7 +27,7 @@ function () {
|
|
|
27
27
|
return fg('dst-date-picker-use-functional-component');
|
|
28
28
|
}, DatePickerNew, DatePickerOld);
|
|
29
29
|
var packageName = "@atlaskit/datetime-picker";
|
|
30
|
-
var packageVersion = "15.9.
|
|
30
|
+
var packageVersion = "15.9.3";
|
|
31
31
|
var analyticsAttributes = {
|
|
32
32
|
componentName: 'dateTimePicker',
|
|
33
33
|
packageName: packageName,
|
|
@@ -309,6 +309,8 @@ var DateTimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
309
309
|
icon: datePickerProps.icon,
|
|
310
310
|
id: datePickerProps.id || id,
|
|
311
311
|
innerProps: datePickerProps.innerProps,
|
|
312
|
+
inputLabel: datePickerProps.inputLabel,
|
|
313
|
+
inputLabelId: datePickerProps.inputLabelId,
|
|
312
314
|
isDisabled: datePickerProps.isDisabled || isDisabled,
|
|
313
315
|
isInvalid: datePickerProps.isInvalid || isInvalid,
|
|
314
316
|
isOpen: datePickerProps.isOpen,
|
|
@@ -322,10 +324,12 @@ var DateTimePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
322
324
|
onBlur: onDateBlur,
|
|
323
325
|
onChange: onDateChange,
|
|
324
326
|
onFocus: onDateFocus,
|
|
327
|
+
openCalendarLabel: datePickerProps.openCalendarLabel,
|
|
325
328
|
parseInputValue: datePickerProps.parseInputValue,
|
|
326
329
|
placeholder: datePickerProps.placeholder,
|
|
327
330
|
previousMonthLabel: datePickerProps.previousMonthLabel,
|
|
328
331
|
selectProps: mergedDatePickerSelectProps,
|
|
332
|
+
shouldShowCalendarButton: datePickerProps.shouldShowCalendarButton,
|
|
329
333
|
spacing: datePickerProps.spacing || spacing,
|
|
330
334
|
testId: testId && "".concat(testId, "--datepicker") || datePickerProps.testId,
|
|
331
335
|
value: dateValue,
|
|
@@ -17,7 +17,7 @@ import parseTime from '../internal/parse-time';
|
|
|
17
17
|
import { convertTokens } from '../internal/parse-tokens';
|
|
18
18
|
import { makeSingleValue } from '../internal/single-value';
|
|
19
19
|
var packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
var packageVersion = "15.9.
|
|
20
|
+
var packageVersion = "15.9.3";
|
|
21
21
|
var menuStyles = {
|
|
22
22
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
23
23
|
position: 'static',
|
|
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
* @jsx jsx
|
|
5
5
|
*/
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
+
|
|
7
8
|
import { css, jsx } from '@emotion/react';
|
|
8
9
|
import { isValid, parseISO } from 'date-fns';
|
|
9
10
|
import Calendar from '@atlaskit/calendar';
|
|
@@ -46,14 +47,31 @@ export var Menu = function Menu(_ref) {
|
|
|
46
47
|
day = _getValidDate.day,
|
|
47
48
|
month = _getValidDate.month,
|
|
48
49
|
year = _getValidDate.year;
|
|
50
|
+
var onMenuMouseDown = function onMenuMouseDown(event) {
|
|
51
|
+
if (event.button !== 0) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
};
|
|
49
57
|
return jsx(Layering, {
|
|
50
58
|
isDisabled: false
|
|
51
59
|
}, jsx(FixedLayer, {
|
|
52
60
|
inputValue: selectProps.inputValue,
|
|
53
61
|
containerRef: selectProps.calendarContainerRef,
|
|
54
|
-
content:
|
|
62
|
+
content:
|
|
63
|
+
// The mousedown event is required for a date selection to work when
|
|
64
|
+
// the menu is opened via the calendar button. The reason why is
|
|
65
|
+
// because there is a mousedown event on the menu inside of
|
|
66
|
+
// `react-select` that will stop the calendar select event from
|
|
67
|
+
// firing. This is passed in via the `innerProps`. Therefore, we must
|
|
68
|
+
// pass it in *after* the `innerProps` spread.
|
|
69
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
70
|
+
jsx("div", _extends({
|
|
55
71
|
css: menuStyles
|
|
56
|
-
}, innerProps
|
|
72
|
+
}, innerProps, {
|
|
73
|
+
onMouseDown: onMenuMouseDown
|
|
74
|
+
}), jsx(Calendar, {
|
|
57
75
|
day: day,
|
|
58
76
|
month: month,
|
|
59
77
|
year: year,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "15.9.
|
|
3
|
+
"version": "15.9.3",
|
|
4
4
|
"description": "A date time picker allows the user to select an associated date and time.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
39
39
|
"@atlaskit/button": "^20.3.1",
|
|
40
40
|
"@atlaskit/calendar": "^15.1.0",
|
|
41
|
-
"@atlaskit/ds-lib": "^3.
|
|
41
|
+
"@atlaskit/ds-lib": "^3.2.0",
|
|
42
42
|
"@atlaskit/icon": "^22.24.0",
|
|
43
|
-
"@atlaskit/layering": "^0.7.
|
|
43
|
+
"@atlaskit/layering": "^0.7.3",
|
|
44
44
|
"@atlaskit/locale": "^2.8.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
46
|
"@atlaskit/popper": "^6.3.0",
|
|
47
|
-
"@atlaskit/primitives": "^13.
|
|
47
|
+
"@atlaskit/primitives": "^13.2.0",
|
|
48
48
|
"@atlaskit/select": "^18.5.0",
|
|
49
49
|
"@atlaskit/theme": "^14.0.0",
|
|
50
50
|
"@atlaskit/tokens": "^2.2.0",
|