@atlaskit/select 17.10.2 → 17.10.4

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 +15 -1
  2. package/README.md +2 -1
  3. package/__perf__/default.tsx +8 -8
  4. package/codemods/13.0.0-popper-props.ts +76 -89
  5. package/codemods/__tests__/13.0.0-popper-props.ts +51 -51
  6. package/codemods/utils/helpers.ts +250 -261
  7. package/dist/cjs/CountrySelect.js +2 -0
  8. package/dist/cjs/PopupSelect/PopupSelect.js +3 -1
  9. package/dist/cjs/PopupSelect/components.js +1 -0
  10. package/dist/cjs/Select.js +1 -1
  11. package/dist/cjs/components/index.js +1 -0
  12. package/dist/cjs/components/indicators.js +2 -1
  13. package/dist/cjs/components/input-options.js +2 -2
  14. package/dist/cjs/createSelect.js +6 -2
  15. package/dist/es2019/CountrySelect.js +1 -0
  16. package/dist/es2019/PopupSelect/PopupSelect.js +3 -1
  17. package/dist/es2019/PopupSelect/components.js +1 -0
  18. package/dist/es2019/Select.js +1 -1
  19. package/dist/es2019/components/index.js +1 -0
  20. package/dist/es2019/components/indicators.js +2 -0
  21. package/dist/es2019/components/input-options.js +4 -1
  22. package/dist/es2019/createSelect.js +6 -2
  23. package/dist/esm/CountrySelect.js +1 -0
  24. package/dist/esm/PopupSelect/PopupSelect.js +3 -1
  25. package/dist/esm/PopupSelect/components.js +1 -0
  26. package/dist/esm/Select.js +1 -1
  27. package/dist/esm/components/index.js +1 -0
  28. package/dist/esm/components/indicators.js +2 -0
  29. package/dist/esm/components/input-options.js +2 -1
  30. package/dist/esm/createSelect.js +6 -2
  31. package/dist/types/PopupSelect/PopupSelect.d.ts +19 -21
  32. package/dist/types/components/index.d.ts +1 -1
  33. package/dist/types/extract-react-types/react-popper-props.d.ts +4 -4
  34. package/dist/types/extract-react-types/react-select-props.d.ts +10 -10
  35. package/dist/types/types.d.ts +7 -7
  36. package/dist/types-ts4.5/PopupSelect/PopupSelect.d.ts +19 -21
  37. package/dist/types-ts4.5/components/index.d.ts +1 -1
  38. package/dist/types-ts4.5/extract-react-types/react-popper-props.d.ts +4 -4
  39. package/dist/types-ts4.5/extract-react-types/react-select-props.d.ts +10 -10
  40. package/dist/types-ts4.5/types.d.ts +7 -7
  41. package/package.json +116 -116
  42. package/report.api.md +971 -1125
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/select
2
2
 
3
+ ## 17.10.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#111724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111724)
8
+ [`c260b95b219de`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c260b95b219de) -
9
+ Update react-select typescript module augmentation path
10
+
11
+ ## 17.10.3
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 17.10.2
4
18
 
5
19
  ### Patch Changes
@@ -23,7 +37,7 @@
23
37
 
24
38
  - [#104208](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104208)
25
39
  [`0d4480895db7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d4480895db7) -
26
- Add support for React 18.
40
+ Add support for React 18 in non-strict mode.
27
41
 
28
42
  ## 17.9.0
29
43
 
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Select
2
2
 
3
- Select gives users the ability to make a single selection, or multiple selections from a number of options.
3
+ Select gives users the ability to make a single selection, or multiple selections from a number of
4
+ options.
4
5
 
5
6
  ## Installation
6
7
 
@@ -2,14 +2,14 @@ import React from 'react';
2
2
  import Select from '../src';
3
3
 
4
4
  const options = [
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' },
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
- addCommentToStartOfFile,
3
- getJSXAttributesByName,
4
- getSpecifierName,
5
- hasImportDeclaration,
6
- isUsingProp,
2
+ addCommentToStartOfFile,
3
+ getJSXAttributesByName,
4
+ getSpecifierName,
5
+ hasImportDeclaration,
6
+ isUsingProp,
7
7
  } from './utils/helpers';
8
8
 
9
9
  import {
10
- type default as core,
11
- type API,
12
- type ASTPath,
13
- type FileInfo,
14
- type JSXElement,
15
- type Options,
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
- j: core.JSCodeshift,
21
- source: Collection<any>,
22
- specifier: string,
23
- ) {
24
- source.findJSXElements(specifier).forEach((path: ASTPath<JSXElement>) => {
25
- if (
26
- isUsingProp({
27
- j,
28
- base: source,
29
- element: path,
30
- propName: 'popperProps',
31
- })
32
- ) {
33
- // Get value from prop
34
- getJSXAttributesByName({
35
- j,
36
- element: path,
37
- attributeName: 'popperProps',
38
- }).forEach((attribute) => {
39
- // convert positionFixed
40
- j(attribute)
41
- .find(j.JSXExpressionContainer)
42
- .find(j.ObjectExpression)
43
- .find(j.ObjectProperty)
44
- // @ts-ignore
45
- .filter((property) => property.node.key.name === 'positionFixed')
46
- .forEach((property) => {
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
- // warn about modifiers prop
58
- j(attribute)
59
- .find(j.JSXExpressionContainer)
60
- .find(j.ObjectExpression)
61
- .find(j.ObjectProperty)
62
- //@ts-ignore
63
- .filter((property) => property.node.key.name === 'modifiers')
64
- .forEach(() => {
65
- addCommentToStartOfFile({
66
- j,
67
- base: source,
68
- message: `
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
- file: FileInfo,
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
- // Exit early if not relevant
91
- // We are doing this so we don't touch the formatting of unrelated files
92
- if (!hasImportDeclaration(j, file.source, '@atlaskit/select')) {
93
- return file.source;
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
- // Get imported name for the component
97
- const specifier = getSpecifierName({
98
- j,
99
- base: source,
100
- packageName: '@atlaskit/select',
101
- component: 'PopupSelect',
102
- });
103
- if (!specifier) {
104
- return file.source;
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
- // Convert boundaries prop
108
- updatePopperProps(j, source, specifier);
94
+ // Convert boundaries prop
95
+ updatePopperProps(j, source, specifier);
109
96
 
110
- return source.toSource(options.printOptions || { quote: 'single' });
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
- it: string;
9
- original: string;
10
- expected: string;
11
- mode?: 'only' | 'skip';
12
- before?: () => void;
13
- after?: () => void;
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
- it: name,
20
- original,
21
- expected,
22
- before = noop,
23
- after = noop,
24
- mode = undefined,
19
+ it: name,
20
+ original,
21
+ expected,
22
+ before = noop,
23
+ after = noop,
24
+ mode = undefined,
25
25
  }: TestArgs) {
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
- });
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
- check({
54
- it: 'Convert `positionFixed: true` to `strategy: "fixed"`',
55
- original: `
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
- expected: `
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
- check({
96
- it: 'Convert `positionFixed: {something truthy}` to `strategy: "fixed"`',
97
- original: `
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
- expected: `
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
- check({
138
- it: 'Convert `positionFixed: false` to `strategy:"absolute"`',
139
- original: `
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
- expected: `
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
- check({
187
- it: 'should add warning comment when using the modifier prop in `popperProps`',
188
- original: `
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
- expected: `
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
  });