@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 +17 -0
- package/codemods/1.0.0-popper-props.ts +75 -88
- package/codemods/__tests__/1.0.0-popper-props.ts +51 -51
- package/codemods/utils/helpers.ts +250 -261
- package/dist/cjs/components/ColorCard.js +19 -17
- package/dist/cjs/components/ColorPaletteMenu.js +9 -4
- package/dist/cjs/components/ColorPicker.js +3 -5
- package/dist/cjs/components/Trigger.js +8 -14
- package/dist/cjs/components/components.js +1 -0
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/utils.js +1 -2
- package/dist/es2019/components/ColorCard.js +20 -17
- package/dist/es2019/components/ColorPaletteMenu.js +9 -4
- package/dist/es2019/components/ColorPicker.js +3 -5
- package/dist/es2019/components/Trigger.js +8 -14
- package/dist/es2019/components/components.js +1 -0
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/utils.js +1 -2
- package/dist/esm/components/ColorCard.js +19 -17
- package/dist/esm/components/ColorPaletteMenu.js +9 -4
- package/dist/esm/components/ColorPicker.js +3 -5
- package/dist/esm/components/Trigger.js +8 -14
- package/dist/esm/components/components.js +1 -0
- package/dist/esm/messages.js +5 -0
- package/dist/esm/utils.js +1 -2
- package/dist/types/messages.d.ts +5 -0
- package/dist/types-ts4.5/messages.d.ts +5 -0
- package/docs/0-intro.tsx +35 -34
- package/package.json +5 -8
- package/report.api.md +103 -107
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
addCommentToStartOfFile,
|
|
3
|
+
getJSXAttributesByName,
|
|
4
|
+
getDefaultSpecifierName,
|
|
5
|
+
hasImportDeclaration,
|
|
6
|
+
isUsingProp,
|
|
7
7
|
} from './utils/helpers';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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,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
|
-
|
|
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/color-picker')) {
|
|
80
|
+
return file.source;
|
|
81
|
+
}
|
|
95
82
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
107
|
-
|
|
93
|
+
// Convert boundaries prop
|
|
94
|
+
updatePopperProps(j, source, specifier);
|
|
108
95
|
|
|
109
|
-
|
|
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
|
-
|
|
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 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
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
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
|
});
|