@atlaskit/popup 1.17.2 → 1.18.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 +441 -432
- package/__perf__/closed.tsx +30 -30
- package/__perf__/default.tsx +19 -19
- package/__perf__/open.tsx +19 -23
- package/__perf__/popup.tsx +26 -26
- package/__perf__/utils/interaction-tasks.tsx +37 -50
- package/codemods/1.0.0-lite-mode.tsx +148 -181
- package/codemods/__tests__/1.0.0-lite-mode.tsx +88 -88
- package/codemods/utils/helpers.tsx +250 -261
- package/dist/cjs/popper-wrapper.js +15 -6
- package/dist/cjs/popup.js +17 -4
- package/dist/es2019/popper-wrapper.js +15 -5
- package/dist/es2019/popup.js +16 -4
- package/dist/esm/popper-wrapper.js +16 -6
- package/dist/esm/popup.js +17 -4
- package/dist/types/compositional/popup.d.ts +1 -1
- package/dist/types/entry-points/experimental/compositional.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/popper-wrapper.d.ts +1 -1
- package/dist/types/reposition-on-update.d.ts +1 -1
- package/dist/types/types.d.ts +24 -1
- package/dist/types-ts4.5/compositional/popup.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/experimental/compositional.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/popper-wrapper.d.ts +1 -1
- package/dist/types-ts4.5/reposition-on-update.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +24 -1
- package/package.json +117 -118
- package/report.api.md +41 -40
package/__perf__/closed.tsx
CHANGED
|
@@ -7,39 +7,39 @@ import Popup from '../src';
|
|
|
7
7
|
import { interactionTasks } from './utils/interaction-tasks';
|
|
8
8
|
|
|
9
9
|
function PopupStoryButton() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
10
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
11
|
+
return (
|
|
12
|
+
<Popup
|
|
13
|
+
isOpen={isOpen}
|
|
14
|
+
onClose={() => setIsOpen(false)}
|
|
15
|
+
content={() => (
|
|
16
|
+
<div data-testid="popup">
|
|
17
|
+
<Button>Test</Button>
|
|
18
|
+
</div>
|
|
19
|
+
)}
|
|
20
|
+
trigger={(triggerProps) => (
|
|
21
|
+
<Button
|
|
22
|
+
testId="popup-trigger"
|
|
23
|
+
{...triggerProps}
|
|
24
|
+
onClick={() => {
|
|
25
|
+
setIsOpen(!isOpen);
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
Click to toggle
|
|
29
|
+
</Button>
|
|
30
|
+
)}
|
|
31
|
+
placement="bottom"
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
PopupStoryButton.story = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
name: 'Popup @atlaskit/button',
|
|
38
|
+
parameters: {
|
|
39
|
+
performance: {
|
|
40
|
+
interactions: interactionTasks,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export default PopupStoryButton;
|
package/__perf__/default.tsx
CHANGED
|
@@ -9,26 +9,26 @@ import MediaServicesAddCommentIcon from '@atlaskit/icon/glyph/media-services/add
|
|
|
9
9
|
import Popup from '../src';
|
|
10
10
|
|
|
11
11
|
const popupStyles = css({
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
width: 175,
|
|
13
|
+
height: 250,
|
|
14
14
|
});
|
|
15
15
|
export default () => {
|
|
16
|
-
|
|
16
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
return (
|
|
19
|
+
<Popup
|
|
20
|
+
isOpen={isOpen}
|
|
21
|
+
onClose={() => setIsOpen(false)}
|
|
22
|
+
placement="bottom-start"
|
|
23
|
+
content={() => <div css={popupStyles} />}
|
|
24
|
+
trigger={(triggerProps) => (
|
|
25
|
+
<Button
|
|
26
|
+
{...triggerProps}
|
|
27
|
+
isSelected={isOpen}
|
|
28
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
29
|
+
iconBefore={<MediaServicesAddCommentIcon label="Add" />}
|
|
30
|
+
/>
|
|
31
|
+
)}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
34
|
};
|
package/__perf__/open.tsx
CHANGED
|
@@ -5,32 +5,28 @@ import Button from '@atlaskit/button/new';
|
|
|
5
5
|
import Popup from '../src';
|
|
6
6
|
|
|
7
7
|
function PopupStoryButtonOpen() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)}
|
|
27
|
-
placement="bottom"
|
|
28
|
-
/>
|
|
29
|
-
);
|
|
8
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
9
|
+
return (
|
|
10
|
+
<Popup
|
|
11
|
+
isOpen={true}
|
|
12
|
+
onClose={() => setIsOpen(isOpen)}
|
|
13
|
+
content={() => (
|
|
14
|
+
<div data-testid="popup">
|
|
15
|
+
<Button>Test</Button>
|
|
16
|
+
</div>
|
|
17
|
+
)}
|
|
18
|
+
trigger={(triggerProps) => (
|
|
19
|
+
<Button testId="popup-trigger" {...triggerProps} onClick={() => setIsOpen(!isOpen)}>
|
|
20
|
+
Click to toggle
|
|
21
|
+
</Button>
|
|
22
|
+
)}
|
|
23
|
+
placement="bottom"
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
PopupStoryButtonOpen.story = {
|
|
33
|
-
|
|
29
|
+
name: 'Open Popup @atlaskit/button',
|
|
34
30
|
};
|
|
35
31
|
|
|
36
32
|
export default PopupStoryButtonOpen;
|
package/__perf__/popup.tsx
CHANGED
|
@@ -5,35 +5,35 @@ import Popup from '../src';
|
|
|
5
5
|
import { interactionTasks } from './utils/interaction-tasks';
|
|
6
6
|
|
|
7
7
|
function PopupStory() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
9
|
+
return (
|
|
10
|
+
<Popup
|
|
11
|
+
isOpen={isOpen}
|
|
12
|
+
onClose={() => setIsOpen(false)}
|
|
13
|
+
content={() => <div data-testid="popup"> Test</div>}
|
|
14
|
+
trigger={(triggerProps) => (
|
|
15
|
+
//@ts-ignore https://product-fabric.atlassian.net/browse/DST-1866
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
data-testid="popup-trigger"
|
|
19
|
+
{...triggerProps}
|
|
20
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
21
|
+
>
|
|
22
|
+
Click to toggle
|
|
23
|
+
</button>
|
|
24
|
+
)}
|
|
25
|
+
placement="bottom"
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
PopupStory.story = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
name: 'Popup',
|
|
32
|
+
parameters: {
|
|
33
|
+
performance: {
|
|
34
|
+
interactions: interactionTasks,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export default PopupStory;
|
|
@@ -1,57 +1,44 @@
|
|
|
1
1
|
import { findByTestId, fireEvent } from '@testing-library/dom';
|
|
2
|
-
import {
|
|
3
|
-
type InteractionTaskArgs,
|
|
4
|
-
type PublicInteractionTask,
|
|
5
|
-
} from 'storybook-addon-performance';
|
|
2
|
+
import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
|
|
6
3
|
|
|
7
4
|
export const interactionTasks: PublicInteractionTask[] = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'[data-testid="popup-trigger"]',
|
|
17
|
-
);
|
|
18
|
-
if (popup == null) {
|
|
19
|
-
throw new Error('Could not find popup element');
|
|
20
|
-
}
|
|
5
|
+
{
|
|
6
|
+
name: 'Click the trigger',
|
|
7
|
+
description: 'Recording how long a click event take to be processed',
|
|
8
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
9
|
+
const popup: HTMLElement | null = container.querySelector('[data-testid="popup-trigger"]');
|
|
10
|
+
if (popup == null) {
|
|
11
|
+
throw new Error('Could not find popup element');
|
|
12
|
+
}
|
|
21
13
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
const existingPopup = parent.querySelector('[data-testid="popup"]');
|
|
46
|
-
if (existingPopup != null) {
|
|
47
|
-
throw new Error('Unexpected popup found');
|
|
48
|
-
}
|
|
14
|
+
await controls.time(async () => {
|
|
15
|
+
// fireEvent.mouseDown(popup);
|
|
16
|
+
fireEvent.click(popup);
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'Open Popup',
|
|
22
|
+
description: 'Recording how long the popup takes to appear',
|
|
23
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
24
|
+
const popup: HTMLElement | null = container.querySelector('[data-testid="popup-trigger"]');
|
|
25
|
+
if (popup == null) {
|
|
26
|
+
throw new Error('Could not find popup element');
|
|
27
|
+
}
|
|
28
|
+
const parent: HTMLElement | null = container.parentElement;
|
|
29
|
+
if (parent == null) {
|
|
30
|
+
throw new Error('Could not find parent element');
|
|
31
|
+
}
|
|
32
|
+
const existingPopup = parent.querySelector('[data-testid="popup"]');
|
|
33
|
+
if (existingPopup != null) {
|
|
34
|
+
throw new Error('Unexpected popup found');
|
|
35
|
+
}
|
|
49
36
|
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
await controls.time(async () => {
|
|
38
|
+
fireEvent.click(popup);
|
|
52
39
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
await findByTestId(parent, 'popup');
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
},
|
|
57
44
|
];
|