@atlaskit/modal-dialog 17.1.2 → 17.2.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 +21 -0
- package/dist/cjs/internal/components/modal-dialog.js +3 -1
- package/dist/cjs/internal/components/modal-wrapper.compiled.css +2 -1
- package/dist/cjs/internal/components/modal-wrapper.js +10 -6
- package/dist/es2019/internal/components/modal-dialog.js +2 -1
- package/dist/es2019/internal/components/modal-wrapper.compiled.css +2 -1
- package/dist/es2019/internal/components/modal-wrapper.js +9 -6
- package/dist/esm/internal/components/modal-dialog.js +3 -1
- package/dist/esm/internal/components/modal-wrapper.compiled.css +2 -1
- package/dist/esm/internal/components/modal-wrapper.js +10 -6
- package/dist/types/types.d.ts +7 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/modal-dialog
|
|
2
2
|
|
|
3
|
+
## 17.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c7a4861c669f1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c7a4861c669f1) -
|
|
8
|
+
Behind `platform-dst-top-layer`, the modal fits the viewport and a full-screen modal fills it.
|
|
9
|
+
|
|
10
|
+
## 17.2.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`2980f0f050276`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2980f0f050276) -
|
|
15
|
+
Add `UNSAFE__disableAutoFocusForAsyncWrapper` to `ModalDialog` and `Popup` to support deferred
|
|
16
|
+
focus when asynchronous entry point content loads. Add the
|
|
17
|
+
`@atlaskit/top-layer/apply-initial-focus` entrypoint for applying initial focus after that content
|
|
18
|
+
is available.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 17.1.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -51,6 +51,8 @@ var ModalDialog = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
51
51
|
shouldScrollInViewport = _props$shouldScrollIn === void 0 ? false : _props$shouldScrollIn,
|
|
52
52
|
shouldCloseOnEscapePress = props.shouldCloseOnEscapePress,
|
|
53
53
|
autoFocus = props.autoFocus,
|
|
54
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
55
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
54
56
|
stackIndex = props.stackIndex,
|
|
55
57
|
onClose = props.onClose,
|
|
56
58
|
onCloseComplete = props.onCloseComplete,
|
|
@@ -82,7 +84,7 @@ var ModalDialog = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
82
84
|
}, []);
|
|
83
85
|
(0, _useAutoFocus.default)(autoFocus,
|
|
84
86
|
// When a user supplies a ref to focus we enable this hook
|
|
85
|
-
(0, _typeof2.default)(autoFocus) === 'object');
|
|
87
|
+
(0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
86
88
|
var _useOnMotionFinish = (0, _useOnMotionFinish3.default)({
|
|
87
89
|
onOpenComplete: onOpenComplete,
|
|
88
90
|
onCloseComplete: onCloseComplete
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
._4t3i1kxc{height:100vh}
|
|
17
17
|
._8am5i4x0{-webkit-overflow-scrolling:touch}
|
|
18
18
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
19
|
+
._ds62idpf>form:only-child{min-height:0}
|
|
19
20
|
._kqsw1n9t{position:fixed}
|
|
20
21
|
._lcxv1wug{pointer-events:auto}
|
|
21
22
|
._ln19p27b{scrollbar-gutter:stable}
|
|
@@ -24,4 +25,4 @@
|
|
|
24
25
|
._1ah3dkaa:focus-visible{outline-offset:var(--ds-border-width-focused,2px)}
|
|
25
26
|
._mizu1v1w:focus-visible{outline-color:var(--ds-border-focused,#4688ec)}
|
|
26
27
|
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
27
|
-
@media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
|
|
28
|
+
@media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._e8uo221b{max-height:calc(100vh - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
|
|
@@ -43,6 +43,7 @@ var _scrollContext = require("../scroll-context");
|
|
|
43
43
|
var _width = require("../width");
|
|
44
44
|
var _modalDialog = _interopRequireDefault(require("./modal-dialog"));
|
|
45
45
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
46
|
+
// eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
|
|
46
47
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-atlaskit-theme
|
|
47
48
|
var fillScreenStyles = null;
|
|
48
49
|
|
|
@@ -52,7 +53,7 @@ var fillScreenStyles = null;
|
|
|
52
53
|
var dialogStyles = {
|
|
53
54
|
'body-scroll': "_1reoewfl _18m9ewfl _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug",
|
|
54
55
|
'viewport-scroll': "_ln19p27b _1bsbauwl _4t3i1kxc",
|
|
55
|
-
'full-screen': ""
|
|
56
|
+
'full-screen': "_1bsbauwl _4t3i1kxc"
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
// Visual styles for modal content inside native <dialog>.
|
|
@@ -64,13 +65,13 @@ var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
|
64
65
|
* Styles applied to the visual modal surface.
|
|
65
66
|
*/
|
|
66
67
|
var surfaceStyles = {
|
|
67
|
-
root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
|
|
68
|
+
root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _ds62idpf _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
|
|
68
69
|
borderRadius: "_2rkoidpf _epkxpb1k"
|
|
69
70
|
};
|
|
70
71
|
var topLayerScrollModeStyles = {
|
|
71
72
|
'full-screen': "_1bsbauwl _4t3i1kxc _kqsw1n9t _152tze3t _1e02ze3t _18m91wug _8am5i4x0",
|
|
72
73
|
'viewport-scroll': "_4t3i1kxc _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug _1mpv184x _1jyk17ks _g7116m9r _we1i18uh",
|
|
73
|
-
'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh"
|
|
74
|
+
'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh _e8uo221b"
|
|
74
75
|
};
|
|
75
76
|
var topLayerAutoHeightStyles = null;
|
|
76
77
|
var allowlistElements = function allowlistElements(element, callback) {
|
|
@@ -94,7 +95,7 @@ function useModalCloseHandler(providedOnClose) {
|
|
|
94
95
|
action: 'closed',
|
|
95
96
|
componentName: 'modalDialog',
|
|
96
97
|
packageName: "@atlaskit/modal-dialog",
|
|
97
|
-
packageVersion: "17.
|
|
98
|
+
packageVersion: "17.2.0"
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
function getScrollMode(_ref) {
|
|
@@ -190,6 +191,7 @@ function getDismissedBy(_ref2) {
|
|
|
190
191
|
*/
|
|
191
192
|
function ModalWrapperTopLayer(props) {
|
|
192
193
|
var autoFocus = props.autoFocus,
|
|
194
|
+
UNSAFE__disableInitialAutoFocus = props.UNSAFE__disableInitialAutoFocus,
|
|
193
195
|
_props$shouldCloseOnE = props.shouldCloseOnEscapePress,
|
|
194
196
|
shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
|
|
195
197
|
_props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
|
|
@@ -317,7 +319,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
317
319
|
|
|
318
320
|
// Focus a ref-targeted element after mount (when autoFocus is a ref).
|
|
319
321
|
// When true, native <dialog>.showModal() handles focus automatically.
|
|
320
|
-
(0, _useAutoFocus.default)((0, _typeof2.default)(autoFocus) === 'object' ? autoFocus : undefined, (0, _typeof2.default)(autoFocus) === 'object');
|
|
322
|
+
(0, _useAutoFocus.default)((0, _typeof2.default)(autoFocus) === 'object' ? autoFocus : undefined, (0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
321
323
|
|
|
322
324
|
// Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
|
|
323
325
|
(0, _react.useEffect)(function () {
|
|
@@ -372,6 +374,8 @@ function ModalWrapperTopLayer(props) {
|
|
|
372
374
|
*/
|
|
373
375
|
var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
374
376
|
var autoFocus = props.autoFocus,
|
|
377
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
378
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
375
379
|
focusLockAllowlist = props.focusLockAllowlist,
|
|
376
380
|
_props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
|
|
377
381
|
shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
|
|
@@ -403,7 +407,7 @@ var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
|
|
|
403
407
|
var isForeground = stackIndex === 0;
|
|
404
408
|
|
|
405
409
|
// If no ref is provided, autofocus on first element
|
|
406
|
-
var autoFocusLock = !((0, _typeof2.default)(autoFocus) === 'object');
|
|
410
|
+
var autoFocusLock = !UNSAFE__disableInitialAutoFocus && !((0, _typeof2.default)(autoFocus) === 'object');
|
|
407
411
|
var onCloseHandler = useModalCloseHandler(providedOnClose);
|
|
408
412
|
var onBlanketClicked = (0, _react.useCallback)(function (e) {
|
|
409
413
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -39,6 +39,7 @@ const ModalDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
39
39
|
shouldScrollInViewport = false,
|
|
40
40
|
shouldCloseOnEscapePress,
|
|
41
41
|
autoFocus,
|
|
42
|
+
UNSAFE__disableInitialAutoFocus = false,
|
|
42
43
|
stackIndex,
|
|
43
44
|
onClose,
|
|
44
45
|
onCloseComplete,
|
|
@@ -66,7 +67,7 @@ const ModalDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
66
67
|
combine(disableDraggingToCrossOriginIFramesForElement(), disableDraggingToCrossOriginIFramesForTextSelection(), disableDraggingToCrossOriginIFramesForExternal()), []);
|
|
67
68
|
useAutoFocus(autoFocus,
|
|
68
69
|
// When a user supplies a ref to focus we enable this hook
|
|
69
|
-
typeof autoFocus === 'object');
|
|
70
|
+
typeof autoFocus === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
70
71
|
const [motionRef, onMotionFinish] = useOnMotionFinish({
|
|
71
72
|
onOpenComplete,
|
|
72
73
|
onCloseComplete
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
._4t3i1kxc{height:100vh}
|
|
17
17
|
._8am5i4x0{-webkit-overflow-scrolling:touch}
|
|
18
18
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
19
|
+
._ds62idpf>form:only-child{min-height:0}
|
|
19
20
|
._kqsw1n9t{position:fixed}
|
|
20
21
|
._lcxv1wug{pointer-events:auto}
|
|
21
22
|
._ln19p27b{scrollbar-gutter:stable}
|
|
@@ -24,4 +25,4 @@
|
|
|
24
25
|
._1ah3dkaa:focus-visible{outline-offset:var(--ds-border-width-focused,2px)}
|
|
25
26
|
._mizu1v1w:focus-visible{outline-color:var(--ds-border-focused,#4688ec)}
|
|
26
27
|
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
27
|
-
@media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
|
|
28
|
+
@media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._e8uo221b{max-height:calc(100vh - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
|
|
@@ -4,6 +4,7 @@ import "./modal-wrapper.compiled.css";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
7
|
+
// eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
|
|
7
8
|
import FocusLock from 'react-focus-lock';
|
|
8
9
|
import ScrollLock, { TouchScrollable } from 'react-scrolllock';
|
|
9
10
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
@@ -42,7 +43,7 @@ const fillScreenStyles = null;
|
|
|
42
43
|
const dialogStyles = {
|
|
43
44
|
'body-scroll': "_1reoewfl _18m9ewfl _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug",
|
|
44
45
|
'viewport-scroll': "_ln19p27b _1bsbauwl _4t3i1kxc",
|
|
45
|
-
'full-screen': ""
|
|
46
|
+
'full-screen': "_1bsbauwl _4t3i1kxc"
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
// Visual styles for modal content inside native <dialog>.
|
|
@@ -54,13 +55,13 @@ const LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
|
54
55
|
* Styles applied to the visual modal surface.
|
|
55
56
|
*/
|
|
56
57
|
const surfaceStyles = {
|
|
57
|
-
root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
|
|
58
|
+
root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _ds62idpf _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
|
|
58
59
|
borderRadius: "_2rkoidpf _epkxpb1k"
|
|
59
60
|
};
|
|
60
61
|
const topLayerScrollModeStyles = {
|
|
61
62
|
'full-screen': "_1bsbauwl _4t3i1kxc _kqsw1n9t _152tze3t _1e02ze3t _18m91wug _8am5i4x0",
|
|
62
63
|
'viewport-scroll': "_4t3i1kxc _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug _1mpv184x _1jyk17ks _g7116m9r _we1i18uh",
|
|
63
|
-
'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh"
|
|
64
|
+
'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh _e8uo221b"
|
|
64
65
|
};
|
|
65
66
|
const topLayerAutoHeightStyles = null;
|
|
66
67
|
const allowlistElements = (element, callback) => {
|
|
@@ -84,7 +85,7 @@ function useModalCloseHandler(providedOnClose) {
|
|
|
84
85
|
action: 'closed',
|
|
85
86
|
componentName: 'modalDialog',
|
|
86
87
|
packageName: "@atlaskit/modal-dialog",
|
|
87
|
-
packageVersion: "17.
|
|
88
|
+
packageVersion: "17.2.0"
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
function getScrollMode({
|
|
@@ -183,6 +184,7 @@ function getDismissedBy({
|
|
|
183
184
|
function ModalWrapperTopLayer(props) {
|
|
184
185
|
const {
|
|
185
186
|
autoFocus,
|
|
187
|
+
UNSAFE__disableInitialAutoFocus,
|
|
186
188
|
shouldCloseOnEscapePress = true,
|
|
187
189
|
shouldCloseOnOverlayClick = true,
|
|
188
190
|
shouldScrollInViewport = false,
|
|
@@ -305,7 +307,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
305
307
|
|
|
306
308
|
// Focus a ref-targeted element after mount (when autoFocus is a ref).
|
|
307
309
|
// When true, native <dialog>.showModal() handles focus automatically.
|
|
308
|
-
useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object');
|
|
310
|
+
useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
309
311
|
|
|
310
312
|
// Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
|
|
311
313
|
useEffect(() => {
|
|
@@ -361,6 +363,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
361
363
|
const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
|
|
362
364
|
const {
|
|
363
365
|
autoFocus,
|
|
366
|
+
UNSAFE__disableInitialAutoFocus = false,
|
|
364
367
|
focusLockAllowlist,
|
|
365
368
|
shouldCloseOnEscapePress = true,
|
|
366
369
|
shouldCloseOnOverlayClick = true,
|
|
@@ -387,7 +390,7 @@ const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
387
390
|
const isForeground = stackIndex === 0;
|
|
388
391
|
|
|
389
392
|
// If no ref is provided, autofocus on first element
|
|
390
|
-
const autoFocusLock = !(typeof autoFocus === 'object');
|
|
393
|
+
const autoFocusLock = !UNSAFE__disableInitialAutoFocus && !(typeof autoFocus === 'object');
|
|
391
394
|
const onCloseHandler = useModalCloseHandler(providedOnClose);
|
|
392
395
|
const onBlanketClicked = useCallback(e => {
|
|
393
396
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -42,6 +42,8 @@ var ModalDialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
42
42
|
shouldScrollInViewport = _props$shouldScrollIn === void 0 ? false : _props$shouldScrollIn,
|
|
43
43
|
shouldCloseOnEscapePress = props.shouldCloseOnEscapePress,
|
|
44
44
|
autoFocus = props.autoFocus,
|
|
45
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
46
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
45
47
|
stackIndex = props.stackIndex,
|
|
46
48
|
onClose = props.onClose,
|
|
47
49
|
onCloseComplete = props.onCloseComplete,
|
|
@@ -73,7 +75,7 @@ var ModalDialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
73
75
|
}, []);
|
|
74
76
|
useAutoFocus(autoFocus,
|
|
75
77
|
// When a user supplies a ref to focus we enable this hook
|
|
76
|
-
_typeof(autoFocus) === 'object');
|
|
78
|
+
_typeof(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
77
79
|
var _useOnMotionFinish = useOnMotionFinish({
|
|
78
80
|
onOpenComplete: onOpenComplete,
|
|
79
81
|
onCloseComplete: onCloseComplete
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
._4t3i1kxc{height:100vh}
|
|
17
17
|
._8am5i4x0{-webkit-overflow-scrolling:touch}
|
|
18
18
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
19
|
+
._ds62idpf>form:only-child{min-height:0}
|
|
19
20
|
._kqsw1n9t{position:fixed}
|
|
20
21
|
._lcxv1wug{pointer-events:auto}
|
|
21
22
|
._ln19p27b{scrollbar-gutter:stable}
|
|
@@ -24,4 +25,4 @@
|
|
|
24
25
|
._1ah3dkaa:focus-visible{outline-offset:var(--ds-border-width-focused,2px)}
|
|
25
26
|
._mizu1v1w:focus-visible{outline-color:var(--ds-border-focused,#4688ec)}
|
|
26
27
|
._ra3xnqa1:focus-visible{outline-style:solid}
|
|
27
|
-
@media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
|
|
28
|
+
@media (min-width:30rem){._1jyk17ks{height:var(--modal-dialog-height)}._g7116m9r{width:var(--modal-dialog-width)}._we1i18uh{max-width:calc(100vw - 90pt)}._e8uo221b{max-height:calc(100vh - 90pt)}._1sg41wqb{margin-top:60px}._maxs1wug{margin-right:auto}._1jvh1wqb{margin-bottom:60px}._1uca1wug{margin-left:auto}._1mpv184x{min-height:min-content}._e8uo1ris{max-height:max-content}._epkxpb1k{border-radius:var(--ds-radius-xlarge,9pt)}._zg7p130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}}
|
|
@@ -5,6 +5,7 @@ import "./modal-wrapper.compiled.css";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
8
|
+
// eslint-disable-next-line @atlaskit/design-system/no-third-party-focus-traps -- existing usage from before this rule was added
|
|
8
9
|
import FocusLock from 'react-focus-lock';
|
|
9
10
|
import ScrollLock, { TouchScrollable } from 'react-scrolllock';
|
|
10
11
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
@@ -43,7 +44,7 @@ var fillScreenStyles = null;
|
|
|
43
44
|
var dialogStyles = {
|
|
44
45
|
'body-scroll': "_1reoewfl _18m9ewfl _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug",
|
|
45
46
|
'viewport-scroll': "_ln19p27b _1bsbauwl _4t3i1kxc",
|
|
46
|
-
'full-screen': ""
|
|
47
|
+
'full-screen': "_1bsbauwl _4t3i1kxc"
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
// Visual styles for modal content inside native <dialog>.
|
|
@@ -55,13 +56,13 @@ var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
|
55
56
|
* Styles applied to the visual modal surface.
|
|
56
57
|
*/
|
|
57
58
|
var surfaceStyles = {
|
|
58
|
-
root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
|
|
59
|
+
root: "_1e0c1txw _2lx21bp4 _bfhk1bhr _1q1l1bhr _lcxv1wug _1mq81kw7 _m01u1kw7 _ds62idpf _1dg11kw7 _mizu1v1w _1ah3dkaa _ra3xnqa1 _128mdkaa _zg7p130s",
|
|
59
60
|
borderRadius: "_2rkoidpf _epkxpb1k"
|
|
60
61
|
};
|
|
61
62
|
var topLayerScrollModeStyles = {
|
|
62
63
|
'full-screen': "_1bsbauwl _4t3i1kxc _kqsw1n9t _152tze3t _1e02ze3t _18m91wug _8am5i4x0",
|
|
63
64
|
'viewport-scroll': "_4t3i1kxc _1sg41wqb _maxs1wug _1jvh1wqb _1uca1wug _1mpv184x _1jyk17ks _g7116m9r _we1i18uh",
|
|
64
|
-
'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh"
|
|
65
|
+
'body-scroll': "_1bsbauwl _4t3i1kxc _1jyk17ks _g7116m9r _we1i18uh _e8uo221b"
|
|
65
66
|
};
|
|
66
67
|
var topLayerAutoHeightStyles = null;
|
|
67
68
|
var allowlistElements = function allowlistElements(element, callback) {
|
|
@@ -85,7 +86,7 @@ function useModalCloseHandler(providedOnClose) {
|
|
|
85
86
|
action: 'closed',
|
|
86
87
|
componentName: 'modalDialog',
|
|
87
88
|
packageName: "@atlaskit/modal-dialog",
|
|
88
|
-
packageVersion: "17.
|
|
89
|
+
packageVersion: "17.2.0"
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
function getScrollMode(_ref) {
|
|
@@ -181,6 +182,7 @@ function getDismissedBy(_ref2) {
|
|
|
181
182
|
*/
|
|
182
183
|
function ModalWrapperTopLayer(props) {
|
|
183
184
|
var autoFocus = props.autoFocus,
|
|
185
|
+
UNSAFE__disableInitialAutoFocus = props.UNSAFE__disableInitialAutoFocus,
|
|
184
186
|
_props$shouldCloseOnE = props.shouldCloseOnEscapePress,
|
|
185
187
|
shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
|
|
186
188
|
_props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
|
|
@@ -308,7 +310,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
308
310
|
|
|
309
311
|
// Focus a ref-targeted element after mount (when autoFocus is a ref).
|
|
310
312
|
// When true, native <dialog>.showModal() handles focus automatically.
|
|
311
|
-
useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object');
|
|
313
|
+
useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
312
314
|
|
|
313
315
|
// Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
|
|
314
316
|
useEffect(function () {
|
|
@@ -363,6 +365,8 @@ function ModalWrapperTopLayer(props) {
|
|
|
363
365
|
*/
|
|
364
366
|
var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
365
367
|
var autoFocus = props.autoFocus,
|
|
368
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
369
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
366
370
|
focusLockAllowlist = props.focusLockAllowlist,
|
|
367
371
|
_props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
|
|
368
372
|
shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
|
|
@@ -394,7 +398,7 @@ var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
394
398
|
var isForeground = stackIndex === 0;
|
|
395
399
|
|
|
396
400
|
// If no ref is provided, autofocus on first element
|
|
397
|
-
var autoFocusLock = !(_typeof(autoFocus) === 'object');
|
|
401
|
+
var autoFocusLock = !UNSAFE__disableInitialAutoFocus && !(_typeof(autoFocus) === 'object');
|
|
398
402
|
var onCloseHandler = useModalCloseHandler(providedOnClose);
|
|
399
403
|
var onBlanketClicked = useCallback(function (e) {
|
|
400
404
|
if (shouldCloseOnOverlayClick) {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -19,6 +19,13 @@ export interface ModalDialogProps {
|
|
|
19
19
|
* modal dialog.
|
|
20
20
|
*/
|
|
21
21
|
autoFocus?: RefObject<HTMLElement | null | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* For asynchronous Entry Point wrappers only. Disables Modal Dialog's
|
|
24
|
+
* initial autofocus so the wrapper can apply focus after its content is
|
|
25
|
+
* ready. This is gated by `platform_dst-automated_focus` and must not be
|
|
26
|
+
* used by Makers or ordinary Modal Dialog consumers.
|
|
27
|
+
*/
|
|
28
|
+
UNSAFE__disableInitialAutoFocus?: boolean;
|
|
22
29
|
/**
|
|
23
30
|
* Contents of the modal dialog.
|
|
24
31
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/modal-dialog",
|
|
3
|
-
"version": "17.1
|
|
3
|
+
"version": "17.2.1",
|
|
4
4
|
"description": "A modal dialog displays content that requires user interaction, in a layer above the page.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,20 +39,20 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@atlaskit/analytics-next": "^12.6.0",
|
|
41
41
|
"@atlaskit/blanket": "^16.4.0",
|
|
42
|
-
"@atlaskit/button": "^25.
|
|
42
|
+
"@atlaskit/button": "^25.7.0",
|
|
43
43
|
"@atlaskit/css": "^1.1.0",
|
|
44
44
|
"@atlaskit/ds-lib": "^8.0.0",
|
|
45
45
|
"@atlaskit/icon": "^38.0.0",
|
|
46
46
|
"@atlaskit/layering": "^6.1.0",
|
|
47
|
-
"@atlaskit/motion": "^9.
|
|
47
|
+
"@atlaskit/motion": "^9.6.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
49
49
|
"@atlaskit/portal": "^7.1.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
|
|
51
51
|
"@atlaskit/primitives": "^22.6.0",
|
|
52
52
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
53
53
|
"@atlaskit/theme": "^28.2.0",
|
|
54
|
-
"@atlaskit/tokens": "^20.
|
|
55
|
-
"@atlaskit/top-layer": "^7.
|
|
54
|
+
"@atlaskit/tokens": "^20.9.0",
|
|
55
|
+
"@atlaskit/top-layer": "^7.1.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|
|
57
57
|
"@compiled/react": "^1.0.2",
|
|
58
58
|
"bind-event-listener": "^3.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@af/accessibility-testing": "workspace:^",
|
|
68
68
|
"@af/integration-testing": "workspace:^",
|
|
69
69
|
"@af/visual-regression": "workspace:^",
|
|
70
|
-
"@atlaskit/avatar": "^30.
|
|
70
|
+
"@atlaskit/avatar": "^30.1.0",
|
|
71
71
|
"@atlaskit/avatar-group": "^14.4.0",
|
|
72
72
|
"@atlaskit/banner": "^15.3.0",
|
|
73
73
|
"@atlaskit/breadcrumbs": "^17.8.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"@atlaskit/form": "^18.3.0",
|
|
81
81
|
"@atlaskit/heading": "^8.0.0",
|
|
82
82
|
"@atlaskit/link": "^5.1.0",
|
|
83
|
-
"@atlaskit/popup": "^10.
|
|
83
|
+
"@atlaskit/popup": "^10.2.0",
|
|
84
84
|
"@atlaskit/radio": "^10.2.0",
|
|
85
85
|
"@atlaskit/section-message": "^10.2.0",
|
|
86
86
|
"@atlaskit/select": "^23.1.0",
|