@atlaskit/modal-dialog 12.0.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 +2111 -0
- package/LICENSE +13 -0
- package/README.md +13 -0
- package/__perf__/default.tsx +42 -0
- package/__perf__/interactions.tsx +136 -0
- package/__perf__/scroll.tsx +98 -0
- package/codemods/12.0.0-lite-mode.ts +51 -0
- package/codemods/__tests__/12.0.0-lite-mode.test.ts +493 -0
- package/codemods/__tests__/handle-prop-spread.tsx +276 -0
- package/codemods/__tests__/inline-WidthNames-declaration.test.ts +260 -0
- package/codemods/__tests__/map-actions-prop.tsx +436 -0
- package/codemods/__tests__/map-body-from-props.test.ts +645 -0
- package/codemods/__tests__/map-container-from-props.test.ts +323 -0
- package/codemods/__tests__/map-footer-from-props.test.ts +544 -0
- package/codemods/__tests__/map-header-from-props.test.ts +559 -0
- package/codemods/__tests__/map-heading-prop.tsx +438 -0
- package/codemods/__tests__/remove-appearance-prop.test.ts +79 -0
- package/codemods/__tests__/remove-component-override-props.test.ts +153 -0
- package/codemods/__tests__/remove-is-chromeless.tsx +182 -0
- package/codemods/__tests__/rename-appearance-type.test.ts +52 -0
- package/codemods/__tests__/rename-inner-component-prop-types.test.ts +82 -0
- package/codemods/__tests__/rename-scrollBehavior-to-shouldScrollInViewport.test.ts +237 -0
- package/codemods/internal/constants.tsx +41 -0
- package/codemods/internal/utils.tsx +223 -0
- package/codemods/migrations/handle-prop-spread.tsx +51 -0
- package/codemods/migrations/inline-WidthNames-declaration.ts +92 -0
- package/codemods/migrations/map-actions-prop.tsx +430 -0
- package/codemods/migrations/map-body-from-props.ts +147 -0
- package/codemods/migrations/map-container-from-props.ts +72 -0
- package/codemods/migrations/map-footer-from-props.ts +107 -0
- package/codemods/migrations/map-header-from-props.ts +101 -0
- package/codemods/migrations/map-heading-prop.tsx +193 -0
- package/codemods/migrations/remove-appearance-prop.ts +27 -0
- package/codemods/migrations/remove-component-override-props.ts +84 -0
- package/codemods/migrations/remove-is-chromeless.tsx +42 -0
- package/codemods/migrations/rename-appearance-type.ts +9 -0
- package/codemods/migrations/rename-inner-component-prop-types.ts +28 -0
- package/codemods/migrations/rename-scrollBehavior-to-shouldScrollInViewport.ts +82 -0
- package/dist/cjs/hooks.js +22 -0
- package/dist/cjs/index.js +63 -0
- package/dist/cjs/internal/components/modal-dialog.js +155 -0
- package/dist/cjs/internal/components/positioner.js +89 -0
- package/dist/cjs/internal/components/scroll-container.js +138 -0
- package/dist/cjs/internal/constants.js +48 -0
- package/dist/cjs/internal/context.js +13 -0
- package/dist/cjs/internal/hooks/use-modal-stack.js +110 -0
- package/dist/cjs/internal/hooks/use-on-motion-finish.js +24 -0
- package/dist/cjs/internal/hooks/use-prevent-programmatic-scroll.js +55 -0
- package/dist/cjs/internal/hooks/use-scroll.js +20 -0
- package/dist/cjs/internal/utils.js +35 -0
- package/dist/cjs/modal-body.js +66 -0
- package/dist/cjs/modal-footer.js +40 -0
- package/dist/cjs/modal-header.js +43 -0
- package/dist/cjs/modal-title.js +108 -0
- package/dist/cjs/modal-transition.js +21 -0
- package/dist/cjs/modal-wrapper.js +126 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/hooks.js +11 -0
- package/dist/es2019/index.js +7 -0
- package/dist/es2019/internal/components/modal-dialog.js +120 -0
- package/dist/es2019/internal/components/positioner.js +78 -0
- package/dist/es2019/internal/components/scroll-container.js +97 -0
- package/dist/es2019/internal/constants.js +27 -0
- package/dist/es2019/internal/context.js +3 -0
- package/dist/es2019/internal/hooks/use-modal-stack.js +85 -0
- package/dist/es2019/internal/hooks/use-on-motion-finish.js +17 -0
- package/dist/es2019/internal/hooks/use-prevent-programmatic-scroll.js +39 -0
- package/dist/es2019/internal/hooks/use-scroll.js +11 -0
- package/dist/es2019/internal/utils.js +22 -0
- package/dist/es2019/modal-body.js +50 -0
- package/dist/es2019/modal-footer.js +30 -0
- package/dist/es2019/modal-header.js +30 -0
- package/dist/es2019/modal-title.js +94 -0
- package/dist/es2019/modal-transition.js +10 -0
- package/dist/es2019/modal-wrapper.js +88 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/hooks.js +11 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/internal/components/modal-dialog.js +131 -0
- package/dist/esm/internal/components/positioner.js +76 -0
- package/dist/esm/internal/components/scroll-container.js +114 -0
- package/dist/esm/internal/constants.js +27 -0
- package/dist/esm/internal/context.js +3 -0
- package/dist/esm/internal/hooks/use-modal-stack.js +96 -0
- package/dist/esm/internal/hooks/use-on-motion-finish.js +16 -0
- package/dist/esm/internal/hooks/use-prevent-programmatic-scroll.js +44 -0
- package/dist/esm/internal/hooks/use-scroll.js +11 -0
- package/dist/esm/internal/utils.js +22 -0
- package/dist/esm/modal-body.js +49 -0
- package/dist/esm/modal-footer.js +29 -0
- package/dist/esm/modal-header.js +29 -0
- package/dist/esm/modal-title.js +93 -0
- package/dist/esm/modal-transition.js +10 -0
- package/dist/esm/modal-wrapper.js +96 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/internal/components/modal-dialog.d.ts +3 -0
- package/dist/types/internal/components/positioner.d.ts +10 -0
- package/dist/types/internal/components/scroll-container.d.ts +20 -0
- package/dist/types/internal/constants.d.ts +25 -0
- package/dist/types/internal/context.d.ts +20 -0
- package/dist/types/internal/hooks/use-modal-stack.d.ts +13 -0
- package/dist/types/internal/hooks/use-on-motion-finish.d.ts +4 -0
- package/dist/types/internal/hooks/use-prevent-programmatic-scroll.d.ts +7 -0
- package/dist/types/internal/hooks/use-scroll.d.ts +1 -0
- package/dist/types/internal/utils.d.ts +3 -0
- package/dist/types/modal-body.d.ts +16 -0
- package/dist/types/modal-footer.d.ts +16 -0
- package/dist/types/modal-header.d.ts +16 -0
- package/dist/types/modal-title.d.ts +26 -0
- package/dist/types/modal-transition.d.ts +3 -0
- package/dist/types/modal-wrapper.d.ts +5 -0
- package/dist/types/types.d.ts +90 -0
- package/extract-react-types/modal-attributes.tsx +5 -0
- package/hooks/package.json +7 -0
- package/modal-body/package.json +7 -0
- package/modal-dialog/package.json +7 -0
- package/modal-footer/package.json +7 -0
- package/modal-header/package.json +7 -0
- package/modal-title/package.json +7 -0
- package/modal-transition/package.json +7 -0
- package/package.json +113 -0
- package/types/package.json +7 -0
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import { createTransformer } from '@atlaskit/codemod-utils';
|
|
2
|
+
|
|
3
|
+
import { mapHeaderFromProps } from '../migrations/map-header-from-props';
|
|
4
|
+
|
|
5
|
+
const transformer = createTransformer([mapHeaderFromProps]);
|
|
6
|
+
|
|
7
|
+
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
8
|
+
|
|
9
|
+
describe('map header from props', () => {
|
|
10
|
+
['tsx', 'babylon'].forEach((parser) => {
|
|
11
|
+
describe(`parser: ${parser}`, () => {
|
|
12
|
+
defineInlineTest(
|
|
13
|
+
{ default: transformer, parser },
|
|
14
|
+
{},
|
|
15
|
+
`
|
|
16
|
+
import React from 'react';
|
|
17
|
+
|
|
18
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
19
|
+
|
|
20
|
+
const Header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
21
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
22
|
+
|
|
23
|
+
export default function modalDialog() {
|
|
24
|
+
return (
|
|
25
|
+
<ModalDialog
|
|
26
|
+
onClose={handleClose}
|
|
27
|
+
components={{
|
|
28
|
+
Header,
|
|
29
|
+
Footer
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
{content}
|
|
33
|
+
</ModalDialog>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
`
|
|
38
|
+
import React from 'react';
|
|
39
|
+
|
|
40
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
41
|
+
|
|
42
|
+
const Header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
43
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
44
|
+
|
|
45
|
+
export default function modalDialog() {
|
|
46
|
+
return (
|
|
47
|
+
<ModalDialog
|
|
48
|
+
onClose={handleClose}
|
|
49
|
+
components={{
|
|
50
|
+
Footer
|
|
51
|
+
}}>
|
|
52
|
+
{Header()}
|
|
53
|
+
{content}
|
|
54
|
+
</ModalDialog>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
`,
|
|
58
|
+
'should invoke Header declared as shorthand',
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
defineInlineTest(
|
|
62
|
+
{ default: transformer, parser },
|
|
63
|
+
{},
|
|
64
|
+
`
|
|
65
|
+
import React from 'react';
|
|
66
|
+
|
|
67
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
68
|
+
|
|
69
|
+
const CustomHeader = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
70
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
71
|
+
|
|
72
|
+
export default function modalDialog() {
|
|
73
|
+
return (
|
|
74
|
+
<ModalDialog
|
|
75
|
+
onClose={handleClose}
|
|
76
|
+
components={{
|
|
77
|
+
Header: CustomHeader,
|
|
78
|
+
Footer,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{content}
|
|
82
|
+
</ModalDialog>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
`,
|
|
86
|
+
`
|
|
87
|
+
import React from 'react';
|
|
88
|
+
|
|
89
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
90
|
+
|
|
91
|
+
const CustomHeader = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
92
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
93
|
+
|
|
94
|
+
export default function modalDialog() {
|
|
95
|
+
return (
|
|
96
|
+
<ModalDialog
|
|
97
|
+
onClose={handleClose}
|
|
98
|
+
components={{
|
|
99
|
+
Footer
|
|
100
|
+
}}>
|
|
101
|
+
{CustomHeader()}
|
|
102
|
+
{content}
|
|
103
|
+
</ModalDialog>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
`,
|
|
107
|
+
'should invoke Header declared as assigned variable',
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
defineInlineTest(
|
|
111
|
+
{ default: transformer, parser },
|
|
112
|
+
{},
|
|
113
|
+
`
|
|
114
|
+
import React from 'react';
|
|
115
|
+
|
|
116
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
117
|
+
|
|
118
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
119
|
+
|
|
120
|
+
export default function modalDialog() {
|
|
121
|
+
return (
|
|
122
|
+
<ModalDialog
|
|
123
|
+
onClose={handleClose}
|
|
124
|
+
components={{
|
|
125
|
+
Footer,
|
|
126
|
+
Header: ({ id, testId }) => (
|
|
127
|
+
<div data-testid={testId}>
|
|
128
|
+
<h1 id={id}>Custom header</h1>
|
|
129
|
+
</div>
|
|
130
|
+
)
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
{content}
|
|
134
|
+
</ModalDialog>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
`,
|
|
138
|
+
`
|
|
139
|
+
import React from 'react';
|
|
140
|
+
|
|
141
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
142
|
+
|
|
143
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
144
|
+
|
|
145
|
+
export default function modalDialog() {
|
|
146
|
+
return (
|
|
147
|
+
<ModalDialog
|
|
148
|
+
onClose={handleClose}
|
|
149
|
+
components={{
|
|
150
|
+
Footer
|
|
151
|
+
}}>
|
|
152
|
+
{(({ id, testId }) => <div data-testid={testId}>
|
|
153
|
+
<h1 id={id}>Custom header</h1>
|
|
154
|
+
</div>)()}
|
|
155
|
+
{content}
|
|
156
|
+
</ModalDialog>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
`,
|
|
160
|
+
'should invoke Header declared as arrow function',
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
defineInlineTest(
|
|
164
|
+
{ default: transformer, parser },
|
|
165
|
+
{},
|
|
166
|
+
`
|
|
167
|
+
import React from 'react';
|
|
168
|
+
|
|
169
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
170
|
+
|
|
171
|
+
const components = {
|
|
172
|
+
Header: (props) => (<div><h1 id={props.id}>{props.children}</h1></div>),
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export default function modalDialog() {
|
|
176
|
+
return (
|
|
177
|
+
<ModalDialog onClose={handleClose} components={components}>
|
|
178
|
+
{content}
|
|
179
|
+
</ModalDialog>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
`,
|
|
183
|
+
`
|
|
184
|
+
import React from 'react';
|
|
185
|
+
|
|
186
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
187
|
+
|
|
188
|
+
const components = {
|
|
189
|
+
Header: (props) => (<div><h1 id={props.id}>{props.children}</h1></div>),
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export default function modalDialog() {
|
|
193
|
+
return (
|
|
194
|
+
<ModalDialog onClose={handleClose} components={components}>
|
|
195
|
+
{content}
|
|
196
|
+
</ModalDialog>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
`,
|
|
200
|
+
'should do nothing if components definition is not an inline object expression',
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
defineInlineTest(
|
|
204
|
+
{ default: transformer, parser },
|
|
205
|
+
{},
|
|
206
|
+
`
|
|
207
|
+
import React from 'react';
|
|
208
|
+
|
|
209
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
210
|
+
|
|
211
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
212
|
+
|
|
213
|
+
class CustomModalDialog extends React.Component {
|
|
214
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
215
|
+
|
|
216
|
+
render() {
|
|
217
|
+
return (
|
|
218
|
+
<ModalDialog
|
|
219
|
+
onClose={handleClose}
|
|
220
|
+
components={{
|
|
221
|
+
Header: this.header,
|
|
222
|
+
Footer,
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
{content}
|
|
226
|
+
</ModalDialog>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
`,
|
|
231
|
+
`
|
|
232
|
+
import React from 'react';
|
|
233
|
+
|
|
234
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
235
|
+
|
|
236
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
237
|
+
|
|
238
|
+
class CustomModalDialog extends React.Component {
|
|
239
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
240
|
+
|
|
241
|
+
render() {
|
|
242
|
+
return (
|
|
243
|
+
<ModalDialog
|
|
244
|
+
onClose={handleClose}
|
|
245
|
+
components={{
|
|
246
|
+
Footer
|
|
247
|
+
}}>
|
|
248
|
+
{this.header()}
|
|
249
|
+
{content}
|
|
250
|
+
</ModalDialog>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
`,
|
|
255
|
+
'should invoke Header of a modal dialog declared as class component',
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
defineInlineTest(
|
|
259
|
+
{ default: transformer, parser },
|
|
260
|
+
{},
|
|
261
|
+
`
|
|
262
|
+
import React from 'react';
|
|
263
|
+
|
|
264
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
265
|
+
|
|
266
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
267
|
+
|
|
268
|
+
class CustomModalDialog extends React.Component {
|
|
269
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
270
|
+
|
|
271
|
+
render() {
|
|
272
|
+
return (
|
|
273
|
+
<ModalDialog
|
|
274
|
+
onClose={handleClose}
|
|
275
|
+
header={this.header}
|
|
276
|
+
components={{
|
|
277
|
+
Footer
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
{content}
|
|
281
|
+
</ModalDialog>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
`,
|
|
286
|
+
`
|
|
287
|
+
import React from 'react';
|
|
288
|
+
|
|
289
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
290
|
+
|
|
291
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
292
|
+
|
|
293
|
+
class CustomModalDialog extends React.Component {
|
|
294
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
295
|
+
|
|
296
|
+
render() {
|
|
297
|
+
return (
|
|
298
|
+
<ModalDialog
|
|
299
|
+
onClose={handleClose}
|
|
300
|
+
header={this.header}
|
|
301
|
+
components={{
|
|
302
|
+
Footer
|
|
303
|
+
}}>
|
|
304
|
+
{this.header()}
|
|
305
|
+
{content}
|
|
306
|
+
</ModalDialog>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
`,
|
|
311
|
+
'should invoke Header passed to the header prop',
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
defineInlineTest(
|
|
315
|
+
{ default: transformer, parser },
|
|
316
|
+
{},
|
|
317
|
+
`
|
|
318
|
+
import React from 'react';
|
|
319
|
+
|
|
320
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
321
|
+
|
|
322
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
323
|
+
|
|
324
|
+
class CustomModalDialog extends React.Component {
|
|
325
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
326
|
+
|
|
327
|
+
render() {
|
|
328
|
+
return (
|
|
329
|
+
<ModalDialog
|
|
330
|
+
onClose={handleClose}
|
|
331
|
+
components={{
|
|
332
|
+
Header: this.header,
|
|
333
|
+
Footer
|
|
334
|
+
}}
|
|
335
|
+
header={({ id, testId }) => (
|
|
336
|
+
<div data-testid={testId}>
|
|
337
|
+
<h1 id={id}>Custom header</h1>
|
|
338
|
+
</div>
|
|
339
|
+
)}
|
|
340
|
+
>
|
|
341
|
+
{content}
|
|
342
|
+
</ModalDialog>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
`,
|
|
347
|
+
`
|
|
348
|
+
import React from 'react';
|
|
349
|
+
|
|
350
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
351
|
+
|
|
352
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
353
|
+
|
|
354
|
+
class CustomModalDialog extends React.Component {
|
|
355
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
356
|
+
|
|
357
|
+
render() {
|
|
358
|
+
return (
|
|
359
|
+
<ModalDialog
|
|
360
|
+
onClose={handleClose}
|
|
361
|
+
components={{
|
|
362
|
+
Footer
|
|
363
|
+
}}
|
|
364
|
+
header={({ id, testId }) => (
|
|
365
|
+
<div data-testid={testId}>
|
|
366
|
+
<h1 id={id}>Custom header</h1>
|
|
367
|
+
</div>
|
|
368
|
+
)}>
|
|
369
|
+
{this.header()}
|
|
370
|
+
{content}
|
|
371
|
+
</ModalDialog>
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
`,
|
|
376
|
+
'should take Header passed from components prop if both declarations exist',
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
defineInlineTest(
|
|
380
|
+
{ default: transformer, parser },
|
|
381
|
+
{},
|
|
382
|
+
`
|
|
383
|
+
import React from 'react';
|
|
384
|
+
|
|
385
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
386
|
+
|
|
387
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
388
|
+
|
|
389
|
+
class CustomModalDialog extends React.Component {
|
|
390
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
391
|
+
|
|
392
|
+
render() {
|
|
393
|
+
return (
|
|
394
|
+
<ModalDialog
|
|
395
|
+
onClose={handleClose}
|
|
396
|
+
appearance="warning"
|
|
397
|
+
components={{
|
|
398
|
+
Header: this.header,
|
|
399
|
+
Footer
|
|
400
|
+
}}
|
|
401
|
+
>
|
|
402
|
+
{content}
|
|
403
|
+
</ModalDialog>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
`,
|
|
408
|
+
`
|
|
409
|
+
import React from 'react';
|
|
410
|
+
|
|
411
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
412
|
+
|
|
413
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
414
|
+
|
|
415
|
+
class CustomModalDialog extends React.Component {
|
|
416
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
417
|
+
|
|
418
|
+
render() {
|
|
419
|
+
return (
|
|
420
|
+
<ModalDialog
|
|
421
|
+
onClose={handleClose}
|
|
422
|
+
appearance="warning"
|
|
423
|
+
components={{
|
|
424
|
+
Footer
|
|
425
|
+
}}>
|
|
426
|
+
{this.header({
|
|
427
|
+
appearance: "warning"
|
|
428
|
+
})}
|
|
429
|
+
{content}
|
|
430
|
+
</ModalDialog>
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
`,
|
|
435
|
+
'should pass appearance set as string literal from parent ModalDialog to custom header as a prop',
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
defineInlineTest(
|
|
439
|
+
{ default: transformer, parser },
|
|
440
|
+
{},
|
|
441
|
+
`
|
|
442
|
+
import React from 'react';
|
|
443
|
+
|
|
444
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
445
|
+
|
|
446
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
447
|
+
|
|
448
|
+
class CustomModalDialog extends React.Component {
|
|
449
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
450
|
+
|
|
451
|
+
render() {
|
|
452
|
+
return (
|
|
453
|
+
<ModalDialog
|
|
454
|
+
onClose={handleClose}
|
|
455
|
+
appearance={modalDialogAppearance}
|
|
456
|
+
components={{
|
|
457
|
+
Header: this.header,
|
|
458
|
+
Footer
|
|
459
|
+
}}
|
|
460
|
+
>
|
|
461
|
+
{content}
|
|
462
|
+
</ModalDialog>
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
`,
|
|
467
|
+
`
|
|
468
|
+
import React from 'react';
|
|
469
|
+
|
|
470
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
471
|
+
|
|
472
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
473
|
+
|
|
474
|
+
class CustomModalDialog extends React.Component {
|
|
475
|
+
header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
476
|
+
|
|
477
|
+
render() {
|
|
478
|
+
return (
|
|
479
|
+
<ModalDialog
|
|
480
|
+
onClose={handleClose}
|
|
481
|
+
appearance={modalDialogAppearance}
|
|
482
|
+
components={{
|
|
483
|
+
Footer
|
|
484
|
+
}}>
|
|
485
|
+
{this.header({
|
|
486
|
+
appearance: modalDialogAppearance
|
|
487
|
+
})}
|
|
488
|
+
{content}
|
|
489
|
+
</ModalDialog>
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
`,
|
|
494
|
+
'should pass appearance set as expression from parent ModalDialog to custom header as a prop',
|
|
495
|
+
);
|
|
496
|
+
|
|
497
|
+
defineInlineTest(
|
|
498
|
+
{ default: transformer, parser },
|
|
499
|
+
{},
|
|
500
|
+
`
|
|
501
|
+
import React from 'react';
|
|
502
|
+
|
|
503
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
504
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
505
|
+
|
|
506
|
+
const Header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
507
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
508
|
+
|
|
509
|
+
export default function modalDialog() {
|
|
510
|
+
return (
|
|
511
|
+
<ModalDialog
|
|
512
|
+
onClose={handleClose}
|
|
513
|
+
appearance="warning"
|
|
514
|
+
components={{
|
|
515
|
+
Header,
|
|
516
|
+
Footer
|
|
517
|
+
}}
|
|
518
|
+
>
|
|
519
|
+
<SectionMessage appearance="information">
|
|
520
|
+
{sectionMessage}
|
|
521
|
+
</SectionMessage>
|
|
522
|
+
{content}
|
|
523
|
+
</ModalDialog>
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
`,
|
|
527
|
+
`
|
|
528
|
+
import React from 'react';
|
|
529
|
+
|
|
530
|
+
import ModalDialog from '@atlaskit/modal-dialog';
|
|
531
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
532
|
+
|
|
533
|
+
const Header = (props) => (<div><h1 id={props.id}>{props.children}</h1></div>);
|
|
534
|
+
const Footer = (props) => (<div>{props.children}</div>);
|
|
535
|
+
|
|
536
|
+
export default function modalDialog() {
|
|
537
|
+
return (
|
|
538
|
+
<ModalDialog
|
|
539
|
+
onClose={handleClose}
|
|
540
|
+
appearance="warning"
|
|
541
|
+
components={{
|
|
542
|
+
Footer
|
|
543
|
+
}}>
|
|
544
|
+
{Header({
|
|
545
|
+
appearance: "warning"
|
|
546
|
+
})}
|
|
547
|
+
<SectionMessage appearance="information">
|
|
548
|
+
{sectionMessage}
|
|
549
|
+
</SectionMessage>
|
|
550
|
+
{content}
|
|
551
|
+
</ModalDialog>
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
`,
|
|
555
|
+
'should pass appearance attribute ONLY from parent ModalDialog',
|
|
556
|
+
);
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
});
|