@atlaskit/datetime-picker 12.7.12 → 12.8.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,11 @@
1
1
  # @atlaskit/datetime-picker
2
2
 
3
+ ## 12.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`0ab32310305`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0ab32310305) - [ux] We are testing adding keyboard accessibility to the datepicker change behind a feature flag. If this fix is successful it will be available in a later release.
8
+
3
9
  ## 12.7.12
4
10
 
5
11
  ### Patch Changes
@@ -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; } } /* eslint-disable @repo/internal/react/use-noop */ /** @jsx jsx */ // eslint-disable-next-line no-restricted-imports
40
40
  var packageName = "@atlaskit/datetime-picker";
41
- var packageVersion = "12.7.12";
41
+ var packageVersion = "12.8.0";
42
42
 
43
43
  /* eslint-disable react/no-unused-prop-types */
44
44
 
@@ -82,7 +82,7 @@ var Menu = function Menu(_ref) {
82
82
  locale: selectProps.calendarLocale,
83
83
  testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
84
84
  weekStartDay: selectProps.calendarWeekStartDay,
85
- tabIndex: -1
85
+ tabIndex: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.accessible-datetime-picker_691ec') ? undefined : -1
86
86
  }))),
87
87
  testId: selectProps.testId
88
88
  });
@@ -168,15 +168,24 @@ var DatePicker = /*#__PURE__*/function (_Component) {
168
168
  });
169
169
  }
170
170
  });
171
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSelectBlur", function (event) {
171
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onContainerBlur", function (event) {
172
172
  var _this$containerRef;
173
173
  var newlyFocusedElement = event.relatedTarget;
174
+ if (!((_this$containerRef = _this.containerRef) !== null && _this$containerRef !== void 0 && _this$containerRef.contains(newlyFocusedElement))) {
175
+ _this.setState({
176
+ isOpen: false
177
+ });
178
+ }
179
+ });
180
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSelectBlur", function (event) {
181
+ var _this$containerRef2;
182
+ var newlyFocusedElement = event.relatedTarget;
174
183
  if (_this.getSafeState().clearingFromIcon) {
175
184
  // Don't close menu if blurring after the user has clicked clear
176
185
  _this.setState({
177
186
  clearingFromIcon: false
178
187
  });
179
- } else if (!((_this$containerRef = _this.containerRef) !== null && _this$containerRef !== void 0 && _this$containerRef.contains(newlyFocusedElement))) {
188
+ } else if (!((_this$containerRef2 = _this.containerRef) !== null && _this$containerRef2 !== void 0 && _this$containerRef2.contains(newlyFocusedElement))) {
180
189
  // Don't close menu if focus is staying within the date picker's
181
190
  // container. Makes keyboard accessibility of calendar possible
182
191
  _this.setState({
@@ -238,29 +247,37 @@ var DatePicker = /*#__PURE__*/function (_Component) {
238
247
  switch (keyPressed) {
239
248
  case 'arrowup':
240
249
  case 'arrowdown':
241
- if (_this.calendarRef) {
242
- event.preventDefault();
243
- var key = keyPressed === 'arrowup' ? 'up' : 'down';
244
- _this.calendarRef.navigate(key);
250
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.accessible-datetime-picker_691ec')) {
251
+ if (_this.calendarRef) {
252
+ event.preventDefault();
253
+ var key = keyPressed === 'arrowup' ? 'up' : 'down';
254
+ _this.calendarRef.navigate(key);
255
+ }
256
+ _this.setState({
257
+ isOpen: true
258
+ });
245
259
  }
246
- _this.setState({
247
- isOpen: true
248
- });
249
260
  break;
250
261
  case 'arrowleft':
251
262
  case 'arrowright':
252
- if (_this.calendarRef) {
263
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.accessible-datetime-picker_691ec') && _this.calendarRef) {
253
264
  event.preventDefault();
254
265
  var _key = keyPressed === 'arrowleft' ? 'left' : 'right';
255
266
  _this.calendarRef.navigate(_key);
256
267
  }
257
268
  break;
258
269
  case 'escape':
259
- case 'tab':
260
270
  _this.setState({
261
271
  isOpen: false
262
272
  });
263
273
  break;
274
+ case 'tab':
275
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.accessible-datetime-picker_691ec')) {
276
+ _this.setState({
277
+ isOpen: false
278
+ });
279
+ }
280
+ break;
264
281
  case 'backspace':
265
282
  case 'delete':
266
283
  {
@@ -485,6 +502,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
485
502
  // (DSP-11587)
486
503
  (0, _react2.jsx)("div", (0, _extends2.default)({}, innerProps, {
487
504
  role: "presentation",
505
+ onBlur: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.accessible-datetime-picker_691ec') ? this.onContainerBlur : undefined,
488
506
  onClick: this.onInputClick,
489
507
  onInput: this.onTextInput,
490
508
  onKeyDown: this.onInputKeyDown,
@@ -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.7.12";
34
+ var packageVersion = "12.8.0";
35
35
 
36
36
  /* eslint-disable react/no-unused-prop-types */
37
37
 
@@ -39,7 +39,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
39
39
  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); }; }
40
40
  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; } }
41
41
  var packageName = "@atlaskit/datetime-picker";
42
- var packageVersion = "12.7.12";
42
+ var packageVersion = "12.8.0";
43
43
 
44
44
  /* eslint-disable react/no-unused-prop-types */
45
45
 
@@ -20,7 +20,7 @@ import FixedLayer from '../internal/fixed-layer';
20
20
  import { makeSingleValue } from '../internal/single-value';
21
21
  import { convertTokens } from './utils';
22
22
  const packageName = "@atlaskit/datetime-picker";
23
- const packageVersion = "12.7.12";
23
+ const packageVersion = "12.8.0";
24
24
 
25
25
  /* eslint-disable react/no-unused-prop-types */
26
26
 
@@ -64,7 +64,7 @@ const Menu = ({
64
64
  locale: selectProps.calendarLocale,
65
65
  testId: selectProps.testId && `${selectProps.testId}--calendar`,
66
66
  weekStartDay: selectProps.calendarWeekStartDay,
67
- tabIndex: -1
67
+ tabIndex: getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec') ? undefined : -1
68
68
  }))),
69
69
  testId: selectProps.testId
70
70
  });
