envoc-form 4.0.1-8 → 4.1.0
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 +15 -5
- 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 +7 -2
- package/es/DatePicker/DatePickerGroup.js +16 -6
- package/es/DatePicker/StringDateOnlyPickerGroup.d.ts +6 -1
- package/es/DatePicker/StringDateOnlyPickerGroup.js +5 -0
- package/es/DatePicker/StringDatePickerGroup.d.ts +6 -1
- package/es/DatePicker/StringDatePickerGroup.js +5 -0
- package/es/Field/Field.d.ts +9 -3
- package/es/Field/Field.js +9 -4
- 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 +11 -2
- package/es/FieldArray/FieldArray.js +7 -2
- package/es/File/FileGroup.d.ts +3 -1
- package/es/File/FileGroup.js +4 -3
- package/es/File/FileList.d.ts +2 -2
- 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 -45
- 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 +7 -4
- package/es/Group.js +4 -3
- package/es/Input/IconInputGroup.d.ts +4 -1
- package/es/Input/IconInputGroup.js +3 -1
- package/es/Input/InputGroup.d.ts +4 -4
- package/es/Input/InputGroup.js +4 -4
- package/es/Input/MoneyInputGroup.d.ts +3 -1
- package/es/Input/MoneyInputGroup.js +1 -0
- package/es/Input/NumberInputGroup.d.ts +3 -1
- package/es/Input/NumberInputGroup.js +1 -0
- package/es/Input/StringInputGroup.d.ts +2 -1
- package/es/Input/StringInputGroup.js +3 -1
- package/es/Normalization/normalizers.d.ts +4 -2
- package/es/Normalization/normalizers.js +2 -0
- package/es/Select/BooleanSelectGroup.d.ts +2 -1
- package/es/Select/BooleanSelectGroup.js +1 -0
- package/es/Select/NumberSelectGroup.d.ts +4 -2
- package/es/Select/NumberSelectGroup.js +2 -0
- package/es/Select/SelectGroup.d.ts +8 -2
- package/es/Select/SelectGroup.js +5 -4
- 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 +4 -1
- package/es/SubmitFormButton.js +1 -0
- package/es/TextArea/TextAreaGroup.d.ts +2 -1
- package/es/TextArea/TextAreaGroup.js +5 -4
- package/es/Validation/validators.d.ts +11 -8
- package/es/Validation/validators.js +6 -2
- package/es/index.d.ts +4 -4
- package/es/setupTests.d.ts +1 -0
- package/es/setupTests.js +1 -0
- package/lib/AddressInput/AddressInput.d.ts +15 -5
- 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 +7 -2
- package/lib/DatePicker/DatePickerGroup.js +16 -6
- package/lib/DatePicker/StringDateOnlyPickerGroup.d.ts +6 -1
- package/lib/DatePicker/StringDateOnlyPickerGroup.js +5 -0
- package/lib/DatePicker/StringDatePickerGroup.d.ts +6 -1
- package/lib/DatePicker/StringDatePickerGroup.js +5 -0
- package/lib/Field/Field.d.ts +9 -3
- package/lib/Field/Field.js +9 -4
- 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 +11 -2
- package/lib/FieldArray/FieldArray.js +7 -2
- package/lib/File/FileGroup.d.ts +3 -1
- package/lib/File/FileGroup.js +4 -3
- package/lib/File/FileList.d.ts +2 -2
- 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 -43
- 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 +7 -4
- package/lib/Group.js +4 -3
- package/lib/Input/IconInputGroup.d.ts +4 -1
- package/lib/Input/IconInputGroup.js +3 -1
- package/lib/Input/InputGroup.d.ts +4 -4
- package/lib/Input/InputGroup.js +4 -4
- package/lib/Input/MoneyInputGroup.d.ts +3 -1
- package/lib/Input/MoneyInputGroup.js +1 -0
- package/lib/Input/NumberInputGroup.d.ts +3 -1
- package/lib/Input/NumberInputGroup.js +1 -0
- package/lib/Input/StringInputGroup.d.ts +2 -1
- package/lib/Input/StringInputGroup.js +3 -1
- package/lib/Normalization/normalizers.d.ts +4 -2
- package/lib/Normalization/normalizers.js +2 -0
- package/lib/Select/BooleanSelectGroup.d.ts +2 -1
- package/lib/Select/BooleanSelectGroup.js +1 -0
- package/lib/Select/NumberSelectGroup.d.ts +4 -2
- package/lib/Select/NumberSelectGroup.js +2 -0
- package/lib/Select/SelectGroup.d.ts +8 -2
- package/lib/Select/SelectGroup.js +5 -4
- 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 +4 -1
- package/lib/SubmitFormButton.js +1 -0
- package/lib/TextArea/TextAreaGroup.d.ts +2 -1
- package/lib/TextArea/TextAreaGroup.js +5 -4
- package/lib/Validation/validators.d.ts +11 -8
- package/lib/Validation/validators.js +6 -2
- package/lib/index.d.ts +4 -4
- package/lib/setupTests.d.ts +1 -0
- package/lib/setupTests.js +3 -0
- package/package.json +9 -6
- package/src/AddressInput/AddressInput.tsx +15 -5
- package/src/AddressInput/__snapshots__/AddressInput.test.tsx.snap +8 -4
- 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 +18 -7
- package/src/DatePicker/StringDateOnlyPickerGroup.tsx +7 -2
- package/src/DatePicker/StringDatePickerGroup.tsx +7 -1
- package/src/Field/Field.tsx +20 -7
- 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 +14 -5
- package/src/File/FileGroup.tsx +9 -3
- package/src/File/FileList.tsx +2 -2
- package/src/Form/FocusError.tsx +3 -0
- package/src/Form/Form.tsx +6 -0
- package/src/Form/FormBasedPreventNavigation.tsx +28 -46
- 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 +12 -4
- package/src/Input/IconInputGroup.tsx +5 -2
- package/src/Input/InputGroup.tsx +13 -5
- package/src/Input/MoneyInputGroup.tsx +3 -1
- package/src/Input/NumberInputGroup.tsx +3 -1
- package/src/Input/StringInputGroup.tsx +3 -2
- 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 +4 -2
- package/src/Select/BooleanSelectGroup.tsx +2 -1
- package/src/Select/NumberSelectGroup.tsx +4 -2
- package/src/Select/SelectGroup.tsx +13 -2
- package/src/Select/StringSelectGroup.tsx +2 -0
- package/src/StandardFormActions.tsx +5 -0
- package/src/SubmitFormButton.tsx +5 -1
- package/src/TextArea/TextAreaGroup.tsx +6 -4
- package/src/Validation/validators.ts +19 -14
- package/src/__Tests__/FormTestBase.tsx +9 -8
- package/src/__Tests__/RealisticForm.test.tsx +82 -0
- package/src/index.ts +4 -4
- 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
@@ -1,8 +1,10 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { SelectGroupPropsHelper } from './SelectGroupPropsHelper';
|
3
|
-
export interface MultiNumberSelectGroupProps extends SelectGroupPropsHelper<number[]> {
|
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
|
-
export interface SingleNumberSelectGroupProps extends SelectGroupPropsHelper<number> {
|
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> {
|
@@ -13,10 +15,14 @@ interface OptionsUseServiceResult<TValue> {
|
|
13
15
|
resp?: Partial<SelectOption<TValue>>[] | OptionsApiResult<TValue> | null;
|
14
16
|
error?: any;
|
15
17
|
}
|
16
|
-
export interface SelectGroupProps<TValue> extends InjectedFieldProps<TValue | undefined>, Omit<GroupProps, 'input' | 'meta' | 'children'> {
|
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
|
}
|
21
|
-
|
26
|
+
/** Generic select dropdown. Uses [react-select](https://react-select.com/home). */
|
27
|
+
export default function SelectGroup<TValue>({ input, meta, className, required, disabled, options, multiple, placeholder, ...rest }: SelectGroupProps<TValue>): JSX.Element;
|
22
28
|
export {};
|
@@ -28,12 +28,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
29
29
|
var react_select_1 = __importDefault(require("react-select"));
|
30
30
|
var classnames_1 = __importDefault(require("classnames"));
|
31
|
-
var Group_1 = __importDefault(require("../Group"));
|
32
31
|
var FormDefaults_1 = require("../FormDefaults");
|
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
|
-
var input = _a.input, meta = _a.meta, className = _a.className, options = _a.options, multiple = _a.multiple, placeholder = _a.placeholder, rest = __rest(_a, ["input", "meta", "className", "options", "multiple", "placeholder"]);
|
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"]);
|
37
38
|
var effectiveOptions = !options
|
38
39
|
? []
|
39
40
|
: Array.isArray(options)
|
@@ -47,10 +48,10 @@ function SelectGroup(_a) {
|
|
47
48
|
? options.resp
|
48
49
|
: [];
|
49
50
|
var isLoading = (options && 'loading' in options && options.loading) || false;
|
50
|
-
return ((0, jsx_runtime_1.jsx)(Group_1.default, __assign({}, rest, { input: input, meta: meta, className: (0, classnames_1.default)(className, (_b = {},
|
51
|
+
return ((0, jsx_runtime_1.jsx)(Group_1.default, __assign({}, rest, { input: input, meta: meta, required: required, disabled: disabled, className: (0, classnames_1.default)(className, (_b = {},
|
51
52
|
_b[FormDefaults_1.FormDefaults.cssClassPrefix + 'multiple'] = multiple,
|
52
53
|
_b[FormDefaults_1.FormDefaults.cssClassPrefix + 'loading'] = isLoading,
|
53
|
-
_b), FormDefaults_1.FormDefaults.cssClassPrefix + 'select-group') }, { children: (0, jsx_runtime_1.jsx)(react_select_1.default, { inputId: input.id, isMulti: multiple, options: effectiveOptions, onBlur: input.onBlur, value: getValue(), onChange: function (e) {
|
54
|
+
_b), FormDefaults_1.FormDefaults.cssClassPrefix + 'select-group') }, { children: (0, jsx_runtime_1.jsx)(react_select_1.default, { inputId: input.id, isMulti: multiple, isDisabled: disabled, options: effectiveOptions, onBlur: input.onBlur, value: getValue(), onChange: function (e) {
|
54
55
|
if (multiple === true) {
|
55
56
|
input.onChange(e === null || e === void 0 ? void 0 : e.map(function (x) { return x.value; }));
|
56
57
|
}
|
@@ -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
|
-
declare const _default: React.
|
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);
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
3
3
|
import { GroupProps } from '../Group';
|
4
|
-
export interface TextAreaGroupProps extends InjectedFieldProps<string | undefined>, Omit<React.HTMLProps<HTMLTextAreaElement>, keyof InjectedFieldProps<any> | 'children' | 'className' | 'label'>, Omit<GroupProps, keyof InjectedFieldProps<any> | 'children'> {
|
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;
|
@@ -28,12 +28,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
29
29
|
var react_1 = __importDefault(require("react"));
|
30
30
|
var classnames_1 = __importDefault(require("classnames"));
|
31
|
-
var Group_1 = __importDefault(require("../Group"));
|
32
31
|
var FormDefaults_1 = require("../FormDefaults");
|
33
|
-
|
32
|
+
var Group_1 = __importDefault(require("../Group"));
|
34
33
|
function TextAreaGroup(_a, ref) {
|
35
|
-
var
|
36
|
-
|
34
|
+
var _b;
|
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"]);
|
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') }))] })));
|
37
37
|
}
|
38
|
+
/** Generic controlled `<textarea/>` wrapped by a `<Group/>` */
|
38
39
|
var TextAreaGroupWithRef = react_1.default.forwardRef(TextAreaGroup);
|
39
40
|
exports.default = TextAreaGroupWithRef;
|
@@ -1,15 +1,18 @@
|
|
1
1
|
import { ValidationFunction } from './ValidationFunction';
|
2
2
|
export declare const required: (value: any) => "Required" | undefined;
|
3
|
-
|
4
|
-
export declare const
|
5
|
-
export declare const
|
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;
|
6
7
|
export declare const maxCount: (count: number) => (value: {
|
7
8
|
isDeleted?: boolean;
|
8
|
-
}[] | undefined) => string | undefined;
|
9
|
+
}[] | undefined | null) => string | undefined;
|
9
10
|
export declare const minCount: (count: number) => (value: {
|
10
11
|
isDeleted?: boolean;
|
11
|
-
}[] | undefined) => string | undefined;
|
12
|
-
export declare const maxValue: (max: number) => (value: number | undefined) => string | undefined;
|
13
|
-
export declare const minValue: (min: number) => (value: number | undefined) => string | undefined;
|
14
|
-
|
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. */
|
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) {
|
@@ -68,6 +69,9 @@ var any = function (validatorList) {
|
|
68
69
|
};
|
69
70
|
exports.any = any;
|
70
71
|
function getLengthOfValue(value) {
|
72
|
+
if (value === null) {
|
73
|
+
return 0;
|
74
|
+
}
|
71
75
|
switch (typeof value) {
|
72
76
|
case 'undefined':
|
73
77
|
return 0;
|
package/lib/index.d.ts
CHANGED
@@ -7,7 +7,7 @@ export type { ConfirmBaseFormProps } from './ConfirmBaseForm/ConfirmBaseForm';
|
|
7
7
|
export { default as ConfirmDeleteForm } from './ConfirmDeleteForm/ConfirmDeleteForm';
|
8
8
|
export type { ConfirmDeleteFormProps } from './ConfirmDeleteForm/ConfirmDeleteForm';
|
9
9
|
export { default as DatePickerGroup } from './DatePicker/DatePickerGroup';
|
10
|
-
export type { DatePickerGroupProps
|
10
|
+
export type { DatePickerGroupProps } from './DatePicker/DatePickerGroup';
|
11
11
|
export { convertToTimeZoneInsensitiveISOString } from './DatePicker/DatePickerGroup';
|
12
12
|
export type { DatePickerHelper } from './DatePicker/DatePickerHelper';
|
13
13
|
export { default as StringDatePickerGroup } from './DatePicker/StringDatePickerGroup';
|
@@ -34,12 +34,12 @@ export type { FormBuilderProp, FormProps } from './Form/Form';
|
|
34
34
|
export { ServerErrorContext } from './Form/ServerErrorContext';
|
35
35
|
export type { ServerErrorContextProps, ServerErrors, } from './Form/ServerErrorContext';
|
36
36
|
export { default as FormActions } from './FormActions';
|
37
|
-
export type { FormActionsProps
|
37
|
+
export type { FormActionsProps } from './FormActions';
|
38
38
|
export { default as StandardFormActions } from './StandardFormActions';
|
39
|
-
export type { StandardFormActionsProps
|
39
|
+
export type { StandardFormActionsProps } from './StandardFormActions';
|
40
40
|
export { FormDefaults } from './FormDefaults';
|
41
41
|
export { default as Group } from './Group';
|
42
|
-
export type { GroupProps
|
42
|
+
export type { GroupProps } from './Group';
|
43
43
|
export { default as IconInputGroup } from './Input/IconInputGroup';
|
44
44
|
export type { IconInputGroupProps } from './Input/IconInputGroup';
|
45
45
|
export { default as InputGroup } from './Input/InputGroup';
|
@@ -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
|
3
|
+
"version": "4.1.0",
|
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
|
41
|
+
"envoc-request": "^4.1.0",
|
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",
|
@@ -16,13 +16,23 @@ export interface AddressInputProps {
|
|
16
16
|
}
|
17
17
|
|
18
18
|
interface AddressDto {
|
19
|
-
address1?: string;
|
20
|
-
address2?: string;
|
21
|
-
zipCode?: string;
|
22
|
-
city?: string;
|
23
|
-
state?: string;
|
19
|
+
address1?: string | null;
|
20
|
+
address2?: string | null;
|
21
|
+
zipCode?: string | null;
|
22
|
+
city?: string | null;
|
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,
|
@@ -7,7 +7,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
7
7
|
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="envoc-form-string-group envoc-form-input-group envoc-form-group"
|
10
|
+
class="envoc-form-string-group envoc-form-input-group envoc-form-group envoc-form-required"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="normaladdressinput.address1-error-scroll-target"
|
@@ -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"
|
@@ -47,7 +49,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
47
49
|
/>
|
48
50
|
</div>
|
49
51
|
<div
|
50
|
-
class="envoc-form-string-group envoc-form-input-group envoc-form-group"
|
52
|
+
class="envoc-form-string-group envoc-form-input-group envoc-form-group envoc-form-required"
|
51
53
|
>
|
52
54
|
<div
|
53
55
|
id="normaladdressinput.city-error-scroll-target"
|
@@ -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"
|
@@ -67,7 +70,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
67
70
|
/>
|
68
71
|
</div>
|
69
72
|
<div
|
70
|
-
class="envoc-form-select-group envoc-form-group"
|
73
|
+
class="envoc-form-select-group envoc-form-group envoc-form-required"
|
71
74
|
>
|
72
75
|
<div
|
73
76
|
id="normaladdressinput.state-error-scroll-target"
|
@@ -156,7 +159,7 @@ exports[`AddressInput has matching snapshot 1`] = `
|
|
156
159
|
</div>
|
157
160
|
</div>
|
158
161
|
<div
|
159
|
-
class="envoc-form-string-group envoc-form-input-group envoc-form-group"
|
162
|
+
class="envoc-form-string-group envoc-form-input-group envoc-form-group envoc-form-required"
|
160
163
|
>
|
161
164
|
<div
|
162
165
|
id="normaladdressinput.zipcode-error-scroll-target"
|
@@ -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', () => {
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { useEffect, useState } from 'react';
|
2
|
-
import DatePicker, {
|
2
|
+
import DatePicker, {
|
3
|
+
DatePickerProps,
|
4
|
+
} from 'react-date-picker/dist/entry.nostyle';
|
3
5
|
import classnames from 'classnames';
|
4
6
|
import parseISO from 'date-fns/parseISO';
|
5
7
|
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
6
8
|
import { FormDefaults } from '../FormDefaults';
|
7
9
|
import Group, { GroupProps } from '../Group';
|
8
10
|
|
9
|
-
// Docs for react-date-picker https://www.npmjs.com/package/react-date-picker
|
10
|
-
|
11
11
|
export interface DatePickerGroupProps<T>
|
12
|
-
extends InjectedFieldProps<T | undefined>,
|
12
|
+
extends InjectedFieldProps<T | undefined | null>,
|
13
13
|
Omit<
|
14
14
|
DatePickerProps,
|
15
15
|
keyof InjectedFieldProps<T> | 'name' | 'value' | 'className'
|
@@ -18,12 +18,18 @@ export interface DatePickerGroupProps<T>
|
|
18
18
|
convert: (arg: Date) => T;
|
19
19
|
}
|
20
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
|
+
*/
|
21
26
|
export default function DatePickerGroup<T>({
|
22
27
|
input,
|
23
28
|
meta,
|
24
29
|
label,
|
25
30
|
helpText,
|
26
31
|
className,
|
32
|
+
required,
|
27
33
|
disabled,
|
28
34
|
convert,
|
29
35
|
...rest
|
@@ -31,10 +37,14 @@ export default function DatePickerGroup<T>({
|
|
31
37
|
const [displayDate, setDisplayDate] = useState<Date | null>(null);
|
32
38
|
|
33
39
|
useEffect(() => {
|
34
|
-
if (input.value
|
35
|
-
setDisplayDate(new Date(`${input.value}T00:00:00.000`));
|
36
|
-
} else {
|
40
|
+
if (!input.value) {
|
37
41
|
setDisplayDate(null);
|
42
|
+
} else if (typeof input.value === 'string') {
|
43
|
+
if (input.value.indexOf('T') === -1) {
|
44
|
+
setDisplayDate(new Date(`${input.value}T00:00:00.000`));
|
45
|
+
} else {
|
46
|
+
setDisplayDate(new Date(input.value));
|
47
|
+
}
|
38
48
|
}
|
39
49
|
}, [setDisplayDate, input.value]);
|
40
50
|
|
@@ -48,6 +58,7 @@ export default function DatePickerGroup<T>({
|
|
48
58
|
className,
|
49
59
|
FormDefaults.cssClassPrefix + 'date-picker'
|
50
60
|
)}
|
61
|
+
required={required}
|
51
62
|
disabled={disabled}>
|
52
63
|
<DatePicker
|
53
64
|
{...rest}
|
@@ -1,9 +1,14 @@
|
|
1
|
-
import { DatePickerHelper } from './DatePickerHelper';
|
2
1
|
import DatePickerGroup from './DatePickerGroup';
|
2
|
+
import { DatePickerHelper } from './DatePickerHelper';
|
3
3
|
|
4
4
|
export interface StringDateOnlyPickerGroupProps
|
5
|
-
extends DatePickerHelper<string | undefined> {}
|
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
|
) {
|
@@ -2,7 +2,13 @@ import DatePickerGroup from './DatePickerGroup';
|
|
2
2
|
import { DatePickerHelper } from './DatePickerHelper';
|
3
3
|
|
4
4
|
export interface StringDatePickerGroupProps
|
5
|
-
extends DatePickerHelper<string | undefined> {}
|
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
|
) {
|