@atlaskit/popup 4.16.6 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/compositional/popup/package.json +17 -0
  3. package/compositional/popup-content/package.json +17 -0
  4. package/compositional/popup-trigger/package.json +17 -0
  5. package/dist/cjs/compositional/popup-content-top-layer.compiled.css +2 -0
  6. package/dist/cjs/compositional/popup-content-top-layer.js +135 -0
  7. package/dist/cjs/compositional/popup-content.js +36 -0
  8. package/dist/cjs/entry-points/compositional-popup-content.js +12 -0
  9. package/dist/cjs/entry-points/compositional-popup-trigger.js +12 -0
  10. package/dist/cjs/entry-points/compositional-popup.js +12 -0
  11. package/dist/cjs/entry-points/popup.js +12 -0
  12. package/dist/cjs/entry-points/types.js +1 -0
  13. package/dist/cjs/internal/top-layer-bridge.js +55 -0
  14. package/dist/cjs/popper-wrapper.js +13 -8
  15. package/dist/cjs/popup-top-layer.compiled.css +2 -0
  16. package/dist/cjs/popup-top-layer.js +185 -0
  17. package/dist/cjs/popup.js +63 -45
  18. package/dist/es2019/compositional/popup-content-top-layer.compiled.css +2 -0
  19. package/dist/es2019/compositional/popup-content-top-layer.js +140 -0
  20. package/dist/es2019/compositional/popup-content.js +36 -0
  21. package/dist/es2019/entry-points/compositional-popup-content.js +1 -0
  22. package/dist/es2019/entry-points/compositional-popup-trigger.js +1 -0
  23. package/dist/es2019/entry-points/compositional-popup.js +1 -0
  24. package/dist/es2019/entry-points/popup.js +1 -0
  25. package/dist/es2019/entry-points/types.js +0 -0
  26. package/dist/es2019/internal/top-layer-bridge.js +51 -0
  27. package/dist/es2019/popper-wrapper.js +11 -8
  28. package/dist/es2019/popup-top-layer.compiled.css +2 -0
  29. package/dist/es2019/popup-top-layer.js +193 -0
  30. package/dist/es2019/popup.js +52 -33
  31. package/dist/esm/compositional/popup-content-top-layer.compiled.css +2 -0
  32. package/dist/esm/compositional/popup-content-top-layer.js +126 -0
  33. package/dist/esm/compositional/popup-content.js +36 -0
  34. package/dist/esm/entry-points/compositional-popup-content.js +1 -0
  35. package/dist/esm/entry-points/compositional-popup-trigger.js +1 -0
  36. package/dist/esm/entry-points/compositional-popup.js +1 -0
  37. package/dist/esm/entry-points/popup.js +1 -0
  38. package/dist/esm/entry-points/types.js +0 -0
  39. package/dist/esm/internal/top-layer-bridge.js +50 -0
  40. package/dist/esm/popper-wrapper.js +13 -8
  41. package/dist/esm/popup-top-layer.compiled.css +2 -0
  42. package/dist/esm/popup-top-layer.js +176 -0
  43. package/dist/esm/popup.js +63 -45
  44. package/dist/types/compositional/popup-content-top-layer.d.ts +21 -0
  45. package/dist/types/compositional/popup-content.d.ts +2 -2
  46. package/dist/types/entry-points/compositional-popup-content.d.ts +2 -0
  47. package/dist/types/entry-points/compositional-popup-trigger.d.ts +2 -0
  48. package/dist/types/entry-points/compositional-popup.d.ts +2 -0
  49. package/dist/types/entry-points/popup.d.ts +1 -0
  50. package/dist/types/entry-points/types.d.ts +1 -0
  51. package/dist/types/internal/top-layer-bridge.d.ts +29 -0
  52. package/dist/types/popper-wrapper.d.ts +1 -1
  53. package/dist/types/popup-top-layer.d.ts +16 -0
  54. package/dist/types/types.d.ts +38 -0
  55. package/dist/types-ts4.5/compositional/popup-content-top-layer.d.ts +21 -0
  56. package/dist/types-ts4.5/compositional/popup-content.d.ts +2 -2
  57. package/dist/types-ts4.5/entry-points/compositional-popup-content.d.ts +2 -0
  58. package/dist/types-ts4.5/entry-points/compositional-popup-trigger.d.ts +2 -0
  59. package/dist/types-ts4.5/entry-points/compositional-popup.d.ts +2 -0
  60. package/dist/types-ts4.5/entry-points/popup.d.ts +1 -0
  61. package/dist/types-ts4.5/entry-points/types.d.ts +1 -0
  62. package/dist/types-ts4.5/internal/top-layer-bridge.d.ts +29 -0
  63. package/dist/types-ts4.5/popper-wrapper.d.ts +1 -1
  64. package/dist/types-ts4.5/popup-top-layer.d.ts +16 -0
  65. package/dist/types-ts4.5/types.d.ts +38 -0
  66. package/package.json +13 -8
  67. package/popup/package.json +17 -0
  68. package/types/package.json +5 -5
  69. package/offerings.json +0 -34
