@atlaskit/icon 32.0.1 → 32.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/icon
2
2
 
3
+ ## 32.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`5e06fddfce409`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5e06fddfce409) -
8
+ Rename codemod to `next-icon-spacing-to-flex-primitive` (now discoverable via
9
+ `npx @atlaskit/codemod-cli`) and update `no-icon-spacing-prop` ESLint rule to generate `Flex`
10
+ wrapper instead of `Box`.
11
+
3
12
  ## 32.0.1
4
13
 
5
14
  ### Patch Changes
@@ -1,14 +1,14 @@
1
- import type { API, ASTPath, Collection, default as core, FileInfo, JSXElement } from 'jscodeshift';
1
+ import type { API, ASTPath, Collection, FileInfo, JSXElement, default as core } from 'jscodeshift';
2
2
 
3
3
  const ICON_PACKAGES = ['@atlaskit/icon/core', '@atlaskit/icon-lab/core'];
4
- const BOX_COMPILED_PACKAGE = '@atlaskit/primitives/compiled';
5
- const BOX_NON_COMPILED_PACKAGE = '@atlaskit/primitives';
4
+ const FLEX_COMPILED_PACKAGE = '@atlaskit/primitives/compiled';
5
+ const FLEX_NON_COMPILED_PACKAGE = '@atlaskit/primitives';
6
6
  const TOKEN_PACKAGE = '@atlaskit/tokens';
7
7
  const CSS_PACKAGE = '@atlaskit/css';
8
8
  const CSSMAP_VARIABLE_NAME = 'iconSpacingStyles';
9
9
 
10
10
  /**
11
- * Spacing → Box padding token mapping.
11
+ * Spacing → Flex padding token mapping.
12
12
  *
13
13
  * medium/unspecified:
14
14
  * compact → space.050 (4px)
@@ -44,8 +44,7 @@ function getIconImportSpecifiers(j: core.JSCodeshift, source: Collection<any>):
44
44
  .find(j.ImportDeclaration)
45
45
  .filter(
46
46
  (path) =>
47
- typeof path.node.source.value === 'string' &&
48
- path.node.source.value.startsWith(pkg),
47
+ typeof path.node.source.value === 'string' && path.node.source.value.startsWith(pkg),
49
48
  )
50
49
  .forEach((importDecl) => {
51
50
  for (const specifier of importDecl.value.specifiers || []) {
@@ -68,38 +67,38 @@ function ensureNamedImport(j: core.JSCodeshift, specifiers: any[], name: string)
68
67
  }
69
68
 
70
69
  /**
71
- * Ensures `Box` is imported from `@atlaskit/primitives/compiled`.
72
- * - If `/compiled` already exists → add `Box` if missing
73
- * - If `@atlaskit/primitives` (non-compiled) exists → migrate path to `/compiled`, add `Box`
70
+ * Ensures `Flex` is imported from `@atlaskit/primitives/compiled`.
71
+ * - If `/compiled` already exists → add `Flex` if missing
72
+ * - If `@atlaskit/primitives` (non-compiled) exists → migrate path to `/compiled`, add `Flex`
74
73
  * - Otherwise → insert new import
75
74
  */
