@atlaskit/datetime-picker 12.3.11 → 12.3.13

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,18 @@
1
1
  # @atlaskit/datetime-picker
2
2
 
3
+ ## 12.3.13
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c71b0ac8222`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c71b0ac8222) - [ux] Add default label to time picker element of datetime picker. Update documentation for more accessible examples and guidelines.
8
+
9
+ ## 12.3.12
10
+
11
+ ### Patch Changes
12
+
13
+ - [`2e01c9c74b5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2e01c9c74b5) - DUMMY remove before merging to master; dupe adf-schema via adf-utils
14
+ - [`e754545d460`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e754545d460) - [ux] Ensure no duplicate ID's when using `selectProps` on any of the DateTime Picker components.
15
+
3
16
  ## 12.3.11
4
17
 
5
18
  ### Patch Changes
@@ -34,9 +34,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
34
34
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
35
  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; }
36
36
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
37
- 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; } }
37
+ 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; } } /* eslint-disable @repo/internal/react/use-noop */ /** @jsx jsx */ // eslint-disable-next-line no-restricted-imports
38
38
  var packageName = "@atlaskit/datetime-picker";
39
- var packageVersion = "12.3.11";
39
+ var packageVersion = "12.3.13";
40
40
 
41
41
  /* eslint-disable react/no-unused-prop-types */
42
42
 
@@ -388,6 +388,19 @@ var DatePicker = /*#__PURE__*/function (_Component) {
388
388
 
389
389
  // All state needs to be accessed via this function so that the state is mapped from props
390
390
  // correctly to allow controlled/uncontrolled usage.
391
+ /**
392
+ * There are two props that can change how the date is parsed.
393
+ * The priority of props used is:
394
+ * 1. parseInputValue
395
+ * 2. locale
396
+ */
397
+ /**
398
+ * There are multiple props that can change how the date is formatted.
399
+ * The priority of props used is:
400
+ * 1. formatDisplayLabel
401
+ * 2. dateFormat
402
+ * 3. locale
403
+ */
391
404
  }, {
392
405
  key: "render",
393
406
  value: function render() {
@@ -457,7 +470,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
457
470
  ref: this.getContainerRef,
458
471
  "data-testid": testId && "".concat(testId, "--container")
459
472
  }), (0, _react2.jsx)("input", {
460
- id: selectProps.inputId,
461
473
  name: name,
462
474
  type: "hidden",
463
475
  value: value,
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = exports.DateTimePickerWithoutAnalytics = void 0;
7
+ exports.timePickerDefaultAriaLabel = exports.default = exports.datePickerDefaultAriaLabel = exports.DateTimePickerWithoutAnalytics = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -29,9 +29,9 @@ var _utils = require("./utils");
29
29
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
30
30
  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; } }
31
31
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32
- 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; }
32
+ 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; } /* eslint-disable @repo/internal/react/use-noop */ /** @jsx jsx */ // eslint-disable-next-line no-restricted-imports
33
33
  var packageName = "@atlaskit/datetime-picker";
34
- var packageVersion = "12.3.11";
34
+ var packageVersion = "12.3.13";
35
35
 
36
36
  /* eslint-disable react/no-unused-prop-types */
37
37
 
@@ -155,6 +155,11 @@ var dateTimePickerDefaultProps = {
155
155
  // Not including a default prop for value as it will
156
156
  // Make the component a controlled component
157
157
  };
158
+
159
+ var datePickerDefaultAriaLabel = 'Date';
160
+ exports.datePickerDefaultAriaLabel = datePickerDefaultAriaLabel;
161
+ var timePickerDefaultAriaLabel = 'Time';
162
+ exports.timePickerDefaultAriaLabel = timePickerDefaultAriaLabel;
158
163
  var DateTimePicker = /*#__PURE__*/function (_React$Component) {
159
164
  (0, _inherits2.default)(DateTimePicker, _React$Component);
160
165
  var _super = _createSuper(DateTimePicker);
@@ -206,7 +211,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
206
211
  }));
207
212
  });
208
213
  return _this;
