@atlaskit/datetime-picker 12.1.0 → 12.1.3
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 +23 -0
- package/dist/cjs/components/{DatePicker.js → date-picker.js} +37 -29
- package/dist/cjs/components/{DateTimePicker.js → date-time-picker.js} +22 -10
- package/dist/cjs/components/{TimePicker.js → time-picker.js} +6 -15
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/internal/{FixedLayer.js → fixed-layer.js} +3 -1
- package/dist/cjs/internal/index.js +1 -0
- package/dist/cjs/internal/{parseTime.js → parse-time.js} +0 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/{DatePicker.js → date-picker.js} +27 -17
- package/dist/es2019/components/{DateTimePicker.js → date-time-picker.js} +22 -8
- package/dist/es2019/components/{TimePicker.js → time-picker.js} +7 -13
- package/dist/es2019/index.js +3 -3
- package/dist/es2019/internal/{FixedLayer.js → fixed-layer.js} +2 -1
- package/dist/es2019/internal/index.js +1 -0
- package/dist/es2019/internal/{parseTime.js → parse-time.js} +0 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/{DatePicker.js → date-picker.js} +39 -30
- package/dist/esm/components/{DateTimePicker.js → date-time-picker.js} +22 -8
- package/dist/esm/components/{TimePicker.js → time-picker.js} +6 -14
- package/dist/esm/index.js +3 -3
- package/dist/esm/internal/{FixedLayer.js → fixed-layer.js} +2 -1
- package/dist/esm/internal/index.js +1 -0
- package/dist/esm/internal/{parseTime.js → parse-time.js} +0 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/{DatePicker.d.ts → date-picker.d.ts} +98 -49
- package/dist/types/components/{DateTimePicker.d.ts → date-time-picker.d.ts} +65 -25
- package/dist/types/components/{TimePicker.d.ts → time-picker.d.ts} +77 -43
- package/dist/types/index.d.ts +6 -6
- package/dist/types/internal/{FixedLayer.d.ts → fixed-layer.d.ts} +7 -5
- package/dist/types/internal/{parseTime.d.ts → parse-time.d.ts} +0 -0
- package/dist/types/types.d.ts +1 -1
- package/extract-react-types/date-picker-props.tsx +2 -2
- package/extract-react-types/datetime-picker-props.tsx +2 -2
- package/extract-react-types/time-picker-props.tsx +2 -2
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 12.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`299e4104e10`](https://bitbucket.org/atlassian/atlassian-frontend/commits/299e4104e10) - [ux] Added appearance 'none' option to component and adopts appearance handling from @atlaskit/select
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 12.1.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`df3d5287649`](https://bitbucket.org/atlassian/atlassian-frontend/commits/df3d5287649) - Internal code change turning on new linting rules.
|
|
15
|
+
- [`429a576a4b2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/429a576a4b2) - fix change-event firing for invalid inputs in datetime-picker select.
|
|
16
|
+
- [`84afee665fc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/84afee665fc) - [ux] Implemented missing functionality to submit forms on enter press after a date has been selected in DatePicker
|
|
17
|
+
- [`2a2dcc1cf91`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2a2dcc1cf91) - Updated styles to use new input design tokens. Fixed bug where border radius on datePicker rendered incorrectly.
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 12.1.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`3fa327b5d01`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3fa327b5d01) - [ux] Border on a subtle appearance date-picker will now persist after a date is selected and field is in focus
|
|
25
|
+
|
|
3
26
|
## 12.1.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -51,7 +51,7 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
51
51
|
|
|
52
52
|
var _internal = require("../internal");
|
|
53
53
|
|
|
54
|
-
var
|
|
54
|
+
var _fixedLayer = _interopRequireDefault(require("../internal/fixed-layer"));
|
|
55
55
|
|
|
56
56
|
var _utils = require("./utils");
|
|
57
57
|
|
|
@@ -68,7 +68,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
68
68
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
69
69
|
|
|
70
70
|
var packageName = "@atlaskit/datetime-picker";
|
|
71
|
-
var packageVersion = "12.1.
|
|
71
|
+
var packageVersion = "12.1.3";
|
|
72
72
|
/* eslint-disable react/no-unused-prop-types */
|
|
73
73
|
|
|
74
74
|
function getDateObj(date) {
|
|
@@ -86,15 +86,16 @@ function getValidDate(iso) {
|
|
|
86
86
|
|
|
87
87
|
var menuStyles = (0, _core.css)({
|
|
88
88
|
zIndex: _constants.layers.dialog(),
|
|
89
|
-
backgroundColor: "var(--ds-surface, ".concat(_colors.N20, ")"),
|
|
89
|
+
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N20, ")"),
|
|
90
90
|
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
91
|
-
boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")")
|
|
91
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A), ")"),
|
|
92
|
+
overflow: 'hidden'
|
|
92
93
|
});
|
|
93
94
|
|
|
94
95
|
var Menu = function Menu(_ref) {
|
|
95
96
|
var selectProps = _ref.selectProps,
|
|
96
97
|
innerProps = _ref.innerProps;
|
|
97
|
-
return (0, _core.jsx)(
|
|
98
|
+
return (0, _core.jsx)(_fixedLayer.default, {
|
|
98
99
|
inputValue: selectProps.inputValue,
|
|
99
100
|
containerRef: selectProps.calendarContainerRef,
|
|
100
101
|
content: (0, _core.jsx)("div", (0, _extends2.default)({
|
|
@@ -216,7 +217,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
216
217
|
});
|
|
217
218
|
} else {
|
|
218
219
|
_this.setState({
|
|
219
|
-
isOpen: false
|
|
220
|
+
isOpen: false,
|
|
221
|
+
isFocused: false
|
|
220
222
|
});
|
|
221
223
|
}
|
|
222
224
|
|
|
@@ -235,7 +237,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
235
237
|
} else {
|
|
236
238
|
_this.setState({
|
|
237
239
|
isOpen: true,
|
|
238
|
-
view: value
|
|
240
|
+
view: value,
|
|
241
|
+
isFocused: true
|
|
239
242
|
});
|
|
240
243
|
}
|
|
241
244
|
|
|
@@ -316,12 +319,21 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
316
319
|
break;
|
|
317
320
|
|
|
318
321
|
case 'enter':
|
|
319
|
-
|
|
322
|
+
if (!_this.state.isOpen) {
|
|
323
|
+
return;
|
|
324
|
+
} // Prevent form submission when a date is selected
|
|
320
325
|
// using enter. See https://product-fabric.atlassian.net/browse/DSP-2501
|
|
321
326
|
// for more details.
|
|
327
|
+
|
|
328
|
+
|
|
322
329
|
event.preventDefault();
|
|
323
330
|
|
|
324
331
|
if (!_this.isDateDisabled(view)) {
|
|
332
|
+
var _this$getSafeState3 = _this.getSafeState(),
|
|
333
|
+
_value = _this$getSafeState3.value;
|
|
334
|
+
|
|
335
|
+
var valueChanged = view !== _value;
|
|
336
|
+
|
|
325
337
|
_this.setState({
|
|
326
338
|
inputValue: '',
|
|
327
339
|
isOpen: false,
|
|
@@ -330,7 +342,9 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
330
342
|
view: view
|
|
331
343
|
});
|
|
332
344
|
|
|
333
|
-
|
|
345
|
+
if (valueChanged) {
|
|
346
|
+
_this.props.onChange(view);
|
|
347
|
+
}
|
|
334
348
|
}
|
|
335
349
|
|
|
336
350
|
break;
|
|
@@ -386,13 +400,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
386
400
|
_this.forceUpdate();
|
|
387
401
|
}
|
|
388
402
|
});
|
|
389
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSubtleControlStyles", function (isOpen) {
|
|
390
|
-
return {
|
|
391
|
-
border: "2px solid ".concat(isOpen ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "transparent"),
|
|
392
|
-
backgroundColor: 'transparent',
|
|
393
|
-
padding: '1px'
|
|
394
|
-
};
|
|
395
|
-
});
|
|
396
403
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "parseDate", function (date) {
|
|
397
404
|
var _this$props = _this.props,
|
|
398
405
|
parseInputValue = _this$props.parseInputValue,
|
|
@@ -402,8 +409,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
402
409
|
return parseInputValue(date, dateFormat || _internal.defaultDateFormat);
|
|
403
410
|
}
|
|
404
411
|
|
|
405
|
-
var _this$
|
|
406
|
-
l10n = _this$
|
|
412
|
+
var _this$getSafeState4 = _this.getSafeState(),
|
|
413
|
+
l10n = _this$getSafeState4.l10n;
|
|
407
414
|
|
|
408
415
|
return l10n.parseDate(date);
|
|
409
416
|
});
|
|
@@ -412,8 +419,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
412
419
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
413
420
|
dateFormat = _this$props2.dateFormat;
|
|
414
421
|
|
|
415
|
-
var _this$
|
|
416
|
-
l10n = _this$
|
|
422
|
+
var _this$getSafeState5 = _this.getSafeState(),
|
|
423
|
+
l10n = _this$getSafeState5.l10n;
|
|
417
424
|
|
|
418
425
|
if (formatDisplayLabel) {
|
|
419
426
|
return formatDisplayLabel(value, dateFormat || _internal.defaultDateFormat);
|
|
@@ -429,8 +436,8 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
429
436
|
return placeholder;
|
|
430
437
|
}
|
|
431
438
|
|
|
432
|
-
var _this$
|
|
433
|
-
l10n = _this$
|
|
439
|
+
var _this$getSafeState6 = _this.getSafeState(),
|
|
440
|
+
l10n = _this$getSafeState6.l10n;
|
|
434
441
|
|
|
435
442
|
return l10n.formatDate(_internal.placeholderDatetime);
|
|
436
443
|
});
|
|
@@ -442,6 +449,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
442
449
|
|
|
443
450
|
_this.state = {
|
|
444
451
|
isOpen: _this.props.defaultIsOpen,
|
|
452
|
+
isFocused: false,
|
|
445
453
|
clearingFromIcon: false,
|
|
446
454
|
inputValue: _this.props.selectProps.inputValue,
|
|
447
455
|
selectedValue: _this.props.value || _this.props.defaultValue,
|
|
@@ -489,11 +497,11 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
489
497
|
weekStartDay = _this$props3.weekStartDay;
|
|
490
498
|
var ICON_PADDING = 2;
|
|
491
499
|
|
|
492
|
-
var _this$
|
|
493
|
-
value = _this$
|
|
494
|
-
view = _this$
|
|
495
|
-
isOpen = _this$
|
|
496
|
-
inputValue = _this$
|
|
500
|
+
var _this$getSafeState7 = this.getSafeState(),
|
|
501
|
+
value = _this$getSafeState7.value,
|
|
502
|
+
view = _this$getSafeState7.view,
|
|
503
|
+
isOpen = _this$getSafeState7.isOpen,
|
|
504
|
+
inputValue = _this$getSafeState7.inputValue;
|
|
497
505
|
|
|
498
506
|
var menuIsOpen = isOpen && !isDisabled;
|
|
499
507
|
var showClearIndicator = Boolean((value || inputValue) && !hideIcon);
|
|
@@ -509,7 +517,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
509
517
|
|
|
510
518
|
var _selectProps$styles = selectProps.styles,
|
|
511
519
|
selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles;
|
|
512
|
-
var controlStyles = appearance === 'subtle' ? this.getSubtleControlStyles(isOpen) : {};
|
|
513
520
|
var disabledStyle = isDisabled ? {
|
|
514
521
|
pointerEvents: 'none'
|
|
515
522
|
} : {};
|
|
@@ -543,6 +550,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
543
550
|
value: value,
|
|
544
551
|
"data-testid": testId && "".concat(testId, "--input")
|
|
545
552
|
}), (0, _core.jsx)(_select.default, (0, _extends2.default)({
|
|
553
|
+
appearance: this.props.appearance,
|
|
546
554
|
enableAnimation: false,
|
|
547
555
|
menuIsOpen: menuIsOpen,
|
|
548
556
|
closeMenuOnSelect: true,
|
|
@@ -557,7 +565,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
557
565
|
onChange: this.onSelectChange,
|
|
558
566
|
styles: (0, _select.mergeStyles)(selectStyles, {
|
|
559
567
|
control: function control(base) {
|
|
560
|
-
return _objectSpread(_objectSpread(
|
|
568
|
+
return _objectSpread(_objectSpread({}, base), disabledStyle);
|
|
561
569
|
},
|
|
562
570
|
indicatorsContainer: function indicatorsContainer(base) {
|
|
563
571
|
return _objectSpread(_objectSpread({}, base), {}, {
|
|
@@ -43,9 +43,9 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
43
43
|
|
|
44
44
|
var _internal = require("../internal");
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _datePicker = _interopRequireDefault(require("./date-picker"));
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var _timePicker = _interopRequireDefault(require("./time-picker"));
|
|
49
49
|
|
|
50
50
|
var _utils = require("./utils");
|
|
51
51
|
|
|
@@ -58,7 +58,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
58
58
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
59
59
|
|
|
60
60
|
var packageName = "@atlaskit/datetime-picker";
|
|
61
|
-
var packageVersion = "12.1.
|
|
61
|
+
var packageVersion = "12.1.3";
|
|
62
62
|
/* eslint-disable react/no-unused-prop-types */
|
|
63
63
|
|
|
64
64
|
var isInvalidBorderStyles = (0, _core.css)({
|
|
@@ -68,16 +68,28 @@ var isFocusedBorderStyles = (0, _core.css)({
|
|
|
68
68
|
borderColor: "var(--ds-border-focused, ".concat(_colors.B100, ")")
|
|
69
69
|
});
|
|
70
70
|
var isFocusedStyles = (0, _core.css)({
|
|
71
|
-
backgroundColor: "var(--ds-
|
|
71
|
+
backgroundColor: "var(--ds-background-input-pressed, ".concat(_colors.N0, ")")
|
|
72
72
|
});
|
|
73
73
|
var subtleBgStyles = (0, _core.css)({
|
|
74
74
|
backgroundColor: 'transparent',
|
|
75
75
|
borderColor: 'transparent'
|
|
76
76
|
});
|
|
77
|
+
var subtleFocusedBgStyles = (0, _core.css)({
|
|
78
|
+
backgroundColor: "var(--ds-background-input-pressed, transparent)",
|
|
79
|
+
borderColor: 'transparent'
|
|
80
|
+
});
|
|
81
|
+
var noBgStyles = (0, _core.css)({
|
|
82
|
+
backgroundColor: 'transparent',
|
|
83
|
+
borderColor: 'transparent',
|
|
84
|
+
'&:hover': {
|
|
85
|
+
backgroundColor: 'transparent',
|
|
86
|
+
borderColor: 'transparent'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
77
89
|
var hoverStyles = (0, _core.css)({
|
|
78
90
|
'&:hover': {
|
|
79
91
|
backgroundColor: "var(--ds-background-input-hovered, ".concat(_colors.N30, ")"),
|
|
80
|
-
borderColor: "var(--ds-border, ".concat(_colors.N30, ")")
|
|
92
|
+
borderColor: "var(--ds-border-input, ".concat(_colors.N30, ")")
|
|
81
93
|
}
|
|
82
94
|
});
|
|
83
95
|
var isInvalidHoverStyles = (0, _core.css)({
|
|
@@ -93,8 +105,8 @@ var isDisabledStyles = (0, _core.css)({
|
|
|
93
105
|
});
|
|
94
106
|
var baseContainerStyles = (0, _core.css)({
|
|
95
107
|
display: 'flex',
|
|
96
|
-
backgroundColor: "var(--ds-background-
|
|
97
|
-
border: "2px solid ".concat("var(--ds-border, ".concat(_colors.N20, ")")),
|
|
108
|
+
backgroundColor: "var(--ds-background-input, ".concat(_colors.N20, ")"),
|
|
109
|
+
border: "2px solid ".concat("var(--ds-border-input, ".concat(_colors.N20, ")")),
|
|
98
110
|
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
99
111
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
100
112
|
'&:hover': {
|
|
@@ -328,7 +340,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
328
340
|
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
329
341
|
var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
330
342
|
return (0, _core.jsx)("div", (0, _extends2.default)({
|
|
331
|
-
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
343
|
+
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]
|
|
332
344
|
}, innerProps, {
|
|
333
345
|
"data-testid": testId
|
|
334
346
|
}), (0, _core.jsx)("input", {
|
|
@@ -338,7 +350,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
338
350
|
value: value
|
|
339
351
|
}), (0, _core.jsx)("div", {
|
|
340
352
|
css: datePickerContainerStyles
|
|
341
|
-
}, (0, _core.jsx)(
|
|
353
|
+
}, (0, _core.jsx)(_datePicker.default, (0, _extends2.default)({}, bothProps, {
|
|
342
354
|
autoFocus: autoFocus,
|
|
343
355
|
dateFormat: dateFormat,
|
|
344
356
|
hideIcon: true,
|
|
@@ -350,7 +362,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
350
362
|
testId: testId && "".concat(testId, "--datepicker")
|
|
351
363
|
}, datePickerProps))), (0, _core.jsx)("div", {
|
|
352
364
|
css: timePickerContainerStyles
|
|
353
|
-
}, (0, _core.jsx)(
|
|
365
|
+
}, (0, _core.jsx)(_timePicker.default, (0, _extends2.default)({}, bothProps, {
|
|
354
366
|
hideIcon: true,
|
|
355
367
|
onChange: this.onTimeChange,
|
|
356
368
|
selectProps: mergedTimePickerSelectProps,
|
|
@@ -39,15 +39,13 @@ var _locale = require("@atlaskit/locale");
|
|
|
39
39
|
|
|
40
40
|
var _select = _interopRequireWildcard(require("@atlaskit/select"));
|
|
41
41
|
|
|
42
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
43
|
-
|
|
44
42
|
var _constants = require("@atlaskit/theme/constants");
|
|
45
43
|
|
|
46
44
|
var _internal = require("../internal");
|
|
47
45
|
|
|
48
|
-
var
|
|
46
|
+
var _fixedLayer = _interopRequireDefault(require("../internal/fixed-layer"));
|
|
49
47
|
|
|
50
|
-
var _parseTime = _interopRequireDefault(require("../internal/
|
|
48
|
+
var _parseTime = _interopRequireDefault(require("../internal/parse-time"));
|
|
51
49
|
|
|
52
50
|
var _utils = require("./utils");
|
|
53
51
|
|
|
@@ -67,7 +65,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
67
65
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
68
66
|
|
|
69
67
|
var packageName = "@atlaskit/datetime-picker";
|
|
70
|
-
var packageVersion = "12.1.
|
|
68
|
+
var packageVersion = "12.1.3";
|
|
71
69
|
var menuStyles = {
|
|
72
70
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
73
71
|
position: 'static',
|
|
@@ -82,7 +80,7 @@ var menuStyles = {
|
|
|
82
80
|
var FixedLayerMenu = function FixedLayerMenu(_ref) {
|
|
83
81
|
var selectProps = _ref.selectProps,
|
|
84
82
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
85
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement(_fixedLayer.default, {
|
|
86
84
|
inputValue: selectProps.inputValue,
|
|
87
85
|
containerRef: selectProps.fixedLayerRef,
|
|
88
86
|
content: /*#__PURE__*/_react.default.createElement(_select.components.Menu, (0, _extends2.default)({}, rest, {
|
|
@@ -242,13 +240,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
242
240
|
});
|
|
243
241
|
}
|
|
244
242
|
});
|
|
245
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSubtleControlStyles", function (selectStyles) {
|
|
246
|
-
return !selectStyles.control ? {
|
|
247
|
-
border: "2px solid ".concat(_this.getSafeState().isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "transparent"),
|
|
248
|
-
backgroundColor: 'transparent',
|
|
249
|
-
padding: '1px'
|
|
250
|
-
} : {};
|
|
251
|
-
});
|
|
252
243
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "formatTime", function (time) {
|
|
253
244
|
var _this$props2 = _this.props,
|
|
254
245
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
@@ -341,7 +332,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
341
332
|
var _selectProps$styles = selectProps.styles,
|
|
342
333
|
selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles,
|
|
343
334
|
otherSelectProps = (0, _objectWithoutProperties2.default)(selectProps, _excluded2);
|
|
344
|
-
var controlStyles = this.props.appearance === 'subtle' ? this.getSubtleControlStyles(selectStyles) : {};
|
|
345
335
|
var SelectComponent = this.props.timeIsEditable ? _select.CreatableSelect : _select.default;
|
|
346
336
|
var labelAndValue = value && {
|
|
347
337
|
label: this.formatTime(value),
|
|
@@ -359,7 +349,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
359
349
|
var renderIconContainer = Boolean(!hideIcon && value);
|
|
360
350
|
var mergedStyles = (0, _select.mergeStyles)(selectStyles, {
|
|
361
351
|
control: function control(base) {
|
|
362
|
-
return _objectSpread(
|
|
352
|
+
return _objectSpread({}, base);
|
|
363
353
|
},
|
|
364
354
|
menu: function menu(base) {
|
|
365
355
|
return _objectSpread(_objectSpread(_objectSpread({}, base), menuStyles), {}, {
|
|
@@ -388,6 +378,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
388
378
|
type: "hidden",
|
|
389
379
|
value: value
|
|
390
380
|
}), /*#__PURE__*/_react.default.createElement(SelectComponent, (0, _extends2.default)({
|
|
381
|
+
appearance: this.props.appearance,
|
|
391
382
|
autoFocus: autoFocus,
|
|
392
383
|
components: selectComponents,
|
|
393
384
|
instanceId: id,
|
package/dist/cjs/index.js
CHANGED
|
@@ -8,24 +8,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
Object.defineProperty(exports, "DatePicker", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
11
|
-
return
|
|
11
|
+
return _datePicker.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "DateTimePicker", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function get() {
|
|
17
|
-
return
|
|
17
|
+
return _dateTimePicker.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "TimePicker", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function get() {
|
|
23
|
-
return
|
|
23
|
+
return _timePicker.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _datePicker = _interopRequireDefault(require("./components/date-picker"));
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _timePicker = _interopRequireDefault(require("./components/time-picker"));
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _dateTimePicker = _interopRequireDefault(require("./components/date-time-picker"));
|
|
@@ -25,6 +25,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
25
25
|
|
|
26
26
|
var _reactScrolllock = _interopRequireDefault(require("react-scrolllock"));
|
|
27
27
|
|
|
28
|
+
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
29
|
+
|
|
28
30
|
var _icon = require("@atlaskit/icon");
|
|
29
31
|
|
|
30
32
|
var _popper = require("@atlaskit/popper");
|
|
@@ -59,7 +61,7 @@ var FixedLayer = /*#__PURE__*/function (_React$Component) {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
62
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "update",
|
|
64
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "update", _noop.default);
|
|
63
65
|
return _this;
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -12,6 +12,7 @@ exports.placeholderDatetime = void 0;
|
|
|
12
12
|
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
|
|
15
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
15
16
|
var EmptyClearIndicator = null; // This date was chosen to clearly show date and time formats (day > 12)
|
|
16
17
|
// e.g. 18/02/1993 vs. 2/18/1993 and 1:00 PM vs 13:00
|
|
17
18
|
|
|
File without changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @repo/internal/react/use-noop */
|
|
5
|
+
|
|
4
6
|
/** @jsx jsx */
|
|
5
7
|
import { Component } from 'react';
|
|
6
8
|
import { css, jsx } from '@emotion/core'; // eslint-disable-next-line no-restricted-imports
|
|
@@ -12,13 +14,13 @@ import Calendar from '@atlaskit/calendar';
|
|
|
12
14
|
import CalendarIcon from '@atlaskit/icon/glyph/calendar';
|
|
13
15
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
14
16
|
import Select, { mergeStyles } from '@atlaskit/select';
|
|
15
|
-
import {
|
|
17
|
+
import { N20, N50A, N60A } from '@atlaskit/theme/colors';
|
|
16
18
|
import { borderRadius, gridSize, layers } from '@atlaskit/theme/constants';
|
|
17
19
|
import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime } from '../internal';
|
|
18
|
-
import FixedLayer from '../internal/
|
|
20
|
+
import FixedLayer from '../internal/fixed-layer';
|
|
19
21
|
import { convertTokens } from './utils';
|
|
20
22
|
const packageName = "@atlaskit/datetime-picker";
|
|
21
|
-
const packageVersion = "12.1.
|
|
23
|
+
const packageVersion = "12.1.3";
|
|
22
24
|
/* eslint-disable react/no-unused-prop-types */
|
|
23
25
|
|
|
24
26
|
function getDateObj(date) {
|
|
@@ -36,9 +38,10 @@ function getValidDate(iso) {
|
|
|
36
38
|
|
|
37
39
|
const menuStyles = css({
|
|
38
40
|
zIndex: layers.dialog(),
|
|
39
|
-
backgroundColor: `var(--ds-surface, ${N20})`,
|
|
41
|
+
backgroundColor: `var(--ds-surface-overlay, ${N20})`,
|
|
40
42
|
borderRadius: `${borderRadius()}px`,
|
|
41
|
-
boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})
|
|
43
|
+
boxShadow: `var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
|
|
44
|
+
overflow: 'hidden'
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
const Menu = ({
|
|
@@ -161,7 +164,8 @@ class DatePicker extends Component {
|
|
|
161
164
|
});
|
|
162
165
|
} else {
|
|
163
166
|
this.setState({
|
|
164
|
-
isOpen: false
|
|
167
|
+
isOpen: false,
|
|
168
|
+
isFocused: false
|
|
165
169
|
});
|
|
166
170
|
}
|
|
167
171
|
|
|
@@ -182,7 +186,8 @@ class DatePicker extends Component {
|
|
|
182
186
|
} else {
|
|
183
187
|
this.setState({
|
|
184
188
|
isOpen: true,
|
|
185
|
-
view: value
|
|
189
|
+
view: value,
|
|
190
|
+
isFocused: true
|
|
186
191
|
});
|
|
187
192
|
}
|
|
188
193
|
|
|
@@ -259,12 +264,20 @@ class DatePicker extends Component {
|
|
|
259
264
|
break;
|
|
260
265
|
|
|
261
266
|
case 'enter':
|
|
262
|
-
|
|
267
|
+
if (!this.state.isOpen) {
|
|
268
|
+
return;
|
|
269
|
+
} // Prevent form submission when a date is selected
|
|
263
270
|
// using enter. See https://product-fabric.atlassian.net/browse/DSP-2501
|
|
264
271
|
// for more details.
|
|
272
|
+
|
|
273
|
+
|
|
265
274
|
event.preventDefault();
|
|
266
275
|
|
|
267
276
|
if (!this.isDateDisabled(view)) {
|
|
277
|
+
const {
|
|
278
|
+
value
|
|
279
|
+
} = this.getSafeState();
|
|
280
|
+
const valueChanged = view !== value;
|
|
268
281
|
this.setState({
|
|
269
282
|
inputValue: '',
|
|
270
283
|
isOpen: false,
|
|
@@ -272,7 +285,10 @@ class DatePicker extends Component {
|
|
|
272
285
|
value: view,
|
|
273
286
|
view
|
|
274
287
|
});
|
|
275
|
-
|
|
288
|
+
|
|
289
|
+
if (valueChanged) {
|
|
290
|
+
this.props.onChange(view);
|
|
291
|
+
}
|
|
276
292
|
}
|
|
277
293
|
|
|
278
294
|
break;
|
|
@@ -335,12 +351,6 @@ class DatePicker extends Component {
|
|
|
335
351
|
}
|
|
336
352
|
});
|
|
337
353
|
|
|
338
|
-
_defineProperty(this, "getSubtleControlStyles", isOpen => ({
|
|
339
|
-
border: `2px solid ${isOpen ? `var(--ds-border-focused, ${B100})` : `transparent`}`,
|
|
340
|
-
backgroundColor: 'transparent',
|
|
341
|
-
padding: '1px'
|
|
342
|
-
}));
|
|
343
|
-
|
|
344
354
|
_defineProperty(this, "parseDate", date => {
|
|
345
355
|
const {
|
|
346
356
|
parseInputValue,
|
|
@@ -396,6 +406,7 @@ class DatePicker extends Component {
|
|
|
396
406
|
} = getDateObj(new Date());
|
|
397
407
|
this.state = {
|
|
398
408
|
isOpen: this.props.defaultIsOpen,
|
|
409
|
+
isFocused: false,
|
|
399
410
|
clearingFromIcon: false,
|
|
400
411
|
inputValue: this.props.selectProps.inputValue,
|
|
401
412
|
selectedValue: this.props.value || this.props.defaultValue,
|
|
@@ -460,7 +471,6 @@ class DatePicker extends Component {
|
|
|
460
471
|
const {
|
|
461
472
|
styles: selectStyles = {}
|
|
462
473
|
} = selectProps;
|
|
463
|
-
const controlStyles = appearance === 'subtle' ? this.getSubtleControlStyles(isOpen) : {};
|
|
464
474
|
const disabledStyle = isDisabled ? {
|
|
465
475
|
pointerEvents: 'none'
|
|
466
476
|
} : {};
|
|
@@ -494,6 +504,7 @@ class DatePicker extends Component {
|
|
|
494
504
|
value: value,
|
|
495
505
|
"data-testid": testId && `${testId}--input`
|
|
496
506
|
}), jsx(Select, _extends({
|
|
507
|
+
appearance: this.props.appearance,
|
|
497
508
|
enableAnimation: false,
|
|
498
509
|
menuIsOpen: menuIsOpen,
|
|
499
510
|
closeMenuOnSelect: true,
|
|
@@ -508,7 +519,6 @@ class DatePicker extends Component {
|
|
|
508
519
|
onChange: this.onSelectChange,
|
|
509
520
|
styles: mergeStyles(selectStyles, {
|
|
510
521
|
control: base => ({ ...base,
|
|
511
|
-
...controlStyles,
|
|
512
522
|
...disabledStyle
|
|
513
523
|
}),
|
|
514
524
|
indicatorsContainer: base => ({ ...base,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @repo/internal/react/use-noop */
|
|
5
|
+
|
|
4
6
|
/** @jsx jsx */
|
|
5
7
|
import React from 'react';
|
|
6
8
|
import { css, jsx } from '@emotion/core'; // eslint-disable-next-line no-restricted-imports
|
|
@@ -13,11 +15,11 @@ import { mergeStyles } from '@atlaskit/select';
|
|
|
13
15
|
import { B100, N0, N20, N30, N500, N70, R400 } from '@atlaskit/theme/colors';
|
|
14
16
|
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
15
17
|
import { defaultTimes, formatDateTimeZoneIntoIso } from '../internal';
|
|
16
|
-
import DatePicker from './
|
|
17
|
-
import TimePicker from './
|
|
18
|
+
import DatePicker from './date-picker';
|
|
19
|
+
import TimePicker from './time-picker';
|
|
18
20
|
import { convertTokens } from './utils';
|
|
19
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
const packageVersion = "12.1.
|
|
22
|
+
const packageVersion = "12.1.3";
|
|
21
23
|
/* eslint-disable react/no-unused-prop-types */
|
|
22
24
|
|
|
23
25
|
const isInvalidBorderStyles = css({
|
|
@@ -27,16 +29,28 @@ const isFocusedBorderStyles = css({
|
|
|
27
29
|
borderColor: `var(--ds-border-focused, ${B100})`
|
|
28
30
|
});
|
|
29
31
|
const isFocusedStyles = css({
|
|
30
|
-
backgroundColor: `var(--ds-
|
|
32
|
+
backgroundColor: `var(--ds-background-input-pressed, ${N0})`
|
|
31
33
|
});
|
|
32
34
|
const subtleBgStyles = css({
|
|
33
35
|
backgroundColor: 'transparent',
|
|
34
36
|
borderColor: 'transparent'
|
|
35
37
|
});
|
|
38
|
+
const subtleFocusedBgStyles = css({
|
|
39
|
+
backgroundColor: "var(--ds-background-input-pressed, transparent)",
|
|
40
|
+
borderColor: 'transparent'
|
|
41
|
+
});
|
|
42
|
+
const noBgStyles = css({
|
|
43
|
+
backgroundColor: 'transparent',
|
|
44
|
+
borderColor: 'transparent',
|
|
45
|
+
'&:hover': {
|
|
46
|
+
backgroundColor: 'transparent',
|
|
47
|
+
borderColor: 'transparent'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
36
50
|
const hoverStyles = css({
|
|
37
51
|
'&:hover': {
|
|
38
52
|
backgroundColor: `var(--ds-background-input-hovered, ${N30})`,
|
|
39
|
-
borderColor: `var(--ds-border, ${N30})`
|
|
53
|
+
borderColor: `var(--ds-border-input, ${N30})`
|
|
40
54
|
}
|
|
41
55
|
});
|
|
42
56
|
const isInvalidHoverStyles = css({
|
|
@@ -52,8 +66,8 @@ const isDisabledStyles = css({
|
|
|
52
66
|
});
|
|
53
67
|
const baseContainerStyles = css({
|
|
54
68
|
display: 'flex',
|
|
55
|
-
backgroundColor: `var(--ds-background-
|
|
56
|
-
border: `2px solid ${`var(--ds-border, ${N20})`}`,
|
|
69
|
+
backgroundColor: `var(--ds-background-input, ${N20})`,
|
|
70
|
+
border: `2px solid ${`var(--ds-border-input, ${N20})`}`,
|
|
57
71
|
borderRadius: `${borderRadius()}px`,
|
|
58
72
|
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
59
73
|
'&:hover': {
|
|
@@ -275,7 +289,7 @@ class DateTimePicker extends React.Component {
|
|
|
275
289
|
const notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
276
290
|
const labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
277
291
|
return jsx("div", _extends({
|
|
278
|
-
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
292
|
+
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]
|
|
279
293
|
}, innerProps, {
|
|
280
294
|
"data-testid": testId
|
|
281
295
|
}), jsx("input", {
|