@atlaskit/modal-dialog 12.5.7 → 12.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 12.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b6b02e57520`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6b02e57520) - Restore support for foreground modal
8
+
9
+ ## 12.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`26388cfdd23`](https://bitbucket.org/atlassian/atlassian-frontend/commits/26388cfdd23) - Adds `label` prop for users of assistive technology to receive more context when using the modal.
14
+
3
15
  ## 12.5.7
4
16
 
5
17
  ### Patch Changes
@@ -87,6 +87,7 @@ var ModalDialog = function ModalDialog(props) {
87
87
  onOpenComplete = props.onOpenComplete,
88
88
  height = props.height,
89
89
  children = props.children,
90
+ label = props.label,
90
91
  testId = props.testId;
91
92
  var id = (0, _reactUid.useUID)();
92
93
  var titleId = "modal-dialog-title-".concat(id);
@@ -120,6 +121,7 @@ var ModalDialog = function ModalDialog(props) {
120
121
  onFinish: onMotionFinish
121
122
  }, function (bottomFadeInProps) {
122
123
  return (0, _react2.jsx)(_focusRing.default, null, (0, _react2.jsx)("section", (0, _extends2.default)({}, bottomFadeInProps, {
124
+ "aria-label": label,
123
125
  ref: (0, _mergeRefs.default)([bottomFadeInProps.ref, motionRef]),
124
126
  style: {
125
127
  '--modal-dialog-width': (0, _utils.dialogWidth)(width),
@@ -127,7 +129,7 @@ var ModalDialog = function ModalDialog(props) {
127
129
  },
128
130
  css: [dialogStyles, shouldScrollInViewport ? viewportScrollStyles : bodyScrollStyles],
129
131
  role: "dialog",
130
- "aria-labelledby": titleId,
132
+ "aria-labelledby": label ? undefined : titleId,
131
133
  "data-testid": testId,
132
134
  "data-modal-stack": stackIndex,
133
135
  tabIndex: -1,
@@ -71,6 +71,7 @@ var ModalWrapper = function ModalWrapper(props) {
71
71
  width = props.width,
72
72
  onCloseComplete = props.onCloseComplete,
73
73
  onOpenComplete = props.onOpenComplete,
74
+ label = props.label,
74
75
  testId = props.testId;
75
76
  var calculatedStackIndex = (0, _useModalStack.default)({
76
77
  onStackChange: onStackChange
@@ -85,7 +86,7 @@ var ModalWrapper = function ModalWrapper(props) {
85
86
  action: 'closed',
86
87
  componentName: 'modalDialog',
87
88
  packageName: "@atlaskit/modal-dialog",
88
- packageVersion: "12.5.7"
89
+ packageVersion: "12.6.1"
89
90
  });
90
91
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
91
92
  if (shouldCloseOnOverlayClick) {
@@ -103,6 +104,7 @@ var ModalWrapper = function ModalWrapper(props) {
103
104
  testId: testId && "".concat(testId, "--blanket")
104
105
  }, (0, _react2.jsx)(_modalDialog.default, {
105
106
  testId: testId,
107
+ label: label,
106
108
  autoFocus: autoFocus,
107
109
  stackIndex: stackIndex,
108
110
  onClose: onCloseHandler,
@@ -120,6 +122,7 @@ var ModalWrapper = function ModalWrapper(props) {
120
122
  "aria-hidden": !isForeground
121
123
  }), (0, _react2.jsx)(_reactFocusLock.default, {
122
124
  autoFocus: autoFocusLock,
125
+ disabled: !isForeground,
123
126
  returnFocus: true,
124
127
  whiteList: whiteListElements
125
128
  }, (0, _react2.jsx)(_reactScrolllock.default, null), shouldScrollInViewport ? (0, _react2.jsx)(_reactScrolllock.TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.5.7",
3
+ "version": "12.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -76,6 +76,7 @@ const ModalDialog = props => {
76
76
  onOpenComplete,
77
77
  height,
78
78
  children,
79
+ label,
79
80
  testId
80
81
  } = props;
81
82
  const id = useUID();
@@ -104,6 +105,7 @@ const ModalDialog = props => {
104
105
  entranceDirection: "bottom",
105
106
  onFinish: onMotionFinish
106
107
  }, bottomFadeInProps => jsx(FocusRing, null, jsx("section", _extends({}, bottomFadeInProps, {
108
+ "aria-label": label,
107
109
  ref: mergeRefs([bottomFadeInProps.ref, motionRef]),
108
110
  style: {
109
111
  '--modal-dialog-width': dialogWidth(width),
@@ -111,7 +113,7 @@ const ModalDialog = props => {
111
113
  },
112
114
  css: [dialogStyles, shouldScrollInViewport ? viewportScrollStyles : bodyScrollStyles],
113
115
  role: "dialog",
114
- "aria-labelledby": titleId,
116
+ "aria-labelledby": label ? undefined : titleId,
115
117
  "data-testid": testId,
116
118
  "data-modal-stack": stackIndex,
117
119
  tabIndex: -1,
@@ -56,6 +56,7 @@ const ModalWrapper = props => {
56
56
  width,
57
57
  onCloseComplete,
58
58
  onOpenComplete,
59
+ label,
59
60
  testId
60
61
  } = props;
61
62
  const calculatedStackIndex = useModalStack({
@@ -71,7 +72,7 @@ const ModalWrapper = props => {
71
72
  action: 'closed',
72
73
  componentName: 'modalDialog',
73
74
  packageName: "@atlaskit/modal-dialog",
74
- packageVersion: "12.5.7"
75
+ packageVersion: "12.6.1"
75
76
  });
76
77
  const onBlanketClicked = useCallback(e => {
77
78
  if (shouldCloseOnOverlayClick) {
@@ -89,6 +90,7 @@ const ModalWrapper = props => {
89
90
  testId: testId && `${testId}--blanket`
90
91
  }, jsx(ModalDialog, {
91
92
  testId: testId,
93
+ label: label,
92
94
  autoFocus: autoFocus,
93
95
  stackIndex: stackIndex,
94
96
  onClose: onCloseHandler,
@@ -105,6 +107,7 @@ const ModalWrapper = props => {
105
107
  "aria-hidden": !isForeground
106
108
  }), jsx(FocusLock, {
107
109
  autoFocus: autoFocusLock,
110
+ disabled: !isForeground,
108
111
  returnFocus: true,
109
112
  whiteList: whiteListElements
110
113
  }, jsx(ScrollLock, null), shouldScrollInViewport ? jsx(TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket))));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.5.7",
3
+ "version": "12.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -79,6 +79,7 @@ var ModalDialog = function ModalDialog(props) {
79
79
  onOpenComplete = props.onOpenComplete,
80
80
  height = props.height,
81
81
  children = props.children,
82
+ label = props.label,
82
83
  testId = props.testId;
83
84
  var id = useUID();
84
85
  var titleId = "modal-dialog-title-".concat(id);
@@ -112,6 +113,7 @@ var ModalDialog = function ModalDialog(props) {
112
113
  onFinish: onMotionFinish
113
114
  }, function (bottomFadeInProps) {
114
115
  return jsx(FocusRing, null, jsx("section", _extends({}, bottomFadeInProps, {
116
+ "aria-label": label,
115
117
  ref: mergeRefs([bottomFadeInProps.ref, motionRef]),
116
118
  style: {
117
119
  '--modal-dialog-width': dialogWidth(width),
@@ -119,7 +121,7 @@ var ModalDialog = function ModalDialog(props) {
119
121
  },
120
122
  css: [dialogStyles, shouldScrollInViewport ? viewportScrollStyles : bodyScrollStyles],
121
123
  role: "dialog",
122
- "aria-labelledby": titleId,
124
+ "aria-labelledby": label ? undefined : titleId,
123
125
  "data-testid": testId,
124
126
  "data-modal-stack": stackIndex,
125
127
  tabIndex: -1,
@@ -61,6 +61,7 @@ var ModalWrapper = function ModalWrapper(props) {
61
61
  width = props.width,
62
62
  onCloseComplete = props.onCloseComplete,
63
63
  onOpenComplete = props.onOpenComplete,
64
+ label = props.label,
64
65
  testId = props.testId;
65
66
  var calculatedStackIndex = useModalStack({
66
67
  onStackChange: onStackChange
@@ -75,7 +76,7 @@ var ModalWrapper = function ModalWrapper(props) {
75
76
  action: 'closed',
76
77
  componentName: 'modalDialog',
77
78
  packageName: "@atlaskit/modal-dialog",
78
- packageVersion: "12.5.7"
79
+ packageVersion: "12.6.1"
79
80
  });
80
81
  var onBlanketClicked = useCallback(function (e) {
81
82
  if (shouldCloseOnOverlayClick) {
@@ -93,6 +94,7 @@ var ModalWrapper = function ModalWrapper(props) {
93
94
  testId: testId && "".concat(testId, "--blanket")
94
95
  }, jsx(ModalDialog, {
95
96
  testId: testId,
97
+ label: label,
96
98
  autoFocus: autoFocus,
97
99
  stackIndex: stackIndex,
98
100
  onClose: onCloseHandler,
@@ -110,6 +112,7 @@ var ModalWrapper = function ModalWrapper(props) {
110
112
  "aria-hidden": !isForeground
111
113
  }), jsx(FocusLock, {
112
114
  autoFocus: autoFocusLock,
115
+ disabled: !isForeground,
113
116
  returnFocus: true,
114
117
  whiteList: whiteListElements
115
118
  }, jsx(ScrollLock, null), shouldScrollInViewport ? jsx(TouchScrollable, null, modalDialogWithBlanket) : modalDialogWithBlanket));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.5.7",
3
+ "version": "12.6.1",
4
4
  "sideEffects": false
5
5
  }
@@ -70,6 +70,13 @@ export interface ModalDialogProps {
70
70
  * This offsets the modal dialogs vertical position.
71
71
  */
72
72
  stackIndex?: number;
73
+ /**
74
+ * The label of the modal dialog that is announced to users of assistive
75
+ * technology. This should only be used if there is no modal title being
76
+ * associated to your modal, either via using the modal title component or the
77
+ * `titleId` prop within the `useModal` context.
78
+ */
79
+ label?: string;
73
80
  /**
74
81
  * A `testId` prop is provided for specified elements,
75
82
  * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
@@ -70,6 +70,13 @@ export interface ModalDialogProps {
70
70
  * This offsets the modal dialogs vertical position.
71
71
  */
72
72
  stackIndex?: number;
73
+ /**
74
+ * The label of the modal dialog that is announced to users of assistive
75
+ * technology. This should only be used if there is no modal title being
76
+ * associated to your modal, either via using the modal title component or the
77
+ * `titleId` prop within the `useModal` context.
78
+ */
79
+ label?: string;
73
80
  /**
74
81
  * A `testId` prop is provided for specified elements,
75
82
  * 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": "12.5.7",
3
+ "version": "12.6.1",
4
4
  "description": "A modal dialog displays content that requires user interaction, in a layer above the page.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "atlaskit:src": "src/index.tsx",
36
36
  "atlassian": {
37
37
  "team": "Design System Team",
38
- "releaseModel": "scheduled",
38
+ "releaseModel": "continuous",
39
39
  "website": {
40
40
  "name": "Modal dialog",
41
41
  "category": "Components"
package/report.api.md CHANGED
@@ -55,6 +55,7 @@ export interface ModalDialogProps {
55
55
  children?: React_2.ReactNode;
56
56
  height?: number | string;
57
57
  isBlanketHidden?: boolean;
58
+ label?: string;
58
59
  onClose?: OnCloseHandler;
59
60
  onCloseComplete?: OnCloseCompleteHandler;
60
61
  onOpenComplete?: OnOpenCompleteHandler;
@@ -0,0 +1,113 @@
1
+ ## API Report File for "@atlaskit/modal-dialog"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ /// <reference types="react" />
8
+
9
+ import { ExitingPersistenceProps } from '@atlaskit/motion/exiting-persistence';
10
+ import { jsx } from '@emotion/react';
11
+ import { default as React_2 } from 'react';
12
+ import { ReactNode } from 'react';
13
+ import { RefObject } from 'react';
14
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
15
+
16
+ // @public (undocumented)
17
+ export type Appearance = 'danger' | 'warning';
18
+
19
+ // @public (undocumented)
20
+ export type KeyboardOrMouseEvent = KeyboardEvent | React_2.KeyboardEvent<any> | React_2.MouseEvent<any>;
21
+
22
+ // @public (undocumented)
23
+ export type ModalAttributes = {
24
+ testId?: ModalDialogProps['testId'];
25
+ titleId: string;
26
+ onClose?: OnCloseHandler;
27
+ };
28
+
29
+ // @public
30
+ export const ModalBody: (props: ModalBodyProps) => jsx.JSX.Element;
31
+
32
+ // @public (undocumented)
33
+ export interface ModalBodyProps {
34
+ children: React_2.ReactNode;
35
+ testId?: string;
36
+ }
37
+
38
+ // @public (undocumented)
39
+ export interface ModalDialogProps {
40
+ autoFocus?: RefObject<HTMLElement | null | undefined> | boolean;
41
+ children?: React_2.ReactNode;
42
+ height?: number | string;
43
+ isBlanketHidden?: boolean;
44
+ label?: string;
45
+ onClose?: OnCloseHandler;
46
+ onCloseComplete?: OnCloseCompleteHandler;
47
+ onOpenComplete?: OnOpenCompleteHandler;
48
+ onStackChange?: OnStackChangeHandler;
49
+ shouldCloseOnEscapePress?: boolean;
50
+ shouldCloseOnOverlayClick?: boolean;
51
+ shouldScrollInViewport?: boolean;
52
+ stackIndex?: number;
53
+ testId?: string;
54
+ width?: WidthNames | number | string;
55
+ }
56
+
57
+ // @public
58
+ export const ModalFooter: (props: ModalFooterProps) => jsx.JSX.Element;
59
+
60
+ // @public (undocumented)
61
+ export interface ModalFooterProps {
62
+ children?: ReactNode;
63
+ testId?: string;
64
+ }
65
+
66
+ // @public
67
+ export const ModalHeader: (props: ModalHeaderProps) => jsx.JSX.Element;
68
+
69
+ // @public (undocumented)
70
+ export interface ModalHeaderProps {
71
+ children?: React_2.ReactNode;
72
+ testId?: string;
73
+ }
74
+
75
+ // @public
76
+ export const ModalTitle: (props: ModalTitleProps) => jsx.JSX.Element;
77
+
78
+ // @public (undocumented)
79
+ export interface ModalTitleProps {
80
+ appearance?: Appearance;
81
+ children?: ReactNode;
82
+ isMultiline?: boolean;
83
+ testId?: string;
84
+ }
85
+
86
+ // @public
87
+ export const ModalTransition: (props: Pick<ExitingPersistenceProps, 'children'>) => JSX.Element;
88
+
89
+ // @public
90
+ const ModalWrapper: (props: ModalDialogProps) => jsx.JSX.Element;
91
+ export default ModalWrapper;
92
+
93
+ // @public (undocumented)
94
+ export type OnCloseCompleteHandler = (element: HTMLElement) => void;
95
+
96
+ // @public (undocumented)
97
+ export type OnCloseHandler = (e: KeyboardOrMouseEvent, analyticEvent: UIAnalyticsEvent) => void;
98
+
99
+ // @public (undocumented)
100
+ export type OnOpenCompleteHandler = (node: HTMLElement, isAppearing: boolean) => void;
101
+
102
+ // @public (undocumented)
103
+ export type OnStackChangeHandler = (stackIndex: number) => void;
104
+
105
+ // @public (undocumented)
106
+ export const useModal: () => ModalAttributes;
107
+
108
+ // @public (undocumented)
109
+ type WidthNames = 'large' | 'medium' | 'small' | 'x-large';
110
+
111
+ // (No @packageDocumentation comment for this package)
112
+
113
+ ```