@atlaskit/datetime-picker 17.8.0 → 17.8.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 CHANGED
@@ -1,5 +1,105 @@
1
1
  # @atlaskit/datetime-picker
2
2
 
3
+ ## 17.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2bed6255731de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2bed6255731de) -
8
+ Top-layer adoption work behind the `platform-dst-top-layer` feature flag. Public adopter APIs are
9
+ intentionally kept narrow while the top-layer API surface settles, with one exception called out
10
+ below.
11
+
12
+ Highlights:
13
+ - Pass the full `[along, away]` legacy popper offset through to the new top-layer
14
+ `placement.offset` API (via `fromLegacyPlacement`). Previously only the `away` axis was
15
+ forwarded, which dropped the `along` offset for consumers of `Popup`, `PopupSelect`,
16
+ `Spotlight`, and `Tooltip` when `platform-dst-top-layer` is enabled.
17
+ - Fix broken import of `dialogHeight` and `dialogWidth` from the removed utils module in
18
+ `@atlaskit/modal-dialog`.
19
+
20
+ Public API:
21
+ - **`@atlaskit/tooltip`** (`minor`): add an optional `testId?: string` field to `TriggerProps`.
22
+ This is additive (no existing prop changes shape). Required because `@atlaskit/button/new` (and
23
+ other `Pressable`-backed primitives) overwrite `data-testid` from spread, so the legacy
24
+ `(triggerProps as any)['data-testid']` workaround is silently absorbed by those consumers. A
25
+ typed `testId` field flows through their own `testId` destructure instead, restoring
26
+ `data-testid` propagation onto the rendered trigger element.
27
+ - **`@atlaskit/popup`**, **`@atlaskit/dropdown-menu`** (`patch`): no public type changes. Wider
28
+ `aria-haspopup` unions that the FF-on path produces are bridged at the package boundary into
29
+ `@atlaskit/top-layer` with localised `FUDGE(top-layer-api)` casts, documented in
30
+ `packages/design-system/top-layer/notes/decisions/migration-roadmap.md` ("Open API decisions
31
+ deferred to a follow-up PR"). They will be widened in a follow-up `minor` PR once the top-layer
32
+ API is committed.
33
+ - **`@atlaskit/modal-dialog`**, **`@atlaskit/select`**, **`@atlaskit/spotlight`**
34
+ (`patch`/`minor`): no public type changes; bug fixes only.
35
+
36
+ Merge-readiness fixes (FF-on test wiring + adopter behavior):
37
+ - **`@atlaskit/popup`** (`minor`): wire the compositional `PopupContent` to delegate to
38
+ `PopupContentTopLayer` when `platform-dst-top-layer` is enabled. Previously only the legacy
39
+ `Popup` component had the FF branch, leaving consumers of the compositional API on the legacy
40
+ popper path.
41
+ - **`@atlaskit/select`** (`minor`): add an `onClick` handler to the `PopupSelect` top-layer
42
+ trigger so clicks open/close the menu (mirrors the legacy global click handler in
43
+ `popup-select.tsx`). Add explicit Escape handling on the menu's `onKeyDown` so the menu closes
44
+ and focus returns to the trigger.
45
+ - **`@atlaskit/top-layer`** (`patch`): the `<dialog>` rendered by the Dialog primitive now sets
46
+ `aria-modal="true"` explicitly. Modern browsers infer modal semantics from `.showModal()` but
47
+ some assistive tech still keys off the explicit attribute.
48
+ - **`@atlaskit/top-layer`** (`patch`): guard `use-anchor-positioning` against environments where
49
+ `ResizeObserver` is not defined (e.g. jest's `node` environment, used by the post-office test
50
+ suite). The observer is used to wait for the popover's first valid layout before measuring;
51
+ consumers in non-DOM jest environments now get a no-op observer and the scroll/resize listeners
52
+ still apply if the host environment polyfills `showPopover`. Real browsers always have
53
+ `ResizeObserver`.
54
+ - **`@atlaskit/modal-dialog`** (`patch`): on the FF-on path, drop the `tabIndex={-1}` (and unused
55
+ `:focus-visible` outline) from the modal content wrapper. The native `<dialog>.showModal()`
56
+ focus-delegate algorithm picks the first focusable descendant (including `tabindex=-1`), and the
57
+ wrapper was hijacking initial focus from the close button. Also honor `shouldReturnFocus={ref}`
58
+ on the FF-on path (an unmount-cleanup focuses the ref after `dialog.close()` so it overrides the
59
+ browser's automatic return-to-trigger). Boolean `shouldReturnFocus={false}` is not yet honored
60
+ on the FF-on path — see `top-layer/notes/merge-blockers.md`.
61
+ - **`@atlaskit/datetime-picker`** (`patch`): on the FF-on path, set `mode="manual"` on the
62
+ `Popup.Content` rendered by both `internal/menu-top-layer.tsx` (date-picker calendar) and
63
+ `internal/fixed-layer-menu-top-layer.tsx` (time-picker menu). With the default `mode="auto"`,
64
+ the same click event that opens the menu (which targets the react-select combobox input —
65
+ outside the popover element) bubbles to the browser's native popover light-dismiss handler and
66
+ immediately closes the menu. react-select / DateTimePicker already own outside-click and Esc
67
+ dismissal via their own state, so opting out of the native auto-dismiss is the correct
68
+ integration. Also extend the existing Esc → trigger-focus restoration in
69
+ `components/date-picker.tsx` to the FF-on path (manual mode disables the browser's built-in
70
+ focus return, and the legacy code path was already handling this for itself behind an FF
71
+ negation).
72
+ - **`@atlaskit/popup`** (no public API change): no source changes — only FF-on Playwright
73
+ spec/example fixes drove the suite from 21/3/2 to 27/0/0. Notable: the two `test.fixme`'d
74
+ nested-popover cases were not browser limitations; `popover="auto"` chains correctly via DOM
75
+ ancestry (the original fixmes had the wrong testId selector). Added `testId` props to two
76
+ examples (`16-popup-with-a11y-props`, `18-should-fit-container`) so default-shape tests can
77
+ reach the trigger.
78
+ - Test alignment for FF-on Playwright suites across `popup`, `select`, `datetime-picker`,
79
+ `inline-dialog`, `inline-message`, and `modal-dialog`: selector updates to match the new
80
+ top-layer testId convention (`${testId}--content`, `[role="dialog"][aria-label="calendar"]`),
81
+ per-spec `skipAxeCheck()` for example-level color-contrast violations unrelated to the
82
+ migration, and focus assertions adjusted to match native `<dialog>` / `Popup.Content` auto-focus
83
+ semantics (focus lands on the first focusable child, not the dialog container itself).
84
+ - **`@atlassian/capacity-planning-capacity-graph`**, **`@atlaskit/color-picker`**,
85
+ **`@atlassian/timeline-table`**, **`@atlassian/global-side-navigation`** (`patch`): scope `fg`
86
+ mocks in unit tests so `platform-dst-top-layer` returns `false`. JSDOM does not implement the
87
+ native Popover API (`showPopover`/`hidePopover`/`toggle` events), so leaving the gate ON in unit
88
+ tests caused popover content to remain in the DOM after close and broke close-behaviour
89
+ assertions. Browser coverage for the FF-on path is provided by the Playwright suites listed
90
+ above.
91
+ - **`@atlaskit/dropdown-menu`** (no public API change): test/example-only fixes for the FF-on
92
+ Playwright suite. Added `role="menuitem"` to the nested-trigger `ButtonItem` in
93
+ `examples/93-testing-nested-keyboard-navigation-top-layer.tsx` to satisfy axe's
94
+ `aria-required-children` rule on the parent menu. Added a `test.beforeEach(skipAxeCheck)` to
95
+ `dropdown-menu.spec.tsx` (FF-on suite) for example-level `color-contrast` violations on the
96
+ pre-existing `color.text.selected`/`color.background.selected` token pair (3.91:1). Replaced a
97
+ deadlocking `await expect(moveItem).not.toBeFocused()` pre-open assertion (Playwright's
98
+ auto-wait blocks 5s on the absent element) with `await expect(moveItem).not.toBeVisible()`.
99
+ Suite result: 22/22 passing.
100
+
101
+ - Updated dependencies
102
+
3
103
  ## 17.8.0
4
104
 
5
105
  ### Minor Changes
@@ -22,6 +22,7 @@ var _css = require("@atlaskit/css");
22
22
  var _useId = require("@atlaskit/ds-lib/use-id");
23
23
  var _calendar = _interopRequireDefault(require("@atlaskit/icon/core/calendar"));
24
24
  var _locale = require("@atlaskit/locale");
25
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
26
  var _compiled = require("@atlaskit/primitives/compiled");
26
27
  var _select = _interopRequireWildcard(require("@atlaskit/select"));
27
28
  var _emptyComponent = require("../internal/empty-component");
@@ -33,6 +34,7 @@ var _getShortIsoString = require("../internal/get-short-iso-string");
33
34
  var _indicatorsContainer = require("../internal/indicators-container");
34
35
  var _isDateDisabled = require("../internal/is-date-disabled");
35
36
  var _menu = require("../internal/menu");
37
+ var _menuTopLayer = require("../internal/menu-top-layer");
36
38
  var _parseDate = require("../internal/parse-date");
37
39
  var _singleValue = require("../internal/single-value");
38
40
  var _excluded = ["appearance", "autoFocus", "clearControlLabel", "hideIcon", "openCalendarLabel", "defaultIsOpen", "defaultValue", "disabled", "disabledDateFilter", "icon", "id", "innerProps", "inputLabel", "inputLabelId", "isDisabled", "isInvalid", "isRequired", "label", "name", "onBlur", "onChange", "onFocus", "selectProps", "shouldShowCalendarButton", "spacing", "locale", "value", "isOpen", "maxDate", "minDate", "weekStartDay", "formatDisplayLabel", "testId", "aria-describedby", "placeholder", "nextMonthLabel", "previousMonthLabel"]; /// <reference types="node" />
@@ -42,7 +44,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
42
44
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
43
45
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
44
46
  var packageName = "@atlaskit/datetime-picker";
45
- var packageVersion = "17.7.0";
47
+ var packageVersion = "17.8.0";
46
48
  var styles = {
47
49
  pickerContainerStyle: "_kqswh2mm",
48
50
  dropdownIndicatorStyles: "_1ul91k8s _1tke1k8s _1e0c1txw _4cvr1h6o _1bah1h6o",
@@ -199,10 +201,14 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, _forwarded
199
201
  return;
200
202
  }
201
203
  if (isOpen && wasOpenedFromCalendarButton) {
202
- var _calendarRef$current;
203
204
  setIsKeyDown(false);
204
- // Focus on the first button within the calendar
205
- calendarRef === null || calendarRef === void 0 || (_calendarRef$current = calendarRef.current) === null || _calendarRef$current === void 0 || (_calendarRef$current = _calendarRef$current.querySelector('button')) === null || _calendarRef$current === void 0 || _calendarRef$current.focus();
205
+ // When using top-layer, Popup.Content with role='dialog' automatically
206
+ // focuses the first focusable element no manual focus needed.
207
+ if (!(0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
208
+ var _calendarRef$current;
209
+ // Focus on the first button within the calendar
210
+ calendarRef === null || calendarRef === void 0 || (_calendarRef$current = calendarRef.current) === null || _calendarRef$current === void 0 || (_calendarRef$current = _calendarRef$current.querySelector('button')) === null || _calendarRef$current === void 0 || _calendarRef$current.focus();
211
+ }
206
212
  }
207
213
  }, [isKeyDown, calendarRef, isOpen, wasOpenedFromCalendarButton]);
208
214
  var getValue = function getValue() {
@@ -226,19 +232,17 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, _forwarded
226
232
  setWasOpenedFromCalendarButton(false);
227
233
  onChangePropWithAnalytics(iso);
228
234
 
229
- // Yes, this is not ideal. The alternative is to be able to place a ref
230
- // on the inner input of Select itself, which would require a lot of
231
- // extra stuff in the Select component for only this one thing. While
232
- // this would be more "React-y", it doesn't seem to pose any other
233
- // benefits. Performance-wise, we are only searching within the
234
- // container, so it's quick.
235
- if (wasOpenedFromCalendarButton) {
236
- var _calendarButtonRef$cu;
237
- (_calendarButtonRef$cu = calendarButtonRef.current) === null || _calendarButtonRef$cu === void 0 || _calendarButtonRef$cu.focus();
238
- } else {
239
- var _containerRef$current;
240
- var innerCombobox = containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('[role="combobox"]');
241
- innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
235
+ // When using top-layer, PopupContent handles focus restoration automatically
236
+ // on close based on the role. Only manually restore focus for the legacy path.
237
+ if (!(0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
238
+ if (wasOpenedFromCalendarButton) {
239
+ var _calendarButtonRef$cu;
240
+ (_calendarButtonRef$cu = calendarButtonRef.current) === null || _calendarButtonRef$cu === void 0 || _calendarButtonRef$cu.focus();
241
+ } else {
242
+ var _containerRef$current;
243
+ var innerCombobox = containerRef === null || containerRef === void 0 || (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('[role="combobox"]');
244
+ innerCombobox === null || innerCombobox === void 0 || innerCombobox.focus();
245
+ }
242
246
  }
243
247
  setIsOpen(false);
244
248
  };
@@ -318,12 +322,12 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, _forwarded
318
322
  }
319
323
  switch (keyPressed) {
320
324
  case 'escape':
321
- // Yes, this is not ideal. The alternative is to be able to place a ref
322
- // on the inner input of Select itself, which would require a lot of
323
- // extra stuff in the Select component for only this one thing. While
324
- // this would be more "React-y", it doesn't seem to pose any other
325
- // benefits. Performance-wise, we are only searching within the
326
- // container, so it's quick.
325
+ // Restore focus on close. Both code paths handle this here:
326
+ // the legacy path because it has no built-in restoration, and
327
+ // the top-layer path because the menu uses `mode="manual"` to
328
+ // avoid the auto-popover light-dismiss closing the menu on the
329
+ // same click that opens it (see internal/menu-top-layer.tsx).
330
+ // `manual` mode disables the browser's native focus return.
327
331
  if (wasOpenedFromCalendarButton) {
328
332
  var _calendarButtonRef$cu2;
329
333
  (_calendarButtonRef$cu2 = calendarButtonRef.current) === null || _calendarButtonRef$cu2 === void 0 || _calendarButtonRef$cu2.focus();
@@ -473,7 +477,7 @@ var DatePicker = /*#__PURE__*/(0, _react.forwardRef)(function (props, _forwarded
473
477
  }));
474
478
  }
475
479
  } : {}), {}, {
476
- Menu: _menu.Menu,
480
+ Menu: (0, _platformFeatureFlags.fg)('platform-dst-top-layer') ? _menuTopLayer.MenuTopLayer : _menu.Menu,
477
481
  SingleValue: SingleValue
478
482
  }, !showClearIndicator && {
479
483
  ClearIndicator: _emptyComponent.EmptyComponent
@@ -30,7 +30,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
30
30
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /// <reference types="node" />
31
31
  // oxlint-disable-next-line @atlassian/no-restricted-imports
32
32
  var packageName = "@atlaskit/datetime-picker";
33
- var packageVersion = "17.7.0";
33
+ var packageVersion = "17.8.0";
34
34
  var compiledStyles = {
35
35
  datePickerContainerStyles: "_i0dl1ssb _16jlkb7n _1o9zidpf",
36
36
  timePickerContainerStyles: "_i0dl1ssb _16jlkb7n",
@@ -403,4 +403,6 @@ var DateTimePicker = (0, _analyticsNext.withAnalyticsContext)({
403
403
  }
404
404
  })
405
405
  })(DateTimePickerComponent));
