@atlaskit/popup 5.2.1 → 5.2.3

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,18 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 5.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 5.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`3da013cc133e5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3da013cc133e5) -
14
+ Internal refactor for safer feature flag usage.
15
+
3
16
  ## 5.2.1
4
17
 
5
18
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- /* popup-content-top-layer.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup-content-top-layer.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -5,7 +5,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.PopupContent = void 0;
8
+ exports.PopupContent = PopupContent;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _react = _interopRequireWildcard(require("react"));
10
11
  var _layering = require("@atlaskit/layering/layering");
11
12
  var _useNotifyOpenLayerObserver = require("@atlaskit/layering/use-notify-open-layer-observer");
@@ -27,13 +28,13 @@ var shouldDisableGpuAccelerationModifiers = [{
27
28
  }
28
29
  }];
29
30
  /**
30
- * __Popup content__
31
- *
32
- * Popup content is the component that renders the content of the popup.
31
+ * Legacy (Popper + Portal) implementation of the compositional PopupContent.
33
32
  *
34
- * It must be a child of the Popup component.
33
+ * Renders when the `platform-dst-top-layer` flag is off. This component owns
34
+ * the open layer observer registration, which on the top-layer path is handled
35
+ * by the `Popover` primitive inside `PopupContentTopLayer` instead.
35
36
  */
36
- var PopupContent = exports.PopupContent = function PopupContent(_ref) {
37
+ function PopupContentLegacy(_ref) {
37
38
  var xcss = _ref.xcss,
38
39
  _ref$appearance = _ref.appearance,
39
40
  inAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
@@ -66,11 +67,9 @@ var PopupContent = exports.PopupContent = function PopupContent(_ref) {
66
67
  _ref$shouldDisableGpu = _ref.shouldDisableGpuAcceleration,
67
68
  shouldDisableGpuAcceleration = _ref$shouldDisableGpu === void 0 ? false : _ref$shouldDisableGpu,
68
69
  role = _ref.role,
69
- label = _ref.label,
70
- titleId = _ref.titleId;
71
- (0, _useEnsureIsInsidePopup.useEnsureIsInsidePopup)();
72
- var isOpen = (0, _react.useContext)(_isOpenContext.IsOpenContext);
73
- var id = (0, _react.useContext)(_idContext.IdContext);
70
+ titleId = _ref.titleId,
71
+ isOpen = _ref.isOpen,
72
+ id = _ref.id;
74
73
  var triggerRef = (0, _react.useContext)(_triggerRefContext.TriggerRefContext);
75
74
  var _usePopupAppearance = (0, _useAppearance.usePopupAppearance)({
76
75
  appearance: inAppearance,
@@ -81,50 +80,11 @@ var PopupContent = exports.PopupContent = function PopupContent(_ref) {
81
80
  var handleOpenLayerObserverCloseSignal = (0, _react.useCallback)(function () {
82
81
  onClose === null || onClose === void 0 || onClose(null);
83
82
  }, [onClose]);
84
-
85
- // On the top-layer path, the Popover primitive registers with the observer
86
- // directly, so we skip registration here to avoid double-counting.
87
- // Safe conditional hook: feature flags are resolved once at startup.
88
- if (!(0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
89
- // eslint-disable-next-line react-hooks/rules-of-hooks
90
- (0, _useNotifyOpenLayerObserver.useNotifyOpenLayerObserver)({
91
- isOpen: isOpen,
92
- onClose: handleOpenLayerObserverCloseSignal,
93
- type: 'popup'
94
- });
95
- }
96
-
97
- // Top-layer rendering path: native Popover API via @atlaskit/top-layer.
98
- // Mirrors the FF branch in the legacy `Popup` component (popup.tsx).
99
- if ((0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
100
- return /*#__PURE__*/_react.default.createElement(_popupContentTopLayer.PopupContentTopLayer, {
101
- xcss: xcss,
102
- appearance: inAppearance,
103
- offset: offset,
104
- onClose: onClose,
105
- testId: testId,
106
- placement: placement,
107
- fallbackPlacements: fallbackPlacements,
108
- popupComponent: popupComponent,
109
- autoFocus: autoFocus,
110
- shouldFitContainer: shouldFitContainer,
111
- shouldFitViewport: shouldFitViewport,
112
- role: role,
113
- label: label,
114
- titleId: titleId,
115
- zIndex: zIndex,
116
- shouldRenderToParent: inShouldRenderToParent,
117
- strategy: strategy,
118
- boundary: boundary,
119
- rootBoundary: rootBoundary,
120
- shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
121
- shouldDisableFocusLock: shouldDisableFocusLock,
122
- shouldFlip: shouldFlip,
123
- shouldDisableGpuAcceleration: shouldDisableGpuAcceleration,
124
- isOpen: isOpen,
125
- id: id
126
- }, children);
127
- }
83
+ (0, _useNotifyOpenLayerObserver.useNotifyOpenLayerObserver)({
84
+ isOpen: isOpen,
85
+ onClose: handleOpenLayerObserverCloseSignal,
86
+ type: 'popup'
87
+ });
128
88
  if (!isOpen) {
129
89
  return null;
130
90
  }
@@ -164,4 +124,40 @@ var PopupContent = exports.PopupContent = function PopupContent(_ref) {
164
124
  return /*#__PURE__*/_react.default.createElement(_portal.default, {
165
125
  zIndex: zIndex
166
126
  }, popperWrapper);
167
- };
127
+ }
128
+
129
+ /**
130
+ * __Popup content__
131
+ *
132
+ * Popup content is the component that renders the content of the popup.
133
+ *
134
+ * It must be a child of the Popup component.
135
+ */
136
+ function PopupContent(props) {
137
+ (0, _useEnsureIsInsidePopup.useEnsureIsInsidePopup)();
138
+ var isOpen = (0, _react.useContext)(_isOpenContext.IsOpenContext);
139
+ var id = (0, _react.useContext)(_idContext.IdContext);
140
+
141
+ // Select the rendering implementation at the component boundary rather than
142
+ // gating hooks inside a single component. Each implementation owns its own
143
+ // hooks, so a runtime feature-flag change swaps component types (a clean
144
+ // remount) instead of changing the hook order of a mounted component.
145
+ //
146
+ // Forwarding the full props onto the chosen implementation is intentional:
147
+ // both implementations declare explicit prop types, so the forward is type
148
+ // checked rather than an unbounded API.
149
+ if ((0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
150
+ // The top-layer Popover registers with the open layer observer itself.
151
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- intentional forward to a typed implementation
152
+ return /*#__PURE__*/_react.default.createElement(_popupContentTopLayer.PopupContentTopLayer, (0, _extends2.default)({}, props, {
153
+ isOpen: isOpen,
154
+ id: id
155
+ }));
156
+ }
157
+
158
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- intentional forward to a typed implementation
159
+ return /*#__PURE__*/_react.default.createElement(PopupContentLegacy, (0, _extends2.default)({}, props, {
160
+ isOpen: isOpen,
161
+ id: id
162
+ }));
163
+ }
@@ -1,4 +1,4 @@
1
- /* popper-wrapper.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popper-wrapper.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,4 +1,4 @@
1
- /* popup-top-layer.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup-top-layer.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
package/dist/cjs/popup.js CHANGED
@@ -1,4 +1,4 @@
1
- /* popup.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -31,7 +31,7 @@ var defaultLayer = 400;
31
31
  var wrapperStyles = {
32
32
  root: "_kqswh2mm"
33
33
  };
34
- var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (props) {
34
+ var PopupLegacy = function PopupLegacy(props) {
35
35
  var xcss = props.xcss,
36
36
  _props$appearance = props.appearance,
37
37
  inAppearance = _props$appearance === void 0 ? 'default' : _props$appearance,
@@ -89,25 +89,11 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (props) {
89
89
  var handleOpenLayerObserverCloseSignal = (0, _react.useCallback)(function () {
90
90
  onClose === null || onClose === void 0 || onClose(null);
91
91
  }, [onClose]);
92
-
93
- // On the top-layer path, the Popover primitive registers with the observer
94
- // directly, so we skip registration here to avoid double-counting.
95
- // Safe conditional hook: feature flags are resolved once at startup.
96
- if (!(0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
97
- // eslint-disable-next-line react-hooks/rules-of-hooks
98
- (0, _useNotifyOpenLayerObserver.useNotifyOpenLayerObserver)({
99
- isOpen: isOpen,
100
- onClose: handleOpenLayerObserverCloseSignal,
101
- type: 'popup'
102
- });
103
- }
104
-
105
- // Top-layer rendering path: native Popover API via @atlaskit/top-layer
106
- if ((0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
107
- // Pass the original props object to preserve the discriminated union
108
- // (shouldFitContainer: true vs false) that is lost after destructuring.
109
- return /*#__PURE__*/React.createElement(_popupTopLayer.PopupTopLayer, props);
110
- }
92
+ (0, _useNotifyOpenLayerObserver.useNotifyOpenLayerObserver)({
93
+ isOpen: isOpen,
94
+ onClose: handleOpenLayerObserverCloseSignal,
95
+ type: 'popup'
96
+ });
111
97
 
112
98
  // `xcss` is part of Popup's public API and is forwarded as-is to
113
99
  // the internal PopperWrapper, which rebuilds the inner styles. We
@@ -171,4 +157,17 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (props) {
171
157
  }, popupContent);
172
158
  }
173
159
  return popupContent;
160
+ };
161
+ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (props) {
162
+ // Choose the rendering implementation at the component boundary rather than
163
+ // gating hooks inside a single component. Each implementation owns its own
164
+ // hooks unconditionally, so a runtime feature-flag change swaps component
165
+ // types (a clean remount) instead of changing the hook order of a mounted
166
+ // component.
167
+ if ((0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
168
+ // Pass the original props object to preserve the discriminated union
169
+ // (shouldFitContainer: true vs false) that is lost after destructuring.
170
+ return /*#__PURE__*/React.createElement(_popupTopLayer.PopupTopLayer, props);
171
+ }
172
+ return /*#__PURE__*/React.createElement(PopupLegacy, props);
174
173
  });
@@ -1,4 +1,4 @@
1
- /* popup-content-top-layer.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup-content-top-layer.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./popup-content-top-layer.compiled.css";
4
4
  import * as React from 'react';
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React, { useCallback, useContext } from 'react';
2
3
  import { Layering } from '@atlaskit/layering/layering';
3
4
  import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
@@ -18,13 +19,13 @@ const shouldDisableGpuAccelerationModifiers = [{
18
19
  }
19
20
  }];
20
21
  /**
21
- * __Popup content__
22
- *
23
- * Popup content is the component that renders the content of the popup.
22
+ * Legacy (Popper + Portal) implementation of the compositional PopupContent.
24
23
  *
25
- * It must be a child of the Popup component.
24
+ * Renders when the `platform-dst-top-layer` flag is off. This component owns
25
+ * the open layer observer registration, which on the top-layer path is handled
26
+ * by the `Popover` primitive inside `PopupContentTopLayer` instead.
26
27
  */
27
- export const PopupContent = ({
28
+ function PopupContentLegacy({
28
29
  xcss,
29
30
  appearance: inAppearance = 'default',
30
31
  children,
@@ -48,12 +49,10 @@ export const PopupContent = ({
48
49
  shouldFitViewport,
49
50
  shouldDisableGpuAcceleration = false,
50
51
  role,
51
- label,
52
- titleId
53
- }) => {
54
- useEnsureIsInsidePopup();
55
- const isOpen = useContext(IsOpenContext);
56
- const id = useContext(IdContext);
52
+ titleId,
53
+ isOpen,
54
+ id
55
+ }) {
57
56
  const triggerRef = useContext(TriggerRefContext);
58
57
  const {
59
58
  appearance,
@@ -65,50 +64,11 @@ export const PopupContent = ({
65
64
  const handleOpenLayerObserverCloseSignal = useCallback(() => {
66
65
  onClose === null || onClose === void 0 ? void 0 : onClose(null);
67
66
  }, [onClose]);
68
-
69
- // On the top-layer path, the Popover primitive registers with the observer
70
- // directly, so we skip registration here to avoid double-counting.
71
- // Safe conditional hook: feature flags are resolved once at startup.
72
- if (!fg('platform-dst-top-layer')) {
73
- // eslint-disable-next-line react-hooks/rules-of-hooks
74
- useNotifyOpenLayerObserver({
75
- isOpen,
76
- onClose: handleOpenLayerObserverCloseSignal,
77
- type: 'popup'
78
- });
79
- }
80
-
81
- // Top-layer rendering path: native Popover API via @atlaskit/top-layer.
82
- // Mirrors the FF branch in the legacy `Popup` component (popup.tsx).
83
- if (fg('platform-dst-top-layer')) {
84
- return /*#__PURE__*/React.createElement(PopupContentTopLayer, {
85
- xcss: xcss,
86
- appearance: inAppearance,
87
- offset: offset,
88
- onClose: onClose,
89
- testId: testId,
90
- placement: placement,
91
- fallbackPlacements: fallbackPlacements,
92
- popupComponent: popupComponent,
93
- autoFocus: autoFocus,
94
- shouldFitContainer: shouldFitContainer,
95
- shouldFitViewport: shouldFitViewport,
96
- role: role,
97
- label: label,
98
- titleId: titleId,
99
- zIndex: zIndex,
100
- shouldRenderToParent: inShouldRenderToParent,
101
- strategy: strategy,
102
- boundary: boundary,
103
- rootBoundary: rootBoundary,
104
- shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
105
- shouldDisableFocusLock: shouldDisableFocusLock,
106
- shouldFlip: shouldFlip,
107
- shouldDisableGpuAcceleration: shouldDisableGpuAcceleration,
108
- isOpen: isOpen,
109
- id: id
110
- }, children);
111
- }
67
+ useNotifyOpenLayerObserver({
68
+ isOpen,
69
+ onClose: handleOpenLayerObserverCloseSignal,
70
+ type: 'popup'
71
+ });
112
72
  if (!isOpen) {
113
73
  return null;
114
74
  }
@@ -148,4 +108,40 @@ export const PopupContent = ({
148
108
  return /*#__PURE__*/React.createElement(Portal, {
149
109
  zIndex: zIndex
150
110
  }, popperWrapper);
151
- };
111
+ }
112
+
113
+ /**
114
+ * __Popup content__
115
+ *
116
+ * Popup content is the component that renders the content of the popup.
117
+ *
118
+ * It must be a child of the Popup component.
119
+ */
120
+ export function PopupContent(props) {
121
+ useEnsureIsInsidePopup();
122
+ const isOpen = useContext(IsOpenContext);
123
+ const id = useContext(IdContext);
124
+
125
+ // Select the rendering implementation at the component boundary rather than
126
+ // gating hooks inside a single component. Each implementation owns its own
127
+ // hooks, so a runtime feature-flag change swaps component types (a clean
128
+ // remount) instead of changing the hook order of a mounted component.
129
+ //
130
+ // Forwarding the full props onto the chosen implementation is intentional:
131
+ // both implementations declare explicit prop types, so the forward is type
132
+ // checked rather than an unbounded API.
133
+ if (fg('platform-dst-top-layer')) {
134
+ // The top-layer Popover registers with the open layer observer itself.
135
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- intentional forward to a typed implementation
136
+ return /*#__PURE__*/React.createElement(PopupContentTopLayer, _extends({}, props, {
137
+ isOpen: isOpen,
138
+ id: id
139
+ }));
140
+ }
141
+
142
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- intentional forward to a typed implementation
143
+ return /*#__PURE__*/React.createElement(PopupContentLegacy, _extends({}, props, {
144
+ isOpen: isOpen,
145
+ id: id
146
+ }));
147
+ }
@@ -1,4 +1,4 @@
1
- /* popper-wrapper.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popper-wrapper.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./popper-wrapper.compiled.css";
4
4
  import * as React from 'react';
@@ -1,4 +1,4 @@
1
- /* popup-top-layer.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup-top-layer.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./popup-top-layer.compiled.css";
4
4
  import * as React from 'react';
@@ -1,4 +1,4 @@
1
- /* popup.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  /* eslint-disable @repo/internal/react/require-jsdoc */
3
3
  import "./popup.compiled.css";
4
4
  import * as React from 'react';
@@ -21,7 +21,7 @@ const defaultLayer = 400;
21
21
  const wrapperStyles = {
22
22
  root: "_kqswh2mm"
23
23
  };
24
- export const Popup = /*#__PURE__*/memo(props => {
24
+ const PopupLegacy = props => {
25
25
  const {
26
26
  xcss,
27
27
  appearance: inAppearance = 'default',
@@ -68,25 +68,11 @@ export const Popup = /*#__PURE__*/memo(props => {
68
68
  const handleOpenLayerObserverCloseSignal = useCallback(() => {
69
69
  onClose === null || onClose === void 0 ? void 0 : onClose(null);
70
70
  }, [onClose]);
71
-
72
- // On the top-layer path, the Popover primitive registers with the observer
73
- // directly, so we skip registration here to avoid double-counting.
74
- // Safe conditional hook: feature flags are resolved once at startup.
75
- if (!fg('platform-dst-top-layer')) {
76
- // eslint-disable-next-line react-hooks/rules-of-hooks
77
- useNotifyOpenLayerObserver({
78
- isOpen,
79
- onClose: handleOpenLayerObserverCloseSignal,
80
- type: 'popup'
81
- });
82
- }
83
-
84
- // Top-layer rendering path: native Popover API via @atlaskit/top-layer
85
- if (fg('platform-dst-top-layer')) {
86
- // Pass the original props object to preserve the discriminated union
87
- // (shouldFitContainer: true vs false) that is lost after destructuring.
88
- return /*#__PURE__*/React.createElement(PopupTopLayer, props);
89
- }
71
+ useNotifyOpenLayerObserver({
72
+ isOpen,
73
+ onClose: handleOpenLayerObserverCloseSignal,
74
+ type: 'popup'
75
+ });
90
76
 
91
77
  // `xcss` is part of Popup's public API and is forwarded as-is to
92
78
  // the internal PopperWrapper, which rebuilds the inner styles. We
@@ -151,4 +137,17 @@ export const Popup = /*#__PURE__*/memo(props => {
151
137
  }, popupContent);
152
138
  }
153
139
  return popupContent;
140
+ };
141
+ export const Popup = /*#__PURE__*/memo(props => {
142
+ // Choose the rendering implementation at the component boundary rather than
143
+ // gating hooks inside a single component. Each implementation owns its own
144
+ // hooks unconditionally, so a runtime feature-flag change swaps component
145
+ // types (a clean remount) instead of changing the hook order of a mounted
146
+ // component.
147
+ if (fg('platform-dst-top-layer')) {
148
+ // Pass the original props object to preserve the discriminated union
149
+ // (shouldFitContainer: true vs false) that is lost after destructuring.
150
+ return /*#__PURE__*/React.createElement(PopupTopLayer, props);
151
+ }
152
+ return /*#__PURE__*/React.createElement(PopupLegacy, props);
154
153
  });
@@ -1,4 +1,4 @@
1
- /* popup-content-top-layer.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup-content-top-layer.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./popup-content-top-layer.compiled.css";
4
4
  import * as React from 'react';
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React, { useCallback, useContext } from 'react';
2
3
  import { Layering } from '@atlaskit/layering/layering';
3
4
  import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
@@ -18,13 +19,13 @@ var shouldDisableGpuAccelerationModifiers = [{
18
19
  }
19
20
  }];
20
21
  /**
21
- * __Popup content__
22
- *
23
- * Popup content is the component that renders the content of the popup.
22
+ * Legacy (Popper + Portal) implementation of the compositional PopupContent.
24
23
  *
25
- * It must be a child of the Popup component.
24
+ * Renders when the `platform-dst-top-layer` flag is off. This component owns
25
+ * the open layer observer registration, which on the top-layer path is handled
26
+ * by the `Popover` primitive inside `PopupContentTopLayer` instead.
26
27
  */
27
- export var PopupContent = function PopupContent(_ref) {
28
+ function PopupContentLegacy(_ref) {
28
29
  var xcss = _ref.xcss,
29
30
  _ref$appearance = _ref.appearance,
30
31
  inAppearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
@@ -57,11 +58,9 @@ export var PopupContent = function PopupContent(_ref) {
57
58
  _ref$shouldDisableGpu = _ref.shouldDisableGpuAcceleration,
58
59
  shouldDisableGpuAcceleration = _ref$shouldDisableGpu === void 0 ? false : _ref$shouldDisableGpu,
59
60
  role = _ref.role,
60
- label = _ref.label,
61
- titleId = _ref.titleId;
62
- useEnsureIsInsidePopup();
63
- var isOpen = useContext(IsOpenContext);
64
- var id = useContext(IdContext);
61
+ titleId = _ref.titleId,
62
+ isOpen = _ref.isOpen,
63
+ id = _ref.id;
65
64
  var triggerRef = useContext(TriggerRefContext);
66
65
  var _usePopupAppearance = usePopupAppearance({
67
66
  appearance: inAppearance,
@@ -72,50 +71,11 @@ export var PopupContent = function PopupContent(_ref) {
72
71
  var handleOpenLayerObserverCloseSignal = useCallback(function () {
73
72
  onClose === null || onClose === void 0 || onClose(null);
74
73
  }, [onClose]);
75
-
76
- // On the top-layer path, the Popover primitive registers with the observer
77
- // directly, so we skip registration here to avoid double-counting.
78
- // Safe conditional hook: feature flags are resolved once at startup.
79
- if (!fg('platform-dst-top-layer')) {
80
- // eslint-disable-next-line react-hooks/rules-of-hooks
81
- useNotifyOpenLayerObserver({
82
- isOpen: isOpen,
83
- onClose: handleOpenLayerObserverCloseSignal,
84
- type: 'popup'
85
- });
86
- }
87
-
88
- // Top-layer rendering path: native Popover API via @atlaskit/top-layer.
89
- // Mirrors the FF branch in the legacy `Popup` component (popup.tsx).
90
- if (fg('platform-dst-top-layer')) {
91
- return /*#__PURE__*/React.createElement(PopupContentTopLayer, {
92
- xcss: xcss,
93
- appearance: inAppearance,
94
- offset: offset,
95
- onClose: onClose,
96
- testId: testId,
97
- placement: placement,
98
- fallbackPlacements: fallbackPlacements,
99
- popupComponent: popupComponent,
100
- autoFocus: autoFocus,
101
- shouldFitContainer: shouldFitContainer,
102
- shouldFitViewport: shouldFitViewport,
103
- role: role,
104
- label: label,
105
- titleId: titleId,
106
- zIndex: zIndex,
107
- shouldRenderToParent: inShouldRenderToParent,
108
- strategy: strategy,
109
- boundary: boundary,
110
- rootBoundary: rootBoundary,
111
- shouldUseCaptureOnOutsideClick: shouldUseCaptureOnOutsideClick,
112
- shouldDisableFocusLock: shouldDisableFocusLock,
113
- shouldFlip: shouldFlip,
114
- shouldDisableGpuAcceleration: shouldDisableGpuAcceleration,
115
- isOpen: isOpen,
116
- id: id
117
- }, children);
118
- }
74
+ useNotifyOpenLayerObserver({
75
+ isOpen: isOpen,
76
+ onClose: handleOpenLayerObserverCloseSignal,
77
+ type: 'popup'
78
+ });
119
79
  if (!isOpen) {
120
80
  return null;
121
81
  }
@@ -155,4 +115,40 @@ export var PopupContent = function PopupContent(_ref) {
155
115
  return /*#__PURE__*/React.createElement(Portal, {
156
116
  zIndex: zIndex
157
117
  }, popperWrapper);
158
- };
118
+ }
119
+
120
+ /**
121
+ * __Popup content__
122
+ *
123
+ * Popup content is the component that renders the content of the popup.
124
+ *
125
+ * It must be a child of the Popup component.
126
+ */
127
+ export function PopupContent(props) {
128
+ useEnsureIsInsidePopup();
129
+ var isOpen = useContext(IsOpenContext);
130
+ var id = useContext(IdContext);
131
+
132
+ // Select the rendering implementation at the component boundary rather than
133
+ // gating hooks inside a single component. Each implementation owns its own
134
+ // hooks, so a runtime feature-flag change swaps component types (a clean
135
+ // remount) instead of changing the hook order of a mounted component.
136
+ //
137
+ // Forwarding the full props onto the chosen implementation is intentional:
138
+ // both implementations declare explicit prop types, so the forward is type
139
+ // checked rather than an unbounded API.
140
+ if (fg('platform-dst-top-layer')) {
141
+ // The top-layer Popover registers with the open layer observer itself.
142
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- intentional forward to a typed implementation
143
+ return /*#__PURE__*/React.createElement(PopupContentTopLayer, _extends({}, props, {
144
+ isOpen: isOpen,
145
+ id: id
146
+ }));
147
+ }
148
+
149
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- intentional forward to a typed implementation
150
+ return /*#__PURE__*/React.createElement(PopupContentLegacy, _extends({}, props, {
151
+ isOpen: isOpen,
152
+ id: id
153
+ }));
154
+ }
@@ -1,4 +1,4 @@
1
- /* popper-wrapper.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popper-wrapper.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
@@ -1,4 +1,4 @@
1
- /* popup-top-layer.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup-top-layer.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./popup-top-layer.compiled.css";
4
4
  import * as React from 'react';
package/dist/esm/popup.js CHANGED
@@ -1,4 +1,4 @@
1
- /* popup.tsx generated by @compiled/babel-plugin v0.40.0 */
1
+ /* popup.tsx generated by @compiled/babel-plugin v2.0.0 */
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "./popup.compiled.css";
4
4
  import * as React from 'react';
@@ -23,7 +23,7 @@ var defaultLayer = 400;
23
23
  var wrapperStyles = {
24
24
  root: "_kqswh2mm"
25
25
  };
26
- export var Popup = /*#__PURE__*/memo(function (props) {
26
+ var PopupLegacy = function PopupLegacy(props) {
27
27
  var xcss = props.xcss,
28
28
  _props$appearance = props.appearance,
29
29
  inAppearance = _props$appearance === void 0 ? 'default' : _props$appearance,
@@ -81,25 +81,11 @@ export var Popup = /*#__PURE__*/memo(function (props) {
81
81
  var handleOpenLayerObserverCloseSignal = useCallback(function () {
82
82
  onClose === null || onClose === void 0 || onClose(null);
83
83
  }, [onClose]);
84
-
85
- // On the top-layer path, the Popover primitive registers with the observer
86
- // directly, so we skip registration here to avoid double-counting.
87
- // Safe conditional hook: feature flags are resolved once at startup.
88
- if (!fg('platform-dst-top-layer')) {
89
- // eslint-disable-next-line react-hooks/rules-of-hooks
90
- useNotifyOpenLayerObserver({
91
- isOpen: isOpen,
92
- onClose: handleOpenLayerObserverCloseSignal,
93
- type: 'popup'
94
- });
95
- }
96
-
97
- // Top-layer rendering path: native Popover API via @atlaskit/top-layer
98
- if (fg('platform-dst-top-layer')) {
99
- // Pass the original props object to preserve the discriminated union
100
- // (shouldFitContainer: true vs false) that is lost after destructuring.
101
- return /*#__PURE__*/React.createElement(PopupTopLayer, props);
102
- }
84
+ useNotifyOpenLayerObserver({
85
+ isOpen: isOpen,
86
+ onClose: handleOpenLayerObserverCloseSignal,
87
+ type: 'popup'
88
+ });
103
89
 
104
90
  // `xcss` is part of Popup's public API and is forwarded as-is to
105
91
  // the internal PopperWrapper, which rebuilds the inner styles. We
@@ -163,4 +149,17 @@ export var Popup = /*#__PURE__*/memo(function (props) {
163
149
  }, popupContent);
164
150
  }
165
151
  return popupContent;
152
+ };
153
+ export var Popup = /*#__PURE__*/memo(function (props) {
154
+ // Choose the rendering implementation at the component boundary rather than
155
+ // gating hooks inside a single component. Each implementation owns its own
156
+ // hooks unconditionally, so a runtime feature-flag change swaps component
157
+ // types (a clean remount) instead of changing the hook order of a mounted
158
+ // component.
159
+ if (fg('platform-dst-top-layer')) {
160
+ // Pass the original props object to preserve the discriminated union
161
+ // (shouldFitContainer: true vs false) that is lost after destructuring.
162
+ return /*#__PURE__*/React.createElement(PopupTopLayer, props);
163
+ }
164
+ return /*#__PURE__*/React.createElement(PopupLegacy, props);
166
165
  });
@@ -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, shouldIgnoreCloseEvent, shouldRenderToParent: inShouldRenderToParent, shouldDisableFocusLock, shouldFitContainer, shouldFitViewport, shouldDisableGpuAcceleration, role, label, titleId, }: PopupContentProps) => React.JSX.Element | null;
34
+ export declare function PopupContent(props: PopupContentProps): React.ReactNode;
35
35
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "5.2.1",
3
+ "version": "5.2.3",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,12 +36,12 @@
36
36
  "@atlaskit/layering": "^5.0.0",
37
37
  "@atlaskit/motion": "^8.0.0",
38
38
  "@atlaskit/platform-feature-flags": "^2.1.0",
39
- "@atlaskit/popper": "^8.4.0",
39
+ "@atlaskit/popper": "^8.5.0",
40
40
  "@atlaskit/portal": "^6.1.0",
41
41
  "@atlaskit/primitives": "^22.2.0",
42
42
  "@atlaskit/react-compiler-gating": "^0.2.0",
43
43
  "@atlaskit/tokens": "^16.3.0",
44
- "@atlaskit/top-layer": "^2.0.0",
44
+ "@atlaskit/top-layer": "^3.0.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "@compiled/react": "^1.0.0",
47
47
  "bind-event-listener": "^3.0.0",
@@ -61,9 +61,9 @@
61
61
  "@atlaskit/code": "^18.2.0",
62
62
  "@atlaskit/docs": "^12.1.0",
63
63
  "@atlaskit/form": "^16.1.0",
64
- "@atlaskit/heading": "^6.2.0",
64
+ "@atlaskit/heading": "^7.0.0",
65
65
  "@atlaskit/icon": "^37.2.0",
66
- "@atlaskit/link": "^4.3.0",
66
+ "@atlaskit/link": "^5.0.0",
67
67
  "@atlaskit/modal-dialog": "^16.2.0",
68
68
  "@atlaskit/section-message": "^9.2.0",
69
69
  "@atlaskit/textfield": "^9.1.0",