@atlaskit/datetime-picker 18.3.1 → 18.4.1
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 +52 -0
- package/__tests__/playwright/top-layer-focus.spec.tsx +34 -37
- package/codemods/14.0.0-remove-duplicate-and-unused-props.tsx +0 -1
- package/dist/cjs/components/date-picker.js +38 -31
- package/dist/cjs/components/date-time-picker.js +6 -6
- package/dist/cjs/components/time-picker.js +15 -22
- package/dist/cjs/internal/date-time-picker-container.js +2 -2
- package/dist/cjs/internal/fixed-layer-menu-top-layer.js +3 -7
- package/dist/cjs/internal/fixed-layer-menu.js +4 -8
- package/dist/cjs/internal/fixed-layer.js +7 -5
- package/dist/cjs/internal/indicators-container.js +2 -2
- package/dist/cjs/internal/menu-top-layer.compiled.css +5 -0
- package/dist/cjs/internal/menu-top-layer.js +11 -51
- package/dist/cjs/internal/menu.js +3 -3
- package/dist/cjs/internal/single-value.js +3 -2
- package/dist/es2019/components/date-picker.js +31 -24
- package/dist/es2019/components/date-time-picker.js +3 -3
- package/dist/es2019/components/time-picker.js +10 -17
- package/dist/es2019/internal/date-time-picker-container.js +1 -1
- package/dist/es2019/internal/fixed-layer-menu-top-layer.js +2 -6
- package/dist/es2019/internal/fixed-layer-menu.js +3 -7
- package/dist/es2019/internal/fixed-layer.js +4 -2
- package/dist/es2019/internal/indicators-container.js +1 -1
- package/dist/es2019/internal/menu-top-layer.compiled.css +5 -0
- package/dist/es2019/internal/menu-top-layer.js +12 -53
- package/dist/es2019/internal/menu.js +2 -2
- package/dist/es2019/internal/single-value.js +2 -2
- package/dist/esm/components/date-picker.js +31 -24
- package/dist/esm/components/date-time-picker.js +3 -3
- package/dist/esm/components/time-picker.js +10 -17
- package/dist/esm/internal/date-time-picker-container.js +1 -1
- package/dist/esm/internal/fixed-layer-menu-top-layer.js +2 -6
- package/dist/esm/internal/fixed-layer-menu.js +3 -7
- package/dist/esm/internal/fixed-layer.js +4 -2
- package/dist/esm/internal/indicators-container.js +1 -1
- package/dist/esm/internal/menu-top-layer.compiled.css +5 -0
- package/dist/esm/internal/menu-top-layer.js +12 -53
- package/dist/esm/internal/menu.js +2 -2
- package/dist/esm/internal/single-value.js +2 -2
- package/dist/types/components/date-picker.d.ts +1 -1
- package/dist/types/internal/fixed-layer-menu-top-layer.d.ts +1 -1
- package/dist/types/internal/fixed-layer-menu.d.ts +1 -1
- package/dist/types/internal/format-date.d.ts +1 -1
- package/dist/types/internal/get-placeholder.d.ts +1 -1
- package/dist/types/internal/indicators-container.d.ts +1 -1
- package/dist/types/internal/menu-top-layer.d.ts +3 -5
- package/dist/types/internal/menu.d.ts +1 -1
- package/dist/types/internal/parse-date.d.ts +1 -1
- package/dist/types/internal/single-value.d.ts +1 -1
- package/dist/types/types.d.ts +2 -2
- package/package.json +22 -21
- package/datetime-picker.docs.tsx +0 -132
|
@@ -16,8 +16,10 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _react = _interopRequireDefault(require("react"));
|
|
18
18
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
19
|
-
var
|
|
20
|
-
var
|
|
19
|
+
var _default = require("@atlaskit/icon/constants/default");
|
|
20
|
+
var _manager = require("@atlaskit/popper/manager");
|
|
21
|
+
var _main = require("@atlaskit/popper/main");
|
|
22
|
+
var _reference = require("@atlaskit/popper/reference");
|
|
21
23
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
22
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
25
|
var styles = {
|
|
@@ -65,14 +67,14 @@ var FixedLayer = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
65
67
|
var divStyles = {
|
|
66
68
|
height: containerRef.getBoundingClientRect().height,
|
|
67
69
|
// Don't block the clear button
|
|
68
|
-
width: containerRef.getBoundingClientRect().width - parseInt(
|
|
70
|
+
width: containerRef.getBoundingClientRect().width - parseInt(_default.sizes.small.slice(0, -2)) - 8
|
|
69
71
|
};
|
|
70
72
|
return (
|
|
71
73
|
/*#__PURE__*/
|
|
72
74
|
/* Need to wrap layer in a fixed position div so that it will render its content as fixed
|
|
73
75
|
* We need to set the intial top value to where the container is and zIndex so that it still
|
|
74
76
|
* applies since we're creating a new stacking context. */
|
|
75
|
-
_react.default.createElement(
|
|
77
|
+
_react.default.createElement(_manager.Manager, null, /*#__PURE__*/_react.default.createElement(_reference.Reference, null, function (_ref) {
|
|
76
78
|
var ref = _ref.ref;
|
|
77
79
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
80
|
ref: ref,
|
|
@@ -80,7 +82,7 @@ var FixedLayer = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
80
82
|
style: divStyles,
|
|
81
83
|
className: (0, _runtime.ax)([styles.root])
|
|
82
84
|
});
|
|
83
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
85
|
+
}), /*#__PURE__*/_react.default.createElement(_main.Popper, null, function (_ref2) {
|
|
84
86
|
var ref = _ref2.ref,
|
|
85
87
|
style = _ref2.style,
|
|
86
88
|
update = _ref2.update;
|
|
@@ -11,7 +11,7 @@ require("./indicators-container.compiled.css");
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
|
-
var
|
|
14
|
+
var _components = require("@atlaskit/react-select/components");
|
|
15
15
|
var _excluded = ["showClearIndicator"];
|
|
16
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
17
|
var styles = {
|
|
@@ -25,5 +25,5 @@ var IndicatorsContainer = exports.IndicatorsContainer = function IndicatorsConta
|
|
|
25
25
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
26
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
27
27
|
className: (0, _runtime.ax)([showClearIndicator ? styles.calendarButtonInclusionStyles : styles.calendarButtonOnlyInclusionStyles])
|
|
28
|
-
}, /*#__PURE__*/React.createElement(
|
|
28
|
+
}, /*#__PURE__*/React.createElement(_components.components.IndicatorsContainer, rest));
|
|
29
29
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
2
|
+
._1bsb1ris{width:max-content}
|
|
3
|
+
._1pfhu2gc{margin-block-start:var(--ds-space-100,8px)}
|
|
4
|
+
._6rthu2gc{margin-block-end:var(--ds-space-100,8px)}
|
|
5
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
@@ -7,25 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.MenuTopLayer = void 0;
|
|
10
|
+
require("./menu-top-layer.compiled.css");
|
|
10
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var React = _react;
|
|
12
13
|
var _runtime = require("@compiled/react/runtime");
|
|
13
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
15
|
var _dateFns = require("date-fns");
|
|
15
|
-
var _calendar = _interopRequireDefault(require("@atlaskit/calendar"));
|
|
16
|
-
var _placementMap = require("@atlaskit/top-layer/placement-map");
|
|
17
|
-
var _popover = require("@atlaskit/top-layer/popover");
|
|
18
|
-
var _popoverSurface = require("@atlaskit/top-layer/popover-surface");
|
|
19
|
-
var _useAnchorPosition = require("@atlaskit/top-layer/use-anchor-position");
|
|
16
|
+
var _calendar = _interopRequireDefault(require("@atlaskit/calendar/calendar"));
|
|
20
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
|
-
/**
|
|
22
|
-
* Bottom-start placement: calendar appears below and aligned to the
|
|
23
|
-
* start edge of the trigger (the select input).
|
|
24
|
-
*/
|
|
25
|
-
var popupPlacement = (0, _placementMap.fromLegacyPlacement)({
|
|
26
|
-
legacy: 'bottom-start'
|
|
27
|
-
});
|
|
28
|
-
|
|
29
18
|
/**
|
|
30
19
|
* @param isos A series of ISO dates.
|
|
31
20
|
* @returns The last valid date within the array of ISO strings.
|
|
@@ -40,19 +29,19 @@ function getValidDate(isos) {
|
|
|
40
29
|
} : acc;
|
|
41
30
|
}, {});
|
|
42
31
|
}
|
|
32
|
+
var styles = {
|
|
33
|
+
root: "_2rko1mok _1bsb1ris _bfhk1bhr _16qs130s _1pfhu2gc _6rthu2gc"
|
|
34
|
+
};
|
|
43
35
|
|
|
44
36
|
/**
|
|
45
37
|
* Top-layer version of the date picker menu.
|
|
46
38
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* CSS Anchor Positioning. This avoids overflow clipping, z-index wars,
|
|
50
|
-
* and portal-based layering.
|
|
39
|
+
* The surrounding react-select menu portal owns the native popover and
|
|
40
|
+
* positioning. This component only supplies the calendar dialog content.
|
|
51
41
|
*
|
|
52
42
|
* Gated behind the `platform-dst-top-layer` feature flag.
|
|
53
43
|
*/
|
|
54
44
|
var MenuTopLayer = exports.MenuTopLayer = function MenuTopLayer(_ref) {
|
|
55
|
-
var _selectProps$calendar, _selectProps$calendar2;
|
|
56
45
|
var selectProps = _ref.selectProps,
|
|
57
46
|
innerProps = _ref.innerProps;
|
|
58
47
|
var calendarValue = selectProps.calendarValue,
|
|
@@ -62,20 +51,6 @@ var MenuTopLayer = exports.MenuTopLayer = function MenuTopLayer(_ref) {
|
|
|
62
51
|
day = _getValidDate.day,
|
|
63
52
|
month = _getValidDate.month,
|
|
64
53
|
year = _getValidDate.year;
|
|
65
|
-
|
|
66
|
-
// The select's container element is the anchor for the popup.
|
|
67
|
-
var triggerRef = (0, _react.useRef)((_selectProps$calendar = selectProps.calendarContainerRef) !== null && _selectProps$calendar !== void 0 ? _selectProps$calendar : null);
|
|
68
|
-
triggerRef.current = (_selectProps$calendar2 = selectProps.calendarContainerRef) !== null && _selectProps$calendar2 !== void 0 ? _selectProps$calendar2 : null;
|
|
69
|
-
var popoverRef = (0, _react.useRef)(null);
|
|
70
|
-
(0, _useAnchorPosition.useAnchorPosition)({
|
|
71
|
-
anchorRef: triggerRef,
|
|
72
|
-
popoverRef: popoverRef,
|
|
73
|
-
placement: popupPlacement,
|
|
74
|
-
// The Popover is rendered with `isOpen` always true while this
|
|
75
|
-
// component is mounted (react-select conditionally mounts/unmounts
|
|
76
|
-
// the menu), so positioning is always active.
|
|
77
|
-
isOpen: true
|
|
78
|
-
});
|
|
79
54
|
var onMenuMouseDown = function onMenuMouseDown(event) {
|
|
80
55
|
if (event.button !== 0) {
|
|
81
56
|
return;
|
|
@@ -84,25 +59,10 @@ var MenuTopLayer = exports.MenuTopLayer = function MenuTopLayer(_ref) {
|
|
|
84
59
|
event.preventDefault();
|
|
85
60
|
};
|
|
86
61
|
var Wrapper = typeof MenuInnerWrapper === 'function' ? MenuInnerWrapper : _react.Fragment;
|
|
87
|
-
return /*#__PURE__*/React.createElement(
|
|
88
|
-
|
|
89
|
-
role: "dialog",
|
|
90
|
-
label: "calendar",
|
|
91
|
-
isOpen: true
|
|
92
|
-
// `mode="manual"` opts out of native popover light-dismiss.
|
|
93
|
-
// react-select / DateTimePicker already own outside-click and
|
|
94
|
-
// Esc handling. Without this, the same click that opens the
|
|
95
|
-
// menu (which targets the select input outside the popover)
|
|
96
|
-
// also bubbles to the browser's auto-dismiss handler and
|
|
97
|
-
// immediately closes the popover.
|
|
98
|
-
,
|
|
99
|
-
mode: "manual",
|
|
100
|
-
placement: popupPlacement,
|
|
101
|
-
shouldAnimate: true,
|
|
102
|
-
testId: selectProps.testId && "".concat(selectProps.testId, "--popup")
|
|
103
|
-
}, /*#__PURE__*/React.createElement(_popoverSurface.PopoverSurface, null, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, innerProps, {
|
|
62
|
+
return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, innerProps, {
|
|
63
|
+
onMouseDown: onMenuMouseDown,
|
|
104
64
|
role: "presentation",
|
|
105
|
-
|
|
65
|
+
className: (0, _runtime.ax)([styles.root])
|
|
106
66
|
}), /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(_calendar.default, {
|
|
107
67
|
day: day,
|
|
108
68
|
month: month,
|
|
@@ -121,5 +81,5 @@ var MenuTopLayer = exports.MenuTopLayer = function MenuTopLayer(_ref) {
|
|
|
121
81
|
locale: selectProps.calendarLocale,
|
|
122
82
|
testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
|
|
123
83
|
weekStartDay: selectProps.calendarWeekStartDay
|
|
124
|
-
})))
|
|
84
|
+
})));
|
|
125
85
|
};
|
|
@@ -13,9 +13,9 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _dateFns = require("date-fns");
|
|
16
|
-
var _calendar = _interopRequireDefault(require("@atlaskit/calendar"));
|
|
16
|
+
var _calendar = _interopRequireDefault(require("@atlaskit/calendar/calendar"));
|
|
17
17
|
var _layering = require("@atlaskit/layering/layering");
|
|
18
|
-
var
|
|
18
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
19
19
|
var _fixedLayer = _interopRequireDefault(require("../internal/fixed-layer"));
|
|
20
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
21
|
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
@@ -64,7 +64,7 @@ var Menu = exports.Menu = function Menu(_ref) {
|
|
|
64
64
|
containerRef: selectProps.calendarContainerRef,
|
|
65
65
|
content: /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, innerProps, {
|
|
66
66
|
onMouseDown: onMenuMouseDown,
|
|
67
|
-
className: (0, _runtime.ax)(["_2rko12b0 _1reo15vq _18m915vq _1pbyowjs _bfhk1bhr _16qs130s", (0,
|
|
67
|
+
className: (0, _runtime.ax)(["_2rko12b0 _1reo15vq _18m915vq _1pbyowjs _bfhk1bhr _16qs130s", (0, _fg.fg)('platform-dst-shape-theme-default') && "_2rko1mok"])
|
|
68
68
|
}), /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(_calendar.default, {
|
|
69
69
|
day: day,
|
|
70
70
|
month: month,
|
|
@@ -8,7 +8,7 @@ exports.makeSingleValue = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _components = require("@atlaskit/react-select/components");
|
|
12
12
|
var _excluded = ["children", "className", "clearValue", "cx", "data", "getStyles", "getValue", "hasValue", "isDisabled", "isMulti", "isRtl", "options", "selectOption", "selectProps", "setValue"];
|
|
13
13
|
/**
|
|
14
14
|
* This creates a functional component that `react-select` will use to make the
|
|
@@ -16,6 +16,7 @@ var _excluded = ["children", "className", "clearValue", "cx", "data", "getStyles
|
|
|
16
16
|
*/
|
|
17
17
|
var makeSingleValue = exports.makeSingleValue =
|
|
18
18
|
// TODO: Make ID required
|
|
19
|
+
|
|
19
20
|
function makeSingleValue(_ref) {
|
|
20
21
|
var id = _ref.id,
|
|
21
22
|
lang = _ref.lang;
|
|
@@ -36,7 +37,7 @@ function makeSingleValue(_ref) {
|
|
|
36
37
|
selectProps = _ref2.selectProps,
|
|
37
38
|
setValue = _ref2.setValue,
|
|
38
39
|
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_components.components.SingleValue, (0, _extends2.default)({}, rest, {
|
|
40
41
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
|
|
41
42
|
className: className,
|
|
42
43
|
clearValue: clearValue,
|
|
@@ -9,15 +9,16 @@ import { forwardRef, useCallback, useEffect, useReducer, useRef, useState } from
|
|
|
9
9
|
|
|
10
10
|
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
11
11
|
import { isValid, parseISO } from 'date-fns';
|
|
12
|
-
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
12
|
+
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
13
13
|
import { IconButton } from '@atlaskit/button/new';
|
|
14
14
|
import { cx } from '@atlaskit/css';
|
|
15
15
|
import { useId } from '@atlaskit/ds-lib/use-id';
|
|
16
16
|
import CalendarIcon from '@atlaskit/icon/core/calendar';
|
|
17
|
-
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
18
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
+
import { createLocalizationProvider } from '@atlaskit/locale/localization-provider';
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
19
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
20
|
-
import Select
|
|
20
|
+
import Select from '@atlaskit/select/default';
|
|
21
|
+
import { mergeStyles } from '@atlaskit/react-select/styles';
|
|
21
22
|
import { EmptyComponent } from '../internal/empty-component';
|
|
22
23
|
import { formatDate } from '../internal/format-date';
|
|
23
24
|
import { getParsedISO } from '../internal/get-parsed-iso';
|
|
@@ -31,7 +32,7 @@ import { MenuTopLayer } from '../internal/menu-top-layer';
|
|
|
31
32
|
import { parseDate } from '../internal/parse-date';
|
|
32
33
|
import { makeSingleValue } from '../internal/single-value';
|
|
33
34
|
const packageName = "@atlaskit/datetime-picker";
|
|
34
|
-
const packageVersion = "18.
|
|
35
|
+
const packageVersion = "18.4.0";
|
|
35
36
|
const styles = {
|
|
36
37
|
pickerContainerStyle: "_kqswh2mm",
|
|
37
38
|
dropdownIndicatorStyles: "_1ul91k8s _1tke1k8s _1e0c1txw _4cvr1h6o _1bah1h6o",
|
|
@@ -58,6 +59,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
58
59
|
const containerRef = useRef(null);
|
|
59
60
|
const calendarRef = useRef(null);
|
|
60
61
|
const calendarButtonRef = useRef(null);
|
|
62
|
+
const isPointerInteractionRef = useRef(false);
|
|
61
63
|
const {
|
|
62
64
|
appearance = 'default',
|
|
63
65
|
autoFocus = false,
|
|
@@ -125,19 +127,15 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
125
127
|
setLocale(propLocale);
|
|
126
128
|
}
|
|
127
129
|
useEffect(() => {
|
|
128
|
-
//
|
|
130
|
+
// Only move focus when the dedicated calendar button opened the menu.
|
|
129
131
|
if (!isKeyDown) {
|
|
130
132
|
return;
|
|
131
133
|
}
|
|
132
134
|
if (isOpen && wasOpenedFromCalendarButton) {
|
|
135
|
+
var _calendarRef$current, _calendarRef$current$;
|
|
133
136
|
setIsKeyDown(false);
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
if (!fg('platform-dst-top-layer')) {
|
|
137
|
-
var _calendarRef$current, _calendarRef$current$;
|
|
138
|
-
// Focus on the first button within the calendar
|
|
139
|
-
calendarRef === null || calendarRef === void 0 ? void 0 : (_calendarRef$current = calendarRef.current) === null || _calendarRef$current === void 0 ? void 0 : (_calendarRef$current$ = _calendarRef$current.querySelector('button')) === null || _calendarRef$current$ === void 0 ? void 0 : _calendarRef$current$.focus();
|
|
140
|
-
}
|
|
137
|
+
// Focus on the first button within the calendar
|
|
138
|
+
calendarRef === null || calendarRef === void 0 ? void 0 : (_calendarRef$current = calendarRef.current) === null || _calendarRef$current === void 0 ? void 0 : (_calendarRef$current$ = _calendarRef$current.querySelector('button')) === null || _calendarRef$current$ === void 0 ? void 0 : _calendarRef$current$.focus();
|
|
141
139
|
}
|
|
142
140
|
}, [isKeyDown, calendarRef, isOpen, wasOpenedFromCalendarButton]);
|
|
143
141
|
const getValue = () => propValue !== null && propValue !== void 0 ? propValue : value;
|
|
@@ -182,6 +180,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
182
180
|
const onContainerBlur = event => {
|
|
183
181
|
var _containerRef$current2;
|
|
184
182
|
const newlyFocusedElement = event.relatedTarget;
|
|
183
|
+
isPointerInteractionRef.current = false;
|
|
185
184
|
if (!(containerRef !== null && containerRef !== void 0 && (_containerRef$current2 = containerRef.current) !== null && _containerRef$current2 !== void 0 && _containerRef$current2.contains(newlyFocusedElement))) {
|
|
186
185
|
setIsOpen(false);
|
|
187
186
|
setShouldSetFocusOnCurrentDay(false);
|
|
@@ -212,8 +211,12 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
212
211
|
// Don't open menu if focussing after the user has clicked clear
|
|
213
212
|
setClearingFromIcon(false);
|
|
214
213
|
} else {
|
|
215
|
-
//
|
|
216
|
-
|
|
214
|
+
// Opening an auto popover during pointer focus allows the matching pointerup
|
|
215
|
+
// to immediately light-dismiss it. Let the subsequent click open it instead.
|
|
216
|
+
if (!fg('platform-dst-top-layer') || !isPointerInteractionRef.current) {
|
|
217
|
+
// Don't open when focused into via keyboard if the calendar button is present
|
|
218
|
+
setIsOpen(!shouldShowCalendarButton);
|
|
219
|
+
}
|
|
217
220
|
setCalendarValue(value);
|
|
218
221
|
setIsFocused(true);
|
|
219
222
|
setWasOpenedFromCalendarButton(false);
|
|
@@ -249,12 +252,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
249
252
|
}
|
|
250
253
|
switch (keyPressed) {
|
|
251
254
|
case 'escape':
|
|
252
|
-
// Restore focus
|
|
253
|
-
// the legacy path because it has no built-in restoration, and
|
|
254
|
-
// the top-layer path because the menu uses `mode="manual"` to
|
|
255
|
-
// avoid the auto-popover light-dismiss closing the menu on the
|
|
256
|
-
// same click that opens it (see internal/menu-top-layer.tsx).
|
|
257
|
-
// `manual` mode disables the browser's native focus return.
|
|
255
|
+
// Restore focus because it may have moved from the input into the calendar.
|
|
258
256
|
if (wasOpenedFromCalendarButton) {
|
|
259
257
|
var _calendarButtonRef$cu2;
|
|
260
258
|
(_calendarButtonRef$cu2 = calendarButtonRef.current) === null || _calendarButtonRef$cu2 === void 0 ? void 0 : _calendarButtonRef$cu2.focus();
|
|
@@ -332,6 +330,9 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
332
330
|
|
|
333
331
|
// This event handler is triggered from both keydown and click. It's weird.
|
|
334
332
|
const onCalendarButtonClick = e => {
|
|
333
|
+
if (!getIsOpen() && fg('platform-dst-top-layer')) {
|
|
334
|
+
setIsKeyDown(true);
|
|
335
|
+
}
|
|
335
336
|
setIsOpen(isOpen => {
|
|
336
337
|
if (isOpen) {
|
|
337
338
|
var _props$selectProps, _props$selectProps$on;
|
|
@@ -436,8 +437,6 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
436
437
|
*/
|
|
437
438
|
menuInnerWrapper: props === null || props === void 0 ? void 0 : props.menuInnerWrapper
|
|
438
439
|
};
|
|
439
|
-
|
|
440
|
-
// @ts-ignore -- Argument of type 'StylesConfig<OptionType, false, GroupBase<OptionType>>' is not assignable to parameter of type 'StylesConfig<OptionType, boolean, GroupBase<OptionType>>'.
|
|
441
440
|
const mergedStyles = mergeStyles(selectStyles, {
|
|
442
441
|
control: base => ({
|
|
443
442
|
...base,
|
|
@@ -465,10 +464,19 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
465
464
|
return /*#__PURE__*/React.createElement("div", _extends({}, innerProps, {
|
|
466
465
|
"data-testid": testId && `${testId}--container`,
|
|
467
466
|
onBlur: onContainerBlur,
|
|
467
|
+
onClickCapture: () => {
|
|
468
|
+
isPointerInteractionRef.current = false;
|
|
469
|
+
},
|
|
468
470
|
onFocus: onContainerFocus,
|
|
469
471
|
onClick: onInputClick,
|
|
470
472
|
onInput: onTextInput,
|
|
471
473
|
onKeyDown: onInputKeyDown,
|
|
474
|
+
onPointerCancelCapture: () => {
|
|
475
|
+
isPointerInteractionRef.current = false;
|
|
476
|
+
},
|
|
477
|
+
onPointerDownCapture: () => {
|
|
478
|
+
isPointerInteractionRef.current = true;
|
|
479
|
+
},
|
|
472
480
|
ref: getContainerRef
|
|
473
481
|
// Since the onclick, onfocus are passed down, adding role="presentation" prevents typecheck errors.
|
|
474
482
|
,
|
|
@@ -521,7 +529,6 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
|
|
|
521
529
|
spacing: spacing,
|
|
522
530
|
testId: testId
|
|
523
531
|
// These aren't part of `Select`'s API, but we're using them here.
|
|
524
|
-
// @ts-ignore -- Property 'calendarContainerRef' does not exist on type 'IntrinsicAttributes & LibraryManagedAttributes<(<Option extends unknown = OptionType, IsMulti extends boolean = false>(props: AtlaskitSelectProps<Option, IsMulti> & { ...; }) => Element), AtlaskitSelectProps<...> & { ...; }>'.
|
|
525
532
|
,
|
|
526
533
|
calendarContainerRef: calendarProps.calendarContainerRef,
|
|
527
534
|
calendarDisabled: calendarProps.calendarDisabled,
|
|
@@ -9,18 +9,18 @@ import React, { forwardRef, useCallback, useEffect, useReducer, useRef, useState
|
|
|
9
9
|
|
|
10
10
|
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
11
11
|
import { format, isValid, parseISO } from 'date-fns';
|
|
12
|
-
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
12
|
+
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
13
13
|
import { IconButton } from '@atlaskit/button/new';
|
|
14
14
|
import SelectClearIcon from '@atlaskit/icon/core/cross-circle';
|
|
15
15
|
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
16
|
-
import { mergeStyles } from '@atlaskit/select';
|
|
16
|
+
import { mergeStyles } from '@atlaskit/react-select/styles';
|
|
17
17
|
import { DateTimePickerContainer } from '../internal/date-time-picker-container';
|
|
18
18
|
import { formatDateTimeZoneIntoIso } from '../internal/format-date-time-zone-into-iso';
|
|
19
19
|
import { convertTokens } from '../internal/parse-tokens';
|
|
20
20
|
import DatePicker from './date-picker';
|
|
21
21
|
import TimePicker from './time-picker';
|
|
22
22
|
const packageName = "@atlaskit/datetime-picker";
|
|
23
|
-
const packageVersion = "18.
|
|
23
|
+
const packageVersion = "18.4.0";
|
|
24
24
|
const analyticsAttributes = {
|
|
25
25
|
componentName: 'dateTimePicker',
|
|
26
26
|
packageName,
|
|
@@ -3,11 +3,13 @@ import React, { forwardRef, useCallback, useEffect, useReducer, useState } from
|
|
|
3
3
|
|
|
4
4
|
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
5
5
|
import { format, isValid } from 'date-fns';
|
|
6
|
-
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
|
|
6
|
+
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
7
7
|
import __noop from '@atlaskit/ds-lib/noop';
|
|
8
|
-
import { createLocalizationProvider } from '@atlaskit/locale';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
-
import Select
|
|
8
|
+
import { createLocalizationProvider } from '@atlaskit/locale/localization-provider';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
|
+
import Select from '@atlaskit/select/default';
|
|
11
|
+
import CreatableSelect from '@atlaskit/select/creatable-select';
|
|
12
|
+
import { mergeStyles } from '@atlaskit/react-select/styles';
|
|
11
13
|
import { defaultTimes } from '../internal/default-times';
|
|
12
14
|
import { EmptyComponent } from '../internal/empty-component';
|
|
13
15
|
import { FixedLayerMenu } from '../internal/fixed-layer-menu';
|
|
@@ -17,7 +19,7 @@ import { convertTokens } from '../internal/parse-tokens';
|
|
|
17
19
|
import { placeholderDatetime } from '../internal/placeholder-date-time';
|
|
18
20
|
import { makeSingleValue } from '../internal/single-value';
|
|
19
21
|
const packageName = "@atlaskit/datetime-picker";
|
|
20
|
-
const packageVersion = "18.
|
|
22
|
+
const packageVersion = "18.4.0";
|
|
21
23
|
const defaultTimeFormat = 'h:mma';
|
|
22
24
|
const menuStyles = {
|
|
23
25
|
/* Need to remove default absolute positioning as that causes issues with position fixed */
|
|
@@ -239,8 +241,6 @@ const TimePicker = /*#__PURE__*/forwardRef(({
|
|
|
239
241
|
})
|
|
240
242
|
};
|
|
241
243
|
const renderIconContainer = Boolean(!hideIcon && value);
|
|
242
|
-
|
|
243
|
-
// @ts-ignore -- Argument of type 'StylesConfig<OptionType, false, GroupBase<OptionType>>' is not assignable to parameter of type 'StylesConfig<OptionType, boolean, GroupBase<OptionType>>'.
|
|
244
244
|
const mergedStyles = mergeStyles(selectStyles, {
|
|
245
245
|
control: base => ({
|
|
246
246
|
...base
|
|
@@ -272,9 +272,7 @@ const TimePicker = /*#__PURE__*/forwardRef(({
|
|
|
272
272
|
"aria-label": label || undefined,
|
|
273
273
|
appearance: appearance,
|
|
274
274
|
autoFocus: autoFocus,
|
|
275
|
-
clearControlLabel: clearControlLabel
|
|
276
|
-
// @ts-ignore - Type mismatch with components - workaround for help-center local consumption
|
|
277
|
-
,
|
|
275
|
+
clearControlLabel: clearControlLabel,
|
|
278
276
|
components: selectComponents,
|
|
279
277
|
inputId: id,
|
|
280
278
|
isClearable: true,
|
|
@@ -284,22 +282,17 @@ const TimePicker = /*#__PURE__*/forwardRef(({
|
|
|
284
282
|
menuPlacement: "auto",
|
|
285
283
|
openMenuOnFocus: true,
|
|
286
284
|
onBlur: onBlur,
|
|
287
|
-
onCreateOption: onCreateOption
|
|
288
|
-
// @ts-ignore - Type mismatch with onChange handler - workaround for help-center local consumption
|
|
289
|
-
,
|
|
285
|
+
onCreateOption: onCreateOption,
|
|
290
286
|
onChange: onChange,
|
|
291
287
|
options: options,
|
|
292
288
|
onFocus: onFocus,
|
|
293
289
|
onMenuOpen: onMenuOpen,
|
|
294
290
|
onMenuClose: onMenuClose,
|
|
295
|
-
placeholder: placeholder || l10n.formatTime(placeholderDatetime)
|
|
296
|
-
// @ts-ignore - Type mismatch with styles config - workaround for help-center local consumption
|
|
297
|
-
,
|
|
291
|
+
placeholder: placeholder || l10n.formatTime(placeholderDatetime),
|
|
298
292
|
styles: mergedStyles,
|
|
299
293
|
value: initialValue,
|
|
300
294
|
spacing: spacing
|
|
301
295
|
// We need this to get things to work, even though it's not supported.
|
|
302
|
-
// @ts-ignore
|
|
303
296
|
,
|
|
304
297
|
fixedLayerRef: containerRef,
|
|
305
298
|
isInvalid: isInvalid,
|
|
@@ -4,7 +4,7 @@ import "./date-time-picker-container.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
8
|
const isInvalidBorderStyles = null;
|
|
9
9
|
const isFocusedBorderStyles = null;
|
|
10
10
|
const isFocusedStyles = null;
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useRef } from 'react';
|
|
6
|
-
import { components } from '@atlaskit/select';
|
|
6
|
+
import { components } from '@atlaskit/react-select/components';
|
|
7
7
|
import { fromLegacyPlacement } from '@atlaskit/top-layer/placement-map';
|
|
8
8
|
import { Popover } from '@atlaskit/top-layer/popover';
|
|
9
9
|
import { PopoverSurface } from '@atlaskit/top-layer/popover-surface';
|
|
@@ -54,9 +54,7 @@ export const FixedLayerMenuTopLayer = ({
|
|
|
54
54
|
}) => {
|
|
55
55
|
var _selectProps$fixedLay, _selectProps$fixedLay2;
|
|
56
56
|
// The select's container element is the anchor for the popup.
|
|
57
|
-
// @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
|
|
58
57
|
const triggerRef = useRef((_selectProps$fixedLay = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay !== void 0 ? _selectProps$fixedLay : null);
|
|
59
|
-
// @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
|
|
60
58
|
triggerRef.current = (_selectProps$fixedLay2 = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay2 !== void 0 ? _selectProps$fixedLay2 : null;
|
|
61
59
|
const popoverRef = useRef(null);
|
|
62
60
|
useAnchorPosition({
|
|
@@ -82,9 +80,7 @@ export const FixedLayerMenuTopLayer = ({
|
|
|
82
80
|
,
|
|
83
81
|
mode: "manual",
|
|
84
82
|
placement: popupPlacement,
|
|
85
|
-
shouldAnimate: true
|
|
86
|
-
// @ts-ignore -- testId is a custom prop passed through selectProps
|
|
87
|
-
,
|
|
83
|
+
shouldAnimate: true,
|
|
88
84
|
testId: selectProps.testId && `${selectProps.testId}--popup`
|
|
89
85
|
}, /*#__PURE__*/React.createElement(PopoverSurface, null, /*#__PURE__*/React.createElement(components.Menu, _extends({}, rest, {
|
|
90
86
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { components } from '@atlaskit/select';
|
|
5
|
+
import { components } from '@atlaskit/react-select/components';
|
|
6
6
|
import FixedLayer from '../internal/fixed-layer';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -33,9 +33,7 @@ export const FixedLayerMenu = ({
|
|
|
33
33
|
children,
|
|
34
34
|
...rest
|
|
35
35
|
}) => /*#__PURE__*/React.createElement(FixedLayer, {
|
|
36
|
-
inputValue: selectProps.inputValue
|
|
37
|
-
//@ts-ignore react-select unsupported props
|
|
38
|
-
,
|
|
36
|
+
inputValue: selectProps.inputValue,
|
|
39
37
|
containerRef: selectProps.fixedLayerRef,
|
|
40
38
|
content: /*#__PURE__*/React.createElement(components.Menu, _extends({}, rest, {
|
|
41
39
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
|
|
@@ -60,8 +58,6 @@ export const FixedLayerMenu = ({
|
|
|
60
58
|
selectOption: selectOption,
|
|
61
59
|
selectProps: selectProps,
|
|
62
60
|
setValue: setValue
|
|
63
|
-
}), children)
|
|
64
|
-
//@ts-ignore react-select unsupported props
|
|
65
|
-
,
|
|
61
|
+
}), children),
|
|
66
62
|
testId: selectProps.testId
|
|
67
63
|
});
|
|
@@ -4,8 +4,10 @@ import "./fixed-layer.compiled.css";
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
|
-
import { sizes } from '@atlaskit/icon';
|
|
8
|
-
import { Manager
|
|
7
|
+
import { sizes } from '@atlaskit/icon/constants/default';
|
|
8
|
+
import { Manager } from '@atlaskit/popper/manager';
|
|
9
|
+
import { Popper } from '@atlaskit/popper/main';
|
|
10
|
+
import { Reference } from '@atlaskit/popper/reference';
|
|
9
11
|
const styles = {
|
|
10
12
|
root: "_bfhk1j28 _kqswstnw _152tze3t",
|
|
11
13
|
popperStyles: "_1pbyowjs"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "./indicators-container.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { components } from '@atlaskit/select';
|
|
5
|
+
import { components } from '@atlaskit/react-select/components';
|
|
6
6
|
const styles = {
|
|
7
7
|
calendarButtonInclusionStyles: "_ahbqxy5q",
|
|
8
8
|
calendarButtonOnlyInclusionStyles: "_ahbq1ejb"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
2
|
+
._1bsb1ris{width:max-content}
|
|
3
|
+
._1pfhu2gc{margin-block-start:var(--ds-space-100,8px)}
|
|
4
|
+
._6rthu2gc{margin-block-end:var(--ds-space-100,8px)}
|
|
5
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|