@atlaskit/textfield 6.3.0 → 6.4.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 +598 -578
- package/__perf__/examples.tsx +34 -37
- package/codemods/5.0.0-lite-mode.tsx +5 -8
- package/codemods/__tests__/5.0.0-lite-mode.tsx +14 -14
- package/codemods/__tests__/remove-imports.tsx +29 -31
- package/codemods/__tests__/remove-prop.tsx +28 -28
- package/codemods/__tests__/rename-disabled-to-isdisabled.tsx +28 -28
- package/codemods/__tests__/rename-imports.tsx +45 -48
- package/codemods/migrations/remove-imports.tsx +3 -3
- package/codemods/migrations/rename-disabled-to-isdisabled.tsx +1 -5
- package/codemods/migrations/rename-imports.tsx +8 -8
- package/codemods/migrations/utils.tsx +279 -320
- package/dist/cjs/styles.js +5 -12
- package/dist/cjs/text-field.js +8 -2
- package/dist/es2019/styles.js +5 -14
- package/dist/es2019/text-field.js +9 -2
- package/dist/esm/styles.js +5 -14
- package/dist/esm/text-field.js +9 -2
- package/dist/types/styles.d.ts +4 -8
- package/dist/types/text-field.d.ts +4 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/styles.d.ts +4 -8
- package/dist/types-ts4.5/text-field.d.ts +4 -1
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/package.json +92 -94
- package/report.api.md +21 -23
package/__perf__/examples.tsx
CHANGED
|
@@ -1,58 +1,55 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { fireEvent } from '@testing-library/dom';
|
|
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 Texfield from '../src';
|
|
10
7
|
|
|
11
8
|
const testId = 'text-field-test-id';
|
|
12
9
|
|
|
13
10
|
const getLastTexfield = (container: HTMLElement) => {
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const textField = container.querySelectorAll(`[data-testId="${testId}"]`);
|
|
12
|
+
return textField[textField.length - 1];
|
|
16
13
|
};
|
|
17
14
|
|
|
18
15
|
const textField = () => {
|
|
19
|
-
|
|
16
|
+
return <Texfield placeholder="new texfield" testId={testId} width="large" />;
|
|
20
17
|
};
|
|
21
18
|
|
|
22
19
|
const interactionTasks: PublicInteractionTask[] = [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
20
|
+
{
|
|
21
|
+
name: 'Focus',
|
|
22
|
+
description: 'Render texfield and make input focus',
|
|
23
|
+
run: async ({ container }: InteractionTaskArgs): Promise<void> => {
|
|
24
|
+
const texfield = getLastTexfield(container);
|
|
25
|
+
fireEvent.focus(texfield);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Blur',
|
|
30
|
+
description: 'Render texfield and make input blur',
|
|
31
|
+
run: async ({ container }: InteractionTaskArgs): Promise<void> => {
|
|
32
|
+
const texfield = getLastTexfield(container);
|
|
33
|
+
fireEvent.blur(texfield);
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'OnChange',
|
|
38
|
+
description: 'Render texfield and make input change',
|
|
39
|
+
run: async ({ container }: InteractionTaskArgs): Promise<void> => {
|
|
40
|
+
const texfield = getLastTexfield(container);
|
|
41
|
+
fireEvent.change(texfield, { target: { value: 'foo' } });
|
|
42
|
+
},
|
|
43
|
+
},
|
|
47
44
|
];
|
|
48
45
|
|
|
49
46
|
textField.story = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
name: 'texfield',
|
|
48
|
+
parameters: {
|
|
49
|
+
performance: {
|
|
50
|
+
interactions: interactionTasks,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
56
53
|
};
|
|
57
54
|
|
|
58
55
|
export default textField;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { removeThemeImports } from './migrations/remove-imports';
|
|
2
2
|
import { removeThemeProp } from './migrations/remove-props';
|
|
3
|
-
import {
|
|
4
|
-
renameThemeAppearanceImport,
|
|
5
|
-
renamethemeTokensImport,
|
|
6
|
-
} from './migrations/rename-imports';
|
|
3
|
+
import { renameThemeAppearanceImport, renamethemeTokensImport } from './migrations/rename-imports';
|
|
7
4
|
import { createTransformer } from './migrations/utils';
|
|
8
5
|
|
|
9
6
|
const transformer = createTransformer('@atlaskit/textfield', [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
removeThemeProp,
|
|
8
|
+
removeThemeImports,
|
|
9
|
+
renamethemeTokensImport,
|
|
10
|
+
renameThemeAppearanceImport,
|
|
14
11
|
]);
|
|
15
12
|
|
|
16
13
|
export default transformer;
|
|
@@ -5,10 +5,10 @@ import transformer from '../5.0.0-lite-mode';
|
|
|
5
5
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
6
|
|
|
7
7
|
describe('TextField code-mods', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
defineInlineTest(
|
|
9
|
+
{ default: transformer, parser: 'tsx' },
|
|
10
|
+
{},
|
|
11
|
+
`
|
|
12
12
|
import Textfield, { ThemeProps, ThemeAppearance , themeTokens as ColorTokens, ThemeTokens } from '@atlaskit/textfield';
|
|
13
13
|
import customeTheme from './theme';
|
|
14
14
|
import React from 'react';
|
|
@@ -21,7 +21,7 @@ describe('TextField code-mods', () => {
|
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
`,
|
|
24
|
-
|
|
24
|
+
`
|
|
25
25
|
/* TODO: (from codemod) This file uses the @atlaskit/textfield \`theme\` prop which
|
|
26
26
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
27
27
|
theme with an equivalent API due to minimal usage of the \`theme\` prop.
|
|
@@ -36,12 +36,12 @@ describe('TextField code-mods', () => {
|
|
|
36
36
|
return <Textfield />;
|
|
37
37
|
}
|
|
38
38
|
`,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
'should remove theme & its imports from Textfield and leave a comment',
|
|
40
|
+
);
|
|
41
|
+
defineInlineTest(
|
|
42
|
+
{ default: transformer, parser: 'tsx' },
|
|
43
|
+
{},
|
|
44
|
+
`
|
|
45
45
|
import Textfield, { ThemeProps, ThemeTokens } from '@atlaskit/textfield';
|
|
46
46
|
import React from 'react';
|
|
47
47
|
|
|
@@ -68,7 +68,7 @@ describe('TextField code-mods', () => {
|
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
`,
|
|
71
|
-
|
|
71
|
+
`
|
|
72
72
|
/* TODO: (from codemod) This file uses the @atlaskit/textfield \`theme\` prop which
|
|
73
73
|
has now been removed due to its poor performance characteristics. We have not replaced
|
|
74
74
|
theme with an equivalent API due to minimal usage of the \`theme\` prop.
|
|
@@ -82,6 +82,6 @@ describe('TextField code-mods', () => {
|
|
|
82
82
|
return <Textfield />;
|
|
83
83
|
}
|
|
84
84
|
`,
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
'should remove theme prop & its imports from Textfield and leave a comment',
|
|
86
|
+
);
|
|
87
87
|
});
|
|
@@ -3,9 +3,7 @@ jest.autoMockOff();
|
|
|
3
3
|
import { removeThemeImports } from '../migrations/remove-imports';
|
|
4
4
|
import { createTransformer } from '../migrations/utils';
|
|
5
5
|
|
|
6
|
-
const transformer = createTransformer('@atlaskit/textfield', [
|
|
7
|
-
removeThemeImports,
|
|
8
|
-
]);
|
|
6
|
+
const transformer = createTransformer('@atlaskit/textfield', [removeThemeImports]);
|
|
9
7
|
|
|
10
8
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
11
9
|
|
|
@@ -14,51 +12,51 @@ const importToDoComment = `
|
|
|
14
12
|
has now been removed due to its poor performance characteristics. */`;
|
|
15
13
|
|
|
16
14
|
describe('Remove imports', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
defineInlineTest(
|
|
16
|
+
{ default: transformer, parser: 'tsx' },
|
|
17
|
+
{},
|
|
18
|
+
`
|
|
21
19
|
import Textfield, { Theme, ThemeProps, ThemeTokens } from '@atlaskit/textfield';
|
|
22
20
|
`,
|
|
23
|
-
|
|
21
|
+
`
|
|
24
22
|
${importToDoComment}
|
|
25
23
|
import Textfield from '@atlaskit/textfield';
|
|
26
24
|
`,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
'should remove theme imports from Textfield and leave a comment',
|
|
26
|
+
);
|
|
27
|
+
defineInlineTest(
|
|
28
|
+
{ default: transformer, parser: 'tsx' },
|
|
29
|
+
{},
|
|
30
|
+
`
|
|
33
31
|
import Textfield, { ThemeProps as TextfieldThemeProp, Theme as TextFieldTheme, ThemeTokens as TextfieldThemeTokens} from '@atlaskit/textfield';
|
|
34
32
|
`,
|
|
35
|
-
|
|
33
|
+
`
|
|
36
34
|
${importToDoComment}
|
|
37
35
|
import Textfield from '@atlaskit/textfield';
|
|
38
36
|
`,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
'should remove theme imports with alias name from Textfield and leave a comment',
|
|
38
|
+
);
|
|
39
|
+
defineInlineTest(
|
|
40
|
+
{ default: transformer, parser: 'tsx' },
|
|
41
|
+
{},
|
|
42
|
+
`
|
|
45
43
|
import { TextFieldProps, ThemeProps, Theme, ThemeTokens } from '@atlaskit/textfield';
|
|
46
44
|
`,
|
|
47
|
-
|
|
45
|
+
`
|
|
48
46
|
${importToDoComment}
|
|
49
47
|
import { TextFieldProps } from '@atlaskit/textfield';
|
|
50
48
|
`,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
'should remove theme imports & leave other imports from Textfield and leave a comment',
|
|
50
|
+
);
|
|
51
|
+
defineInlineTest(
|
|
52
|
+
{ default: transformer, parser: 'tsx' },
|
|
53
|
+
{},
|
|
54
|
+
`
|
|
57
55
|
import { ThemeProps, ThemeTokens, Theme } from '@atlaskit/textfield';
|
|
58
56
|
`,
|
|
59
|
-
|
|
57
|
+
`
|
|
60
58
|
${importToDoComment}
|
|
61
59
|
`,
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
'should remove theme imports & remove whole line if no default import from Textfield and leave a comment',
|
|
61
|
+
);
|
|
64
62
|
});
|
|
@@ -14,10 +14,10 @@ const themeToDoComment = `
|
|
|
14
14
|
The appearance of TextField will have likely changed. */`;
|
|
15
15
|
|
|
16
16
|
describe('Remove prop', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
defineInlineTest(
|
|
18
|
+
{ default: transformer, parser: 'tsx' },
|
|
19
|
+
{},
|
|
20
|
+
`
|
|
21
21
|
import React from 'react';
|
|
22
22
|
import Textfield from '@atlaskit/textfield';
|
|
23
23
|
import customeTheme from './theme';
|
|
@@ -30,7 +30,7 @@ describe('Remove prop', () => {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
`,
|
|
33
|
-
|
|
33
|
+
`
|
|
34
34
|
${themeToDoComment}
|
|
35
35
|
import React from 'react';
|
|
36
36
|
import Textfield from '@atlaskit/textfield';
|
|
@@ -40,13 +40,13 @@ describe('Remove prop', () => {
|
|
|
40
40
|
return <Textfield />;
|
|
41
41
|
}
|
|
42
42
|
`,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
'should remove theme from Textfield and leave a comment',
|
|
44
|
+
);
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
defineInlineTest(
|
|
47
|
+
{ default: transformer, parser: 'tsx' },
|
|
48
|
+
{},
|
|
49
|
+
`
|
|
50
50
|
import React from 'react';
|
|
51
51
|
import TextField from '@atlaskit/textfield';
|
|
52
52
|
import customeTheme from './theme';
|
|
@@ -59,7 +59,7 @@ describe('Remove prop', () => {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
`,
|
|
62
|
-
|
|
62
|
+
`
|
|
63
63
|
${themeToDoComment}
|
|
64
64
|
import React from 'react';
|
|
65
65
|
import TextField from '@atlaskit/textfield';
|
|
@@ -69,13 +69,13 @@ describe('Remove prop', () => {
|
|
|
69
69
|
return <TextField />;
|
|
70
70
|
}
|
|
71
71
|
`,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
'should remove theme from TextField and leave a comment',
|
|
73
|
+
);
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
defineInlineTest(
|
|
76
|
+
{ default: transformer, parser: 'tsx' },
|
|
77
|
+
{},
|
|
78
|
+
`
|
|
79
79
|
import React from 'react';
|
|
80
80
|
import Textfield from '@atlaskit/textfield';
|
|
81
81
|
import customeTheme from './theme';
|
|
@@ -93,7 +93,7 @@ describe('Remove prop', () => {
|
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
`,
|
|
96
|
-
|
|
96
|
+
`
|
|
97
97
|
${themeToDoComment}
|
|
98
98
|
import React from 'react';
|
|
99
99
|
import Textfield from '@atlaskit/textfield';
|
|
@@ -108,13 +108,13 @@ describe('Remove prop', () => {
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
`,
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
'should remove 2 usages of theme and add 1 comment',
|
|
112
|
+
);
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
defineInlineTest(
|
|
115
|
+
{ default: transformer, parser: 'tsx' },
|
|
116
|
+
{},
|
|
117
|
+
`
|
|
118
118
|
import React from 'react';
|
|
119
119
|
import Foo from '@atlaskit/textfield';
|
|
120
120
|
import customeTheme from './theme';
|
|
@@ -127,7 +127,7 @@ describe('Remove prop', () => {
|
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
`,
|
|
130
|
-
|
|
130
|
+
`
|
|
131
131
|
${themeToDoComment}
|
|
132
132
|
import React from 'react';
|
|
133
133
|
import Foo from '@atlaskit/textfield';
|
|
@@ -137,6 +137,6 @@ describe('Remove prop', () => {
|
|
|
137
137
|
return <Foo />;
|
|
138
138
|
}
|
|
139
139
|
`,
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
'should remove theme prop when using an aliased name',
|
|
141
|
+
);
|
|
142
142
|
});
|
|
@@ -9,10 +9,10 @@ const transformer = createTransformer([renameDisabledToIsDisabled]);
|
|
|
9
9
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
10
10
|
|
|
11
11
|
describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
defineInlineTest(
|
|
13
|
+
{ default: transformer, parser: 'tsx' },
|
|
14
|
+
{},
|
|
15
|
+
`
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import Textfield from '@atlaskit/textfield';
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
20
20
|
return <Textfield disabled />;
|
|
21
21
|
}
|
|
22
22
|
`,
|
|
23
|
-
|
|
23
|
+
`
|
|
24
24
|
import React from 'react';
|
|
25
25
|
import Textfield from '@atlaskit/textfield';
|
|
26
26
|
|
|
@@ -28,13 +28,13 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
28
28
|
return <Textfield isDisabled />;
|
|
29
29
|
}
|
|
30
30
|
`,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
'should rename single line disabled to isDisabled',
|
|
32
|
+
);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
defineInlineTest(
|
|
35
|
+
{ default: transformer, parser: 'tsx' },
|
|
36
|
+
{},
|
|
37
|
+
`
|
|
38
38
|
import React from 'react';
|
|
39
39
|
import Textfield from '@atlaskit/textfield';
|
|
40
40
|
|
|
@@ -48,7 +48,7 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
`,
|
|
51
|
-
|
|
51
|
+
`
|
|
52
52
|
import React from 'react';
|
|
53
53
|
import Textfield from '@atlaskit/textfield';
|
|
54
54
|
|
|
@@ -62,13 +62,13 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
`,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
'should rename multiline disabled to isDisabled',
|
|
66
|
+
);
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
defineInlineTest(
|
|
69
|
+
{ default: transformer, parser: 'tsx' },
|
|
70
|
+
{},
|
|
71
|
+
`
|
|
72
72
|
import React from 'react';
|
|
73
73
|
import Textfield from '@atlaskit/textfield';
|
|
74
74
|
|
|
@@ -84,7 +84,7 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
`,
|
|
87
|
-
|
|
87
|
+
`
|
|
88
88
|
import React from 'react';
|
|
89
89
|
import Textfield from '@atlaskit/textfield';
|
|
90
90
|
|
|
@@ -100,13 +100,13 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
`,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
'should rename disabled to isDisabled with indirection',
|
|
104
|
+
);
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
defineInlineTest(
|
|
107
|
+
{ default: transformer, parser: 'tsx' },
|
|
108
|
+
{},
|
|
109
|
+
`
|
|
110
110
|
import React from 'react';
|
|
111
111
|
import AkTextfield from '@atlaskit/textfield';
|
|
112
112
|
|
|
@@ -122,7 +122,7 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
`,
|
|
125
|
-
|
|
125
|
+
`
|
|
126
126
|
import React from 'react';
|
|
127
127
|
import AkTextfield from '@atlaskit/textfield';
|
|
128
128
|
|
|
@@ -138,6 +138,6 @@ describe('Rename `disabled` prop to `isDisabled`', () => {
|
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
140
|
`,
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
'should rename disabled to isDisabled with indirection and different default import',
|
|
142
|
+
);
|
|
143
143
|
});
|
|
@@ -1,85 +1,82 @@
|
|
|
1
1
|
jest.autoMockOff();
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
renameThemeAppearanceImport,
|
|
5
|
-
renamethemeTokensImport,
|
|
6
|
-
} from '../migrations/rename-imports';
|
|
3
|
+
import { renameThemeAppearanceImport, renamethemeTokensImport } from '../migrations/rename-imports';
|
|
7
4
|
import { createTransformer } from '../migrations/utils';
|
|
8
5
|
|
|
9
6
|
const transformer = createTransformer('@atlaskit/textfield', [
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
renamethemeTokensImport,
|
|
8
|
+
renameThemeAppearanceImport,
|
|
12
9
|
]);
|
|
13
10
|
|
|
14
11
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
15
12
|
|
|
16
13
|
describe('Rename imports', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
defineInlineTest(
|
|
15
|
+
{ default: transformer, parser: 'tsx' },
|
|
16
|
+
{},
|
|
17
|
+
`
|
|
21
18
|
import { themeTokens, ThemeAppearance } from '@atlaskit/textfield';
|
|
22
19
|
`,
|
|
23
|
-
|
|
20
|
+
`
|
|
24
21
|
import { TextFieldColors, Appearance } from '@atlaskit/textfield';
|
|
25
22
|
`,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
'should rename themeTokens & ThemeAppearance to TextFieldColors & Appearance',
|
|
24
|
+
);
|
|
25
|
+
defineInlineTest(
|
|
26
|
+
{ default: transformer, parser: 'tsx' },
|
|
27
|
+
{},
|
|
28
|
+
`
|
|
32
29
|
import Textfield, { ThemeAppearance, themeTokens } from '@atlaskit/textfield';
|
|
33
30
|
`,
|
|
34
|
-
|
|
31
|
+
`
|
|
35
32
|
import Textfield, { Appearance, TextFieldColors } from '@atlaskit/textfield';
|
|
36
33
|
`,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
'should rename themeTokens & Appearance to TextFieldColors & Appearance and keep Textfield default import as is',
|
|
35
|
+
);
|
|
36
|
+
defineInlineTest(
|
|
37
|
+
{ default: transformer, parser: 'tsx' },
|
|
38
|
+
{},
|
|
39
|
+
`
|
|
43
40
|
import Textfield, { TextFieldProps, themeTokens } from '@atlaskit/textfield';
|
|
44
41
|
`,
|
|
45
|
-
|
|
42
|
+
`
|
|
46
43
|
import Textfield, { TextFieldProps, TextFieldColors } from '@atlaskit/textfield';
|
|
47
44
|
`,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
'should rename themeTokens to TextFieldColors and keep TextFieldProps as is',
|
|
46
|
+
);
|
|
47
|
+
defineInlineTest(
|
|
48
|
+
{ default: transformer, parser: 'tsx' },
|
|
49
|
+
{},
|
|
50
|
+
`
|
|
54
51
|
import Textfield, { TextFieldProps, themeTokens as MyLifeMyColors } from '@atlaskit/textfield';
|
|
55
52
|
`,
|
|
56
|
-
|
|
53
|
+
`
|
|
57
54
|
import Textfield, { TextFieldProps, TextFieldColors as MyLifeMyColors } from '@atlaskit/textfield';
|
|
58
55
|
`,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
'should rename themeTokens to TextFieldColors and keep its alias name as is',
|
|
57
|
+
);
|
|
58
|
+
defineInlineTest(
|
|
59
|
+
{ default: transformer, parser: 'tsx' },
|
|
60
|
+
{},
|
|
61
|
+
`
|
|
65
62
|
import Textfield, { ThemeProps as TextfieldThemeProp,
|
|
66
63
|
ThemeAppearance as TextFieldAppearance, Theme as TextFieldTheme, themeTokens as MyLifeMyColors, ThemeTokens as TextfieldThemeTokens} from '@atlaskit/textfield';
|
|
67
64
|
`,
|
|
68
|
-
|
|
65
|
+
`
|
|
69
66
|
import Textfield, { ThemeProps as TextfieldThemeProp,
|
|
70
67
|
Appearance as TextFieldAppearance, Theme as TextFieldTheme, TextFieldColors as MyLifeMyColors, ThemeTokens as TextfieldThemeTokens} from '@atlaskit/textfield';
|
|
71
68
|
`,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
'should rename themeTokens to TextFieldColors, ThemeAppearance to Appearance and keep its alias name as is even when there are multiple name exports with alias',
|
|
70
|
+
);
|
|
71
|
+
defineInlineTest(
|
|
72
|
+
{ default: transformer, parser: 'tsx' },
|
|
73
|
+
{},
|
|
74
|
+
`
|
|
78
75
|
import { themeTokens, TextFieldProps } from '@atlaskit/textfield';
|
|
79
76
|
`,
|
|
80
|
-
|
|
77
|
+
`
|
|
81
78
|
import { TextFieldColors, TextFieldProps } from '@atlaskit/textfield';
|
|
82
79
|
`,
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
'should rename themeTokens to TextFieldColors and keep TextFieldProps named import as is',
|
|
81
|
+
);
|
|
85
82
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRemoveImportsFor } from './utils';
|
|
2
2
|
|
|
3
3
|
export const removeThemeImports = createRemoveImportsFor({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
importsToRemove: ['ThemeProps', 'ThemeTokens', 'Theme'],
|
|
5
|
+
packagePath: '@atlaskit/textfield',
|
|
6
|
+
comment: `This file uses exports used to help theme @atlaskit/textfield which
|
|
7
7
|
has now been removed due to its poor performance characteristics.`,
|
|
8
8
|
});
|
|
@@ -4,8 +4,4 @@ const component = '@atlaskit/textfield';
|
|
|
4
4
|
const from = 'disabled';
|
|
5
5
|
const to = 'isDisabled';
|
|
6
6
|
|
|
7
|
-
export const renameDisabledToIsDisabled = createRenameFuncFor(
|
|
8
|
-
component,
|
|
9
|
-
from,
|
|
10
|
-
to,
|
|
11
|
-
);
|
|
7
|
+
export const renameDisabledToIsDisabled = createRenameFuncFor(component, from, to);
|