@atlaskit/datetime-picker 12.3.2 → 12.3.4

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/datetime-picker
2
2
 
3
+ ## 12.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 12.3.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`cb8f8e76d25`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb8f8e76d25) - Update types for react-select and @atlaskit/select upgrade
14
+ Update commerce-ui entrypoints that caused a pipeline issue.
15
+ - Updated dependencies
16
+
3
17
  ## 12.3.2
4
18
 
5
19
  ### Patch Changes
@@ -68,7 +68,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
68
68
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
69
69
 
70
70
  var packageName = "@atlaskit/datetime-picker";
71
- var packageVersion = "12.3.2";
71
+ var packageVersion = "12.3.4";
72
72
  /* eslint-disable react/no-unused-prop-types */
73
73
 
74
74
  function getDateObj(date) {
@@ -506,14 +506,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
506
506
  var menuIsOpen = isOpen && !isDisabled;
507
507
  var showClearIndicator = Boolean((value || inputValue) && !hideIcon);
508
508
  var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
509
- var selectComponents = {
509
+
510
+ var selectComponents = _objectSpread({
510
511
  DropdownIndicator: dropDownIcon,
511
512
  Menu: Menu
512
- };
513
-
514
- if (!showClearIndicator) {
515
- selectComponents.ClearIndicator = _internal.EmptyClearIndicator;
516
- }
513
+ }, !showClearIndicator && {
514
+ ClearIndicator: _internal.EmptyComponent
515
+ });
517
516
 
518
517
  var _selectProps$styles = selectProps.styles,
519
518
  selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles;
@@ -58,7 +58,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
58
58
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
59
59
 
60
60
  var packageName = "@atlaskit/datetime-picker";
61
- var packageVersion = "12.3.2";
61
+ var packageVersion = "12.3.4";
62
62
  /* eslint-disable react/no-unused-prop-types */
63
63
 
64
64
  var isInvalidBorderStyles = (0, _react2.css)({
@@ -65,7 +65,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
65
65
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
66
66
 
67
67
  var packageName = "@atlaskit/datetime-picker";
68
- var packageVersion = "12.3.2";
68
+ var packageVersion = "12.3.4";
69
69
  var menuStyles = {
70
70
  /* Need to remove default absolute positioning as that causes issues with position fixed */
71
71
  position: 'static',
@@ -142,8 +142,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
142
142
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeState", function () {
143
143
  return _objectSpread(_objectSpread({}, _this.state), (0, _pick.default)(_this.props, ['value', 'isOpen']));
144
144
  });
145
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onChange", function (v, action) {
146
- var value = v ? v.value : '';
145
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onChange", function (newValue, action) {
146
+ var rawValue = newValue ? newValue.value || newValue : '';
147
+ var value = rawValue.toString();
147
148
  var changedState = {
148
149
  value: value
149
150
  };
@@ -321,7 +322,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
321
322
  selectProps = _this$props3.selectProps,
322
323
  spacing = _this$props3.spacing,
323
324
  testId = _this$props3.testId,
324
- isInvalid = _this$props3.isInvalid;
325
+ isInvalid = _this$props3.isInvalid,
326
+ timeIsEditable = _this$props3.timeIsEditable;
325
327
  var ICON_PADDING = 2;
326
328
 
327
329
  var _this$getSafeState3 = this.getSafeState(),
@@ -332,19 +334,18 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
332
334
  var _selectProps$styles = selectProps.styles,
333
335
  selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles,
334
336
  otherSelectProps = (0, _objectWithoutProperties2.default)(selectProps, _excluded2);
335
- var SelectComponent = this.props.timeIsEditable ? _select.CreatableSelect : _select.default;
337
+ var SelectComponent = timeIsEditable ? _select.CreatableSelect : _select.default;
336
338
  var labelAndValue = value && {
337
339
  label: this.formatTime(value),
338
340
  value: value
339
341
  };
340
- var selectComponents = {
341
- DropdownIndicator: _internal.DropdownIndicator,
342
- Menu: FixedLayerMenu
343
- };
344
342
 
345
- if (hideIcon) {
346
- selectComponents.ClearIndicator = _internal.EmptyClearIndicator;
347
- }
343
+ var selectComponents = _objectSpread({
344
+ DropdownIndicator: _internal.EmptyComponent,
345
+ Menu: FixedLayerMenu
346
+ }, hideIcon && {
347
+ ClearIndicator: _internal.EmptyComponent
348
+ });
348
349
 
349
350
  var renderIconContainer = Boolean(!hideIcon && value);
350
351
  var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
@@ -397,7 +398,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
397
398
  placeholder: this.getPlaceholder(),
398
399
  styles: mergedStyles,
399
400
  value: labelAndValue,
400
- spacing: spacing,
401
+ spacing: spacing // @ts-ignore caused by prop not part of @atlaskit/select
402
+ ,
401
403
  fixedLayerRef: this.containerRef,
402
404
  isInvalid: isInvalid,
403
405
  testId: testId
@@ -1,22 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.defaultTimes = exports.defaultTimeFormat = exports.defaultDateFormat = exports.EmptyClearIndicator = exports.DropdownIndicator = void 0;
6
+ exports.defaultTimes = exports.defaultTimeFormat = exports.defaultDateFormat = exports.EmptyComponent = void 0;
9
7
  exports.formatDateTimeZoneIntoIso = formatDateTimeZoneIntoIso;
10
8
  exports.padToTwo = padToTwo;
11
9
  exports.placeholderDatetime = void 0;
12
10
 
13
- var _react = _interopRequireDefault(require("react"));
14
-
15
11
  /* eslint-disable @repo/internal/react/require-jsdoc */
16
- var EmptyClearIndicator = null; // This date was chosen to clearly show date and time formats (day > 12)
12
+ var EmptyComponent = function EmptyComponent() {
13
+ return null;
14
+ }; // This date was chosen to clearly show date and time formats (day > 12)
17
15
  // e.g. 18/02/1993 vs. 2/18/1993 and 1:00 PM vs 13:00
18
16
 
19
- exports.EmptyClearIndicator = EmptyClearIndicator;
17
+
18
+ exports.EmptyComponent = EmptyComponent;
20
19
  var placeholderDatetime = new Date(1993, 1, 18, 13);
21
20
  exports.placeholderDatetime = placeholderDatetime;
22
21
  var defaultTimes = ['09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00'];
@@ -30,15 +29,6 @@ function padToTwo(number) {
30
29
  return number <= 99 ? "0".concat(number).slice(-2) : "".concat(number);
31
30
  }
32
31
 
33
- var DropdownIndicator = function DropdownIndicator(props) {
34
- // Wanted to use React.Component<{}> but that was having issues
35
- // https://github.com/basarat/typescript-book/blob/master/docs/jsx/react.md#react-jsx-tip-accept-a-component-that-can-act-on-props-and-be-rendered-using-jsx
36
- var Icon = props.selectProps.dropdownIndicatorIcon;
37
- return Icon ? /*#__PURE__*/_react.default.createElement(Icon, null) : null;
38
- };
39
-
40
- exports.DropdownIndicator = DropdownIndicator;
41
-
42
32
  function formatDateTimeZoneIntoIso(date, time, zone) {
43
33
  // 12:00 => 12:00, 1:00 => 01:00
44
34
  var needsLeadingZero = /^\d:/;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.2",
3
+ "version": "12.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -16,11 +16,11 @@ import { createLocalizationProvider } from '@atlaskit/locale';
16
16
  import Select, { mergeStyles } from '@atlaskit/select';
17
17
  import { N20, N50A, N60A } from '@atlaskit/theme/colors';
18
18
  import { borderRadius, gridSize, layers } from '@atlaskit/theme/constants';
19
- import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime } from '../internal';
19
+ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from '../internal';
20
20
  import FixedLayer from '../internal/fixed-layer';
21
21
  import { convertTokens } from './utils';
22
22
  const packageName = "@atlaskit/datetime-picker";
23
- const packageVersion = "12.3.2";
23
+ const packageVersion = "12.3.4";
24
24
  /* eslint-disable react/no-unused-prop-types */
25
25
 
26
26
  function getDateObj(date) {
@@ -461,13 +461,11 @@ class DatePicker extends Component {
461
461
  const dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
462
462
  const selectComponents = {
463
463
  DropdownIndicator: dropDownIcon,
464
- Menu
464
+ Menu,
465
+ ...(!showClearIndicator && {
466
+ ClearIndicator: EmptyComponent
467
+ })
465
468
  };
466
-
467
- if (!showClearIndicator) {
468
- selectComponents.ClearIndicator = EmptyClearIndicator;
469
- }
470
-
471
469
  const {
472
470
  styles: selectStyles = {}
473
471
  } = selectProps;
@@ -19,7 +19,7 @@ import DatePicker from './date-picker';
19
19
  import TimePicker from './time-picker';
20
20
  import { convertTokens } from './utils';
21
21
  const packageName = "@atlaskit/datetime-picker";
22
- const packageVersion = "12.3.2";
22
+ const packageVersion = "12.3.4";
23
23
  /* eslint-disable react/no-unused-prop-types */
24
24
 
25
25
  const isInvalidBorderStyles = css({
@@ -10,12 +10,12 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
10
10
  import { createLocalizationProvider } from '@atlaskit/locale';
11
11
  import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
12
12
  import { gridSize } from '@atlaskit/theme/constants';
13
- import { defaultTimeFormat, defaultTimes, DropdownIndicator, EmptyClearIndicator, placeholderDatetime } from '../internal';
13
+ import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
14
14
  import FixedLayer from '../internal/fixed-layer';
15
15
  import parseTime from '../internal/parse-time';
16
16
  import { convertTokens } from './utils';
17
17
  const packageName = "@atlaskit/datetime-picker";
18
- const packageVersion = "12.3.2";
18
+ const packageVersion = "12.3.4";
19
19
  const menuStyles = {
20
20
  /* Need to remove default absolute positioning as that causes issues with position fixed */
21
21
  position: 'static',
@@ -83,8 +83,9 @@ class TimePicker extends React.Component {
83
83
  };
84
84
  });
85
85
 
86
- _defineProperty(this, "onChange", (v, action) => {
87
- const value = v ? v.value : '';
86
+ _defineProperty(this, "onChange", (newValue, action) => {
87
+ const rawValue = newValue ? newValue.value || newValue : '';
88
+ const value = rawValue.toString();
88
89
  let changedState = {
89
90
  value
90
91
  };
@@ -263,7 +264,8 @@ class TimePicker extends React.Component {
263
264
  selectProps,
264
265
  spacing,
265
266
  testId,
266
- isInvalid
267
+ isInvalid,
268
+ timeIsEditable
267
269
  } = this.props;
268
270
  const ICON_PADDING = 2;
269
271
  const {
@@ -274,20 +276,18 @@ class TimePicker extends React.Component {
274
276
  styles: selectStyles = {},
275
277
  ...otherSelectProps
276
278
  } = selectProps;
277
- const SelectComponent = this.props.timeIsEditable ? CreatableSelect : Select;
279
+ const SelectComponent = timeIsEditable ? CreatableSelect : Select;
278
280
  const labelAndValue = value && {
279
281
  label: this.formatTime(value),
280
282
  value
281
283
  };
282
284
  const selectComponents = {
283
- DropdownIndicator,
284
- Menu: FixedLayerMenu
285
+ DropdownIndicator: EmptyComponent,
286
+ Menu: FixedLayerMenu,
287
+ ...(hideIcon && {
288
+ ClearIndicator: EmptyComponent
289
+ })
285
290
  };
286
-
287
- if (hideIcon) {
288
- selectComponents.ClearIndicator = EmptyClearIndicator;
289
- }
290
-
291
291
  const renderIconContainer = Boolean(!hideIcon && value);
292
292
  const mergedStyles = mergeStyles(selectStyles, {
293
293
  control: base => ({ ...base
@@ -335,7 +335,8 @@ class TimePicker extends React.Component {
335
335
  placeholder: this.getPlaceholder(),
336
336
  styles: mergedStyles,
337
337
  value: labelAndValue,
338
- spacing: spacing,
338
+ spacing: spacing // @ts-ignore caused by prop not part of @atlaskit/select
339
+ ,
339
340
  fixedLayerRef: this.containerRef,
340
341
  isInvalid: isInvalid,
341
342
  testId: testId
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable @repo/internal/react/require-jsdoc */
2
- import React from 'react';
3
- export const EmptyClearIndicator = null; // This date was chosen to clearly show date and time formats (day > 12)
2
+ export const EmptyComponent = () => null; // This date was chosen to clearly show date and time formats (day > 12)
4
3
  // e.g. 18/02/1993 vs. 2/18/1993 and 1:00 PM vs 13:00
5
4
 
6
5
  export const placeholderDatetime = new Date(1993, 1, 18, 13);
@@ -10,12 +9,6 @@ export const defaultDateFormat = 'YYYY/MM/DD';
10
9
  export function padToTwo(number) {
11
10
  return number <= 99 ? `0${number}`.slice(-2) : `${number}`;
12
11
  }
13
- export const DropdownIndicator = props => {
14
- // Wanted to use React.Component<{}> but that was having issues
15
- // https://github.com/basarat/typescript-book/blob/master/docs/jsx/react.md#react-jsx-tip-accept-a-component-that-can-act-on-props-and-be-rendered-using-jsx
16
- const Icon = props.selectProps.dropdownIndicatorIcon;
17
- return Icon ? /*#__PURE__*/React.createElement(Icon, null) : null;
18
- };
19
12
  export function formatDateTimeZoneIntoIso(date, time, zone) {
20
13
  // 12:00 => 12:00, 1:00 => 01:00
21
14
  const needsLeadingZero = /^\d:/;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.2",
3
+ "version": "12.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -31,11 +31,11 @@ import { createLocalizationProvider } from '@atlaskit/locale';
31
31
  import Select, { mergeStyles } from '@atlaskit/select';
32
32
  import { N20, N50A, N60A } from '@atlaskit/theme/colors';
33
33
  import { borderRadius, gridSize, layers } from '@atlaskit/theme/constants';
34
- import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime } from '../internal';
34
+ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from '../internal';
35
35
  import FixedLayer from '../internal/fixed-layer';
36
36
  import { convertTokens } from './utils';
37
37
  var packageName = "@atlaskit/datetime-picker";
38
- var packageVersion = "12.3.2";
38
+ var packageVersion = "12.3.4";
39
39
  /* eslint-disable react/no-unused-prop-types */
40
40
 
41
41
  function getDateObj(date) {
@@ -493,14 +493,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
493
493
  var menuIsOpen = isOpen && !isDisabled;
494
494
  var showClearIndicator = Boolean((value || inputValue) && !hideIcon);
495
495
  var dropDownIcon = appearance === 'subtle' || hideIcon || showClearIndicator ? null : icon;
496
- var selectComponents = {
496
+
497
+ var selectComponents = _objectSpread({
497
498
  DropdownIndicator: dropDownIcon,
498
499
  Menu: Menu
499
- };
500
-
501
- if (!showClearIndicator) {
502
- selectComponents.ClearIndicator = EmptyClearIndicator;
503
- }
500
+ }, !showClearIndicator && {
501
+ ClearIndicator: EmptyComponent
502
+ });
504
503
 
505
504
  var _selectProps$styles = selectProps.styles,
506
505
  selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles;
@@ -33,7 +33,7 @@ import DatePicker from './date-picker';
33
33
  import TimePicker from './time-picker';
34
34
  import { convertTokens } from './utils';
35
35
  var packageName = "@atlaskit/datetime-picker";
36
- var packageVersion = "12.3.2";
36
+ var packageVersion = "12.3.4";
37
37
  /* eslint-disable react/no-unused-prop-types */
38
38
 
39
39
  var isInvalidBorderStyles = css({
@@ -27,12 +27,12 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
27
27
  import { createLocalizationProvider } from '@atlaskit/locale';
28
28
  import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
29
29
  import { gridSize } from '@atlaskit/theme/constants';
30
- import { defaultTimeFormat, defaultTimes, DropdownIndicator, EmptyClearIndicator, placeholderDatetime } from '../internal';
30
+ import { defaultTimeFormat, defaultTimes, EmptyComponent, placeholderDatetime } from '../internal';
31
31
  import FixedLayer from '../internal/fixed-layer';
32
32
  import parseTime from '../internal/parse-time';
33
33
  import { convertTokens } from './utils';
34
34
  var packageName = "@atlaskit/datetime-picker";
35
- var packageVersion = "12.3.2";
35
+ var packageVersion = "12.3.4";
36
36
  var menuStyles = {
37
37
  /* Need to remove default absolute positioning as that causes issues with position fixed */
38
38
  position: 'static',
@@ -114,8 +114,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
114
114
  return _objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value', 'isOpen']));
115
115
  });
116
116
 
117
- _defineProperty(_assertThisInitialized(_this), "onChange", function (v, action) {
118
- var value = v ? v.value : '';
117
+ _defineProperty(_assertThisInitialized(_this), "onChange", function (newValue, action) {
118
+ var rawValue = newValue ? newValue.value || newValue : '';
119
+ var value = rawValue.toString();
119
120
  var changedState = {
120
121
  value: value
121
122
  };
@@ -303,7 +304,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
303
304
  selectProps = _this$props3.selectProps,
304
305
  spacing = _this$props3.spacing,
305
306
  testId = _this$props3.testId,
306
- isInvalid = _this$props3.isInvalid;
307
+ isInvalid = _this$props3.isInvalid,
308
+ timeIsEditable = _this$props3.timeIsEditable;
307
309
  var ICON_PADDING = 2;
308
310
 
309
311
  var _this$getSafeState3 = this.getSafeState(),
@@ -315,19 +317,18 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
315
317
  selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles,
316
318
  otherSelectProps = _objectWithoutProperties(selectProps, _excluded2);
317
319
 
318
- var SelectComponent = this.props.timeIsEditable ? CreatableSelect : Select;
320
+ var SelectComponent = timeIsEditable ? CreatableSelect : Select;
319
321
  var labelAndValue = value && {
320
322
  label: this.formatTime(value),
321
323
  value: value
322
324
  };
323
- var selectComponents = {
324
- DropdownIndicator: DropdownIndicator,
325
- Menu: FixedLayerMenu
326
- };
327
325
 
328
- if (hideIcon) {
329
- selectComponents.ClearIndicator = EmptyClearIndicator;
330
- }
326
+ var selectComponents = _objectSpread({
327
+ DropdownIndicator: EmptyComponent,
328
+ Menu: FixedLayerMenu
329
+ }, hideIcon && {
330
+ ClearIndicator: EmptyComponent
331
+ });
331
332
 
332
333
  var renderIconContainer = Boolean(!hideIcon && value);
333
334
  var mergedStyles = mergeStyles(selectStyles, {
@@ -380,7 +381,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
380
381
  placeholder: this.getPlaceholder(),
381
382
  styles: mergedStyles,
382
383
  value: labelAndValue,
383
- spacing: spacing,
384
+ spacing: spacing // @ts-ignore caused by prop not part of @atlaskit/select
385
+ ,
384
386
  fixedLayerRef: this.containerRef,
385
387
  isInvalid: isInvalid,
386
388
  testId: testId
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @repo/internal/react/require-jsdoc */
2
- import React from 'react';
3
- export var EmptyClearIndicator = null; // This date was chosen to clearly show date and time formats (day > 12)
2
+ export var EmptyComponent = function EmptyComponent() {
3
+ return null;
4
+ }; // This date was chosen to clearly show date and time formats (day > 12)
4
5
  // e.g. 18/02/1993 vs. 2/18/1993 and 1:00 PM vs 13:00
5
6
 
6
7
  export var placeholderDatetime = new Date(1993, 1, 18, 13);
@@ -10,12 +11,6 @@ export var defaultDateFormat = 'YYYY/MM/DD';
10
11
  export function padToTwo(number) {
11
12
  return number <= 99 ? "0".concat(number).slice(-2) : "".concat(number);
12
13
  }
13
- export var DropdownIndicator = function DropdownIndicator(props) {
14
- // Wanted to use React.Component<{}> but that was having issues
15
- // https://github.com/basarat/typescript-book/blob/master/docs/jsx/react.md#react-jsx-tip-accept-a-component-that-can-act-on-props-and-be-rendered-using-jsx
16
- var Icon = props.selectProps.dropdownIndicatorIcon;
17
- return Icon ? /*#__PURE__*/React.createElement(Icon, null) : null;
18
- };
19
14
  export function formatDateTimeZoneIntoIso(date, time, zone) {
20
15
  // 12:00 => 12:00, 1:00 => 01:00
21
16
  var needsLeadingZero = /^\d:/;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.2",
3
+ "version": "12.3.4",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import { jsx } from '@emotion/react';
4
4
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
5
5
  import { CalendarRef } from '@atlaskit/calendar';
6
6
  import { LocalizationProvider } from '@atlaskit/locale';
7
- import { ActionMeta, IndicatorComponentType, IndicatorProps, OptionType, ValueType } from '@atlaskit/select';
7
+ import { ActionMeta, DropdownIndicatorProps, OptionType, ValueType } from '@atlaskit/select';
8
8
  import { Appearance, SelectProps, Spacing } from '../types';
9
9
  export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
10
10
  /**
@@ -48,7 +48,7 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps {
48
48
  /**
49
49
  * The icon shown in the picker.
50
50
  */
51
- icon?: IndicatorComponentType<OptionType>;
51
+ icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
52
52
  /**
53
53
  * The id of the field. Currently, react-select transforms this to have a `react-select-` prefix, and an `--input` suffix when applied to the input. For example, the id `my-input` would be transformed to `react-select-my-input--input`.
54
54
  *
@@ -179,7 +179,7 @@ declare const datePickerDefaultProps: {
179
179
  disabled: string[];
180
180
  disabledDateFilter: (_: string) => boolean;
181
181
  hideIcon: boolean;
182
- icon: import("react").ComponentType<IndicatorProps<OptionType, false>>;
182
+ icon: import("react").ComponentType<DropdownIndicatorProps<OptionType, boolean, import("@atlaskit/select").GroupType<OptionType>>>;
183
183
  id: string;
184
184
  innerProps: {};
185
185
  isDisabled: boolean;
@@ -201,7 +201,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
201
201
  disabled: string[];
202
202
  disabledDateFilter: (_: string) => boolean;
203
203
  hideIcon: boolean;
204
- icon: import("react").ComponentType<IndicatorProps<OptionType, false>>;
204
+ icon: import("react").ComponentType<DropdownIndicatorProps<OptionType, boolean, import("@atlaskit/select").GroupType<OptionType>>>;
205
205
  id: string;
206
206
  innerProps: {};
207
207
  isDisabled: boolean;
@@ -272,7 +272,7 @@ declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit
272
272
  disabled: string[];
273
273
  disabledDateFilter: (_: string) => boolean;
274
274
  hideIcon: boolean;
275
- icon: import("react").ComponentType<IndicatorProps<OptionType, false>>;
275
+ icon: import("react").ComponentType<DropdownIndicatorProps<OptionType, boolean, import("@atlaskit/select").GroupType<OptionType>>>;
276
276
  id: string;
277
277
  innerProps: {};
278
278
  isDisabled: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
3
  import { LocalizationProvider } from '@atlaskit/locale';
4
- import { ActionMeta, OptionType, SelectProps } from '@atlaskit/select';
4
+ import { ActionMeta, OptionType, SelectProps, ValueType } from '@atlaskit/select';
5
5
  import { Appearance, Spacing } from '../types';
6
6
  interface Option {
7
7
  label: string;
@@ -179,13 +179,11 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
179
179
  UNSAFE_componentWillReceiveProps(nextProps: TimePickerProps): void;
180
180
  getSafeState: () => State;
181
181
  getOptions(): Array<Option>;
182
- onChange: (v: {
183
- value: string;
184
- } | null, action?: ActionMeta<OptionType> | undefined) => void;
182
+ onChange: (newValue: ValueType<OptionType> | string, action?: ActionMeta<OptionType> | undefined) => void;
185
183
  /**
186
184
  * Only allow custom times if timeIsEditable prop is true
187
185
  */
188
- onCreateOption: (inputValue: any) => void;
186
+ onCreateOption: (inputValue: string) => void;
189
187
  onMenuOpen: () => void;
190
188
  onMenuClose: () => void;
191
189
  setContainerRef: (ref: HTMLElement | null) => void;
@@ -1,10 +1,7 @@
1
- /// <reference types="react" />
2
- import { IndicatorProps } from '@atlaskit/select';
3
- export declare const EmptyClearIndicator: null;
1
+ export declare const EmptyComponent: () => null;
4
2
  export declare const placeholderDatetime: Date;
5
3
  export declare const defaultTimes: string[];
6
4
  export declare const defaultTimeFormat = "h:mma";
7
5
  export declare const defaultDateFormat = "YYYY/MM/DD";
8
6
  export declare function padToTwo(number: number): string;
9
- export declare const DropdownIndicator: (props: IndicatorProps<any>) => JSX.Element | null;
10
7
  export declare function formatDateTimeZoneIntoIso(date: string, time: string, zone: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.2",
3
+ "version": "12.3.4",
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/"
@@ -30,10 +30,10 @@
30
30
  "@atlaskit/ds-lib": "^2.1.0",
31
31
  "@atlaskit/icon": "^21.11.0",
32
32
  "@atlaskit/locale": "^2.1.0",
33
- "@atlaskit/popper": "^5.2.0",
34
- "@atlaskit/select": "^15.7.0",
33
+ "@atlaskit/popper": "^5.4.0",
34
+ "@atlaskit/select": "^16.0.0",
35
35
  "@atlaskit/theme": "^12.2.0",
36
- "@atlaskit/tokens": "^0.11.0",
36
+ "@atlaskit/tokens": "^0.12.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "@emotion/react": "^11.7.1",
39
39
  "date-fns": "^2.17.0",
@@ -44,10 +44,10 @@
44
44
  "react": "^16.8.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@atlaskit/button": "^16.4.0",
47
+ "@atlaskit/button": "^16.5.0",
48
48
  "@atlaskit/docs": "*",
49
49
  "@atlaskit/field-base": "^15.0.5",
50
- "@atlaskit/form": "^8.7.0",
50
+ "@atlaskit/form": "^8.8.0",
51
51
  "@atlaskit/modal-dialog": "^12.4.0",
52
52
  "@atlaskit/popup": "^1.5.0",
53
53
  "@atlaskit/range": "^7.0.0",
@@ -60,8 +60,8 @@
60
60
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
61
61
  "@emotion/react": "^11.7.1",
62
62
  "@testing-library/react": "^12.1.5",
63
- "enzyme": "^3.10.0",
64
- "enzyme-to-json": "^3.3.0",
63
+ "@testing-library/user-event": "^14.4.3",
64
+ "@types/testing-library__jest-dom": "^5.14.5",
65
65
  "moment": "^2.29.2",
66
66
  "react-dom": "^16.8.0",
67
67
  "react-lorem-component": "^0.13.0",
package/report.api.md CHANGED
@@ -1,19 +1,24 @@
1
+ <!-- API Report Version: 2.2 -->
2
+
1
3
  ## API Report File for "@atlaskit/datetime-picker"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
9
+
10
+ - [Main Entry Types](#main-entry-types)
4
11
 
5
- <!--
6
- Generated API Report version: 2.0
7
- -->
12
+ ### Main Entry Types
8
13
 
9
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
14
+ <!--SECTION START: Main Entry Types-->
10
15
 
11
16
  ```ts
12
17
  import { ComponentType } from 'react';
18
+ import { DropdownIndicatorProps } from '@atlaskit/select';
13
19
  import { FocusEvent as FocusEvent_2 } from 'react';
14
20
  import { ForwardRefExoticComponent } from 'react';
15
- import { IndicatorComponentType } from '@atlaskit/select';
16
- import { IndicatorProps } from '@atlaskit/select';
21
+ import { GroupType } from '@atlaskit/select';
17
22
  import { OptionType } from '@atlaskit/select';
18
23
  import { default as React_2 } from 'react';
19
24
  import { RefAttributes } from 'react';
@@ -22,48 +27,48 @@ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
22
27
  import { WithContextProps } from '@atlaskit/analytics-next';
23
28
 
24
29
  // @public (undocumented)
25
- export type Appearance = 'default' | 'subtle' | 'none';
30
+ export type Appearance = 'default' | 'none' | 'subtle';
26
31
 
27
32
  // @public (undocumented)
28
33
  export const DatePicker: ForwardRefExoticComponent<
29
34
  Pick<
30
35
  Pick<
31
36
  Omit<DatePickerProps_2, keyof WithAnalyticsEventsProps>,
32
- | 'testId'
37
+ | 'dateFormat'
38
+ | 'formatDisplayLabel'
39
+ | 'isOpen'
33
40
  | 'maxDate'
34
41
  | 'minDate'
35
- | 'isOpen'
36
42
  | 'nextMonthLabel'
37
43
  | 'parseInputValue'
38
- | 'formatDisplayLabel'
44
+ | 'placeholder'
39
45
  | 'previousMonthLabel'
46
+ | 'testId'
40
47
  | 'value'
41
- | 'dateFormat'
42
- | 'placeholder'
43
48
  | 'weekStartDay'
44
49
  > &
45
50
  Partial<
46
51
  Pick<
47
52
  Omit<DatePickerProps_2, keyof WithAnalyticsEventsProps>,
48
- | 'icon'
49
- | 'disabled'
50
53
  | 'appearance'
51
- | 'selectProps'
52
- | 'innerProps'
53
54
  | 'autoFocus'
54
55
  | 'defaultIsOpen'
55
56
  | 'defaultValue'
57
+ | 'disabled'
56
58
  | 'disabledDateFilter'
57
59
  | 'hideIcon'
60
+ | 'icon'
58
61
  | 'id'
62
+ | 'innerProps'
59
63
  | 'isDisabled'
60
64
  | 'isInvalid'
65
+ | 'locale'
61
66
  | 'name'
62
67
  | 'onBlur'
63
68
  | 'onChange'
64
69
  | 'onFocus'
70
+ | 'selectProps'
65
71
  | 'spacing'
66
- | 'locale'
67
72
  >
68
73
  > &
69
74
  Partial<
@@ -76,7 +81,9 @@ export const DatePicker: ForwardRefExoticComponent<
76
81
  disabled: string[];
77
82
  disabledDateFilter: (_: string) => boolean;
78
83
  hideIcon: boolean;
79
- icon: ComponentType<IndicatorProps<OptionType, false>>;
84
+ icon: ComponentType<
85
+ DropdownIndicatorProps<OptionType, boolean, GroupType<OptionType>>
86
+ >;
80
87
  id: string;
81
88
  innerProps: {};
82
89
  isDisabled: boolean;
@@ -94,39 +101,39 @@ export const DatePicker: ForwardRefExoticComponent<
94
101
  > &
95
102
  RefAttributes<any> &
96
103
  WithContextProps,
97
- | 'testId'
98
- | 'icon'
99
- | 'disabled'
104
+ | 'analyticsContext'
100
105
  | 'appearance'
101
- | 'selectProps'
102
- | 'innerProps'
103
106
  | 'autoFocus'
107
+ | 'dateFormat'
104
108
  | 'defaultIsOpen'
105
109
  | 'defaultValue'
110
+ | 'disabled'
106
111
  | 'disabledDateFilter'
112
+ | 'formatDisplayLabel'
107
113
  | 'hideIcon'
114
+ | 'icon'
108
115
  | 'id'
116
+ | 'innerProps'
109
117
  | 'isDisabled'
110
118
  | 'isInvalid'
111
- | 'name'
112
- | 'onBlur'
113
- | 'onChange'
114
- | 'onFocus'
115
- | 'spacing'
119
+ | 'isOpen'
120
+ | 'key'
116
121
  | 'locale'
117
122
  | 'maxDate'
118
123
  | 'minDate'
119
- | 'isOpen'
124
+ | 'name'
120
125
  | 'nextMonthLabel'
126
+ | 'onBlur'
127
+ | 'onChange'
128
+ | 'onFocus'
121
129
  | 'parseInputValue'
122
- | 'formatDisplayLabel'
130
+ | 'placeholder'
123
131
  | 'previousMonthLabel'
132
+ | 'selectProps'
133
+ | 'spacing'
134
+ | 'testId'
124
135
  | 'value'
125
- | 'dateFormat'
126
- | 'placeholder'
127
136
  | 'weekStartDay'
128
- | 'key'
129
- | 'analyticsContext'
130
137
  > &
131
138
  RefAttributes<any>
132
139
  >;
@@ -140,7 +147,9 @@ const datePickerDefaultProps: {
140
147
  disabled: string[];
141
148
  disabledDateFilter: (_: string) => boolean;
142
149
  hideIcon: boolean;
143
- icon: ComponentType<IndicatorProps<OptionType, false>>;
150
+ icon: ComponentType<
151
+ DropdownIndicatorProps<OptionType, boolean, GroupType<OptionType>>
152
+ >;
144
153
  id: string;
145
154
  innerProps: {};
146
155
  isDisabled: boolean;
@@ -165,7 +174,7 @@ export interface DatePickerProps extends WithAnalyticsEventsProps {
165
174
  disabledDateFilter?: (date: string) => boolean;
166
175
  formatDisplayLabel?: (value: string, dateFormat: string) => string;
167
176
  hideIcon?: boolean;
168
- icon?: IndicatorComponentType<OptionType>;
177
+ icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
169
178
  id?: string;
170
179
  innerProps?: React.AllHTMLAttributes<HTMLElement>;
171
180
  isDisabled?: boolean;
@@ -197,30 +206,30 @@ export const DateTimePicker: React_2.ForwardRefExoticComponent<
197
206
  Pick<
198
207
  Pick<
199
208
  Omit<DateTimePickerProps_2, keyof WithAnalyticsEventsProps>,
200
- 'testId' | 'value' | 'dateFormat' | 'timeFormat' | 'parseValue'
209
+ 'dateFormat' | 'parseValue' | 'testId' | 'timeFormat' | 'value'
201
210
  > &
202
211
  Partial<
203
212
  Pick<
204
213
  Omit<DateTimePickerProps_2, keyof WithAnalyticsEventsProps>,
205
214
  | 'appearance'
206
- | 'innerProps'
207
215
  | 'autoFocus'
216
+ | 'datePickerProps'
217
+ | 'datePickerSelectProps'
208
218
  | 'defaultValue'
209
219
  | 'id'
220
+ | 'innerProps'
210
221
  | 'isDisabled'
211
222
  | 'isInvalid'
223
+ | 'locale'
212
224
  | 'name'
213
225
  | 'onBlur'
214
226
  | 'onChange'
215
227
  | 'onFocus'
216
228
  | 'spacing'
217
- | 'locale'
218
- | 'times'
219
229
  | 'timeIsEditable'
220
- | 'datePickerProps'
221
230
  | 'timePickerProps'
222
- | 'datePickerSelectProps'
223
231
  | 'timePickerSelectProps'
232
+ | 'times'
224
233
  >
225
234
  > &
226
235
  Partial<
@@ -251,32 +260,32 @@ export const DateTimePicker: React_2.ForwardRefExoticComponent<
251
260
  > &
252
261
  React_2.RefAttributes<any> &
253
262
  WithContextProps,
254
- | 'testId'
263
+ | 'analyticsContext'
255
264
  | 'appearance'
256
- | 'innerProps'
257
265
  | 'autoFocus'
266
+ | 'dateFormat'
267
+ | 'datePickerProps'
268
+ | 'datePickerSelectProps'
258
269
  | 'defaultValue'
259
270
  | 'id'
271
+ | 'innerProps'
260
272
  | 'isDisabled'
261
273
  | 'isInvalid'
274
+ | 'key'
275
+ | 'locale'
262
276
  | 'name'
263
277
  | 'onBlur'
264
278
  | 'onChange'
265
279
  | 'onFocus'
280
+ | 'parseValue'
266
281
  | 'spacing'
267
- | 'locale'
268
- | 'value'
269
- | 'dateFormat'
270
- | 'key'
271
- | 'analyticsContext'
272
- | 'times'
273
- | 'timeIsEditable'
282
+ | 'testId'
274
283
  | 'timeFormat'
275
- | 'datePickerProps'
284
+ | 'timeIsEditable'
276
285
  | 'timePickerProps'
277
- | 'datePickerSelectProps'
278
286
  | 'timePickerSelectProps'
279
- | 'parseValue'
287
+ | 'times'
288
+ | 'value'
280
289
  > &
281
290
  React_2.RefAttributes<any>
282
291
  >;
@@ -356,35 +365,35 @@ export const TimePicker: React_2.ForwardRefExoticComponent<
356
365
  Pick<
357
366
  Pick<
358
367
  Omit<TimePickerProps_2, keyof WithAnalyticsEventsProps>,
359
- | 'testId'
360
- | 'isOpen'
361
368
  | 'formatDisplayLabel'
362
- | 'value'
369
+ | 'isOpen'
363
370
  | 'placeholder'
371
+ | 'testId'
364
372
  | 'timeFormat'
373
+ | 'value'
365
374
  > &
366
375
  Partial<
367
376
  Pick<
368
377
  Omit<TimePickerProps_2, keyof WithAnalyticsEventsProps>,
369
378
  | 'appearance'
370
- | 'selectProps'
371
- | 'innerProps'
372
379
  | 'autoFocus'
373
380
  | 'defaultIsOpen'
374
381
  | 'defaultValue'
375
382
  | 'hideIcon'
376
383
  | 'id'
384
+ | 'innerProps'
377
385
  | 'isDisabled'
378
386
  | 'isInvalid'
387
+ | 'locale'
379
388
  | 'name'
380
389
  | 'onBlur'
381
390
  | 'onChange'
382
391
  | 'onFocus'
383
- | 'spacing'
384
- | 'locale'
385
392
  | 'parseInputValue'
386
- | 'times'
393
+ | 'selectProps'
394
+ | 'spacing'
387
395
  | 'timeIsEditable'
396
+ | 'times'
388
397
  >
389
398
  > &
390
399
  Partial<
@@ -406,7 +415,7 @@ export const TimePicker: React_2.ForwardRefExoticComponent<
406
415
  parseInputValue: (
407
416
  time: string,
408
417
  timeFormat: string,
409
- ) => string | Date;
418
+ ) => Date | string;
410
419
  selectProps: {};
411
420
  spacing: Spacing;
412
421
  times: string[];
@@ -418,33 +427,33 @@ export const TimePicker: React_2.ForwardRefExoticComponent<
418
427
  > &
419
428
  React_2.RefAttributes<any> &
420
429
  WithContextProps,
421
- | 'testId'
430
+ | 'analyticsContext'
422
431
  | 'appearance'
423
- | 'selectProps'
424
- | 'innerProps'
425
432
  | 'autoFocus'
426
433
  | 'defaultIsOpen'
427
434
  | 'defaultValue'
435
+ | 'formatDisplayLabel'
428
436
  | 'hideIcon'
429
437
  | 'id'
438
+ | 'innerProps'
430
439
  | 'isDisabled'
431
440
  | 'isInvalid'
441
+ | 'isOpen'
442
+ | 'key'
443
+ | 'locale'
432
444
  | 'name'
433
445
  | 'onBlur'
434
446
  | 'onChange'
435
447
  | 'onFocus'
436
- | 'spacing'
437
- | 'locale'
438
- | 'isOpen'
439
448
  | 'parseInputValue'
440
- | 'formatDisplayLabel'
441
- | 'value'
442
449
  | 'placeholder'
443
- | 'key'
444
- | 'analyticsContext'
445
- | 'times'
446
- | 'timeIsEditable'
450
+ | 'selectProps'
451
+ | 'spacing'
452
+ | 'testId'
447
453
  | 'timeFormat'
454
+ | 'timeIsEditable'
455
+ | 'times'
456
+ | 'value'
448
457
  > &
449
458
  React_2.RefAttributes<any>
450
459
  >;
@@ -464,7 +473,7 @@ const timePickerDefaultProps: {
464
473
  onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
465
474
  onChange: (value: string) => void;
466
475
  onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
467
- parseInputValue: (time: string, timeFormat: string) => string | Date;
476
+ parseInputValue: (time: string, timeFormat: string) => Date | string;
468
477
  selectProps: {};
469
478
  spacing: Spacing;
470
479
  times: string[];
@@ -491,7 +500,7 @@ export interface TimePickerProps extends WithAnalyticsEventsProps {
491
500
  onChange?: (value: string) => void;
492
501
  onFocus?: React_2.FocusEventHandler<HTMLElement>;
493
502
  // (undocumented)
494
- parseInputValue?: (time: string, timeFormat: string) => string | Date;
503
+ parseInputValue?: (time: string, timeFormat: string) => Date | string;
495
504
  placeholder?: string;
496
505
  selectProps?: SelectProps_2<any>;
497
506
  spacing?: Spacing;
@@ -507,3 +516,5 @@ type TimePickerProps_2 = typeof timePickerDefaultProps & TimePickerProps;
507
516
 
508
517
  // (No @packageDocumentation comment for this package)
509
518
  ```
519
+
520
+ <!--SECTION END: Main Entry Types-->