@atlaskit/datetime-picker 12.3.12 → 12.4.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,17 @@
1
1
  # @atlaskit/datetime-picker
2
2
 
3
+ ## 12.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e976f3cebd0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e976f3cebd0) - Remove excessive `aria-labelledby` prop, remove incorret documentation.
8
+
9
+ ## 12.3.13
10
+
11
+ ### Patch Changes
12
+
13
+ - [`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.
14
+
3
15
  ## 12.3.12
4
16
 
5
17
  ### Patch Changes
@@ -36,7 +36,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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
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.12";
39
+ var packageVersion = "12.4.0";
40
40
 
41
41
  /* eslint-disable react/no-unused-prop-types */
42
42
 
@@ -119,6 +119,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
119
119
  _this = _super.call(this, props);
120
120
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "calendarRef", null);
121
121
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "containerRef", null);
122
+ // All state needs to be accessed via this function so that the state is mapped from props
123
+ // correctly to allow controlled/uncontrolled usage.
122
124
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeState", function () {
123
125
  return _objectSpread(_objectSpread(_objectSpread({}, _this.state), (0, _pick.default)(_this.props, ['value', 'isOpen'])), (0, _pick.default)(_this.props.selectProps, ['inputValue']));
124
126
  });
@@ -333,6 +335,12 @@ var DatePicker = /*#__PURE__*/function (_Component) {
333
335
  _this.forceUpdate();
334
336
  }
335
337
  });
338
+ /**
339
+ * There are two props that can change how the date is parsed.
340
+ * The priority of props used is:
341
+ * 1. parseInputValue
342
+ * 2. locale
343
+ */
336
344
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "parseDate", function (date) {
337
345
  var _this$props = _this.props,
338
346
  parseInputValue = _this$props.parseInputValue,
@@ -344,6 +352,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
344
352
  l10n = _this$getSafeState4.l10n;
345
353
  return l10n.parseDate(date);
346
354
  });
355
+ /**
356
+ * There are multiple props that can change how the date is formatted.
357
+ * The priority of props used is:
358
+ * 1. formatDisplayLabel
359
+ * 2. dateFormat
360
+ * 3. locale
361
+ */
347
362
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatDate", function (value) {
348
363
  var _this$props2 = _this.props,
349
364
  formatDisplayLabel = _this$props2.formatDisplayLabel,
@@ -385,22 +400,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
385
400
  });
386
401
  }
387
402
  }
388
-
389
- // All state needs to be accessed via this function so that the state is mapped from props
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
- */
404
403
  }, {
405
404
  key: "render",
406
405
  value: function render() {
@@ -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"));
@@ -31,7 +31,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
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
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.12";
34
+ var packageVersion = "12.4.0";
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);
@@ -173,6 +178,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
173
178
  value: _this.props.defaultValue,
174
179
  zoneValue: ''
175
180
  });
181
+ // All state needs to be accessed via this function so that the state is mapped from props
182
+ // correctly to allow controlled/uncontrolled usage.
176
183
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeState", function () {
177
184
  var mappedState = _objectSpread(_objectSpread({}, _this.state), (0, _pick.default)(_this.props, ['value']));
178
185
  return _objectSpread(_objectSpread({}, mappedState), _this.parseValue(mappedState.value, mappedState.dateValue, mappedState.timeValue, mappedState.zoneValue));
@@ -206,8 +213,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
206
213
  }));
207
214
  });
208
215
  return _this;
209
- } // All state needs to be accessed via this function so that the state is mapped from props
210
- // correctly to allow controlled/uncontrolled usage.
216
+ }
211
217
  (0, _createClass2.default)(DateTimePicker, [{
212
218
  key: "parseValue",
213
219
  value: function parseValue(value, dateValue, timeValue, zoneValue) {
@@ -290,9 +296,11 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
290
296
  var _timePickerSelectProp = timePickerSelectProps.styles,
291
297
  timePickerStyles = _timePickerSelectProp === void 0 ? {} : _timePickerSelectProp;
292
298
  var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
299
+ 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
293
300
  styles: (0, _select.mergeStyles)(styles, datePickerStyles)
294
301
  });
295
302
  var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
303
+ 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
296
304
  styles: (0, _select.mergeStyles)(styles, timePickerStyles)
297
305
  });
298
306
 
@@ -38,7 +38,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
38
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); }; }
39
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; } }
40
40
  var packageName = "@atlaskit/datetime-picker";
41
- var packageVersion = "12.3.12";
41
+ var packageVersion = "12.4.0";
42
42
 
43
43
  /* eslint-disable react/no-unused-prop-types */
44
44
 
@@ -105,6 +105,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
105
105
  isFocused: false,
106
106
  l10n: (0, _locale.createLocalizationProvider)(_this.props.locale)
107
107
  });
108
+ // All state needs to be accessed via this function so that the state is mapped from props
109
+ // correctly to allow controlled/uncontrolled usage.
108
110
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSafeState", function () {
109
111
  return _objectSpread(_objectSpread({}, _this.state), (0, _pick.default)(_this.props, ['value', 'isOpen']));
110
112
  });
@@ -122,6 +124,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
122
124
  _this.setState(changedState);
123
125
  _this.props.onChange(value);
124
126
  });
127
+ /**
128
+ * Only allow custom times if timeIsEditable prop is true
129
+ */
125
130
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onCreateOption", function (inputValue) {
126
131
  if (_this.props.timeIsEditable) {
127
132
  var _this$props = _this.props,
@@ -198,6 +203,13 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
198
203
  });
199
204
  }
200
205
  });
206
+ /**
207
+ * There are multiple props that can change how the time is formatted.
208
+ * The priority of props used is:
209
+ * 1. formatDisplayLabel
210
+ * 2. timeFormat
211
+ * 3. locale
212
+ */
201
213
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatTime", function (time) {
202
214
  var _this$props2 = _this.props,
203
215
  formatDisplayLabel = _this$props2.formatDisplayLabel,
@@ -239,9 +251,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
239
251
  });
240
252
  }
241
253
  }
242
-
243
- // All state needs to be accessed via this function so that the state is mapped from props
244
- // correctly to allow controlled/uncontrolled usage.
245
254
  }, {
246
255
  key: "getOptions",
247
256
  value: function getOptions() {
@@ -253,18 +262,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
253
262
  };
254
263
  });
255
264
  }
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
- */
268
265
  }, {
269
266
  key: "render",
270
267
  value: function render() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.12",
3
+ "version": "12.4.0",
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.12";
21
+ const packageVersion = "12.4.0";
22
22
 
23
23
  /* eslint-disable react/no-unused-prop-types */
24
24
 
@@ -95,6 +95,8 @@ class DatePicker extends Component {
95
95
  super(props);
96
96
  _defineProperty(this, "calendarRef", null);
97
97
  _defineProperty(this, "containerRef", null);
98
+ // All state needs to be accessed via this function so that the state is mapped from props
99
+ // correctly to allow controlled/uncontrolled usage.
98
100
  _defineProperty(this, "getSafeState", () => {
99
101
  return {
100
102
  ...this.state,
@@ -317,6 +319,12 @@ class DatePicker extends Component {
317
319
  this.forceUpdate();
318
320
  }
319
321
  });
322
+ /**
323
+ * There are two props that can change how the date is parsed.
324
+ * The priority of props used is:
325
+ * 1. parseInputValue
326
+ * 2. locale
327
+ */
320
328
  _defineProperty(this, "parseDate", date => {
321
329
  const {
322
330
  parseInputValue,
@@ -330,6 +338,13 @@ class DatePicker extends Component {
330
338
  } = this.getSafeState();
331
339
  return l10n.parseDate(date);
332
340
  });
341
+ /**
342
+ * There are multiple props that can change how the date is formatted.
343
+ * The priority of props used is:
344
+ * 1. formatDisplayLabel
345
+ * 2. dateFormat
346
+ * 3. locale
347
+ */
333
348
  _defineProperty(this, "formatDate", value => {
334
349
  const {
335
350
  formatDisplayLabel,
@@ -373,22 +388,6 @@ class DatePicker extends Component {
373
388
  });
374
389
  }
375
390
  }
376
-
377
- // All state needs to be accessed via this function so that the state is mapped from props
378
- // correctly to allow controlled/uncontrolled usage.
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
- */
392
391
  render() {
393
392
  const {
394
393
  appearance,
@@ -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.12";
20
+ const packageVersion = "12.4.0";
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);
@@ -152,6 +154,8 @@ class DateTimePicker extends React.Component {
152
154
  value: this.props.defaultValue,
153
155
  zoneValue: ''
154
156
  });
157
+ // All state needs to be accessed via this function so that the state is mapped from props
158
+ // correctly to allow controlled/uncontrolled usage.
155
159
  _defineProperty(this, "getSafeState", () => {
156
160
  const mappedState = {
157
161
  ...this.state,
@@ -193,8 +197,7 @@ class DateTimePicker extends React.Component {
193
197
  dateValue: ''
194
198
  });
195
199
  });
196
- } // All state needs to be accessed via this function so that the state is mapped from props
197
- // correctly to allow controlled/uncontrolled usage.
200
+ }
198
201
  parseValue(value, dateValue, timeValue, zoneValue) {
199
202
  if (this.props.parseValue) {
200
203
  return this.props.parseValue(value, dateValue, timeValue, zoneValue);
@@ -278,10 +281,12 @@ class DateTimePicker extends React.Component {
278
281
  } = timePickerSelectProps;
279
282
  const mergedDatePickerSelectProps = {
280
283
  ...datePickerSelectProps,
284
+ 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
281
285
  styles: mergeStyles(styles, datePickerStyles)
282
286
  };
283
287
  const mergedTimePickerSelectProps = {
284
288
  ...timePickerSelectProps,
289
+ 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
285
290
  styles: mergeStyles(styles, timePickerStyles)
286
291
  };
287
292
 
@@ -16,7 +16,7 @@ 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.12";
19
+ const packageVersion = "12.4.0";
20
20
 
21
21
  /* eslint-disable react/no-unused-prop-types */
22
22
 
@@ -74,6 +74,8 @@ class TimePicker extends React.Component {
74
74
  isFocused: false,
75
75
  l10n: createLocalizationProvider(this.props.locale)
76
76
  });
77
+ // All state needs to be accessed via this function so that the state is mapped from props
78
+ // correctly to allow controlled/uncontrolled usage.
77
79
  _defineProperty(this, "getSafeState", () => {
78
80
  return {
79
81
  ...this.state,
@@ -95,6 +97,9 @@ class TimePicker extends React.Component {
95
97
  this.setState(changedState);
96
98
  this.props.onChange(value);
97
99
  });
100
+ /**
101
+ * Only allow custom times if timeIsEditable prop is true
102
+ */
98
103
  _defineProperty(this, "onCreateOption", inputValue => {
99
104
  if (this.props.timeIsEditable) {
100
105
  const {
@@ -174,6 +179,13 @@ class TimePicker extends React.Component {
174
179
  });
175
180
  }
176
181
  });
182
+ /**
183
+ * There are multiple props that can change how the time is formatted.
184
+ * The priority of props used is:
185
+ * 1. formatDisplayLabel
186
+ * 2. timeFormat
187
+ * 3. locale
188
+ */
177
189
  _defineProperty(this, "formatTime", time => {
178
190
  const {
179
191
  formatDisplayLabel,
@@ -217,9 +229,6 @@ class TimePicker extends React.Component {
217
229
  });
218
230
  }
219
231
  }
220
-
221
- // All state needs to be accessed via this function so that the state is mapped from props
222
- // correctly to allow controlled/uncontrolled usage.
223
232
  getOptions() {
224
233
  return this.props.times.map(time => {
225
234
  return {
@@ -228,19 +237,6 @@ class TimePicker extends React.Component {
228
237
  };
229
238
  });
230
239
  }
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
-
244
240
  render() {
245
241
  const {
246
242
  autoFocus,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.12",
3
+ "version": "12.4.0",
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.12";
32
+ var packageVersion = "12.4.0";
33
33
 
34
34
  /* eslint-disable react/no-unused-prop-types */
35
35
 
@@ -112,6 +112,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
112
112
  _this = _super.call(this, props);
113
113
  _defineProperty(_assertThisInitialized(_this), "calendarRef", null);
114
114
  _defineProperty(_assertThisInitialized(_this), "containerRef", null);
115
+ // All state needs to be accessed via this function so that the state is mapped from props
116
+ // correctly to allow controlled/uncontrolled usage.
115
117
  _defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
116
118
  return _objectSpread(_objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value', 'isOpen'])), pick(_this.props.selectProps, ['inputValue']));
117
119
  });
@@ -326,6 +328,12 @@ var DatePicker = /*#__PURE__*/function (_Component) {
326
328
  _this.forceUpdate();
327
329
  }
328
330
  });
331
+ /**
332
+ * There are two props that can change how the date is parsed.
333
+ * The priority of props used is:
334
+ * 1. parseInputValue
335
+ * 2. locale
336
+ */
329
337
  _defineProperty(_assertThisInitialized(_this), "parseDate", function (date) {
330
338
  var _this$props = _this.props,
331
339
  parseInputValue = _this$props.parseInputValue,
@@ -337,6 +345,13 @@ var DatePicker = /*#__PURE__*/function (_Component) {
337
345
  l10n = _this$getSafeState4.l10n;
338
346
  return l10n.parseDate(date);
339
347
  });
348
+ /**
349
+ * There are multiple props that can change how the date is formatted.
350
+ * The priority of props used is:
351
+ * 1. formatDisplayLabel
352
+ * 2. dateFormat
353
+ * 3. locale
354
+ */
340
355
  _defineProperty(_assertThisInitialized(_this), "formatDate", function (value) {
341
356
  var _this$props2 = _this.props,
342
357
  formatDisplayLabel = _this$props2.formatDisplayLabel,
@@ -378,22 +393,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
378
393
  });
379
394
  }
380
395
  }
381
-
382
- // All state needs to be accessed via this function so that the state is mapped from props
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
- */
397
396
  }, {
398
397
  key: "render",
399
398
  value: function render() {
@@ -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.12";
30
+ var packageVersion = "12.4.0";
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);
@@ -169,6 +172,8 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
169
172
  value: _this.props.defaultValue,
170
173
  zoneValue: ''
171
174
  });
175
+ // All state needs to be accessed via this function so that the state is mapped from props
176
+ // correctly to allow controlled/uncontrolled usage.
172
177
  _defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
173
178
  var mappedState = _objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value']));
174
179
  return _objectSpread(_objectSpread({}, mappedState), _this.parseValue(mappedState.value, mappedState.dateValue, mappedState.timeValue, mappedState.zoneValue));
@@ -202,8 +207,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
202
207
  }));
203
208
  });
204
209
  return _this;
205
- } // All state needs to be accessed via this function so that the state is mapped from props
206
- // correctly to allow controlled/uncontrolled usage.
210
+ }
207
211
  _createClass(DateTimePicker, [{
208
212
  key: "parseValue",
209
213
  value: function parseValue(value, dateValue, timeValue, zoneValue) {
@@ -286,9 +290,11 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
286
290
  var _timePickerSelectProp = timePickerSelectProps.styles,
287
291
  timePickerStyles = _timePickerSelectProp === void 0 ? {} : _timePickerSelectProp;
288
292
  var mergedDatePickerSelectProps = _objectSpread(_objectSpread({}, datePickerSelectProps), {}, {
293
+ 'aria-label': datePickerSelectProps['aria-label'] || datePickerDefaultAriaLabel,
289
294
  styles: mergeStyles(styles, datePickerStyles)
290
295
  });
291
296
  var mergedTimePickerSelectProps = _objectSpread(_objectSpread({}, timePickerSelectProps), {}, {
297
+ 'aria-label': timePickerSelectProps['aria-label'] || timePickerDefaultAriaLabel,
292
298
  styles: mergeStyles(styles, timePickerStyles)
293
299
  });
294
300
 
@@ -29,7 +29,7 @@ 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.12";
32
+ var packageVersion = "12.4.0";
33
33
 
34
34
  /* eslint-disable react/no-unused-prop-types */
35
35
 
@@ -96,6 +96,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
96
96
  isFocused: false,
97
97
  l10n: createLocalizationProvider(_this.props.locale)
98
98
  });
99
+ // All state needs to be accessed via this function so that the state is mapped from props
100
+ // correctly to allow controlled/uncontrolled usage.
99
101
  _defineProperty(_assertThisInitialized(_this), "getSafeState", function () {
100
102
  return _objectSpread(_objectSpread({}, _this.state), pick(_this.props, ['value', 'isOpen']));
101
103
  });
@@ -113,6 +115,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
113
115
  _this.setState(changedState);
114
116
  _this.props.onChange(value);
115
117
  });
118
+ /**
119
+ * Only allow custom times if timeIsEditable prop is true
120
+ */
116
121
  _defineProperty(_assertThisInitialized(_this), "onCreateOption", function (inputValue) {
117
122
  if (_this.props.timeIsEditable) {
118
123
  var _this$props = _this.props,
@@ -189,6 +194,13 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
189
194
  });
190
195
  }
191
196
  });
197
+ /**
198
+ * There are multiple props that can change how the time is formatted.
199
+ * The priority of props used is:
200
+ * 1. formatDisplayLabel
201
+ * 2. timeFormat
202
+ * 3. locale
203
+ */
192
204
  _defineProperty(_assertThisInitialized(_this), "formatTime", function (time) {
193
205
  var _this$props2 = _this.props,
194
206
  formatDisplayLabel = _this$props2.formatDisplayLabel,
@@ -230,9 +242,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
230
242
  });
231
243
  }
232
244
  }
233
-
234
- // All state needs to be accessed via this function so that the state is mapped from props
235
- // correctly to allow controlled/uncontrolled usage.
236
245
  }, {
237
246
  key: "getOptions",
238
247
  value: function getOptions() {
@@ -244,18 +253,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
244
253
  };
245
254
  });
246
255
  }
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
- */
259
256
  }, {
260
257
  key: "render",
261
258
  value: function render() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.12",
3
+ "version": "12.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -145,6 +145,8 @@ declare const dateTimePickerDefaultProps: {
145
145
  spacing: string;
146
146
  locale: string;
147
147
  };
148
+ export declare const datePickerDefaultAriaLabel = "Date";
149
+ export declare const timePickerDefaultAriaLabel = "Time";
148
150
  declare class DateTimePicker extends React.Component<DateTimePickerProps, State> {
149
151
  static defaultProps: {
150
152
  appearance: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.3.12",
3
+ "version": "12.4.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/"
@@ -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.9.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",