76
- function insertBoxImport(j: core.JSCodeshift, source: Collection<any>): void {
75
+ function insertFlexImport(j: core.JSCodeshift, source: Collection<any>): void {
77
76
  const compiledImports = source
78
77
  .find(j.ImportDeclaration)
79
- .filter((path) => path.node.source.value === BOX_COMPILED_PACKAGE);
78
+ .filter((path) => path.node.source.value === FLEX_COMPILED_PACKAGE);
80
79
 
81
80
  if (compiledImports.length > 0) {
82
81
  compiledImports.forEach((path) => {
83
- ensureNamedImport(j, path.node.specifiers || [], 'Box');
82
+ ensureNamedImport(j, path.node.specifiers || [], 'Flex');
84
83
  });
85
84
  return;
86
85
  }
87
86
 
88
87
  const nonCompiledImports = source
89
88
  .find(j.ImportDeclaration)
90
- .filter((path) => path.node.source.value === BOX_NON_COMPILED_PACKAGE);
89
+ .filter((path) => path.node.source.value === FLEX_NON_COMPILED_PACKAGE);
91
90
 
92
91
  if (nonCompiledImports.length > 0) {
93
92
  nonCompiledImports.forEach((path) => {
94
- path.node.source = j.stringLiteral(BOX_COMPILED_PACKAGE);
95
- ensureNamedImport(j, path.node.specifiers || [], 'Box');
93
+ path.node.source = j.stringLiteral(FLEX_COMPILED_PACKAGE);
94
+ ensureNamedImport(j, path.node.specifiers || [], 'Flex');
96
95
  });
97
96
  return;
98
97
  }
99
98
 
100
99
  const newImport = j.importDeclaration(
101
- [j.importSpecifier(j.identifier('Box'))],
102
- j.stringLiteral(BOX_COMPILED_PACKAGE),
100
+ [j.importSpecifier(j.identifier('Flex'))],
101
+ j.stringLiteral(FLEX_COMPILED_PACKAGE),
103
102
  );
104
103
  source.get().node.program.body.unshift(newImport);
105
104
  }
@@ -165,10 +164,7 @@ function insertOrUpdateCssMapVariable(
165
164
  // Check if iconSpacingStyles already exists
166
165
  const existing = source.find(j.VariableDeclaration).filter((path) => {
167
166
  const decl = path.node.declarations[0];
168
- return (
169
- decl?.type === 'VariableDeclarator' &&
170
- (decl.id as any)?.name === CSSMAP_VARIABLE_NAME
171
- );
167
+ return decl?.type === 'VariableDeclarator' && (decl.id as any)?.name === CSSMAP_VARIABLE_NAME;
172
168
  });
173
169
 
174
170
  if (existing.length > 0) {
@@ -176,14 +172,16 @@ function insertOrUpdateCssMapVariable(
176
172
  existing.forEach((path) => {
177
173
  const decl = path.node.declarations[0] as any;
178
174
  const cssMapCall = decl?.init;
179
- if (cssMapCall?.type !== 'CallExpression') return;
175
+ if (cssMapCall?.type !== 'CallExpression') {
176
+ return;
177
+ }
180
178
  const objExpr = cssMapCall.arguments[0];
181
- if (objExpr?.type !== 'ObjectExpression') return;
179
+ if (objExpr?.type !== 'ObjectExpression') {
180
+ return;
181
+ }
182
182
 
183
183
  const existingKeys = new Set(
184
- objExpr.properties
185
- .filter((p: any) => p.key)
186
- .map((p: any) => p.key.name || p.key.value),
184
+ objExpr.properties.filter((p: any) => p.key).map((p: any) => p.key.name || p.key.value),
187
185
  );
188
186
 
189
187
  for (const paddingToken of Array.from(paddingTokens).sort()) {
@@ -195,10 +193,8 @@ function insertOrUpdateCssMapVariable(
195
193
  j.objectProperty(
196
194
  j.identifier(key),
197
195
  j.objectExpression([
198
- j.objectProperty(j.identifier('paddingTop'), tokenCall()),
199
- j.objectProperty(j.identifier('paddingRight'), tokenCall()),
200
- j.objectProperty(j.identifier('paddingBottom'), tokenCall()),
201
- j.objectProperty(j.identifier('paddingLeft'), tokenCall()),
196
+ j.objectProperty(j.identifier('paddingBlock'), tokenCall()),
197
+ j.objectProperty(j.identifier('paddingInline'), tokenCall()),
202
198
  ]),
203
199
  ),
204
200
  );
@@ -217,17 +213,13 @@ function insertOrUpdateCssMapVariable(
217
213
  return j.objectProperty(
218
214
  j.identifier(getCssMapKey(paddingToken)),
219
215
  j.objectExpression([
220
- j.objectProperty(j.identifier('paddingTop'), tokenCall()),
221
- j.objectProperty(j.identifier('paddingRight'), tokenCall()),
222
- j.objectProperty(j.identifier('paddingBottom'), tokenCall()),
223
- j.objectProperty(j.identifier('paddingLeft'), tokenCall()),
216
+ j.objectProperty(j.identifier('paddingBlock'), tokenCall()),
217
+ j.objectProperty(j.identifier('paddingInline'), tokenCall()),
224
218
  ]),
225
219
  );
226
220
  });
227
221
 
228
- const cssMapCall = j.callExpression(j.identifier('cssMap'), [
229
- j.objectExpression(properties),
230
- ]);
222
+ const cssMapCall = j.callExpression(j.identifier('cssMap'), [j.objectExpression(properties)]);
231
223
 
232
224
  const variableDecl = j.variableDeclaration('const', [
233
225
  j.variableDeclarator(j.identifier(CSSMAP_VARIABLE_NAME), cssMapCall),
@@ -246,28 +238,29 @@ function insertOrUpdateCssMapVariable(
246
238
  }
247
239
 
248
240
  /**
249
- * Wraps a JSXElement in <Box xcss={iconSpacingStyles.spaceXXX}>...</Box>.
241
+ * Wraps a JSXElement in <Flex xcss={iconSpacingStyles.spaceXXX}>...</Flex>.
250
242
  */
251
- function wrapWithBox(j: core.JSCodeshift, iconElement: JSXElement, paddingToken: string) {
243
+ function wrapWithFlex(j: core.JSCodeshift, iconElement: JSXElement, paddingToken: string) {
252
244
  const key = getCssMapKey(paddingToken);
253
245
  return j.jsxElement(
254
- j.jsxOpeningElement(j.jsxIdentifier('Box'), [
246
+ j.jsxOpeningElement(j.jsxIdentifier('Flex'), [
255
247
  j.jsxAttribute(
256
248
  j.jsxIdentifier('xcss'),
257
249
  j.jsxExpressionContainer(
258
- j.memberExpression(
259
- j.identifier(CSSMAP_VARIABLE_NAME),
260
- j.identifier(key),
261
- ),
250
+ j.memberExpression(j.identifier(CSSMAP_VARIABLE_NAME), j.identifier(key)),
262
251
  ),
263
252
  ),
264
253
  ]),
265
- j.jsxClosingElement(j.jsxIdentifier('Box')),
254
+ j.jsxClosingElement(j.jsxIdentifier('Flex')),
266
255
  [iconElement],
267
256
  );
268
257
  }
269
258
 
270
- function addEslintDisableComment(j: core.JSCodeshift, path: ASTPath<JSXElement>, reason: string): void {
259
+ function addEslintDisableComment(
260
+ j: core.JSCodeshift,
261
+ path: ASTPath<JSXElement>,
262
+ reason: string,
263
+ ): void {
271
264
  const comment = j.line(
272
265
  ` eslint-disable-next-line @atlaskit/design-system/no-icon-spacing-prop -- TODO: ${reason}`,
273
266
  );
@@ -279,7 +272,9 @@ function getStaticPropValue(attributes: any[], propName: string): string | null
279
272
  const prop = attributes.find(
280
273
  (attr: any) => attr.type === 'JSXAttribute' && attr.name?.name === propName,
281
274
  );
282
- if (!prop) return null;
275
+ if (!prop) {
276
+ return null;
277
+ }
283
278
  if (prop.value?.type === 'StringLiteral' || prop.value?.type === 'Literal') {
284
279
  return prop.value.value;
285
280
  }
@@ -294,7 +289,9 @@ function isSpacingDynamic(attributes: any[]): boolean {
294
289
  const prop = attributes.find(
295
290
  (attr: any) => attr.type === 'JSXAttribute' && attr.name?.name === 'spacing',
296
291
  );
297
- if (!prop) return false;
292
+ if (!prop) {
293
+ return false;
294
+ }
298
295
  return prop.value?.type !== 'StringLiteral' && prop.value?.type !== 'Literal';
299
296
  }
300
297
 
@@ -364,18 +361,26 @@ export default function transformer(file: FileInfo, api: API): string {
364
361
  }
365
362
 
366
363
  const paddingTokensUsed = new Set<string>();
367
- let needsBoxImport = false;
364
+ let needsFlexImport = false;
368
365
 
369
366
  iconJSXWithSpacing.forEach((path) => {
370
367
  const attrs = path.value.openingElement.attributes || [];
371
368
 
372
369
  if (hasSpreadAttributes(attrs)) {
373
- addEslintDisableComment(j, path, 'Manually migrate spacing prop to Box primitive (spread props detected)');
370
+ addEslintDisableComment(
371
+ j,
372
+ path,
373
+ 'Manually migrate spacing prop to Flex primitive (spread props detected)',
374
+ );
374
375
  return;
375
376
  }
376
377
 
377
378
  if (isSpacingDynamic(attrs)) {
378
- addEslintDisableComment(j, path, 'Manually migrate spacing prop to Box primitive (dynamic spacing value detected)');
379
+ addEslintDisableComment(
380
+ j,
381
+ path,
382
+ 'Manually migrate spacing prop to Flex primitive (dynamic spacing value detected)',
383
+ );
379
384
  return;
380
385
  }
381
386
 
@@ -391,7 +396,11 @@ export default function transformer(file: FileInfo, api: API): string {
391
396
  const paddingToken = SPACING_TO_PADDING[sizeKey]?.[spacingValue];
392
397
 
393
398
  if (!paddingToken) {
394
- addEslintDisableComment(j, path, `Manually migrate spacing="${spacingValue}" prop to Box primitive (unknown spacing value)`);
399
+ addEslintDisableComment(
400
+ j,
401
+ path,
402
+ `Manually migrate spacing="${spacingValue}" prop to Flex primitive (unknown spacing value)`,
403
+ );
395
404
  return;
396
405
  }
397
406
 
@@ -399,18 +408,18 @@ export default function transformer(file: FileInfo, api: API): string {
399
408
  (path.value as any).extra.parenthesized = false;
400
409
  }
401
410
 
402
- const wrappedElement = wrapWithBox(j, path.value, paddingToken);
411
+ const wrappedElement = wrapWithFlex(j, path.value, paddingToken);
403
412
  replaceWithWrapped(j, path, wrappedElement);
404
413
 
405
- needsBoxImport = true;
414
+ needsFlexImport = true;
406
415
  paddingTokensUsed.add(paddingToken);
407
416
  });
408
417
 
409
- if (needsBoxImport) {
418
+ if (needsFlexImport) {
410
419
  // Insert in reverse order since each unshift prepends — last inserted appears first
411
420
  // Desired order: @atlaskit/css, @atlaskit/primitives/compiled, @atlaskit/tokens
412
421
  insertTokenImport(j, source);
413
- insertBoxImport(j, source);
422
+ insertFlexImport(j, source);
414
423
  insertCssMapImport(j, source);
415
424
  insertOrUpdateCssMapVariable(j, source, paddingTokensUsed);
416
425
  }
@@ -1,35 +1,29 @@
1
- import transformer from '../icon-spacing-to-box-primitive';
1
+ import transformer from '../32.0';
2
2
 
3
3
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
4
4
 
5
5
  const space050Block = `const iconSpacingStyles = cssMap({
6
6
  space050: {
7
- paddingTop: token("space.050"),
8
- paddingRight: token("space.050"),
9
- paddingBottom: token("space.050"),
10
- paddingLeft: token("space.050")
7
+ paddingBlock: token("space.050"),
8
+ paddingInline: token("space.050")
11
9
  }
12
10
  });`;
13
11
 
14
12
  const space075Block = `const iconSpacingStyles = cssMap({
15
13
  space075: {
16
- paddingTop: token("space.075"),
17
- paddingRight: token("space.075"),
18
- paddingBottom: token("space.075"),
19
- paddingLeft: token("space.075")
14
+ paddingBlock: token("space.075"),
15
+ paddingInline: token("space.075")
20
16
  }
21
17
  });`;
22
18
 
23
19
  const space025Block = `const iconSpacingStyles = cssMap({
24
20
  space025: {
25
- paddingTop: token("space.025"),
26
- paddingRight: token("space.025"),
27
- paddingBottom: token("space.025"),
28
- paddingLeft: token("space.025")
21
+ paddingBlock: token("space.025"),
22
+ paddingInline: token("space.025")
29
23
  }
30
24
  });`;
31
25
 
32
- describe('Migrate spacing prop to Box primitive', () => {
26
+ describe('Migrate spacing prop to Flex primitive', () => {
33
27
  defineInlineTest(
34
28
  { default: transformer, parser: 'tsx' },
35
29
  {},
@@ -37,7 +31,7 @@ describe('Migrate spacing prop to Box primitive', () => {
37
31
  const App = () => <AddIcon label="" spacing="none" />;`,
38
32
  `import AddIcon from '@atlaskit/icon/core/add';
39
33
  const App = () => <AddIcon label="" />;`,
40
- 'should remove spacing="none" with no Box wrap',
34
+ 'should remove spacing="none" with no Flex wrap',
41
35
  );
42
36
 
43
37
  defineInlineTest(
@@ -46,14 +40,14 @@ const App = () => <AddIcon label="" />;`,
46
40
  `import AddIcon from '@atlaskit/icon/core/add';
47
41
  const App = () => <AddIcon label="" spacing="spacious" />;`,
48
42
  `import { cssMap } from "@atlaskit/css";
49
- import { Box } from "@atlaskit/primitives/compiled";
43
+ import { Flex } from "@atlaskit/primitives/compiled";
50
44
  import { token } from "@atlaskit/tokens";
51
45
  import AddIcon from '@atlaskit/icon/core/add';
52
46
 
53
47
  ${space050Block}
54
48
 
55
- const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></Box>;`,
56
- 'should wrap medium icon with spacing="spacious" in Box with space050',
49
+ const App = () => <Flex xcss={iconSpacingStyles.space050}><AddIcon label="" /></Flex>;`,
50
+ 'should wrap medium icon with spacing="spacious" in Flex with space050',
57
51
  );
58
52
 
59
53
  defineInlineTest(
@@ -62,14 +56,14 @@ const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></B
62
56
  `import AddIcon from '@atlaskit/icon/core/add';
63
57
  const App = () => <AddIcon label="" spacing="compact" />;`,
64
58
  `import { cssMap } from "@atlaskit/css";
65
- import { Box } from "@atlaskit/primitives/compiled";
59
+ import { Flex } from "@atlaskit/primitives/compiled";
66
60
  import { token } from "@atlaskit/tokens";
67
61
  import AddIcon from '@atlaskit/icon/core/add';
68
62
 
69
63
  ${space050Block}
70
64
 
71
- const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></Box>;`,
72
- 'should wrap medium icon with spacing="compact" in Box with space050',
65
+ const App = () => <Flex xcss={iconSpacingStyles.space050}><AddIcon label="" /></Flex>;`,
66
+ 'should wrap medium icon with spacing="compact" in Flex with space050',
73
67
  );
74
68
 
75
69
  defineInlineTest(
@@ -78,14 +72,14 @@ const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></B
78
72
  `import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
79
73
  const App = () => <ChevronRightIcon label="" size="small" spacing="spacious" />;`,
80
74
  `import { cssMap } from "@atlaskit/css";
81
- import { Box } from "@atlaskit/primitives/compiled";
75
+ import { Flex } from "@atlaskit/primitives/compiled";
82
76
  import { token } from "@atlaskit/tokens";
83
77
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
84
78
 
85
79
  ${space075Block}
86
80
 
87
- const App = () => <Box xcss={iconSpacingStyles.space075}><ChevronRightIcon label="" size="small" /></Box>;`,
88
- 'should wrap small icon with spacing="spacious" in Box with space075',
81
+ const App = () => <Flex xcss={iconSpacingStyles.space075}><ChevronRightIcon label="" size="small" /></Flex>;`,
82
+ 'should wrap small icon with spacing="spacious" in Flex with space075',
89
83
  );
90
84
 
91
85
  defineInlineTest(
@@ -94,14 +88,14 @@ const App = () => <Box xcss={iconSpacingStyles.space075}><ChevronRightIcon label
94
88
  `import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
95
89
  const App = () => <ChevronRightIcon label="" size="small" spacing="compact" />;`,
96
90
  `import { cssMap } from "@atlaskit/css";
97
- import { Box } from "@atlaskit/primitives/compiled";
91
+ import { Flex } from "@atlaskit/primitives/compiled";
98
92
  import { token } from "@atlaskit/tokens";
99
93
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
100
94
 
101
95
  ${space025Block}
102
96
 
103
- const App = () => <Box xcss={iconSpacingStyles.space025}><ChevronRightIcon label="" size="small" /></Box>;`,
104
- 'should wrap small icon with spacing="compact" in Box with space025',
97
+ const App = () => <Flex xcss={iconSpacingStyles.space025}><ChevronRightIcon label="" size="small" /></Flex>;`,
98
+ 'should wrap small icon with spacing="compact" in Flex with space025',
105
99
  );
106
100
 
107
101
  defineInlineTest(
@@ -110,13 +104,13 @@ const App = () => <Box xcss={iconSpacingStyles.space025}><ChevronRightIcon label
110
104
  `import MoreIcon from '@atlaskit/icon/core/more';
111
105
  const App = () => <Button iconBefore={<MoreIcon label="" spacing="spacious" />} />;`,
112
106
  `import { cssMap } from "@atlaskit/css";
113
- import { Box } from "@atlaskit/primitives/compiled";
107
+ import { Flex } from "@atlaskit/primitives/compiled";
114
108
  import { token } from "@atlaskit/tokens";
115
109
  import MoreIcon from '@atlaskit/icon/core/more';
116
110
 
117
111
  ${space050Block}
118
112
 
119
- const App = () => <Button iconBefore={<Box xcss={iconSpacingStyles.space050}><MoreIcon label="" /></Box>} />;`,
113
+ const App = () => <Button iconBefore={<Flex xcss={iconSpacingStyles.space050}><MoreIcon label="" /></Flex>} />;`,
120
114
  'should wrap icon with spacing prop inside a component slot',
121
115
  );
122
116
 
@@ -126,13 +120,13 @@ const App = () => <Button iconBefore={<Box xcss={iconSpacingStyles.space050}><Mo
126
120
  `import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
127
121
  const App = () => <DropdownMenu iconAfter={<ChevronDownIcon label="" size="small" spacing="spacious" />} />;`,
128
122
  `import { cssMap } from "@atlaskit/css";
129
- import { Box } from "@atlaskit/primitives/compiled";
123
+ import { Flex } from "@atlaskit/primitives/compiled";
130
124
  import { token } from "@atlaskit/tokens";
131
125
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
132
126
 
133
127
  ${space075Block}
134
128
 
135
- const App = () => <DropdownMenu iconAfter={<Box xcss={iconSpacingStyles.space075}><ChevronDownIcon label="" size="small" /></Box>} />;`,
129
+ const App = () => <DropdownMenu iconAfter={<Flex xcss={iconSpacingStyles.space075}><ChevronDownIcon label="" size="small" /></Flex>} />;`,
136
130
  'should wrap small icon with spacing prop inside a component slot',
137
131
  );
138
132
 
@@ -142,7 +136,7 @@ const App = () => <DropdownMenu iconAfter={<Box xcss={iconSpacingStyles.space075
142
136
  `import AddIcon from '@atlaskit/icon/core/add';
143
137
  const App = (props: any) => <AddIcon {...props} spacing="spacious" label="" />;`,
144
138
  `import AddIcon from '@atlaskit/icon/core/add';
145
- const App = (props: any) => // eslint-disable-next-line @atlaskit/design-system/no-icon-spacing-prop -- TODO: Manually migrate spacing prop to Box primitive (spread props detected)
139
+ const App = (props: any) => // eslint-disable-next-line @atlaskit/design-system/no-icon-spacing-prop -- TODO: Manually migrate spacing prop to Flex primitive (spread props detected)
146
140
  <AddIcon {...props} spacing="spacious" label="" />;`,
147
141
  'should add eslint-disable comment inline and skip when spread props are present',
148
142
  );
@@ -153,7 +147,7 @@ const App = (props: any) => // eslint-disable-next-line @atlaskit/design-system/
153
147
  `import AddIcon from '@atlaskit/icon/core/add';
154
148
  const App = ({ spacing }: any) => <AddIcon label="" spacing={spacing} />;`,
155
149
  `import AddIcon from '@atlaskit/icon/core/add';
156
- const App = ({ spacing }: any) => // eslint-disable-next-line @atlaskit/design-system/no-icon-spacing-prop -- TODO: Manually migrate spacing prop to Box primitive (dynamic spacing value detected)
150
+ const App = ({ spacing }: any) => // eslint-disable-next-line @atlaskit/design-system/no-icon-spacing-prop -- TODO: Manually migrate spacing prop to Flex primitive (dynamic spacing value detected)
157
151
  <AddIcon label="" spacing={spacing} />;`,
158
152
  'should add eslint-disable comment inline and skip when spacing is a dynamic expression',
159
153
  );
@@ -182,31 +176,27 @@ const App = () => (
182
176
  </>
183
177
  );`,
184
178
  `import { cssMap } from "@atlaskit/css";
185
- import { Box } from "@atlaskit/primitives/compiled";
179
+ import { Flex } from "@atlaskit/primitives/compiled";
186
180
  import { token } from "@atlaskit/tokens";
187
181
  import AddIcon from '@atlaskit/icon/core/add';
188
182
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
189
183
 
190
184
  const iconSpacingStyles = cssMap({
191
185
  space050: {
192
- paddingTop: token("space.050"),
193
- paddingRight: token("space.050"),
194
- paddingBottom: token("space.050"),
195
- paddingLeft: token("space.050")
186
+ paddingBlock: token("space.050"),
187
+ paddingInline: token("space.050")
196
188
  },
197
189
 
198
190
  space075: {
199
- paddingTop: token("space.075"),
200
- paddingRight: token("space.075"),
201
- paddingBottom: token("space.075"),
202
- paddingLeft: token("space.075")
191
+ paddingBlock: token("space.075"),
192
+ paddingInline: token("space.075")
203
193
  }
204
194
  });
205
195
 
206
196
  const App = () => (
207
197
  <>
208
- <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></Box>
209
- <Box xcss={iconSpacingStyles.space075}><ChevronRightIcon label="" size="small" /></Box>
198
+ <Flex xcss={iconSpacingStyles.space050}><AddIcon label="" /></Flex>
199
+ <Flex xcss={iconSpacingStyles.space075}><ChevronRightIcon label="" size="small" /></Flex>
210
200
  <AddIcon label="" />
211
201
  </>
212
202
  );`,
@@ -221,47 +211,47 @@ import AddIcon from '@atlaskit/icon/core/add';
221
211
  const App = () => <AddIcon label="" spacing="spacious" />;`,
222
212
  `import { cssMap } from "@atlaskit/css";
223
213
  import { token } from "@atlaskit/tokens";
224
- import { Inline, Box } from '@atlaskit/primitives/compiled';
214
+ import { Inline, Flex } from '@atlaskit/primitives/compiled';
225
215
  import AddIcon from '@atlaskit/icon/core/add';
226
216
 
227
217
  ${space050Block}
228
218
 
229
- const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></Box>;`,
230
- 'should add Box to existing @atlaskit/primitives/compiled import',
219
+ const App = () => <Flex xcss={iconSpacingStyles.space050}><AddIcon label="" /></Flex>;`,
220
+ 'should add Flex to existing @atlaskit/primitives/compiled import',
231
221
  );
232
222
 
233
223
  defineInlineTest(
234
224
  { default: transformer, parser: 'tsx' },
235
225
  {},
236
- `import { Box } from '@atlaskit/primitives';
226
+ `import { Flex } from '@atlaskit/primitives';
237
227
  import AddIcon from '@atlaskit/icon/core/add';
238
228
  const App = () => <AddIcon label="" spacing="spacious" />;`,
239
229
  `import { cssMap } from "@atlaskit/css";
240
230
  import { token } from "@atlaskit/tokens";
241
- import { Box } from "@atlaskit/primitives/compiled";
231
+ import { Flex } from "@atlaskit/primitives/compiled";
242
232
  import AddIcon from '@atlaskit/icon/core/add';
243
233
 
244
234
  ${space050Block}
245
235
 
246
- const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></Box>;`,
236
+ const App = () => <Flex xcss={iconSpacingStyles.space050}><AddIcon label="" /></Flex>;`,
247
237
  'should update @atlaskit/primitives to @atlaskit/primitives/compiled',
248
238
  );
249
239
 
250
240
  defineInlineTest(
251
241
  { default: transformer, parser: 'tsx' },
252
242
  {},
253
- `import { Box } from '@atlaskit/primitives/compiled';
243
+ `import { Flex } from '@atlaskit/primitives/compiled';
254
244
  import AddIcon from '@atlaskit/icon/core/add';
255
245
  const App = () => <AddIcon label="" spacing="spacious" />;`,
256
246
  `import { cssMap } from "@atlaskit/css";
257
247
  import { token } from "@atlaskit/tokens";
258
- import { Box } from '@atlaskit/primitives/compiled';
248
+ import { Flex } from '@atlaskit/primitives/compiled';
259
249
  import AddIcon from '@atlaskit/icon/core/add';
260
250
 
261
251
  ${space050Block}
262
252
 
263
- const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></Box>;`,
264
- 'should keep existing Box import from compiled unchanged',
253
+ const App = () => <Flex xcss={iconSpacingStyles.space050}><AddIcon label="" /></Flex>;`,
254
+ 'should keep existing Flex import from compiled unchanged',
265
255
  );
266
256
 
267
257
  defineInlineTest(
@@ -272,13 +262,13 @@ import AddIcon from '@atlaskit/icon/core/add';
272
262
  const App = () => <AddIcon label="" spacing="spacious" />;`,
273
263
  `import { cssMap } from "@atlaskit/css";
274
264
  import { token } from "@atlaskit/tokens";
275
- import { Inline, Box } from "@atlaskit/primitives/compiled";
265
+ import { Inline, Flex } from "@atlaskit/primitives/compiled";
276
266
  import AddIcon from '@atlaskit/icon/core/add';
277
267
 
278
268
  ${space050Block}
279
269
 
280
- const App = () => <Box xcss={iconSpacingStyles.space050}><AddIcon label="" /></Box>;`,
281
- 'should add Box and update @atlaskit/primitives to @atlaskit/primitives/compiled',
270
+ const App = () => <Flex xcss={iconSpacingStyles.space050}><AddIcon label="" /></Flex>;`,
271
+ 'should add Flex and update @atlaskit/primitives to @atlaskit/primitives/compiled',
282
272
  );
283
273
 
284
274
  defineInlineTest(
@@ -290,16 +280,16 @@ const IconBefore = (
290
280
  <MoreIcon spacing="spacious" label="More" />
291
281
  );`,
292
282
  `import { cssMap } from "@atlaskit/css";
293
- import { Box } from "@atlaskit/primitives/compiled";
283
+ import { Flex } from "@atlaskit/primitives/compiled";
294
284
  import { token } from "@atlaskit/tokens";
295
285
  import MoreIcon from '@atlaskit/icon/core/more';
296
286
 
297
287
  ${space050Block}
298
288
 
299
289
  const IconBefore = (
300
- <Box xcss={iconSpacingStyles.space050}><MoreIcon label="More" /></Box>
290
+ <Flex xcss={iconSpacingStyles.space050}><MoreIcon label="More" /></Flex>
301
291
  );`,
302
- 'should not produce extra parentheses inside Box when icon is in a parenthesized expression',
292
+ 'should not produce extra parentheses inside Flex when icon is in a parenthesized expression',
303
293
  );
304
294
 
305
295
  defineInlineTest(
@@ -308,13 +298,13 @@ const IconBefore = (
308
298
  `import BitbucketBranchIcon from '@atlaskit/icon-lab/core/bitbucket-branch';
309
299
  const App = () => <BitbucketBranchIcon label="" spacing="spacious" />;`,
310
300
  `import { cssMap } from "@atlaskit/css";
311
- import { Box } from "@atlaskit/primitives/compiled";
301
+ import { Flex } from "@atlaskit/primitives/compiled";
312
302
  import { token } from "@atlaskit/tokens";
313
303
  import BitbucketBranchIcon from '@atlaskit/icon-lab/core/bitbucket-branch';
314
304
 
315
305
  ${space050Block}
316
306
 
317
- const App = () => <Box xcss={iconSpacingStyles.space050}><BitbucketBranchIcon label="" /></Box>;`,
307
+ const App = () => <Flex xcss={iconSpacingStyles.space050}><BitbucketBranchIcon label="" /></Flex>;`,
318
308
  'should migrate icon-lab icons',
319
309
  );
320
310
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/icon",
3
- "version": "32.0.1",
3
+ "version": "32.0.2",
4
4
  "description": "An icon is a symbol representing a command, device, directory, or common action.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/button": "^23.10.0",
52
52
  "@atlaskit/code": "^17.4.0",
53
53
  "@atlaskit/css": "^0.19.0",
54
- "@atlaskit/docs": "^11.6.0",
54
+ "@atlaskit/docs": "^11.7.0",
55
55
  "@atlaskit/form": "^15.4.0",
56
56
  "@atlaskit/heading": "^5.3.0",
57
57
  "@atlaskit/icon-file-type": "^7.0.0",