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
@@ -1,43 +1,43 @@
|
|
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 InputGroup from './InputGroup';
|
27
|
-
import { FormDefaults } from '../FormDefaults';
|
28
|
-
function NumberInputGroup(_a, ref) {
|
29
|
-
var parseFunc = _a.parseFunc, className = _a.className, rest = __rest(_a, ["parseFunc", "className"]);
|
30
|
-
var effectiveParse = parseFunc !== null && parseFunc !== void 0 ? parseFunc : parseFloat;
|
31
|
-
var input = rest.input;
|
32
|
-
return (_jsx(InputGroup, __assign({ ref: ref }, rest, { type: "number", className: classNames(className, FormDefaults.cssClassPrefix + 'number-group'), value: input.value || '', onChange: function (e) {
|
33
|
-
if (!e.target.value) {
|
34
|
-
input.onChange(undefined);
|
35
|
-
}
|
36
|
-
else {
|
37
|
-
input.onChange(effectiveParse(e.target.value));
|
38
|
-
}
|
39
|
-
} })));
|
40
|
-
}
|
41
|
-
/** Standard number input group. By default allows for float values. */
|
42
|
-
var NumberInputGroupWithRef = React.forwardRef(NumberInputGroup);
|
43
|
-
export default NumberInputGroupWithRef;
|
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 InputGroup from './InputGroup';
|
27
|
+
import { FormDefaults } from '../FormDefaults';
|
28
|
+
function NumberInputGroup(_a, ref) {
|
29
|
+
var parseFunc = _a.parseFunc, className = _a.className, rest = __rest(_a, ["parseFunc", "className"]);
|
30
|
+
var effectiveParse = parseFunc !== null && parseFunc !== void 0 ? parseFunc : parseFloat;
|
31
|
+
var input = rest.input;
|
32
|
+
return (_jsx(InputGroup, __assign({ ref: ref }, rest, { type: "number", className: classNames(className, FormDefaults.cssClassPrefix + 'number-group'), value: input.value || '', onChange: function (e) {
|
33
|
+
if (!e.target.value) {
|
34
|
+
input.onChange(undefined);
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
input.onChange(effectiveParse(e.target.value));
|
38
|
+
}
|
39
|
+
} })));
|
40
|
+
}
|
41
|
+
/** Standard number input group. By default allows for float values. */
|
42
|
+
var NumberInputGroupWithRef = React.forwardRef(NumberInputGroup);
|
43
|
+
export default NumberInputGroupWithRef;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { InputGroupProps } from './InputGroup';
|
3
|
+
export interface PhoneNumberInputGroupProps extends Omit<InputGroupProps<string | undefined | null>, 'onChange' | 'type' | 'value'> {
|
4
|
+
}
|
5
|
+
/**A standard phone number input. Will display to the user in `+XXX XXX-XXX-XXXX` format as the number is being inputted.
|
6
|
+
* The data will get sent in the same format as displayed. Uses `normalizers.phoneNumber`.
|
7
|
+
* @default autoComplete="tel-national"
|
8
|
+
*/
|
9
|
+
declare const PhoneNumberInputGroupWithRef: React.ComponentType<PhoneNumberInputGroupProps>;
|
10
|
+
export default PhoneNumberInputGroupWithRef;
|
@@ -0,0 +1,47 @@
|
|
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 InputGroup from './InputGroup';
|
27
|
+
import { FormDefaults } from '../FormDefaults';
|
28
|
+
import { phoneNumber } from '../Normalization/normalizers';
|
29
|
+
function PhoneNumberInputGroup(_a, ref) {
|
30
|
+
var _b;
|
31
|
+
var className = _a.className, rest = __rest(_a, ["className"]);
|
32
|
+
var input = rest.input;
|
33
|
+
return (_jsx(InputGroup, __assign({ ref: ref, autoComplete: "tel-national" }, rest, { type: "text", className: classNames(className, FormDefaults.cssClassPrefix + 'phone-number-group'), value: (_b = input.value) !== null && _b !== void 0 ? _b : '', onChange: function (e) {
|
34
|
+
if (!e.target.value) {
|
35
|
+
input.onChange(undefined);
|
36
|
+
}
|
37
|
+
else {
|
38
|
+
input.onChange(phoneNumber(e.target.value));
|
39
|
+
}
|
40
|
+
} })));
|
41
|
+
}
|
42
|
+
/**A standard phone number input. Will display to the user in `+XXX XXX-XXX-XXXX` format as the number is being inputted.
|
43
|
+
* The data will get sent in the same format as displayed. Uses `normalizers.phoneNumber`.
|
44
|
+
* @default autoComplete="tel-national"
|
45
|
+
*/
|
46
|
+
var PhoneNumberInputGroupWithRef = React.forwardRef(PhoneNumberInputGroup);
|
47
|
+
export default PhoneNumberInputGroupWithRef;
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { InputGroupProps } from './InputGroup';
|
3
|
-
export interface StringInputGroupProps extends Omit<InputGroupProps<string | undefined | null>, 'onChange' | 'type' | 'value'> {
|
4
|
-
type?: 'color' | 'email' | 'search' | 'tel' | 'text' | 'url' | 'password' | 'textarea';
|
5
|
-
}
|
6
|
-
/** Standard string input group. */
|
7
|
-
declare const StringInputGroupWithRef: React.ComponentType<StringInputGroupProps>;
|
8
|
-
export default StringInputGroupWithRef;
|
1
|
+
import React from 'react';
|
2
|
+
import { InputGroupProps } from './InputGroup';
|
3
|
+
export interface StringInputGroupProps extends Omit<InputGroupProps<string | undefined | null>, 'onChange' | 'type' | 'value'> {
|
4
|
+
type?: 'color' | 'email' | 'search' | 'tel' | 'text' | 'url' | 'password' | 'textarea';
|
5
|
+
}
|
6
|
+
/** Standard string input group. */
|
7
|
+
declare const StringInputGroupWithRef: React.ComponentType<StringInputGroupProps>;
|
8
|
+
export default StringInputGroupWithRef;
|
@@ -1,43 +1,43 @@
|
|
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 InputGroup from './InputGroup';
|
27
|
-
import { FormDefaults } from '../FormDefaults';
|
28
|
-
function StringInputGroup(_a, ref) {
|
29
|
-
var _b;
|
30
|
-
var className = _a.className, rest = __rest(_a, ["className"]);
|
31
|
-
var input = rest.input;
|
32
|
-
return (_jsx(InputGroup, __assign({ ref: ref }, rest, { className: classNames(className, FormDefaults.cssClassPrefix + 'string-group'), value: (_b = input.value) !== null && _b !== void 0 ? _b : '', onChange: function (e) {
|
33
|
-
if (!e.target.value) {
|
34
|
-
input.onChange(undefined);
|
35
|
-
}
|
36
|
-
else {
|
37
|
-
input.onChange(e.target.value);
|
38
|
-
}
|
39
|
-
} })));
|
40
|
-
}
|
41
|
-
/** Standard string input group. */
|
42
|
-
var StringInputGroupWithRef = React.forwardRef(StringInputGroup);
|
43
|
-
export default StringInputGroupWithRef;
|
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 InputGroup from './InputGroup';
|
27
|
+
import { FormDefaults } from '../FormDefaults';
|
28
|
+
function StringInputGroup(_a, ref) {
|
29
|
+
var _b;
|
30
|
+
var className = _a.className, rest = __rest(_a, ["className"]);
|
31
|
+
var input = rest.input;
|
32
|
+
return (_jsx(InputGroup, __assign({ ref: ref }, rest, { className: classNames(className, FormDefaults.cssClassPrefix + 'string-group'), value: (_b = input.value) !== null && _b !== void 0 ? _b : '', onChange: function (e) {
|
33
|
+
if (!e.target.value) {
|
34
|
+
input.onChange(undefined);
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
input.onChange(e.target.value);
|
38
|
+
}
|
39
|
+
} })));
|
40
|
+
}
|
41
|
+
/** Standard string input group. */
|
42
|
+
var StringInputGroupWithRef = React.forwardRef(StringInputGroup);
|
43
|
+
export default StringInputGroupWithRef;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/** Normalization of values */
|
2
|
-
export interface NormalizationFunction<TValue> {
|
3
|
-
(value: TValue): TValue;
|
4
|
-
}
|
1
|
+
/** Normalization of values */
|
2
|
+
export interface NormalizationFunction<TValue> {
|
3
|
+
(value: TValue): TValue;
|
4
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/** Normalizer for converting a string into a valid phone number. */
|
2
|
-
export declare const phoneNumber: (value: string | undefined | null) => string | undefined;
|
3
|
-
/** Normalizer for converting a string into a valid zip code. Allows for XXXXX and XXXXX-XXXX format. */
|
4
|
-
export declare const zipCode: (value: string | undefined | null) => string | undefined;
|
1
|
+
/** Normalizer for converting a string into a valid phone number. */
|
2
|
+
export declare const phoneNumber: (value: string | undefined | null) => string | undefined;
|
3
|
+
/** Normalizer for converting a string into a valid zip code. Allows for XXXXX and XXXXX-XXXX format. */
|
4
|
+
export declare const zipCode: (value: string | undefined | null) => string | undefined;
|
@@ -1,32 +1,32 @@
|
|
1
|
-
/** Normalizer for converting a string into a valid phone number. */
|
2
|
-
export var phoneNumber = function (value) {
|
3
|
-
if (!value) {
|
4
|
-
return undefined;
|
5
|
-
}
|
6
|
-
var onlyNums = value.replace(/[^\d]/g, '');
|
7
|
-
if (onlyNums.length <= 3) {
|
8
|
-
return onlyNums;
|
9
|
-
}
|
10
|
-
if (onlyNums.length <= 7) {
|
11
|
-
return "".concat(onlyNums.slice(0, 3), "-").concat(onlyNums.slice(3));
|
12
|
-
}
|
13
|
-
if (onlyNums.length <= 10) {
|
14
|
-
return "".concat(onlyNums.slice(0, 3), "-").concat(onlyNums.slice(3, 6), "-").concat(onlyNums.slice(6, 10));
|
15
|
-
}
|
16
|
-
if (onlyNums.length <= 13) {
|
17
|
-
var countryCodeLength = onlyNums.length - 10;
|
18
|
-
return "+".concat(onlyNums.slice(0, countryCodeLength), " ").concat(onlyNums.slice(countryCodeLength, 3 + countryCodeLength), "-").concat(onlyNums.slice(3 + countryCodeLength, 6 + countryCodeLength), "-").concat(onlyNums.slice(6 + countryCodeLength, onlyNums.length));
|
19
|
-
}
|
20
|
-
return onlyNums;
|
21
|
-
};
|
22
|
-
/** Normalizer for converting a string into a valid zip code. Allows for XXXXX and XXXXX-XXXX format. */
|
23
|
-
export var zipCode = function (value) {
|
24
|
-
if (!value) {
|
25
|
-
return undefined;
|
26
|
-
}
|
27
|
-
var onlyNums = value.replace(/[^\d]/g, '');
|
28
|
-
if (onlyNums.length > 5) {
|
29
|
-
return onlyNums.substring(0, 5) + '-' + onlyNums.substring(5, 9);
|
30
|
-
}
|
31
|
-
return onlyNums;
|
32
|
-
};
|
1
|
+
/** Normalizer for converting a string into a valid phone number. */
|
2
|
+
export var phoneNumber = function (value) {
|
3
|
+
if (!value) {
|
4
|
+
return undefined;
|
5
|
+
}
|
6
|
+
var onlyNums = value.replace(/[^\d]/g, '');
|
7
|
+
if (onlyNums.length <= 3) {
|
8
|
+
return onlyNums;
|
9
|
+
}
|
10
|
+
if (onlyNums.length <= 7) {
|
11
|
+
return "".concat(onlyNums.slice(0, 3), "-").concat(onlyNums.slice(3));
|
12
|
+
}
|
13
|
+
if (onlyNums.length <= 10) {
|
14
|
+
return "".concat(onlyNums.slice(0, 3), "-").concat(onlyNums.slice(3, 6), "-").concat(onlyNums.slice(6, 10));
|
15
|
+
}
|
16
|
+
if (onlyNums.length <= 13) {
|
17
|
+
var countryCodeLength = onlyNums.length - 10;
|
18
|
+
return "+".concat(onlyNums.slice(0, countryCodeLength), " ").concat(onlyNums.slice(countryCodeLength, 3 + countryCodeLength), "-").concat(onlyNums.slice(3 + countryCodeLength, 6 + countryCodeLength), "-").concat(onlyNums.slice(6 + countryCodeLength, onlyNums.length));
|
19
|
+
}
|
20
|
+
return onlyNums;
|
21
|
+
};
|
22
|
+
/** Normalizer for converting a string into a valid zip code. Allows for XXXXX and XXXXX-XXXX format. */
|
23
|
+
export var zipCode = function (value) {
|
24
|
+
if (!value) {
|
25
|
+
return undefined;
|
26
|
+
}
|
27
|
+
var onlyNums = value.replace(/[^\d]/g, '');
|
28
|
+
if (onlyNums.length > 5) {
|
29
|
+
return onlyNums.substring(0, 5) + '-' + onlyNums.substring(5, 9);
|
30
|
+
}
|
31
|
+
return onlyNums;
|
32
|
+
};
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
export declare function BooleanSelectGroup(props: BooleanSelectGroupProps): JSX.Element;
|
1
|
+
import { SelectOption } from './SelectGroup';
|
2
|
+
import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
|
3
|
+
export interface BooleanSelectGroupProps extends Omit<SelectGroupPropsHelper<boolean | undefined | null>, 'options'> {
|
4
|
+
options?: SelectOption<boolean>[];
|
5
|
+
}
|
6
|
+
/** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
|
7
|
+
export declare function BooleanSelectGroup(props: BooleanSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
@@ -1,28 +1,28 @@
|
|
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
|
-
var booleanOptions = [
|
15
|
-
{
|
16
|
-
label: 'Yes',
|
17
|
-
value: true,
|
18
|
-
},
|
19
|
-
{
|
20
|
-
label: 'No',
|
21
|
-
value: false,
|
22
|
-
},
|
23
|
-
];
|
24
|
-
/** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
|
25
|
-
export function BooleanSelectGroup(props) {
|
26
|
-
var _a;
|
27
|
-
return (_jsx(SelectGroup, __assign({ multiple: false }, props, { options: (_a = props.options) !== null && _a !== void 0 ? _a : booleanOptions })));
|
28
|
-
}
|
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
|
+
var booleanOptions = [
|
15
|
+
{
|
16
|
+
label: 'Yes',
|
17
|
+
value: true,
|
18
|
+
},
|
19
|
+
{
|
20
|
+
label: 'No',
|
21
|
+
value: false,
|
22
|
+
},
|
23
|
+
];
|
24
|
+
/** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
|
25
|
+
export function BooleanSelectGroup(props) {
|
26
|
+
var _a;
|
27
|
+
return (_jsx(SelectGroup, __assign({ multiple: false }, props, { options: (_a = props.options) !== null && _a !== void 0 ? _a : booleanOptions })));
|
28
|
+
}
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
export
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
export declare function SingleNumberSelectGroup(props: SingleNumberSelectGroupProps): JSX.Element;
|
1
|
+
import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
|
2
|
+
export interface MultiNumberSelectGroupProps extends SelectGroupPropsHelper<number[] | undefined | null> {
|
3
|
+
}
|
4
|
+
/** A `<SelectGroup/>` dropdown with values as numbers. Many options can be selected at a time. */
|
5
|
+
export declare function MultiNumberSelectGroup(props: MultiNumberSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
6
|
+
export interface SingleNumberSelectGroupProps extends SelectGroupPropsHelper<number | undefined | null> {
|
7
|
+
}
|
8
|
+
/** A `<SelectGroup/>` dropdown with values as numbers. Only one option can be selected at a time. */
|
9
|
+
export declare function SingleNumberSelectGroup(props: SingleNumberSelectGroupProps): 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 numbers. Many options can be selected at a time. */
|
15
|
-
export function MultiNumberSelectGroup(props) {
|
16
|
-
return _jsx(SelectGroup, __assign({ multiple: true }, props));
|
17
|
-
}
|
18
|
-
/** A `<SelectGroup/>` dropdown with values as numbers. Only one option can be selected at a time. */
|
19
|
-
export function SingleNumberSelectGroup(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 numbers. Many options can be selected at a time. */
|
15
|
+
export function MultiNumberSelectGroup(props) {
|
16
|
+
return _jsx(SelectGroup, __assign({ multiple: true }, props));
|
17
|
+
}
|
18
|
+
/** A `<SelectGroup/>` dropdown with values as numbers. Only one option can be selected at a time. */
|
19
|
+
export function SingleNumberSelectGroup(props) {
|
20
|
+
return _jsx(SelectGroup, __assign({ multiple: false }, props));
|
21
|
+
}
|
@@ -1,28 +1,27 @@
|
|
1
|
-
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
export
|
28
|
-
export {};
|
1
|
+
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
2
|
+
import { GroupProps } from '../Group';
|
3
|
+
export interface SelectOption<TValue> {
|
4
|
+
/** Value for the select. This will be sent to the API. */
|
5
|
+
value: (TValue extends Array<infer P> ? P : TValue) | undefined;
|
6
|
+
/** Label for the select. This is displayed to the user. */
|
7
|
+
label: string;
|
8
|
+
}
|
9
|
+
interface OptionsApiResult<TValue> {
|
10
|
+
result?: Partial<SelectOption<TValue>>[];
|
11
|
+
}
|
12
|
+
interface OptionsUseServiceResult<TValue> {
|
13
|
+
loading?: boolean;
|
14
|
+
resp?: Partial<SelectOption<TValue>>[] | OptionsApiResult<TValue> | null;
|
15
|
+
error?: any;
|
16
|
+
}
|
17
|
+
export interface SelectGroupProps<TValue> extends InjectedFieldProps<TValue | undefined | null>, Omit<GroupProps, 'input' | 'meta' | 'children'> {
|
18
|
+
/** Options for the dropdown. Includes the label and value. */
|
19
|
+
options: SelectOption<TValue>[] | OptionsUseServiceResult<TValue>;
|
20
|
+
/** Whether the user should be able to have multiple values selected. */
|
21
|
+
multiple: TValue extends Array<any> ? true : false;
|
22
|
+
/** Text diplayed when no value is selected. */
|
23
|
+
placeholder?: string;
|
24
|
+
}
|
25
|
+
/** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
|
26
|
+
export default function SelectGroup<TValue>({ input, meta, className, required, disabled, options, multiple, placeholder, ...rest }: SelectGroupProps<TValue>): import("react/jsx-runtime").JSX.Element;
|
27
|
+
export {};
|