@atlaskit/modal-dialog 14.11.1 → 14.11.2
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 +6 -0
- package/codemods/__tests__/not-yet-boolean-autofocus-removal.tsx +70 -0
- package/codemods/utils.tsx +8 -3
- package/dist/cjs/internal/components/modal-wrapper.js +1 -1
- package/dist/es2019/internal/components/modal-wrapper.js +1 -1
- package/dist/esm/internal/components/modal-wrapper.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -152,4 +152,74 @@ describe('Remove autoFocus prop', () => {
|
|
|
152
152
|
`,
|
|
153
153
|
'should remove autoFocus prop with aliased import',
|
|
154
154
|
);
|
|
155
|
+
defineInlineTest(
|
|
156
|
+
{ default: transformer, parser: 'tsx' },
|
|
157
|
+
{},
|
|
158
|
+
`
|
|
159
|
+
import React from 'react';
|
|
160
|
+
import Button from '@atlaskit/button';
|
|
161
|
+
import { ModalDialog } from '@atlaskit/modal-dialog';
|
|
162
|
+
|
|
163
|
+
const SimpleModalDialog = () => {
|
|
164
|
+
return (
|
|
165
|
+
<ModalDialog onClose={closeModal} width={1100}>
|
|
166
|
+
<Button appearance="primary" onClick={closeModal} autoFocus>
|
|
167
|
+
Close
|
|
168
|
+
</Button>
|
|
169
|
+
</ModalDialog>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
`,
|
|
173
|
+
`
|
|
174
|
+
import React from 'react';
|
|
175
|
+
import Button from '@atlaskit/button';
|
|
176
|
+
import { ModalDialog } from '@atlaskit/modal-dialog';
|
|
177
|
+
|
|
178
|
+
const SimpleModalDialog = () => {
|
|
179
|
+
return (
|
|
180
|
+
<ModalDialog onClose={closeModal} width={1100}>
|
|
181
|
+
<Button appearance="primary" onClick={closeModal} autoFocus>
|
|
182
|
+
Close
|
|
183
|
+
</Button>
|
|
184
|
+
</ModalDialog>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
`,
|
|
188
|
+
'should not remove autoFocus prop from component inside modal',
|
|
189
|
+
);
|
|
190
|
+
defineInlineTest(
|
|
191
|
+
{ default: transformer, parser: 'tsx' },
|
|
192
|
+
{},
|
|
193
|
+
`
|
|
194
|
+
import React from 'react';
|
|
195
|
+
import Button from '@atlaskit/button';
|
|
196
|
+
import { ModalDialog } from '@atlaskit/modal-dialog';
|
|
197
|
+
|
|
198
|
+
const SimpleModalDialog = () => {
|
|
199
|
+
return (
|
|
200
|
+
<ModalDialog onClose={closeModal} width={1100} autoFocus={false}>
|
|
201
|
+
<Button appearance="primary" onClick={closeModal} autoFocus>
|
|
202
|
+
Close
|
|
203
|
+
</Button>
|
|
204
|
+
</ModalDialog>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
`,
|
|
208
|
+
`
|
|
209
|
+
import React from 'react';
|
|
210
|
+
import Button from '@atlaskit/button';
|
|
211
|
+
import { ModalDialog } from '@atlaskit/modal-dialog';
|
|
212
|
+
|
|
213
|
+
const SimpleModalDialog = () => {
|
|
214
|
+
return (
|
|
215
|
+
<ModalDialog onClose={closeModal} width={1100}>
|
|
216
|
+
<Button appearance="primary" onClick={closeModal} autoFocus>
|
|
217
|
+
Close
|
|
218
|
+
</Button>
|
|
219
|
+
</ModalDialog>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
`,
|
|
223
|
+
'should remove modal autoFocus but not from component inside modal',
|
|
224
|
+
);
|
|
155
225
|
});
|
package/codemods/utils.tsx
CHANGED
|
@@ -280,10 +280,15 @@ export const createRemoveFuncIfBooleanFor: (
|
|
|
280
280
|
|
|
281
281
|
source.findJSXElements(specifier).forEach((element) => {
|
|
282
282
|
getJSXAttributesByName(j, element, prop).forEach((attribute) => {
|
|
283
|
+
const el = attribute.parent.value;
|
|
283
284
|
if (
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
// Verify the element we are working on is the element we want
|
|
286
|
+
el.type === 'JSXOpeningElement' &&
|
|
287
|
+
el.name.type === 'JSXIdentifier' &&
|
|
288
|
+
el.name.name === specifier &&
|
|
289
|
+
(attribute.value.value === null ||
|
|
290
|
+
(attribute.value.value?.type === 'JSXExpressionContainer' &&
|
|
291
|
+
attribute.value.value.expression.type === 'BooleanLiteral'))
|
|
287
292
|
) {
|
|
288
293
|
j(attribute).remove();
|
|
289
294
|
if (comment) {
|
|
@@ -88,7 +88,7 @@ var InternalModalWrapper = function InternalModalWrapper(props) {
|
|
|
88
88
|
action: 'closed',
|
|
89
89
|
componentName: 'modalDialog',
|
|
90
90
|
packageName: "@atlaskit/modal-dialog",
|
|
91
|
-
packageVersion: "14.11.
|
|
91
|
+
packageVersion: "14.11.1"
|
|
92
92
|
});
|
|
93
93
|
var onBlanketClicked = (0, _react.useCallback)(function (e) {
|
|
94
94
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -75,7 +75,7 @@ const InternalModalWrapper = props => {
|
|
|
75
75
|
action: 'closed',
|
|
76
76
|
componentName: 'modalDialog',
|
|
77
77
|
packageName: "@atlaskit/modal-dialog",
|
|
78
|
-
packageVersion: "14.11.
|
|
78
|
+
packageVersion: "14.11.1"
|
|
79
79
|
});
|
|
80
80
|
const onBlanketClicked = useCallback(e => {
|
|
81
81
|
if (shouldCloseOnOverlayClick) {
|
|
@@ -79,7 +79,7 @@ var InternalModalWrapper = function InternalModalWrapper(props) {
|
|
|
79
79
|
action: 'closed',
|
|
80
80
|
componentName: 'modalDialog',
|
|
81
81
|
packageName: "@atlaskit/modal-dialog",
|
|
82
|
-
packageVersion: "14.11.
|
|
82
|
+
packageVersion: "14.11.1"
|
|
83
83
|
});
|
|
84
84
|
var onBlanketClicked = useCallback(function (e) {
|
|
85
85
|
if (shouldCloseOnOverlayClick) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/modal-dialog",
|
|
3
|
-
"version": "14.11.
|
|
3
|
+
"version": "14.11.2",
|
|
4
4
|
"description": "A modal dialog displays content that requires user interaction, in a layer above the page.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
31
31
|
"@atlaskit/blanket": "^15.0.0",
|
|
32
|
-
"@atlaskit/button": "^23.
|
|
32
|
+
"@atlaskit/button": "^23.10.0",
|
|
33
33
|
"@atlaskit/css": "^0.19.0",
|
|
34
34
|
"@atlaskit/ds-lib": "^5.3.0",
|
|
35
35
|
"@atlaskit/icon": "^32.0.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/portal": "^5.2.0",
|
|
40
40
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
41
41
|
"@atlaskit/primitives": "^18.0.0",
|
|
42
|
-
"@atlaskit/theme": "^
|
|
42
|
+
"@atlaskit/theme": "^22.0.0",
|
|
43
43
|
"@atlaskit/tokens": "^11.0.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@compiled/react": "^0.18.6",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@atlaskit/checkbox": "^17.3.0",
|
|
63
63
|
"@atlaskit/code": "^17.4.0",
|
|
64
64
|
"@atlaskit/datetime-picker": "^17.5.0",
|
|
65
|
-
"@atlaskit/docs": "^11.
|
|
66
|
-
"@atlaskit/dropdown-menu": "^16.
|
|
65
|
+
"@atlaskit/docs": "^11.5.0",
|
|
66
|
+
"@atlaskit/dropdown-menu": "^16.5.0",
|
|
67
67
|
"@atlaskit/flag": "^17.8.0",
|
|
68
68
|
"@atlaskit/form": "^15.3.0",
|
|
69
69
|
"@atlaskit/heading": "^5.3.0",
|