@atlaskit/modal-dialog 12.7.1 → 12.8.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 +12 -0
- package/dist/cjs/hooks.js +2 -3
- package/dist/cjs/internal/components/modal-dialog.js +1 -2
- package/dist/cjs/internal/components/positioner.js +1 -2
- package/dist/cjs/internal/components/scroll-container.js +1 -2
- package/dist/cjs/internal/constants.js +11 -21
- package/dist/cjs/internal/context.js +2 -4
- package/dist/cjs/internal/utils.js +3 -5
- package/dist/cjs/modal-body.js +1 -2
- package/dist/cjs/modal-footer.js +1 -2
- package/dist/cjs/modal-header.js +1 -2
- package/dist/cjs/modal-title.js +1 -2
- package/dist/cjs/modal-transition.js +1 -2
- package/dist/cjs/modal-wrapper.js +5 -4
- package/dist/es2019/modal-wrapper.js +3 -2
- package/dist/esm/modal-wrapper.js +4 -2
- package/dist/types/types.d.ts +6 -0
- package/dist/types-ts4.5/types.d.ts +6 -0
- package/package.json +2 -2
- package/report.api.md +1 -0
- package/tmp/api-report-tmp.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/modal-dialog
|
|
2
2
|
|
|
3
|
+
## 12.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#40647](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40647) [`0de92f17021`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0de92f17021) - Bump react-focus-lock to latest version
|
|
8
|
+
|
|
9
|
+
## 12.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#39425](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39425) [`f0df9a3b6e7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f0df9a3b6e7) - [ED-19408] Add new prop to modal shouldReturnFocus - shouldReturnFocus is used to control what happens when the user exits focus lock mode. If true, focus will be returned to the element that had focus before focus lock was activated. If false, focus remains where it was when the FocusLock was deactivated
|
|
14
|
+
|
|
3
15
|
## 12.7.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/hooks.js
CHANGED
|
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useModal = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _context = require("./internal/context");
|
|
9
|
-
var useModal = function useModal() {
|
|
9
|
+
var useModal = exports.useModal = function useModal() {
|
|
10
10
|
var modalContext = (0, _react.useContext)(_context.ModalContext);
|
|
11
11
|
if (modalContext == null) {
|
|
12
12
|
throw Error('@atlaskit/modal-dialog: Modal context unavailable – this component needs to be a child of ModalDialog.');
|
|
13
13
|
}
|
|
14
14
|
return modalContext;
|
|
15
|
-
};
|
|
16
|
-
exports.useModal = useModal;
|
|
15
|
+
};
|
|
@@ -120,5 +120,4 @@ var ScrollContainer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
|
120
120
|
}, children));
|
|
121
121
|
});
|
|
122
122
|
ScrollContainer.displayName = 'ScrollContainer';
|
|
123
|
-
var _default = ScrollContainer;
|
|
124
|
-
exports.default = _default;
|
|
123
|
+
var _default = exports.default = ScrollContainer;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.width = exports.verticalOffset = exports.titleIconMargin = exports.textColor = exports.padding = exports.keylineHeight = exports.keylineColor = exports.iconColor = exports.gutter = exports.borderRadius = void 0;
|
|
7
7
|
var _colors = require("@atlaskit/theme/colors");
|
|
8
8
|
var _constants = require("@atlaskit/theme/constants");
|
|
9
|
-
var width = {
|
|
9
|
+
var width = exports.width = {
|
|
10
10
|
values: ['small', 'medium', 'large', 'x-large'],
|
|
11
11
|
widths: {
|
|
12
12
|
small: 400,
|
|
@@ -16,26 +16,16 @@ var width = {
|
|
|
16
16
|
},
|
|
17
17
|
defaultValue: 'medium'
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
20
|
-
var gutter = 60;
|
|
21
|
-
exports.gutter = gutter;
|
|
19
|
+
var gutter = exports.gutter = 60;
|
|
22
20
|
var gridSize = (0, _constants.gridSize)();
|
|
23
|
-
var borderRadius = (0, _constants.borderRadius)();
|
|
24
|
-
exports.
|
|
25
|
-
var
|
|
26
|
-
exports.
|
|
27
|
-
var
|
|
28
|
-
exports.
|
|
29
|
-
var
|
|
30
|
-
exports.
|
|
31
|
-
var keylineHeight = 2;
|
|
32
|
-
exports.keylineHeight = keylineHeight;
|
|
33
|
-
var keylineColor = "var(--ds-border, ".concat(_colors.N30, ")");
|
|
34
|
-
exports.keylineColor = keylineColor;
|
|
35
|
-
var textColor = "var(--ds-text, ".concat(_colors.N900, ")");
|
|
36
|
-
exports.textColor = textColor;
|
|
37
|
-
var iconColor = {
|
|
21
|
+
var borderRadius = exports.borderRadius = (0, _constants.borderRadius)();
|
|
22
|
+
var verticalOffset = exports.verticalOffset = gridSize * 2;
|
|
23
|
+
var padding = exports.padding = gridSize * 3;
|
|
24
|
+
var titleIconMargin = exports.titleIconMargin = gridSize;
|
|
25
|
+
var keylineHeight = exports.keylineHeight = 2;
|
|
26
|
+
var keylineColor = exports.keylineColor = "var(--ds-border, ".concat(_colors.N30, ")");
|
|
27
|
+
var textColor = exports.textColor = "var(--ds-text, ".concat(_colors.N900, ")");
|
|
28
|
+
var iconColor = exports.iconColor = {
|
|
38
29
|
danger: "var(--ds-icon-danger, ".concat(_colors.R400, ")"),
|
|
39
30
|
warning: "var(--ds-icon-warning, #D97008)"
|
|
40
|
-
};
|
|
41
|
-
exports.iconColor = iconColor;
|
|
31
|
+
};
|
|
@@ -6,7 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ScrollContext = exports.ModalContext = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
9
|
-
var ModalContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
10
|
-
exports.
|
|
11
|
-
var ScrollContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
12
|
-
exports.ScrollContext = ScrollContext;
|
|
9
|
+
var ModalContext = exports.ModalContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
10
|
+
var ScrollContext = exports.ScrollContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.dialogWidth = exports.dialogHeight = void 0;
|
|
7
7
|
var _constants = require("./constants");
|
|
8
|
-
var dialogWidth = function dialogWidth(input) {
|
|
8
|
+
var dialogWidth = exports.dialogWidth = function dialogWidth(input) {
|
|
9
9
|
if (!input) {
|
|
10
10
|
return 'auto';
|
|
11
11
|
}
|
|
@@ -16,11 +16,9 @@ var dialogWidth = function dialogWidth(input) {
|
|
|
16
16
|
}
|
|
17
17
|
return typeof input === 'number' ? "".concat(input, "px") : input;
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
20
|
-
var dialogHeight = function dialogHeight(input) {
|
|
19
|
+
var dialogHeight = exports.dialogHeight = function dialogHeight(input) {
|
|
21
20
|
if (!input) {
|
|
22
21
|
return 'auto';
|
|
23
22
|
}
|
|
24
23
|
return typeof input === 'number' ? "".concat(input, "px") : input;
|
|
25
|
-
};
|
|
26
|
-
exports.dialogHeight = dialogHeight;
|
|
24
|
+
};
|
package/dist/cjs/modal-body.js
CHANGED
package/dist/cjs/modal-footer.js
CHANGED
package/dist/cjs/modal-header.js
CHANGED
package/dist/cjs/modal-title.js
CHANGED
|
@@ -58,6 +58,8 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
58
58
|
shouldCloseOnOverlayClick = _props$shouldCloseOnO === void 0 ? true : _props$shouldCloseOnO,
|
|
59
59
|
_props$shouldScrollIn = props.shouldScrollInViewport,
|
|
60
60
|
shouldScrollInViewport = _props$shouldScrollIn === void 0 ? false : _props$shouldScrollIn,
|
|
61
|
+
_props$shouldReturnFo = props.shouldReturnFocus,
|
|
62
|
+
shouldReturnFocus = _props$shouldReturnFo === void 0 ? true : _props$shouldReturnFo,
|
|
61
63
|
stackIndexOverride = props.stackIndex,
|
|
62
64
|
_props$onClose = props.onClose,
|
|
63
65
|
onClose = _props$onClose === void 0 ? _noop.default : _props$onClose,
|
|
@@ -84,7 +86,7 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
84
86
|
action: 'closed',
|
|
85
87
|
componentName: 'modalDialog',
|
|
86
88
|
packageName: "@atlaskit/modal-dialog",
|
|
87
|
-
packageVersion: "12.
|
|
89
|
+
packageVersion: "12.8.1"
|
|
88
90
|
});
|
|
89
91
|
var onBlanketClicked = (0, _react.useCallback)(function (e) {
|
|
90
92
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -118,10 +120,9 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
118
120
|
}), (0, _react2.jsx)(_reactFocusLock.default, {
|
|
119
121
|
autoFocus: autoFocusLock,
|
|
120
122
|
disabled: !isForeground,
|
|
121
|
-
returnFocus:
|
|
123
|
+
returnFocus: shouldReturnFocus,
|
|
122
124
|
whiteList: whiteListElements
|
|
123
125
|
}, (0, _react2.jsx)(_reactScrolllock.default, null), shouldScrollInViewport ? (0, _react2.jsx)(_reactScrolllock.TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket));
|
|
124
126
|
})));
|
|
125
127
|
};
|
|
126
|
-
var _default = ModalWrapper;
|
|
127
|
-
exports.default = _default;
|
|
128
|
+
var _default = exports.default = ModalWrapper;
|
|
@@ -45,6 +45,7 @@ const ModalWrapper = props => {
|
|
|
45
45
|
shouldCloseOnEscapePress = true,
|
|
46
46
|
shouldCloseOnOverlayClick = true,
|
|
47
47
|
shouldScrollInViewport = false,
|
|
48
|
+
shouldReturnFocus = true,
|
|
48
49
|
stackIndex: stackIndexOverride,
|
|
49
50
|
onClose = noop,
|
|
50
51
|
onStackChange = noop,
|
|
@@ -70,7 +71,7 @@ const ModalWrapper = props => {
|
|
|
70
71
|
action: 'closed',
|
|
71
72
|
componentName: 'modalDialog',
|
|
72
73
|
packageName: "@atlaskit/modal-dialog",
|
|
73
|
-
packageVersion: "12.
|
|
74
|
+
packageVersion: "12.8.1"
|
|
74
75
|
});
|
|
75
76
|
const onBlanketClicked = useCallback(e => {
|
|
76
77
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -103,7 +104,7 @@ const ModalWrapper = props => {
|
|
|
103
104
|
}), jsx(FocusLock, {
|
|
104
105
|
autoFocus: autoFocusLock,
|
|
105
106
|
disabled: !isForeground,
|
|
106
|
-
returnFocus:
|
|
107
|
+
returnFocus: shouldReturnFocus,
|
|
107
108
|
whiteList: whiteListElements
|
|
108
109
|
}, jsx(ScrollLock, null), shouldScrollInViewport ? jsx(TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket)))));
|
|
109
110
|
};
|
|
@@ -48,6 +48,8 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
48
48
|
shouldCloseOnOverlayClick = _props$shouldCloseOnO === void 0 ? true : _props$shouldCloseOnO,
|
|
49
49
|
_props$shouldScrollIn = props.shouldScrollInViewport,
|
|
50
50
|
shouldScrollInViewport = _props$shouldScrollIn === void 0 ? false : _props$shouldScrollIn,
|
|
51
|
+
_props$shouldReturnFo = props.shouldReturnFocus,
|
|
52
|
+
shouldReturnFocus = _props$shouldReturnFo === void 0 ? true : _props$shouldReturnFo,
|
|
51
53
|
stackIndexOverride = props.stackIndex,
|
|
52
54
|
_props$onClose = props.onClose,
|
|
53
55
|
onClose = _props$onClose === void 0 ? noop : _props$onClose,
|
|
@@ -74,7 +76,7 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
74
76
|
action: 'closed',
|
|
75
77
|
componentName: 'modalDialog',
|
|
76
78
|
packageName: "@atlaskit/modal-dialog",
|
|
77
|
-
packageVersion: "12.
|
|
79
|
+
packageVersion: "12.8.1"
|
|
78
80
|
});
|
|
79
81
|
var onBlanketClicked = useCallback(function (e) {
|
|
80
82
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -108,7 +110,7 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
108
110
|
}), jsx(FocusLock, {
|
|
109
111
|
autoFocus: autoFocusLock,
|
|
110
112
|
disabled: !isForeground,
|
|
111
|
-
returnFocus:
|
|
113
|
+
returnFocus: shouldReturnFocus,
|
|
112
114
|
whiteList: whiteListElements
|
|
113
115
|
}, jsx(ScrollLock, null), shouldScrollInViewport ? jsx(TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket));
|
|
114
116
|
})));
|
package/dist/types/types.d.ts
CHANGED
|
@@ -61,6 +61,12 @@ export interface ModalDialogProps {
|
|
|
61
61
|
* Calls `onClose` when pressing escape.
|
|
62
62
|
*/
|
|
63
63
|
shouldCloseOnEscapePress?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* ReturnFocus is used to control what happens when the user exists
|
|
66
|
+
* focus lock mode. If true, focus will be returned to the element that had focus before focus lock
|
|
67
|
+
* was activated. If false, focus remains where it was when the FocusLock was deactivated.
|
|
68
|
+
*/
|
|
69
|
+
shouldReturnFocus?: boolean;
|
|
64
70
|
/**
|
|
65
71
|
* Will remove the blanket tinted background color.
|
|
66
72
|
*/
|
|
@@ -61,6 +61,12 @@ export interface ModalDialogProps {
|
|
|
61
61
|
* Calls `onClose` when pressing escape.
|
|
62
62
|
*/
|
|
63
63
|
shouldCloseOnEscapePress?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* ReturnFocus is used to control what happens when the user exists
|
|
66
|
+
* focus lock mode. If true, focus will be returned to the element that had focus before focus lock
|
|
67
|
+
* was activated. If false, focus remains where it was when the FocusLock was deactivated.
|
|
68
|
+
*/
|
|
69
|
+
shouldReturnFocus?: boolean;
|
|
64
70
|
/**
|
|
65
71
|
* Will remove the blanket tinted background color.
|
|
66
72
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/modal-dialog",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.8.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/"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@emotion/react": "^11.7.1",
|
|
43
43
|
"bind-event-listener": "^2.1.1",
|
|
44
44
|
"raf-schd": "^4.0.3",
|
|
45
|
-
"react-focus-lock": "^2.5
|
|
45
|
+
"react-focus-lock": "^2.9.5",
|
|
46
46
|
"react-scrolllock": "^5.0.1",
|
|
47
47
|
"react-uid": "^2.2.0"
|
|
48
48
|
},
|
package/report.api.md
CHANGED
|
@@ -62,6 +62,7 @@ export interface ModalDialogProps {
|
|
|
62
62
|
onStackChange?: OnStackChangeHandler;
|
|
63
63
|
shouldCloseOnEscapePress?: boolean;
|
|
64
64
|
shouldCloseOnOverlayClick?: boolean;
|
|
65
|
+
shouldReturnFocus?: boolean;
|
|
65
66
|
shouldScrollInViewport?: boolean;
|
|
66
67
|
stackIndex?: number;
|
|
67
68
|
testId?: string;
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export interface ModalDialogProps {
|
|
|
48
48
|
onStackChange?: OnStackChangeHandler;
|
|
49
49
|
shouldCloseOnEscapePress?: boolean;
|
|
50
50
|
shouldCloseOnOverlayClick?: boolean;
|
|
51
|
+
shouldReturnFocus?: boolean;
|
|
51
52
|
shouldScrollInViewport?: boolean;
|
|
52
53
|
stackIndex?: number;
|
|
53
54
|
testId?: string;
|