@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.
Files changed (74) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/__perf__/default.tsx +3 -1
  3. package/__perf__/interactions.tsx +1 -1
  4. package/__perf__/scroll.tsx +1 -1
  5. package/codemods/{12.0.0-lite-mode.ts → 12.0.0-lite-mode.tsx} +2 -2
  6. package/codemods/__tests__/{12.0.0-lite-mode.test.ts → 12.0.0-lite-mode.test.tsx} +0 -0
  7. package/codemods/__tests__/{inline-WidthNames-declaration.test.ts → inline-width-names-declaration.test.tsx} +1 -1
  8. package/codemods/__tests__/{map-body-from-props.test.ts → map-body-from-props.test.tsx} +0 -0
  9. package/codemods/__tests__/{map-container-from-props.test.ts → map-container-from-props.test.tsx} +0 -0
  10. package/codemods/__tests__/{map-footer-from-props.test.ts → map-footer-from-props.test.tsx} +0 -0
  11. package/codemods/__tests__/{map-header-from-props.test.ts → map-header-from-props.test.tsx} +0 -0
  12. package/codemods/__tests__/{remove-appearance-prop.test.ts → remove-appearance-prop.test.tsx} +0 -0
  13. package/codemods/__tests__/{remove-component-override-props.test.ts → remove-component-override-props.test.tsx} +0 -0
  14. package/codemods/__tests__/{rename-appearance-type.test.ts → rename-appearance-type.test.tsx} +0 -0
  15. package/codemods/__tests__/{rename-inner-component-prop-types.test.ts → rename-inner-component-prop-types.test.tsx} +0 -0
  16. package/codemods/__tests__/{rename-scrollBehavior-to-shouldScrollInViewport.test.ts → rename-scroll-behavior-to-should-scroll-in-viewport.test.tsx} +1 -1
  17. package/codemods/migrations/{inline-WidthNames-declaration.ts → inline-width-names-declaration.tsx} +0 -0
  18. package/codemods/migrations/{map-body-from-props.ts → map-body-from-props.tsx} +0 -0
  19. package/codemods/migrations/{map-container-from-props.ts → map-container-from-props.tsx} +0 -0
  20. package/codemods/migrations/{map-footer-from-props.ts → map-footer-from-props.tsx} +0 -0
  21. package/codemods/migrations/{map-header-from-props.ts → map-header-from-props.tsx} +0 -0
  22. package/codemods/migrations/{remove-appearance-prop.ts → remove-appearance-prop.tsx} +0 -0
  23. package/codemods/migrations/{remove-component-override-props.ts → remove-component-override-props.tsx} +0 -0
  24. package/codemods/migrations/{rename-appearance-type.ts → rename-appearance-type.tsx} +0 -0
  25. package/codemods/migrations/{rename-inner-component-prop-types.ts → rename-inner-component-prop-types.tsx} +0 -0
  26. package/codemods/migrations/{rename-scrollBehavior-to-shouldScrollInViewport.ts → rename-scroll-behavior-to-should-scroll-in-viewport.tsx} +0 -0
  27. package/dist/cjs/internal/components/modal-dialog.js +4 -2
  28. package/dist/cjs/internal/components/positioner.js +11 -5
  29. package/dist/cjs/internal/components/scroll-container.js +1 -5
  30. package/dist/cjs/internal/context.js +1 -0
  31. package/dist/cjs/internal/hooks/use-on-motion-finish.js +1 -0
  32. package/dist/cjs/internal/hooks/use-scroll.js +1 -0
  33. package/dist/cjs/modal-body.js +13 -2
  34. package/dist/cjs/modal-footer.js +9 -0
  35. package/dist/cjs/modal-header.js +9 -0
  36. package/dist/cjs/modal-title.js +13 -2
  37. package/dist/cjs/modal-transition.js +9 -0
  38. package/dist/cjs/modal-wrapper.js +25 -10
  39. package/dist/cjs/version.json +1 -1
  40. package/dist/es2019/internal/components/modal-dialog.js +4 -2
  41. package/dist/es2019/internal/components/positioner.js +11 -5
  42. package/dist/es2019/internal/components/scroll-container.js +1 -5
  43. package/dist/es2019/internal/context.js +1 -0
  44. package/dist/es2019/internal/hooks/use-on-motion-finish.js +1 -0
  45. package/dist/es2019/internal/hooks/use-scroll.js +2 -1
  46. package/dist/es2019/modal-body.js +13 -2
  47. package/dist/es2019/modal-footer.js +9 -0
  48. package/dist/es2019/modal-header.js +9 -0
  49. package/dist/es2019/modal-title.js +13 -2
  50. package/dist/es2019/modal-transition.js +9 -0
  51. package/dist/es2019/modal-wrapper.js +24 -6
  52. package/dist/es2019/version.json +1 -1
  53. package/dist/esm/internal/components/modal-dialog.js +4 -2
  54. package/dist/esm/internal/components/positioner.js +11 -5
  55. package/dist/esm/internal/components/scroll-container.js +1 -5
  56. package/dist/esm/internal/context.js +1 -0
  57. package/dist/esm/internal/hooks/use-on-motion-finish.js +1 -0
  58. package/dist/esm/internal/hooks/use-scroll.js +2 -1
  59. package/dist/esm/modal-body.js +13 -2
  60. package/dist/esm/modal-footer.js +9 -0
  61. package/dist/esm/modal-header.js +9 -0
  62. package/dist/esm/modal-title.js +13 -2
  63. package/dist/esm/modal-transition.js +9 -0
  64. package/dist/esm/modal-wrapper.js +24 -9
  65. package/dist/esm/version.json +1 -1
  66. package/dist/types/modal-body.d.ts +9 -0
  67. package/dist/types/modal-footer.d.ts +9 -0
  68. package/dist/types/modal-header.d.ts +9 -0
  69. package/dist/types/modal-title.d.ts +9 -0
  70. package/dist/types/modal-transition.d.ts +9 -0
  71. package/dist/types/modal-wrapper.d.ts +10 -0
  72. package/dist/types/types.d.ts +2 -2
  73. package/package.json +9 -8
  74. 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
