@atlaskit/form 14.2.1 → 14.2.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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/form
|
|
2
2
|
|
|
3
|
+
## 14.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
3
9
|
## 14.2.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -984,7 +990,6 @@
|
|
|
984
990
|
had no effect when used.
|
|
985
991
|
|
|
986
992
|
The props which were removed from the typings are:
|
|
987
|
-
|
|
988
993
|
- `error`
|
|
989
994
|
- `fieldId`
|
|
990
995
|
- `valid`
|
|
@@ -1581,7 +1586,6 @@
|
|
|
1581
1586
|
|
|
1582
1587
|
Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
|
|
1583
1588
|
[6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
|
|
1584
|
-
|
|
1585
1589
|
- @atlaskit/docs@8.3.2
|
|
1586
1590
|
- @atlaskit/visual-regression@0.1.9
|
|
1587
1591
|
- @atlaskit/button@13.3.7
|
|
@@ -1899,7 +1903,6 @@
|
|
|
1899
1903
|
### Minor Changes
|
|
1900
1904
|
|
|
1901
1905
|
- [minor][7bbf303d01](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7bbf303d01):
|
|
1902
|
-
|
|
1903
1906
|
- Improved form validation user experience when field validation and submission validation used
|
|
1904
1907
|
together on the same field
|
|
1905
1908
|
- Improved form validation docs
|
|
@@ -1988,13 +1991,11 @@
|
|
|
1988
1991
|
## 6.0.1
|
|
1989
1992
|
|
|
1990
1993
|
- [patch][19bbcb44ed](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/19bbcb44ed):
|
|
1991
|
-
|
|
1992
1994
|
- Upgrade final-form dependency. No behavioural or API changes.
|
|
1993
1995
|
|
|
1994
1996
|
## 6.0.0
|
|
1995
1997
|
|
|
1996
1998
|
- [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
|
|
1997
|
-
|
|
1998
1999
|
- Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
|
|
1999
2000
|
this package, please ensure you use at least this version of react and react-dom.
|
|
2000
2001
|
|
|
@@ -2017,7 +2018,6 @@
|
|
|
2017
2018
|
## 5.2.8
|
|
2018
2019
|
|
|
2019
2020
|
- [patch][cb7ec50eca](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/cb7ec50eca):
|
|
2020
|
-
|
|
2021
2021
|
- Internal changes only. Form is compatible with SSR.
|
|
2022
2022
|
|
|
2023
2023
|
## 5.2.7
|
|
@@ -2051,7 +2051,6 @@
|
|
|
2051
2051
|
## 5.2.6
|
|
2052
2052
|
|
|
2053
2053
|
- [patch][9b0bdd73c2](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9b0bdd73c2):
|
|
2054
|
-
|
|
2055
2054
|
- Remove unused inline edit dependency from package
|
|
2056
2055
|
|
|
2057
2056
|
## 5.2.5
|
|
@@ -2099,7 +2098,6 @@
|
|
|
2099
2098
|
## 5.2.2
|
|
2100
2099
|
|
|
2101
2100
|
- [patch][a1217df379](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/a1217df379):
|
|
2102
|
-
|
|
2103
2101
|
- Internal changes only. Form is now compatible with ssr.
|
|
2104
2102
|
|
|
2105
2103
|
## 5.2.1
|
|
@@ -2134,13 +2132,11 @@
|
|
|
2134
2132
|
## 5.2.0
|
|
2135
2133
|
|
|
2136
2134
|
- [minor][fe7683f9d6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/fe7683f9d6):
|
|
2137
|
-
|
|
2138
2135
|
- Feature: Submit form on Cmd + Enter on Mac and Ctrl + Enter on Mac and Windows
|
|
2139
2136
|
|
|
2140
2137
|
## 5.1.8
|
|
2141
2138
|
|
|
2142
2139
|
- [patch][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
|
|
2143
|
-
|
|
2144
2140
|
- Drop ES5 from all the flow modules
|
|
2145
2141
|
|
|
2146
2142
|
### Dropping CJS support in all @atlaskit packages
|
|
@@ -2192,7 +2188,6 @@
|
|
|
2192
2188
|
## 5.1.6
|
|
2193
2189
|
|
|
2194
2190
|
- [patch][887c85ffdc](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/887c85ffdc):
|
|
2195
|
-
|
|
2196
2191
|
- Form now provides a `getValues` function to it's child render function. The `getValues` function
|
|
2197
2192
|
returns an object containing the current value of all fields.
|
|
2198
2193
|
|
|
@@ -2207,13 +2202,11 @@
|
|
|
2207
2202
|
## 5.1.4
|
|
2208
2203
|
|
|
2209
2204
|
- [patch][0c0f20c9cf](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/0c0f20c9cf):
|
|
2210
|
-
|
|
2211
2205
|
- Fix typo in Field.js
|
|
2212
2206
|
|
|
2213
2207
|
## 5.1.3
|
|
2214
2208
|
|
|
2215
2209
|
- [patch][a360a3d2b6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/a360a3d2b6):
|
|
2216
|
-
|
|
2217
2210
|
- Bugfix: field entry in form state gets deleted when Field is unmounted
|
|
2218
2211
|
- Bugfix: Shallow equal check in Field works correctly across different types
|
|
2219
2212
|
|
|
@@ -2244,20 +2237,17 @@
|
|
|
2244
2237
|
## 5.1.1
|
|
2245
2238
|
|
|
2246
2239
|
- [patch][58e7bc1](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/58e7bc1):
|
|
2247
|
-
|
|
2248
2240
|
- Added example of Form use within a ModalDialog - no changes required
|
|
2249
2241
|
|
|
2250
2242
|
## 5.1.0
|
|
2251
2243
|
|
|
2252
2244
|
- [minor][b36a82f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b36a82f):
|
|
2253
|
-
|
|
2254
2245
|
- **feature:** Uses context to automatically assosiate a message to field. No upgrade changes
|
|
2255
2246
|
required. Can remove fieldId prop on Message components if you are using that prop currently.
|
|
2256
2247
|
|
|
2257
2248
|
## 5.0.0
|
|
2258
2249
|
|
|
2259
2250
|
- [major][647a46f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/647a46f):
|
|
2260
|
-
|
|
2261
2251
|
- **Breaking:** this version is a major overhaul of the package.
|
|
2262
2252
|
- **Conceptual changes:** The `Form` component must be the source of truth for the form state.
|
|
2263
2253
|
This means you keep track of far less state in your application.
|
|
@@ -2380,13 +2370,11 @@
|
|
|
2380
2370
|
## 4.0.15
|
|
2381
2371
|
|
|
2382
2372
|
- [patch][e6d3f57](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e6d3f57):
|
|
2383
|
-
|
|
2384
2373
|
- Check that content children of FormSection are valid elements before cloning
|
|
2385
2374
|
|
|
2386
2375
|
## 4.0.14
|
|
2387
2376
|
|
|
2388
2377
|
- [patch][c8d935f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/c8d935f" d):
|
|
2389
|
-
|
|
2390
2378
|
- Fixing form header styles
|
|
2391
2379
|
|
|
2392
2380
|
## 4.0.13
|
|
@@ -460,23 +460,23 @@ const formElement = (
|
|
|
460
460
|
import Form from '@atlaskit/form';
|
|
461
461
|
|
|
462
462
|
const FormComponent1 = () => (
|
|
463
|
-
<Form onSubmit={() => {}}
|
|
463
|
+
<Form onSubmit={() => {}} noValidate name="bar" id="foo" autocomplete="off"><input /></Form>
|
|
464
464
|
);
|
|
465
465
|
|
|
466
466
|
const FormComponent2 = () => (
|
|
467
467
|
<>
|
|
468
|
-
<Form onSubmit={() => {}}
|
|
468
|
+
<Form onSubmit={() => {}} noValidate name="bar" id="foo" autocomplete="off"><input /></Form>
|
|
469
469
|
</>
|
|
470
470
|
);
|
|
471
471
|
|
|
472
472
|
class FormComponent3 extends React.Component {
|
|
473
473
|
render() {
|
|
474
|
-
return (<Form onSubmit={() => {}}
|
|
474
|
+
return (<Form onSubmit={() => {}} noValidate name="bar" id="foo" autocomplete="off"><input /></Form>);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
const formElement = (
|
|
479
|
-
<Form onSubmit={() => {}}
|
|
479
|
+
<Form onSubmit={() => {}} noValidate name="bar" id="foo" autocomplete="off"><input /></Form>
|
|
480
480
|
);
|
|
481
481
|
`,
|
|
482
482
|
'should migrate existing props on `form` into their respective props on `Form`',
|
|
@@ -540,23 +540,23 @@ const formElement = (
|
|
|
540
540
|
import Form from '@atlaskit/form';
|
|
541
541
|
|
|
542
542
|
const FormComponent1 = () => (
|
|
543
|
-
<Form onSubmit={() => {}}
|
|
543
|
+
<Form onSubmit={() => {}} labelId="bar" label="foo"><input /></Form>
|
|
544
544
|
);
|
|
545
545
|
|
|
546
546
|
const FormComponent2 = () => (
|
|
547
547
|
<>
|
|
548
|
-
<Form onSubmit={() => {}}
|
|
548
|
+
<Form onSubmit={() => {}} labelId="bar" label="foo"><input /></Form>
|
|
549
549
|
</>
|
|
550
550
|
);
|
|
551
551
|
|
|
552
552
|
class FormComponent3 extends React.Component {
|
|
553
553
|
render() {
|
|
554
|
-
return (<Form onSubmit={() => {}}
|
|
554
|
+
return (<Form onSubmit={() => {}} labelId="bar" label="foo"><input /></Form>);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
|
|
558
558
|
const formElement = (
|
|
559
|
-
<Form onSubmit={() => {}}
|
|
559
|
+
<Form onSubmit={() => {}} labelId="bar" label="foo"><input /></Form>
|
|
560
560
|
);
|
|
561
561
|
`,
|
|
562
562
|
'should migrate existing props on `form` into different names',
|
|
@@ -622,26 +622,26 @@ const formElement = (
|
|
|
622
622
|
const FormComponent1 = () => (
|
|
623
623
|
<Form
|
|
624
624
|
onSubmit={() => {}}
|
|
625
|
+
noValidate
|
|
626
|
+
name="bar"
|
|
627
|
+
id="foo"
|
|
628
|
+
autocomplete="off"
|
|
625
629
|
formProps={{
|
|
626
630
|
quu: "qux"
|
|
627
|
-
}}
|
|
628
|
-
autocomplete="off"
|
|
629
|
-
id="foo"
|
|
630
|
-
name="bar"
|
|
631
|
-
noValidate><input /></Form>
|
|
631
|
+
}}><input /></Form>
|
|
632
632
|
);
|
|
633
633
|
|
|
634
634
|
const FormComponent2 = () => (
|
|
635
635
|
<>
|
|
636
636
|
<Form
|
|
637
637
|
onSubmit={() => {}}
|
|
638
|
+
noValidate
|
|
639
|
+
name="bar"
|
|
640
|
+
id="foo"
|
|
641
|
+
autocomplete="off"
|
|
638
642
|
formProps={{
|
|
639
643
|
quu: "qux"
|
|
640
|
-
}}
|
|
641
|
-
autocomplete="off"
|
|
642
|
-
id="foo"
|
|
643
|
-
name="bar"
|
|
644
|
-
noValidate><input /></Form>
|
|
644
|
+
}}><input /></Form>
|
|
645
645
|
</>
|
|
646
646
|
);
|
|
647
647
|
|
|
@@ -650,13 +650,13 @@ const formElement = (
|
|
|
650
650
|
return (
|
|
651
651
|
<Form
|
|
652
652
|
onSubmit={() => {}}
|
|
653
|
+
noValidate
|
|
654
|
+
name="bar"
|
|
655
|
+
id="foo"
|
|
656
|
+
autocomplete="off"
|
|
653
657
|
formProps={{
|
|
654
658
|
quu: "qux"
|
|
655
|
-
}}
|
|
656
|
-
autocomplete="off"
|
|
657
|
-
id="foo"
|
|
658
|
-
name="bar"
|
|
659
|
-
noValidate><input /></Form>
|
|
659
|
+
}}><input /></Form>
|
|
660
660
|
);
|
|
661
661
|
}
|
|
662
662
|
}
|
|
@@ -664,13 +664,13 @@ const formElement = (
|
|
|
664
664
|
const formElement = (
|
|
665
665
|
<Form
|
|
666
666
|
onSubmit={() => {}}
|
|
667
|
+
noValidate
|
|
668
|
+
name="bar"
|
|
669
|
+
id="foo"
|
|
670
|
+
autocomplete="off"
|
|
667
671
|
formProps={{
|
|
668
672
|
quu: "qux"
|
|
669
|
-
}}
|
|
670
|
-
autocomplete="off"
|
|
671
|
-
id="foo"
|
|
672
|
-
name="bar"
|
|
673
|
-
noValidate><input /></Form>
|
|
673
|
+
}}><input /></Form>
|
|
674
674
|
);
|
|
675
675
|
`,
|
|
676
676
|
'should migrate existing props on `form` into their respective props on `Form` and also use `formProps` if needed',
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type API,
|
|
3
|
+
type Collection,
|
|
3
4
|
type FileInfo,
|
|
4
5
|
type JSCodeshift,
|
|
5
6
|
type JSXAttribute,
|
|
6
7
|
type JSXElement,
|
|
7
8
|
type Options,
|
|
8
9
|
} from 'jscodeshift';
|
|
9
|
-
import { type Collection } from 'jscodeshift/src/Collection';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
addJSXAttributeToJSXElement,
|
|
13
|
-
getImportDeclarationCollection,
|
|
14
|
-
getImportDefaultSpecifierCollection,
|
|
15
|
-
getImportDefaultSpecifierName,
|
|
16
|
-
hasImportDeclaration,
|
|
17
|
-
} from './utils/helpers';
|
|
18
10
|
|
|
19
11
|
const importPath = '@atlaskit/form';
|
|
20
12
|
const EXISTING_FORM_ATTRIBUTES: Record<string, any> = {
|
|
@@ -26,6 +18,56 @@ const EXISTING_FORM_ATTRIBUTES: Record<string, any> = {
|
|
|
26
18
|
noValidate: 'noValidate',
|
|
27
19
|
};
|
|
28
20
|
|
|
21
|
+
const shouldSkipFile = (filePath: string): boolean =>
|
|
22
|
+
filePath.includes('__tests__') || filePath.includes('test');
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Helper functions for JSX manipulation
|
|
26
|
+
*/
|
|
27
|
+
function getImportDeclarationCollection(
|
|
28
|
+
j: JSCodeshift,
|
|
29
|
+
collection: Collection<any>,
|
|
30
|
+
importPath: string,
|
|
31
|
+
): Collection<any> {
|
|
32
|
+
return collection.find(j.ImportDeclaration, {
|
|
33
|
+
source: { value: importPath },
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getImportDefaultSpecifierCollection(
|
|
38
|
+
j: JSCodeshift,
|
|
39
|
+
importDeclarationCollection: Collection<any>,
|
|
40
|
+
): Collection<any> {
|
|
41
|
+
return importDeclarationCollection.find(j.ImportDefaultSpecifier);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getImportDefaultSpecifierName(defaultImport: Collection<any>): string | null {
|
|
45
|
+
if (defaultImport.length === 0) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return defaultImport.get(0).node.local.name;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function hasImportDeclaration(
|
|
52
|
+
j: JSCodeshift,
|
|
53
|
+
collection: Collection<any>,
|
|
54
|
+
importPath: string,
|
|
55
|
+
): boolean {
|
|
56
|
+
return getImportDeclarationCollection(j, collection, importPath).length > 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function addJSXAttributeToJSXElement(
|
|
60
|
+
j: JSCodeshift,
|
|
61
|
+
jsxElementPath: any,
|
|
62
|
+
attribute: JSXAttribute,
|
|
63
|
+
position: number = 0,
|
|
64
|
+
): void {
|
|
65
|
+
if (!jsxElementPath.node.openingElement.attributes) {
|
|
66
|
+
jsxElementPath.node.openingElement.attributes = [];
|
|
67
|
+
}
|
|
68
|
+
jsxElementPath.node.openingElement.attributes.splice(position, 0, attribute);
|
|
69
|
+
}
|
|
70
|
+
|
|
29
71
|
const convertToSimpleForm = (j: JSCodeshift, collection: Collection<any>) => {
|
|
30
72
|
const importDeclarationCollection = getImportDeclarationCollection(j, collection, importPath);
|
|
31
73
|
const defaultImport = getImportDefaultSpecifierCollection(j, importDeclarationCollection);
|
|
@@ -58,7 +100,7 @@ const convertToSimpleForm = (j: JSCodeshift, collection: Collection<any>) => {
|
|
|
58
100
|
return;
|
|
59
101
|
}
|
|
60
102
|
|
|
61
|
-
// if function child but more than just `
|
|
103
|
+
// if function child but more than just `formProps`, exit early
|
|
62
104
|
const args = childFunction.expression.params
|
|
63
105
|
.filter((arg) => arg.type === 'ObjectPattern' && 'properties' in arg)
|
|
64
106
|
.flatMap((arg) => arg.properties)
|
|
@@ -188,7 +230,13 @@ const convertToSimpleForm = (j: JSCodeshift, collection: Collection<any>) => {
|
|
|
188
230
|
};
|
|
189
231
|
|
|
190
232
|
export default function transformer(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) {
|
|
191
|
-
const { source } = fileInfo;
|
|
233
|
+
const { source, path } = fileInfo;
|
|
234
|
+
|
|
235
|
+
// Skip test files
|
|
236
|
+
if (path && shouldSkipFile(path)) {
|
|
237
|
+
return source;
|
|
238
|
+
}
|
|
239
|
+
|
|
192
240
|
const collection = j(source);
|
|
193
241
|
|
|
194
242
|
// If our component is not here, skip the file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/form",
|
|
3
|
-
"version": "14.2.
|
|
3
|
+
"version": "14.2.2",
|
|
4
4
|
"description": "A form allows users to input information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"**/*.compiled.css"
|
|
17
17
|
],
|
|
18
18
|
"atlaskit:src": "src/index.tsx",
|
|
19
|
-
"atlaskit:designLink": "https://atlassian.design/
|
|
19
|
+
"atlaskit:designLink": "https://atlassian.design/patterns/forms",
|
|
20
20
|
"atlassian": {
|
|
21
21
|
"team": "Design System Team",
|
|
22
22
|
"website": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/icon": "^28.5.0",
|
|
32
32
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
33
33
|
"@atlaskit/primitives": "^15.0.0",
|
|
34
|
-
"@atlaskit/tokens": "^
|
|
34
|
+
"@atlaskit/tokens": "^7.0.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0",
|
|
36
36
|
"final-form": "^4.20.3",
|
|
37
37
|
"final-form-focus": "^1.1.2",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/checkbox": "^17.1.0",
|
|
50
50
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
51
51
|
"@atlaskit/datetime-picker": "^17.1.0",
|
|
52
|
-
"@atlaskit/docs": "^11.
|
|
52
|
+
"@atlaskit/docs": "^11.2.0",
|
|
53
53
|
"@atlaskit/link": "^3.2.0",
|
|
54
54
|
"@atlaskit/lozenge": "^13.0.0",
|
|
55
55
|
"@atlaskit/modal-dialog": "^14.5.0",
|