@atlaskit/range 8.2.0 → 9.0.1
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 +26 -0
- package/package.json +14 -12
- 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,31 @@
|
|
|
1
1
|
# @atlaskit/range
|
|
2
2
|
|
|
3
|
+
## 9.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#120300](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120300)
|
|
8
|
+
[`c7e29fd764fdc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c7e29fd764fdc) -
|
|
9
|
+
Remove old codemod and update dependencies.
|
|
10
|
+
|
|
11
|
+
## 9.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#117363](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117363)
|
|
16
|
+
[`10a0f7f6c2027`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/10a0f7f6c2027) -
|
|
17
|
+
This package's `peerDependencies` have been adjusted for `react` and/or `react-dom` to reflect the
|
|
18
|
+
status of only supporting React 18 going forward. No explicit breaking change to React support has
|
|
19
|
+
been made in this release, but this is to signify going forward, breaking changes for React 16 or
|
|
20
|
+
React 17 may come via non-major semver releases.
|
|
21
|
+
|
|
22
|
+
Please refer this community post for more details:
|
|
23
|
+
https://community.developer.atlassian.com/t/rfc-78-dropping-support-for-react-16-and-rendering-in-a-react-18-concurrent-root-in-jira-and-confluence/87026
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 8.2.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/range",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "A range lets users choose an approximate value on a slider.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,31 +25,33 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@atlaskit/css": "^0.
|
|
29
|
-
"@atlaskit/ds-lib": "^
|
|
30
|
-
"@atlaskit/theme": "^
|
|
31
|
-
"@atlaskit/tokens": "^
|
|
28
|
+
"@atlaskit/css": "^0.10.0",
|
|
29
|
+
"@atlaskit/ds-lib": "^4.0.0",
|
|
30
|
+
"@atlaskit/theme": "^17.0.0",
|
|
31
|
+
"@atlaskit/tokens": "^4.2.0",
|
|
32
32
|
"@babel/runtime": "^7.0.0",
|
|
33
33
|
"@compiled/react": "^0.18.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"react": "^
|
|
36
|
+
"react": "^18.2.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
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
|
-
"@atlaskit/tooltip": "^
|
|
45
|
-
"@atlaskit/visual-regression": "*",
|
|
50
|
+
"@atlaskit/tooltip": "^20.0.0",
|
|
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
|
-
});
|