@atlaskit/datetime-picker 11.0.2 → 11.1.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 +14 -0
- package/dist/cjs/components/DatePicker.js +21 -18
- package/dist/cjs/components/DateTimePicker.js +83 -108
- package/dist/cjs/components/TimePicker.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/DatePicker.js +22 -18
- package/dist/es2019/components/DateTimePicker.js +79 -121
- package/dist/es2019/components/TimePicker.js +3 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/DatePicker.js +23 -18
- package/dist/esm/components/DateTimePicker.js +83 -96
- package/dist/esm/components/TimePicker.js +3 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/components/DatePicker.d.ts +14 -13
- package/dist/types/components/DateTimePicker.d.ts +4 -3
- package/dist/types/components/TimePicker.d.ts +2 -2
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/datetime-picker
|
|
2
2
|
|
|
3
|
+
## 11.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`354ef86cca0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/354ef86cca0) - Instrumented datetime-picker with the new theming package, `@atlaskit/tokens`.
|
|
8
|
+
|
|
9
|
+
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
10
|
+
These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`2b98dfda0a6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2b98dfda0a6) - Removes `@emotion/styled` in favour of `@emotion/core`.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 11.0.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -27,11 +27,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
27
27
|
|
|
28
28
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _react = require("react");
|
|
31
31
|
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
32
|
+
var _core = require("@emotion/core");
|
|
35
33
|
|
|
36
34
|
var _dateFns = require("date-fns");
|
|
37
35
|
|
|
@@ -51,7 +49,7 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
51
49
|
|
|
52
50
|
var _constants = require("@atlaskit/theme/constants");
|
|
53
51
|
|
|
54
|
-
var
|
|
52
|
+
var _tokens = require("@atlaskit/tokens");
|
|
55
53
|
|
|
56
54
|
var _internal = require("../internal");
|
|
57
55
|
|
|
@@ -59,8 +57,6 @@ var _FixedLayer = _interopRequireDefault(require("../internal/FixedLayer"));
|
|
|
59
57
|
|
|
60
58
|
var _utils = require("./utils");
|
|
61
59
|
|
|
62
|
-
var _templateObject;
|
|
63
|
-
|
|
64
60
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
65
61
|
|
|
66
62
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -74,7 +70,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
74
70
|
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; } }
|
|
75
71
|
|
|
76
72
|
var packageName = "@atlaskit/datetime-picker";
|
|
77
|
-
var packageVersion = "11.0
|
|
73
|
+
var packageVersion = "11.1.0";
|
|
78
74
|
/* eslint-disable react/no-unused-prop-types */
|
|
79
75
|
|
|
80
76
|
function getDateObj(date) {
|
|
@@ -90,15 +86,22 @@ function getValidDate(iso) {
|
|
|
90
86
|
return (0, _dateFns.isValid)(date) ? getDateObj(date) : {};
|
|
91
87
|
}
|
|
92
88
|
|
|
93
|
-
var
|
|
89
|
+
var menuStyles = (0, _core.css)({
|
|
90
|
+
zIndex: _constants.layers.dialog(),
|
|
91
|
+
backgroundColor: (0, _tokens.token)('color.background.default', _colors.N20),
|
|
92
|
+
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
93
|
+
boxShadow: (0, _tokens.token)('shadow.overlay', "0 4px 8px -2px ".concat(_colors.N50A, ", 0 0 1px ").concat(_colors.N60A))
|
|
94
|
+
});
|
|
94
95
|
|
|
95
96
|
var Menu = function Menu(_ref) {
|
|
96
97
|
var selectProps = _ref.selectProps,
|
|
97
98
|
innerProps = _ref.innerProps;
|
|
98
|
-
return
|
|
99
|
+
return (0, _core.jsx)(_FixedLayer.default, {
|
|
99
100
|
inputValue: selectProps.inputValue,
|
|
100
101
|
containerRef: selectProps.calendarContainerRef,
|
|
101
|
-
content:
|
|
102
|
+
content: (0, _core.jsx)("div", (0, _extends2.default)({
|
|
103
|
+
css: menuStyles
|
|
104
|
+
}, innerProps), (0, _core.jsx)(_calendar.default, (0, _extends2.default)({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
|
|
102
105
|
disabled: selectProps.calendarDisabled,
|
|
103
106
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
104
107
|
minDate: selectProps.calendarMinDate,
|
|
@@ -141,8 +144,8 @@ var datePickerDefaultProps = {
|
|
|
141
144
|
|
|
142
145
|
};
|
|
143
146
|
|
|
144
|
-
var DatePicker = /*#__PURE__*/function (
|
|
145
|
-
(0, _inherits2.default)(DatePicker,
|
|
147
|
+
var DatePicker = /*#__PURE__*/function (_Component) {
|
|
148
|
+
(0, _inherits2.default)(DatePicker, _Component);
|
|
146
149
|
|
|
147
150
|
var _super = _createSuper(DatePicker);
|
|
148
151
|
|
|
@@ -379,7 +382,7 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
379
382
|
});
|
|
380
383
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSubtleControlStyles", function (isOpen) {
|
|
381
384
|
return {
|
|
382
|
-
border: "2px solid ".concat(isOpen ? _colors.B100 : "transparent"),
|
|
385
|
+
border: "2px solid ".concat(isOpen ? (0, _tokens.token)('color.border.focus', _colors.B100) : "transparent"),
|
|
383
386
|
backgroundColor: 'transparent',
|
|
384
387
|
padding: '1px'
|
|
385
388
|
};
|
|
@@ -517,19 +520,19 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
517
520
|
calendarLocale: locale,
|
|
518
521
|
calendarWeekStartDay: weekStartDay
|
|
519
522
|
};
|
|
520
|
-
return
|
|
523
|
+
return (0, _core.jsx)("div", (0, _extends2.default)({}, innerProps, {
|
|
521
524
|
role: "presentation",
|
|
522
525
|
onClick: this.onInputClick,
|
|
523
526
|
onInput: this.onSelectInput,
|
|
524
527
|
onKeyDown: this.onSelectKeyDown,
|
|
525
528
|
ref: this.getContainerRef,
|
|
526
529
|
"data-testid": testId && "".concat(testId, "--container")
|
|
527
|
-
}),
|
|
530
|
+
}), (0, _core.jsx)("input", {
|
|
528
531
|
name: name,
|
|
529
532
|
type: "hidden",
|
|
530
533
|
value: value,
|
|
531
534
|
"data-testid": testId && "".concat(testId, "--input")
|
|
532
|
-
}),
|
|
535
|
+
}), (0, _core.jsx)(_select.default, (0, _extends2.default)({
|
|
533
536
|
enableAnimation: false,
|
|
534
537
|
menuIsOpen: menuIsOpen,
|
|
535
538
|
closeMenuOnSelect: true,
|
|
@@ -567,7 +570,7 @@ var DatePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
567
570
|
}
|
|
568
571
|
}]);
|
|
569
572
|
return DatePicker;
|
|
570
|
-
}(_react.
|
|
573
|
+
}(_react.Component);
|
|
571
574
|
|
|
572
575
|
exports.DatePickerWithoutAnalytics = DatePicker;
|
|
573
576
|
(0, _defineProperty2.default)(DatePicker, "defaultProps", datePickerDefaultProps);
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -25,11 +23,9 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
25
23
|
|
|
26
24
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
25
|
|
|
28
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
29
|
-
|
|
30
26
|
var _react = _interopRequireDefault(require("react"));
|
|
31
27
|
|
|
32
|
-
var
|
|
28
|
+
var _core = require("@emotion/core");
|
|
33
29
|
|
|
34
30
|
var _dateFns = require("date-fns");
|
|
35
31
|
|
|
@@ -41,10 +37,12 @@ var _selectClear = _interopRequireDefault(require("@atlaskit/icon/glyph/select-c
|
|
|
41
37
|
|
|
42
38
|
var _select = require("@atlaskit/select");
|
|
43
39
|
|
|
44
|
-
var
|
|
40
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
45
41
|
|
|
46
42
|
var _constants = require("@atlaskit/theme/constants");
|
|
47
43
|
|
|
44
|
+
var _tokens = require("@atlaskit/tokens");
|
|
45
|
+
|
|
48
46
|
var _internal = require("../internal");
|
|
49
47
|
|
|
50
48
|
var _DatePicker = _interopRequireDefault(require("./DatePicker"));
|
|
@@ -53,12 +51,6 @@ var _TimePicker = _interopRequireDefault(require("./TimePicker"));
|
|
|
53
51
|
|
|
54
52
|
var _utils = require("./utils");
|
|
55
53
|
|
|
56
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
57
|
-
|
|
58
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
59
|
-
|
|
60
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
61
|
-
|
|
62
54
|
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); }; }
|
|
63
55
|
|
|
64
56
|
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,94 +60,75 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
68
60
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
69
61
|
|
|
70
62
|
var packageName = "@atlaskit/datetime-picker";
|
|
71
|
-
var packageVersion = "11.0
|
|
63
|
+
var packageVersion = "11.1.0";
|
|
72
64
|
/* eslint-disable react/no-unused-prop-types */
|
|
73
65
|
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return "border: 2px solid ".concat(color, ";");
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
var getBorderColorHover = function getBorderColorHover(_ref2) {
|
|
96
|
-
var isFocused = _ref2.isFocused,
|
|
97
|
-
isInvalid = _ref2.isInvalid,
|
|
98
|
-
isDisabled = _ref2.isDisabled;
|
|
99
|
-
var color = colors.N30;
|
|
100
|
-
|
|
101
|
-
if (isFocused || isDisabled) {
|
|
102
|
-
return "";
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (isInvalid) {
|
|
106
|
-
color = colors.R400;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return "border-color: ".concat(color, ";");
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
var getBackgroundColor = function getBackgroundColor(_ref3) {
|
|
113
|
-
var appearance = _ref3.appearance,
|
|
114
|
-
isFocused = _ref3.isFocused;
|
|
115
|
-
var color = colors.N20;
|
|
116
|
-
|
|
117
|
-
if (isFocused) {
|
|
118
|
-
color = colors.N0;
|
|
66
|
+
var isInvalidBorderStyles = (0, _core.css)({
|
|
67
|
+
borderColor: (0, _tokens.token)('color.iconBorder.danger', _colors.R400)
|
|
68
|
+
});
|
|
69
|
+
var isFocusedBorderStyles = (0, _core.css)({
|
|
70
|
+
borderColor: (0, _tokens.token)('color.border.focus', _colors.B100)
|
|
71
|
+
});
|
|
72
|
+
var isFocusedStyles = (0, _core.css)({
|
|
73
|
+
backgroundColor: (0, _tokens.token)('color.background.default', _colors.N0)
|
|
74
|
+
});
|
|
75
|
+
var subtleBgStyles = (0, _core.css)({
|
|
76
|
+
backgroundColor: 'transparent',
|
|
77
|
+
borderColor: 'transparent'
|
|
78
|
+
});
|
|
79
|
+
var hoverStyles = (0, _core.css)({
|
|
80
|
+
'&:hover': {
|
|
81
|
+
backgroundColor: (0, _tokens.token)('color.background.default', _colors.N30),
|
|
82
|
+
borderColor: (0, _tokens.token)('color.border.neutral', _colors.N30)
|
|
119
83
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
84
|
+
});
|
|
85
|
+
var isInvalidHoverStyles = (0, _core.css)({
|
|
86
|
+
'&:hover': {
|
|
87
|
+
backgroundColor: (0, _tokens.token)('color.background.default', _colors.N0),
|
|
88
|
+
borderColor: (0, _tokens.token)('color.iconBorder.danger', _colors.R400)
|
|
123
89
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
var getBackgroundColorHover = function getBackgroundColorHover(_ref4) {
|
|
129
|
-
var isFocused = _ref4.isFocused,
|
|
130
|
-
isInvalid = _ref4.isInvalid,
|
|
131
|
-
isDisabled = _ref4.isDisabled;
|
|
132
|
-
var color = colors.N30;
|
|
133
|
-
|
|
134
|
-
if (isFocused || isDisabled) {
|
|
135
|
-
return "";
|
|
90
|
+
});
|
|
91
|
+
var isDisabledStyles = (0, _core.css)({
|
|
92
|
+
'&:hover': {
|
|
93
|
+
cursor: 'default'
|
|
136
94
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
95
|
+
});
|
|
96
|
+
var baseContainerStyles = (0, _core.css)({
|
|
97
|
+
display: 'flex',
|
|
98
|
+
backgroundColor: (0, _tokens.token)('color.background.subtleNeutral.resting', _colors.N20),
|
|
99
|
+
border: "2px solid ".concat((0, _tokens.token)('color.border.neutral', _colors.N20)),
|
|
100
|
+
borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
|
|
101
|
+
transition: 'background-color 200ms ease-in-out, border-color 200ms ease-in-out',
|
|
102
|
+
'&:hover': {
|
|
103
|
+
cursor: 'pointer'
|
|
140
104
|
}
|
|
141
|
-
|
|
142
|
-
return "background-color: ".concat(color, ";");
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
var Flex = _styled.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n border-radius: ", "px;\n display: flex;\n transition: background-color 200ms ease-in-out, border-color 200ms ease-in-out;\n &:hover {\n cursor: ", ";\n ", "\n ", "\n }\n"])), getBackgroundColor, getBorder, (0, _constants.borderRadius)(), function (props) {
|
|
146
|
-
return props.isDisabled ? 'default' : 'pointer';
|
|
147
|
-
}, getBackgroundColorHover, getBorderColorHover); // Make DatePicker 50% the width of DateTimePicker
|
|
105
|
+
}); // Make DatePicker 50% the width of DateTimePicker
|
|
148
106
|
// If rendering an icon container, shrink the TimePicker
|
|
149
107
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
108
|
+
var datePickerContainerStyles = (0, _core.css)({
|
|
109
|
+
flexBasis: '50%',
|
|
110
|
+
flexGrow: 1,
|
|
111
|
+
flexShrink: 0
|
|
112
|
+
});
|
|
113
|
+
var timePickerContainerStyles = (0, _core.css)({
|
|
114
|
+
flexBasis: '50%',
|
|
115
|
+
flexGrow: 1
|
|
116
|
+
});
|
|
155
117
|
var ICON_PADDING = 2;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
118
|
+
var iconContainerStyles = (0, _core.css)({
|
|
119
|
+
display: 'flex',
|
|
120
|
+
paddingTop: "6px",
|
|
121
|
+
paddingRight: "".concat((0, _constants.gridSize)(), "px"),
|
|
122
|
+
paddingBottom: "6px",
|
|
123
|
+
paddingLeft: "".concat(ICON_PADDING * 2, "px"),
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
flexBasis: 'inherit',
|
|
126
|
+
color: (0, _tokens.token)('color.text.lowEmphasis', _colors.N70),
|
|
127
|
+
transition: "color 150ms",
|
|
128
|
+
'&:hover': {
|
|
129
|
+
color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.N500)
|
|
130
|
+
}
|
|
131
|
+
}); // react-select overrides (via @atlaskit/select).
|
|
159
132
|
|
|
160
133
|
var styles = {
|
|
161
134
|
control: function control(style) {
|
|
@@ -276,10 +249,10 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
276
249
|
}
|
|
277
250
|
}, {
|
|
278
251
|
key: "onValueChange",
|
|
279
|
-
value: function onValueChange(
|
|
280
|
-
var dateValue =
|
|
281
|
-
timeValue =
|
|
282
|
-
zoneValue =
|
|
252
|
+
value: function onValueChange(_ref) {
|
|
253
|
+
var dateValue = _ref.dateValue,
|
|
254
|
+
timeValue = _ref.timeValue,
|
|
255
|
+
zoneValue = _ref.zoneValue;
|
|
283
256
|
this.setState({
|
|
284
257
|
dateValue: dateValue,
|
|
285
258
|
timeValue: timeValue,
|
|
@@ -354,17 +327,18 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
354
327
|
|
|
355
328
|
|
|
356
329
|
var isClearable = Boolean(dateValue || timeValue);
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
appearance: this.props.appearance,
|
|
330
|
+
var notFocusedOrIsDisabled = !(isFocused || isDisabled);
|
|
331
|
+
return (0, _core.jsx)("div", (0, _extends2.default)({
|
|
332
|
+
css: [baseContainerStyles, isDisabled && isDisabledStyles, isFocused && isFocusedStyles, bothProps.appearance === 'subtle' && subtleBgStyles, isFocused && isFocusedBorderStyles, bothProps.isInvalid && isInvalidBorderStyles, notFocusedOrIsDisabled && (bothProps.isInvalid ? isInvalidHoverStyles : hoverStyles)]
|
|
333
|
+
}, innerProps, {
|
|
362
334
|
"data-testid": testId
|
|
363
|
-
}),
|
|
335
|
+
}), (0, _core.jsx)("input", {
|
|
364
336
|
name: name,
|
|
365
337
|
type: "hidden",
|
|
366
338
|
value: value
|
|
367
|
-
}),
|
|
339
|
+
}), (0, _core.jsx)("div", {
|
|
340
|
+
css: datePickerContainerStyles
|
|
341
|
+
}, (0, _core.jsx)(_DatePicker.default, (0, _extends2.default)({}, bothProps, {
|
|
368
342
|
autoFocus: autoFocus,
|
|
369
343
|
dateFormat: dateFormat,
|
|
370
344
|
hideIcon: true,
|
|
@@ -374,7 +348,9 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
374
348
|
value: dateValue,
|
|
375
349
|
locale: locale,
|
|
376
350
|
testId: testId && "".concat(testId, "--datepicker")
|
|
377
|
-
}, datePickerProps))),
|
|
351
|
+
}, datePickerProps))), (0, _core.jsx)("div", {
|
|
352
|
+
css: timePickerContainerStyles
|
|
353
|
+
}, (0, _core.jsx)(_TimePicker.default, (0, _extends2.default)({}, bothProps, {
|
|
378
354
|
hideIcon: true,
|
|
379
355
|
onChange: this.onTimeChange,
|
|
380
356
|
selectProps: mergedTimePickerSelectProps,
|
|
@@ -384,13 +360,12 @@ var DateTimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
384
360
|
timeFormat: timeFormat,
|
|
385
361
|
locale: locale,
|
|
386
362
|
testId: testId && "".concat(testId, "--timepicker")
|
|
387
|
-
}, timePickerProps))), isClearable && !isDisabled ?
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
_react.default.createElement(IconContainer, {
|
|
363
|
+
}, timePickerProps))), isClearable && !isDisabled ? // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
364
|
+
(0, _core.jsx)("div", {
|
|
365
|
+
css: iconContainerStyles,
|
|
391
366
|
onClick: this.onClear,
|
|
392
367
|
"data-testid": testId && "".concat(testId, "--icon--container")
|
|
393
|
-
},
|
|
368
|
+
}, (0, _core.jsx)(_selectClear.default, {
|
|
394
369
|
size: "small",
|
|
395
370
|
primaryColor: "inherit",
|
|
396
371
|
label: "clear"
|
|
@@ -43,6 +43,8 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
43
43
|
|
|
44
44
|
var _constants = require("@atlaskit/theme/constants");
|
|
45
45
|
|
|
46
|
+
var _tokens = require("@atlaskit/tokens");
|
|
47
|
+
|
|
46
48
|
var _internal = require("../internal");
|
|
47
49
|
|
|
48
50
|
var _FixedLayer = _interopRequireDefault(require("../internal/FixedLayer"));
|
|
@@ -64,7 +66,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
64
66
|
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; } }
|
|
65
67
|
|
|
66
68
|
var packageName = "@atlaskit/datetime-picker";
|
|
67
|
-
var packageVersion = "11.0
|
|
69
|
+
var packageVersion = "11.1.0";
|
|
68
70
|
var menuStyles = {
|
|
69
71
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
70
72
|
position: 'static',
|
|
@@ -233,7 +235,7 @@ var TimePicker = /*#__PURE__*/function (_React$Component) {
|
|
|
233
235
|
});
|
|
234
236
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getSubtleControlStyles", function (selectStyles) {
|
|
235
237
|
return !selectStyles.control ? {
|
|
236
|
-
border: "2px solid ".concat(_this.getSafeState().isFocused ?
|
|
238
|
+
border: "2px solid ".concat(_this.getSafeState().isFocused ? (0, _tokens.token)('color.border.focus', _colors.B100) : "transparent"),
|
|
237
239
|
backgroundColor: 'transparent',
|
|
238
240
|
padding: '1px'
|
|
239
241
|
} : {};
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { Component } from 'react';
|
|
6
|
+
import { css, jsx } from '@emotion/core'; // eslint-disable-next-line no-restricted-imports
|
|
5
7
|
|
|
6
8
|
import { format, isValid, lastDayOfMonth, parseISO } from 'date-fns';
|
|
7
9
|
import pick from 'lodash/pick';
|
|
@@ -10,14 +12,14 @@ import Calendar from '@atlaskit/calendar';
|
|
|
10
12
|
import CalendarIcon from '@atlaskit/icon/glyph/calendar';
|
|
11
13
|
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
12
14
|
import Select, { mergeStyles } from '@atlaskit/select';
|
|
13
|
-
import { B100, N20 } from '@atlaskit/theme/colors';
|
|
15
|
+
import { B100, N20, N50A, N60A } from '@atlaskit/theme/colors';
|
|
14
16
|
import { borderRadius, gridSize, layers } from '@atlaskit/theme/constants';
|
|
15
|
-
import {
|
|
17
|
+
import { token } from '@atlaskit/tokens';
|
|
16
18
|
import { defaultDateFormat, EmptyClearIndicator, padToTwo, placeholderDatetime } from '../internal';
|
|
17
19
|
import FixedLayer from '../internal/FixedLayer';
|
|
18
20
|
import { convertTokens } from './utils';
|
|
19
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
const packageVersion = "11.0
|
|
22
|
+
const packageVersion = "11.1.0";
|
|
21
23
|
/* eslint-disable react/no-unused-prop-types */
|
|
22
24
|
|
|
23
25
|
function getDateObj(date) {
|
|
@@ -33,20 +35,22 @@ function getValidDate(iso) {
|
|
|
33
35
|
return isValid(date) ? getDateObj(date) : {};
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
${
|
|
41
|
-
|
|
38
|
+
const menuStyles = css({
|
|
39
|
+
zIndex: layers.dialog(),
|
|
40
|
+
backgroundColor: token('color.background.default', N20),
|
|
41
|
+
borderRadius: `${borderRadius()}px`,
|
|
42
|
+
boxShadow: token('shadow.overlay', `0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`)
|
|
43
|
+
});
|
|
42
44
|
|
|
43
45
|
const Menu = ({
|
|
44
46
|
selectProps,
|
|
45
47
|
innerProps
|
|
46
|
-
}) =>
|
|
48
|
+
}) => jsx(FixedLayer, {
|
|
47
49
|
inputValue: selectProps.inputValue,
|
|
48
50
|
containerRef: selectProps.calendarContainerRef,
|
|
49
|
-
content:
|
|
51
|
+
content: jsx("div", _extends({
|
|
52
|
+
css: menuStyles
|
|
53
|
+
}, innerProps), jsx(Calendar, _extends({}, getValidDate(selectProps.calendarValue), getValidDate(selectProps.calendarView), {
|
|
50
54
|
disabled: selectProps.calendarDisabled,
|
|
51
55
|
disabledDateFilter: selectProps.calendarDisabledDateFilter,
|
|
52
56
|
minDate: selectProps.calendarMinDate,
|
|
@@ -86,7 +90,7 @@ const datePickerDefaultProps = {
|
|
|
86
90
|
|
|
87
91
|
};
|
|
88
92
|
|
|
89
|
-
class DatePicker extends
|
|
93
|
+
class DatePicker extends Component {
|
|
90
94
|
constructor(props) {
|
|
91
95
|
super(props);
|
|
92
96
|
|
|
@@ -325,7 +329,7 @@ class DatePicker extends React.Component {
|
|
|
325
329
|
});
|
|
326
330
|
|
|
327
331
|
_defineProperty(this, "getSubtleControlStyles", isOpen => ({
|
|
328
|
-
border: `2px solid ${isOpen ? B100 : `transparent`}`,
|
|
332
|
+
border: `2px solid ${isOpen ? token('color.border.focus', B100) : `transparent`}`,
|
|
329
333
|
backgroundColor: 'transparent',
|
|
330
334
|
padding: '1px'
|
|
331
335
|
}));
|
|
@@ -466,19 +470,19 @@ class DatePicker extends React.Component {
|
|
|
466
470
|
calendarLocale: locale,
|
|
467
471
|
calendarWeekStartDay: weekStartDay
|
|
468
472
|
};
|
|
469
|
-
return
|
|
473
|
+
return jsx("div", _extends({}, innerProps, {
|
|
470
474
|
role: "presentation",
|
|
471
475
|
onClick: this.onInputClick,
|
|
472
476
|
onInput: this.onSelectInput,
|
|
473
477
|
onKeyDown: this.onSelectKeyDown,
|
|
474
478
|
ref: this.getContainerRef,
|
|
475
479
|
"data-testid": testId && `${testId}--container`
|
|
476
|
-
}),
|
|
480
|
+
}), jsx("input", {
|
|
477
481
|
name: name,
|
|
478
482
|
type: "hidden",
|
|
479
483
|
value: value,
|
|
480
484
|
"data-testid": testId && `${testId}--input`
|
|
481
|
-
}),
|
|
485
|
+
}), jsx(Select, _extends({
|
|
482
486
|
enableAnimation: false,
|
|
483
487
|
menuIsOpen: menuIsOpen,
|
|
484
488
|
closeMenuOnSelect: true,
|