@atlaskit/menu 2.4.0 → 2.5.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 +20 -1
- package/__perf__/button.tsx +7 -9
- package/__perf__/custom.tsx +13 -17
- package/__perf__/link.tsx +6 -6
- package/__perf__/utils/example-runner.tsx +36 -41
- package/__perf__/utils/interaction-tasks.tsx +63 -86
- package/codemods/0.7.0-change-css-fn-prop.tsx +128 -156
- package/codemods/2.1.0-invalid-link-item-to-button-item.tsx +121 -145
- package/codemods/__tests__/0.7.0-change-css-fn-prop.tsx +77 -77
- package/codemods/__tests__/next-invalid-link-item-to-button-item.tsx +117 -117
- package/codemods/helpers/generic.tsx +528 -564
- package/dist/cjs/internal/components/menu-item-primitive.js +13 -2
- package/dist/cjs/internal/components/skeleton-shimmer.js +6 -0
- package/dist/cjs/menu-item/button-item.js +4 -0
- package/dist/cjs/menu-item/custom-item.js +8 -2
- package/dist/cjs/menu-item/heading-item.js +12 -2
- package/dist/cjs/menu-item/link-item.js +4 -0
- package/dist/cjs/menu-item/skeleton-heading-item.js +12 -1
- package/dist/cjs/menu-item/skeleton-item.js +25 -1
- package/dist/cjs/menu-section/menu-group.js +4 -0
- package/dist/cjs/menu-section/popup-menu-group.js +4 -0
- package/dist/cjs/menu-section/section.js +19 -4
- package/dist/es2019/internal/components/menu-item-primitive.js +13 -2
- package/dist/es2019/internal/components/skeleton-shimmer.js +5 -0
- package/dist/es2019/menu-item/button-item.js +5 -0
- package/dist/es2019/menu-item/custom-item.js +9 -2
- package/dist/es2019/menu-item/heading-item.js +13 -2
- package/dist/es2019/menu-item/link-item.js +5 -0
- package/dist/es2019/menu-item/skeleton-heading-item.js +11 -1
- package/dist/es2019/menu-item/skeleton-item.js +24 -1
- package/dist/es2019/menu-section/menu-group.js +4 -0
- package/dist/es2019/menu-section/popup-menu-group.js +4 -0
- package/dist/es2019/menu-section/section.js +20 -4
- package/dist/esm/internal/components/menu-item-primitive.js +13 -2
- package/dist/esm/internal/components/skeleton-shimmer.js +5 -0
- package/dist/esm/menu-item/button-item.js +5 -0
- package/dist/esm/menu-item/custom-item.js +9 -2
- package/dist/esm/menu-item/heading-item.js +13 -2
- package/dist/esm/menu-item/link-item.js +5 -0
- package/dist/esm/menu-item/skeleton-heading-item.js +11 -1
- package/dist/esm/menu-item/skeleton-item.js +24 -1
- package/dist/esm/menu-section/menu-group.js +4 -0
- package/dist/esm/menu-section/popup-menu-group.js +4 -0
- package/dist/esm/menu-section/section.js +20 -4
- package/dist/types/internal/components/skeleton-shimmer.d.ts +4 -1
- package/dist/types/menu-item/custom-item.d.ts +3 -0
- package/dist/types/menu-section/menu-group.d.ts +3 -0
- package/dist/types/menu-section/popup-menu-group.d.ts +3 -0
- package/dist/types-ts4.5/internal/components/skeleton-shimmer.d.ts +4 -1
- package/dist/types-ts4.5/menu-item/custom-item.d.ts +3 -0
- package/dist/types-ts4.5/menu-section/menu-group.d.ts +3 -0
- package/dist/types-ts4.5/menu-section/popup-menu-group.d.ts +3 -0
- package/package.json +133 -133
- package/report.api.md +130 -138
|
@@ -5,35 +5,35 @@ import * as transformer from '../2.1.0-invalid-link-item-to-button-item';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('Converts link items with invalid or missing `href` to button items', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* Success cases
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
defineInlineTest(
|
|
14
|
+
{ ...transformer, parser: 'tsx' },
|
|
15
|
+
{},
|
|
16
|
+
`
|
|
17
17
|
import { LinkItem } from '@atlaskit/something';
|
|
18
18
|
|
|
19
19
|
const App = () => {
|
|
20
20
|
return <LinkItem />;
|
|
21
21
|
}
|
|
22
22
|
`,
|
|
23
|
-
|
|
23
|
+
`
|
|
24
24
|
import { LinkItem } from '@atlaskit/something';
|
|
25
25
|
|
|
26
26
|
const App = () => {
|
|
27
27
|
return <LinkItem />;
|
|
28
28
|
}
|
|
29
29
|
`,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
'leaves unrelated code untouched',
|
|
31
|
+
);
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
defineInlineTest(
|
|
34
|
+
{ ...transformer, parser: 'tsx' },
|
|
35
|
+
{},
|
|
36
|
+
`
|
|
37
37
|
import { LinkItem } from '@atlaskit/menu';
|
|
38
38
|
import { variable } from 'somewhere';
|
|
39
39
|
|
|
@@ -41,7 +41,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
41
41
|
return <LinkItem href={variable}>test</LinkItem>;
|
|
42
42
|
}
|
|
43
43
|
`,
|
|
44
|
-
|
|
44
|
+
`
|
|
45
45
|
import { LinkItem } from '@atlaskit/menu';
|
|
46
46
|
import { variable } from 'somewhere';
|
|
47
47
|
|
|
@@ -49,177 +49,177 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
49
49
|
return <LinkItem href={variable}>test</LinkItem>;
|
|
50
50
|
}
|
|
51
51
|
`,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
'should not do anything with `href`s that are variables',
|
|
53
|
+
);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
defineInlineTest(
|
|
56
|
+
{ ...transformer, parser: 'tsx' },
|
|
57
|
+
{},
|
|
58
|
+
`
|
|
59
59
|
import { LinkItem } from '@atlaskit/menu';
|
|
60
60
|
|
|
61
61
|
const App = () => {
|
|
62
62
|
return <LinkItem href="http://valid.com">test</LinkItem>;
|
|
63
63
|
}
|
|
64
64
|
`,
|
|
65
|
-
|
|
65
|
+
`
|
|
66
66
|
import { LinkItem } from '@atlaskit/menu';
|
|
67
67
|
|
|
68
68
|
const App = () => {
|
|
69
69
|
return <LinkItem href="http://valid.com">test</LinkItem>;
|
|
70
70
|
}
|
|
71
71
|
`,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
'should not do anything with a valid `href`',
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* Missing `href`
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
defineInlineTest(
|
|
82
|
+
{ ...transformer, parser: 'tsx' },
|
|
83
|
+
{},
|
|
84
|
+
`
|
|
85
85
|
import { LinkItem } from '@atlaskit/menu';
|
|
86
86
|
|
|
87
87
|
const App = () => {
|
|
88
88
|
return <LinkItem>test</LinkItem>;
|
|
89
89
|
}
|
|
90
90
|
`,
|
|
91
|
-
|
|
91
|
+
`
|
|
92
92
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
93
93
|
|
|
94
94
|
const App = () => {
|
|
95
95
|
return <ButtonItem>test</ButtonItem>;
|
|
96
96
|
}
|
|
97
97
|
`,
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
'Should convert to ButtonItem if no href exists on LinkItem',
|
|
99
|
+
);
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
defineInlineTest(
|
|
102
|
+
{ ...transformer, parser: 'tsx' },
|
|
103
|
+
{},
|
|
104
|
+
`
|
|
105
105
|
import { LinkItem } from '@atlaskit/menu';
|
|
106
106
|
|
|
107
107
|
const App = () => {
|
|
108
108
|
return <LinkItem id="test">test</LinkItem>;
|
|
109
109
|
}
|
|
110
110
|
`,
|
|
111
|
-
|
|
111
|
+
`
|
|
112
112
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
113
113
|
|
|
114
114
|
const App = () => {
|
|
115
115
|
return <ButtonItem id="test">test</ButtonItem>;
|
|
116
116
|
}
|
|
117
117
|
`,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
'Should convert to ButtonItem but keep existing props if no href exists on LinkItem',
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* Invalid `href`
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
defineInlineTest(
|
|
128
|
+
{ ...transformer, parser: 'tsx' },
|
|
129
|
+
{},
|
|
130
|
+
`
|
|
131
131
|
import { LinkItem } from '@atlaskit/menu';
|
|
132
132
|
|
|
133
133
|
const App = () => {
|
|
134
134
|
return <LinkItem href="#">test</LinkItem>;
|
|
135
135
|
}
|
|
136
136
|
`,
|
|
137
|
-
|
|
137
|
+
`
|
|
138
138
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
139
139
|
|
|
140
140
|
const App = () => {
|
|
141
141
|
return <ButtonItem>test</ButtonItem>;
|
|
142
142
|
}
|
|
143
143
|
`,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
'Should convert to ButtonItem if invalid `href`',
|
|
145
|
+
);
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
defineInlineTest(
|
|
148
|
+
{ ...transformer, parser: 'tsx' },
|
|
149
|
+
{},
|
|
150
|
+
`
|
|
151
151
|
import { LinkItem } from '@atlaskit/menu';
|
|
152
152
|
|
|
153
153
|
const App = () => {
|
|
154
154
|
return <LinkItem href="#" id="test">test</LinkItem>;
|
|
155
155
|
}
|
|
156
156
|
`,
|
|
157
|
-
|
|
157
|
+
`
|
|
158
158
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
159
159
|
|
|
160
160
|
const App = () => {
|
|
161
161
|
return <ButtonItem id="test">test</ButtonItem>;
|
|
162
162
|
}
|
|
163
163
|
`,
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
'Should convert to ButtonItem but keep existing props if invalid `href`',
|
|
165
|
+
);
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
defineInlineTest(
|
|
168
|
+
{ ...transformer, parser: 'tsx' },
|
|
169
|
+
{},
|
|
170
|
+
`
|
|
171
171
|
import { LinkItem } from '@atlaskit/menu';
|
|
172
172
|
|
|
173
173
|
const App = () => {
|
|
174
174
|
return <LinkItem href="">test</LinkItem>;
|
|
175
175
|
}
|
|
176
176
|
`,
|
|
177
|
-
|
|
177
|
+
`
|
|
178
178
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
179
179
|
|
|
180
180
|
const App = () => {
|
|
181
181
|
return <ButtonItem>test</ButtonItem>;
|
|
182
182
|
}
|
|
183
183
|
`,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
184
|
+
'Should convert to ButtonItem if invalid `href`',
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
*
|
|
189
|
+
* Expressions
|
|
190
|
+
*
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
defineInlineTest(
|
|
194
|
+
{ ...transformer, parser: 'tsx' },
|
|
195
|
+
{},
|
|
196
|
+
`
|
|
197
197
|
import { LinkItem } from '@atlaskit/menu';
|
|
198
198
|
|
|
199
199
|
const App = () => {
|
|
200
200
|
return <LinkItem href={''}>test</LinkItem>;
|
|
201
201
|
}
|
|
202
202
|
`,
|
|
203
|
-
|
|
203
|
+
`
|
|
204
204
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
205
205
|
|
|
206
206
|
const App = () => {
|
|
207
207
|
return <ButtonItem>test</ButtonItem>;
|
|
208
208
|
}
|
|
209
209
|
`,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
210
|
+
'should handle strings in expression containers',
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
*
|
|
215
|
+
* Edge cases
|
|
216
|
+
*
|
|
217
|
+
*/
|
|
218
|
+
|
|
219
|
+
defineInlineTest(
|
|
220
|
+
{ ...transformer, parser: 'tsx' },
|
|
221
|
+
{},
|
|
222
|
+
`
|
|
223
223
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
224
224
|
|
|
225
225
|
const App = () => {
|
|
@@ -231,7 +231,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
233
|
`,
|
|
234
|
-
|
|
234
|
+
`
|
|
235
235
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
236
236
|
|
|
237
237
|
const App = () => {
|
|
@@ -243,13 +243,13 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
243
243
|
);
|
|
244
244
|
}
|
|
245
245
|
`,
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
'Should handle multiple item types',
|
|
247
|
+
);
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
defineInlineTest(
|
|
250
|
+
{ ...transformer, parser: 'tsx' },
|
|
251
|
+
{},
|
|
252
|
+
`
|
|
253
253
|
import { LinkItem, CustomItem } from '@atlaskit/menu';
|
|
254
254
|
|
|
255
255
|
const App = () => {
|
|
@@ -261,7 +261,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
261
261
|
);
|
|
262
262
|
}
|
|
263
263
|
`,
|
|
264
|
-
|
|
264
|
+
`
|
|
265
265
|
import { LinkItem, CustomItem, ButtonItem } from '@atlaskit/menu';
|
|
266
266
|
|
|
267
267
|
const App = () => {
|
|
@@ -273,13 +273,13 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
273
273
|
);
|
|
274
274
|
}
|
|
275
275
|
`,
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
'Should not delete any imports',
|
|
277
|
+
);
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
defineInlineTest(
|
|
280
|
+
{ ...transformer, parser: 'tsx' },
|
|
281
|
+
{},
|
|
282
|
+
`
|
|
283
283
|
import { LinkItem } from '@atlaskit/menu';
|
|
284
284
|
|
|
285
285
|
const App = () => {
|
|
@@ -291,7 +291,7 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
291
291
|
);
|
|
292
292
|
}
|
|
293
293
|
`,
|
|
294
|
-
|
|
294
|
+
`
|
|
295
295
|
import { LinkItem, ButtonItem } from '@atlaskit/menu';
|
|
296
296
|
|
|
297
297
|
const App = () => {
|
|
@@ -303,6 +303,6 @@ describe('Converts link items with invalid or missing `href` to button items', (
|
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
305
|
`,
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
'Should allow valid `href` and convert invalid ones',
|
|
307
|
+
);
|
|
308
308
|
});
|