@atlaskit/checkbox 13.3.0 → 13.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 +873 -858
- package/README.md +2 -1
- package/__perf__/checkbox.tsx +54 -72
- package/__perf__/default.tsx +7 -7
- package/codemods/12.0.0-lite-mode.tsx +12 -16
- package/codemods/__tests__/12.0.0-lite-mode.tsx +105 -105
- package/codemods/migrations/remove-imports.tsx +3 -3
- package/codemods/migrations/remove-props.tsx +9 -13
- package/codemods/migrations/rename-import.tsx +10 -10
- package/codemods/migrations/rename-input-ref-to-ref.tsx +4 -4
- package/codemods/utils.tsx +362 -401
- package/dist/cjs/checkbox.js +27 -2
- package/dist/cjs/internal/checkbox-icon.js +2 -0
- package/dist/cjs/internal/label-text.js +4 -0
- package/dist/cjs/internal/label.js +10 -1
- package/dist/cjs/internal/required-indicator.js +6 -2
- package/dist/es2019/checkbox.js +27 -1
- package/dist/es2019/internal/checkbox-icon.js +2 -0
- package/dist/es2019/internal/label-text.js +4 -0
- package/dist/es2019/internal/label.js +10 -1
- package/dist/es2019/internal/required-indicator.js +6 -2
- package/dist/esm/checkbox.js +28 -2
- package/dist/esm/internal/checkbox-icon.js +2 -0
- package/dist/esm/internal/label-text.js +4 -0
- package/dist/esm/internal/label.js +10 -1
- package/dist/esm/internal/required-indicator.js +6 -2
- package/dist/types/internal/label-text.d.ts +4 -1
- package/dist/types/internal/label.d.ts +5 -2
- package/dist/types/internal/required-indicator.d.ts +3 -0
- package/dist/types/types.d.ts +12 -1
- package/dist/types-ts4.5/internal/label-text.d.ts +4 -1
- package/dist/types-ts4.5/internal/label.d.ts +5 -2
- package/dist/types-ts4.5/internal/required-indicator.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +12 -1
- package/extract-react-types/checkbox-props.tsx +2 -2
- package/package.json +93 -93
- package/report.api.md +41 -46
package/README.md
CHANGED
package/__perf__/checkbox.tsx
CHANGED
|
@@ -1,88 +1,70 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { fireEvent } from '@testing-library/react';
|
|
4
|
-
import {
|
|
5
|
-
InteractionTaskArgs,
|
|
6
|
-
PublicInteractionTask,
|
|
7
|
-
} from 'storybook-addon-performance';
|
|
4
|
+
import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
|
|
8
5
|
|
|
9
6
|
import { Checkbox } from '../src';
|
|
10
7
|
|
|
11
8
|
const interactionTasks: PublicInteractionTask[] = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
run: async ({
|
|
52
|
-
container,
|
|
53
|
-
controls,
|
|
54
|
-
}: InteractionTaskArgs): Promise<void> => {
|
|
55
|
-
const checkbox: HTMLElement | null = container.querySelector(
|
|
56
|
-
'input[name="checkbox-basic"]',
|
|
57
|
-
);
|
|
58
|
-
if (checkbox == null) {
|
|
59
|
-
throw new Error('Could not find checkbox element');
|
|
60
|
-
}
|
|
61
|
-
await controls.time(async () => {
|
|
62
|
-
fireEvent.focus(checkbox);
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
},
|
|
9
|
+
{
|
|
10
|
+
name: 'Select checkbox',
|
|
11
|
+
description: 'Select checkbox',
|
|
12
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
13
|
+
const checkbox: HTMLElement | null = container.querySelector('input[name="checkbox-basic"]');
|
|
14
|
+
if (checkbox == null) {
|
|
15
|
+
throw new Error('Could not find checkbox element');
|
|
16
|
+
}
|
|
17
|
+
await controls.time(async () => {
|
|
18
|
+
fireEvent.click(checkbox);
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Hover checkbox',
|
|
24
|
+
description: 'Hover checkbox',
|
|
25
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
26
|
+
const checkbox: HTMLElement | null = container.querySelector('input[name="checkbox-basic"]');
|
|
27
|
+
if (checkbox == null) {
|
|
28
|
+
throw new Error('Could not find checkbox element');
|
|
29
|
+
}
|
|
30
|
+
await controls.time(async () => {
|
|
31
|
+
fireEvent.mouseOver(checkbox);
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'Focus checkbox',
|
|
37
|
+
description: 'Focus checkbox',
|
|
38
|
+
run: async ({ container, controls }: InteractionTaskArgs): Promise<void> => {
|
|
39
|
+
const checkbox: HTMLElement | null = container.querySelector('input[name="checkbox-basic"]');
|
|
40
|
+
if (checkbox == null) {
|
|
41
|
+
throw new Error('Could not find checkbox element');
|
|
42
|
+
}
|
|
43
|
+
await controls.time(async () => {
|
|
44
|
+
fireEvent.focus(checkbox);
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
},
|
|
66
48
|
];
|
|
67
49
|
|
|
68
50
|
function PerformanceComponent() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
51
|
+
return (
|
|
52
|
+
<Checkbox
|
|
53
|
+
value="Basic checkbox"
|
|
54
|
+
label="Basic checkbox"
|
|
55
|
+
name="checkbox-basic"
|
|
56
|
+
testId="cb-basic"
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
77
59
|
}
|
|
78
60
|
|
|
79
61
|
PerformanceComponent.story = {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
62
|
+
name: 'Performance',
|
|
63
|
+
parameters: {
|
|
64
|
+
performance: {
|
|
65
|
+
interactions: interactionTasks,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
86
68
|
};
|
|
87
69
|
|
|
88
70
|
export default PerformanceComponent;
|
package/__perf__/default.tsx
CHANGED
|
@@ -3,11 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import { Checkbox } from '../src';
|
|
4
4
|
|
|
5
5
|
export default () => (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
<Checkbox
|
|
7
|
+
value="default checkbox"
|
|
8
|
+
label="Default checkbox"
|
|
9
|
+
onChange={() => {}}
|
|
10
|
+
name="checkbox-default"
|
|
11
|
+
testId="cb-default"
|
|
12
|
+
/>
|
|
13
13
|
);
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import { removeThemeImports } from './migrations/remove-imports';
|
|
2
|
+
import { removeFullWidth, removeOverrides, removeTheme } from './migrations/remove-props';
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from './migrations/remove-props';
|
|
7
|
-
import {
|
|
8
|
-
renameCheckboxWithoutAnalyticsImport,
|
|
9
|
-
renameDeepTypeImport,
|
|
10
|
-
renameTypeImport,
|
|
4
|
+
renameCheckboxWithoutAnalyticsImport,
|
|
5
|
+
renameDeepTypeImport,
|
|
6
|
+
renameTypeImport,
|
|
11
7
|
} from './migrations/rename-import';
|
|
12
8
|
import { renameInputRef } from './migrations/rename-input-ref-to-ref';
|
|
13
9
|
import { createTransformer } from './utils';
|
|
14
10
|
|
|
15
11
|
const transformer = createTransformer('@atlaskit/checkbox', [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
removeThemeImports,
|
|
13
|
+
renameCheckboxWithoutAnalyticsImport,
|
|
14
|
+
renameTypeImport,
|
|
15
|
+
renameDeepTypeImport,
|
|
16
|
+
renameInputRef,
|
|
17
|
+
removeFullWidth,
|
|
18
|
+
removeOverrides,
|
|
19
|
+
removeTheme,
|
|
24
20
|
]);
|
|
25
21
|
|
|
26
22
|
export default transformer;
|
|
@@ -5,10 +5,10 @@ import transformer from '../12.0.0-lite-mode';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('Update imports', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
defineInlineTest(
|
|
9
|
+
{ default: transformer, parser: 'tsx' },
|
|
10
|
+
{},
|
|
11
|
+
`
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { CheckboxWithoutAnalytics as Checkbox } from '@atlaskit/checkbox/Checkbox';
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ describe('Update imports', () => {
|
|
|
16
16
|
return <Checkbox />;
|
|
17
17
|
}
|
|
18
18
|
`,
|
|
19
|
-
|
|
19
|
+
`
|
|
20
20
|
import React from 'react';
|
|
21
21
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
22
22
|
|
|
@@ -24,12 +24,12 @@ describe('Update imports', () => {
|
|
|
24
24
|
return <Checkbox />;
|
|
25
25
|
}
|
|
26
26
|
`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
'should replace import to CheckboxWithoutAnayltics with base import',
|
|
28
|
+
);
|
|
29
|
+
defineInlineTest(
|
|
30
|
+
{ default: transformer, parser: 'tsx' },
|
|
31
|
+
{},
|
|
32
|
+
`
|
|
33
33
|
import React from 'react';
|
|
34
34
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
35
35
|
import { CheckboxProps } from '@atlaskit/checkbox/types';
|
|
@@ -41,7 +41,7 @@ describe('Update imports', () => {
|
|
|
41
41
|
return <Checkbox {...props} />;
|
|
42
42
|
}
|
|
43
43
|
`,
|
|
44
|
-
|
|
44
|
+
`
|
|
45
45
|
import React from 'react';
|
|
46
46
|
import { Checkbox, CheckboxProps } from '@atlaskit/checkbox';
|
|
47
47
|
|
|
@@ -52,12 +52,12 @@ describe('Update imports', () => {
|
|
|
52
52
|
return <Checkbox {...props} />;
|
|
53
53
|
}
|
|
54
54
|
`,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
'should replace import into /types with base import',
|
|
56
|
+
);
|
|
57
|
+
defineInlineTest(
|
|
58
|
+
{ default: transformer, parser: 'tsx' },
|
|
59
|
+
{},
|
|
60
|
+
`
|
|
61
61
|
import React from 'react';
|
|
62
62
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
63
63
|
import { CheckboxProps as AkCheckboxProps } from '@atlaskit/checkbox/dist/cjs/types';
|
|
@@ -69,7 +69,7 @@ describe('Update imports', () => {
|
|
|
69
69
|
return <Checkbox {...props} />;
|
|
70
70
|
}
|
|
71
71
|
`,
|
|
72
|
-
|
|
72
|
+
`
|
|
73
73
|
import React from 'react';
|
|
74
74
|
import { Checkbox, CheckboxProps as AkCheckboxProps } from '@atlaskit/checkbox';
|
|
75
75
|
|
|
@@ -80,12 +80,12 @@ describe('Update imports', () => {
|
|
|
80
80
|
return <Checkbox {...props} />;
|
|
81
81
|
}
|
|
82
82
|
`,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
'should replace import into /dist/cjs/types with an alias with base import',
|
|
84
|
+
);
|
|
85
|
+
defineInlineTest(
|
|
86
|
+
{ default: transformer, parser: 'tsx' },
|
|
87
|
+
{},
|
|
88
|
+
`
|
|
89
89
|
import React from 'react';
|
|
90
90
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
91
91
|
import { ComponentTokens, ThemeFn } from '@atlaskit/checkbox/types';
|
|
@@ -94,7 +94,7 @@ describe('Update imports', () => {
|
|
|
94
94
|
return <Checkbox />;
|
|
95
95
|
}
|
|
96
96
|
`,
|
|
97
|
-
|
|
97
|
+
`
|
|
98
98
|
/* TODO: (from codemod) This file uses exports used to help theme @atlaskit/checkbox which
|
|
99
99
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
100
100
|
theme with an equivalent API due to minimal usage of the theming.
|
|
@@ -106,12 +106,12 @@ describe('Update imports', () => {
|
|
|
106
106
|
return <Checkbox />;
|
|
107
107
|
}
|
|
108
108
|
`,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
'should replace import from /types that do not exist anymore',
|
|
110
|
+
);
|
|
111
|
+
defineInlineTest(
|
|
112
|
+
{ default: transformer, parser: 'tsx' },
|
|
113
|
+
{},
|
|
114
|
+
`
|
|
115
115
|
import React from 'react';
|
|
116
116
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
117
117
|
import { ComponentTokens, ThemeFn, CheckboxProps as AkCheckboxProps } from '@atlaskit/checkbox/types';
|
|
@@ -123,7 +123,7 @@ describe('Update imports', () => {
|
|
|
123
123
|
return <Checkbox {...props} />;
|
|
124
124
|
}
|
|
125
125
|
`,
|
|
126
|
-
|
|
126
|
+
`
|
|
127
127
|
/* TODO: (from codemod) This file uses exports used to help theme @atlaskit/checkbox which
|
|
128
128
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
129
129
|
theme with an equivalent API due to minimal usage of the theming.
|
|
@@ -138,15 +138,15 @@ describe('Update imports', () => {
|
|
|
138
138
|
return <Checkbox {...props} />;
|
|
139
139
|
}
|
|
140
140
|
`,
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
'should replace import from /types that do not exist anymore',
|
|
142
|
+
);
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
describe('Update ref prop', () => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
defineInlineTest(
|
|
147
|
+
{ default: transformer, parser: 'tsx' },
|
|
148
|
+
{},
|
|
149
|
+
`
|
|
150
150
|
import React, { useRef } from 'react';
|
|
151
151
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
152
152
|
|
|
@@ -159,7 +159,7 @@ describe('Update ref prop', () => {
|
|
|
159
159
|
return <Checkbox inputRef={inputRef} />;
|
|
160
160
|
}
|
|
161
161
|
`,
|
|
162
|
-
|
|
162
|
+
`
|
|
163
163
|
import React, { useRef } from 'react';
|
|
164
164
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
165
165
|
|
|
@@ -172,13 +172,13 @@ describe('Update ref prop', () => {
|
|
|
172
172
|
return <Checkbox ref={inputRef} />;
|
|
173
173
|
}
|
|
174
174
|
`,
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
'should replace inputRef with ref',
|
|
176
|
+
);
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
defineInlineTest(
|
|
179
|
+
{ default: transformer, parser: 'tsx' },
|
|
180
|
+
{},
|
|
181
|
+
`
|
|
182
182
|
import React, { useRef } from 'react';
|
|
183
183
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
184
184
|
|
|
@@ -194,7 +194,7 @@ describe('Update ref prop', () => {
|
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
`,
|
|
197
|
-
|
|
197
|
+
`
|
|
198
198
|
import React, { useRef } from 'react';
|
|
199
199
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
200
200
|
|
|
@@ -210,13 +210,13 @@ describe('Update ref prop', () => {
|
|
|
210
210
|
);
|
|
211
211
|
}
|
|
212
212
|
`,
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
'should replace inputRef with ref when defined inline',
|
|
214
|
+
);
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
defineInlineTest(
|
|
217
|
+
{ default: transformer, parser: 'tsx' },
|
|
218
|
+
{},
|
|
219
|
+
`
|
|
220
220
|
import React, { useRef } from 'react';
|
|
221
221
|
import { Checkbox as Foo } from '@atlaskit/checkbox';
|
|
222
222
|
|
|
@@ -229,7 +229,7 @@ describe('Update ref prop', () => {
|
|
|
229
229
|
return <Foo inputRef={inputRef} />;
|
|
230
230
|
}
|
|
231
231
|
`,
|
|
232
|
-
|
|
232
|
+
`
|
|
233
233
|
import React, { useRef } from 'react';
|
|
234
234
|
import { Checkbox as Foo } from '@atlaskit/checkbox';
|
|
235
235
|
|
|
@@ -242,15 +242,15 @@ describe('Update ref prop', () => {
|
|
|
242
242
|
return <Foo ref={inputRef} />;
|
|
243
243
|
}
|
|
244
244
|
`,
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
'should change inputRef with aliased import name',
|
|
246
|
+
);
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
describe('Remove props', () => {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
250
|
+
defineInlineTest(
|
|
251
|
+
{ default: transformer, parser: 'tsx' },
|
|
252
|
+
{},
|
|
253
|
+
`
|
|
254
254
|
import React from 'react';
|
|
255
255
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
256
256
|
|
|
@@ -258,7 +258,7 @@ describe('Remove props', () => {
|
|
|
258
258
|
return <Checkbox isFullWidth={true} />;
|
|
259
259
|
}
|
|
260
260
|
`,
|
|
261
|
-
|
|
261
|
+
`
|
|
262
262
|
import React from 'react';
|
|
263
263
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
264
264
|
|
|
@@ -266,12 +266,12 @@ describe('Remove props', () => {
|
|
|
266
266
|
return <Checkbox />;
|
|
267
267
|
}
|
|
268
268
|
`,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
269
|
+
'should remove isFullWidth',
|
|
270
|
+
);
|
|
271
|
+
defineInlineTest(
|
|
272
|
+
{ default: transformer, parser: 'tsx' },
|
|
273
|
+
{},
|
|
274
|
+
`
|
|
275
275
|
import React from 'react';
|
|
276
276
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
277
277
|
import IconIndeterminate from '@atlaskit/icon/glyph/add-circle';
|
|
@@ -294,7 +294,7 @@ describe('Remove props', () => {
|
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
296
|
`,
|
|
297
|
-
|
|
297
|
+
`
|
|
298
298
|
/* TODO: (from codemod) This file uses the @atlaskit/checkbox \`overrides\` prop
|
|
299
299
|
which has now been removed due to its poor performance characteristics. We have not
|
|
300
300
|
replaced overrides with an equivalent API and the overrides pattern exposes internal
|
|
@@ -309,12 +309,12 @@ describe('Remove props', () => {
|
|
|
309
309
|
return <Checkbox />;
|
|
310
310
|
}
|
|
311
311
|
`,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
312
|
+
'should remove overrides and leave a comment',
|
|
313
|
+
);
|
|
314
|
+
defineInlineTest(
|
|
315
|
+
{ default: transformer, parser: 'tsx' },
|
|
316
|
+
{},
|
|
317
|
+
`
|
|
318
318
|
import React from 'react';
|
|
319
319
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
320
320
|
import customeTheme from './theme';
|
|
@@ -327,7 +327,7 @@ describe('Remove props', () => {
|
|
|
327
327
|
);
|
|
328
328
|
}
|
|
329
329
|
`,
|
|
330
|
-
|
|
330
|
+
`
|
|
331
331
|
/* TODO: (from codemod) This file uses the @atlaskit/checkbox \`theme\` prop which
|
|
332
332
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
333
333
|
theme with an equivalent API due to minimal usage of the \`theme\` prop. However if you
|
|
@@ -341,12 +341,12 @@ describe('Remove props', () => {
|
|
|
341
341
|
return <Checkbox />;
|
|
342
342
|
}
|
|
343
343
|
`,
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
344
|
+
'should remove theme and leave a comment',
|
|
345
|
+
);
|
|
346
|
+
defineInlineTest(
|
|
347
|
+
{ default: transformer, parser: 'tsx' },
|
|
348
|
+
{},
|
|
349
|
+
`
|
|
350
350
|
import React from 'react';
|
|
351
351
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
352
352
|
import IconIndeterminate from '@atlaskit/icon/glyph/add-circle';
|
|
@@ -372,7 +372,7 @@ describe('Remove props', () => {
|
|
|
372
372
|
);
|
|
373
373
|
}
|
|
374
374
|
`,
|
|
375
|
-
|
|
375
|
+
`
|
|
376
376
|
/* TODO: (from codemod) This file uses the @atlaskit/checkbox \`overrides\` prop
|
|
377
377
|
which has now been removed due to its poor performance characteristics. We have not
|
|
378
378
|
replaced overrides with an equivalent API and the overrides pattern exposes internal
|
|
@@ -393,12 +393,12 @@ describe('Remove props', () => {
|
|
|
393
393
|
return <Checkbox />;
|
|
394
394
|
}
|
|
395
395
|
`,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
396
|
+
'should remove all 3 props and leave a comment',
|
|
397
|
+
);
|
|
398
|
+
defineInlineTest(
|
|
399
|
+
{ default: transformer, parser: 'tsx' },
|
|
400
|
+
{},
|
|
401
|
+
`
|
|
402
402
|
import React from 'react';
|
|
403
403
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
404
404
|
import { ComponentTokens, ThemeFn, CheckboxProps as AkCheckboxProps } from '@atlaskit/checkbox/types';
|
|
@@ -425,7 +425,7 @@ describe('Remove props', () => {
|
|
|
425
425
|
);
|
|
426
426
|
}
|
|
427
427
|
`,
|
|
428
|
-
|
|
428
|
+
`
|
|
429
429
|
/* TODO: (from codemod) This file uses exports used to help theme @atlaskit/checkbox which
|
|
430
430
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
431
431
|
theme with an equivalent API due to minimal usage of the theming.
|
|
@@ -450,12 +450,12 @@ describe('Remove props', () => {
|
|
|
450
450
|
return <Checkbox />;
|
|
451
451
|
}
|
|
452
452
|
`,
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
453
|
+
'should remove an old import, all 3 props and leave a comment',
|
|
454
|
+
);
|
|
455
|
+
defineInlineTest(
|
|
456
|
+
{ default: transformer, parser: 'tsx' },
|
|
457
|
+
{},
|
|
458
|
+
`
|
|
459
459
|
import React from 'react';
|
|
460
460
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
461
461
|
import customeTheme from './theme';
|
|
@@ -473,7 +473,7 @@ describe('Remove props', () => {
|
|
|
473
473
|
);
|
|
474
474
|
}
|
|
475
475
|
`,
|
|
476
|
-
|
|
476
|
+
`
|
|
477
477
|
/* TODO: (from codemod) This file uses the @atlaskit/checkbox \`theme\` prop which
|
|
478
478
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
479
479
|
theme with an equivalent API due to minimal usage of the \`theme\` prop. However if you
|
|
@@ -492,12 +492,12 @@ describe('Remove props', () => {
|
|
|
492
492
|
);
|
|
493
493
|
}
|
|
494
494
|
`,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
495
|
+
'should remove 2 usages of theme and add 1 comment',
|
|
496
|
+
);
|
|
497
|
+
defineInlineTest(
|
|
498
|
+
{ default: transformer, parser: 'tsx' },
|
|
499
|
+
{},
|
|
500
|
+
`
|
|
501
501
|
import React from 'react';
|
|
502
502
|
import { Checkbox as Foo } from '@atlaskit/checkbox';
|
|
503
503
|
import IconIndeterminate from '@atlaskit/icon/glyph/add-circle';
|
|
@@ -523,7 +523,7 @@ describe('Remove props', () => {
|
|
|
523
523
|
);
|
|
524
524
|
}
|
|
525
525
|
`,
|
|
526
|
-
|
|
526
|
+
`
|
|
527
527
|
/* TODO: (from codemod) This file uses the @atlaskit/checkbox \`overrides\` prop
|
|
528
528
|
which has now been removed due to its poor performance characteristics. We have not
|
|
529
529
|
replaced overrides with an equivalent API and the overrides pattern exposes internal
|
|
@@ -544,6 +544,6 @@ describe('Remove props', () => {
|
|
|
544
544
|
return <Foo />;
|
|
545
545
|
}
|
|
546
546
|
`,
|
|
547
|
-
|
|
548
|
-
|
|
547
|
+
'should remove props when using an aliased name',
|
|
548
|
+
);
|
|
549
549
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRemoveImportsFor } from '../utils';
|
|
2
2
|
|
|
3
3
|
export const removeThemeImports = createRemoveImportsFor({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
importsToRemove: ['ComponentTokens', 'ThemeFn'],
|
|
5
|
+
packagePath: '@atlaskit/checkbox/types',
|
|
6
|
+
comment: `This file uses exports used to help theme @atlaskit/checkbox which
|
|
7
7
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
8
8
|
theme with an equivalent API due to minimal usage of the theming.
|
|
9
9
|
The appearance of Checkbox will have likely changed.`,
|