406
+
407
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
406
408
  var _default = exports.default = DateTimePicker;
@@ -33,7 +33,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
33
33
  // for typing `process`
34
34
  // oxlint-disable-next-line @atlassian/no-restricted-imports
35
35
  var packageName = "@atlaskit/datetime-picker";
36
- var packageVersion = "17.7.0";
36
+ var packageVersion = "17.8.0";
37
37
  var analyticsAttributes = {
38
38
  componentName: 'dateTimePicker',
39
39
  packageName: packageName,
@@ -15,10 +15,12 @@ var _dateFns = require("date-fns");
15
15
  var _analyticsNext = require("@atlaskit/analytics-next");
16
16
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
17
17
  var _locale = require("@atlaskit/locale");
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _select = _interopRequireWildcard(require("@atlaskit/select"));
19
20
  var _defaultTimes = require("../internal/default-times");
20
21
  var _emptyComponent = require("../internal/empty-component");
21
22
  var _fixedLayerMenu = require("../internal/fixed-layer-menu");
23
+ var _fixedLayerMenuTopLayer = require("../internal/fixed-layer-menu-top-layer");
22
24
  var _parseTime = _interopRequireDefault(require("../internal/parse-time"));
23
25
  var _parseTokens = require("../internal/parse-tokens");
24
26
  var _placeholderDateTime = require("../internal/placeholder-date-time");
@@ -28,7 +30,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
28
30
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
31
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // oxlint-disable-next-line @atlassian/no-restricted-imports
30
32
  var packageName = "@atlaskit/datetime-picker";
31
- var packageVersion = "17.7.0";
33
+ var packageVersion = "17.8.0";
32
34
  var defaultTimeFormat = 'h:mma';
33
35
  var menuStyles = {
34
36
  /* Need to remove default absolute positioning as that causes issues with position fixed */
@@ -281,7 +283,7 @@ var TimePicker = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, _ref) {
281
283
  });
