@atlaskit/datetime-picker 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/datetime-picker
2
2
 
3
+ ## 12.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`58d4cd75f7a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/58d4cd75f7a) - Removed deprecated hideIcon prop from DateTimePicker because it is unused and serves no functionality.
8
+ Removed the deprecation notice for the formatDisplayLabel prop in TimePicker
9
+
10
+ ### Patch Changes
11
+
12
+ - [`c3a1b950d49`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c3a1b950d49) - DSP-3301 specifies label to input id
13
+ - [`c2f866d31d1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2f866d31d1) - [ux] Fix timepicker clear icon alignment
14
+ - [`7566be18f20`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7566be18f20) - [ux] Time picker no longer loses focus to the document when tabbing through it in a popup.
15
+ - [`574b6c8ba7f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/574b6c8ba7f) - [ux] DSP-2987 Add code to catch console error
16
+ - Updated dependencies
17
+
3
18
  ## 12.0.0
4
19
 
5
20
  ### Major 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.0.0";
71
+ var packageVersion = "12.1.0";
72
72
  /* eslint-disable react/no-unused-prop-types */
73
73
 
74
74
  function getDateObj(date) {
@@ -112,7 +112,8 @@ var Menu = function Menu(_ref) {
112
112
  selected: [selectProps.calendarValue],
113
113
  locale: selectProps.calendarLocale,
114
114
  testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
115
- weekStartDay: selectProps.calendarWeekStartDay
115
+ weekStartDay: selectProps.calendarWeekStartDay,
116
+ tabIndex: -1
116
117
  }))),
117
118
  testId: selectProps.testId
118
119
  });
@@ -486,7 +487,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
486
487
  locale = _this$props3.locale,
487
488
  testId = _this$props3.testId,
488
489
  weekStartDay = _this$props3.weekStartDay;
489
- var BORDER_WIDTH = 2;
490
490
  var ICON_PADDING = 2;
491
491
 
492
492
  var _this$getSafeState6 = this.getSafeState(),
@@ -537,6 +537,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
537
537
  ref: this.getContainerRef,
538
538
  "data-testid": testId && "".concat(testId, "--container")
539
539
  }), (0, _core.jsx)("input", {
540
+ id: selectProps.inputId,
540
541
  name: name,
541
542
  type: "hidden",
542
543
  value: value,
@@ -561,7 +562,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
561
562
  indicatorsContainer: function indicatorsContainer(base) {
562
563
  return _objectSpread(_objectSpread({}, base), {}, {
563
564
  paddingLeft: ICON_PADDING,
564
- paddingRight: (0, _constants.gridSize)() - BORDER_WIDTH
565
+ paddingRight: (0, _constants.gridSize)() - ICON_PADDING
565
566
  });
566
567
  }
567
568
  }),
@@ -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.0.0";
61
+ var packageVersion = "12.1.0";
62
62
  /* eslint-disable react/no-unused-prop-types */
63
63
 
