@atlaskit/inline-dialog 13.1.4 → 13.1.8
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 +25 -1
- package/dist/cjs/InlineDialog/index.js +35 -12
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/InlineDialog/index.js +33 -13
- package/dist/es2019/version.json +1 -1
- package/dist/esm/InlineDialog/index.js +34 -12
- package/dist/esm/version.json +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/inline-dialog
|
|
2
2
|
|
|
3
|
+
## 13.1.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.1.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`34282240102`](https://bitbucket.org/atlassian/atlassian-frontend/commits/34282240102) - Adds explicit type to button usages components.
|
|
14
|
+
|
|
15
|
+
## 13.1.6
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`cb79dfea5d9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb79dfea5d9) - This fixes a bug in version 13.1.2 where inline dialog's `useEffect` was running synchronously and while the click event was still happening. This meant that if the open state was outside of inline dialog, there were instances where it failed to open.
|
|
20
|
+
|
|
21
|
+
## 13.1.5
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [`b94375ecf08`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b94375ecf08) - Fixes issue where enzyme is unable to access component name in snapshot tests. There should be no UI or UX change.
|
|
26
|
+
|
|
3
27
|
## 13.1.4
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -16,7 +40,7 @@
|
|
|
16
40
|
|
|
17
41
|
### Patch Changes
|
|
18
42
|
|
|
19
|
-
- [`398904f14d9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/398904f14d9) - [ux] Fixes a bug in version 13.1.0 where InlineDialog cannot be closed after it opens a Modal. There should be no other UI or UX changes.
|
|
43
|
+
- [`398904f14d9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/398904f14d9) - [ux] Fixes a bug in version 13.1.0 where InlineDialog cannot be closed after it opens a Modal. There should be no other UI or UX changes. Note that the click event listener's `capture: false` has been changed to `capture: true`. This may cause some issues with the opening or closing of the inline dialog in some situations e.g. if the open state of the inline dialog is in an outer component. You can solve this by trying to add a `preventDefault` to the click handler in the outer component or changing the inline dialog's event handler to `{ capture: true }`.
|
|
20
44
|
|
|
21
45
|
## 13.1.1
|
|
22
46
|
|
|
@@ -13,6 +13,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _core = require("@emotion/core");
|
|
15
15
|
|
|
16
|
+
var _bindEventListener = require("bind-event-listener");
|
|
17
|
+
|
|
16
18
|
var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
|
|
17
19
|
|
|
18
20
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
@@ -29,7 +31,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
29
31
|
|
|
30
32
|
/** @jsx jsx */
|
|
31
33
|
var packageName = "@atlaskit/inline-dialog";
|
|
32
|
-
var packageVersion = "13.1.
|
|
34
|
+
var packageVersion = "13.1.8";
|
|
33
35
|
|
|
34
36
|
var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
35
37
|
if (!node) {
|
|
@@ -39,7 +41,7 @@ var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
|
39
41
|
return node.classList && node.classList.contains('atlaskit-portal-container') || checkIsChildOfPortal(node.parentElement);
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
var InlineDialog = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
44
|
+
var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
43
45
|
var _ref$isOpen = _ref.isOpen,
|
|
44
46
|
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
45
47
|
_ref$onContentBlur = _ref.onContentBlur,
|
|
@@ -94,16 +96,35 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
94
96
|
}
|
|
95
97
|
}, [onClose]);
|
|
96
98
|
(0, _react.useEffect)(function () {
|
|
97
|
-
if (isOpen) {
|
|
98
|
-
|
|
99
|
-
capture: false
|
|
100
|
-
});
|
|
101
|
-
return function () {
|
|
102
|
-
window.removeEventListener('click', handleClickOutside, {
|
|
103
|
-
capture: false
|
|
104
|
-
});
|
|
105
|
-
};
|
|
99
|
+
if (!isOpen) {
|
|
100
|
+
return;
|
|
106
101
|
}
|
|
102
|
+
|
|
103
|
+
var unbind; // Under most circumstances, `useEffect` should run after an event has ended
|
|
104
|
+
// In this particular case, the popperjs library has a setState inside of a ref,
|
|
105
|
+
// which cases `useEffect` to run synchronously instead. To avoid this, we use a
|
|
106
|
+
// `setTimeout` so `useEffect` after the event. We only want to start listening
|
|
107
|
+
// for clicks after the original click event that triggered the dialog
|
|
108
|
+
// has finished. You can see more in the Codesandbox here:
|
|
109
|
+
// https://codesandbox.io/s/useeffect-and-event-timing-refs-in-state-5tys3?file=/src/App.tsx
|
|
110
|
+
|
|
111
|
+
var timeoutId = setTimeout(function () {
|
|
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
|
+
});
|
|
121
|
+
});
|
|
122
|
+
return function () {
|
|
123
|
+
var _unbind;
|
|
124
|
+
|
|
125
|
+
window.clearTimeout(timeoutId);
|
|
126
|
+
(_unbind = unbind) === null || _unbind === void 0 ? void 0 : _unbind();
|
|
127
|
+
};
|
|
107
128
|
}, [handleClickOutside, isOpen]);
|
|
108
129
|
var popper = isOpen ? (0, _core.jsx)(_popper.Popper, {
|
|
109
130
|
placement: placement
|
|
@@ -143,8 +164,10 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
143
164
|
}
|
|
144
165
|
}, children);
|
|
145
166
|
}), popper);
|
|
146
|
-
});
|
|
167
|
+
}); // enzyme relies on components having a display name
|
|
168
|
+
|
|
147
169
|
exports.InlineDialogWithoutAnalytics = InlineDialog;
|
|
170
|
+
InlineDialog.displayName = 'InlineDialog';
|
|
148
171
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
149
172
|
|
|
150
173
|
var _default = (0, _analyticsNext.withAnalyticsContext)({
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { memo, useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/core';
|
|
4
|
+
import { bind } from 'bind-event-listener';
|
|
4
5
|
import NodeResolver from 'react-node-resolver';
|
|
5
6
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
7
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
8
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
8
9
|
import { Container } from './styled/container';
|
|
9
10
|
const packageName = "@atlaskit/inline-dialog";
|
|
10
|
-
const packageVersion = "13.1.
|
|
11
|
+
const packageVersion = "13.1.8";
|
|
11
12
|
|
|
12
13
|
const checkIsChildOfPortal = node => {
|
|
13
14
|
if (!node) {
|
|
@@ -17,7 +18,7 @@ const checkIsChildOfPortal = node => {
|
|
|
17
18
|
return node.classList && node.classList.contains('atlaskit-portal-container') || checkIsChildOfPortal(node.parentElement);
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
const InlineDialog = /*#__PURE__*/memo(({
|
|
21
|
+
const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
21
22
|
isOpen = false,
|
|
22
23
|
onContentBlur = noop,
|
|
23
24
|
onContentClick = noop,
|
|
@@ -27,7 +28,7 @@ const InlineDialog = /*#__PURE__*/memo(({
|
|
|
27
28
|
testId,
|
|
28
29
|
content,
|
|
29
30
|
children
|
|
30
|
-
})
|
|
31
|
+
}) {
|
|
31
32
|
const containerRef = useRef(null);
|
|
32
33
|
const triggerRef = useRef(null);
|
|
33
34
|
const handleClickOutside = useCallback(event => {
|
|
@@ -69,16 +70,33 @@ const InlineDialog = /*#__PURE__*/memo(({
|
|
|
69
70
|
}
|
|
70
71
|
}, [onClose]);
|
|
71
72
|
useEffect(() => {
|
|
72
|
-
if (isOpen) {
|
|
73
|
-
|
|
74
|
-
capture: false
|
|
75
|
-
});
|
|
76
|
-
return () => {
|
|
77
|
-
window.removeEventListener('click', handleClickOutside, {
|
|
78
|
-
capture: false
|
|
79
|
-
});
|
|
80
|
-
};
|
|
73
|
+
if (!isOpen) {
|
|
74
|
+
return;
|
|
81
75
|
}
|
|
76
|
+
|
|
77
|
+
let unbind; // Under most circumstances, `useEffect` should run after an event has ended
|
|
78
|
+
// In this particular case, the popperjs library has a setState inside of a ref,
|
|
79
|
+
// which cases `useEffect` to run synchronously instead. To avoid this, we use a
|
|
80
|
+
// `setTimeout` so `useEffect` after the event. We only want to start listening
|
|
81
|
+
// for clicks after the original click event that triggered the dialog
|
|
82
|
+
// has finished. You can see more in the Codesandbox here:
|
|
83
|
+
// https://codesandbox.io/s/useeffect-and-event-timing-refs-in-state-5tys3?file=/src/App.tsx
|
|
84
|
+
|
|
85
|
+
const timeoutId = setTimeout(() => {
|
|
86
|
+
unbind = bind(window, {
|
|
87
|
+
type: 'click',
|
|
88
|
+
listener: event => handleClickOutside(event),
|
|
89
|
+
options: {
|
|
90
|
+
capture: false
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
return () => {
|
|
95
|
+
var _unbind;
|
|
96
|
+
|
|
97
|
+
window.clearTimeout(timeoutId);
|
|
98
|
+
(_unbind = unbind) === null || _unbind === void 0 ? void 0 : _unbind();
|
|
99
|
+
};
|
|
82
100
|
}, [handleClickOutside, isOpen]);
|
|
83
101
|
const popper = isOpen ? jsx(Popper, {
|
|
84
102
|
placement: placement
|
|
@@ -116,7 +134,9 @@ const InlineDialog = /*#__PURE__*/memo(({
|
|
|
116
134
|
}
|
|
117
135
|
}
|
|
118
136
|
}, children)), popper);
|
|
119
|
-
});
|
|
137
|
+
}); // enzyme relies on components having a display name
|
|
138
|
+
|
|
139
|
+
InlineDialog.displayName = 'InlineDialog';
|
|
120
140
|
export { InlineDialog as InlineDialogWithoutAnalytics };
|
|
121
141
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
122
142
|
export default withAnalyticsContext({
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { memo, useCallback, useEffect, useRef } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/core';
|
|
4
|
+
import { bind } from 'bind-event-listener';
|
|
4
5
|
import NodeResolver from 'react-node-resolver';
|
|
5
6
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
7
|
import noop from '@atlaskit/ds-lib/noop';
|
|
7
8
|
import { Manager, Popper, Reference } from '@atlaskit/popper';
|
|
8
9
|
import { Container } from './styled/container';
|
|
9
10
|
var packageName = "@atlaskit/inline-dialog";
|
|
10
|
-
var packageVersion = "13.1.
|
|
11
|
+
var packageVersion = "13.1.8";
|
|
11
12
|
|
|
12
13
|
var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
13
14
|
if (!node) {
|
|
@@ -17,7 +18,7 @@ var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
|
17
18
|
return node.classList && node.classList.contains('atlaskit-portal-container') || checkIsChildOfPortal(node.parentElement);
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
var InlineDialog = /*#__PURE__*/memo(function (_ref) {
|
|
21
|
+
var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
21
22
|
var _ref$isOpen = _ref.isOpen,
|
|
22
23
|
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
23
24
|
_ref$onContentBlur = _ref.onContentBlur,
|
|
@@ -72,16 +73,35 @@ var InlineDialog = /*#__PURE__*/memo(function (_ref) {
|
|
|
72
73
|
}
|
|
73
74
|
}, [onClose]);
|
|
74
75
|
useEffect(function () {
|
|
75
|
-
if (isOpen) {
|
|
76
|
-
|
|
77
|
-
capture: false
|
|
78
|
-
});
|
|
79
|
-
return function () {
|
|
80
|
-
window.removeEventListener('click', handleClickOutside, {
|
|
81
|
-
capture: false
|
|
82
|
-
});
|
|
83
|
-
};
|
|
76
|
+
if (!isOpen) {
|
|
77
|
+
return;
|
|
84
78
|
}
|
|
79
|
+
|
|
80
|
+
var unbind; // Under most circumstances, `useEffect` should run after an event has ended
|
|
81
|
+
// In this particular case, the popperjs library has a setState inside of a ref,
|
|
82
|
+
// which cases `useEffect` to run synchronously instead. To avoid this, we use a
|
|
83
|
+
// `setTimeout` so `useEffect` after the event. We only want to start listening
|
|
84
|
+
// for clicks after the original click event that triggered the dialog
|
|
85
|
+
// has finished. You can see more in the Codesandbox here:
|
|
86
|
+
// https://codesandbox.io/s/useeffect-and-event-timing-refs-in-state-5tys3?file=/src/App.tsx
|
|
87
|
+
|
|
88
|
+
var timeoutId = setTimeout(function () {
|
|
89
|
+
unbind = bind(window, {
|
|
90
|
+
type: 'click',
|
|
91
|
+
listener: function listener(event) {
|
|
92
|
+
return handleClickOutside(event);
|
|
93
|
+
},
|
|
94
|
+
options: {
|
|
95
|
+
capture: false
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
return function () {
|
|
100
|
+
var _unbind;
|
|
101
|
+
|
|
102
|
+
window.clearTimeout(timeoutId);
|
|
103
|
+
(_unbind = unbind) === null || _unbind === void 0 ? void 0 : _unbind();
|
|
104
|
+
};
|
|
85
105
|
}, [handleClickOutside, isOpen]);
|
|
86
106
|
var popper = isOpen ? jsx(Popper, {
|
|
87
107
|
placement: placement
|
|
@@ -121,7 +141,9 @@ var InlineDialog = /*#__PURE__*/memo(function (_ref) {
|
|
|
121
141
|
}
|
|
122
142
|
}, children);
|
|
123
143
|
}), popper);
|
|
124
|
-
});
|
|
144
|
+
}); // enzyme relies on components having a display name
|
|
145
|
+
|
|
146
|
+
InlineDialog.displayName = 'InlineDialog';
|
|
125
147
|
export { InlineDialog as InlineDialogWithoutAnalytics };
|
|
126
148
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
127
149
|
export default withAnalyticsContext({
|
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.1.
|
|
3
|
+
"version": "13.1.8",
|
|
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/"
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
"@atlaskit/ds-lib": "^1.3.0",
|
|
29
29
|
"@atlaskit/popper": "^5.0.0",
|
|
30
30
|
"@atlaskit/theme": "^12.0.0",
|
|
31
|
-
"@atlaskit/tokens": "^0.
|
|
31
|
+
"@atlaskit/tokens": "^0.3.0",
|
|
32
32
|
"@babel/runtime": "^7.0.0",
|
|
33
33
|
"@emotion/core": "^10.0.9",
|
|
34
|
+
"bind-event-listener": "^1.0.2",
|
|
34
35
|
"react-node-resolver": "^1.0.1"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
@@ -39,13 +40,12 @@
|
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@atlaskit/build-utils": "*",
|
|
41
42
|
"@atlaskit/button": "^16.1.0",
|
|
42
|
-
"@atlaskit/datetime-picker": "^11.
|
|
43
|
+
"@atlaskit/datetime-picker": "^11.1.0",
|
|
43
44
|
"@atlaskit/docs": "*",
|
|
44
45
|
"@atlaskit/icon": "^21.9.0",
|
|
45
|
-
"@atlaskit/modal-dialog": "^12.0
|
|
46
|
+
"@atlaskit/modal-dialog": "^12.1.0",
|
|
46
47
|
"@atlaskit/section-message": "^6.1.0",
|
|
47
48
|
"@atlaskit/select": "^15.0.0",
|
|
48
|
-
"@atlaskit/single-select": "^10.0.0",
|
|
49
49
|
"@atlaskit/ssr": "*",
|
|
50
50
|
"@atlaskit/visual-regression": "*",
|
|
51
51
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@repo/internal": {
|
|
70
70
|
"analytics": "analytics-next",
|
|
71
71
|
"theming": [
|
|
72
|
-
"
|
|
72
|
+
"react-context",
|
|
73
73
|
"tokens"
|
|
74
74
|
],
|
|
75
75
|
"styling": "emotion",
|