@atlaskit/form 14.2.1 → 14.2.3
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,17 @@
|
|
|
1
1
|
# @atlaskit/form
|
|
2
2
|
|
|
3
|
+
## 14.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 14.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 14.2.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -984,7 +996,6 @@
|
|
|
984
996
|
had no effect when used.
|
|
985
997
|
|
|
986
998
|
The props which were removed from the typings are:
|
|
987
|
-
|
|
988
999
|
- `error`
|
|
989
1000
|
- `fieldId`
|
|
990
1001
|
- `valid`
|
|
@@ -1581,7 +1592,6 @@
|
|
|
1581
1592
|
|
|
1582
1593
|
Remove namespace imports from React, ReactDom, and PropTypes- Updated dependencies
|
|
1583
1594
|
[6548261c9a](https://bitbucket.org/atlassian/atlassian-frontend/commits/6548261c9a):
|
|
1584
|
-
|
|
1585
1595
|
- @atlaskit/docs@8.3.2
|
|
1586
1596
|
- @atlaskit/visual-regression@0.1.9
|
|
1587
1597
|
- @atlaskit/button@13.3.7
|
|
@@ -1899,7 +1909,6 @@
|
|
|
1899
1909
|
### Minor Changes
|
|
1900
1910
|
|
|
1901
1911
|
- [minor][7bbf303d01](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7bbf303d01):
|
|
1902
|
-
|
|
1903
1912
|
- Improved form validation user experience when field validation and submission validation used
|
|
1904
1913
|
together on the same field
|
|
1905
1914
|
- Improved form validation docs
|
|
@@ -1988,13 +1997,11 @@
|
|
|
1988
1997
|
## 6.0.1
|
|
1989
1998
|
|
|
1990
1999
|
- [patch][19bbcb44ed](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/19bbcb44ed):
|
|
1991
|
-
|
|
1992
2000
|
- Upgrade final-form dependency. No behavioural or API changes.
|
|
1993
2001
|
|
|
1994
2002
|
## 6.0.0
|
|
1995
2003
|
|
|
1996
2004
|
- [major][7c17b35107](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/7c17b35107):
|
|
1997
|
-
|
|
1998
2005
|
- Updates react and react-dom peer dependencies to react@^16.8.0 and react-dom@^16.8.0. To use
|
|
1999
2006
|
this package, please ensure you use at least this version of react and react-dom.
|
|
2000
2007
|
|
|
@@ -2017,7 +2024,6 @@
|
|
|
2017
2024
|
## 5.2.8
|
|
2018
2025
|
|
|
2019
2026
|
- [patch][cb7ec50eca](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/cb7ec50eca):
|
|
2020
|
-
|
|
2021
2027
|
- Internal changes only. Form is compatible with SSR.
|
|
2022
2028
|
|
|
2023
2029
|
## 5.2.7
|
|
@@ -2051,7 +2057,6 @@
|
|
|
2051
2057
|
## 5.2.6
|
|
2052
2058
|
|
|
2053
2059
|
- [patch][9b0bdd73c2](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/9b0bdd73c2):
|
|
2054
|
-
|
|
2055
2060
|
- Remove unused inline edit dependency from package
|
|
2056
2061
|
|
|
2057
2062
|
## 5.2.5
|
|
@@ -2099,7 +2104,6 @@
|
|
|
2099
2104
|
## 5.2.2
|
|
2100
2105
|
|
|
2101
2106
|
- [patch][a1217df379](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/a1217df379):
|
|
2102
|
-
|
|
2103
2107
|
- Internal changes only. Form is now compatible with ssr.
|
|
2104
2108
|
|
|
2105
2109
|
## 5.2.1
|
|
@@ -2134,13 +2138,11 @@
|
|
|
2134
2138
|
## 5.2.0
|
|
2135
2139
|
|
|
2136
2140
|
- [minor][fe7683f9d6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/fe7683f9d6):
|
|
2137
|
-
|
|
2138
2141
|
- Feature: Submit form on Cmd + Enter on Mac and Ctrl + Enter on Mac and Windows
|
|
2139
2142
|
|
|
2140
2143
|
## 5.1.8
|
|
2141
2144
|
|
|
2142
2145
|
- [patch][76299208e6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/76299208e6):
|
|
2143
|
-
|
|
2144
2146
|
- Drop ES5 from all the flow modules
|
|
2145
2147
|
|
|
2146
2148
|
### Dropping CJS support in all @atlaskit packages
|
|
@@ -2192,7 +2194,6 @@
|
|
|
2192
2194
|
## 5.1.6
|
|
2193
2195
|
|
|
2194
2196
|
- [patch][887c85ffdc](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/887c85ffdc):
|
|
2195
|
-
|
|
2196
2197
|
- Form now provides a `getValues` function to it's child render function. The `getValues` function
|
|
2197
2198
|
returns an object containing the current value of all fields.
|
|
2198
2199
|
|
|
@@ -2207,13 +2208,11 @@
|
|
|
2207
2208
|
## 5.1.4
|
|
2208
2209
|
|
|
2209
2210
|
- [patch][0c0f20c9cf](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/0c0f20c9cf):
|
|
2210
|
-
|
|
2211
2211
|
- Fix typo in Field.js
|
|
2212
2212
|
|
|
2213
2213
|
## 5.1.3
|
|
2214
2214
|
|
|
2215
2215
|
- [patch][a360a3d2b6](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/a360a3d2b6):
|
|
2216
|
-
|
|
2217
2216
|
- Bugfix: field entry in form state gets deleted when Field is unmounted
|
|
2218
2217
|
- Bugfix: Shallow equal check in Field works correctly across different types
|
|
2219
2218
|
|
|
@@ -2244,20 +2243,17 @@
|
|
|
2244
2243
|
## 5.1.1
|
|
2245
2244
|
|
|
2246
2245
|
- [patch][58e7bc1](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/58e7bc1):
|
|
2247
|
-
|
|
2248
2246
|
- Added example of Form use within a ModalDialog - no changes required
|
|
2249
2247
|
|
|
2250
2248
|
## 5.1.0
|
|
2251
2249
|
|
|
2252
2250
|
- [minor][b36a82f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/b36a82f):
|
|
2253
|
-
|
|
2254
2251
|
- **feature:** Uses context to automatically assosiate a message to field. No upgrade changes
|
|
2255
2252
|
required. Can remove fieldId prop on Message components if you are using that prop currently.
|
|
2256
2253
|
|
|
2257
2254
|
## 5.0.0
|
|
2258
2255
|
|
|
2259
2256
|
- [major][647a46f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/647a46f):
|
|
2260
|
-
|
|
2261
2257
|
- **Breaking:** this version is a major overhaul of the package.
|
|
2262
2258
|
- **Conceptual changes:** The `Form` component must be the source of truth for the form state.
|
|
2263
2259
|
This means you keep track of far less state in your application.
|
|
@@ -2380,13 +2376,11 @@
|
|
|
2380
2376
|
## 4.0.15
|
|
2381
2377
|
|
|
2382
2378
|
- [patch][e6d3f57](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/e6d3f57):
|
|
2383
|
-
|
|
2384
2379
|
- Check that content children of FormSection are valid elements before cloning
|
|
2385
2380
|
|
|
2386
2381
|
## 4.0.14
|
|
2387
2382
|
|
|
2388
2383
|
- [patch][c8d935f](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/c8d935f" d):
|
|
2389
|
-
|
|
2390
2384
|
- Fixing form header styles
|
|
2391
2385
|
|
|
2392
2386
|
## 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.3",
|
|
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": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@atlaskit/heading": "^5.2.0",
|
|
31
31
|
"@atlaskit/icon": "^28.5.0",
|
|
32
32
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
33
|
-
"@atlaskit/primitives": "^
|
|
34
|
-
"@atlaskit/tokens": "^
|
|
33
|
+
"@atlaskit/primitives": "^16.0.0",
|
|
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",
|