@atlaskit/select 18.2.0 → 18.4.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 +24 -0
- package/codemods/18.3.0-select-props.tsx +156 -0
- package/codemods/__tests__/next-select-props.tsx +307 -0
- package/dist/cjs/Select.js +1 -1
- package/dist/cjs/components/indicators.js +15 -6
- package/dist/cjs/components/no-options.js +2 -5
- package/dist/es2019/Select.js +1 -1
- package/dist/es2019/components/indicators.js +20 -14
- package/dist/es2019/components/no-options.js +2 -5
- package/dist/esm/Select.js +1 -1
- package/dist/esm/components/indicators.js +9 -3
- package/dist/esm/components/no-options.js +2 -5
- package/dist/types/components/indicators.d.ts +1 -1
- package/dist/types-ts4.5/components/indicators.d.ts +1 -1
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/select
|
|
2
2
|
|
|
3
|
+
## 18.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#157818](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/157818)
|
|
8
|
+
[`87c14ad1a3efa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/87c14ad1a3efa) -
|
|
9
|
+
Use semantic tags and arias for combobox and listbox and reduce aria-live
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 18.3.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#156026](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/156026)
|
|
20
|
+
[`709b9c76673df`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/709b9c76673df) -
|
|
21
|
+
Add clearControlLabel to select component.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 18.2.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
API,
|
|
3
|
+
ASTPath,
|
|
4
|
+
default as core,
|
|
5
|
+
FileInfo,
|
|
6
|
+
ImportDeclaration,
|
|
7
|
+
ImportSpecifier,
|
|
8
|
+
Options,
|
|
9
|
+
} from 'jscodeshift';
|
|
10
|
+
|
|
11
|
+
function getSpecifier(
|
|
12
|
+
j: core.JSCodeshift,
|
|
13
|
+
source: ReturnType<typeof j>,
|
|
14
|
+
specifier: string,
|
|
15
|
+
imported?: string,
|
|
16
|
+
) {
|
|
17
|
+
let specifiers;
|
|
18
|
+
if (imported) {
|
|
19
|
+
specifiers = source
|
|
20
|
+
.find(j.ImportDeclaration)
|
|
21
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
22
|
+
.find(j.ImportSpecifier)
|
|
23
|
+
.filter((path: ASTPath<ImportSpecifier>) => path.value.imported.name === imported);
|
|
24
|
+
} else {
|
|
25
|
+
specifiers = source
|
|
26
|
+
.find(j.ImportDeclaration)
|
|
27
|
+
.filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
|
|
28
|
+
.find(j.ImportDefaultSpecifier);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!specifiers.length) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return specifiers.nodes()[0]!.local!.name;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getJSXAttributesByName(j: core.JSCodeshift, element: ASTPath<any>, attributeName: string) {
|
|
39
|
+
return j(element)
|
|
40
|
+
.find(j.JSXOpeningElement)
|
|
41
|
+
.find(j.JSXAttribute)
|
|
42
|
+
.filter((attribute) => {
|
|
43
|
+
const matches = j(attribute)
|
|
44
|
+
.find(j.JSXIdentifier)
|
|
45
|
+
.filter((identifier) => identifier.value.name === attributeName);
|
|
46
|
+
return Boolean(matches.length);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function updateSelectProps(j: core.JSCodeshift, source: ReturnType<typeof j>, variant?: string) {
|
|
51
|
+
const specifier = getSpecifier(j, source, '@atlaskit/select', variant);
|
|
52
|
+
|
|
53
|
+
if (!specifier) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
58
|
+
const propsToRemove = [
|
|
59
|
+
'aria-errormessage',
|
|
60
|
+
'aria-live',
|
|
61
|
+
'ariaLiveMessages',
|
|
62
|
+
'captureMenuOnScroll',
|
|
63
|
+
'delimiter',
|
|
64
|
+
'isRTL',
|
|
65
|
+
'menuShouldBlockScroll',
|
|
66
|
+
'screenReaderStatus',
|
|
67
|
+
'theme',
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const propsToReplace = {
|
|
71
|
+
'aria-invalid': 'isInvalid',
|
|
72
|
+
'aria-label': 'label',
|
|
73
|
+
'aria-labelledby': 'labelId',
|
|
74
|
+
disabled: 'isDisabled',
|
|
75
|
+
} as const;
|
|
76
|
+
|
|
77
|
+
propsToRemove.forEach((propName) => getJSXAttributesByName(j, element, propName).remove());
|
|
78
|
+
|
|
79
|
+
(Object.keys(propsToReplace) as Array<keyof typeof propsToReplace>).forEach((key) =>
|
|
80
|
+
getJSXAttributesByName(j, element, key).forEach((attribute) => {
|
|
81
|
+
j(attribute).find(j.JSXIdentifier).replaceWith(j.jsxIdentifier(propsToReplace[key]));
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// This needs to switch error to true and remove if default/success are used
|
|
86
|
+
getJSXAttributesByName(j, element, 'validationState').forEach((attribute) => {
|
|
87
|
+
// If validationState is 'default' or 'success' just remove
|
|
88
|
+
j(attribute)
|
|
89
|
+
.filter((attr) => attr.node.value.value.match(/default|success/))
|
|
90
|
+
.remove();
|
|
91
|
+
|
|
92
|
+
// If validationState is 'error' replace with isInvalid
|
|
93
|
+
j(attribute)
|
|
94
|
+
.filter((attr) => attr.node.value && attr.node.value.value === 'error')
|
|
95
|
+
.replaceWith(j.jsxAttribute(j.jsxIdentifier('isInvalid')));
|
|
96
|
+
|
|
97
|
+
// TODO: In order to complete the deprecation of validationState, we need to clean up custom props name isInvalid
|
|
98
|
+
// j(attribute)
|
|
99
|
+
// .find(j.JSXExpressionContainer)
|
|
100
|
+
// .filter((container) => {
|
|
101
|
+
// return j(container).find(j.BooleanLiteral).length === 0;
|
|
102
|
+
// })
|
|
103
|
+
// .forEach((container) => {
|
|
104
|
+
// j(container).replaceWith(
|
|
105
|
+
// j.jsxExpressionContainer(
|
|
106
|
+
// // Type 'JSXEmptyExpression' is not assignable to type 'ExpressionKind'.
|
|
107
|
+
// // @ts-ignore TS2345
|
|
108
|
+
// j.unaryExpression('!', container.node.expression),
|
|
109
|
+
// ),
|
|
110
|
+
// );
|
|
111
|
+
// });
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// TODO: Probably need to wait until Select a11y improvements have shipped
|
|
115
|
+
// getJSXAttributesByName(j, element, 'escapeClearsValue').remove();
|
|
116
|
+
|
|
117
|
+
// TODO: Need to work out how isRequired is spread from Field
|
|
118
|
+
// getJSXAttributesByName(j, element, 'aria-required').forEach((attribute) => {
|
|
119
|
+
// j(attribute).find(j.JSXIdentifier).replaceWith(j.jsxIdentifier('isRequired'));
|
|
120
|
+
// });
|
|
121
|
+
|
|
122
|
+
// TODO: Need to work out how isRequired is spread from Field
|
|
123
|
+
// getJSXAttributesByName(j, element, 'required').forEach((attribute) => {
|
|
124
|
+
// j(attribute).find(j.JSXIdentifier).replaceWith(j.jsxIdentifier('isRequired'));
|
|
125
|
+
// });
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function hasImportDeclaration(
|
|
130
|
+
j: core.JSCodeshift,
|
|
131
|
+
source: ReturnType<typeof j>,
|
|
132
|
+
importPath: string,
|
|
133
|
+
) {
|
|
134
|
+
return !!source.find(j.ImportDeclaration).filter((path) => path.node.source.value === importPath)
|
|
135
|
+
.length;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
139
|
+
const source = j(fileInfo.source);
|
|
140
|
+
|
|
141
|
+
if (hasImportDeclaration(j, source, '@atlaskit/select')) {
|
|
142
|
+
updateSelectProps(j, source);
|
|
143
|
+
[
|
|
144
|
+
'AsyncSelect',
|
|
145
|
+
'CheckboxSelect',
|
|
146
|
+
'CountrySelect',
|
|
147
|
+
'CreatableSelect',
|
|
148
|
+
'PopupSelect',
|
|
149
|
+
'RadioSelect',
|
|
150
|
+
].forEach((variant) => updateSelectProps(j, source, variant));
|
|
151
|
+
|
|
152
|
+
return source.toSource(options.printOptions || { quote: 'single' });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return fileInfo.source;
|
|
156
|
+
}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
jest.autoMockOff();
|
|
2
|
+
|
|
3
|
+
import * as transformer from '../18.3.0-select-props';
|
|
4
|
+
|
|
5
|
+
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
|
+
|
|
7
|
+
describe('Update Select props', () => {
|
|
8
|
+
defineInlineTest(
|
|
9
|
+
{ ...transformer, parser: 'tsx' },
|
|
10
|
+
{},
|
|
11
|
+
`
|
|
12
|
+
import Foo from '@atlaskit/select';
|
|
13
|
+
|
|
14
|
+
const App = () => {
|
|
15
|
+
return (
|
|
16
|
+
<Foo
|
|
17
|
+
aria-errormessage={''}
|
|
18
|
+
aria-live={''}
|
|
19
|
+
ariaLiveMessages={''}
|
|
20
|
+
captureMenuOnScroll={true}
|
|
21
|
+
delimiter={''}
|
|
22
|
+
isRTL={true}
|
|
23
|
+
menuShouldBlockScroll={true}
|
|
24
|
+
screenReaderStatus={''}
|
|
25
|
+
theme={{}}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
`,
|
|
30
|
+
`
|
|
31
|
+
import Foo from '@atlaskit/select';
|
|
32
|
+
|
|
33
|
+
const App = () => {
|
|
34
|
+
return <Foo />;
|
|
35
|
+
};
|
|
36
|
+
`,
|
|
37
|
+
'should remove all deleted props with aliased import name',
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
defineInlineTest(
|
|
41
|
+
{ ...transformer, parser: 'tsx' },
|
|
42
|
+
{},
|
|
43
|
+
`
|
|
44
|
+
import Select from '@foo/bar';
|
|
45
|
+
|
|
46
|
+
const App = () => {
|
|
47
|
+
return (
|
|
48
|
+
<Select
|
|
49
|
+
aria-errormessage={''}
|
|
50
|
+
aria-live={''}
|
|
51
|
+
ariaLiveMessages={''}
|
|
52
|
+
captureMenuOnScroll={true}
|
|
53
|
+
delimiter={''}
|
|
54
|
+
isRTL={true}
|
|
55
|
+
menuShouldBlockScroll={true}
|
|
56
|
+
screenReaderStatus={''}
|
|
57
|
+
theme={{}}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
`,
|
|
62
|
+
`
|
|
63
|
+
import Select from '@foo/bar';
|
|
64
|
+
|
|
65
|
+
const App = () => {
|
|
66
|
+
return (
|
|
67
|
+
<Select
|
|
68
|
+
aria-errormessage={''}
|
|
69
|
+
aria-live={''}
|
|
70
|
+
ariaLiveMessages={''}
|
|
71
|
+
captureMenuOnScroll={true}
|
|
72
|
+
delimiter={''}
|
|
73
|
+
isRTL={true}
|
|
74
|
+
menuShouldBlockScroll={true}
|
|
75
|
+
screenReaderStatus={''}
|
|
76
|
+
theme={{}}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
`,
|
|
81
|
+
'should not mutate if not from @atlaskit/select',
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
[
|
|
85
|
+
'Select',
|
|
86
|
+
'AsyncSelect',
|
|
87
|
+
'CheckboxSelect',
|
|
88
|
+
'CountrySelect',
|
|
89
|
+
'CreatableSelect',
|
|
90
|
+
'PopupSelect',
|
|
91
|
+
'RadioSelect',
|
|
92
|
+
].forEach((identifier) => {
|
|
93
|
+
const variant = identifier === `Select` ? 'Select' : `{ ${identifier} }`;
|
|
94
|
+
defineInlineTest(
|
|
95
|
+
{ ...transformer, parser: 'tsx' },
|
|
96
|
+
{},
|
|
97
|
+
`
|
|
98
|
+
import ${variant} from '@atlaskit/select';
|
|
99
|
+
|
|
100
|
+
const App = () => {
|
|
101
|
+
return (
|
|
102
|
+
<${identifier}
|
|
103
|
+
aria-errormessage={''}
|
|
104
|
+
aria-live={''}
|
|
105
|
+
ariaLiveMessages={''}
|
|
106
|
+
captureMenuOnScroll={true}
|
|
107
|
+
delimiter={''}
|
|
108
|
+
isRTL={true}
|
|
109
|
+
menuShouldBlockScroll={true}
|
|
110
|
+
screenReaderStatus={''}
|
|
111
|
+
theme={{}}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
`,
|
|
116
|
+
`
|
|
117
|
+
import ${variant} from '@atlaskit/select';
|
|
118
|
+
|
|
119
|
+
const App = () => {
|
|
120
|
+
return <${identifier} />;
|
|
121
|
+
};
|
|
122
|
+
`,
|
|
123
|
+
`should remove all deleted props for ${identifier} `,
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
defineInlineTest(
|
|
127
|
+
{ ...transformer, parser: 'tsx' },
|
|
128
|
+
{},
|
|
129
|
+
`
|
|
130
|
+
import ${variant} from '@atlaskit/select';
|
|
131
|
+
|
|
132
|
+
const App = () => {
|
|
133
|
+
return <${identifier} aria-invalid={true} aria-label={''} aria-labelledby={''} disabled={''} />;
|
|
134
|
+
};
|
|
135
|
+
`,
|
|
136
|
+
`
|
|
137
|
+
import ${variant} from '@atlaskit/select';
|
|
138
|
+
|
|
139
|
+
const App = () => {
|
|
140
|
+
return <${identifier} isInvalid={true} label={''} labelId={''} isDisabled={''} />;
|
|
141
|
+
};
|
|
142
|
+
`,
|
|
143
|
+
`should transform all replaced props for ${identifier}`,
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
defineInlineTest(
|
|
147
|
+
{ ...transformer, parser: 'tsx' },
|
|
148
|
+
{},
|
|
149
|
+
`
|
|
150
|
+
import ${variant} from '@atlaskit/select';
|
|
151
|
+
|
|
152
|
+
const App = () => {
|
|
153
|
+
return <${identifier} validationState='error' />;
|
|
154
|
+
};
|
|
155
|
+
`,
|
|
156
|
+
`
|
|
157
|
+
import ${variant} from '@atlaskit/select';
|
|
158
|
+
|
|
159
|
+
const App = () => {
|
|
160
|
+
return <${identifier} isInvalid />;
|
|
161
|
+
};
|
|
162
|
+
`,
|
|
163
|
+
`should transform validationState="error" to isInvalid for ${identifier}`,
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
defineInlineTest(
|
|
167
|
+
{ ...transformer, parser: 'tsx' },
|
|
168
|
+
{},
|
|
169
|
+
`
|
|
170
|
+
import ${variant} from '@atlaskit/select';
|
|
171
|
+
|
|
172
|
+
const App = () => {
|
|
173
|
+
return <${identifier} validationState = 'default' />;
|
|
174
|
+
};
|
|
175
|
+
`,
|
|
176
|
+
`
|
|
177
|
+
import ${variant} from '@atlaskit/select';
|
|
178
|
+
|
|
179
|
+
const App = () => {
|
|
180
|
+
return <${identifier} />;
|
|
181
|
+
};
|
|
182
|
+
`,
|
|
183
|
+
`should remove validationState when set to "default" for ${identifier}`,
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
defineInlineTest(
|
|
187
|
+
{ ...transformer, parser: 'tsx' },
|
|
188
|
+
{},
|
|
189
|
+
`
|
|
190
|
+
import ${variant} from '@atlaskit/select';
|
|
191
|
+
|
|
192
|
+
const App = () => {
|
|
193
|
+
return <${identifier} validationState = 'success' />;
|
|
194
|
+
};
|
|
195
|
+
`,
|
|
196
|
+
`
|
|
197
|
+
import ${variant} from '@atlaskit/select';
|
|
198
|
+
|
|
199
|
+
const App = () => {
|
|
200
|
+
return <${identifier} />;
|
|
201
|
+
};
|
|
202
|
+
`,
|
|
203
|
+
`should remove validationState when set to "success" for ${identifier}`,
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
// TODO: Enable once we have cleaned up validationState
|
|
207
|
+
// defineInlineTest(
|
|
208
|
+
// { ...transformer, parser: 'tsx' },
|
|
209
|
+
// {},
|
|
210
|
+
// `
|
|
211
|
+
// import Select from '@atlaskit/select';
|
|
212
|
+
|
|
213
|
+
// const App = () => {
|
|
214
|
+
// return (
|
|
215
|
+
// <${identifier}
|
|
216
|
+
// validationState={value}
|
|
217
|
+
// />
|
|
218
|
+
// )
|
|
219
|
+
// }
|
|
220
|
+
// `,
|
|
221
|
+
// `
|
|
222
|
+
// import Select from '@atlaskit/select';
|
|
223
|
+
|
|
224
|
+
// const App = () => {
|
|
225
|
+
// return (
|
|
226
|
+
// <${identifier}
|
|
227
|
+
// validationState={!value}
|
|
228
|
+
// />
|
|
229
|
+
// );
|
|
230
|
+
// }
|
|
231
|
+
// `,
|
|
232
|
+
// 'should transform validationState to isInvalid and negate when an expression is provided"',
|
|
233
|
+
// );
|
|
234
|
+
|
|
235
|
+
defineInlineTest(
|
|
236
|
+
{ ...transformer, parser: 'tsx' },
|
|
237
|
+
{},
|
|
238
|
+
`
|
|
239
|
+
const App = () => {
|
|
240
|
+
return (
|
|
241
|
+
<${identifier}
|
|
242
|
+
aria-errormessage={''}
|
|
243
|
+
aria-live={''}
|
|
244
|
+
ariaLiveMessages={''}
|
|
245
|
+
captureMenuOnScroll={true}
|
|
246
|
+
delimiter={''}
|
|
247
|
+
isRTL={true}
|
|
248
|
+
menuShouldBlockScroll={true}
|
|
249
|
+
screenReaderStatus={''}
|
|
250
|
+
theme={{}}
|
|
251
|
+
/>
|
|
252
|
+
);
|
|
253
|
+
};
|
|
254
|
+
`,
|
|
255
|
+
`
|
|
256
|
+
const App = () => {
|
|
257
|
+
return (
|
|
258
|
+
<${identifier}
|
|
259
|
+
aria-errormessage={''}
|
|
260
|
+
aria-live={''}
|
|
261
|
+
ariaLiveMessages={''}
|
|
262
|
+
captureMenuOnScroll={true}
|
|
263
|
+
delimiter={''}
|
|
264
|
+
isRTL={true}
|
|
265
|
+
menuShouldBlockScroll={true}
|
|
266
|
+
screenReaderStatus={''}
|
|
267
|
+
theme={{}}
|
|
268
|
+
/>
|
|
269
|
+
);
|
|
270
|
+
};
|
|
271
|
+
`,
|
|
272
|
+
'should not mutate JSX if import is missing',
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
defineInlineTest(
|
|
276
|
+
{ ...transformer, parser: 'tsx' },
|
|
277
|
+
{},
|
|
278
|
+
`
|
|
279
|
+
import ${identifier === 'Select' ? `Ak${identifier}` : `{${identifier} as Ak${identifier}}`} from '@atlaskit/select';
|
|
280
|
+
|
|
281
|
+
const App = () => {
|
|
282
|
+
return (
|
|
283
|
+
<Ak${identifier}
|
|
284
|
+
aria-errormessage={''}
|
|
285
|
+
aria-live={''}
|
|
286
|
+
ariaLiveMessages={''}
|
|
287
|
+
captureMenuOnScroll={true}
|
|
288
|
+
delimiter={''}
|
|
289
|
+
isRTL={true}
|
|
290
|
+
menuShouldBlockScroll={true}
|
|
291
|
+
screenReaderStatus={''}
|
|
292
|
+
theme={{}}
|
|
293
|
+
/>
|
|
294
|
+
);
|
|
295
|
+
};
|
|
296
|
+
`,
|
|
297
|
+
`
|
|
298
|
+
import ${identifier === 'Select' ? `Ak${identifier}` : `{${identifier} as Ak${identifier}}`} from '@atlaskit/select';
|
|
299
|
+
|
|
300
|
+
const App = () => {
|
|
301
|
+
return <Ak${identifier} />;
|
|
302
|
+
};
|
|
303
|
+
`,
|
|
304
|
+
`should handle named imports for ${identifier} `,
|
|
305
|
+
);
|
|
306
|
+
});
|
|
307
|
+
});
|
package/dist/cjs/Select.js
CHANGED
|
@@ -11,7 +11,7 @@ var _createSelect = _interopRequireDefault(require("./createSelect"));
|
|
|
11
11
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
12
12
|
|
|
13
13
|
var packageName = "@atlaskit/select";
|
|
14
|
-
var packageVersion = "18.
|
|
14
|
+
var packageVersion = "18.4.0";
|
|
15
15
|
var SelectWithoutAnalytics = exports.SelectWithoutAnalytics = (0, _createSelect.default)(_reactSelect.default);
|
|
16
16
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
17
17
|
var Select = (0, _analyticsNext.withAnalyticsContext)({
|
|
@@ -7,17 +7,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.LoadingIndicator = exports.DropdownIndicator = exports.ClearIndicator = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = require("@emotion/react");
|
|
11
12
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-down"));
|
|
12
13
|
var _crossCircleSelectClear = _interopRequireDefault(require("@atlaskit/icon/utility/migration/cross-circle--select-clear"));
|
|
13
14
|
var _primitives = require("@atlaskit/primitives");
|
|
14
15
|
var _reactSelect = require("@atlaskit/react-select");
|
|
15
16
|
var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
var _excluded = ["clearControlLabel"];
|
|
18
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
19
|
+
/**
|
|
18
20
|
* @jsxRuntime classic
|
|
19
21
|
* @jsx jsx
|
|
20
|
-
*/
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
24
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
26
|
var iconContainerStyles = (0, _primitives.xcss)({
|
|
22
27
|
all: 'unset',
|
|
23
28
|
outline: 'revert',
|
|
@@ -29,16 +34,20 @@ var iconContainerStyles = (0, _primitives.xcss)({
|
|
|
29
34
|
var dropdownWrapperStyles = (0, _primitives.xcss)({
|
|
30
35
|
padding: 'space.075'
|
|
31
36
|
});
|
|
32
|
-
var ClearIndicator = exports.ClearIndicator = function ClearIndicator(
|
|
37
|
+
var ClearIndicator = exports.ClearIndicator = function ClearIndicator(_ref) {
|
|
38
|
+
var _ref$clearControlLabe = _ref.clearControlLabel,
|
|
39
|
+
clearControlLabel = _ref$clearControlLabe === void 0 ? 'clear' : _ref$clearControlLabe,
|
|
40
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
33
41
|
return (0, _react.jsx)(_reactSelect.components.ClearIndicator, _objectSpread(_objectSpread({}, props), {}, {
|
|
34
42
|
innerProps: _objectSpread(_objectSpread({}, props.innerProps), {}, {
|
|
35
43
|
'aria-hidden': 'false'
|
|
36
44
|
})
|
|
37
45
|
}), (0, _react.jsx)(_primitives.Pressable, {
|
|
38
46
|
xcss: iconContainerStyles,
|
|
39
|
-
tabIndex: -1
|
|
47
|
+
tabIndex: -1,
|
|
48
|
+
"aria-label": clearControlLabel
|
|
40
49
|
}, (0, _react.jsx)(_crossCircleSelectClear.default, {
|
|
41
|
-
label: "
|
|
50
|
+
label: "",
|
|
42
51
|
color: "currentColor",
|
|
43
52
|
LEGACY_size: "small",
|
|
44
53
|
LEGACY_margin: "var(--ds-space-negative-025, -0.125rem)"
|
|
@@ -12,10 +12,7 @@ var _reactSelect = require("@atlaskit/react-select");
|
|
|
12
12
|
* __No options message__
|
|
13
13
|
*/
|
|
14
14
|
var NoOptionsMessage = exports.NoOptionsMessage = function NoOptionsMessage(props) {
|
|
15
|
-
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.NoOptionsMessage, props, /*#__PURE__*/_react.default.createElement(
|
|
16
|
-
id: "no-options",
|
|
17
|
-
role: "alert"
|
|
18
|
-
}, /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.NoOptionsMessage, props, /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
19
16
|
color: "color.text.subtle"
|
|
20
|
-
}, props.children || "No options"))
|
|
17
|
+
}, props.children || "No options"));
|
|
21
18
|
};
|
package/dist/es2019/Select.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
3
3
|
import ReactSelect from '@atlaskit/react-select';
|
|
4
4
|
import createSelect from './createSelect';
|
|
5
5
|
const packageName = "@atlaskit/select";
|
|
6
|
-
const packageVersion = "18.
|
|
6
|
+
const packageVersion = "18.4.0";
|
|
7
7
|
export const SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
8
8
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
9
9
|
const Select = withAnalyticsContext({
|
|
@@ -22,20 +22,26 @@ const iconContainerStyles = xcss({
|
|
|
22
22
|
const dropdownWrapperStyles = xcss({
|
|
23
23
|
padding: 'space.075'
|
|
24
24
|
});
|
|
25
|
-
export const ClearIndicator =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
25
|
+
export const ClearIndicator = ({
|
|
26
|
+
clearControlLabel = 'clear',
|
|
27
|
+
...props
|
|
28
|
+
}) => {
|
|
29
|
+
return jsx(components.ClearIndicator, _extends({}, props, {
|
|
30
|
+
innerProps: {
|
|
31
|
+
...props.innerProps,
|
|
32
|
+
'aria-hidden': 'false'
|
|
33
|
+
}
|
|
34
|
+
}), jsx(Pressable, {
|
|
35
|
+
xcss: iconContainerStyles,
|
|
36
|
+
tabIndex: -1,
|
|
37
|
+
"aria-label": clearControlLabel
|
|
38
|
+
}, jsx(CrossIcon, {
|
|
39
|
+
label: "",
|
|
40
|
+
color: "currentColor",
|
|
41
|
+
LEGACY_size: "small",
|
|
42
|
+
LEGACY_margin: "var(--ds-space-negative-025, -0.125rem)"
|
|
43
|
+
})));
|
|
44
|
+
};
|
|
39
45
|
export const DropdownIndicator = props =>
|
|
40
46
|
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
41
47
|
jsx(components.DropdownIndicator, props, jsx(Inline, {
|
|
@@ -5,10 +5,7 @@ import { components } from '@atlaskit/react-select';
|
|
|
5
5
|
* __No options message__
|
|
6
6
|
*/
|
|
7
7
|
export const NoOptionsMessage = props => {
|
|
8
|
-
return /*#__PURE__*/React.createElement(components.NoOptionsMessage, props, /*#__PURE__*/React.createElement(
|
|
9
|
-
id: "no-options",
|
|
10
|
-
role: "alert"
|
|
11
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
8
|
+
return /*#__PURE__*/React.createElement(components.NoOptionsMessage, props, /*#__PURE__*/React.createElement(Text, {
|
|
12
9
|
color: "color.text.subtle"
|
|
13
|
-
}, props.children || `No options`))
|
|
10
|
+
}, props.children || `No options`));
|
|
14
11
|
};
|
package/dist/esm/Select.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
3
3
|
import ReactSelect from '@atlaskit/react-select';
|
|
4
4
|
import createSelect from './createSelect';
|
|
5
5
|
var packageName = "@atlaskit/select";
|
|
6
|
-
var packageVersion = "18.
|
|
6
|
+
var packageVersion = "18.4.0";
|
|
7
7
|
export var SelectWithoutAnalytics = createSelect(ReactSelect);
|
|
8
8
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
9
9
|
var Select = withAnalyticsContext({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["clearControlLabel"];
|
|
3
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
7
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
@@ -25,16 +27,20 @@ var iconContainerStyles = xcss({
|
|
|
25
27
|
var dropdownWrapperStyles = xcss({
|
|
26
28
|
padding: 'space.075'
|
|
27
29
|
});
|
|
28
|
-
export var ClearIndicator = function ClearIndicator(
|
|
30
|
+
export var ClearIndicator = function ClearIndicator(_ref) {
|
|
31
|
+
var _ref$clearControlLabe = _ref.clearControlLabel,
|
|
32
|
+
clearControlLabel = _ref$clearControlLabe === void 0 ? 'clear' : _ref$clearControlLabe,
|
|
33
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
34
|
return jsx(components.ClearIndicator, _objectSpread(_objectSpread({}, props), {}, {
|
|
30
35
|
innerProps: _objectSpread(_objectSpread({}, props.innerProps), {}, {
|
|
31
36
|
'aria-hidden': 'false'
|
|
32
37
|
})
|
|
33
38
|
}), jsx(Pressable, {
|
|
34
39
|
xcss: iconContainerStyles,
|
|
35
|
-
tabIndex: -1
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
"aria-label": clearControlLabel
|
|
36
42
|
}, jsx(CrossIcon, {
|
|
37
|
-
label: "
|
|
43
|
+
label: "",
|
|
38
44
|
color: "currentColor",
|
|
39
45
|
LEGACY_size: "small",
|
|
40
46
|
LEGACY_margin: "var(--ds-space-negative-025, -0.125rem)"
|
|
@@ -5,10 +5,7 @@ import { components } from '@atlaskit/react-select';
|
|
|
5
5
|
* __No options message__
|
|
6
6
|
*/
|
|
7
7
|
export var NoOptionsMessage = function NoOptionsMessage(props) {
|
|
8
|
-
return /*#__PURE__*/React.createElement(components.NoOptionsMessage, props, /*#__PURE__*/React.createElement(
|
|
9
|
-
id: "no-options",
|
|
10
|
-
role: "alert"
|
|
11
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
8
|
+
return /*#__PURE__*/React.createElement(components.NoOptionsMessage, props, /*#__PURE__*/React.createElement(Text, {
|
|
12
9
|
color: "color.text.subtle"
|
|
13
|
-
}, props.children || "No options"))
|
|
10
|
+
}, props.children || "No options"));
|
|
14
11
|
};
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type ClearIndicatorProps, type DropdownIndicatorProps, type LoadingIndicatorProps } from '../types';
|
|
7
|
-
export declare const ClearIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: ClearIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
7
|
+
export declare const ClearIndicator: <Option extends unknown, IsMulti extends boolean = false>({ clearControlLabel, ...props }: ClearIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
8
8
|
export declare const DropdownIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: DropdownIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
9
9
|
export declare const LoadingIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: LoadingIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type ClearIndicatorProps, type DropdownIndicatorProps, type LoadingIndicatorProps } from '../types';
|
|
7
|
-
export declare const ClearIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: ClearIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
7
|
+
export declare const ClearIndicator: <Option extends unknown, IsMulti extends boolean = false>({ clearControlLabel, ...props }: ClearIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
8
8
|
export declare const DropdownIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: DropdownIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
|
9
9
|
export declare const LoadingIndicator: <Option extends unknown, IsMulti extends boolean = false>(props: LoadingIndicatorProps<Option, IsMulti>) => jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/select",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.4.0",
|
|
4
4
|
"description": "Select allows users to make a single selection or multiple selections from a list of options.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
42
42
|
"@atlaskit/ds-lib": "^3.1.0",
|
|
43
|
-
"@atlaskit/icon": "^22.
|
|
43
|
+
"@atlaskit/icon": "^22.24.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
45
45
|
"@atlaskit/primitives": "^12.2.0",
|
|
46
|
-
"@atlaskit/react-select": "^1.0
|
|
46
|
+
"@atlaskit/react-select": "^1.2.0",
|
|
47
47
|
"@atlaskit/spinner": "^16.3.0",
|
|
48
48
|
"@atlaskit/theme": "^14.0.0",
|
|
49
49
|
"@atlaskit/tokens": "^2.0.0",
|
|
@@ -110,6 +110,10 @@
|
|
|
110
110
|
},
|
|
111
111
|
"platform_dst_select-bump-react-focus-lock": {
|
|
112
112
|
"type": "boolean"
|
|
113
|
+
},
|
|
114
|
+
"design_system_select-a11y-improvement": {
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"referenceOnly": true
|
|
113
117
|
}
|
|
114
118
|
},
|
|
115
119
|
"homepage": "https://atlassian.design/components/select/"
|