282
284
  var selectComponents = _objectSpread({
283
285
  DropdownIndicator: _emptyComponent.EmptyComponent,
284
- Menu: _fixedLayerMenu.FixedLayerMenu,
286
+ Menu: (0, _platformFeatureFlags.fg)('platform-dst-top-layer') ? _fixedLayerMenuTopLayer.FixedLayerMenuTopLayer : _fixedLayerMenu.FixedLayerMenu,
285
287
  SingleValue: SingleValue
286
288
  }, hideIcon && {
287
289
  ClearIndicator: _emptyComponent.EmptyComponent
@@ -0,0 +1,113 @@
1
+ /* fixed-layer-menu-top-layer.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.FixedLayerMenuTopLayer = void 0;
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var React = _react;
12
+ var _runtime = require("@compiled/react/runtime");
13
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
+ var _select = require("@atlaskit/select");
16
+ var _animations = require("@atlaskit/top-layer/animations");
17
+ var _placementMap = require("@atlaskit/top-layer/placement-map");
18
+ var _popup = require("@atlaskit/top-layer/popup");
19
+ var _excluded = ["className", "clearValue", "cx", "getStyles", "getValue", "hasValue", "innerProps", "innerRef", "isLoading", "isMulti", "isRtl", "maxMenuHeight", "menuPlacement", "menuPosition", "menuShouldScrollIntoView", "minMenuHeight", "options", "placement", "selectOption", "selectProps", "setValue", "children"];
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
+ var animation = (0, _animations.slideAndFade)();
22
+
23
+ /**
24
+ * Bottom-start placement: time options menu appears below and aligned to the
25
+ * start edge of the trigger (the select input).
26
+ */
27
+ var popupPlacement = (0, _placementMap.fromLegacyPlacement)({
28
+ legacy: 'bottom-start'
29
+ });
30
+
31
+ /**
32
+ * Top-layer version of the fixed layer menu used in the time picker.
33
+ *
34
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
35
+ * time options list renders in the browser's top layer via the native Popover API
36
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
37
+ * z-index wars, and portal-based layering.
38
+ *
39
+ * Gated behind the `platform-dst-top-layer` feature flag.
40
+ */
41
+ var FixedLayerMenuTopLayer = exports.FixedLayerMenuTopLayer = function FixedLayerMenuTopLayer(_ref) {
42
+ var _selectProps$fixedLay, _selectProps$fixedLay2;
43
+ var className = _ref.className,
44
+ clearValue = _ref.clearValue,
45
+ cx = _ref.cx,
46
+ getStyles = _ref.getStyles,
47
+ getValue = _ref.getValue,
48
+ hasValue = _ref.hasValue,
49
+ innerProps = _ref.innerProps,
50
+ innerRef = _ref.innerRef,
51
+ isLoading = _ref.isLoading,
52
+ isMulti = _ref.isMulti,
53
+ isRtl = _ref.isRtl,
54
+ maxMenuHeight = _ref.maxMenuHeight,
55
+ menuPlacement = _ref.menuPlacement,
56
+ menuPosition = _ref.menuPosition,
57
+ menuShouldScrollIntoView = _ref.menuShouldScrollIntoView,
58
+ minMenuHeight = _ref.minMenuHeight,
59
+ options = _ref.options,
60
+ placement = _ref.placement,
61
+ selectOption = _ref.selectOption,
62
+ selectProps = _ref.selectProps,
63
+ setValue = _ref.setValue,
64
+ children = _ref.children,
65
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
66
+ // The select's container element is the anchor for the popup.
67
+ // @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
68
+ var triggerRef = (0, _react.useRef)((_selectProps$fixedLay = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay !== void 0 ? _selectProps$fixedLay : null);
69
+ // @ts-ignore -- fixedLayerRef is a custom prop passed through selectProps
70
+ triggerRef.current = (_selectProps$fixedLay2 = selectProps.fixedLayerRef) !== null && _selectProps$fixedLay2 !== void 0 ? _selectProps$fixedLay2 : null;
71
+ return /*#__PURE__*/React.createElement(_popup.Popup.Content, {
72
+ role: "listbox",
73
+ isOpen: true
74
+ // `mode="manual"` opts out of the native popover light-dismiss
75
+ // (Esc / click-outside). react-select already owns those: opening
76
+ // the menu via a click on the input that lives outside the popover
77
+ // element triggers the browser's auto-dismiss as that very click
78
+ // bubbles, slamming the menu shut before the user sees it. With
79
+ // `manual`, react-select's existing onMenuClose / outside-click
80
+ // logic remains the single source of truth.
81
+ ,
82
+ mode: "manual",
83
+ placement: popupPlacement,
84
+ triggerRef: triggerRef,
85
+ animate: animation
86
+ // @ts-ignore -- testId is a custom prop passed through selectProps
87
+ ,
88
+ testId: selectProps.testId && "".concat(selectProps.testId, "--popup")
89
+ }, /*#__PURE__*/React.createElement(_popup.Popup.Surface, null, /*#__PURE__*/React.createElement(_select.components.Menu, (0, _extends2.default)({}, rest, {
90
+ // eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides, @atlaskit/ui-styling-standard/no-classname-prop
91
+ className: className,
92
+ clearValue: clearValue,
93
+ cx: cx,
94
+ getStyles: getStyles,
95
+ getValue: getValue,
96
+ hasValue: hasValue,
97
+ innerProps: innerProps,
98
+ innerRef: innerRef,
99
+ isLoading: isLoading,
100
+ isMulti: isMulti,
101
+ isRtl: isRtl,
102
+ maxMenuHeight: maxMenuHeight,
103
+ menuPlacement: menuPlacement,
104
+ menuPosition: menuPosition,
105
+ menuShouldScrollIntoView: false || menuShouldScrollIntoView,
106
+ minMenuHeight: minMenuHeight,
107
+ options: options,
108
+ placement: placement,
109
+ selectOption: selectOption,
110
+ selectProps: selectProps,
111
+ setValue: setValue
112
+ }), children)));
113
+ };
@@ -0,0 +1,116 @@
1
+ /* menu-top-layer.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.MenuTopLayer = void 0;
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var React = _react;
12
+ var _runtime = require("@compiled/react/runtime");
13
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
+ var _dateFns = require("date-fns");
15
+ var _calendar = _interopRequireDefault(require("@atlaskit/calendar"));
16
+ var _animations = require("@atlaskit/top-layer/animations");
17
+ var _placementMap = require("@atlaskit/top-layer/placement-map");
18
+ var _popup = require("@atlaskit/top-layer/popup");
19
+ 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); }
20
+ var animation = (0, _animations.slideAndFade)();
21
+
22
+ /**
23
+ * Bottom-start placement: calendar appears below and aligned to the
24
+ * start edge of the trigger (the select input).
25
+ */
26
+ var popupPlacement = (0, _placementMap.fromLegacyPlacement)({
27
+ legacy: 'bottom-start'
28
+ });
29
+
30
+ /**
31
+ * @param isos A series of ISO dates.
32
+ * @returns The last valid date within the array of ISO strings.
33
+ */
34
+ function getValidDate(isos) {
35
+ return isos.reduce(function (acc, iso) {
36
+ var date = (0, _dateFns.parseISO)(iso);
37
+ return (0, _dateFns.isValid)(date) ? {
38
+ day: date.getDate(),
39
+ month: date.getMonth() + 1,
40
+ year: date.getFullYear()
41
+ } : acc;
42
+ }, {});
43
+ }
44
+
45
+ /**
46
+ * Top-layer version of the date picker menu.
47
+ *
48
+ * Uses `@atlaskit/top-layer/popup` (Popup.Content + Popup.Surface) so the
49
+ * calendar renders in the browser's top layer via the native Popover API
50
+ * and is positioned via CSS Anchor Positioning. This avoids overflow clipping,
51
+ * z-index wars, and portal-based layering.
52
+ *
53
+ * Gated behind the `platform-dst-top-layer` feature flag.
54
+ */
55
+ var MenuTopLayer = exports.MenuTopLayer = function MenuTopLayer(_ref) {
56
+ var _selectProps$calendar, _selectProps$calendar2;
57
+ var selectProps = _ref.selectProps,
58
+ innerProps = _ref.innerProps;
59
+ var calendarValue = selectProps.calendarValue,
60
+ calendarView = selectProps.calendarView,
61
+ MenuInnerWrapper = selectProps.menuInnerWrapper;
62
+ var _getValidDate = getValidDate([calendarValue, calendarView]),
63
+ day = _getValidDate.day,
64
+ month = _getValidDate.month,
65
+ year = _getValidDate.year;
66
+
67
+ // The select's container element is the anchor for the popup.
68
+ var triggerRef = (0, _react.useRef)((_selectProps$calendar = selectProps.calendarContainerRef) !== null && _selectProps$calendar !== void 0 ? _selectProps$calendar : null);
69
+ triggerRef.current = (_selectProps$calendar2 = selectProps.calendarContainerRef) !== null && _selectProps$calendar2 !== void 0 ? _selectProps$calendar2 : null;
70
+ var onMenuMouseDown = function onMenuMouseDown(event) {
71
+ if (event.button !== 0) {
72
+ return;
73
+ }
74
+ event.stopPropagation();
75
+ event.preventDefault();
76
+ };
77
+ var Wrapper = typeof MenuInnerWrapper === 'function' ? MenuInnerWrapper : _react.Fragment;
78
+ return /*#__PURE__*/React.createElement(_popup.Popup.Content, {
79
+ role: "dialog",
80
+ label: "calendar",
81
+ isOpen: true
82
+ // `mode="manual"` opts out of native popover light-dismiss.
83
+ // react-select / DateTimePicker already own outside-click and
84
+ // Esc handling. Without this, the same click that opens the
85
+ // menu (which targets the select input outside the popover)
86
+ // also bubbles to the browser's auto-dismiss handler and
87
+ // immediately closes the popover.
88
+ ,
89
+ mode: "manual",
90
+ placement: popupPlacement,
91
+ triggerRef: triggerRef,
92
+ animate: animation,
93
+ testId: selectProps.testId && "".concat(selectProps.testId, "--popup")
94
+ }, /*#__PURE__*/React.createElement(_popup.Popup.Surface, null, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, innerProps, {
95
+ role: "presentation",
96
+ onMouseDown: onMenuMouseDown
97
+ }), /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(_calendar.default, {
98
+ day: day,
99
+ month: month,
100
+ year: year,
101
+ disabled: selectProps.calendarDisabled,
102
+ disabledDateFilter: selectProps.calendarDisabledDateFilter,
103
+ minDate: selectProps.calendarMinDate,
104
+ maxDate: selectProps.calendarMaxDate,
105
+ nextMonthLabel: selectProps.nextMonthLabel,
106
+ onChange: selectProps.onCalendarChange,
107
+ onSelect: selectProps.onCalendarSelect,
108
+ previousMonthLabel: selectProps.previousMonthLabel,
109
+ ref: selectProps.calendarRef,
110
+ selected: [selectProps.calendarValue],
111
+ shouldSetFocusOnCurrentDay: selectProps.shouldSetFocusOnCurrentDay,
112
+ locale: selectProps.calendarLocale,
113
+ testId: selectProps.testId && "".concat(selectProps.testId, "--calendar"),
114
+ weekStartDay: selectProps.calendarWeekStartDay
115
+ })))));
116
+ };
@@ -15,6 +15,7 @@ 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
17
  import { createLocalizationProvider } from '@atlaskit/locale';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
