envoc-form 2.0.1-9 → 2.0.1
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/README.md +7 -7
- package/dist/css/envoc-form-styles.css +7 -6
- package/dist/css/envoc-form-styles.css.map +1 -1
- package/es/AddressInput/AddressInput.js +7 -6
- package/es/ConfirmBaseForm/ConfirmBaseForm.js +3 -2
- package/es/ConfirmDeleteForm/ConfirmDeleteForm.js +2 -1
- package/es/DatePickerInput/DatePickerInput.js +22 -5
- package/es/FileInput/DefaultFileList.js +3 -2
- package/es/FileInput/DropzoneFileInput.js +15 -12
- package/es/FileInput/FileInput.js +31 -9
- package/es/Form/Form.js +2 -1
- package/es/FormGroupWrapper.js +2 -1
- package/es/FormInput/FormInput.js +12 -6
- package/es/FormInputArray/FormInputArray.js +39 -24
- package/es/IconInput.js +2 -1
- package/es/ReactSelectField/ReactSelectField.js +6 -3
- package/es/SubmitFormButton.js +2 -1
- package/es/__Tests__/FormTestBase.js +5 -2
- package/es/normalizers.js +10 -5
- package/es/useStandardFormInput.js +4 -2
- package/lib/AddressInput/AddressInput.js +14 -8
- package/lib/ConfirmBaseForm/ConfirmBaseForm.js +4 -2
- package/lib/ConfirmDeleteForm/ConfirmDeleteForm.js +3 -1
- package/lib/DatePickerInput/DatePickerInput.js +25 -5
- package/lib/FileInput/DefaultFileList.js +3 -2
- package/lib/FileInput/DropzoneFileInput.js +17 -12
- package/lib/FileInput/FileInput.js +39 -10
- package/lib/Form/Form.js +9 -3
- package/lib/Form/FormBasedPreventNavigation.js +5 -1
- package/lib/FormGroupWrapper.js +3 -1
- package/lib/FormInput/FormInput.js +13 -6
- package/lib/FormInputArray/FormInputArray.js +47 -26
- package/lib/FormSection.js +5 -1
- package/lib/IconInput.js +3 -1
- package/lib/ReactSelectField/ReactSelectField.js +13 -5
- package/lib/ReactSelectField/index.js +6 -2
- package/lib/SubmitFormButton.js +3 -1
- package/lib/__Tests__/FormTestBase.js +6 -2
- package/lib/index.js +7 -3
- package/lib/normalizers.js +10 -5
- package/lib/useStandardFormInput.js +5 -2
- package/lib/validators/index.js +5 -1
- package/package.json +99 -93
- package/src/AddressInput/AddesssInput.test.js +23 -23
- package/src/AddressInput/AddressInput.js +73 -73
- package/src/AddressInput/UsStates.js +53 -53
- package/src/AddressInput/__snapshots__/AddesssInput.test.js.snap +207 -207
- package/src/AddressInput/index.js +2 -2
- package/src/BoolInput/BoolInput.js +7 -7
- package/src/BoolInput/BoolInput.test.js +23 -23
- package/src/BoolInput/InlineBoolInput.js +7 -7
- package/src/BoolInput/__snapshots__/BoolInput.test.js.snap +89 -89
- package/src/BoolInput/boolOptions.js +6 -6
- package/src/BoolInput/index.js +4 -4
- package/src/ConfirmBaseForm/ConfirmBaseForm.js +37 -37
- package/src/ConfirmBaseForm/ConfirmBaseForm.test.js +14 -14
- package/src/ConfirmBaseForm/__snapshots__/ConfirmBaseForm.test.js.snap +23 -23
- package/src/ConfirmBaseForm/index.js +1 -1
- package/src/ConfirmDeleteForm/ConfirmDeleteForm.js +39 -39
- package/src/ConfirmDeleteForm/ConfirmDeleteForm.test.js +24 -24
- package/src/ConfirmDeleteForm/__snapshots__/ConfirmDeleteForm.test.js.snap +25 -25
- package/src/ConfirmDeleteForm/index.js +1 -1
- package/src/DatePickerInput/DatePickerInput.js +58 -46
- package/src/DatePickerInput/DatePickerInput.test.js +74 -74
- package/src/DatePickerInput/__snapshots__/DatePickerInput.test.js.snap +134 -134
- package/src/DatePickerInput/date-picker-input.scss +42 -42
- package/src/DatePickerInput/index.js +3 -3
- package/src/ErrorScrollTarget.js +6 -6
- package/src/FileInput/DefaultFileList.js +39 -39
- package/src/FileInput/DropzoneFileInput.js +56 -55
- package/src/FileInput/DropzoneFileInput.test.js +24 -15
- package/src/FileInput/FileInput.js +77 -49
- package/src/FileInput/FileInput.test.js +24 -15
- package/src/FileInput/__snapshots__/DropzoneFileInput.test.js.snap +57 -28
- package/src/FileInput/__snapshots__/FileInput.test.js.snap +58 -22
- package/src/FileInput/file-input.scss +57 -57
- package/src/FileInput/index.js +4 -4
- package/src/Form/FocusError.js +48 -48
- package/src/Form/Form.js +139 -139
- package/src/Form/Form.test.js +23 -23
- package/src/Form/FormBasedPreventNavigation.js +25 -25
- package/src/Form/ServerErrorContext.js +7 -7
- package/src/Form/__snapshots__/Form.test.js.snap +9 -9
- package/src/Form/index.js +3 -3
- package/src/FormGroup.js +30 -30
- package/src/FormGroupWrapper.js +28 -28
- package/src/FormInput/FormInput.js +144 -144
- package/src/FormInput/FormInput.test.js +66 -66
- package/src/FormInput/__snapshots__/FormInput.test.js.snap +323 -316
- package/src/FormInput/form-input.scss +9 -9
- package/src/FormInput/index.js +2 -2
- package/src/FormInputArray/FormInputArray.js +224 -210
- package/src/FormInputArray/FormInputArray.test.js +108 -59
- package/src/FormInputArray/__snapshots__/FormInputArray.test.js.snap +52 -40
- package/src/FormInputArray/form-input-array.scss +13 -8
- package/src/FormInputArray/index.js +2 -2
- package/src/FormSection.js +13 -13
- package/src/IconInput.js +31 -31
- package/src/InlineFormInput/InlineFormInput.js +6 -6
- package/src/InlineFormInput/InlineFormInput.test.js +23 -23
- package/src/InlineFormInput/__snapshots__/InlineFormInput.test.js.snap +26 -26
- package/src/InlineFormInput/index.js +3 -3
- package/src/InlineFormInput/inline-form-input.scss +3 -3
- package/src/MoneyInput/InlineMoneyInput.js +7 -7
- package/src/MoneyInput/MoneyInput.js +7 -7
- package/src/MoneyInput/MoneyInputs.test.js +43 -43
- package/src/MoneyInput/__snapshots__/MoneyInputs.test.js.snap +81 -81
- package/src/MoneyInput/index.js +4 -4
- package/src/MoneyInput/money-input.scss +3 -3
- package/src/MoneyInput/moneyInputProps.js +12 -12
- package/src/NestedFormFieldContext.js +6 -6
- package/src/ReactSelectField/ReactSelectField.js +122 -120
- package/src/ReactSelectField/index.js +6 -6
- package/src/ReactSelectField/react-select-field.scss +5 -5
- package/src/StandardFormActions.js +27 -27
- package/src/SubmitFormButton.js +28 -28
- package/src/__Tests__/FormTestBase.js +14 -11
- package/src/__Tests__/IconInput.test.js +23 -23
- package/src/__Tests__/StandardFormActions.test.js +23 -23
- package/src/__Tests__/SubmitFormButton.test.js +23 -23
- package/src/__Tests__/__snapshots__/IconInput.test.js.snap +38 -38
- package/src/__Tests__/__snapshots__/StandardFormActions.test.js.snap +25 -25
- package/src/__Tests__/__snapshots__/SubmitFormButton.test.js.snap +18 -18
- package/src/__Tests__/index.js +2 -2
- package/src/_variables.scss +11 -11
- package/src/index.js +33 -33
- package/src/normalizers.js +42 -32
- package/src/selectors.js +3 -3
- package/src/styles.scss +7 -7
- package/src/useStandardFormInput.js +118 -118
- package/src/utils/index.js +3 -3
- package/src/utils/objectContainsNonSerializableProperty.js +15 -15
- package/src/utils/objectContainsNonSerializableProperty.test.js +49 -49
- package/src/utils/objectToFormData.js +89 -89
- package/src/utils/objectToFormData.test.js +76 -76
- package/src/utils/typeChecks.js +18 -18
- package/src/validators/index.js +2 -2
- package/src/validators/validators.js +93 -93
- package/src/validators/validators.test.js +79 -79
- package/CHANGELOG.json +0 -95
- package/CHANGELOG.md +0 -58
@@ -1,79 +1,79 @@
|
|
1
|
-
import { integer, length, maxLength, maxValue, minValue } from './validators';
|
2
|
-
|
3
|
-
describe('integer validator', () => {
|
4
|
-
it('accepts an integer', () => {
|
5
|
-
const returned = integer(123);
|
6
|
-
expect(returned).toBe(undefined);
|
7
|
-
});
|
8
|
-
|
9
|
-
it("doesn't accept a float", () => {
|
10
|
-
const returned = integer(123.5569);
|
11
|
-
expect(returned).toBe('Must be a whole number');
|
12
|
-
});
|
13
|
-
});
|
14
|
-
|
15
|
-
describe('length validator', () => {
|
16
|
-
it('fails for invalid Length', () => {
|
17
|
-
const length10 = length(10);
|
18
|
-
const tooLong = length10('01234567890');
|
19
|
-
const tooShort = length10('aaa');
|
20
|
-
expect(tooLong).toBe('Length must be 10');
|
21
|
-
expect(tooShort).toBe('Length must be 10');
|
22
|
-
});
|
23
|
-
|
24
|
-
it('succeeds for correct length', () => {
|
25
|
-
const length10 = length(10);
|
26
|
-
const validString = length10('0123456789');
|
27
|
-
const validNumber = length10(1234567890);
|
28
|
-
expect(validString).toBe(undefined);
|
29
|
-
expect(validNumber).toBe(undefined);
|
30
|
-
});
|
31
|
-
});
|
32
|
-
|
33
|
-
describe('maxValue validator', () => {
|
34
|
-
it('fails for invalid value', () => {
|
35
|
-
const maxValue10 = maxValue(10);
|
36
|
-
const tooBig = maxValue10(11);
|
37
|
-
expect(tooBig).toBe('Maximum value 10 exceeded');
|
38
|
-
});
|
39
|
-
|
40
|
-
it('succeeds for valid value', () => {
|
41
|
-
const maxValue10 = maxValue(10);
|
42
|
-
const maxAllowable = maxValue10(10);
|
43
|
-
const lowAllowable = maxValue10(1);
|
44
|
-
expect(maxAllowable).toBe(undefined);
|
45
|
-
expect(lowAllowable).toBe(undefined);
|
46
|
-
});
|
47
|
-
});
|
48
|
-
|
49
|
-
describe('minValue validator', () => {
|
50
|
-
it('fails for invalid value', () => {
|
51
|
-
const minValue10 = minValue(10);
|
52
|
-
const tooSmall = minValue10(9);
|
53
|
-
expect(tooSmall).toBe('Minimum value 10 not met');
|
54
|
-
});
|
55
|
-
|
56
|
-
it('succeeds for valid value', () => {
|
57
|
-
const minValue10 = minValue(10);
|
58
|
-
const minAllowable = minValue10(10);
|
59
|
-
const highAllowable = minValue10(15);
|
60
|
-
expect(minAllowable).toBe(undefined);
|
61
|
-
expect(highAllowable).toBe(undefined);
|
62
|
-
});
|
63
|
-
});
|
64
|
-
|
65
|
-
describe('maxLength validator', () => {
|
66
|
-
it('fails for invalid value', () => {
|
67
|
-
const maxLength10 = maxLength(10);
|
68
|
-
const tooLong = maxLength10('012345678910');
|
69
|
-
expect(tooLong).toBe('Maximum length 10 exceeded');
|
70
|
-
});
|
71
|
-
|
72
|
-
it('succeeds for valid value', () => {
|
73
|
-
const maxLength10 = maxLength(10);
|
74
|
-
const exactMatch = maxLength10('0123456789');
|
75
|
-
const shortValid = maxLength10('0123');
|
76
|
-
expect(exactMatch).toBe(undefined);
|
77
|
-
expect(shortValid).toBe(undefined);
|
78
|
-
});
|
79
|
-
});
|
1
|
+
import { integer, length, maxLength, maxValue, minValue } from './validators';
|
2
|
+
|
3
|
+
describe('integer validator', () => {
|
4
|
+
it('accepts an integer', () => {
|
5
|
+
const returned = integer(123);
|
6
|
+
expect(returned).toBe(undefined);
|
7
|
+
});
|
8
|
+
|
9
|
+
it("doesn't accept a float", () => {
|
10
|
+
const returned = integer(123.5569);
|
11
|
+
expect(returned).toBe('Must be a whole number');
|
12
|
+
});
|
13
|
+
});
|
14
|
+
|
15
|
+
describe('length validator', () => {
|
16
|
+
it('fails for invalid Length', () => {
|
17
|
+
const length10 = length(10);
|
18
|
+
const tooLong = length10('01234567890');
|
19
|
+
const tooShort = length10('aaa');
|
20
|
+
expect(tooLong).toBe('Length must be 10');
|
21
|
+
expect(tooShort).toBe('Length must be 10');
|
22
|
+
});
|
23
|
+
|
24
|
+
it('succeeds for correct length', () => {
|
25
|
+
const length10 = length(10);
|
26
|
+
const validString = length10('0123456789');
|
27
|
+
const validNumber = length10(1234567890);
|
28
|
+
expect(validString).toBe(undefined);
|
29
|
+
expect(validNumber).toBe(undefined);
|
30
|
+
});
|
31
|
+
});
|
32
|
+
|
33
|
+
describe('maxValue validator', () => {
|
34
|
+
it('fails for invalid value', () => {
|
35
|
+
const maxValue10 = maxValue(10);
|
36
|
+
const tooBig = maxValue10(11);
|
37
|
+
expect(tooBig).toBe('Maximum value 10 exceeded');
|
38
|
+
});
|
39
|
+
|
40
|
+
it('succeeds for valid value', () => {
|
41
|
+
const maxValue10 = maxValue(10);
|
42
|
+
const maxAllowable = maxValue10(10);
|
43
|
+
const lowAllowable = maxValue10(1);
|
44
|
+
expect(maxAllowable).toBe(undefined);
|
45
|
+
expect(lowAllowable).toBe(undefined);
|
46
|
+
});
|
47
|
+
});
|
48
|
+
|
49
|
+
describe('minValue validator', () => {
|
50
|
+
it('fails for invalid value', () => {
|
51
|
+
const minValue10 = minValue(10);
|
52
|
+
const tooSmall = minValue10(9);
|
53
|
+
expect(tooSmall).toBe('Minimum value 10 not met');
|
54
|
+
});
|
55
|
+
|
56
|
+
it('succeeds for valid value', () => {
|
57
|
+
const minValue10 = minValue(10);
|
58
|
+
const minAllowable = minValue10(10);
|
59
|
+
const highAllowable = minValue10(15);
|
60
|
+
expect(minAllowable).toBe(undefined);
|
61
|
+
expect(highAllowable).toBe(undefined);
|
62
|
+
});
|
63
|
+
});
|
64
|
+
|
65
|
+
describe('maxLength validator', () => {
|
66
|
+
it('fails for invalid value', () => {
|
67
|
+
const maxLength10 = maxLength(10);
|
68
|
+
const tooLong = maxLength10('012345678910');
|
69
|
+
expect(tooLong).toBe('Maximum length 10 exceeded');
|
70
|
+
});
|
71
|
+
|
72
|
+
it('succeeds for valid value', () => {
|
73
|
+
const maxLength10 = maxLength(10);
|
74
|
+
const exactMatch = maxLength10('0123456789');
|
75
|
+
const shortValid = maxLength10('0123');
|
76
|
+
expect(exactMatch).toBe(undefined);
|
77
|
+
expect(shortValid).toBe(undefined);
|
78
|
+
});
|
79
|
+
});
|
package/CHANGELOG.json
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "envoc-form",
|
3
|
-
"entries": [
|
4
|
-
{
|
5
|
-
"version": "2.0.0",
|
6
|
-
"tag": "envoc-form_v2.0.0",
|
7
|
-
"date": "Fri, 11 Sep 2020 16:49:17 GMT",
|
8
|
-
"comments": {}
|
9
|
-
},
|
10
|
-
{
|
11
|
-
"version": "1.3.1",
|
12
|
-
"tag": "envoc-form_v1.3.1",
|
13
|
-
"date": "Fri, 04 Sep 2020 19:35:20 GMT",
|
14
|
-
"comments": {}
|
15
|
-
},
|
16
|
-
{
|
17
|
-
"version": "1.3.0",
|
18
|
-
"tag": "envoc-form_v1.3.0",
|
19
|
-
"date": "Tue, 01 Sep 2020 16:02:23 GMT",
|
20
|
-
"comments": {}
|
21
|
-
},
|
22
|
-
{
|
23
|
-
"version": "1.2.0",
|
24
|
-
"tag": "envoc-form_v1.2.0",
|
25
|
-
"date": "Mon, 31 Aug 2020 20:33:06 GMT",
|
26
|
-
"comments": {
|
27
|
-
"none": [
|
28
|
-
{
|
29
|
-
"comment": "readme change"
|
30
|
-
},
|
31
|
-
{
|
32
|
-
"comment": "Resolves issues with scss not being included, provides support for tree-shaking, adds jest testing"
|
33
|
-
},
|
34
|
-
{
|
35
|
-
"comment": " Prerelease"
|
36
|
-
},
|
37
|
-
{
|
38
|
-
"comment": "Fixes missing destructed prop on ConfirmBaseForm and adds some tests"
|
39
|
-
},
|
40
|
-
{
|
41
|
-
"comment": "build script changes"
|
42
|
-
},
|
43
|
-
{
|
44
|
-
"comment": "Fix issues with validators export"
|
45
|
-
},
|
46
|
-
{
|
47
|
-
"comment": "fixes normalizers"
|
48
|
-
}
|
49
|
-
]
|
50
|
-
}
|
51
|
-
},
|
52
|
-
{
|
53
|
-
"version": "1.1.26",
|
54
|
-
"tag": "envoc-form_v1.1.26",
|
55
|
-
"date": "Mon, 13 Jul 2020 16:17:47 GMT",
|
56
|
-
"comments": {}
|
57
|
-
},
|
58
|
-
{
|
59
|
-
"version": "1.1.25",
|
60
|
-
"tag": "envoc-form_v1.1.25",
|
61
|
-
"date": "Fri, 10 Jul 2020 19:16:12 GMT",
|
62
|
-
"comments": {
|
63
|
-
"none": [
|
64
|
-
{
|
65
|
-
"comment": "Changing the 'sideEffects' to be false for better tree shaking"
|
66
|
-
}
|
67
|
-
]
|
68
|
-
}
|
69
|
-
},
|
70
|
-
{
|
71
|
-
"version": "1.1.24",
|
72
|
-
"tag": "envoc-form_v1.1.24",
|
73
|
-
"date": "Fri, 10 Jul 2020 18:58:53 GMT",
|
74
|
-
"comments": {
|
75
|
-
"none": [
|
76
|
-
{
|
77
|
-
"comment": "Resolves issues with scss not being included, provides support for tree-shaking, adds jest testing"
|
78
|
-
}
|
79
|
-
]
|
80
|
-
}
|
81
|
-
},
|
82
|
-
{
|
83
|
-
"version": "1.1.23",
|
84
|
-
"tag": "envoc-form_v1.1.23",
|
85
|
-
"date": "Thu, 25 Jun 2020 19:05:11 GMT",
|
86
|
-
"comments": {
|
87
|
-
"none": [
|
88
|
-
{
|
89
|
-
"comment": "Initial envoc-form implementation"
|
90
|
-
}
|
91
|
-
]
|
92
|
-
}
|
93
|
-
}
|
94
|
-
]
|
95
|
-
}
|
package/CHANGELOG.md
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# Change Log - envoc-form
|
2
|
-
|
3
|
-
This log was last generated on Fri, 11 Sep 2020 16:49:17 GMT and should not be manually modified.
|
4
|
-
|
5
|
-
## 2.0.0
|
6
|
-
Fri, 11 Sep 2020 16:49:17 GMT
|
7
|
-
|
8
|
-
*Version update only*
|
9
|
-
|
10
|
-
## 1.3.1
|
11
|
-
Fri, 04 Sep 2020 19:35:20 GMT
|
12
|
-
|
13
|
-
*Version update only*
|
14
|
-
|
15
|
-
## 1.3.0
|
16
|
-
Tue, 01 Sep 2020 16:02:23 GMT
|
17
|
-
|
18
|
-
*Version update only*
|
19
|
-
|
20
|
-
## 1.2.0
|
21
|
-
Mon, 31 Aug 2020 20:33:06 GMT
|
22
|
-
|
23
|
-
### Updates
|
24
|
-
|
25
|
-
- readme change
|
26
|
-
- Resolves issues with scss not being included, provides support for tree-shaking, adds jest testing
|
27
|
-
- Prerelease
|
28
|
-
- Fixes missing destructed prop on ConfirmBaseForm and adds some tests
|
29
|
-
- build script changes
|
30
|
-
- Fix issues with validators export
|
31
|
-
- fixes normalizers
|
32
|
-
|
33
|
-
## 1.1.26
|
34
|
-
Mon, 13 Jul 2020 16:17:47 GMT
|
35
|
-
|
36
|
-
*Version update only*
|
37
|
-
|
38
|
-
## 1.1.25
|
39
|
-
Fri, 10 Jul 2020 19:16:12 GMT
|
40
|
-
|
41
|
-
### Updates
|
42
|
-
|
43
|
-
- Changing the 'sideEffects' to be false for better tree shaking
|
44
|
-
|
45
|
-
## 1.1.24
|
46
|
-
Fri, 10 Jul 2020 18:58:53 GMT
|
47
|
-
|
48
|
-
### Updates
|
49
|
-
|
50
|
-
- Resolves issues with scss not being included, provides support for tree-shaking, adds jest testing
|
51
|
-
|
52
|
-
## 1.1.23
|
53
|
-
Thu, 25 Jun 2020 19:05:11 GMT
|
54
|
-
|
55
|
-
### Updates
|
56
|
-
|
57
|
-
- Initial envoc-form implementation
|
58
|
-
|