@atlaskit/modal-dialog 12.8.4 → 12.9.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,17 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 12.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#43674](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43674) [`4061f5b29f8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4061f5b29f8) - [ux] shouldReturnFocus now can accept ref as a value to return focus to a specified element on modal close.
8
+
9
+ ## 12.8.5
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 12.8.4
4
16
 
5
17
  ### Patch Changes
@@ -87,7 +87,7 @@ var ModalWrapper = function ModalWrapper(props) {
87
87
  action: 'closed',
88
88
  componentName: 'modalDialog',
89
89
  packageName: "@atlaskit/modal-dialog",
90
- packageVersion: "12.8.4"
90
+ packageVersion: "12.9.0"
91
91
  });
92
92
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
93
93
  if (shouldCloseOnOverlayClick) {
@@ -112,6 +112,18 @@ var ModalWrapper = function ModalWrapper(props) {
112
112
  onCloseComplete: onCloseComplete,
113
113
  onOpenComplete: onOpenComplete
114
114
  }, children));
115
+ var returnFocus = true;
116
+ var onDeactivation;
117
+ if ('boolean' === typeof shouldReturnFocus) {
118
+ returnFocus = shouldReturnFocus;
119
+ } else {
120
+ onDeactivation = function onDeactivation() {
121
+ window.setTimeout(function () {
122
+ var _shouldReturnFocus$cu;
123
+ (_shouldReturnFocus$cu = shouldReturnFocus.current) === null || _shouldReturnFocus$cu === void 0 || _shouldReturnFocus$cu.focus();
124
+ }, 0);
125
+ };
126
+ }
115
127
  return (0, _react2.jsx)(_layering.UNSAFE_LAYERING, {
116
128
  isDisabled: (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.layering_qmiw3') ? false : true
117
129
  }, (0, _react2.jsx)(_portal.default, {
@@ -123,7 +135,8 @@ var ModalWrapper = function ModalWrapper(props) {
123
135
  }), (0, _react2.jsx)(_reactFocusLock.default, {
124
136
  autoFocus: autoFocusLock,
125
137
  disabled: !isForeground,
126
- returnFocus: shouldReturnFocus,
138
+ returnFocus: returnFocus,
139
+ onDeactivation: onDeactivation,
127
140
  whiteList: whiteListElements
128
141
  }, (0, _react2.jsx)(_reactScrolllock.default, null), shouldScrollInViewport ? (0, _react2.jsx)(_reactScrolllock.TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket));
129
142
  })));
@@ -72,7 +72,7 @@ const ModalWrapper = props => {
72
72
  action: 'closed',
73
73
  componentName: 'modalDialog',
74
74
  packageName: "@atlaskit/modal-dialog",
75
- packageVersion: "12.8.4"
75
+ packageVersion: "12.9.0"
76
76
  });
77
77
  const onBlanketClicked = useCallback(e => {
78
78
  if (shouldCloseOnOverlayClick) {
@@ -97,6 +97,18 @@ const ModalWrapper = props => {
97
97
  onCloseComplete: onCloseComplete,
98
98
  onOpenComplete: onOpenComplete
99
99
  }, children));
100
+ let returnFocus = true;
101
+ let onDeactivation;
102
+ if ('boolean' === typeof shouldReturnFocus) {
103
+ returnFocus = shouldReturnFocus;
104
+ } else {
105
+ onDeactivation = () => {
106
+ window.setTimeout(() => {
107
+ var _shouldReturnFocus$cu;
108
+ (_shouldReturnFocus$cu = shouldReturnFocus.current) === null || _shouldReturnFocus$cu === void 0 ? void 0 : _shouldReturnFocus$cu.focus();
109
+ }, 0);
110
+ };
111
+ }
100
112
  return jsx(UNSAFE_LAYERING, {
101
113
  isDisabled: getBooleanFF('platform.design-system-team.layering_qmiw3') ? false : true
102
114
  }, jsx(Portal, {
@@ -107,7 +119,8 @@ const ModalWrapper = props => {
107
119
  }), jsx(FocusLock, {
108
120
  autoFocus: autoFocusLock,
109
121
  disabled: !isForeground,
110
- returnFocus: shouldReturnFocus,
122
+ returnFocus: returnFocus,
123
+ onDeactivation: onDeactivation,
111
124
  whiteList: whiteListElements
112
125
  }, jsx(ScrollLock, null), shouldScrollInViewport ? jsx(TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket)))));
113
126
  };
@@ -77,7 +77,7 @@ var ModalWrapper = function ModalWrapper(props) {
77
77
  action: 'closed',
78
78
  componentName: 'modalDialog',
79
79
  packageName: "@atlaskit/modal-dialog",
80
- packageVersion: "12.8.4"
80
+ packageVersion: "12.9.0"
81
81
  });
