@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
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _select = require("@atlaskit/select");
12
- var _excluded = ["children"];
12
+ var _excluded = ["children", "className", "clearValue", "cx", "data", "getStyles", "getValue", "hasValue", "isDisabled", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue", "theme"];
13
13
  /**
14
14
  * This creates a functional component that `react-select` will use to make the
15
15
  * SingleValue part of the different pickers.
@@ -18,11 +18,44 @@ var makeSingleValue = exports.makeSingleValue = function makeSingleValue(_ref) {
18
18
  var lang = _ref.lang;
19
19
  return function (_ref2) {
20
20
  var children = _ref2.children,
21
- props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
22
- return /*#__PURE__*/_react.default.createElement(_select.components.SingleValue, (0, _extends2.default)({}, props, {
21
+ className = _ref2.className,
22
+ clearValue = _ref2.clearValue,
23
+ cx = _ref2.cx,
24
+ data = _ref2.data,
25
+ getStyles = _ref2.getStyles,
26
+ getValue = _ref2.getValue,
27
+ hasValue = _ref2.hasValue,
28
+ isDisabled = _ref2.isDisabled,
29
+ isMulti = _ref2.isMulti,
30
+ isRtl = _ref2.isRtl,
31
+ options = _ref2.options,
32
+ selectOption = _ref2.selectOption,
33
+ selectProps = _ref2.selectProps,
34
+ setValue = _ref2.setValue,
35
+ theme = _ref2.theme,
36
+ rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
37
+ return /*#__PURE__*/_react.default.createElement(_select.components.SingleValue, (0, _extends2.default)({}, rest, {
38
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
39
+ className: className,
40
+ clearValue: clearValue,
41
+ cx: cx,
42
+ data: data,
43
+ getStyles: getStyles,
44
+ getValue: getValue,
45
+ hasValue: hasValue,
23
46
  innerProps: {
24
47
  lang: lang
25
- }
48
+ },
49
+ isDisabled: isDisabled,
50
+ isMulti: isMulti,
51
+ isRtl: isRtl,
52
+ options: options,
53
+ selectOption: selectOption,
54
+ selectProps: selectProps,
55
+ setValue: setValue
56
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides, @atlaskit/design-system/no-unsafe-style-overrides
57
+ ,
58
+ theme: theme
26
59
  }), children);
27
60
  };
28
61
  };
@@ -9,7 +9,6 @@ import { Component } from 'react';
9
9
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
10
  import { jsx } from '@emotion/react';
11
11
  import { format, isValid, lastDayOfMonth, parseISO } from 'date-fns';
12
- import pick from 'lodash/pick';
13
12
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
14
13
  import CalendarIcon from '@atlaskit/icon/glyph/calendar';
15
14
  import { createLocalizationProvider } from '@atlaskit/locale';
@@ -20,7 +19,7 @@ import { getSafeCalendarValue, getShortISOString } from '../internal/parse-date'
20
19
  import { convertTokens } from '../internal/parse-tokens';
21
20
  import { makeSingleValue } from '../internal/single-value';
22
21
  const packageName = "@atlaskit/datetime-picker";
23
- const packageVersion = "13.11.1";
22
+ const packageVersion = "13.11.3";
24
23
  const datePickerDefaultProps = {
25
24
  appearance: 'default',
26
25
  autoFocus: false,
@@ -56,12 +55,13 @@ class DatePickerComponent extends Component {
56
55
  _defineProperty(this, "containerRef", null);
57
56
  // All state needs to be accessed via this function so that the state is mapped from props
58
57
  // correctly to allow controlled/uncontrolled usage.
59
- _defineProperty(this, "getSafeState", () => {
60
- return {
61
- ...this.state,
62
- ...pick(this.props, ['value', 'isOpen']),
63
- ...pick(this.props.selectProps, ['inputValue'])
64
- };
58
+ _defineProperty(this, "getValue", () => {
59
+ var _this$props$value;
60
+ return (_this$props$value = this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : this.state.value;
61
+ });
62
+ _defineProperty(this, "getIsOpen", () => {
63
+ var _this$props$isOpen;
64
+ return (_this$props$isOpen = this.props.isOpen) !== null && _this$props$isOpen !== void 0 ? _this$props$isOpen : this.state.isOpen;
65
65
  });
66
66
  _defineProperty(this, "isDateDisabled", date => {
67
67
  return this.props.disabled.indexOf(date) > -1;
@@ -109,7 +109,7 @@ class DatePickerComponent extends Component {
109
109
  });
110
110
  });
111
111
  _defineProperty(this, "onInputClick", () => {
112
- if (!this.props.isDisabled && !this.getSafeState().isOpen) {
112
+ if (!this.props.isDisabled && !this.getIsOpen()) {
113
113
  this.setState({
114
114
  isOpen: true
115
115
  });
@@ -134,7 +134,7 @@ class DatePickerComponent extends Component {
134
134
  _defineProperty(this, "onSelectBlur", event => {
135
135
  var _this$containerRef3;
136
136
  const newlyFocusedElement = event.relatedTarget;
137
- if (this.getSafeState().clearingFromIcon) {
137
+ if (this.state.clearingFromIcon) {
138
138
  // Don't close menu if blurring after the user has clicked clear
139
139
  this.setState({
140
140
  clearingFromIcon: false
@@ -150,9 +150,9 @@ class DatePickerComponent extends Component {
150
150
  });
151
151
  _defineProperty(this, "onSelectFocus", event => {
152
152
  const {
153
- clearingFromIcon,
154
- value
155
- } = this.getSafeState();
153
+ clearingFromIcon
154
+ } = this.state;
155
+ const value = this.getValue();
156
156
  if (clearingFromIcon) {
157
157
  // Don't open menu if focussing after the user has clicked clear
158
158
  this.setState({
@@ -187,9 +187,9 @@ class DatePickerComponent extends Component {
187
187
  _defineProperty(this, "onInputKeyDown", event => {
188
188
  var _this$containerRef4;
189
189
  const {
190
- value,
191
190
  calendarValue
192
- } = this.getSafeState();
191
+ } = this.state;
192
+ const value = this.getValue();
193
193
  const keyPressed = event.key.toLowerCase();
194
194
 
195
195
  // If the input is focused and the calendar is not visible, handle space and enter clicks
@@ -323,7 +323,7 @@ class DatePickerComponent extends Component {
323
323
  }
324
324
  const {
325
325
  l10n
326
- } = this.getSafeState();
326
+ } = this.state;
327
327
  return l10n.parseDate(date);
328
328
  });
329
329
  /**
@@ -340,7 +340,7 @@ class DatePickerComponent extends Component {
340
340
  } = this.props;
341
341
  const {
342
342
  l10n
343
- } = this.getSafeState();
343
+ } = this.state;
344
344
  if (formatDisplayLabel) {
345
345
  return formatDisplayLabel(value, dateFormat || defaultDateFormat);
346
346
  }
@@ -356,7 +356,7 @@ class DatePickerComponent extends Component {
356
356
  }
357
357
  const {
358
358
  l10n
359
- } = this.getSafeState();
359
+ } = this.state;
360
360
  return l10n.formatDate(placeholderDatetime);
361
361
  });
362
362
  this.state = {
@@ -407,14 +407,13 @@ class DatePickerComponent extends Component {
407
407
  weekStartDay
408
408
  } = this.props;
409
409
  const {
410
- value,
411
410
  calendarValue,
412
- isOpen,
413
411
  selectInputValue
414
- } = this.getSafeState();
412
+ } = this.state;
413
+ const value = this.getValue();
415
414
  let actualSelectInputValue;
416
415
  actualSelectInputValue = selectInputValue;
417
- const menuIsOpen = isOpen && !isDisabled;
416
+ const menuIsOpen = this.getIsOpen() && !isDisabled;
418
417
  const showClearIndicator = Boolean((value || selectInputValue) && !hideIcon);
419
418
  const dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
420
419
  const SingleValue = makeSingleValue({
@@ -448,8 +447,6 @@ class DatePickerComponent extends Component {
448
447
  onCalendarSelect: this.onCalendarSelect,
449
448
  calendarLocale: locale,
450
449
  calendarWeekStartDay: weekStartDay,
451
- nextMonthLabel,
452
- previousMonthLabel,
453
450
  shouldSetFocusOnCurrentDay: this.state.shouldSetFocusOnCurrentDay
454
451
  };
455
452
  const mergedStyles = mergeStyles(selectStyles, {
@@ -486,31 +483,48 @@ class DatePickerComponent extends Component {
486
483
  value: value,
487
484
  "data-testid": testId && `${testId}--input`
488
485
  }), jsx(Select, _extends({
486
+ appearance: this.props.appearance,
489
487
  "aria-describedby": ariaDescribedBy,
490
488
  "aria-label": label || undefined,
491
- appearance: this.props.appearance,
492
- enableAnimation: false,
493
- menuIsOpen: menuIsOpen,
494
- closeMenuOnSelect: true,
495
489
  autoFocus: autoFocus,
490
+ closeMenuOnSelect: true,
491
+ components: selectComponents,
492
+ enableAnimation: false,
496
493
  inputId: id,
494
+ inputValue: actualSelectInputValue,
497
495
  isDisabled: isDisabled,
496
+ menuIsOpen: menuIsOpen,
498
497
  onBlur: this.onSelectBlur,
498
+ onChange: this.onSelectChange,
499
499
  onFocus: this.onSelectFocus,
500
- inputValue: actualSelectInputValue,
501
500
  onInputChange: this.handleSelectInputChange,
502
- components: selectComponents,
503
- onChange: this.onSelectChange
504
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
505
- ,
506
- styles: mergedStyles,
507
501
  placeholder: this.getPlaceholder(),
502
+ styles: mergedStyles,
508
503
  value: initialValue
509
- }, selectProps, calendarProps, {
504
+ }, selectProps, {
505
+ // These are below the spread because I don't know what is in
506
+ // selectProps or not and what wil be overwritten
510
507
  isClearable: true,
511
- spacing: spacing,
512
508
  isInvalid: isInvalid,
509
+ spacing: spacing,
513
510
  testId: testId
511
+ // These aren't part of `Select`'s API, but we're using them here.
512
+ ,
513
+ calendarContainerRef: calendarProps.calendarContainerRef,
514
+ calendarDisabled: calendarProps.calendarDisabled,
515
+ calendarDisabledDateFilter: calendarProps.calendarDisabledDateFilter,
516
+ calendarLocale: calendarProps.calendarLocale,
517
+ calendarMaxDate: calendarProps.calendarMaxDate,
518
+ calendarMinDate: calendarProps.calendarMinDate,
519
+ calendarRef: calendarProps.calendarRef,
520
+ calendarValue: calendarProps.calendarValue,
521
+ calendarView: calendarProps.calendarView,
522
+ calendarWeekStartDay: calendarProps.calendarWeekStartDay,
523
+ nextMonthLabel: nextMonthLabel,
524
+ onCalendarChange: calendarProps.onCalendarChange,
525
+ onCalendarSelect: calendarProps.onCalendarSelect,
526
+ previousMonthLabel: previousMonthLabel,
527
+ shouldSetFocusOnCurrentDay: calendarProps.shouldSetFocusOnCurrentDay
514
528
  })))
515
529
  );
516
530
  }
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  /**
4
3
  * @jsxRuntime classic
@@ -9,7 +8,6 @@ import React from 'react';
9
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
10
9
  import { css, jsx } from '@emotion/react';
11
10
  import { format, isValid, parseISO } from 'date-fns';
12
- import pick from 'lodash/pick';
13
11
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
14
12
  import SelectClearIcon from '@atlaskit/icon/glyph/select-clear';
15
13
  import { mergeStyles } from '@atlaskit/select';
@@ -20,7 +18,7 @@ import { convertTokens } from '../internal/parse-tokens';
20
18
  import DatePicker from './date-picker';
21
19
  import TimePicker from './time-picker';
22
20
  const packageName = "@atlaskit/datetime-picker";
23
- const packageVersion = "13.11.1";
21
+ const packageVersion = "13.11.3";
24
22
  // Make DatePicker 50% the width of DateTimePicker
25
23
  // If rendering an icon container, shrink the TimePicker
26
24
  const datePickerContainerStyles = css({
@@ -105,15 +103,10 @@ class DateTimePickerComponent extends React.Component {
105
103
  });
106
104
  // All state needs to be accessed via this function so that the state is mapped from props
107
105
  // correctly to allow controlled/uncontrolled usage.
108
- _defineProperty(this, "getSafeState", () => {
109
- const mappedState = {
110
- ...this.state,
111
- ...pick(this.props, ['value'])
112
- };
113
- return {
114
- ...mappedState,
115
- ...this.parseValue(mappedState.value, mappedState.dateValue, mappedState.timeValue, mappedState.zoneValue)
116
- };
106
+ _defineProperty(this, "getParsedValues", () => this.parseValue(this.getValue(), this.state.dateValue, this.state.timeValue, this.state.zoneValue));
107
+ _defineProperty(this, "getValue", () => {
108
+ var _this$props$value;
109
+ return (_this$props$value = this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : this.state.value;
117
110
  });
118
111
  _defineProperty(this, "onBlur", event => {
119
112
  this.setState({
@@ -128,28 +121,44 @@ class DateTimePickerComponent extends React.Component {
128
121
  this.props.onFocus(event);
129
122
  });
130
123
  _defineProperty(this, "onDateChange", dateValue => {
124
+ const parsedValues = this.getParsedValues();
131
125
  this.onValueChange({
132
- ...this.getSafeState(),
133
- dateValue
126
+ dateValue,
127
+ timeValue: parsedValues.timeValue,
128
+ zoneValue: parsedValues.zoneValue
134
129
  });
135
130
  });
136
131
  _defineProperty(this, "onTimeChange", timeValue => {
132
+ const parsedValues = this.getParsedValues();
137
133
  this.onValueChange({
138
- ...this.getSafeState(),
139
- timeValue
134
+ dateValue: parsedValues.dateValue,
135
+ timeValue,
136
+ zoneValue: parsedValues.zoneValue
140
137
  });
141
138
  });
142
139
  _defineProperty(this, "onClear", () => {
140
+ const parsedValues = this.getParsedValues();
143
141
  this.onValueChange({
144
- ...this.getSafeState(),
142
+ dateValue: '',
145
143
  timeValue: '',
146
- dateValue: ''
144
+ zoneValue: parsedValues.zoneValue
147
145
  });
148
146
  });
149
147
  }
150
148
  parseValue(value, dateValue, timeValue, zoneValue) {
151
149
  if (this.props.parseValue) {
152
- return this.props.parseValue(value, dateValue, timeValue, zoneValue);
150
+ const parsedFromFn = this.props.parseValue(value, dateValue, timeValue, zoneValue);
151
+ // This handles cases found in Jira where the parse function actually does
152
+ // nothing and returns undefined. The previous `getSafeState` function
153
+ // just spread the values over the state, but if it returned `undefined`,
154
+ // it would just rely on the previous state values. Considering this is
155
+ // what is input to this function anyway, this is a safe way to handle
156
+ // this, colocate the behavior, and not rely on `getSafeState`.
157
+ return parsedFromFn || {
158
+ dateValue,
159
+ timeValue,
160
+ zoneValue
161
+ };
153
162
  }
154
163
  const parsed = parseISO(value);
155
164
  return isValid(parsed) ? {
@@ -183,7 +192,7 @@ class DateTimePickerComponent extends React.Component {
183
192
  });
184
193
  this.props.onChange(valueWithValidZone);
185
194
  // If the date or time value was cleared when there is an existing datetime value, then clear the value.
186
- } else if (this.getSafeState().value) {
195
+ } else if (this.getValue()) {
187
196
  this.setState({
188
197
  value: ''
189
198
  });
@@ -212,12 +221,13 @@ class DateTimePickerComponent extends React.Component {
212
221
  timePickerSelectProps,
213
222
  times
214
223
  } = this.props;
224
+ const value = this.getValue();
215
225
  const {
216
- isFocused,
217
- value,
218
- dateValue,
219
- timeValue
220
- } = this.getSafeState();
226
+ isFocused
227
+ } = this.state;
228
+ const parsedValues = this.getParsedValues();
229
+ const dateValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.dateValue;
230
+ const timeValue = parsedValues === null || parsedValues === void 0 ? void 0 : parsedValues.timeValue;
221
231
  const {
222
232
  styles: datePickerStyles = {}
223
233
  } = datePickerSelectProps;
@@ -254,41 +264,67 @@ class DateTimePickerComponent extends React.Component {
254
264
  "data-testid": testId && `${testId}--input`
255
265
  }), jsx("div", {
256
266
  css: datePickerContainerStyles
257
- }, jsx(DatePicker, _extends({
267
+ }, jsx(DatePicker, {
258
268
  appearance: appearance,
259
- autoFocus: autoFocus,
260
- dateFormat: dateFormat,
261
- hideIcon: true,
262
- id: id,
263
- isDisabled: isDisabled,
264
- isInvalid: isInvalid,
265
- locale: locale,
266
- onBlur: this.onBlur,
267
- onChange: this.onDateChange,
268
- onFocus: this.onFocus,
269
+ autoFocus: datePickerProps.autoFocus || autoFocus,
270
+ dateFormat: datePickerProps.dateFormat || dateFormat,
271
+ defaultIsOpen: datePickerProps.defaultIsOpen,
272
+ defaultValue: datePickerProps.defaultValue,
273
+ disabled: datePickerProps.disabled,
274
+ disabledDateFilter: datePickerProps.disabledDateFilter,
275
+ formatDisplayLabel: datePickerProps.formatDisplayLabel,
276
+ hideIcon: datePickerProps.hideIcon || true,
277
+ icon: datePickerProps.icon,
278
+ id: datePickerProps.id || id,
279
+ innerProps: datePickerProps.innerProps,
280
+ isDisabled: datePickerProps.isDisabled || isDisabled,
281
+ isInvalid: datePickerProps.isInvalid || isInvalid,
282
+ isOpen: datePickerProps.isOpen,
283
+ locale: datePickerProps.locale || locale,
284
+ maxDate: datePickerProps.maxDate,
285
+ minDate: datePickerProps.minDate,
286
+ name: datePickerProps.name,
287
+ nextMonthLabel: datePickerProps.nextMonthLabel,
288
+ onBlur: datePickerProps.onBlur || this.onBlur,
289
+ onChange: datePickerProps.onChange || this.onDateChange,
290
+ onFocus: datePickerProps.onFocus || this.onFocus,
291
+ parseInputValue: datePickerProps.parseInputValue,
292
+ placeholder: datePickerProps.placeholder,
293
+ previousMonthLabel: datePickerProps.previousMonthLabel,
269
294
  selectProps: mergedDatePickerSelectProps,
270
- spacing: spacing,
271
- testId: testId && `${testId}--datepicker`,
272
- value: dateValue
273
- }, datePickerProps))), jsx("div", {
295
+ spacing: datePickerProps.spacing || spacing,
296
+ testId: testId && `${testId}--datepicker` || datePickerProps.testId,
297
+ value: dateValue,
298
+ weekStartDay: datePickerProps.weekStartDay
299
+ })), jsx("div", {
274
300
  css: timePickerContainerStyles
275
- }, jsx(TimePicker, _extends({
276
- appearance: appearance,
277
- hideIcon: true,
278
- isDisabled: isDisabled,
279
- isInvalid: isInvalid,
280
- locale: locale,
281
- onBlur: this.onBlur,
282
- onChange: this.onTimeChange,
283
- onFocus: this.onFocus,
301
+ }, jsx(TimePicker, {
302
+ appearance: timePickerProps.appearance || appearance,
303
+ autoFocus: timePickerProps.autoFocus,
304
+ defaultIsOpen: timePickerProps.defaultIsOpen,
305
+ defaultValue: timePickerProps.defaultValue,
306
+ formatDisplayLabel: timePickerProps.formatDisplayLabel,
307
+ hideIcon: timePickerProps.hideIcon || true,
308
+ id: timePickerProps.id,
309
+ innerProps: timePickerProps.innerProps,
310
+ isDisabled: timePickerProps.isDisabled || isDisabled,
311
+ isInvalid: timePickerProps.isInvalid || isInvalid,
312
+ isOpen: timePickerProps.isOpen,
313
+ locale: timePickerProps.locale || locale,
314
+ name: timePickerProps.name,
315
+ onBlur: timePickerProps.onBlur || this.onBlur,
316
+ onChange: timePickerProps.onChange || this.onTimeChange,
317
+ onFocus: timePickerProps.onFocus || this.onFocus,
318
+ parseInputValue: timePickerProps.parseInputValue,
319
+ placeholder: timePickerProps.placeholder,
284
320
  selectProps: mergedTimePickerSelectProps,
285
- spacing: spacing,
286
- testId: testId && `${testId}--timepicker`,
287
- timeFormat: timeFormat,
288
- timeIsEditable: timeIsEditable,
289
- times: times,
321
+ spacing: timePickerProps.spacing || spacing,
322
+ testId: timePickerProps.testId || testId && `${testId}--timepicker`,
323
+ timeFormat: timePickerProps.timeFormat || timeFormat,
324
+ timeIsEditable: timePickerProps.timeIsEditable || timeIsEditable,
325
+ times: timePickerProps.times || times,
290
326
  value: timeValue
291
- }, timePickerProps))), isClearable && !isDisabled ? jsx("button", {
327
+ })), isClearable && !isDisabled ? jsx("button", {
292
328
  css: iconContainerStyles,
293
329
  onClick: this.onClear,
294
330
  "data-testid": testId && `${testId}--icon--container`,
@@ -4,7 +4,6 @@ import React from 'react';
4
4
 
5
5
  // eslint-disable-next-line no-restricted-imports
6
6
  import { format, isValid } from 'date-fns';
7
- import pick from 'lodash/pick';
8
7
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
9
8
  import { createLocalizationProvider } from '@atlaskit/locale';
10
9
  import Select, { CreatableSelect, mergeStyles } from '@atlaskit/select';
@@ -16,7 +15,7 @@ import parseTime from '../internal/parse-time';
16
15
  import { convertTokens } from '../internal/parse-tokens';
17
16
  import { makeSingleValue } from '../internal/single-value';
18
17
  const packageName = "@atlaskit/datetime-picker";
19
- const packageVersion = "13.11.1";
18
+ const packageVersion = "13.11.3";
20
19
  const menuStyles = {
21
20
  /* Need to remove default absolute positioning as that causes issues with position fixed */
22
21
  position: 'static',
@@ -65,11 +64,13 @@ class TimePickerComponent extends React.Component {
65
64
  });
66
65
  // All state needs to be accessed via this function so that the state is mapped from props
67
66
  // correctly to allow controlled/uncontrolled usage.
68
- _defineProperty(this, "getSafeState", () => {
69
- return {
70
- ...this.state,
71
- ...pick(this.props, ['value', 'isOpen'])
72
- };
67
+ _defineProperty(this, "getValue", () => {
68
+ var _this$props$value;
69
+ return (_this$props$value = this.props.value) !== null && _this$props$value !== void 0 ? _this$props$value : this.state.value;
70
+ });
71
+ _defineProperty(this, "getIsOpen", () => {
72
+ var _this$props$isOpen;
73
+ return (_this$props$isOpen = this.props.isOpen) !== null && _this$props$isOpen !== void 0 ? _this$props$isOpen : this.state.isOpen;
73
74
  });
74
75
  _defineProperty(this, "onChange", (newValue, action) => {
75
76
  const rawValue = newValue ? newValue.value || newValue : '';
@@ -114,7 +115,7 @@ class TimePickerComponent extends React.Component {
114
115
  });
115
116
  _defineProperty(this, "onMenuOpen", () => {
116
117
  // Don't open menu after the user has clicked clear
117
- if (this.getSafeState().clearingFromIcon) {
118
+ if (this.state.clearingFromIcon) {
118
119
  this.setState({
119
120
  clearingFromIcon: false
120
121
  });
@@ -126,7 +127,7 @@ class TimePickerComponent extends React.Component {
126
127
  });
127
128
  _defineProperty(this, "onMenuClose", () => {
128
129
  // Don't close menu after the user has clicked clear
129
- if (this.getSafeState().clearingFromIcon) {
130
+ if (this.state.clearingFromIcon) {
130
131
  this.setState({
131
132
  clearingFromIcon: false
132
133
  });
@@ -162,7 +163,7 @@ class TimePickerComponent extends React.Component {
162
163
  key
163
164
  } = event;
164
165
  const keyPressed = key.toLowerCase();
165
- if (this.getSafeState().clearingFromIcon && (keyPressed === 'backspace' || keyPressed === 'delete')) {
166
+ if (this.state.clearingFromIcon && (keyPressed === 'backspace' || keyPressed === 'delete')) {
166
167
  // If being cleared from keyboard, don't change behaviour
167
168
  this.setState({
168
169
  clearingFromIcon: false
@@ -194,10 +195,8 @@ class TimePickerComponent extends React.Component {
194
195
  } = this.props;
195
196
  const ICON_PADDING = 2;
196
197
  const l10n = createLocalizationProvider(locale);
197
- const {
198
- value = '',
199
- isOpen
200
- } = this.getSafeState();
198
+ const value = this.getValue() || '';
199
+ const isOpen = this.getIsOpen();
201
200
  const {
202
201
  styles: selectStyles = {},
203
202
  ...otherSelectProps
@@ -297,9 +296,7 @@ class TimePickerComponent extends React.Component {
297
296
  placeholder: placeholder || l10n.formatTime(placeholderDatetime),
298
297
  styles: mergedStyles,
299
298
  value: initialValue,
300
- spacing: spacing
301
- // @ts-ignore caused by prop not part of @atlaskit/select
302
- ,
299
+ spacing: spacing,
303
300
  fixedLayerRef: this.containerRef,
304
301
  isInvalid: isInvalid,
305
302
  testId: testId
@@ -12,13 +12,59 @@ import FixedLayer from '../internal/fixed-layer';
12
12
  * This is the fixed layer menu used in the time picker.
13
13
  */
14
14
  export const FixedLayerMenu = ({
15
+ className,
16
+ clearValue,
17
+ cx,
18
+ getStyles,
19
+ getValue,
20
+ hasValue,
21
+ innerProps,
22
+ innerRef,
23
+ isLoading,
24
+ isMulti,
25
+ isRtl,
26
+ maxMenuHeight,
27
+ menuPlacement,
28
+ menuPosition,
29
+ menuShouldScrollIntoView,
30
+ minMenuHeight,
31
+ options,
32
+ placement,
33
+ selectOption,
15
34
  selectProps,
35
+ setValue,
36
+ theme,
37
+ children,
16
38
  ...rest
17
39
  }) => jsx(FixedLayer, {
18
40
  inputValue: selectProps.inputValue,
19
41
  containerRef: selectProps.fixedLayerRef,
20
42
  content: jsx(components.Menu, _extends({}, rest, {
21
- menuShouldScrollIntoView: false
22
- })),
43
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
44
+ className: className,
45
+ clearValue: clearValue,
46
+ cx: cx,
47
+ getStyles: getStyles,
48
+ getValue: getValue,
49
+ hasValue: hasValue,
50
+ innerProps: innerProps,
51
+ innerRef: innerRef,
52
+ isLoading: isLoading,
53
+ isMulti: isMulti,
54
+ isRtl: isRtl,
55
+ maxMenuHeight: maxMenuHeight,
56
+ menuPlacement: menuPlacement,
57
+ menuPosition: menuPosition,
58
+ menuShouldScrollIntoView: false || menuShouldScrollIntoView,
59
+ minMenuHeight: minMenuHeight,
60
+ options: options,
61
+ placement: placement,
62
+ selectOption: selectOption,
63
+ selectProps: selectProps,
64
+ setValue: setValue
65
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides, @atlaskit/design-system/no-unsafe-style-overrides
66
+ ,
67
+ theme: theme
68
+ }), children),
23
69
  testId: selectProps.testId
24
70
  });