@atlaskit/modal-dialog 17.1.1 → 17.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 17.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2980f0f050276`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2980f0f050276) -
8
+ Add `UNSAFE__disableAutoFocusForAsyncWrapper` to `ModalDialog` and `Popup` to support deferred
9
+ focus when asynchronous entry point content loads. Add the
10
+ `@atlaskit/top-layer/apply-initial-focus` entrypoint for applying initial focus after that content
11
+ is available.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
17
+ ## 17.1.2
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 17.1.1
4
24
 
5
25
  ### 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__disableAutoFocusForAsyncWrapper,
55
+ UNSAFE__disableAutoFocusForAsyncWrapper = _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__disableAutoFocusForAsyncWrapper);
86
88
  var _useOnMotionFinish = (0, _useOnMotionFinish3.default)({
87
89
  onOpenComplete: onOpenComplete,
88
90
  onCloseComplete: onCloseComplete
@@ -94,7 +94,7 @@ function useModalCloseHandler(providedOnClose) {
94
94
  action: 'closed',
95
95
  componentName: 'modalDialog',
96
96
  packageName: "@atlaskit/modal-dialog",
97
- packageVersion: "17.1.0"
97
+ packageVersion: "17.1.2"
98
98
  });
99
99
  }
100
100
  function getScrollMode(_ref) {
@@ -190,6 +190,7 @@ function getDismissedBy(_ref2) {
190
190
  */
191
191
  function ModalWrapperTopLayer(props) {
192
192
  var autoFocus = props.autoFocus,
193
+ UNSAFE__disableAutoFocusForAsyncWrapper = props.UNSAFE__disableAutoFocusForAsyncWrapper,
193
194
  _props$shouldCloseOnE = props.shouldCloseOnEscapePress,
194
195
  shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
195
196
  _props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
@@ -317,7 +318,7 @@ function ModalWrapperTopLayer(props) {
317
318
 
318
319
  // Focus a ref-targeted element after mount (when autoFocus is a ref).
319
320
  // When true, native <dialog>.showModal() handles focus automatically.
320
- (0, _useAutoFocus.default)((0, _typeof2.default)(autoFocus) === 'object' ? autoFocus : undefined, (0, _typeof2.default)(autoFocus) === 'object');
321
+ (0, _useAutoFocus.default)((0, _typeof2.default)(autoFocus) === 'object' ? autoFocus : undefined, (0, _typeof2.default)(autoFocus) === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
321
322
 
322
323
  // Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
323
324
  (0, _react.useEffect)(function () {
@@ -372,6 +373,8 @@ function ModalWrapperTopLayer(props) {
372
373
  */
373
374
  var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
374
375
  var autoFocus = props.autoFocus,
376
+ _props$UNSAFE__disabl = props.UNSAFE__disableAutoFocusForAsyncWrapper,
377
+ UNSAFE__disableAutoFocusForAsyncWrapper = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
375
378
  focusLockAllowlist = props.focusLockAllowlist,
376
379
  _props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
377
380
  shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
@@ -403,7 +406,7 @@ var ModalWrapperLegacy = /*#__PURE__*/(0, _react.forwardRef)(function (props, re
403
406
  var isForeground = stackIndex === 0;
404
407
 
405
408
  // If no ref is provided, autofocus on first element
406
- var autoFocusLock = !((0, _typeof2.default)(autoFocus) === 'object');
409
+ var autoFocusLock = !UNSAFE__disableAutoFocusForAsyncWrapper && !((0, _typeof2.default)(autoFocus) === 'object');
407
410
  var onCloseHandler = useModalCloseHandler(providedOnClose);
408
411
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
409
412
  if (shouldCloseOnOverlayClick) {
@@ -5,15 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ScrollContext = void 0;
7
7
  var _react = require("react");
8
- // TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
9
- // Remove links that the component does not have (such as usage). If there are no links remove them all.
10
- /**
11
- * __Scroll context__
12
- *
13
- * A scroll context {description}.
14
- *
15
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
16
- * - [Code](https://atlassian.design/components/{packageName}/code)
17
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
18
- */
19
8
  var ScrollContext = exports.ScrollContext = /*#__PURE__*/(0, _react.createContext)(null);
@@ -39,6 +39,7 @@ const ModalDialog = /*#__PURE__*/forwardRef((props, ref) => {
39
39
  shouldScrollInViewport = false,
40
40
  shouldCloseOnEscapePress,
41
41
  autoFocus,
42
+ UNSAFE__disableAutoFocusForAsyncWrapper = 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__disableAutoFocusForAsyncWrapper);
70
71
  const [motionRef, onMotionFinish] = useOnMotionFinish({
71
72
  onOpenComplete,
72
73
  onCloseComplete
@@ -84,7 +84,7 @@ function useModalCloseHandler(providedOnClose) {
84
84
  action: 'closed',
85
85
  componentName: 'modalDialog',
86
86
  packageName: "@atlaskit/modal-dialog",
87
- packageVersion: "17.1.0"
87
+ packageVersion: "17.1.2"
88
88
  });
89
89
  }
90
90
  function getScrollMode({
@@ -183,6 +183,7 @@ function getDismissedBy({
183
183
  function ModalWrapperTopLayer(props) {
184
184
  const {
185
185
  autoFocus,
186
+ UNSAFE__disableAutoFocusForAsyncWrapper,
186
187
  shouldCloseOnEscapePress = true,
187
188
  shouldCloseOnOverlayClick = true,
188
189
  shouldScrollInViewport = false,
@@ -305,7 +306,7 @@ function ModalWrapperTopLayer(props) {
305
306
 
306
307
  // Focus a ref-targeted element after mount (when autoFocus is a ref).
307
308
  // When true, native <dialog>.showModal() handles focus automatically.
308
- useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object');
309
+ useAutoFocus(typeof autoFocus === 'object' ? autoFocus : undefined, typeof autoFocus === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
309
310
 
310
311
  // Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
311
312
  useEffect(() => {
@@ -361,6 +362,7 @@ function ModalWrapperTopLayer(props) {
361
362
  const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
362
363
  const {
363
364
  autoFocus,
365
+ UNSAFE__disableAutoFocusForAsyncWrapper = false,
364
366
  focusLockAllowlist,
365
367
  shouldCloseOnEscapePress = true,
366
368
  shouldCloseOnOverlayClick = true,
@@ -387,7 +389,7 @@ const ModalWrapperLegacy = /*#__PURE__*/forwardRef((props, ref) => {
387
389
  const isForeground = stackIndex === 0;
388
390
 
389
391
  // If no ref is provided, autofocus on first element
390
- const autoFocusLock = !(typeof autoFocus === 'object');
392
+ const autoFocusLock = !UNSAFE__disableAutoFocusForAsyncWrapper && !(typeof autoFocus === 'object');
391
393
  const onCloseHandler = useModalCloseHandler(providedOnClose);
392
394
  const onBlanketClicked = useCallback(e => {
393
395
  if (shouldCloseOnOverlayClick) {
@@ -1,14 +1,2 @@
1
1
  import { createContext } from 'react';
2
-
3
- // TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
4
- // Remove links that the component does not have (such as usage). If there are no links remove them all.
5
- /**
6
- * __Scroll context__
7
- *
8
- * A scroll context {description}.
9
- *
10
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
11
- * - [Code](https://atlassian.design/components/{packageName}/code)
12
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
13
- */
14
2
  export const ScrollContext = /*#__PURE__*/createContext(null);
@@ -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__disableAutoFocusForAsyncWrapper,
46
+ UNSAFE__disableAutoFocusForAsyncWrapper = _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__disableAutoFocusForAsyncWrapper);
77
79
  var _useOnMotionFinish = useOnMotionFinish({
78
80
  onOpenComplete: onOpenComplete,
79
81
  onCloseComplete: onCloseComplete
@@ -85,7 +85,7 @@ function useModalCloseHandler(providedOnClose) {
85
85
  action: 'closed',
86
86
  componentName: 'modalDialog',
87
87
  packageName: "@atlaskit/modal-dialog",
88
- packageVersion: "17.1.0"
88
+ packageVersion: "17.1.2"
89
89
  });
90
90
  }
91
91
  function getScrollMode(_ref) {
@@ -181,6 +181,7 @@ function getDismissedBy(_ref2) {
181
181
  */
182
182
  function ModalWrapperTopLayer(props) {
183
183
  var autoFocus = props.autoFocus,
184
+ UNSAFE__disableAutoFocusForAsyncWrapper = props.UNSAFE__disableAutoFocusForAsyncWrapper,
184
185
  _props$shouldCloseOnE = props.shouldCloseOnEscapePress,
185
186
  shouldCloseOnEscapePress = _props$shouldCloseOnE === void 0 ? true : _props$shouldCloseOnE,
186
187
  _props$shouldCloseOnO = props.shouldCloseOnOverlayClick,
@@ -308,7 +309,7 @@ function ModalWrapperTopLayer(props) {
308
309
 
309
310
  // Focus a ref-targeted element after mount (when autoFocus is a ref).
310
311
  // When true, native <dialog>.showModal() handles focus automatically.
311
- useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object');
312
+ useAutoFocus(_typeof(autoFocus) === 'object' ? autoFocus : undefined, _typeof(autoFocus) === 'object' && !UNSAFE__disableAutoFocusForAsyncWrapper);
312
313
 
313
314
  // Chrome cross-origin iframe DnD workaround (crbug.com/362301053)
314
315
  useEffect(function () {
@@ -363,6 +364,8 @@ function ModalWrapperTopLayer(props) {
363
364
  */
364
365
  var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
365
366
  var autoFocus = props.autoFocus,
367
+ _props$UNSAFE__disabl = props.UNSAFE__disableAutoFocusForAsyncWrapper,
368
+ UNSAFE__disableAutoFocusForAsyncWrapper = _props$UNSAFE__disabl === void 0 ? false : _props$UNSAFE__disabl,
366
369
  focusLockAllowlist = props.focusLockAllowlist,
367
370
  _props$shouldCloseOnE2 = props.shouldCloseOnEscapePress,
368
371
  shouldCloseOnEscapePress = _props$shouldCloseOnE2 === void 0 ? true : _props$shouldCloseOnE2,
@@ -394,7 +397,7 @@ var ModalWrapperLegacy = /*#__PURE__*/forwardRef(function (props, ref) {
394
397
  var isForeground = stackIndex === 0;
395
398
 
396
399
  // If no ref is provided, autofocus on first element
397
- var autoFocusLock = !(_typeof(autoFocus) === 'object');
400
+ var autoFocusLock = !UNSAFE__disableAutoFocusForAsyncWrapper && !(_typeof(autoFocus) === 'object');
398
401
  var onCloseHandler = useModalCloseHandler(providedOnClose);
399
402
  var onBlanketClicked = useCallback(function (e) {
400
403
  if (shouldCloseOnOverlayClick) {
@@ -1,14 +1,2 @@
1
1
  import { createContext } from 'react';
2
-
3
- // TODO: Fill in the component {description} and ensure links point to the correct {packageName} location.
4
- // Remove links that the component does not have (such as usage). If there are no links remove them all.
5
- /**
6
- * __Scroll context__
7
- *
8
- * A scroll context {description}.
9
- *
10
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
11
- * - [Code](https://atlassian.design/components/{packageName}/code)
12
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
13
- */
14
2
  export var ScrollContext = /*#__PURE__*/createContext(null);
@@ -1,11 +1,2 @@
1
1
  import { type Context } from 'react';
2
- /**
3
- * __Scroll context__
4
- *
5
- * A scroll context {description}.
6
- *
7
- * - [Examples](https://atlassian.design/components/{packageName}/examples)
8
- * - [Code](https://atlassian.design/components/{packageName}/code)
9
- * - [Usage](https://atlassian.design/components/{packageName}/usage)
10
- */
11
2
  export declare const ScrollContext: Context<boolean | null>;
@@ -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__disableAutoFocusForAsyncWrapper?: 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.1",
3
+ "version": "17.2.0",
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.5.0",
42
+ "@atlaskit/button": "^25.6.0",
43
43
  "@atlaskit/css": "^1.1.0",
44
44
  "@atlaskit/ds-lib": "^8.0.0",
45
45
  "@atlaskit/icon": "^38.0.0",
46
- "@atlaskit/layering": "^6.0.0",
47
- "@atlaskit/motion": "^9.4.0",
46
+ "@atlaskit/layering": "^6.1.0",
47
+ "@atlaskit/motion": "^9.5.0",
48
48
  "@atlaskit/platform-feature-flags": "^2.2.0",
49
- "@atlaskit/portal": "^7.0.0",
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.6.0",
55
- "@atlaskit/top-layer": "^6.4.0",
54
+ "@atlaskit/tokens": "^20.8.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",
@@ -73,19 +73,19 @@
73
73
  "@atlaskit/breadcrumbs": "^17.8.0",
74
74
  "@atlaskit/checkbox": "^19.3.0",
75
75
  "@atlaskit/code": "^20.0.0",
76
- "@atlaskit/datetime-picker": "^19.3.0",
76
+ "@atlaskit/datetime-picker": "^19.4.0",
77
77
  "@atlaskit/docs": "^12.3.0",
78
78
  "@atlaskit/dropdown-menu": "^21.0.0",
79
79
  "@atlaskit/flag": "^19.0.0",
80
- "@atlaskit/form": "^18.2.0",
80
+ "@atlaskit/form": "^18.3.0",
81
81
  "@atlaskit/heading": "^8.0.0",
82
82
  "@atlaskit/link": "^5.1.0",
83
- "@atlaskit/popup": "^10.0.0",
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",
87
87
  "@atlaskit/spotlight": "^4.2.0",
88
- "@atlaskit/textfield": "^10.2.0",
88
+ "@atlaskit/textfield": "^10.3.0",
89
89
  "@atlaskit/tooltip": "^24.4.0",
90
90
  "@atlassian/feature-flags-test-utils": "^1.3.0",
91
91
  "@atlassian/ssr-tests": "workspace:^",