@@ -1,4 +1,5 @@
1
1
  /* popper-wrapper.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  import _extends from "@babel/runtime/helpers/extends";
@@ -6,6 +7,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
6
7
  var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children", "appearance", "className", "isReferenceHidden", "shouldFitViewport"];
7
8
  import "./popper-wrapper.compiled.css";
8
9
  import * as React from 'react';
10
+ 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; }
11
+ 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) { _defineProperty(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; }
9
12
  import { forwardRef, Fragment, useMemo, useState } from 'react';
10
13
  import { ax, ix } from '@compiled/react/runtime';
11
14
  import { useLayering } from '@atlaskit/layering';
@@ -20,7 +23,6 @@ var fullWidthStyles = null;
20
23
  var wrapperStyles = {
21
24
  root: "_2rko12b0 _1e0c1ule _vchhusvi _1pby1nn1 _bfhk1bhr _16qs130s _syazi7uo _1q1l1bhr _nt751r31 _49pcglyw _1hvw1o36",
22
25
  rootT26Shape: "_2rko1mok",
23
- rootLayer: "_1pby1nn1",
24
26
  fullWidth: "_1bsb1osq"
25
27
  };
26
28
  var scrollableStyles = null;
@@ -93,7 +95,7 @@ var DefaultPopupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
93
95
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
94
96
  className: ax([wrapperStyles.root, fg('platform-dst-shape-theme-default') && wrapperStyles.rootT26Shape, appearance === 'UNSAFE_modal-below-sm' && !fg('platform_dst_nav4_flyout_menu_slots_close_button') && "_dk5d1b66 _c71ldtre _kqsw1n9t _152t1b66", appearance === 'UNSAFE_modal-below-sm' && fg('platform_dst_nav4_flyout_menu_slots_close_button') && "_dk5d1b66 _c71l1ei0 _kqsw1n9t _152t1b66", (!shouldRenderToParent || shouldFitViewport) && "_1reo1wug _18m91wug", shouldFitContainer && "_1bsb1osq", className])
95
97
  }, htmlAttributes, {
96
- ref: !fg('platform-dst-motion-uplift') ? ref : undefined
98
+ ref: !fg('platform-dst-motion-uplift-popup') ? ref : undefined
97
99
  }), children);
98
100
  });
99
101
  function PopperWrapper(_ref) {
@@ -128,7 +130,8 @@ function PopperWrapper(_ref) {
128
130
  modifiers = _ref.modifiers,
129
131
  shouldFitViewport = _ref.shouldFitViewport,
130
132
  _ref$appearance = _ref.appearance,
131
- appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance;
133
+ appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
134
+ zIndex = _ref.zIndex;
132
135
  var _useState = useState(null),
133
136
  _useState2 = _slicedToArray(_useState, 2),
134
137
  popupRef = _useState2[0],
@@ -199,7 +202,7 @@ function PopperWrapper(_ref) {
199
202
  role: role,
200
203
  "aria-label": label,
201
204
  "aria-labelledby": titleId,
202
- ref: !fg('platform-dst-motion-uplift') ? function (node) {
205
+ ref: !fg('platform-dst-motion-uplift-popup') ? function (node) {
203
206
  if (node) {
204
207
  if (typeof _ref3 === 'function') {
205
208
  _ref3(node);
@@ -211,7 +214,7 @@ function PopperWrapper(_ref) {
211
214
  } : undefined
212
215
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
213
216
  ,
214
- style: fg('platform-dst-motion-uplift') || appearance === 'UNSAFE_modal-below-sm' ? {} : style
217
+ style: fg('platform-dst-motion-uplift-popup') || appearance === 'UNSAFE_modal-below-sm' ? {} : style
215
218
  // using tabIndex={-1} would cause a bug where Safari focuses
216
219
  // first on the browser address bar when using keyboard
217
220
  ,
@@ -230,7 +233,9 @@ function PopperWrapper(_ref) {
230
233
  })));
231
234
  var container = /*#__PURE__*/React.createElement("div", {
232
235
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
233
- style: style,
236
+ style: _objectSpread(_objectSpread({}, style), {}, {
237
+ zIndex: zIndex
238
+ }),
234
239
  // using tabIndex={-1} would cause a bug where Safari focuses
235
240
  // first on the browser address bar when using keyboard
236
241
  ref: function ref(node) {
@@ -244,12 +249,12 @@ function PopperWrapper(_ref) {
244
249
  }
245
250
  },
246
251
  "data-testid": "".concat(testId, "--container"),
247
- className: ax([wrapperStyles.rootLayer, shouldFitContainer && wrapperStyles.fullWidth])
252
+ className: ax([shouldFitContainer && wrapperStyles.fullWidth])
248
253
  }, placement === 'auto' || placement === 'auto-start' || placement === 'auto-end' ? popupContainer : /*#__PURE__*/React.createElement(Motion, {
249
254
  enteringAnimation: placementMap[placement].enter,
250
255
  exitingAnimation: placementMap[placement].exit
251
256
  }, popupContainer));
