@atlaskit/modal-dialog 12.19.2 → 12.19.3

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,13 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 12.19.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#107054](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107054)
8
+ [`046508790857d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/046508790857d) -
9
+ Add appearance to modal title for better AT support
10
+
3
11
  ## 12.19.2
4
12
 
5
13
  ### Patch Changes
@@ -8,8 +8,6 @@ exports.default = void 0;
8
8
  var _react = require("@emotion/react");
9
9
  var _error = _interopRequireDefault(require("@atlaskit/icon/core/migration/error"));
10
10
  var _warning = _interopRequireDefault(require("@atlaskit/icon/core/migration/warning"));
11
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
- var _primitives = require("@atlaskit/primitives");
13
11
  var _hooks = require("./hooks");
14
12
  var _constants = require("./internal/constants");
15
13
  /**
@@ -87,28 +85,18 @@ var ModalTitle = function ModalTitle(props) {
87
85
  titleId = _useModal.titleId,
88
86
  modalTestId = _useModal.testId;
89
87
  var testId = userDefinedTestId || modalTestId && "".concat(modalTestId, "--title");
90
- return (0, _platformFeatureFlags.fg)('platform_modal-dialog-heading-icon-a11y-fix') ? (0, _react.jsx)(_primitives.Flex, {
91
- gap: "space.100"
92
- }, appearance && (0, _react.jsx)(TitleIcon, {
93
- appearance: appearance
94
- }), (0, _react.jsx)("h1", {
95
- css: titleStyles,
96
- "data-testid": testId
97
- }, (0, _react.jsx)("span", {
98
- id: titleId,
99
- css: [textStyles, !isMultiline && truncatedTextStyles],
100
- "data-testid": testId && "".concat(testId, "-text")
101
- }, children))) :
102
- // eslint-disable-next-line @atlaskit/design-system/use-heading
103
- (0, _react.jsx)("h1", {
104
- css: titleStyles,
105
- "data-testid": testId
106
- }, appearance && (0, _react.jsx)(TitleIcon, {
107
- appearance: appearance
108
- }), (0, _react.jsx)("span", {
109
- id: titleId,
110
- css: [textStyles, !isMultiline && truncatedTextStyles],
111
- "data-testid": testId && "".concat(testId, "-text")
112
- }, children));
88
+ return (
89
+ // eslint-disable-next-line @atlaskit/design-system/use-heading
90
+ (0, _react.jsx)("h1", {
91
+ css: titleStyles,
92
+ "data-testid": testId
93
+ }, appearance && (0, _react.jsx)(TitleIcon, {
94
+ appearance: appearance
95
+ }), (0, _react.jsx)("span", {
96
+ id: titleId,
97
+ css: [textStyles, !isMultiline && truncatedTextStyles],
98
+ "data-testid": testId && "".concat(testId, "-text")
99
+ }, children))
100
+ );
113
101
  };
114
102
  var _default = exports.default = ModalTitle;
@@ -108,7 +108,7 @@ var ModalWrapper = function ModalWrapper(props) {
108
108
  action: 'closed',
109
109
  componentName: 'modalDialog',
110
110
  packageName: "@atlaskit/modal-dialog",
111
- packageVersion: "12.19.2"
111
+ packageVersion: "12.19.3"
112
112
  });
113
113
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
114
114
  if (shouldCloseOnOverlayClick) {
@@ -7,8 +7,6 @@
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import ErrorIcon from '@atlaskit/icon/core/migration/error';
9
9
  import WarningIcon from '@atlaskit/icon/core/migration/warning';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
- import { Flex } from '@atlaskit/primitives';
12
10
  import { useModal } from './hooks';
13
11
  import { iconColor } from './internal/constants';
14
12
  const titleStyles = css({
@@ -82,28 +80,18 @@ const ModalTitle = props => {
82
80
  testId: modalTestId
83
81
  } = useModal();
84
82
  const testId = userDefinedTestId || modalTestId && `${modalTestId}--title`;
85
- return fg('platform_modal-dialog-heading-icon-a11y-fix') ? jsx(Flex, {
86
- gap: "space.100"
87
- }, appearance && jsx(TitleIcon, {
88
- appearance: appearance
89
- }), jsx("h1", {
90
- css: titleStyles,
91
- "data-testid": testId
92
- }, jsx("span", {
93
- id: titleId,
94
- css: [textStyles, !isMultiline && truncatedTextStyles],
95
- "data-testid": testId && `${testId}-text`
96
- }, children))) :
97
- // eslint-disable-next-line @atlaskit/design-system/use-heading
98
- jsx("h1", {
99
- css: titleStyles,
100
- "data-testid": testId
101
- }, appearance && jsx(TitleIcon, {
102
- appearance: appearance
103
- }), jsx("span", {
104
- id: titleId,
105
- css: [textStyles, !isMultiline && truncatedTextStyles],
106
- "data-testid": testId && `${testId}-text`
107
- }, children));
83
+ return (
84
+ // eslint-disable-next-line @atlaskit/design-system/use-heading
85
+ jsx("h1", {
86
+ css: titleStyles,
87
+ "data-testid": testId
88
+ }, appearance && jsx(TitleIcon, {
89
+ appearance: appearance
90
+ }), jsx("span", {
91
+ id: titleId,
92
+ css: [textStyles, !isMultiline && truncatedTextStyles],
93
+ "data-testid": testId && `${testId}-text`
94
+ }, children))
95
+ );
108
96
  };
109
97
  export default ModalTitle;
@@ -93,7 +93,7 @@ const ModalWrapper = props => {
93
93
  action: 'closed',
94
94
  componentName: 'modalDialog',
95
95
  packageName: "@atlaskit/modal-dialog",
96
- packageVersion: "12.19.2"
96
+ packageVersion: "12.19.3"
97
97
  });
98
98
  const onBlanketClicked = useCallback(e => {
99
99
  if (shouldCloseOnOverlayClick) {
@@ -7,8 +7,6 @@
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import ErrorIcon from '@atlaskit/icon/core/migration/error';
9
9
  import WarningIcon from '@atlaskit/icon/core/migration/warning';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
- import { Flex } from '@atlaskit/primitives';
12
10
  import { useModal } from './hooks';
13
11
  import { iconColor } from './internal/constants';
14
12
  var titleStyles = css({
@@ -79,28 +77,18 @@ var ModalTitle = function ModalTitle(props) {
79
77
  titleId = _useModal.titleId,
80
78
  modalTestId = _useModal.testId;
81
79
  var testId = userDefinedTestId || modalTestId && "".concat(modalTestId, "--title");
82
- return fg('platform_modal-dialog-heading-icon-a11y-fix') ? jsx(Flex, {
83
- gap: "space.100"
84
- }, appearance && jsx(TitleIcon, {
85
- appearance: appearance
86
- }), jsx("h1", {
87
- css: titleStyles,
88
- "data-testid": testId
89
- }, jsx("span", {
90
- id: titleId,
91
- css: [textStyles, !isMultiline && truncatedTextStyles],
92
- "data-testid": testId && "".concat(testId, "-text")
93
- }, children))) :
94
- // eslint-disable-next-line @atlaskit/design-system/use-heading
95
- jsx("h1", {
96
- css: titleStyles,
97
- "data-testid": testId
98
- }, appearance && jsx(TitleIcon, {
99
- appearance: appearance
100
- }), jsx("span", {
101
- id: titleId,
102
- css: [textStyles, !isMultiline && truncatedTextStyles],
103
- "data-testid": testId && "".concat(testId, "-text")
104
- }, children));
80
+ return (
81
+ // eslint-disable-next-line @atlaskit/design-system/use-heading
82
+ jsx("h1", {
83
+ css: titleStyles,
84
+ "data-testid": testId
85
+ }, appearance && jsx(TitleIcon, {
86
+ appearance: appearance
87
+ }), jsx("span", {
88
+ id: titleId,
89
+ css: [textStyles, !isMultiline && truncatedTextStyles],
90
+ "data-testid": testId && "".concat(testId, "-text")
91
+ }, children))
92
+ );
105
93
  };
106
94
  export default ModalTitle;
@@ -98,7 +98,7 @@ var ModalWrapper = function ModalWrapper(props) {
98
98
  action: 'closed',
99
99
  componentName: 'modalDialog',
100
100
  packageName: "@atlaskit/modal-dialog",
101
- packageVersion: "12.19.2"
101
+ packageVersion: "12.19.3"
102
102
  });
103
103
  var onBlanketClicked = useCallback(function (e) {
104
104
  if (shouldCloseOnOverlayClick) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "12.19.2",
3
+ "version": "12.19.3",
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/"
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
42
42
  "@atlaskit/primitives": "^13.3.0",
43
43
  "@atlaskit/theme": "^14.0.0",
44
- "@atlaskit/tokens": "^3.1.0",
44
+ "@atlaskit/tokens": "^3.2.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "@emotion/react": "^11.7.1",
47
47
  "bind-event-listener": "^3.0.0",
@@ -58,7 +58,7 @@
58
58
  "@af/visual-regression": "*",
59
59
  "@atlaskit/button": "*",
60
60
  "@atlaskit/checkbox": "^15.2.0",
61
- "@atlaskit/dropdown-menu": "^12.24.0",
61
+ "@atlaskit/dropdown-menu": "^12.25.0",
62
62
  "@atlaskit/popup": "^1.30.0",
63
63
  "@atlaskit/radio": "^7.0.0",
64
64
  "@atlaskit/select": "^18.9.0",
@@ -1,38 +0,0 @@
1
- import React, { useState } from 'react';
2
-
3
- import Button from '@atlaskit/button/new';
4
-
5
- import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '../src';
6
-
7
- export default function Example() {
8
- const [isOpen, setIsOpen] = useState(false);
9
- const close = () => setIsOpen(false);
10
- const open = () => setIsOpen(true);
11
-
12
- return (
13
- <>
14
- <button onClick={open} type="button">
15
- open modal
16
- </button>
17
-
18
- <ModalTransition>
19
- {isOpen && (
20
- <Modal onClose={close}>
21
- <ModalHeader>
22
- <ModalTitle>Modal title</ModalTitle>
23
- </ModalHeader>
24
- <ModalBody>A simple Modal</ModalBody>
25
- <ModalFooter>
26
- <Button testId="primary" appearance="primary" onClick={close}>
27
- Close
28
- </Button>
29
- <Button testId="secondary" appearance="subtle">
30
- Secondary Action
31
- </Button>
32
- </ModalFooter>
33
- </Modal>
34
- )}
35
- </ModalTransition>
36
- </>
37
- );
38
- }
@@ -1,115 +0,0 @@
1
- import React, { useCallback, useState } from 'react';
2
-
3
- import { findByText, fireEvent } from '@testing-library/dom';
4
- import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
5
-
6
- import Button from '@atlaskit/button/new';
7
-
8
- import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '../src';
9
-
10
- const modalText = (index: number) => `Hello, world (${index})`;
11
- const closeText = (index: number) => `Close (${index})`;
12
- const openText = (index: number) => `Open (${index})`;
13
-
14
- const InteractionPerformance = ({ index = 0 }: { index?: number }) => {
15
- const [isOpen, setIsOpen] = useState(false);
16
- const open = useCallback(() => setIsOpen(true), []);
17
- const close = useCallback(() => setIsOpen(false), []);
18
-
19
- return (
20
- <>
21
- <button data-testid="open-button" onClick={open} type="button">
22
- {openText(index)}
23
- </button>
24
-
25
- <ModalTransition>
26
- {isOpen && (
27
- <Modal onClose={close}>
28
- <ModalHeader>
29
- <ModalTitle>Modal dialog</ModalTitle>
30
- </ModalHeader>
31
- <ModalBody>
32
- {modalText(index)}
33
- <InteractionPerformance index={index + 1} />
34
- </ModalBody>
35
- <ModalFooter>
36
- <Button testId="primary" appearance="primary" onClick={close}>
37
- {closeText(index)}
38
- </Button>
39
- </ModalFooter>
40
- </Modal>
41
- )}
42
- </ModalTransition>
43
- </>
44
- );
45
- };
46
-
47
- const interactionTasks: PublicInteractionTask[] = [
48
- {
49
- name: 'Open first',
50
- description: 'Opens the modal dialog',
51
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
52
- const openButton = await findByText(container, openText(0));
53
-
54
- await controls.time(async () => {
55
- fireEvent.click(openButton);
56
- await findByText(document.body, modalText(0));
57
- });
58
- },
59
- },
60
- {
61
- name: 'Close first',
62
- description: 'Closes the modal dialog',
63
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
64
- const openButton = await findByText(container, openText(0));
65
- fireEvent.click(openButton);
66
-
67
- await controls.time(async () => {
68
- const closeButton = await findByText(document.body, closeText(0));
69
- fireEvent.click(closeButton);
70
- });
71
- },
72
- },
73
- {
74
- name: 'Open second',
75
- description: 'Opens the a second modal',
76
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
77
- const openButton = await findByText(container, openText(0));
78
- fireEvent.click(openButton);
79
- await findByText(document.body, modalText(0));
80
- const secondOpenButton = await findByText(document.body, openText(1));
81
-
82
- await controls.time(async () => {
83
- fireEvent.click(secondOpenButton);
84
- await findByText(document.body, modalText(1));
85
- });
86
- },
87
- },
88
- {
89
- name: 'Close second',
90
- description: 'Closes the a second modal',
91
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
92
- const openButton = await findByText(container, openText(0));
93
- fireEvent.click(openButton);
94
- await findByText(document.body, modalText(0));
95
- const secondOpenButton = await findByText(document.body, openText(1));
96
- fireEvent.click(secondOpenButton);
97
- await findByText(document.body, modalText(1));
98
-
99
- await controls.time(async () => {
100
- const closeButton = await findByText(document.body, closeText(1));
101
- fireEvent.click(closeButton);
102
- });
103
- },
104
- },
105
- ];
106
-
107
- InteractionPerformance.story = {
108
- parameters: {
109
- performance: {
110
- interactions: interactionTasks,
111
- },
112
- },
113
- };
114
-
115
- export default InteractionPerformance;
@@ -1,81 +0,0 @@
1
- import React, { useCallback, useRef, useState } from 'react';
2
-
3
- import { findByTestId, findByText, fireEvent } from '@testing-library/dom';
4
- import Lorem from 'react-lorem-component';
5
- import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
6
-
7
- import Button from '@atlaskit/button/new';
8
-
9
- import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '../src';
10
-
11
- const openText = 'Open modal';
12
- const closeText = 'Close';
13
- const scrollToBottomText = 'Scroll to bottom';
14
-
15
- const ScrollPerformance = () => {
16
- const [isOpen, setIsOpen] = useState(false);
17
-
18
- const bottomRef = useRef<HTMLDivElement>(null);
19
-
20
- const open = useCallback(() => setIsOpen(true), []);
21
- const close = useCallback(() => setIsOpen(false), []);
22
-
23
- const scrollToBottom = () => bottomRef.current && bottomRef.current.scrollIntoView(true);
24
-
25
- return (
26
- <>
27
- <button data-testid="open" onClick={open} type="button">
28
- {openText}
29
- </button>
30
-
31
- <ModalTransition>
32
- {isOpen && (
33
- <Modal onClose={close} testId="modal">
34
- <ModalHeader>
35
- <ModalTitle>Modal dialog</ModalTitle>
36
- </ModalHeader>
37
- <ModalBody>
38
- <Lorem count={10} />
39
- <div ref={bottomRef} />
40
- </ModalBody>
41
- <ModalFooter>
42
- <Button testId="close" appearance="primary" onClick={close}>
43
- {closeText}
44
- </Button>
45
- <Button testId="scroll-to-bottom" appearance="subtle" onClick={scrollToBottom}>
46
- {scrollToBottomText}
47
- </Button>
48
- </ModalFooter>
49
- </Modal>
50
- )}
51
- </ModalTransition>
52
- </>
53
- );
54
- };
55
-
56
- const interactionTasks: PublicInteractionTask[] = [
57
- {
58
- name: 'Scroll to bottom',
59
- description: 'Opens the modal dialog',
60
- run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
61
- const openButton = await findByText(container, openText);
62
- fireEvent.click(openButton);
63
-
64
- const content = await findByTestId(document.body, 'modal--scrollable');
65
-
66
- await controls.time(async () => {
67
- content.scrollTo(0, content.scrollHeight);
68
- });
69
- },
70
- },
71
- ];
72
-
73
- ScrollPerformance.story = {
74
- parameters: {
75
- performance: {
76
- interactions: interactionTasks,
77
- },
78
- },
79
- };
80
-
81
- export default ScrollPerformance;