envoc-form 4.1.0 → 5.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/README.md +367 -176
- package/es/AddressInput/AddressInput.d.ts +24 -25
- package/es/AddressInput/AddressInput.js +20 -31
- package/es/AddressInput/UsStates.d.ts +3 -3
- package/es/AddressInput/UsStates.js +53 -53
- package/es/ConfirmBaseForm/ConfirmBaseForm.d.ts +26 -26
- package/es/ConfirmBaseForm/ConfirmBaseForm.js +42 -42
- package/es/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +24 -24
- package/es/ConfirmDeleteForm/ConfirmDeleteForm.js +60 -60
- package/es/DatePicker/DatePickerGroup.d.ts +13 -14
- package/es/DatePicker/DatePickerGroup.js +87 -87
- package/es/DatePicker/DatePickerHelper.d.ts +3 -3
- package/es/DatePicker/DatePickerHelper.js +1 -1
- package/es/DatePicker/StringDateOnlyPickerGroup.d.ts +9 -10
- package/es/DatePicker/StringDateOnlyPickerGroup.js +29 -29
- package/es/DatePicker/StringDatePickerGroup.d.ts +9 -10
- package/es/DatePicker/StringDatePickerGroup.js +24 -24
- package/es/Field/CustomFieldInputProps.d.ts +7 -7
- package/es/Field/CustomFieldInputProps.js +1 -1
- package/es/Field/CustomFieldMetaProps.d.ts +4 -4
- package/es/Field/CustomFieldMetaProps.js +1 -1
- package/es/Field/Field.d.ts +28 -28
- package/es/Field/Field.js +51 -51
- package/es/Field/FieldErrorScrollTarget.d.ts +2 -3
- package/es/Field/FieldErrorScrollTarget.js +12 -12
- package/es/Field/FieldNameContext.d.ts +3 -3
- package/es/Field/FieldNameContext.js +3 -3
- package/es/Field/FieldSection.d.ts +7 -7
- package/es/Field/FieldSection.js +9 -20
- package/es/Field/InjectedFieldProps.d.ts +7 -7
- package/es/Field/InjectedFieldProps.js +1 -1
- package/es/Field/StandAloneInput.d.ts +13 -13
- package/es/Field/StandAloneInput.js +50 -50
- package/es/Field/useStandardField.d.ts +21 -21
- package/es/Field/useStandardField.js +92 -92
- package/es/FieldArray/FieldArray.d.ts +24 -24
- package/es/FieldArray/FieldArray.js +77 -88
- package/es/File/FileGroup.d.ts +10 -10
- package/es/File/FileGroup.js +53 -53
- package/es/File/FileList.d.ts +5 -6
- package/es/File/FileList.js +10 -21
- package/es/File/humanFileSize.d.ts +1 -1
- package/es/File/humanFileSize.js +6 -6
- package/es/Form/FocusError.d.ts +7 -7
- package/es/Form/FocusError.js +42 -42
- package/es/Form/Form.d.ts +33 -33
- package/es/Form/Form.js +141 -141
- package/es/Form/FormBasedPreventNavigation.d.ts +6 -7
- package/es/Form/FormBasedPreventNavigation.js +20 -20
- package/es/Form/LegacyFormBasedPreventNavigation.d.ts +17 -17
- package/es/Form/LegacyFormBasedPreventNavigation.js +69 -69
- package/es/Form/NewFormBasedPreventNavigation.d.ts +14 -14
- package/es/Form/NewFormBasedPreventNavigation.js +39 -39
- package/es/Form/ServerErrorContext.d.ts +11 -11
- package/es/Form/ServerErrorContext.js +9 -9
- package/es/FormActions.d.ts +12 -13
- package/es/FormActions.js +16 -27
- package/es/FormDefaults.d.ts +4 -4
- package/es/FormDefaults.js +2 -2
- package/es/Group.d.ts +16 -16
- package/es/Group.js +14 -25
- package/es/Input/IconInputGroup.d.ts +12 -12
- package/es/Input/IconInputGroup.js +43 -43
- package/es/Input/InputGroup.d.ts +12 -12
- package/es/Input/InputGroup.js +34 -34
- package/es/Input/MoneyInputGroup.d.ts +9 -9
- package/es/Input/MoneyInputGroup.js +43 -43
- package/es/Input/NumberInputGroup.d.ts +9 -9
- package/es/Input/NumberInputGroup.js +43 -43
- package/es/Input/PhoneNumberInputGroup.d.ts +10 -0
- package/es/Input/PhoneNumberInputGroup.js +47 -0
- package/es/Input/StringInputGroup.d.ts +8 -8
- package/es/Input/StringInputGroup.js +43 -43
- package/es/Normalization/NormalizationFunction.d.ts +4 -4
- package/es/Normalization/NormalizationFunction.js +1 -1
- package/es/Normalization/normalizers.d.ts +4 -4
- package/es/Normalization/normalizers.js +32 -32
- package/es/Select/BooleanSelectGroup.d.ts +7 -8
- package/es/Select/BooleanSelectGroup.js +28 -28
- package/es/Select/NumberSelectGroup.d.ts +9 -10
- package/es/Select/NumberSelectGroup.js +21 -21
- package/es/Select/SelectGroup.d.ts +27 -28
- package/es/Select/SelectGroup.js +65 -65
- package/es/Select/SelectGroupPropsHelper.d.ts +3 -3
- package/es/Select/SelectGroupPropsHelper.js +1 -1
- package/es/Select/StringSelectGroup.d.ts +9 -10
- package/es/Select/StringSelectGroup.js +21 -21
- package/es/StandardFormActions.d.ts +11 -11
- package/es/StandardFormActions.js +14 -25
- package/es/SubmitFormButton.d.ts +10 -10
- package/es/SubmitFormButton.js +40 -40
- package/es/TextArea/TextAreaGroup.d.ts +9 -9
- package/es/TextArea/TextAreaGroup.js +35 -35
- package/es/Validation/ValidatedApiResult.d.ts +6 -6
- package/es/Validation/ValidatedApiResult.js +1 -1
- package/es/Validation/ValidationError.d.ts +5 -5
- package/es/Validation/ValidationError.js +1 -1
- package/es/Validation/ValidationFunction.d.ts +4 -4
- package/es/Validation/ValidationFunction.js +1 -1
- package/es/Validation/validators.d.ts +18 -18
- package/es/Validation/validators.js +77 -77
- package/es/index.d.ts +75 -73
- package/es/index.js +51 -50
- package/es/setupTests.d.ts +1 -1
- package/es/setupTests.js +1 -1
- package/es/utils/objectContainsNonSerializableProperty.d.ts +1 -1
- package/es/utils/objectContainsNonSerializableProperty.js +14 -14
- package/es/utils/objectToFormData.d.ts +10 -10
- package/es/utils/objectToFormData.js +77 -77
- package/es/utils/typeChecks.d.ts +8 -8
- package/es/utils/typeChecks.js +18 -18
- package/lib/AddressInput/AddressInput.d.ts +24 -25
- package/lib/AddressInput/AddressInput.js +26 -37
- package/lib/AddressInput/UsStates.d.ts +3 -3
- package/lib/AddressInput/UsStates.js +55 -55
- package/lib/ConfirmBaseForm/ConfirmBaseForm.d.ts +26 -26
- package/lib/ConfirmBaseForm/ConfirmBaseForm.js +48 -48
- package/lib/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +24 -24
- package/lib/ConfirmDeleteForm/ConfirmDeleteForm.js +66 -66
- package/lib/DatePicker/DatePickerGroup.d.ts +13 -14
- package/lib/DatePicker/DatePickerGroup.js +95 -95
- package/lib/DatePicker/DatePickerHelper.d.ts +3 -3
- package/lib/DatePicker/DatePickerHelper.js +2 -2
- package/lib/DatePicker/StringDateOnlyPickerGroup.d.ts +9 -10
- package/lib/DatePicker/StringDateOnlyPickerGroup.js +35 -35
- package/lib/DatePicker/StringDatePickerGroup.d.ts +9 -10
- package/lib/DatePicker/StringDatePickerGroup.js +30 -30
- package/lib/Field/CustomFieldInputProps.d.ts +7 -7
- package/lib/Field/CustomFieldInputProps.js +2 -2
- package/lib/Field/CustomFieldMetaProps.d.ts +4 -4
- package/lib/Field/CustomFieldMetaProps.js +2 -2
- package/lib/Field/Field.d.ts +28 -28
- package/lib/Field/Field.js +56 -56
- package/lib/Field/FieldErrorScrollTarget.d.ts +2 -3
- package/lib/Field/FieldErrorScrollTarget.js +15 -15
- package/lib/Field/FieldNameContext.d.ts +3 -3
- package/lib/Field/FieldNameContext.js +9 -9
- package/lib/Field/FieldSection.d.ts +7 -7
- package/lib/Field/FieldSection.js +12 -23
- package/lib/Field/InjectedFieldProps.d.ts +7 -7
- package/lib/Field/InjectedFieldProps.js +2 -2
- package/lib/Field/StandAloneInput.d.ts +13 -13
- package/lib/Field/StandAloneInput.js +76 -76
- package/lib/Field/useStandardField.d.ts +21 -21
- package/lib/Field/useStandardField.js +95 -95
- package/lib/FieldArray/FieldArray.d.ts +24 -24
- package/lib/FieldArray/FieldArray.js +83 -94
- package/lib/File/FileGroup.d.ts +10 -10
- package/lib/File/FileGroup.js +58 -58
- package/lib/File/FileList.d.ts +5 -6
- package/lib/File/FileList.js +13 -24
- package/lib/File/humanFileSize.d.ts +1 -1
- package/lib/File/humanFileSize.js +10 -10
- package/lib/Form/FocusError.d.ts +7 -7
- package/lib/Form/FocusError.js +48 -48
- package/lib/Form/Form.d.ts +33 -33
- package/lib/Form/Form.js +147 -147
- package/lib/Form/FormBasedPreventNavigation.d.ts +6 -7
- package/lib/Form/FormBasedPreventNavigation.js +26 -26
- package/lib/Form/LegacyFormBasedPreventNavigation.d.ts +17 -17
- package/lib/Form/LegacyFormBasedPreventNavigation.js +72 -72
- package/lib/Form/NewFormBasedPreventNavigation.d.ts +14 -14
- package/lib/Form/NewFormBasedPreventNavigation.js +42 -42
- package/lib/Form/ServerErrorContext.d.ts +11 -11
- package/lib/Form/ServerErrorContext.js +15 -15
- package/lib/FormActions.d.ts +12 -13
- package/lib/FormActions.js +22 -33
- package/lib/FormDefaults.d.ts +4 -4
- package/lib/FormDefaults.js +5 -5
- package/lib/Group.d.ts +16 -16
- package/lib/Group.js +20 -31
- package/lib/Input/IconInputGroup.d.ts +12 -12
- package/lib/Input/IconInputGroup.js +48 -48
- package/lib/Input/InputGroup.d.ts +12 -12
- package/lib/Input/InputGroup.js +39 -39
- package/lib/Input/MoneyInputGroup.d.ts +9 -9
- package/lib/Input/MoneyInputGroup.js +48 -48
- package/lib/Input/NumberInputGroup.d.ts +9 -9
- package/lib/Input/NumberInputGroup.js +48 -48
- package/lib/Input/PhoneNumberInputGroup.d.ts +10 -0
- package/lib/Input/PhoneNumberInputGroup.js +52 -0
- package/lib/Input/StringInputGroup.d.ts +8 -8
- package/lib/Input/StringInputGroup.js +48 -48
- package/lib/Normalization/NormalizationFunction.d.ts +4 -4
- package/lib/Normalization/NormalizationFunction.js +2 -2
- package/lib/Normalization/normalizers.d.ts +4 -4
- package/lib/Normalization/normalizers.js +37 -37
- package/lib/Select/BooleanSelectGroup.d.ts +7 -8
- package/lib/Select/BooleanSelectGroup.js +35 -35
- package/lib/Select/NumberSelectGroup.d.ts +9 -10
- package/lib/Select/NumberSelectGroup.js +29 -29
- package/lib/Select/SelectGroup.d.ts +27 -28
- package/lib/Select/SelectGroup.js +71 -71
- package/lib/Select/SelectGroupPropsHelper.d.ts +3 -3
- package/lib/Select/SelectGroupPropsHelper.js +2 -2
- package/lib/Select/StringSelectGroup.d.ts +9 -10
- package/lib/Select/StringSelectGroup.js +29 -29
- package/lib/StandardFormActions.d.ts +11 -11
- package/lib/StandardFormActions.js +20 -31
- package/lib/SubmitFormButton.d.ts +10 -10
- package/lib/SubmitFormButton.js +45 -45
- package/lib/TextArea/TextAreaGroup.d.ts +9 -9
- package/lib/TextArea/TextAreaGroup.js +40 -40
- package/lib/Validation/ValidatedApiResult.d.ts +6 -6
- package/lib/Validation/ValidatedApiResult.js +2 -2
- package/lib/Validation/ValidationError.d.ts +5 -5
- package/lib/Validation/ValidationError.js +2 -2
- package/lib/Validation/ValidationFunction.d.ts +4 -4
- package/lib/Validation/ValidationFunction.js +2 -2
- package/lib/Validation/validators.d.ts +18 -18
- package/lib/Validation/validators.js +90 -90
- package/lib/index.d.ts +75 -73
- package/lib/index.js +119 -117
- package/lib/setupTests.d.ts +1 -1
- package/lib/setupTests.js +3 -3
- package/lib/utils/objectContainsNonSerializableProperty.d.ts +1 -1
- package/lib/utils/objectContainsNonSerializableProperty.js +17 -17
- package/lib/utils/objectToFormData.d.ts +10 -10
- package/lib/utils/objectToFormData.js +79 -79
- package/lib/utils/typeChecks.d.ts +8 -8
- package/lib/utils/typeChecks.js +29 -29
- package/package.json +12 -12
- package/src/AddressInput/__snapshots__/AddressInput.test.tsx.snap +6 -8
- package/src/Input/PhoneNumberInputGroup.tsx +45 -0
- package/src/Input/__Tests__/PhoneNumberInputGroup.test.tsx +36 -0
- package/src/Input/__Tests__/__snapshots__/PhoneNumberInputGroup.test.tsx.snap +33 -0
- package/src/Select/__tests__/__snapshots__/BooleanSelectGroup.test.tsx.snap +6 -8
- package/src/Select/__tests__/__snapshots__/NumberSelectGroup.test.tsx.snap +12 -16
- package/src/Select/__tests__/__snapshots__/StringSelectGroup.test.tsx.snap +12 -16
- package/src/index.ts +3 -0
- package/src/utils/objectToFormData.test.tsx +1 -1
package/es/Select/SelectGroup.js
CHANGED
@@ -1,65 +1,65 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
-
import { default as ReactSelect } from 'react-select';
|
25
|
-
import classNames from 'classnames';
|
26
|
-
import { FormDefaults } from '../FormDefaults';
|
27
|
-
import Group from '../Group';
|
28
|
-
// TODO: we could also name this "ReactSelectGroup" or similar but the types are strongly defined now so kept the names consistent
|
29
|
-
/** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
|
30
|
-
export default function SelectGroup(_a) {
|
31
|
-
var _b;
|
32
|
-
var input = _a.input, meta = _a.meta, className = _a.className, required = _a.required, disabled = _a.disabled, options = _a.options, multiple = _a.multiple, placeholder = _a.placeholder, rest = __rest(_a, ["input", "meta", "className", "required", "disabled", "options", "multiple", "placeholder"]);
|
33
|
-
var effectiveOptions = !options
|
34
|
-
? []
|
35
|
-
: Array.isArray(options)
|
36
|
-
? options
|
37
|
-
: 'resp' in options &&
|
38
|
-
!!options.resp &&
|
39
|
-
'result' in options.resp &&
|
40
|
-
!!options.resp.result
|
41
|
-
? options.resp.result
|
42
|
-
: 'resp' in options && !!options.resp && Array.isArray(options.resp)
|
43
|
-
? options.resp
|
44
|
-
: [];
|
45
|
-
var isLoading = (options && 'loading' in options && options.loading) || false;
|
46
|
-
return (_jsx(Group, __assign({}, rest, { input: input, meta: meta, required: required, disabled: disabled, className: classNames(className, (_b = {},
|
47
|
-
_b[FormDefaults.cssClassPrefix + 'multiple'] = multiple,
|
48
|
-
_b[FormDefaults.cssClassPrefix + 'loading'] = isLoading,
|
49
|
-
_b), FormDefaults.cssClassPrefix + 'select-group')
|
50
|
-
if (multiple === true) {
|
51
|
-
input.onChange(e === null || e === void 0 ? void 0 : e.map(function (x) { return x.value; }));
|
52
|
-
}
|
53
|
-
else {
|
54
|
-
input.onChange(e === null || e === void 0 ? void 0 : e.value);
|
55
|
-
}
|
56
|
-
}, getOptionLabel: function (option) { var _a; return (_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : ''; }, className: classNames(className, FormDefaults.cssClassPrefix + 'select-group'), classNamePrefix: "react-select", menuPortalTarget: document.body, menuPlacement: "auto", placeholder: placeholder }) })));
|
57
|
-
function getValue() {
|
58
|
-
if (multiple) {
|
59
|
-
return effectiveOptions.filter(function (o) {
|
60
|
-
return Array.isArray(input.value) && !!input.value.find(function (x) { return o.value === x; });
|
61
|
-
});
|
62
|
-
}
|
63
|
-
return effectiveOptions.find(function (o) { return o.value === input.value; });
|
64
|
-
}
|
65
|
-
}
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
+
var t = {};
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
+
t[p] = s[p];
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
+
t[p[i]] = s[p[i]];
|
20
|
+
}
|
21
|
+
return t;
|
22
|
+
};
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
+
import { default as ReactSelect } from 'react-select';
|
25
|
+
import classNames from 'classnames';
|
26
|
+
import { FormDefaults } from '../FormDefaults';
|
27
|
+
import Group from '../Group';
|
28
|
+
// TODO: we could also name this "ReactSelectGroup" or similar but the types are strongly defined now so kept the names consistent
|
29
|
+
/** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
|
30
|
+
export default function SelectGroup(_a) {
|
31
|
+
var _b;
|
32
|
+
var input = _a.input, meta = _a.meta, className = _a.className, required = _a.required, disabled = _a.disabled, options = _a.options, multiple = _a.multiple, placeholder = _a.placeholder, rest = __rest(_a, ["input", "meta", "className", "required", "disabled", "options", "multiple", "placeholder"]);
|
33
|
+
var effectiveOptions = !options
|
34
|
+
? []
|
35
|
+
: Array.isArray(options)
|
36
|
+
? options
|
37
|
+
: 'resp' in options &&
|
38
|
+
!!options.resp &&
|
39
|
+
'result' in options.resp &&
|
40
|
+
!!options.resp.result
|
41
|
+
? options.resp.result
|
42
|
+
: 'resp' in options && !!options.resp && Array.isArray(options.resp)
|
43
|
+
? options.resp
|
44
|
+
: [];
|
45
|
+
var isLoading = (options && 'loading' in options && options.loading) || false;
|
46
|
+
return (_jsx(Group, __assign({}, rest, { input: input, meta: meta, required: required, disabled: disabled, className: classNames(className, (_b = {},
|
47
|
+
_b[FormDefaults.cssClassPrefix + 'multiple'] = multiple,
|
48
|
+
_b[FormDefaults.cssClassPrefix + 'loading'] = isLoading,
|
49
|
+
_b), FormDefaults.cssClassPrefix + 'select-group'), children: _jsx(ReactSelect, { inputId: input.id, isMulti: multiple, isDisabled: disabled, options: effectiveOptions, onBlur: input.onBlur, value: getValue(), onChange: function (e) {
|
50
|
+
if (multiple === true) {
|
51
|
+
input.onChange(e === null || e === void 0 ? void 0 : e.map(function (x) { return x.value; }));
|
52
|
+
}
|
53
|
+
else {
|
54
|
+
input.onChange(e === null || e === void 0 ? void 0 : e.value);
|
55
|
+
}
|
56
|
+
}, getOptionLabel: function (option) { var _a; return (_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : ''; }, className: classNames(className, FormDefaults.cssClassPrefix + 'select-group'), classNamePrefix: "react-select", menuPortalTarget: document.body, menuPlacement: "auto", placeholder: placeholder }) })));
|
57
|
+
function getValue() {
|
58
|
+
if (multiple) {
|
59
|
+
return effectiveOptions.filter(function (o) {
|
60
|
+
return Array.isArray(input.value) && !!input.value.find(function (x) { return o.value === x; });
|
61
|
+
});
|
62
|
+
}
|
63
|
+
return effectiveOptions.find(function (o) { return o.value === input.value; });
|
64
|
+
}
|
65
|
+
}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { SelectGroupProps } from './SelectGroup';
|
2
|
-
export interface SelectGroupPropsHelper<T> extends Omit<SelectGroupProps<T>, 'multiple'> {
|
3
|
-
}
|
1
|
+
import { SelectGroupProps } from './SelectGroup';
|
2
|
+
export interface SelectGroupPropsHelper<T> extends Omit<SelectGroupProps<T>, 'multiple'> {
|
3
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
export
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
export declare function SingleStringSelectGroup(props: SingleStringSelectGroupProps): JSX.Element;
|
1
|
+
import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
|
2
|
+
export interface MultiStringSelectGroupProps extends SelectGroupPropsHelper<string[]> {
|
3
|
+
}
|
4
|
+
/** A `<SelectGroup/>` dropdown with values as strings. Multiple options can be selected at a time. */
|
5
|
+
export declare function MultiStringSelectGroup(props: MultiStringSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
6
|
+
export interface SingleStringSelectGroupProps extends SelectGroupPropsHelper<string> {
|
7
|
+
}
|
8
|
+
/** A `<SelectGroup/>` dropdown with the value as a string. Only one option can be selected at a time. */
|
9
|
+
export declare function SingleStringSelectGroup(props: SingleStringSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
@@ -1,21 +1,21 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
-
import SelectGroup from './SelectGroup';
|
14
|
-
/** A `<SelectGroup/>` dropdown with values as strings. Multiple options can be selected at a time. */
|
15
|
-
export function MultiStringSelectGroup(props) {
|
16
|
-
return _jsx(SelectGroup, __assign({ multiple: true }, props));
|
17
|
-
}
|
18
|
-
/** A `<SelectGroup/>` dropdown with the value as a string. Only one option can be selected at a time. */
|
19
|
-
export function SingleStringSelectGroup(props) {
|
20
|
-
return _jsx(SelectGroup, __assign({ multiple: false }, props));
|
21
|
-
}
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
13
|
+
import SelectGroup from './SelectGroup';
|
14
|
+
/** A `<SelectGroup/>` dropdown with values as strings. Multiple options can be selected at a time. */
|
15
|
+
export function MultiStringSelectGroup(props) {
|
16
|
+
return _jsx(SelectGroup, __assign({ multiple: true }, props));
|
17
|
+
}
|
18
|
+
/** A `<SelectGroup/>` dropdown with the value as a string. Only one option can be selected at a time. */
|
19
|
+
export function SingleStringSelectGroup(props) {
|
20
|
+
return _jsx(SelectGroup, __assign({ multiple: false }, props));
|
21
|
+
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import { MouseEventHandler } from 'react';
|
2
|
-
export interface StandardFormActionsProps {
|
3
|
-
/** Allow the form to be submitted without any changes. By default this is not allowed. */
|
4
|
-
allowPristineSubmit?: boolean;
|
5
|
-
/** The cancel button's `onClick`.
|
6
|
-
* @defaultValue `window.history.back()`
|
7
|
-
*/
|
8
|
-
handleCancel?: MouseEventHandler<HTMLButtonElement>;
|
9
|
-
}
|
10
|
-
/** Standard submit and cancel buttons. */
|
11
|
-
export default function StandardFormActions({ allowPristineSubmit, handleCancel, }: StandardFormActionsProps): JSX.Element;
|
1
|
+
import { MouseEventHandler } from 'react';
|
2
|
+
export interface StandardFormActionsProps {
|
3
|
+
/** Allow the form to be submitted without any changes. By default this is not allowed. */
|
4
|
+
allowPristineSubmit?: boolean;
|
5
|
+
/** The cancel button's `onClick`.
|
6
|
+
* @defaultValue `window.history.back()`
|
7
|
+
*/
|
8
|
+
handleCancel?: MouseEventHandler<HTMLButtonElement>;
|
9
|
+
}
|
10
|
+
/** Standard submit and cancel buttons. */
|
11
|
+
export default function StandardFormActions({ allowPristineSubmit, handleCancel, }: StandardFormActionsProps): import("react/jsx-runtime").JSX.Element;
|
@@ -1,25 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
return
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
import SubmitFormButton from './SubmitFormButton';
|
16
|
-
import { FormDefaults } from './FormDefaults';
|
17
|
-
/** Standard submit and cancel buttons. */
|
18
|
-
export default function StandardFormActions(_a) {
|
19
|
-
var allowPristineSubmit = _a.allowPristineSubmit, handleCancel = _a.handleCancel;
|
20
|
-
var isSubmitting = useFormikContext().isSubmitting;
|
21
|
-
return (_jsxs(_Fragment, { children: [_jsx(SubmitFormButton, { allowPristineSubmit: allowPristineSubmit }), "\u00A0", _jsx("button", __assign({ className: classNames(FormDefaults.cssClassPrefix + 'standard-form-actions-cancel-button'), type: "button", disabled: isSubmitting, onClick: handleCancel || goBack }, { children: "Cancel" }))] }));
|
22
|
-
function goBack() {
|
23
|
-
window.history.back();
|
24
|
-
}
|
25
|
-
}
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import classNames from 'classnames';
|
3
|
+
import { useFormikContext } from 'formik';
|
4
|
+
import SubmitFormButton from './SubmitFormButton';
|
5
|
+
import { FormDefaults } from './FormDefaults';
|
6
|
+
/** Standard submit and cancel buttons. */
|
7
|
+
export default function StandardFormActions(_a) {
|
8
|
+
var allowPristineSubmit = _a.allowPristineSubmit, handleCancel = _a.handleCancel;
|
9
|
+
var isSubmitting = useFormikContext().isSubmitting;
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsx(SubmitFormButton, { allowPristineSubmit: allowPristineSubmit }), "\u00A0", _jsx("button", { className: classNames(FormDefaults.cssClassPrefix + 'standard-form-actions-cancel-button'), type: "button", disabled: isSubmitting, onClick: handleCancel || goBack, children: "Cancel" })] }));
|
11
|
+
function goBack() {
|
12
|
+
window.history.back();
|
13
|
+
}
|
14
|
+
}
|
package/es/SubmitFormButton.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
export interface SubmitFormButtonProps extends Omit<React.HTMLProps<HTMLButtonElement>, 'type'> {
|
3
|
-
/** Allow the form to be submitted without any changes. By default this is not allowed. */
|
4
|
-
allowPristineSubmit?: boolean;
|
5
|
-
/** Text to display on the button. Default text is 'Submit'. */
|
6
|
-
children?: React.ReactNode;
|
7
|
-
}
|
8
|
-
|
9
|
-
|
10
|
-
export default _default;
|
1
|
+
import React from 'react';
|
2
|
+
export interface SubmitFormButtonProps extends Omit<React.HTMLProps<HTMLButtonElement>, 'type'> {
|
3
|
+
/** Allow the form to be submitted without any changes. By default this is not allowed. */
|
4
|
+
allowPristineSubmit?: boolean;
|
5
|
+
/** Text to display on the button. Default text is 'Submit'. */
|
6
|
+
children?: React.ReactNode;
|
7
|
+
}
|
8
|
+
/** Generic submit button for forms. */
|
9
|
+
declare const _default: React.FunctionComponent<SubmitFormButtonProps>;
|
10
|
+
export default _default;
|
package/es/SubmitFormButton.js
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
-
import React from 'react';
|
25
|
-
import classNames from 'classnames';
|
26
|
-
import { useFormikContext } from 'formik';
|
27
|
-
import { FormDefaults } from './FormDefaults';
|
28
|
-
function SubmitFormButton(_a, ref) {
|
29
|
-
var allowPristineSubmit = _a.allowPristineSubmit, children = _a.children, disabled = _a.disabled, title = _a.title, className = _a.className, props = __rest(_a, ["allowPristineSubmit", "children", "disabled", "title", "className"]);
|
30
|
-
var _b = useFormikContext(), isSubmitting = _b.isSubmitting, dirty = _b.dirty;
|
31
|
-
var preventSubmit = (!dirty && !allowPristineSubmit) || isSubmitting;
|
32
|
-
var buttonName = typeof children === 'string' ? children : 'Submit';
|
33
|
-
return (_jsx("button", __assign({}, props, { ref: ref, type: "submit", disabled: preventSubmit || disabled, "aria-label": buttonName, title: title || isSubmitting
|
34
|
-
? 'Loading, please wait...'
|
35
|
-
: preventSubmit
|
36
|
-
? "You haven't made any changes"
|
37
|
-
: '', className: classNames(FormDefaults.cssClassPrefix + 'submit-form-button', className)
|
38
|
-
}
|
39
|
-
/** Generic submit button for forms. */
|
40
|
-
export default React.forwardRef(SubmitFormButton);
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
+
var t = {};
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
+
t[p] = s[p];
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
+
t[p[i]] = s[p[i]];
|
20
|
+
}
|
21
|
+
return t;
|
22
|
+
};
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
24
|
+
import React from 'react';
|
25
|
+
import classNames from 'classnames';
|
26
|
+
import { useFormikContext } from 'formik';
|
27
|
+
import { FormDefaults } from './FormDefaults';
|
28
|
+
function SubmitFormButton(_a, ref) {
|
29
|
+
var allowPristineSubmit = _a.allowPristineSubmit, children = _a.children, disabled = _a.disabled, title = _a.title, className = _a.className, props = __rest(_a, ["allowPristineSubmit", "children", "disabled", "title", "className"]);
|
30
|
+
var _b = useFormikContext(), isSubmitting = _b.isSubmitting, dirty = _b.dirty;
|
31
|
+
var preventSubmit = (!dirty && !allowPristineSubmit) || isSubmitting;
|
32
|
+
var buttonName = typeof children === 'string' ? children : 'Submit';
|
33
|
+
return (_jsx("button", __assign({}, props, { ref: ref, type: "submit", disabled: preventSubmit || disabled, "aria-label": buttonName, title: title || isSubmitting
|
34
|
+
? 'Loading, please wait...'
|
35
|
+
: preventSubmit
|
36
|
+
? "You haven't made any changes"
|
37
|
+
: '', className: classNames(FormDefaults.cssClassPrefix + 'submit-form-button', className), children: children || 'Submit' })));
|
38
|
+
}
|
39
|
+
/** Generic submit button for forms. */
|
40
|
+
export default React.forwardRef(SubmitFormButton);
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
3
|
-
import { GroupProps } from '../Group';
|
4
|
-
export interface TextAreaGroupProps extends InjectedFieldProps<string | undefined | null>, Omit<React.HTMLProps<HTMLTextAreaElement>, keyof InjectedFieldProps<any> | 'children' | 'className' | 'label'>, Omit<GroupProps, keyof InjectedFieldProps<any> | 'children'> {
|
5
|
-
icon?: React.ReactNode;
|
6
|
-
}
|
7
|
-
/** Generic controlled `<textarea/>` wrapped by a `<Group/>` */
|
8
|
-
declare const TextAreaGroupWithRef: React.ComponentType<TextAreaGroupProps>;
|
9
|
-
export default TextAreaGroupWithRef;
|
1
|
+
import React from 'react';
|
2
|
+
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
3
|
+
import { GroupProps } from '../Group';
|
4
|
+
export interface TextAreaGroupProps extends InjectedFieldProps<string | undefined | null>, Omit<React.HTMLProps<HTMLTextAreaElement>, keyof InjectedFieldProps<any> | 'children' | 'className' | 'label'>, Omit<GroupProps, keyof InjectedFieldProps<any> | 'children'> {
|
5
|
+
icon?: React.ReactNode;
|
6
|
+
}
|
7
|
+
/** Generic controlled `<textarea/>` wrapped by a `<Group/>` */
|
8
|
+
declare const TextAreaGroupWithRef: React.ComponentType<TextAreaGroupProps>;
|
9
|
+
export default TextAreaGroupWithRef;
|
@@ -1,35 +1,35 @@
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
2
|
-
__assign = Object.assign || function(t) {
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
-
s = arguments[i];
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
-
t[p] = s[p];
|
7
|
-
}
|
8
|
-
return t;
|
9
|
-
};
|
10
|
-
return __assign.apply(this, arguments);
|
11
|
-
};
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
-
var t = {};
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
-
t[p] = s[p];
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
-
t[p[i]] = s[p[i]];
|
20
|
-
}
|
21
|
-
return t;
|
22
|
-
};
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
|
-
import React from 'react';
|
25
|
-
import classNames from 'classnames';
|
26
|
-
import { FormDefaults } from '../FormDefaults';
|
27
|
-
import Group from '../Group';
|
28
|
-
function TextAreaGroup(_a, ref) {
|
29
|
-
var _b;
|
30
|
-
var input = _a.input, meta = _a.meta, label = _a.label, helpText = _a.helpText, className = _a.className, required = _a.required, disabled = _a.disabled, icon = _a.icon, rest = __rest(_a, ["input", "meta", "label", "helpText", "className", "required", "disabled", "icon"]);
|
31
|
-
return (_jsxs(Group,
|
32
|
-
}
|
33
|
-
/** Generic controlled `<textarea/>` wrapped by a `<Group/>` */
|
34
|
-
var TextAreaGroupWithRef = React.forwardRef(TextAreaGroup);
|
35
|
-
export default TextAreaGroupWithRef;
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
2
|
+
__assign = Object.assign || function(t) {
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4
|
+
s = arguments[i];
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
6
|
+
t[p] = s[p];
|
7
|
+
}
|
8
|
+
return t;
|
9
|
+
};
|
10
|
+
return __assign.apply(this, arguments);
|
11
|
+
};
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
13
|
+
var t = {};
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
15
|
+
t[p] = s[p];
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
19
|
+
t[p[i]] = s[p[i]];
|
20
|
+
}
|
21
|
+
return t;
|
22
|
+
};
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
24
|
+
import React from 'react';
|
25
|
+
import classNames from 'classnames';
|
26
|
+
import { FormDefaults } from '../FormDefaults';
|
27
|
+
import Group from '../Group';
|
28
|
+
function TextAreaGroup(_a, ref) {
|
29
|
+
var _b;
|
30
|
+
var input = _a.input, meta = _a.meta, label = _a.label, helpText = _a.helpText, className = _a.className, required = _a.required, disabled = _a.disabled, icon = _a.icon, rest = __rest(_a, ["input", "meta", "label", "helpText", "className", "required", "disabled", "icon"]);
|
31
|
+
return (_jsxs(Group, { input: input, meta: meta, required: required, disabled: disabled, label: label, helpText: helpText, className: classNames(className, FormDefaults.cssClassPrefix + 'text-area-group'), children: [icon, _jsx("textarea", __assign({}, input, rest, { value: (_b = input.value) !== null && _b !== void 0 ? _b : '', onChange: function (val) { return input.onChange(val.target.value); }, ref: ref, className: classNames(className, FormDefaults.cssClassPrefix + 'text-area-group') }))] }));
|
32
|
+
}
|
33
|
+
/** Generic controlled `<textarea/>` wrapped by a `<Group/>` */
|
34
|
+
var TextAreaGroupWithRef = React.forwardRef(TextAreaGroup);
|
35
|
+
export default TextAreaGroupWithRef;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { ValidationError } from './ValidationError';
|
2
|
-
/** The root result from a typical envoc API call when forms are returned */
|
3
|
-
export interface ValidatedApiResult {
|
4
|
-
validationFailures?: ValidationError[];
|
5
|
-
hasErrors?: boolean;
|
6
|
-
}
|
1
|
+
import { ValidationError } from './ValidationError';
|
2
|
+
/** The root result from a typical envoc API call when forms are returned */
|
3
|
+
export interface ValidatedApiResult {
|
4
|
+
validationFailures?: ValidationError[];
|
5
|
+
hasErrors?: boolean;
|
6
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,5 +1,5 @@
|
|
1
|
-
/** Represents a server side validation failure - only 'standard' for envoc */
|
2
|
-
export interface ValidationError {
|
3
|
-
propertyName?: string;
|
4
|
-
errorMessage?: string;
|
5
|
-
}
|
1
|
+
/** Represents a server side validation failure - only 'standard' for envoc */
|
2
|
+
export interface ValidationError {
|
3
|
+
propertyName?: string;
|
4
|
+
errorMessage?: string;
|
5
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/** Client side validation function */
|
2
|
-
export interface ValidationFunction<TValue> {
|
3
|
-
(value: TValue): string | undefined;
|
4
|
-
}
|
1
|
+
/** Client side validation function */
|
2
|
+
export interface ValidationFunction<TValue> {
|
3
|
+
(value: TValue): string | undefined;
|
4
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import { ValidationFunction } from './ValidationFunction';
|
2
|
-
export declare const required: (value: any) => "Required" | undefined;
|
3
|
-
/** Asserts that the value is a certain number of characters. numbers are coerced to a string */
|
4
|
-
export declare const length: (len: number) => (value: string | number | undefined | null) => string | undefined;
|
5
|
-
export declare const integer: (val: string | number | undefined | null) => "Must be a whole number" | undefined;
|
6
|
-
export declare const maxLength: (len: number) => (value: string | number | undefined | null) => string | undefined;
|
7
|
-
export declare const maxCount: (count: number) => (value: {
|
8
|
-
isDeleted?: boolean;
|
9
|
-
}[] | undefined | null) => string | undefined;
|
10
|
-
export declare const minCount: (count: number) => (value: {
|
11
|
-
isDeleted?: boolean;
|
12
|
-
}[] | undefined | null) => string | undefined;
|
13
|
-
export declare const maxValue: (max: number) => (value: number | undefined | null) => string | undefined;
|
14
|
-
export declare const minValue: (min: number) => (value: number | undefined | null) => string | undefined;
|
15
|
-
/** Validate for a ZIP Code. Accepts formats: ##### and #####-#### */
|
16
|
-
export declare const zipCode: (value: string | undefined | null) => "Invalid ZIP Code" | undefined;
|
17
|
-
/** One of the validators provided must be true. */
|
18
|
-
export declare const any: <TValue>(validatorList: ValidationFunction<TValue>[]) => (value: TValue) => string | undefined;
|
1
|
+
import { ValidationFunction } from './ValidationFunction';
|
2
|
+
export declare const required: (value: any) => "Required" | undefined;
|
3
|
+
/** Asserts that the value is a certain number of characters. numbers are coerced to a string */
|
4
|
+
export declare const length: (len: number) => (value: string | number | undefined | null) => string | undefined;
|
5
|
+
export declare const integer: (val: string | number | undefined | null) => "Must be a whole number" | undefined;
|
6
|
+
export declare const maxLength: (len: number) => (value: string | number | undefined | null) => string | undefined;
|
7
|
+
export declare const maxCount: (count: number) => (value: {
|
8
|
+
isDeleted?: boolean;
|
9
|
+
}[] | undefined | null) => string | undefined;
|
10
|
+
export declare const minCount: (count: number) => (value: {
|
11
|
+
isDeleted?: boolean;
|
12
|
+
}[] | undefined | null) => string | undefined;
|
13
|
+
export declare const maxValue: (max: number) => (value: number | undefined | null) => string | undefined;
|
14
|
+
export declare const minValue: (min: number) => (value: number | undefined | null) => string | undefined;
|
15
|
+
/** Validate for a ZIP Code. Accepts formats: ##### and #####-#### */
|
16
|
+
export declare const zipCode: (value: string | undefined | null) => "Invalid ZIP Code" | undefined;
|
17
|
+
/** One of the validators provided must be true. */
|
18
|
+
export declare const any: <TValue>(validatorList: ValidationFunction<TValue>[]) => (value: TValue) => string | undefined;
|