@atlaskit/inline-dialog 13.1.9 → 13.2.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.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/InlineDialog/index.js +22 -33
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/InlineDialog/index.js +20 -31
- package/dist/es2019/version.json +1 -1
- package/dist/esm/InlineDialog/index.js +22 -33
- package/dist/esm/version.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/inline-dialog
|
|
2
2
|
|
|
3
|
+
## 13.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2fe0d03807f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2fe0d03807f) - This removes the preventDefault functionality (reverts it back to the previous version of inline dialog where event listeners were added in the capture phase). It also refactors handleClickOutside so that it is now triggered by a ref.
|
|
8
|
+
|
|
3
9
|
## 13.1.9
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -31,7 +31,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
31
|
|
|
32
32
|
/** @jsx jsx */
|
|
33
33
|
var packageName = "@atlaskit/inline-dialog";
|
|
34
|
-
var packageVersion = "13.
|
|
34
|
+
var packageVersion = "13.2.0";
|
|
35
35
|
|
|
36
36
|
var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
37
37
|
if (!node) {
|
|
@@ -58,12 +58,13 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
|
58
58
|
content = _ref.content,
|
|
59
59
|
children = _ref.children;
|
|
60
60
|
var containerRef = (0, _react.useRef)(null);
|
|
61
|
-
var triggerRef = (0, _react.useRef)(null);
|
|
62
|
-
var handleClickOutside = (0, _react.useCallback)(function (event) {
|
|
63
|
-
if (event.defaultPrevented) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
61
|
+
var triggerRef = (0, _react.useRef)(null); // we put this into a ref to avoid handleClickOutside having this as a dependency
|
|
66
62
|
|
|
63
|
+
var onCloseRef = (0, _react.useRef)(onClose);
|
|
64
|
+
(0, _react.useEffect)(function () {
|
|
65
|
+
onCloseRef.current = onClose;
|
|
66
|
+
});
|
|
67
|
+
var handleClickOutside = (0, _react.useCallback)(function (event) {
|
|
67
68
|
var target = event.target; // checks for when target is not HTMLElement
|
|
68
69
|
|
|
69
70
|
if (!(target instanceof HTMLElement)) {
|
|
@@ -89,43 +90,31 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
|
89
90
|
|
|
90
91
|
|
|
91
92
|
if (containerRef.current && !containerRef.current.contains(target)) {
|
|
92
|
-
|
|
93
|
+
var _onCloseRef$current;
|
|
94
|
+
|
|
95
|
+
(_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 ? void 0 : _onCloseRef$current.call(onCloseRef, {
|
|
93
96
|
isOpen: false,
|
|
94
97
|
event: event
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
|
-
}, [
|
|
100
|
+
}, []);
|
|
98
101
|
(0, _react.useEffect)(function () {
|
|
99
102
|
if (!isOpen) {
|
|
100
103
|
return;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
var unbind;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
unbind = (0, _bindEventListener.bind)(window, {
|
|
113
|
-
type: 'click',
|
|
114
|
-
listener: function listener(event) {
|
|
115
|
-
return handleClickOutside(event);
|
|
116
|
-
},
|
|
117
|
-
options: {
|
|
118
|
-
capture: false
|
|
119
|
-
}
|
|
120
|
-
});
|
|
106
|
+
var unbind;
|
|
107
|
+
unbind = (0, _bindEventListener.bind)(window, {
|
|
108
|
+
type: 'click',
|
|
109
|
+
listener: function listener(e) {
|
|
110
|
+
return handleClickOutside(e);
|
|
111
|
+
},
|
|
112
|
+
options: {
|
|
113
|
+
capture: true
|
|
114
|
+
}
|
|
121
115
|
});
|
|
122
|
-
return
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
window.clearTimeout(timeoutId);
|
|
126
|
-
(_unbind = unbind) === null || _unbind === void 0 ? void 0 : _unbind();
|
|
127
|
-
};
|
|
128
|
-
}, [handleClickOutside, isOpen]);
|
|
116
|
+
return unbind;
|
|
117
|
+
}, [isOpen, handleClickOutside]);
|
|
129
118
|
var popper = isOpen ? (0, _core.jsx)(_popper.Popper, {
|
|
130
119
|
placement: placement
|
|
131
120
|
}, function (_ref2) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -8,7 +8,7 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
8
8
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
9
9
|
import { Container } from './styled/container';
|
|
10
10
|
const packageName = "@atlaskit/inline-dialog";
|
|
11
|
-
const packageVersion = "13.
|
|
11
|
+
const packageVersion = "13.2.0";
|
|
12
12
|
|
|
13
13
|
const checkIsChildOfPortal = node => {
|
|
14
14
|
if (!node) {
|
|
@@ -30,12 +30,13 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
30
30
|
children
|
|
31
31
|
}) {
|
|
32
32
|
const containerRef = useRef(null);
|
|
33
|
-
const triggerRef = useRef(null);
|
|
34
|
-
const handleClickOutside = useCallback(event => {
|
|
35
|
-
if (event.defaultPrevented) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
33
|
+
const triggerRef = useRef(null); // we put this into a ref to avoid handleClickOutside having this as a dependency
|
|
38
34
|
|
|
35
|
+
const onCloseRef = useRef(onClose);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
onCloseRef.current = onClose;
|
|
38
|
+
});
|
|
39
|
+
const handleClickOutside = useCallback(event => {
|
|
39
40
|
const {
|
|
40
41
|
target
|
|
41
42
|
} = event; // checks for when target is not HTMLElement
|
|
@@ -63,41 +64,29 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
63
64
|
|
|
64
65
|
|
|
65
66
|
if (containerRef.current && !containerRef.current.contains(target)) {
|
|
66
|
-
|
|
67
|
+
var _onCloseRef$current;
|
|
68
|
+
|
|
69
|
+
(_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 ? void 0 : _onCloseRef$current.call(onCloseRef, {
|
|
67
70
|
isOpen: false,
|
|
68
71
|
event: event
|
|
69
72
|
});
|
|
70
73
|
}
|
|
71
|
-
}, [
|
|
74
|
+
}, []);
|
|
72
75
|
useEffect(() => {
|
|
73
76
|
if (!isOpen) {
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
|
-
let unbind;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const timeoutId = setTimeout(() => {
|
|
86
|
-
unbind = bind(window, {
|
|
87
|
-
type: 'click',
|
|
88
|
-
listener: event => handleClickOutside(event),
|
|
89
|
-
options: {
|
|
90
|
-
capture: false
|
|
91
|
-
}
|
|
92
|
-
});
|
|
80
|
+
let unbind;
|
|
81
|
+
unbind = bind(window, {
|
|
82
|
+
type: 'click',
|
|
83
|
+
listener: e => handleClickOutside(e),
|
|
84
|
+
options: {
|
|
85
|
+
capture: true
|
|
86
|
+
}
|
|
93
87
|
});
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
window.clearTimeout(timeoutId);
|
|
98
|
-
(_unbind = unbind) === null || _unbind === void 0 ? void 0 : _unbind();
|
|
99
|
-
};
|
|
100
|
-
}, [handleClickOutside, isOpen]);
|
|
88
|
+
return unbind;
|
|
89
|
+
}, [isOpen, handleClickOutside]);
|
|
101
90
|
const popper = isOpen ? jsx(Popper, {
|
|
102
91
|
placement: placement
|
|
103
92
|
}, ({
|
package/dist/es2019/version.json
CHANGED
|
@@ -8,7 +8,7 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
8
8
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
9
9
|
import { Container } from './styled/container';
|
|
10
10
|
var packageName = "@atlaskit/inline-dialog";
|
|
11
|
-
var packageVersion = "13.
|
|
11
|
+
var packageVersion = "13.2.0";
|
|
12
12
|
|
|
13
13
|
var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
14
14
|
if (!node) {
|
|
@@ -35,12 +35,13 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
|
35
35
|
content = _ref.content,
|
|
36
36
|
children = _ref.children;
|
|
37
37
|
var containerRef = useRef(null);
|
|
38
|
-
var triggerRef = useRef(null);
|
|
39
|
-
var handleClickOutside = useCallback(function (event) {
|
|
40
|
-
if (event.defaultPrevented) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
38
|
+
var triggerRef = useRef(null); // we put this into a ref to avoid handleClickOutside having this as a dependency
|
|
43
39
|
|
|
40
|
+
var onCloseRef = useRef(onClose);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
onCloseRef.current = onClose;
|
|
43
|
+
});
|
|
44
|
+
var handleClickOutside = useCallback(function (event) {
|
|
44
45
|
var target = event.target; // checks for when target is not HTMLElement
|
|
45
46
|
|
|
46
47
|
if (!(target instanceof HTMLElement)) {
|
|
@@ -66,43 +67,31 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
|
66
67
|
|
|
67
68
|
|
|
68
69
|
if (containerRef.current && !containerRef.current.contains(target)) {
|
|
69
|
-
|
|
70
|
+
var _onCloseRef$current;
|
|
71
|
+
|
|
72
|
+
(_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 ? void 0 : _onCloseRef$current.call(onCloseRef, {
|
|
70
73
|
isOpen: false,
|
|
71
74
|
event: event
|
|
72
75
|
});
|
|
73
76
|
}
|
|
74
|
-
}, [
|
|
77
|
+
}, []);
|
|
75
78
|
useEffect(function () {
|
|
76
79
|
if (!isOpen) {
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
|
-
var unbind;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
unbind = bind(window, {
|
|
90
|
-
type: 'click',
|
|
91
|
-
listener: function listener(event) {
|
|
92
|
-
return handleClickOutside(event);
|
|
93
|
-
},
|
|
94
|
-
options: {
|
|
95
|
-
capture: false
|
|
96
|
-
}
|
|
97
|
-
});
|
|
83
|
+
var unbind;
|
|
84
|
+
unbind = bind(window, {
|
|
85
|
+
type: 'click',
|
|
86
|
+
listener: function listener(e) {
|
|
87
|
+
return handleClickOutside(e);
|
|
88
|
+
},
|
|
89
|
+
options: {
|
|
90
|
+
capture: true
|
|
91
|
+
}
|
|
98
92
|
});
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
window.clearTimeout(timeoutId);
|
|
103
|
-
(_unbind = unbind) === null || _unbind === void 0 ? void 0 : _unbind();
|
|
104
|
-
};
|
|
105
|
-
}, [handleClickOutside, isOpen]);
|
|
93
|
+
return unbind;
|
|
94
|
+
}, [isOpen, handleClickOutside]);
|
|
106
95
|
var popper = isOpen ? jsx(Popper, {
|
|
107
96
|
placement: placement
|
|
108
97
|
}, function (_ref2) {
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/inline-dialog",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.0",
|
|
4
4
|
"description": "An inline dialog is a pop-up container for small amounts of information. It can also contain controls.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|