@atlaskit/side-navigation 3.2.0 → 3.3.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/README.md +7 -3
- package/afm-jira/tsconfig.json +3 -0
- package/codemods/0.8.0-change-css-fn-prop.tsx +136 -164
- package/codemods/__tests__/0.8.0-change-css-fn-prop.tsx +77 -77
- package/codemods/helpers/generic.tsx +528 -564
- package/constellation/index/examples.mdx +20 -20
- package/constellation/index/props.mdx +8 -8
- package/constellation/index/usage.mdx +27 -11
- package/dist/cjs/components/Header/index.js +4 -0
- package/dist/cjs/components/Item/link-item.js +3 -1
- package/dist/cjs/components/LoadingItems/index.js +7 -3
- package/dist/cjs/components/NavigationContent/index.js +8 -1
- package/dist/cjs/components/NavigationHeader/index.js +4 -0
- package/dist/cjs/components/NestableNavigationContent/index.js +5 -0
- package/dist/cjs/components/NestableNavigationContent/nesting-motion.js +3 -1
- package/dist/cjs/components/NestingItem/index.js +4 -0
- package/dist/cjs/components/SideNavigation/index.js +5 -0
- package/dist/es2019/components/Header/index.js +5 -0
- package/dist/es2019/components/Item/link-item.js +3 -1
- package/dist/es2019/components/LoadingItems/index.js +7 -3
- package/dist/es2019/components/NavigationContent/index.js +8 -1
- package/dist/es2019/components/NavigationHeader/index.js +4 -0
- package/dist/es2019/components/NestableNavigationContent/index.js +5 -0
- package/dist/es2019/components/NestableNavigationContent/nesting-motion.js +4 -0
- package/dist/es2019/components/NestingItem/index.js +5 -0
- package/dist/es2019/components/SideNavigation/index.js +5 -0
- package/dist/esm/components/Header/index.js +5 -0
- package/dist/esm/components/Item/link-item.js +3 -1
- package/dist/esm/components/LoadingItems/index.js +7 -3
- package/dist/esm/components/NavigationContent/index.js +8 -1
- package/dist/esm/components/NavigationHeader/index.js +4 -0
- package/dist/esm/components/NestableNavigationContent/index.js +5 -0
- package/dist/esm/components/NestableNavigationContent/nesting-motion.js +4 -0
- package/dist/esm/components/NestingItem/index.js +5 -0
- package/dist/esm/components/SideNavigation/index.js +5 -0
- package/dist/types/components/LoadingItems/index.d.ts +1 -1
- package/dist/types/components/NavigationContent/index.d.ts +3 -0
- package/dist/types/components/NavigationHeader/index.d.ts +3 -0
- package/dist/types/components/NestableNavigationContent/index.d.ts +0 -1
- package/dist/types/components/NestableNavigationContent/nesting-motion.d.ts +3 -0
- package/dist/types/components/NestingItem/index.d.ts +3 -0
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types-ts4.5/components/LoadingItems/index.d.ts +1 -1
- package/dist/types-ts4.5/components/NavigationContent/index.d.ts +3 -0
- package/dist/types-ts4.5/components/NavigationHeader/index.d.ts +3 -0
- package/dist/types-ts4.5/components/NestableNavigationContent/index.d.ts +0 -1
- package/dist/types-ts4.5/components/NestableNavigationContent/nesting-motion.d.ts +3 -0
- package/dist/types-ts4.5/components/NestingItem/index.d.ts +3 -0
- package/dist/types-ts4.5/components/index.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/docs/00-intro.tsx +4 -6
- package/docs/ert/footer.tsx +6 -6
- package/package.json +97 -97
- package/report.api.md +102 -123
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/side-navigation
|
|
2
2
|
|
|
3
|
+
## 3.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#110836](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/110836)
|
|
8
|
+
[`a8bd419fd70b9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a8bd419fd70b9) -
|
|
9
|
+
Explicitly set jsxRuntime to classic via pragma comments in order to avoid issues where jsxRuntime
|
|
10
|
+
is implicitly set to automatic.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 3.2.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 3.2.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -37,7 +56,7 @@
|
|
|
37
56
|
|
|
38
57
|
- [#94389](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94389)
|
|
39
58
|
[`5ca1173e141e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5ca1173e141e) -
|
|
40
|
-
Add support for React 18.
|
|
59
|
+
Add support for React 18 in non-strict mode.
|
|
41
60
|
|
|
42
61
|
## 3.0.10
|
|
43
62
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,11 @@ yarn add @atlaskit/side-navigation
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
Detailed docs and example usage can be found
|
|
13
|
+
Detailed docs and example usage can be found
|
|
14
|
+
[here](https://atlassian.design/components/side-navigation).
|
|
14
15
|
|
|
15
|
-
To add a top navigation, use
|
|
16
|
-
|
|
16
|
+
To add a top navigation, use
|
|
17
|
+
[@atlaskit/atlassian-navigation](https://atlassian.design/components/atlassian-navigation) To
|
|
18
|
+
control the layout of these navigation elements and add expand/collapse functionality to
|
|
19
|
+
`side-navigation`, use
|
|
20
|
+
[@atlaskit/page-layout](https://atlaskit.atlassian.com/packages/design-system/page-layout).
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -1,185 +1,157 @@
|
|
|
1
1
|
import { type NodePath } from 'ast-types/lib/node-path';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
type API,
|
|
4
|
+
type ASTPath,
|
|
5
|
+
type default as core,
|
|
6
|
+
type FileInfo,
|
|
7
|
+
type ImportDeclaration,
|
|
8
|
+
type ImportSpecifier,
|
|
9
|
+
type Options,
|
|
10
10
|
} from 'jscodeshift';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.find(j.JSXAttribute)
|
|
25
|
-
.filter((attribute) => {
|
|
26
|
-
const matches = j(attribute)
|
|
27
|
-
.find(j.JSXIdentifier)
|
|
28
|
-
.filter((identifier) => identifier.value.name === attributeName);
|
|
29
|
-
return Boolean(matches.length);
|
|
30
|
-
});
|
|
12
|
+
import { addCommentBeforeJSX, getDefaultSpecifierName } from './helpers/generic';
|
|
13
|
+
|
|
14
|
+
function getJSXAttributesByName(j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) {
|
|
15
|
+
return j(element)
|
|
16
|
+
.find(j.JSXOpeningElement)
|
|
17
|
+
.find(j.JSXAttribute)
|
|
18
|
+
.filter((attribute) => {
|
|
19
|
+
const matches = j(attribute)
|
|
20
|
+
.find(j.JSXIdentifier)
|
|
21
|
+
.filter((identifier) => identifier.value.name === attributeName);
|
|
22
|
+
return Boolean(matches.length);
|
|
23
|
+
});
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
function getImportSpecifier(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
j: core.JSCodeshift,
|
|
28
|
+
source: ReturnType<typeof j>,
|
|
29
|
+
specifier: string,
|
|
30
|
+
imported: string,
|
|
38
31
|
) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!specifiers.length) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return specifiers.nodes()[0]!.local!.name;
|
|
32
|
+
const specifiers = source
|
|
33
|
+
.find(j.ImportDeclaration)
|
|
34
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
35
|
+
.find(j.ImportSpecifier)
|
|
36
|
+
.filter((path: ASTPath<ImportSpecifier>) => path.value.imported.name === imported);
|
|
37
|
+
|
|
38
|
+
if (!specifiers.length) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return specifiers.nodes()[0]!.local!.name;
|
|
55
43
|
}
|
|
56
44
|
|
|
57
|
-
function updateCssFnProp(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
cssFnExpression!.value.params.shift();
|
|
102
|
-
} catch (e) {
|
|
103
|
-
addCommentBeforeJSX(
|
|
104
|
-
j,
|
|
105
|
-
cssFnProp,
|
|
106
|
-
`
|
|
45
|
+
function updateCssFnProp(j: core.JSCodeshift, source: ReturnType<typeof j>, specifier: string) {
|
|
46
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
47
|
+
const cssFnPropCollection = getJSXAttributesByName(j, element, 'cssFn');
|
|
48
|
+
|
|
49
|
+
// no cssProp usage for this element
|
|
50
|
+
if (!cssFnPropCollection.length) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const cssFnProp = cssFnPropCollection.get();
|
|
55
|
+
|
|
56
|
+
const cssFnExpression: NodePath = j(cssFnProp)
|
|
57
|
+
.find(j.JSXExpressionContainer)
|
|
58
|
+
.find(j.Expression)
|
|
59
|
+
.get();
|
|
60
|
+
|
|
61
|
+
if (cssFnExpression) {
|
|
62
|
+
// just remove the state styles param
|
|
63
|
+
try {
|
|
64
|
+
const [stylePropName] = cssFnExpression!.value.params;
|
|
65
|
+
j(cssFnExpression)
|
|
66
|
+
.find(j.SpreadElement)
|
|
67
|
+
.forEach((n) => {
|
|
68
|
+
// discerns whether there are multiple identifiers here
|
|
69
|
+
const isComplexIdentifier = j(n).find(j.Identifier).length > 1;
|
|
70
|
+
|
|
71
|
+
if (isComplexIdentifier) {
|
|
72
|
+
throw new Error('CSSFn Prop codemod: Unable to parse spread element');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const hasStyleProp = !!j(n)
|
|
76
|
+
.find(j.Identifier)
|
|
77
|
+
.filter((node) => node.value.name === stylePropName.name).length;
|
|
78
|
+
if (hasStyleProp) {
|
|
79
|
+
j(n).remove();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
cssFnExpression!.value.params.shift();
|
|
84
|
+
} catch (e) {
|
|
85
|
+
addCommentBeforeJSX(
|
|
86
|
+
j,
|
|
87
|
+
cssFnProp,
|
|
88
|
+
`
|
|
107
89
|
The usage of the 'cssFn' prop in this component could not be transformed and requires manual intervention.
|
|
108
90
|
The 'cssFn' prop has been simplified so that users no longer need to merge the inherited styles with their own overrides.
|
|
109
91
|
For more info please reach out to #help-design-system-code.
|
|
110
92
|
`,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
115
97
|
}
|
|
116
98
|
|
|
117
99
|
function hasImportDeclaration(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
100
|
+
j: core.JSCodeshift,
|
|
101
|
+
source: ReturnType<typeof j>,
|
|
102
|
+
importPath: string,
|
|
121
103
|
) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.filter((path) => path.node.source.value === importPath).length;
|
|
104
|
+
return !!source.find(j.ImportDeclaration).filter((path) => path.node.source.value === importPath)
|
|
105
|
+
.length;
|
|
125
106
|
}
|
|
126
107
|
|
|
127
|
-
export default function transformer(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return source.toSource(
|
|
177
|
-
options.printOptions || {
|
|
178
|
-
quote: 'single',
|
|
179
|
-
trailingComma: true,
|
|
180
|
-
},
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return fileInfo.source;
|
|
108
|
+
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
109
|
+
const source = j(fileInfo.source);
|
|
110
|
+
|
|
111
|
+
if (hasImportDeclaration(j, source, '@atlaskit/side-navigation')) {
|
|
112
|
+
const defaultSpecifier = getDefaultSpecifierName({
|
|
113
|
+
j,
|
|
114
|
+
base: source,
|
|
115
|
+
packageName: '@atlaskit/side-navigation',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
if (defaultSpecifier != null) {
|
|
119
|
+
updateCssFnProp(j, source, defaultSpecifier);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
[
|
|
123
|
+
'SideNavigation',
|
|
124
|
+
'Header',
|
|
125
|
+
'NavigationHeader',
|
|
126
|
+
'NavigationContent',
|
|
127
|
+
'Section',
|
|
128
|
+
'HeadingItem',
|
|
129
|
+
'SkeletonHeadingItem',
|
|
130
|
+
'NestableNavigationContent',
|
|
131
|
+
'NestingItem',
|
|
132
|
+
'ButtonItem',
|
|
133
|
+
'LinkItem',
|
|
134
|
+
'GoBackItem',
|
|
135
|
+
'CustomItem',
|
|
136
|
+
'SkeletonItem',
|
|
137
|
+
'Footer',
|
|
138
|
+
'NavigationFooter',
|
|
139
|
+
'LoadingItems',
|
|
140
|
+
].forEach((pkg) => {
|
|
141
|
+
const importSpecifier = getImportSpecifier(j, source, '@atlaskit/side-navigation', pkg);
|
|
142
|
+
|
|
143
|
+
if (importSpecifier != null) {
|
|
144
|
+
updateCssFnProp(j, source, importSpecifier);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
return source.toSource(
|
|
149
|
+
options.printOptions || {
|
|
150
|
+
quote: 'single',
|
|
151
|
+
trailingComma: true,
|
|
152
|
+
},
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return fileInfo.source;
|
|
185
157
|
}
|