@atlaskit/modal-dialog 14.10.3 → 14.10.5

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,19 @@
1
1
  # @atlaskit/modal-dialog
2
2
 
3
+ ## 14.10.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`54274768b5a88`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/54274768b5a88) -
8
+ Fixed an issue where the modal title could overflow the width of the modal instead of truncating
9
+ when `isMultiline` is set to false
10
+
11
+ ## 14.10.4
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 14.10.3
4
18
 
5
19
  ### Patch Changes
@@ -0,0 +1,155 @@
1
+ jest.autoMockOff();
2
+
3
+ import transformer from '../not-yet-boolean-autofocus-removal';
4
+
5
+ const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
6
+
7
+ describe('Remove autoFocus prop', () => {
8
+ defineInlineTest(
9
+ { default: transformer, parser: 'tsx' },
10
+ {},
11
+ `
12
+ import React from 'react';
13
+ import ModalDialog from '@atlaskit/modal-dialog';
14
+
15
+ const SimpleModalDialog = () => {
16
+ return <ModalDialog autoFocus />;
17
+ }
18
+ `,
19
+ `
20
+ import React from 'react';
21
+ import ModalDialog from '@atlaskit/modal-dialog';
22
+
23
+ const SimpleModalDialog = () => {
24
+ return <ModalDialog />;
25
+ }
26
+ `,
27
+ 'should remove "true" boolean autoFocus prop from default import',
28
+ );
29
+ defineInlineTest(
30
+ { default: transformer, parser: 'tsx' },
31
+ {},
32
+ `
33
+ import React from 'react';
34
+ import ModalDialog from '@atlaskit/modal-dialog';
35
+
36
+ const SimpleModalDialog = () => {
37
+ return <ModalDialog autoFocus={true} />;
38
+ }
39
+ `,
40
+ `
41
+ import React from 'react';
42
+ import ModalDialog from '@atlaskit/modal-dialog';
43
+
44
+ const SimpleModalDialog = () => {
45
+ return <ModalDialog />;
46
+ }
47
+ `,
48
+ 'should remove boolean true autoFocus prop from default import',
49
+ );
50
+ defineInlineTest(
51
+ { default: transformer, parser: 'tsx' },
52
+ {},
53
+ `
54
+ import React from 'react';
55
+ import ModalDialog from '@atlaskit/modal-dialog';
56
+
57
+ const SimpleModalDialog = () => {
58
+ return <ModalDialog autoFocus={false} />;
59
+ }
60
+ `,
61
+ `
62
+ import React from 'react';
63
+ import ModalDialog from '@atlaskit/modal-dialog';
64
+
65
+ const SimpleModalDialog = () => {
66
+ return <ModalDialog />;
67
+ }
68
+ `,
69
+ 'should remove boolean false autoFocus prop from default import',
70
+ );
71
+ defineInlineTest(
72
+ { default: transformer, parser: 'tsx' },
73
+ {},
74
+ `
75
+ import React from 'react';
76
+ import ModalDialog from '@atlaskit/modal-dialog';
77
+
78
+ const SimpleModalDialog = () => {
79
+ return <ModalDialog autoFocus={ref} />;
80
+ }
81
+ `,
82
+ `
83
+ import React from 'react';
84
+ import ModalDialog from '@atlaskit/modal-dialog';
85
+
86
+ const SimpleModalDialog = () => {
87
+ return <ModalDialog autoFocus={ref} />;
88
+ }
89
+ `,
90
+ 'should not remove non-boolean autoFocus prop from default import',
91
+ );
92
+ defineInlineTest(
93
+ { default: transformer, parser: 'tsx' },
94
+ {},
95
+ `
96
+ import React from 'react';
97
+ import { ModalDialog } from '@atlaskit/modal-dialog';
98
+
99
+ const SimpleModalDialog = () => {
100
+ return <ModalDialog autoFocus={false} />;
101
+ }
102
+ `,
103
+ `
104
+ import React from 'react';
105
+ import { ModalDialog } from '@atlaskit/modal-dialog';
106
+
107
+ const SimpleModalDialog = () => {
108
+ return <ModalDialog />;
109
+ }
110
+ `,
111
+ 'should remove autoFocus prop from named import',
112
+ );
113
+ defineInlineTest(
114
+ { default: transformer, parser: 'tsx' },
115
+ {},
116
+ `
117
+ import React from 'react';
118
+ import { ModalDialog } from '@foo/bar';
119
+
120
+ const SimpleModalDialog = () => {
121
+ return <ModalDialog autoFocus={false} />;
122
+ }
123
+ `,
124
+ `
125
+ import React from 'react';
126
+ import { ModalDialog } from '@foo/bar';
127
+
128
+ const SimpleModalDialog = () => {
129
+ return <ModalDialog autoFocus={false} />;
130
+ }
131
+ `,
132
+ 'should do nothing if not correct import',
133
+ );
134
+ defineInlineTest(
135
+ { default: transformer, parser: 'tsx' },
136
+ {},
137
+ `
138
+ import React from 'react';
139
+ import { ModalDialog as AkModalDialog } from '@atlaskit/modal-dialog';
140
+
141
+ const SimpleModalDialog = () => {
142
+ return <AkModalDialog autoFocus={false} />;
143
+ }
144
+ `,
145
+ `
146
+ import React from 'react';
147
+ import { ModalDialog as AkModalDialog } from '@atlaskit/modal-dialog';
148
+
149
+ const SimpleModalDialog = () => {
150
+ return <AkModalDialog />;
151
+ }
152
+ `,
153
+ 'should remove autoFocus prop with aliased import',
154
+ );
155
+ });
@@ -0,0 +1,6 @@
1
+ import { createRemoveFuncIfBooleanFor } from '../utils';
2
+
3
+ export const removeAutoFocus: (
4
+ j: import('jscodeshift/src/core').JSCodeshift,
5
+ source: import('jscodeshift/src/Collection').Collection<Node>,
6
+ ) => void = createRemoveFuncIfBooleanFor('@atlaskit/modal-dialog', 'ModalDialog', 'autoFocus');
@@ -0,0 +1,9 @@
1
+ import type { API, FileInfo, Options } from 'jscodeshift';
2
+
3
+ import { removeAutoFocus } from './migrations/remove-props';
4
+ import { createTransformer } from './utils';
5
+
6
+ const transformer: (fileInfo: FileInfo, { jscodeshift }: API, options: Options) => string =
7
+ createTransformer('@atlaskit/modal-dialog', [removeAutoFocus]);
8
+
9
+ export default transformer;
@@ -0,0 +1,457 @@
1
+ import type {
2
+ API,
3
+ ASTPath,
4
+ default as core,
5
+ FileInfo,
6
+ ImportDeclaration,
7
+ ImportDefaultSpecifier,
8
+ ImportSpecifier,
9
+ JSXAttribute,
10
+ Options,
11
+ Program,
12
+ VariableDeclaration,
13
+ } from 'jscodeshift';
14
+ import { type Collection } from 'jscodeshift/src/Collection';
15
+
16
+ export type Nullable<T> = T | null;
17
+
18
+ export function getNamedSpecifier(
19
+ j: core.JSCodeshift,
20
+ source: any,
21
+ specifier: string,
22
+ importName: string,
23
+ ): any {
24
+ const specifiers = source
25
+ .find(j.ImportDeclaration)
26
+ .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
27
+ .find(j.ImportSpecifier)
28
+ .filter((path: ASTPath<ImportSpecifier>) => path.node.imported.name === importName);
29
+
30
+ if (!specifiers.length) {
31
+ return null;
32
+ }
33
+ return specifiers.nodes()[0]!.local!.name;
34
+ }
35
+
36
+ function getDefaultSpecifier(j: core.JSCodeshift, source: ReturnType<typeof j>, specifier: string) {
37
+ const specifiers = source
38
+ .find(j.ImportDeclaration)
39
+ .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === specifier)
40
+ .find(j.ImportDefaultSpecifier);
41
+
42
+ if (!specifiers.length) {
43
+ return null;
44
+ }
45
+ return specifiers.nodes()[0]!.local!.name;
46
+ }
47
+
48
+ export function getJSXAttributesByName(
49
+ j: core.JSCodeshift,
50
+ element: ASTPath<any>,
51
+ attributeName: string,
52
+ ): Collection<JSXAttribute> {
53
+ return j(element)
54
+ .find(j.JSXOpeningElement)
55
+ .find(j.JSXAttribute)
56
+ .filter((attribute) => {
57
+ const matches = j(attribute)
58
+ .find(j.JSXIdentifier)
59
+ .filter((identifier) => identifier.value.name === attributeName);
60
+ return Boolean(matches.length);
61
+ });
62
+ }
63
+
64
+ export function hasImportDeclaration(j: core.JSCodeshift, source: any, importPath: string): boolean {
65
+ const imports = source
66
+ .find(j.ImportDeclaration)
67
+ .filter(
68
+ (path: ASTPath<ImportDeclaration>) =>
69
+ typeof path.node.source.value === 'string' && path.node.source.value.startsWith(importPath),
70
+ );
71
+
72
+ return Boolean(imports.length);
73
+ }
74
+
75
+ export function findIdentifierAndReplaceAttribute(
76
+ j: core.JSCodeshift,
77
+ source: ReturnType<typeof j>,
78
+ identifierName: string,
79
+ searchAttr: string,
80
+ replaceWithAttr: string,
81
+ ): void {
82
+ source
83
+ .find(j.JSXElement)
84
+ .find(j.JSXOpeningElement)
85
+ .filter((path) => {
86
+ return !!j(path.node)
87
+ .find(j.JSXIdentifier)
88
+ .filter((identifier) => identifier.value.name === identifierName);
89
+ })
90
+ .forEach((element) => {
91
+ j(element)
92
+ .find(j.JSXAttribute)
93
+ .find(j.JSXIdentifier)
94
+ .filter((attr) => attr.node.name === searchAttr)
95
+ .forEach((attribute) => {
96
+ j(attribute).replaceWith(j.jsxIdentifier(replaceWithAttr));
97
+ });
98
+ });
99
+ }
100
+
101
+ export function hasVariableAssignment(
102
+ j: core.JSCodeshift,
103
+ source: ReturnType<typeof j>,
104
+ identifierName: string,
105
+ ): Collection<VariableDeclaration> | boolean {
106
+ const occurance = source.find(j.VariableDeclaration).filter((path) => {
107
+ return !!j(path.node)
108
+ .find(j.VariableDeclarator)
109
+ .find(j.Identifier)
110
+ .filter((identifier) => {
111
+ return identifier.node.name === identifierName;
112
+ }).length;
113
+ });
114
+ return !!occurance.length ? occurance : false;
115
+ }
116
+
117
+ // not replacing newlines (which \s does)
118
+ const spacesAndTabs: RegExp = /[ \t]{2,}/g;
119
+ const lineStartWithSpaces: RegExp = /^[ \t]*/gm;
120
+
121
+ function clean(value: string): string {
122
+ return (
123
+ value
124
+ .replace(spacesAndTabs, ' ')
125
+ .replace(lineStartWithSpaces, '')
126
+ // using .trim() to clear the any newlines before the first text and after last text
127
+ .trim()
128
+ );
129
+ }
130
+
131
+ export function addCommentToStartOfFile({
132
+ j,
133
+ base,
134
+ message,
135
+ }: {
136
+ j: core.JSCodeshift;
137
+ base: Collection<Node>;
138
+ message: string;
139
+ }): void {
140
+ addCommentBefore({
141
+ j,
142
+ target: base.find(j.Program),
143
+ message,
144
+ });
145
+ }
146
+
147
+ export function addCommentBefore({
148
+ j,
149
+ target,
150
+ message,
151
+ }: {
152
+ j: core.JSCodeshift;
153
+ target: Collection<Program> | Collection<ImportDeclaration>;
154
+ message: string;
155
+ }): void {
156
+ const content: string = ` TODO: (from codemod) ${clean(message)} `;
157
+ target.forEach((path: ASTPath<Program | ImportDeclaration>) => {
158
+ path.value.comments = path.value.comments || [];
159
+
160
+ const exists = path.value.comments.find((comment) => comment.value === content);
161
+
162
+ // avoiding duplicates of the same comment
163
+ if (exists) {
164
+ return;
165
+ }
166
+
167
+ path.value.comments.push(j.commentBlock(content));
168
+ });
169
+ }
170
+
171
+ export function tryCreateImport({
172
+ j,
173
+ base,
174
+ relativeToPackage,
175
+ packageName,
176
+ }: {
177
+ j: core.JSCodeshift;
178
+ base: Collection<any>;
179
+ relativeToPackage: string;
180
+ packageName: string;
181
+ }): void {
182
+ const exists: boolean =
183
+ base.find(j.ImportDeclaration).filter((path) => path.value.source.value === packageName)
184
+ .length > 0;
185
+
186
+ if (exists) {
187
+ return;
188
+ }
189
+
190
+ base
191
+ .find(j.ImportDeclaration)
192
+ .filter((path) => path.value.source.value === relativeToPackage)
193
+ .insertBefore(j.importDeclaration([], j.literal(packageName)));
194
+ }
195
+
196
+ export function addToImport({
197
+ j,
198
+ base,
199
+ importSpecifier,
200
+ packageName,
201
+ }: {
202
+ j: core.JSCodeshift;
203
+ base: Collection<any>;
204
+ importSpecifier: ImportSpecifier | ImportDefaultSpecifier;
205
+ packageName: string;
206
+ }): void {
207
+ base
208
+ .find(j.ImportDeclaration)
209
+ .filter((path) => path.value.source.value === packageName)
210
+ .replaceWith((declaration) => {
211
+ return j.importDeclaration(
212
+ [
213
+ // we are appending to the existing specifiers
214
+ // We are doing a filter hear because sometimes specifiers can be removed
215
+ // but they hand around in the declaration
216
+ ...(declaration.value.specifiers || []).filter(
217
+ (item) => item.type === 'ImportSpecifier' && item.imported != null,
218
+ ),
219
+ importSpecifier,
220
+ ],
221
+ j.literal(packageName),
222
+ );
223
+ });
224
+ }
225
+
226
+ export const createRenameFuncFor: (component: string, importName: string, from: string, to: string) => (j: core.JSCodeshift, source: Collection<Node>) => void =
227
+ (component: string, importName: string, from: string, to: string) =>
228
+ (j: core.JSCodeshift, source: Collection<Node>) => {
229
+ const specifier = getNamedSpecifier(j, source, component, importName);
230
+
231
+ if (!specifier) {
232
+ return;
233
+ }
234
+
235
+ source.findJSXElements(specifier).forEach((element) => {
236
+ getJSXAttributesByName(j, element, from).forEach((attribute) => {
237
+ j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier(to), attribute.node.value));
238
+ });
239
+ });
240
+
241
+ let variable = hasVariableAssignment(j, source, specifier);
242
+ if (variable) {
243
+ (variable as Collection<VariableDeclaration>)
244
+ .find(j.VariableDeclarator)
245
+ .forEach((declarator) => {
246
+ j(declarator)
247
+ .find(j.Identifier)
248
+ .filter((identifier) => identifier.name === 'id')
249
+ .forEach((ids) => {
250
+ findIdentifierAndReplaceAttribute(j, source, ids.node.name, from, to);
251
+ });
252
+ });
253
+ }
254
+ };
255
+
256
+ export const createRemoveFuncIfBooleanFor: (component: string, importName: string, prop: string, comment?: string) => (j: core.JSCodeshift, source: Collection<Node>) => void =
257
+ (component: string, importName: string, prop: string, comment?: string) =>
258
+ (j: core.JSCodeshift, source: Collection<Node>) => {
259
+ const specifier =
260
+ getNamedSpecifier(j, source, component, importName) ||
261
+ getDefaultSpecifier(j, source, component);
262
+
263
+ if (!specifier) {
264
+ return;
265
+ }
266
+
267
+ source.findJSXElements(specifier).forEach((element) => {
268
+ getJSXAttributesByName(j, element, prop).forEach((attribute) => {
269
+ if (
270
+ attribute.value.value === null ||
271
+ (attribute.value.value?.type === 'JSXExpressionContainer' &&
272
+ attribute.value.value.expression.type === 'BooleanLiteral')
273
+ ) {
274
+ j(attribute).remove();
275
+ if (comment) {
276
+ addCommentToStartOfFile({ j, base: source, message: comment });
277
+ }
278
+ }
279
+ });
280
+ });
281
+ };
282
+
283
+ export const createRenameImportFor: ({ componentName, newComponentName, oldPackagePath, newPackagePath, }: {
284
+ componentName: string;
285
+ newComponentName?: string;
286
+ oldPackagePath: string;
287
+ newPackagePath: string;
288
+ }) => (j: core.JSCodeshift, source: Collection<Node>) => void =
289
+ ({
290
+ componentName,
291
+ newComponentName,
292
+ oldPackagePath,
293
+ newPackagePath,
294
+ }: {
295
+ componentName: string;
296
+ newComponentName?: string;
297
+ oldPackagePath: string;
298
+ newPackagePath: string;
299
+ }) =>
300
+ (j: core.JSCodeshift, source: Collection<Node>) => {
301
+ const isUsingName: boolean =
302
+ source
303
+ .find(j.ImportDeclaration)
304
+ .filter((path) => path.node.source.value === oldPackagePath)
305
+ .find(j.ImportSpecifier)
306
+ .nodes()
307
+ .filter((specifier) => specifier.imported && specifier.imported.name === componentName)
308
+ .length > 0;
309
+ if (!isUsingName) {
310
+ return;
311
+ }
312
+
313
+ const existingAlias: Nullable<string> =
314
+ source
315
+ .find(j.ImportDeclaration)
316
+ .filter((path) => path.node.source.value === oldPackagePath)
317
+ .find(j.ImportSpecifier)
318
+ .nodes()
319
+ .map((specifier): Nullable<string> => {
320
+ if (specifier.imported && specifier.imported.name !== componentName) {
321
+ return null;
322
+ }
323
+ // If aliased: return the alias
324
+ if (specifier.local && specifier.local.name !== componentName) {
325
+ return specifier.local.name;
326
+ }
327
+
328
+ return null;
329
+ })
330
+ .filter(Boolean)[0] || null;
331
+
332
+ // Check to see if need to create new package path
333
+ // Try create an import declaration just before the old import
334
+ tryCreateImport({
335
+ j,
336
+ base: source,
337
+ relativeToPackage: oldPackagePath,
338
+ packageName: newPackagePath,
339
+ });
340
+
341
+ const newSpecifier: ImportSpecifier | ImportDefaultSpecifier = (() => {
342
+ // If there's a new name use that
343
+ if (newComponentName) {
344
+ return j.importSpecifier(j.identifier(newComponentName), j.identifier(newComponentName));
345
+ }
346
+
347
+ if (existingAlias) {
348
+ return j.importSpecifier(j.identifier(componentName), j.identifier(existingAlias));
349
+ }
350
+
351
+ // Add specifier
352
+ return j.importSpecifier(j.identifier(componentName), j.identifier(componentName));
353
+ })();
354
+
355
+ addToImport({
356
+ j,
357
+ base: source,
358
+ importSpecifier: newSpecifier,
359
+ packageName: newPackagePath,
360
+ });
361
+
362
+ // Remove old path
363
+ source
364
+ .find(j.ImportDeclaration)
365
+ .filter((path) => path.node.source.value === oldPackagePath)
366
+ .remove();
367
+ };
368
+
369
+ export const createRemoveImportsFor: ({ importsToRemove, packagePath, comment, }: {
370
+ importsToRemove: string[];
371
+ packagePath: string;
372
+ comment: string;
373
+ }) => (j: core.JSCodeshift, source: Collection<Node>) => void =
374
+ ({
375
+ importsToRemove,
376
+ packagePath,
377
+ comment,
378
+ }: {
379
+ importsToRemove: string[];
380
+ packagePath: string;
381
+ comment: string;
382
+ }) =>
383
+ (j: core.JSCodeshift, source: Collection<Node>) => {
384
+ const isUsingName: boolean =
385
+ source.find(j.ImportDeclaration).filter((path) => path.node.source.value === packagePath)
386
+ .length > 0;
387
+ if (!isUsingName) {
388
+ return;
389
+ }
390
+
391
+ const existingAlias: Nullable<string> =
392
+ source
393
+ .find(j.ImportDeclaration)
394
+ .filter((path) => path.node.source.value === packagePath)
395
+ .find(j.ImportSpecifier)
396
+ .nodes()
397
+ .map((specifier): Nullable<string> => {
398
+ if (!importsToRemove.includes(specifier.imported.name)) {
399
+ return null;
400
+ }
401
+ // If aliased: return the alias
402
+ if (specifier.local && !importsToRemove.includes(specifier.local.name)) {
403
+ return specifier.local.name;
404
+ }
405
+
406
+ return null;
407
+ })
408
+ .filter(Boolean)[0] || null;
409
+
410
+ // Remove imports
411
+ source
412
+ .find(j.ImportDeclaration)
413
+ .filter((path) => path.node.source.value === packagePath)
414
+ .find(j.ImportSpecifier)
415
+ .find(j.Identifier)
416
+ .filter((identifier) => {
417
+ if (
418
+ importsToRemove.includes(identifier.value.name) ||
419
+ identifier.value.name === existingAlias
420
+ ) {
421
+ addCommentToStartOfFile({ j, base: source, message: comment });
422
+ return true;
423
+ }
424
+ return false;
425
+ })
426
+ .remove();
427
+
428
+ // Remove entire import if it is empty
429
+ const isEmptyImport =
430
+ source
431
+ .find(j.ImportDeclaration)
432
+ .filter((path) => path.node.source.value === packagePath)
433
+ .find(j.ImportSpecifier)
434
+ .find(j.Identifier).length === 0;
435
+ if (isEmptyImport) {
436
+ source
437
+ .find(j.ImportDeclaration)
438
+ .filter((path) => path.node.source.value === packagePath)
439
+ .remove();
440
+ }
441
+ };
442
+
443
+ export const createTransformer: (component: string, migrates: {
444
+ (j: core.JSCodeshift, source: Collection<Node>): void;
445
+ }[]) => (fileInfo: FileInfo, api: API, options: Options) => string =
446
+ (component: string, migrates: { (j: core.JSCodeshift, source: Collection<Node>): void }[]) =>
447
+ (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => {
448
+ const source: Collection<Node> = j(fileInfo.source);
449
+
450
+ if (!hasImportDeclaration(j, source, component)) {
451
+ return fileInfo.source;
452
+ }
453
+
454
+ migrates.forEach((tf) => tf(j, source));
455
+
456
+ return source.toSource(options.printOptions || { quote: 'single' });
457
+ };
@@ -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: "0.0.0-development"
91
+ packageVersion: "14.10.4"
92
92
  });
