@atlaskit/tabs 16.1.2 → 16.2.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/__perf__/default.tsx +16 -16
  3. package/codemods/13.0.0-lite-mode.tsx +14 -18
  4. package/codemods/__tests__/13.0.0-lite-mode.tsx +44 -44
  5. package/codemods/__tests__/add-id-prop.tsx +13 -13
  6. package/codemods/__tests__/map-tabs-prop.tsx +42 -42
  7. package/codemods/__tests__/on-select-to-on-change.tsx +49 -49
  8. package/codemods/__tests__/remove-components-prop.tsx +14 -14
  9. package/codemods/__tests__/remove-is-selected-test-prop.tsx +14 -14
  10. package/codemods/__tests__/remove-tab-item-tab-content.tsx +7 -7
  11. package/codemods/__tests__/remove-types.tsx +14 -14
  12. package/codemods/__tests__/rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx +36 -38
  13. package/codemods/migrations/add-id-prop.tsx +37 -45
  14. package/codemods/migrations/map-tabs-prop.tsx +143 -164
  15. package/codemods/migrations/on-select-to-on-change.tsx +66 -76
  16. package/codemods/migrations/remove-components-prop.tsx +3 -3
  17. package/codemods/migrations/remove-is-selected-test-prop.tsx +3 -3
  18. package/codemods/migrations/remove-tab-item-tab-content.tsx +19 -22
  19. package/codemods/migrations/remove-types.tsx +32 -32
  20. package/codemods/migrations/rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx +46 -59
  21. package/codemods/utils.tsx +25 -28
  22. package/dist/cjs/components/tab-list.js +5 -0
  23. package/dist/cjs/components/tab-panel.js +5 -0
  24. package/dist/cjs/components/tab.js +4 -0
  25. package/dist/cjs/components/tabs.js +4 -2
  26. package/dist/cjs/internal/styles.js +8 -5
  27. package/dist/es2019/components/tab-list.js +5 -0
  28. package/dist/es2019/components/tab-panel.js +5 -0
  29. package/dist/es2019/components/tab.js +4 -0
  30. package/dist/es2019/components/tabs.js +6 -1
  31. package/dist/es2019/internal/styles.js +9 -4
  32. package/dist/esm/components/tab-list.js +5 -0
  33. package/dist/esm/components/tab-panel.js +5 -0
  34. package/dist/esm/components/tab.js +4 -0
  35. package/dist/esm/components/tabs.js +6 -1
  36. package/dist/esm/internal/styles.js +8 -4
  37. package/dist/types/components/tab.d.ts +3 -0
  38. package/dist/types-ts4.5/components/tab.d.ts +3 -0
  39. package/extract-react-types/tab-attributes.tsx +1 -1
  40. package/extract-react-types/tab-panel-attributes.tsx +1 -1
  41. package/package.json +93 -93
  42. package/report.api.md +40 -42
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/tabs
2
2
 
3
+ ## 16.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#111016](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111016)
8
+ [`d131599730792`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d131599730792) -
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
+
3
16
  ## 16.1.2
4
17
 
5
18
  ### Patch Changes
@@ -18,7 +31,7 @@
18
31
 
