@atlaskit/color-picker 3.2.14 → 3.2.16

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,22 @@
1
1
  # @atlaskit/color-picker
2
2
 
3
+ ## 3.2.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#107395](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107395)
8
+ [`9a4ffd1c2458e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a4ffd1c2458e) -
9
+ added different label for radio item
10
+
11
+ ## 3.2.15
12
+
13
+ ### Patch Changes
14
+
15
+ - [#107548](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107548)
16
+ [`86e1626ec32ff`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/86e1626ec32ff) -
17
+ Clean up ff platform.color-picker-radio-button-functionality_6hkcy
18
+ - Updated dependencies
19
+
3
20
  ## 3.2.14
4
21
 
5
22
  ### Patch Changes
@@ -1,71 +1,62 @@
1
1
  import {
2
- addCommentToStartOfFile,
3
- getJSXAttributesByName,
4
- getDefaultSpecifierName,
5
- hasImportDeclaration,
6
- isUsingProp,
2
+ addCommentToStartOfFile,
3
+ getJSXAttributesByName,
4
+ getDefaultSpecifierName,
5
+ hasImportDeclaration,
6
+ isUsingProp,
7
7
  } from './utils/helpers';
8
8
 
9
9
  import {
10
- type API,
11
- type default as core,
12
- type ASTPath,
13
- type FileInfo,
14
- type JSXElement,
15
- type Options,
10
+ type API,
11
+ type default as core,
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,38 +64,34 @@ 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/color-picker')) {
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/color-picker')) {
80
+ return file.source;
81
+ }
95
82
 
96
- // Get imported name for the component
97
- const specifier = getDefaultSpecifierName({
98
- j,
99
- base: source,
100
- packageName: '@atlaskit/color-picker',
101
- });
102
- if (!specifier) {
103
- return file.source;
104
- }
83
+ // Get imported name for the component
84
+ const specifier = getDefaultSpecifierName({
85
+ j,
86
+ base: source,
87
+ packageName: '@atlaskit/color-picker',
88
+ });
89
+ if (!specifier) {
90
+ return file.source;
91
+ }
105
92
 
106
- // Convert boundaries prop
107
- updatePopperProps(j, source, specifier);
93
+ // Convert boundaries prop
94
+ updatePopperProps(j, source, specifier);
108
95
 
109
- return source.toSource(options.printOptions || { quote: 'single' });
96
+ return source.toSource(options.printOptions || { quote: 'single' });
110
97
  }
@@ -5,43 +5,43 @@ import transformer from '../1.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 ColorPicker from '@atlaskit/color-picker';
57
57
 
58
58
  export default () => (
@@ -68,7 +68,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
68
68
  />
69
69
  );
70
70
  `,
71
- expected: `
71
+ expected: `
72
72
  import ColorPicker from '@atlaskit/color-picker';
73
73
 
74
74
  export default () => (
@@ -84,11 +84,11 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
84
84
  />
85
85
  );
86
86
  `,
87
- });
87
+ });
88
88
 
89
- check({
90
- it: 'Convert `positionFixed: {something truthy}` to `strategy: "fixed"`',
91
- original: `
89
+ check({
90
+ it: 'Convert `positionFixed: {something truthy}` to `strategy: "fixed"`',
91
+ original: `
92
92
  import ColorPicker from '@atlaskit/color-picker';
93
93
 
94
94
  export default () => (
@@ -104,7 +104,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
104
104
  />
105
105
  );
106
106
  `,
107
- expected: `
107
+ expected: `
108
108
  import ColorPicker from '@atlaskit/color-picker';
109
109
 
110
110
  export default () => (
@@ -120,11 +120,11 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
120
120
  />
121
121
  );
122
122
  `,
123
- });
123
+ });
124
124
 
125
- check({
126
- it: 'Convert `positionFixed: false` to `strategy:"absolute"`',
127
- original: `
125
+ check({
126
+ it: 'Convert `positionFixed: false` to `strategy:"absolute"`',
127
+ original: `
128
128
  import ColorPicker from '@atlaskit/color-picker';
129
129
 
130
130
  export default () => (
@@ -140,7 +140,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
140
140
  />
141
141
  );
142
142
  `,
143
- expected: `
143
+ expected: `
144
144
  import ColorPicker from '@atlaskit/color-picker';
145
145
 
146
146
  export default () => (
@@ -156,7 +156,7 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
156
156
  />
157
157
  );
158
158
  `,
159
- });
159
+ });
160
160
  });
161
161
 
162
162
  /**
@@ -165,9 +165,9 @@ describe('Convert positionFixed:boolean to strategy:"fixed"|"absolute"', () => {
165
165
  */
166
166
 
167
167
  describe('Warn use of the `modifiers` prop', () => {
168
- check({
169
- it: 'should add warning comment when using the modifier prop in `popperProps`',
170
- original: `
168
+ check({
169
+ it: 'should add warning comment when using the modifier prop in `popperProps`',
170
+ original: `
171
171
  import ColorPicker from '@atlaskit/color-picker';
172
172
 
173
173
  export default () => (
@@ -183,7 +183,7 @@ describe('Warn use of the `modifiers` prop', () => {
183
183
  />
184
184
  );
185
185
  `,
186
- expected: `
186
+ expected: `
187
187
  /* TODO: (from codemod) Popper.js has been upgraded from 1.14.1 to 2.4.2,
188
188
  and as a result the modifier prop has changed significantly. The format has been
189
189
  changed from object of objects, to array of objects, with the key for each modifier
@@ -205,5 +205,5 @@ describe('Warn use of the `modifiers` prop', () => {
205
205
  />
206
206
  );
207
207
  `,
208
- });
208
+ });
209
209
  });