93
93
  var onBlanketClicked = (0, _react.useCallback)(function (e) {
94
94
  if (shouldCloseOnOverlayClick) {
@@ -1,7 +1,10 @@
1
1
  ._18zr1ejb{padding-inline:var(--ds-space-300,24px)}
2
2
  ._1bah1yb4{justify-content:space-between}
3
+ ._1bsb1osq{width:100%}
3
4
  ._1e0c1txw{display:flex}
4
5
  ._1q511ejb{padding-block-start:var(--ds-space-300,24px)}
6
+ ._1ul9idpf{min-width:0}
7
+ ._2lx21sbv{flex-direction:row-reverse}
5
8
  ._4cvr1h6o{align-items:center}
6
9
  ._6rth1i6y{margin-block-end:var(--ds-space-negative-025,-2px)}
7
10
  ._85i5pxbi{padding-block-end:var(--ds-space-200,1pc)}
@@ -9,15 +9,14 @@ exports.default = void 0;
9
9
  require("./modal-header.compiled.css");
10
10
  var _runtime = require("@compiled/react/runtime");
11
11
  var _react = _interopRequireDefault(require("react"));
12
- var _primitives = require("@atlaskit/primitives");
12
+ var _compiled = require("@atlaskit/primitives/compiled");
13
13
  var _closeButton = require("./close-button");
14
14
  var _hooks = require("./hooks");
15
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
16
- var headerStyles = null;
17
- var flexStyles = (0, _primitives.xcss)({
18
- flexDirection: 'row-reverse',
19
- width: '100%'
20
- });
15
+ var styles = {
16
+ header: "_18zr1ejb _1e0c1txw _kqswh2mm _4cvr1h6o _1bah1yb4 _6rth1i6y _85i5pxbi _1q511ejb",
17
+ flex: "_2lx21sbv _1bsb1osq",
18
+ titleContainer: "_1ul9idpf"
19
+ };
21
20
  /**
22
21
  * __Modal header__
23
22
  *
@@ -42,25 +41,20 @@ var ModalHeader = function ModalHeader(props) {
42
41
  var shouldShowCloseButton = hasCloseButton && hasProvidedOnClose && onClose;
43
42
  return /*#__PURE__*/_react.default.createElement("div", {
44
43
  "data-testid": testId,
45
- className: (0, _runtime.ax)(["_18zr1ejb _1e0c1txw _kqswh2mm _4cvr1h6o _1bah1yb4 _6rth1i6y _85i5pxbi _1q511ejb"])
46
- }, shouldShowCloseButton ?
47
- /*#__PURE__*/
48
- // The reason we are putting the close button first in the DOM and then
49
- // reordering them is to ensure that users of assistive technology get
50
- // all the context of a modal when initial focus is placed on the close
51
- // button, since it's the first interactive element.
52
- _react.default.createElement(_primitives.Flex, {
44
+ className: (0, _runtime.ax)([styles.header])
45
+ }, shouldShowCloseButton ? /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
53
46
  gap: "space.200",
54
47
  justifyContent: "space-between",
55
- xcss: flexStyles
56
- }, /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
48
+ xcss: styles.flex
49
+ }, /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
57
50
  justifyContent: "end"
58
51
  }, /*#__PURE__*/_react.default.createElement(_closeButton.CloseButton, {
59
52
  onClick: onClose,
60
53
  testId: modalTestId
61
- })), /*#__PURE__*/_react.default.createElement(_primitives.Flex, {
54
+ })), /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
62
55
  justifyContent: "start",
