@atlaskit/select 17.10.3 → 17.11.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 +22 -1
- package/README.md +2 -1
- package/__perf__/default.tsx +8 -8
- package/codemods/13.0.0-popper-props.ts +76 -89
- package/codemods/__tests__/13.0.0-popper-props.ts +51 -51
- package/codemods/utils/helpers.ts +250 -261
- package/dist/cjs/CountrySelect.js +5 -0
- package/dist/cjs/PopupSelect/PopupSelect.js +3 -1
- package/dist/cjs/PopupSelect/components.js +4 -0
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/components/index.js +4 -0
- package/dist/cjs/components/indicators.js +4 -1
- package/dist/cjs/components/input-options.js +4 -2
- package/dist/cjs/createSelect.js +6 -2
- package/dist/es2019/CountrySelect.js +4 -0
- package/dist/es2019/PopupSelect/PopupSelect.js +3 -1
- package/dist/es2019/PopupSelect/components.js +4 -0
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/components/index.js +4 -0
- package/dist/es2019/components/indicators.js +5 -0
- package/dist/es2019/components/input-options.js +7 -1
- package/dist/es2019/createSelect.js +6 -2
- package/dist/esm/CountrySelect.js +4 -0
- package/dist/esm/PopupSelect/PopupSelect.js +3 -1
- package/dist/esm/PopupSelect/components.js +4 -0
- package/dist/esm/Select.js +1 -1
- package/dist/esm/components/index.js +4 -0
- package/dist/esm/components/indicators.js +5 -0
- package/dist/esm/components/input-options.js +5 -1
- package/dist/esm/createSelect.js +6 -2
- package/dist/types/PopupSelect/PopupSelect.d.ts +19 -21
- package/dist/types/PopupSelect/components.d.ts +3 -0
- package/dist/types/components/index.d.ts +4 -1
- package/dist/types/components/indicators.d.ts +3 -0
- package/dist/types/components/input-options.d.ts +3 -0
- package/dist/types/extract-react-types/react-popper-props.d.ts +4 -4
- package/dist/types/extract-react-types/react-select-props.d.ts +10 -10
- package/dist/types/types.d.ts +7 -7
- package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +19 -21
- package/dist/types-ts4.5/PopupSelect/components.d.ts +3 -0
- package/dist/types-ts4.5/components/index.d.ts +4 -1
- package/dist/types-ts4.5/components/indicators.d.ts +3 -0
- package/dist/types-ts4.5/components/input-options.d.ts +3 -0
- package/dist/types-ts4.5/extract-react-types/react-popper-props.d.ts +4 -4
- package/dist/types-ts4.5/extract-react-types/react-select-props.d.ts +10 -10
- package/dist/types-ts4.5/types.d.ts +7 -7
- package/package.json +116 -116
- package/report.api.md +971 -1125
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 17.11.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
|
+
## 17.10.4
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#111724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111724)
|
|
21
|
+
[`c260b95b219de`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c260b95b219de) -
|
|
22
|
+
Update react-select typescript module augmentation path
|
|
23
|
+
|
|
3
24
|
## 17.10.3
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -29,7 +50,7 @@
|
|
|
29
50
|
|
|
30
51
|
- [#104208](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104208)
|
|
31
52
|
[`0d4480895db7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d4480895db7) -
|
|
32
|
-
Add support for React 18.
|
|
53
|
+
Add support for React 18 in non-strict mode.
|
|
33
54
|
|
|
34
55
|
## 17.9.0
|
|
35
56
|
|
package/README.md
CHANGED
package/__perf__/default.tsx
CHANGED
|
@@ -2,14 +2,14 @@ import React from 'react';
|
|
|
2
2
|
import Select from '../src';
|
|
3
3
|
|
|
4
4
|
const options = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
{ label: 'Adelaide', value: 'adelaide' },
|
|
6
|
+
{ label: 'Brisbane', value: 'brisbane' },
|
|
7
|
+
{ label: 'Canberra', value: 'canberra' },
|
|
8
|
+
{ label: 'Darwin', value: 'darwin' },
|
|
9
|
+
{ label: 'Hobart', value: 'hobart' },
|
|
10
|
+
{ label: 'Melbourne', value: 'melbourne' },
|
|
11
|
+
{ label: 'Perth', value: 'perth' },
|
|
12
|
+
{ label: 'Sydney', value: 'sydney' },
|
|
13
13
|
];
|
|
14
14
|
|
|
15
15
|
export default () => <Select options={options} placeholder="Choose a City" />;
|
|
@@ -1,71 +1,62 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
addCommentToStartOfFile,
|
|
3
|
+
getJSXAttributesByName,
|
|
4
|
+
getSpecifierName,
|
|
5
|
+
hasImportDeclaration,
|
|
6
|
+
isUsingProp,
|
|
7
7
|
} from './utils/helpers';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
type default as core,
|
|
11
|
+
type API,
|
|
12
|
+
type ASTPath,
|
|
13
|
+
type FileInfo,
|
|
14
|
+
type JSXElement,
|
|
15
|
+
type Options,
|
|
16
16
|
} from 'jscodeshift';
|
|
17
17
|
import { type Collection } from 'jscodeshift/src/Collection';
|
|
18
18
|
|
|
19
|
-
function updatePopperProps(
|
|
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
|
-
// @ts-ignore
|
|
48
|
-
const strategy = property.node.value.value ? 'fixed' : 'absolute';
|
|
49
|
-
property.replace(
|
|
50
|
-
j.objectProperty(
|
|
51
|
-
j.identifier('strategy'),
|
|
52
|
-
j.stringLiteral(strategy),
|
|
53
|
-
),
|
|
54
|
-
);
|
|
55
|
-
});
|
|
19
|
+
function updatePopperProps(j: core.JSCodeshift, source: Collection<any>, specifier: string) {
|
|
20
|
+
source.findJSXElements(specifier).forEach((path: ASTPath<JSXElement>) => {
|
|
21
|
+
if (
|
|
22
|
+
isUsingProp({
|
|
23
|
+
j,
|
|
24
|
+
base: source,
|
|
25
|
+
element: path,
|
|
26
|
+
propName: 'popperProps',
|
|
27
|
+
})
|
|
28
|
+
) {
|
|
29
|
+
// Get value from prop
|
|
30
|
+
getJSXAttributesByName({
|
|
31
|
+
j,
|
|
32
|
+
element: path,
|
|
33
|
+
attributeName: 'popperProps',
|
|
34
|
+
}).forEach((attribute) => {
|
|
35
|
+
// convert positionFixed
|
|
36
|
+
j(attribute)
|
|
37
|
+
.find(j.JSXExpressionContainer)
|
|
38
|
+
.find(j.ObjectExpression)
|
|
39
|
+
.find(j.ObjectProperty)
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
.filter((property) => property.node.key.name === 'positionFixed')
|
|
42
|
+
.forEach((property) => {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
const strategy = property.node.value.value ? 'fixed' : 'absolute';
|
|
45
|
+
property.replace(j.objectProperty(j.identifier('strategy'), j.stringLiteral(strategy)));
|
|
46
|
+
});
|
|
56
47
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
48
|
+
// warn about modifiers prop
|
|
49
|
+
j(attribute)
|
|
50
|
+
.find(j.JSXExpressionContainer)
|
|
51
|
+
.find(j.ObjectExpression)
|
|
52
|
+
.find(j.ObjectProperty)
|
|
53
|
+
//@ts-ignore
|
|
54
|
+
.filter((property) => property.node.key.name === 'modifiers')
|
|
55
|
+
.forEach(() => {
|
|
56
|
+
addCommentToStartOfFile({
|
|
57
|
+
j,
|
|
58
|
+
base: source,
|
|
59
|
+
message: `
|
|
69
60
|
Popper.js has been upgraded from 1.14.1 to 2.4.2,
|
|
70
61
|
and as a result the modifier prop has changed significantly. The format has been
|
|
71
62
|
changed from object of objects, to array of objects, with the key for each modifier
|
|
@@ -73,39 +64,35 @@ function updatePopperProps(
|
|
|
73
64
|
pair for configuration and other changes unique to each modifier.
|
|
74
65
|
Further details can be found in the popper docs: https://popper.js.org/docs/v2/modifiers/
|
|
75
66
|
`,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
81
72
|
}
|
|
82
73
|
|
|
83
|
-
export default function transformer(
|
|
84
|
-
|
|
85
|
-
{ jscodeshift: j }: API,
|
|
86
|
-
options: Options,
|
|
87
|
-
) {
|
|
88
|
-
const source = j(file.source);
|
|
74
|
+
export default function transformer(file: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
75
|
+
const source = j(file.source);
|
|
89
76
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
77
|
+
// Exit early if not relevant
|
|
78
|
+
// We are doing this so we don't touch the formatting of unrelated files
|
|
79
|
+
if (!hasImportDeclaration(j, file.source, '@atlaskit/select')) {
|
|
80
|
+
return file.source;
|
|
81
|
+
}
|
|
95
82
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
83
|
+
// Get imported name for the component
|
|
84
|
+
const specifier = getSpecifierName({
|
|
85
|
+
j,
|
|
86
|
+
base: source,
|
|
87
|
+
packageName: '@atlaskit/select',
|
|
88
|
+
component: 'PopupSelect',
|
|
89
|
+
});
|
|
90
|
+
if (!specifier) {
|
|
91
|
+
return file.source;
|
|
92
|
+
}
|
|
106
93
|
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
// Convert boundaries prop
|
|
95
|
+
updatePopperProps(j, source, specifier);
|
|
109
96
|
|
|
110
|
-
|
|
97
|
+
return source.toSource(options.printOptions || { quote: 'single' });
|
|
111
98
|
}
|
|
@@ -5,43 +5,43 @@ import transformer from '../13.0.0-popper-props';
|
|
|
5
5
|
const applyTransform = require('jscodeshift/dist/testUtils').applyTransform;
|
|
6
6
|
|
|
7
7
|
type TestArgs = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
it: string;
|
|
9
|
+
original: string;
|
|
10
|
+
expected: string;
|
|
11
|
+
mode?: 'only' | 'skip';
|
|
12
|
+
before?: () => void;
|
|
13
|
+
after?: () => void;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
function noop() {}
|
|
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
|
/**
|
|
@@ -50,9 +50,9 @@ function check({
|
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
52
|
describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
check({
|
|
54
|
+
it: 'Convert `positionFixed: true` to `strategy: "fixed"`',
|
|
55
|
+
original: `
|
|
56
56
|
import { PopupSelect } from '@atlaskit/select';
|
|
57
57
|
|
|
58
58
|
export default () => (
|
|
@@ -71,7 +71,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
|
71
71
|
/>
|
|
72
72
|
);
|
|
73
73
|
`,
|
|
74
|
-
|
|
74
|
+
expected: `
|
|
75
75
|
import { PopupSelect } from '@atlaskit/select';
|
|
76
76
|
|
|
77
77
|
export default () => (
|
|
@@ -90,11 +90,11 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
|
90
90
|
/>
|
|
91
91
|
);
|
|
92
92
|
`,
|
|
93
|
-
|
|
93
|
+
});
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
check({
|
|
96
|
+
it: 'Convert `positionFixed: {something truthy}` to `strategy: "fixed"`',
|
|
97
|
+
original: `
|
|
98
98
|
import { PopupSelect } from '@atlaskit/select';
|
|
99
99
|
|
|
100
100
|
export default () => (
|
|
@@ -113,7 +113,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
|
113
113
|
/>
|
|
114
114
|
);
|
|
115
115
|
`,
|
|
116
|
-
|
|
116
|
+
expected: `
|
|
117
117
|
import { PopupSelect } from '@atlaskit/select';
|
|
118
118
|
|
|
119
119
|
export default () => (
|
|
@@ -132,11 +132,11 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
|
132
132
|
/>
|
|
133
133
|
);
|
|
134
134
|
`,
|
|
135
|
-
|
|
135
|
+
});
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
check({
|
|
138
|
+
it: 'Convert `positionFixed: false` to `strategy:"absolute"`',
|
|
139
|
+
original: `
|
|
140
140
|
import { PopupSelect } from '@atlaskit/select';
|
|
141
141
|
|
|
142
142
|
export default () => (
|
|
@@ -155,7 +155,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
|
155
155
|
/>
|
|
156
156
|
);
|
|
157
157
|
`,
|
|
158
|
-
|
|
158
|
+
expected: `
|
|
159
159
|
import { PopupSelect } from '@atlaskit/select';
|
|
160
160
|
|
|
161
161
|
export default () => (
|
|
@@ -174,7 +174,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
|
174
174
|
/>
|
|
175
175
|
);
|
|
176
176
|
`,
|
|
177
|
-
|
|
177
|
+
});
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
/**
|
|
@@ -183,9 +183,9 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
|
|
|
183
183
|
*/
|
|
184
184
|
|
|
185
185
|
describe('Warn use of the `modifiers` prop', () => {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
check({
|
|
187
|
+
it: 'should add warning comment when using the modifier prop in `popperProps`',
|
|
188
|
+
original: `
|
|
189
189
|
import { PopupSelect } from '@atlaskit/select';
|
|
190
190
|
|
|
191
191
|
export default () => (
|
|
@@ -204,7 +204,7 @@ describe('Warn use of the `modifiers` prop', () => {
|
|
|
204
204
|
/>
|
|
205
205
|
);
|
|
206
206
|
`,
|
|
207
|
-
|
|
207
|
+
expected: `
|
|
208
208
|
/* TODO: (from codemod) Popper.js has been upgraded from 1.14.1 to 2.4.2,
|
|
209
209
|
and as a result the modifier prop has changed significantly. The format has been
|
|
210
210
|
changed from object of objects, to array of objects, with the key for each modifier
|
|
@@ -229,5 +229,5 @@ describe('Warn use of the `modifiers` prop', () => {
|
|
|
229
229
|
/>
|
|
230
230
|
);
|
|
231
231
|
`,
|
|
232
|
-
|
|
232
|
+
});
|
|
233
233
|
});
|