@atlaskit/popup 4.20.2 → 4.21.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,30 @@
1
1
  # @atlaskit/popup
2
2
 
3
+ ## 4.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.21.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`8e9ab10567283`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e9ab10567283) -
14
+ When `platform-dst-top-layer` is enabled, the open layer observer registration now happens inside
15
+ the `Dialog` and `Popover` primitives directly, so `popup`, `modal-dialog`, and `tooltip` no
16
+ longer register with the open layer observer separately (avoiding double-counting).
17
+ - `Dialog` registers as `type: 'modal'`, with a no-op `onClose`, as there is no current use case
18
+ for programmatic close of modals via the open layer observer.
19
+ - `Popover` registers as `type: 'popup'` for interactive overlay roles (`dialog`, `alertdialog`,
20
+ `menu`, `listbox`, `tree`, `grid`) and omits `type` for other roles (e.g. `tooltip`).
21
+ - A new `programmatic` value has been added to `TPopoverCloseReason` to distinguish programmatic
22
+ closes, such as those from the open layer observer's `closeLayers()` calls.
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 4.20.2
4
29
 
5
30
  ### Patch Changes
@@ -80,11 +80,18 @@ var PopupContent = exports.PopupContent = function PopupContent(_ref) {
80
80
  var handleOpenLayerObserverCloseSignal = (0, _react.useCallback)(function () {
81
81
  onClose === null || onClose === void 0 || onClose(null);
82
82
  }, [onClose]);
83
- (0, _openLayerObserver.useNotifyOpenLayerObserver)({
84
- isOpen: isOpen,
85
- onClose: handleOpenLayerObserverCloseSignal,
86
- type: 'popup'
87
- });
83
+
84
+ // On the top-layer path, the Popover primitive registers with the observer
85
+ // directly, so we skip registration here to avoid double-counting.
86
+ // Safe conditional hook: feature flags are resolved once at startup.
87
+ if (!(0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
88
+ // eslint-disable-next-line react-hooks/rules-of-hooks
89
+ (0, _openLayerObserver.useNotifyOpenLayerObserver)({
90
+ isOpen: isOpen,
91
+ onClose: handleOpenLayerObserverCloseSignal,
92
+ type: 'popup'
93
+ });
94
+ }
88
95
 
89
96
  // Top-layer rendering path: native Popover API via @atlaskit/top-layer.
90
97
  // Mirrors the FF branch in the legacy `Popup` component (popup.tsx).
package/dist/cjs/popup.js CHANGED
@@ -88,11 +88,18 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (props) {
88
88
  var handleOpenLayerObserverCloseSignal = (0, _react.useCallback)(function () {
89
89
  onClose === null || onClose === void 0 || onClose(null);
90
90
  }, [onClose]);
91
- (0, _openLayerObserver.useNotifyOpenLayerObserver)({
92
- isOpen: isOpen,
93
- onClose: handleOpenLayerObserverCloseSignal,
94
- type: 'popup'
95
- });
91
+
92
+ // On the top-layer path, the Popover primitive registers with the observer
93
+ // directly, so we skip registration here to avoid double-counting.
94
+ // Safe conditional hook: feature flags are resolved once at startup.
95
+ if (!(0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
96
+ // eslint-disable-next-line react-hooks/rules-of-hooks
97
+ (0, _openLayerObserver.useNotifyOpenLayerObserver)({
98
+ isOpen: isOpen,
99
+ onClose: handleOpenLayerObserverCloseSignal,
100
+ type: 'popup'
101
+ });
102
+ }
96
103
 
97
104
  // Top-layer rendering path: native Popover API via @atlaskit/top-layer
98
105
  if ((0, _platformFeatureFlags.fg)('platform-dst-top-layer')) {
@@ -64,11 +64,18 @@ export const PopupContent = ({
64
64
  const handleOpenLayerObserverCloseSignal = useCallback(() => {
65
65
  onClose === null || onClose === void 0 ? void 0 : onClose(null);
66
66
  }, [onClose]);
67
- useNotifyOpenLayerObserver({
68
- isOpen,
69
- onClose: handleOpenLayerObserverCloseSignal,
70
- type: 'popup'
71
- });
67
+
68
+ // On the top-layer path, the Popover primitive registers with the observer
69
+ // directly, so we skip registration here to avoid double-counting.
70
+ // Safe conditional hook: feature flags are resolved once at startup.
71
+ if (!fg('platform-dst-top-layer')) {
72
+ // eslint-disable-next-line react-hooks/rules-of-hooks
73
+ useNotifyOpenLayerObserver({
74
+ isOpen,
75
+ onClose: handleOpenLayerObserverCloseSignal,
76
+ type: 'popup'
77
+ });
78
+ }
72
79
 
73
80
  // Top-layer rendering path: native Popover API via @atlaskit/top-layer.
74
81
  // Mirrors the FF branch in the legacy `Popup` component (popup.tsx).
@@ -67,11 +67,18 @@ export const Popup = /*#__PURE__*/memo(props => {
67
67
  const handleOpenLayerObserverCloseSignal = useCallback(() => {
68
68
  onClose === null || onClose === void 0 ? void 0 : onClose(null);
69
69
  }, [onClose]);
70
- useNotifyOpenLayerObserver({
71
- isOpen,
72
- onClose: handleOpenLayerObserverCloseSignal,
73
- type: 'popup'
74
- });
70
+
71
+ // On the top-layer path, the Popover primitive registers with the observer
72
+ // directly, so we skip registration here to avoid double-counting.
73
+ // Safe conditional hook: feature flags are resolved once at startup.
74
+ if (!fg('platform-dst-top-layer')) {
75
+ // eslint-disable-next-line react-hooks/rules-of-hooks
76
+ useNotifyOpenLayerObserver({
77
+ isOpen,
78
+ onClose: handleOpenLayerObserverCloseSignal,
79
+ type: 'popup'
80
+ });
81
+ }
75
82
 
76
83
  // Top-layer rendering path: native Popover API via @atlaskit/top-layer
77
84
  if (fg('platform-dst-top-layer')) {
@@ -71,11 +71,18 @@ export var PopupContent = function PopupContent(_ref) {
71
71
  var handleOpenLayerObserverCloseSignal = useCallback(function () {
72
72
  onClose === null || onClose === void 0 || onClose(null);
73
73
  }, [onClose]);
74
- useNotifyOpenLayerObserver({
75
- isOpen: isOpen,
76
- onClose: handleOpenLayerObserverCloseSignal,
77
- type: 'popup'
78
- });
74
+
75
+ // On the top-layer path, the Popover primitive registers with the observer
76
+ // directly, so we skip registration here to avoid double-counting.
77
+ // Safe conditional hook: feature flags are resolved once at startup.
78
+ if (!fg('platform-dst-top-layer')) {
79
+ // eslint-disable-next-line react-hooks/rules-of-hooks
80
+ useNotifyOpenLayerObserver({
81
+ isOpen: isOpen,
82
+ onClose: handleOpenLayerObserverCloseSignal,
83
+ type: 'popup'
84
+ });
85
+ }
79
86
 
80
87
  // Top-layer rendering path: native Popover API via @atlaskit/top-layer.
81
88
  // Mirrors the FF branch in the legacy `Popup` component (popup.tsx).
package/dist/esm/popup.js CHANGED
@@ -80,11 +80,18 @@ export var Popup = /*#__PURE__*/memo(function (props) {
80
80
  var handleOpenLayerObserverCloseSignal = useCallback(function () {
81
81
  onClose === null || onClose === void 0 || onClose(null);
82
82
  }, [onClose]);
83
- useNotifyOpenLayerObserver({
84
- isOpen: isOpen,
85
- onClose: handleOpenLayerObserverCloseSignal,
86
- type: 'popup'
87
- });
83
+
84
+ // On the top-layer path, the Popover primitive registers with the observer
85
+ // directly, so we skip registration here to avoid double-counting.
86
+ // Safe conditional hook: feature flags are resolved once at startup.
87
+ if (!fg('platform-dst-top-layer')) {
88
+ // eslint-disable-next-line react-hooks/rules-of-hooks
89
+ useNotifyOpenLayerObserver({
90
+ isOpen: isOpen,
91
+ onClose: handleOpenLayerObserverCloseSignal,
92
+ type: 'popup'
93
+ });
94
+ }
88
95
 
89
96
  // Top-layer rendering path: native Popover API via @atlaskit/top-layer
90
97
  if (fg('platform-dst-top-layer')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/popup",
3
- "version": "4.20.2",
3
+ "version": "4.21.1",
4
4
  "description": "A popup displays brief content in an overlay.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/portal": "^5.5.0",
49
49
  "@atlaskit/primitives": "^19.0.0",
50
50
  "@atlaskit/tokens": "^13.0.0",
51
- "@atlaskit/top-layer": "^0.8.0",
51
+ "@atlaskit/top-layer": "^0.10.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@compiled/react": "^0.20.0",
54
54
  "bind-event-listener": "^3.0.0",
@@ -69,9 +69,9 @@
69
69
  "@atlaskit/docs": "^11.8.0",
70
70
  "@atlaskit/form": "^15.5.0",
71
71
  "@atlaskit/heading": "^5.4.0",
72
- "@atlaskit/icon": "^35.0.0",
72
+ "@atlaskit/icon": "^35.1.0",
73
73
  "@atlaskit/link": "^3.4.0",
74
- "@atlaskit/modal-dialog": "^15.1.0",
74
+ "@atlaskit/modal-dialog": "^15.2.0",
75
75
  "@atlaskit/section-message": "^8.13.0",
76
76
  "@atlaskit/textfield": "^8.3.0",
77
77
  "@atlaskit/toggle": "^15.6.0",
package/popup.docs.tsx CHANGED
@@ -1,47 +1,49 @@
1
1
  import path from 'path';
2
2
 
3
- import type { ComponentStructuredContentSource } from '@atlassian/structured-docs-types';
3
+ import type { StructuredContentSource } from '@atlassian/structured-docs-types/types';
4
4
 
5
- const documentation: ComponentStructuredContentSource[] = [
6
- {
7
- name: 'Popup',
8
- description: 'A component for displaying popup content relative to a trigger element.',
9
- status: 'general-availability',
10
- import: {
5
+ const documentation: StructuredContentSource = {
6
+ components: [
7
+ {
11
8
  name: 'Popup',
12
- package: '@atlaskit/popup',
13
- type: 'default',
14
- packagePath: path.resolve(__dirname),
15
- packageJson: require('./package.json'),
16
- },
17
- usageGuidelines: [
18
- 'Use for contextual content that appears on demand',
19
- 'Position appropriately relative to trigger',
20
- 'Consider dismissal behavior',
21
- 'Use appropriate content sizing',
22
- ],
23
- contentGuidelines: [
24
- 'Keep popup content focused and relevant',
25
- 'Use clear, concise content',
26
- 'Provide appropriate actions when needed',
27
- 'Consider content hierarchy',
28
- ],
29
- accessibilityGuidelines: [
30
- 'Provide appropriate focus management',
31
- 'Use clear trigger labels',
32
- 'Ensure keyboard navigation support',
33
- 'Provide escape key dismissal',
34
- ],
35
- examples: [
36
- {
9
+ description: 'A component for displaying popup content relative to a trigger element.',
10
+ status: 'general-availability',
11
+ import: {
37
12
  name: 'Popup',
38
- description: 'Popup example',
39
- source: path.resolve(__dirname, './examples/ai/popup.tsx'),
13
+ package: '@atlaskit/popup',
14
+ type: 'default',
15
+ packagePath: path.resolve(__dirname),
16
+ packageJson: require('./package.json'),
40
17
  },
41
- ],
42
- keywords: ['popup', 'overlay', 'floating', 'content', 'trigger'],
43
- categories: ['overlay'],
44
- },
45
- ];
18
+ usageGuidelines: [
19
+ 'Use for contextual content that appears on demand',
20
+ 'Position appropriately relative to trigger',
21
+ 'Consider dismissal behavior',
22
+ 'Use appropriate content sizing',
23
+ ],
24
+ contentGuidelines: [
25
+ 'Keep popup content focused and relevant',
26
+ 'Use clear, concise content',
27
+ 'Provide appropriate actions when needed',
28
+ 'Consider content hierarchy',
29
+ ],
30
+ accessibilityGuidelines: [
31
+ 'Provide appropriate focus management',
32
+ 'Use clear trigger labels',
33
+ 'Ensure keyboard navigation support',
34
+ 'Provide escape key dismissal',
35
+ ],
36
+ examples: [
37
+ {
38
+ name: 'Popup',
39
+ description: 'Popup example',
40
+ source: path.resolve(__dirname, './examples/ai/popup.tsx'),
41
+ },
42
+ ],
43
+ keywords: ['popup', 'overlay', 'floating', 'content', 'trigger'],
44
+ categories: ['overlay'],
45
+ },
46
+ ],
47
+ };
46
48
 
47
49
  export default documentation;