@atlaskit/datetime-picker 12.7.11 → 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 +12 -0
- package/dist/cjs/components/date-picker.js +31 -13
- package/dist/cjs/components/date-time-picker.js +2 -4
- package/dist/cjs/components/time-picker.js +37 -41
- package/dist/es2019/components/date-picker.js +31 -13
- package/dist/es2019/components/date-time-picker.js +2 -4
- package/dist/es2019/components/time-picker.js +37 -41
- package/dist/esm/components/date-picker.js +31 -13
- package/dist/esm/components/date-time-picker.js +2 -4
- package/dist/esm/components/time-picker.js +37 -41
- package/dist/types/components/date-picker.d.ts +1 -0
- package/dist/types-ts4.5/components/date-picker.d.ts +1 -0
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
9
|
+
## 12.7.12
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`5fae4d61ff7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5fae4d61ff7) - Move event handlers to time picker input
|
|
14
|
+
|
|
3
15
|
## 12.7.11
|
|
4
16
|
|
|
5
17
|
### 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.
|
|
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), "
|
|
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$
|
|
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 (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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.
|
|
34
|
+
var packageVersion = "12.8.0";
|
|
35
35
|
|
|
36
36
|
/* eslint-disable react/no-unused-prop-types */
|
|
37
37
|
|
|
@@ -341,9 +341,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
341
341
|
timeFormat: timeFormat,
|
|
342
342
|
locale: locale,
|
|
343
343
|
testId: testId && "".concat(testId, "--timepicker")
|
|
344
|
-
}, timePickerProps))), isClearable && !isDisabled ?
|
|
345
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
346
|
-
(0, _react2.jsx)("button", {
|
|
344
|
+
}, timePickerProps))), isClearable && !isDisabled ? (0, _react2.jsx)("button", {
|
|
347
345
|
css: iconContainerStyles,
|
|
348
346
|
onClick: this.onClear,
|
|
349
347
|
"data-testid": testId && "".concat(testId, "--icon--container"),
|
|
@@ -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.
|
|
42
|
+
var packageVersion = "12.8.0";
|
|
43
43
|
|
|
44
44
|
/* eslint-disable react/no-unused-prop-types */
|
|
45
45
|
|
|
@@ -321,46 +321,42 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
|
-
return (
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
isInvalid: isInvalid,
|
|
361
|
-
testId: testId
|
|
362
|
-
}, otherSelectProps)))
|
|
363
|
-
);
|
|
324
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, innerProps, {
|
|
325
|
+
ref: this.setContainerRef,
|
|
326
|
+
"data-testid": testId && "".concat(testId, "--container")
|
|
327
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
328
|
+
name: name,
|
|
329
|
+
type: "hidden",
|
|
330
|
+
value: value,
|
|
331
|
+
"data-testid": testId && "".concat(testId, "--input"),
|
|
332
|
+
onKeyDown: this.onSelectKeyDown
|
|
333
|
+
}), /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
|
|
334
|
+
appearance: this.props.appearance,
|
|
335
|
+
autoFocus: autoFocus,
|
|
336
|
+
components: selectComponents,
|
|
337
|
+
instanceId: id,
|
|
338
|
+
isClearable: true,
|
|
339
|
+
isDisabled: isDisabled,
|
|
340
|
+
menuIsOpen: isOpen && !isDisabled,
|
|
341
|
+
menuPlacement: "auto",
|
|
342
|
+
openMenuOnFocus: true,
|
|
343
|
+
onBlur: this.onBlur,
|
|
344
|
+
onCreateOption: this.onCreateOption,
|
|
345
|
+
onChange: this.onChange,
|
|
346
|
+
options: this.getOptions(),
|
|
347
|
+
onFocus: this.onFocus,
|
|
348
|
+
onMenuOpen: this.onMenuOpen,
|
|
349
|
+
onMenuClose: this.onMenuClose,
|
|
350
|
+
placeholder: this.getPlaceholder(),
|
|
351
|
+
styles: mergedStyles,
|
|
352
|
+
value: labelAndValue,
|
|
353
|
+
spacing: spacing
|
|
354
|
+
// @ts-ignore caused by prop not part of @atlaskit/select
|
|
355
|
+
,
|
|
356
|
+
fixedLayerRef: this.containerRef,
|
|
357
|
+
isInvalid: isInvalid,
|
|
358
|
+
testId: testId
|
|
359
|
+
}, otherSelectProps)));
|
|
364
360
|
}
|
|
365
361
|
}]);
|
|
366
362
|
return TimePicker;
|
|
@@ -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.
|
|
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, "
|
|
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$
|
|
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 (
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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.
|
|
20
|
+
const packageVersion = "12.8.0";
|
|
21
21
|
|
|
22
22
|
/* eslint-disable react/no-unused-prop-types */
|
|
23
23
|
|
|
@@ -327,9 +327,7 @@ class DateTimePicker extends React.Component {
|
|
|
327
327
|
timeFormat: timeFormat,
|
|
328
328
|
locale: locale,
|
|
329
329
|
testId: testId && `${testId}--timepicker`
|
|
330
|
-
}, timePickerProps))), isClearable && !isDisabled ?
|
|
331
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
332
|
-
jsx("button", {
|
|
330
|
+
}, timePickerProps))), isClearable && !isDisabled ? jsx("button", {
|
|
333
331
|
css: iconContainerStyles,
|
|
334
332
|
onClick: this.onClear,
|
|
335
333
|
"data-testid": testId && `${testId}--icon--container`,
|
|
@@ -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.
|
|
20
|
+
const packageVersion = "12.8.0";
|
|
21
21
|
|
|
22
22
|
/* eslint-disable react/no-unused-prop-types */
|
|
23
23
|
|
|
@@ -295,46 +295,42 @@ class TimePicker extends React.Component {
|
|
|
295
295
|
paddingRight: renderIconContainer ? gridSize() - ICON_PADDING : 0
|
|
296
296
|
})
|
|
297
297
|
});
|
|
298
|
-
return (
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
isInvalid: isInvalid,
|
|
335
|
-
testId: testId
|
|
336
|
-
}, otherSelectProps)))
|
|
337
|
-
);
|
|
298
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
|
|
299
|
+
ref: this.setContainerRef,
|
|
300
|
+
"data-testid": testId && `${testId}--container`
|
|
301
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
302
|
+
name: name,
|
|
303
|
+
type: "hidden",
|
|
304
|
+
value: value,
|
|
305
|
+
"data-testid": testId && `${testId}--input`,
|
|
306
|
+
onKeyDown: this.onSelectKeyDown
|
|
307
|
+
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
308
|
+
appearance: this.props.appearance,
|
|
309
|
+
autoFocus: autoFocus,
|
|
310
|
+
components: selectComponents,
|
|
311
|
+
instanceId: id,
|
|
312
|
+
isClearable: true,
|
|
313
|
+
isDisabled: isDisabled,
|
|
314
|
+
menuIsOpen: isOpen && !isDisabled,
|
|
315
|
+
menuPlacement: "auto",
|
|
316
|
+
openMenuOnFocus: true,
|
|
317
|
+
onBlur: this.onBlur,
|
|
318
|
+
onCreateOption: this.onCreateOption,
|
|
319
|
+
onChange: this.onChange,
|
|
320
|
+
options: this.getOptions(),
|
|
321
|
+
onFocus: this.onFocus,
|
|
322
|
+
onMenuOpen: this.onMenuOpen,
|
|
323
|
+
onMenuClose: this.onMenuClose,
|
|
324
|
+
placeholder: this.getPlaceholder(),
|
|
325
|
+
styles: mergedStyles,
|
|
326
|
+
value: labelAndValue,
|
|
327
|
+
spacing: spacing
|
|
328
|
+
// @ts-ignore caused by prop not part of @atlaskit/select
|
|
329
|
+
,
|
|
330
|
+
fixedLayerRef: this.containerRef,
|
|
331
|
+
isInvalid: isInvalid,
|
|
332
|
+
testId: testId
|
|
333
|
+
}, otherSelectProps)));
|
|
338
334
|
}
|
|
339
335
|
}
|
|
340
336
|
_defineProperty(TimePicker, "defaultProps", timePickerDefaultProps);
|
|
@@ -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.
|
|
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), "
|
|
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$
|
|
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 (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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.
|
|
30
|
+
var packageVersion = "12.8.0";
|
|
31
31
|
|
|
32
32
|
/* eslint-disable react/no-unused-prop-types */
|
|
33
33
|
|
|
@@ -335,9 +335,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
335
335
|
timeFormat: timeFormat,
|
|
336
336
|
locale: locale,
|
|
337
337
|
testId: testId && "".concat(testId, "--timepicker")
|
|
338
|
-
}, timePickerProps))), isClearable && !isDisabled ?
|
|
339
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
340
|
-
jsx("button", {
|
|
338
|
+
}, timePickerProps))), isClearable && !isDisabled ? jsx("button", {
|
|
341
339
|
css: iconContainerStyles,
|
|
342
340
|
onClick: this.onClear,
|
|
343
341
|
"data-testid": testId && "".concat(testId, "--icon--container"),
|
|
@@ -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.
|
|
33
|
+
var packageVersion = "12.8.0";
|
|
34
34
|
|
|
35
35
|
/* eslint-disable react/no-unused-prop-types */
|
|
36
36
|
|
|
@@ -312,46 +312,42 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
|
-
return (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
isInvalid: isInvalid,
|
|
352
|
-
testId: testId
|
|
353
|
-
}, otherSelectProps)))
|
|
354
|
-
);
|
|
315
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
|
|
316
|
+
ref: this.setContainerRef,
|
|
317
|
+
"data-testid": testId && "".concat(testId, "--container")
|
|
318
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
319
|
+
name: name,
|
|
320
|
+
type: "hidden",
|
|
321
|
+
value: value,
|
|
322
|
+
"data-testid": testId && "".concat(testId, "--input"),
|
|
323
|
+
onKeyDown: this.onSelectKeyDown
|
|
324
|
+
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
325
|
+
appearance: this.props.appearance,
|
|
326
|
+
autoFocus: autoFocus,
|
|
327
|
+
components: selectComponents,
|
|
328
|
+
instanceId: id,
|
|
329
|
+
isClearable: true,
|
|
330
|
+
isDisabled: isDisabled,
|
|
331
|
+
menuIsOpen: isOpen && !isDisabled,
|
|
332
|
+
menuPlacement: "auto",
|
|
333
|
+
openMenuOnFocus: true,
|
|
334
|
+
onBlur: this.onBlur,
|
|
335
|
+
onCreateOption: this.onCreateOption,
|
|
336
|
+
onChange: this.onChange,
|
|
337
|
+
options: this.getOptions(),
|
|
338
|
+
onFocus: this.onFocus,
|
|
339
|
+
onMenuOpen: this.onMenuOpen,
|
|
340
|
+
onMenuClose: this.onMenuClose,
|
|
341
|
+
placeholder: this.getPlaceholder(),
|
|
342
|
+
styles: mergedStyles,
|
|
343
|
+
value: labelAndValue,
|
|
344
|
+
spacing: spacing
|
|
345
|
+
// @ts-ignore caused by prop not part of @atlaskit/select
|
|
346
|
+
,
|
|
347
|
+
fixedLayerRef: this.containerRef,
|
|
348
|
+
isInvalid: isInvalid,
|
|
349
|
+
testId: testId
|
|
350
|
+
}, otherSelectProps)));
|
|
355
351
|
}
|
|
356
352
|
}]);
|
|
357
353
|
return TimePicker;
|
|
@@ -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.
|
|
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",
|