envoc-form 4.0.1-11 → 4.0.1-12
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 +5117 -12
- package/es/AddressInput/AddressInput.d.ts +10 -0
- package/es/AddressInput/AddressInput.js +10 -0
- package/es/ConfirmBaseForm/ConfirmBaseForm.d.ts +14 -0
- package/es/ConfirmBaseForm/ConfirmBaseForm.js +6 -0
- package/es/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +13 -0
- package/es/ConfirmDeleteForm/ConfirmDeleteForm.js +5 -0
- package/es/DatePicker/DatePickerGroup.d.ts +5 -0
- package/es/DatePicker/DatePickerGroup.js +5 -0
- package/es/DatePicker/StringDateOnlyPickerGroup.d.ts +5 -0
- package/es/DatePicker/StringDateOnlyPickerGroup.js +5 -0
- package/es/DatePicker/StringDatePickerGroup.d.ts +5 -0
- package/es/DatePicker/StringDatePickerGroup.js +5 -0
- package/es/Field/Field.d.ts +6 -0
- package/es/Field/FieldErrorScrollTarget.d.ts +1 -0
- package/es/Field/FieldErrorScrollTarget.js +1 -0
- package/es/Field/StandAloneInput.d.ts +4 -0
- package/es/Field/StandAloneInput.js +1 -0
- package/es/Field/useStandardField.d.ts +6 -0
- package/es/Field/useStandardField.js +8 -9
- package/es/FieldArray/FieldArray.d.ts +9 -0
- package/es/FieldArray/FieldArray.js +5 -0
- package/es/File/FileGroup.d.ts +2 -0
- package/es/File/FileGroup.js +1 -0
- package/es/Form/FocusError.d.ts +2 -0
- package/es/Form/FocusError.js +1 -0
- package/es/Form/Form.d.ts +6 -0
- package/es/Form/Form.js +1 -0
- package/es/Form/FormBasedPreventNavigation.d.ts +3 -1
- package/es/Form/FormBasedPreventNavigation.js +12 -62
- package/es/Form/LegacyFormBasedPreventNavigation.d.ts +17 -0
- package/es/Form/LegacyFormBasedPreventNavigation.js +69 -0
- package/es/Form/NewFormBasedPreventNavigation.d.ts +14 -0
- package/es/Form/NewFormBasedPreventNavigation.js +39 -0
- package/es/Form/ServerErrorContext.d.ts +1 -0
- package/es/Form/ServerErrorContext.js +1 -0
- package/es/FormActions.d.ts +6 -0
- package/es/FormActions.js +1 -0
- package/es/FormDefaults.d.ts +1 -0
- package/es/FormDefaults.js +1 -0
- package/es/Group.d.ts +5 -3
- package/es/Group.js +2 -2
- package/es/Input/IconInputGroup.d.ts +3 -0
- package/es/Input/IconInputGroup.js +1 -0
- package/es/Input/InputGroup.d.ts +1 -1
- package/es/Input/InputGroup.js +2 -2
- package/es/Input/MoneyInputGroup.d.ts +2 -0
- package/es/Input/MoneyInputGroup.js +1 -0
- package/es/Input/NumberInputGroup.d.ts +2 -0
- package/es/Input/NumberInputGroup.js +1 -0
- package/es/Input/StringInputGroup.d.ts +1 -0
- package/es/Input/StringInputGroup.js +1 -0
- package/es/Normalization/normalizers.d.ts +2 -0
- package/es/Normalization/normalizers.js +2 -0
- package/es/Select/BooleanSelectGroup.d.ts +1 -0
- package/es/Select/BooleanSelectGroup.js +1 -0
- package/es/Select/NumberSelectGroup.d.ts +2 -0
- package/es/Select/NumberSelectGroup.js +2 -0
- package/es/Select/SelectGroup.d.ts +6 -0
- package/es/Select/SelectGroup.js +1 -0
- package/es/Select/StringSelectGroup.d.ts +2 -0
- package/es/Select/StringSelectGroup.js +2 -0
- package/es/StandardFormActions.d.ts +5 -0
- package/es/StandardFormActions.js +1 -0
- package/es/SubmitFormButton.d.ts +3 -0
- package/es/SubmitFormButton.js +1 -0
- package/es/TextArea/TextAreaGroup.d.ts +1 -0
- package/es/TextArea/TextAreaGroup.js +1 -1
- package/es/Validation/validators.d.ts +3 -0
- package/es/Validation/validators.js +3 -2
- package/es/setupTests.d.ts +1 -0
- package/es/setupTests.js +1 -0
- package/lib/AddressInput/AddressInput.d.ts +10 -0
- package/lib/AddressInput/AddressInput.js +10 -0
- package/lib/ConfirmBaseForm/ConfirmBaseForm.d.ts +14 -0
- package/lib/ConfirmBaseForm/ConfirmBaseForm.js +6 -0
- package/lib/ConfirmDeleteForm/ConfirmDeleteForm.d.ts +13 -0
- package/lib/ConfirmDeleteForm/ConfirmDeleteForm.js +5 -0
- package/lib/DatePicker/DatePickerGroup.d.ts +5 -0
- package/lib/DatePicker/DatePickerGroup.js +5 -0
- package/lib/DatePicker/StringDateOnlyPickerGroup.d.ts +5 -0
- package/lib/DatePicker/StringDateOnlyPickerGroup.js +5 -0
- package/lib/DatePicker/StringDatePickerGroup.d.ts +5 -0
- package/lib/DatePicker/StringDatePickerGroup.js +5 -0
- package/lib/Field/Field.d.ts +6 -0
- package/lib/Field/FieldErrorScrollTarget.d.ts +1 -0
- package/lib/Field/FieldErrorScrollTarget.js +1 -0
- package/lib/Field/StandAloneInput.d.ts +4 -0
- package/lib/Field/StandAloneInput.js +1 -0
- package/lib/Field/useStandardField.d.ts +6 -0
- package/lib/Field/useStandardField.js +8 -9
- package/lib/FieldArray/FieldArray.d.ts +9 -0
- package/lib/FieldArray/FieldArray.js +5 -0
- package/lib/File/FileGroup.d.ts +2 -0
- package/lib/File/FileGroup.js +1 -0
- package/lib/Form/FocusError.d.ts +2 -0
- package/lib/Form/FocusError.js +1 -0
- package/lib/Form/Form.d.ts +6 -0
- package/lib/Form/Form.js +1 -0
- package/lib/Form/FormBasedPreventNavigation.d.ts +3 -1
- package/lib/Form/FormBasedPreventNavigation.js +13 -60
- package/lib/Form/LegacyFormBasedPreventNavigation.d.ts +17 -0
- package/lib/Form/LegacyFormBasedPreventNavigation.js +72 -0
- package/lib/Form/NewFormBasedPreventNavigation.d.ts +14 -0
- package/lib/Form/NewFormBasedPreventNavigation.js +42 -0
- package/lib/Form/ServerErrorContext.d.ts +1 -0
- package/lib/Form/ServerErrorContext.js +1 -0
- package/lib/FormActions.d.ts +6 -0
- package/lib/FormActions.js +1 -0
- package/lib/FormDefaults.d.ts +1 -0
- package/lib/FormDefaults.js +1 -0
- package/lib/Group.d.ts +5 -3
- package/lib/Group.js +2 -2
- package/lib/Input/IconInputGroup.d.ts +3 -0
- package/lib/Input/IconInputGroup.js +1 -0
- package/lib/Input/InputGroup.d.ts +1 -1
- package/lib/Input/InputGroup.js +2 -2
- package/lib/Input/MoneyInputGroup.d.ts +2 -0
- package/lib/Input/MoneyInputGroup.js +1 -0
- package/lib/Input/NumberInputGroup.d.ts +2 -0
- package/lib/Input/NumberInputGroup.js +1 -0
- package/lib/Input/StringInputGroup.d.ts +1 -0
- package/lib/Input/StringInputGroup.js +1 -0
- package/lib/Normalization/normalizers.d.ts +2 -0
- package/lib/Normalization/normalizers.js +2 -0
- package/lib/Select/BooleanSelectGroup.d.ts +1 -0
- package/lib/Select/BooleanSelectGroup.js +1 -0
- package/lib/Select/NumberSelectGroup.d.ts +2 -0
- package/lib/Select/NumberSelectGroup.js +2 -0
- package/lib/Select/SelectGroup.d.ts +6 -0
- package/lib/Select/SelectGroup.js +1 -0
- package/lib/Select/StringSelectGroup.d.ts +2 -0
- package/lib/Select/StringSelectGroup.js +2 -0
- package/lib/StandardFormActions.d.ts +5 -0
- package/lib/StandardFormActions.js +1 -0
- package/lib/SubmitFormButton.d.ts +3 -0
- package/lib/SubmitFormButton.js +1 -0
- package/lib/TextArea/TextAreaGroup.d.ts +1 -0
- package/lib/TextArea/TextAreaGroup.js +1 -1
- package/lib/Validation/validators.d.ts +3 -0
- package/lib/Validation/validators.js +3 -2
- package/lib/setupTests.d.ts +1 -0
- package/lib/setupTests.js +3 -0
- package/package.json +9 -6
- package/src/AddressInput/AddressInput.tsx +10 -0
- package/src/AddressInput/__snapshots__/AddressInput.test.tsx.snap +4 -0
- package/src/ConfirmBaseForm/ConfirmBaseForm.tsx +14 -0
- package/src/ConfirmDeleteForm/ConfirmDeleteForm.tsx +13 -0
- package/src/DatePicker/DatePicker.test.tsx +1 -1
- package/src/DatePicker/DatePickerGroup.tsx +5 -2
- package/src/DatePicker/StringDateOnlyPickerGroup.tsx +5 -0
- package/src/DatePicker/StringDatePickerGroup.tsx +6 -0
- package/src/Field/Field.tsx +6 -1
- package/src/Field/FieldErrorScrollTarget.tsx +1 -0
- package/src/Field/StandAloneInput.tsx +4 -0
- package/src/Field/useStandardField.ts +13 -9
- package/src/FieldArray/FieldArray.tsx +9 -0
- package/src/File/FileGroup.tsx +2 -0
- package/src/Form/FocusError.tsx +3 -0
- package/src/Form/Form.tsx +6 -0
- package/src/Form/FormBasedPreventNavigation.tsx +26 -60
- package/src/Form/LegacyFormBasedPreventNavigation.tsx +77 -0
- package/src/Form/NewFormBasedPreventNavigation.tsx +59 -0
- package/src/Form/ServerErrorContext.ts +1 -0
- package/src/FormActions.tsx +7 -0
- package/src/FormDefaults.ts +1 -0
- package/src/Group.tsx +8 -4
- package/src/Input/IconInputGroup.tsx +3 -0
- package/src/Input/InputGroup.tsx +3 -1
- package/src/Input/MoneyInputGroup.tsx +2 -0
- package/src/Input/NumberInputGroup.tsx +2 -0
- package/src/Input/StringInputGroup.tsx +1 -0
- package/src/Input/__Tests__/__snapshots__/IconInputGroup.test.tsx.snap +1 -0
- package/src/Input/__Tests__/__snapshots__/MoneyInputGroup.test.tsx.snap +1 -0
- package/src/Input/__Tests__/__snapshots__/NumberInputGroup.test.tsx.snap +1 -0
- package/src/Input/__Tests__/__snapshots__/StringInputGroup.test.tsx.snap +1 -0
- package/src/Normalization/normalizers.ts +2 -0
- package/src/Select/BooleanSelectGroup.tsx +1 -0
- package/src/Select/NumberSelectGroup.tsx +2 -0
- package/src/Select/SelectGroup.tsx +6 -0
- package/src/Select/StringSelectGroup.tsx +2 -0
- package/src/StandardFormActions.tsx +5 -0
- package/src/SubmitFormButton.tsx +3 -0
- package/src/TextArea/TextAreaGroup.tsx +1 -1
- package/src/Validation/validators.ts +3 -2
- package/src/__Tests__/FormTestBase.tsx +7 -6
- package/src/__Tests__/RealisticForm.test.tsx +82 -0
- package/src/setupTests.ts +1 -0
- package/es/__Tests__/FormTestBase.d.ts +0 -27
- package/es/__Tests__/FormTestBase.js +0 -83
- package/es/__Tests__/index.d.ts +0 -2
- package/es/__Tests__/index.js +0 -2
- package/lib/__Tests__/FormTestBase.d.ts +0 -27
- package/lib/__Tests__/FormTestBase.js +0 -86
- package/lib/__Tests__/index.d.ts +0 -2
- package/lib/__Tests__/index.js +0 -8
@@ -6,7 +6,7 @@ export interface InputGroupProps<TValue> extends InjectedFieldProps<TValue>, Omi
|
|
6
6
|
value: string | number | null | undefined;
|
7
7
|
icon?: React.ReactNode;
|
8
8
|
}
|
9
|
-
/** generic controlled <input/> wrapped by a Group */
|
10
9
|
declare function InputGroup<TValue>({ input, meta, label, helpText, className, required, disabled, onChange, value, icon, ...rest }: InputGroupProps<TValue>, ref: LegacyRef<HTMLInputElement>): JSX.Element;
|
10
|
+
/** Generic controlled `<input/>` wrapped by a `<Group/>` */
|
11
11
|
declare const InputGroupWithRef: typeof InputGroup;
|
12
12
|
export default InputGroupWithRef;
|
package/lib/Input/InputGroup.js
CHANGED
@@ -30,10 +30,10 @@ var react_1 = __importDefault(require("react"));
|
|
30
30
|
var classnames_1 = __importDefault(require("classnames"));
|
31
31
|
var FormDefaults_1 = require("../FormDefaults");
|
32
32
|
var Group_1 = __importDefault(require("../Group"));
|
33
|
-
/** generic controlled <input/> wrapped by a Group */
|
34
33
|
function InputGroup(_a, ref) {
|
35
34
|
var input = _a.input, meta = _a.meta, label = _a.label, helpText = _a.helpText, className = _a.className, required = _a.required, disabled = _a.disabled, onChange = _a.onChange, value = _a.value, icon = _a.icon, rest = __rest(_a, ["input", "meta", "label", "helpText", "className", "required", "disabled", "onChange", "value", "icon"]);
|
36
|
-
return ((0, jsx_runtime_1.jsxs)(Group_1.default, __assign({ input: input, meta: meta, required: required, disabled: disabled, label: label, helpText: helpText, className: (0, classnames_1.default)(className, FormDefaults_1.FormDefaults.cssClassPrefix + 'input-group') }, { children: [icon, (0, jsx_runtime_1.jsx)("input", __assign({}, input, rest, { value: value !== null && value !== void 0 ? value : '', onChange: onChange, ref: ref, className: (0, classnames_1.default)(className, FormDefaults_1.FormDefaults.cssClassPrefix + 'input-group') }))] })));
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(Group_1.default, __assign({ input: input, meta: meta, required: required, disabled: disabled, label: label, helpText: helpText, className: (0, classnames_1.default)(className, FormDefaults_1.FormDefaults.cssClassPrefix + 'input-group') }, { children: [icon, (0, jsx_runtime_1.jsx)("input", __assign({}, input, rest, { "aria-invalid": !!meta.error, "aria-errormessage": !!meta.error ? "".concat(input.name, "-error") : undefined, value: value !== null && value !== void 0 ? value : '', onChange: onChange, ref: ref, className: (0, classnames_1.default)(className, FormDefaults_1.FormDefaults.cssClassPrefix + 'input-group') }))] })));
|
37
36
|
}
|
37
|
+
/** Generic controlled `<input/>` wrapped by a `<Group/>` */
|
38
38
|
var InputGroupWithRef = react_1.default.forwardRef(InputGroup);
|
39
39
|
exports.default = InputGroupWithRef;
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { InputGroupProps } from './InputGroup';
|
3
3
|
export interface MoneyInputGroupProps extends Omit<InputGroupProps<number | undefined | null>, 'onChange' | 'type' | 'value'> {
|
4
|
+
/** Custom parsing function when the value changes. */
|
4
5
|
parseFunc?: typeof parseInt | typeof parseFloat;
|
5
6
|
}
|
7
|
+
/** Input group for inputting money. */
|
6
8
|
declare const MoneyInputGroupWithRef: React.FunctionComponent<MoneyInputGroupProps>;
|
7
9
|
export default MoneyInputGroupWithRef;
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { InputGroupProps } from './InputGroup';
|
3
3
|
export interface NumberInputGroupProps extends Omit<InputGroupProps<number | undefined | null>, 'onChange' | 'type' | 'value'> {
|
4
|
+
/** Custom parsing function when the value changes. */
|
4
5
|
parseFunc?: typeof parseInt | typeof parseFloat;
|
5
6
|
}
|
7
|
+
/** Standard number input group. By default allows for float values. */
|
6
8
|
declare const NumberInputGroupWithRef: React.ComponentType<NumberInputGroupProps>;
|
7
9
|
export default NumberInputGroupWithRef;
|
@@ -3,5 +3,6 @@ import { InputGroupProps } from './InputGroup';
|
|
3
3
|
export interface StringInputGroupProps extends Omit<InputGroupProps<string | undefined | null>, 'onChange' | 'type' | 'value'> {
|
4
4
|
type?: 'color' | 'email' | 'search' | 'tel' | 'text' | 'url' | 'password' | 'textarea';
|
5
5
|
}
|
6
|
+
/** Standard string input group. */
|
6
7
|
declare const StringInputGroupWithRef: React.ComponentType<StringInputGroupProps>;
|
7
8
|
export default StringInputGroupWithRef;
|
@@ -1,2 +1,4 @@
|
|
1
|
+
/** Normalizer for converting a string into a valid phone number. */
|
1
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. */
|
2
4
|
export declare const zipCode: (value: string | undefined | null) => string | undefined;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.zipCode = exports.phoneNumber = void 0;
|
4
|
+
/** Normalizer for converting a string into a valid phone number. */
|
4
5
|
var phoneNumber = function (value) {
|
5
6
|
if (!value) {
|
6
7
|
return undefined;
|
@@ -22,6 +23,7 @@ var phoneNumber = function (value) {
|
|
22
23
|
return onlyNums;
|
23
24
|
};
|
24
25
|
exports.phoneNumber = phoneNumber;
|
26
|
+
/** Normalizer for converting a string into a valid zip code. Allows for XXXXX and XXXXX-XXXX format. */
|
25
27
|
var zipCode = function (value) {
|
26
28
|
if (!value) {
|
27
29
|
return undefined;
|
@@ -4,4 +4,5 @@ import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
|
|
4
4
|
export interface BooleanSelectGroupProps extends Omit<SelectGroupPropsHelper<boolean | undefined | null>, 'options'> {
|
5
5
|
options?: SelectOption<boolean>[];
|
6
6
|
}
|
7
|
+
/** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
|
7
8
|
export declare function BooleanSelectGroup(props: BooleanSelectGroupProps): JSX.Element;
|
@@ -27,6 +27,7 @@ var booleanOptions = [
|
|
27
27
|
value: false,
|
28
28
|
},
|
29
29
|
];
|
30
|
+
/** A `<SelectGroup/>` dropdown with two options. Default options are 'Yes' and 'No' with values of `true` and `false`. */
|
30
31
|
function BooleanSelectGroup(props) {
|
31
32
|
var _a;
|
32
33
|
return ((0, jsx_runtime_1.jsx)(SelectGroup_1.default, __assign({ multiple: false }, props, { options: (_a = props.options) !== null && _a !== void 0 ? _a : booleanOptions })));
|
@@ -2,7 +2,9 @@
|
|
2
2
|
import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
|
3
3
|
export interface MultiNumberSelectGroupProps extends SelectGroupPropsHelper<number[] | undefined | null> {
|
4
4
|
}
|
5
|
+
/** A `<SelectGroup/>` dropdown with values as numbers. Many options can be selected at a time. */
|
5
6
|
export declare function MultiNumberSelectGroup(props: MultiNumberSelectGroupProps): JSX.Element;
|
6
7
|
export interface SingleNumberSelectGroupProps extends SelectGroupPropsHelper<number | undefined | null> {
|
7
8
|
}
|
9
|
+
/** A `<SelectGroup/>` dropdown with values as numbers. Only one option can be selected at a time. */
|
8
10
|
export declare function SingleNumberSelectGroup(props: SingleNumberSelectGroupProps): JSX.Element;
|
@@ -17,10 +17,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.SingleNumberSelectGroup = exports.MultiNumberSelectGroup = void 0;
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
19
19
|
var SelectGroup_1 = __importDefault(require("./SelectGroup"));
|
20
|
+
/** A `<SelectGroup/>` dropdown with values as numbers. Many options can be selected at a time. */
|
20
21
|
function MultiNumberSelectGroup(props) {
|
21
22
|
return (0, jsx_runtime_1.jsx)(SelectGroup_1.default, __assign({ multiple: true }, props));
|
22
23
|
}
|
23
24
|
exports.MultiNumberSelectGroup = MultiNumberSelectGroup;
|
25
|
+
/** A `<SelectGroup/>` dropdown with values as numbers. Only one option can be selected at a time. */
|
24
26
|
function SingleNumberSelectGroup(props) {
|
25
27
|
return (0, jsx_runtime_1.jsx)(SelectGroup_1.default, __assign({ multiple: false }, props));
|
26
28
|
}
|
@@ -2,7 +2,9 @@
|
|
2
2
|
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
3
3
|
import { GroupProps } from '../Group';
|
4
4
|
export interface SelectOption<TValue> {
|
5
|
+
/** Value for the select. This will be sent to the API. */
|
5
6
|
value: (TValue extends Array<infer P> ? P : TValue) | undefined;
|
7
|
+
/** Label for the select. This is displayed to the user. */
|
6
8
|
label: string;
|
7
9
|
}
|
8
10
|
interface OptionsApiResult<TValue> {
|
@@ -14,9 +16,13 @@ interface OptionsUseServiceResult<TValue> {
|
|
14
16
|
error?: any;
|
15
17
|
}
|
16
18
|
export interface SelectGroupProps<TValue> extends InjectedFieldProps<TValue | undefined | null>, Omit<GroupProps, 'input' | 'meta' | 'children'> {
|
19
|
+
/** Options for the dropdown. Includes the label and value. */
|
17
20
|
options: SelectOption<TValue>[] | OptionsUseServiceResult<TValue>;
|
21
|
+
/** Whether the user should be able to have multiple values selected. */
|
18
22
|
multiple: TValue extends Array<any> ? true : false;
|
23
|
+
/** Text diplayed when no value is selected. */
|
19
24
|
placeholder?: string;
|
20
25
|
}
|
26
|
+
/** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
|
21
27
|
export default function SelectGroup<TValue>({ input, meta, className, required, disabled, options, multiple, placeholder, ...rest }: SelectGroupProps<TValue>): JSX.Element;
|
22
28
|
export {};
|
@@ -31,6 +31,7 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
31
31
|
var FormDefaults_1 = require("../FormDefaults");
|
32
32
|
var Group_1 = __importDefault(require("../Group"));
|
33
33
|
// TODO: we could also name this "ReactSelectGroup" or similar but the types are strongly defined now so kept the names consistent
|
34
|
+
/** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
|
34
35
|
function SelectGroup(_a) {
|
35
36
|
var _b;
|
36
37
|
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"]);
|
@@ -2,7 +2,9 @@
|
|
2
2
|
import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
|
3
3
|
export interface MultiStringSelectGroupProps extends SelectGroupPropsHelper<string[]> {
|
4
4
|
}
|
5
|
+
/** A `<SelectGroup/>` dropdown with values as strings. Multiple options can be selected at a time. */
|
5
6
|
export declare function MultiStringSelectGroup(props: MultiStringSelectGroupProps): JSX.Element;
|
6
7
|
export interface SingleStringSelectGroupProps extends SelectGroupPropsHelper<string> {
|
7
8
|
}
|
9
|
+
/** A `<SelectGroup/>` dropdown with the value as a string. Only one option can be selected at a time. */
|
8
10
|
export declare function SingleStringSelectGroup(props: SingleStringSelectGroupProps): JSX.Element;
|
@@ -17,10 +17,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.SingleStringSelectGroup = exports.MultiStringSelectGroup = void 0;
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
19
19
|
var SelectGroup_1 = __importDefault(require("./SelectGroup"));
|
20
|
+
/** A `<SelectGroup/>` dropdown with values as strings. Multiple options can be selected at a time. */
|
20
21
|
function MultiStringSelectGroup(props) {
|
21
22
|
return (0, jsx_runtime_1.jsx)(SelectGroup_1.default, __assign({ multiple: true }, props));
|
22
23
|
}
|
23
24
|
exports.MultiStringSelectGroup = MultiStringSelectGroup;
|
25
|
+
/** A `<SelectGroup/>` dropdown with the value as a string. Only one option can be selected at a time. */
|
24
26
|
function SingleStringSelectGroup(props) {
|
25
27
|
return (0, jsx_runtime_1.jsx)(SelectGroup_1.default, __assign({ multiple: false }, props));
|
26
28
|
}
|
@@ -1,6 +1,11 @@
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
2
2
|
export interface StandardFormActionsProps {
|
3
|
+
/** Allow the form to be submitted without any changes. By default this is not allowed. */
|
3
4
|
allowPristineSubmit?: boolean;
|
5
|
+
/** The cancel button's `onClick`.
|
6
|
+
* @defaultValue `window.history.back()`
|
7
|
+
*/
|
4
8
|
handleCancel?: MouseEventHandler<HTMLButtonElement>;
|
5
9
|
}
|
10
|
+
/** Standard submit and cancel buttons. */
|
6
11
|
export default function StandardFormActions({ allowPristineSubmit, handleCancel, }: StandardFormActionsProps): JSX.Element;
|
@@ -19,6 +19,7 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
19
19
|
var formik_1 = require("formik");
|
20
20
|
var SubmitFormButton_1 = __importDefault(require("./SubmitFormButton"));
|
21
21
|
var FormDefaults_1 = require("./FormDefaults");
|
22
|
+
/** Standard submit and cancel buttons. */
|
22
23
|
function StandardFormActions(_a) {
|
23
24
|
var allowPristineSubmit = _a.allowPristineSubmit, handleCancel = _a.handleCancel;
|
24
25
|
var isSubmitting = (0, formik_1.useFormikContext)().isSubmitting;
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
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. */
|
3
4
|
allowPristineSubmit?: boolean;
|
5
|
+
/** Text to display on the button. Default text is 'Submit'. */
|
4
6
|
children?: React.ReactNode;
|
5
7
|
}
|
6
8
|
declare const _default: React.FunctionComponent<SubmitFormButtonProps>;
|
9
|
+
/** Generic submit button for forms. */
|
7
10
|
export default _default;
|
package/lib/SubmitFormButton.js
CHANGED
@@ -41,4 +41,5 @@ function SubmitFormButton(_a, ref) {
|
|
41
41
|
? "You haven't made any changes"
|
42
42
|
: '', className: (0, classnames_1.default)(FormDefaults_1.FormDefaults.cssClassPrefix + 'submit-form-button', className) }, { children: children || 'Submit' })));
|
43
43
|
}
|
44
|
+
/** Generic submit button for forms. */
|
44
45
|
exports.default = react_1.default.forwardRef(SubmitFormButton);
|
@@ -4,5 +4,6 @@ import { GroupProps } from '../Group';
|
|
4
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
5
|
icon?: React.ReactNode;
|
6
6
|
}
|
7
|
+
/** Generic controlled `<textarea/>` wrapped by a `<Group/>` */
|
7
8
|
declare const TextAreaGroupWithRef: React.ComponentType<TextAreaGroupProps>;
|
8
9
|
export default TextAreaGroupWithRef;
|
@@ -30,11 +30,11 @@ var react_1 = __importDefault(require("react"));
|
|
30
30
|
var classnames_1 = __importDefault(require("classnames"));
|
31
31
|
var FormDefaults_1 = require("../FormDefaults");
|
32
32
|
var Group_1 = __importDefault(require("../Group"));
|
33
|
-
/** generic controlled <textarea/> wrapped by a Group */
|
34
33
|
function TextAreaGroup(_a, ref) {
|
35
34
|
var _b;
|
36
35
|
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"]);
|
37
36
|
return ((0, jsx_runtime_1.jsxs)(Group_1.default, __assign({ input: input, meta: meta, required: required, disabled: disabled, label: label, helpText: helpText, className: (0, classnames_1.default)(className, FormDefaults_1.FormDefaults.cssClassPrefix + 'text-area-group') }, { children: [icon, (0, jsx_runtime_1.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: (0, classnames_1.default)(className, FormDefaults_1.FormDefaults.cssClassPrefix + 'text-area-group') }))] })));
|
38
37
|
}
|
38
|
+
/** Generic controlled `<textarea/>` wrapped by a `<Group/>` */
|
39
39
|
var TextAreaGroupWithRef = react_1.default.forwardRef(TextAreaGroup);
|
40
40
|
exports.default = TextAreaGroupWithRef;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { ValidationFunction } from './ValidationFunction';
|
2
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 */
|
3
4
|
export declare const length: (len: number) => (value: string | number | undefined | null) => string | undefined;
|
4
5
|
export declare const integer: (val: string | number | undefined | null) => "Must be a whole number" | undefined;
|
5
6
|
export declare const maxLength: (len: number) => (value: string | number | undefined | null) => string | undefined;
|
@@ -11,5 +12,7 @@ export declare const minCount: (count: number) => (value: {
|
|
11
12
|
}[] | undefined | null) => string | undefined;
|
12
13
|
export declare const maxValue: (max: number) => (value: number | undefined | null) => string | undefined;
|
13
14
|
export declare const minValue: (min: number) => (value: number | undefined | null) => string | undefined;
|
15
|
+
/** Validate for a ZIP Code. Accepts formats: ##### and #####-#### */
|
14
16
|
export declare const zipCode: (value: string | undefined | null) => "Invalid ZIP Code" | undefined;
|
17
|
+
/** One of the validators provided must be true. */
|
15
18
|
export declare const any: <TValue>(validatorList: ValidationFunction<TValue>[]) => (value: TValue) => string | undefined;
|
@@ -11,7 +11,7 @@ var required = function (value) {
|
|
11
11
|
: 'Required';
|
12
12
|
};
|
13
13
|
exports.required = required;
|
14
|
-
|
14
|
+
/** Asserts that the value is a certain number of characters. numbers are coerced to a string */
|
15
15
|
var length = function (len) { return function (value) {
|
16
16
|
var hasError = getLengthOfValue(value) !== len;
|
17
17
|
return !hasError ? undefined : "Length must be ".concat(len);
|
@@ -51,13 +51,14 @@ var minValue = function (min) { return function (value) {
|
|
51
51
|
return !hasError ? undefined : "Minimum value ".concat(min, " not met");
|
52
52
|
}; };
|
53
53
|
exports.minValue = minValue;
|
54
|
+
/** Validate for a ZIP Code. Accepts formats: ##### and #####-#### */
|
54
55
|
var zipCode = function (value) {
|
55
56
|
return value && !/^[0-9]{5}(?:-[0-9]{4})?$/.test(value)
|
56
57
|
? 'Invalid ZIP Code'
|
57
58
|
: undefined;
|
58
59
|
};
|
59
60
|
exports.zipCode = zipCode;
|
60
|
-
|
61
|
+
/** One of the validators provided must be true. */
|
61
62
|
var any = function (validatorList) {
|
62
63
|
return function (value) {
|
63
64
|
if (validatorList.length === 0 || !value) {
|
@@ -0,0 +1 @@
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "envoc-form",
|
3
|
-
"version": "4.0.1-
|
3
|
+
"version": "4.0.1-12",
|
4
4
|
"description": "Envoc form components",
|
5
5
|
"keywords": [
|
6
6
|
"react-component",
|
@@ -23,11 +23,12 @@
|
|
23
23
|
"es"
|
24
24
|
],
|
25
25
|
"scripts": {
|
26
|
-
"build": "yarn verify-imports && yarn build:esm && yarn build:cjs && yarn build:css",
|
26
|
+
"build": "yarn verify-imports && yarn build:esm && yarn build:cjs && yarn build:css && yarn build:docs",
|
27
27
|
"rebuild": "rimraf ./{dist,es,lib} && yarn build",
|
28
28
|
"build:esm": "cross-env BABEL_ENV=esm-dir tsc -p tsconfig.esm.json",
|
29
29
|
"build:css": "sass src/styles.scss dist/css/envoc-form-styles.css",
|
30
30
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
31
|
+
"build:docs": "yarn rimraf README.md && yarn typedoc --options typedoc.json src/index.ts && npx concat-md --decrease-title-levels --dir-name-as-title docs > README.md && cls && yarn rimraf docs",
|
31
32
|
"verify-imports": "node ../../scripts/check-for-scss-imports.js envoc-form",
|
32
33
|
"start": "webpack serve --config ./webpack.demo.config.js",
|
33
34
|
"test": "cross-env SKIP_PREFLIGHT_CHECK=true react-scripts test --watchAll=false",
|
@@ -37,12 +38,12 @@
|
|
37
38
|
"axios": "^0.21.1",
|
38
39
|
"classnames": "^2.3.1",
|
39
40
|
"date-fns": "^2.22.1",
|
40
|
-
"envoc-request": "^4.0.1-
|
41
|
+
"envoc-request": "^4.0.1-12",
|
41
42
|
"lru-cache": "^6.0.0",
|
42
43
|
"prop-types": "^15.7.2",
|
43
44
|
"react-date-picker": "^8.2.0",
|
44
45
|
"react-dropzone": "^11.3.4",
|
45
|
-
"react-router": "^6.
|
46
|
+
"react-router": "^6.14.1",
|
46
47
|
"react-select": "^5.2.2",
|
47
48
|
"react-textarea-autosize": "^8.3.3",
|
48
49
|
"react-toastify": "^7.0.4",
|
@@ -65,6 +66,7 @@
|
|
65
66
|
"@testing-library/user-event": "^12.7.1",
|
66
67
|
"@types/jest": "^26.0.24",
|
67
68
|
"@types/react": "^16.9.56",
|
69
|
+
"@types/testing-library__jest-dom": "5.14.5",
|
68
70
|
"@types/smoothscroll-polyfill": "^0.3.1",
|
69
71
|
"@types/uuid": "^8.3.2",
|
70
72
|
"babel-loader": "^8.2.2",
|
@@ -79,7 +81,7 @@
|
|
79
81
|
"jest-junit": "~12.2.0",
|
80
82
|
"react": "^17.0.1",
|
81
83
|
"react-dom": "^17.0.1",
|
82
|
-
"react-router-dom": "^6.
|
84
|
+
"react-router-dom": "^6.14.1",
|
83
85
|
"react-scripts": "^4.0.3",
|
84
86
|
"rimraf": "~3.0.2",
|
85
87
|
"sass": "^1.35.2",
|
@@ -91,7 +93,8 @@
|
|
91
93
|
"ts-loader": "^9.2.8",
|
92
94
|
"typescript": "^4.6.3",
|
93
95
|
"typedoc-plugin-markdown": "~3.10.3",
|
94
|
-
"typedoc": "~0.21.4"
|
96
|
+
"typedoc": "~0.21.4",
|
97
|
+
"concat-md": "~0.3.5"
|
95
98
|
},
|
96
99
|
"peerDependencies": {
|
97
100
|
"@babel/runtime": "^7.14.6",
|
@@ -23,6 +23,16 @@ interface AddressDto {
|
|
23
23
|
state?: string | null;
|
24
24
|
}
|
25
25
|
|
26
|
+
/**
|
27
|
+
* Collection of `<Field/>`s for inputting an address. Includes:
|
28
|
+
* ```txt
|
29
|
+
* Address 1
|
30
|
+
* Address 2
|
31
|
+
* City
|
32
|
+
* State
|
33
|
+
* Zip
|
34
|
+
* ```
|
35
|
+
*/
|
26
36
|
export default function AddressInput({
|
27
37
|
fieldBuilder: { Field },
|
28
38
|
name,
|
@@ -19,6 +19,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
19
19
|
Address 1
|
20
20
|
</label>
|
21
21
|
<input
|
22
|
+
aria-invalid="false"
|
22
23
|
class="envoc-form-string-group envoc-form-input-group"
|
23
24
|
id="normalAddressInput.address1"
|
24
25
|
name="normalAddressInput.address1"
|
@@ -39,6 +40,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
39
40
|
Address 2
|
40
41
|
</label>
|
41
42
|
<input
|
43
|
+
aria-invalid="false"
|
42
44
|
class="envoc-form-string-group envoc-form-input-group"
|
43
45
|
id="normalAddressInput.address2"
|
44
46
|
name="normalAddressInput.address2"
|
@@ -59,6 +61,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
59
61
|
City
|
60
62
|
</label>
|
61
63
|
<input
|
64
|
+
aria-invalid="false"
|
62
65
|
class="envoc-form-string-group envoc-form-input-group"
|
63
66
|
id="normalAddressInput.city"
|
64
67
|
name="normalAddressInput.city"
|
@@ -168,6 +171,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
168
171
|
Zip
|
169
172
|
</label>
|
170
173
|
<input
|
174
|
+
aria-invalid="false"
|
171
175
|
class="envoc-form-string-group envoc-form-input-group"
|
172
176
|
id="normalAddressInput.zipCode"
|
173
177
|
name="normalAddressInput.zipCode"
|
@@ -6,16 +6,30 @@ import { FormDefaults } from '../FormDefaults';
|
|
6
6
|
// TODO: change the style prop type to Tailwind type (does this exist before Tailwind 3.1 ???), or
|
7
7
|
// should this just be type 'string'
|
8
8
|
export interface ConfirmBaseFormProps {
|
9
|
+
/** Function to run when cancel button is clicked. */
|
9
10
|
handleCancel?: MouseEventHandler<HTMLButtonElement>;
|
11
|
+
/** Axios request upon confirmation */
|
10
12
|
request: useAxiosRequestProps;
|
11
13
|
style?: React.CSSProperties;
|
14
|
+
/** `<h3/>` title text on top of the form. */
|
12
15
|
title?: string;
|
16
|
+
/** Custom confirm button text.
|
17
|
+
* @defaultValue `Confirm`
|
18
|
+
*/
|
13
19
|
confirmButtonText?: string;
|
20
|
+
/** CSS class for the buttons. */
|
14
21
|
confirmButtonClass?: string;
|
22
|
+
/** Any components to be rendered in between the title and the buttons. */
|
15
23
|
children?: React.ReactNode;
|
16
24
|
}
|
17
25
|
|
18
26
|
// TODO: ask about how we should use 'children'
|
27
|
+
/**
|
28
|
+
* Confimation dialog. Navigates to a different route to allow the user to either confirm or cancel an action.
|
29
|
+
* Commonly used for confirming delete and archive.
|
30
|
+
*
|
31
|
+
* See `<ConfirmDeleteForm/>` if the confirmation is specifically for deletion.
|
32
|
+
*/
|
19
33
|
export default function ConfirmBaseForm({
|
20
34
|
handleCancel,
|
21
35
|
request,
|
@@ -9,14 +9,27 @@ import { FormDefaults } from '../FormDefaults';
|
|
9
9
|
|
10
10
|
export interface ConfirmDeleteFormProps
|
11
11
|
extends Pick<ConfirmBaseFormProps, 'style'> {
|
12
|
+
/** Url to navigate to on success. */
|
12
13
|
successUrl?: string;
|
14
|
+
/** Form name (key) to apply the confirmation on. */
|
13
15
|
form: string;
|
16
|
+
/** Custom message to display.
|
17
|
+
* @defaultValue `Are you sure you want to delete this?`
|
18
|
+
*/
|
14
19
|
title?: string;
|
20
|
+
/** Custom function when the axios request succeeds. */
|
15
21
|
handleComplete?: Function;
|
22
|
+
/** Custom function when the axios request fails. */
|
16
23
|
handleError?: Function;
|
24
|
+
/** Any components to be rendered in between the title and the buttons. */
|
17
25
|
children?: React.ReactNode;
|
18
26
|
}
|
19
27
|
|
28
|
+
/**
|
29
|
+
* Deletion confirmation. Navigates to a different route to allow the user to either confirm or cancel an action.
|
30
|
+
*
|
31
|
+
* Wraps `<ConfirmBaseForm/>`.
|
32
|
+
*/
|
20
33
|
export default function ConfirmDeleteForm({
|
21
34
|
successUrl,
|
22
35
|
form,
|
@@ -4,7 +4,7 @@ import StringDatePickerGroup from './StringDatePickerGroup';
|
|
4
4
|
import FormTestBase from '../__Tests__/FormTestBase';
|
5
5
|
|
6
6
|
//hack so the datepicker internals don't complain about this not existing in the context of jest
|
7
|
-
HTMLCanvasElement.prototype.getContext = () =>
|
7
|
+
HTMLCanvasElement.prototype.getContext = () => null;
|
8
8
|
|
9
9
|
describe('IconInputGroup', () => {
|
10
10
|
it('renders without crashing', () => {
|
@@ -8,8 +8,6 @@ import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
|
8
8
|
import { FormDefaults } from '../FormDefaults';
|
9
9
|
import Group, { GroupProps } from '../Group';
|
10
10
|
|
11
|
-
// Docs for react-date-picker https://www.npmjs.com/package/react-date-picker
|
12
|
-
|
13
11
|
export interface DatePickerGroupProps<T>
|
14
12
|
extends InjectedFieldProps<T | undefined | null>,
|
15
13
|
Omit<
|
@@ -20,6 +18,11 @@ export interface DatePickerGroupProps<T>
|
|
20
18
|
convert: (arg: Date) => T;
|
21
19
|
}
|
22
20
|
|
21
|
+
/**
|
22
|
+
* Field for inputting dates. Uses `<Group/>` and `<DatePicker/>`.
|
23
|
+
*
|
24
|
+
* Uses [react-date-picker](https://www.npmjs.com/package/react-date-picker)
|
25
|
+
*/
|
23
26
|
export default function DatePickerGroup<T>({
|
24
27
|
input,
|
25
28
|
meta,
|
@@ -4,6 +4,11 @@ import { DatePickerHelper } from './DatePickerHelper';
|
|
4
4
|
export interface StringDateOnlyPickerGroupProps
|
5
5
|
extends DatePickerHelper<string | undefined | null> {}
|
6
6
|
|
7
|
+
/**
|
8
|
+
* Date picker input that consumes and outputs as a date only string in ISO format `YYYY-MM-DD`.
|
9
|
+
*
|
10
|
+
* Default display to the user is in `MM/DD/YYYY` format.
|
11
|
+
*/
|
7
12
|
export default function StringDatePickerGroup(
|
8
13
|
props: StringDateOnlyPickerGroupProps
|
9
14
|
) {
|
@@ -3,6 +3,12 @@ import { DatePickerHelper } from './DatePickerHelper';
|
|
3
3
|
|
4
4
|
export interface StringDatePickerGroupProps
|
5
5
|
extends DatePickerHelper<string | undefined | null> {}
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Date picker input that consumes and outputs as a date only string in ISO format `YYYY-MM-DDTHH:mm:ss.sssZ` or `±YYYYYY-MM-DDTHH:mm:ss.sssZ`
|
9
|
+
*
|
10
|
+
* If you need `YYYY-MM-DD` format use `<StringDateOnlyPickerGroup/>`.
|
11
|
+
*/
|
6
12
|
export default function StringDatePickerGroup(
|
7
13
|
props: StringDatePickerGroupProps
|
8
14
|
) {
|
package/src/Field/Field.tsx
CHANGED
@@ -34,14 +34,19 @@ export type FieldProps<
|
|
34
34
|
TProp extends keyof TForm,
|
35
35
|
TRenderComponent extends ElementType
|
36
36
|
> = {
|
37
|
+
/** Name of the field. Used on submission. */
|
37
38
|
name: TProp; // somewhat duplicated from useStandardFormInputProps but better for autocomplete
|
39
|
+
/** Component to be rendered. Usually this is a type of input group e.g. `<StringInputGroup/>` */
|
38
40
|
Component: RenderComponent<TForm[TProp], TRenderComponent>;
|
39
|
-
|
41
|
+
/** Id of the field. */
|
40
42
|
id?: string;
|
43
|
+
/** Whether the field should be disabled. */
|
41
44
|
disabled?: boolean;
|
45
|
+
/** Client side validation functions */
|
42
46
|
validate?:
|
43
47
|
| ValidationFunction<TForm[TProp]>
|
44
48
|
| ValidationFunction<TForm[TProp]>[];
|
49
|
+
/** Function to modify the field value without making the form dirty. (e.g. phone number) */
|
45
50
|
normalize?: NormalizationFunction<TForm[TProp]>;
|
46
51
|
} & Omit<
|
47
52
|
RenderComponentProps<TForm[TProp], TRenderComponent>,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { useContext } from 'react';
|
2
2
|
import { FieldNameContext } from './FieldNameContext';
|
3
3
|
|
4
|
+
/** Hidden `<div/>` that acts as an anchor to scroll to when a form error occurs. */
|
4
5
|
export default function FieldErrorScrollTarget() {
|
5
6
|
const name = useContext(FieldNameContext);
|
6
7
|
if (!name) {
|
@@ -9,8 +9,11 @@ export type StandAloneInputProps<
|
|
9
9
|
TValue,
|
10
10
|
TRenderComponent extends ElementType
|
11
11
|
> = {
|
12
|
+
/** Component to render inside of the field. */
|
12
13
|
Component: RenderComponent<TValue, TRenderComponent>;
|
14
|
+
/** Value of the field. */
|
13
15
|
value: TValue;
|
16
|
+
/** Function to change the value of the field. */
|
14
17
|
onChange: (arg: TValue) => void;
|
15
18
|
} & Omit<
|
16
19
|
RenderComponentProps<TValue, TRenderComponent>,
|
@@ -21,6 +24,7 @@ export type StandAloneInputProps<
|
|
21
24
|
| 'validate'
|
22
25
|
>;
|
23
26
|
|
27
|
+
/** The stand alone version of `<Field/>`. Can use a type of input component outside of a `<Form/>`. */
|
24
28
|
export default function StandAloneInput<TValue, TComponent extends ElementType>(
|
25
29
|
props: StandAloneInputProps<TValue, TComponent>
|
26
30
|
) {
|