@atlaskit/datetime-picker 13.11.1 → 13.11.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/components/date-picker.js +51 -38
  3. package/dist/cjs/components/date-time-picker.js +98 -52
  4. package/dist/cjs/components/time-picker.js +14 -14
  5. package/dist/cjs/internal/fixed-layer-menu.js +50 -4
  6. package/dist/cjs/internal/menu.js +24 -9
  7. package/dist/cjs/internal/single-value.js +37 -4
  8. package/dist/es2019/components/date-picker.js +50 -36
  9. package/dist/es2019/components/date-time-picker.js +91 -55
  10. package/dist/es2019/components/time-picker.js +14 -17
  11. package/dist/es2019/internal/fixed-layer-menu.js +48 -2
  12. package/dist/es2019/internal/menu.js +53 -32
  13. package/dist/es2019/internal/single-value.js +36 -3
  14. package/dist/esm/components/date-picker.js +51 -38
  15. package/dist/esm/components/date-time-picker.js +98 -52
  16. package/dist/esm/components/time-picker.js +14 -14
  17. package/dist/esm/internal/fixed-layer-menu.js +50 -4
  18. package/dist/esm/internal/menu.js +25 -9
  19. package/dist/esm/internal/single-value.js +37 -4
  20. package/dist/types/components/date-picker.d.ts +2 -12
  21. package/dist/types/components/date-time-picker.d.ts +2 -3
  22. package/dist/types/components/time-picker.d.ts +2 -1
  23. package/dist/types/internal/fixed-layer-menu.d.ts +1 -1
  24. package/dist/types/internal/single-value.d.ts +1 -1
  25. package/dist/types-ts4.5/components/date-picker.d.ts +2 -12
  26. package/dist/types-ts4.5/components/date-time-picker.d.ts +2 -3
  27. package/dist/types-ts4.5/components/time-picker.d.ts +2 -1
  28. package/dist/types-ts4.5/internal/fixed-layer-menu.d.ts +1 -1
  29. package/dist/types-ts4.5/internal/single-value.d.ts +1 -1
  30. package/package.json +6 -7
@@ -11,13 +11,20 @@ import { UNSAFE_LAYERING } from '@atlaskit/layering';
11
11
  import { N0, N50A, N60A } from '@atlaskit/theme/colors';
12
12
  import { layers } from '@atlaskit/theme/constants';
13
13
  import FixedLayer from '../internal/fixed-layer';