209
- }
214
+ } // All state needs to be accessed via this function so that the state is mapped from props
215
+ // correctly to allow controlled/uncontrolled usage.
210
216
  (0, _createClass2.default)(DateTimePicker, [{
211
217
  key: "parseValue",
212
218
  value: function parseValue(value, dateValue, timeValue, zoneValue) {
@@ -270,7 +276,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
270
276
  times = _this$props.times,
271
277
  timeFormat = _this$props.timeFormat,
272
278
  locale = _this$props.locale,
273
- testId = _this$props.testId;
279
+ testId = _this$props.testId,
280
+ ariaLabelledBy = _this$props['aria-labelledby'];
274
281
  var _this$getSafeState = this.getSafeState(),
275
282
  isFocused = _this$getSafeState.isFocused,
276
283
  value = _this$getSafeState.value,
@@ -289,9 +296,11 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
289
296
  var _timePickerSelectProp = timePickerSelectProps.styles,
290
297
  timePickerStyles = _timePickerSelectProp === void 0 ? {} : _timePickerSelectProp;
291
298
  var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
299
+ 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
292
300
  styles: (0, _select.mergeStyles)(styles, datePickerStyles)
293
301
  });
294
302
  var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
303
+ 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
295
304
  styles: (0, _select.mergeStyles)(styles, timePickerStyles)
296
305
  });
297
306
 
@@ -299,16 +308,17 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
299
308
  // Don't use Date or TimePicker's because they can't be customised
300
309
  var isClearable = Boolean(dateValue || timeValue);
301
310
  var notFocusedOrIsDisabled = !(isFocused || isDisabled);
302
- var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
303
311
  return (0, _react2.jsx)("div", (0, _extends2.default)({
304
312
  css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles), bothProps.appearance === 'none' && noBgStyles]
305
313
  }, innerProps, {
314
+ role: "group",
315
+ "aria-labelledby": ariaLabelledBy,
306
316
  "data-testid": testId
307
317
  }), (0, _react2.jsx)("input", {
308
- id: labelId,
309
318
  name: name,
310
319
  type: "hidden",
311
- value: value
320
+ value: value,
321
+ "data-testid": testId && "".concat(testId, "--input")
312
322
  }), (0, _react2.jsx)("div", {
313
323
  css: datePickerContainerStyles
314
324
  }, (0, _react2.jsx)(_datePicker.default, (0, _extends2.default)({}, bothProps, {
@@ -28,6 +28,9 @@ var _parseTime = _interopRequireDefault(require("../internal/parse-time"));
28
28
  var _utils = require("./utils");
29
29
  var _excluded = ["selectProps"],
30
30
  _excluded2 = ["styles"];
31
+ /* eslint-disable @repo/internal/react/use-noop */
32
+ // eslint-disable-next-line no-restricted-imports
33
+ // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
31
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
32
35
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -35,7 +38,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
35
38
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
36
39
  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; } }
37
40
  var packageName = "@atlaskit/datetime-picker";
38
- var packageVersion = "12.3.11";
41
+ var packageVersion = "12.3.13";
42
+
43
+ /* eslint-disable react/no-unused-prop-types */
44
+
39
45
  var menuStyles = {
40
46
  /* Need to remove default absolute positioning as that causes issues with position fixed */
41
47
  position: 'static',
@@ -247,6 +253,18 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
247
253
  };
248
254
  });
249
255
  }
256
+
257
+ /**
258
+ * Only allow custom times if timeIsEditable prop is true
259
+ */
260
+
261
+ /**
262
+ * There are multiple props that can change how the time is formatted.
263
+ * The priority of props used is:
264
+ * 1. formatDisplayLabel
265
+ * 2. timeFormat
266
+ * 3. locale
267
+ */
250
268
  }, {
251
269
  key: "render",
252
270
  value: function render() {
@@ -309,10 +327,10 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
309
327
  "data-testid": testId && "".concat(testId, "--container"),
310
328
  onKeyDown: this.onSelectKeyDown
311
329
  }), /*#__PURE__*/_react.default.createElement("input", {
312
- id: selectProps.inputId,
313
330
  name: name,
314
331
  type: "hidden",
315
- value: value
332
+ value: value,
333
+ "data-testid": testId && "".concat(testId, "--input")
316
334
  }), /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
317
335
  appearance: this.props.appearance,
318
336
  autoFocus: autoFocus,
@@ -21,7 +21,7 @@ var _constants = require("@atlaskit/theme/constants");
21
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
22
  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; }
