@atlaskit/popup 6.0.0 → 6.0.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 +8 -0
- package/dist/cjs/use-close-manager.js +15 -36
- package/dist/es2019/use-close-manager.js +15 -36
- package/dist/esm/use-close-manager.js +15 -36
- package/package.json +11 -34
package/CHANGELOG.md
CHANGED
|
@@ -72,43 +72,22 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
|
|
|
72
72
|
if (!doesDomNodeExist) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if
|
|
82
|
-
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
var levelOfClickedLayer = layeredElement.getAttribute('data-ds--level');
|
|
86
|
-
if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
|
|
87
|
-
// Don't close this popup when the click landed inside a higher-level layer
|
|
88
|
-
// (e.g. a Drawer or Modal that portals to <body>). Such nodes are not DOM
|
|
89
|
-
// descendants of popupRef, so the contains() checks below would wrongly
|
|
90
|
-
// classify them as "outside" clicks and close the popup prematurely.
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
75
|
+
if (target instanceof HTMLElement) {
|
|
76
|
+
var _target$closest;
|
|
77
|
+
var layeredElement = (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, "[data-ds--level]");
|
|
78
|
+
if (layeredElement) {
|
|
79
|
+
var closeType = layeredElement.getAttribute('data-ds--close--type');
|
|
80
|
+
if (closeType === 'single' && isLayerDisabled()) {
|
|
81
|
+
// if the close type is single, we won't close other disabled layers when clicking outside
|
|
82
|
+
return;
|
|
93
83
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var _closeType = _layeredElement.getAttribute('[data-ds--close--type]');
|
|
102
|
-
if (_closeType === 'single') {
|
|
103
|
-
// if the close type is single, we won't close other disabled layers when clicking outside
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
var _levelOfClickedLayer = _layeredElement.getAttribute('data-ds--level');
|
|
107
|
-
if (_levelOfClickedLayer && Number(_levelOfClickedLayer) > currentLevel) {
|
|
108
|
-
// won't trigger onClick event when we click in a higher layer.
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
84
|
+
var levelOfClickedLayer = layeredElement.getAttribute('data-ds--level');
|
|
85
|
+
if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
|
|
86
|
+
// Don't close this popup when the click landed inside a higher-level layer
|
|
87
|
+
// (e.g. a Drawer or Modal that portals to <body>). Such nodes are not DOM
|
|
88
|
+
// descendants of popupRef, so the contains() checks below would wrongly
|
|
89
|
+
// classify them as "outside" clicks and close the popup prematurely.
|
|
90
|
+
return;
|
|
112
91
|
}
|
|
113
92
|
}
|
|
114
93
|
}
|
|
@@ -69,43 +69,22 @@ export const useCloseManager = ({
|
|
|
69
69
|
if (!doesDomNodeExist) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if
|
|
79
|
-
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const levelOfClickedLayer = layeredElement.getAttribute('data-ds--level');
|
|
83
|
-
if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
|
|
84
|
-
// Don't close this popup when the click landed inside a higher-level layer
|
|
85
|
-
// (e.g. a Drawer or Modal that portals to <body>). Such nodes are not DOM
|
|
86
|
-
// descendants of popupRef, so the contains() checks below would wrongly
|
|
87
|
-
// classify them as "outside" clicks and close the popup prematurely.
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
72
|
+
if (target instanceof HTMLElement) {
|
|
73
|
+
var _target$closest;
|
|
74
|
+
const layeredElement = (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, `[data-ds--level]`);
|
|
75
|
+
if (layeredElement) {
|
|
76
|
+
const closeType = layeredElement.getAttribute('data-ds--close--type');
|
|
77
|
+
if (closeType === 'single' && isLayerDisabled()) {
|
|
78
|
+
// if the close type is single, we won't close other disabled layers when clicking outside
|
|
79
|
+
return;
|
|
90
80
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const closeType = layeredElement.getAttribute('[data-ds--close--type]');
|
|
99
|
-
if (closeType === 'single') {
|
|
100
|
-
// if the close type is single, we won't close other disabled layers when clicking outside
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const levelOfClickedLayer = layeredElement.getAttribute('data-ds--level');
|
|
104
|
-
if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
|
|
105
|
-
// won't trigger onClick event when we click in a higher layer.
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
81
|
+
const levelOfClickedLayer = layeredElement.getAttribute('data-ds--level');
|
|
82
|
+
if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
|
|
83
|
+
// Don't close this popup when the click landed inside a higher-level layer
|
|
84
|
+
// (e.g. a Drawer or Modal that portals to <body>). Such nodes are not DOM
|
|
85
|
+
// descendants of popupRef, so the contains() checks below would wrongly
|
|
86
|
+
// classify them as "outside" clicks and close the popup prematurely.
|
|
87
|
+
return;
|
|
109
88
|
}
|
|
110
89
|
}
|
|
111
90
|
}
|
|
@@ -64,43 +64,22 @@ export var useCloseManager = function useCloseManager(_ref) {
|
|
|
64
64
|
if (!doesDomNodeExist) {
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if
|
|
74
|
-
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
var levelOfClickedLayer = layeredElement.getAttribute('data-ds--level');
|
|
78
|
-
if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
|
|
79
|
-
// Don't close this popup when the click landed inside a higher-level layer
|
|
80
|
-
// (e.g. a Drawer or Modal that portals to <body>). Such nodes are not DOM
|
|
81
|
-
// descendants of popupRef, so the contains() checks below would wrongly
|
|
82
|
-
// classify them as "outside" clicks and close the popup prematurely.
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
67
|
+
if (target instanceof HTMLElement) {
|
|
68
|
+
var _target$closest;
|
|
69
|
+
var layeredElement = (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, "[data-ds--level]");
|
|
70
|
+
if (layeredElement) {
|
|
71
|
+
var closeType = layeredElement.getAttribute('data-ds--close--type');
|
|
72
|
+
if (closeType === 'single' && isLayerDisabled()) {
|
|
73
|
+
// if the close type is single, we won't close other disabled layers when clicking outside
|
|
74
|
+
return;
|
|
85
75
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var _closeType = _layeredElement.getAttribute('[data-ds--close--type]');
|
|
94
|
-
if (_closeType === 'single') {
|
|
95
|
-
// if the close type is single, we won't close other disabled layers when clicking outside
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
var _levelOfClickedLayer = _layeredElement.getAttribute('data-ds--level');
|
|
99
|
-
if (_levelOfClickedLayer && Number(_levelOfClickedLayer) > currentLevel) {
|
|
100
|
-
// won't trigger onClick event when we click in a higher layer.
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
76
|
+
var levelOfClickedLayer = layeredElement.getAttribute('data-ds--level');
|
|
77
|
+
if (levelOfClickedLayer && Number(levelOfClickedLayer) > currentLevel) {
|
|
78
|
+
// Don't close this popup when the click landed inside a higher-level layer
|
|
79
|
+
// (e.g. a Drawer or Modal that portals to <body>). Such nodes are not DOM
|
|
80
|
+
// descendants of popupRef, so the contains() checks below would wrongly
|
|
81
|
+
// classify them as "outside" clicks and close the popup prematurely.
|
|
82
|
+
return;
|
|
104
83
|
}
|
|
105
84
|
}
|
|
106
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "A popup displays brief content in an overlay.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,14 +36,14 @@
|
|
|
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": "^9.
|
|
40
|
-
"@atlaskit/portal": "^6.
|
|
39
|
+
"@atlaskit/popper": "^9.1.0",
|
|
40
|
+
"@atlaskit/portal": "^6.2.0",
|
|
41
41
|
"@atlaskit/primitives": "^22.2.0",
|
|
42
42
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
43
|
-
"@atlaskit/tokens": "^16.
|
|
44
|
-
"@atlaskit/top-layer": "^3.
|
|
43
|
+
"@atlaskit/tokens": "^16.7.0",
|
|
44
|
+
"@atlaskit/top-layer": "^3.2.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
|
-
"@compiled/react": "^1.0.
|
|
46
|
+
"@compiled/react": "^1.0.2",
|
|
47
47
|
"bind-event-listener": "^3.0.0",
|
|
48
48
|
"focus-trap": "^2.4.5",
|
|
49
49
|
"memoize-one": "^6.0.0",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"@af/integration-testing": "workspace:^",
|
|
59
59
|
"@af/visual-regression": "workspace:^",
|
|
60
60
|
"@atlaskit/button": "^25.0.0",
|
|
61
|
-
"@atlaskit/code": "^
|
|
62
|
-
"@atlaskit/docs": "^12.
|
|
63
|
-
"@atlaskit/form": "^
|
|
61
|
+
"@atlaskit/code": "^19.0.0",
|
|
62
|
+
"@atlaskit/docs": "^12.2.0",
|
|
63
|
+
"@atlaskit/form": "^17.0.0",
|
|
64
64
|
"@atlaskit/heading": "^7.0.0",
|
|
65
|
-
"@atlaskit/icon": "^37.
|
|
65
|
+
"@atlaskit/icon": "^37.3.0",
|
|
66
66
|
"@atlaskit/link": "^5.0.0",
|
|
67
|
-
"@atlaskit/modal-dialog": "^16.
|
|
67
|
+
"@atlaskit/modal-dialog": "^16.3.0",
|
|
68
68
|
"@atlaskit/section-message": "^10.0.0",
|
|
69
69
|
"@atlaskit/textfield": "^10.0.0",
|
|
70
70
|
"@atlaskit/toggle": "^17.1.0",
|
|
@@ -85,33 +85,10 @@
|
|
|
85
85
|
"react",
|
|
86
86
|
"ui"
|
|
87
87
|
],
|
|
88
|
-
"techstack": {
|
|
89
|
-
"@atlassian/frontend": {
|
|
90
|
-
"import-structure": "atlassian-conventions"
|
|
91
|
-
},
|
|
92
|
-
"@repo/internal": {
|
|
93
|
-
"dom-events": "use-bind-event-listener",
|
|
94
|
-
"design-system": "v1",
|
|
95
|
-
"ui-components": "lite-mode",
|
|
96
|
-
"analytics": "analytics-next",
|
|
97
|
-
"design-tokens": [
|
|
98
|
-
"color",
|
|
99
|
-
"spacing"
|
|
100
|
-
],
|
|
101
|
-
"deprecation": "no-deprecated-imports",
|
|
102
|
-
"styling": [
|
|
103
|
-
"static",
|
|
104
|
-
"emotion"
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
88
|
"platform-feature-flags": {
|
|
109
89
|
"cc_blocks_changeboarding": {
|
|
110
90
|
"type": "boolean"
|
|
111
91
|
},
|
|
112
|
-
"jsmgrowth_popup_fix": {
|
|
113
|
-
"type": "boolean"
|
|
114
|
-
},
|
|
115
92
|
"platform-dst-top-layer": {
|
|
116
93
|
"type": "boolean"
|
|
117
94
|
},
|