19
32
  - [#96791](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/96791)
20
33
  [`d85b0f65d608`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d85b0f65d608) -
21
- Add support for React 18.
34
+ Add support for React 18 in non-strict mode.
22
35
 
23
36
  ## 16.0.0
24
37
 
@@ -3,20 +3,20 @@ import React from 'react';
3
3
  import Tabs, { Tab, TabList, TabPanel } from '../src';
4
4
 
5
5
  export default () => (
6
- <Tabs id="test">
7
- <TabList>
8
- <Tab>Tab 1</Tab>
9
- <Tab>Tab 2</Tab>
10
- <Tab>Tab 3</Tab>
11
- </TabList>
12
- <TabPanel>
13
- <div>One</div>
14
- </TabPanel>
15
- <TabPanel>
16
- <div>Two</div>
17
- </TabPanel>
18
- <TabPanel>
19
- <div>Three</div>
20
- </TabPanel>
21
- </Tabs>
6
+ <Tabs id="test">
7
+ <TabList>
8
+ <Tab>Tab 1</Tab>
9
+ <Tab>Tab 2</Tab>
10
+ <Tab>Tab 3</Tab>
11
+ </TabList>
12
+ <TabPanel>
13
+ <div>One</div>
14
+ </TabPanel>
15
+ <TabPanel>
16
+ <div>Two</div>
17
+ </TabPanel>
18
+ <TabPanel>
19
+ <div>Three</div>
20
+ </TabPanel>
21
+ </Tabs>
22
22
  );
@@ -1,10 +1,7 @@
1
1
  import { type JSCodeshift } from 'jscodeshift';
2
2
  import { type Collection } from 'jscodeshift/src/Collection';
3
3
 
4
- import {
5
- createTransformer,
6
- hasImportDeclaration,
7
- } from '@atlaskit/codemod-utils';
4
+ import { createTransformer, hasImportDeclaration } from '@atlaskit/codemod-utils';
8
5
 
9
6
  import { addIdProp } from './migrations/add-id-prop';
10
7
  import { mapTabsProp, removeTabsProp } from './migrations/map-tabs-prop';
@@ -16,20 +13,19 @@ import { removeTypes } from './migrations/remove-types';
16
13
  import { renameIsContentPersistedToShouldUnmountTabPanelOnChange } from './migrations/rename-is-content-persisted-to-should-unmount-tab-panel-on-change';
17
14
 
18
15
  const transformer = createTransformer(
19
- [
20
- // Note these first 2 must be done first while there is one JSX element for tabs
21
- addIdProp,
22
- renameIsContentPersistedToShouldUnmountTabPanelOnChange,
23
- migrateOnSelectType,
24
- removeTabItemTabContent,
25
- mapTabsProp,
26
- removeTabsProp,
27
- removeComponentsProp,
28
- removeIsSelectedTestProp,
29
- removeTypes,
30
- ],
31
- (j: JSCodeshift, source: Collection<Node>) =>
32
- hasImportDeclaration(j, source, '@atlaskit/tabs'),
16
+ [
17
+ // Note these first 2 must be done first while there is one JSX element for tabs
18
+ addIdProp,
19
+ renameIsContentPersistedToShouldUnmountTabPanelOnChange,
20
+ migrateOnSelectType,
21
+ removeTabItemTabContent,
22
+ mapTabsProp,
23
+ removeTabsProp,
24
+ removeComponentsProp,
25
+ removeIsSelectedTestProp,
26
+ removeTypes,
27
+ ],
28
+ (j: JSCodeshift, source: Collection<Node>) => hasImportDeclaration(j, source, '@atlaskit/tabs'),
33
29
  );
34
30
 
35
31
  export default transformer;
@@ -3,19 +3,19 @@ import transformer from '../13.0.0-lite-mode';
3
3
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
4
4
 
5
5
  describe('all transforms should be applied', () => {
6
- beforeEach(() => {
7
- jest.spyOn(global.Math, 'random').mockReturnValue(0.123456789);
8
- });
9
-
10
- afterEach(() => {
11
- jest.spyOn(global.Math, 'random').mockRestore();
12
- });
13
-
14
- // Note the first 2 are extreme cases, not many usages would have all these use cases
15
- defineInlineTest(
16
- { default: transformer, parser: 'tsx' },
17
- {},
18
- `
6
+ beforeEach(() => {
7
+ jest.spyOn(global.Math, 'random').mockReturnValue(0.123456789);
8
+ });
9
+
10
+ afterEach(() => {
11
+ jest.spyOn(global.Math, 'random').mockRestore();
12
+ });
13
+
14
+ // Note the first 2 are extreme cases, not many usages would have all these use cases
15
+ defineInlineTest(
16
+ { default: transformer, parser: 'tsx' },
17
+ {},
18
+ `
19
19
  import React, { useState } from "react";
20
20
  import Tabs, { TabItem } from "@atlaskit/tabs";
21
21
  import {
@@ -59,7 +59,7 @@ describe('all transforms should be applied', () => {
59
59
  );
60
60
  }
61
61
  `,
62
- `
62
+ `
63
63
  /* TODO: (from codemod) We have added an "id" prop to "Tabs" for accessibility reasons.
64
64
  The codemod has added a random ID but you can add one that makes sense for your use case. */
65
65
  /* TODO: (from codemod)
@@ -133,13 +133,13 @@ describe('all transforms should be applied', () => {
133
133
  );
134
134
  }
135
135
  `,
136
- 'should change usages',
137
- );
136
+ 'should change usages',
137
+ );
138
138
 
139
- defineInlineTest(
140
- { default: transformer, parser: 'tsx' },
141
- {},
142
- `
139
+ defineInlineTest(
140
+ { default: transformer, parser: 'tsx' },
141
+ {},
142
+ `
143
143
  import React, { useState } from "react";
144
144
  import Tabs, { TabItem, TabContent } from "@atlaskit/tabs";
145
145
  import {
@@ -177,7 +177,7 @@ describe('all transforms should be applied', () => {
177
177
  );
178
178
  }
179
179
  `,
180
- `
180
+ `
181
181
  /* TODO: (from codemod) We have added an "id" prop to "Tabs" for accessibility reasons.
182
182
  The codemod has added a random ID but you can add one that makes sense for your use case. */
183
183
  /* TODO: (from codemod)
@@ -256,13 +256,13 @@ describe('all transforms should be applied', () => {
256
256
  );
257
257
  }
258
258
  `,
259
- 'should change usages with different variations of how the props are used',
260
- );
259
+ 'should change usages with different variations of how the props are used',
260
+ );
261
261
 
262
- defineInlineTest(
263
- { default: transformer, parser: 'tsx' },
264
- {},
265
- `
262
+ defineInlineTest(
263
+ { default: transformer, parser: 'tsx' },
264
+ {},
265
+ `
266
266
  import React, { useState } from "react";
267
267
  import Tabs from "@atlaskit/tabs";
268
268
  import {
@@ -300,7 +300,7 @@ describe('all transforms should be applied', () => {
300
300
  );
301
301
  }
302
302
  `,
303
- `
303
+ `
304
304
  /* TODO: (from codemod) We have added an "id" prop to "Tabs" for accessibility reasons.
305
305
  The codemod has added a random ID but you can add one that makes sense for your use case. */
306
306
  /* TODO: (from codemod)
@@ -351,13 +351,13 @@ describe('all transforms should be applied', () => {
351
351
  );
352
352
  }
353
353
  `,
354
- 'should change usages when not using components and isSelectedTest',
355
- );
354
+ 'should change usages when not using components and isSelectedTest',
355
+ );
356
356
 
357
- defineInlineTest(
358
- { default: transformer, parser: 'tsx' },
359
- {},
360
- `
357
+ defineInlineTest(
358
+ { default: transformer, parser: 'tsx' },
359
+ {},
360
+ `
361
361
  import React, { useState } from "react";
362
362
  import Tabs from "@atlaskit/tabs";
363
363
  import {
@@ -386,7 +386,7 @@ describe('all transforms should be applied', () => {
386
386
  );
387
387
  }
388
388
  `,
389
- `
389
+ `
390
390
  /* TODO: (from codemod) We have added an "id" prop to "Tabs" for accessibility reasons.
391
391
  The codemod has added a random ID but you can add one that makes sense for your use case. */
392
392
  /* TODO: (from codemod)
@@ -441,13 +441,13 @@ describe('all transforms should be applied', () => {
441
441
  );
442
442
  }
443
443
  `,
444
- 'should change usages when spreading props',
445
- );
444
+ 'should change usages when spreading props',
445
+ );
446
446
 
447
- defineInlineTest(
448
- { default: transformer, parser: 'tsx' },
449
- {},
450
- `
447
+ defineInlineTest(
448
+ { default: transformer, parser: 'tsx' },
449
+ {},
450
+ `
451
451
  import React, { useState } from "react";
452
452
  import Tabs, { TabItem, TabContent } from "@atlaskit/tabs";
453
453
  import {
@@ -485,7 +485,7 @@ describe('all transforms should be applied', () => {
485
485
  );
486
486
  }
487
487
  `,
488
- `
488
+ `
489
489
  /* TODO: (from codemod) We have added an "id" prop to "Tabs" for accessibility reasons.
490
490
  The codemod has added a random ID but you can add one that makes sense for your use case. */
491
491
  /* TODO: (from codemod)
@@ -564,6 +564,6 @@ describe('all transforms should be applied', () => {
564
564
  );
565
565
  }
566
566
  `,
567
- 'should change usages when onChange is defined in a child',
568
- );
567
+ 'should change usages when onChange is defined in a child',
568
+ );
569
569
  });
@@ -7,18 +7,18 @@ const transformer = createTransformer([addIdProp]);
7
7
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
8
8
 
9
9
  describe('add id prop', () => {
10
- beforeEach(() => {
11
- jest.spyOn(global.Math, 'random').mockReturnValue(0.123456789);
12
- });
10
+ beforeEach(() => {
11
+ jest.spyOn(global.Math, 'random').mockReturnValue(0.123456789);
12
+ });
13
13
 
14
- afterEach(() => {
15
- jest.spyOn(global.Math, 'random').mockRestore();
16
- });
14
+ afterEach(() => {
15
+ jest.spyOn(global.Math, 'random').mockRestore();
16
+ });
17
17
 
18
- defineInlineTest(
19
- { default: transformer, parser: 'tsx' },
20
- {},
21
- `
18
+ defineInlineTest(
19
+ { default: transformer, parser: 'tsx' },
20
+ {},
21
+ `
22
22
  import React from 'react';
23
23
 
24
24
  import Tabs, { Tab, TabList, TabPanel } from '@atlaskit/tabs';
@@ -44,7 +44,7 @@ describe('add id prop', () => {
44
44
  );
45
45
  }
46
46
  `,
47
- `
47
+ `
48
48
  /* TODO: (from codemod) We have added an "id" prop to "Tabs" for accessibility reasons.
49
49
  The codemod has added a random ID but you can add one that makes sense for your use case. */
50
50
  import React from 'react';
@@ -72,6 +72,6 @@ describe('add id prop', () => {
72
72
  );
73
73
  }
74
74
  `,
75
- 'should add an id prop',
76
- );
75
+ 'should add an id prop',
76
+ );
77
77
  });