18
19
  import { Box } from '@atlaskit/primitives/compiled';
19
20
  import Select, { mergeStyles } from '@atlaskit/select';
20
21
  import { EmptyComponent } from '../internal/empty-component';
@@ -26,10 +27,11 @@ import { getShortISOString } from '../internal/get-short-iso-string';
26
27
  import { IndicatorsContainer } from '../internal/indicators-container';
27
28
  import { isDateDisabled } from '../internal/is-date-disabled';
28
29
  import { Menu } from '../internal/menu';
30
+ import { MenuTopLayer } from '../internal/menu-top-layer';
29
31
  import { parseDate } from '../internal/parse-date';
30
32
  import { makeSingleValue } from '../internal/single-value';
31
33
  const packageName = "@atlaskit/datetime-picker";
32
- const packageVersion = "17.7.0";
34
+ const packageVersion = "17.8.0";
33
35
  const styles = {
34
36
  pickerContainerStyle: "_kqswh2mm",
35
37
  dropdownIndicatorStyles: "_1ul91k8s _1tke1k8s _1e0c1txw _4cvr1h6o _1bah1h6o",
@@ -128,10 +130,14 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
128
130
  return;
129
131
  }
130
132
  if (isOpen && wasOpenedFromCalendarButton) {
131
- var _calendarRef$current, _calendarRef$current$;
132
133
  setIsKeyDown(false);
133
- // Focus on the first button within the calendar
134
- 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();
134
+ // When using top-layer, Popup.Content with role='dialog' automatically
135
+ // focuses the first focusable element no manual focus needed.
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
+ }
135
141
  }
