@atlaskit/button 17.17.2 → 17.17.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 +10 -1
- package/__perf__/button.tsx +6 -6
- package/__perf__/custom.tsx +6 -6
- package/__perf__/customised.tsx +1 -3
- package/__perf__/utils/example-runner.tsx +32 -36
- package/__perf__/utils/interaction-tasks.tsx +65 -86
- package/codemods/15.0.0-lite-mode.tsx +32 -36
- package/codemods/15.1.1-data-testid.tsx +136 -142
- package/codemods/__tests__/15.0.0-lite-mode/optimistic.tsx +121 -121
- package/codemods/__tests__/15.0.0-lite-mode/safe.tsx +54 -54
- package/codemods/__tests__/15.0.0-lite-mode/shared.tsx +96 -97
- package/codemods/__tests__/15.1.1-data-testid/rename-data-testid.tsx +32 -32
- package/codemods/__tests__/_framework.tsx +32 -32
- package/codemods/helpers/15.0.0-runner.tsx +135 -137
- package/codemods/helpers/helpers-generic.tsx +524 -556
- package/codemods/optimistic-15.0.0-lite-mode.tsx +208 -231
- package/dist/cjs/old-button/shared/button-base.js +1 -1
- package/dist/es2019/new-button/variants/default/link.js +2 -2
- package/dist/es2019/new-button/variants/icon/link.js +3 -3
- package/dist/es2019/old-button/shared/button-base.js +1 -1
- package/dist/esm/new-button/variants/default/link.js +2 -2
- package/dist/esm/new-button/variants/icon/link.js +3 -3
- package/dist/esm/old-button/shared/button-base.js +1 -1
- package/dist/types/entry-points/loading-button.d.ts +1 -1
- package/dist/types/entry-points/new.d.ts +3 -3
- package/dist/types/entry-points/types.d.ts +2 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/new.d.ts +3 -3
- package/dist/types-ts4.5/entry-points/loading-button.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/new.d.ts +3 -3
- package/dist/types-ts4.5/entry-points/types.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +3 -3
- package/dist/types-ts4.5/new.d.ts +3 -3
- package/extract-react-types/custom-theme-button-props.tsx +2 -4
- package/extract-react-types/legacy-button/custom-theme-button-props.tsx +2 -4
- package/extract-react-types/legacy-button/loading-button-props.tsx +1 -1
- package/extract-react-types/legacy-button/shared-props.tsx +1 -1
- package/extract-react-types/loading-button-props.tsx +1 -1
- package/extract-react-types/new-button/containers/split-button/split-button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/default/button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/default/common-default-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/default/link-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/icon-button/common-icon-button-props.tsx +4 -4
- package/extract-react-types/new-button/variants/icon-button/icon-button-props.tsx +1 -1
- package/extract-react-types/new-button/variants/icon-button/link-icon-button-props.tsx +2 -4
- package/extract-react-types/shared-props.tsx +1 -1
- package/package.json +2 -2
- package/report.api.md +78 -96
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/button
|
|
2
2
|
|
|
3
|
+
## 17.17.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#110867](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110867)
|
|
8
|
+
[`dc7e72da70ef7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dc7e72da70ef7) -
|
|
9
|
+
Migrating instances of `UNSAFE_ANCHOR` primitive imports to the new safe import `Anchor`, in
|
|
10
|
+
preparation of Anchor open beta and removal of the unsafe export from `@atlaskit/primitives`
|
|
11
|
+
|
|
3
12
|
## 17.17.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -38,7 +47,7 @@
|
|
|
38
47
|
|
|
39
48
|
- [#99861](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99861)
|
|
40
49
|
[`452b917ff365`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/452b917ff365) -
|
|
41
|
-
Add support for React 18.
|
|
50
|
+
Add support for React 18 in non-strict mode.
|
|
42
51
|
|
|
43
52
|
## 17.14.3
|
|
44
53
|
|
package/__perf__/button.tsx
CHANGED
|
@@ -8,12 +8,12 @@ import { interactionTasks } from './utils/interaction-tasks';
|
|
|
8
8
|
const button = () => <Example Component={Button} />;
|
|
9
9
|
|
|
10
10
|
button.story = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
name: 'Button',
|
|
12
|
+
parameters: {
|
|
13
|
+
performance: {
|
|
14
|
+
interactions: interactionTasks,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export default button;
|
package/__perf__/custom.tsx
CHANGED
|
@@ -8,12 +8,12 @@ import { interactionTasks } from './utils/interaction-tasks';
|
|
|
8
8
|
const customThemeButton = () => <Example Component={CustomThemeButton} />;
|
|
9
9
|
|
|
10
10
|
customThemeButton.story = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
name: 'CustomThemeButton',
|
|
12
|
+
parameters: {
|
|
13
|
+
performance: {
|
|
14
|
+
interactions: interactionTasks,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export default customThemeButton;
|
package/__perf__/customised.tsx
CHANGED
|
@@ -5,7 +5,5 @@ import AddIcon from '@atlaskit/icon/glyph/editor/add';
|
|
|
5
5
|
import { CustomThemeButton } from '../src';
|
|
6
6
|
|
|
7
7
|
export default () => (
|
|
8
|
-
|
|
9
|
-
Button
|
|
10
|
-
</CustomThemeButton>
|
|
8
|
+
<CustomThemeButton iconBefore={<AddIcon label="" />}>Button</CustomThemeButton>
|
|
11
9
|
);
|
|
@@ -4,44 +4,40 @@ import { bindAll } from 'bind-event-listener';
|
|
|
4
4
|
|
|
5
5
|
import type { ButtonProps } from '../../src';
|
|
6
6
|
|
|
7
|
-
export default function Example({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}) {
|
|
12
|
-
const [isSelected, setIsSelected] = useState<boolean>(false);
|
|
13
|
-
const [isDisabled, setIsDisabled] = useState<boolean>(false);
|
|
14
|
-
const ref = useRef<HTMLElement>(null);
|
|
7
|
+
export default function Example({ Component }: { Component: ButtonProps['component'] }) {
|
|
8
|
+
const [isSelected, setIsSelected] = useState<boolean>(false);
|
|
9
|
+
const [isDisabled, setIsDisabled] = useState<boolean>(false);
|
|
10
|
+
const ref = useRef<HTMLElement>(null);
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
function toggleSelect() {
|
|
14
|
+
setIsSelected((value) => !value);
|
|
15
|
+
}
|
|
16
|
+
function toggleDisabled() {
|
|
17
|
+
setIsDisabled((value) => !value);
|
|
18
|
+
}
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const el: HTMLElement | null = ref.current;
|
|
21
|
+
if (!el) {
|
|
22
|
+
throw new Error('Could not find button ref');
|
|
23
|
+
}
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
return bindAll(el, [
|
|
26
|
+
{ type: 'toggle-select', listener: toggleSelect },
|
|
27
|
+
{ type: 'toggle-disabled', listener: toggleDisabled },
|
|
28
|
+
]);
|
|
29
|
+
}, []);
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
return (
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
<Component
|
|
34
|
+
ref={ref}
|
|
35
|
+
testId="my-button"
|
|
36
|
+
isSelected={isSelected}
|
|
37
|
+
isDisabled={isDisabled}
|
|
38
|
+
data-is-selected={isSelected}
|
|
39
|
+
>
|
|
40
|
+
Hello world
|
|
41
|
+
</Component>
|
|
42
|
+
);
|
|
47
43
|
}
|
|
@@ -1,98 +1,77 @@
|
|
|
1
1
|
import { fireEvent } from '@testing-library/react';
|
|
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
|
-
if (button == null) {
|
|
17
|
-
throw new Error('Could not find button element');
|
|
18
|
-
}
|
|
5
|
+
{
|
|
6
|
+
name: 'Click a button',
|
|
7
|
+
description: 'Recording how long a mousedown + click event take to be processed',
|
|
8
|
+
run: async ({ container }: InteractionTaskArgs): Promise<void> => {
|
|
9
|
+
const button: HTMLElement | null = container.querySelector('[data-testid="my-button"]');
|
|
10
|
+
if (button == null) {
|
|
11
|
+
throw new Error('Could not find button element');
|
|
12
|
+
}
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'[data-testid="my-button"]',
|
|
33
|
-
);
|
|
34
|
-
if (button == null) {
|
|
35
|
-
throw new Error('Could not find button element');
|
|
36
|
-
}
|
|
14
|
+
fireEvent.mouseDown(button);
|
|
15
|
+
fireEvent.click(button);
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Focus on button',
|
|
20
|
+
description: 'Focus on a button and wait for layout and paint to finish',
|
|
21
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
22
|
+
const button: HTMLElement | null = container.querySelector('[data-testid="my-button"]');
|
|
23
|
+
if (button == null) {
|
|
24
|
+
throw new Error('Could not find button element');
|
|
25
|
+
}
|
|
37
26
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
'[data-testid="my-button"]',
|
|
53
|
-
);
|
|
54
|
-
if (button == null) {
|
|
55
|
-
throw new Error('Could not find button element');
|
|
56
|
-
}
|
|
27
|
+
await controls.time(async () => {
|
|
28
|
+
fireEvent.focus(button);
|
|
29
|
+
fireEvent.blur(button);
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Select button',
|
|
35
|
+
description: 'Trigger the selection of a button',
|
|
36
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
37
|
+
const button: HTMLElement | null = container.querySelector('[data-testid="my-button"]');
|
|
38
|
+
if (button == null) {
|
|
39
|
+
throw new Error('Could not find button element');
|
|
40
|
+
}
|
|
57
41
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
if (button.getAttribute('data-is-selected') !== 'false') {
|
|
43
|
+
throw new Error('Should not start selected');
|
|
44
|
+
}
|
|
61
45
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
await controls.time(async () => {
|
|
47
|
+
fireEvent(button, new Event('toggle-select'));
|
|
48
|
+
});
|
|
65
49
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'[data-testid="my-button"]',
|
|
80
|
-
);
|
|
81
|
-
if (button == null) {
|
|
82
|
-
throw new Error('Could not find button element');
|
|
83
|
-
}
|
|
50
|
+
if (button.getAttribute('data-is-selected') !== 'true') {
|
|
51
|
+
throw new Error('Should now be selected');
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Disable button',
|
|
57
|
+
description: 'Trigger the disabling of a button',
|
|
58
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
59
|
+
const button: HTMLElement | null = container.querySelector('[data-testid="my-button"]');
|
|
60
|
+
if (button == null) {
|
|
61
|
+
throw new Error('Could not find button element');
|
|
62
|
+
}
|
|
84
63
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
if (button.hasAttribute('disabled')) {
|
|
65
|
+
throw new Error('Should not start disabled');
|
|
66
|
+
}
|
|
88
67
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
68
|
+
await controls.time(async () => {
|
|
69
|
+
fireEvent(button, new Event('toggle-disabled'));
|
|
70
|
+
});
|
|
92
71
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
if (!button.hasAttribute('disabled')) {
|
|
73
|
+
throw new Error('Should now be disabled');
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
98
77
|
];
|
|
@@ -3,46 +3,42 @@ import { type Collection } from 'jscodeshift/src/Collection';
|
|
|
3
3
|
|
|
4
4
|
import { changeType, transformButton } from './helpers/15.0.0-runner';
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
getDefaultSpecifierName,
|
|
7
|
+
type Nullable,
|
|
8
|
+
shiftDefaultImport,
|
|
9
9
|
} from './helpers/helpers-generic';
|
|
10
10
|
|
|
11
|
-
export default function transformer(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
oldName: 'ButtonProps',
|
|
24
|
-
newName: 'CustomThemeButtonProps',
|
|
25
|
-
fallbackNameAlias: 'DSCustomThemeButtonProps',
|
|
26
|
-
});
|
|
11
|
+
export default function transformer(file: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
12
|
+
return transformButton({
|
|
13
|
+
file,
|
|
14
|
+
j,
|
|
15
|
+
custom: (base: Collection<any>) => {
|
|
16
|
+
changeType({
|
|
17
|
+
j,
|
|
18
|
+
base,
|
|
19
|
+
oldName: 'ButtonProps',
|
|
20
|
+
newName: 'CustomThemeButtonProps',
|
|
21
|
+
fallbackNameAlias: 'DSCustomThemeButtonProps',
|
|
22
|
+
});
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
const defaultName: Nullable<string> = getDefaultSpecifierName({
|
|
25
|
+
j,
|
|
26
|
+
base,
|
|
27
|
+
packageName: '@atlaskit/button',
|
|
28
|
+
});
|
|
29
|
+
if (defaultName == null) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
shiftDefaultImport({
|
|
34
|
+
j,
|
|
35
|
+
base,
|
|
36
|
+
defaultName,
|
|
37
|
+
oldPackagePath: '@atlaskit/button',
|
|
38
|
+
newPackagePath: '@atlaskit/button/custom-theme-button',
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
// Note: not exporting a 'parser' because doing so
|