@atlaskit/popup 1.17.2 → 1.18.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 +441 -432
- package/__perf__/closed.tsx +30 -30
- package/__perf__/default.tsx +19 -19
- package/__perf__/open.tsx +19 -23
- package/__perf__/popup.tsx +26 -26
- package/__perf__/utils/interaction-tasks.tsx +37 -50
- package/codemods/1.0.0-lite-mode.tsx +148 -181
- package/codemods/__tests__/1.0.0-lite-mode.tsx +88 -88
- package/codemods/utils/helpers.tsx +250 -261
- package/dist/cjs/popper-wrapper.js +15 -6
- package/dist/cjs/popup.js +17 -4
- package/dist/es2019/popper-wrapper.js +15 -5
- package/dist/es2019/popup.js +16 -4
- package/dist/esm/popper-wrapper.js +16 -6
- package/dist/esm/popup.js +17 -4
- package/dist/types/compositional/popup.d.ts +1 -1
- package/dist/types/entry-points/experimental/compositional.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/popper-wrapper.d.ts +1 -1
- package/dist/types/reposition-on-update.d.ts +1 -1
- package/dist/types/types.d.ts +24 -1
- package/dist/types-ts4.5/compositional/popup.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/experimental/compositional.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/popper-wrapper.d.ts +1 -1
- package/dist/types-ts4.5/reposition-on-update.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +24 -1
- package/package.json +117 -118
- package/report.api.md +41 -40
|
@@ -7,41 +7,41 @@ import transformer from '../1.0.0-lite-mode';
|
|
|
7
7
|
const applyTransform = require('jscodeshift/dist/testUtils').applyTransform;
|
|
8
8
|
|
|
9
9
|
type TestArgs = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
it: string;
|
|
11
|
+
original: string;
|
|
12
|
+
expected: string;
|
|
13
|
+
mode?: 'only' | 'skip';
|
|
14
|
+
before?: () => void;
|
|
15
|
+
after?: () => void;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
function check({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
it: name,
|
|
20
|
+
original,
|
|
21
|
+
expected,
|
|
22
|
+
before = noop,
|
|
23
|
+
after = noop,
|
|
24
|
+
mode = undefined,
|
|
25
25
|
}: TestArgs) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
const run = mode === 'only' ? it.only : mode === 'skip' ? it.skip : it;
|
|
27
|
+
|
|
28
|
+
run(name, () => {
|
|
29
|
+
before();
|
|
30
|
+
try {
|
|
31
|
+
const output: string = applyTransform(
|
|
32
|
+
{ default: transformer, parser: 'tsx' },
|
|
33
|
+
{},
|
|
34
|
+
{ source: original },
|
|
35
|
+
);
|
|
36
|
+
expect(output).toBe(expected.trim());
|
|
37
|
+
} catch (e) {
|
|
38
|
+
// a failed assertion will throw
|
|
39
|
+
after();
|
|
40
|
+
throw e;
|
|
41
|
+
}
|
|
42
|
+
// will only be hit if we don't throw
|
|
43
|
+
after();
|
|
44
|
+
});
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -53,9 +53,9 @@ function check({
|
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
55
|
describe('Convert boundaries props', () => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
check({
|
|
57
|
+
it: 'should turn `boundariesElement="scrollParents"` to `boundary="clippingParents"`',
|
|
58
|
+
original: `
|
|
59
59
|
import Popup from '@atlaskit/popup';
|
|
60
60
|
|
|
61
61
|
export default () => (
|
|
@@ -73,7 +73,7 @@ describe('Convert boundaries props', () => {
|
|
|
73
73
|
/>
|
|
74
74
|
);
|
|
75
75
|
`,
|
|
76
|
-
|
|
76
|
+
expected: `
|
|
77
77
|
import Popup from '@atlaskit/popup';
|
|
78
78
|
|
|
79
79
|
export default () => (
|
|
@@ -91,11 +91,11 @@ describe('Convert boundaries props', () => {
|
|
|
91
91
|
/>
|
|
92
92
|
);
|
|
93
93
|
`,
|
|
94
|
-
|
|
94
|
+
});
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
check({
|
|
97
|
+
it: 'should turn `boundariesElement="window"` into `rootBoundary="document"`',
|
|
98
|
+
original: `
|
|
99
99
|
import Popup from '@atlaskit/popup';
|
|
100
100
|
|
|
101
101
|
export default () => (
|
|
@@ -113,7 +113,7 @@ describe('Convert boundaries props', () => {
|
|
|
113
113
|
/>
|
|
114
114
|
);
|
|
115
115
|
`,
|
|
116
|
-
|
|
116
|
+
expected: `
|
|
117
117
|
import Popup from '@atlaskit/popup';
|
|
118
118
|
|
|
119
119
|
export default () => (
|
|
@@ -131,11 +131,11 @@ describe('Convert boundaries props', () => {
|
|
|
131
131
|
/>
|
|
132
132
|
);
|
|
133
133
|
`,
|
|
134
|
-
|
|
134
|
+
});
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
check({
|
|
137
|
+
it: 'should turn `boundariesElement="viewport"` into `rootBoundary="viewport"`',
|
|
138
|
+
original: `
|
|
139
139
|
import Popup from '@atlaskit/popup';
|
|
140
140
|
|
|
141
141
|
export default () => (
|
|
@@ -153,7 +153,7 @@ describe('Convert boundaries props', () => {
|
|
|
153
153
|
/>
|
|
154
154
|
);
|
|
155
155
|
`,
|
|
156
|
-
|
|
156
|
+
expected: `
|
|
157
157
|
import Popup from '@atlaskit/popup';
|
|
158
158
|
|
|
159
159
|
export default () => (
|
|
@@ -171,16 +171,16 @@ describe('Convert boundaries props', () => {
|
|
|
171
171
|
/>
|
|
172
172
|
);
|
|
173
173
|
`,
|
|
174
|
-
|
|
174
|
+
});
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
describe('Convert offset props', () => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
/**
|
|
179
|
+
* `offset` prop is no longer a string, but an array of two integers (i.e. '0px 8px' is now [0, 8])
|
|
180
|
+
*/
|
|
181
|
+
check({
|
|
182
|
+
it: 'should convert offset from a string to an array of two integers',
|
|
183
|
+
original: `
|
|
184
184
|
import Popup from '@atlaskit/popup';
|
|
185
185
|
|
|
186
186
|
export default () => (
|
|
@@ -245,7 +245,7 @@ describe('Convert offset props', () => {
|
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
`,
|
|
248
|
-
|
|
248
|
+
expected: `
|
|
249
249
|
import Popup from '@atlaskit/popup';
|
|
250
250
|
|
|
251
251
|
export default () => (
|
|
@@ -310,13 +310,13 @@ describe('Convert offset props', () => {
|
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
312
|
`,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* If a user is passing in an offset with vh, vw or % in the offset, let them know that's no longer supported
|
|
316
|
+
*/
|
|
317
|
+
check({
|
|
318
|
+
it: 'should warn users using vh, vw or % in the offset',
|
|
319
|
+
original: `
|
|
320
320
|
import Popup from '@atlaskit/popup';
|
|
321
321
|
|
|
322
322
|
export default () => (
|
|
@@ -333,7 +333,7 @@ describe('Convert offset props', () => {
|
|
|
333
333
|
/>
|
|
334
334
|
);
|
|
335
335
|
`,
|
|
336
|
-
|
|
336
|
+
expected: `
|
|
337
337
|
/* TODO: (from codemod) Popper.js has been upgraded from 1.14.1 to 2.4.2,
|
|
338
338
|
and as a result the offset prop has changed to be an array. e.g '0px 8px' -> [0, 8]
|
|
339
339
|
Along with this change you cannot use vw, vh or % units or addition or multiplication
|
|
@@ -355,14 +355,14 @@ describe('Convert offset props', () => {
|
|
|
355
355
|
/>
|
|
356
356
|
);
|
|
357
357
|
`,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* If a user is passing in a variable for offset then we should leave a comment to update it themselves
|
|
362
|
+
*/
|
|
363
|
+
check({
|
|
364
|
+
it: 'warn users passing in a variable for an offset',
|
|
365
|
+
original: `
|
|
366
366
|
import Popup from '@atlaskit/popup';
|
|
367
367
|
|
|
368
368
|
function directOffset({offset}) {
|
|
@@ -381,7 +381,7 @@ describe('Convert offset props', () => {
|
|
|
381
381
|
);
|
|
382
382
|
}
|
|
383
383
|
`,
|
|
384
|
-
|
|
384
|
+
expected: `
|
|
385
385
|
/* TODO: (from codemod) Popper.js has been upgraded from 1.14.1 to 2.4.2, and as a result the offset
|
|
386
386
|
prop has changed to be an array. e.g '0px 8px' -> [0, 8]
|
|
387
387
|
As you are using a variable, you will have change the offset prop manually
|
|
@@ -404,11 +404,11 @@ describe('Convert offset props', () => {
|
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
406
|
`,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
407
|
+
});
|
|
408
|
+
// Works with an aliased import and other imports
|
|
409
|
+
check({
|
|
410
|
+
it: 'should work with aliased import and other imports',
|
|
411
|
+
original: `
|
|
412
412
|
|
|
413
413
|
import AkPopup, { PopupProps as AkPopupProps, TriggerProps as AkTriggerProps } from '@atlaskit/popup';
|
|
414
414
|
|
|
@@ -426,7 +426,7 @@ describe('Convert offset props', () => {
|
|
|
426
426
|
/>
|
|
427
427
|
);
|
|
428
428
|
`,
|
|
429
|
-
|
|
429
|
+
expected: `
|
|
430
430
|
import AkPopup, { PopupProps as AkPopupProps, TriggerProps as AkTriggerProps } from '@atlaskit/popup';
|
|
431
431
|
|
|
432
432
|
export default () => (
|
|
@@ -443,12 +443,12 @@ describe('Convert offset props', () => {
|
|
|
443
443
|
/>
|
|
444
444
|
);
|
|
445
445
|
`,
|
|
446
|
-
|
|
446
|
+
});
|
|
447
447
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
// Works when not a default import
|
|
449
|
+
check({
|
|
450
|
+
it: 'should work when not accessed using a default import',
|
|
451
|
+
original: `
|
|
452
452
|
import { Popup } from '@atlaskit/popup';
|
|
453
453
|
|
|
454
454
|
export default () => (
|
|
@@ -465,7 +465,7 @@ describe('Convert offset props', () => {
|
|
|
465
465
|
/>
|
|
466
466
|
);
|
|
467
467
|
`,
|
|
468
|
-
|
|
468
|
+
expected: `
|
|
469
469
|
import { Popup } from '@atlaskit/popup';
|
|
470
470
|
|
|
471
471
|
export default () => (
|
|
@@ -482,7 +482,7 @@ describe('Convert offset props', () => {
|
|
|
482
482
|
/>
|
|
483
483
|
);
|
|
484
484
|
`,
|
|
485
|
-
|
|
485
|
+
});
|
|
486
486
|
});
|
|
487
487
|
|
|
488
488
|
/**
|
|
@@ -490,9 +490,9 @@ describe('Convert offset props', () => {
|
|
|
490
490
|
* - `scheduleUpdate`, for async updates, has been renamed to `update`, and now returns a Promise.
|
|
491
491
|
*/
|
|
492
492
|
describe('Convert render props', () => {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
493
|
+
check({
|
|
494
|
+
it: 'should rename schedulUpdate to `update`',
|
|
495
|
+
original: `
|
|
496
496
|
import Popup from '@atlaskit/popup';
|
|
497
497
|
|
|
498
498
|
export default () => (
|
|
@@ -509,7 +509,7 @@ describe('Convert render props', () => {
|
|
|
509
509
|
/>
|
|
510
510
|
);
|
|
511
511
|
`,
|
|
512
|
-
|
|
512
|
+
expected: `
|
|
513
513
|
import Popup from '@atlaskit/popup';
|
|
514
514
|
|
|
515
515
|
export default () => (
|
|
@@ -528,5 +528,5 @@ describe('Convert render props', () => {
|
|
|
528
528
|
/>
|
|
529
529
|
);
|
|
530
530
|
`,
|
|
531
|
-
|
|
531
|
+
});
|
|
532
532
|
});
|