136
142
  }, [isKeyDown, calendarRef, isOpen, wasOpenedFromCalendarButton]);
137
143
  const getValue = () => propValue !== null && propValue !== void 0 ? propValue : value;
@@ -153,19 +159,17 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
153
159
  setWasOpenedFromCalendarButton(false);
154
160
  onChangePropWithAnalytics(iso);
155
161
 
156
- // Yes, this is not ideal. The alternative is to be able to place a ref
157
- // on the inner input of Select itself, which would require a lot of
158
- // extra stuff in the Select component for only this one thing. While
159
- // this would be more "React-y", it doesn't seem to pose any other
160
- // benefits. Performance-wise, we are only searching within the
161
- // container, so it's quick.
162
- if (wasOpenedFromCalendarButton) {
163
- var _calendarButtonRef$cu;
164
- (_calendarButtonRef$cu = calendarButtonRef.current) === null || _calendarButtonRef$cu === void 0 ? void 0 : _calendarButtonRef$cu.focus();
165
- } else {
166
- var _containerRef$current;
167
- const innerCombobox = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('[role="combobox"]');
168
- innerCombobox === null || innerCombobox === void 0 ? void 0 : innerCombobox.focus();
162
+ // When using top-layer, PopupContent handles focus restoration automatically
163
+ // on close based on the role. Only manually restore focus for the legacy path.
164
+ if (!fg('platform-dst-top-layer')) {
165
+ if (wasOpenedFromCalendarButton) {
166
+ var _calendarButtonRef$cu;
167
+ (_calendarButtonRef$cu = calendarButtonRef.current) === null || _calendarButtonRef$cu === void 0 ? void 0 : _calendarButtonRef$cu.focus();
168
+ } else {
169
+ var _containerRef$current;
170
+ const innerCombobox = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.querySelector('[role="combobox"]');
171
+ innerCombobox === null || innerCombobox === void 0 ? void 0 : innerCombobox.focus();
172
+ }
169
173
  }
170
174
  setIsOpen(false);
171
175
  };