64
64
  var isInvalidBorderStyles = (0, _core.css)({
@@ -326,11 +326,13 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
326
326
 
327
327
  var isClearable = Boolean(dateValue || timeValue);
328
328
  var notFocusedOrIsDisabled = !(isFocused || isDisabled);
329
+ var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
329
330
  return (0, _core.jsx)("div", (0, _extends2.default)({
330
331
  css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
331
332
  }, innerProps, {
332
333
  "data-testid": testId
333
334
  }), (0, _core.jsx)("input", {
335
+ id: labelId,
334
336
  name: name,
335
337
  type: "hidden",
336
338
  value: value
@@ -67,7 +67,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
67
67
  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; } }
68
68
 
69
69
  var packageName = "@atlaskit/datetime-picker";
70
- var packageVersion = "12.0.0";
70
+ var packageVersion = "12.1.0";
71
71
  var menuStyles = {
72
72
  /* Need to remove default absolute positioning as that causes issues with position fixed */
73
73
  position: 'static',
@@ -165,7 +165,15 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
165
165
  var _this$props = _this.props,
166
166
  parseInputValue = _this$props.parseInputValue,
167
167
  _timeFormat = _this$props.timeFormat;
168
- var formattedValue = (0, _dateFns.format)(parseInputValue(inputValue, _timeFormat || _internal.defaultTimeFormat), 'HH:mm') || '';
168
+ var sanitizedInput;
169
+
170
+ try {
171
+ sanitizedInput = parseInputValue(inputValue, _timeFormat || _internal.defaultTimeFormat);
172
+ } catch (e) {
173
+ return; // do nothing, the main validation should happen in the form
174
+ }
175
+
176
+ var formattedValue = (0, _dateFns.format)(sanitizedInput, 'HH:mm') || '';
169
177
 
170
178
  _this.setState({
171
179
  value: formattedValue
@@ -323,7 +331,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
323
331
  spacing = _this$props3.spacing,
324
332
  testId = _this$props3.testId;
325
333
  var ICON_PADDING = 2;
326
- var BORDER_WIDTH = 2;
327
334
 
328
335
  var _this$getSafeState3 = this.getSafeState(),
329
336
  _this$getSafeState3$v = _this$getSafeState3.value,
@@ -349,7 +356,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
349
356
  selectComponents.ClearIndicator = _internal.EmptyClearIndicator;
350
357
  }
351
358
 
352
- var renderIconContainer = Boolean(hideIcon && value);
359
+ var renderIconContainer = Boolean(!hideIcon && value);
353
360
  var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
354
361
  control: function control(base) {
355
362
  return _objectSpread(_objectSpread({}, base), controlStyles);
@@ -364,7 +371,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
364
371
  indicatorsContainer: function indicatorsContainer(base) {
365
372
  return _objectSpread(_objectSpread({}, base), {}, {
366
373
  paddingLeft: renderIconContainer ? ICON_PADDING : 0,
367
- paddingRight: renderIconContainer ? (0, _constants.gridSize)() - BORDER_WIDTH : 0
374
+ paddingRight: renderIconContainer ? (0, _constants.gridSize)() - ICON_PADDING : 0
368
375
  });
369
376
  }
370
377
  });
@@ -376,6 +383,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
376
383
  "data-testid": testId && "".concat(testId, "--container"),
377
384
  onKeyDown: this.onSelectKeyDown
378
385
  }), /*#__PURE__*/_react.default.createElement("input", {
386
+ id: selectProps.inputId,
379
387
  name: name,
380
388
  type: "hidden",
381
389
  value: value
@@ -123,14 +123,14 @@ function _default(time) {
123
123
  var trimmedTime = time.toString().trim();
124
124
 
125
125
  if (!isValid(trimmedTime)) {
126
- return 'invalid time format';
126
+ throw RangeError('invalid time format');
127
127
  }
128
128
 
129
129
  var time1 = removeSpacer(trimmedTime);
130
130
  var time2 = convertTo24hrTime(time1);
131
131
 
132
132
  if (!time2) {
133
- return 'invalid time format';
133
+ throw RangeError('invalid time format');
134
134
  }
135
135
 
136
136
  return assignToDate(time2);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -18,7 +18,7 @@ import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime }
18
18
  import FixedLayer from '../internal/FixedLayer';
19
19
  import { convertTokens } from './utils';
20
20
  const packageName = "@atlaskit/datetime-picker";
21
- const packageVersion = "12.0.0";
21
+ const packageVersion = "12.1.0";
22
22
  /* eslint-disable react/no-unused-prop-types */
23
23
 
24
24
  function getDateObj(date) {
@@ -62,7 +62,8 @@ const Menu = ({
62
62
  selected: [selectProps.calendarValue],
63
63
  locale: selectProps.calendarLocale,
64
64
  testId: selectProps.testId && `${selectProps.testId}--calendar`,
65
- weekStartDay: selectProps.calendarWeekStartDay
65
+ weekStartDay: selectProps.calendarWeekStartDay,
66
+ tabIndex: -1
66
67
  }))),
67
68
  testId: selectProps.testId
68
69
  });
@@ -437,7 +438,6 @@ class DatePicker extends Component {
437
438
  testId,
438
439
  weekStartDay
439
440
  } = this.props;
440
- const BORDER_WIDTH = 2;
441
441
  const ICON_PADDING = 2;
442
442
  const {
443
443
  value,
@@ -488,6 +488,7 @@ class DatePicker extends Component {
488
488
  ref: this.getContainerRef,
489
489
  "data-testid": testId && `${testId}--container`
490
490
  }), jsx("input", {
491
+ id: selectProps.inputId,
491
492
  name: name,
492
493
  type: "hidden",
493
494
  value: value,
@@ -512,7 +513,7 @@ class DatePicker extends Component {
512
513
  }),
513
514
  indicatorsContainer: base => ({ ...base,
514
515
  paddingLeft: ICON_PADDING,
515
- paddingRight: gridSize() - BORDER_WIDTH
516
+ paddingRight: gridSize() - ICON_PADDING
516
517
  })
517
518
  }),
518
519
  placeholder: this.getPlaceholder(),
@@ -17,7 +17,7 @@ import DatePicker from './DatePicker';
17
17
  import TimePicker from './TimePicker';
18
18
  import { convertTokens } from './utils';
19
19
  const packageName = "@atlaskit/datetime-picker";
20
- const packageVersion = "12.0.0";
20
+ const packageVersion = "12.1.0";
21
21
  /* eslint-disable react/no-unused-prop-types */
22
22
 