63
- alignItems: "center"
56
+ alignItems: "center",
57
+ xcss: styles.titleContainer
64
58
  }, children)) : children);
65
59
  };
66
60
  var _default = exports.default = ModalHeader;
@@ -75,7 +75,7 @@ const InternalModalWrapper = props => {
75
75
  action: 'closed',
76
76
  componentName: 'modalDialog',
77
77
  packageName: "@atlaskit/modal-dialog",
78
- packageVersion: "0.0.0-development"
78
+ packageVersion: "14.10.4"
79
79
  });
80
80
  const onBlanketClicked = useCallback(e => {
81
81
  if (shouldCloseOnOverlayClick) {
@@ -1,7 +1,10 @@
1
1
  ._18zr1ejb{padding-inline:var(--ds-space-300,24px)}
2
2
  ._1bah1yb4{justify-content:space-between}
3
+ ._1bsb1osq{width:100%}
3
4
  ._1e0c1txw{display:flex}
4
5
  ._1q511ejb{padding-block-start:var(--ds-space-300,24px)}
6
+ ._1ul9idpf{min-width:0}
7
+ ._2lx21sbv{flex-direction:row-reverse}
5
8
  ._4cvr1h6o{align-items:center}
6
9
  ._6rth1i6y{margin-block-end:var(--ds-space-negative-025,-2px)}
7
10
  ._85i5pxbi{padding-block-end:var(--ds-space-200,1pc)}
@@ -2,15 +2,14 @@
2
2
  import "./modal-header.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
6
- import { Flex, xcss } from '@atlaskit/primitives';
5
+ import { Flex } from '@atlaskit/primitives/compiled';
7
6
  import { CloseButton } from './close-button';
8
7
  import { useModal } from './hooks';
9
- const headerStyles = null;
10
- const flexStyles = xcss({
11
- flexDirection: 'row-reverse',
12
- width: '100%'
13
- });
8
+ const styles = {
9
+ header: "_18zr1ejb _1e0c1txw _kqswh2mm _4cvr1h6o _1bah1yb4 _6rth1i6y _85i5pxbi _1q511ejb",
10
+ flex: "_2lx21sbv _1bsb1osq",
11
+ titleContainer: "_1ul9idpf"
12
+ };
14
13
  /**
15
14
  * __Modal header__
16
15
  *
@@ -37,17 +36,11 @@ const ModalHeader = props => {
37
36
  const shouldShowCloseButton = hasCloseButton && hasProvidedOnClose && onClose;
38
37
  return /*#__PURE__*/React.createElement("div", {
39
38
  "data-testid": testId,
40
- className: ax(["_18zr1ejb _1e0c1txw _kqswh2mm _4cvr1h6o _1bah1yb4 _6rth1i6y _85i5pxbi _1q511ejb"])
41
- }, shouldShowCloseButton ?
42
- /*#__PURE__*/
43
- // The reason we are putting the close button first in the DOM and then
44
- // reordering them is to ensure that users of assistive technology get
45
- // all the context of a modal when initial focus is placed on the close
46
- // button, since it's the first interactive element.
47
- React.createElement(Flex, {
39
+ className: ax([styles.header])
40
+ }, shouldShowCloseButton ? /*#__PURE__*/React.createElement(Flex, {
48
41
  gap: "space.200",
49
42
  justifyContent: "space-between",
50
- xcss: flexStyles
43
+ xcss: styles.flex
51
44
  }, /*#__PURE__*/React.createElement(Flex, {
52
45
  justifyContent: "end"
53
46
  }, /*#__PURE__*/React.createElement(CloseButton, {
@@ -55,7 +48,8 @@ const ModalHeader = props => {
55
48
  testId: modalTestId
56
49
  })), /*#__PURE__*/React.createElement(Flex, {
57
50
  justifyContent: "start",
58
- alignItems: "center"
51
+ alignItems: "center",
52
+ xcss: styles.titleContainer
59
53
  }, children)) : children);
60
54
  };
61
55
  export default ModalHeader;
@@ -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: "0.0.0-development"
82
+ packageVersion: "14.10.4"
83
83
  });
84
84
  var onBlanketClicked = useCallback(function (e) {
85
85
  if (shouldCloseOnOverlayClick) {
@@ -1,7 +1,10 @@
1
1
  ._18zr1ejb{padding-inline:var(--ds-space-300,24px)}
2
2
  ._1bah1yb4{justify-content:space-between}
3
+ ._1bsb1osq{width:100%}
3
4
  ._1e0c1txw{display:flex}
4
5
  ._1q511ejb{padding-block-start:var(--ds-space-300,24px)}
6
+ ._1ul9idpf{min-width:0}
7
+ ._2lx21sbv{flex-direction:row-reverse}
5
8
  ._4cvr1h6o{align-items:center}
6
9
  ._6rth1i6y{margin-block-end:var(--ds-space-negative-025,-2px)}
7
10
  ._85i5pxbi{padding-block-end:var(--ds-space-200,1pc)}
@@ -2,15 +2,14 @@
2
2
  import "./modal-header.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
5
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
6
- import { Flex, xcss } from '@atlaskit/primitives';
5
+ import { Flex } from '@atlaskit/primitives/compiled';
7
6
  import { CloseButton } from './close-button';
8
7
  import { useModal } from './hooks';
9
- var headerStyles = null;
10
- var flexStyles = xcss({
11
- flexDirection: 'row-reverse',
12
- width: '100%'
13
- });
8
+ var styles = {
9
+ header: "_18zr1ejb _1e0c1txw _kqswh2mm _4cvr1h6o _1bah1yb4 _6rth1i6y _85i5pxbi _1q511ejb",
10
+ flex: "_2lx21sbv _1bsb1osq",
11
+ titleContainer: "_1ul9idpf"
12
+ };
14
13
  /**
15
14
  * __Modal header__
16
15
  *
@@ -35,17 +34,11 @@ var ModalHeader = function ModalHeader(props) {
35
34
  var shouldShowCloseButton = hasCloseButton && hasProvidedOnClose && onClose;
36
35
  return /*#__PURE__*/React.createElement("div", {
37
36
  "data-testid": testId,
38
- className: ax(["_18zr1ejb _1e0c1txw _kqswh2mm _4cvr1h6o _1bah1yb4 _6rth1i6y _85i5pxbi _1q511ejb"])
39
- }, shouldShowCloseButton ?
40
- /*#__PURE__*/
41
- // The reason we are putting the close button first in the DOM and then
42
- // reordering them is to ensure that users of assistive technology get
43
- // all the context of a modal when initial focus is placed on the close
44
- // button, since it's the first interactive element.
45
- React.createElement(Flex, {
37
+ className: ax([styles.header])
38
+ }, shouldShowCloseButton ? /*#__PURE__*/React.createElement(Flex, {
46
39
  gap: "space.200",
47
40
  justifyContent: "space-between",
48
- xcss: flexStyles
41
+ xcss: styles.flex
49
42
  }, /*#__PURE__*/React.createElement(Flex, {
50
43
  justifyContent: "end"
51
44
  }, /*#__PURE__*/React.createElement(CloseButton, {
@@ -53,7 +46,8 @@ var ModalHeader = function ModalHeader(props) {
53
46
  testId: modalTestId
54
47
  })), /*#__PURE__*/React.createElement(Flex, {
55
48
  justifyContent: "start",
56
- alignItems: "center"
49
+ alignItems: "center",
50
+ xcss: styles.titleContainer
57
51
  }, children)) : children);
58
52
  };
59
53
  export default ModalHeader;
@@ -1 +1,2 @@
1
- export declare const useModal: () => import("./internal/context").ModalAttributes;
1
+ import { type ModalAttributes } from './internal/context';
2
+ export declare const useModal: () => ModalAttributes;
@@ -1,3 +1,4 @@
1
+ import { type Context } from 'react';
1
2
  import { type ModalDialogProps, type OnCloseHandler } from '../types';
2
3
  export type ModalAttributes = {
3
4
  /**
@@ -25,5 +26,5 @@ export type ModalAttributes = {
25
26
  */
26
27
  isFullScreen: boolean;
27
28
  };
28
- export declare const ModalContext: import("react").Context<ModalAttributes | null>;
29
- export declare const ScrollContext: import("react").Context<boolean | null>;
29
+ export declare const ModalContext: Context<ModalAttributes | null>;
30
+ export declare const ScrollContext: Context<boolean | null>;
@@ -1 +1,2 @@
1
- export declare const useModal: () => import("./internal/context").ModalAttributes;
1
+ import { type ModalAttributes } from './internal/context';
2
+ export declare const useModal: () => ModalAttributes;
@@ -1,3 +1,4 @@
1
+ import { type Context } from 'react';
1
2
  import { type ModalDialogProps, type OnCloseHandler } from '../types';
2
3
  export type ModalAttributes = {
3
4
  /**
@@ -25,5 +26,5 @@ export type ModalAttributes = {
25
26
  */
26
27
  isFullScreen: boolean;
27
28
  };
28
- export declare const ModalContext: import("react").Context<ModalAttributes | null>;
29
- export declare const ScrollContext: import("react").Context<boolean | null>;
29
+ export declare const ModalContext: Context<ModalAttributes | null>;
30
+ export declare const ScrollContext: Context<boolean | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/modal-dialog",
3
- "version": "14.10.3",
3
+ "version": "14.10.5",
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/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/button": "^23.9.0",
33
33
  "@atlaskit/css": "^0.19.0",
34
34
  "@atlaskit/ds-lib": "^5.3.0",
35
- "@atlaskit/icon": "^30.0.0",
35
+ "@atlaskit/icon": "^31.0.0",
36
36
  "@atlaskit/layering": "^3.6.0",
37
37
  "@atlaskit/motion": "^5.3.0",
38
38
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -61,12 +61,12 @@
61
61
  "@atlaskit/breadcrumbs": "^15.3.0",
62
62
  "@atlaskit/checkbox": "^17.3.0",
63
63
  "@atlaskit/code": "^17.4.0",
64
- "@atlaskit/datetime-picker": "^17.4.0",
64
+ "@atlaskit/datetime-picker": "^17.5.0",
65
65
  "@atlaskit/docs": "^11.3.0",
66
66
  "@atlaskit/dropdown-menu": "^16.4.0",
67
67
  "@atlaskit/flag": "^17.8.0",
68
68
  "@atlaskit/form": "^15.3.0",
69
- "@atlaskit/heading": "^5.2.0",
69
+ "@atlaskit/heading": "^5.3.0",
70
70
  "@atlaskit/link": "^3.3.0",
71
71
  "@atlaskit/popup": "^4.13.0",
72
72
  "@atlaskit/radio": "^8.4.0",
@@ -80,6 +80,7 @@
80
80
  "@testing-library/react": "^16.3.0",
81
81
  "@testing-library/user-event": "^14.4.3",
82
82
  "@types/raf-schd": "^4.0.1",
83
+ "jscodeshift": "^17.0.0",
83
84
  "react-dom": "^18.2.0",
84
85
  "react-lorem-component": "^0.13.0",
85
86
  "react-sweet-state": "^2.6.5",