@atlaskit/inline-dialog 13.4.5 → 13.4.7
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 +12 -0
- package/dist/cjs/InlineDialog/index.js +32 -52
- package/dist/cjs/InlineDialog/styled/container.js +6 -21
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/InlineDialog/index.js +14 -20
- package/dist/es2019/InlineDialog/styled/container.js +1 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/InlineDialog/index.js +31 -37
- package/dist/esm/InlineDialog/styled/container.js +6 -13
- package/dist/esm/version.json +1 -1
- package/package.json +3 -3
- package/report.api.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/inline-dialog
|
|
2
2
|
|
|
3
|
+
## 13.4.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.4.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`18aeca8c199`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18aeca8c199) - Internal change to update token references. There is no expected behaviour or visual change.
|
|
14
|
+
|
|
3
15
|
## 13.4.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,99 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.InlineDialogWithoutAnalytics = void 0;
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
|
|
14
10
|
var _react2 = require("@emotion/react");
|
|
15
|
-
|
|
16
11
|
var _bindEventListener = require("bind-event-listener");
|
|
17
|
-
|
|
18
12
|
var _reactNodeResolver = _interopRequireDefault(require("react-node-resolver"));
|
|
19
|
-
|
|
20
13
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
21
|
-
|
|
22
14
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
23
|
-
|
|
24
15
|
var _popper = require("@atlaskit/popper");
|
|
25
|
-
|
|
26
16
|
var _container = require("./styled/container");
|
|
27
|
-
|
|
28
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
-
|
|
30
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
-
|
|
32
19
|
/** @jsx jsx */
|
|
33
|
-
var packageName = "@atlaskit/inline-dialog";
|
|
34
|
-
var packageVersion = "13.4.5";
|
|
35
20
|
|
|
21
|
+
var packageName = "@atlaskit/inline-dialog";
|
|
22
|
+
var packageVersion = "13.4.7";
|
|
36
23
|
var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
37
24
|
if (!node) {
|
|
38
25
|
return false;
|
|
39
26
|
}
|
|
40
|
-
|
|
41
27
|
return node.classList && node.classList.contains('atlaskit-portal-container') || checkIsChildOfPortal(node.parentElement);
|
|
42
28
|
};
|
|
43
|
-
|
|
44
29
|
var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
45
30
|
var _ref$isOpen = _ref.isOpen,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
31
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
32
|
+
_ref$onContentBlur = _ref.onContentBlur,
|
|
33
|
+
onContentBlur = _ref$onContentBlur === void 0 ? _noop.default : _ref$onContentBlur,
|
|
34
|
+
_ref$onContentClick = _ref.onContentClick,
|
|
35
|
+
onContentClick = _ref$onContentClick === void 0 ? _noop.default : _ref$onContentClick,
|
|
36
|
+
_ref$onContentFocus = _ref.onContentFocus,
|
|
37
|
+
onContentFocus = _ref$onContentFocus === void 0 ? _noop.default : _ref$onContentFocus,
|
|
38
|
+
_ref$onClose = _ref.onClose,
|
|
39
|
+
onClose = _ref$onClose === void 0 ? _noop.default : _ref$onClose,
|
|
40
|
+
_ref$placement = _ref.placement,
|
|
41
|
+
placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
|
|
42
|
+
_ref$strategy = _ref.strategy,
|
|
43
|
+
strategy = _ref$strategy === void 0 ? 'fixed' : _ref$strategy,
|
|
44
|
+
testId = _ref.testId,
|
|
45
|
+
content = _ref.content,
|
|
46
|
+
children = _ref.children;
|
|
62
47
|
var containerRef = (0, _react.useRef)(null);
|
|
63
|
-
var triggerRef = (0, _react.useRef)(null);
|
|
64
|
-
|
|
48
|
+
var triggerRef = (0, _react.useRef)(null);
|
|
49
|
+
// we put this into a ref to avoid handleClickOutside having this as a dependency
|
|
65
50
|
var onCloseRef = (0, _react.useRef)(onClose);
|
|
66
51
|
(0, _react.useEffect)(function () {
|
|
67
52
|
onCloseRef.current = onClose;
|
|
68
53
|
});
|
|
69
54
|
var handleClickOutside = (0, _react.useCallback)(function (event) {
|
|
70
|
-
var target = event.target;
|
|
55
|
+
var target = event.target;
|
|
71
56
|
|
|
57
|
+
// checks for when target is not HTMLElement
|
|
72
58
|
if (!(target instanceof HTMLElement)) {
|
|
73
59
|
return;
|
|
74
|
-
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// TODO: This is to handle the case where the target is no longer in the DOM.
|
|
75
63
|
// This happens with react-select in datetime picker. There might be other
|
|
76
64
|
// edge cases for this.
|
|
77
|
-
|
|
78
|
-
|
|
79
65
|
if (!document.body.contains(target)) {
|
|
80
66
|
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
67
|
+
}
|
|
83
68
|
|
|
69
|
+
// exit if we click outside but on the trigger — it can handle the clicks itself
|
|
84
70
|
if (triggerRef.current && triggerRef.current.contains(target)) {
|
|
85
71
|
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
72
|
+
}
|
|
88
73
|
|
|
74
|
+
// handles the case where inline dialog opens portalled elements such as modal
|
|
89
75
|
if (checkIsChildOfPortal(target)) {
|
|
90
76
|
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
77
|
+
}
|
|
93
78
|
|
|
79
|
+
// call onClose if the click originated from outside the dialog
|
|
94
80
|
if (containerRef.current && !containerRef.current.contains(target)) {
|
|
95
81
|
var _onCloseRef$current;
|
|
96
|
-
|
|
97
82
|
(_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 ? void 0 : _onCloseRef$current.call(onCloseRef, {
|
|
98
83
|
isOpen: false,
|
|
99
84
|
event: event
|
|
@@ -104,7 +89,6 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
|
104
89
|
if (!isOpen) {
|
|
105
90
|
return;
|
|
106
91
|
}
|
|
107
|
-
|
|
108
92
|
var unbind = (0, _bindEventListener.bind)(window, {
|
|
109
93
|
type: 'click',
|
|
110
94
|
listener: handleClickOutside,
|
|
@@ -119,7 +103,7 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
|
119
103
|
strategy: strategy
|
|
120
104
|
}, function (_ref2) {
|
|
121
105
|
var _ref3 = _ref2.ref,
|
|
122
|
-
|
|
106
|
+
style = _ref2.style;
|
|
123
107
|
return (0, _react2.jsx)(_container.Container, {
|
|
124
108
|
onBlur: onContentBlur,
|
|
125
109
|
onFocus: onContentFocus,
|
|
@@ -127,7 +111,6 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
|
127
111
|
ref: function ref(node) {
|
|
128
112
|
if (node) {
|
|
129
113
|
containerRef.current = node;
|
|
130
|
-
|
|
131
114
|
if (typeof _ref3 === 'function') {
|
|
132
115
|
_ref3(node);
|
|
133
116
|
} else {
|
|
@@ -144,7 +127,6 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
|
144
127
|
return (0, _react2.jsx)(_reactNodeResolver.default, {
|
|
145
128
|
innerRef: function innerRef(node) {
|
|
146
129
|
triggerRef.current = node;
|
|
147
|
-
|
|
148
130
|
if (typeof ref === 'function') {
|
|
149
131
|
ref(node);
|
|
150
132
|
} else {
|
|
@@ -157,7 +139,6 @@ var InlineDialog = /*#__PURE__*/(0, _react.memo)(function InlineDialog(_ref) {
|
|
|
157
139
|
exports.InlineDialogWithoutAnalytics = InlineDialog;
|
|
158
140
|
InlineDialog.displayName = 'InlineDialog';
|
|
159
141
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
160
|
-
|
|
161
142
|
var _default = (0, _analyticsNext.withAnalyticsContext)({
|
|
162
143
|
componentName: 'inlineDialog',
|
|
163
144
|
packageName: packageName,
|
|
@@ -173,5 +154,4 @@ var _default = (0, _analyticsNext.withAnalyticsContext)({
|
|
|
173
154
|
}
|
|
174
155
|
})
|
|
175
156
|
})(InlineDialog));
|
|
176
|
-
|
|
177
157
|
exports.default = _default;
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.Container = void 0;
|
|
11
|
-
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _react2 = require("@emotion/react");
|
|
17
|
-
|
|
18
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
-
|
|
20
13
|
var _components = require("@atlaskit/theme/components");
|
|
21
|
-
|
|
22
14
|
var _constants = require("@atlaskit/theme/constants");
|
|
23
|
-
|
|
24
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
|
|
26
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
-
|
|
28
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
-
|
|
30
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
-
|
|
32
19
|
var themedBackground = (0, _components.themed)({
|
|
33
20
|
light: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
34
21
|
dark: "var(--ds-surface-overlay, ".concat(_colors.DN50, ")")
|
|
@@ -50,7 +37,7 @@ var containerStyles = (0, _react2.css)({
|
|
|
50
37
|
boxSizing: 'content-box',
|
|
51
38
|
maxWidth: "".concat(gridSize * 56, "px"),
|
|
52
39
|
maxHeight: "".concat(gridSize * 56, "px"),
|
|
53
|
-
padding: "var(--ds-
|
|
40
|
+
padding: "var(--ds-space-200, 16px)".concat(" ", "var(--ds-space-300, 24px)"),
|
|
54
41
|
zIndex: _constants.layers.dialog(),
|
|
55
42
|
background: "var(".concat(CSS_THEME_BACKGROUND, ")"),
|
|
56
43
|
borderRadius: "".concat(borderRadius, "px"),
|
|
@@ -60,7 +47,6 @@ var containerStyles = (0, _react2.css)({
|
|
|
60
47
|
outline: 'none'
|
|
61
48
|
}
|
|
62
49
|
});
|
|
63
|
-
|
|
64
50
|
/**
|
|
65
51
|
* __Container__
|
|
66
52
|
*
|
|
@@ -70,13 +56,12 @@ var containerStyles = (0, _react2.css)({
|
|
|
70
56
|
*/
|
|
71
57
|
var Container = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
72
58
|
var _objectSpread2;
|
|
73
|
-
|
|
74
59
|
var children = _ref.children,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
onBlur = _ref.onBlur,
|
|
61
|
+
onClick = _ref.onClick,
|
|
62
|
+
onFocus = _ref.onFocus,
|
|
63
|
+
style = _ref.style,
|
|
64
|
+
testId = _ref.testId;
|
|
80
65
|
var theme = (0, _components.useGlobalTheme)();
|
|
81
66
|
return (0, _react2.jsx)("div", {
|
|
82
67
|
css: containerStyles,
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -11,5 +10,4 @@ Object.defineProperty(exports, "default", {
|
|
|
11
10
|
return _InlineDialog.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
var _InlineDialog = _interopRequireDefault(require("./InlineDialog"));
|
package/dist/cjs/version.json
CHANGED
|
@@ -8,16 +8,13 @@ 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.4.
|
|
12
|
-
|
|
11
|
+
const packageVersion = "13.4.7";
|
|
13
12
|
const checkIsChildOfPortal = node => {
|
|
14
13
|
if (!node) {
|
|
15
14
|
return false;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
return node.classList && node.classList.contains('atlaskit-portal-container') || checkIsChildOfPortal(node.parentElement);
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
22
19
|
isOpen = false,
|
|
23
20
|
onContentBlur = noop,
|
|
@@ -31,8 +28,8 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
31
28
|
children
|
|
32
29
|
}) {
|
|
33
30
|
const containerRef = useRef(null);
|
|
34
|
-
const triggerRef = useRef(null);
|
|
35
|
-
|
|
31
|
+
const triggerRef = useRef(null);
|
|
32
|
+
// we put this into a ref to avoid handleClickOutside having this as a dependency
|
|
36
33
|
const onCloseRef = useRef(onClose);
|
|
37
34
|
useEffect(() => {
|
|
38
35
|
onCloseRef.current = onClose;
|
|
@@ -40,33 +37,33 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
40
37
|
const handleClickOutside = useCallback(event => {
|
|
41
38
|
const {
|
|
42
39
|
target
|
|
43
|
-
} = event;
|
|
40
|
+
} = event;
|
|
44
41
|
|
|
42
|
+
// checks for when target is not HTMLElement
|
|
45
43
|
if (!(target instanceof HTMLElement)) {
|
|
46
44
|
return;
|
|
47
|
-
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// TODO: This is to handle the case where the target is no longer in the DOM.
|
|
48
48
|
// This happens with react-select in datetime picker. There might be other
|
|
49
49
|
// edge cases for this.
|
|
50
|
-
|
|
51
|
-
|
|
52
50
|
if (!document.body.contains(target)) {
|
|
53
51
|
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
52
|
+
}
|
|
56
53
|
|
|
54
|
+
// exit if we click outside but on the trigger — it can handle the clicks itself
|
|
57
55
|
if (triggerRef.current && triggerRef.current.contains(target)) {
|
|
58
56
|
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
57
|
+
}
|
|
61
58
|
|
|
59
|
+
// handles the case where inline dialog opens portalled elements such as modal
|
|
62
60
|
if (checkIsChildOfPortal(target)) {
|
|
63
61
|
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
62
|
+
}
|
|
66
63
|
|
|
64
|
+
// call onClose if the click originated from outside the dialog
|
|
67
65
|
if (containerRef.current && !containerRef.current.contains(target)) {
|
|
68
66
|
var _onCloseRef$current;
|
|
69
|
-
|
|
70
67
|
(_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 ? void 0 : _onCloseRef$current.call(onCloseRef, {
|
|
71
68
|
isOpen: false,
|
|
72
69
|
event: event
|
|
@@ -77,7 +74,6 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
77
74
|
if (!isOpen) {
|
|
78
75
|
return;
|
|
79
76
|
}
|
|
80
|
-
|
|
81
77
|
const unbind = bind(window, {
|
|
82
78
|
type: 'click',
|
|
83
79
|
listener: handleClickOutside,
|
|
@@ -100,7 +96,6 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
100
96
|
ref: node => {
|
|
101
97
|
if (node) {
|
|
102
98
|
containerRef.current = node;
|
|
103
|
-
|
|
104
99
|
if (typeof ref === 'function') {
|
|
105
100
|
ref(node);
|
|
106
101
|
} else {
|
|
@@ -116,7 +111,6 @@ const InlineDialog = /*#__PURE__*/memo(function InlineDialog({
|
|
|
116
111
|
}) => jsx(NodeResolver, {
|
|
117
112
|
innerRef: node => {
|
|
118
113
|
triggerRef.current = node;
|
|
119
|
-
|
|
120
114
|
if (typeof ref === 'function') {
|
|
121
115
|
ref(node);
|
|
122
116
|
} else {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
2
|
-
|
|
3
2
|
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
4
|
-
|
|
5
3
|
/** @jsx jsx */
|
|
6
4
|
import React, { forwardRef } from 'react';
|
|
7
5
|
import { css, jsx } from '@emotion/react';
|
|
@@ -29,7 +27,7 @@ const containerStyles = css({
|
|
|
29
27
|
boxSizing: 'content-box',
|
|
30
28
|
maxWidth: `${gridSize * 56}px`,
|
|
31
29
|
maxHeight: `${gridSize * 56}px`,
|
|
32
|
-
padding: `${"var(--ds-
|
|
30
|
+
padding: `${"var(--ds-space-200, 16px)"} ${"var(--ds-space-300, 24px)"}`,
|
|
33
31
|
zIndex: layers.dialog(),
|
|
34
32
|
background: `var(${CSS_THEME_BACKGROUND})`,
|
|
35
33
|
borderRadius: `${borderRadius}px`,
|
|
@@ -39,7 +37,6 @@ const containerStyles = css({
|
|
|
39
37
|
outline: 'none'
|
|
40
38
|
}
|
|
41
39
|
});
|
|
42
|
-
|
|
43
40
|
/**
|
|
44
41
|
* __Container__
|
|
45
42
|
*
|
package/dist/es2019/version.json
CHANGED
|
@@ -8,69 +8,66 @@ 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.4.
|
|
12
|
-
|
|
11
|
+
var packageVersion = "13.4.7";
|
|
13
12
|
var checkIsChildOfPortal = function checkIsChildOfPortal(node) {
|
|
14
13
|
if (!node) {
|
|
15
14
|
return false;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
return node.classList && node.classList.contains('atlaskit-portal-container') || checkIsChildOfPortal(node.parentElement);
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
22
19
|
var _ref$isOpen = _ref.isOpen,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
21
|
+
_ref$onContentBlur = _ref.onContentBlur,
|
|
22
|
+
onContentBlur = _ref$onContentBlur === void 0 ? noop : _ref$onContentBlur,
|
|
23
|
+
_ref$onContentClick = _ref.onContentClick,
|
|
24
|
+
onContentClick = _ref$onContentClick === void 0 ? noop : _ref$onContentClick,
|
|
25
|
+
_ref$onContentFocus = _ref.onContentFocus,
|
|
26
|
+
onContentFocus = _ref$onContentFocus === void 0 ? noop : _ref$onContentFocus,
|
|
27
|
+
_ref$onClose = _ref.onClose,
|
|
28
|
+
onClose = _ref$onClose === void 0 ? noop : _ref$onClose,
|
|
29
|
+
_ref$placement = _ref.placement,
|
|
30
|
+
placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
|
|
31
|
+
_ref$strategy = _ref.strategy,
|
|
32
|
+
strategy = _ref$strategy === void 0 ? 'fixed' : _ref$strategy,
|
|
33
|
+
testId = _ref.testId,
|
|
34
|
+
content = _ref.content,
|
|
35
|
+
children = _ref.children;
|
|
39
36
|
var containerRef = useRef(null);
|
|
40
|
-
var triggerRef = useRef(null);
|
|
41
|
-
|
|
37
|
+
var triggerRef = useRef(null);
|
|
38
|
+
// we put this into a ref to avoid handleClickOutside having this as a dependency
|
|
42
39
|
var onCloseRef = useRef(onClose);
|
|
43
40
|
useEffect(function () {
|
|
44
41
|
onCloseRef.current = onClose;
|
|
45
42
|
});
|
|
46
43
|
var handleClickOutside = useCallback(function (event) {
|
|
47
|
-
var target = event.target;
|
|
44
|
+
var target = event.target;
|
|
48
45
|
|
|
46
|
+
// checks for when target is not HTMLElement
|
|
49
47
|
if (!(target instanceof HTMLElement)) {
|
|
50
48
|
return;
|
|
51
|
-
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// TODO: This is to handle the case where the target is no longer in the DOM.
|
|
52
52
|
// This happens with react-select in datetime picker. There might be other
|
|
53
53
|
// edge cases for this.
|
|
54
|
-
|
|
55
|
-
|
|
56
54
|
if (!document.body.contains(target)) {
|
|
57
55
|
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
56
|
+
}
|
|
60
57
|
|
|
58
|
+
// exit if we click outside but on the trigger — it can handle the clicks itself
|
|
61
59
|
if (triggerRef.current && triggerRef.current.contains(target)) {
|
|
62
60
|
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
61
|
+
}
|
|
65
62
|
|
|
63
|
+
// handles the case where inline dialog opens portalled elements such as modal
|
|
66
64
|
if (checkIsChildOfPortal(target)) {
|
|
67
65
|
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
66
|
+
}
|
|
70
67
|
|
|
68
|
+
// call onClose if the click originated from outside the dialog
|
|
71
69
|
if (containerRef.current && !containerRef.current.contains(target)) {
|
|
72
70
|
var _onCloseRef$current;
|
|
73
|
-
|
|
74
71
|
(_onCloseRef$current = onCloseRef.current) === null || _onCloseRef$current === void 0 ? void 0 : _onCloseRef$current.call(onCloseRef, {
|
|
75
72
|
isOpen: false,
|
|
76
73
|
event: event
|
|
@@ -81,7 +78,6 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
|
81
78
|
if (!isOpen) {
|
|
82
79
|
return;
|
|
83
80
|
}
|
|
84
|
-
|
|
85
81
|
var unbind = bind(window, {
|
|
86
82
|
type: 'click',
|
|
87
83
|
listener: handleClickOutside,
|
|
@@ -96,7 +92,7 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
|
96
92
|
strategy: strategy
|
|
97
93
|
}, function (_ref2) {
|
|
98
94
|
var _ref3 = _ref2.ref,
|
|
99
|
-
|
|
95
|
+
style = _ref2.style;
|
|
100
96
|
return jsx(Container, {
|
|
101
97
|
onBlur: onContentBlur,
|
|
102
98
|
onFocus: onContentFocus,
|
|
@@ -104,7 +100,6 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
|
104
100
|
ref: function ref(node) {
|
|
105
101
|
if (node) {
|
|
106
102
|
containerRef.current = node;
|
|
107
|
-
|
|
108
103
|
if (typeof _ref3 === 'function') {
|
|
109
104
|
_ref3(node);
|
|
110
105
|
} else {
|
|
@@ -121,7 +116,6 @@ var InlineDialog = /*#__PURE__*/memo(function InlineDialog(_ref) {
|
|
|
121
116
|
return jsx(NodeResolver, {
|
|
122
117
|
innerRef: function innerRef(node) {
|
|
123
118
|
triggerRef.current = node;
|
|
124
|
-
|
|
125
119
|
if (typeof ref === 'function') {
|
|
126
120
|
ref(node);
|
|
127
121
|
} else {
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
8
|
-
|
|
9
5
|
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
10
|
-
|
|
11
6
|
/** @jsx jsx */
|
|
12
7
|
import React, { forwardRef } from 'react';
|
|
13
8
|
import { css, jsx } from '@emotion/react';
|
|
@@ -35,7 +30,7 @@ var containerStyles = css({
|
|
|
35
30
|
boxSizing: 'content-box',
|
|
36
31
|
maxWidth: "".concat(gridSize * 56, "px"),
|
|
37
32
|
maxHeight: "".concat(gridSize * 56, "px"),
|
|
38
|
-
padding: "var(--ds-
|
|
33
|
+
padding: "var(--ds-space-200, 16px)".concat(" ", "var(--ds-space-300, 24px)"),
|
|
39
34
|
zIndex: layers.dialog(),
|
|
40
35
|
background: "var(".concat(CSS_THEME_BACKGROUND, ")"),
|
|
41
36
|
borderRadius: "".concat(borderRadius, "px"),
|
|
@@ -45,7 +40,6 @@ var containerStyles = css({
|
|
|
45
40
|
outline: 'none'
|
|
46
41
|
}
|
|
47
42
|
});
|
|
48
|
-
|
|
49
43
|
/**
|
|
50
44
|
* __Container__
|
|
51
45
|
*
|
|
@@ -55,13 +49,12 @@ var containerStyles = css({
|
|
|
55
49
|
*/
|
|
56
50
|
export var Container = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
57
51
|
var _objectSpread2;
|
|
58
|
-
|
|
59
52
|
var children = _ref.children,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
onBlur = _ref.onBlur,
|
|
54
|
+
onClick = _ref.onClick,
|
|
55
|
+
onFocus = _ref.onFocus,
|
|
56
|
+
style = _ref.style,
|
|
57
|
+
testId = _ref.testId;
|
|
65
58
|
var theme = useGlobalTheme();
|
|
66
59
|
return jsx("div", {
|
|
67
60
|
css: containerStyles,
|
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.4.
|
|
3
|
+
"version": "13.4.7",
|
|
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/"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
40
40
|
"@atlaskit/popper": "^5.4.0",
|
|
41
41
|
"@atlaskit/theme": "^12.2.0",
|
|
42
|
-
"@atlaskit/tokens": "^0.
|
|
42
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
45
45
|
"bind-event-listener": "^2.1.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/icon": "^21.11.0",
|
|
56
56
|
"@atlaskit/modal-dialog": "^12.4.0",
|
|
57
57
|
"@atlaskit/section-message": "^6.3.0",
|
|
58
|
-
"@atlaskit/select": "^16.
|
|
58
|
+
"@atlaskit/select": "^16.1.0",
|
|
59
59
|
"@atlaskit/ssr": "*",
|
|
60
60
|
"@atlaskit/visual-regression": "*",
|
|
61
61
|
"@atlaskit/webdriver-runner": "*",
|
package/report.api.md
CHANGED