@atlaskit/icon 22.3.1 → 22.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 +1081 -1072
- package/README.md +5 -2
- package/__perf__/default.tsx +7 -9
- package/build/index.tsx +39 -42
- package/codemods/21.2.0-metadata-entry.tsx +88 -96
- package/codemods/__tests__/21.2.0-metadata-entry.test.tsx +63 -63
- package/dist/cjs/components/icon-new.js +6 -1
- package/dist/cjs/components/icon-tile.js +5 -0
- package/dist/cjs/components/icon.js +13 -6
- package/dist/cjs/components/skeleton.js +7 -1
- package/dist/cjs/components/styles.js +8 -0
- package/dist/cjs/components/svg.js +10 -2
- package/dist/es2019/components/icon-new.js +5 -1
- package/dist/es2019/components/icon-tile.js +4 -0
- package/dist/es2019/components/icon.js +15 -5
- package/dist/es2019/components/skeleton.js +7 -1
- package/dist/es2019/components/styles.js +7 -0
- package/dist/es2019/components/svg.js +9 -2
- package/dist/esm/components/icon-new.js +5 -1
- package/dist/esm/components/icon-tile.js +4 -0
- package/dist/esm/components/icon.js +14 -5
- package/dist/esm/components/skeleton.js +7 -1
- package/dist/esm/components/styles.js +7 -0
- package/dist/esm/components/svg.js +9 -2
- package/docs/0-intro.tsx +5 -4
- package/package.json +116 -118
- package/report.api.md +23 -25
- package/utils/logo-icons.tsx +0 -32
package/README.md
CHANGED
|
@@ -10,6 +10,9 @@ yarn add @atlaskit/icon
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
Icons should be used intentionally to maximize comprehension and reduce cognitive load. Use it to
|
|
13
|
+
Icons should be used intentionally to maximize comprehension and reduce cognitive load. Use it to
|
|
14
|
+
call attention to a particular action, command, or section. If you’re questioning an icon’s use, it
|
|
15
|
+
probably doesn’t need to be used.
|
|
14
16
|
|
|
15
|
-
To search through all the icons we have in our system, have a look at our
|
|
17
|
+
To search through all the icons we have in our system, have a look at our
|
|
18
|
+
[icon explorer](https://atlassian.design/components/icon/icon-explorer).
|
package/__perf__/default.tsx
CHANGED
|
@@ -2,14 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import Icon from '../src';
|
|
3
3
|
|
|
4
4
|
const customGlyph = () => (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
<svg viewBox="0 0 24 24" focusable="false" role="presentation">
|
|
6
|
+
<g fill="currentColor" fillRule="evenodd">
|
|
7
|
+
<path d="M20.402 4.215a.414.414 0 0 0-.33-.166.398.398 0 0 0-.19.049c-2.427 1.328-5.24 2.03-8.134 2.03-2.895 0-5.708-.702-8.134-2.03a.397.397 0 0 0-.19-.049.405.405 0 0 0-.254.727 14.296 14.296 0 0 0 8.577 2.854h.001a14.295 14.295 0 0 0 8.579-2.855.405.405 0 0 0 .075-.56m-2.788 3.783a.326.326 0 0 0-.314-.045 15.86 15.86 0 0 1-2.069.625.407.407 0 0 0-.285.248c-.474 1.301-1.687 2.54-2.96 3.837a.329.329 0 0 1-.238.113c-.116 0-.187-.062-.24-.113-1.271-1.297-2.484-2.531-2.959-3.832a.407.407 0 0 0-.285-.249 16.06 16.06 0 0 1-2.07-.631.328.328 0 0 0-.313.045.325.325 0 0 0-.126.287c.108 1.082.535 2.14 1.307 3.247.725 1.042 1.67 2.007 2.585 2.94 1.685 1.718 3.276 3.34 3.416 5.223.012.17.154.301.324.301h1.98a.326.326 0 0 0 .325-.342c-.062-1.258-.536-2.518-1.448-3.851-.19-.28-.396-.552-.61-.818a.236.236 0 0 1 .016-.311l.199-.203c.914-.933 1.86-1.897 2.585-2.939.771-1.108 1.199-2.16 1.306-3.24a.334.334 0 0 0-.126-.292m-7.99 7.935a.301.301 0 0 0-.231-.099.326.326 0 0 0-.27.153c-.832 1.267-1.262 2.463-1.321 3.664a.33.33 0 0 0 .09.242.33.33 0 0 0 .236.101h1.976c.17 0 .314-.133.326-.303.043-.579.223-1.16.552-1.77a.458.458 0 0 0-.04-.493c-.326-.424-.725-.876-1.318-1.495" />
|
|
8
|
+
<path d="M11.75 8.968c.62 0 .98-.037 1.106-.037a.302.302 0 0 1 .275.421c-.082.22-.457 1.011-1.155 1.69a.319.319 0 0 1-.228.09.318.318 0 0 1-.229-.09c-.698-.679-1.073-1.47-1.155-1.69a.302.302 0 0 1 .275-.421c.127 0 .486.037 1.106.037h.005" />
|
|
9
|
+
</g>
|
|
10
|
+
</svg>
|
|
11
11
|
);
|
|
12
12
|
|
|
13
|
-
export default () =>
|
|
14
|
-
<Icon glyph={customGlyph} label="Custom icon" size="xlarge" />
|
|
15
|
-
);
|
|
13
|
+
export default () => <Icon glyph={customGlyph} label="Custom icon" size="xlarge" />;
|
package/build/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import utilityIconMetadata from '../icons_raw/metadata-utility';
|
|
|
10
10
|
const root = pkgDir.sync();
|
|
11
11
|
|
|
12
12
|
if (!root) {
|
|
13
|
-
|
|
13
|
+
throw new Error('Root directory was not found');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -41,59 +41,56 @@ if (!root) {
|
|
|
41
41
|
* The updated icon build process for the new icons under `@atlaskit/icon/core/*`
|
|
42
42
|
*/
|
|
43
43
|
const configCore: IconBuildConfig = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
srcDir: path.resolve(root, 'icons_raw/core'),
|
|
45
|
+
processedDir: path.resolve(root, 'icons_optimised/core'),
|
|
46
|
+
destDir: path.resolve(root, 'core'),
|
|
47
|
+
maxWidth: 24,
|
|
48
|
+
maxHeight: 24,
|
|
49
|
+
glob: '**/*.svg',
|
|
50
|
+
baseIconEntryPoint: '@atlaskit/icon/UNSAFE_base-new',
|
|
51
|
+
isUpdatedIconBuildEnabled: true,
|
|
52
|
+
iconType: 'core',
|
|
53
|
+
metadata: coreIconMetadata,
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
buildIcons(configCore).then((icons) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
const iconDocs = createIconDocs(
|
|
58
|
+
icons,
|
|
59
|
+
'@atlaskit/icon/core',
|
|
60
|
+
synonyms,
|
|
61
|
+
['icon', 'core'],
|
|
62
|
+
true,
|
|
63
|
+
coreIconMetadata,
|
|
64
|
+
);
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
return fs.outputFile(path.resolve(root, 'src/metadata-core.tsx'), iconDocs);
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* The updated icon build process for the new icons under `@atlaskit/icon/utility/*`
|
|
71
71
|
*/
|
|
72
72
|
const configUtility: IconBuildConfig = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
srcDir: path.resolve(root, 'icons_raw/utility'),
|
|
74
|
+
processedDir: path.resolve(root, 'icons_optimised/utility'),
|
|
75
|
+
destDir: path.resolve(root, 'utility'),
|
|
76
|
+
maxWidth: 12,
|
|
77
|
+
maxHeight: 12,
|
|
78
|
+
glob: '**/*.svg',
|
|
79
|
+
baseIconEntryPoint: '@atlaskit/icon/UNSAFE_base-new',
|
|
80
|
+
isUpdatedIconBuildEnabled: true,
|
|
81
|
+
iconType: 'utility',
|
|
82
|
+
metadata: utilityIconMetadata,
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
buildIcons(configUtility).then((icons) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
const iconDocs = createIconDocs(
|
|
87
|
+
icons,
|
|
88
|
+
'@atlaskit/icon/utility',
|
|
89
|
+
synonyms,
|
|
90
|
+
['icon', 'utility'],
|
|
91
|
+
true,
|
|
92
|
+
utilityIconMetadata,
|
|
93
|
+
);
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
path.resolve(root, 'src/metadata-utility.tsx'),
|
|
97
|
-
iconDocs,
|
|
98
|
-
);
|
|
95
|
+
return fs.outputFile(path.resolve(root, 'src/metadata-utility.tsx'), iconDocs);
|
|
99
96
|
});
|
|
@@ -1,119 +1,111 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
default as core,
|
|
3
|
+
API,
|
|
4
|
+
FileInfo,
|
|
5
|
+
ImportSpecifier,
|
|
6
|
+
ASTPath,
|
|
7
|
+
ImportDefaultSpecifier,
|
|
8
|
+
Options,
|
|
9
9
|
} from 'jscodeshift';
|
|
10
10
|
import { type Collection } from 'jscodeshift/src/Collection';
|
|
11
11
|
|
|
12
12
|
export const packageName = '@atlaskit/icon';
|
|
13
13
|
|
|
14
|
-
export default function transformer(
|
|
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
|
-
p.replace();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return root.toSource(options.printOptions || { quote: 'single' });
|
|
51
|
-
}
|
|
52
|
-
return file.source;
|
|
14
|
+
export default function transformer(file: FileInfo, api: API, options: Options) {
|
|
15
|
+
const j = api.jscodeshift;
|
|
16
|
+
const root = j(file.source, { quote: 'auto' });
|
|
17
|
+
if (hasImportDeclaration(j, root, packageName)) {
|
|
18
|
+
const imports = root.find(j.ImportSpecifier, {
|
|
19
|
+
imported: { name: 'metadata' },
|
|
20
|
+
});
|
|
21
|
+
imports.forEach((p: ASTPath<ImportSpecifier | ImportDefaultSpecifier>) => {
|
|
22
|
+
if (p.parentPath.parentPath.node.source.value !== packageName) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (p.parentPath.node.specifiers.length === 1) {
|
|
26
|
+
p.node.type = 'ImportDefaultSpecifier';
|
|
27
|
+
p.parentPath.node.source.value = `${packageName}/metadata`;
|
|
28
|
+
} else if (p.node.local) {
|
|
29
|
+
tryCreateImport({
|
|
30
|
+
j,
|
|
31
|
+
base: root,
|
|
32
|
+
packageName: `${packageName}/metadata`,
|
|
33
|
+
relativeToPackage: packageName,
|
|
34
|
+
});
|
|
35
|
+
addToImport({
|
|
36
|
+
j,
|
|
37
|
+
base: root,
|
|
38
|
+
packageName: `${packageName}/metadata`,
|
|
39
|
+
importSpecifier: j.importDefaultSpecifier(j.identifier(p.node.local.name)),
|
|
40
|
+
});
|
|
41
|
+
p.replace();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return root.toSource(options.printOptions || { quote: 'single' });
|
|
45
|
+
}
|
|
46
|
+
return file.source;
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
function hasImportDeclaration(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
j: core.JSCodeshift,
|
|
51
|
+
source: ReturnType<typeof j>,
|
|
52
|
+
importPath: string,
|
|
59
53
|
) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.filter((path) => path.node.source.value === importPath).length;
|
|
54
|
+
return !!source.find(j.ImportDeclaration).filter((path) => path.node.source.value === importPath)
|
|
55
|
+
.length;
|
|
63
56
|
}
|
|
64
57
|
|
|
65
58
|
function tryCreateImport({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
j,
|
|
60
|
+
base,
|
|
61
|
+
relativeToPackage,
|
|
62
|
+
packageName,
|
|
70
63
|
}: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
j: core.JSCodeshift;
|
|
65
|
+
base: Collection<any>;
|
|
66
|
+
relativeToPackage: string;
|
|
67
|
+
packageName: string;
|
|
75
68
|
}) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.filter((path) => path.value.source.value === packageName).length > 0;
|
|
69
|
+
const exists: boolean =
|
|
70
|
+
base.find(j.ImportDeclaration).filter((path) => path.value.source.value === packageName)
|
|
71
|
+
.length > 0;
|
|
80
72
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
73
|
+
if (exists) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
84
76
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
base
|
|
78
|
+
.find(j.ImportDeclaration)
|
|
79
|
+
.filter((path) => path.value.source.value === relativeToPackage)
|
|
80
|
+
.insertBefore(j.importDeclaration([], j.literal(packageName)));
|
|
89
81
|
}
|
|
90
82
|
|
|
91
83
|
function addToImport({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
j,
|
|
85
|
+
base,
|
|
86
|
+
importSpecifier,
|
|
87
|
+
packageName,
|
|
96
88
|
}: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
j: core.JSCodeshift;
|
|
90
|
+
base: Collection<any>;
|
|
91
|
+
importSpecifier: ImportSpecifier | ImportDefaultSpecifier;
|
|
92
|
+
packageName: string;
|
|
101
93
|
}) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
94
|
+
base
|
|
95
|
+
.find(j.ImportDeclaration)
|
|
96
|
+
.filter((path) => path.value.source.value === packageName)
|
|
97
|
+
.replaceWith((declaration) => {
|
|
98
|
+
return j.importDeclaration(
|
|
99
|
+
[
|
|
100
|
+
// we are appending to the existing specifiers
|
|
101
|
+
// We are doing a filter hear because sometimes specifiers can be removed
|
|
102
|
+
// but they hand around in the declaration
|
|
103
|
+
...(declaration.value.specifiers || []).filter(
|
|
104
|
+
(item) => item.type === 'ImportSpecifier' && item.imported != null,
|
|
105
|
+
),
|
|
106
|
+
importSpecifier,
|
|
107
|
+
],
|
|
108
|
+
j.literal(packageName),
|
|
109
|
+
);
|
|
110
|
+
});
|
|
119
111
|
}
|
|
@@ -5,122 +5,122 @@ import transformer, { packageName } from '../21.2.0-metadata-entry';
|
|
|
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 { metadata } from '${packageName}';
|
|
13
13
|
console.log(metadata);
|
|
14
14
|
`,
|
|
15
|
-
|
|
15
|
+
`
|
|
16
16
|
import metadata from '${packageName}/metadata';
|
|
17
17
|
console.log(metadata);
|
|
18
18
|
`,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
'should replace named metadata import from main entry point with default import from dedicated entry point',
|
|
20
|
+
);
|
|
21
|
+
defineInlineTest(
|
|
22
|
+
{ default: transformer, parser: 'tsx' },
|
|
23
|
+
{},
|
|
24
|
+
`
|
|
25
25
|
import { metadata as data } from '${packageName}';
|
|
26
26
|
console.log(data);
|
|
27
27
|
`,
|
|
28
|
-
|
|
28
|
+
`
|
|
29
29
|
import data from '${packageName}/metadata';
|
|
30
30
|
console.log(data);
|
|
31
31
|
`,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
'should preserve renaming when converting from named import to default import',
|
|
33
|
+
);
|
|
34
|
+
defineInlineTest(
|
|
35
|
+
{ default: transformer, parser: 'tsx' },
|
|
36
|
+
{},
|
|
37
|
+
`
|
|
38
38
|
import { a, metadata, b } from '${packageName}';
|
|
39
39
|
console.log(metadata);
|
|
40
40
|
`,
|
|
41
|
-
|
|
41
|
+
`
|
|
42
42
|
import metadata from '${packageName}/metadata';
|
|
43
43
|
import { a, b } from '${packageName}';
|
|
44
44
|
console.log(metadata);
|
|
45
45
|
`,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
'should preserve other named imports',
|
|
47
|
+
);
|
|
48
|
+
defineInlineTest(
|
|
49
|
+
{ default: transformer, parser: 'tsx' },
|
|
50
|
+
{},
|
|
51
|
+
`
|
|
52
52
|
import { a, metadata as data, b } from '${packageName}';
|
|
53
53
|
console.log(data);
|
|
54
54
|
`,
|
|
55
|
-
|
|
55
|
+
`
|
|
56
56
|
import data from '${packageName}/metadata';
|
|
57
57
|
import { a, b } from '${packageName}';
|
|
58
58
|
console.log(data);
|
|
59
59
|
`,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
'should preserve other named imports, as well as metadata renaming',
|
|
61
|
+
);
|
|
62
|
+
defineInlineTest(
|
|
63
|
+
{ default: transformer, parser: 'tsx' },
|
|
64
|
+
{},
|
|
65
|
+
`
|
|
66
66
|
import Icon, { a, metadata as data, b } from '${packageName}';
|
|
67
67
|
console.log(a, data, b);
|
|
68
68
|
`,
|
|
69
|
-
|
|
69
|
+
`
|
|
70
70
|
import data from '${packageName}/metadata';
|
|
71
71
|
import Icon, { a, b } from '${packageName}';
|
|
72
72
|
console.log(a, data, b);
|
|
73
73
|
`,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
'should preserve other named imports and default import, as well as metadata renaming',
|
|
75
|
+
);
|
|
76
|
+
defineInlineTest(
|
|
77
|
+
{ default: transformer, parser: 'tsx' },
|
|
78
|
+
{},
|
|
79
|
+
`
|
|
80
80
|
import metadata from '${packageName}/metadata';
|
|
81
81
|
console.log(metadata);
|
|
82
82
|
`,
|
|
83
|
-
|
|
83
|
+
`
|
|
84
84
|
import metadata from '${packageName}/metadata';
|
|
85
85
|
console.log(metadata);
|
|
86
86
|
`,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
'should not affect existing good imports',
|
|
88
|
+
);
|
|
89
|
+
defineInlineTest(
|
|
90
|
+
{ default: transformer, parser: 'tsx' },
|
|
91
|
+
{},
|
|
92
|
+
`
|
|
93
93
|
import { metadata } from 'not-${packageName}';
|
|
94
94
|
`,
|
|
95
|
-
|
|
95
|
+
`
|
|
96
96
|
import { metadata } from 'not-${packageName}';
|
|
97
97
|
`,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
'should not affect other packages',
|
|
99
|
+
);
|
|
100
|
+
defineInlineTest(
|
|
101
|
+
{ default: transformer, parser: 'tsx' },
|
|
102
|
+
{},
|
|
103
|
+
`
|
|
104
104
|
import { metadata } from '${packageName}/foo';
|
|
105
105
|
`,
|
|
106
|
-
|
|
106
|
+
`
|
|
107
107
|
import { metadata } from '${packageName}/foo';
|
|
108
108
|
`,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
'should not affect other entrypoints',
|
|
110
|
+
);
|
|
111
|
+
defineInlineTest(
|
|
112
|
+
{ default: transformer, parser: 'tsx' },
|
|
113
|
+
{},
|
|
114
|
+
`
|
|
115
115
|
import { metadata } from '@atlaskit/icon';
|
|
116
116
|
import { metadata as objectIconMetadata } from '@atlaskit/icon-object';
|
|
117
117
|
import { metadata as fileTypeIconMetadata } from '@atlaskit/icon-file-type';
|
|
118
118
|
`,
|
|
119
|
-
|
|
119
|
+
`
|
|
120
120
|
import metadata from '@atlaskit/icon/metadata';
|
|
121
121
|
import { metadata as objectIconMetadata } from '@atlaskit/icon-object';
|
|
122
122
|
import { metadata as fileTypeIconMetadata } from '@atlaskit/icon-file-type';
|
|
123
123
|
`,
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
'should work as expected on a real-world case',
|
|
125
|
+
);
|
|
126
126
|
});
|
|
@@ -7,8 +7,13 @@ exports.default = exports.Icon = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _react2 = require("@emotion/react");
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
|
+
/**
|
|
11
|
+
* @jsxRuntime classic
|
|
12
|
+
*/
|
|
10
13
|
/** @jsx jsx */
|
|
11
14
|
|
|
15
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
|
+
|
|
12
17
|
/**
|
|
13
18
|
* We are hiding this props from consumers as it's reserved
|
|
14
19
|
* for use by Icon Tile.
|
|
@@ -22,7 +27,7 @@ var commonSVGStyles = (0, _react2.css)({
|
|
|
22
27
|
* We have to initially set stop-color to inherit (either via DOM attribute or an initial CSS
|
|
23
28
|
* rule) and then override it with currentColor for the color changes to be picked up.
|
|
24
29
|
*/
|
|
25
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
30
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
26
31
|
stop: {
|
|
27
32
|
stopColor: 'currentColor'
|
|
28
33
|
}
|
|
@@ -5,8 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = IconTile;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
+
/**
|
|
9
|
+
* @jsxRuntime classic
|
|
10
|
+
*/
|
|
8
11
|
/** @jsx jsx */
|
|
9
12
|
|
|
13
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
|
+
|
|
10
15
|
var sizeMap = {
|
|
11
16
|
'16': (0, _react.css)({
|
|
12
17
|
width: '16px',
|
|
@@ -12,7 +12,9 @@ var _react2 = require("@emotion/react");
|
|
|
12
12
|
var _utils = require("./utils");
|
|
13
13
|
var _styles = require("./styles");
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
16
|
+
* @jsxRuntime classic
|
|
17
|
+
*/ /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
18
|
/**
|
|
17
19
|
* We are hiding these props from consumers as they're used to
|
|
18
20
|
* hack around icon sizing specifically for icon-file-type.
|
|
@@ -22,7 +24,7 @@ var iconStyles = (0, _react2.css)({
|
|
|
22
24
|
display: 'inline-block',
|
|
23
25
|
flexShrink: 0,
|
|
24
26
|
lineHeight: 1,
|
|
25
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
26
28
|
'> svg': _objectSpread(_objectSpread({}, _styles.commonSVGStyles), {}, {
|
|
27
29
|
maxWidth: '100%',
|
|
28
30
|
maxHeight: '100%',
|
|
@@ -36,7 +38,7 @@ var iconStyles = (0, _react2.css)({
|
|
|
36
38
|
*/
|
|
37
39
|
var baseHcmStyles = (0, _react2.css)({
|
|
38
40
|
'@media screen and (forced-colors: active)': {
|
|
39
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
41
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
40
42
|
'> svg': {
|
|
41
43
|
filter: 'grayscale(1)',
|
|
42
44
|
'--icon-primary-color': 'CanvasText',
|
|
@@ -47,7 +49,7 @@ var baseHcmStyles = (0, _react2.css)({
|
|
|
47
49
|
});
|
|
48
50
|
var primaryEqualsSecondaryHcmStyles = (0, _react2.css)({
|
|
49
51
|
'@media screen and (forced-colors: active)': {
|
|
50
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
52
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
51
53
|
'> svg': {
|
|
52
54
|
// if the primaryColor is the same as the secondaryColor we
|
|
53
55
|
// set the --icon-primary-color to Canvas
|
|
@@ -58,7 +60,7 @@ var primaryEqualsSecondaryHcmStyles = (0, _react2.css)({
|
|
|
58
60
|
});
|
|
59
61
|
var secondaryTransparentHcmStyles = (0, _react2.css)({
|
|
60
62
|
'@media screen and (forced-colors: active)': {
|
|
61
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
63
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
62
64
|
'> svg': {
|
|
63
65
|
'--icon-secondary-color': 'transparent' // background
|
|
64
66
|
}
|
|
@@ -108,7 +110,9 @@ var Icon = exports.Icon = /*#__PURE__*/(0, _react.memo)(function Icon(props) {
|
|
|
108
110
|
,
|
|
109
111
|
style: {
|
|
110
112
|
'--icon-primary-color': primaryColor,
|
|
113
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
111
114
|
'--icon-secondary-color': secondaryColor || (0, _utils.getBackground)()
|
|
115
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
112
116
|
}
|
|
113
117
|
}, glyphProps, {
|
|
114
118
|
css: [iconStyles, baseHcmStyles, primaryColor === secondaryColor && primaryEqualsSecondaryHcmStyles, secondaryColor === 'transparent' && secondaryTransparentHcmStyles,
|
|
@@ -116,10 +120,13 @@ var Icon = exports.Icon = /*#__PURE__*/(0, _react.memo)(function Icon(props) {
|
|
|
116
120
|
// We could then simplify how common styles are dealt with simply by encapsulating them
|
|
117
121
|
// at their appropriate level and/or having a singular approach to css variables in the package
|
|
118
122
|
dimensions &&
|
|
119
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
123
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
120
124
|
(0, _react2.css)({
|
|
125
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
121
126
|
width: dimensions.width,
|
|
127
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
122
128
|
height: dimensions.height,
|
|
129
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
123
130
|
'> svg': dimensions
|
|
124
131
|
})]
|
|
125
132
|
}));
|