@atlaskit/modal-dialog 13.1.0 → 13.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 13.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#127054](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127054)
8
+ [`fb709895d8d5c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fb709895d8d5c) -
9
+ [ux] Adds a new `hasCloseButton` prop to `ModalHeader` to add a close button. This uses the
10
+ exported `CloseButton` internally.
11
+
12
+ This is done to improve the accessibility of all modal dialogs and ensure that users of assistive
13
+ technology get full context of the modal and so that pointer users have a more clear way to close
14
+ the modal.
15
+
16
+ ## 13.1.1
17
+
18
+ ### Patch Changes
19
+
20
+ - [#127022](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/127022)
21
+ [`6e22b57d6bf75`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6e22b57d6bf75) -
22
+ Update dependencies and remove old codemods.
23
+ - Updated dependencies
24
+
3
25
  ## 13.1.0
4
26
 
5
27
  ### Minor Changes
@@ -85,6 +85,7 @@ var ModalDialog = function ModalDialog(props) {
85
85
  onCloseComplete = props.onCloseComplete,
86
86
  onOpenComplete = props.onOpenComplete,
87
87
  height = props.height,
88
+ hasProvidedOnClose = props.hasProvidedOnClose,
88
89
  children = props.children,
89
90
  label = props.label,
90
91
  testId = props.testId;
@@ -115,9 +116,10 @@ var ModalDialog = function ModalDialog(props) {
115
116
  return {
116
117
  testId: testId,
117
118
  titleId: titleId,
118
- onClose: onClose
119
+ onClose: onClose,
120
+ hasProvidedOnClose: hasProvidedOnClose
119
121
  };
120
- }, [testId, titleId, onClose]);
122
+ }, [testId, titleId, onClose, hasProvidedOnClose]);
121
123
  (0, _layering.useCloseOnEscapePress)({
122
124
  onClose: onClose,
123
125
  isDisabled: !shouldCloseOnEscapePress
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@emotion/react");
10
+ var _primitives = require("@atlaskit/primitives");
11
+ var _closeButton = require("./close-button");
10
12
  var _hooks = require("./hooks");
11
13
  /**
12
14
  * @jsxRuntime classic
@@ -25,6 +27,15 @@ var headerStyles = (0, _react2.css)({
25
27
  paddingBlockStart: "var(--ds-space-300, 24px)",
26
28
  paddingInline: "var(--ds-space-300, 24px)"
27
29
  });
30
+ var gridStyles = (0, _primitives.xcss)({
31
+ width: '100%'
32
+ });
33
+ var closeContainerStyles = (0, _primitives.xcss)({
34
+ gridArea: 'close'
35
+ });
36
+ var titleContainerStyles = (0, _primitives.xcss)({
37
+ gridArea: 'title'
38
+ });
28
39
  /**
29
40
  * __Modal header__
30
41
  *
@@ -36,13 +47,34 @@ var headerStyles = (0, _react2.css)({
36
47
  */
37
48
  var ModalHeader = function ModalHeader(props) {
38
49
  var children = props.children,
39
- userDefinedTestId = props.testId;
50
+ userDefinedTestId = props.testId,
51
+ _props$hasCloseButton = props.hasCloseButton,
52
+ hasCloseButton = _props$hasCloseButton === void 0 ? false : _props$hasCloseButton;
40
53
  var _useModal = (0, _hooks.useModal)(),
54
+ hasProvidedOnClose = _useModal.hasProvidedOnClose,
55
+ onClose = _useModal.onClose,
41
56
  modalTestId = _useModal.testId;
42
57
  var testId = userDefinedTestId || modalTestId && "".concat(modalTestId, "--header");
58
+
59
+ // Only show if an onClose was provided for the modal dialog
60
+ var shouldShowCloseButton = hasCloseButton && hasProvidedOnClose && onClose;
43
61
  return (0, _react2.jsx)("div", {
44
62
  css: headerStyles,
45
63
  "data-testid": testId
46
- }, children);
64
+ }, shouldShowCloseButton ? (0, _react2.jsx)(_primitives.Grid, {
65
+ gap: "space.200",
66
+ templateAreas: ['title close'],
67
+ xcss: gridStyles
68
+ }, (0, _react2.jsx)(_primitives.Flex, {
69
+ xcss: titleContainerStyles,
70
+ justifyContent: "start",
71
+ alignItems: "center"
72
+ }, children), (0, _react2.jsx)(_primitives.Flex, {
73
+ xcss: closeContainerStyles,
74
+ justifyContent: "end"
75
+ }, (0, _react2.jsx)(_closeButton.CloseButton, {
76
+ onClick: onClose,
77
+ testId: modalTestId
78
+ }))) : children);
47
79
  };
48
80
  var _default = exports.default = ModalHeader;
@@ -21,6 +21,22 @@ var iconColor = {
21
21
  danger: "var(--ds-icon-danger, ".concat(_colors.R400, ")"),
22
22
  warning: "var(--ds-icon-warning, #D97008)"
23
23
  };
24
+ var iconStyles = (0, _react.css)({
25
+ flex: '0 0 auto',
26
+ // The following properties have been added purely to avoid a global style override in Jira breaking alignment between the icon and title text.
27
+ // https://stash.atlassian.com/projects/JIRACLOUD/repos/jira/browse/jira-components/jira-legacy-frontend/jira-atlaskit-module/src/main/resources/jira-atlaskit-module/css/adg3-general-overrides.less?at=master#24
28
+ // When the override is removed, these can be removed.
29
+ color: 'inherit',
30
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
31
+ fontSize: 'inherit',
32
+ fontStyle: 'inherit',
33
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
34
+ fontWeight: 'inherit',
35
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
36
+ letterSpacing: 'inherit',
37
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
38
+ lineHeight: 'inherit'
39
+ });
24
40
  var titleStyles = (0, _react.css)({
25
41
  display: 'flex',
26
42
  minWidth: 0,
@@ -38,22 +54,6 @@ var textStyles = (0, _react.css)({
38
54
  flex: '1 1 auto',
39
55
  wordWrap: 'break-word'
40
56
  });
41
- var iconStyles = (0, _react.css)({
42
- flex: '0 0 auto',
43
- // The following properties have been added purely to avoid a global style override in Jira breaking alignment between the icon and title text.
44
- // https://stash.atlassian.com/projects/JIRACLOUD/repos/jira/browse/jira-components/jira-legacy-frontend/jira-atlaskit-module/src/main/resources/jira-atlaskit-module/css/adg3-general-overrides.less?at=master#24
45
- // When the override is removed, these can be removed.
46
- color: 'inherit',
47
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
48
- fontSize: 'inherit',
49
- fontStyle: 'inherit',
50
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
51
- fontWeight: 'inherit',
52
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
53
- letterSpacing: 'inherit',
54
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
55
- lineHeight: 'inherit'
56
- });
57
57
  var truncatedTextStyles = (0, _react.css)({
58
58
  overflow: 'hidden',
59
59
  textOverflow: 'ellipsis',
@@ -78,8 +78,7 @@ var ModalWrapper = function ModalWrapper(props) {
78
78
  _props$shouldReturnFo = props.shouldReturnFocus,
79
79
  shouldReturnFocus = _props$shouldReturnFo === void 0 ? true : _props$shouldReturnFo,
80
80
  stackIndexOverride = props.stackIndex,
81
- _props$onClose = props.onClose,
82
- onClose = _props$onClose === void 0 ? _noop.default : _props$onClose,
81
+ providedOnClose = props.onClose,
83
82
  _props$onStackChange = props.onStackChange,
84
83
  onStackChange = _props$onStackChange === void 0 ? _noop.default : _props$onStackChange,
85
84
  isBlanketHidden = props.isBlanketHidden,
@@ -99,11 +98,11 @@ var ModalWrapper = function ModalWrapper(props) {
99
98
  // When a user supplies a ref to focus we skip auto focus via react-focus-lock
100
99
  var autoFocusLock = typeof autoFocus === 'boolean' ? autoFocus : false;
101
100
  var onCloseHandler = (0, _analyticsNext.usePlatformLeafEventHandler)({
102
- fn: onClose,
101
+ fn: providedOnClose || _noop.default,
103
102
  action: 'closed',
104
103
  componentName: 'modalDialog',
105
104
  packageName: "@atlaskit/modal-dialog",
106
- packageVersion: "13.1.0"
105
+ packageVersion: "13.2.0"
107
106
  });
108
107
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
109
108
  if (shouldCloseOnOverlayClick) {
@@ -131,7 +130,8 @@ var ModalWrapper = function ModalWrapper(props) {
131
130
  height: height,
132
131
  width: width,
133
132
  onCloseComplete: onCloseComplete,
134
- onOpenComplete: onOpenComplete
133
+ onOpenComplete: onOpenComplete,
134
+ hasProvidedOnClose: Boolean(providedOnClose)
135
135
  }, children));
136
136
  var returnFocus = true;
137
137
  var onDeactivation;
@@ -86,6 +86,7 @@ const ModalDialog = props => {
86
86
  onCloseComplete,
87
87
  onOpenComplete,
88
88
  height,
89
+ hasProvidedOnClose,
89
90
  children,
90
91
  label,
91
92
  testId
@@ -113,8 +114,9 @@ const ModalDialog = props => {
113
114
  const modalDialogContext = useMemo(() => ({
114
115
  testId,
115
116
  titleId,
116
- onClose
117
- }), [testId, titleId, onClose]);
117
+ onClose,
118
+ hasProvidedOnClose
119
+ }), [testId, titleId, onClose, hasProvidedOnClose]);
118
120
  useCloseOnEscapePress({
119
121
  onClose,
120
122
  isDisabled: !shouldCloseOnEscapePress
@@ -6,6 +6,8 @@ import React from 'react';
6
6
 
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
+ import { Flex, Grid, xcss } from '@atlaskit/primitives';
10
+ import { CloseButton } from './close-button';
9
11
  import { useModal } from './hooks';
10
12
  const headerStyles = css({
11
13
  display: 'flex',
@@ -17,6 +19,15 @@ const headerStyles = css({
17
19
  paddingBlockStart: "var(--ds-space-300, 24px)",
18
20
  paddingInline: "var(--ds-space-300, 24px)"
19
21
  });
22
+ const gridStyles = xcss({
23
+ width: '100%'
24
+ });
25
+ const closeContainerStyles = xcss({
26
+ gridArea: 'close'
27
+ });
28
+ const titleContainerStyles = xcss({
29
+ gridArea: 'title'
30
+ });
20
31
  /**
21
32
  * __Modal header__
22
33
  *
@@ -29,15 +40,35 @@ const headerStyles = css({
29
40
  const ModalHeader = props => {
30
41
  const {
31
42
  children,
32
- testId: userDefinedTestId
43
+ testId: userDefinedTestId,
44
+ hasCloseButton = false
33
45
  } = props;
34
46
  const {
47
+ hasProvidedOnClose,
48
+ onClose,
35
49
  testId: modalTestId
36
50
  } = useModal();
37
51
  const testId = userDefinedTestId || modalTestId && `${modalTestId}--header`;
52
+
53
+ // Only show if an onClose was provided for the modal dialog
54
+ const shouldShowCloseButton = hasCloseButton && hasProvidedOnClose && onClose;
38
55
  return jsx("div", {
39
56
  css: headerStyles,
40
57
  "data-testid": testId
41
- }, children);
58
+ }, shouldShowCloseButton ? jsx(Grid, {
59
+ gap: "space.200",
60
+ templateAreas: ['title close'],
61
+ xcss: gridStyles
62
+ }, jsx(Flex, {
63
+ xcss: titleContainerStyles,
64
+ justifyContent: "start",
65
+ alignItems: "center"
66
+ }, children), jsx(Flex, {
67
+ xcss: closeContainerStyles,
68
+ justifyContent: "end"
69
+ }, jsx(CloseButton, {
70
+ onClick: onClose,
71
+ testId: modalTestId
72
+ }))) : children);
42
73
  };
43
74
  export default ModalHeader;
@@ -13,6 +13,22 @@ const iconColor = {
13
13
  danger: `var(--ds-icon-danger, ${R400})`,
14
14
  warning: "var(--ds-icon-warning, #D97008)"
15
15
  };
16
+ const iconStyles = css({
17
+ flex: '0 0 auto',
18
+ // The following properties have been added purely to avoid a global style override in Jira breaking alignment between the icon and title text.
19
+ // https://stash.atlassian.com/projects/JIRACLOUD/repos/jira/browse/jira-components/jira-legacy-frontend/jira-atlaskit-module/src/main/resources/jira-atlaskit-module/css/adg3-general-overrides.less?at=master#24
20
+ // When the override is removed, these can be removed.
21
+ color: 'inherit',
22
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
23
+ fontSize: 'inherit',
24
+ fontStyle: 'inherit',
25
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
26
+ fontWeight: 'inherit',
27
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
28
+ letterSpacing: 'inherit',
29
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
30
+ lineHeight: 'inherit'
31
+ });
16
32
  const titleStyles = css({
17
33
  display: 'flex',
18
34
  minWidth: 0,
@@ -30,22 +46,6 @@ const textStyles = css({
30
46
  flex: '1 1 auto',
31
47
  wordWrap: 'break-word'
32
48
  });
33
- const iconStyles = css({
34
- flex: '0 0 auto',
35
- // The following properties have been added purely to avoid a global style override in Jira breaking alignment between the icon and title text.
36
- // https://stash.atlassian.com/projects/JIRACLOUD/repos/jira/browse/jira-components/jira-legacy-frontend/jira-atlaskit-module/src/main/resources/jira-atlaskit-module/css/adg3-general-overrides.less?at=master#24
37
- // When the override is removed, these can be removed.
38
- color: 'inherit',
39
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
40
- fontSize: 'inherit',
41
- fontStyle: 'inherit',
42
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
43
- fontWeight: 'inherit',
44
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
45
- letterSpacing: 'inherit',
46
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
47
- lineHeight: 'inherit'
48
- });
49
49
  const truncatedTextStyles = css({
50
50
  overflow: 'hidden',
51
51
  textOverflow: 'ellipsis',
@@ -64,7 +64,7 @@ const ModalWrapper = props => {
64
64
  shouldScrollInViewport = false,
65
65
  shouldReturnFocus = true,
66
66
  stackIndex: stackIndexOverride,
67
- onClose = noop,
67
+ onClose: providedOnClose,
68
68
  onStackChange = noop,
69
69
  isBlanketHidden,
70
70
  children,
@@ -84,11 +84,11 @@ const ModalWrapper = props => {
84
84
  // When a user supplies a ref to focus we skip auto focus via react-focus-lock
85
85
  const autoFocusLock = typeof autoFocus === 'boolean' ? autoFocus : false;
86
86
  const onCloseHandler = usePlatformLeafEventHandler({
87
- fn: onClose,
87
+ fn: providedOnClose || noop,
88
88
  action: 'closed',
89
89
  componentName: 'modalDialog',
90
90
  packageName: "@atlaskit/modal-dialog",
91
- packageVersion: "13.1.0"
91
+ packageVersion: "13.2.0"
92
92
  });
93
93
  const onBlanketClicked = useCallback(e => {
94
94
  if (shouldCloseOnOverlayClick) {
@@ -114,7 +114,8 @@ const ModalWrapper = props => {
114
114
  height: height,
115
115
  width: width,
116
116
  onCloseComplete: onCloseComplete,
117
- onOpenComplete: onOpenComplete
117
+ onOpenComplete: onOpenComplete,
118
+ hasProvidedOnClose: Boolean(providedOnClose)
118
119
  }, children));
119
120
  let returnFocus = true;
120
121
  let onDeactivation;
@@ -78,6 +78,7 @@ var ModalDialog = function ModalDialog(props) {
78
78
  onCloseComplete = props.onCloseComplete,
79
79
  onOpenComplete = props.onOpenComplete,
80
80
  height = props.height,
81
+ hasProvidedOnClose = props.hasProvidedOnClose,
81
82
  children = props.children,
82
83
  label = props.label,
83
84
  testId = props.testId;
@@ -108,9 +109,10 @@ var ModalDialog = function ModalDialog(props) {
108
109
  return {
109
110
  testId: testId,
110
111
  titleId: titleId,
111
- onClose: onClose
112
+ onClose: onClose,
113
+ hasProvidedOnClose: hasProvidedOnClose
112
114
  };
113
- }, [testId, titleId, onClose]);
115
+ }, [testId, titleId, onClose, hasProvidedOnClose]);
114
116
  useCloseOnEscapePress({
115
117
  onClose: onClose,
116
118
  isDisabled: !shouldCloseOnEscapePress
@@ -6,6 +6,8 @@ import React from 'react';
6
6
 
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
+ import { Flex, Grid, xcss } from '@atlaskit/primitives';
10
+ import { CloseButton } from './close-button';
9
11
  import { useModal } from './hooks';
10
12
  var headerStyles = css({
11
13
  display: 'flex',
@@ -17,6 +19,15 @@ var headerStyles = css({
17
19
  paddingBlockStart: "var(--ds-space-300, 24px)",
18
20
  paddingInline: "var(--ds-space-300, 24px)"
19
21
  });
22
+ var gridStyles = xcss({
23
+ width: '100%'
24
+ });
25
+ var closeContainerStyles = xcss({
26
+ gridArea: 'close'
27
+ });
28
+ var titleContainerStyles = xcss({
29
+ gridArea: 'title'
30
+ });
20
31
  /**
21
32
  * __Modal header__
22
33
  *
@@ -28,13 +39,34 @@ var headerStyles = css({
28
39
  */
29
40
  var ModalHeader = function ModalHeader(props) {
30
41
  var children = props.children,
31
- userDefinedTestId = props.testId;
42
+ userDefinedTestId = props.testId,
43
+ _props$hasCloseButton = props.hasCloseButton,
44
+ hasCloseButton = _props$hasCloseButton === void 0 ? false : _props$hasCloseButton;
32
45
  var _useModal = useModal(),
46
+ hasProvidedOnClose = _useModal.hasProvidedOnClose,
47
+ onClose = _useModal.onClose,
33
48
  modalTestId = _useModal.testId;
34
49
  var testId = userDefinedTestId || modalTestId && "".concat(modalTestId, "--header");
50
+
51
+ // Only show if an onClose was provided for the modal dialog
52
+ var shouldShowCloseButton = hasCloseButton && hasProvidedOnClose && onClose;
35
53
  return jsx("div", {
36
54
  css: headerStyles,
37
55
  "data-testid": testId
38
- }, children);
56
+ }, shouldShowCloseButton ? jsx(Grid, {
57
+ gap: "space.200",
58
+ templateAreas: ['title close'],
59
+ xcss: gridStyles
60
+ }, jsx(Flex, {
61
+ xcss: titleContainerStyles,
62
+ justifyContent: "start",
63
+ alignItems: "center"
64
+ }, children), jsx(Flex, {
65
+ xcss: closeContainerStyles,
66
+ justifyContent: "end"
67
+ }, jsx(CloseButton, {
68
+ onClick: onClose,
69
+ testId: modalTestId
70
+ }))) : children);
39
71
  };
40
72
  export default ModalHeader;
@@ -13,6 +13,22 @@ var iconColor = {
13
13
  danger: "var(--ds-icon-danger, ".concat(R400, ")"),
14
14
  warning: "var(--ds-icon-warning, #D97008)"
15
15
  };
16
+ var iconStyles = css({
17
+ flex: '0 0 auto',
18
+ // The following properties have been added purely to avoid a global style override in Jira breaking alignment between the icon and title text.
19
+ // https://stash.atlassian.com/projects/JIRACLOUD/repos/jira/browse/jira-components/jira-legacy-frontend/jira-atlaskit-module/src/main/resources/jira-atlaskit-module/css/adg3-general-overrides.less?at=master#24
20
+ // When the override is removed, these can be removed.
21
+ color: 'inherit',
22
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
23
+ fontSize: 'inherit',
24
+ fontStyle: 'inherit',
25
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
26
+ fontWeight: 'inherit',
27
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
28
+ letterSpacing: 'inherit',
29
+ // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
30
+ lineHeight: 'inherit'
31
+ });
16
32
  var titleStyles = css({
17
33
  display: 'flex',
18
34
  minWidth: 0,
@@ -30,22 +46,6 @@ var textStyles = css({
30
46
  flex: '1 1 auto',
31
47
  wordWrap: 'break-word'
32
48
  });
33
- var iconStyles = css({
34
- flex: '0 0 auto',
35
- // The following properties have been added purely to avoid a global style override in Jira breaking alignment between the icon and title text.
36
- // https://stash.atlassian.com/projects/JIRACLOUD/repos/jira/browse/jira-components/jira-legacy-frontend/jira-atlaskit-module/src/main/resources/jira-atlaskit-module/css/adg3-general-overrides.less?at=master#24
37
- // When the override is removed, these can be removed.
38
- color: 'inherit',
39
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
40
- fontSize: 'inherit',
41
- fontStyle: 'inherit',
42
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
43
- fontWeight: 'inherit',
44
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
45
- letterSpacing: 'inherit',
46
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
47
- lineHeight: 'inherit'
48
- });
49
49
  var truncatedTextStyles = css({
50
50
  overflow: 'hidden',
51
51
  textOverflow: 'ellipsis',
@@ -68,8 +68,7 @@ var ModalWrapper = function ModalWrapper(props) {
68
68
  _props$shouldReturnFo = props.shouldReturnFocus,
69
69
  shouldReturnFocus = _props$shouldReturnFo === void 0 ? true : _props$shouldReturnFo,
70
70
  stackIndexOverride = props.stackIndex,
71
- _props$onClose = props.onClose,
72
- onClose = _props$onClose === void 0 ? noop : _props$onClose,
71
+ providedOnClose = props.onClose,
73
72
  _props$onStackChange = props.onStackChange,
74
73
  onStackChange = _props$onStackChange === void 0 ? noop : _props$onStackChange,
75
74
  isBlanketHidden = props.isBlanketHidden,
@@ -89,11 +88,11 @@ var ModalWrapper = function ModalWrapper(props) {
89
88
  // When a user supplies a ref to focus we skip auto focus via react-focus-lock
90
89
  var autoFocusLock = typeof autoFocus === 'boolean' ? autoFocus : false;
91
90
  var onCloseHandler = usePlatformLeafEventHandler({
92
- fn: onClose,
91
+ fn: providedOnClose || noop,
93
92
  action: 'closed',
94
93
  componentName: 'modalDialog',
95
94
  packageName: "@atlaskit/modal-dialog",
96
- packageVersion: "13.1.0"
95
+ packageVersion: "13.2.0"
97
96
  });
98
97
  var onBlanketClicked = useCallback(function (e) {
99
98
  if (shouldCloseOnOverlayClick) {
@@ -121,7 +120,8 @@ var ModalWrapper = function ModalWrapper(props) {
121
120
  height: height,
122
121
  width: width,
123
122
  onCloseComplete: onCloseComplete,
124
- onOpenComplete: onOpenComplete
123
+ onOpenComplete: onOpenComplete,
124
+ hasProvidedOnClose: Boolean(providedOnClose)
125
125
  }, children));
126
126
  var returnFocus = true;
127
127
  var onDeactivation;
@@ -5,6 +5,12 @@
5
5
  import { jsx } from '@emotion/react';
6
6
  import type { KeyboardOrMouseEvent, ModalDialogProps } from '../../types';
7
7
  declare const ModalDialog: (props: ModalDialogProps & {
8
+ /**
9
+ * A boolean for if the onClose is provided. We define a `noop` as our onClose
10
+ * at the top level, but we need to know if one is provided for the close
11
+ * button to be rendered.
12
+ */
13
+ hasProvidedOnClose: boolean;
8
14
  onClose: (value: KeyboardOrMouseEvent) => void;
9
15
  }) => jsx.JSX.Element;
10
16
  export default ModalDialog;
@@ -15,6 +15,12 @@ export type ModalAttributes = {
15
15
  * wrapped in modal dialog's analytic event context.
16
16
  */
17
17
  onClose: OnCloseHandler;
18
+ /**
19
+ * A boolean for if the onClose is provided. We define a `noop` as our onClose
20
+ * at the top level, but we need to know if one is provided for the close
21
+ * button to be rendered.
22
+ */
23
+ hasProvidedOnClose?: boolean;
18
24
  };
19
25
  export declare const ModalContext: import("react").Context<ModalAttributes | null>;
20
26
  export declare const ScrollContext: import("react").Context<boolean | null>;
@@ -9,6 +9,11 @@ export interface ModalHeaderProps {
9
9
  * Children of modal dialog header.
10
10
  */
11
11
  children?: React.ReactNode;
12
+ /**
13
+ * Shows a close button at the end of the header.
14
+ * @default false
15
+ */
16
+ hasCloseButton?: boolean;
12
17
  /**
13
18
  * A `testId` prop is provided for specified elements,
14
19
  * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
@@ -5,6 +5,12 @@
5
5
  import { jsx } from '@emotion/react';
6
6
  import type { KeyboardOrMouseEvent, ModalDialogProps } from '../../types';
7
7
  declare const ModalDialog: (props: ModalDialogProps & {
8
+ /**
9
+ * A boolean for if the onClose is provided. We define a `noop` as our onClose
10
+ * at the top level, but we need to know if one is provided for the close
11
+ * button to be rendered.
12
+ */
13
+ hasProvidedOnClose: boolean;
8
14
  onClose: (value: KeyboardOrMouseEvent) => void;
9
15
  }) => jsx.JSX.Element;
10
16
  export default ModalDialog;
@@ -15,6 +15,12 @@ export type ModalAttributes = {
15
15
  * wrapped in modal dialog's analytic event context.
16
16
  */
17
17
  onClose: OnCloseHandler;
18
+ /**
19
+ * A boolean for if the onClose is provided. We define a `noop` as our onClose
20
+ * at the top level, but we need to know if one is provided for the close
21
+ * button to be rendered.
22
+ */
23
+ hasProvidedOnClose?: boolean;
18
24
  };
19
25
  export declare const ModalContext: import("react").Context<ModalAttributes | null>;
20
26
  export declare const ScrollContext: import("react").Context<boolean | null>;
@@ -9,6 +9,11 @@ export interface ModalHeaderProps {
9
9
  * Children of modal dialog header.
10
10
  */
11
11
  children?: React.ReactNode;
12
+ /**
13
+ * Shows a close button at the end of the header.
14
+ * @default false
15
+ */
16
+ hasCloseButton?: boolean;
12
17
  /**
13
18
  * A `testId` prop is provided for specified elements,
14
19
  * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "13.1.0",
3
+ "version": "13.2.0",
4
4
  "description": "A modal dialog displays content that requires user interaction, in a layer above the page.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -66,13 +66,13 @@
66
66
  "@atlaskit/datetime-picker": "^16.1.0",
67
67
  "@atlaskit/docs": "^10.0.0",
68
68
  "@atlaskit/dropdown-menu": "^13.0.0",
69
- "@atlaskit/flag": "^16.2.0",
69
+ "@atlaskit/flag": "^17.1.0",
70
70
  "@atlaskit/form": "^12.0.0",
71
71
  "@atlaskit/heading": "^5.1.0",
72
72
  "@atlaskit/link": "^3.0.0",
73
73
  "@atlaskit/popup": "^2.0.0",
74
74
  "@atlaskit/radio": "^8.0.0",
75
- "@atlaskit/section-message": "^8.1.0",
75
+ "@atlaskit/section-message": "^8.2.0",
76
76
  "@atlaskit/select": "^20.0.0",
77
77
  "@atlaskit/ssr": "^0.4.0",
78
78
  "@atlaskit/textfield": "^8.0.0",