@atlaskit/button 17.17.2 → 17.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 +56 -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/containers/button-group.js +3 -1
- package/dist/cjs/new-button/containers/split-button/split-button.js +6 -2
- package/dist/cjs/new-button/variants/default/button.js +8 -1
- package/dist/cjs/new-button/variants/default/link.js +8 -1
- package/dist/cjs/new-button/variants/default/use-default-button.js +7 -1
- package/dist/cjs/new-button/variants/icon/button.js +6 -1
- package/dist/cjs/new-button/variants/icon/link.js +6 -1
- package/dist/cjs/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/cjs/new-button/variants/shared/constants.js +7 -0
- package/dist/cjs/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/cjs/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/cjs/old-button/button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/custom-theme-button.js +1 -1
- package/dist/cjs/old-button/custom-theme-button/theme.js +1 -1
- package/dist/cjs/old-button/shared/button-base.js +9 -3
- package/dist/cjs/old-button/shared/css.js +4 -3
- package/dist/es2019/containers/button-group.js +3 -1
- package/dist/es2019/new-button/containers/split-button/split-button.js +5 -2
- package/dist/es2019/new-button/variants/default/button.js +7 -0
- package/dist/es2019/new-button/variants/default/link.js +9 -2
- package/dist/es2019/new-button/variants/default/use-default-button.js +7 -1
- package/dist/es2019/new-button/variants/icon/button.js +5 -0
- package/dist/es2019/new-button/variants/icon/link.js +8 -3
- package/dist/es2019/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/es2019/new-button/variants/shared/constants.js +1 -0
- package/dist/es2019/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/es2019/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/es2019/old-button/button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/es2019/old-button/custom-theme-button/theme.js +2 -0
- package/dist/es2019/old-button/shared/button-base.js +10 -3
- package/dist/es2019/old-button/shared/css.js +4 -2
- package/dist/esm/containers/button-group.js +3 -1
- package/dist/esm/new-button/containers/split-button/split-button.js +5 -2
- package/dist/esm/new-button/variants/default/button.js +8 -1
- package/dist/esm/new-button/variants/default/link.js +10 -3
- package/dist/esm/new-button/variants/default/use-default-button.js +7 -1
- package/dist/esm/new-button/variants/icon/button.js +6 -1
- package/dist/esm/new-button/variants/icon/link.js +9 -4
- package/dist/esm/new-button/variants/icon/use-icon-button.js +7 -1
- package/dist/esm/new-button/variants/shared/constants.js +1 -0
- package/dist/esm/new-button/variants/shared/loading-overlay.js +4 -3
- package/dist/esm/new-button/variants/shared/use-button-base.js +54 -2
- package/dist/esm/old-button/button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/custom-theme-button.js +3 -0
- package/dist/esm/old-button/custom-theme-button/theme.js +2 -0
- package/dist/esm/old-button/shared/button-base.js +10 -3
- package/dist/esm/old-button/shared/css.js +4 -2
- 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-button/variants/default/link.d.ts +1 -1
- package/dist/types/new-button/variants/default/types.d.ts +1 -1
- package/dist/types/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types/new-button/variants/shared/use-button-base.d.ts +5 -1
- 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-button/variants/default/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/types.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/default/use-default-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/icon/link.d.ts +1 -1
- package/dist/types-ts4.5/new-button/variants/icon/use-icon-button.d.ts +4 -3
- package/dist/types-ts4.5/new-button/variants/shared/constants.d.ts +1 -0
- package/dist/types-ts4.5/new-button/variants/shared/loading-overlay.d.ts +2 -1
- package/dist/types-ts4.5/new-button/variants/shared/use-button-base.d.ts +5 -1
- 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 +202 -201
- package/report.api.md +78 -96
|
@@ -1,81 +1,72 @@
|
|
|
1
1
|
import { type NodePath } from 'ast-types/lib/node-path';
|
|
2
|
-
import type {
|
|
3
|
-
API,
|
|
4
|
-
default as core,
|
|
5
|
-
FileInfo,
|
|
6
|
-
JSXElement,
|
|
7
|
-
Node,
|
|
8
|
-
Options,
|
|
9
|
-
} from 'jscodeshift';
|
|
2
|
+
import type { API, default as core, FileInfo, JSXElement, Node, Options } from 'jscodeshift';
|
|
10
3
|
import { type Collection } from 'jscodeshift/src/Collection';
|
|
11
4
|
|
|
12
5
|
import { convertButtonType, transformButton } from './helpers/15.0.0-runner';
|
|
13
6
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
addCommentBefore,
|
|
8
|
+
addCommentToStartOfFile,
|
|
9
|
+
addToImport,
|
|
10
|
+
changeImportFor,
|
|
11
|
+
getDefaultSpecifierName,
|
|
12
|
+
getSafeImportName,
|
|
13
|
+
isOnlyUsingNameForJSX,
|
|
14
|
+
isUsingProp,
|
|
15
|
+
isUsingSupportedSpread,
|
|
16
|
+
type Nullable,
|
|
17
|
+
tryCreateImport,
|
|
25
18
|
} from './helpers/helpers-generic';
|
|
26
19
|
|
|
27
20
|
function changeUsage({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
j,
|
|
22
|
+
base,
|
|
23
|
+
packageName,
|
|
31
24
|
}: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
j: core.JSCodeshift;
|
|
26
|
+
base: Collection<Node>;
|
|
27
|
+
packageName: string;
|
|
35
28
|
}): void {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
// 1. Are we using the default export?
|
|
30
|
+
// If not: we can exit early!
|
|
31
|
+
const defaultName: Nullable<string> = getDefaultSpecifierName({
|
|
32
|
+
j,
|
|
33
|
+
base,
|
|
34
|
+
packageName,
|
|
35
|
+
});
|
|
36
|
+
if (defaultName == null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
// Only supporting cases where default identifier is only used in JSX
|
|
41
|
+
const isSupported: boolean = isOnlyUsingNameForJSX({
|
|
42
|
+
j,
|
|
43
|
+
base,
|
|
44
|
+
name: defaultName,
|
|
45
|
+
});
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
47
|
+
if (!isSupported) {
|
|
48
|
+
tryCreateImport({
|
|
49
|
+
j,
|
|
50
|
+
base,
|
|
51
|
+
relativeToPackage: '@atlaskit/button',
|
|
52
|
+
packageName: '@atlaskit/button/standard-button',
|
|
53
|
+
});
|
|
54
|
+
addToImport({
|
|
55
|
+
j,
|
|
56
|
+
base,
|
|
57
|
+
// we can safely use the default name, because it was being used before
|
|
58
|
+
importSpecifier: j.importDefaultSpecifier(j.identifier(defaultName)),
|
|
59
|
+
packageName: '@atlaskit/button/standard-button',
|
|
60
|
+
});
|
|
68
61
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
),
|
|
78
|
-
message: `
|
|
62
|
+
addCommentBefore({
|
|
63
|
+
j,
|
|
64
|
+
target: base
|
|
65
|
+
.find(j.ImportDeclaration)
|
|
66
|
+
.filter(
|
|
67
|
+
(declaration) => declaration.value.source.value === '@atlaskit/button/standard-button',
|
|
68
|
+
),
|
|
69
|
+
message: `
|
|
79
70
|
This file does not exclusively use Button in JSX.
|
|
80
71
|
The codemod is unable to know which button variant, so it is using
|
|
81
72
|
the standard button: "@atlaskit/button/standard-button".
|
|
@@ -83,203 +74,189 @@ function changeUsage({
|
|
|
83
74
|
Please validate this decision.
|
|
84
75
|
You might need to change the usage of Button to either LoadingButton or CustomThemeButton
|
|
85
76
|
`,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
89
80
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
// Find usages of the Button component
|
|
82
|
+
// There are three possible import statements:
|
|
83
|
+
// 1. import Button from '@atlaskit/button/standard';
|
|
84
|
+
// 2. import LoadingButton from '@atlaskit/button/loading-button';
|
|
85
|
+
// 3. import CustomThemeButton from '@atlaskit/button/custom-theme-button';
|
|
95
86
|
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
// What to do if any of the names clash?
|
|
88
|
+
// - In the case of clash: prefix with 'DS' (eg import DSLoadingButton from '@atlaskit/button/loading-button';)
|
|
98
89
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
// What to do if old Button was aliased? eg "AkButton"
|
|
91
|
+
// - We cannot use that existing alias as we might have three different Button imports in the file
|
|
92
|
+
// - We automatically will be be swapping to the standard names with 'DS' prefix for all imports
|
|
102
93
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
94
|
+
type Groups = {
|
|
95
|
+
standard: NodePath<JSXElement, JSXElement>[];
|
|
96
|
+
loading: NodePath<JSXElement, JSXElement>[];
|
|
97
|
+
customTheme: NodePath<JSXElement, JSXElement>[];
|
|
98
|
+
};
|
|
108
99
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
const groups: Groups = {
|
|
101
|
+
standard: [],
|
|
102
|
+
loading: [],
|
|
103
|
+
customTheme: [],
|
|
104
|
+
};
|
|
114
105
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
base.findJSXElements(defaultName).forEach((path) => {
|
|
107
|
+
const hasThemeProp: boolean = isUsingProp({
|
|
108
|
+
j,
|
|
109
|
+
base,
|
|
110
|
+
element: path,
|
|
111
|
+
propName: 'theme',
|
|
112
|
+
});
|
|
122
113
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
if (hasThemeProp) {
|
|
115
|
+
groups.customTheme.push(path);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
127
118
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
119
|
+
if (!isUsingSupportedSpread({ j, base, element: path })) {
|
|
120
|
+
addCommentToStartOfFile({
|
|
121
|
+
j,
|
|
122
|
+
base,
|
|
123
|
+
message: `
|
|
133
124
|
Detected spreading props (<Button {...props} />) that was too complex for our codemod to understand
|
|
134
125
|
Our codemod will only look at inline objects, or objects defined in the same file (ObjectExpression's)
|
|
135
126
|
We have opted for our safest upgrade component in this file: '<CustomThemeButton />'
|
|
136
127
|
`,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
});
|
|
129
|
+
groups.customTheme.push(path);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
141
132
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
.filter((specifier) => specifier.value.imported.name === 'Theme')
|
|
152
|
-
.length > 0;
|
|
133
|
+
const isUsingThemeInFile: boolean =
|
|
134
|
+
base
|
|
135
|
+
.find(j.ImportDeclaration)
|
|
136
|
+
.filter(
|
|
137
|
+
(declaration) =>
|
|
138
|
+
declaration.value.source.value === '@atlaskit/button/custom-theme-button',
|
|
139
|
+
)
|
|
140
|
+
.find(j.ImportSpecifier)
|
|
141
|
+
.filter((specifier) => specifier.value.imported.name === 'Theme').length > 0;
|
|
153
142
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
143
|
+
if (isUsingThemeInFile) {
|
|
144
|
+
addCommentToStartOfFile({
|
|
145
|
+
j,
|
|
146
|
+
base,
|
|
147
|
+
message: `
|
|
159
148
|
Using "import { Theme } from '@atlaskit/button/custom-theme-button" in a file
|
|
160
149
|
will cause all buttons in that file to be safely converted to a <CustomThemeButton/>
|
|
161
150
|
`,
|
|
162
|
-
|
|
151
|
+
});
|
|
163
152
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
153
|
+
groups.customTheme.push(path);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
167
156
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
157
|
+
const hasIsLoadingProp: boolean = isUsingProp({
|
|
158
|
+
j,
|
|
159
|
+
base,
|
|
160
|
+
element: path,
|
|
161
|
+
propName: 'isLoading',
|
|
162
|
+
});
|
|
174
163
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
164
|
+
if (hasIsLoadingProp) {
|
|
165
|
+
groups.loading.push(path);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
179
168
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
169
|
+
groups.standard.push(path);
|
|
170
|
+
return;
|
|
171
|
+
});
|
|
183
172
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
173
|
+
convertButtonType({
|
|
174
|
+
j,
|
|
175
|
+
base,
|
|
176
|
+
elements: groups.standard,
|
|
177
|
+
name: getSafeImportName({
|
|
178
|
+
j,
|
|
179
|
+
base,
|
|
180
|
+
currentDefaultSpecifierName: defaultName,
|
|
181
|
+
desiredName: 'Button',
|
|
182
|
+
fallbackName: 'DSButton',
|
|
183
|
+
}),
|
|
184
|
+
newPackageName: '@atlaskit/button/standard-button',
|
|
185
|
+
});
|
|
197
186
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
187
|
+
convertButtonType({
|
|
188
|
+
j,
|
|
189
|
+
base,
|
|
190
|
+
elements: groups.loading,
|
|
191
|
+
newPackageName: '@atlaskit/button/loading-button',
|
|
192
|
+
name: getSafeImportName({
|
|
193
|
+
j,
|
|
194
|
+
base,
|
|
195
|
+
desiredName: 'LoadingButton',
|
|
196
|
+
fallbackName: 'DSLoadingButton',
|
|
197
|
+
currentDefaultSpecifierName: defaultName,
|
|
198
|
+
}),
|
|
199
|
+
});
|
|
200
|
+
convertButtonType({
|
|
201
|
+
j,
|
|
202
|
+
base,
|
|
203
|
+
elements: groups.customTheme,
|
|
204
|
+
newPackageName: '@atlaskit/button/custom-theme-button',
|
|
205
|
+
name: getSafeImportName({
|
|
206
|
+
j,
|
|
207
|
+
base,
|
|
208
|
+
currentDefaultSpecifierName: defaultName,
|
|
209
|
+
desiredName: 'CustomThemeButton',
|
|
210
|
+
fallbackName: 'DSCustomThemeButton',
|
|
211
|
+
}),
|
|
212
|
+
});
|
|
224
213
|
}
|
|
225
214
|
|
|
226
|
-
export default function transformer(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
oldPackagePath: '@atlaskit/button',
|
|
244
|
-
newPackagePath: '@atlaskit/button/types',
|
|
245
|
-
});
|
|
215
|
+
export default function transformer(file: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
216
|
+
return transformButton({
|
|
217
|
+
j,
|
|
218
|
+
file,
|
|
219
|
+
custom: (base: Collection<any>) => {
|
|
220
|
+
changeImportFor({
|
|
221
|
+
j,
|
|
222
|
+
base,
|
|
223
|
+
option: {
|
|
224
|
+
type: 'keep-name',
|
|
225
|
+
name: 'ButtonProps',
|
|
226
|
+
behaviour: 'keep-as-named-import',
|
|
227
|
+
},
|
|
228
|
+
oldPackagePath: '@atlaskit/button',
|
|
229
|
+
newPackagePath: '@atlaskit/button/types',
|
|
230
|
+
});
|
|
246
231
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
)
|
|
254
|
-
.find(j.ImportSpecifier)
|
|
255
|
-
.filter(
|
|
256
|
-
(specifier) => specifier.value.imported.name === 'ButtonProps',
|
|
257
|
-
).length > 0;
|
|
232
|
+
const isUsingButtonPropsType: boolean =
|
|
233
|
+
base
|
|
234
|
+
.find(j.ImportDeclaration)
|
|
235
|
+
.filter((declaration) => declaration.value.source.value === '@atlaskit/button/types')
|
|
236
|
+
.find(j.ImportSpecifier)
|
|
237
|
+
.filter((specifier) => specifier.value.imported.name === 'ButtonProps').length > 0;
|
|
258
238
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
j,
|
|
268
|
-
target,
|
|
269
|
-
message: `
|
|
239
|
+
if (isUsingButtonPropsType) {
|
|
240
|
+
const target = base
|
|
241
|
+
.find(j.ImportDeclaration)
|
|
242
|
+
.filter((declaration) => declaration.value.source.value === '@atlaskit/button/types');
|
|
243
|
+
addCommentBefore({
|
|
244
|
+
j,
|
|
245
|
+
target,
|
|
246
|
+
message: `
|
|
270
247
|
Verify ButtonProps is the right prop type
|
|
271
248
|
You might need the LoadingButtonProps, CustomButtonProps types which can be imported from '@atlaskit/button/types'
|
|
272
249
|
`,
|
|
273
|
-
|
|
274
|
-
|
|
250
|
+
});
|
|
251
|
+
}
|
|
275
252
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
253
|
+
changeUsage({
|
|
254
|
+
j,
|
|
255
|
+
base,
|
|
256
|
+
packageName: '@atlaskit/button',
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
});
|
|
283
260
|
}
|
|
284
261
|
|
|
285
262
|
// Note: not exporting a 'parser' because doing so
|
|
@@ -11,10 +11,12 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
11
11
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
|
+
|
|
14
16
|
var buttonGroupStyles = (0, _react2.css)({
|
|
15
17
|
display: 'inline-flex',
|
|
16
18
|
gap: "var(--ds-space-050, 4px)",
|
|
17
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
19
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
18
20
|
'> *': {
|
|
19
21
|
flex: '1 0 auto'
|
|
20
22
|
}
|
|
@@ -10,6 +10,8 @@ var _splitButtonContext = require("./split-button-context");
|
|
|
10
10
|
var _utils = require("./utils");
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
|
|
13
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
|
+
|
|
13
15
|
var fontSize = (0, _constants.fontSize)();
|
|
14
16
|
var heights = {
|
|
15
17
|
default: "".concat(32 / fontSize, "em"),
|
|
@@ -23,9 +25,11 @@ var baseDividerStyles = (0, _react.css)({
|
|
|
23
25
|
zIndex: 2
|
|
24
26
|
});
|
|
25
27
|
var defaultDividerStyles = (0, _react.css)({
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
26
29
|
height: heights.default
|
|
27
30
|
});
|
|
28
31
|
var compactDividerStyles = (0, _react.css)({
|
|
32
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
29
33
|
height: heights.compact
|
|
30
34
|
});
|
|
31
35
|
var dividerDisabledStyles = (0, _react.css)({
|
|
@@ -75,14 +79,14 @@ var splitButtonStyles = (0, _react.css)({
|
|
|
75
79
|
whiteSpace: 'nowrap'
|
|
76
80
|
});
|
|
77
81
|
var primaryButtonStyles = (0, _react.css)({
|
|
78
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
82
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
79
83
|
'button,a': {
|
|
80
84
|
borderEndEndRadius: 0,
|
|
81
85
|
borderStartEndRadius: 0
|
|
82
86
|
}
|
|
83
87
|
});
|
|
84
88
|
var secondaryButtonStyles = (0, _react.css)({
|
|
85
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
89
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
86
90
|
'button,a': {
|
|
87
91
|
borderEndStartRadius: 0,
|
|
88
92
|
borderStartStartRadius: 0
|
|
@@ -10,7 +10,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
|
|
12
12
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
13
|
-
var _excluded = ["analyticsContext", "appearance", "autoFocus", "children", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isLoading", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "overlay", "shouldFitContainer", "spacing", "testId", "type", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
|
|
13
|
+
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isLoading", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "overlay", "shouldFitContainer", "spacing", "testId", "type", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
|
|
14
14
|
/**
|
|
15
15
|
* __Button__
|
|
16
16
|
*
|
|
@@ -23,6 +23,8 @@ var _excluded = ["analyticsContext", "appearance", "autoFocus", "children", "ico
|
|
|
23
23
|
var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwardRef(function Button(_ref, ref) {
|
|
24
24
|
var analyticsContext = _ref.analyticsContext,
|
|
25
25
|
appearance = _ref.appearance,
|
|
26
|
+
ariaLabel = _ref['aria-label'],
|
|
27
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
26
28
|
autoFocus = _ref.autoFocus,
|
|
27
29
|
children = _ref.children,
|
|
28
30
|
iconAfter = _ref.iconAfter,
|
|
@@ -51,6 +53,8 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
51
53
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
52
54
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
53
55
|
var baseProps = (0, _useDefaultButton.default)({
|
|
56
|
+
ariaLabel: ariaLabel,
|
|
57
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
54
58
|
analyticsContext: analyticsContext,
|
|
55
59
|
appearance: appearance,
|
|
56
60
|
autoFocus: autoFocus,
|
|
@@ -76,12 +80,15 @@ var Button = /*#__PURE__*/_react.default.memo( /*#__PURE__*/_react.default.forwa
|
|
|
76
80
|
ref: ref,
|
|
77
81
|
shouldFitContainer: shouldFitContainer,
|
|
78
82
|
spacing: spacing,
|
|
83
|
+
testId: testId,
|
|
79
84
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
80
85
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
81
86
|
});
|
|
82
87
|
return /*#__PURE__*/_react.default.createElement(_pressable.default
|
|
83
88
|
// TODO: Remove spread props
|
|
84
89
|
, (0, _extends2.default)({}, rest, {
|
|
90
|
+
"aria-label": baseProps['aria-label'],
|
|
91
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
85
92
|
ref: baseProps.ref,
|
|
86
93
|
xcss: baseProps.xcss,
|
|
87
94
|
isDisabled: baseProps.isDisabled,
|
|
@@ -11,12 +11,14 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _anchor = _interopRequireDefault(require("@atlaskit/primitives/anchor"));
|
|
13
13
|
var _useDefaultButton = _interopRequireDefault(require("./use-default-button"));
|
|
14
|
-
var _excluded = ["analyticsContext", "appearance", "autoFocus", "children", "href", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "overlay", "shouldFitContainer", "spacing", "testId", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
|
|
14
|
+
var _excluded = ["analyticsContext", "appearance", "aria-label", "aria-labelledby", "autoFocus", "children", "href", "iconAfter", "iconBefore", "interactionName", "isDisabled", "isSelected", "onClick", "onClickCapture", "onKeyDownCapture", "onKeyUpCapture", "onMouseDownCapture", "onMouseUpCapture", "onPointerDownCapture", "onPointerUpCapture", "onTouchEndCapture", "onTouchStartCapture", "overlay", "shouldFitContainer", "spacing", "testId", "UNSAFE_iconAfter_size", "UNSAFE_iconBefore_size"];
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
18
18
|
var analyticsContext = _ref.analyticsContext,
|
|
19
19
|
appearance = _ref.appearance,
|
|
20
|
+
ariaLabel = _ref['aria-label'],
|
|
21
|
+
ariaLabelledBy = _ref['aria-labelledby'],
|
|
20
22
|
autoFocus = _ref.autoFocus,
|
|
21
23
|
children = _ref.children,
|
|
22
24
|
href = _ref.href,
|
|
@@ -43,6 +45,8 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
43
45
|
UNSAFE_iconBefore_size = _ref.UNSAFE_iconBefore_size,
|
|
44
46
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
45
47
|
var baseProps = (0, _useDefaultButton.default)({
|
|
48
|
+
ariaLabel: ariaLabel,
|
|
49
|
+
ariaLabelledBy: ariaLabelledBy,
|
|
46
50
|
analyticsContext: analyticsContext,
|
|
47
51
|
appearance: appearance,
|
|
48
52
|
autoFocus: autoFocus,
|
|
@@ -67,12 +71,15 @@ var LinkButtonBase = function LinkButtonBase(_ref, ref) {
|
|
|
67
71
|
ref: ref,
|
|
68
72
|
shouldFitContainer: shouldFitContainer,
|
|
69
73
|
spacing: spacing,
|
|
74
|
+
testId: testId,
|
|
70
75
|
UNSAFE_iconAfter_size: UNSAFE_iconAfter_size,
|
|
71
76
|
UNSAFE_iconBefore_size: UNSAFE_iconBefore_size
|
|
72
77
|
});
|
|
73
78
|
return /*#__PURE__*/_react.default.createElement(_anchor.default
|
|
74
79
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
75
80
|
, (0, _extends2.default)({}, rest, {
|
|
81
|
+
"aria-label": baseProps['aria-label'],
|
|
82
|
+
"aria-labelledby": baseProps['aria-labelledby'],
|
|
76
83
|
ref: baseProps.ref,
|
|
77
84
|
xcss: baseProps.xcss,
|
|
78
85
|
onClick: baseProps.onClick,
|