23
23
  const isInvalidBorderStyles = css({
@@ -273,11 +273,13 @@ class DateTimePicker extends React.Component {
273
273
 
274
274
  const isClearable = Boolean(dateValue || timeValue);
275
275
  const notFocusedOrIsDisabled = !(isFocused || isDisabled);
276
+ const labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
276
277
  return jsx("div", _extends({
277
278
  css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
278
279
  }, innerProps, {
279
280
  "data-testid": testId
280
281
  }), jsx("input", {
282
+ id: labelId,
281
283
  name: name,
282
284
  type: "hidden",
283
285
  value: value
@@ -14,7 +14,7 @@ import FixedLayer from '../internal/FixedLayer';
14
14
  import parseTime from '../internal/parseTime';
15
15
  import { convertTokens } from './utils';
16
16
  const packageName = "@atlaskit/datetime-picker";
17
- const packageVersion = "12.0.0";
17
+ const packageVersion = "12.1.0";
18
18
  const menuStyles = {
19
19
  /* Need to remove default absolute positioning as that causes issues with position fixed */
20
20
  position: 'static',
@@ -104,7 +104,15 @@ class TimePicker extends React.Component {
104
104
  parseInputValue,
105
105
  timeFormat
106
106
  } = this.props;
107
- const formattedValue = format(parseInputValue(inputValue, timeFormat || defaultTimeFormat), 'HH:mm') || '';
107
+ let sanitizedInput;
108
+
109
+ try {
110
+ sanitizedInput = parseInputValue(inputValue, timeFormat || defaultTimeFormat);
111
+ } catch (e) {
112
+ return; // do nothing, the main validation should happen in the form
113
+ }
114
+
115
+ const formattedValue = format(sanitizedInput, 'HH:mm') || '';
108
116
  this.setState({
109
117
  value: formattedValue
110
118
  });
@@ -262,7 +270,6 @@ class TimePicker extends React.Component {
262
270
  testId
263
271
  } = this.props;
264
272
  const ICON_PADDING = 2;
265
- const BORDER_WIDTH = 2;
266
273
  const {
267
274
  value = '',
268
275
  isOpen
@@ -287,7 +294,7 @@ class TimePicker extends React.Component {
287
294
  selectComponents.ClearIndicator = EmptyClearIndicator;
288
295
  }
289
296
 
290
- const renderIconContainer = Boolean(hideIcon && value);
297
+ const renderIconContainer = Boolean(!hideIcon && value);
291
298
  const mergedStyles = mergeStyles(selectStyles, {
292
299
  control: base => ({ ...base,
293
300
  ...controlStyles
@@ -300,7 +307,7 @@ class TimePicker extends React.Component {
300
307
  }),
301
308
  indicatorsContainer: base => ({ ...base,
302
309
  paddingLeft: renderIconContainer ? ICON_PADDING : 0,
303
- paddingRight: renderIconContainer ? gridSize() - BORDER_WIDTH : 0
310
+ paddingRight: renderIconContainer ? gridSize() - ICON_PADDING : 0
304
311
  })
305
312
  });
306
313
  return (
@@ -311,6 +318,7 @@ class TimePicker extends React.Component {
311
318
  "data-testid": testId && `${testId}--container`,
312
319
  onKeyDown: this.onSelectKeyDown
313
320
  }), /*#__PURE__*/React.createElement("input", {
321
+ id: selectProps.inputId,
314
322
  name: name,
315
323
  type: "hidden",
316
324
  value: value
@@ -102,14 +102,14 @@ export default function (time) {
102
102
  const trimmedTime = time.toString().trim();
103
103
 
104
104
  if (!isValid(trimmedTime)) {
105
- return 'invalid time format';
105
+ throw RangeError('invalid time format');
106
106
  }
107
107
 
108
108
  const time1 = removeSpacer(trimmedTime);
109
109
  const time2 = convertTo24hrTime(time1);
110
110
 
111
111
  if (!time2) {
112
- return 'invalid time format';
112
+ throw RangeError('invalid time format');
113
113
  }
114
114
 
115
115
  return assignToDate(time2);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -33,7 +33,7 @@ import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime }
33
33
  import FixedLayer from '../internal/FixedLayer';
34
34
  import { convertTokens } from './utils';
35
35
  var packageName = "@atlaskit/datetime-picker";
36
- var packageVersion = "12.0.0";
36
+ var packageVersion = "12.1.0";
37
37
  /* eslint-disable react/no-unused-prop-types */
38
38
 
39
39
  function getDateObj(date) {
@@ -77,7 +77,8 @@ var Menu = function Menu(_ref) {
77
77
  selected: [selectProps.calendarValue],
78
78
  locale: selectProps.calendarLocale,
79
79
  testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
80
- weekStartDay: selectProps.calendarWeekStartDay
80
+ weekStartDay: selectProps.calendarWeekStartDay,
81
+ tabIndex: -1
81
82
  }))),
82
83
  testId: selectProps.testId
83
84
  });
@@ -472,7 +473,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
472
473
  locale = _this$props3.locale,
473
474
  testId = _this$props3.testId,
474
475
  weekStartDay = _this$props3.weekStartDay;
475
- var BORDER_WIDTH = 2;
476
476
  var ICON_PADDING = 2;
477
477
 
478
478
  var _this$getSafeState6 = this.getSafeState(),
@@ -523,6 +523,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
523
523
  ref: this.getContainerRef,
524
524
  "data-testid": testId && "".concat(testId, "--container")
525
525
  }), jsx("input", {
526
+ id: selectProps.inputId,
526
527
  name: name,
527
528
  type: "hidden",
528
529
  value: value,
@@ -547,7 +548,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
547
548
  indicatorsContainer: function indicatorsContainer(base) {
548
549
  return _objectSpread(_objectSpread({}, base), {}, {
549
550
  paddingLeft: ICON_PADDING,
550
- paddingRight: gridSize() - BORDER_WIDTH
551
+ paddingRight: gridSize() - ICON_PADDING
551
552
  });
552
553
  }
553
554
  }),
@@ -31,7 +31,7 @@ import DatePicker from './DatePicker';
31
31
  import TimePicker from './TimePicker';
32
32
  import { convertTokens } from './utils';
33
33
  var packageName = "@atlaskit/datetime-picker";
34
- var packageVersion = "12.0.0";
34
+ var packageVersion = "12.1.0";
35
35
  /* eslint-disable react/no-unused-prop-types */
36
36
 
37
37
  var isInvalidBorderStyles = css({
@@ -307,11 +307,13 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
307
307
 
308
308
  var isClearable = Boolean(dateValue || timeValue);
309
309
  var notFocusedOrIsDisabled = !(isFocused || isDisabled);
310
+ var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
310
311
  return jsx("div", _extends({
311
312
  css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
312
313
  }, innerProps, {
313
314
  "data-testid": testId
314
315
  }), jsx("input", {
316
+ id: labelId,
315
317
  name: name,
316
318
  type: "hidden",
317
319
  value: value
@@ -32,7 +32,7 @@ import FixedLayer from '../internal/FixedLayer';
32
32
  import parseTime from '../internal/parseTime';
33
33
  import { convertTokens } from './utils';
34
34
  var packageName = "@atlaskit/datetime-picker";
35
- var packageVersion = "12.0.0";
35
+ var packageVersion = "12.1.0";
36
36
  var menuStyles = {
37
37
  /* Need to remove default absolute positioning as that causes issues with position fixed */
38
38
  position: 'static',
@@ -136,7 +136,15 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
136
136
  var _this$props = _this.props,
137
137
  parseInputValue = _this$props.parseInputValue,
138
138
  _timeFormat = _this$props.timeFormat;
139
- var formattedValue = format(parseInputValue(inputValue, _timeFormat || defaultTimeFormat), 'HH:mm') || '';
139
+ var sanitizedInput;
140
+
141
+ try {
142
+ sanitizedInput = parseInputValue(inputValue, _timeFormat || defaultTimeFormat);
143
+ } catch (e) {
144
+ return; // do nothing, the main validation should happen in the form
145
+ }
146
+
147
+ var formattedValue = format(sanitizedInput, 'HH:mm') || '';
140
148
 
141
149
  _this.setState({
142
150
  value: formattedValue
@@ -304,7 +312,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
304
312
  spacing = _this$props3.spacing,
305
313
  testId = _this$props3.testId;
306
314
  var ICON_PADDING = 2;
307
- var BORDER_WIDTH = 2;
308
315
 
309
316
  var _this$getSafeState3 = this.getSafeState(),
310
317
  _this$getSafeState3$v = _this$getSafeState3.value,
@@ -332,7 +339,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
332
339
  selectComponents.ClearIndicator = EmptyClearIndicator;
333
340
  }
334
341
 
335
- var renderIconContainer = Boolean(hideIcon && value);
342
+ var renderIconContainer = Boolean(!hideIcon && value);
336
343
  var mergedStyles = mergeStyles(selectStyles, {
337
344
  control: function control(base) {
338
345
  return _objectSpread(_objectSpread({}, base), controlStyles);
@@ -347,7 +354,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
347
354
  indicatorsContainer: function indicatorsContainer(base) {
348
355
  return _objectSpread(_objectSpread({}, base), {}, {
349
356
  paddingLeft: renderIconContainer ? ICON_PADDING : 0,
350
- paddingRight: renderIconContainer ? gridSize() - BORDER_WIDTH : 0
357
+ paddingRight: renderIconContainer ? gridSize() - ICON_PADDING : 0
351
358
  });
352
359
  }
353
360
  });
@@ -359,6 +366,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
359
366
  "data-testid": testId && "".concat(testId, "--container"),
360
367
  onKeyDown: this.onSelectKeyDown
361
368
  }), /*#__PURE__*/React.createElement("input", {
369
+ id: selectProps.inputId,
362
370
  name: name,
363
371
  type: "hidden",
364
372
  value: value
@@ -102,14 +102,14 @@ export default function (time) {
102
102
  var trimmedTime = time.toString().trim();
103
103
 
104
104
  if (!isValid(trimmedTime)) {
105
- return 'invalid time format';
105
+ throw RangeError('invalid time format');
106
106
  }
107
107
 
108
108
  var time1 = removeSpacer(trimmedTime);
109
109
  var time2 = convertTo24hrTime(time1);
110
110
 
111
111
  if (!time2) {
112
- return 'invalid time format';
112
+ throw RangeError('invalid time format');
113
113
  }
114
114
 
115
115
  return assignToDate(time2);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "sideEffects": false
5
5
  }
@@ -39,8 +39,6 @@ export interface Props extends WithAnalyticsEventsProps {
39
39
  timeIsEditable?: boolean;
40
40
  /** Set if the picker has an invalid value. */
41
41
  isInvalid?: boolean;
42
- /** DEPRECATED - This is here only for backwards compatibility and doesn't do anything. It will be removed in the next MAJOR. */
43
- hideIcon?: boolean;
44
42
  /** Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format). */
45
43
  dateFormat?: string;
46
44
  /** Props applied to the `DatePicker`. */
@@ -155,7 +153,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
155
153
  render(): JSX.Element;
156
154
  }
157
155
  export { DateTimePicker as DateTimePickerWithoutAnalytics };
158
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "hideIcon" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "times" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
156
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "times" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
159
157
  appearance: string;
160
158
  autoFocus: boolean;
161
159
  isDisabled: boolean;
@@ -175,5 +173,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimeP
175
173
  times: string[];
176
174
  spacing: string;
177
175
  locale: string;
178
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "value" | "dateFormat" | "key" | "analyticsContext" | "times" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps" | "parseValue"> & React.RefAttributes<any>>;
176
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "testId" | "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "value" | "dateFormat" | "key" | "analyticsContext" | "times" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps" | "parseValue"> & React.RefAttributes<any>>;
179
177
  export default _default;
@@ -22,7 +22,7 @@ export interface Props extends WithAnalyticsEventsProps {
22
22
  defaultIsOpen?: boolean;
23
23
  /** The default for `value`. */
24
24
  defaultValue?: string;
25
- /** DEPRECATED - Use locale instead. Function for formatting the displayed time value in the input. By default parses with an internal time parser, and formats using the [date-fns format function]((https://date-fns.org/v1.29.0/docs/format)). */
25
+ /** A function for formatting the displayed time value in the input. By default parses with an internal time parser, and formats using the [date-fns format function]((https://date-fns.org/v1.29.0/docs/format)) */
26
26
  formatDisplayLabel?: (time: string, timeFormat: string) => string;
27
27
  /** 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`. Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release. */
28
28
  id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
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/"
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@atlaskit/analytics-next": "^8.2.0",
28
- "@atlaskit/calendar": "^12.2.0",
28
+ "@atlaskit/calendar": "^12.3.0",
29
29
  "@atlaskit/icon": "^21.10.0",
30
30
  "@atlaskit/locale": "^2.1.0",
31
31
  "@atlaskit/popper": "^5.2.0",
@@ -47,6 +47,7 @@
47
47
  "@atlaskit/field-base": "^15.0.5",
48
48
  "@atlaskit/form": "^8.5.0",
49
49
  "@atlaskit/modal-dialog": "^12.2.0",
50
+ "@atlaskit/popup": "^1.3.9",
50
51
  "@atlaskit/range": "^6.0.0",
51
52
  "@atlaskit/section-message": "^6.0.0",
52
53
  "@atlaskit/ssr": "*",
package/report.api.md ADDED
@@ -0,0 +1,636 @@
1
+ ## API Report File for "@atlaskit/datetime-picker"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ import { ComponentType } from 'react';
7
+ import { FocusEvent as FocusEvent_2 } from 'react';
8
+ import { ForwardRefExoticComponent } from 'react';
9
+ import { IndicatorComponentType } from '@atlaskit/select';
10
+ import { IndicatorProps } from '@atlaskit/select';
11
+ import { OptionType } from '@atlaskit/select';
12
+ import { default as React_2 } from 'react';
13
+ import { RefAttributes } from 'react';
14
+ import { SelectProps as SelectProps_2 } from '@atlaskit/select';
15
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
16
+ import { WithContextProps } from '@atlaskit/analytics-next';
17
+
18
+ export declare type Appearance = 'default' | 'subtle';
19
+
20
+ export declare const DatePicker: ForwardRefExoticComponent<
21
+ Pick<
22
+ Pick<
23
+ Omit<DatePickerProps_2, keyof WithAnalyticsEventsProps>,
24
+ | 'testId'
25
+ | 'maxDate'
26
+ | 'minDate'
27
+ | 'isOpen'
28
+ | 'nextMonthLabel'
29
+ | 'parseInputValue'
30
+ | 'formatDisplayLabel'
31
+ | 'previousMonthLabel'
32
+ | 'value'
33
+ | 'dateFormat'
34
+ | 'placeholder'
35
+ | 'weekStartDay'
36
+ > &
37
+ Partial<
38
+ Pick<
39
+ Omit<DatePickerProps_2, keyof WithAnalyticsEventsProps>,
40
+ | 'icon'
41
+ | 'disabled'
42
+ | 'appearance'
43
+ | 'selectProps'
44
+ | 'innerProps'
45
+ | 'autoFocus'
46
+ | 'defaultIsOpen'
47
+ | 'defaultValue'
48
+ | 'disabledDateFilter'
49
+ | 'hideIcon'
50
+ | 'id'
51
+ | 'isDisabled'
52
+ | 'isInvalid'
53
+ | 'name'
54
+ | 'onBlur'
55
+ | 'onChange'
56
+ | 'onFocus'
57
+ | 'spacing'
58
+ | 'locale'
59
+ >
60
+ > &
61
+ Partial<
62
+ Pick<
63
+ {
64
+ appearance: Appearance;
65
+ autoFocus: boolean;
66
+ defaultIsOpen: boolean;
67
+ defaultValue: string;
68
+ disabled: string[];
69
+ disabledDateFilter: (_: string) => boolean;
70
+ hideIcon: boolean;
71
+ icon: ComponentType<IndicatorProps<OptionType, false>>;
72
+ id: string;
73
+ innerProps: {};
74
+ isDisabled: boolean;
75
+ isInvalid: boolean;
76
+ name: string;
77
+ onBlur: (event: FocusEvent_2<HTMLInputElement>) => void;
78
+ onChange: (value: string) => void;
79
+ onFocus: (event: FocusEvent_2<HTMLInputElement>) => void;
80
+ selectProps: {};
81
+ spacing: Spacing;
82
+ locale: string;
83
+ },
84
+ never
85
+ >
86
+ > &
87
+ RefAttributes<any> &
88
+ WithContextProps,
89
+ | 'testId'
90
+ | 'icon'
91
+ | 'disabled'
92
+ | 'appearance'
93
+ | 'selectProps'
94
+ | 'innerProps'
95
+ | 'autoFocus'
96
+ | 'defaultIsOpen'
97
+ | 'defaultValue'
98
+ | 'disabledDateFilter'
99
+ | 'hideIcon'
100
+ | 'id'
101
+ | 'isDisabled'
102
+ | 'isInvalid'
103
+ | 'name'
104
+ | 'onBlur'
105
+ | 'onChange'
106
+ | 'onFocus'
107
+ | 'spacing'
108
+ | 'locale'
109
+ | 'maxDate'
110
+ | 'minDate'
111
+ | 'isOpen'
112
+ | 'nextMonthLabel'
113
+ | 'parseInputValue'
114
+ | 'formatDisplayLabel'
115
+ | 'previousMonthLabel'
116
+ | 'value'
117
+ | 'dateFormat'
118
+ | 'placeholder'
119
+ | 'weekStartDay'
120
+ | 'key'
121
+ | 'analyticsContext'
122
+ > &
123
+ RefAttributes<any>
124
+ >;
125
+
126
+ declare const datePickerDefaultProps: {
127
+ appearance: Appearance;
128
+ autoFocus: boolean;
129
+ defaultIsOpen: boolean;
130
+ defaultValue: string;
131
+ disabled: string[];
132
+ disabledDateFilter: (_: string) => boolean;
133
+ hideIcon: boolean;
134
+ icon: ComponentType<IndicatorProps<OptionType, false>>;
135
+ id: string;
136
+ innerProps: {};
137
+ isDisabled: boolean;
138
+ isInvalid: boolean;
139
+ name: string;
140
+ onBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
141
+ onChange: (value: string) => void;
142
+ onFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
143
+ selectProps: {};
144
+ spacing: Spacing;
145
+ locale: string;
146
+ };
147
+
148
+ export declare interface DatePickerProps extends WithAnalyticsEventsProps {
149
+ /**
150
+ Set the appearance of the picker.
151
+
152
+ `subtle` will remove the borders, background, and icon.
153
+
154
+ **NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
155
+ */
156
+ appearance?: Appearance;
157
+ /** Set the picker to autofocus on mount. */
158
+ autoFocus?: boolean;
159
+ /** The default for `isOpen`. Will be `false` if not provided. */
160
+ defaultIsOpen?: boolean;
161
+ /** The default for `value`. */
162
+ defaultValue?: string;
163
+ /** An array of ISO dates that should be disabled on the calendar. This does not affect what users can type into the picker. */
164
+ disabled?: string[];
165
+ /**
166
+ A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
167
+
168
+ The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
169
+ */
170
+ disabledDateFilter?: (date: string) => boolean;
171
+ /** The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker. */
172
+ maxDate?: string;
173
+ /** The earliest enabled date. Dates before this are disabled on the calendar. This does not affect what users can type into the picker. */
174
+ minDate?: string;
175
+ /** The icon shown in the picker. */
176
+ icon?: IndicatorComponentType<OptionType>;
177
+ /**
178
+ 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`.
179
+
180
+ Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
181
+ */
182
+ id?: string;
183
+ /** Props to apply to the container. **/
184
+ innerProps?: React.AllHTMLAttributes<HTMLElement>;
185
+ /** Set if the picker is disabled. */
186
+ isDisabled?: boolean;
187
+ /** Set if the picker is open. */
188
+ isOpen?: boolean;
189
+ /** The name of the field. */
190
+ name?: string;
191
+ /** The aria-label attribute associated with the next-month arrow. */
192
+ nextMonthLabel?: string;
193
+ /** Called when the field is blurred. */
194
+ onBlur?: React.FocusEventHandler<HTMLInputElement>;
195
+ /** Called when the value changes. The only argument is an ISO time or empty string. */
196
+ onChange?: (value: string) => void;
197
+ /** Called when the field is focused. */
198
+ onFocus?: React.FocusEventHandler<HTMLInputElement>;
199
+ /** A function for parsing input characters and transforming them into a Date object. By default parses the date string based off the locale. */
200
+ parseInputValue?: (date: string, dateFormat: string) => Date;
201
+ /** A function for formatting the date displayed in the input. By default composes together [date-fn's parse method](https://date-fns.org/v1.29.0/docs/parse) and [date-fn's format method](https://date-fns.org/v1.29.0/docs/format) to return a correctly formatted date string. */
202
+ formatDisplayLabel?: (value: string, dateFormat: string) => string;
203
+ /** The aria-label attribute associated with the previous-month arrow. */
204
+ previousMonthLabel?: string;
205
+ /** Props to apply to the select. This can be used to set options such as placeholder text.
206
+ * See [the `Select` documentation for further information](/components/select). */
207
+ selectProps?: SelectProps;
208
+ /**
209
+ The spacing for the select control.
210
+
211
+ Compact is `gridSize() * 4`, default is `gridSize * 5`.
212
+ */
213
+ spacing?: Spacing;
214
+ /** The ISO time used as the input value. */
215
+ value?: string;
216
+ /** Set if the picker has an invalid value. */
217
+ isInvalid?: boolean;
218
+ /** Hides icon for dropdown indicator. */
219
+ hideIcon?: boolean;
220
+ /** Format the date with a string that is accepted by [date-fn's format function](https://date-fns.org/v1.29.0/docs/format). */
221
+ dateFormat?: string;
222
+ /** Placeholder text displayed in input */
223
+ placeholder?: string;
224
+ /** Locale used to format the date and calendar. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). */
225
+ locale?: string;
226
+ /**
227
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
228
+ * - `{testId}--container` wrapping element of date-picker
229
+ * - `{testId}--calendar--container` nested calendar component
230
+ **/
231
+ testId?: string;
232
+ /**
233
+ * Start day of the week for the calendar.
234
+ * - `0` sunday (default value)
235
+ * - `1` monday
236
+ * - `2` tuesday
237
+ * - `3` wednesday
238
+ * - `4` thursday
239
+ * - `5` friday
240
+ * - `6` saturday
241
+ */
242
+ weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
243
+ }
244
+
245
+ declare type DatePickerProps_2 = typeof datePickerDefaultProps &
246
+ DatePickerProps;
247
+
248
+ export declare const DateTimePicker: React_2.ForwardRefExoticComponent<
249
+ Pick<
250
+ Pick<
251
+ Omit<DateTimePickerProps_2, keyof WithAnalyticsEventsProps>,
252
+ | 'testId'
253
+ | 'hideIcon'
254
+ | 'value'
255
+ | 'dateFormat'
256
+ | 'timeFormat'
257
+ | 'parseValue'
258
+ > &
259
+ Partial<
260
+ Pick<
261
+ Omit<DateTimePickerProps_2, keyof WithAnalyticsEventsProps>,
262
+ | 'appearance'
263
+ | 'innerProps'
264
+ | 'autoFocus'
265
+ | 'defaultValue'
266
+ | 'id'
267
+ | 'isDisabled'
268
+ | 'isInvalid'
269
+ | 'name'
270
+ | 'onBlur'
271
+ | 'onChange'
272
+ | 'onFocus'
273
+ | 'spacing'
274
+ | 'locale'
275
+ | 'times'
276
+ | 'timeIsEditable'
277
+ | 'datePickerProps'
278
+ | 'timePickerProps'
279
+ | 'datePickerSelectProps'
280
+ | 'timePickerSelectProps'
281
+ >
282
+ > &
283
+ Partial<
284
+ Pick<
285
+ {
286
+ appearance: string;
287
+ autoFocus: boolean;
288
+ isDisabled: boolean;
289
+ name: string;
290
+ onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
291
+ onChange: (value: string) => void;
292
+ onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
293
+ innerProps: {};
294
+ id: string;
295
+ defaultValue: string;
296
+ timeIsEditable: boolean;
297
+ isInvalid: boolean;
298
+ datePickerProps: {};
299
+ timePickerProps: {};
300
+ datePickerSelectProps: {};
301
+ timePickerSelectProps: {};
302
+ times: string[];
303
+ spacing: string;
304
+ locale: string;
305
+ },
306
+ never
307
+ >
308
+ > &
309
+ React_2.RefAttributes<any> &
310
+ WithContextProps,
311
+ | 'testId'
312
+ | 'appearance'
313
+ | 'innerProps'
314
+ | 'autoFocus'
315
+ | 'defaultValue'
316
+ | 'hideIcon'
317
+ | 'id'
318
+ | 'isDisabled'
319
+ | 'isInvalid'
320
+ | 'name'
321
+ | 'onBlur'
322
+ | 'onChange'
323
+ | 'onFocus'
324
+ | 'spacing'
325
+ | 'locale'
326
+ | 'value'
327
+ | 'dateFormat'
328
+ | 'key'
329
+ | 'analyticsContext'
330
+ | 'times'
331
+ | 'timeIsEditable'
332
+ | 'timeFormat'
333
+ | 'datePickerProps'
334
+ | 'timePickerProps'
335
+ | 'datePickerSelectProps'
336
+ | 'timePickerSelectProps'
337
+ | 'parseValue'
338
+ > &
339
+ React_2.RefAttributes<any>
340
+ >;
341
+
342
+ declare const dateTimePickerDefaultProps: {
343
+ appearance: string;
344
+ autoFocus: boolean;
345
+ isDisabled: boolean;
346
+ name: string;
347
+ onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
348
+ onChange: (value: string) => void;
349
+ onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
350
+ innerProps: {};
351
+ id: string;
352
+ defaultValue: string;
353
+ timeIsEditable: boolean;
354
+ isInvalid: boolean;
355
+ datePickerProps: {};
356
+ timePickerProps: {};
357
+ datePickerSelectProps: {};
358
+ timePickerSelectProps: {};
359
+ times: string[];
360
+ spacing: string;
361
+ locale: string;
362
+ };
363
+
364
+ export declare interface DateTimePickerProps extends WithAnalyticsEventsProps {
365
+ /**
366
+ * Set the appearance of the picker.
367
+ *
368
+ * `subtle` will remove the borders and background.
369
+ */
370
+ appearance?: Appearance;
371
+ /** Set the picker to autofocus on mount. */
372
+ autoFocus?: boolean;
373
+ /** The default for `value`. */
374
+ defaultValue?: string;
375
+ /**
376
+ * 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`.
377
+ * Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
378
+ */
379
+ id?: string;
380
+ /** Props to apply to the container. **/
381
+ innerProps?: React_2.AllHTMLAttributes<HTMLElement>;
382
+ /** Set if the field is disabled. */
383
+ isDisabled?: boolean;
384
+ /** The name of the field. */
385
+ name?: string;
386
+ /** Called when the field is blurred. */
387
+ onBlur?: React_2.FocusEventHandler<HTMLInputElement>;
388
+ /** Called when the value changes and the date / time is a complete value, or empty. The only value is an ISO string or empty string. */
389
+ onChange?: (value: string) => void;
390
+ /** Called when the field is focused. */
391
+ onFocus?: React_2.FocusEventHandler<HTMLInputElement>;
392
+ /** The ISO time that should be used as the input value. */
393
+ value?: string;
394
+ /** Set if users can edit the input, allowing them to add custom times. */
395
+ timeIsEditable?: boolean;
396
+ /** Set if the picker has an invalid value. */
397
+ isInvalid?: boolean;
398
+ /** DEPRECATED - This is here only for backwards compatibility and doesn't do anything. It will be removed in the next MAJOR. */
399
+ hideIcon?: boolean;
400
+ /** Format the date with a string that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format). */
401
+ dateFormat?: string;
402
+ /** Props applied to the `DatePicker`. */
403
+ datePickerProps?: DatePickerProps;
404
+ /** Props applied to the `TimePicker`. */
405
+ timePickerProps?: TimePickerProps;
406
+ /** Function used to parse datetime values into their date, time and timezone sub-values. **/
407
+ parseValue?: (
408
+ dateTimeValue: string,
409
+ date: string,
410
+ time: string,
411
+ timezone: string,
412
+ ) => {
413
+ dateValue: string;
414
+ timeValue: string;
415
+ zoneValue: string;
416
+ };
417
+ /** [Select props](/components/select) to pass onto the `DatePicker` component's `Select`. This can be used to set options such as placeholder text. */
418
+ datePickerSelectProps?: SelectProps_2<any>;
419
+ /** [Select props](/components/select) to pass onto the `TimePicker` component's `Select`. This can be used to set options such as placeholder text. */
420
+ timePickerSelectProps?: SelectProps_2<any>;
421
+ /** The times shown by the `TimePicker`. */
422
+ times?: Array<string>;
423
+ /** The format that times are displayed in. Values should be those accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format). */
424
+ timeFormat?: string;
425
+ /**
426
+ * The spacing for the select control.
427
+ *
428
+ * Compact is `gridSize() * 4`, default is `gridSize() * 5`.
429
+ */
430
+ spacing?: Spacing;
431
+ /** Locale used for formatting dates and times. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). */
432
+ locale?: string;
433
+ /**
434
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
435
+ * - `{testId}--datepicker--container` wrapping element of date-picker
436
+ * - `{testId}--timepicker--container` wrapping element of time-picker
437
+ **/
438
+ testId?: string;
439
+ }
440
+
441
+ declare type DateTimePickerProps_2 = typeof dateTimePickerDefaultProps &
442
+ DateTimePickerProps;
443
+
444
+ declare type SelectProps = any;
445
+
446
+ export declare type Spacing = 'compact' | 'default';
447
+
448
+ export declare const TimePicker: React_2.ForwardRefExoticComponent<
449
+ Pick<
450
+ Pick<
451
+ Omit<TimePickerProps_2, keyof WithAnalyticsEventsProps>,
452
+ | 'testId'
453
+ | 'isOpen'
454
+ | 'formatDisplayLabel'
455
+ | 'value'
456
+ | 'placeholder'
457
+ | 'timeFormat'
458
+ > &
459
+ Partial<
460
+ Pick<
461
+ Omit<TimePickerProps_2, keyof WithAnalyticsEventsProps>,
462
+ | 'appearance'
463
+ | 'selectProps'
464
+ | 'innerProps'
465
+ | 'autoFocus'
466
+ | 'defaultIsOpen'
467
+ | 'defaultValue'
468
+ | 'hideIcon'
469
+ | 'id'
470
+ | 'isDisabled'
471
+ | 'isInvalid'
472
+ | 'name'
473
+ | 'onBlur'
474
+ | 'onChange'
475
+ | 'onFocus'
476
+ | 'spacing'
477
+ | 'locale'
478
+ | 'parseInputValue'
479
+ | 'times'
480
+ | 'timeIsEditable'
481
+ >
482
+ > &
483
+ Partial<
484
+ Pick<
485
+ {
486
+ appearance: Appearance;
487
+ autoFocus: boolean;
488
+ defaultIsOpen: boolean;
489
+ defaultValue: string;
490
+ hideIcon: boolean;
491
+ id: string;
492
+ innerProps: {};
493
+ isDisabled: boolean;
494
+ isInvalid: boolean;
495
+ name: string;
496
+ onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
497
+ onChange: (value: string) => void;
498
+ onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
499
+ parseInputValue: (
500
+ time: string,
501
+ timeFormat: string,
502
+ ) => string | Date;
503
+ selectProps: {};
504
+ spacing: Spacing;
505
+ times: string[];
506
+ timeIsEditable: boolean;
507
+ locale: string;
508
+ },
509
+ never
510
+ >
511
+ > &
512
+ React_2.RefAttributes<any> &
513
+ WithContextProps,
514
+ | 'testId'
515
+ | 'appearance'
516
+ | 'selectProps'
517
+ | 'innerProps'
518
+ | 'autoFocus'
519
+ | 'defaultIsOpen'
520
+ | 'defaultValue'
521
+ | 'hideIcon'
522
+ | 'id'
523
+ | 'isDisabled'
524
+ | 'isInvalid'
525
+ | 'name'
526
+ | 'onBlur'
527
+ | 'onChange'
528
+ | 'onFocus'
529
+ | 'spacing'
530
+ | 'locale'
531
+ | 'isOpen'
532
+ | 'parseInputValue'
533
+ | 'formatDisplayLabel'
534
+ | 'value'
535
+ | 'placeholder'
536
+ | 'key'
537
+ | 'analyticsContext'
538
+ | 'times'
539
+ | 'timeIsEditable'
540
+ | 'timeFormat'
541
+ > &
542
+ React_2.RefAttributes<any>
543
+ >;
544
+
545
+ declare const timePickerDefaultProps: {
546
+ appearance: Appearance;
547
+ autoFocus: boolean;
548
+ defaultIsOpen: boolean;
549
+ defaultValue: string;
550
+ hideIcon: boolean;
551
+ id: string;
552
+ innerProps: {};
553
+ isDisabled: boolean;
554
+ isInvalid: boolean;
555
+ name: string;
556
+ onBlur: (event: React_2.FocusEvent<HTMLInputElement>) => void;
557
+ onChange: (value: string) => void;
558
+ onFocus: (event: React_2.FocusEvent<HTMLInputElement>) => void;
559
+ parseInputValue: (time: string, timeFormat: string) => string | Date;
560
+ selectProps: {};
561
+ spacing: Spacing;
562
+ times: string[];
563
+ timeIsEditable: boolean;
564
+ locale: string;
565
+ };
566
+
567
+ export declare interface TimePickerProps extends WithAnalyticsEventsProps {
568
+ /**
569
+ Set the appearance of the picker.
570
+
571
+ `subtle` will remove the borders, background, and icon.
572
+
573
+ **NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
574
+ */
575
+ appearance?: Appearance;
576
+ /** Set the picker to autofocus on mount. */
577
+ autoFocus?: boolean;
578
+ /** The default for `isOpen`. */
579
+ defaultIsOpen?: boolean;
580
+ /** The default for `value`. */
581
+ defaultValue?: string;
582
+ /** DEPRECATED - Use locale instead. Function for formatting the displayed time value in the input. By default parses with an internal time parser, and formats using the [date-fns format function]((https://date-fns.org/v1.29.0/docs/format)). */
583
+ formatDisplayLabel?: (time: string, timeFormat: string) => string;
584
+ /** 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`. Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release. */
585
+ id?: string;
586
+ /** Props to apply to the container. **/
587
+ innerProps?: React_2.AllHTMLAttributes<HTMLElement>;
588
+ /** Set if the field is disabled. */
589
+ isDisabled?: boolean;
590
+ /** Set if the dropdown is open. Will be `false` if not provided. */
591
+ isOpen?: boolean;
592
+ /** The name of the field. */
593
+ name?: string;
594
+ /** Called when the field is blurred. */
595
+ onBlur?: React_2.FocusEventHandler<HTMLElement>;
596
+ /** Called when the value changes. The only argument is an ISO time or empty string. */
597
+ onChange?: (value: string) => void;
598
+ /** Called when the field is focused. */
599
+ onFocus?: React_2.FocusEventHandler<HTMLElement>;
600
+ parseInputValue?: (time: string, timeFormat: string) => string | Date;
601
+ /** Props to apply to the select. */
602
+ selectProps?: SelectProps_2<any>;
603
+ /**
604
+ The spacing for the select control.
605
+
606
+ Compact is `gridSize() * 4`, default is `gridSize * 5`.
607
+ */
608
+ spacing?: Spacing;
609
+ /** The times shown in the dropdown. */
610
+ times?: string[];
611
+ /** Set if users can edit the input, allowing them to add custom times. */
612
+ timeIsEditable?: boolean;
613
+ /** The ISO time that should be used as the input value. */
614
+ value?: string;
615
+ /** Set if the picker has an invalid value. */
616
+ isInvalid?: boolean;
617
+ /** Hides icon for dropdown indicator. */
618
+ hideIcon?: boolean;
619
+ /** Time format that is accepted by [date-fns's format function](https://date-fns.org/v1.29.0/docs/format). */
620
+ timeFormat?: string;
621
+ /** Placeholder text displayed in input. */
622
+ placeholder?: string;
623
+ /** Locale used to format the time. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat). */
624
+ locale?: string;
625
+ /**
626
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests:
627
+ * - `{testId}--container` wrapping element of time-picker
628
+ **/
629
+ testId?: string;
630
+ }
631
+
632
+ declare type TimePickerProps_2 = typeof timePickerDefaultProps &
633
+ TimePickerProps;
634
+
635
+ export {};
636
+ ```