@atlaskit/modal-dialog 17.2.0 → 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 +7 -0
- package/dist/cjs/internal/components/modal-dialog.js +3 -3
- package/dist/cjs/internal/components/modal-wrapper.compiled.css +2 -1
- package/dist/cjs/internal/components/modal-wrapper.js +10 -9
- package/dist/es2019/internal/components/modal-dialog.js +2 -2
- package/dist/es2019/internal/components/modal-wrapper.compiled.css +2 -1
- package/dist/es2019/internal/components/modal-wrapper.js +9 -8
- package/dist/esm/internal/components/modal-dialog.js +3 -3
- package/dist/esm/internal/components/modal-wrapper.compiled.css +2 -1
- package/dist/esm/internal/components/modal-wrapper.js +10 -9
- package/dist/types/types.d.ts +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
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
|
+
|
|
3
10
|
## 17.2.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -51,8 +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.
|
|
55
|
-
|
|
54
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
55
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
56
56
|
stackIndex = props.stackIndex,
|
|
57
57
|
onClose = props.onClose,
|
|
58
58
|
onCloseComplete = props.onCloseComplete,
|
|
@@ -84,7 +84,7 @@ var ModalDialog = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
84
84
|
}, []);
|
|
85
85
|
(0, _useAutoFocus.default)(autoFocus,
|
|
86
86
|
// When a user supplies a ref to focus we enable this hook
|
|
87
|
-
(0, _typeof2.default)(autoFocus) === 'object' && !
|
|
87
|
+
(0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
88
88
|
var _useOnMotionFinish = (0, _useOnMotionFinish3.default)({
|
|
89
89
|
onOpenComplete: onOpenComplete,
|
|
90
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,7 +191,7 @@ function getDismissedBy(_ref2) {
|
|
|
190
191
|
*/
|
|
191
192
|
function ModalWrapperTopLayer(props) {
|
|
192
193
|
var autoFocus = props.autoFocus,
|
|
193
|
-
|
|
194
|
+
UNSAFE__disableInitialAutoFocus = props.UNSAFE__disableInitialAutoFocus,
|
|
194
195
|
_props$shouldCloseOnE = props.shouldCloseOnEscapePress,
|
|
195
196
|
shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
|
|
196
197
|
_props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
|
|
@@ -318,7 +319,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
318
319
|
|
|
319
320
|
// Focus a ref-targeted element after mount (when autoFocus is a ref).
|
|
320
321
|
// When true, native <dialog>.showModal() handles focus automatically.
|
|
321
|
-
(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);
|
|
322
323
|
|
|
323
324
|
// Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
|
|
324
325
|
(0, _react.useEffect)(function () {
|
|
@@ -373,8 +374,8 @@ function ModalWrapperTopLayer(props) {
|
|
|
373
374
|
*/
|
|
374
375
|
var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
375
376
|
var autoFocus = props.autoFocus,
|
|
376
|
-
_props$UNSAFE__disabl = props.
|
|
377
|
-
|
|
377
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
378
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
378
379
|
focusLockAllowlist = props.focusLockAllowlist,
|
|
379
380
|
_props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
|
|
380
381
|
shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
|
|
@@ -406,7 +407,7 @@ var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
|
|
|
406
407
|
var isForeground = stackIndex === 0;
|
|
407
408
|
|
|
408
409
|
// If no ref is provided, autofocus on first element
|
|
409
|
-
var autoFocusLock = !
|
|
410
|
+
var autoFocusLock = !UNSAFE__disableInitialAutoFocus && !((0, _typeof2.default)(autoFocus) === 'object');
|
|
410
411
|
var onCloseHandler = useModalCloseHandler(providedOnClose);
|
|
411
412
|
var onBlanketClicked = (0, _react.useCallback)(function (e) {
|
|
412
413
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -39,7 +39,7 @@ const ModalDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
39
39
|
shouldScrollInViewport = false,
|
|
40
40
|
shouldCloseOnEscapePress,
|
|
41
41
|
autoFocus,
|
|
42
|
-
|
|
42
|
+
UNSAFE__disableInitialAutoFocus = false,
|
|
43
43
|
stackIndex,
|
|
44
44
|
onClose,
|
|
45
45
|
onCloseComplete,
|
|
@@ -67,7 +67,7 @@ const ModalDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
67
67
|
combine(disableDraggingToCrossOriginIFramesForElement(), disableDraggingToCrossOriginIFramesForTextSelection(), disableDraggingToCrossOriginIFramesForExternal()), []);
|
|
68
68
|
useAutoFocus(autoFocus,
|
|
69
69
|
// When a user supplies a ref to focus we enable this hook
|
|
70
|
-
typeof autoFocus === 'object' && !
|
|
70
|
+
typeof autoFocus === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
71
71
|
const [motionRef, onMotionFinish] = useOnMotionFinish({
|
|
72
72
|
onOpenComplete,
|
|
73
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,7 +184,7 @@ function getDismissedBy({
|
|
|
183
184
|
function ModalWrapperTopLayer(props) {
|
|
184
185
|
const {
|
|
185
186
|
autoFocus,
|
|
186
|
-
|
|
187
|
+
UNSAFE__disableInitialAutoFocus,
|
|
187
188
|
shouldCloseOnEscapePress = true,
|
|
188
189
|
shouldCloseOnOverlayClick = true,
|
|
189
190
|
shouldScrollInViewport = false,
|
|
@@ -306,7 +307,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
306
307
|
|
|
307
308
|
// Focus a ref-targeted element after mount (when autoFocus is a ref).
|
|
308
309
|
// When true, native <dialog>.showModal() handles focus automatically.
|
|
309
|
-
useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object' && !
|
|
310
|
+
useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
310
311
|
|
|
311
312
|
// Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
|
|
312
313
|
useEffect(() => {
|
|
@@ -362,7 +363,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
362
363
|
const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
|
|
363
364
|
const {
|
|
364
365
|
autoFocus,
|
|
365
|
-
|
|
366
|
+
UNSAFE__disableInitialAutoFocus = false,
|
|
366
367
|
focusLockAllowlist,
|
|
367
368
|
shouldCloseOnEscapePress = true,
|
|
368
369
|
shouldCloseOnOverlayClick = true,
|
|
@@ -389,7 +390,7 @@ const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
389
390
|
const isForeground = stackIndex === 0;
|
|
390
391
|
|
|
391
392
|
// If no ref is provided, autofocus on first element
|
|
392
|
-
const autoFocusLock = !
|
|
393
|
+
const autoFocusLock = !UNSAFE__disableInitialAutoFocus && !(typeof autoFocus === 'object');
|
|
393
394
|
const onCloseHandler = useModalCloseHandler(providedOnClose);
|
|
394
395
|
const onBlanketClicked = useCallback(e => {
|
|
395
396
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -42,8 +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.
|
|
46
|
-
|
|
45
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
46
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
47
47
|
stackIndex = props.stackIndex,
|
|
48
48
|
onClose = props.onClose,
|
|
49
49
|
onCloseComplete = props.onCloseComplete,
|
|
@@ -75,7 +75,7 @@ var ModalDialog = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
75
75
|
}, []);
|
|
76
76
|
useAutoFocus(autoFocus,
|
|
77
77
|
// When a user supplies a ref to focus we enable this hook
|
|
78
|
-
_typeof(autoFocus) === 'object' && !
|
|
78
|
+
_typeof(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
79
79
|
var _useOnMotionFinish = useOnMotionFinish({
|
|
80
80
|
onOpenComplete: onOpenComplete,
|
|
81
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,7 +182,7 @@ function getDismissedBy(_ref2) {
|
|
|
181
182
|
*/
|
|
182
183
|
function ModalWrapperTopLayer(props) {
|
|
183
184
|
var autoFocus = props.autoFocus,
|
|
184
|
-
|
|
185
|
+
UNSAFE__disableInitialAutoFocus = props.UNSAFE__disableInitialAutoFocus,
|
|
185
186
|
_props$shouldCloseOnE = props.shouldCloseOnEscapePress,
|
|
186
187
|
shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
|
|
187
188
|
_props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
|
|
@@ -309,7 +310,7 @@ function ModalWrapperTopLayer(props) {
|
|
|
309
310
|
|
|
310
311
|
// Focus a ref-targeted element after mount (when autoFocus is a ref).
|
|
311
312
|
// When true, native <dialog>.showModal() handles focus automatically.
|
|
312
|
-
useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object' && !
|
|
313
|
+
useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object' && !UNSAFE__disableInitialAutoFocus);
|
|
313
314
|
|
|
314
315
|
// Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
|
|
315
316
|
useEffect(function () {
|
|
@@ -364,8 +365,8 @@ function ModalWrapperTopLayer(props) {
|
|
|
364
365
|
*/
|
|
365
366
|
var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
366
367
|
var autoFocus = props.autoFocus,
|
|
367
|
-
_props$UNSAFE__disabl = props.
|
|
368
|
-
|
|
368
|
+
_props$UNSAFE__disabl = props.UNSAFE__disableInitialAutoFocus,
|
|
369
|
+
UNSAFE__disableInitialAutoFocus = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
|
|
369
370
|
focusLockAllowlist = props.focusLockAllowlist,
|
|
370
371
|
_props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
|
|
371
372
|
shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
|
|
@@ -397,7 +398,7 @@ var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
397
398
|
var isForeground = stackIndex === 0;
|
|
398
399
|
|
|
399
400
|
// If no ref is provided, autofocus on first element
|
|
400
|
-
var autoFocusLock = !
|
|
401
|
+
var autoFocusLock = !UNSAFE__disableInitialAutoFocus && !(_typeof(autoFocus) === 'object');
|
|
401
402
|
var onCloseHandler = useModalCloseHandler(providedOnClose);
|
|
402
403
|
var onBlanketClicked = useCallback(function (e) {
|
|
403
404
|
if (shouldCloseOnOverlayClick) {
|
package/dist/types/types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface ModalDialogProps {
|
|
|
25
25
|
* ready. This is gated by `platform_dst-automated_focus` and must not be
|
|
26
26
|
* used by Makers or ordinary Modal Dialog consumers.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
UNSAFE__disableInitialAutoFocus?: boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Contents of the modal dialog.
|
|
31
31
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/modal-dialog",
|
|
3
|
-
"version": "17.2.
|
|
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,19 +39,19 @@
|
|
|
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.
|
|
54
|
+
"@atlaskit/tokens": "^20.9.0",
|
|
55
55
|
"@atlaskit/top-layer": "^7.1.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|
|
57
57
|
"@compiled/react": "^1.0.2",
|
|
@@ -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",
|