@atlaskit/range 9.0.0 → 9.0.2
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 +14 -0
- package/package.json +10 -8
- package/codemods/4.0.0-lite-mode.tsx +0 -67
- package/codemods/__tests__/4.0.0-lite-mode.tsx +0 -109
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/range
|
|
2
2
|
|
|
3
|
+
## 9.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#120300](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120300)
|
|
14
|
+
[`c7e29fd764fdc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c7e29fd764fdc) -
|
|
15
|
+
Remove old codemod and update dependencies.
|
|
16
|
+
|
|
3
17
|
## 9.0.0
|
|
4
18
|
|
|
5
19
|
### Major Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/range",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "A range lets users choose an approximate value on a slider.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/css": "^0.10.0",
|
|
29
29
|
"@atlaskit/ds-lib": "^4.0.0",
|
|
30
|
-
"@atlaskit/theme": "^
|
|
31
|
-
"@atlaskit/tokens": "^4.
|
|
30
|
+
"@atlaskit/theme": "^18.0.0",
|
|
31
|
+
"@atlaskit/tokens": "^4.3.0",
|
|
32
32
|
"@babel/runtime": "^7.0.0",
|
|
33
33
|
"@compiled/react": "^0.18.2"
|
|
34
34
|
},
|
|
@@ -39,17 +39,19 @@
|
|
|
39
39
|
"@af/accessibility-testing": "*",
|
|
40
40
|
"@af/integration-testing": "*",
|
|
41
41
|
"@af/visual-regression": "*",
|
|
42
|
-
"@atlaskit/
|
|
42
|
+
"@atlaskit/button": "^21.1.0",
|
|
43
|
+
"@atlaskit/checkbox": "^17.0.0",
|
|
44
|
+
"@atlaskit/docs": "*",
|
|
45
|
+
"@atlaskit/form": "^12.0.0",
|
|
46
|
+
"@atlaskit/link": "*",
|
|
47
|
+
"@atlaskit/primitives": "^14.1.2",
|
|
48
|
+
"@atlaskit/section-message": "*",
|
|
43
49
|
"@atlaskit/ssr": "*",
|
|
44
50
|
"@atlaskit/tooltip": "^20.0.0",
|
|
45
|
-
"@atlaskit/visual-regression": "*",
|
|
46
51
|
"@emotion/styled": "^11.0.0",
|
|
47
52
|
"@testing-library/react": "^13.4.0",
|
|
48
|
-
"@types/jscodeshift": "^0.11.0",
|
|
49
|
-
"jscodeshift": "^0.13.0",
|
|
50
53
|
"lodash": "^4.17.21",
|
|
51
54
|
"react-dom": "^18.2.0",
|
|
52
|
-
"storybook-addon-performance": "^0.17.3",
|
|
53
55
|
"typescript": "~5.4.2"
|
|
54
56
|
},
|
|
55
57
|
"keywords": [
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type API,
|
|
3
|
-
type ASTPath,
|
|
4
|
-
type default as core,
|
|
5
|
-
type FileInfo,
|
|
6
|
-
type ImportDeclaration,
|
|
7
|
-
type JSXAttribute,
|
|
8
|
-
type Options,
|
|
9
|
-
} from 'jscodeshift';
|
|
10
|
-
|
|
11
|
-
function getDefaultSpecifier(j: core.JSCodeshift, source: any, specifier: string) {
|
|
12
|
-
const specifiers = source
|
|
13
|
-
.find(j.ImportDeclaration)
|
|
14
|
-
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
15
|
-
.find(j.ImportDefaultSpecifier);
|
|
16
|
-
|
|
17
|
-
if (!specifiers.length) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return specifiers.nodes()[0]!.local!.name;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getJSXAttributesByName(j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) {
|
|
24
|
-
return j(element)
|
|
25
|
-
.find(j.JSXOpeningElement)
|
|
26
|
-
.find(j.JSXAttribute)
|
|
27
|
-
.filter((attribute) => {
|
|
28
|
-
const matches = j(attribute)
|
|
29
|
-
.find(j.JSXIdentifier)
|
|
30
|
-
.filter((identifier) => identifier.value.name === attributeName);
|
|
31
|
-
return Boolean(matches.length);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function updateRef(j: core.JSCodeshift, source: any) {
|
|
36
|
-
const defaultSpecifier = getDefaultSpecifier(j, source, '@atlaskit/range');
|
|
37
|
-
|
|
38
|
-
if (!defaultSpecifier) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXAttribute>) => {
|
|
43
|
-
getJSXAttributesByName(j, element, 'inputRef').forEach((attribute) => {
|
|
44
|
-
j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier('ref'), attribute.node.value));
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function hasImportDeclaration(j: core.JSCodeshift, source: any, importPath: string) {
|
|
50
|
-
const imports = source
|
|
51
|
-
.find(j.ImportDeclaration)
|
|
52
|
-
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === importPath);
|
|
53
|
-
|
|
54
|
-
return Boolean(imports.length);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
58
|
-
const source = j(fileInfo.source);
|
|
59
|
-
|
|
60
|
-
if (!hasImportDeclaration(j, source, '@atlaskit/range')) {
|
|
61
|
-
return fileInfo.source;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
updateRef(j, source);
|
|
65
|
-
|
|
66
|
-
return source.toSource(options.printOptions || { quote: 'single' });
|
|
67
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
jest.autoMockOff();
|
|
2
|
-
|
|
3
|
-
import transformer from '../4.0.0-lite-mode';
|
|
4
|
-
|
|
5
|
-
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
|
-
|
|
7
|
-
describe('Update ref prop', () => {
|
|
8
|
-
defineInlineTest(
|
|
9
|
-
{ default: transformer, parser: 'tsx' },
|
|
10
|
-
{},
|
|
11
|
-
`
|
|
12
|
-
import React, { useRef } from 'react';
|
|
13
|
-
import Range from '@atlaskit/range';
|
|
14
|
-
|
|
15
|
-
const SimpleRange = () => {
|
|
16
|
-
let ref = useRef();
|
|
17
|
-
|
|
18
|
-
const inputRef = (newRef) => {
|
|
19
|
-
ref = newRef;
|
|
20
|
-
}
|
|
21
|
-
return <Range inputRef={inputRef} />;
|
|
22
|
-
}
|
|
23
|
-
`,
|
|
24
|
-
`
|
|
25
|
-
import React, { useRef } from 'react';
|
|
26
|
-
import Range from '@atlaskit/range';
|
|
27
|
-
|
|
28
|
-
const SimpleRange = () => {
|
|
29
|
-
let ref = useRef();
|
|
30
|
-
|
|
31
|
-
const inputRef = (newRef) => {
|
|
32
|
-
ref = newRef;
|
|
33
|
-
}
|
|
34
|
-
return <Range ref={inputRef} />;
|
|
35
|
-
}
|
|
36
|
-
`,
|
|
37
|
-
'should replace inputRef with ref',
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
defineInlineTest(
|
|
41
|
-
{ default: transformer, parser: 'tsx' },
|
|
42
|
-
{},
|
|
43
|
-
`
|
|
44
|
-
import React, { useRef } from 'react';
|
|
45
|
-
import Range from '@atlaskit/range';
|
|
46
|
-
|
|
47
|
-
const SimpleRange = () => {
|
|
48
|
-
let ref = useRef();
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Range
|
|
52
|
-
inputRef={newRef => {
|
|
53
|
-
ref = newRef;
|
|
54
|
-
}}
|
|
55
|
-
/>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
`,
|
|
59
|
-
`
|
|
60
|
-
import React, { useRef } from 'react';
|
|
61
|
-
import Range from '@atlaskit/range';
|
|
62
|
-
|
|
63
|
-
const SimpleRange = () => {
|
|
64
|
-
let ref = useRef();
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<Range
|
|
68
|
-
ref={newRef => {
|
|
69
|
-
ref = newRef;
|
|
70
|
-
}}
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
`,
|
|
75
|
-
'should replace inputRef with ref when defined inline',
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
defineInlineTest(
|
|
79
|
-
{ default: transformer, parser: 'tsx' },
|
|
80
|
-
{},
|
|
81
|
-
`
|
|
82
|
-
import React, { useRef } from 'react';
|
|
83
|
-
import Foo from '@atlaskit/range';
|
|
84
|
-
|
|
85
|
-
const SimpleRange = () => {
|
|
86
|
-
let ref = useRef();
|
|
87
|
-
|
|
88
|
-
const inputRef = (newRef) => {
|
|
89
|
-
ref = newRef;
|
|
90
|
-
}
|
|
91
|
-
return <Foo inputRef={inputRef} />;
|
|
92
|
-
}
|
|
93
|
-
`,
|
|
94
|
-
`
|
|
95
|
-
import React, { useRef } from 'react';
|
|
96
|
-
import Foo from '@atlaskit/range';
|
|
97
|
-
|
|
98
|
-
const SimpleRange = () => {
|
|
99
|
-
let ref = useRef();
|
|
100
|
-
|
|
101
|
-
const inputRef = (newRef) => {
|
|
102
|
-
ref = newRef;
|
|
103
|
-
}
|
|
104
|
-
return <Foo ref={inputRef} />;
|
|
105
|
-
}
|
|
106
|
-
`,
|
|
107
|
-
'should change inputRef with aliased import name',
|
|
108
|
-
);
|
|
109
|
-
});
|