@@ -7,10 +7,10 @@ const transformer = createTransformer([mapTabsProp, removeTabsProp]);
7
7
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
8
8
 
9
9
  describe('map tabs prop to components', () => {
10
- defineInlineTest(
11
- { default: transformer, parser: 'tsx' },
12
- {},
13
- `
10
+ defineInlineTest(
11
+ { default: transformer, parser: 'tsx' },
12
+ {},
13
+ `
14
14
  import React from "react";
15
15
  import Tabs from "@atlaskit/tabs";
16
16
 
@@ -27,7 +27,7 @@ describe('map tabs prop to components', () => {
27
27
  />
28
28
  );
29
29
  `,
30
- `
30
+ `
31
31
  import React from "react";
32
32
  import Tabs, { Tab, TabList, TabPanel } from "@atlaskit/tabs";
33
33
 
@@ -48,13 +48,13 @@ describe('map tabs prop to components', () => {
48
48
  );
49
49
 
50
50
  `,
51
- 'should map tabs correctly',
52
- );
51
+ 'should map tabs correctly',
52
+ );
53
53
 
54
- defineInlineTest(
55
- { default: transformer, parser: 'tsx' },
56
- {},
57
- `
54
+ defineInlineTest(
55
+ { default: transformer, parser: 'tsx' },
56
+ {},
57
+ `
58
58
  import React from "react";
59
59
  import Tabs from "@atlaskit/tabs";
60
60
 
@@ -69,7 +69,7 @@ describe('map tabs prop to components', () => {
69
69
  />
70
70
  );
71
71
  `,
72
- `
72
+ `
73
73
  import React from "react";
74
74
  import Tabs, { Tab, TabList, TabPanel } from "@atlaskit/tabs";
75
75
 
@@ -93,13 +93,13 @@ describe('map tabs prop to components', () => {
93
93
  );
94
94
 
95
95
  `,
96
- 'should map tabs correctly if defined inline',
97
- );
96
+ 'should map tabs correctly if defined inline',
97
+ );
98
98
 
99
- defineInlineTest(
100
- { default: transformer, parser: 'tsx' },
101
- {},
102
- `
99
+ defineInlineTest(
100
+ { default: transformer, parser: 'tsx' },
101
+ {},
102
+ `
103
103
  import React from "react";
104
104
  import Tabs from "@atlaskit/tabs";
105
105
 
@@ -119,7 +119,7 @@ describe('map tabs prop to components', () => {
119
119
  />
120
120
  );
121
121
  `,
122
- `
122
+ `
123
123
  import React from "react";
124
124
  import Tabs, { Tab as AtlaskitTab, TabList as AtlaskitTabList, TabPanel } from "@atlaskit/tabs";
125
125
 
@@ -145,13 +145,13 @@ describe('map tabs prop to components', () => {
145
145
  );
146
146
 
147
147
  `,
148
- 'should map tabs correctly - with alias',
149
- );
148
+ 'should map tabs correctly - with alias',
149
+ );
150
150
 
151
- defineInlineTest(
152
- { default: transformer, parser: 'tsx' },
153
- {},
154
- `
151
+ defineInlineTest(
152
+ { default: transformer, parser: 'tsx' },
153
+ {},
154
+ `
155
155
  import React from "react";
156
156
  import Tabs from "@atlaskit/tabs";
157
157
 
@@ -172,7 +172,7 @@ describe('map tabs prop to components', () => {
172
172
  />
173
173
  );
174
174
  `,
175
- `
175
+ `
176
176
  import React from "react";
177
177
  import Tabs, {
178
178
  Tab as AtlaskitTab,
@@ -205,13 +205,13 @@ describe('map tabs prop to components', () => {
205
205
  );
206
206
 
207
207
  `,
208
- 'should map tabs correctly - with all clashed',
209
- );
208
+ 'should map tabs correctly - with all clashed',
209
+ );
210
210
 
211
- defineInlineTest(
212
- { default: transformer, parser: 'tsx' },
213
- {},
214
- `
211
+ defineInlineTest(
212
+ { default: transformer, parser: 'tsx' },
213
+ {},
214
+ `
215
215
  import React from "react";
216
216
  import Tabs from "@atlaskit/tabs";
217
217
 
@@ -230,7 +230,7 @@ describe('map tabs prop to components', () => {
230
230
  />
231
231
  );
232
232
  `,
233
- `
233
+ `
234
234
  import React from "react";
235
235
  import Tabs, { Tab, TabList, TabPanel } from "@atlaskit/tabs";
236
236
 
@@ -253,13 +253,13 @@ describe('map tabs prop to components', () => {
253
253
  );
254
254
 
255
255
  `,
256
- 'should map tabs correctly if defined inline',
257
- );
256
+ 'should map tabs correctly if defined inline',
257
+ );
258
258
 
259
- defineInlineTest(
260
- { default: transformer, parser: 'tsx' },
261
- {},
262
- `
259
+ defineInlineTest(
260
+ { default: transformer, parser: 'tsx' },
261
+ {},
262
+ `
263
263
  import React from "react";
264
264
  import Tabs from "@atlaskit/tabs";
265
265
 
@@ -269,7 +269,7 @@ describe('map tabs prop to components', () => {
269
269
  />
270
270
  );
271
271
  `,
272
- `
272
+ `
273
273
  /* TODO: (from codemod)
274
274
  This file is spreading props on the Tabs component.
275
275
 
@@ -294,6 +294,6 @@ describe('map tabs prop to components', () => {
294
294
  );
295
295
 
296
296
  `,
297
- 'should map tabs correctly if spread is used',
298
- );
297
+ 'should map tabs correctly if spread is used',
298
+ );
299
299
  });