@@ -146,15 +146,24 @@ class DatePicker extends Component {
146
146
  });
147
147
  }
148
148
  });
149
- _defineProperty(this, "onSelectBlur", event => {
149
+ _defineProperty(this, "onContainerBlur", event => {
150
150
  var _this$containerRef;
151
151
  const newlyFocusedElement = event.relatedTarget;
152
+ if (!((_this$containerRef = this.containerRef) !== null && _this$containerRef !== void 0 && _this$containerRef.contains(newlyFocusedElement))) {
153
+ this.setState({
154
+ isOpen: false
155
+ });
156
+ }
157
+ });
158
+ _defineProperty(this, "onSelectBlur", event => {
159
+ var _this$containerRef2;
160
+ const newlyFocusedElement = event.relatedTarget;
152
161
  if (this.getSafeState().clearingFromIcon) {
153
162
  // Don't close menu if blurring after the user has clicked clear
154
163
  this.setState({
155
164
  clearingFromIcon: false
156
165
  });
157
- } else if (!((_this$containerRef = this.containerRef) !== null && _this$containerRef !== void 0 && _this$containerRef.contains(newlyFocusedElement))) {
166
+ } else if (!((_this$containerRef2 = this.containerRef) !== null && _this$containerRef2 !== void 0 && _this$containerRef2.contains(newlyFocusedElement))) {
158
167
  // Don't close menu if focus is staying within the date picker's
159
168
  // container. Makes keyboard accessibility of calendar possible
160
169
  this.setState({
@@ -218,29 +227,37 @@ class DatePicker extends Component {
218
227
  switch (keyPressed) {
219
228
  case 'arrowup':
220
229
  case 'arrowdown':
221
- if (this.calendarRef) {
222
- event.preventDefault();
223
- const key = keyPressed === 'arrowup' ? 'up' : 'down';
224
- this.calendarRef.navigate(key);
230
+ if (!getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec')) {
231
+ if (this.calendarRef) {
232
+ event.preventDefault();
233
+ const key = keyPressed === 'arrowup' ? 'up' : 'down';
234
+ this.calendarRef.navigate(key);
235
+ }
236
+ this.setState({
237
+ isOpen: true
238
+ });
225
239
  }
226
- this.setState({
227
- isOpen: true
228
- });
229
240
  break;
230
241
  case 'arrowleft':
231
242
  case 'arrowright':
232
- if (this.calendarRef) {
243
+ if (!getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec') && this.calendarRef) {
233
244
  event.preventDefault();
234
245
  const key = keyPressed === 'arrowleft' ? 'left' : 'right';
235
246
  this.calendarRef.navigate(key);
236
247
  }
237
248
  break;
238
249
  case 'escape':
239
- case 'tab':
240
250
  this.setState({
241
251
  isOpen: false
242
252
  });
243
253
  break;
254
+ case 'tab':
255
+ if (!getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec')) {
256
+ this.setState({
257
+ isOpen: false
258
+ });
259
+ }
260
+ break;
244
261
  case 'backspace':
245
262
  case 'delete':
246
263
  {
@@ -475,6 +492,7 @@ class DatePicker extends Component {
475
492
  // (DSP-11587)
476
493
  jsx("div", _extends({}, innerProps, {
477
494
  role: "presentation",
495
+ onBlur: getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec') ? this.onContainerBlur : undefined,
478
496
  onClick: this.onInputClick,
479
497
  onInput: this.onTextInput,
480
498
  onKeyDown: this.onInputKeyDown,
@@ -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.7.12";
20
+ const packageVersion = "12.8.0";
21
21
 
22
22
  /* eslint-disable react/no-unused-prop-types */
23
23
 
@@ -17,7 +17,7 @@ import parseTime from '../internal/parse-time';
17
17
  import { makeSingleValue } from '../internal/single-value';
18
18
  import { convertTokens } from './utils';
19
19
  const packageName = "@atlaskit/datetime-picker";
20
- const packageVersion = "12.7.12";
20
+ const packageVersion = "12.8.0";
21
21
 
22
22
  /* eslint-disable react/no-unused-prop-types */
23
23
 
@@ -31,7 +31,7 @@ import FixedLayer from '../internal/fixed-layer';
31
31
  import { makeSingleValue } from '../internal/single-value';
32
32
  import { convertTokens } from './utils';
33
33
  var packageName = "@atlaskit/datetime-picker";
34
- var packageVersion = "12.7.12";
34
+ var packageVersion = "12.8.0";
35
35
 
36
36
  /* eslint-disable react/no-unused-prop-types */
37
37
 
@@ -75,7 +75,7 @@ var Menu = function Menu(_ref) {
75
75
  locale: selectProps.calendarLocale,
76
76
  testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
77
77
  weekStartDay: selectProps.calendarWeekStartDay,
78
- tabIndex: -1
78
+ tabIndex: getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec') ? undefined : -1
79
79
  }))),
80
80
  testId: selectProps.testId
81
81
  });
@@ -161,15 +161,24 @@ var DatePicker = /*#__PURE__*/function (_Component) {
161
161
  });
162
162
  }
163
163
  });
164
- _defineProperty(_assertThisInitialized(_this), "onSelectBlur", function (event) {
164
+ _defineProperty(_assertThisInitialized(_this), "onContainerBlur", function (event) {
165
165
  var _this$containerRef;
166
166
  var newlyFocusedElement = event.relatedTarget;
167
+ if (!((_this$containerRef = _this.containerRef) !== null && _this$containerRef !== void 0 && _this$containerRef.contains(newlyFocusedElement))) {
168
+ _this.setState({
169
+ isOpen: false
170
+ });
171
+ }
172
+ });
173
+ _defineProperty(_assertThisInitialized(_this), "onSelectBlur", function (event) {
174
+ var _this$containerRef2;
175
+ var newlyFocusedElement = event.relatedTarget;
167
176
  if (_this.getSafeState().clearingFromIcon) {
168
177
  // Don't close menu if blurring after the user has clicked clear
169
178
  _this.setState({
170
179
  clearingFromIcon: false
171
180
  });
172
- } else if (!((_this$containerRef = _this.containerRef) !== null && _this$containerRef !== void 0 && _this$containerRef.contains(newlyFocusedElement))) {
181
+ } else if (!((_this$containerRef2 = _this.containerRef) !== null && _this$containerRef2 !== void 0 && _this$containerRef2.contains(newlyFocusedElement))) {
173
182
  // Don't close menu if focus is staying within the date picker's
174
183
  // container. Makes keyboard accessibility of calendar possible
175
184
  _this.setState({
@@ -231,29 +240,37 @@ var DatePicker = /*#__PURE__*/function (_Component) {
231
240
  switch (keyPressed) {
232
241
  case 'arrowup':
233
242
  case 'arrowdown':
234
- if (_this.calendarRef) {
235
- event.preventDefault();
236
- var key = keyPressed === 'arrowup' ? 'up' : 'down';
237
- _this.calendarRef.navigate(key);
243
+ if (!getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec')) {
244
+ if (_this.calendarRef) {
245
+ event.preventDefault();
246
+ var key = keyPressed === 'arrowup' ? 'up' : 'down';
247
+ _this.calendarRef.navigate(key);
248
+ }
249
+ _this.setState({
250
+ isOpen: true
251
+ });
238
252
  }
239
- _this.setState({
240
- isOpen: true
241
- });
242
253
  break;
243
254
  case 'arrowleft':
244
255
  case 'arrowright':
245
- if (_this.calendarRef) {
256
+ if (!getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec') && _this.calendarRef) {
246
257
  event.preventDefault();
247
258
  var _key = keyPressed === 'arrowleft' ? 'left' : 'right';
248
259
  _this.calendarRef.navigate(_key);
249
260
  }
250
261
  break;
251
262
  case 'escape':
252
- case 'tab':
253
263
  _this.setState({
254
264
  isOpen: false
255
265
  });
256
266
  break;
267
+ case 'tab':
268
+ if (!getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec')) {
269
+ _this.setState({
270
+ isOpen: false
271
+ });
272
+ }
273
+ break;
257
274
  case 'backspace':
258
275
  case 'delete':
259
276
  {
@@ -478,6 +495,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
478
495
  // (DSP-11587)
479
496
  jsx("div", _extends({}, innerProps, {
480
497
  role: "presentation",
498
+ onBlur: getBooleanFF('platform.design-system-team.accessible-datetime-picker_691ec') ? this.onContainerBlur : undefined,
481
499
  onClick: this.onInputClick,
482
500
  onInput: this.onTextInput,
483
501
  onKeyDown: this.onInputKeyDown,
@@ -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.7.12";
30
+ var packageVersion = "12.8.0";
31
31
 
32
32
  /* eslint-disable react/no-unused-prop-types */
33
33
 
@@ -30,7 +30,7 @@ import parseTime from '../internal/parse-time';
30
30
  import { makeSingleValue } from '../internal/single-value';
31
31
  import { convertTokens } from './utils';
32
32
  var packageName = "@atlaskit/datetime-picker";
33
- var packageVersion = "12.7.12";
33
+ var packageVersion = "12.8.0";
34
34
 
35
35
  /* eslint-disable react/no-unused-prop-types */
36
36
 
@@ -232,6 +232,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
232
232
  iso: string;
233
233
  }) => void;
234
234
  onInputClick: () => void;
235
+ onContainerBlur: (event: React.FocusEvent<HTMLElement>) => void;
235
236
  onSelectBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
236
237
  onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
237
238
  onTextInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
@@ -232,6 +232,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
232
232
  iso: string;
233
233
  }) => void;
234
234
  onInputClick: () => void;
235
+ onContainerBlur: (event: React.FocusEvent<HTMLElement>) => void;
235
236
  onSelectBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
236
237
  onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
237
238
  onTextInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "12.7.12",
3
+ "version": "12.8.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/"
@@ -101,6 +101,9 @@
101
101
  },
102
102
  "platform.design-system-team.date-picker-input-a11y-fix_cbbxs": {
103
103
  "type": "boolean"
104
+ },
105
+ "platform.design-system-team.accessible-datetime-picker_691ec": {
106
+ "type": "boolean"
104
107
  }
105
108
  },
106
109
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",