14
- function getValidDate(iso) {
15
- const date = parseISO(iso);
16
- return isValid(date) ? {
17
- day: date.getDate(),
18
- month: date.getMonth() + 1,
19
- year: date.getFullYear()
20
- } : {};
14
+
15
+ /**
16
+ * @param isos A series of ISO dates.
17
+ * @returns The last valid date within the array of ISO strings.
18
+ */
19
+ function getValidDate(isos) {
20
+ return isos.reduce((acc, iso) => {
21
+ const date = parseISO(iso);
22
+ return isValid(date) ? {
23
+ day: date.getDate(),
24
+ month: date.getMonth() + 1,
25
+ year: date.getFullYear()
26
+ } : acc;
27
+ }, {});
21
28
  }
22
29
  const menuStyles = css({
23
30
  zIndex: layers.dialog(),
@@ -33,28 +40,42 @@ const menuStyles = css({
33
40
  export const Menu = ({
34
41
  selectProps,
35
42
  innerProps
36
- }) => jsx(UNSAFE_LAYERING, {
37
- isDisabled: false
38
- }, jsx(FixedLayer, {
39
- inputValue: selectProps.inputValue,
40
- containerRef: selectProps.calendarContainerRef,
41
- content: jsx("div", _extends({
42
- css: menuStyles
43
- }, innerProps), jsx(Calendar, _extends({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
44
- disabled: selectProps.calendarDisabled,
45
- disabledDateFilter: selectProps.calendarDisabledDateFilter,
46
- minDate: selectProps.calendarMinDate,
47
- maxDate: selectProps.calendarMaxDate,
48
- nextMonthLabel: selectProps.nextMonthLabel,
49
- onChange: selectProps.onCalendarChange,
50
- onSelect: selectProps.onCalendarSelect,
51
- previousMonthLabel: selectProps.previousMonthLabel,
52
- calendarRef: selectProps.calendarRef,
53
- selected: [selectProps.calendarValue],
54
- shouldSetFocusOnCurrentDay: selectProps.shouldSetFocusOnCurrentDay,
55
- locale: selectProps.calendarLocale,
56
- testId: selectProps.testId && `${selectProps.testId}--calendar`,
57
- weekStartDay: selectProps.calendarWeekStartDay
58
- }))),
59
- testId: selectProps.testId
60
- }));
43
+ }) => {
44
+ const {
45
+ calendarValue,
46
+ calendarView
47
+ } = selectProps;
48
+ const {
49
+ day,
50
+ month,
51
+ year
52
+ } = getValidDate([calendarValue, calendarView]);
53
+ return jsx(UNSAFE_LAYERING, {
54
+ isDisabled: false
55
+ }, jsx(FixedLayer, {
56
+ inputValue: selectProps.inputValue,
57
+ containerRef: selectProps.calendarContainerRef,
58
+ content: jsx("div", _extends({
59
+ css: menuStyles
60
+ }, innerProps), jsx(Calendar, {
61
+ day: day,
62
+ month: month,
63
+ year: year,
64
+ disabled: selectProps.calendarDisabled,
65
+ disabledDateFilter: selectProps.calendarDisabledDateFilter,
66
+ minDate: selectProps.calendarMinDate,
67
+ maxDate: selectProps.calendarMaxDate,
68
+ nextMonthLabel: selectProps.nextMonthLabel,
69
+ onChange: selectProps.onCalendarChange,
70
+ onSelect: selectProps.onCalendarSelect,
71
+ previousMonthLabel: selectProps.previousMonthLabel,
72
+ calendarRef: selectProps.calendarRef,
73
+ selected: [selectProps.calendarValue],
74
+ shouldSetFocusOnCurrentDay: selectProps.shouldSetFocusOnCurrentDay,
75
+ locale: selectProps.calendarLocale,
76
+ testId: selectProps.testId && `${selectProps.testId}--calendar`,
77
+ weekStartDay: selectProps.calendarWeekStartDay
78
+ })),
79
+ testId: selectProps.testId
80
+ }));
81
+ };
@@ -10,11 +10,44 @@ export const makeSingleValue = ({
10
10
  lang
11
11
  }) => ({
12
12
  children,
13
- ...props
13
+ className,
14
+ clearValue,
15
+ cx,
16
+ data,
17
+ getStyles,
18
+ getValue,
19
+ hasValue,
20
+ isDisabled,
21
+ isMulti,
22
+ isRtl,
23
+ options,
24
+ selectOption,
25
+ selectProps,
26
+ setValue,
27
+ theme,
28
+ ...rest
14
29
  }) => {
15
- return /*#__PURE__*/React.createElement(components.SingleValue, _extends({}, props, {
30
+ return /*#__PURE__*/React.createElement(components.SingleValue, _extends({}, rest, {
31
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
32
+ className: className,
33
+ clearValue: clearValue,
34
+ cx: cx,
35
+ data: data,
36
+ getStyles: getStyles,
37
+ getValue: getValue,
38
+ hasValue: hasValue,
16
39
  innerProps: {
17
40
  lang
18
- }
41
+ },
42
+ isDisabled: isDisabled,
43
+ isMulti: isMulti,
44
+ isRtl: isRtl,
45
+ options: options,
46
+ selectOption: selectOption,
47
+ selectProps: selectProps,
48
+ setValue: setValue
49
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides, @atlaskit/design-system/no-unsafe-style-overrides
50
+ ,
51
+ theme: theme
19
52
  }), children);
20
53
  };
@@ -20,7 +20,6 @@ import { Component } from 'react';
20
20
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
21
21
  import { jsx } from '@emotion/react';
22
22
  import { format, isValid, lastDayOfMonth, parseISO } from 'date-fns';
23
- import pick from 'lodash/pick';
24
23
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
25
24
  import CalendarIcon from '@atlaskit/icon/glyph/calendar';
26
25
  import { createLocalizationProvider } from '@atlaskit/locale';
@@ -31,7 +30,7 @@ import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date'
31
30
  import { convertTokens } from '../internal/parse-tokens';
32
31
  import { makeSingleValue } from '../internal/single-value';
33
32
  var packageName = "@atlaskit/datetime-picker";
34
- var packageVersion = "13.11.1";
33
+ var packageVersion = "13.11.3";
35
34
  var datePickerDefaultProps = {
36
35
  appearance: 'default',
37
36
  autoFocus: false,
@@ -73,8 +72,13 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
73
72
  _defineProperty(_assertThisInitialized(_this), "containerRef", null);
74
73
  // All state needs to be accessed via this function so that the state is mapped from props
75
74
  // correctly to allow controlled/uncontrolled usage.
76
- _defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
77
- return _objectSpread(_objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value', 'isOpen'])), pick(_this.props.selectProps, ['inputValue']));
75
+ _defineProperty(_assertThisInitialized(_this), "getValue", function () {
76
+ var _this$props$value;
77
+ return (_this$props$value = _this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : _this.state.value;
78
+ });
79
+ _defineProperty(_assertThisInitialized(_this), "getIsOpen", function () {
80
+ var _this$props$isOpen;
81
+ return (_this$props$isOpen = _this.props.isOpen) !== null && _this$props$isOpen !== void 0 ? _this$props$isOpen : _this.state.isOpen;
78
82
  });
79
83
  _defineProperty(_assertThisInitialized(_this), "isDateDisabled", function (date) {
80
84
  return _this.props.disabled.indexOf(date) > -1;
@@ -124,7 +128,7 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
124
128
  });
125
129
  });
126
130
  _defineProperty(_assertThisInitialized(_this), "onInputClick", function () {
127
- if (!_this.props.isDisabled && !_this.getSafeState().isOpen) {
131
+ if (!_this.props.isDisabled && !_this.getIsOpen()) {
128
132
  _this.setState({
129
133
  isOpen: true
130
134
  });
@@ -149,7 +153,7 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
149
153
  _defineProperty(_assertThisInitialized(_this), "onSelectBlur", function (event) {
150
154
  var _this$containerRef3;
151
155
  var newlyFocusedElement = event.relatedTarget;
152
- if (_this.getSafeState().clearingFromIcon) {
156
+ if (_this.state.clearingFromIcon) {
153
157
  // Don't close menu if blurring after the user has clicked clear
154
158
  _this.setState({
155
159
  clearingFromIcon: false
@@ -164,9 +168,8 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
164
168
  }
165
169
  });
166
170
  _defineProperty(_assertThisInitialized(_this), "onSelectFocus", function (event) {
167
- var _this$getSafeState = _this.getSafeState(),
168
- clearingFromIcon = _this$getSafeState.clearingFromIcon,
169
- value = _this$getSafeState.value;
171
+ var clearingFromIcon = _this.state.clearingFromIcon;
172
+ var value = _this.getValue();
170
173
  if (clearingFromIcon) {
171
174
  // Don't open menu if focussing after the user has clicked clear
172
175
  _this.setState({
@@ -200,9 +203,8 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
200
203
  });
201
204
  _defineProperty(_assertThisInitialized(_this), "onInputKeyDown", function (event) {
202
205
  var _this$containerRef4;
203
- var _this$getSafeState2 = _this.getSafeState(),
204
- value = _this$getSafeState2.value,
205
- calendarValue = _this$getSafeState2.calendarValue;
206
+ var calendarValue = _this.state.calendarValue;
207
+ var value = _this.getValue();
206
208
  var keyPressed = event.key.toLowerCase();
207
209
 
208
210
  // If the input is focused and the calendar is not visible, handle space and enter clicks
@@ -330,8 +332,7 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
330
332
  if (parseInputValue) {
331
333
  return parseInputValue(date, dateFormat || defaultDateFormat);
332
334
  }
333
- var _this$getSafeState3 = _this.getSafeState(),
334
- l10n = _this$getSafeState3.l10n;
335
+ var l10n = _this.state.l10n;
335
336
  return l10n.parseDate(date);
336
337
  });
337
338
  /**
@@ -345,8 +346,7 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
345
346
  var _this$props2 = _this.props,
346
347
  formatDisplayLabel = _this$props2.formatDisplayLabel,
347
348
  dateFormat = _this$props2.dateFormat;
348
- var _this$getSafeState4 = _this.getSafeState(),
349
- l10n = _this$getSafeState4.l10n;
349
+ var l10n = _this.state.l10n;
350
350
  if (formatDisplayLabel) {
351
351
  return formatDisplayLabel(value, dateFormat || defaultDateFormat);
352
352
  }
@@ -358,8 +358,7 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
358
358
  if (placeholder) {
359
359
  return placeholder;
360
360
  }
361
- var _this$getSafeState5 = _this.getSafeState(),
362
- l10n = _this$getSafeState5.l10n;
361
+ var l10n = _this.state.l10n;
363
362
  return l10n.formatDate(placeholderDatetime);
364
363
  });
365
364
  _this.state = {
@@ -401,14 +400,13 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
401
400
  locale = _this$props3.locale,
402
401
  testId = _this$props3.testId,
403
402
  weekStartDay = _this$props3.weekStartDay;
404
- var _this$getSafeState6 = this.getSafeState(),
405
- value = _this$getSafeState6.value,
406
- calendarValue = _this$getSafeState6.calendarValue,
407
- isOpen = _this$getSafeState6.isOpen,
408
- selectInputValue = _this$getSafeState6.selectInputValue;
403
+ var _this$state = this.state,
404
+ calendarValue = _this$state.calendarValue,
405
+ selectInputValue = _this$state.selectInputValue;
406
+ var value = this.getValue();
409
407
  var actualSelectInputValue;
410
408
  actualSelectInputValue = selectInputValue;
411
- var menuIsOpen = isOpen && !isDisabled;
409
+ var menuIsOpen = this.getIsOpen() && !isDisabled;
412
410
  var showClearIndicator = Boolean((value || selectInputValue) && !hideIcon);
413
411
  var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
414
412
  var SingleValue = makeSingleValue({
@@ -440,8 +438,6 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
440
438
  onCalendarSelect: this.onCalendarSelect,
441
439
  calendarLocale: locale,
442
440
  calendarWeekStartDay: weekStartDay,
443
- nextMonthLabel: nextMonthLabel,
444
- previousMonthLabel: previousMonthLabel,
445
441
  shouldSetFocusOnCurrentDay: this.state.shouldSetFocusOnCurrentDay
446
442
  };
447
443
  var mergedStyles = mergeStyles(selectStyles, {
@@ -478,31 +474,48 @@ var DatePickerComponent = /*#__PURE__*/function (_Component) {
478
474
  value: value,
479
475
  "data-testid": testId && "".concat(testId, "--input")
480
476
  }), jsx(Select, _extends({
477
+ appearance: this.props.appearance,
481
478
  "aria-describedby": ariaDescribedBy,
482
479
  "aria-label": label || undefined,
483
- appearance: this.props.appearance,
484
- enableAnimation: false,
485
- menuIsOpen: menuIsOpen,
486
- closeMenuOnSelect: true,
487
480
  autoFocus: autoFocus,
481
+ closeMenuOnSelect: true,
482
+ components: selectComponents,
483
+ enableAnimation: false,
488
484
  inputId: id,
485
+ inputValue: actualSelectInputValue,
489
486
  isDisabled: isDisabled,
487
+ menuIsOpen: menuIsOpen,
490
488
  onBlur: this.onSelectBlur,
489
+ onChange: this.onSelectChange,
491
490
  onFocus: this.onSelectFocus,
492
- inputValue: actualSelectInputValue,
493
491
  onInputChange: this.handleSelectInputChange,
494
- components: selectComponents,
495
- onChange: this.onSelectChange
496
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
497
- ,
498
- styles: mergedStyles,
499
492
  placeholder: this.getPlaceholder(),
493
+ styles: mergedStyles,
500
494
  value: initialValue
501
- }, selectProps, calendarProps, {
495
+ }, selectProps, {
496
+ // These are below the spread because I don't know what is in
497
+ // selectProps or not and what wil be overwritten
502
498
  isClearable: true,
503
- spacing: spacing,
504
499
  isInvalid: isInvalid,
500
+ spacing: spacing,
505
501
  testId: testId
502
+ // These aren't part of `Select`'s API, but we're using them here.
503
+ ,
504
+ calendarContainerRef: calendarProps.calendarContainerRef,
505
+ calendarDisabled: calendarProps.calendarDisabled,
506
+ calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
507
+ calendarLocale: calendarProps.calendarLocale,
508
+ calendarMaxDate: calendarProps.calendarMaxDate,
509
+ calendarMinDate: calendarProps.calendarMinDate,
510
+ calendarRef: calendarProps.calendarRef,
511
+ calendarValue: calendarProps.calendarValue,
512
+ calendarView: calendarProps.calendarView,
513
+ calendarWeekStartDay: calendarProps.calendarWeekStartDay,
514
+ nextMonthLabel: nextMonthLabel,
515
+ onCalendarChange: calendarProps.onCalendarChange,
516
+ onCalendarSelect: calendarProps.onCalendarSelect,
517
+ previousMonthLabel: previousMonthLabel,
518
+ shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
506
519
  })))
507
520
  );
508
521
  }
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/createClass";
4
3
  import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
@@ -19,7 +18,6 @@ import React from 'react';
19
18
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
20
19
  import { css, jsx } from '@emotion/react';
21
20
  import { format, isValid, parseISO } from 'date-fns';
22
- import pick from 'lodash/pick';
23
21
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
24
22
  import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
25
23
  import { mergeStyles } from '@atlaskit/select';
@@ -30,7 +28,7 @@ import { convertTokens } from '../internal/parse-tokens';
30
28
  import DatePicker from './date-picker';
31
29
  import TimePicker from './time-picker';
32
30
  var packageName = "@atlaskit/datetime-picker";
33
- var packageVersion = "13.11.1";
31
+ var packageVersion = "13.11.3";
34
32
  // Make DatePicker 50% the width of DateTimePicker
35
33
  // If rendering an icon container, shrink the TimePicker
36
34
  var datePickerContainerStyles = css({
@@ -123,9 +121,12 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
123
121
  });
124
122
  // All state needs to be accessed via this function so that the state is mapped from props
125
123
  // correctly to allow controlled/uncontrolled usage.
126
- _defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
127
- var mappedState = _objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value']));
128
- return _objectSpread(_objectSpread({}, mappedState), _this.parseValue(mappedState.value, mappedState.dateValue, mappedState.timeValue, mappedState.zoneValue));
124
+ _defineProperty(_assertThisInitialized(_this), "getParsedValues", function () {
125
+ return _this.parseValue(_this.getValue(), _this.state.dateValue, _this.state.timeValue, _this.state.zoneValue);
126
+ });
127
+ _defineProperty(_assertThisInitialized(_this), "getValue", function () {
128
+ var _this$props$value;
129
+ return (_this$props$value = _this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : _this.state.value;
129
130
  });
130
131
  _defineProperty(_assertThisInitialized(_this), "onBlur", function (event) {
131
132
  _this.setState({
@@ -140,20 +141,28 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
140
141
  _this.props.onFocus(event);
141
142
  });
142
143
  _defineProperty(_assertThisInitialized(_this), "onDateChange", function (dateValue) {
143
- _this.onValueChange(_objectSpread(_objectSpread({}, _this.getSafeState()), {}, {
144
- dateValue: dateValue
145
- }));
144
+ var parsedValues = _this.getParsedValues();
145
+ _this.onValueChange({
146
+ dateValue: dateValue,
147
+ timeValue: parsedValues.timeValue,
148
+ zoneValue: parsedValues.zoneValue
149
+ });
146
150
  });
147
151
  _defineProperty(_assertThisInitialized(_this), "onTimeChange", function (timeValue) {
148
- _this.onValueChange(_objectSpread(_objectSpread({}, _this.getSafeState()), {}, {
149
- timeValue: timeValue
150
- }));
152
+ var parsedValues = _this.getParsedValues();
153
+ _this.onValueChange({
154
+ dateValue: parsedValues.dateValue,
155
+ timeValue: timeValue,
156
+ zoneValue: parsedValues.zoneValue
157
+ });
151
158
  });
152
159
  _defineProperty(_assertThisInitialized(_this), "onClear", function () {
153
- _this.onValueChange(_objectSpread(_objectSpread({}, _this.getSafeState()), {}, {
160
+ var parsedValues = _this.getParsedValues();
161
+ _this.onValueChange({
162
+ dateValue: '',
154
163
  timeValue: '',
155
- dateValue: ''
156
- }));
164
+ zoneValue: parsedValues.zoneValue
165
+ });
157
166
  });
158
167
  return _this;
159
168
  }
@@ -161,7 +170,18 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
161
170
  key: "parseValue",
162
171
  value: function parseValue(value, dateValue, timeValue, zoneValue) {
163
172
  if (this.props.parseValue) {
164
- return this.props.parseValue(value, dateValue, timeValue, zoneValue);
173
+ var parsedFromFn = this.props.parseValue(value, dateValue, timeValue, zoneValue);
174
+ // This handles cases found in Jira where the parse function actually does
175
+ // nothing and returns undefined. The previous `getSafeState` function
176
+ // just spread the values over the state, but if it returned `undefined`,
177
+ // it would just rely on the previous state values. Considering this is
178
+ // what is input to this function anyway, this is a safe way to handle
179
+ // this, colocate the behavior, and not rely on `getSafeState`.
180
+ return parsedFromFn || {
181
+ dateValue: dateValue,
182
+ timeValue: timeValue,
183
+ zoneValue: zoneValue
184
+ };
165
185
  }
166
186
  var parsed = parseISO(value);
167
187
  return isValid(parsed) ? {
@@ -195,7 +215,7 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
195
215
  });
196
216
  this.props.onChange(valueWithValidZone);
197
217
  // If the date or time value was cleared when there is an existing datetime value, then clear the value.
198
- } else if (this.getSafeState().value) {
218
+ } else if (this.getValue()) {
199
219
  this.setState({
200
220
  value: ''
201
221
  });
@@ -225,11 +245,11 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
225
245
  timePickerProps = _this$props.timePickerProps,
226
246
  timePickerSelectProps = _this$props.timePickerSelectProps,
227
247
  times = _this$props.times;
228
- var _this$getSafeState = this.getSafeState(),
229
- isFocused = _this$getSafeState.isFocused,
230
- value = _this$getSafeState.value,
231
- dateValue = _this$getSafeState.dateValue,
232
- timeValue = _this$getSafeState.timeValue;
248
+ var value = this.getValue();
249
+ var isFocused = this.state.isFocused;
250
+ var parsedValues = this.getParsedValues();
251
+ var dateValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.dateValue;
252
+ var timeValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.timeValue;
233
253
  var _datePickerSelectProp = datePickerSelectProps.styles,
234
254
  datePickerStyles = _datePickerSelectProp === void 0 ? {} : _datePickerSelectProp;
235
255
  var _timePickerSelectProp = timePickerSelectProps.styles,
@@ -262,41 +282,67 @@ var DateTimePickerComponent = /*#__PURE__*/function (_React$Component) {
262
282
  "data-testid": testId && "".concat(testId, "--input")
263
283
  }), jsx("div", {
264
284
  css: datePickerContainerStyles
265
- }, jsx(DatePicker, _extends({
285
+ }, jsx(DatePicker, {
266
286
  appearance: appearance,
267
- autoFocus: autoFocus,
268
- dateFormat: dateFormat,
269
- hideIcon: true,
270
- id: id,
271
- isDisabled: isDisabled,
272
- isInvalid: isInvalid,
273
- locale: locale,
274
- onBlur: this.onBlur,
275
- onChange: this.onDateChange,
276
- onFocus: this.onFocus,
287
+ autoFocus: datePickerProps.autoFocus || autoFocus,
288
+ dateFormat: datePickerProps.dateFormat || dateFormat,
289
+ defaultIsOpen: datePickerProps.defaultIsOpen,
290
+ defaultValue: datePickerProps.defaultValue,
291
+ disabled: datePickerProps.disabled,
292
+ disabledDateFilter: datePickerProps.disabledDateFilter,
293
+ formatDisplayLabel: datePickerProps.formatDisplayLabel,
294
+ hideIcon: datePickerProps.hideIcon || true,
295
+ icon: datePickerProps.icon,
296
+ id: datePickerProps.id || id,
297
+ innerProps: datePickerProps.innerProps,
298
+ isDisabled: datePickerProps.isDisabled || isDisabled,
299
+ isInvalid: datePickerProps.isInvalid || isInvalid,
300
+ isOpen: datePickerProps.isOpen,
301
+ locale: datePickerProps.locale || locale,
302
+ maxDate: datePickerProps.maxDate,
303
+ minDate: datePickerProps.minDate,
304
+ name: datePickerProps.name,
305
+ nextMonthLabel: datePickerProps.nextMonthLabel,
306
+ onBlur: datePickerProps.onBlur || this.onBlur,
307
+ onChange: datePickerProps.onChange || this.onDateChange,
308
+ onFocus: datePickerProps.onFocus || this.onFocus,
309
+ parseInputValue: datePickerProps.parseInputValue,
310
+ placeholder: datePickerProps.placeholder,
311
+ previousMonthLabel: datePickerProps.previousMonthLabel,
277
312
  selectProps: mergedDatePickerSelectProps,
278
- spacing: spacing,
279
- testId: testId && "".concat(testId, "--datepicker"),
280
- value: dateValue
281
- }, datePickerProps))), jsx("div", {
313
+ spacing: datePickerProps.spacing || spacing,
314
+ testId: testId && "".concat(testId, "--datepicker") || datePickerProps.testId,
315
+ value: dateValue,
316
+ weekStartDay: datePickerProps.weekStartDay
317
+ })), jsx("div", {
282
318
  css: timePickerContainerStyles
283
- }, jsx(TimePicker, _extends({
284
- appearance: appearance,
285
- hideIcon: true,
286
- isDisabled: isDisabled,
287
- isInvalid: isInvalid,
288
- locale: locale,
289
- onBlur: this.onBlur,
290
- onChange: this.onTimeChange,
291
- onFocus: this.onFocus,
319
+ }, jsx(TimePicker, {
320
+ appearance: timePickerProps.appearance || appearance,
321
+ autoFocus: timePickerProps.autoFocus,
322
+ defaultIsOpen: timePickerProps.defaultIsOpen,
323
+ defaultValue: timePickerProps.defaultValue,
324
+ formatDisplayLabel: timePickerProps.formatDisplayLabel,
325
+ hideIcon: timePickerProps.hideIcon || true,
326
+ id: timePickerProps.id,
327
+ innerProps: timePickerProps.innerProps,
328
+ isDisabled: timePickerProps.isDisabled || isDisabled,
329
+ isInvalid: timePickerProps.isInvalid || isInvalid,
330
+ isOpen: timePickerProps.isOpen,
331
+ locale: timePickerProps.locale || locale,
332
+ name: timePickerProps.name,
333
+ onBlur: timePickerProps.onBlur || this.onBlur,
334
+ onChange: timePickerProps.onChange || this.onTimeChange,
335
+ onFocus: timePickerProps.onFocus || this.onFocus,
336
+ parseInputValue: timePickerProps.parseInputValue,
337
+ placeholder: timePickerProps.placeholder,
292
338
  selectProps: mergedTimePickerSelectProps,
293
- spacing: spacing,
294
- testId: testId && "".concat(testId, "--timepicker"),
295
- timeFormat: timeFormat,
296
- timeIsEditable: timeIsEditable,
297
- times: times,
339
+ spacing: timePickerProps.spacing || spacing,
340
+ testId: timePickerProps.testId || testId && "".concat(testId, "--timepicker"),
341
+ timeFormat: timePickerProps.timeFormat || timeFormat,
342
+ timeIsEditable: timePickerProps.timeIsEditable || timeIsEditable,
343
+ times: timePickerProps.times || times,
298
344
  value: timeValue
299
- }, timePickerProps))), isClearable && !isDisabled ? jsx("button", {
345
+ })), isClearable && !isDisabled ? jsx("button", {
300
346
  css: iconContainerStyles,
301
347
  onClick: this.onClear,
302
348
  "data-testid": testId && "".concat(testId, "--icon--container"),
@@ -16,7 +16,6 @@ import React from 'react';
16
16
 
17
17
  // eslint-disable-next-line no-restricted-imports
18
18
  import { format, isValid } from 'date-fns';
19
- import pick from 'lodash/pick';
20
19
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
21
20
  import { createLocalizationProvider } from '@atlaskit/locale';
22
21
  import Select, { CreatableSelect, mergeStyles } from '@atlaskit/select';
@@ -28,7 +27,7 @@ import parseTime from '../internal/parse-time';
28
27
  import { convertTokens } from '../internal/parse-tokens';
29
28
  import { makeSingleValue } from '../internal/single-value';
30
29
  var packageName = "@atlaskit/datetime-picker";
31
- var packageVersion = "13.11.1";
30
+ var packageVersion = "13.11.3";
32
31
  var menuStyles = {
33
32
  /* Need to remove default absolute positioning as that causes issues with position fixed */
34
33
  position: 'static',
@@ -86,8 +85,13 @@ var TimePickerComponent = /*#__PURE__*/function (_React$Component) {
86
85
  });
87
86
  // All state needs to be accessed via this function so that the state is mapped from props
88
87
  // correctly to allow controlled/uncontrolled usage.
89
- _defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
90
- return _objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value', 'isOpen']));
88
+ _defineProperty(_assertThisInitialized(_this), "getValue", function () {
89
+ var _this$props$value;
90
+ return (_this$props$value = _this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : _this.state.value;
91
+ });
92
+ _defineProperty(_assertThisInitialized(_this), "getIsOpen", function () {
93
+ var _this$props$isOpen;
94
+ return (_this$props$isOpen = _this.props.isOpen) !== null && _this$props$isOpen !== void 0 ? _this$props$isOpen : _this.state.isOpen;
91
95
  });
92
96
  _defineProperty(_assertThisInitialized(_this), "onChange", function (newValue, action) {
93
97
  var rawValue = newValue ? newValue.value || newValue : '';
@@ -130,7 +134,7 @@ var TimePickerComponent = /*#__PURE__*/function (_React$Component) {
130
134
  });
131
135
  _defineProperty(_assertThisInitialized(_this), "onMenuOpen", function () {
132
136
  // Don't open menu after the user has clicked clear
133
- if (_this.getSafeState().clearingFromIcon) {
137
+ if (_this.state.clearingFromIcon) {
134
138
  _this.setState({
135
139
  clearingFromIcon: false
136
140
  });
@@ -142,7 +146,7 @@ var TimePickerComponent = /*#__PURE__*/function (_React$Component) {
142
146
  });
143
147
  _defineProperty(_assertThisInitialized(_this), "onMenuClose", function () {
144
148
  // Don't close menu after the user has clicked clear
145
- if (_this.getSafeState().clearingFromIcon) {
149
+ if (_this.state.clearingFromIcon) {
146
150
  _this.setState({
147
151
  clearingFromIcon: false
148
152
  });
@@ -176,7 +180,7 @@ var TimePickerComponent = /*#__PURE__*/function (_React$Component) {
176
180
  _defineProperty(_assertThisInitialized(_this), "onSelectKeyDown", function (event) {
177
181
  var key = event.key;
178
182
  var keyPressed = key.toLowerCase();
179
- if (_this.getSafeState().clearingFromIcon && (keyPressed === 'backspace' || keyPressed === 'delete')) {
183
+ if (_this.state.clearingFromIcon && (keyPressed === 'backspace' || keyPressed === 'delete')) {
180
184
  // If being cleared from keyboard, don't change behaviour
181
185
  _this.setState({
182
186
  clearingFromIcon: false
@@ -211,10 +215,8 @@ var TimePickerComponent = /*#__PURE__*/function (_React$Component) {
211
215
  times = _this$props2.times;
212
216
  var ICON_PADDING = 2;
213
217
  var l10n = createLocalizationProvider(locale);
214
- var _this$getSafeState = this.getSafeState(),
215
- _this$getSafeState$va = _this$getSafeState.value,
216
- value = _this$getSafeState$va === void 0 ? '' : _this$getSafeState$va,
217
- isOpen = _this$getSafeState.isOpen;
218
+ var value = this.getValue() || '';
219
+ var isOpen = this.getIsOpen();
218
220
  var _selectProps$styles = selectProps.styles,
219
221
  selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles,
220
222
  otherSelectProps = _objectWithoutProperties(selectProps, _excluded);
@@ -313,9 +315,7 @@ var TimePickerComponent = /*#__PURE__*/function (_React$Component) {
313
315
  placeholder: placeholder || l10n.formatTime(placeholderDatetime),
314
316
  styles: mergedStyles,
315
317
  value: initialValue,
316
- spacing: spacing
317
- // @ts-ignore caused by prop not part of @atlaskit/select
318
- ,
318
+ spacing: spacing,
319
319
  fixedLayerRef: this.containerRef,
320
320
  isInvalid: isInvalid,
321
321
  testId: testId