@@ -17,7 +17,9 @@ export default function Example() {
17
17
 
18
18
  return (
19
19
  <>
20
- <button onClick={open}>open modal</button>
20
+ <button onClick={open} type="button">
21
+ open modal
22
+ </button>
21
23
 
22
24
  <ModalTransition>
23
25
  {isOpen && (
@@ -27,7 +27,7 @@ const InteractionPerformance = ({ index = 0 }: { index?: number }) => {
27
27
 
28
28
  return (
29
29
  <>
30
- <button data-testid="open-button" onClick={open}>
30
+ <button data-testid="open-button" onClick={open} type="button">
31
31
  {openText(index)}
32
32
  </button>
33
33
 
@@ -34,7 +34,7 @@ const ScrollPerformance = () => {
34
34
 
35
35
  return (
36
36
  <>
37
- <button data-testid="open" onClick={open}>
37
+ <button data-testid="open" onClick={open} type="button">
38
38
  {openText}
39
39
  </button>
40
40
 
@@ -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-WidthNames-declaration';
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-scrollBehavior-to-shouldScrollInViewport';
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!
@@ -1,6 +1,6 @@
1
1
  import { createTransformer } from '@atlaskit/codemod-utils';
2
2
 
3
- import { inlineWidthNamesDeclaration } from '../migrations/inline-WidthNames-declaration';
3
+ import { inlineWidthNamesDeclaration } from '../migrations/inline-width-names-declaration';
4
4
 
5
5
  const transformer = createTransformer([inlineWidthNamesDeclaration]);
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { createTransformer } from '@atlaskit/codemod-utils';
2
2
 
3
- import { renameScrollBehaviorToShouldScrollInViewport } from '../migrations/rename-scrollBehavior-to-shouldScrollInViewport';
3
+ import { renameScrollBehaviorToShouldScrollInViewport } from '../migrations/rename-scroll-behavior-to-should-scroll-in-viewport';
4
4
 
5
5
  const transformer = createTransformer([
6
6
  renameScrollBehaviorToShouldScrollInViewport,
@@ -47,7 +47,8 @@ var dialogStyles = (0, _core.css)({
47
47
  height: '100%',
48
48
  minHeight: 0,
49
49
  maxHeight: '100vh',
50
- flex: '1 1 auto',
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
- /** Duplicated from @atlaskit/motion/accessibility
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);
@@ -7,6 +7,7 @@ exports.default = useOnMotionFinish;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
10
11
  function useOnMotionFinish(_ref) {
11
12
  var onOpenComplete = _ref.onOpenComplete,
12
13
  onCloseComplete = _ref.onCloseComplete;
@@ -9,6 +9,7 @@ var _react = require("react");
9
9
 
10
10
  var _context = require("../context");
11
11
 
12
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
12
13
  function useScroll() {
13
14
  var shouldScrollInViewport = (0, _react.useContext)(_context.ScrollContext);
14
15
 
@@ -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;
@@ -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;
@@ -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;
@@ -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
- testId = props.testId,
76
- modalDialogProps = (0, _objectWithoutProperties2.default)(props, _excluded);
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.12"
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, (0, _extends2.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
- }, modalDialogProps)));
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) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.2.12",
3
+ "version": "12.2.15",
4
4
  "sideEffects": false
5
5
  }
@@ -21,7 +21,8 @@ const dialogStyles = css({
21
21
  height: '100%',
22
22
  minHeight: 0,
23
23
  maxHeight: '100vh',
24
- flex: '1 1 auto',
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
- /** Duplicated from @atlaskit/motion/accessibility
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,3 +1,4 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
1
2
  import { createContext } from 'react';
2
3
  export const ModalContext = /*#__PURE__*/createContext(null);
3
4
  export const ScrollContext = /*#__PURE__*/createContext(null);
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useRef } from 'react';
2
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
2
3
  export default function useOnMotionFinish({
3
4
  onOpenComplete,
4
5
  onCloseComplete
@@ -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,