envoc-form 4.0.1-0 → 4.0.1-10
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 +2 -2
- package/es/ConfirmBaseForm/ConfirmBaseForm.d.ts +3 -1
- package/es/ConfirmBaseForm/ConfirmBaseForm.js +3 -2
- package/es/ConfirmDeleteForm/ConfirmDeleteForm.js +2 -1
- package/es/DatePicker/DatePickerGroup.d.ts +9 -0
- package/es/DatePicker/DatePickerGroup.js +77 -0
- package/es/DatePicker/DatePickerHelper.d.ts +3 -0
- package/es/DatePicker/DatePickerHelper.js +1 -0
- package/es/DatePicker/StringDateOnlyPickerGroup.d.ts +5 -0
- package/es/DatePicker/StringDateOnlyPickerGroup.js +24 -0
- package/es/DatePicker/StringDatePickerGroup.d.ts +5 -0
- package/es/DatePicker/StringDatePickerGroup.js +19 -0
- package/es/Field/Field.d.ts +3 -3
- package/es/Field/Field.js +9 -4
- package/es/Field/StandAloneInput.d.ts +9 -0
- package/es/Field/StandAloneInput.js +49 -0
- package/es/FieldArray/FieldArray.js +10 -7
- package/es/File/FileGroup.js +5 -3
- package/es/File/FileList.js +2 -1
- package/es/Form/Form.d.ts +8 -3
- package/es/Form/Form.js +32 -3
- package/es/FormActions.js +5 -1
- package/es/FormDefaults.d.ts +3 -0
- package/es/FormDefaults.js +1 -0
- package/es/Group.d.ts +3 -2
- package/es/Group.js +8 -5
- package/es/Input/IconInputGroup.js +2 -1
- package/es/Input/InputGroup.d.ts +1 -1
- package/es/Input/InputGroup.js +3 -2
- package/es/Input/MoneyInputGroup.js +2 -1
- package/es/Input/NumberInputGroup.js +2 -1
- package/es/Input/StringInputGroup.d.ts +1 -1
- package/es/Input/StringInputGroup.js +2 -1
- package/es/Select/SelectGroup.d.ts +1 -1
- package/es/Select/SelectGroup.js +8 -3
- package/es/StandardFormActions.js +2 -1
- package/es/SubmitFormButton.js +4 -2
- package/es/TextArea/TextAreaGroup.d.ts +8 -0
- package/es/TextArea/TextAreaGroup.js +34 -0
- package/es/Validation/validators.d.ts +1 -1
- package/es/Validation/validators.js +1 -1
- package/es/__Tests__/FormTestBase.d.ts +3 -3
- package/es/index.d.ts +21 -5
- package/es/index.js +10 -1
- package/lib/ConfirmBaseForm/ConfirmBaseForm.d.ts +3 -1
- package/lib/ConfirmBaseForm/ConfirmBaseForm.js +3 -2
- package/lib/ConfirmDeleteForm/ConfirmDeleteForm.js +2 -1
- package/lib/DatePicker/DatePickerGroup.d.ts +9 -0
- package/lib/DatePicker/DatePickerGroup.js +85 -0
- package/lib/DatePicker/DatePickerHelper.d.ts +3 -0
- package/lib/DatePicker/DatePickerHelper.js +2 -0
- package/lib/DatePicker/StringDateOnlyPickerGroup.d.ts +5 -0
- package/lib/DatePicker/StringDateOnlyPickerGroup.js +30 -0
- package/lib/DatePicker/StringDatePickerGroup.d.ts +5 -0
- package/lib/DatePicker/StringDatePickerGroup.js +25 -0
- package/lib/Field/Field.d.ts +3 -3
- package/lib/Field/Field.js +9 -4
- package/lib/Field/StandAloneInput.d.ts +9 -0
- package/lib/Field/StandAloneInput.js +75 -0
- package/lib/FieldArray/FieldArray.js +10 -7
- package/lib/File/FileGroup.js +5 -3
- package/lib/File/FileList.js +2 -1
- package/lib/Form/Form.d.ts +8 -3
- package/lib/Form/Form.js +32 -3
- package/lib/FormActions.js +5 -1
- package/lib/FormDefaults.d.ts +3 -0
- package/lib/FormDefaults.js +4 -0
- package/lib/Group.d.ts +3 -2
- package/lib/Group.js +8 -5
- package/lib/Input/IconInputGroup.js +2 -1
- package/lib/Input/InputGroup.d.ts +1 -1
- package/lib/Input/InputGroup.js +3 -2
- package/lib/Input/MoneyInputGroup.js +2 -1
- package/lib/Input/NumberInputGroup.js +2 -1
- package/lib/Input/StringInputGroup.d.ts +1 -1
- package/lib/Input/StringInputGroup.js +2 -1
- package/lib/Select/SelectGroup.d.ts +1 -1
- package/lib/Select/SelectGroup.js +8 -3
- package/lib/StandardFormActions.js +2 -1
- package/lib/SubmitFormButton.js +4 -2
- package/lib/TextArea/TextAreaGroup.d.ts +8 -0
- package/lib/TextArea/TextAreaGroup.js +39 -0
- package/lib/Validation/validators.d.ts +1 -1
- package/lib/Validation/validators.js +1 -1
- package/lib/__Tests__/FormTestBase.d.ts +3 -3
- package/lib/index.d.ts +21 -5
- package/lib/index.js +19 -3
- package/package.json +4 -2
- package/src/AddressInput/__snapshots__/AddressInput.test.tsx.snap +15 -10
- package/src/ConfirmBaseForm/ConfirmBaseForm.tsx +13 -3
- package/src/ConfirmBaseForm/__snapshots__/ConfirmBaseForm.test.tsx.snap +3 -3
- package/src/ConfirmDeleteForm/ConfirmDeleteForm.tsx +8 -1
- package/src/ConfirmDeleteForm/__snapshots__/ConfirmDeleteForm.test.tsx.snap +2 -2
- package/src/{DatePickerInput/DatePickerInput.test.tsx → DatePicker/DatePicker.test.tsx} +3 -3
- package/src/DatePicker/DatePickerGroup.tsx +108 -0
- package/src/DatePicker/DatePickerHelper.ts +4 -0
- package/src/DatePicker/StringDateOnlyPickerGroup.tsx +23 -0
- package/src/DatePicker/StringDatePickerGroup.tsx +14 -0
- package/src/{DatePickerInput/__snapshots__/DatePickerInput.test.tsx.snap → DatePicker/__snapshots__/DatePicker.test.tsx.snap} +3 -2
- package/src/Field/Field.tsx +28 -10
- package/src/Field/StandAloneInput.tsx +51 -0
- package/src/FieldArray/FieldArray.tsx +21 -9
- package/src/File/FileGroup.tsx +14 -2
- package/src/File/FileList.tsx +3 -1
- package/src/File/__snapshots__/FileGroup.test.tsx.snap +5 -3
- package/src/Form/Form.tsx +56 -4
- package/src/Form/__snapshots__/Form.test.tsx.snap +1 -0
- package/src/FormActions.tsx +8 -2
- package/src/FormDefaults.ts +1 -0
- package/src/Group.tsx +22 -7
- package/src/Input/IconInputGroup.tsx +5 -2
- package/src/Input/InputGroup.tsx +11 -2
- package/src/Input/MoneyInputGroup.tsx +5 -1
- package/src/Input/NumberInputGroup.tsx +5 -1
- package/src/Input/StringInputGroup.tsx +14 -2
- package/src/Input/__Tests__/__snapshots__/IconInputGroup.test.tsx.snap +4 -2
- package/src/Input/__Tests__/__snapshots__/MoneyInputGroup.test.tsx.snap +4 -2
- package/src/Input/__Tests__/__snapshots__/NumberInputGroup.test.tsx.snap +4 -2
- package/src/Input/__Tests__/__snapshots__/StringInputGroup.test.tsx.snap +4 -2
- package/src/Select/SelectGroup.tsx +15 -3
- package/src/Select/__tests__/__snapshots__/BooleanSelectGroup.test.tsx.snap +3 -2
- package/src/Select/__tests__/__snapshots__/NumberSelectGroup.test.tsx.snap +6 -4
- package/src/Select/__tests__/__snapshots__/StringSelectGroup.test.tsx.snap +6 -4
- package/src/StandardFormActions.tsx +4 -1
- package/src/SubmitFormButton.tsx +7 -1
- package/src/TextArea/TextAreaGroup.tsx +64 -0
- package/src/Validation/validators.ts +2 -2
- package/src/__Tests__/FormTestBase.tsx +3 -3
- package/src/__Tests__/__snapshots__/StandardFormActions.test.tsx.snap +4 -2
- package/src/__Tests__/__snapshots__/SubmitFormButton.test.tsx.snap +3 -1
- package/src/index.ts +41 -5
- package/es/DatePickerInput/DatePickerInput.d.ts +0 -14
- package/es/DatePickerInput/DatePickerInput.js +0 -63
- package/lib/DatePickerInput/DatePickerInput.d.ts +0 -14
- package/lib/DatePickerInput/DatePickerInput.js +0 -69
- package/src/DatePickerInput/DatePickerInput.tsx +0 -85
@@ -2,6 +2,7 @@ import { default as ReactSelect } from 'react-select';
|
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
4
4
|
import Group, { GroupProps } from '../Group';
|
5
|
+
import { FormDefaults } from '../FormDefaults';
|
5
6
|
|
6
7
|
export interface SelectOption<TValue> {
|
7
8
|
value: (TValue extends Array<infer P> ? P : TValue) | undefined;
|
@@ -37,6 +38,8 @@ export default function SelectGroup<TValue>({
|
|
37
38
|
input,
|
38
39
|
meta,
|
39
40
|
className,
|
41
|
+
required,
|
42
|
+
disabled,
|
40
43
|
options,
|
41
44
|
multiple,
|
42
45
|
placeholder,
|
@@ -63,10 +66,15 @@ export default function SelectGroup<TValue>({
|
|
63
66
|
{...rest}
|
64
67
|
input={input}
|
65
68
|
meta={meta}
|
69
|
+
required={required}
|
70
|
+
disabled={disabled}
|
66
71
|
className={classNames(
|
67
72
|
className,
|
68
|
-
{
|
69
|
-
|
73
|
+
{
|
74
|
+
[FormDefaults.cssClassPrefix + 'multiple']: multiple,
|
75
|
+
[FormDefaults.cssClassPrefix + 'loading']: isLoading,
|
76
|
+
},
|
77
|
+
FormDefaults.cssClassPrefix + 'select-group'
|
70
78
|
)}>
|
71
79
|
<ReactSelect<
|
72
80
|
Partial<SelectOption<TValue>>,
|
@@ -74,6 +82,7 @@ export default function SelectGroup<TValue>({
|
|
74
82
|
>
|
75
83
|
inputId={input.id}
|
76
84
|
isMulti={multiple}
|
85
|
+
isDisabled={disabled}
|
77
86
|
options={effectiveOptions}
|
78
87
|
onBlur={input.onBlur}
|
79
88
|
value={getValue()}
|
@@ -85,7 +94,10 @@ export default function SelectGroup<TValue>({
|
|
85
94
|
}
|
86
95
|
}}
|
87
96
|
getOptionLabel={(option) => option?.label ?? ''}
|
88
|
-
className={classNames(
|
97
|
+
className={classNames(
|
98
|
+
className,
|
99
|
+
FormDefaults.cssClassPrefix + 'select-group'
|
100
|
+
)}
|
89
101
|
classNamePrefix="react-select"
|
90
102
|
menuPortalTarget={document.body}
|
91
103
|
menuPlacement="auto"
|
@@ -4,9 +4,10 @@ exports[`BooleanSelectGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
+
class="envoc-form-form"
|
7
8
|
>
|
8
9
|
<div
|
9
|
-
class="select-group group"
|
10
|
+
class="envoc-form-select-group envoc-form-group"
|
10
11
|
>
|
11
12
|
<div
|
12
13
|
id="allowlogin-error-scroll-target"
|
@@ -18,7 +19,7 @@ exports[`BooleanSelectGroup has matching snapshot 1`] = `
|
|
18
19
|
Allow Login
|
19
20
|
</label>
|
20
21
|
<div
|
21
|
-
class="select-group css-b62m3t-container"
|
22
|
+
class="envoc-form-select-group css-b62m3t-container"
|
22
23
|
>
|
23
24
|
<span
|
24
25
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -4,9 +4,10 @@ exports[`MultiNumberSelectGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
+
class="envoc-form-form"
|
7
8
|
>
|
8
9
|
<div
|
9
|
-
class="multiple select-group group"
|
10
|
+
class="envoc-form-multiple envoc-form-select-group envoc-form-group"
|
10
11
|
>
|
11
12
|
<div
|
12
13
|
id="userroles-error-scroll-target"
|
@@ -18,7 +19,7 @@ exports[`MultiNumberSelectGroup has matching snapshot 1`] = `
|
|
18
19
|
Favorite Number
|
19
20
|
</label>
|
20
21
|
<div
|
21
|
-
class="select-group css-b62m3t-container"
|
22
|
+
class="envoc-form-select-group css-b62m3t-container"
|
22
23
|
>
|
23
24
|
<span
|
24
25
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -102,9 +103,10 @@ exports[`SingleNumberSelectGroup has matching snapshot 1`] = `
|
|
102
103
|
<DocumentFragment>
|
103
104
|
<form
|
104
105
|
action="#"
|
106
|
+
class="envoc-form-form"
|
105
107
|
>
|
106
108
|
<div
|
107
|
-
class="select-group group"
|
109
|
+
class="envoc-form-select-group envoc-form-group"
|
108
110
|
>
|
109
111
|
<div
|
110
112
|
id="favoritenumber-error-scroll-target"
|
@@ -116,7 +118,7 @@ exports[`SingleNumberSelectGroup has matching snapshot 1`] = `
|
|
116
118
|
Favorite Number
|
117
119
|
</label>
|
118
120
|
<div
|
119
|
-
class="select-group css-b62m3t-container"
|
121
|
+
class="envoc-form-select-group css-b62m3t-container"
|
120
122
|
>
|
121
123
|
<span
|
122
124
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -4,9 +4,10 @@ exports[`MultiStringSelectGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
+
class="envoc-form-form"
|
7
8
|
>
|
8
9
|
<div
|
9
|
-
class="multiple select-group group"
|
10
|
+
class="envoc-form-multiple envoc-form-select-group envoc-form-group"
|
10
11
|
>
|
11
12
|
<div
|
12
13
|
id="favoritecolors-error-scroll-target"
|
@@ -18,7 +19,7 @@ exports[`MultiStringSelectGroup has matching snapshot 1`] = `
|
|
18
19
|
Favorite Color
|
19
20
|
</label>
|
20
21
|
<div
|
21
|
-
class="select-group css-b62m3t-container"
|
22
|
+
class="envoc-form-select-group css-b62m3t-container"
|
22
23
|
>
|
23
24
|
<span
|
24
25
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -102,9 +103,10 @@ exports[`SingleStringSelectGroup has matching snapshot 1`] = `
|
|
102
103
|
<DocumentFragment>
|
103
104
|
<form
|
104
105
|
action="#"
|
106
|
+
class="envoc-form-form"
|
105
107
|
>
|
106
108
|
<div
|
107
|
-
class="select-group group"
|
109
|
+
class="envoc-form-select-group envoc-form-group"
|
108
110
|
>
|
109
111
|
<div
|
110
112
|
id="favoritecolor-error-scroll-target"
|
@@ -116,7 +118,7 @@ exports[`SingleStringSelectGroup has matching snapshot 1`] = `
|
|
116
118
|
Favorite Color
|
117
119
|
</label>
|
118
120
|
<div
|
119
|
-
class="select-group css-b62m3t-container"
|
121
|
+
class="envoc-form-select-group css-b62m3t-container"
|
120
122
|
>
|
121
123
|
<span
|
122
124
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -2,6 +2,7 @@ import { MouseEventHandler } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import { useFormikContext } from 'formik';
|
4
4
|
import SubmitFormButton from './SubmitFormButton';
|
5
|
+
import { FormDefaults } from './FormDefaults';
|
5
6
|
|
6
7
|
export interface StandardFormActionsProps {
|
7
8
|
allowPristineSubmit?: boolean;
|
@@ -19,7 +20,9 @@ export default function StandardFormActions({
|
|
19
20
|
<SubmitFormButton allowPristineSubmit={allowPristineSubmit} />
|
20
21
|
|
21
22
|
<button
|
22
|
-
className={classNames(
|
23
|
+
className={classNames(
|
24
|
+
FormDefaults.cssClassPrefix + 'standard-form-actions-cancel-button'
|
25
|
+
)}
|
23
26
|
type="button"
|
24
27
|
disabled={isSubmitting}
|
25
28
|
onClick={handleCancel || goBack}>
|
package/src/SubmitFormButton.tsx
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { LegacyRef } from 'react';
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import { useFormikContext } from 'formik';
|
4
|
+
import { FormDefaults } from './FormDefaults';
|
4
5
|
|
5
6
|
export interface SubmitFormButtonProps
|
6
7
|
extends Omit<React.HTMLProps<HTMLButtonElement>, 'type'> {
|
@@ -20,12 +21,14 @@ function SubmitFormButton(
|
|
20
21
|
) {
|
21
22
|
const { isSubmitting, dirty } = useFormikContext();
|
22
23
|
const preventSubmit = (!dirty && !allowPristineSubmit) || isSubmitting;
|
24
|
+
const buttonName = typeof children === 'string' ? children : 'Submit';
|
23
25
|
return (
|
24
26
|
<button
|
25
27
|
{...props}
|
26
28
|
ref={ref}
|
27
29
|
type="submit"
|
28
30
|
disabled={preventSubmit || disabled}
|
31
|
+
aria-label={buttonName}
|
29
32
|
title={
|
30
33
|
title || isSubmitting
|
31
34
|
? 'Loading, please wait...'
|
@@ -33,7 +36,10 @@ function SubmitFormButton(
|
|
33
36
|
? "You haven't made any changes"
|
34
37
|
: ''
|
35
38
|
}
|
36
|
-
className={classNames(
|
39
|
+
className={classNames(
|
40
|
+
FormDefaults.cssClassPrefix + 'submit-form-button',
|
41
|
+
className
|
42
|
+
)}>
|
37
43
|
{children || 'Submit'}
|
38
44
|
</button>
|
39
45
|
);
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import React, { LegacyRef } from 'react';
|
2
|
+
import classNames from 'classnames';
|
3
|
+
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
4
|
+
import Group, { GroupProps } from '../Group';
|
5
|
+
import { FormDefaults } from '../FormDefaults';
|
6
|
+
|
7
|
+
export interface TextAreaGroupProps
|
8
|
+
extends InjectedFieldProps<string | undefined>,
|
9
|
+
Omit<
|
10
|
+
React.HTMLProps<HTMLTextAreaElement>,
|
11
|
+
keyof InjectedFieldProps<any> | 'children' | 'className' | 'label'
|
12
|
+
>,
|
13
|
+
Omit<GroupProps, keyof InjectedFieldProps<any> | 'children'> {
|
14
|
+
icon?: React.ReactNode;
|
15
|
+
}
|
16
|
+
|
17
|
+
/** generic controlled <textarea/> wrapped by a Group */
|
18
|
+
function TextAreaGroup(
|
19
|
+
{
|
20
|
+
input,
|
21
|
+
meta,
|
22
|
+
label,
|
23
|
+
helpText,
|
24
|
+
className,
|
25
|
+
required,
|
26
|
+
disabled,
|
27
|
+
icon,
|
28
|
+
...rest
|
29
|
+
}: TextAreaGroupProps,
|
30
|
+
ref: LegacyRef<HTMLTextAreaElement>
|
31
|
+
) {
|
32
|
+
return (
|
33
|
+
<Group
|
34
|
+
input={input}
|
35
|
+
meta={meta}
|
36
|
+
required={required}
|
37
|
+
disabled={disabled}
|
38
|
+
label={label}
|
39
|
+
helpText={helpText}
|
40
|
+
className={classNames(
|
41
|
+
className,
|
42
|
+
FormDefaults.cssClassPrefix + 'text-area-group'
|
43
|
+
)}>
|
44
|
+
{icon}
|
45
|
+
<textarea
|
46
|
+
{...input}
|
47
|
+
{...rest}
|
48
|
+
value={input.value}
|
49
|
+
onChange={(val) => input.onChange(val.target.value)}
|
50
|
+
ref={ref}
|
51
|
+
className={classNames(
|
52
|
+
className,
|
53
|
+
FormDefaults.cssClassPrefix + 'text-area-group'
|
54
|
+
)}
|
55
|
+
/>
|
56
|
+
</Group>
|
57
|
+
);
|
58
|
+
}
|
59
|
+
|
60
|
+
const TextAreaGroupWithRef = React.forwardRef(
|
61
|
+
TextAreaGroup
|
62
|
+
) as React.ComponentType<TextAreaGroupProps>;
|
63
|
+
|
64
|
+
export default TextAreaGroupWithRef;
|
@@ -15,11 +15,11 @@ export const length = (len: number) => (value: string | number | undefined) => {
|
|
15
15
|
return !hasError ? undefined : `Length must be ${len}`;
|
16
16
|
};
|
17
17
|
|
18
|
-
export const integer = (val: string | undefined) => {
|
18
|
+
export const integer = (val: string | number | undefined) => {
|
19
19
|
if (!val) {
|
20
20
|
return undefined;
|
21
21
|
}
|
22
|
-
if (!Number.isInteger(parseFloat(val))) {
|
22
|
+
if (!Number.isInteger(typeof val === 'number' ? val : parseFloat(val))) {
|
23
23
|
return 'Must be a whole number';
|
24
24
|
}
|
25
25
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import '@testing-library/jest-dom/extend-expect';
|
2
2
|
import { HashRouter } from 'react-router-dom';
|
3
3
|
import { ValidatedApiResult } from 'Validation/ValidatedApiResult';
|
4
|
-
import {
|
4
|
+
import { Form, FormBuilderProp } from '../../src';
|
5
5
|
|
6
6
|
interface FormTestBaseProps<TForm extends object> {
|
7
7
|
children: (formBuilder: FormBuilderProp<TForm>) => JSX.Element;
|
@@ -50,8 +50,8 @@ interface PersonDto {
|
|
50
50
|
phoneNumber?: string;
|
51
51
|
yearlySalaryUSD?: number;
|
52
52
|
isCool?: boolean;
|
53
|
-
gradDate?:
|
54
|
-
favoriteDate?:
|
53
|
+
gradDate?: string;
|
54
|
+
favoriteDate?: string;
|
55
55
|
favoriteNumber?: number;
|
56
56
|
favoriteColor?: string;
|
57
57
|
favoriteColors?: string[];
|
@@ -4,9 +4,11 @@ exports[`StandardFormActions has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
+
class="envoc-form-form"
|
7
8
|
>
|
8
9
|
<button
|
9
|
-
|
10
|
+
aria-label="Submit"
|
11
|
+
class="envoc-form-submit-form-button"
|
10
12
|
disabled=""
|
11
13
|
title="You haven't made any changes"
|
12
14
|
type="submit"
|
@@ -15,7 +17,7 @@ exports[`StandardFormActions has matching snapshot 1`] = `
|
|
15
17
|
</button>
|
16
18
|
|
17
19
|
<button
|
18
|
-
class="standard-form-actions-cancel-button"
|
20
|
+
class="envoc-form-standard-form-actions-cancel-button"
|
19
21
|
type="button"
|
20
22
|
>
|
21
23
|
Cancel
|
@@ -4,9 +4,11 @@ exports[`SubmitFormButton has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
+
class="envoc-form-form"
|
7
8
|
>
|
8
9
|
<button
|
9
|
-
|
10
|
+
aria-label="Submit"
|
11
|
+
class="envoc-form-submit-form-button"
|
10
12
|
disabled=""
|
11
13
|
title="You haven't made any changes"
|
12
14
|
type="submit"
|
package/src/index.ts
CHANGED
@@ -15,19 +15,35 @@ export { default as ConfirmDeleteForm } from './ConfirmDeleteForm/ConfirmDeleteF
|
|
15
15
|
export type { ConfirmDeleteFormProps } from './ConfirmDeleteForm/ConfirmDeleteForm';
|
16
16
|
|
17
17
|
// Date
|
18
|
-
export { default as
|
19
|
-
export type {
|
18
|
+
export { default as DatePickerGroup } from './DatePicker/DatePickerGroup';
|
19
|
+
export type { DatePickerGroupProps as DatePickerGroupProps } from './DatePicker/DatePickerGroup';
|
20
|
+
export { convertToTimeZoneInsensitiveISOString } from './DatePicker/DatePickerGroup';
|
21
|
+
|
22
|
+
export type { DatePickerHelper } from './DatePicker/DatePickerHelper';
|
23
|
+
|
24
|
+
export { default as StringDatePickerGroup } from './DatePicker/StringDatePickerGroup';
|
25
|
+
export type { StringDatePickerGroupProps } from './DatePicker/StringDatePickerGroup';
|
26
|
+
|
27
|
+
export { default as StringDateOnlyPickerGroup } from './DatePicker/StringDateOnlyPickerGroup';
|
28
|
+
export type { StringDateOnlyPickerGroupProps } from './DatePicker/StringDateOnlyPickerGroup';
|
20
29
|
|
21
30
|
// Field
|
22
31
|
export { default as Field } from './Field/Field';
|
23
32
|
export type { FieldProps } from './Field/Field';
|
24
33
|
|
34
|
+
export type { RenderComponent } from './Field/Field';
|
35
|
+
export type { RenderComponentProps } from './Field/Field';
|
36
|
+
|
25
37
|
export { default as FieldErrorScrollTarget } from './Field/FieldErrorScrollTarget';
|
26
38
|
|
27
39
|
export { FieldNameContext } from './Field/FieldNameContext';
|
28
40
|
|
29
41
|
export type { InjectedFieldProps } from './Field/InjectedFieldProps';
|
30
42
|
|
43
|
+
export { default as StandAloneInput } from './Field/StandAloneInput';
|
44
|
+
|
45
|
+
export type { StandAloneInputProps } from './Field/StandAloneInput';
|
46
|
+
|
31
47
|
export { default as useStandardField } from './Field/useStandardField';
|
32
48
|
export type { useStandardFieldProps } from './Field/useStandardField';
|
33
49
|
|
@@ -54,6 +70,12 @@ export type {
|
|
54
70
|
export { default as FormActions } from './FormActions';
|
55
71
|
export type { FormActionsProps as FormActionsProps } from './FormActions';
|
56
72
|
|
73
|
+
export { default as StandardFormActions } from './StandardFormActions';
|
74
|
+
export type { StandardFormActionsProps as StandardFormActionsProps } from './StandardFormActions';
|
75
|
+
|
76
|
+
// FormDefaults
|
77
|
+
export { FormDefaults } from './FormDefaults';
|
78
|
+
|
57
79
|
// Input
|
58
80
|
export { default as Group } from './Group';
|
59
81
|
export type { GroupProps as GroupProps } from './Group';
|
@@ -79,7 +101,7 @@ export * as normalizers from './Normalization/normalizers';
|
|
79
101
|
|
80
102
|
// Select
|
81
103
|
export { default as SelectGroup } from './Select/SelectGroup';
|
82
|
-
export type { SelectGroupProps } from './Select/SelectGroup';
|
104
|
+
export type { SelectGroupProps, SelectOption } from './Select/SelectGroup';
|
83
105
|
|
84
106
|
export { BooleanSelectGroup } from './Select/BooleanSelectGroup';
|
85
107
|
export type { BooleanSelectGroupProps } from './Select/BooleanSelectGroup';
|
@@ -88,13 +110,27 @@ export {
|
|
88
110
|
MultiNumberSelectGroup,
|
89
111
|
SingleNumberSelectGroup,
|
90
112
|
} from './Select/NumberSelectGroup';
|
91
|
-
export type {
|
113
|
+
export type {
|
114
|
+
MultiNumberSelectGroupProps,
|
115
|
+
SingleNumberSelectGroupProps,
|
116
|
+
} from './Select/NumberSelectGroup';
|
117
|
+
|
118
|
+
export type { SelectGroupPropsHelper } from './Select/SelectGroupPropsHelper';
|
92
119
|
|
93
120
|
export {
|
94
121
|
MultiStringSelectGroup,
|
95
122
|
SingleStringSelectGroup,
|
96
123
|
} from './Select/StringSelectGroup';
|
97
|
-
export type {
|
124
|
+
export type {
|
125
|
+
MultiStringSelectGroupProps,
|
126
|
+
SingleStringSelectGroupProps,
|
127
|
+
} from './Select/StringSelectGroup';
|
128
|
+
|
129
|
+
// Text Area
|
130
|
+
|
131
|
+
export { default as TextAreaGroup } from './TextArea/TextAreaGroup';
|
132
|
+
|
133
|
+
export type { TextAreaGroupProps } from './TextArea/TextAreaGroup';
|
98
134
|
|
99
135
|
// Utils
|
100
136
|
export { default as objectContainsNonSerializableProperty } from './utils/objectContainsNonSerializableProperty';
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
import { DatePickerProps } from 'react-date-picker';
|
3
|
-
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
4
|
-
import { GroupProps } from '../Group';
|
5
|
-
export interface DateOnly {
|
6
|
-
year?: number;
|
7
|
-
month?: number;
|
8
|
-
day?: number;
|
9
|
-
}
|
10
|
-
declare type InjectedDate = InjectedFieldProps<DateOnly | undefined>;
|
11
|
-
export interface DatePickerInputProps extends InjectedDate, Omit<DatePickerProps, keyof InjectedDate | 'name' | 'value' | 'className'>, Omit<GroupProps, keyof InjectedDate | 'children'> {
|
12
|
-
}
|
13
|
-
export default function DatePickerInput({ input, meta, label, helpText, className, disabled, ...rest }: DatePickerInputProps): JSX.Element;
|
14
|
-
export {};
|
@@ -1,63 +0,0 @@
|
|
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 { useState } from 'react';
|
25
|
-
import DatePicker from 'react-date-picker';
|
26
|
-
import classnames from 'classnames';
|
27
|
-
import parseISO from 'date-fns/parseISO';
|
28
|
-
import Group from '../Group';
|
29
|
-
export default function DatePickerInput(_a) {
|
30
|
-
var input = _a.input, meta = _a.meta, label = _a.label, helpText = _a.helpText, className = _a.className, disabled = _a.disabled, rest = __rest(_a, ["input", "meta", "label", "helpText", "className", "disabled"]);
|
31
|
-
var _b = useState(null), displayDate = _b[0], setDisplayDate = _b[1];
|
32
|
-
function handleChange(e) {
|
33
|
-
var onChange = input.onChange;
|
34
|
-
if (onChange == null) {
|
35
|
-
return;
|
36
|
-
}
|
37
|
-
if (!e) {
|
38
|
-
onChange(undefined);
|
39
|
-
setDisplayDate(null);
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
if (e instanceof Date) {
|
43
|
-
var parsedValue = parseISO(e.toISOString().split('T')[0]);
|
44
|
-
setDisplayDate(parsedValue);
|
45
|
-
onChange({
|
46
|
-
year: e.getFullYear(),
|
47
|
-
month: e.getMonth() + 1,
|
48
|
-
day: e.getDate(),
|
49
|
-
});
|
50
|
-
}
|
51
|
-
else {
|
52
|
-
// e is instanceof Date[]
|
53
|
-
var parsedValue = parseISO(e[0].toISOString().split('T')[0]);
|
54
|
-
setDisplayDate(parsedValue);
|
55
|
-
onChange({
|
56
|
-
year: e[0].getFullYear(),
|
57
|
-
month: e[0].getMonth() + 1,
|
58
|
-
day: e[0].getDate(),
|
59
|
-
});
|
60
|
-
}
|
61
|
-
}
|
62
|
-
return (_jsx(Group, __assign({ input: input, meta: meta, label: label, helpText: helpText, className: classnames(className, 'date-picker'), disabled: disabled }, { children: _jsx(DatePicker, __assign({}, rest, { className: classnames('date-picker', className), value: displayDate, onChange: handleChange })) })));
|
63
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
import { DatePickerProps } from 'react-date-picker';
|
3
|
-
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
4
|
-
import { GroupProps } from '../Group';
|
5
|
-
export interface DateOnly {
|
6
|
-
year?: number;
|
7
|
-
month?: number;
|
8
|
-
day?: number;
|
9
|
-
}
|
10
|
-
declare type InjectedDate = InjectedFieldProps<DateOnly | undefined>;
|
11
|
-
export interface DatePickerInputProps extends InjectedDate, Omit<DatePickerProps, keyof InjectedDate | 'name' | 'value' | 'className'>, Omit<GroupProps, keyof InjectedDate | 'children'> {
|
12
|
-
}
|
13
|
-
export default function DatePickerInput({ input, meta, label, helpText, className, disabled, ...rest }: DatePickerInputProps): JSX.Element;
|
14
|
-
export {};
|
@@ -1,69 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
3
|
-
__assign = Object.assign || function(t) {
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
-
s = arguments[i];
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
-
t[p] = s[p];
|
8
|
-
}
|
9
|
-
return t;
|
10
|
-
};
|
11
|
-
return __assign.apply(this, arguments);
|
12
|
-
};
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
14
|
-
var t = {};
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
16
|
-
t[p] = s[p];
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
20
|
-
t[p[i]] = s[p[i]];
|
21
|
-
}
|
22
|
-
return t;
|
23
|
-
};
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
26
|
-
};
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
28
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
29
|
-
var react_1 = require("react");
|
30
|
-
var react_date_picker_1 = __importDefault(require("react-date-picker"));
|
31
|
-
var classnames_1 = __importDefault(require("classnames"));
|
32
|
-
var parseISO_1 = __importDefault(require("date-fns/parseISO"));
|
33
|
-
var Group_1 = __importDefault(require("../Group"));
|
34
|
-
function DatePickerInput(_a) {
|
35
|
-
var input = _a.input, meta = _a.meta, label = _a.label, helpText = _a.helpText, className = _a.className, disabled = _a.disabled, rest = __rest(_a, ["input", "meta", "label", "helpText", "className", "disabled"]);
|
36
|
-
var _b = (0, react_1.useState)(null), displayDate = _b[0], setDisplayDate = _b[1];
|
37
|
-
function handleChange(e) {
|
38
|
-
var onChange = input.onChange;
|
39
|
-
if (onChange == null) {
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
if (!e) {
|
43
|
-
onChange(undefined);
|
44
|
-
setDisplayDate(null);
|
45
|
-
return;
|
46
|
-
}
|
47
|
-
if (e instanceof Date) {
|
48
|
-
var parsedValue = (0, parseISO_1.default)(e.toISOString().split('T')[0]);
|
49
|
-
setDisplayDate(parsedValue);
|
50
|
-
onChange({
|
51
|
-
year: e.getFullYear(),
|
52
|
-
month: e.getMonth() + 1,
|
53
|
-
day: e.getDate(),
|
54
|
-
});
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
// e is instanceof Date[]
|
58
|
-
var parsedValue = (0, parseISO_1.default)(e[0].toISOString().split('T')[0]);
|
59
|
-
setDisplayDate(parsedValue);
|
60
|
-
onChange({
|
61
|
-
year: e[0].getFullYear(),
|
62
|
-
month: e[0].getMonth() + 1,
|
63
|
-
day: e[0].getDate(),
|
64
|
-
});
|
65
|
-
}
|
66
|
-
}
|
67
|
-
return ((0, jsx_runtime_1.jsx)(Group_1.default, __assign({ input: input, meta: meta, label: label, helpText: helpText, className: (0, classnames_1.default)(className, 'date-picker'), disabled: disabled }, { children: (0, jsx_runtime_1.jsx)(react_date_picker_1.default, __assign({}, rest, { className: (0, classnames_1.default)('date-picker', className), value: displayDate, onChange: handleChange })) })));
|
68
|
-
}
|
69
|
-
exports.default = DatePickerInput;
|