@atlaskit/modal-dialog 12.2.13 → 12.3.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 +23 -0
- package/__perf__/default.tsx +3 -1
- package/__perf__/interactions.tsx +1 -1
- package/__perf__/scroll.tsx +1 -1
- package/codemods/{12.0.0-lite-mode.ts → 12.0.0-lite-mode.tsx} +2 -2
- package/codemods/__tests__/{12.0.0-lite-mode.test.ts → 12.0.0-lite-mode.test.tsx} +0 -0
- package/codemods/__tests__/{inline-WidthNames-declaration.test.ts → inline-width-names-declaration.test.tsx} +1 -1
- package/codemods/__tests__/{map-body-from-props.test.ts → map-body-from-props.test.tsx} +0 -0
- package/codemods/__tests__/{map-container-from-props.test.ts → map-container-from-props.test.tsx} +0 -0
- package/codemods/__tests__/{map-footer-from-props.test.ts → map-footer-from-props.test.tsx} +0 -0
- package/codemods/__tests__/{map-header-from-props.test.ts → map-header-from-props.test.tsx} +0 -0
- package/codemods/__tests__/{remove-appearance-prop.test.ts → remove-appearance-prop.test.tsx} +0 -0
- package/codemods/__tests__/{remove-component-override-props.test.ts → remove-component-override-props.test.tsx} +0 -0
- package/codemods/__tests__/{rename-appearance-type.test.ts → rename-appearance-type.test.tsx} +0 -0
- package/codemods/__tests__/{rename-inner-component-prop-types.test.ts → rename-inner-component-prop-types.test.tsx} +0 -0
- package/codemods/__tests__/{rename-scrollBehavior-to-shouldScrollInViewport.test.ts → rename-scroll-behavior-to-should-scroll-in-viewport.test.tsx} +1 -1
- package/codemods/migrations/{inline-WidthNames-declaration.ts → inline-width-names-declaration.tsx} +0 -0
- package/codemods/migrations/{map-body-from-props.ts → map-body-from-props.tsx} +0 -0
- package/codemods/migrations/{map-container-from-props.ts → map-container-from-props.tsx} +0 -0
- package/codemods/migrations/{map-footer-from-props.ts → map-footer-from-props.tsx} +0 -0
- package/codemods/migrations/{map-header-from-props.ts → map-header-from-props.tsx} +0 -0
- package/codemods/migrations/{remove-appearance-prop.ts → remove-appearance-prop.tsx} +0 -0
- package/codemods/migrations/{remove-component-override-props.ts → remove-component-override-props.tsx} +0 -0
- package/codemods/migrations/{rename-appearance-type.ts → rename-appearance-type.tsx} +0 -0
- package/codemods/migrations/{rename-inner-component-prop-types.ts → rename-inner-component-prop-types.tsx} +0 -0
- package/codemods/migrations/{rename-scrollBehavior-to-shouldScrollInViewport.ts → rename-scroll-behavior-to-should-scroll-in-viewport.tsx} +0 -0
- package/dist/cjs/internal/components/modal-dialog.js +2 -1
- package/dist/cjs/internal/components/positioner.js +6 -3
- package/dist/cjs/internal/context.js +1 -0
- package/dist/cjs/internal/hooks/use-on-motion-finish.js +1 -0
- package/dist/cjs/internal/hooks/use-scroll.js +1 -0
- package/dist/cjs/modal-body.js +13 -2
- package/dist/cjs/modal-footer.js +9 -0
- package/dist/cjs/modal-header.js +9 -0
- package/dist/cjs/modal-title.js +13 -2
- package/dist/cjs/modal-transition.js +9 -0
- package/dist/cjs/modal-wrapper.js +33 -11
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/internal/components/modal-dialog.js +2 -1
- package/dist/es2019/internal/components/positioner.js +6 -3
- package/dist/es2019/internal/context.js +1 -0
- package/dist/es2019/internal/hooks/use-on-motion-finish.js +1 -0
- package/dist/es2019/internal/hooks/use-scroll.js +2 -1
- package/dist/es2019/modal-body.js +13 -2
- package/dist/es2019/modal-footer.js +9 -0
- package/dist/es2019/modal-header.js +9 -0
- package/dist/es2019/modal-title.js +13 -2
- package/dist/es2019/modal-transition.js +9 -0
- package/dist/es2019/modal-wrapper.js +32 -7
- package/dist/es2019/version.json +1 -1
- package/dist/esm/internal/components/modal-dialog.js +2 -1
- package/dist/esm/internal/components/positioner.js +6 -3
- package/dist/esm/internal/context.js +1 -0
- package/dist/esm/internal/hooks/use-on-motion-finish.js +1 -0
- package/dist/esm/internal/hooks/use-scroll.js +2 -1
- package/dist/esm/modal-body.js +13 -2
- package/dist/esm/modal-footer.js +9 -0
- package/dist/esm/modal-header.js +9 -0
- package/dist/esm/modal-title.js +13 -2
- package/dist/esm/modal-transition.js +9 -0
- package/dist/esm/modal-wrapper.js +32 -10
- package/dist/esm/version.json +1 -1
- package/dist/types/modal-body.d.ts +9 -0
- package/dist/types/modal-footer.d.ts +9 -0
- package/dist/types/modal-header.d.ts +9 -0
- package/dist/types/modal-title.d.ts +9 -0
- package/dist/types/modal-transition.d.ts +9 -0
- package/dist/types/modal-wrapper.d.ts +10 -0
- package/dist/types/types.d.ts +2 -2
- package/package.json +10 -9
- package/report.api.md +210 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/modal-dialog
|
|
2
2
|
|
|
3
|
+
## 12.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c44f3f5f973`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c44f3f5f973) - Modal Dialog’s focus lock now allows focus to reach elements outside the modal if they contain the data-atlas-extension attribute, such as a browser extension that renders in-browser.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 12.2.15
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
18
|
+
|
|
19
|
+
## 12.2.14
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`454ec1bbf07`](https://bitbucket.org/atlassian/atlassian-frontend/commits/454ec1bbf07) - Internal code change turning on new linting rules.
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 12.2.13
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/__perf__/default.tsx
CHANGED
package/__perf__/scroll.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@atlaskit/codemod-utils';
|
|
8
8
|
|
|
9
9
|
import { handlePropSpread } from './migrations/handle-prop-spread';
|
|
10
|
-
import { inlineWidthNamesDeclaration } from './migrations/inline-
|
|
10
|
+
import { inlineWidthNamesDeclaration } from './migrations/inline-width-names-declaration';
|
|
11
11
|
import { mapActionsProp } from './migrations/map-actions-prop';
|
|
12
12
|
import { mapBodyFromProps } from './migrations/map-body-from-props';
|
|
13
13
|
import { mapContainerFromProps } from './migrations/map-container-from-props';
|
|
@@ -19,7 +19,7 @@ import { removeComponentOverrideProps } from './migrations/remove-component-over
|
|
|
19
19
|
import { removeIsChromeless } from './migrations/remove-is-chromeless';
|
|
20
20
|
import { renameAppearanceType } from './migrations/rename-appearance-type';
|
|
21
21
|
import { renameInnerComponentPropTypes } from './migrations/rename-inner-component-prop-types';
|
|
22
|
-
import { renameScrollBehaviorToShouldScrollInViewport } from './migrations/rename-
|
|
22
|
+
import { renameScrollBehaviorToShouldScrollInViewport } from './migrations/rename-scroll-behavior-to-should-scroll-in-viewport';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The order of these migrations matters!
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTransformer } from '@atlaskit/codemod-utils';
|
|
2
2
|
|
|
3
|
-
import { inlineWidthNamesDeclaration } from '../migrations/inline-
|
|
3
|
+
import { inlineWidthNamesDeclaration } from '../migrations/inline-width-names-declaration';
|
|
4
4
|
|
|
5
5
|
const transformer = createTransformer([inlineWidthNamesDeclaration]);
|
|
6
6
|
|
|
File without changes
|
package/codemods/__tests__/{map-container-from-props.test.ts → map-container-from-props.test.tsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/codemods/__tests__/{remove-appearance-prop.test.ts → remove-appearance-prop.test.tsx}
RENAMED
|
File without changes
|
|
File without changes
|
package/codemods/__tests__/{rename-appearance-type.test.ts → rename-appearance-type.test.tsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTransformer } from '@atlaskit/codemod-utils';
|
|
2
2
|
|
|
3
|
-
import { renameScrollBehaviorToShouldScrollInViewport } from '../migrations/rename-
|
|
3
|
+
import { renameScrollBehaviorToShouldScrollInViewport } from '../migrations/rename-scroll-behavior-to-should-scroll-in-viewport';
|
|
4
4
|
|
|
5
5
|
const transformer = createTransformer([
|
|
6
6
|
renameScrollBehaviorToShouldScrollInViewport,
|
package/codemods/migrations/{inline-WidthNames-declaration.ts → inline-width-names-declaration.tsx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -152,7 +152,8 @@ var ModalDialog = function ModalDialog(props) {
|
|
|
152
152
|
"aria-modal": true
|
|
153
153
|
}), children));
|
|
154
154
|
}))));
|
|
155
|
-
};
|
|
155
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
156
|
+
|
|
156
157
|
|
|
157
158
|
var _default = ModalDialog;
|
|
158
159
|
exports.default = _default;
|
|
@@ -56,9 +56,11 @@ var stackTransitionStyles = (0, _core.css)({
|
|
|
56
56
|
transitionProperty: 'transform',
|
|
57
57
|
transitionTimingFunction: _curves.easeInOut,
|
|
58
58
|
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Duplicated from @atlaskit/motion/accessibility
|
|
60
61
|
* because @repo/internal/styles/consistent-style-ordering
|
|
61
|
-
* doesn't work well with object spreading.
|
|
62
|
+
* doesn't work well with object spreading.
|
|
63
|
+
*/
|
|
62
64
|
'@media (prefers-reduced-motion: reduce)': {
|
|
63
65
|
animation: 'none',
|
|
64
66
|
transition: 'none'
|
|
@@ -85,7 +87,8 @@ var Positioner = function Positioner(props) {
|
|
|
85
87
|
stackIndex > 0 ? stackTransformStyles : stackIdleStyles, shouldScrollInViewport ? viewportScrollStyles : bodyScrollStyles],
|
|
86
88
|
"data-testid": testId && "".concat(testId, "--positioner")
|
|
87
89
|
}, children);
|
|
88
|
-
};
|
|
90
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
91
|
+
|
|
89
92
|
|
|
90
93
|
var _default = Positioner;
|
|
91
94
|
exports.default = _default;
|
|
@@ -7,6 +7,7 @@ exports.ScrollContext = exports.ModalContext = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
10
11
|
var ModalContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
11
12
|
exports.ModalContext = ModalContext;
|
|
12
13
|
var ScrollContext = /*#__PURE__*/(0, _react.createContext)(null);
|
package/dist/cjs/modal-body.js
CHANGED
|
@@ -29,19 +29,30 @@ var bodyStyles = (0, _core.css)({
|
|
|
29
29
|
/**
|
|
30
30
|
* Adding the padding here avoids cropping the keyline on its sides.
|
|
31
31
|
* The combined vertical spacing is maintained by subtracting the
|
|
32
|
-
* keyline height from header and footer.
|
|
32
|
+
* keyline height from header and footer.
|
|
33
|
+
*/
|
|
33
34
|
|
|
34
35
|
var bodyScrollStyles = (0, _core.css)({
|
|
35
36
|
padding: "".concat(_constants.keylineHeight, "px ").concat(_constants.padding, "px")
|
|
36
37
|
});
|
|
37
38
|
/**
|
|
38
39
|
* Keylines will not be shown if scrolling in viewport so we do
|
|
39
|
-
* not account for them in this case.
|
|
40
|
+
* not account for them in this case.
|
|
41
|
+
*/
|
|
40
42
|
|
|
41
43
|
var viewportScrollStyles = (0, _core.css)({
|
|
42
44
|
padding: "0px ".concat(_constants.padding, "px")
|
|
43
45
|
});
|
|
44
46
|
|
|
47
|
+
/**
|
|
48
|
+
* __Modal body__
|
|
49
|
+
*
|
|
50
|
+
* A modal body is used to display the main content of a modal.
|
|
51
|
+
*
|
|
52
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
53
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code#modal-body-props)
|
|
54
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
55
|
+
*/
|
|
45
56
|
var ModalBody = function ModalBody(props) {
|
|
46
57
|
var children = props.children,
|
|
47
58
|
userDefinedTestId = props.testId;
|
package/dist/cjs/modal-footer.js
CHANGED
|
@@ -22,6 +22,15 @@ var footerStyles = (0, _core.css)({
|
|
|
22
22
|
gap: "".concat(_constants.footerItemGap, "px")
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* __Modal footer__
|
|
27
|
+
*
|
|
28
|
+
* A modal footer often contains a primary action and the ability to cancel and close the dialog, though can contain any React element.
|
|
29
|
+
*
|
|
30
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples#modal-footer)
|
|
31
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code#modal-footer-props)
|
|
32
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
33
|
+
*/
|
|
25
34
|
var ModalFooter = function ModalFooter(props) {
|
|
26
35
|
var children = props.children,
|
|
27
36
|
userDefinedTestId = props.testId;
|
package/dist/cjs/modal-header.js
CHANGED
|
@@ -25,6 +25,15 @@ var headerStyles = (0, _core.css)({
|
|
|
25
25
|
justifyContent: 'space-between'
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* __Modal header__
|
|
30
|
+
*
|
|
31
|
+
* A modal header contains the title of the modal and can contain other React elements such as a close button.
|
|
32
|
+
*
|
|
33
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples#modal-header)
|
|
34
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code#modal-header-props)
|
|
35
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
36
|
+
*/
|
|
28
37
|
var ModalHeader = function ModalHeader(props) {
|
|
29
38
|
var children = props.children,
|
|
30
39
|
userDefinedTestId = props.testId;
|
package/dist/cjs/modal-title.js
CHANGED
|
@@ -38,7 +38,8 @@ var textStyles = (0, _core.css)({
|
|
|
38
38
|
/**
|
|
39
39
|
* This ensures that the element fills the whole header space
|
|
40
40
|
* and its content does not overflow (since flex items don't
|
|
41
|
-
* shrink past its content size by default).
|
|
41
|
+
* shrink past its content size by default).
|
|
42
|
+
*/
|
|
42
43
|
flex: '1 1 auto',
|
|
43
44
|
wordWrap: 'break-word'
|
|
44
45
|
});
|
|
@@ -50,7 +51,8 @@ var iconStyles = (0, _core.css)({
|
|
|
50
51
|
/**
|
|
51
52
|
* When the title is truncated (not multi-line), we adjust the
|
|
52
53
|
* line height to avoid cropping the descenders. This removes
|
|
53
|
-
* the extra spacing that we get from that adjustment.
|
|
54
|
+
* the extra spacing that we get from that adjustment.
|
|
55
|
+
*/
|
|
54
56
|
|
|
55
57
|
var lineHeightOffset = fontSize - fontSize * adjustedLineHeight;
|
|
56
58
|
var truncatedTextStyles = (0, _core.css)({
|
|
@@ -78,6 +80,15 @@ var TitleIcon = function TitleIcon(_ref) {
|
|
|
78
80
|
}));
|
|
79
81
|
};
|
|
80
82
|
|
|
83
|
+
/**
|
|
84
|
+
* __Modal title__
|
|
85
|
+
*
|
|
86
|
+
* A modal title is used to display a title within a modal.
|
|
87
|
+
*
|
|
88
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
89
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code)
|
|
90
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
91
|
+
*/
|
|
81
92
|
var ModalTitle = function ModalTitle(props) {
|
|
82
93
|
var appearance = props.appearance,
|
|
83
94
|
children = props.children,
|
|
@@ -11,6 +11,15 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _exitingPersistence = _interopRequireDefault(require("@atlaskit/motion/exiting-persistence"));
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* __Modal transition__
|
|
16
|
+
*
|
|
17
|
+
* A modal transition wraps a modal to provide a fluid transition upon opening and closing.
|
|
18
|
+
*
|
|
19
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
20
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code)
|
|
21
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
22
|
+
*/
|
|
14
23
|
var ModalTransition = function ModalTransition(props) {
|
|
15
24
|
return /*#__PURE__*/_react.default.createElement(_exitingPersistence.default, {
|
|
16
25
|
appear: true
|
|
@@ -11,8 +11,6 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
14
|
var _react = require("react");
|
|
17
15
|
|
|
18
16
|
var _core = require("@emotion/core");
|
|
@@ -41,12 +39,11 @@ var _useModalStack = _interopRequireDefault(require("./internal/hooks/use-modal-
|
|
|
41
39
|
|
|
42
40
|
var _usePreventProgrammaticScroll = _interopRequireDefault(require("./internal/hooks/use-prevent-programmatic-scroll"));
|
|
43
41
|
|
|
44
|
-
var _excluded = ["autoFocus", "shouldCloseOnEscapePress", "shouldCloseOnOverlayClick", "shouldScrollInViewport", "stackIndex", "onClose", "onStackChange", "isBlanketHidden", "testId"];
|
|
45
|
-
|
|
46
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
47
43
|
|
|
48
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
45
|
|
|
46
|
+
/** @jsx jsx */
|
|
50
47
|
var fillScreenStyles = (0, _core.css)({
|
|
51
48
|
width: '100vw',
|
|
52
49
|
height: '100vh',
|
|
@@ -57,6 +54,22 @@ var fillScreenStyles = (0, _core.css)({
|
|
|
57
54
|
WebkitOverflowScrolling: 'touch'
|
|
58
55
|
});
|
|
59
56
|
|
|
57
|
+
var whiteListElements = function whiteListElements(element) {
|
|
58
|
+
// allows focus to reach elements outside the modal if they contain the data-atlas-extension attribute
|
|
59
|
+
return !element.hasAttribute('data-atlas-extension');
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* __Modal wrapper__
|
|
63
|
+
*
|
|
64
|
+
* A modal wrapper displays content that requires user interaction, in a layer above the page.
|
|
65
|
+
* This component is primary container for other modal components.
|
|
66
|
+
*
|
|
67
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
68
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code)
|
|
69
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
|
|
60
73
|
var ModalWrapper = function ModalWrapper(props) {
|
|
61
74
|
var _props$autoFocus = props.autoFocus,
|
|
62
75
|
autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
|
|
@@ -72,8 +85,12 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
72
85
|
_props$onStackChange = props.onStackChange,
|
|
73
86
|
onStackChange = _props$onStackChange === void 0 ? _noop.default : _props$onStackChange,
|
|
74
87
|
isBlanketHidden = props.isBlanketHidden,
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
children = props.children,
|
|
89
|
+
height = props.height,
|
|
90
|
+
width = props.width,
|
|
91
|
+
onCloseComplete = props.onCloseComplete,
|
|
92
|
+
onOpenComplete = props.onOpenComplete,
|
|
93
|
+
testId = props.testId;
|
|
77
94
|
var calculatedStackIndex = (0, _useModalStack.default)({
|
|
78
95
|
onStackChange: onStackChange
|
|
79
96
|
});
|
|
@@ -86,7 +103,7 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
86
103
|
action: 'closed',
|
|
87
104
|
componentName: 'modalDialog',
|
|
88
105
|
packageName: "@atlaskit/modal-dialog",
|
|
89
|
-
packageVersion: "12.
|
|
106
|
+
packageVersion: "12.3.0"
|
|
90
107
|
});
|
|
91
108
|
var onBlanketClicked = (0, _react.useCallback)(function (e) {
|
|
92
109
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -102,13 +119,17 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
102
119
|
isTinted: !isBlanketHidden,
|
|
103
120
|
onBlanketClicked: onBlanketClicked,
|
|
104
121
|
testId: testId && "".concat(testId, "--blanket")
|
|
105
|
-
}, (0, _core.jsx)(_modalDialog.default,
|
|
122
|
+
}, (0, _core.jsx)(_modalDialog.default, {
|
|
106
123
|
testId: testId,
|
|
107
124
|
autoFocus: autoFocus,
|
|
108
125
|
stackIndex: stackIndex,
|
|
109
126
|
onClose: onCloseHandler,
|
|
110
|
-
shouldScrollInViewport: shouldScrollInViewport
|
|
111
|
-
|
|
127
|
+
shouldScrollInViewport: shouldScrollInViewport,
|
|
128
|
+
height: height,
|
|
129
|
+
width: width,
|
|
130
|
+
onCloseComplete: onCloseComplete,
|
|
131
|
+
onOpenComplete: onOpenComplete
|
|
132
|
+
}, children));
|
|
112
133
|
return (0, _core.jsx)(_portal.default, {
|
|
113
134
|
zIndex: _constants.layers.modal()
|
|
114
135
|
}, (0, _core.jsx)(_fadeIn.default, null, function (fadeInProps) {
|
|
@@ -118,7 +139,8 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
118
139
|
}), (0, _core.jsx)(_reactFocusLock.default, {
|
|
119
140
|
autoFocus: autoFocusLock,
|
|
120
141
|
disabled: !isForeground,
|
|
121
|
-
returnFocus: true
|
|
142
|
+
returnFocus: true,
|
|
143
|
+
whiteList: whiteListElements
|
|
122
144
|
}, (0, _core.jsx)(_reactScrolllock.default, null), shouldScrollInViewport ? (0, _core.jsx)(_reactScrolllock.TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket));
|
|
123
145
|
}));
|
|
124
146
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -44,9 +44,11 @@ const stackTransitionStyles = css({
|
|
|
44
44
|
transitionProperty: 'transform',
|
|
45
45
|
transitionTimingFunction: easeInOut,
|
|
46
46
|
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Duplicated from @atlaskit/motion/accessibility
|
|
48
49
|
* because @repo/internal/styles/consistent-style-ordering
|
|
49
|
-
* doesn't work well with object spreading.
|
|
50
|
+
* doesn't work well with object spreading.
|
|
51
|
+
*/
|
|
50
52
|
'@media (prefers-reduced-motion: reduce)': {
|
|
51
53
|
animation: 'none',
|
|
52
54
|
transition: 'none'
|
|
@@ -75,6 +77,7 @@ const Positioner = props => {
|
|
|
75
77
|
stackIndex > 0 ? stackTransformStyles : stackIdleStyles, shouldScrollInViewport ? viewportScrollStyles : bodyScrollStyles],
|
|
76
78
|
"data-testid": testId && `${testId}--positioner`
|
|
77
79
|
}, children);
|
|
78
|
-
};
|
|
80
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
81
|
+
|
|
79
82
|
|
|
80
83
|
export default Positioner;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
|
-
import { ScrollContext } from '../context';
|
|
2
|
+
import { ScrollContext } from '../context'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
3
|
+
|
|
3
4
|
export default function useScroll() {
|
|
4
5
|
const shouldScrollInViewport = useContext(ScrollContext);
|
|
5
6
|
|
|
@@ -13,19 +13,30 @@ const bodyStyles = css({
|
|
|
13
13
|
/**
|
|
14
14
|
* Adding the padding here avoids cropping the keyline on its sides.
|
|
15
15
|
* The combined vertical spacing is maintained by subtracting the
|
|
16
|
-
* keyline height from header and footer.
|
|
16
|
+
* keyline height from header and footer.
|
|
17
|
+
*/
|
|
17
18
|
|
|
18
19
|
const bodyScrollStyles = css({
|
|
19
20
|
padding: `${keylineHeight}px ${padding}px`
|
|
20
21
|
});
|
|
21
22
|
/**
|
|
22
23
|
* Keylines will not be shown if scrolling in viewport so we do
|
|
23
|
-
* not account for them in this case.
|
|
24
|
+
* not account for them in this case.
|
|
25
|
+
*/
|
|
24
26
|
|
|
25
27
|
const viewportScrollStyles = css({
|
|
26
28
|
padding: `0px ${padding}px`
|
|
27
29
|
});
|
|
28
30
|
|
|
31
|
+
/**
|
|
32
|
+
* __Modal body__
|
|
33
|
+
*
|
|
34
|
+
* A modal body is used to display the main content of a modal.
|
|
35
|
+
*
|
|
36
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
37
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code#modal-body-props)
|
|
38
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
39
|
+
*/
|
|
29
40
|
const ModalBody = props => {
|
|
30
41
|
const {
|
|
31
42
|
children,
|
|
@@ -12,6 +12,15 @@ const footerStyles = css({
|
|
|
12
12
|
gap: `${footerItemGap}px`
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* __Modal footer__
|
|
17
|
+
*
|
|
18
|
+
* A modal footer often contains a primary action and the ability to cancel and close the dialog, though can contain any React element.
|
|
19
|
+
*
|
|
20
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples#modal-footer)
|
|
21
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code#modal-footer-props)
|
|
22
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
23
|
+
*/
|
|
15
24
|
const ModalFooter = props => {
|
|
16
25
|
const {
|
|
17
26
|
children,
|
|
@@ -12,6 +12,15 @@ const headerStyles = css({
|
|
|
12
12
|
justifyContent: 'space-between'
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* __Modal header__
|
|
17
|
+
*
|
|
18
|
+
* A modal header contains the title of the modal and can contain other React elements such as a close button.
|
|
19
|
+
*
|
|
20
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples#modal-header)
|
|
21
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code#modal-header-props)
|
|
22
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
23
|
+
*/
|
|
15
24
|
const ModalHeader = props => {
|
|
16
25
|
const {
|
|
17
26
|
children,
|
|
@@ -24,7 +24,8 @@ const textStyles = css({
|
|
|
24
24
|
/**
|
|
25
25
|
* This ensures that the element fills the whole header space
|
|
26
26
|
* and its content does not overflow (since flex items don't
|
|
27
|
-
* shrink past its content size by default).
|
|
27
|
+
* shrink past its content size by default).
|
|
28
|
+
*/
|
|
28
29
|
flex: '1 1 auto',
|
|
29
30
|
wordWrap: 'break-word'
|
|
30
31
|
});
|
|
@@ -36,7 +37,8 @@ const iconStyles = css({
|
|
|
36
37
|
/**
|
|
37
38
|
* When the title is truncated (not multi-line), we adjust the
|
|
38
39
|
* line height to avoid cropping the descenders. This removes
|
|
39
|
-
* the extra spacing that we get from that adjustment.
|
|
40
|
+
* the extra spacing that we get from that adjustment.
|
|
41
|
+
*/
|
|
40
42
|
|
|
41
43
|
const lineHeightOffset = fontSize - fontSize * adjustedLineHeight;
|
|
42
44
|
const truncatedTextStyles = css({
|
|
@@ -65,6 +67,15 @@ const TitleIcon = ({
|
|
|
65
67
|
}));
|
|
66
68
|
};
|
|
67
69
|
|
|
70
|
+
/**
|
|
71
|
+
* __Modal title__
|
|
72
|
+
*
|
|
73
|
+
* A modal title is used to display a title within a modal.
|
|
74
|
+
*
|
|
75
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
76
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code)
|
|
77
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
78
|
+
*/
|
|
68
79
|
const ModalTitle = props => {
|
|
69
80
|
const {
|
|
70
81
|
appearance,
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
3
|
+
/**
|
|
4
|
+
* __Modal transition__
|
|
5
|
+
*
|
|
6
|
+
* A modal transition wraps a modal to provide a fluid transition upon opening and closing.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
11
|
+
*/
|
|
3
12
|
|
|
4
13
|
const ModalTransition = props => {
|
|
5
14
|
return /*#__PURE__*/React.createElement(ExitingPersistence, {
|