@atlaskit/popup 1.20.1 → 1.20.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 +16 -0
- package/__perf__/default.tsx +1 -1
- package/dist/cjs/popper-wrapper.js +9 -7
- package/dist/cjs/popup.js +5 -3
- package/dist/cjs/use-close-manager.js +12 -15
- package/dist/es2019/popper-wrapper.js +9 -7
- package/dist/es2019/popup.js +5 -3
- package/dist/es2019/use-close-manager.js +12 -15
- package/dist/esm/popper-wrapper.js +10 -8
- package/dist/esm/popup.js +5 -3
- package/dist/esm/use-close-manager.js +12 -15
- package/dist/types/popper-wrapper.d.ts +1 -1
- package/dist/types/popup.d.ts +1 -1
- package/dist/types/types.d.ts +6 -1
- package/dist/types-ts4.5/popper-wrapper.d.ts +1 -1
- package/dist/types-ts4.5/popup.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +6 -1
- package/package.json +5 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/popup
|
|
2
2
|
|
|
3
|
+
## 1.20.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#123803](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/123803)
|
|
8
|
+
[`741dadf4fa8f9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/741dadf4fa8f9) -
|
|
9
|
+
Added modifiers prop to the popup
|
|
10
|
+
|
|
11
|
+
## 1.20.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#122722](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122722)
|
|
16
|
+
[`512798d699bd1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/512798d699bd1) -
|
|
17
|
+
Disable onClick event if popup is a disabled layer
|
|
18
|
+
|
|
3
19
|
## 1.20.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/__perf__/default.tsx
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
8
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -24,8 +25,8 @@ var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children"];
|
|
|
24
25
|
var _css;
|
|
25
26
|
/**
|
|
26
27
|
* @jsxRuntime classic
|
|
28
|
+
* @jsx jsx
|
|
27
29
|
*/
|
|
28
|
-
/** @jsx jsx */
|
|
29
30
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
30
31
|
var popupFullWidthStyles = (0, _react2.css)({
|
|
31
32
|
width: '100%'
|
|
@@ -89,7 +90,8 @@ function PopperWrapper(_ref) {
|
|
|
89
90
|
strategy = _ref.strategy,
|
|
90
91
|
role = _ref.role,
|
|
91
92
|
label = _ref.label,
|
|
92
|
-
titleId = _ref.titleId
|
|
93
|
+
titleId = _ref.titleId,
|
|
94
|
+
modifiers = _ref.modifiers;
|
|
93
95
|
var _useState = (0, _react.useState)(null),
|
|
94
96
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
95
97
|
popupRef = _useState2[0],
|
|
@@ -117,7 +119,7 @@ function PopperWrapper(_ref) {
|
|
|
117
119
|
});
|
|
118
120
|
var _UNSAFE_useLayering = (0, _layering.UNSAFE_useLayering)(),
|
|
119
121
|
currentLevel = _UNSAFE_useLayering.currentLevel;
|
|
120
|
-
var
|
|
122
|
+
var mergedModifiers = (0, _react.useMemo)(function () {
|
|
121
123
|
return [{
|
|
122
124
|
name: 'flip',
|
|
123
125
|
enabled: shouldFlip,
|
|
@@ -126,12 +128,12 @@ function PopperWrapper(_ref) {
|
|
|
126
128
|
boundary: boundary,
|
|
127
129
|
fallbackPlacements: fallbackPlacements
|
|
128
130
|
}
|
|
129
|
-
}];
|
|
130
|
-
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
|
|
131
|
+
}].concat((0, _toConsumableArray2.default)(modifiers || []));
|
|
132
|
+
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
|
|
131
133
|
return (0, _react2.jsx)(_popper.Popper, {
|
|
132
134
|
placement: placement,
|
|
133
135
|
offset: offset,
|
|
134
|
-
modifiers:
|
|
136
|
+
modifiers: mergedModifiers,
|
|
135
137
|
strategy: strategy
|
|
136
138
|
}, function (_ref2) {
|
|
137
139
|
var _ref3 = _ref2.ref,
|
|
@@ -165,7 +167,7 @@ function PopperWrapper(_ref) {
|
|
|
165
167
|
tabIndex: autoFocus ? 0 : undefined,
|
|
166
168
|
shouldRenderToParent: shouldRenderToParent,
|
|
167
169
|
shouldFitContainer: shouldFitContainer
|
|
168
|
-
}, (0, _platformFeatureFlags.
|
|
170
|
+
}, (0, _platformFeatureFlags.fg)('platform.design-system-team.iframe_gojiv') && (0, _react2.jsx)(_react2.Global, {
|
|
169
171
|
styles: blockPointerEventsOnExternalIframeStyles
|
|
170
172
|
}), (0, _react2.jsx)(_repositionOnUpdate.RepositionOnUpdate, {
|
|
171
173
|
update: update
|
package/dist/cjs/popup.js
CHANGED
|
@@ -19,8 +19,8 @@ var _useGetMemoizedMergedTriggerRef = require("./use-get-memoized-merged-trigger
|
|
|
19
19
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
20
20
|
/**
|
|
21
21
|
* @jsxRuntime classic
|
|
22
|
+
* @jsx jsx
|
|
22
23
|
*/
|
|
23
|
-
/** @jsx jsx */
|
|
24
24
|
|
|
25
25
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
|
|
@@ -60,7 +60,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
60
60
|
strategy = _ref.strategy,
|
|
61
61
|
role = _ref.role,
|
|
62
62
|
label = _ref.label,
|
|
63
|
-
titleId = _ref.titleId
|
|
63
|
+
titleId = _ref.titleId,
|
|
64
|
+
modifiers = _ref.modifiers;
|
|
64
65
|
var _useState = (0, _react.useState)(null),
|
|
65
66
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
66
67
|
triggerRef = _useState2[0],
|
|
@@ -92,7 +93,8 @@ var Popup = exports.Popup = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
92
93
|
strategy: shouldFitContainer ? 'absolute' : strategy,
|
|
93
94
|
role: role,
|
|
94
95
|
label: label,
|
|
95
|
-
titleId: titleId
|
|
96
|
+
titleId: titleId,
|
|
97
|
+
modifiers: modifiers
|
|
96
98
|
}));
|
|
97
99
|
var popupContent = (0, _react2.jsx)(_popper.Manager, null, (0, _react2.jsx)(_popper.Reference, null, function (_ref2) {
|
|
98
100
|
var ref = _ref2.ref;
|
|
@@ -9,7 +9,6 @@ var _react = require("react");
|
|
|
9
9
|
var _bindEventListener = require("bind-event-listener");
|
|
10
10
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
11
11
|
var _layering = require("@atlaskit/layering");
|
|
12
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
12
|
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
|
14
13
|
|
|
15
14
|
var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
|
|
@@ -45,7 +44,7 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
|
|
|
45
44
|
if (!doesDomNodeExist) {
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
|
-
if (isLayerDisabled()
|
|
47
|
+
if (isLayerDisabled()) {
|
|
49
48
|
//if it is a disabled layer, we need to disable its click listener.
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
@@ -77,20 +76,18 @@ var useCloseManager = exports.useCloseManager = function useCloseManager(_ref) {
|
|
|
77
76
|
|
|
78
77
|
// bind onBlur event listener to fix popup not close when clicking on iframe outside
|
|
79
78
|
var unbindBlur = _noop.default;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
var wrapper = document.activeElement.closest('[data-ds--level]');
|
|
88
|
-
if (!wrapper || currentLevel > Number(wrapper.getAttribute('data-ds--level'))) {
|
|
89
|
-
closePopup(e);
|
|
90
|
-
}
|
|
79
|
+
unbindBlur = (0, _bindEventListener.bind)(window, {
|
|
80
|
+
type: 'blur',
|
|
81
|
+
listener: function onBlur(e) {
|
|
82
|
+
if (isLayerDisabled() || !(document.activeElement instanceof HTMLIFrameElement)) {
|
|
83
|
+
return;
|
|
91
84
|
}
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
var wrapper = document.activeElement.closest('[data-ds--level]');
|
|
86
|
+
if (!wrapper || currentLevel > Number(wrapper.getAttribute('data-ds--level'))) {
|
|
87
|
+
closePopup(e);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
94
91
|
return function () {
|
|
95
92
|
unbind();
|
|
96
93
|
unbindBlur();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
import { forwardRef, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css, Global, jsx } from '@emotion/react';
|
|
10
10
|
import { UNSAFE_useLayering } from '@atlaskit/layering';
|
|
11
|
-
import {
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { Popper } from '@atlaskit/popper';
|
|
13
13
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
14
14
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -69,6 +69,7 @@ function PopperWrapper({
|
|
|
69
69
|
rootBoundary,
|
|
70
70
|
shouldFlip,
|
|
71
71
|
placement = 'auto',
|
|
72
|
+
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
72
73
|
popupComponent: PopupContainer = DefaultPopupComponent,
|
|
73
74
|
autoFocus = true,
|
|
74
75
|
triggerRef,
|
|
@@ -79,7 +80,8 @@ function PopperWrapper({
|
|
|
79
80
|
strategy,
|
|
80
81
|
role,
|
|
81
82
|
label,
|
|
82
|
-
titleId
|
|
83
|
+
titleId,
|
|
84
|
+
modifiers
|
|
83
85
|
}) {
|
|
84
86
|
const [popupRef, setPopupRef] = useState(null);
|
|
85
87
|
const [initialFocusRef, setInitialFocusRef] = useState(null);
|
|
@@ -103,7 +105,7 @@ function PopperWrapper({
|
|
|
103
105
|
const {
|
|
104
106
|
currentLevel
|
|
105
107
|
} = UNSAFE_useLayering();
|
|
106
|
-
const
|
|
108
|
+
const mergedModifiers = useMemo(() => [{
|
|
107
109
|
name: 'flip',
|
|
108
110
|
enabled: shouldFlip,
|
|
109
111
|
options: {
|
|
@@ -111,11 +113,11 @@ function PopperWrapper({
|
|
|
111
113
|
boundary,
|
|
112
114
|
fallbackPlacements
|
|
113
115
|
}
|
|
114
|
-
}], [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
|
|
116
|
+
}, ...(modifiers || [])], [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
|
|
115
117
|
return jsx(Popper, {
|
|
116
118
|
placement: placement,
|
|
117
119
|
offset: offset,
|
|
118
|
-
modifiers:
|
|
120
|
+
modifiers: mergedModifiers,
|
|
119
121
|
strategy: strategy
|
|
120
122
|
}, ({
|
|
121
123
|
ref,
|
|
@@ -150,7 +152,7 @@ function PopperWrapper({
|
|
|
150
152
|
tabIndex: autoFocus ? 0 : undefined,
|
|
151
153
|
shouldRenderToParent: shouldRenderToParent,
|
|
152
154
|
shouldFitContainer: shouldFitContainer
|
|
153
|
-
},
|
|
155
|
+
}, fg('platform.design-system-team.iframe_gojiv') && jsx(Global, {
|
|
154
156
|
styles: blockPointerEventsOnExternalIframeStyles
|
|
155
157
|
}), jsx(RepositionOnUpdate, {
|
|
156
158
|
update: update
|
package/dist/es2019/popup.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
/**
|
|
3
3
|
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
4
5
|
*/
|
|
5
|
-
/** @jsx jsx */
|
|
6
6
|
import { memo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
@@ -42,7 +42,8 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
42
42
|
strategy,
|
|
43
43
|
role,
|
|
44
44
|
label,
|
|
45
|
-
titleId
|
|
45
|
+
titleId,
|
|
46
|
+
modifiers
|
|
46
47
|
}) => {
|
|
47
48
|
const [triggerRef, setTriggerRef] = useState(null);
|
|
48
49
|
const getMergedTriggerRef = useGetMemoizedMergedTriggerRef();
|
|
@@ -72,7 +73,8 @@ export const Popup = /*#__PURE__*/memo(({
|
|
|
72
73
|
strategy: shouldFitContainer ? 'absolute' : strategy,
|
|
73
74
|
role: role,
|
|
74
75
|
label: label,
|
|
75
|
-
titleId: titleId
|
|
76
|
+
titleId: titleId,
|
|
77
|
+
modifiers: modifiers
|
|
76
78
|
}));
|
|
77
79
|
const popupContent = jsx(Manager, null, jsx(Reference, null, ({
|
|
78
80
|
ref
|
|
@@ -3,7 +3,6 @@ import { useEffect } from 'react';
|
|
|
3
3
|
import { bind, bindAll } from 'bind-event-listener';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { UNSAFE_useLayering } from '@atlaskit/layering';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
export const useCloseManager = ({
|
|
8
7
|
isOpen,
|
|
9
8
|
onClose,
|
|
@@ -41,7 +40,7 @@ export const useCloseManager = ({
|
|
|
41
40
|
if (!doesDomNodeExist) {
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
44
|
-
if (isLayerDisabled()
|
|
43
|
+
if (isLayerDisabled()) {
|
|
45
44
|
//if it is a disabled layer, we need to disable its click listener.
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
@@ -75,20 +74,18 @@ export const useCloseManager = ({
|
|
|
75
74
|
|
|
76
75
|
// bind onBlur event listener to fix popup not close when clicking on iframe outside
|
|
77
76
|
let unbindBlur = noop;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const wrapper = document.activeElement.closest('[data-ds--level]');
|
|
86
|
-
if (!wrapper || currentLevel > Number(wrapper.getAttribute('data-ds--level'))) {
|
|
87
|
-
closePopup(e);
|
|
88
|
-
}
|
|
77
|
+
unbindBlur = bind(window, {
|
|
78
|
+
type: 'blur',
|
|
79
|
+
listener: function onBlur(e) {
|
|
80
|
+
if (isLayerDisabled() || !(document.activeElement instanceof HTMLIFrameElement)) {
|
|
81
|
+
return;
|
|
89
82
|
}
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
const wrapper = document.activeElement.closest('[data-ds--level]');
|
|
84
|
+
if (!wrapper || currentLevel > Number(wrapper.getAttribute('data-ds--level'))) {
|
|
85
|
+
closePopup(e);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
92
89
|
return () => {
|
|
93
90
|
unbind();
|
|
94
91
|
unbindBlur();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
@@ -6,14 +7,14 @@ var _excluded = ["shouldRenderToParent", "shouldFitContainer", "children"];
|
|
|
6
7
|
var _css;
|
|
7
8
|
/**
|
|
8
9
|
* @jsxRuntime classic
|
|
10
|
+
* @jsx jsx
|
|
9
11
|
*/
|
|
10
|
-
/** @jsx jsx */
|
|
11
12
|
import { forwardRef, useMemo, useState } from 'react';
|
|
12
13
|
|
|
13
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
15
|
import { css, Global, jsx } from '@emotion/react';
|
|
15
16
|
import { UNSAFE_useLayering } from '@atlaskit/layering';
|
|
16
|
-
import {
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { Popper } from '@atlaskit/popper';
|
|
18
19
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
19
20
|
import { layers } from '@atlaskit/theme/constants';
|
|
@@ -83,7 +84,8 @@ function PopperWrapper(_ref) {
|
|
|
83
84
|
strategy = _ref.strategy,
|
|
84
85
|
role = _ref.role,
|
|
85
86
|
label = _ref.label,
|
|
86
|
-
titleId = _ref.titleId
|
|
87
|
+
titleId = _ref.titleId,
|
|
88
|
+
modifiers = _ref.modifiers;
|
|
87
89
|
var _useState = useState(null),
|
|
88
90
|
_useState2 = _slicedToArray(_useState, 2),
|
|
89
91
|
popupRef = _useState2[0],
|
|
@@ -111,7 +113,7 @@ function PopperWrapper(_ref) {
|
|
|
111
113
|
});
|
|
112
114
|
var _UNSAFE_useLayering = UNSAFE_useLayering(),
|
|
113
115
|
currentLevel = _UNSAFE_useLayering.currentLevel;
|
|
114
|
-
var
|
|
116
|
+
var mergedModifiers = useMemo(function () {
|
|
115
117
|
return [{
|
|
116
118
|
name: 'flip',
|
|
117
119
|
enabled: shouldFlip,
|
|
@@ -120,12 +122,12 @@ function PopperWrapper(_ref) {
|
|
|
120
122
|
boundary: boundary,
|
|
121
123
|
fallbackPlacements: fallbackPlacements
|
|
122
124
|
}
|
|
123
|
-
}];
|
|
124
|
-
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements]);
|
|
125
|
+
}].concat(_toConsumableArray(modifiers || []));
|
|
126
|
+
}, [shouldFlip, rootBoundary, boundary, fallbackPlacements, modifiers]);
|
|
125
127
|
return jsx(Popper, {
|
|
126
128
|
placement: placement,
|
|
127
129
|
offset: offset,
|
|
128
|
-
modifiers:
|
|
130
|
+
modifiers: mergedModifiers,
|
|
129
131
|
strategy: strategy
|
|
130
132
|
}, function (_ref2) {
|
|
131
133
|
var _ref3 = _ref2.ref,
|
|
@@ -159,7 +161,7 @@ function PopperWrapper(_ref) {
|
|
|
159
161
|
tabIndex: autoFocus ? 0 : undefined,
|
|
160
162
|
shouldRenderToParent: shouldRenderToParent,
|
|
161
163
|
shouldFitContainer: shouldFitContainer
|
|
162
|
-
},
|
|
164
|
+
}, fg('platform.design-system-team.iframe_gojiv') && jsx(Global, {
|
|
163
165
|
styles: blockPointerEventsOnExternalIframeStyles
|
|
164
166
|
}), jsx(RepositionOnUpdate, {
|
|
165
167
|
update: update
|
package/dist/esm/popup.js
CHANGED
|
@@ -2,8 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
3
3
|
/**
|
|
4
4
|
* @jsxRuntime classic
|
|
5
|
+
* @jsx jsx
|
|
5
6
|
*/
|
|
6
|
-
/** @jsx jsx */
|
|
7
7
|
import { memo, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
@@ -52,7 +52,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
52
52
|
strategy = _ref.strategy,
|
|
53
53
|
role = _ref.role,
|
|
54
54
|
label = _ref.label,
|
|
55
|
-
titleId = _ref.titleId
|
|
55
|
+
titleId = _ref.titleId,
|
|
56
|
+
modifiers = _ref.modifiers;
|
|
56
57
|
var _useState = useState(null),
|
|
57
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
58
59
|
triggerRef = _useState2[0],
|
|
@@ -84,7 +85,8 @@ export var Popup = /*#__PURE__*/memo(function (_ref) {
|
|
|
84
85
|
strategy: shouldFitContainer ? 'absolute' : strategy,
|
|
85
86
|
role: role,
|
|
86
87
|
label: label,
|
|
87
|
-
titleId: titleId
|
|
88
|
+
titleId: titleId,
|
|
89
|
+
modifiers: modifiers
|
|
88
90
|
}));
|
|
89
91
|
var popupContent = jsx(Manager, null, jsx(Reference, null, function (_ref2) {
|
|
90
92
|
var ref = _ref2.ref;
|
|
@@ -3,7 +3,6 @@ import { useEffect } from 'react';
|
|
|
3
3
|
import { bind, bindAll } from 'bind-event-listener';
|
|
4
4
|
import noop from '@atlaskit/ds-lib/noop';
|
|
5
5
|
import { UNSAFE_useLayering } from '@atlaskit/layering';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
export var useCloseManager = function useCloseManager(_ref) {
|
|
8
7
|
var isOpen = _ref.isOpen,
|
|
9
8
|
onClose = _ref.onClose,
|
|
@@ -37,7 +36,7 @@ export var useCloseManager = function useCloseManager(_ref) {
|
|
|
37
36
|
if (!doesDomNodeExist) {
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
|
-
if (isLayerDisabled()
|
|
39
|
+
if (isLayerDisabled()) {
|
|
41
40
|
//if it is a disabled layer, we need to disable its click listener.
|
|
42
41
|
return;
|
|
43
42
|
}
|
|
@@ -69,20 +68,18 @@ export var useCloseManager = function useCloseManager(_ref) {
|
|
|
69
68
|
|
|
70
69
|
// bind onBlur event listener to fix popup not close when clicking on iframe outside
|
|
71
70
|
var unbindBlur = noop;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
var wrapper = document.activeElement.closest('[data-ds--level]');
|
|
80
|
-
if (!wrapper || currentLevel > Number(wrapper.getAttribute('data-ds--level'))) {
|
|
81
|
-
closePopup(e);
|
|
82
|
-
}
|
|
71
|
+
unbindBlur = bind(window, {
|
|
72
|
+
type: 'blur',
|
|
73
|
+
listener: function onBlur(e) {
|
|
74
|
+
if (isLayerDisabled() || !(document.activeElement instanceof HTMLIFrameElement)) {
|
|
75
|
+
return;
|
|
83
76
|
}
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
var wrapper = document.activeElement.closest('[data-ds--level]');
|
|
78
|
+
if (!wrapper || currentLevel > Number(wrapper.getAttribute('data-ds--level'))) {
|
|
79
|
+
closePopup(e);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
86
83
|
return function () {
|
|
87
84
|
unbind();
|
|
88
85
|
unbindBlur();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { type PopperWrapperProps } from './types';
|
|
3
|
-
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
|
|
3
|
+
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, modifiers, }: PopperWrapperProps): jsx.JSX.Element;
|
|
4
4
|
export default PopperWrapper;
|
package/dist/types/popup.d.ts
CHANGED
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType, type CSSProperties, type Dispatch, type PropsWithChildren, type default as React, type ReactNode, type Ref, type SetStateAction } from 'react';
|
|
2
|
-
import { type Placement, type PopperChildrenProps } from '@atlaskit/popper';
|
|
2
|
+
import { type Modifier, type Placement, type PopperChildrenProps } from '@atlaskit/popper';
|
|
3
3
|
export interface TriggerProps {
|
|
4
4
|
ref: Ref<any>;
|
|
5
5
|
'aria-controls'?: string;
|
|
@@ -189,6 +189,11 @@ interface BaseProps {
|
|
|
189
189
|
* Usage of either this, or the `label` attribute is strongly recommended.
|
|
190
190
|
*/
|
|
191
191
|
titleId?: string;
|
|
192
|
+
/**
|
|
193
|
+
* Additional modifiers and modifier overwrites.
|
|
194
|
+
* for more details - https://popper.js.org/docs/v1/#modifiers
|
|
195
|
+
*/
|
|
196
|
+
modifiers?: Partial<Modifier<string, object>>[];
|
|
192
197
|
}
|
|
193
198
|
interface InternalPopupProps extends BaseProps {
|
|
194
199
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
2
|
import { type PopperWrapperProps } from './types';
|
|
3
|
-
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, }: PopperWrapperProps): jsx.JSX.Element;
|
|
3
|
+
declare function PopperWrapper({ isOpen, id, offset, testId, content, fallbackPlacements, onClose, boundary, rootBoundary, shouldFlip, placement, popupComponent: PopupContainer, autoFocus, triggerRef, shouldUseCaptureOnOutsideClick, shouldRenderToParent, shouldFitContainer, shouldDisableFocusLock, strategy, role, label, titleId, modifiers, }: PopperWrapperProps): jsx.JSX.Element;
|
|
4
4
|
export default PopperWrapper;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType, type CSSProperties, type Dispatch, type PropsWithChildren, type default as React, type ReactNode, type Ref, type SetStateAction } from 'react';
|
|
2
|
-
import { type Placement, type PopperChildrenProps } from '@atlaskit/popper';
|
|
2
|
+
import { type Modifier, type Placement, type PopperChildrenProps } from '@atlaskit/popper';
|
|
3
3
|
export interface TriggerProps {
|
|
4
4
|
ref: Ref<any>;
|
|
5
5
|
'aria-controls'?: string;
|
|
@@ -192,6 +192,11 @@ interface BaseProps {
|
|
|
192
192
|
* Usage of either this, or the `label` attribute is strongly recommended.
|
|
193
193
|
*/
|
|
194
194
|
titleId?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Additional modifiers and modifier overwrites.
|
|
197
|
+
* for more details - https://popper.js.org/docs/v1/#modifiers
|
|
198
|
+
*/
|
|
199
|
+
modifiers?: Partial<Modifier<string, object>>[];
|
|
195
200
|
}
|
|
196
201
|
interface InternalPopupProps extends BaseProps {
|
|
197
202
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/popup",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.3",
|
|
4
4
|
"description": "A popup displays brief content in an overlay.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
46
46
|
"@atlaskit/popper": "^6.1.0",
|
|
47
47
|
"@atlaskit/portal": "^4.6.0",
|
|
48
|
-
"@atlaskit/primitives": "^11.
|
|
48
|
+
"@atlaskit/primitives": "^11.1.0",
|
|
49
49
|
"@atlaskit/theme": "^12.11.0",
|
|
50
|
-
"@atlaskit/tokens": "^1.
|
|
50
|
+
"@atlaskit/tokens": "^1.56.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@emotion/react": "^11.7.1",
|
|
53
53
|
"bind-event-listener": "^3.0.0",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@af/accessibility-testing": "*",
|
|
65
65
|
"@af/visual-regression": "*",
|
|
66
|
-
"@atlaskit/button": "^
|
|
67
|
-
"@atlaskit/icon": "^22.
|
|
66
|
+
"@atlaskit/button": "^19.1.0",
|
|
67
|
+
"@atlaskit/icon": "^22.9.0",
|
|
68
68
|
"@atlaskit/ssr": "*",
|
|
69
69
|
"@atlaskit/textfield": "^6.4.0",
|
|
70
70
|
"@atlaskit/toggle": "^13.2.0",
|
|
@@ -109,9 +109,6 @@
|
|
|
109
109
|
"platform-feature-flags": {
|
|
110
110
|
"platform.design-system-team.iframe_gojiv": {
|
|
111
111
|
"type": "boolean"
|
|
112
|
-
},
|
|
113
|
-
"platform.design-system-team.iframe-layering_p3eb8": {
|
|
114
|
-
"type": "boolean"
|
|
115
112
|
}
|
|
116
113
|
},
|
|
117
114
|
"homepage": "https://atlassian.design/components/popup/"
|