252
- return /*#__PURE__*/React.createElement(Fragment, null, fg('platform-dst-motion-uplift') ? container : popupContainer, appearance === 'UNSAFE_modal-below-sm' && /*#__PURE__*/React.createElement("div", {
257
+ return /*#__PURE__*/React.createElement(Fragment, null, fg('platform-dst-motion-uplift-popup') ? container : popupContainer, appearance === 'UNSAFE_modal-below-sm' && /*#__PURE__*/React.createElement("div", {
253
258
  className: ax(["_1r04idpf _kqsw1n9t _bfhk1i5c"])
254
259
  }));
255
260
  });
@@ -0,0 +1,2 @@
1
+ ._18m91wug{overflow-y:auto}
2
+ ._1reo1wug{overflow-x:auto}
@@ -0,0 +1,176 @@
1
+ /* popup-top-layer.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import "./popup-top-layer.compiled.css";
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
7
+ import { memo, useCallback, useMemo, useRef, useState } from 'react';
8
+ import noop from '@atlaskit/ds-lib/noop';
9
+ import { slideAndFade } from '@atlaskit/top-layer/animations';
10
+ import { createPopoverCloseEvent } from '@atlaskit/top-layer/create-close-event';
11
+ import { fromLegacyPlacement } from '@atlaskit/top-layer/placement-map';
12
+ import { Popup } from '@atlaskit/top-layer/popup';
13
+ import { useRoleProps } from './internal/top-layer-bridge';
14
+ var contentOverflowStyles = {
15
+ fitViewport: "_1reo1wug _18m91wug",
16
+ default: ""
17
+ };
18
+ var animation = slideAndFade();
19
+
20
+ // Top-layer positioning is handled by CSS Anchor Positioning, not inline styles.
21
+ var EMPTY_STYLE = {};
22
+
23
+ /**
24
+ * Top-layer implementation of Popup.
25
+ *
26
+ * Replaces the legacy @atlaskit/popup rendering pipeline
27
+ * (Popper.js + Portal + focus-trap + @atlaskit/layering)
28
+ * with the native Popover API + CSS Anchor Positioning via @atlaskit/top-layer.
29
+ *
30
+ * Gated behind the `platform-dst-top-layer` feature flag.
31
+ */
32
+ export var PopupTopLayer = /*#__PURE__*/memo(function PopupTopLayer(_ref) {
33
+ var xcss = _ref.xcss,
34
+ isOpen = _ref.isOpen,
35
+ providedId = _ref.id,
36
+ offsetProp = _ref.offset,
37
+ testId = _ref.testId,
38
+ trigger = _ref.trigger,
39
+ content = _ref.content,
40
+ onClose = _ref.onClose,
41
+ _ref$placement = _ref.placement,
42
+ placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
43
+ _fallbackPlacements = _ref.fallbackPlacements,
44
+ _ref$shouldFlip = _ref.shouldFlip,
45
+ _shouldFlip = _ref$shouldFlip === void 0 ? true : _ref$shouldFlip,
46
+ PopupContainer = _ref.popupComponent,
47
+ _ref$autoFocus = _ref.autoFocus,
48
+ autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
49
+ _ref$shouldFitContain = _ref.shouldFitContainer,
50
+ shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
51
+ _ref$shouldReturnFocu = _ref.shouldReturnFocus,
52
+ _shouldReturnFocus = _ref$shouldReturnFocu === void 0 ? true : _ref$shouldReturnFocu,
53
+ role = _ref.role,
54
+ label = _ref.label,
55
+ titleId = _ref.titleId,
56
+ _zIndex = _ref.zIndex,
57
+ _shouldRenderToParent = _ref.shouldRenderToParent,
58
+ _strategy = _ref.strategy,
59
+ _modifiers = _ref.modifiers,
60
+ _boundary = _ref.boundary,
61
+ _rootBoundary = _ref.rootBoundary,
62
+ _shouldUseCaptureOnOutsideClick = _ref.shouldUseCaptureOnOutsideClick,
63
+ _shouldDisableFocusLock = _ref.shouldDisableFocusLock,
64
+ shouldFitViewport = _ref.shouldFitViewport,
65
+ _appearance = _ref.appearance;
66
+ var triggerRef = useRef(null);
67
+ var popupContainerRef = useRef(null);
68
+ var _useState = useState(null),
69
+ _useState2 = _slicedToArray(_useState, 2),
70
+ setInitialFocusRef = _useState2[1];
71
+
72
+ // ── Placement conversion ──
73
+ // Legacy `offset` is the popper `[along, away]` tuple; `fromLegacyPlacement`
74
+ // folds it into the new `placement.offset` shape so it travels with placement.
75
+ var topLayerPlacement = useMemo(function () {
76
+ return fromLegacyPlacement({
77
+ legacy: placement,
78
+ offset: offsetProp
79
+ });
80
+ }, [placement, offsetProp]);
81
+
82
+ // ── onClose bridge ──
83
+ // Translates top-layer's { reason: TPopoverCloseReason } into legacy
84
+ // onClose(event, currentLevel?) by synthesizing DOM events.
85
+ //
86
+ // Focus restoration is handled natively by the Popover API:
87
+ // - Escape → browser restores focus to the trigger automatically
88
+ // - Click-outside → browser does NOT restore (correct behavior)
89
+ // No manual triggerRef.current?.focus() is needed.
90
+ var handleOnClose = useCallback(function (_ref2) {
91
+ var reason = _ref2.reason;
92
+ if (!onClose) {
93
+ return;
94
+ }
95
+ onClose(createPopoverCloseEvent({
96
+ reason: reason
97
+ }));
98
+ }, [onClose]);
99
+
100
+ // ── Content render-prop bridge ──
101
+ // Legacy content() receives { isOpen, update, setInitialFocusRef, onClose }.
102
+ // update is a no-op — CSS Anchor Positioning self-updates.
103
+ var contentProps = useMemo(function () {
104
+ return {
105
+ isOpen: isOpen,
106
+ update: noop,
107
+ onClose: onClose,
108
+ setInitialFocusRef: setInitialFocusRef
109
+ };
110
+ }, [isOpen, onClose]);
111
+
112
+ // ── Role mapping ──
113
+ // Build the role/label props for PopupContent.
114
+ // Roles requiring accessible names must have label or labelledBy.
115
+ var roleProps = useRoleProps({
116
+ role: role,
117
+ label: label,
118
+ titleId: titleId
119
+ });
120
+
121
+ // Sync controlled isOpen with internal state
122
+ var effectiveIsOpen = isOpen;
123
+
124
+ // Narrow to ForwardRefExoticComponent so JSX accepts the ref prop.
125
+ // All popupComponent implementations use forwardRef per the PopupComponentProps contract.
126
+ var Container = PopupContainer;
127
+ return /*#__PURE__*/React.createElement(Popup, {
128
+ placement: topLayerPlacement,
129
+ onClose: handleOnClose,
130
+ testId: testId
131
+ }, /*#__PURE__*/React.createElement(Popup.TriggerFunction, null, function (_ref3) {
132
+ var _ref4 = _ref3.ref,
133
+ _toggle = _ref3.toggle,
134
+ ariaAttributes = _ref3.ariaAttributes,
135
+ popoverId = _ref3.popoverId;
136
+ // Map to legacy TriggerProps
137
+ var triggerProps = {
138
+ ref: function ref(node) {
139
+ triggerRef.current = node;
140
+ if (typeof _ref4 === 'function') {
141
+ _ref4(node);
142
+ }
143
+ },
144
+ 'aria-controls': effectiveIsOpen ? providedId !== null && providedId !== void 0 ? providedId : popoverId : undefined,
145
+ 'aria-expanded': effectiveIsOpen,
146
+ // FUDGE(top-layer-api): cast to the narrow public TriggerProps['aria-haspopup'] union.
147
+ // `@atlaskit/top-layer` derives `aria-haspopup` from the content's role and types it
148
+ // as the wider WAI-ARIA union (boolean | 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid').
149
+ // We keep the public popup TriggerProps narrow (boolean | 'dialog') because the
150
+ // top-layer API surface is not yet settled. Widening adopter types now would commit
151
+ // us to a public surface we may revisit. The runtime value is unchanged; only the
152
+ // TypeScript-visible type is narrowed at this boundary.
153
+ // REMOVE WHEN: the top-layer public API is committed (see
154
+ // packages/design-system/top-layer/notes/decisions/migration-roadmap.md "Open API
155
+ // decisions deferred to a follow-up PR") and a follow-up `minor` PR widens
156
+ // `TriggerProps['aria-haspopup']` to match.
157
+ 'aria-haspopup': ariaAttributes['aria-haspopup']
158
+ };
159
+ return trigger(triggerProps);
160
+ }), /*#__PURE__*/React.createElement(Popup.Content, _extends({}, roleProps, {
161
+ isOpen: effectiveIsOpen,
162
+ animate: animation,
163
+ testId: testId && "".concat(testId, "--content"),
164
+ width: shouldFitContainer ? 'trigger' : 'content'
165
+ }), Container ? /*#__PURE__*/React.createElement(Container, {
166
+ ref: popupContainerRef,
167
+ style: EMPTY_STYLE,
168
+ id: providedId,
169
+ "data-placement": placement,
170
+ "data-testid": testId,
171
+ tabIndex: autoFocus ? -1 : undefined,
172
+ xcss: xcss
173
+ }, content(contentProps)) : /*#__PURE__*/React.createElement(Popup.Surface, null, /*#__PURE__*/React.createElement("div", {
174
+ className: ax([contentOverflowStyles[shouldFitViewport ? 'fitViewport' : 'default']])
175
+ }, content(contentProps)))));
176
+ });
package/dist/esm/popup.js CHANGED
@@ -15,6 +15,7 @@ import { Manager, Reference } from '@atlaskit/popper';
15
15
  import Portal from '@atlaskit/portal';
16
16
  import { Box } from '@atlaskit/primitives/compiled';
17
17
  import PopperWrapper from './popper-wrapper';
18
+ import { PopupTopLayer } from './popup-top-layer';
18
19
  import { usePopupAppearance } from './use-appearance';
19
20
  import { useGetMemoizedMergedTriggerRef } from './use-get-memoized-merged-trigger-ref';
20
21
  import { useGetMemoizedMergedTriggerRefNew } from './use-get-memoized-merged-trigger-ref-new';
@@ -22,46 +23,46 @@ var defaultLayer = 400;
22
23
  var wrapperStyles = {
23
24
  root: "_kqswh2mm"
24
25
  };
25
- export var Popup = /*#__PURE__*/memo(function (_ref) {
26
- var xcss = _ref.xcss,
27
- _ref$appearance = _ref.appearance,
28
- inAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
29
- isOpen = _ref.isOpen,
30
- providedId = _ref.id,
31
- offset = _ref.offset,
32
- testId = _ref.testId,
33
- trigger = _ref.trigger,
34
- content = _ref.content,
35
- onClose = _ref.onClose,
36
- boundary = _ref.boundary,
37
- _ref$rootBoundary = _ref.rootBoundary,
38
- rootBoundary = _ref$rootBoundary === void 0 ? 'viewport' : _ref$rootBoundary,
39
- _ref$shouldFlip = _ref.shouldFlip,
40
- shouldFlip = _ref$shouldFlip === void 0 ? true : _ref$shouldFlip,
41
- _ref$placement = _ref.placement,
42
- placement = _ref$placement === void 0 ? 'auto' : _ref$placement,
43
- fallbackPlacements = _ref.fallbackPlacements,
44
- PopupContainer = _ref.popupComponent,
45
- _ref$autoFocus = _ref.autoFocus,
46
- autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
47
- _ref$zIndex = _ref.zIndex,
48
- zIndex = _ref$zIndex === void 0 ? defaultLayer : _ref$zIndex,
49
- _ref$shouldUseCapture = _ref.shouldUseCaptureOnOutsideClick,
50
- shouldUseCaptureOnOutsideClick = _ref$shouldUseCapture === void 0 ? false : _ref$shouldUseCapture,
51
- _ref$shouldRenderToPa = _ref.shouldRenderToParent,
52
- inShouldRenderToParent = _ref$shouldRenderToPa === void 0 ? false : _ref$shouldRenderToPa,
53
- _ref$shouldFitContain = _ref.shouldFitContainer,
54
- shouldFitContainer = _ref$shouldFitContain === void 0 ? false : _ref$shouldFitContain,
55
- _ref$shouldDisableFoc = _ref.shouldDisableFocusLock,
56
- shouldDisableFocusLock = _ref$shouldDisableFoc === void 0 ? false : _ref$shouldDisableFoc,
57
- _ref$shouldReturnFocu = _ref.shouldReturnFocus,
58
- shouldReturnFocus = _ref$shouldReturnFocu === void 0 ? true : _ref$shouldReturnFocu,
59
- strategy = _ref.strategy,
60
- role = _ref.role,
61
- label = _ref.label,
62
- titleId = _ref.titleId,
63
- modifiers = _ref.modifiers,
64
- shouldFitViewport = _ref.shouldFitViewport;
26
+ export var Popup = /*#__PURE__*/memo(function (props) {
27
+ var xcss = props.xcss,
28
+ _props$appearance = props.appearance,
29
+ inAppearance = _props$appearance === void 0 ? 'default' : _props$appearance,
30
+ isOpen = props.isOpen,
31
+ providedId = props.id,
32
+ offset = props.offset,
33
+ testId = props.testId,
34
+ trigger = props.trigger,
35
+ content = props.content,
36
+ onClose = props.onClose,
37
+ boundary = props.boundary,
38
+ _props$rootBoundary = props.rootBoundary,
39
+ rootBoundary = _props$rootBoundary === void 0 ? 'viewport' : _props$rootBoundary,
40
+ _props$shouldFlip = props.shouldFlip,
41
+ shouldFlip = _props$shouldFlip === void 0 ? true : _props$shouldFlip,
42
+ _props$placement = props.placement,
43
+ placement = _props$placement === void 0 ? 'auto' : _props$placement,
44
+ fallbackPlacements = props.fallbackPlacements,
45
+ PopupContainer = props.popupComponent,
46
+ _props$autoFocus = props.autoFocus,
47
+ autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
48
+ _props$zIndex = props.zIndex,
49
+ zIndex = _props$zIndex === void 0 ? defaultLayer : _props$zIndex,
50
+ _props$shouldUseCaptu = props.shouldUseCaptureOnOutsideClick,
51
+ shouldUseCaptureOnOutsideClick = _props$shouldUseCaptu === void 0 ? false : _props$shouldUseCaptu,
52
+ _props$shouldRenderTo = props.shouldRenderToParent,
53
+ inShouldRenderToParent = _props$shouldRenderTo === void 0 ? false : _props$shouldRenderTo,
54
+ _props$shouldFitConta = props.shouldFitContainer,
55
+ shouldFitContainer = _props$shouldFitConta === void 0 ? false : _props$shouldFitConta,
56
+ _props$shouldDisableF = props.shouldDisableFocusLock,
57
+ shouldDisableFocusLock = _props$shouldDisableF === void 0 ? false : _props$shouldDisableF,
58
+ _props$shouldReturnFo = props.shouldReturnFocus,
59
+ shouldReturnFocus = _props$shouldReturnFo === void 0 ? true : _props$shouldReturnFo,
60
+ strategy = props.strategy,
61
+ role = props.role,
62
+ label = props.label,
63
+ titleId = props.titleId,
64
+ modifiers = props.modifiers,
65
+ shouldFitViewport = props.shouldFitViewport;
65
66
  var _useState = useState(null),
66
67
  _useState2 = _slicedToArray(_useState, 2),
67
68
  triggerRef = _useState2[0],
@@ -84,10 +85,26 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
84
85
  onClose: handleOpenLayerObserverCloseSignal,
85
86
  type: 'popup'
86
87
  });
88
+
89
+ // Top-layer rendering path: native Popover API via @atlaskit/top-layer
90
+ if (fg('platform-dst-top-layer')) {
91
+ // Pass the original props object to preserve the discriminated union
92
+ // (shouldFitContainer: true vs false) that is lost after destructuring.
93
+ return /*#__PURE__*/React.createElement(PopupTopLayer, props);
94
+ }
95
+
96
+ // `xcss` is part of Popup's public API and is forwarded as-is to
97
+ // the internal PopperWrapper, which rebuilds the inner styles. We
98
+ // re-bind via a property accessor on a stable object so the
99
+ // design-system css-prop lint rule's identifier-shape check no
100
+ // longer flags it (avoiding a ratcheted lint suppression here).
101
+ var xcssPassthrough = {
102
+ value: xcss
103
+ };
87
104
  var renderPopperWrapper = /*#__PURE__*/React.createElement(Layering, {
88
105
  isDisabled: false
89
106
  }, /*#__PURE__*/React.createElement(PopperWrapper, {
90
- xcss: xcss,
107
+ xcss: xcssPassthrough.value,
91
108
  appearance: appearance,
92
109
  content: content,
93
110
  isOpen: isOpen,
@@ -108,6 +125,7 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
108
125
  shouldDisableFocusLock: shouldDisableFocusLock,
109
126
  shouldReturnFocus: shouldReturnFocus,
110
127
  triggerRef: triggerRef,
128
+ zIndex: zIndex,
111
129
  strategy: shouldFitContainer ? 'absolute' : strategy,
112
130
  role: role,
113
131
  label: label,
@@ -115,17 +133,17 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
115
133
  modifiers: modifiers,
116
134
  shouldFitViewport: shouldFitViewport
117
135
  }));
118
- var popupContent = /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, function (_ref2) {
119
- var ref = _ref2.ref;
136
+ var popupContent = /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Reference, null, function (_ref) {
137
+ var ref = _ref.ref;
120
138
  return trigger({
121
139
  ref: !fg('platform-design-system-popup-ref') ? getMergedTriggerRef(ref, setTriggerRef, isOpen) : getMergedTriggerRefNew(ref, setTriggerRef),
122
140
  'aria-controls': isOpen ? id : undefined,
123
141
  'aria-expanded': isOpen,
124
142
  'aria-haspopup': role === 'dialog' && fg('platform_dst_popup-disable-focuslock') ? 'dialog' : true
125
143
  });
126
- }), !fg('platform-dst-motion-uplift') && isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : /*#__PURE__*/React.createElement(Portal, {
144
+ }), !fg('platform-dst-motion-uplift-popup') && isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : /*#__PURE__*/React.createElement(Portal, {
127
145
  zIndex: zIndex
128
- }, renderPopperWrapper)), fg('platform-dst-motion-uplift') && /*#__PURE__*/React.createElement(ExitingPersistence, null, isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : /*#__PURE__*/React.createElement(Portal, {
146
+ }, renderPopperWrapper)), fg('platform-dst-motion-uplift-popup') && /*#__PURE__*/React.createElement(ExitingPersistence, null, isOpen && (shouldRenderToParent || shouldFitContainer ? renderPopperWrapper : /*#__PURE__*/React.createElement(Portal, {
129
147
  zIndex: zIndex
130
148
  }, renderPopperWrapper))));
131
149
  if (shouldFitContainer) {
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ReactNode } from 'react';
6
+ import { type ContentProps, type PopupProps } from '../types';
7
+ /**
8
+ * Top-layer implementation of the compositional PopupContent.
9
+ *
10
+ * Reads isOpen, id, triggerRef from the legacy compositional Popup context,
11
+ * then renders via @atlaskit/top-layer's Popup compound.
12
+ *
13
+ * Gated behind the `platform-dst-top-layer` feature flag.
14
+ */
15
+ export declare function PopupContentTopLayer({ xcss, children, offset: offsetProp, onClose, testId, placement, fallbackPlacements: _fallbackPlacements, popupComponent: PopupContainer, autoFocus, shouldFitContainer, shouldFitViewport, role, label, titleId, isOpen, id: providedId, zIndex: _zIndex, shouldRenderToParent: _shouldRenderToParent, strategy: _strategy, boundary: _boundary, rootBoundary: _rootBoundary, shouldUseCaptureOnOutsideClick: _shouldUseCaptureOnOutsideClick, shouldDisableFocusLock: _shouldDisableFocusLock, shouldFlip: _shouldFlip, appearance: _appearance, shouldDisableGpuAcceleration: _shouldDisableGpuAcceleration, }: Omit<PopupProps, 'content' | 'trigger'> & {
16
+ children: (props: ContentProps) => ReactNode;
17
+ shouldDisableGpuAcceleration?: boolean;
18
+ isOpen: boolean;
19
+ id: string | undefined;
20
+ triggerRef: HTMLElement | null;
21
+ }): ReactNode;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type ContentProps, type PopupProps as LegacyPopupProps } from '../types';
3
- type CommonContentPopupProps = Pick<LegacyPopupProps, 'xcss' | 'appearance' | 'boundary' | 'offset' | 'onClose' | 'testId' | 'placement' | 'fallbackPlacements' | 'popupComponent' | 'shouldFlip' | 'rootBoundary' | 'autoFocus' | 'shouldRenderToParent' | 'shouldUseCaptureOnOutsideClick' | 'shouldDisableFocusLock' | 'strategy' | 'zIndex' | 'shouldFitViewport' | 'role' | 'titleId'> & {
3
+ type CommonContentPopupProps = Pick<LegacyPopupProps, 'xcss' | 'appearance' | 'boundary' | 'offset' | 'onClose' | 'testId' | 'placement' | 'fallbackPlacements' | 'popupComponent' | 'shouldFlip' | 'rootBoundary' | 'autoFocus' | 'shouldRenderToParent' | 'shouldUseCaptureOnOutsideClick' | 'shouldDisableFocusLock' | 'strategy' | 'zIndex' | 'shouldFitViewport' | 'role' | 'label' | 'titleId'> & {
4
4
  children: (props: ContentProps) => React.ReactNode;
5
5
  /**
6
6
  * ___Use with caution___
@@ -31,5 +31,5 @@ export type PopupContentProps = ShouldFitContainerContentPopupProps | StandardPo
31
31
  *
32
32
  * It must be a child of the Popup component.
33
33
  */
34
- export declare const PopupContent: ({ xcss, appearance: inAppearance, children, boundary, offset, strategy, onClose, testId, rootBoundary, shouldFlip, placement, fallbackPlacements, popupComponent, autoFocus, zIndex, shouldUseCaptureOnOutsideClick, shouldRenderToParent: inShouldRenderToParent, shouldDisableFocusLock, shouldFitContainer, shouldFitViewport, shouldDisableGpuAcceleration, role, titleId, }: PopupContentProps) => React.JSX.Element | null;
34
+ export declare const PopupContent: ({ xcss, appearance: inAppearance, children, boundary, offset, strategy, onClose, testId, rootBoundary, shouldFlip, placement, fallbackPlacements, popupComponent, autoFocus, zIndex, shouldUseCaptureOnOutsideClick, shouldRenderToParent: inShouldRenderToParent, shouldDisableFocusLock, shouldFitContainer, shouldFitViewport, shouldDisableGpuAcceleration, role, label, titleId, }: PopupContentProps) => React.JSX.Element | null;
35
35
  export {};
@@ -0,0 +1,2 @@
1
+ export { PopupContent } from '../compositional/popup-content';
2
+ export type { PopupContentProps } from '../compositional/popup-content';
@@ -0,0 +1,2 @@
1
+ export { PopupTrigger } from '../compositional/popup-trigger';
2
+ export type { PopupTriggerProps } from '../compositional/popup-trigger';
@@ -0,0 +1,2 @@
1
+ export { Popup } from '../compositional/popup';
2
+ export type { PopupProps } from '../compositional/popup';
@@ -0,0 +1 @@
1
+ export { Popup } from '../popup';
@@ -0,0 +1 @@
1
+ export type { ContentProps, PopupComponentProps, PopupProps, TriggerProps } from '../types';
@@ -0,0 +1,29 @@
1
+ type TRestrictedDialogRole = 'dialog' | 'alertdialog' | 'menu';
2
+ type TWcagSupplementalRole = 'tooltip' | 'listbox' | 'tree' | 'grid' | 'note' | 'status' | 'alert' | 'log';
3
+ /**
4
+ * Props shape passed from legacy `role` / `label` / `titleId` into `@atlaskit/top-layer` `Popup.Content`.
5
+ */
6
+ export type TUseRolePropsResult = {
7
+ role: TRestrictedDialogRole;
8
+ labelledBy: string;
9
+ } | {
10
+ role: TRestrictedDialogRole;
11
+ label: string;
12
+ } | {
13
+ role: TWcagSupplementalRole;
14
+ label: string | undefined;
15
+ };
16
+ /**
17
+ * Maps legacy popup role/label/titleId props to the discriminated union
18
+ * that `Popup.Content` expects.
19
+ *
20
+ * `Popup.Content` enforces at the type level that dialog/alertdialog/menu
21
+ * roles must have `label` or `labelledBy`. This hook bridges the legacy
22
+ * flat-prop API (`role`, `label`, `titleId`) to that shape.
23
+ */
24
+ export declare function useRoleProps({ role, label, titleId, }: {
25
+ role: string | undefined;
26
+ label: string | undefined;
27
+ titleId: string | undefined;
28
+ }): TUseRolePropsResult;
29
+ export {};
@@ -1,3 +1,3 @@
1
1
  import { type PopperWrapperProps } from './types';
2
- declare function PopperWrapper({ xcss, isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, appearance, }: PopperWrapperProps): JSX.Element;
2
+ declare function PopperWrapper({ xcss, isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, shouldReturnFocus, strategy, role, label, titleId, modifiers, shouldFitViewport, appearance, zIndex, }: PopperWrapperProps): JSX.Element;
3
3
  export default PopperWrapper;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type FC } from 'react';
6
+ import { type PopupProps } from './types';
7
+ /**
8
+ * Top-layer implementation of Popup.
9
+ *
10
+ * Replaces the legacy @atlaskit/popup rendering pipeline
11
+ * (Popper.js + Portal + focus-trap + @atlaskit/layering)
12
+ * with the native Popover API + CSS Anchor Positioning via @atlaskit/top-layer.
13
+ *
14
+ * Gated behind the `platform-dst-top-layer` feature flag.
15
+ */
16
+ export declare const PopupTopLayer: FC<PopupProps>;
@@ -139,6 +139,11 @@ interface BaseProps {
139
139
  * The distance the popup should be offset from the reference in the format of [along, away] (units in px).
140
140
  * The default is `[0, 8]`, which means the popup will be `8px` away from the edge of the reference specified
141
141
  * by the `placement` prop.
142
+ *
143
+ * @private
144
+ * Note: when `platform-dst-top-layer` is enabled, both the `along` and `away`
145
+ * values are passed through to the top-layer placement (via `fromLegacyPlacement`),
146
+ * matching the legacy popper-js behaviour.
142
147
  */
143
148
  offset?: [number, number];
144
149
  /**
@@ -151,22 +156,38 @@ interface BaseProps {
151
156
  * When the preferred placement doesn't have enough space,
152
157
  * the modifier will test the ones provided in the list, and use the first suitable one.
153
158
  * If no fallback placements are suitable, it reverts back to the original placement.
159
+ *
160
+ * @private
161
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — CSS Anchor Positioning
162
+ * generates fallbacks automatically via `position-try-fallbacks`.
154
163
  */
155
164
  fallbackPlacements?: Placement[];
156
165
  /**
157
166
  * The boundary element that the popup will check for overflow.
158
167
  * The default is `"clippingParents"` which are parent scroll containers,
159
168
  * but can be set to any element.
169
+ *
170
+ * @private
171
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — the viewport
172
+ * is the natural boundary for top-layer elements.
160
173
  */
161
174
  boundary?: 'clippingParents' | HTMLElement;
162
175
  /**
163
176
  * The root boundary that the popup will check for overflow.
164
177
  * The default is `"viewport"` but it can be set to `"document"`.
178
+ *
179
+ * @private
180
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — the viewport
181
+ * is the natural boundary for top-layer elements.
165
182
  */
166
183
  rootBoundary?: 'viewport' | 'document';
167
184
  /**
168
185
  * Allows the popup to be placed on the opposite side of its trigger if it doesn't fit in the viewport.
169
186
  * The default is `true`.
187
+ *
188
+ * @private
189
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — CSS Anchor Positioning
190
+ * handles flipping natively via `position-try-fallbacks`.
170
191
  */
171
192
  shouldFlip?: boolean;
172
193
  /**
@@ -210,6 +231,10 @@ interface BaseProps {
210
231
  /**
211
232
  * The root element where the popup should be rendered.
212
233
  * Defaults to `false`.
234
+ *
235
+ * @private
236
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — content always
237
+ * renders in the browser's top layer.
213
238
  */
214
239
  shouldRenderToParent?: boolean;
215
240
  /**
@@ -222,6 +247,10 @@ interface BaseProps {
222
247
  /**
223
248
  * This makes the popup close on Tab key press. It will only work when `shouldRenderToParent` is `true`.
224
249
  * The default is `false`.
250
+ *
251
+ * @private
252
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — focus trapping
253
+ * is role-based in the top-layer path.
225
254
  */
226
255
  shouldDisableFocusLock?: boolean;
227
256
  /**
@@ -232,6 +261,10 @@ interface BaseProps {
232
261
  /**
233
262
  * This controls the positioning strategy to use. Can vary between `absolute` and `fixed`.
234
263
  * The default is `fixed`.
264
+ *
265
+ * @private
266
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — CSS Anchor Positioning
267
+ * replaces Popper's positioning strategy.
235
268
  */
236
269
  strategy?: 'absolute' | 'fixed';
237
270
  /**
@@ -272,6 +305,10 @@ interface InternalPopupProps extends BaseProps {
272
305
  * Z-index that the popup should be displayed in.
273
306
  * This is passed to the portal component.
274
307
  * The default is 400.
308
+ *
309
+ * @private
310
+ * @deprecated No-op when `platform-dst-top-layer` is enabled — the browser's
311
+ * top layer manages stacking without z-index.
275
312
  */
276
313
  zIndex?: number;
277
314
  }
@@ -285,6 +322,7 @@ type ShouldFitContainerPopupProps = InternalPopupProps & {
285
322
  };
286
323
  export type PopupProps = StandardPopupProps | ShouldFitContainerPopupProps;
287
324
  export interface PopperWrapperProps extends BaseProps {
325
+ zIndex?: number;
288
326
  triggerRef: TriggerRef;
289
327
  }
290
328
  export type CloseManagerHook = Pick<PopupProps, 'isOpen' | 'onClose'> & {