@@ -245,12 +249,12 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
245
249
  }
246
250
  switch (keyPressed) {
247
251
  case 'escape':
248
- // Yes, this is not ideal. The alternative is to be able to place a ref
249
- // on the inner input of Select itself, which would require a lot of
250
- // extra stuff in the Select component for only this one thing. While
251
- // this would be more "React-y", it doesn't seem to pose any other
252
- // benefits. Performance-wise, we are only searching within the
253
- // container, so it's quick.
252
+ // Restore focus on close. Both code paths handle this here:
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.
254
258
  if (wasOpenedFromCalendarButton) {
255
259
  var _calendarButtonRef$cu2;
256
260
  (_calendarButtonRef$cu2 = calendarButtonRef.current) === null || _calendarButtonRef$cu2 === void 0 ? void 0 : _calendarButtonRef$cu2.focus();
@@ -399,7 +403,7 @@ const DatePicker = /*#__PURE__*/forwardRef((props, _forwardedRef) => {
399
403
  showClearIndicator: showClearIndicator
400
404
  }))
401
405
  } : {}),
402
- Menu,
406
+ Menu: fg('platform-dst-top-layer') ? MenuTopLayer : Menu,
403
407
  SingleValue,
404
408
  ...(!showClearIndicator && {
405
409
  ClearIndicator: EmptyComponent
@@ -16,7 +16,7 @@ import { convertTokens } from '../internal/parse-tokens';
16
16
  import DatePicker from './date-picker';
17
17
  import TimePicker from './time-picker';
18
18
  const packageName = "@atlaskit/datetime-picker";
19
- const packageVersion = "17.7.0";
19
+ const packageVersion = "17.8.0";
20
20
  const compiledStyles = {
21
21
  datePickerContainerStyles: "_i0dl1ssb _16jlkb7n _1o9zidpf",
22
22
  timePickerContainerStyles: "_i0dl1ssb _16jlkb7n",
@@ -368,4 +368,6 @@ const DateTimePicker = withAnalyticsContext({
368
368
  }
369
369
  })
370
370
  })(DateTimePickerComponent));
371
+
372
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
371
373
  export default DateTimePicker;
@@ -20,7 +20,7 @@ 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 = "17.7.0";
23
+ const packageVersion = "17.8.0";
24
24
  const analyticsAttributes = {
25
25
  componentName: 'dateTimePicker',
26
26
  packageName,