23
23
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
24
- 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; } }
24
+ 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; } } // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
25
25
  /**
26
26
  * This component renders layered content with fixed positioning.
27
27
  * Scroll is locked outside the layer to prevent the layered content from detaching from the
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.11",
3
+ "version": "12.3.13",
4
4
  "sideEffects": false
5
5
  }
@@ -18,7 +18,7 @@ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from
18
18
  import FixedLayer from '../internal/fixed-layer';
19
19
  import { convertTokens } from './utils';
20
20
  const packageName = "@atlaskit/datetime-picker";
21
- const packageVersion = "12.3.11";
21
+ const packageVersion = "12.3.13";
22
22
 
23
23
  /* eslint-disable react/no-unused-prop-types */
24
24
 
@@ -376,7 +376,19 @@ class DatePicker extends Component {
376
376
 
377
377
  // All state needs to be accessed via this function so that the state is mapped from props
378
378
  // correctly to allow controlled/uncontrolled usage.
379
-
379
+ /**
380
+ * There are two props that can change how the date is parsed.
381
+ * The priority of props used is:
382
+ * 1. parseInputValue
383
+ * 2. locale
384
+ */
385
+ /**
386
+ * There are multiple props that can change how the date is formatted.
387
+ * The priority of props used is:
388
+ * 1. formatDisplayLabel
389
+ * 2. dateFormat
390
+ * 3. locale
391
+ */
380
392
  render() {
381
393
  const {
382
394
  appearance,
@@ -448,7 +460,6 @@ class DatePicker extends Component {
448
460
  ref: this.getContainerRef,
449
461
  "data-testid": testId && `${testId}--container`
450
462
  }), jsx("input", {
451
- id: selectProps.inputId,
452
463
  name: name,
453
464
  type: "hidden",
454
465
  value: value,
@@ -17,7 +17,7 @@ import DatePicker from './date-picker';
17
17
  import TimePicker from './time-picker';
18
18
  import { convertTokens } from './utils';
19
19
  const packageName = "@atlaskit/datetime-picker";
20
- const packageVersion = "12.3.11";
20
+ const packageVersion = "12.3.13";
21
21
 
22
22
  /* eslint-disable react/no-unused-prop-types */
23
23
 
@@ -141,6 +141,8 @@ const dateTimePickerDefaultProps = {
141
141
  // Make the component a controlled component
142
142
  };
143
143
 
144
+ export const datePickerDefaultAriaLabel = 'Date';
145
+ export const timePickerDefaultAriaLabel = 'Time';
144
146
  class DateTimePicker extends React.Component {
145
147
  constructor(...args) {
146
148
  super(...args);
@@ -193,7 +195,8 @@ class DateTimePicker extends React.Component {
193
195
  dateValue: ''
194
196
  });
195
197
  });
196
- }
198
+ } // All state needs to be accessed via this function so that the state is mapped from props
199
+ // correctly to allow controlled/uncontrolled usage.
197
200
  parseValue(value, dateValue, timeValue, zoneValue) {
198
201
  if (this.props.parseValue) {
199
202
  return this.props.parseValue(value, dateValue, timeValue, zoneValue);
@@ -253,7 +256,8 @@ class DateTimePicker extends React.Component {
253
256
  times,
254
257
  timeFormat,
255
258
  locale,
256
- testId
259
+ testId,
260
+ 'aria-labelledby': ariaLabelledBy
257
261
  } = this.props;
258
262
  const {
259
263
  isFocused,
@@ -277,10 +281,12 @@ class DateTimePicker extends React.Component {
277
281
  } = timePickerSelectProps;
278
282
  const mergedDatePickerSelectProps = {
279
283
  ...datePickerSelectProps,
284
+ 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
280
285
  styles: mergeStyles(styles, datePickerStyles)
281
286
  };
282
287
  const mergedTimePickerSelectProps = {
283
288
  ...timePickerSelectProps,
289
+ 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
284
290
  styles: mergeStyles(styles, timePickerStyles)
285
291
  };
286
292
 
@@ -288,16 +294,17 @@ class DateTimePicker extends React.Component {
288
294
  // Don't use Date or TimePicker's because they can't be customised
289
295
  const isClearable = Boolean(dateValue || timeValue);
290
296
  const notFocusedOrIsDisabled = !(isFocused || isDisabled);
291
- const labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
292
297
  return jsx("div", _extends({
293
298
  css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles), bothProps.appearance === 'none' && noBgStyles]
294
299
  }, innerProps, {
300
+ role: "group",
301
+ "aria-labelledby": ariaLabelledBy,
295
302
  "data-testid": testId
296
303
  }), jsx("input", {
297
- id: labelId,
298
304
  name: name,
299
305
  type: "hidden",
300
- value: value
306
+ value: value,
307
+ "data-testid": testId && `${testId}--input`
301
308
  }), jsx("div", {
302
309
  css: datePickerContainerStyles
303
310
  }, jsx(DatePicker, _extends({}, bothProps, {
@@ -16,7 +16,10 @@ import FixedLayer from '../internal/fixed-layer';
16
16
  import parseTime from '../internal/parse-time';
17
17
  import { convertTokens } from './utils';
18
18
  const packageName = "@atlaskit/datetime-picker";
19
- const packageVersion = "12.3.11";
19
+ const packageVersion = "12.3.13";
20
+
21
+ /* eslint-disable react/no-unused-prop-types */
22
+
20
23
  const menuStyles = {
21
24
  /* Need to remove default absolute positioning as that causes issues with position fixed */
22
25
  position: 'static',
@@ -217,7 +220,6 @@ class TimePicker extends React.Component {
217
220
 
218
221
  // All state needs to be accessed via this function so that the state is mapped from props
219
222
  // correctly to allow controlled/uncontrolled usage.
220
-
221
223
  getOptions() {
222
224
  return this.props.times.map(time => {
223
225
  return {
@@ -226,6 +228,19 @@ class TimePicker extends React.Component {
226
228
  };
227
229
  });
228
230
  }
231
+
232
+ /**
233
+ * Only allow custom times if timeIsEditable prop is true
234
+ */
235
+
236
+ /**
237
+ * There are multiple props that can change how the time is formatted.
238
+ * The priority of props used is:
239
+ * 1. formatDisplayLabel
240
+ * 2. timeFormat
241
+ * 3. locale
242
+ */
243
+
229
244
  render() {
230
245
  const {
231
246
  autoFocus,
@@ -287,10 +302,10 @@ class TimePicker extends React.Component {
287
302
  "data-testid": testId && `${testId}--container`,
288
303
  onKeyDown: this.onSelectKeyDown
289
304
  }), /*#__PURE__*/React.createElement("input", {
290
- id: selectProps.inputId,
291
305
  name: name,
292
306
  type: "hidden",
293
- value: value
307
+ value: value,
308
+ "data-testid": testId && `${testId}--input`
294
309
  }), /*#__PURE__*/React.createElement(SelectComponent, _extends({
295
310
  appearance: this.props.appearance,
296
311
  autoFocus: autoFocus,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.11",
3
+ "version": "12.3.13",
4
4
  "sideEffects": false
5
5
  }
@@ -29,7 +29,7 @@ import { defaultDateFormat, EmptyComponent, padToTwo, placeholderDatetime } from
29
29
  import FixedLayer from '../internal/fixed-layer';
30
30
  import { convertTokens } from './utils';
31
31
  var packageName = "@atlaskit/datetime-picker";
32
- var packageVersion = "12.3.11";
32
+ var packageVersion = "12.3.13";
33
33
 
34
34
  /* eslint-disable react/no-unused-prop-types */
35
35
 
@@ -381,6 +381,19 @@ var DatePicker = /*#__PURE__*/function (_Component) {
381
381
 
382
382
  // All state needs to be accessed via this function so that the state is mapped from props
383
383
  // correctly to allow controlled/uncontrolled usage.
384
+ /**
385
+ * There are two props that can change how the date is parsed.
386
+ * The priority of props used is:
387
+ * 1. parseInputValue
388
+ * 2. locale
389
+ */
390
+ /**
391
+ * There are multiple props that can change how the date is formatted.
392
+ * The priority of props used is:
393
+ * 1. formatDisplayLabel
394
+ * 2. dateFormat
395
+ * 3. locale
396
+ */
384
397
  }, {
385
398
  key: "render",
386
399
  value: function render() {
@@ -450,7 +463,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
450
463
  ref: this.getContainerRef,
451
464
  "data-testid": testId && "".concat(testId, "--container")
452
465
  }), jsx("input", {
453
- id: selectProps.inputId,
454
466
  name: name,
455
467
  type: "hidden",
456
468
  value: value,
@@ -27,7 +27,7 @@ import DatePicker from './date-picker';
27
27
  import TimePicker from './time-picker';
28
28
  import { convertTokens } from './utils';
29
29
  var packageName = "@atlaskit/datetime-picker";
30
- var packageVersion = "12.3.11";
30
+ var packageVersion = "12.3.13";
31
31
 
32
32
  /* eslint-disable react/no-unused-prop-types */
33
33
 
@@ -151,6 +151,9 @@ var dateTimePickerDefaultProps = {
151
151
  // Not including a default prop for value as it will
152
152
  // Make the component a controlled component
153
153
  };
154
+
155
+ export var datePickerDefaultAriaLabel = 'Date';
156
+ export var timePickerDefaultAriaLabel = 'Time';
154
157
  var DateTimePicker = /*#__PURE__*/function (_React$Component) {
155
158
  _inherits(DateTimePicker, _React$Component);
156
159
  var _super = _createSuper(DateTimePicker);
@@ -202,7 +205,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
202
205
  }));
203
206
  });
204
207
  return _this;
205
- }
208
+ } // All state needs to be accessed via this function so that the state is mapped from props
209
+ // correctly to allow controlled/uncontrolled usage.
206
210
  _createClass(DateTimePicker, [{
207
211
  key: "parseValue",
208
212
  value: function parseValue(value, dateValue, timeValue, zoneValue) {
@@ -266,7 +270,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
266
270
  times = _this$props.times,
267
271
  timeFormat = _this$props.timeFormat,
268
272
  locale = _this$props.locale,
269
- testId = _this$props.testId;
273
+ testId = _this$props.testId,
274
+ ariaLabelledBy = _this$props['aria-labelledby'];
270
275
  var _this$getSafeState = this.getSafeState(),
271
276
  isFocused = _this$getSafeState.isFocused,
272
277
  value = _this$getSafeState.value,
@@ -285,9 +290,11 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
285
290
  var _timePickerSelectProp = timePickerSelectProps.styles,
286
291
  timePickerStyles = _timePickerSelectProp === void 0 ? {} : _timePickerSelectProp;
287
292
  var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
293
+ 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
288
294
  styles: mergeStyles(styles, datePickerStyles)
289
295
  });
290
296
  var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
297
+ 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
291
298
  styles: mergeStyles(styles, timePickerStyles)
292
299
  });
293
300
 
@@ -295,16 +302,17 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
295
302
  // Don't use Date or TimePicker's because they can't be customised
296
303
  var isClearable = Boolean(dateValue || timeValue);
297
304
  var notFocusedOrIsDisabled = !(isFocused || isDisabled);
298
- var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
299
305
  return jsx("div", _extends({
300
306
  css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles), bothProps.appearance === 'none' && noBgStyles]
301
307
  }, innerProps, {
308
+ role: "group",
309
+ "aria-labelledby": ariaLabelledBy,
302
310
  "data-testid": testId
303
311
  }), jsx("input", {
304
- id: labelId,
305
312
  name: name,
306
313
  type: "hidden",
307
- value: value
314
+ value: value,
315
+ "data-testid": testId && "".concat(testId, "--input")
308
316
  }), jsx("div", {
309
317
  css: datePickerContainerStyles
310
318
  }, jsx(DatePicker, _extends({}, bothProps, {
@@ -29,7 +29,10 @@ import FixedLayer from '../internal/fixed-layer';
29
29
  import parseTime from '../internal/parse-time';
30
30
  import { convertTokens } from './utils';
31
31
  var packageName = "@atlaskit/datetime-picker";
32
- var packageVersion = "12.3.11";
32
+ var packageVersion = "12.3.13";
33
+
34
+ /* eslint-disable react/no-unused-prop-types */
35
+
33
36
  var menuStyles = {
34
37
  /* Need to remove default absolute positioning as that causes issues with position fixed */
35
38
  position: 'static',
@@ -241,6 +244,18 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
241
244
  };
242
245
  });
243
246
  }
247
+
248
+ /**
249
+ * Only allow custom times if timeIsEditable prop is true
250
+ */
251
+
252
+ /**
253
+ * There are multiple props that can change how the time is formatted.
254
+ * The priority of props used is:
255
+ * 1. formatDisplayLabel
256
+ * 2. timeFormat
257
+ * 3. locale
258
+ */
244
259
  }, {
245
260
  key: "render",
246
261
  value: function render() {
@@ -303,10 +318,10 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
303
318
  "data-testid": testId && "".concat(testId, "--container"),
304
319
  onKeyDown: this.onSelectKeyDown
305
320
  }), /*#__PURE__*/React.createElement("input", {
306
- id: selectProps.inputId,
307
321
  name: name,
308
322
  type: "hidden",
309
- value: value
323
+ value: value,
324
+ "data-testid": testId && "".concat(testId, "--input")
310
325
  }), /*#__PURE__*/React.createElement(SelectComponent, _extends({
311
326
  appearance: this.props.appearance,
312
327
  autoFocus: autoFocus,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.11",
3
+ "version": "12.3.13",
4
4
  "sideEffects": false
5
5
  }
@@ -26,6 +26,11 @@ export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
26
26
  * Keep this in mind when needing to refer to the ID. This will be fixed in an upcoming release.
27
27
  */
28
28
  id?: string;
29
+ /**
30
+ * The ID of the element that labels the datetime picker field. This will
31
+ * label the element that groups both the datepicker and the timepicker.
32
+ */
33
+ 'aria-labelledby'?: string;
29
34
  /**
30
35
  * Props to apply to the container. *
31
36
  */
@@ -145,6 +150,8 @@ declare const dateTimePickerDefaultProps: {
145
150
  spacing: string;
146
151
  locale: string;
147
152
  };
153
+ export declare const datePickerDefaultAriaLabel = "Date";
154
+ export declare const timePickerDefaultAriaLabel = "Time";
148
155
  declare class DateTimePicker extends React.Component<DateTimePickerProps, State> {
149
156
  static defaultProps: {
150
157
  appearance: string;
@@ -194,7 +201,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
194
201
  render(): jsx.JSX.Element;
195
202
  }
196
203
  export { DateTimePicker as DateTimePickerWithoutAnalytics };
197
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "appearance" | "autoFocus" | "defaultValue" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
204
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "aria-labelledby" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "times" | "appearance" | "autoFocus" | "defaultValue" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "isInvalid" | "locale" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
198
205
  appearance: string;
199
206
  autoFocus: boolean;
200
207
  isDisabled: boolean;
@@ -214,5 +221,5 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimeP
214
221
  times: string[];
215
222
  spacing: string;
216
223
  locale: string;
217
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "autoFocus" | "defaultValue" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "value" | "isInvalid" | "dateFormat" | "locale" | "key" | "analyticsContext" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps"> & React.RefAttributes<any>>;
224
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "times" | "testId" | "appearance" | "autoFocus" | "defaultValue" | "id" | "innerProps" | "isDisabled" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "value" | "isInvalid" | "dateFormat" | "locale" | "key" | "analyticsContext" | "aria-labelledby" | "timeIsEditable" | "timeFormat" | "datePickerProps" | "timePickerProps" | "parseValue" | "datePickerSelectProps" | "timePickerSelectProps"> & React.RefAttributes<any>>;
218
225
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.11",
3
+ "version": "12.3.13",
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/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/locale": "^2.1.0",
32
32
  "@atlaskit/popper": "^5.4.0",
33
33
  "@atlaskit/select": "^16.1.0",
34
- "@atlaskit/theme": "^12.3.0",
34
+ "@atlaskit/theme": "^12.4.0",
35
35
  "@atlaskit/tokens": "^1.2.0",
36
36
  "@babel/runtime": "^7.0.0",
37
37
  "@emotion/react": "^11.7.1",
@@ -45,8 +45,8 @@
45
45
  "devDependencies": {
46
46
  "@atlaskit/button": "^16.6.0",
47
47
  "@atlaskit/docs": "*",
48
- "@atlaskit/field-base": "^15.0.5",
49
- "@atlaskit/form": "^8.8.0",
48
+ "@atlaskit/field-base": "^15.1.0",
49
+ "@atlaskit/form": "^8.10.0",
50
50
  "@atlaskit/modal-dialog": "^12.4.0",
51
51
  "@atlaskit/popup": "^1.5.0",
52
52
  "@atlaskit/range": "^7.0.0",
@@ -63,6 +63,7 @@
63
63
  "@types/testing-library__jest-dom": "^5.14.5",
64
64
  "moment": "^2.29.2",
65
65
  "react-dom": "^16.8.0",
66
+ "react-intl-next": "npm:react-intl@^5.18.1",
66
67
  "react-lorem-component": "^0.13.0",
67
68
  "react-test-renderer": "^16.8.0",
68
69
  "typescript": "4.5.5"