envoc-form 4.0.1-4 → 4.0.1-6
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/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.js +5 -2
- package/es/Field/Field.js +1 -1
- package/es/FieldArray/FieldArray.js +10 -7
- package/es/File/FileGroup.js +4 -2
- package/es/File/FileList.js +2 -1
- package/es/Form/Form.js +2 -1
- package/es/FormActions.js +5 -1
- package/es/FormDefaults.d.ts +3 -0
- package/es/FormDefaults.js +1 -0
- package/es/Group.js +6 -4
- package/es/Input/IconInputGroup.js +2 -1
- package/es/Input/InputGroup.js +2 -1
- package/es/Input/MoneyInputGroup.js +2 -1
- package/es/Input/NumberInputGroup.js +2 -1
- package/es/Input/StringInputGroup.js +2 -1
- package/es/Select/SelectGroup.js +7 -2
- package/es/StandardFormActions.js +2 -1
- package/es/SubmitFormButton.js +2 -1
- package/es/TextArea/TextAreaGroup.js +2 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- 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.js +5 -2
- package/lib/Field/Field.js +1 -1
- package/lib/FieldArray/FieldArray.js +10 -7
- package/lib/File/FileGroup.js +4 -2
- package/lib/File/FileList.js +2 -1
- package/lib/Form/Form.js +2 -1
- package/lib/FormActions.js +5 -1
- package/lib/FormDefaults.d.ts +3 -0
- package/lib/FormDefaults.js +4 -0
- package/lib/Group.js +6 -4
- package/lib/Input/IconInputGroup.js +2 -1
- package/lib/Input/InputGroup.js +2 -1
- package/lib/Input/MoneyInputGroup.js +2 -1
- package/lib/Input/NumberInputGroup.js +2 -1
- package/lib/Input/StringInputGroup.js +2 -1
- package/lib/Select/SelectGroup.js +7 -2
- package/lib/StandardFormActions.js +2 -1
- package/lib/SubmitFormButton.js +2 -1
- package/lib/TextArea/TextAreaGroup.js +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -1
- package/package.json +2 -2
- package/src/AddressInput/__snapshots__/AddressInput.test.tsx.snap +11 -11
- 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/DatePicker/DatePickerGroup.tsx +15 -4
- package/src/DatePicker/__snapshots__/DatePicker.test.tsx.snap +3 -3
- package/src/Field/Field.tsx +8 -1
- package/src/FieldArray/FieldArray.tsx +21 -9
- package/src/File/FileGroup.tsx +10 -2
- package/src/File/FileList.tsx +3 -1
- package/src/File/__snapshots__/FileGroup.test.tsx.snap +4 -4
- package/src/Form/Form.tsx +5 -1
- package/src/Form/__snapshots__/Form.test.tsx.snap +1 -1
- package/src/FormActions.tsx +8 -2
- package/src/FormDefaults.ts +1 -0
- package/src/Group.tsx +17 -6
- package/src/Input/IconInputGroup.tsx +5 -2
- package/src/Input/InputGroup.tsx +9 -2
- package/src/Input/MoneyInputGroup.tsx +5 -1
- package/src/Input/NumberInputGroup.tsx +5 -1
- package/src/Input/StringInputGroup.tsx +5 -1
- package/src/Input/__Tests__/__snapshots__/IconInputGroup.test.tsx.snap +3 -3
- package/src/Input/__Tests__/__snapshots__/MoneyInputGroup.test.tsx.snap +3 -3
- package/src/Input/__Tests__/__snapshots__/NumberInputGroup.test.tsx.snap +3 -3
- package/src/Input/__Tests__/__snapshots__/StringInputGroup.test.tsx.snap +3 -3
- package/src/Select/SelectGroup.tsx +10 -3
- package/src/Select/__tests__/__snapshots__/BooleanSelectGroup.test.tsx.snap +3 -3
- package/src/Select/__tests__/__snapshots__/NumberSelectGroup.test.tsx.snap +6 -6
- package/src/Select/__tests__/__snapshots__/StringSelectGroup.test.tsx.snap +6 -6
- package/src/StandardFormActions.tsx +4 -1
- package/src/SubmitFormButton.tsx +5 -1
- package/src/TextArea/TextAreaGroup.tsx +9 -2
- package/src/__Tests__/__snapshots__/StandardFormActions.test.tsx.snap +3 -3
- package/src/__Tests__/__snapshots__/SubmitFormButton.test.tsx.snap +2 -2
- package/src/index.ts +3 -0
package/src/File/FileGroup.tsx
CHANGED
@@ -3,6 +3,7 @@ import classNames from 'classnames';
|
|
3
3
|
import FileList from './FileList';
|
4
4
|
import { InjectedFieldProps } from '../Field/InjectedFieldProps';
|
5
5
|
import Group, { GroupProps } from '../Group';
|
6
|
+
import { FormDefaults } from '../FormDefaults';
|
6
7
|
|
7
8
|
export interface FileGroupProps
|
8
9
|
// note: file props are of type "any" with the current type generation
|
@@ -33,7 +34,11 @@ function FileGroup(
|
|
33
34
|
meta={meta}
|
34
35
|
label={label}
|
35
36
|
helpText={helpText}
|
36
|
-
className={classNames(
|
37
|
+
className={classNames(
|
38
|
+
className,
|
39
|
+
{ [FormDefaults.cssClassPrefix + 'multiple']: multiple },
|
40
|
+
FormDefaults.cssClassPrefix + 'file-group'
|
41
|
+
)}>
|
37
42
|
<input
|
38
43
|
{...input}
|
39
44
|
{...rest}
|
@@ -56,7 +61,10 @@ function FileGroup(
|
|
56
61
|
value={undefined}
|
57
62
|
ref={ref}
|
58
63
|
type="file"
|
59
|
-
className={classNames(
|
64
|
+
className={classNames(
|
65
|
+
className,
|
66
|
+
FormDefaults.cssClassPrefix + 'file-group'
|
67
|
+
)}
|
60
68
|
/>
|
61
69
|
{/* Note: because input.value is any - due to how files are currently handled - type safeness isn't great here */}
|
62
70
|
<FileList files={input.value} />
|
package/src/File/FileList.tsx
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
import { FormDefaults } from '../FormDefaults';
|
2
|
+
|
1
3
|
export interface FileListProps {
|
2
4
|
files?: File | File[] | undefined;
|
3
5
|
rejectedFiles?: File | File[] | undefined;
|
4
6
|
}
|
5
7
|
export default function FileList({ files, rejectedFiles }: FileListProps) {
|
6
8
|
return (
|
7
|
-
<div className=
|
9
|
+
<div className={FormDefaults.cssClassPrefix + 'file-list'}>
|
8
10
|
{!files ? null : Array.isArray(files) ? (
|
9
11
|
files.map((x, i) => <File file={x} key={i} />)
|
10
12
|
) : (
|
@@ -4,10 +4,10 @@ exports[`FileGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="file-group group"
|
10
|
+
class="envoc-form-file-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="profileimage-error-scroll-target"
|
@@ -19,14 +19,14 @@ exports[`FileGroup has matching snapshot 1`] = `
|
|
19
19
|
Profile Image
|
20
20
|
</label>
|
21
21
|
<input
|
22
|
-
class="file-group"
|
22
|
+
class="envoc-form-file-group"
|
23
23
|
id="profileImage"
|
24
24
|
name="profileImage"
|
25
25
|
type="file"
|
26
26
|
value=""
|
27
27
|
/>
|
28
28
|
<div
|
29
|
-
class="file-list"
|
29
|
+
class="envoc-form-file-list"
|
30
30
|
/>
|
31
31
|
</div>
|
32
32
|
</form>
|
package/src/Form/Form.tsx
CHANGED
@@ -25,6 +25,7 @@ import objectContainsNonSerializableProperty from '../utils/objectContainsNonSer
|
|
25
25
|
import objectToFormData from '../utils/objectToFormData';
|
26
26
|
import { ValidatedApiResult } from '../Validation/ValidatedApiResult';
|
27
27
|
import { ValidationError } from '../Validation/ValidationError';
|
28
|
+
import { FormDefaults } from '../FormDefaults';
|
28
29
|
|
29
30
|
// This exposes the builder that ensures only "name" values on the given TForm can be used
|
30
31
|
// Further, each Field can then infer the proper type given the name
|
@@ -94,7 +95,10 @@ export default function Form<TForm extends object>({
|
|
94
95
|
{...props}>
|
95
96
|
<ServerErrorContext.Provider value={serverErrorContextValue}>
|
96
97
|
<FormikFormWrapper
|
97
|
-
className={classNames(
|
98
|
+
className={classNames(
|
99
|
+
className,
|
100
|
+
FormDefaults.cssClassPrefix + 'form'
|
101
|
+
)}
|
98
102
|
style={style}>
|
99
103
|
<FocusError serverErrors={serverErrorContextValue} />
|
100
104
|
<FormBasedPreventNavigation ignoreLostChanges={ignoreLostChanges} />
|
package/src/FormActions.tsx
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { FormDefaults } from './FormDefaults';
|
1
2
|
import { useFormikContext } from 'formik';
|
2
3
|
import SubmitFormButton from './SubmitFormButton';
|
3
4
|
|
@@ -15,13 +16,18 @@ export default function FormActions({
|
|
15
16
|
return (
|
16
17
|
<>
|
17
18
|
<SubmitFormButton
|
18
|
-
className=
|
19
|
+
className={FormDefaults.cssClassPrefix + 'form-actions'}
|
19
20
|
allowPristineSubmit={allowPristineSubmit}
|
20
21
|
disabled={disabled}
|
21
22
|
/>
|
22
23
|
<button
|
23
24
|
type="button"
|
24
|
-
className=
|
25
|
+
className={
|
26
|
+
FormDefaults.cssClassPrefix +
|
27
|
+
'form-actions ' +
|
28
|
+
FormDefaults.cssClassPrefix +
|
29
|
+
'cancel-form-button'
|
30
|
+
}
|
25
31
|
disabled={isSubmitting || disabled}
|
26
32
|
onClick={handleCancel || goBack}>
|
27
33
|
Cancel
|
@@ -0,0 +1 @@
|
|
1
|
+
export const FormDefaults = { cssClassPrefix: 'envoc-form-' };
|
package/src/Group.tsx
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import classNames from 'classnames';
|
2
|
+
import { FormDefaults } from './FormDefaults';
|
2
3
|
import FieldErrorScrollTarget from './Field/FieldErrorScrollTarget';
|
3
4
|
import { InjectedFieldProps } from './Field/InjectedFieldProps';
|
4
5
|
|
@@ -28,16 +29,26 @@ export default function Group({
|
|
28
29
|
}: GroupProps) {
|
29
30
|
return (
|
30
31
|
<div
|
31
|
-
className={classNames(className, 'group', {
|
32
|
-
'
|
33
|
-
disabled: disabled,
|
32
|
+
className={classNames(className, FormDefaults.cssClassPrefix + 'group', {
|
33
|
+
[FormDefaults.cssClassPrefix + 'invalid']: meta.error,
|
34
|
+
[FormDefaults.cssClassPrefix + 'disabled']: disabled,
|
34
35
|
})}>
|
35
36
|
<FieldErrorScrollTarget />
|
36
|
-
{meta.warning &&
|
37
|
+
{meta.warning && (
|
38
|
+
<div className={FormDefaults.cssClassPrefix + 'warning'}>
|
39
|
+
{meta.warning}
|
40
|
+
</div>
|
41
|
+
)}
|
37
42
|
<label htmlFor={input.id}>{label}</label>
|
38
43
|
{children}
|
39
|
-
{meta.error &&
|
40
|
-
|
44
|
+
{meta.error && (
|
45
|
+
<div className={FormDefaults.cssClassPrefix + 'error'}>
|
46
|
+
{meta.error}
|
47
|
+
</div>
|
48
|
+
)}
|
49
|
+
{helpText && (
|
50
|
+
<div className={FormDefaults.cssClassPrefix + 'help'}>{helpText}</div>
|
51
|
+
)}
|
41
52
|
</div>
|
42
53
|
);
|
43
54
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { LegacyRef } from 'react';
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import InputGroupWithRef, { InputGroupProps } from './InputGroup';
|
4
|
-
import
|
4
|
+
import { FormDefaults } from '../FormDefaults';
|
5
5
|
|
6
6
|
// TODO: make className tailwind-able instead of css. make it typeof string ????
|
7
7
|
// or should we just give a div a className and let each project decide? (this seems to be the patern)
|
@@ -26,7 +26,10 @@ function IconInputGroup(
|
|
26
26
|
<InputGroupWithRef
|
27
27
|
icon={icon}
|
28
28
|
ref={ref}
|
29
|
-
className={classNames(
|
29
|
+
className={classNames(
|
30
|
+
className,
|
31
|
+
FormDefaults.cssClassPrefix + 'icon-input-group'
|
32
|
+
)}
|
30
33
|
value={input.value || ''}
|
31
34
|
onChange={(e) => {
|
32
35
|
if (!e.target.value) {
|
package/src/Input/InputGroup.tsx
CHANGED
@@ -2,6 +2,7 @@ import React, { ChangeEventHandler, LegacyRef } from 'react';
|
|
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 InputGroupProps<TValue>
|
7
8
|
extends InjectedFieldProps<TValue>,
|
@@ -38,7 +39,10 @@ function InputGroup<TValue>(
|
|
38
39
|
disabled={disabled}
|
39
40
|
label={label}
|
40
41
|
helpText={helpText}
|
41
|
-
className={classNames(
|
42
|
+
className={classNames(
|
43
|
+
className,
|
44
|
+
FormDefaults.cssClassPrefix + 'input-group'
|
45
|
+
)}>
|
42
46
|
{icon}
|
43
47
|
<input
|
44
48
|
{...input}
|
@@ -46,7 +50,10 @@ function InputGroup<TValue>(
|
|
46
50
|
value={value}
|
47
51
|
onChange={onChange}
|
48
52
|
ref={ref}
|
49
|
-
className={classNames(
|
53
|
+
className={classNames(
|
54
|
+
className,
|
55
|
+
FormDefaults.cssClassPrefix + 'input-group'
|
56
|
+
)}
|
50
57
|
/>
|
51
58
|
</Group>
|
52
59
|
);
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { LegacyRef } from 'react';
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import InputGroup, { InputGroupProps } from './InputGroup';
|
4
|
+
import { FormDefaults } from '../FormDefaults';
|
4
5
|
|
5
6
|
export interface MoneyInputGroupProps
|
6
7
|
extends Omit<
|
@@ -24,7 +25,10 @@ function MoneyInputGroup(
|
|
24
25
|
min={0}
|
25
26
|
{...rest}
|
26
27
|
type="number"
|
27
|
-
className={classNames(
|
28
|
+
className={classNames(
|
29
|
+
className,
|
30
|
+
FormDefaults.cssClassPrefix + 'money-group'
|
31
|
+
)}
|
28
32
|
value={input.value || ''}
|
29
33
|
onChange={(e) => {
|
30
34
|
if (!e.target.value) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { LegacyRef } from 'react';
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import InputGroup, { InputGroupProps } from './InputGroup';
|
4
|
+
import { FormDefaults } from '../FormDefaults';
|
4
5
|
|
5
6
|
export interface NumberInputGroupProps
|
6
7
|
extends Omit<
|
@@ -22,7 +23,10 @@ function NumberInputGroup(
|
|
22
23
|
ref={ref}
|
23
24
|
{...rest}
|
24
25
|
type="number"
|
25
|
-
className={classNames(
|
26
|
+
className={classNames(
|
27
|
+
className,
|
28
|
+
FormDefaults.cssClassPrefix + 'number-group'
|
29
|
+
)}
|
26
30
|
value={input.value || ''}
|
27
31
|
onChange={(e) => {
|
28
32
|
if (!e.target.value) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { LegacyRef } from 'react';
|
2
2
|
import classNames from 'classnames';
|
3
3
|
import InputGroup, { InputGroupProps } from './InputGroup';
|
4
|
+
import { FormDefaults } from '../FormDefaults';
|
4
5
|
|
5
6
|
export interface StringInputGroupProps
|
6
7
|
extends Omit<
|
@@ -28,7 +29,10 @@ function StringInputGroup(
|
|
28
29
|
<InputGroup
|
29
30
|
ref={ref}
|
30
31
|
{...rest}
|
31
|
-
className={classNames(
|
32
|
+
className={classNames(
|
33
|
+
className,
|
34
|
+
FormDefaults.cssClassPrefix + 'string-group'
|
35
|
+
)}
|
32
36
|
value={input.value || ''}
|
33
37
|
onChange={(e) => {
|
34
38
|
if (!e.target.value) {
|
@@ -4,10 +4,10 @@ exports[`IconInputGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="icon-input-group input-group group"
|
10
|
+
class="envoc-form-icon-input-group envoc-form-input-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="namewithicon-error-scroll-target"
|
@@ -20,7 +20,7 @@ exports[`IconInputGroup has matching snapshot 1`] = `
|
|
20
20
|
Pretend this is an icon
|
21
21
|
</span>
|
22
22
|
<input
|
23
|
-
class="icon-input-group input-group"
|
23
|
+
class="envoc-form-icon-input-group envoc-form-input-group"
|
24
24
|
id="nameWithIcon"
|
25
25
|
name="nameWithIcon"
|
26
26
|
value=""
|
@@ -4,10 +4,10 @@ exports[`MoneyInputGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="something-here money-group input-group group"
|
10
|
+
class="something-here envoc-form-money-group envoc-form-input-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="yearlysalaryusd-error-scroll-target"
|
@@ -19,7 +19,7 @@ exports[`MoneyInputGroup has matching snapshot 1`] = `
|
|
19
19
|
Salary
|
20
20
|
</label>
|
21
21
|
<input
|
22
|
-
class="something-here money-group input-group"
|
22
|
+
class="something-here envoc-form-money-group envoc-form-input-group"
|
23
23
|
id="yearlySalaryUSD"
|
24
24
|
min="0"
|
25
25
|
name="yearlySalaryUSD"
|
@@ -4,10 +4,10 @@ exports[`NumberInputGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="number-group input-group group"
|
10
|
+
class="envoc-form-number-group envoc-form-input-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="numberofarms-error-scroll-target"
|
@@ -19,7 +19,7 @@ exports[`NumberInputGroup has matching snapshot 1`] = `
|
|
19
19
|
Arm Count
|
20
20
|
</label>
|
21
21
|
<input
|
22
|
-
class="number-group input-group"
|
22
|
+
class="envoc-form-number-group envoc-form-input-group"
|
23
23
|
id="numberOfArms"
|
24
24
|
name="numberOfArms"
|
25
25
|
type="number"
|
@@ -4,10 +4,10 @@ exports[`StringInputGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="string-group input-group group"
|
10
|
+
class="envoc-form-string-group envoc-form-input-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="name-error-scroll-target"
|
@@ -19,7 +19,7 @@ exports[`StringInputGroup has matching snapshot 1`] = `
|
|
19
19
|
Name
|
20
20
|
</label>
|
21
21
|
<input
|
22
|
-
class="string-group input-group"
|
22
|
+
class="envoc-form-string-group envoc-form-input-group"
|
23
23
|
id="name"
|
24
24
|
name="name"
|
25
25
|
value=""
|
@@ -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;
|
@@ -65,8 +66,11 @@ export default function SelectGroup<TValue>({
|
|
65
66
|
meta={meta}
|
66
67
|
className={classNames(
|
67
68
|
className,
|
68
|
-
{
|
69
|
-
|
69
|
+
{
|
70
|
+
[FormDefaults.cssClassPrefix + 'multiple']: multiple,
|
71
|
+
[FormDefaults.cssClassPrefix + 'loading']: isLoading,
|
72
|
+
},
|
73
|
+
FormDefaults.cssClassPrefix + 'select-group'
|
70
74
|
)}>
|
71
75
|
<ReactSelect<
|
72
76
|
Partial<SelectOption<TValue>>,
|
@@ -85,7 +89,10 @@ export default function SelectGroup<TValue>({
|
|
85
89
|
}
|
86
90
|
}}
|
87
91
|
getOptionLabel={(option) => option?.label ?? ''}
|
88
|
-
className={classNames(
|
92
|
+
className={classNames(
|
93
|
+
className,
|
94
|
+
FormDefaults.cssClassPrefix + 'select-group'
|
95
|
+
)}
|
89
96
|
classNamePrefix="react-select"
|
90
97
|
menuPortalTarget={document.body}
|
91
98
|
menuPlacement="auto"
|
@@ -4,10 +4,10 @@ exports[`BooleanSelectGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="select-group group"
|
10
|
+
class="envoc-form-select-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="allowlogin-error-scroll-target"
|
@@ -19,7 +19,7 @@ exports[`BooleanSelectGroup has matching snapshot 1`] = `
|
|
19
19
|
Allow Login
|
20
20
|
</label>
|
21
21
|
<div
|
22
|
-
class="select-group css-b62m3t-container"
|
22
|
+
class="envoc-form-select-group css-b62m3t-container"
|
23
23
|
>
|
24
24
|
<span
|
25
25
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -4,10 +4,10 @@ exports[`MultiNumberSelectGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="multiple select-group group"
|
10
|
+
class="envoc-form-multiple envoc-form-select-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="userroles-error-scroll-target"
|
@@ -19,7 +19,7 @@ exports[`MultiNumberSelectGroup has matching snapshot 1`] = `
|
|
19
19
|
Favorite Number
|
20
20
|
</label>
|
21
21
|
<div
|
22
|
-
class="select-group css-b62m3t-container"
|
22
|
+
class="envoc-form-select-group css-b62m3t-container"
|
23
23
|
>
|
24
24
|
<span
|
25
25
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -103,10 +103,10 @@ exports[`SingleNumberSelectGroup has matching snapshot 1`] = `
|
|
103
103
|
<DocumentFragment>
|
104
104
|
<form
|
105
105
|
action="#"
|
106
|
-
class="form"
|
106
|
+
class="envoc-form-form"
|
107
107
|
>
|
108
108
|
<div
|
109
|
-
class="select-group group"
|
109
|
+
class="envoc-form-select-group envoc-form-group"
|
110
110
|
>
|
111
111
|
<div
|
112
112
|
id="favoritenumber-error-scroll-target"
|
@@ -118,7 +118,7 @@ exports[`SingleNumberSelectGroup has matching snapshot 1`] = `
|
|
118
118
|
Favorite Number
|
119
119
|
</label>
|
120
120
|
<div
|
121
|
-
class="select-group css-b62m3t-container"
|
121
|
+
class="envoc-form-select-group css-b62m3t-container"
|
122
122
|
>
|
123
123
|
<span
|
124
124
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -4,10 +4,10 @@ exports[`MultiStringSelectGroup has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<div
|
10
|
-
class="multiple select-group group"
|
10
|
+
class="envoc-form-multiple envoc-form-select-group envoc-form-group"
|
11
11
|
>
|
12
12
|
<div
|
13
13
|
id="favoritecolors-error-scroll-target"
|
@@ -19,7 +19,7 @@ exports[`MultiStringSelectGroup has matching snapshot 1`] = `
|
|
19
19
|
Favorite Color
|
20
20
|
</label>
|
21
21
|
<div
|
22
|
-
class="select-group css-b62m3t-container"
|
22
|
+
class="envoc-form-select-group css-b62m3t-container"
|
23
23
|
>
|
24
24
|
<span
|
25
25
|
class="css-1f43avz-a11yText-A11yText"
|
@@ -103,10 +103,10 @@ exports[`SingleStringSelectGroup has matching snapshot 1`] = `
|
|
103
103
|
<DocumentFragment>
|
104
104
|
<form
|
105
105
|
action="#"
|
106
|
-
class="form"
|
106
|
+
class="envoc-form-form"
|
107
107
|
>
|
108
108
|
<div
|
109
|
-
class="select-group group"
|
109
|
+
class="envoc-form-select-group envoc-form-group"
|
110
110
|
>
|
111
111
|
<div
|
112
112
|
id="favoritecolor-error-scroll-target"
|
@@ -118,7 +118,7 @@ exports[`SingleStringSelectGroup has matching snapshot 1`] = `
|
|
118
118
|
Favorite Color
|
119
119
|
</label>
|
120
120
|
<div
|
121
|
-
class="select-group css-b62m3t-container"
|
121
|
+
class="envoc-form-select-group css-b62m3t-container"
|
122
122
|
>
|
123
123
|
<span
|
124
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'> {
|
@@ -33,7 +34,10 @@ function SubmitFormButton(
|
|
33
34
|
? "You haven't made any changes"
|
34
35
|
: ''
|
35
36
|
}
|
36
|
-
className={classNames(
|
37
|
+
className={classNames(
|
38
|
+
FormDefaults.cssClassPrefix + 'submit-form-button',
|
39
|
+
className
|
40
|
+
)}>
|
37
41
|
{children || 'Submit'}
|
38
42
|
</button>
|
39
43
|
);
|
@@ -2,6 +2,7 @@ import React, { LegacyRef } from 'react';
|
|
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 TextAreaGroupProps
|
7
8
|
extends InjectedFieldProps<string | undefined>,
|
@@ -34,7 +35,10 @@ function TextAreaGroup(
|
|
34
35
|
disabled={disabled}
|
35
36
|
label={label}
|
36
37
|
helpText={helpText}
|
37
|
-
className={classNames(
|
38
|
+
className={classNames(
|
39
|
+
className,
|
40
|
+
FormDefaults.cssClassPrefix + 'text-area-group'
|
41
|
+
)}>
|
38
42
|
{icon}
|
39
43
|
<textarea
|
40
44
|
{...input}
|
@@ -42,7 +46,10 @@ function TextAreaGroup(
|
|
42
46
|
value={input.value}
|
43
47
|
onChange={(val) => input.onChange(val.target.value)}
|
44
48
|
ref={ref}
|
45
|
-
className={classNames(
|
49
|
+
className={classNames(
|
50
|
+
className,
|
51
|
+
FormDefaults.cssClassPrefix + 'text-area-group'
|
52
|
+
)}
|
46
53
|
/>
|
47
54
|
</Group>
|
48
55
|
);
|
@@ -4,10 +4,10 @@ exports[`StandardFormActions has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<button
|
10
|
-
class="submit-form-button"
|
10
|
+
class="envoc-form-submit-form-button"
|
11
11
|
disabled=""
|
12
12
|
title="You haven't made any changes"
|
13
13
|
type="submit"
|
@@ -16,7 +16,7 @@ exports[`StandardFormActions has matching snapshot 1`] = `
|
|
16
16
|
</button>
|
17
17
|
|
18
18
|
<button
|
19
|
-
class="standard-form-actions-cancel-button"
|
19
|
+
class="envoc-form-standard-form-actions-cancel-button"
|
20
20
|
type="button"
|
21
21
|
>
|
22
22
|
Cancel
|
@@ -4,10 +4,10 @@ exports[`SubmitFormButton has matching snapshot 1`] = `
|
|
4
4
|
<DocumentFragment>
|
5
5
|
<form
|
6
6
|
action="#"
|
7
|
-
class="form"
|
7
|
+
class="envoc-form-form"
|
8
8
|
>
|
9
9
|
<button
|
10
|
-
class="submit-form-button"
|
10
|
+
class="envoc-form-submit-form-button"
|
11
11
|
disabled=""
|
12
12
|
title="You haven't made any changes"
|
13
13
|
type="submit"
|
package/src/index.ts
CHANGED
@@ -76,6 +76,9 @@ export type { FormActionsProps as FormActionsProps } from './FormActions';
|
|
76
76
|
export { default as StandardFormActions } from './StandardFormActions';
|
77
77
|
export type { StandardFormActionsProps as StandardFormActionsProps } from './StandardFormActions';
|
78
78
|
|
79
|
+
// FormDefaults
|
80
|
+
export { FormDefaults } from './FormDefaults';
|
81
|
+
|
79
82
|
// Input
|
80
83
|
export { default as Group } from './Group';
|
81
84
|
export type { GroupProps as GroupProps } from './Group';
|