@atlaskit/modal-dialog 12.2.12 → 12.2.15
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 +19 -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 +4 -2
- package/dist/cjs/internal/components/positioner.js +11 -5
- package/dist/cjs/internal/components/scroll-container.js +1 -5
- 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 +25 -10
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/internal/components/modal-dialog.js +4 -2
- package/dist/es2019/internal/components/positioner.js +11 -5
- package/dist/es2019/internal/components/scroll-container.js +1 -5
- 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 +24 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/internal/components/modal-dialog.js +4 -2
- package/dist/esm/internal/components/positioner.js +11 -5
- package/dist/esm/internal/components/scroll-container.js +1 -5
- 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 +24 -9
- 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 +9 -8
- package/report.api.md +210 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/modal-dialog
|
|
2
2
|
|
|
3
|
+
## 12.2.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
8
|
+
|
|
9
|
+
## 12.2.14
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`454ec1bbf07`](https://bitbucket.org/atlassian/atlassian-frontend/commits/454ec1bbf07) - Internal code change turning on new linting rules.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 12.2.13
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`1c3948738f9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1c3948738f9) - Adjust the styles for an internal positioning element to constrain the height for ModalBody and restore support for custom scrolling regions"
|
|
21
|
+
|
|
3
22
|
## 12.2.12
|
|
4
23
|
|
|
5
24
|
### 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
|
|
@@ -47,7 +47,8 @@ var dialogStyles = (0, _core.css)({
|
|
|
47
47
|
height: '100%',
|
|
48
48
|
minHeight: 0,
|
|
49
49
|
maxHeight: '100vh',
|
|
50
|
-
|
|
50
|
+
// Flex-grow set to 0 to prevent this element from filling its parent flexbox container
|
|
51
|
+
flex: '0 1 auto',
|
|
51
52
|
flexDirection: 'column',
|
|
52
53
|
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
53
54
|
color: _constants.textColor,
|
|
@@ -151,7 +152,8 @@ var ModalDialog = function ModalDialog(props) {
|
|
|
151
152
|
"aria-modal": true
|
|
152
153
|
}), children));
|
|
153
154
|
}))));
|
|
154
|
-
};
|
|
155
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
156
|
+
|
|
155
157
|
|
|
156
158
|
var _default = ModalDialog;
|
|
157
159
|
exports.default = _default;
|
|
@@ -17,15 +17,18 @@ var _constants2 = require("../constants");
|
|
|
17
17
|
|
|
18
18
|
/** @jsx jsx */
|
|
19
19
|
var maxWidthDimensions = "calc(100vw - ".concat(_constants2.gutter * 2, "px)");
|
|
20
|
-
var maxHeightDimensions = "calc(100vh - ".concat(_constants2.gutter * 2 - 1, "px)");
|
|
20
|
+
var maxHeightDimensions = "calc(100vh - ".concat(_constants2.gutter * 2 - 1, "px)"); // Flex and min-content are set to constrain the height of the body and support multi-column scrolling experiences
|
|
21
|
+
|
|
21
22
|
var positionerStyles = (0, _core.css)({
|
|
23
|
+
display: 'flex',
|
|
22
24
|
width: '100%',
|
|
23
25
|
maxWidth: '100%',
|
|
24
26
|
height: '100%',
|
|
25
27
|
position: 'fixed',
|
|
26
28
|
zIndex: _constants.layers.modal(),
|
|
27
29
|
top: 0,
|
|
28
|
-
left: 0
|
|
30
|
+
left: 0,
|
|
31
|
+
flexDirection: 'column'
|
|
29
32
|
});
|
|
30
33
|
var viewportScrollStyles = (0, _core.css)({
|
|
31
34
|
height: 'auto',
|
|
@@ -53,9 +56,11 @@ var stackTransitionStyles = (0, _core.css)({
|
|
|
53
56
|
transitionProperty: 'transform',
|
|
54
57
|
transitionTimingFunction: _curves.easeInOut,
|
|
55
58
|
|
|
56
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Duplicated from @atlaskit/motion/accessibility
|
|
57
61
|
* because @repo/internal/styles/consistent-style-ordering
|
|
58
|
-
* doesn't work well with object spreading.
|
|
62
|
+
* doesn't work well with object spreading.
|
|
63
|
+
*/
|
|
59
64
|
'@media (prefers-reduced-motion: reduce)': {
|
|
60
65
|
animation: 'none',
|
|
61
66
|
transition: 'none'
|
|
@@ -82,7 +87,8 @@ var Positioner = function Positioner(props) {
|
|
|
82
87
|
stackIndex > 0 ? stackTransformStyles : stackIdleStyles, shouldScrollInViewport ? viewportScrollStyles : bodyScrollStyles],
|
|
83
88
|
"data-testid": testId && "".concat(testId, "--positioner")
|
|
84
89
|
}, children);
|
|
85
|
-
};
|
|
90
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
91
|
+
|
|
86
92
|
|
|
87
93
|
var _default = Positioner;
|
|
88
94
|
exports.default = _default;
|
|
@@ -37,15 +37,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
37
|
|
|
38
38
|
/** @jsx jsx */
|
|
39
39
|
var baseStyles = (0, _core.css)({
|
|
40
|
-
/**
|
|
41
|
-
* We need to inherit flex styles from its parent here
|
|
42
|
-
* in case they're set because we're essentially being a proxy container
|
|
43
|
-
* between the original flex parent and its children (the modal body).
|
|
44
|
-
*/
|
|
45
40
|
display: 'inherit',
|
|
46
41
|
margin: 0,
|
|
47
42
|
flex: 'inherit',
|
|
48
43
|
flexDirection: 'inherit',
|
|
44
|
+
flexGrow: 1,
|
|
49
45
|
overflowX: 'hidden',
|
|
50
46
|
overflowY: 'auto',
|
|
51
47
|
'@media (min-width: 480px)': {
|
|
@@ -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',
|
|
@@ -56,6 +53,16 @@ var fillScreenStyles = (0, _core.css)({
|
|
|
56
53
|
overflowY: 'auto',
|
|
57
54
|
WebkitOverflowScrolling: 'touch'
|
|
58
55
|
});
|
|
56
|
+
/**
|
|
57
|
+
* __Modal wrapper__
|
|
58
|
+
*
|
|
59
|
+
* A modal wrapper displays content that requires user interaction, in a layer above the page.
|
|
60
|
+
* This component is primary container for other modal components.
|
|
61
|
+
*
|
|
62
|
+
* - [Examples](https://atlassian.design/components/modal-dialog/examples)
|
|
63
|
+
* - [Code](https://atlassian.design/components/modal-dialog/code)
|
|
64
|
+
* - [Usage](https://atlassian.design/components/modal-dialog/usage)
|
|
65
|
+
*/
|
|
59
66
|
|
|
60
67
|
var ModalWrapper = function ModalWrapper(props) {
|
|
61
68
|
var _props$autoFocus = props.autoFocus,
|
|
@@ -72,8 +79,12 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
72
79
|
_props$onStackChange = props.onStackChange,
|
|
73
80
|
onStackChange = _props$onStackChange === void 0 ? _noop.default : _props$onStackChange,
|
|
74
81
|
isBlanketHidden = props.isBlanketHidden,
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
children = props.children,
|
|
83
|
+
height = props.height,
|
|
84
|
+
width = props.width,
|
|
85
|
+
onCloseComplete = props.onCloseComplete,
|
|
86
|
+
onOpenComplete = props.onOpenComplete,
|
|
87
|
+
testId = props.testId;
|
|
77
88
|
var calculatedStackIndex = (0, _useModalStack.default)({
|
|
78
89
|
onStackChange: onStackChange
|
|
79
90
|
});
|
|
@@ -86,7 +97,7 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
86
97
|
action: 'closed',
|
|
87
98
|
componentName: 'modalDialog',
|
|
88
99
|
packageName: "@atlaskit/modal-dialog",
|
|
89
|
-
packageVersion: "12.2.
|
|
100
|
+
packageVersion: "12.2.15"
|
|
90
101
|
});
|
|
91
102
|
var onBlanketClicked = (0, _react.useCallback)(function (e) {
|
|
92
103
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -102,13 +113,17 @@ var ModalWrapper = function ModalWrapper(props) {
|
|
|
102
113
|
isTinted: !isBlanketHidden,
|
|
103
114
|
onBlanketClicked: onBlanketClicked,
|
|
104
115
|
testId: testId && "".concat(testId, "--blanket")
|
|
105
|
-
}, (0, _core.jsx)(_modalDialog.default,
|
|
116
|
+
}, (0, _core.jsx)(_modalDialog.default, {
|
|
106
117
|
testId: testId,
|
|
107
118
|
autoFocus: autoFocus,
|
|
108
119
|
stackIndex: stackIndex,
|
|
109
120
|
onClose: onCloseHandler,
|
|
110
|
-
shouldScrollInViewport: shouldScrollInViewport
|
|
111
|
-
|
|
121
|
+
shouldScrollInViewport: shouldScrollInViewport,
|
|
122
|
+
height: height,
|
|
123
|
+
width: width,
|
|
124
|
+
onCloseComplete: onCloseComplete,
|
|
125
|
+
onOpenComplete: onOpenComplete
|
|
126
|
+
}, children));
|
|
112
127
|
return (0, _core.jsx)(_portal.default, {
|
|
113
128
|
zIndex: _constants.layers.modal()
|
|
114
129
|
}, (0, _core.jsx)(_fadeIn.default, null, function (fadeInProps) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -21,7 +21,8 @@ const dialogStyles = css({
|
|
|
21
21
|
height: '100%',
|
|
22
22
|
minHeight: 0,
|
|
23
23
|
maxHeight: '100vh',
|
|
24
|
-
|
|
24
|
+
// Flex-grow set to 0 to prevent this element from filling its parent flexbox container
|
|
25
|
+
flex: '0 1 auto',
|
|
25
26
|
flexDirection: 'column',
|
|
26
27
|
backgroundColor: `var(--ds-surface-overlay, ${N0})`,
|
|
27
28
|
color: textColor,
|
|
@@ -116,6 +117,7 @@ const ModalDialog = props => {
|
|
|
116
117
|
tabIndex: -1,
|
|
117
118
|
"aria-modal": true
|
|
118
119
|
}), children))))));
|
|
119
|
-
};
|
|
120
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
121
|
+
|
|
120
122
|
|
|
121
123
|
export default ModalDialog;
|
|
@@ -5,15 +5,18 @@ import { mediumDurationMs } from '@atlaskit/motion/durations';
|
|
|
5
5
|
import { layers } from '@atlaskit/theme/constants';
|
|
6
6
|
import { gutter, verticalOffset } from '../constants';
|
|
7
7
|
const maxWidthDimensions = `calc(100vw - ${gutter * 2}px)`;
|
|
8
|
-
const maxHeightDimensions = `calc(100vh - ${gutter * 2 - 1}px)`;
|
|
8
|
+
const maxHeightDimensions = `calc(100vh - ${gutter * 2 - 1}px)`; // Flex and min-content are set to constrain the height of the body and support multi-column scrolling experiences
|
|
9
|
+
|
|
9
10
|
const positionerStyles = css({
|
|
11
|
+
display: 'flex',
|
|
10
12
|
width: '100%',
|
|
11
13
|
maxWidth: '100%',
|
|
12
14
|
height: '100%',
|
|
13
15
|
position: 'fixed',
|
|
14
16
|
zIndex: layers.modal(),
|
|
15
17
|
top: 0,
|
|
16
|
-
left: 0
|
|
18
|
+
left: 0,
|
|
19
|
+
flexDirection: 'column'
|
|
17
20
|
});
|
|
18
21
|
const viewportScrollStyles = css({
|
|
19
22
|
height: 'auto',
|
|
@@ -41,9 +44,11 @@ const stackTransitionStyles = css({
|
|
|
41
44
|
transitionProperty: 'transform',
|
|
42
45
|
transitionTimingFunction: easeInOut,
|
|
43
46
|
|
|
44
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Duplicated from @atlaskit/motion/accessibility
|
|
45
49
|
* because @repo/internal/styles/consistent-style-ordering
|
|
46
|
-
* doesn't work well with object spreading.
|
|
50
|
+
* doesn't work well with object spreading.
|
|
51
|
+
*/
|
|
47
52
|
'@media (prefers-reduced-motion: reduce)': {
|
|
48
53
|
animation: 'none',
|
|
49
54
|
transition: 'none'
|
|
@@ -72,6 +77,7 @@ const Positioner = props => {
|
|
|
72
77
|
stackIndex > 0 ? stackTransformStyles : stackIdleStyles, shouldScrollInViewport ? viewportScrollStyles : bodyScrollStyles],
|
|
73
78
|
"data-testid": testId && `${testId}--positioner`
|
|
74
79
|
}, children);
|
|
75
|
-
};
|
|
80
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
81
|
+
|
|
76
82
|
|
|
77
83
|
export default Positioner;
|
|
@@ -10,15 +10,11 @@ import useStateRef from '@atlaskit/ds-lib/use-state-ref';
|
|
|
10
10
|
import FocusRing from '@atlaskit/focus-ring';
|
|
11
11
|
import { keylineColor, keylineHeight } from '../constants';
|
|
12
12
|
const baseStyles = css({
|
|
13
|
-
/**
|
|
14
|
-
* We need to inherit flex styles from its parent here
|
|
15
|
-
* in case they're set because we're essentially being a proxy container
|
|
16
|
-
* between the original flex parent and its children (the modal body).
|
|
17
|
-
*/
|
|
18
13
|
display: 'inherit',
|
|
19
14
|
margin: 0,
|
|
20
15
|
flex: 'inherit',
|
|
21
16
|
flexDirection: 'inherit',
|
|
17
|
+
flexGrow: 1,
|
|
22
18
|
overflowX: 'hidden',
|
|
23
19
|
overflowY: 'auto',
|
|
24
20
|
'@media (min-width: 480px)': {
|
|
@@ -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,
|