82
82
  var onBlanketClicked = useCallback(function (e) {
83
83
  if (shouldCloseOnOverlayClick) {
@@ -102,6 +102,18 @@ var ModalWrapper = function ModalWrapper(props) {
102
102
  onCloseComplete: onCloseComplete,
103
103
  onOpenComplete: onOpenComplete
104
104
  }, children));
105
+ var returnFocus = true;
106
+ var onDeactivation;
107
+ if ('boolean' === typeof shouldReturnFocus) {
108
+ returnFocus = shouldReturnFocus;
109
+ } else {
110
+ onDeactivation = function onDeactivation() {
111
+ window.setTimeout(function () {
112
+ var _shouldReturnFocus$cu;
113
+ (_shouldReturnFocus$cu = shouldReturnFocus.current) === null || _shouldReturnFocus$cu === void 0 || _shouldReturnFocus$cu.focus();
114
+ }, 0);
115
+ };
116
+ }
105
117
  return jsx(UNSAFE_LAYERING, {
106
118
  isDisabled: getBooleanFF('platform.design-system-team.layering_qmiw3') ? false : true
107
119
  }, jsx(Portal, {
@@ -113,7 +125,8 @@ var ModalWrapper = function ModalWrapper(props) {
113
125
  }), jsx(FocusLock, {
114
126
  autoFocus: autoFocusLock,
115
127
  disabled: !isForeground,
116
- returnFocus: shouldReturnFocus,
128
+ returnFocus: returnFocus,
129
+ onDeactivation: onDeactivation,
117
130
  whiteList: whiteListElements
118
131
  }, jsx(ScrollLock, null), shouldScrollInViewport ? jsx(TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket));
119
132
  })));
@@ -66,7 +66,7 @@ export interface ModalDialogProps {
66
66
  * focus lock mode. If true, focus will be returned to the element that had focus before focus lock
67
67
  * was activated. If false, focus remains where it was when the FocusLock was deactivated.
68
68
  */
69
- shouldReturnFocus?: boolean;
69
+ shouldReturnFocus?: boolean | RefObject<HTMLElement>;
70
70
  /**
71
71
  * Will remove the blanket tinted background color.
72
72
  */
@@ -66,7 +66,7 @@ export interface ModalDialogProps {
66
66
  * focus lock mode. If true, focus will be returned to the element that had focus before focus lock
67
67
  * was activated. If false, focus remains where it was when the FocusLock was deactivated.
68
68
  */
69
- shouldReturnFocus?: boolean;
69
+ shouldReturnFocus?: boolean | RefObject<HTMLElement>;
70
70
  /**
71
71
  * Will remove the blanket tinted background color.
72
72
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.8.4",
3
+ "version": "12.9.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/"
@@ -31,14 +31,14 @@
31
31
  "@atlaskit/codemod-utils": "^4.2.0",
32
32
  "@atlaskit/ds-lib": "^2.2.0",
33
33
  "@atlaskit/focus-ring": "^1.3.0",
34
- "@atlaskit/icon": "^21.12.0",
34
+ "@atlaskit/icon": "^22.0.0",
35
35
  "@atlaskit/layering": "^0.2.0",
36
36
  "@atlaskit/motion": "^1.5.0",
37
37
  "@atlaskit/platform-feature-flags": "^0.2.0",
38
38
  "@atlaskit/portal": "^4.4.0",
39
- "@atlaskit/primitives": "^1.9.0",
39
+ "@atlaskit/primitives": "^1.12.0",
40
40
  "@atlaskit/theme": "^12.6.0",
41
- "@atlaskit/tokens": "^1.28.0",
41
+ "@atlaskit/tokens": "^1.29.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "@emotion/react": "^11.7.1",
44
44
  "bind-event-listener": "^2.1.1",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/button": "*",
58
58
  "@atlaskit/dropdown-menu": "^12.0.0",
59
59
  "@atlaskit/popup": "^1.10.0",
60
- "@atlaskit/select": "^16.7.0",
60
+ "@atlaskit/select": "^17.0.0",
61
61
  "@atlaskit/ssr": "*",
62
62
  "@atlaskit/visual-regression": "*",
63
63
  "@atlaskit/webdriver-runner": "*",
package/report.api.md CHANGED
@@ -62,7 +62,7 @@ export interface ModalDialogProps {
62
62
  onStackChange?: OnStackChangeHandler;
63
63
  shouldCloseOnEscapePress?: boolean;
64
64
  shouldCloseOnOverlayClick?: boolean;
65
- shouldReturnFocus?: boolean;
65
+ shouldReturnFocus?: RefObject<HTMLElement> | boolean;
66
66
  shouldScrollInViewport?: boolean;
67
67
  stackIndex?: number;
68
68
  testId?: string;
@@ -48,7 +48,7 @@ export interface ModalDialogProps {
48
48
  onStackChange?: OnStackChangeHandler;
49
49
  shouldCloseOnEscapePress?: boolean;
50
50
  shouldCloseOnOverlayClick?: boolean;
51
- shouldReturnFocus?: boolean;
51
+ shouldReturnFocus?: RefObject<HTMLElement> | boolean;
52
52
  shouldScrollInViewport?: boolean;
53
53
  stackIndex?: number;
54
54
  testId?: string;