@atlaskit/form 12.1.0 → 12.2.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 +16 -0
- package/codemods/__tests__/not-yet-migrate-to-simplified-form.test.tsx +613 -0
- package/codemods/not-yet-migrate-to-simplified-form.tsx +173 -0
- package/codemods/utils/helpers.tsx +327 -0
- package/dist/cjs/form.js +16 -8
- package/dist/es2019/form.js +18 -8
- package/dist/esm/form.js +16 -8
- package/dist/types/form.d.ts +13 -0
- package/dist/types-ts4.5/form.d.ts +13 -0
- package/package.json +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/form
|
|
2
2
|
|
|
3
|
+
## 12.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`07de46497864a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/07de46497864a) -
|
|
8
|
+
We are testing a new way to render the Form component behind a feature flag. Rendering a `Form`
|
|
9
|
+
component with direct JSX elements instead of a function as `children` will render an HTML `form`
|
|
10
|
+
element internally, reducing the boilerplate required for most use cases. If this fix is
|
|
11
|
+
successful it will be available in a later release.
|
|
12
|
+
|
|
13
|
+
## 12.1.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 12.1.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
jest.autoMockOff();
|
|
2
|
+
|
|
3
|
+
import transformer from '../not-yet-migrate-to-simplified-form';
|
|
4
|
+
|
|
5
|
+
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
6
|
+
|
|
7
|
+
defineInlineTest(
|
|
8
|
+
{ default: transformer, parser: 'tsx' },
|
|
9
|
+
{},
|
|
10
|
+
`import React from 'react';`,
|
|
11
|
+
`import React from 'react';`,
|
|
12
|
+
'should not transform if imports are not present',
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
defineInlineTest(
|
|
16
|
+
{ default: transformer, parser: 'tsx' },
|
|
17
|
+
{},
|
|
18
|
+
`
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { Field } from '@atlaskit/form';
|
|
21
|
+
|
|
22
|
+
const Component1 = () => <Field />;
|
|
23
|
+
|
|
24
|
+
const Component2 = () => <><Field /></>;
|
|
25
|
+
|
|
26
|
+
class Component3 extends React.Component { render() { return <Field />; } }
|
|
27
|
+
|
|
28
|
+
const element = <Field />;
|
|
29
|
+
`,
|
|
30
|
+
`
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import { Field } from '@atlaskit/form';
|
|
33
|
+
|
|
34
|
+
const Component1 = () => <Field />;
|
|
35
|
+
|
|
36
|
+
const Component2 = () => <><Field /></>;
|
|
37
|
+
|
|
38
|
+
class Component3 extends React.Component { render() { return <Field />; } }
|
|
39
|
+
|
|
40
|
+
const element = <Field />;
|
|
41
|
+
`,
|
|
42
|
+
'should not transform if default import is not preset',
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
defineInlineTest(
|
|
46
|
+
{ default: transformer, parser: 'tsx' },
|
|
47
|
+
{},
|
|
48
|
+
`
|
|
49
|
+
import React from 'react';
|
|
50
|
+
import Form from '@atlaskit/form';
|
|
51
|
+
|
|
52
|
+
const Component1 = () => <Form />;
|
|
53
|
+
|
|
54
|
+
const Component2 = () => <><Form /></>;
|
|
55
|
+
|
|
56
|
+
class Component3 extends React.Component { render() { return <Form />; } }
|
|
57
|
+
|
|
58
|
+
const element = <Form />;
|
|
59
|
+
`,
|
|
60
|
+
`
|
|
61
|
+
import React from 'react';
|
|
62
|
+
import Form from '@atlaskit/form';
|
|
63
|
+
|
|
64
|
+
const Component1 = () => <Form />;
|
|
65
|
+
|
|
66
|
+
const Component2 = () => <><Form /></>;
|
|
67
|
+
|
|
68
|
+
class Component3 extends React.Component { render() { return <Form />; } }
|
|
69
|
+
|
|
70
|
+
const element = <Form />;
|
|
71
|
+
`,
|
|
72
|
+
'should not transform if children are not preset',
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
defineInlineTest(
|
|
76
|
+
{ default: transformer, parser: 'tsx' },
|
|
77
|
+
{},
|
|
78
|
+
`
|
|
79
|
+
import React from 'react';
|
|
80
|
+
import Form from '@atlaskit/code';
|
|
81
|
+
|
|
82
|
+
const Component1 = () => (
|
|
83
|
+
<Form onSubmit={() => {}}>
|
|
84
|
+
<p>Test</p>
|
|
85
|
+
</Form>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const Component2 = () => (
|
|
89
|
+
<Form onSubmit={() => {}}>
|
|
90
|
+
<p>Test</p>
|
|
91
|
+
</Form>
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
class Component3 extends React.Component {
|
|
95
|
+
render() {
|
|
96
|
+
return (
|
|
97
|
+
<Form onSubmit={() => {}}>
|
|
98
|
+
<p>Test</p>
|
|
99
|
+
</Form>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const element = (
|
|
105
|
+
<Form onSubmit={() => {}}>
|
|
106
|
+
<p>Test</p>
|
|
107
|
+
</Form>
|
|
108
|
+
);
|
|
109
|
+
`,
|
|
110
|
+
`
|
|
111
|
+
import React from 'react';
|
|
112
|
+
import Form from '@atlaskit/code';
|
|
113
|
+
|
|
114
|
+
const Component1 = () => (
|
|
115
|
+
<Form onSubmit={() => {}}>
|
|
116
|
+
<p>Test</p>
|
|
117
|
+
</Form>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const Component2 = () => (
|
|
121
|
+
<Form onSubmit={() => {}}>
|
|
122
|
+
<p>Test</p>
|
|
123
|
+
</Form>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
class Component3 extends React.Component {
|
|
127
|
+
render() {
|
|
128
|
+
return (
|
|
129
|
+
<Form onSubmit={() => {}}>
|
|
130
|
+
<p>Test</p>
|
|
131
|
+
</Form>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const element = (
|
|
137
|
+
<Form onSubmit={() => {}}>
|
|
138
|
+
<p>Test</p>
|
|
139
|
+
</Form>
|
|
140
|
+
);
|
|
141
|
+
`,
|
|
142
|
+
'should not transform if children is not a function',
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
describe('Migrate <Form> to simplified version if only `formProps` in child arg ', () => {
|
|
146
|
+
defineInlineTest(
|
|
147
|
+
{ default: transformer, parser: 'tsx' },
|
|
148
|
+
{},
|
|
149
|
+
`
|
|
150
|
+
import React from 'react';
|
|
151
|
+
import Form from '@atlaskit/form';
|
|
152
|
+
|
|
153
|
+
const FormComponent1 = () => (
|
|
154
|
+
<Form onSubmit={() => {}}>
|
|
155
|
+
{({ formProps }) => (
|
|
156
|
+
<form {...formProps}>
|
|
157
|
+
<input />
|
|
158
|
+
</form>
|
|
159
|
+
)}
|
|
160
|
+
</Form>
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
const FormComponent2 = () => (
|
|
164
|
+
<>
|
|
165
|
+
<Form onSubmit={() => {}}>
|
|
166
|
+
{({ formProps }) => (
|
|
167
|
+
<form {...formProps}>
|
|
168
|
+
<input />
|
|
169
|
+
</form>
|
|
170
|
+
)}
|
|
171
|
+
</Form>
|
|
172
|
+
</>
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
class FormComponent3 extends React.Component {
|
|
176
|
+
render() {
|
|
177
|
+
return (
|
|
178
|
+
<Form onSubmit={() => {}}>
|
|
179
|
+
{({ formProps }) => (
|
|
180
|
+
<form {...formProps}>
|
|
181
|
+
<input />
|
|
182
|
+
</form>
|
|
183
|
+
)}
|
|
184
|
+
</Form>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const formElement = (
|
|
190
|
+
<Form onSubmit={() => {}}>
|
|
191
|
+
{({ formProps }) => (
|
|
192
|
+
<form {...formProps}>
|
|
193
|
+
<input />
|
|
194
|
+
</form>
|
|
195
|
+
)}
|
|
196
|
+
</Form>
|
|
197
|
+
);
|
|
198
|
+
`,
|
|
199
|
+
`
|
|
200
|
+
import React from 'react';
|
|
201
|
+
import Form from '@atlaskit/form';
|
|
202
|
+
|
|
203
|
+
const FormComponent1 = () => (
|
|
204
|
+
<Form onSubmit={() => {}}><input /></Form>
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const FormComponent2 = () => (
|
|
208
|
+
<>
|
|
209
|
+
<Form onSubmit={() => {}}><input /></Form>
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
class FormComponent3 extends React.Component {
|
|
214
|
+
render() {
|
|
215
|
+
return (<Form onSubmit={() => {}}><input /></Form>);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const formElement = (
|
|
220
|
+
<Form onSubmit={() => {}}><input /></Form>
|
|
221
|
+
);
|
|
222
|
+
`,
|
|
223
|
+
'should convert from function with no props on form',
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
defineInlineTest(
|
|
227
|
+
{ default: transformer, parser: 'tsx' },
|
|
228
|
+
{},
|
|
229
|
+
`
|
|
230
|
+
import React from 'react';
|
|
231
|
+
import Form from '@atlaskit/form';
|
|
232
|
+
|
|
233
|
+
const FormComponent1 = () => (
|
|
234
|
+
<Form onSubmit={() => {}}>
|
|
235
|
+
{({ formProps: renamed }) => (
|
|
236
|
+
<form {...renamed}>
|
|
237
|
+
<input />
|
|
238
|
+
</form>
|
|
239
|
+
)}
|
|
240
|
+
</Form>
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
const FormComponent2 = () => (
|
|
244
|
+
<>
|
|
245
|
+
<Form onSubmit={() => {}}>
|
|
246
|
+
{({ formProps: renamed }) => (
|
|
247
|
+
<form {...renamed}>
|
|
248
|
+
<input />
|
|
249
|
+
</form>
|
|
250
|
+
)}
|
|
251
|
+
</Form>
|
|
252
|
+
</>
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
class FormComponent3 extends React.Component {
|
|
256
|
+
render() {
|
|
257
|
+
return (
|
|
258
|
+
<Form onSubmit={() => {}}>
|
|
259
|
+
{({ formProps: renamed }) => (
|
|
260
|
+
<form {...renamed}>
|
|
261
|
+
<input />
|
|
262
|
+
</form>
|
|
263
|
+
)}
|
|
264
|
+
</Form>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const formElement = (
|
|
270
|
+
<Form onSubmit={() => {}}>
|
|
271
|
+
{({ formProps: renamed }) => (
|
|
272
|
+
<form {...renamed}>
|
|
273
|
+
<input />
|
|
274
|
+
</form>
|
|
275
|
+
)}
|
|
276
|
+
</Form>
|
|
277
|
+
);
|
|
278
|
+
`,
|
|
279
|
+
`
|
|
280
|
+
import React from 'react';
|
|
281
|
+
import Form from '@atlaskit/form';
|
|
282
|
+
|
|
283
|
+
const FormComponent1 = () => (
|
|
284
|
+
<Form onSubmit={() => {}}><input /></Form>
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
const FormComponent2 = () => (
|
|
288
|
+
<>
|
|
289
|
+
<Form onSubmit={() => {}}><input /></Form>
|
|
290
|
+
</>
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
class FormComponent3 extends React.Component {
|
|
294
|
+
render() {
|
|
295
|
+
return (<Form onSubmit={() => {}}><input /></Form>);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const formElement = (
|
|
300
|
+
<Form onSubmit={() => {}}><input /></Form>
|
|
301
|
+
);
|
|
302
|
+
`,
|
|
303
|
+
'should convert from function with no props on form',
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
defineInlineTest(
|
|
307
|
+
{ default: transformer, parser: 'tsx' },
|
|
308
|
+
{},
|
|
309
|
+
`
|
|
310
|
+
import React from 'react';
|
|
311
|
+
import Form from '@atlaskit/form';
|
|
312
|
+
|
|
313
|
+
const FormComponent1 = () => (
|
|
314
|
+
<Form onSubmit={() => {}}>
|
|
315
|
+
{({ formProps }) => (
|
|
316
|
+
<form {...formProps} foo="bar">
|
|
317
|
+
<input />
|
|
318
|
+
</form>
|
|
319
|
+
)}
|
|
320
|
+
</Form>
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
const FormComponent2 = () => (
|
|
324
|
+
<>
|
|
325
|
+
<Form onSubmit={() => {}}>
|
|
326
|
+
{({ formProps }) => (
|
|
327
|
+
<form {...formProps} foo="bar">
|
|
328
|
+
<input />
|
|
329
|
+
</form>
|
|
330
|
+
)}
|
|
331
|
+
</Form>
|
|
332
|
+
</>
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
class FormComponent3 extends React.Component {
|
|
336
|
+
render() {
|
|
337
|
+
return (
|
|
338
|
+
<Form onSubmit={() => {}}>
|
|
339
|
+
{({ formProps }) => (
|
|
340
|
+
<form {...formProps} foo="bar">
|
|
341
|
+
<input />
|
|
342
|
+
</form>
|
|
343
|
+
)}
|
|
344
|
+
</Form>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const formElement = (
|
|
350
|
+
<Form onSubmit={() => {}}>
|
|
351
|
+
{({ formProps }) => (
|
|
352
|
+
<form {...formProps} foo="bar">
|
|
353
|
+
<input />
|
|
354
|
+
</form>
|
|
355
|
+
)}
|
|
356
|
+
</Form>
|
|
357
|
+
);
|
|
358
|
+
`,
|
|
359
|
+
`
|
|
360
|
+
import React from 'react';
|
|
361
|
+
import Form from '@atlaskit/form';
|
|
362
|
+
|
|
363
|
+
const FormComponent1 = () => (
|
|
364
|
+
<Form
|
|
365
|
+
onSubmit={() => {}}
|
|
366
|
+
formProps={{
|
|
367
|
+
foo: "bar"
|
|
368
|
+
}}><input /></Form>
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
const FormComponent2 = () => (
|
|
372
|
+
<>
|
|
373
|
+
<Form
|
|
374
|
+
onSubmit={() => {}}
|
|
375
|
+
formProps={{
|
|
376
|
+
foo: "bar"
|
|
377
|
+
}}><input /></Form>
|
|
378
|
+
</>
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
class FormComponent3 extends React.Component {
|
|
382
|
+
render() {
|
|
383
|
+
return (
|
|
384
|
+
<Form
|
|
385
|
+
onSubmit={() => {}}
|
|
386
|
+
formProps={{
|
|
387
|
+
foo: "bar"
|
|
388
|
+
}}><input /></Form>
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const formElement = (
|
|
394
|
+
<Form
|
|
395
|
+
onSubmit={() => {}}
|
|
396
|
+
formProps={{
|
|
397
|
+
foo: "bar"
|
|
398
|
+
}}><input /></Form>
|
|
399
|
+
);
|
|
400
|
+
`,
|
|
401
|
+
'should convert from function with single prop on form',
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
defineInlineTest(
|
|
405
|
+
{ default: transformer, parser: 'tsx' },
|
|
406
|
+
{},
|
|
407
|
+
`
|
|
408
|
+
import React from 'react';
|
|
409
|
+
import Form from '@atlaskit/form';
|
|
410
|
+
|
|
411
|
+
const FormComponent1 = () => (
|
|
412
|
+
<Form onSubmit={() => {}}>
|
|
413
|
+
{({ formProps }) => (
|
|
414
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
415
|
+
<input />
|
|
416
|
+
</form>
|
|
417
|
+
)}
|
|
418
|
+
</Form>
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
const FormComponent2 = () => (
|
|
422
|
+
<>
|
|
423
|
+
<Form onSubmit={() => {}}>
|
|
424
|
+
{({ formProps }) => (
|
|
425
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
426
|
+
<input />
|
|
427
|
+
</form>
|
|
428
|
+
)}
|
|
429
|
+
</Form>
|
|
430
|
+
</>
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
class FormComponent3 extends React.Component {
|
|
434
|
+
render() {
|
|
435
|
+
return (
|
|
436
|
+
<Form onSubmit={() => {}}>
|
|
437
|
+
{({ formProps }) => (
|
|
438
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
439
|
+
<input />
|
|
440
|
+
</form>
|
|
441
|
+
)}
|
|
442
|
+
</Form>
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const formElement = (
|
|
448
|
+
<Form onSubmit={() => {}}>
|
|
449
|
+
{({ formProps }) => (
|
|
450
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
451
|
+
<input />
|
|
452
|
+
</form>
|
|
453
|
+
)}
|
|
454
|
+
</Form>
|
|
455
|
+
);
|
|
456
|
+
`,
|
|
457
|
+
`
|
|
458
|
+
import React from 'react';
|
|
459
|
+
import Form from '@atlaskit/form';
|
|
460
|
+
|
|
461
|
+
const FormComponent1 = () => (
|
|
462
|
+
<Form
|
|
463
|
+
onSubmit={() => {}}
|
|
464
|
+
formProps={{
|
|
465
|
+
foo: "bar",
|
|
466
|
+
baz: "qux"
|
|
467
|
+
}}><input /></Form>
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
const FormComponent2 = () => (
|
|
471
|
+
<>
|
|
472
|
+
<Form
|
|
473
|
+
onSubmit={() => {}}
|
|
474
|
+
formProps={{
|
|
475
|
+
foo: "bar",
|
|
476
|
+
baz: "qux"
|
|
477
|
+
}}><input /></Form>
|
|
478
|
+
</>
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
class FormComponent3 extends React.Component {
|
|
482
|
+
render() {
|
|
483
|
+
return (
|
|
484
|
+
<Form
|
|
485
|
+
onSubmit={() => {}}
|
|
486
|
+
formProps={{
|
|
487
|
+
foo: "bar",
|
|
488
|
+
baz: "qux"
|
|
489
|
+
}}><input /></Form>
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const formElement = (
|
|
495
|
+
<Form
|
|
496
|
+
onSubmit={() => {}}
|
|
497
|
+
formProps={{
|
|
498
|
+
foo: "bar",
|
|
499
|
+
baz: "qux"
|
|
500
|
+
}}><input /></Form>
|
|
501
|
+
);
|
|
502
|
+
`,
|
|
503
|
+
'should convert from function with multiple props on form',
|
|
504
|
+
);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
describe('Do not migrate Form when anything more than `formProps` in child arg', () => {
|
|
508
|
+
defineInlineTest(
|
|
509
|
+
{ default: transformer, parser: 'tsx' },
|
|
510
|
+
{},
|
|
511
|
+
`
|
|
512
|
+
import React from 'react';
|
|
513
|
+
import Form from '@atlaskit/form';
|
|
514
|
+
|
|
515
|
+
const FormComponent1 = () => (
|
|
516
|
+
<Form onSubmit={() => {}}>
|
|
517
|
+
{({ formProps, submitting }) => (
|
|
518
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
519
|
+
<input />
|
|
520
|
+
</form>
|
|
521
|
+
)}
|
|
522
|
+
</Form>
|
|
523
|
+
);
|
|
524
|
+
|
|
525
|
+
const FormComponent2 = () => (
|
|
526
|
+
<>
|
|
527
|
+
<Form onSubmit={() => {}}>
|
|
528
|
+
{({ formProps, submitting }) => (
|
|
529
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
530
|
+
<input />
|
|
531
|
+
</form>
|
|
532
|
+
)}
|
|
533
|
+
</Form>
|
|
534
|
+
</>
|
|
535
|
+
);
|
|
536
|
+
|
|
537
|
+
class FormComponent3 extends React.Component {
|
|
538
|
+
render() {
|
|
539
|
+
return (
|
|
540
|
+
<Form onSubmit={() => {}}>
|
|
541
|
+
{({ formProps, submitting }) => (
|
|
542
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
543
|
+
<input />
|
|
544
|
+
</form>
|
|
545
|
+
)}
|
|
546
|
+
</Form>
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
const formElement = (
|
|
552
|
+
<Form onSubmit={() => {}}>
|
|
553
|
+
{({ formProps, submitting }) => (
|
|
554
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
555
|
+
<input />
|
|
556
|
+
</form>
|
|
557
|
+
)}
|
|
558
|
+
</Form>
|
|
559
|
+
);
|
|
560
|
+
`,
|
|
561
|
+
`
|
|
562
|
+
import React from 'react';
|
|
563
|
+
import Form from '@atlaskit/form';
|
|
564
|
+
|
|
565
|
+
const FormComponent1 = () => (
|
|
566
|
+
<Form onSubmit={() => {}}>
|
|
567
|
+
{({ formProps, submitting }) => (
|
|
568
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
569
|
+
<input />
|
|
570
|
+
</form>
|
|
571
|
+
)}
|
|
572
|
+
</Form>
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
const FormComponent2 = () => (
|
|
576
|
+
<>
|
|
577
|
+
<Form onSubmit={() => {}}>
|
|
578
|
+
{({ formProps, submitting }) => (
|
|
579
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
580
|
+
<input />
|
|
581
|
+
</form>
|
|
582
|
+
)}
|
|
583
|
+
</Form>
|
|
584
|
+
</>
|
|
585
|
+
);
|
|
586
|
+
|
|
587
|
+
class FormComponent3 extends React.Component {
|
|
588
|
+
render() {
|
|
589
|
+
return (
|
|
590
|
+
<Form onSubmit={() => {}}>
|
|
591
|
+
{({ formProps, submitting }) => (
|
|
592
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
593
|
+
<input />
|
|
594
|
+
</form>
|
|
595
|
+
)}
|
|
596
|
+
</Form>
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const formElement = (
|
|
602
|
+
<Form onSubmit={() => {}}>
|
|
603
|
+
{({ formProps, submitting }) => (
|
|
604
|
+
<form {...formProps} foo="bar" baz="qux">
|
|
605
|
+
<input />
|
|
606
|
+
</form>
|
|
607
|
+
)}
|
|
608
|
+
</Form>
|
|
609
|
+
);
|
|
610
|
+
`,
|
|
611
|
+
'should not migrate when anything other than `formProps` is an arg in child function',
|
|
612
|
+
);
|
|
613
|
+
});
|