@atlaskit/datetime-picker 12.1.2 → 12.2.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 +27 -0
- package/dist/cjs/components/date-picker.js +12 -19
- package/dist/cjs/components/date-time-picker.js +31 -23
- package/dist/cjs/components/time-picker.js +6 -15
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/date-picker.js +5 -12
- package/dist/es2019/components/date-time-picker.js +11 -3
- package/dist/es2019/components/time-picker.js +6 -14
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/date-picker.js +6 -14
- package/dist/esm/components/date-time-picker.js +11 -3
- package/dist/esm/components/time-picker.js +6 -16
- package/dist/esm/version.json +1 -1
- package/dist/types/components/date-picker.d.ts +2 -6
- package/dist/types/components/date-time-picker.d.ts +2 -1
- package/dist/types/components/time-picker.d.ts +1 -10
- package/dist/types/types.d.ts +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 12.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a91fbaf0552`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a91fbaf0552) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`0fbb2840aba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0fbb2840aba) - Add isInvalid prop to `@atlastkit/Select`. The prop indicates whether if the component is in the error state. If true, it visually shows a red border around the input.
|
|
12
|
+
|
|
13
|
+
This replaces validationState to make Select more consistent like other components that uses isInvalid prop.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 12.1.4
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
22
|
+
|
|
23
|
+
## 12.1.3
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- [`299e4104e10`](https://bitbucket.org/atlassian/atlassian-frontend/commits/299e4104e10) - [ux] Added appearance 'none' option to component and adopts appearance handling from @atlaskit/select
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 12.1.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -29,7 +29,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
29
29
|
|
|
30
30
|
var _react = require("react");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _react2 = require("@emotion/react");
|
|
33
33
|
|
|
34
34
|
var _dateFns = require("date-fns");
|
|
35
35
|
|
|
@@ -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.
|
|
71
|
+
var packageVersion = "12.2.0";
|
|
72
72
|
/* eslint-disable react/no-unused-prop-types */
|
|
73
73
|
|
|
74
74
|
function getDateObj(date) {
|
|
@@ -84,7 +84,7 @@ function getValidDate(iso) {
|
|
|
84
84
|
return (0, _dateFns.isValid)(date) ? getDateObj(date) : {};
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
var menuStyles = (0,
|
|
87
|
+
var menuStyles = (0, _react2.css)({
|
|
88
88
|
zIndex: _constants.layers.dialog(),
|
|
89
89
|
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N20, ")"),
|
|
90
90
|
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
@@ -95,12 +95,12 @@ var menuStyles = (0, _core.css)({
|
|
|
95
95
|
var Menu = function Menu(_ref) {
|
|
96
96
|
var selectProps = _ref.selectProps,
|
|
97
97
|
innerProps = _ref.innerProps;
|
|
98
|
-
return (0,
|
|
98
|
+
return (0, _react2.jsx)(_fixedLayer.default, {
|
|
99
99
|
inputValue: selectProps.inputValue,
|
|
100
100
|
containerRef: selectProps.calendarContainerRef,
|
|
101
|
-
content: (0,
|
|
101
|
+
content: (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
102
102
|
css: menuStyles
|
|
103
|
-
}, innerProps), (0,
|
|
103
|
+
}, innerProps), (0, _react2.jsx)(_calendar.default, (0, _extends2.default)({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
|
|
104
104
|
disabled: selectProps.calendarDisabled,
|
|
105
105
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
106
106
|
minDate: selectProps.calendarMinDate,
|
|
@@ -400,13 +400,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
400
400
|
_this.forceUpdate();
|
|
401
401
|
}
|
|
402
402
|
});
|
|
403
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSubtleControlStyles", function () {
|
|
404
|
-
return {
|
|
405
|
-
border: "2px solid ".concat(_this.getSafeState().isFocused ? "var(--ds-border-focused, ".concat(_colors.B100, ")") : "transparent"),
|
|
406
|
-
backgroundColor: _this.getSafeState().isOpen ? "var(--ds-background-input-pressed, transparent)" : 'transparent',
|
|
407
|
-
padding: '1px'
|
|
408
|
-
};
|
|
409
|
-
});
|
|
410
403
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "parseDate", function (date) {
|
|
411
404
|
var _this$props = _this.props,
|
|
412
405
|
parseInputValue = _this$props.parseInputValue,
|
|
@@ -524,7 +517,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
524
517
|
|
|
525
518
|
var _selectProps$styles = selectProps.styles,
|
|
526
519
|
selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles;
|
|
527
|
-
var controlStyles = appearance === 'subtle' ? this.getSubtleControlStyles() : {};
|
|
528
520
|
var disabledStyle = isDisabled ? {
|
|
529
521
|
pointerEvents: 'none'
|
|
530
522
|
} : {};
|
|
@@ -544,20 +536,21 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
544
536
|
nextMonthLabel: nextMonthLabel,
|
|
545
537
|
previousMonthLabel: previousMonthLabel
|
|
546
538
|
};
|
|
547
|
-
return (0,
|
|
539
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({}, innerProps, {
|
|
548
540
|
role: "presentation",
|
|
549
541
|
onClick: this.onInputClick,
|
|
550
542
|
onInput: this.onSelectInput,
|
|
551
543
|
onKeyDown: this.onSelectKeyDown,
|
|
552
544
|
ref: this.getContainerRef,
|
|
553
545
|
"data-testid": testId && "".concat(testId, "--container")
|
|
554
|
-
}), (0,
|
|
546
|
+
}), (0, _react2.jsx)("input", {
|
|
555
547
|
id: selectProps.inputId,
|
|
556
548
|
name: name,
|
|
557
549
|
type: "hidden",
|
|
558
550
|
value: value,
|
|
559
551
|
"data-testid": testId && "".concat(testId, "--input")
|
|
560
|
-
}), (0,
|
|
552
|
+
}), (0, _react2.jsx)(_select.default, (0, _extends2.default)({
|
|
553
|
+
appearance: this.props.appearance,
|
|
561
554
|
enableAnimation: false,
|
|
562
555
|
menuIsOpen: menuIsOpen,
|
|
563
556
|
closeMenuOnSelect: true,
|
|
@@ -572,7 +565,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
572
565
|
onChange: this.onSelectChange,
|
|
573
566
|
styles: (0, _select.mergeStyles)(selectStyles, {
|
|
574
567
|
control: function control(base) {
|
|
575
|
-
return _objectSpread(_objectSpread(
|
|
568
|
+
return _objectSpread(_objectSpread({}, base), disabledStyle);
|
|
576
569
|
},
|
|
577
570
|
indicatorsContainer: function indicatorsContainer(base) {
|
|
578
571
|
return _objectSpread(_objectSpread({}, base), {}, {
|
|
@@ -589,7 +582,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
589
582
|
}, selectProps, calendarProps, {
|
|
590
583
|
isClearable: true,
|
|
591
584
|
spacing: spacing,
|
|
592
|
-
|
|
585
|
+
isInvalid: isInvalid,
|
|
593
586
|
testId: testId
|
|
594
587
|
})));
|
|
595
588
|
}
|
|
@@ -25,7 +25,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
25
|
|
|
26
26
|
var _react = _interopRequireDefault(require("react"));
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _react2 = require("@emotion/react");
|
|
29
29
|
|
|
30
30
|
var _dateFns = require("date-fns");
|
|
31
31
|
|
|
@@ -58,44 +58,52 @@ 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.
|
|
61
|
+
var packageVersion = "12.2.0";
|
|
62
62
|
/* eslint-disable react/no-unused-prop-types */
|
|
63
63
|
|
|
64
|
-
var isInvalidBorderStyles = (0,
|
|
64
|
+
var isInvalidBorderStyles = (0, _react2.css)({
|
|
65
65
|
borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")")
|
|
66
66
|
});
|
|
67
|
-
var isFocusedBorderStyles = (0,
|
|
67
|
+
var isFocusedBorderStyles = (0, _react2.css)({
|
|
68
68
|
borderColor: "var(--ds-border-focused, ".concat(_colors.B100, ")")
|
|
69
69
|
});
|
|
70
|
-
var isFocusedStyles = (0,
|
|
70
|
+
var isFocusedStyles = (0, _react2.css)({
|
|
71
71
|
backgroundColor: "var(--ds-background-input-pressed, ".concat(_colors.N0, ")")
|
|
72
72
|
});
|
|
73
|
-
var subtleBgStyles = (0,
|
|
73
|
+
var subtleBgStyles = (0, _react2.css)({
|
|
74
74
|
backgroundColor: 'transparent',
|
|
75
75
|
borderColor: 'transparent'
|
|
76
76
|
});
|
|
77
|
-
var subtleFocusedBgStyles = (0,
|
|
77
|
+
var subtleFocusedBgStyles = (0, _react2.css)({
|
|
78
78
|
backgroundColor: "var(--ds-background-input-pressed, transparent)",
|
|
79
79
|
borderColor: 'transparent'
|
|
80
80
|
});
|
|
81
|
-
var
|
|
81
|
+
var noBgStyles = (0, _react2.css)({
|
|
82
|
+
backgroundColor: 'transparent',
|
|
83
|
+
borderColor: 'transparent',
|
|
84
|
+
'&:hover': {
|
|
85
|
+
backgroundColor: 'transparent',
|
|
86
|
+
borderColor: 'transparent'
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
var hoverStyles = (0, _react2.css)({
|
|
82
90
|
'&:hover': {
|
|
83
91
|
backgroundColor: "var(--ds-background-input-hovered, ".concat(_colors.N30, ")"),
|
|
84
92
|
borderColor: "var(--ds-border-input, ".concat(_colors.N30, ")")
|
|
85
93
|
}
|
|
86
94
|
});
|
|
87
|
-
var isInvalidHoverStyles = (0,
|
|
95
|
+
var isInvalidHoverStyles = (0, _react2.css)({
|
|
88
96
|
'&:hover': {
|
|
89
97
|
backgroundColor: "var(--ds-background-input-hovered, ".concat(_colors.N0, ")"),
|
|
90
98
|
borderColor: "var(--ds-border-danger, ".concat(_colors.R400, ")")
|
|
91
99
|
}
|
|
92
100
|
});
|
|
93
|
-
var isDisabledStyles = (0,
|
|
101
|
+
var isDisabledStyles = (0, _react2.css)({
|
|
94
102
|
'&:hover': {
|
|
95
103
|
cursor: 'default'
|
|
96
104
|
}
|
|
97
105
|
});
|
|
98
|
-
var baseContainerStyles = (0,
|
|
106
|
+
var baseContainerStyles = (0, _react2.css)({
|
|
99
107
|
display: 'flex',
|
|
100
108
|
backgroundColor: "var(--ds-background-input, ".concat(_colors.N20, ")"),
|
|
101
109
|
border: "2px solid ".concat("var(--ds-border-input, ".concat(_colors.N20, ")")),
|
|
@@ -107,17 +115,17 @@ var baseContainerStyles = (0, _core.css)({
|
|
|
107
115
|
}); // Make DatePicker 50% the width of DateTimePicker
|
|
108
116
|
// If rendering an icon container, shrink the TimePicker
|
|
109
117
|
|
|
110
|
-
var datePickerContainerStyles = (0,
|
|
118
|
+
var datePickerContainerStyles = (0, _react2.css)({
|
|
111
119
|
flexBasis: '50%',
|
|
112
120
|
flexGrow: 1,
|
|
113
121
|
flexShrink: 0
|
|
114
122
|
});
|
|
115
|
-
var timePickerContainerStyles = (0,
|
|
123
|
+
var timePickerContainerStyles = (0, _react2.css)({
|
|
116
124
|
flexBasis: '50%',
|
|
117
125
|
flexGrow: 1
|
|
118
126
|
});
|
|
119
127
|
var ICON_PADDING = 2;
|
|
120
|
-
var iconContainerStyles = (0,
|
|
128
|
+
var iconContainerStyles = (0, _react2.css)({
|
|
121
129
|
display: 'flex',
|
|
122
130
|
paddingTop: "6px",
|
|
123
131
|
paddingRight: "".concat((0, _constants.gridSize)(), "px"),
|
|
@@ -331,18 +339,18 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
331
339
|
var isClearable = Boolean(dateValue || timeValue);
|
|
332
340
|
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
333
341
|
var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
334
|
-
return (0,
|
|
335
|
-
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
342
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
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]
|
|
336
344
|
}, innerProps, {
|
|
337
345
|
"data-testid": testId
|
|
338
|
-
}), (0,
|
|
346
|
+
}), (0, _react2.jsx)("input", {
|
|
339
347
|
id: labelId,
|
|
340
348
|
name: name,
|
|
341
349
|
type: "hidden",
|
|
342
350
|
value: value
|
|
343
|
-
}), (0,
|
|
351
|
+
}), (0, _react2.jsx)("div", {
|
|
344
352
|
css: datePickerContainerStyles
|
|
345
|
-
}, (0,
|
|
353
|
+
}, (0, _react2.jsx)(_datePicker.default, (0, _extends2.default)({}, bothProps, {
|
|
346
354
|
autoFocus: autoFocus,
|
|
347
355
|
dateFormat: dateFormat,
|
|
348
356
|
hideIcon: true,
|
|
@@ -352,9 +360,9 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
352
360
|
value: dateValue,
|
|
353
361
|
locale: locale,
|
|
354
362
|
testId: testId && "".concat(testId, "--datepicker")
|
|
355
|
-
}, datePickerProps))), (0,
|
|
363
|
+
}, datePickerProps))), (0, _react2.jsx)("div", {
|
|
356
364
|
css: timePickerContainerStyles
|
|
357
|
-
}, (0,
|
|
365
|
+
}, (0, _react2.jsx)(_timePicker.default, (0, _extends2.default)({}, bothProps, {
|
|
358
366
|
hideIcon: true,
|
|
359
367
|
onChange: this.onTimeChange,
|
|
360
368
|
selectProps: mergedTimePickerSelectProps,
|
|
@@ -365,11 +373,11 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
365
373
|
locale: locale,
|
|
366
374
|
testId: testId && "".concat(testId, "--timepicker")
|
|
367
375
|
}, timePickerProps))), isClearable && !isDisabled ? // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
368
|
-
(0,
|
|
376
|
+
(0, _react2.jsx)("div", {
|
|
369
377
|
css: iconContainerStyles,
|
|
370
378
|
onClick: this.onClear,
|
|
371
379
|
"data-testid": testId && "".concat(testId, "--icon--container")
|
|
372
|
-
}, (0,
|
|
380
|
+
}, (0, _react2.jsx)(_selectClear.default, {
|
|
373
381
|
size: "small",
|
|
374
382
|
primaryColor: "inherit",
|
|
375
383
|
label: "clear"
|
|
@@ -39,8 +39,6 @@ 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");
|
|
@@ -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.
|
|
68
|
+
var packageVersion = "12.2.0";
|
|
71
69
|
var menuStyles = {
|
|
72
70
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
73
71
|
position: 'static',
|
|
@@ -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: _this.getSafeState().isFocused ? "var(--ds-background-input-pressed, transparent)" : '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,
|
|
@@ -329,7 +320,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
329
320
|
name = _this$props3.name,
|
|
330
321
|
selectProps = _this$props3.selectProps,
|
|
331
322
|
spacing = _this$props3.spacing,
|
|
332
|
-
testId = _this$props3.testId
|
|
323
|
+
testId = _this$props3.testId,
|
|
324
|
+
isInvalid = _this$props3.isInvalid;
|
|
333
325
|
var ICON_PADDING = 2;
|
|
334
326
|
|
|
335
327
|
var _this$getSafeState3 = this.getSafeState(),
|
|
@@ -337,11 +329,9 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
337
329
|
value = _this$getSafeState3$v === void 0 ? '' : _this$getSafeState3$v,
|
|
338
330
|
isOpen = _this$getSafeState3.isOpen;
|
|
339
331
|
|
|
340
|
-
var validationState = this.props.isInvalid ? 'error' : 'default';
|
|
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,
|
|
@@ -408,7 +399,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
408
399
|
value: labelAndValue,
|
|
409
400
|
spacing: spacing,
|
|
410
401
|
fixedLayerRef: this.containerRef,
|
|
411
|
-
|
|
402
|
+
isInvalid: isInvalid,
|
|
412
403
|
testId: testId
|
|
413
404
|
}, otherSelectProps)))
|
|
414
405
|
);
|
package/dist/cjs/version.json
CHANGED
|
@@ -5,7 +5,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
5
5
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { Component } from 'react';
|
|
8
|
-
import { css, jsx } from '@emotion/
|
|
8
|
+
import { css, jsx } from '@emotion/react'; // eslint-disable-next-line no-restricted-imports
|
|
9
9
|
|
|
10
10
|
import { format, isValid, lastDayOfMonth, parseISO } from 'date-fns';
|
|
11
11
|
import pick from 'lodash/pick';
|
|
@@ -14,13 +14,13 @@ import Calendar from '@atlaskit/calendar';
|
|
|
14
14
|
import CalendarIcon from '@atlaskit/icon/glyph/calendar';
|
|
15
15
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
16
16
|
import Select, { mergeStyles } from '@atlaskit/select';
|
|
17
|
-
import {
|
|
17
|
+
import { N20, N50A, N60A } from '@atlaskit/theme/colors';
|
|
18
18
|
import { borderRadius, gridSize, layers } from '@atlaskit/theme/constants';
|
|
19
19
|
import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime } from '../internal';
|
|
20
20
|
import FixedLayer from '../internal/fixed-layer';
|
|
21
21
|
import { convertTokens } from './utils';
|
|
22
22
|
const packageName = "@atlaskit/datetime-picker";
|
|
23
|
-
const packageVersion = "12.
|
|
23
|
+
const packageVersion = "12.2.0";
|
|
24
24
|
/* eslint-disable react/no-unused-prop-types */
|
|
25
25
|
|
|
26
26
|
function getDateObj(date) {
|
|
@@ -351,12 +351,6 @@ class DatePicker extends Component {
|
|
|
351
351
|
}
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
-
_defineProperty(this, "getSubtleControlStyles", () => ({
|
|
355
|
-
border: `2px solid ${this.getSafeState().isFocused ? `var(--ds-border-focused, ${B100})` : `transparent`}`,
|
|
356
|
-
backgroundColor: this.getSafeState().isOpen ? "var(--ds-background-input-pressed, transparent)" : 'transparent',
|
|
357
|
-
padding: '1px'
|
|
358
|
-
}));
|
|
359
|
-
|
|
360
354
|
_defineProperty(this, "parseDate", date => {
|
|
361
355
|
const {
|
|
362
356
|
parseInputValue,
|
|
@@ -477,7 +471,6 @@ class DatePicker extends Component {
|
|
|
477
471
|
const {
|
|
478
472
|
styles: selectStyles = {}
|
|
479
473
|
} = selectProps;
|
|
480
|
-
const controlStyles = appearance === 'subtle' ? this.getSubtleControlStyles() : {};
|
|
481
474
|
const disabledStyle = isDisabled ? {
|
|
482
475
|
pointerEvents: 'none'
|
|
483
476
|
} : {};
|
|
@@ -511,6 +504,7 @@ class DatePicker extends Component {
|
|
|
511
504
|
value: value,
|
|
512
505
|
"data-testid": testId && `${testId}--input`
|
|
513
506
|
}), jsx(Select, _extends({
|
|
507
|
+
appearance: this.props.appearance,
|
|
514
508
|
enableAnimation: false,
|
|
515
509
|
menuIsOpen: menuIsOpen,
|
|
516
510
|
closeMenuOnSelect: true,
|
|
@@ -525,7 +519,6 @@ class DatePicker extends Component {
|
|
|
525
519
|
onChange: this.onSelectChange,
|
|
526
520
|
styles: mergeStyles(selectStyles, {
|
|
527
521
|
control: base => ({ ...base,
|
|
528
|
-
...controlStyles,
|
|
529
522
|
...disabledStyle
|
|
530
523
|
}),
|
|
531
524
|
indicatorsContainer: base => ({ ...base,
|
|
@@ -541,7 +534,7 @@ class DatePicker extends Component {
|
|
|
541
534
|
}, selectProps, calendarProps, {
|
|
542
535
|
isClearable: true,
|
|
543
536
|
spacing: spacing,
|
|
544
|
-
|
|
537
|
+
isInvalid: isInvalid,
|
|
545
538
|
testId: testId
|
|
546
539
|
})));
|
|
547
540
|
}
|
|
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { css, jsx } from '@emotion/
|
|
8
|
+
import { css, jsx } from '@emotion/react'; // eslint-disable-next-line no-restricted-imports
|
|
9
9
|
|
|
10
10
|
import { format, isValid, parseISO } from 'date-fns';
|
|
11
11
|
import pick from 'lodash/pick';
|
|
@@ -19,7 +19,7 @@ import DatePicker from './date-picker';
|
|
|
19
19
|
import TimePicker from './time-picker';
|
|
20
20
|
import { convertTokens } from './utils';
|
|
21
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
22
|
-
const packageVersion = "12.
|
|
22
|
+
const packageVersion = "12.2.0";
|
|
23
23
|
/* eslint-disable react/no-unused-prop-types */
|
|
24
24
|
|
|
25
25
|
const isInvalidBorderStyles = css({
|
|
@@ -39,6 +39,14 @@ const subtleFocusedBgStyles = css({
|
|
|
39
39
|
backgroundColor: "var(--ds-background-input-pressed, transparent)",
|
|
40
40
|
borderColor: 'transparent'
|
|
41
41
|
});
|
|
42
|
+
const noBgStyles = css({
|
|
43
|
+
backgroundColor: 'transparent',
|
|
44
|
+
borderColor: 'transparent',
|
|
45
|
+
'&:hover': {
|
|
46
|
+
backgroundColor: 'transparent',
|
|
47
|
+
borderColor: 'transparent'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
42
50
|
const hoverStyles = css({
|
|
43
51
|
'&:hover': {
|
|
44
52
|
backgroundColor: `var(--ds-background-input-hovered, ${N30})`,
|
|
@@ -281,7 +289,7 @@ class DateTimePicker extends React.Component {
|
|
|
281
289
|
const notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
282
290
|
const labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
283
291
|
return jsx("div", _extends({
|
|
284
|
-
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : 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]
|
|
285
293
|
}, innerProps, {
|
|
286
294
|
"data-testid": testId
|
|
287
295
|
}), jsx("input", {
|
|
@@ -9,14 +9,13 @@ import pick from 'lodash/pick';
|
|
|
9
9
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
11
11
|
import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
|
|
12
|
-
import { B100 } from '@atlaskit/theme/colors';
|
|
13
12
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
14
13
|
import { defaultTimeFormat, defaultTimes, DropdownIndicator, EmptyClearIndicator, placeholderDatetime } from '../internal';
|
|
15
14
|
import FixedLayer from '../internal/fixed-layer';
|
|
16
15
|
import parseTime from '../internal/parse-time';
|
|
17
16
|
import { convertTokens } from './utils';
|
|
18
17
|
const packageName = "@atlaskit/datetime-picker";
|
|
19
|
-
const packageVersion = "12.
|
|
18
|
+
const packageVersion = "12.2.0";
|
|
20
19
|
const menuStyles = {
|
|
21
20
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
22
21
|
position: 'static',
|
|
@@ -188,12 +187,6 @@ class TimePicker extends React.Component {
|
|
|
188
187
|
}
|
|
189
188
|
});
|
|
190
189
|
|
|
191
|
-
_defineProperty(this, "getSubtleControlStyles", selectStyles => !selectStyles.control ? {
|
|
192
|
-
border: `2px solid ${this.getSafeState().isFocused ? `var(--ds-border-focused, ${B100})` : `transparent`}`,
|
|
193
|
-
backgroundColor: this.getSafeState().isFocused ? "var(--ds-background-input-pressed, transparent)" : 'transparent',
|
|
194
|
-
padding: '1px'
|
|
195
|
-
} : {});
|
|
196
|
-
|
|
197
190
|
_defineProperty(this, "formatTime", time => {
|
|
198
191
|
const {
|
|
199
192
|
formatDisplayLabel,
|
|
@@ -269,19 +262,18 @@ class TimePicker extends React.Component {
|
|
|
269
262
|
name,
|
|
270
263
|
selectProps,
|
|
271
264
|
spacing,
|
|
272
|
-
testId
|
|
265
|
+
testId,
|
|
266
|
+
isInvalid
|
|
273
267
|
} = this.props;
|
|
274
268
|
const ICON_PADDING = 2;
|
|
275
269
|
const {
|
|
276
270
|
value = '',
|
|
277
271
|
isOpen
|
|
278
272
|
} = this.getSafeState();
|
|
279
|
-
const validationState = this.props.isInvalid ? 'error' : 'default';
|
|
280
273
|
const {
|
|
281
274
|
styles: selectStyles = {},
|
|
282
275
|
...otherSelectProps
|
|
283
276
|
} = selectProps;
|
|
284
|
-
const controlStyles = this.props.appearance === 'subtle' ? this.getSubtleControlStyles(selectStyles) : {};
|
|
285
277
|
const SelectComponent = this.props.timeIsEditable ? CreatableSelect : Select;
|
|
286
278
|
const labelAndValue = value && {
|
|
287
279
|
label: this.formatTime(value),
|
|
@@ -298,8 +290,7 @@ class TimePicker extends React.Component {
|
|
|
298
290
|
|
|
299
291
|
const renderIconContainer = Boolean(!hideIcon && value);
|
|
300
292
|
const mergedStyles = mergeStyles(selectStyles, {
|
|
301
|
-
control: base => ({ ...base
|
|
302
|
-
...controlStyles
|
|
293
|
+
control: base => ({ ...base
|
|
303
294
|
}),
|
|
304
295
|
menu: base => ({ ...base,
|
|
305
296
|
...menuStyles,
|
|
@@ -325,6 +316,7 @@ class TimePicker extends React.Component {
|
|
|
325
316
|
type: "hidden",
|
|
326
317
|
value: value
|
|
327
318
|
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
319
|
+
appearance: this.props.appearance,
|
|
328
320
|
autoFocus: autoFocus,
|
|
329
321
|
components: selectComponents,
|
|
330
322
|
instanceId: id,
|
|
@@ -345,7 +337,7 @@ class TimePicker extends React.Component {
|
|
|
345
337
|
value: labelAndValue,
|
|
346
338
|
spacing: spacing,
|
|
347
339
|
fixedLayerRef: this.containerRef,
|
|
348
|
-
|
|
340
|
+
isInvalid: isInvalid,
|
|
349
341
|
testId: testId
|
|
350
342
|
}, otherSelectProps)))
|
|
351
343
|
);
|
package/dist/es2019/version.json
CHANGED
|
@@ -20,7 +20,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
20
20
|
|
|
21
21
|
/** @jsx jsx */
|
|
22
22
|
import { Component } from 'react';
|
|
23
|
-
import { css, jsx } from '@emotion/
|
|
23
|
+
import { css, jsx } from '@emotion/react'; // eslint-disable-next-line no-restricted-imports
|
|
24
24
|
|
|
25
25
|
import { format, isValid, lastDayOfMonth, parseISO } from 'date-fns';
|
|
26
26
|
import pick from 'lodash/pick';
|
|
@@ -29,13 +29,13 @@ import Calendar from '@atlaskit/calendar';
|
|
|
29
29
|
import CalendarIcon from '@atlaskit/icon/glyph/calendar';
|
|
30
30
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
31
31
|
import Select, { mergeStyles } from '@atlaskit/select';
|
|
32
|
-
import {
|
|
32
|
+
import { N20, N50A, N60A } from '@atlaskit/theme/colors';
|
|
33
33
|
import { borderRadius, gridSize, layers } from '@atlaskit/theme/constants';
|
|
34
34
|
import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime } from '../internal';
|
|
35
35
|
import FixedLayer from '../internal/fixed-layer';
|
|
36
36
|
import { convertTokens } from './utils';
|
|
37
37
|
var packageName = "@atlaskit/datetime-picker";
|
|
38
|
-
var packageVersion = "12.
|
|
38
|
+
var packageVersion = "12.2.0";
|
|
39
39
|
/* eslint-disable react/no-unused-prop-types */
|
|
40
40
|
|
|
41
41
|
function getDateObj(date) {
|
|
@@ -385,14 +385,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
385
385
|
}
|
|
386
386
|
});
|
|
387
387
|
|
|
388
|
-
_defineProperty(_assertThisInitialized(_this), "getSubtleControlStyles", function () {
|
|
389
|
-
return {
|
|
390
|
-
border: "2px solid ".concat(_this.getSafeState().isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "transparent"),
|
|
391
|
-
backgroundColor: _this.getSafeState().isOpen ? "var(--ds-background-input-pressed, transparent)" : 'transparent',
|
|
392
|
-
padding: '1px'
|
|
393
|
-
};
|
|
394
|
-
});
|
|
395
|
-
|
|
396
388
|
_defineProperty(_assertThisInitialized(_this), "parseDate", function (date) {
|
|
397
389
|
var _this$props = _this.props,
|
|
398
390
|
parseInputValue = _this$props.parseInputValue,
|
|
@@ -512,7 +504,6 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
512
504
|
|
|
513
505
|
var _selectProps$styles = selectProps.styles,
|
|
514
506
|
selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles;
|
|
515
|
-
var controlStyles = appearance === 'subtle' ? this.getSubtleControlStyles() : {};
|
|
516
507
|
var disabledStyle = isDisabled ? {
|
|
517
508
|
pointerEvents: 'none'
|
|
518
509
|
} : {};
|
|
@@ -546,6 +537,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
546
537
|
value: value,
|
|
547
538
|
"data-testid": testId && "".concat(testId, "--input")
|
|
548
539
|
}), jsx(Select, _extends({
|
|
540
|
+
appearance: this.props.appearance,
|
|
549
541
|
enableAnimation: false,
|
|
550
542
|
menuIsOpen: menuIsOpen,
|
|
551
543
|
closeMenuOnSelect: true,
|
|
@@ -560,7 +552,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
560
552
|
onChange: this.onSelectChange,
|
|
561
553
|
styles: mergeStyles(selectStyles, {
|
|
562
554
|
control: function control(base) {
|
|
563
|
-
return _objectSpread(_objectSpread(
|
|
555
|
+
return _objectSpread(_objectSpread({}, base), disabledStyle);
|
|
564
556
|
},
|
|
565
557
|
indicatorsContainer: function indicatorsContainer(base) {
|
|
566
558
|
return _objectSpread(_objectSpread({}, base), {}, {
|
|
@@ -577,7 +569,7 @@ var DatePicker = /*#__PURE__*/function (_Component) {
|
|
|
577
569
|
}, selectProps, calendarProps, {
|
|
578
570
|
isClearable: true,
|
|
579
571
|
spacing: spacing,
|
|
580
|
-
|
|
572
|
+
isInvalid: isInvalid,
|
|
581
573
|
testId: testId
|
|
582
574
|
})));
|
|
583
575
|
}
|
|
@@ -19,7 +19,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
19
19
|
|
|
20
20
|
/** @jsx jsx */
|
|
21
21
|
import React from 'react';
|
|
22
|
-
import { css, jsx } from '@emotion/
|
|
22
|
+
import { css, jsx } from '@emotion/react'; // eslint-disable-next-line no-restricted-imports
|
|
23
23
|
|
|
24
24
|
import { format, isValid, parseISO } from 'date-fns';
|
|
25
25
|
import pick from 'lodash/pick';
|
|
@@ -33,7 +33,7 @@ import DatePicker from './date-picker';
|
|
|
33
33
|
import TimePicker from './time-picker';
|
|
34
34
|
import { convertTokens } from './utils';
|
|
35
35
|
var packageName = "@atlaskit/datetime-picker";
|
|
36
|
-
var packageVersion = "12.
|
|
36
|
+
var packageVersion = "12.2.0";
|
|
37
37
|
/* eslint-disable react/no-unused-prop-types */
|
|
38
38
|
|
|
39
39
|
var isInvalidBorderStyles = css({
|
|
@@ -53,6 +53,14 @@ var subtleFocusedBgStyles = css({
|
|
|
53
53
|
backgroundColor: "var(--ds-background-input-pressed, transparent)",
|
|
54
54
|
borderColor: 'transparent'
|
|
55
55
|
});
|
|
56
|
+
var noBgStyles = css({
|
|
57
|
+
backgroundColor: 'transparent',
|
|
58
|
+
borderColor: 'transparent',
|
|
59
|
+
'&:hover': {
|
|
60
|
+
backgroundColor: 'transparent',
|
|
61
|
+
borderColor: 'transparent'
|
|
62
|
+
}
|
|
63
|
+
});
|
|
56
64
|
var hoverStyles = css({
|
|
57
65
|
'&:hover': {
|
|
58
66
|
backgroundColor: "var(--ds-background-input-hovered, ".concat(N30, ")"),
|
|
@@ -315,7 +323,7 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
315
323
|
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
316
324
|
var labelId = (datePickerSelectProps === null || datePickerSelectProps === void 0 ? void 0 : datePickerSelectProps.inputId) || (timePickerSelectProps === null || timePickerSelectProps === void 0 ? void 0 : timePickerSelectProps.inputId) || '';
|
|
317
325
|
return jsx("div", _extends({
|
|
318
|
-
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && (isFocused ? subtleFocusedBgStyles : subtleBgStyles), isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
326
|
+
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]
|
|
319
327
|
}, innerProps, {
|
|
320
328
|
"data-testid": testId
|
|
321
329
|
}), jsx("input", {
|
|
@@ -26,14 +26,13 @@ import pick from 'lodash/pick';
|
|
|
26
26
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
27
27
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
28
28
|
import Select, { components, CreatableSelect, mergeStyles } from '@atlaskit/select';
|
|
29
|
-
import { B100 } from '@atlaskit/theme/colors';
|
|
30
29
|
import { gridSize } from '@atlaskit/theme/constants';
|
|
31
30
|
import { defaultTimeFormat, defaultTimes, DropdownIndicator, EmptyClearIndicator, placeholderDatetime } from '../internal';
|
|
32
31
|
import FixedLayer from '../internal/fixed-layer';
|
|
33
32
|
import parseTime from '../internal/parse-time';
|
|
34
33
|
import { convertTokens } from './utils';
|
|
35
34
|
var packageName = "@atlaskit/datetime-picker";
|
|
36
|
-
var packageVersion = "12.
|
|
35
|
+
var packageVersion = "12.2.0";
|
|
37
36
|
var menuStyles = {
|
|
38
37
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
39
38
|
position: 'static',
|
|
@@ -221,14 +220,6 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
221
220
|
}
|
|
222
221
|
});
|
|
223
222
|
|
|
224
|
-
_defineProperty(_assertThisInitialized(_this), "getSubtleControlStyles", function (selectStyles) {
|
|
225
|
-
return !selectStyles.control ? {
|
|
226
|
-
border: "2px solid ".concat(_this.getSafeState().isFocused ? "var(--ds-border-focused, ".concat(B100, ")") : "transparent"),
|
|
227
|
-
backgroundColor: _this.getSafeState().isFocused ? "var(--ds-background-input-pressed, transparent)" : 'transparent',
|
|
228
|
-
padding: '1px'
|
|
229
|
-
} : {};
|
|
230
|
-
});
|
|
231
|
-
|
|
232
223
|
_defineProperty(_assertThisInitialized(_this), "formatTime", function (time) {
|
|
233
224
|
var _this$props2 = _this.props,
|
|
234
225
|
formatDisplayLabel = _this$props2.formatDisplayLabel,
|
|
@@ -311,7 +302,8 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
311
302
|
name = _this$props3.name,
|
|
312
303
|
selectProps = _this$props3.selectProps,
|
|
313
304
|
spacing = _this$props3.spacing,
|
|
314
|
-
testId = _this$props3.testId
|
|
305
|
+
testId = _this$props3.testId,
|
|
306
|
+
isInvalid = _this$props3.isInvalid;
|
|
315
307
|
var ICON_PADDING = 2;
|
|
316
308
|
|
|
317
309
|
var _this$getSafeState3 = this.getSafeState(),
|
|
@@ -319,13 +311,10 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
319
311
|
value = _this$getSafeState3$v === void 0 ? '' : _this$getSafeState3$v,
|
|
320
312
|
isOpen = _this$getSafeState3.isOpen;
|
|
321
313
|
|
|
322
|
-
var validationState = this.props.isInvalid ? 'error' : 'default';
|
|
323
|
-
|
|
324
314
|
var _selectProps$styles = selectProps.styles,
|
|
325
315
|
selectStyles = _selectProps$styles === void 0 ? {} : _selectProps$styles,
|
|
326
316
|
otherSelectProps = _objectWithoutProperties(selectProps, _excluded2);
|
|
327
317
|
|
|
328
|
-
var controlStyles = this.props.appearance === 'subtle' ? this.getSubtleControlStyles(selectStyles) : {};
|
|
329
318
|
var SelectComponent = this.props.timeIsEditable ? CreatableSelect : Select;
|
|
330
319
|
var labelAndValue = value && {
|
|
331
320
|
label: this.formatTime(value),
|
|
@@ -343,7 +332,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
343
332
|
var renderIconContainer = Boolean(!hideIcon && value);
|
|
344
333
|
var mergedStyles = mergeStyles(selectStyles, {
|
|
345
334
|
control: function control(base) {
|
|
346
|
-
return _objectSpread(
|
|
335
|
+
return _objectSpread({}, base);
|
|
347
336
|
},
|
|
348
337
|
menu: function menu(base) {
|
|
349
338
|
return _objectSpread(_objectSpread(_objectSpread({}, base), menuStyles), {}, {
|
|
@@ -372,6 +361,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
372
361
|
type: "hidden",
|
|
373
362
|
value: value
|
|
374
363
|
}), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
364
|
+
appearance: this.props.appearance,
|
|
375
365
|
autoFocus: autoFocus,
|
|
376
366
|
components: selectComponents,
|
|
377
367
|
instanceId: id,
|
|
@@ -392,7 +382,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
392
382
|
value: labelAndValue,
|
|
393
383
|
spacing: spacing,
|
|
394
384
|
fixedLayerRef: this.containerRef,
|
|
395
|
-
|
|
385
|
+
isInvalid: isInvalid,
|
|
396
386
|
testId: testId
|
|
397
387
|
}, otherSelectProps)))
|
|
398
388
|
);
|
package/dist/esm/version.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
3
4
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
4
5
|
import { CalendarRef } from '@atlaskit/calendar';
|
|
5
6
|
import { LocalizationProvider } from '@atlaskit/locale';
|
|
@@ -244,11 +245,6 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
244
245
|
refCalendar: (ref: CalendarRef | null) => void;
|
|
245
246
|
handleInputChange: (inputValue: string, actionMeta: {}) => void;
|
|
246
247
|
getContainerRef: (ref: HTMLElement | null) => void;
|
|
247
|
-
getSubtleControlStyles: () => {
|
|
248
|
-
border: string;
|
|
249
|
-
backgroundColor: string;
|
|
250
|
-
padding: string;
|
|
251
|
-
};
|
|
252
248
|
/**
|
|
253
249
|
* There are two props that can change how the date is parsed.
|
|
254
250
|
* The priority of props used is:
|
|
@@ -265,7 +261,7 @@ declare class DatePicker extends Component<DatePickerProps, State> {
|
|
|
265
261
|
*/
|
|
266
262
|
formatDate: (value: string) => string;
|
|
267
263
|
getPlaceholder: () => string;
|
|
268
|
-
render(): JSX.Element;
|
|
264
|
+
render(): jsx.JSX.Element;
|
|
269
265
|
}
|
|
270
266
|
export { DatePicker as DatePickerWithoutAnalytics };
|
|
271
267
|
declare const _default: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "maxDate" | "minDate" | "isOpen" | "nextMonthLabel" | "parseInputValue" | "formatDisplayLabel" | "previousMonthLabel" | "value" | "dateFormat" | "placeholder" | "weekStartDay"> & Partial<Pick<Omit<DatePickerProps, keyof WithAnalyticsEventsProps>, "icon" | "disabled" | "appearance" | "selectProps" | "innerProps" | "autoFocus" | "defaultIsOpen" | "defaultValue" | "disabledDateFilter" | "hideIcon" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale">> & Partial<Pick<{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
3
4
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
4
5
|
import { SelectProps } from '@atlaskit/select';
|
|
5
6
|
import { Appearance, Spacing } from '../types';
|
|
@@ -190,7 +191,7 @@ declare class DateTimePicker extends React.Component<DateTimePickerProps, State>
|
|
|
190
191
|
timeValue: string;
|
|
191
192
|
zoneValue: string;
|
|
192
193
|
}): void;
|
|
193
|
-
render(): JSX.Element;
|
|
194
|
+
render(): jsx.JSX.Element;
|
|
194
195
|
}
|
|
195
196
|
export { DateTimePicker as DateTimePickerWithoutAnalytics };
|
|
196
197
|
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "testId" | "value" | "dateFormat" | "timeFormat" | "parseValue"> & Partial<Pick<Omit<DateTimePickerProps, keyof WithAnalyticsEventsProps>, "appearance" | "innerProps" | "autoFocus" | "defaultValue" | "id" | "isDisabled" | "isInvalid" | "name" | "onBlur" | "onChange" | "onFocus" | "spacing" | "locale" | "times" | "timeIsEditable" | "datePickerProps" | "timePickerProps" | "datePickerSelectProps" | "timePickerSelectProps">> & Partial<Pick<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
3
|
import { LocalizationProvider } from '@atlaskit/locale';
|
|
4
|
-
import { ActionMeta, OptionType, SelectProps
|
|
4
|
+
import { ActionMeta, OptionType, SelectProps } from '@atlaskit/select';
|
|
5
5
|
import { Appearance, Spacing } from '../types';
|
|
6
6
|
interface Option {
|
|
7
7
|
label: string;
|
|
@@ -192,15 +192,6 @@ declare class TimePicker extends React.Component<TimePickerProps, State> {
|
|
|
192
192
|
onBlur: (event: React.FocusEvent<HTMLElement>) => void;
|
|
193
193
|
onFocus: (event: React.FocusEvent<HTMLElement>) => void;
|
|
194
194
|
onSelectKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
195
|
-
getSubtleControlStyles: (selectStyles: StylesConfig) => {
|
|
196
|
-
border: string;
|
|
197
|
-
backgroundColor: string;
|
|
198
|
-
padding: string;
|
|
199
|
-
} | {
|
|
200
|
-
border?: undefined;
|
|
201
|
-
backgroundColor?: undefined;
|
|
202
|
-
padding?: undefined;
|
|
203
|
-
};
|
|
204
195
|
/**
|
|
205
196
|
* There are multiple props that can change how the time is formatted.
|
|
206
197
|
* The priority of props used is:
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/datetime-picker",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.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/"
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
28
|
-
"@atlaskit/calendar": "^12.
|
|
28
|
+
"@atlaskit/calendar": "^12.4.0",
|
|
29
29
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
30
30
|
"@atlaskit/icon": "^21.10.0",
|
|
31
31
|
"@atlaskit/locale": "^2.1.0",
|
|
32
32
|
"@atlaskit/popper": "^5.2.0",
|
|
33
|
-
"@atlaskit/select": "^15.
|
|
34
|
-
"@atlaskit/theme": "^12.
|
|
33
|
+
"@atlaskit/select": "^15.7.0",
|
|
34
|
+
"@atlaskit/theme": "^12.2.0",
|
|
35
35
|
"@atlaskit/tokens": "^0.10.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|
|
37
|
-
"@emotion/
|
|
37
|
+
"@emotion/react": "^11.7.1",
|
|
38
38
|
"date-fns": "^2.17.0",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"react-scrolllock": "^5.0.1"
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"@atlaskit/docs": "*",
|
|
48
48
|
"@atlaskit/field-base": "^15.0.5",
|
|
49
49
|
"@atlaskit/form": "^8.5.0",
|
|
50
|
-
"@atlaskit/modal-dialog": "^12.
|
|
50
|
+
"@atlaskit/modal-dialog": "^12.3.0",
|
|
51
51
|
"@atlaskit/popup": "^1.4.0",
|
|
52
52
|
"@atlaskit/range": "^6.0.0",
|
|
53
|
-
"@atlaskit/section-message": "^6.
|
|
53
|
+
"@atlaskit/section-message": "^6.2.0",
|
|
54
54
|
"@atlaskit/ssr": "*",
|
|
55
|
-
"@atlaskit/textfield": "^5.
|
|
56
|
-
"@atlaskit/toggle": "^12.
|
|
55
|
+
"@atlaskit/textfield": "^5.2.0",
|
|
56
|
+
"@atlaskit/toggle": "^12.5.0",
|
|
57
57
|
"@atlaskit/visual-regression": "*",
|
|
58
58
|
"@atlaskit/webdriver-runner": "*",
|
|
59
59
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
60
|
-
"@emotion/
|
|
60
|
+
"@emotion/react": "^11.7.1",
|
|
61
61
|
"@testing-library/react": "^8.0.1",
|
|
62
62
|
"enzyme": "^3.10.0",
|
|
63
63
|
"enzyme-to-json": "^3.3.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"react-dom": "^16.8.0",
|
|
66
66
|
"react-lorem-component": "^0.13.0",
|
|
67
67
|
"react-test-renderer": "^16.8.0",
|
|
68
|
-
"typescript": "4.
|
|
68
|
+
"typescript": "4.3.5"
|
|
69
69
|
},
|
|
70
70
|
"techstack": {
|
|
71
71
|
"@atlassian/frontend": {
|