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