@nwon/react-mui-hook-form 1.0.16 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/errors/FormFieldError.d.ts +9 -0
- package/dist/errors/FormFieldErrorDisplay.d.ts +9 -0
- package/dist/formFields/InputEmail/InputEmail.d.ts +2 -2
- package/dist/formFields/baseTypes/{InputText/InputText.d.ts → InputOutlinedInput/InputOutlinedInput.d.ts} +3 -3
- package/dist/formFields/baseTypes/InputText/InputTextField.d.ts +14 -0
- package/dist/formFields/formHelper/{getFormError.d.ts → getFormErrorForNestedKeys.d.ts} +1 -1
- package/dist/formFields/index.d.ts +11 -9
- package/dist/packageExports.d.ts +4 -2
- package/dist/packageExports.js +272 -197
- package/dist/packageExports.js.map +1 -1
- package/package.json +79 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FieldError } from "react-hook-form";
|
|
3
|
+
/**
|
|
4
|
+
* Renders field errors in an opinionated way.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare const FormFieldErrorDisplay: ({ error, }: {
|
|
8
|
+
error: FieldError | FieldError[] | undefined;
|
|
9
|
+
}) => JSX.Element | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { InputOutlinedInputProps } from "../baseTypes/InputOutlinedInput/InputOutlinedInput";
|
|
3
3
|
import { FormField } from "../inputTypes";
|
|
4
4
|
export interface InputEmailProps {
|
|
5
5
|
formField: FormField;
|
|
6
|
-
|
|
6
|
+
outlinedInputProps?: InputOutlinedInputProps["outlinedInputProps"];
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Renders a MUI input for an email address that is embedded in a react hook form context.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { OutlinedInputProps } from "@mui/material";
|
|
3
3
|
import { FormField } from "../../inputTypes";
|
|
4
|
-
export interface
|
|
4
|
+
export interface InputOutlinedInputProps {
|
|
5
5
|
formField: FormField;
|
|
6
|
-
|
|
6
|
+
outlinedInputProps?: Omit<OutlinedInputProps, "required" | "label">;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Renders a MUI input text fields that is embedded in a react
|
|
@@ -11,4 +11,4 @@ export interface InputTextProps {
|
|
|
11
11
|
*
|
|
12
12
|
* @throws Error when FormContext is null.
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const InputOutlinedInput: ({ formField, outlinedInputProps, }: InputOutlinedInputProps) => JSX.Element | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextFieldProps } from "@mui/material";
|
|
3
|
+
import { FormField } from "../../inputTypes";
|
|
4
|
+
export interface InputTextFieldProps {
|
|
5
|
+
formField: FormField;
|
|
6
|
+
textFieldProps?: Omit<TextFieldProps, "required" | "label">;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders a MUI input text fields that is embedded in a react
|
|
10
|
+
* hook form context.
|
|
11
|
+
*
|
|
12
|
+
* @throws Error when FormContext is null.
|
|
13
|
+
*/
|
|
14
|
+
export declare const InputTextField: ({ formField, textFieldProps, }: InputTextFieldProps) => JSX.Element | null;
|
|
@@ -8,4 +8,4 @@ import { FieldError, FormState } from "react-hook-form";
|
|
|
8
8
|
*
|
|
9
9
|
* Did not find a built-in way to do this … there might be one though.
|
|
10
10
|
*/
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const getFormErrorForNestedKeys: (errors: FormState<AnyObject>["errors"], fieldName: string) => FieldError | FieldError[] | undefined;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export { HookFormProvider } from "./HookFormProvider";
|
|
2
|
-
export { InputEmail } from "./InputEmail/InputEmail";
|
|
3
|
-
export type { InputEmailProps } from "./InputEmail/InputEmail";
|
|
4
|
-
export { InputPasswordSet } from "./InputPasswordSet/InputPasswordSet";
|
|
5
|
-
export type { InputPasswordSetProps } from "./InputPasswordSet/InputPasswordSetInterfaces";
|
|
6
|
-
export type { TranslatedString } from "./TranslatedString";
|
|
7
1
|
export { InputAutocomplete } from "./baseTypes/InputAutocomplete/InputAutocomplete";
|
|
8
2
|
export type { InputAutocompleteProps } from "./baseTypes/InputAutocomplete/InputAutocompleteInterfaces";
|
|
9
3
|
export { InputCheckbox } from "./baseTypes/InputCheckbox/InputCheckbox";
|
|
@@ -12,15 +6,17 @@ export { InputDatePicker } from "./baseTypes/InputDatePicker/InputDatePicker";
|
|
|
12
6
|
export type { InputDatePickerProps } from "./baseTypes/InputDatePicker/InputDatePicker";
|
|
13
7
|
export { InputDateTimePicker } from "./baseTypes/InputDateTimePicker/InputDateTimePicker";
|
|
14
8
|
export type { InputDateTimePickerProps } from "./baseTypes/InputDateTimePicker/InputDateTimePicker";
|
|
9
|
+
export { InputOutlinedInput, InputOutlinedInput as InputText, } from "./baseTypes/InputOutlinedInput/InputOutlinedInput";
|
|
10
|
+
export type { InputOutlinedInputProps, InputOutlinedInputProps as InputTextProps, } from "./baseTypes/InputOutlinedInput/InputOutlinedInput";
|
|
15
11
|
export { InputRadio } from "./baseTypes/InputRadio/InputRadio";
|
|
16
12
|
export type { InputRadioProps } from "./baseTypes/InputRadio/InputRadio";
|
|
17
13
|
export { InputSelect } from "./baseTypes/InputSelect/InputSelect";
|
|
18
14
|
export type { InputSelectProps } from "./baseTypes/InputSelect/InputSelect";
|
|
19
15
|
export { InputSelectFromEnum } from "./baseTypes/InputSelectFromEnum/InputSelectFromEnum";
|
|
20
16
|
export type { InputSelectFromEnumProps } from "./baseTypes/InputSelectFromEnum/InputSelectFromEnumInterfaces";
|
|
21
|
-
export {
|
|
22
|
-
export type {
|
|
23
|
-
export { getFormError } from "./formHelper/
|
|
17
|
+
export { InputTextField } from "./baseTypes/InputText/InputTextField";
|
|
18
|
+
export type { InputTextFieldProps } from "./baseTypes/InputText/InputTextField";
|
|
19
|
+
export { getFormErrorForNestedKeys as getFormError } from "./formHelper/getFormErrorForNestedKeys";
|
|
24
20
|
export { syncSubmit } from "./formHelper/syncSubmit";
|
|
25
21
|
export type { FormSubmitHandler, FormSubmitHandlerAsync, } from "./formHelper/syncSubmit";
|
|
26
22
|
export { useHookForm } from "./formHelper/useHookForm";
|
|
@@ -29,4 +25,10 @@ export { useHookFormContext } from "./formHelper/useHookFormContext";
|
|
|
29
25
|
export { useMergedFormField } from "./formHelper/useMergedFormField";
|
|
30
26
|
export { useSortedOptionsWithGroup } from "./formHelper/useSortedOptionsWithGroup";
|
|
31
27
|
export { useTranslateString } from "./formHelper/useTranslateString";
|
|
28
|
+
export { HookFormProvider } from "./HookFormProvider";
|
|
29
|
+
export { InputEmail } from "./InputEmail/InputEmail";
|
|
30
|
+
export type { InputEmailProps } from "./InputEmail/InputEmail";
|
|
31
|
+
export { InputPasswordSet } from "./InputPasswordSet/InputPasswordSet";
|
|
32
|
+
export type { InputPasswordSetProps } from "./InputPasswordSet/InputPasswordSetInterfaces";
|
|
32
33
|
export type { FormField, FormFieldTranslated, LabeledValue, LabeledValueWithGrouping, TranslatedValidate, } from "./inputTypes";
|
|
34
|
+
export type { TranslatedString } from "./TranslatedString";
|
package/dist/packageExports.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This is the main package file, containing everything that our package exports.
|
|
3
3
|
*/
|
|
4
|
+
export { FormFieldError } from "./errors/FormFieldError";
|
|
5
|
+
export { FormFieldErrorDisplay } from "./errors/FormFieldErrorDisplay";
|
|
6
|
+
export { HookFormProvider, InputAutocomplete, InputCheckbox, InputDatePicker, InputDateTimePicker, InputEmail, InputOutlinedInput, InputPasswordSet, InputRadio, InputSelect, InputSelectFromEnum, InputText, InputTextField, getFormError, syncSubmit, useHookForm, useHookFormContext, useMergedFormField, useSortedOptionsWithGroup, useTranslateString, } from "./formFields";
|
|
7
|
+
export type { FieldNameGetter, FormField, FormFieldTranslated, FormReturn, FormSubmitHandler, FormSubmitHandlerAsync, InputAutocompleteProps, InputCheckboxProps, InputDatePickerProps, InputDateTimePickerProps, InputEmailProps, InputOutlinedInputProps, InputPasswordSetProps, InputRadioProps, InputSelectFromEnumProps, InputSelectProps, InputTextFieldProps, InputTextProps, LabeledValue, LabeledValueWithGrouping, TranslatedString, TranslatedValidate, } from "./formFields/";
|
|
4
8
|
export { LoadingButton, LoadingButtonState, loadingButtonStateFromFormState, loadingButtonStateFromReactQueryMutationStatus, useLoadingButtonStateFromFormContext, } from "./LoadingButton";
|
|
5
9
|
export type { LoadingButtonProps } from "./LoadingButton";
|
|
6
|
-
export { HookFormProvider, InputAutocomplete, InputCheckbox, InputDatePicker, InputDateTimePicker, InputEmail, InputPasswordSet, InputRadio, InputSelect, InputSelectFromEnum, InputText, getFormError, syncSubmit, useHookForm, useHookFormContext, useMergedFormField, useSortedOptionsWithGroup, useTranslateString, } from "./formFields";
|
|
7
|
-
export type { FieldNameGetter, FormField, FormFieldTranslated, FormReturn, FormSubmitHandler, FormSubmitHandlerAsync, InputAutocompleteProps, InputCheckboxProps, InputDatePickerProps, InputDateTimePickerProps, InputEmailProps, InputPasswordSetProps, InputRadioProps, InputSelectFromEnumProps, InputSelectProps, InputTextProps, LabeledValue, LabeledValueWithGrouping, TranslatedString, TranslatedValidate, } from "./formFields/";
|
package/dist/packageExports.js
CHANGED
|
@@ -9,88 +9,16 @@ function ___$insertStyle(css) {
|
|
|
9
9
|
return css;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { useFormContext, useFormState, Controller, useForm, FormProvider } from 'react-hook-form';
|
|
13
|
+
import { FormHelperText, useFormControl, Checkbox, FormControl, Autocomplete, TextField, FormControlLabel, Box, InputLabel, OutlinedInput, FormLabel, RadioGroup, Radio, Select, MenuItem, Stack, Tooltip, ListSubheader } from '@mui/material';
|
|
14
|
+
import { filterNoUndefinedNoNull, uppercaseFirstLetter, assertTruthy, objectHasKey, rethrow } from '@nvon/baseline';
|
|
13
15
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
import {
|
|
15
|
-
import { useFormControl, FormControl, InputLabel, OutlinedInput, FormHelperText, Checkbox, Autocomplete, TextField, FormControlLabel, Box, FormLabel, RadioGroup, Radio, Select, MenuItem, Stack, Tooltip, ListSubheader } from '@mui/material';
|
|
16
|
-
import { uppercaseFirstLetter, assertTruthy, objectHasKey, rethrow } from '@nvon/baseline';
|
|
16
|
+
import { CheckBoxOutlineBlank, CheckBox } from '@mui/icons-material';
|
|
17
17
|
import { useCallback, useMemo, useState, createElement } from 'react';
|
|
18
18
|
import { t } from 'i18next';
|
|
19
|
-
import { CheckBoxOutlineBlank, CheckBox } from '@mui/icons-material';
|
|
20
19
|
import { DatePicker, DateTimePicker } from '@mui/x-date-pickers';
|
|
21
20
|
import { identity } from 'lodash-es';
|
|
22
|
-
|
|
23
|
-
var LoadingButtonState;
|
|
24
|
-
(function (LoadingButtonState) {
|
|
25
|
-
LoadingButtonState["Idle"] = "idle";
|
|
26
|
-
LoadingButtonState["Loading"] = "loading";
|
|
27
|
-
LoadingButtonState["Success"] = "success";
|
|
28
|
-
})(LoadingButtonState || (LoadingButtonState = {}));
|
|
29
|
-
|
|
30
|
-
const LoadingButton = ({
|
|
31
|
-
buttonText,
|
|
32
|
-
buttonTextSuccess,
|
|
33
|
-
loadingButtonProps,
|
|
34
|
-
loadingButtonPropsPropsSuccess,
|
|
35
|
-
buttonState,
|
|
36
|
-
successIcon
|
|
37
|
-
}) => {
|
|
38
|
-
const isSuccess = buttonState === LoadingButtonState.Success;
|
|
39
|
-
const propsToSpread = isSuccess ? loadingButtonPropsPropsSuccess : loadingButtonProps;
|
|
40
|
-
return /*#__PURE__*/jsx(LoadingButton$1, {
|
|
41
|
-
loading: buttonState === LoadingButtonState.Loading,
|
|
42
|
-
disabled: buttonState !== LoadingButtonState.Idle,
|
|
43
|
-
...propsToSpread,
|
|
44
|
-
children: buttonState === LoadingButtonState.Success ? /*#__PURE__*/jsxs(Fragment, {
|
|
45
|
-
children: [successIcon ? successIcon : null, buttonTextSuccess ? buttonTextSuccess : buttonText]
|
|
46
|
-
}) : buttonText
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get loading button state from react-query mutation status.
|
|
52
|
-
*/
|
|
53
|
-
const loadingButtonStateFromReactQueryMutationStatus = mutationStatus => {
|
|
54
|
-
const mapStatus = {
|
|
55
|
-
idle: LoadingButtonState.Idle,
|
|
56
|
-
error: LoadingButtonState.Idle,
|
|
57
|
-
success: LoadingButtonState.Success,
|
|
58
|
-
loading: LoadingButtonState.Loading
|
|
59
|
-
};
|
|
60
|
-
return mapStatus[mutationStatus];
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Get loading button state from a react-hook-form context.
|
|
64
|
-
*/
|
|
65
|
-
const useLoadingButtonStateFromFormContext = () => {
|
|
66
|
-
const formContext = useFormContext();
|
|
67
|
-
return loadingButtonStateFromFormState(formContext.formState);
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Get loading button state from a react-hook-form state.
|
|
71
|
-
*/
|
|
72
|
-
const loadingButtonStateFromFormState = (
|
|
73
|
-
// we are not interested in the value types FormState holds
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
-
formState) => {
|
|
76
|
-
if (formState.isSubmitting) {
|
|
77
|
-
return LoadingButtonState.Loading;
|
|
78
|
-
}
|
|
79
|
-
if (formState.isDirty) {
|
|
80
|
-
return LoadingButtonState.Idle;
|
|
81
|
-
}
|
|
82
|
-
if (formState.isSubmitSuccessful) {
|
|
83
|
-
return LoadingButtonState.Success;
|
|
84
|
-
}
|
|
85
|
-
return LoadingButtonState.Idle;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Reexport of FormProvider.
|
|
90
|
-
*
|
|
91
|
-
* This became necessary as context is not available when the FormProvider is initialized outside of the package. Most likely this is some kind of instance mismatch.
|
|
92
|
-
*/
|
|
93
|
-
const HookFormProvider = FormProvider;
|
|
21
|
+
import { LoadingButton as LoadingButton$1 } from '@mui/lab';
|
|
94
22
|
|
|
95
23
|
const formContextNull = "FormContext is null. This should not happen. You may need to use the HookFormProvider instead of the FormProvider exported by react-hook-form";
|
|
96
24
|
|
|
@@ -102,7 +30,7 @@ const formContextNull = "FormContext is null. This should not happen. You may ne
|
|
|
102
30
|
*
|
|
103
31
|
* Did not find a built-in way to do this … there might be one though.
|
|
104
32
|
*/
|
|
105
|
-
const
|
|
33
|
+
const getFormErrorForNestedKeys = (errors, fieldName) => {
|
|
106
34
|
const nestedKeys = fieldName.split(".");
|
|
107
35
|
//
|
|
108
36
|
// To my best knowledge, this works as expected.
|
|
@@ -121,6 +49,38 @@ const getFormError = (errors, fieldName) => {
|
|
|
121
49
|
/* eslint-enable */
|
|
122
50
|
};
|
|
123
51
|
|
|
52
|
+
const FormFieldErrorDisplay = ({
|
|
53
|
+
error
|
|
54
|
+
}) => {
|
|
55
|
+
if (Array.isArray(error)) {
|
|
56
|
+
return /*#__PURE__*/jsx(FormHelperText, {
|
|
57
|
+
children: error.map(e => e.message).filter(filterNoUndefinedNoNull).join(", ")
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (error?.message) {
|
|
61
|
+
return /*#__PURE__*/jsx(FormHelperText, {
|
|
62
|
+
children: error?.message
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const FormFieldError = ({
|
|
69
|
+
fieldName
|
|
70
|
+
}) => {
|
|
71
|
+
const form = useFormContext();
|
|
72
|
+
if (!form) {
|
|
73
|
+
throw Error(formContextNull);
|
|
74
|
+
}
|
|
75
|
+
const {
|
|
76
|
+
formState
|
|
77
|
+
} = form;
|
|
78
|
+
const error = getFormErrorForNestedKeys(formState.errors, fieldName);
|
|
79
|
+
return /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
80
|
+
error: error
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
124
84
|
/**
|
|
125
85
|
* Return a function which turns our TranslatedString into a plain string.
|
|
126
86
|
*
|
|
@@ -184,106 +144,6 @@ formFieldDefaults) => {
|
|
|
184
144
|
return withPlainStrings;
|
|
185
145
|
};
|
|
186
146
|
|
|
187
|
-
const InputText = ({
|
|
188
|
-
formField,
|
|
189
|
-
textFieldProps
|
|
190
|
-
}) => {
|
|
191
|
-
const form = useFormContext();
|
|
192
|
-
const muiFormControl = useFormControl();
|
|
193
|
-
const {
|
|
194
|
-
label,
|
|
195
|
-
name,
|
|
196
|
-
required,
|
|
197
|
-
requiredErrorMessage,
|
|
198
|
-
validate
|
|
199
|
-
} = useMergedFormField(formField, formField.t);
|
|
200
|
-
if (!form) {
|
|
201
|
-
throw Error(formContextNull);
|
|
202
|
-
}
|
|
203
|
-
const {
|
|
204
|
-
register,
|
|
205
|
-
formState
|
|
206
|
-
} = form;
|
|
207
|
-
const error = getFormError(formState.errors, formField.name);
|
|
208
|
-
return /*#__PURE__*/jsxs(FormControl, {
|
|
209
|
-
error: !!error,
|
|
210
|
-
required: required,
|
|
211
|
-
disabled: muiFormControl?.disabled,
|
|
212
|
-
children: [/*#__PURE__*/jsx(InputLabel, {
|
|
213
|
-
required: required,
|
|
214
|
-
children: label
|
|
215
|
-
}), /*#__PURE__*/jsx(OutlinedInput, {
|
|
216
|
-
...register(name, {
|
|
217
|
-
required: required ? requiredErrorMessage : false,
|
|
218
|
-
validate,
|
|
219
|
-
disabled: muiFormControl?.disabled
|
|
220
|
-
}),
|
|
221
|
-
required: required,
|
|
222
|
-
label: label,
|
|
223
|
-
...textFieldProps
|
|
224
|
-
}), error?.message && /*#__PURE__*/jsx(FormHelperText, {
|
|
225
|
-
children: error?.message
|
|
226
|
-
})]
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const InputEmail = props => {
|
|
231
|
-
const merged = useMergedFormField(props.formField, props.formField.t, formDefaults);
|
|
232
|
-
return /*#__PURE__*/jsx(InputText, {
|
|
233
|
-
textFieldProps: {
|
|
234
|
-
type: "email",
|
|
235
|
-
...props.textFieldProps
|
|
236
|
-
},
|
|
237
|
-
formField: merged
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
const formDefaults = {
|
|
241
|
-
required: true,
|
|
242
|
-
validate: emailInput => {
|
|
243
|
-
if (emailInput.match(/.@./)) {
|
|
244
|
-
return true;
|
|
245
|
-
}
|
|
246
|
-
return "E-Mail address invalid";
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
const InputPasswordSet = ({
|
|
251
|
-
passwordField,
|
|
252
|
-
passwordValidationField,
|
|
253
|
-
doNotMatchError
|
|
254
|
-
}) => {
|
|
255
|
-
const {
|
|
256
|
-
watch
|
|
257
|
-
} = useFormContext();
|
|
258
|
-
const passwordFieldMerged = useMergedFormField(passwordField, passwordField.t, {
|
|
259
|
-
required: true
|
|
260
|
-
});
|
|
261
|
-
const validationFieldMerged = useMergedFormField(passwordValidationField, passwordValidationField.t, {
|
|
262
|
-
required: true
|
|
263
|
-
});
|
|
264
|
-
const validatePasswordMatch = useCallback(value => {
|
|
265
|
-
const passwordValue = watch(passwordFieldMerged.name);
|
|
266
|
-
return value === passwordValue || doNotMatchError;
|
|
267
|
-
}, [doNotMatchError, passwordFieldMerged.name, watch]);
|
|
268
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
269
|
-
children: [/*#__PURE__*/jsx(InputText, {
|
|
270
|
-
formField: passwordFieldMerged,
|
|
271
|
-
textFieldProps: {
|
|
272
|
-
type: "password"
|
|
273
|
-
}
|
|
274
|
-
}), /*#__PURE__*/jsx(InputText, {
|
|
275
|
-
formField: {
|
|
276
|
-
...validationFieldMerged,
|
|
277
|
-
validate: validatePasswordMatch,
|
|
278
|
-
t: passwordValidationField.t
|
|
279
|
-
},
|
|
280
|
-
textFieldProps: {
|
|
281
|
-
type: "password"
|
|
282
|
-
}
|
|
283
|
-
})]
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
|
|
287
147
|
var GroupLabelSorting;
|
|
288
148
|
(function (GroupLabelSorting) {
|
|
289
149
|
GroupLabelSorting["Alphabetical"] = "alphabetical";
|
|
@@ -368,7 +228,7 @@ const InputAutocomplete = ({
|
|
|
368
228
|
formState,
|
|
369
229
|
setValue
|
|
370
230
|
} = form;
|
|
371
|
-
const error =
|
|
231
|
+
const error = getFormErrorForNestedKeys(formState.errors, formField.name);
|
|
372
232
|
const muiFormControl = useFormControl();
|
|
373
233
|
const {
|
|
374
234
|
label,
|
|
@@ -458,8 +318,8 @@ const InputAutocomplete = ({
|
|
|
458
318
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
459
319
|
,
|
|
460
320
|
...autoCompleteProps
|
|
461
|
-
}),
|
|
462
|
-
|
|
321
|
+
}), /*#__PURE__*/jsx(FormFieldError, {
|
|
322
|
+
fieldName: formField.name
|
|
463
323
|
})]
|
|
464
324
|
});
|
|
465
325
|
};
|
|
@@ -478,7 +338,7 @@ const InputCheckbox = ({
|
|
|
478
338
|
const {
|
|
479
339
|
errors
|
|
480
340
|
} = useFormState();
|
|
481
|
-
const error =
|
|
341
|
+
const error = getFormErrorForNestedKeys(errors, formField.name);
|
|
482
342
|
const muiFormControl = useFormControl();
|
|
483
343
|
const {
|
|
484
344
|
label,
|
|
@@ -516,8 +376,8 @@ const InputCheckbox = ({
|
|
|
516
376
|
}),
|
|
517
377
|
label: jsxLabel ?? label,
|
|
518
378
|
...formControlLabelProps
|
|
519
|
-
}),
|
|
520
|
-
|
|
379
|
+
}), /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
380
|
+
error: error
|
|
521
381
|
})]
|
|
522
382
|
});
|
|
523
383
|
};
|
|
@@ -530,7 +390,7 @@ const InputDatePicker = ({
|
|
|
530
390
|
formState,
|
|
531
391
|
control
|
|
532
392
|
} = useFormContext();
|
|
533
|
-
const error =
|
|
393
|
+
const error = getFormErrorForNestedKeys(formState.errors, formField.name);
|
|
534
394
|
const muiFormControl = useFormControl();
|
|
535
395
|
const {
|
|
536
396
|
label,
|
|
@@ -568,8 +428,8 @@ const InputDatePicker = ({
|
|
|
568
428
|
...restField,
|
|
569
429
|
...datePickerProps
|
|
570
430
|
})
|
|
571
|
-
}),
|
|
572
|
-
|
|
431
|
+
}), /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
432
|
+
error: error
|
|
573
433
|
})]
|
|
574
434
|
})
|
|
575
435
|
});
|
|
@@ -583,7 +443,7 @@ const InputDateTimePicker = ({
|
|
|
583
443
|
formState,
|
|
584
444
|
control
|
|
585
445
|
} = useFormContext();
|
|
586
|
-
const error =
|
|
446
|
+
const error = getFormErrorForNestedKeys(formState.errors, formField.name);
|
|
587
447
|
const muiFormControl = useFormControl();
|
|
588
448
|
const {
|
|
589
449
|
label,
|
|
@@ -622,13 +482,56 @@ const InputDateTimePicker = ({
|
|
|
622
482
|
...restField,
|
|
623
483
|
...dateTimePickerProps
|
|
624
484
|
})
|
|
625
|
-
}),
|
|
626
|
-
|
|
485
|
+
}), /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
486
|
+
error: error
|
|
627
487
|
})]
|
|
628
488
|
})
|
|
629
489
|
});
|
|
630
490
|
};
|
|
631
491
|
|
|
492
|
+
const InputOutlinedInput = ({
|
|
493
|
+
formField,
|
|
494
|
+
outlinedInputProps
|
|
495
|
+
}) => {
|
|
496
|
+
const form = useFormContext();
|
|
497
|
+
const muiFormControl = useFormControl();
|
|
498
|
+
const {
|
|
499
|
+
label,
|
|
500
|
+
name,
|
|
501
|
+
required,
|
|
502
|
+
requiredErrorMessage,
|
|
503
|
+
validate
|
|
504
|
+
} = useMergedFormField(formField, formField.t);
|
|
505
|
+
if (!form) {
|
|
506
|
+
throw Error(formContextNull);
|
|
507
|
+
}
|
|
508
|
+
const {
|
|
509
|
+
register,
|
|
510
|
+
formState
|
|
511
|
+
} = form;
|
|
512
|
+
const error = getFormErrorForNestedKeys(formState.errors, formField.name);
|
|
513
|
+
return /*#__PURE__*/jsxs(FormControl, {
|
|
514
|
+
error: !!error,
|
|
515
|
+
required: required,
|
|
516
|
+
disabled: muiFormControl?.disabled,
|
|
517
|
+
children: [/*#__PURE__*/jsx(InputLabel, {
|
|
518
|
+
required: required,
|
|
519
|
+
children: label
|
|
520
|
+
}), /*#__PURE__*/jsx(OutlinedInput, {
|
|
521
|
+
...register(name, {
|
|
522
|
+
required: required ? requiredErrorMessage : false,
|
|
523
|
+
validate,
|
|
524
|
+
disabled: muiFormControl?.disabled
|
|
525
|
+
}),
|
|
526
|
+
required: required,
|
|
527
|
+
label: label,
|
|
528
|
+
...outlinedInputProps
|
|
529
|
+
}), /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
530
|
+
error: error
|
|
531
|
+
})]
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
|
|
632
535
|
const InputRadio = ({
|
|
633
536
|
formField,
|
|
634
537
|
selectableOptions,
|
|
@@ -643,7 +546,7 @@ const InputRadio = ({
|
|
|
643
546
|
const {
|
|
644
547
|
errors
|
|
645
548
|
} = useFormState();
|
|
646
|
-
const error =
|
|
549
|
+
const error = getFormErrorForNestedKeys(errors, formField.name);
|
|
647
550
|
const muiFormControl = useFormControl();
|
|
648
551
|
const {
|
|
649
552
|
label,
|
|
@@ -689,8 +592,8 @@ const InputRadio = ({
|
|
|
689
592
|
...formControlLabelProps
|
|
690
593
|
});
|
|
691
594
|
})
|
|
692
|
-
}),
|
|
693
|
-
|
|
595
|
+
}), /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
596
|
+
error: error
|
|
694
597
|
})]
|
|
695
598
|
});
|
|
696
599
|
};
|
|
@@ -729,7 +632,7 @@ const InputSelect = ({
|
|
|
729
632
|
watch,
|
|
730
633
|
formState
|
|
731
634
|
} = form;
|
|
732
|
-
const error =
|
|
635
|
+
const error = getFormErrorForNestedKeys(formState.errors, formField.name);
|
|
733
636
|
const muiFormControl = useFormControl();
|
|
734
637
|
const {
|
|
735
638
|
label,
|
|
@@ -807,8 +710,8 @@ const InputSelect = ({
|
|
|
807
710
|
children: option.group
|
|
808
711
|
}, option.group), wrappedMenuItem] : wrappedMenuItem;
|
|
809
712
|
})]
|
|
810
|
-
}),
|
|
811
|
-
|
|
713
|
+
}), /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
714
|
+
error: error
|
|
812
715
|
})]
|
|
813
716
|
});
|
|
814
717
|
};
|
|
@@ -843,6 +746,46 @@ const InputSelectFromEnum = props => {
|
|
|
843
746
|
});
|
|
844
747
|
};
|
|
845
748
|
|
|
749
|
+
const InputTextField = ({
|
|
750
|
+
formField,
|
|
751
|
+
textFieldProps
|
|
752
|
+
}) => {
|
|
753
|
+
const form = useFormContext();
|
|
754
|
+
const muiFormControl = useFormControl();
|
|
755
|
+
const {
|
|
756
|
+
label,
|
|
757
|
+
name,
|
|
758
|
+
required,
|
|
759
|
+
requiredErrorMessage,
|
|
760
|
+
validate
|
|
761
|
+
} = useMergedFormField(formField, formField.t);
|
|
762
|
+
if (!form) {
|
|
763
|
+
throw Error(formContextNull);
|
|
764
|
+
}
|
|
765
|
+
const {
|
|
766
|
+
register,
|
|
767
|
+
formState
|
|
768
|
+
} = form;
|
|
769
|
+
const error = getFormErrorForNestedKeys(formState.errors, formField.name);
|
|
770
|
+
return /*#__PURE__*/jsxs(FormControl, {
|
|
771
|
+
error: !!error,
|
|
772
|
+
required: required,
|
|
773
|
+
disabled: muiFormControl?.disabled,
|
|
774
|
+
children: [/*#__PURE__*/jsx(TextField, {
|
|
775
|
+
...register(name, {
|
|
776
|
+
required: required ? requiredErrorMessage : false,
|
|
777
|
+
validate,
|
|
778
|
+
disabled: muiFormControl?.disabled
|
|
779
|
+
}),
|
|
780
|
+
required: required,
|
|
781
|
+
label: label,
|
|
782
|
+
...textFieldProps
|
|
783
|
+
}), /*#__PURE__*/jsx(FormFieldErrorDisplay, {
|
|
784
|
+
error: error
|
|
785
|
+
})]
|
|
786
|
+
});
|
|
787
|
+
};
|
|
788
|
+
|
|
846
789
|
/**
|
|
847
790
|
* Turn an async submitHandler into a synchronous one.
|
|
848
791
|
*
|
|
@@ -888,5 +831,137 @@ const useHookFormContext = () => {
|
|
|
888
831
|
};
|
|
889
832
|
};
|
|
890
833
|
|
|
891
|
-
|
|
834
|
+
/**
|
|
835
|
+
* Reexport of FormProvider.
|
|
836
|
+
*
|
|
837
|
+
* This became necessary as context is not available when the FormProvider is initialized outside of the package. Most likely this is some kind of instance mismatch.
|
|
838
|
+
*/
|
|
839
|
+
const HookFormProvider = FormProvider;
|
|
840
|
+
|
|
841
|
+
const InputEmail = props => {
|
|
842
|
+
const merged = useMergedFormField(props.formField, props.formField.t, formDefaults);
|
|
843
|
+
return /*#__PURE__*/jsx(InputOutlinedInput, {
|
|
844
|
+
outlinedInputProps: {
|
|
845
|
+
type: "email",
|
|
846
|
+
...props.outlinedInputProps,
|
|
847
|
+
autoComplete: "email"
|
|
848
|
+
},
|
|
849
|
+
formField: merged
|
|
850
|
+
});
|
|
851
|
+
};
|
|
852
|
+
const formDefaults = {
|
|
853
|
+
required: true,
|
|
854
|
+
validate: emailInput => {
|
|
855
|
+
if (emailInput.match(/.@./)) {
|
|
856
|
+
return true;
|
|
857
|
+
}
|
|
858
|
+
return "E-Mail address invalid";
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
const InputPasswordSet = ({
|
|
863
|
+
passwordField,
|
|
864
|
+
passwordValidationField,
|
|
865
|
+
doNotMatchError
|
|
866
|
+
}) => {
|
|
867
|
+
const {
|
|
868
|
+
watch
|
|
869
|
+
} = useFormContext();
|
|
870
|
+
const passwordFieldMerged = useMergedFormField(passwordField, passwordField.t, {
|
|
871
|
+
required: true
|
|
872
|
+
});
|
|
873
|
+
const validationFieldMerged = useMergedFormField(passwordValidationField, passwordValidationField.t, {
|
|
874
|
+
required: true
|
|
875
|
+
});
|
|
876
|
+
const validatePasswordMatch = useCallback(value => {
|
|
877
|
+
const passwordValue = watch(passwordFieldMerged.name);
|
|
878
|
+
return value === passwordValue || doNotMatchError;
|
|
879
|
+
}, [doNotMatchError, passwordFieldMerged.name, watch]);
|
|
880
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
881
|
+
children: [/*#__PURE__*/jsx(InputOutlinedInput, {
|
|
882
|
+
formField: passwordFieldMerged,
|
|
883
|
+
outlinedInputProps: {
|
|
884
|
+
type: "password",
|
|
885
|
+
autoComplete: "new-password"
|
|
886
|
+
}
|
|
887
|
+
}), /*#__PURE__*/jsx(InputOutlinedInput, {
|
|
888
|
+
formField: {
|
|
889
|
+
...validationFieldMerged,
|
|
890
|
+
validate: validatePasswordMatch,
|
|
891
|
+
t: passwordValidationField.t
|
|
892
|
+
},
|
|
893
|
+
outlinedInputProps: {
|
|
894
|
+
type: "password",
|
|
895
|
+
autoComplete: "new-password"
|
|
896
|
+
}
|
|
897
|
+
})]
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
var LoadingButtonState;
|
|
902
|
+
(function (LoadingButtonState) {
|
|
903
|
+
LoadingButtonState["Idle"] = "idle";
|
|
904
|
+
LoadingButtonState["Loading"] = "loading";
|
|
905
|
+
LoadingButtonState["Success"] = "success";
|
|
906
|
+
})(LoadingButtonState || (LoadingButtonState = {}));
|
|
907
|
+
|
|
908
|
+
const LoadingButton = ({
|
|
909
|
+
buttonText,
|
|
910
|
+
buttonTextSuccess,
|
|
911
|
+
loadingButtonProps,
|
|
912
|
+
loadingButtonPropsPropsSuccess,
|
|
913
|
+
buttonState,
|
|
914
|
+
successIcon
|
|
915
|
+
}) => {
|
|
916
|
+
const isSuccess = buttonState === LoadingButtonState.Success;
|
|
917
|
+
const propsToSpread = isSuccess ? loadingButtonPropsPropsSuccess : loadingButtonProps;
|
|
918
|
+
return /*#__PURE__*/jsx(LoadingButton$1, {
|
|
919
|
+
loading: buttonState === LoadingButtonState.Loading,
|
|
920
|
+
disabled: buttonState !== LoadingButtonState.Idle,
|
|
921
|
+
...propsToSpread,
|
|
922
|
+
children: buttonState === LoadingButtonState.Success ? /*#__PURE__*/jsxs(Fragment, {
|
|
923
|
+
children: [successIcon ? successIcon : null, buttonTextSuccess ? buttonTextSuccess : buttonText]
|
|
924
|
+
}) : buttonText
|
|
925
|
+
});
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Get loading button state from react-query mutation status.
|
|
930
|
+
*/
|
|
931
|
+
const loadingButtonStateFromReactQueryMutationStatus = mutationStatus => {
|
|
932
|
+
const mapStatus = {
|
|
933
|
+
idle: LoadingButtonState.Idle,
|
|
934
|
+
error: LoadingButtonState.Idle,
|
|
935
|
+
success: LoadingButtonState.Success,
|
|
936
|
+
loading: LoadingButtonState.Loading
|
|
937
|
+
};
|
|
938
|
+
return mapStatus[mutationStatus];
|
|
939
|
+
};
|
|
940
|
+
/**
|
|
941
|
+
* Get loading button state from a react-hook-form context.
|
|
942
|
+
*/
|
|
943
|
+
const useLoadingButtonStateFromFormContext = () => {
|
|
944
|
+
const formContext = useFormContext();
|
|
945
|
+
return loadingButtonStateFromFormState(formContext.formState);
|
|
946
|
+
};
|
|
947
|
+
/**
|
|
948
|
+
* Get loading button state from a react-hook-form state.
|
|
949
|
+
*/
|
|
950
|
+
const loadingButtonStateFromFormState = (
|
|
951
|
+
// we are not interested in the value types FormState holds
|
|
952
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
953
|
+
formState) => {
|
|
954
|
+
if (formState.isSubmitting) {
|
|
955
|
+
return LoadingButtonState.Loading;
|
|
956
|
+
}
|
|
957
|
+
if (formState.isDirty) {
|
|
958
|
+
return LoadingButtonState.Idle;
|
|
959
|
+
}
|
|
960
|
+
if (formState.isSubmitSuccessful) {
|
|
961
|
+
return LoadingButtonState.Success;
|
|
962
|
+
}
|
|
963
|
+
return LoadingButtonState.Idle;
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
export { FormFieldError, FormFieldErrorDisplay, HookFormProvider, InputAutocomplete, InputCheckbox, InputDatePicker, InputDateTimePicker, InputEmail, InputOutlinedInput, InputPasswordSet, InputRadio, InputSelect, InputSelectFromEnum, InputOutlinedInput as InputText, InputTextField, LoadingButton, LoadingButtonState, getFormErrorForNestedKeys as getFormError, loadingButtonStateFromFormState, loadingButtonStateFromReactQueryMutationStatus, syncSubmit, useHookForm, useHookFormContext, useLoadingButtonStateFromFormContext, useMergedFormField, useSortedOptionsWithGroup, useTranslateString };
|
|
892
967
|
//# sourceMappingURL=packageExports.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageExports.js","sources":["../../src/LoadingButton/LoadingButtonInterfaces.ts","../../src/LoadingButton/LoadingButton.tsx","../../src/LoadingButton/getLoadingButtonState.ts","../../src/formFields/HookFormProvider.tsx","../../src/formFields/errorMessages.ts","../../src/formFields/formHelper/getFormError.ts","../../src/formFields/formHelper/useTranslateString.ts","../../src/formFields/formHelper/useMergedFormField.ts","../../src/formFields/baseTypes/InputText/InputText.tsx","../../src/formFields/InputEmail/InputEmail.tsx","../../src/formFields/InputPasswordSet/InputPasswordSet.tsx","../../src/formFields/baseTypes/InputAutocomplete/useSortedOptionsWithGroup.ts","../../src/formFields/baseTypes/InputAutocomplete/InputAutocomplete.tsx","../../src/formFields/baseTypes/InputCheckbox/InputCheckbox.tsx","../../src/formFields/baseTypes/InputDatePicker/InputDatePicker.tsx","../../src/formFields/baseTypes/InputDateTimePicker/InputDateTimePicker.tsx","../../src/formFields/baseTypes/InputRadio/InputRadio.tsx","../../src/formFields/formHelper/useSortedOptionsWithGroup.ts","../../src/formFields/baseTypes/InputSelect/InputSelect.tsx","../../src/formFields/baseTypes/InputSelectFromEnum/InputSelectFromEnum.tsx","../../src/formFields/formHelper/syncSubmit.ts","../../src/formFields/formHelper/useHookForm.ts","../../src/formFields/formHelper/useHookFormContext.ts"],"sourcesContent":["import { LoadingButtonProps as MuiLoadingButtonProps } from \"@mui/lab\";\nimport { ReactElement } from \"react\";\n\nexport enum LoadingButtonState {\n Idle = \"idle\",\n Loading = \"loading\",\n Success = \"success\",\n}\n\ntype SelectedButtonProps = Omit<MuiLoadingButtonProps, \"children\">;\n\nexport interface LoadingButtonProps {\n buttonState: LoadingButtonState;\n /**\n * Button label.\n */\n buttonText: string;\n /**\n * Button label that is displayed on success.\n */\n buttonTextSuccess?: string;\n /**\n * Provide an icon that is displayed in front of the text\n * when state is successful.\n */\n successIcon?: JSX.Element | ReactElement;\n /**\n * Adjust the button when the state is any other than successful.\n */\n loadingButtonProps?: SelectedButtonProps;\n /**\n * Adjust the button when the state is successful.\n */\n loadingButtonPropsPropsSuccess?: SelectedButtonProps;\n}\n","import { LoadingButton as MuiLoadingButton } from \"@mui/lab\";\nimport {\n LoadingButtonProps,\n LoadingButtonState,\n} from \"./LoadingButtonInterfaces\";\n\n/**\n * A loading button component.\n */\nexport const LoadingButton = ({\n buttonText,\n buttonTextSuccess,\n loadingButtonProps,\n loadingButtonPropsPropsSuccess,\n buttonState,\n successIcon,\n}: LoadingButtonProps): JSX.Element => {\n const isSuccess = buttonState === LoadingButtonState.Success;\n\n const propsToSpread = isSuccess\n ? loadingButtonPropsPropsSuccess\n : loadingButtonProps;\n\n return (\n <MuiLoadingButton\n loading={buttonState === LoadingButtonState.Loading}\n disabled={buttonState !== LoadingButtonState.Idle}\n {...propsToSpread}\n >\n {buttonState === LoadingButtonState.Success ? (\n <>\n {successIcon ? successIcon : null}\n\n {buttonTextSuccess ? buttonTextSuccess : buttonText}\n </>\n ) : (\n buttonText\n )}\n </MuiLoadingButton>\n );\n};\n","import { FormState, useFormContext } from \"react-hook-form\";\nimport { LoadingButtonState } from \"./LoadingButtonInterfaces\";\n\n/**\n * Redefinition of mutation status defined by react query. By doing this\n * we don't need to import react-query in the package.\n */\ndeclare type MutationStatus = \"idle\" | \"loading\" | \"success\" | \"error\";\n\n/**\n * Get loading button state from react-query mutation status.\n */\nexport const loadingButtonStateFromReactQueryMutationStatus = (\n mutationStatus: MutationStatus\n): LoadingButtonState => {\n const mapStatus: Record<MutationStatus, LoadingButtonState> = {\n idle: LoadingButtonState.Idle,\n error: LoadingButtonState.Idle,\n success: LoadingButtonState.Success,\n loading: LoadingButtonState.Loading,\n };\n\n return mapStatus[mutationStatus];\n};\n\n/**\n * Get loading button state from a react-hook-form context.\n */\nexport const useLoadingButtonStateFromFormContext = (): LoadingButtonState => {\n const formContext = useFormContext();\n\n return loadingButtonStateFromFormState(formContext.formState);\n};\n\n/**\n * Get loading button state from a react-hook-form state.\n */\nexport const loadingButtonStateFromFormState = (\n // we are not interested in the value types FormState holds\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formState: FormState<any>\n): LoadingButtonState => {\n if (formState.isSubmitting) {\n return LoadingButtonState.Loading;\n }\n\n if (formState.isDirty) {\n return LoadingButtonState.Idle;\n }\n\n if (formState.isSubmitSuccessful) {\n return LoadingButtonState.Success;\n }\n\n return LoadingButtonState.Idle;\n};\n","import { FormProvider } from \"react-hook-form\";\n\n/**\n * Reexport of FormProvider.\n *\n * This became necessary as context is not available when the FormProvider is initialized outside of the package. Most likely this is some kind of instance mismatch.\n */\nexport const HookFormProvider = FormProvider;\n","export const formContextNull =\n \"FormContext is null. This should not happen. You may need to use the HookFormProvider instead of the FormProvider exported by react-hook-form\";\n","import { AnyObject } from \"@nvon/baseline\";\nimport { FieldError, FormState } from \"react-hook-form\";\n\n/**\n * Get the field errors for a (possibly nested) field name.\n *\n * Checking `formState.errors[fieldName]` only works if fieldName is not a path\n * (e.g. Does not include dots).\n *\n * Did not find a built-in way to do this … there might be one though.\n */\nexport const getFormError = (\n errors: FormState<AnyObject>[\"errors\"],\n fieldName: string\n): FieldError | undefined => {\n const nestedKeys = fieldName.split(\".\");\n\n //\n // To my best knowledge, this works as expected.\n //\n // It recursively walks the error object by the given keys\n // until the lowest level is reached, or undefined returned.\n //\n // Typescript is just not very happy with the dynamic nature of this,\n // hence the errors.\n //\n\n /* eslint-disable @typescript-eslint/ban-ts-comment,@typescript-eslint/no-unsafe-return */\n // @ts-expect-error\n return nestedKeys.reduce(\n // @ts-expect-error\n (errorObj: FieldError | undefined, pathKey) => errorObj?.[pathKey],\n errors\n );\n /* eslint-enable */\n};\n","import { t, TFunction } from \"i18next\";\nimport { useCallback } from \"react\";\nimport { TranslatedString } from \"../TranslatedString\";\n\n/**\n * Return a function which turns our TranslatedString into a plain string.\n *\n * @throws Error if no t was provided but a translated string.\n */\nexport const useTranslateString = (): ((\n input: TranslatedString | string,\n t?: TFunction\n) => string) => {\n if (!t) {\n throw Error(\n \"If you pass in a translated validate function you need to provide a t\"\n );\n }\n\n return useCallback((input: TranslatedString | string) => {\n return typeof input === \"string\" ? input : input(t);\n }, []);\n};\n","import { uppercaseFirstLetter } from \"@nvon/baseline\";\nimport { TFunction } from \"i18next\";\nimport { useMemo } from \"react\";\nimport { RegisterOptions } from \"react-hook-form\";\nimport {\n FormField,\n FormFieldTranslated,\n TranslatedValidate,\n} from \"../inputTypes\";\nimport { useTranslateString } from \"./useTranslateString\";\n\n/**\n * Merge a form field with defaults.\n */\nexport const useMergedFormField = (\n /**\n * Form fields, typically those passed into a component.\n *\n */\n formField: FormField,\n t?: TFunction,\n /**\n * Additional defaults. Duplicate values will be overridden by the formField.\n */\n formFieldDefaults?: Partial<FormField>\n): FormFieldTranslated => {\n const translate = useTranslateString();\n\n const merged = useMemo(() => {\n const builtInDefaults = {\n label: uppercaseFirstLetter(formField.name),\n required: false,\n requiredErrorMessage: \"Please fill in required information\",\n validate: undefined,\n };\n\n return {\n ...builtInDefaults,\n ...formFieldDefaults,\n ...formField,\n };\n }, [formField, formFieldDefaults]);\n\n const withPlainStrings = useMemo(() => {\n // Translating the validate function is a bit tricky,\n // since it can be an object in both cases.\n const validate = (() => {\n if (\n typeof merged.validate === \"object\" &&\n typeof merged.validate.translated === \"function\"\n ) {\n if (!t) {\n throw Error(\n \"If you pass in a translated validate function you need to provide a t\"\n );\n }\n\n return (merged.validate.translated as TranslatedValidate)(t);\n }\n\n return merged.validate;\n })() as RegisterOptions[\"validate\"]; // This should be fine. Not sure why TS is complaining.\n\n return {\n ...merged,\n label: translate(merged.label, t),\n requiredErrorMessage: translate(merged.requiredErrorMessage, t),\n validate,\n };\n }, [merged, t, translate]);\n\n return withPlainStrings;\n};\n","import {\n FormControl,\n FormHelperText,\n InputLabel,\n OutlinedInput,\n OutlinedInputProps,\n useFormControl,\n} from \"@mui/material\";\nimport { useFormContext } from \"react-hook-form\";\nimport { formContextNull } from \"../../errorMessages\";\nimport { getFormError } from \"../../formHelper/getFormError\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\nexport interface InputTextProps {\n formField: FormField;\n textFieldProps?: Omit<OutlinedInputProps, \"required\" | \"label\">;\n}\n\n/**\n * Renders a MUI input text fields that is embedded in a react\n * hook form context.\n *\n * @throws Error when FormContext is null.\n */\nexport const InputText = ({\n formField,\n textFieldProps,\n}: InputTextProps): JSX.Element | null => {\n const form = useFormContext();\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate } =\n useMergedFormField(formField, formField.t);\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { register, formState } = form;\n const error = getFormError(formState.errors, formField.name);\n\n return (\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <InputLabel required={required}>{label}</InputLabel>\n\n <OutlinedInput\n {...register(name, {\n required: required ? requiredErrorMessage : false,\n validate,\n disabled: muiFormControl?.disabled,\n })}\n required={required}\n label={label}\n {...textFieldProps}\n />\n\n {error?.message && <FormHelperText>{error?.message}</FormHelperText>}\n </FormControl>\n );\n};\n","import { InputText, InputTextProps } from \"../baseTypes/InputText/InputText\";\nimport { useMergedFormField } from \"../formHelper/useMergedFormField\";\nimport { FormField } from \"../inputTypes\";\n\nexport interface InputEmailProps {\n formField: FormField;\n textFieldProps?: InputTextProps[\"textFieldProps\"];\n}\n\n/**\n * Renders a MUI input for an email address that is embedded in a react hook form context.\n */\nexport const InputEmail = (props: InputEmailProps): JSX.Element => {\n const merged = useMergedFormField(\n props.formField,\n props.formField.t,\n formDefaults\n );\n\n return (\n <InputText\n textFieldProps={{\n type: \"email\",\n ...props.textFieldProps,\n }}\n formField={merged}\n />\n );\n};\n\nconst formDefaults: Omit<FormField, \"name\" | \"t\"> = {\n required: true,\n validate: (emailInput: string) => {\n if (emailInput.match(/.@./)) {\n return true;\n }\n\n return \"E-Mail address invalid\";\n },\n};\n","import { useCallback } from \"react\";\nimport {\n RegisterOptions,\n useFormContext,\n ValidateResult,\n} from \"react-hook-form\";\nimport { InputText } from \"../baseTypes/InputText/InputText\";\nimport { useMergedFormField } from \"../formHelper/useMergedFormField\";\nimport { InputPasswordSetProps } from \"./InputPasswordSetInterfaces\";\n\n/**\n * Two fields for setting a password set: input & validation.\n *\n * Checks for equality of both.\n */\nexport const InputPasswordSet = ({\n passwordField,\n passwordValidationField,\n doNotMatchError,\n}: InputPasswordSetProps): JSX.Element => {\n const { watch } = useFormContext();\n\n const passwordFieldMerged = useMergedFormField(\n passwordField,\n passwordField.t,\n { required: true }\n );\n const validationFieldMerged = useMergedFormField(\n passwordValidationField,\n passwordValidationField.t,\n { required: true }\n );\n\n const validatePasswordMatch: RegisterOptions[\"validate\"] = useCallback(\n (value: string): ValidateResult => {\n const passwordValue = watch(passwordFieldMerged.name) as string;\n\n return value === passwordValue || doNotMatchError;\n },\n [doNotMatchError, passwordFieldMerged.name, watch]\n );\n\n return (\n <>\n <InputText\n formField={passwordFieldMerged}\n textFieldProps={{\n type: \"password\",\n }}\n />\n\n <InputText\n formField={{\n ...validationFieldMerged,\n validate: validatePasswordMatch,\n t: passwordValidationField.t,\n }}\n textFieldProps={{\n type: \"password\",\n }}\n />\n </>\n );\n};\n","import { useMemo } from \"react\";\nimport { LabeledValueWithGrouping } from \"../../inputTypes\";\n\nexport enum GroupLabelSorting {\n Alphabetical = \"alphabetical\",\n GroupMemberCountAsc = \"groupMemberCountAsc\",\n}\n\n/**\n * Sorts option in the desired order.\n */\nexport const useSortedOptionsWithGroup = (\n selectableOptions: LabeledValueWithGrouping[],\n sorting: GroupLabelSorting = GroupLabelSorting.Alphabetical\n): LabeledValueWithGrouping[] => {\n return useMemo(() => {\n if (sorting === GroupLabelSorting.GroupMemberCountAsc) {\n const groupCounts = selectableOptions.reduce((acc, option) => {\n if (option.group) {\n acc[option.group] = (acc[option.group] || 0) + 1;\n }\n return acc;\n }, {} as Record<string, number>);\n\n return selectableOptions.sort((a, b) => {\n if (a.group == undefined && !!b.group) {\n return -1;\n }\n\n if (a.group && b.group) {\n const groupA = groupCounts[a.group];\n const groupB = groupCounts[b.group];\n\n if (groupA && groupB && groupA < groupB) {\n return -1;\n } else if (groupCounts[a.group] === groupCounts[b.group]) {\n if (b.label > a.label) {\n return -1;\n }\n\n return 1;\n }\n\n return 1;\n }\n\n if (b.label > a.label) {\n return -1;\n }\n\n return 1;\n });\n }\n\n return selectableOptions.sort((a, b) => {\n if (a.group == undefined && !!b.group) {\n return -1;\n }\n\n if (a.group && b.group && a.group < b.group) {\n return -1;\n }\n\n if (a.group == b.group && b.label > a.label) {\n return 1;\n }\n\n return 0;\n });\n }, [selectableOptions, sorting]);\n};\n","import { CheckBox, CheckBoxOutlineBlank } from \"@mui/icons-material\";\nimport {\n Autocomplete,\n Checkbox,\n ChipTypeMap,\n FormControl,\n FormHelperText,\n TextField,\n useFormControl,\n} from \"@mui/material\";\nimport { assertTruthy, objectHasKey } from \"@nvon/baseline\";\nimport { useMemo } from \"react\";\nimport { useFormContext } from \"react-hook-form\";\nimport { formContextNull } from \"../../errorMessages\";\nimport { getFormError } from \"../../formHelper/getFormError\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport {\n FormField,\n LabeledValue,\n LabeledValueWithGrouping,\n} from \"../../inputTypes\";\nimport { InputAutocompleteProps } from \"./InputAutocompleteInterfaces\";\nimport { useSortedOptionsWithGroup } from \"./useSortedOptionsWithGroup\";\n\nconst icon = <CheckBoxOutlineBlank fontSize=\"small\" />;\nconst checkedIcon = <CheckBox fontSize=\"small\" />;\n\n/**\n * Renders a MUI autocomplete input that is embedded in a react hook form context.\n *\n * @throws Error when FormContext is null.\n */\nexport const InputAutocomplete = <\n T,\n Multiple extends boolean | undefined = false,\n DisableClearable extends boolean | undefined = false,\n FreeSolo extends boolean | undefined = false,\n ChipComponent extends React.ElementType = ChipTypeMap[\"defaultComponent\"]\n>({\n formField,\n selectableOptions,\n noOptions,\n autoCompleteProps,\n checkboxesForMultiselect: renderCheckboxes,\n groupSorting,\n}: InputAutocompleteProps<\n T,\n Multiple,\n DisableClearable,\n FreeSolo,\n ChipComponent\n>): JSX.Element => {\n const form = useFormContext();\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { register, watch, formState, setValue } = form;\n\n const error = getFormError(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField, formField.t);\n\n const sortedOptions = useSortedOptionsWithGroup(\n selectableOptions,\n groupSorting\n );\n\n const value = watch(name) as\n | string\n | number\n | string[]\n | number[]\n | undefined;\n\n const multiSelect = !!autoCompleteProps?.multiple;\n\n let valueToUse = value;\n if (!value) {\n valueToUse = multiSelect ? [] : \"\";\n }\n\n assertTruthy(\n [\"string\", \"number\", \"object\"].includes(typeof valueToUse),\n \"Value for select input has unexpected type\"\n );\n\n const props = register(name, {\n required: required ? requiredErrorMessage : false,\n validate,\n disabled: muiFormControl?.disabled,\n });\n\n const currentValue = useMemo(() => {\n return multiSelect\n ? selectableOptions.filter((o) => {\n if (Array.isArray(valueToUse)) {\n return valueToUse.includes(o.value as never);\n }\n\n return selectableOptions.find(\n (option) => option.value === valueToUse\n );\n })\n : selectableOptions.find((option) => option.value === valueToUse);\n }, [multiSelect, selectableOptions, valueToUse]);\n\n const renderOption = useMemo(() => {\n if (autoCompleteProps?.renderOption) {\n return autoCompleteProps.renderOption;\n }\n\n return multiSelect && renderCheckboxes\n ? (liProps: object, option: LabeledValue) => (\n <li {...liProps}>\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n sx={{ mr: 2 }}\n checked={\n Array.isArray(currentValue)\n ? !!currentValue.find((item) => item.value === option.value)\n : false\n }\n />\n\n {option.label}\n </li>\n )\n : undefined;\n }, [\n autoCompleteProps?.renderOption,\n currentValue,\n multiSelect,\n renderCheckboxes,\n ]);\n\n return (\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <Autocomplete\n options={sortedOptions}\n value={currentValue || \"\"}\n {...props}\n label={label}\n renderOption={renderOption}\n multiple={multiSelect}\n getOptionLabel={(o) => {\n if (objectHasKey(o, \"label\")) {\n return o.label;\n }\n\n return \"\";\n }}\n onChange={(e, selectedOption: LabeledValue | LabeledValue[]) => {\n if (Array.isArray(selectedOption)) {\n setValue(\n name,\n selectedOption.map((o) => o.value),\n {\n shouldDirty: true,\n shouldValidate: true,\n shouldTouch: true,\n }\n );\n } else if (selectedOption) {\n setValue(name, selectedOption.value, {\n shouldDirty: true,\n shouldValidate: true,\n shouldTouch: true,\n });\n }\n }}\n noOptionsText={noOptions}\n renderInput={(params) => (\n <TextField {...params} label={label} variant=\"outlined\" />\n )}\n groupBy={(option: LabeledValueWithGrouping) => option.group || \"Choose\"}\n // need to parse this as any in order to get no typing errors\n // for multiselect\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {...(autoCompleteProps as any)}\n />\n\n {error?.message && <FormHelperText>{error?.message}</FormHelperText>}\n </FormControl>\n );\n};\n","import {\n Checkbox,\n CheckboxProps,\n FormControl,\n FormControlLabel,\n FormControlLabelProps,\n FormHelperText,\n useFormControl,\n} from \"@mui/material\";\nimport { ChangeEvent, useCallback } from \"react\";\nimport { useFormContext, useFormState } from \"react-hook-form\";\nimport { getFormError } from \"../../formHelper/getFormError\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\nexport interface InputCheckboxProps {\n formField: FormField;\n checkboxProps?: Omit<CheckboxProps, \"checked\">;\n formControlLabelProps?: Omit<FormControlLabelProps, \"control\" | \"label\">;\n /**\n * In contrast to other FormFields,\n * the checkbox supports jsx elements as a label.\n *\n * If this is provided, formField.label will be ignored.\n */\n jsxLabel?: JSX.Element;\n}\n\n/**\n * Input for Checking a box indicating acceptance of something.\n */\nexport const InputCheckbox = ({\n formField,\n jsxLabel,\n checkboxProps,\n formControlLabelProps,\n}: InputCheckboxProps): JSX.Element => {\n const { register, watch, setValue } = useFormContext();\n const { errors } = useFormState();\n\n const error = getFormError(errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField);\n\n const changeEv = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(name, e.target.checked, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true,\n });\n },\n [name, setValue]\n );\n\n const id = `rvo-input-checkbox-${name}`;\n\n const registered = register(name, {\n required: required ? requiredErrorMessage : false,\n onChange: changeEv,\n validate,\n disabled: muiFormControl?.disabled,\n });\n\n const value = (watch(name, false) as boolean | undefined) ?? false;\n\n return (\n <FormControl error={!!error} disabled={muiFormControl?.disabled}>\n <FormControlLabel\n required={jsxLabel ? false : required} // If jsxLabel is set, we don't want to show the asterisk.\n control={\n <Checkbox\n checked={value}\n aria-labelledby={id}\n {...registered}\n {...checkboxProps}\n />\n }\n label={jsxLabel ?? label}\n {...formControlLabelProps}\n />\n\n {error?.message && <FormHelperText>{error?.message}</FormHelperText>}\n </FormControl>\n );\n};\n","import {\n Box,\n FormControl,\n FormHelperText,\n TextField,\n TextFieldProps,\n useFormControl,\n} from \"@mui/material\";\nimport {\n DatePicker,\n DatePickerProps as MuiDatePickerProps,\n} from \"@mui/x-date-pickers\";\nimport { useState } from \"react\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport { getFormError } from \"../../formHelper/getFormError\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\n/**\n * Mangled version of the original DatePickerProps type\n * from @mui/x-date-pickers.\n */\ninterface DatePickerProps\n extends Omit<\n MuiDatePickerProps<TextFieldProps, Date>,\n \"label\" | \"onChange\" | \"disabled\" | \"value\" | \"renderInput\"\n > {\n renderInput?: MuiDatePickerProps<TextFieldProps, Date>[\"renderInput\"];\n}\n\nexport interface InputDatePickerProps {\n formField: FormField;\n datePickerProps?: DatePickerProps;\n}\n\n/**\n * A Datetime picker that works with react hook form.\n */\nexport const InputDatePicker = ({\n formField,\n datePickerProps,\n}: InputDatePickerProps): JSX.Element => {\n const { formState, control } = useFormContext();\n const error = getFormError(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required } = useMergedFormField(formField);\n\n const [date, setDate] = useState<Date>(new Date());\n\n return (\n <Box>\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <Controller\n name={name}\n defaultValue={date}\n control={control}\n render={({ field: { onChange, ...restField } }) => (\n <DatePicker\n label={label}\n onChange={(event: Date | null) => {\n onChange(event);\n\n if (event) {\n setDate(event);\n }\n }}\n disabled={muiFormControl?.disabled}\n renderInput={\n datePickerProps?.renderInput\n ? datePickerProps.renderInput\n : (params) => <TextField required={required} {...params} />\n }\n {...restField}\n {...datePickerProps}\n />\n )}\n />\n\n {error?.message && <FormHelperText>{error?.message}</FormHelperText>}\n </FormControl>\n </Box>\n );\n};\n","import {\n Box,\n FormControl,\n FormHelperText,\n TextField,\n TextFieldProps,\n useFormControl,\n} from \"@mui/material\";\nimport {\n DateTimePicker,\n DateTimePickerProps as MuiDateTimePickerProps,\n} from \"@mui/x-date-pickers\";\nimport { useState } from \"react\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport { getFormError } from \"../../formHelper/getFormError\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\n/**\n * Mangled version of the original DateTimePickerProps type\n * from @mui/x-date-pickers.\n */\ninterface DateTimePickerProps\n extends Omit<\n MuiDateTimePickerProps<TextFieldProps, Date>,\n \"label\" | \"onChange\" | \"disabled\" | \"value\" | \"renderInput\"\n > {\n renderInput?: MuiDateTimePickerProps<TextFieldProps, Date>[\"renderInput\"];\n}\n\nexport interface InputDateTimePickerProps {\n formField: FormField;\n dateTimePickerProps?: DateTimePickerProps;\n}\n\n/**\n * A Datetime picker that works with react hook form.\n */\nexport const InputDateTimePicker = ({\n formField,\n dateTimePickerProps,\n}: InputDateTimePickerProps): JSX.Element => {\n const { formState, control } = useFormContext();\n const error = getFormError(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required } = useMergedFormField(formField);\n\n const [date, setDate] = useState<Date>(new Date());\n\n return (\n <Box>\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <Controller\n name={name}\n defaultValue={date}\n control={control}\n render={({ field: { onChange, ...restField } }) => (\n <DateTimePicker\n label={label}\n ampm={\n dateTimePickerProps?.ampm ? dateTimePickerProps.ampm : false\n }\n onChange={(event: Date | null) => {\n onChange(event);\n\n if (event) {\n setDate(event);\n }\n }}\n disabled={muiFormControl?.disabled}\n renderInput={\n dateTimePickerProps?.renderInput\n ? dateTimePickerProps?.renderInput\n : (params) => <TextField required={required} {...params} />\n }\n {...restField}\n {...dateTimePickerProps}\n />\n )}\n />\n\n {error?.message && <FormHelperText>{error?.message}</FormHelperText>}\n </FormControl>\n </Box>\n );\n};\n","import {\n FormControl,\n FormControlLabel,\n FormControlLabelProps,\n FormHelperText,\n FormLabel,\n Radio,\n RadioGroup,\n RadioGroupProps,\n useFormControl,\n} from \"@mui/material\";\nimport { assertTruthy } from \"@nvon/baseline\";\nimport { ChangeEvent, useCallback } from \"react\";\nimport { useFormContext, useFormState } from \"react-hook-form\";\nimport { getFormError } from \"../../formHelper/getFormError\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField, LabeledValue } from \"../../inputTypes\";\n\nexport interface InputRadioProps {\n formField: FormField;\n selectableOptions: LabeledValue[];\n formControlLabelProps?: FormControlLabelProps;\n radioGroupProps?: RadioGroupProps;\n}\n\n/**\n * Input for selecting between a list of options using radio buttons.\n */\nexport const InputRadio = ({\n formField,\n selectableOptions,\n formControlLabelProps,\n radioGroupProps,\n}: InputRadioProps): JSX.Element => {\n const { register, watch, setValue } = useFormContext();\n const { errors } = useFormState();\n\n const error = getFormError(errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField);\n\n const changeEv = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(name, e.target.value, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true,\n });\n },\n [name, setValue]\n );\n\n const value = (watch(name) as string | number | undefined) ?? \"\";\n\n assertTruthy(\n [\"string\", \"number\"].includes(typeof value),\n \"Value for select input has unexpected type\"\n );\n\n const id = `rvo-input-radio-${name}`;\n\n const registered = register(name, {\n required: required ? requiredErrorMessage : false,\n onChange: changeEv,\n validate,\n disabled: muiFormControl?.disabled,\n });\n\n return (\n <FormControl error={!!error} disabled={muiFormControl?.disabled}>\n <FormLabel id={id} required={required}>\n {label}\n </FormLabel>\n\n <RadioGroup value={value} aria-labelledby={id} {...radioGroupProps}>\n {selectableOptions?.map((option) => {\n return (\n <FormControlLabel\n {...registered}\n key={option.value}\n value={option.value}\n control={<Radio />}\n label={option.label}\n {...formControlLabelProps}\n />\n );\n })}\n </RadioGroup>\n\n {error?.message && <FormHelperText>{error?.message}</FormHelperText>}\n </FormControl>\n );\n};\n","import { useMemo } from \"react\";\nimport { LabeledValueWithGrouping } from \"../inputTypes\";\n\n/**\n * Sorts the options by group and value.\n */\nexport const useSortedOptionsWithGroup = (\n selectableOptions: LabeledValueWithGrouping[]\n): LabeledValueWithGrouping[] => {\n return useMemo(\n () =>\n selectableOptions.sort((a, b) => {\n if (a.group == undefined && !!b.group) {\n return -1;\n }\n\n if (a.group && b.group && a.group < b.group) {\n return -1;\n }\n\n if (a.group == b.group && b.value > a.value) {\n return 1;\n }\n\n return 0;\n }),\n [selectableOptions]\n );\n};\n","import {\n Box,\n FormControl,\n FormHelperText,\n InputLabel,\n ListSubheader,\n MenuItem,\n Select,\n SelectProps,\n Stack,\n Tooltip,\n useFormControl,\n} from \"@mui/material\";\nimport { assertTruthy } from \"@nvon/baseline\";\nimport { useFormContext } from \"react-hook-form\";\nimport { formContextNull } from \"../../errorMessages\";\nimport { getFormError } from \"../../formHelper/getFormError\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { useSortedOptionsWithGroup } from \"../../formHelper/useSortedOptionsWithGroup\";\nimport { FormField, LabeledValueWithGrouping } from \"../../inputTypes\";\n\nexport interface InputSelectProps {\n formField: FormField;\n selectableOptions: LabeledValueWithGrouping[];\n placeholderText: string;\n selectComponentProps?: Omit<\n SelectProps,\n \"labelId\" | \"error\" | \"label\" | \"value\"\n >;\n /**\n * Element that is rendered in the end of a select item and holds\n * a tooltip with the disabled message for this option.\n *\n * If none is given the element is disabled without rendering a tooltip.\n */\n tooltipHolder?: JSX.Element;\n}\n\n/**\n * Renders a MUI select based that is embedded in a react hook\n * form context.\n *\n * @throws Error when FormContext is null.\n */\nexport const InputSelect = ({\n formField,\n selectableOptions,\n placeholderText,\n selectComponentProps,\n tooltipHolder,\n}: InputSelectProps): JSX.Element => {\n const form = useFormContext();\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { register, watch, formState } = form;\n\n const error = getFormError(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField, formField.t);\n\n const defaultValue = selectComponentProps?.multiple ? [] : \"\";\n\n const value =\n (watch(name) as string | number | undefined | string[] | number[]) ??\n defaultValue;\n\n if (selectComponentProps?.multiple && value) {\n assertTruthy(\n Array.isArray(value),\n \"Value for multiple select need to be an array or undefined\"\n );\n } else if (value) {\n assertTruthy(\n [\"string\", \"number\"].includes(typeof value),\n \"Value for select input has unexpected type\"\n );\n }\n\n const id = `input-select-${name}`;\n const sortedOptions = useSortedOptionsWithGroup(selectableOptions);\n\n return (\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <InputLabel id={id} required={required}>\n {label}\n </InputLabel>\n\n <Select\n labelId={id}\n {...selectComponentProps}\n error={!!formState.errors[name]}\n label={label}\n value={value}\n {...register(name, {\n required: required ? requiredErrorMessage : false,\n validate,\n disabled: muiFormControl?.disabled,\n })}\n >\n <MenuItem value=\"\">\n <em>{placeholderText}</em>\n </MenuItem>\n\n {sortedOptions?.map((option, index) => {\n const optionBefore = sortedOptions[index - 1];\n const showGroup =\n (optionBefore || index == 0) &&\n option.group &&\n optionBefore?.group !== option.group;\n const disabledText =\n typeof option.disabled === \"string\" ? option.disabled : undefined;\n const isDisabled = !!disabledText || !!option.disabled;\n\n const menuItem = (\n <MenuItem\n key={option.label}\n value={option.value}\n disabled={isDisabled}\n title={\n typeof option.disabled === \"string\"\n ? option.disabled\n : undefined\n }\n selected={value === option.value}\n >\n {option.label}\n </MenuItem>\n );\n\n const wrappedMenuItem = disabledText ? (\n <Box sx={{ position: \"relative\" }}>\n {menuItem}\n\n <Stack\n direction=\"column\"\n justifyContent={\"center\"}\n spacing={1}\n sx={{\n position: \"absolute\",\n right: (th) => th.spacing(0.5),\n top: 0,\n bottom: 0,\n }}\n >\n {tooltipHolder ? (\n <Tooltip title={disabledText}>{tooltipHolder}</Tooltip>\n ) : null}\n </Stack>\n </Box>\n ) : (\n menuItem\n );\n\n return showGroup\n ? [\n <ListSubheader key={option.group}>\n {option.group}\n </ListSubheader>,\n wrappedMenuItem,\n ]\n : wrappedMenuItem;\n })}\n </Select>\n\n {error?.message && <FormHelperText>{error?.message}</FormHelperText>}\n </FormControl>\n );\n};\n","import { assertTruthy } from \"@nvon/baseline\";\nimport { useMemo } from \"react\";\nimport { LabeledValue } from \"../../inputTypes\";\nimport { InputSelect } from \"../InputSelect/InputSelect\";\nimport { InputSelectFromEnumProps } from \"./InputSelectFromEnumInterfaces\";\n\n/**\n * Renders a MUI select based on an enum that is embedded in a react hook form context.\n */\nexport const InputSelectFromEnum = <EnumType extends Record<string, string>>(\n props: InputSelectFromEnumProps<EnumType>\n): JSX.Element => {\n const { enumData, formField } = props;\n const translateFunction = formField.t;\n\n const options: LabeledValue[] = useMemo(() => {\n return Object.entries(enumData.enumToUse).map(([, value]) => {\n const label = enumData.labelsForEnum[value];\n\n assertTruthy(label, \"Could not find a label for value\" + value);\n\n if (typeof label === \"string\") {\n return { label, value };\n }\n\n assertTruthy(\n translateFunction,\n \"If you want to use translated labels you need to provide a translate function in the HookFormProvider.\"\n );\n\n return {\n label: label(translateFunction),\n value,\n };\n });\n }, [enumData.enumToUse, enumData.labelsForEnum, translateFunction]);\n\n return (\n <InputSelect {...props} selectableOptions={options} formField={formField} />\n );\n};\n","import { rethrow } from \"@nvon/baseline\";\nimport { FormEvent } from \"react\";\n\nexport type FormSubmitHandlerAsync = (event?: FormEvent) => Promise<void>;\nexport type FormSubmitHandler = (event?: FormEvent) => void;\n\n/**\n * Turn an async submitHandler into a synchronous one.\n *\n * Reasoning:\n * - we're often talking to the API during form submission. The onSubmit handler will be returning a Promise in this case.\n * - the `form` element, per definition, always expects a synchronous function.\n * - creating on inline function in every form is a bit clumsy, and does not look clean.\n *\n * Then/catch cases should be properly handled by the submit handler itself,\n * the catch supplied here is only a last safety net against an \"unhandled promise rejection\" error.\n */\nexport const syncSubmit = (\n asyncSubmitHandler: FormSubmitHandlerAsync\n): FormSubmitHandler => {\n return (e) => {\n asyncSubmitHandler(e).catch(rethrow);\n };\n};\n","import { identity } from \"lodash-es\";\nimport {\n FieldPath,\n FieldValues,\n useForm,\n UseFormProps,\n UseFormReturn,\n} from \"react-hook-form\";\n\n/**\n * Gets a TypeScript-validated field name.\n */\nexport type FieldNameGetter<TFieldValues extends FieldValues> = (\n fieldName: FieldPath<TFieldValues>\n) => FieldPath<TFieldValues>;\n\n/**\n * Not sure what this represents,\n * but it's the seconds generic argument in RHFs type declarations.\n *\n * Using any here seems fine so far.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ReactHookFormContext = any;\n\n/**\n * The react-hook-form useForm returnType,\n * amended with our custom function to validate a field name.\n */\nexport type FormReturn<TFieldValues extends FieldValues> = UseFormReturn<\n TFieldValues,\n ReactHookFormContext\n> & {\n fieldName: FieldNameGetter<TFieldValues>;\n};\n\n/**\n * Wrapper around react-hook-form's useForm.\n *\n * Should behave like the original function, only exposing a \"fieldName\"\n * function on top which is used to validate field names.\n */\nexport const useHookForm = <TFieldValues extends FieldValues>(\n props?: UseFormProps<TFieldValues, ReactHookFormContext>\n): FormReturn<TFieldValues> => {\n const form = useForm<TFieldValues>(props);\n\n return {\n ...form,\n fieldName: identity,\n };\n};\n","import { identity } from \"lodash-es\";\nimport { FieldValues, useFormContext } from \"react-hook-form\";\nimport { FormReturn } from \"./useHookForm\";\n\n/**\n * Wrapper around react-hook-form's useFormContext.\n *\n * Should behave like the original function, only exposing a \"fieldName\"\n * function on top which is used to validate field names.\n */\nexport const useHookFormContext = <\n TFieldValues extends FieldValues\n>(): FormReturn<TFieldValues> => {\n const form = useFormContext<TFieldValues>();\n\n return {\n ...form,\n fieldName: identity,\n };\n};\n"],"names":["LoadingButtonState","LoadingButton","buttonText","buttonTextSuccess","loadingButtonProps","loadingButtonPropsPropsSuccess","buttonState","successIcon","isSuccess","Success","propsToSpread","_jsx","MuiLoadingButton","loading","Loading","disabled","Idle","children","_jsxs","_Fragment","loadingButtonStateFromReactQueryMutationStatus","mutationStatus","mapStatus","idle","error","success","useLoadingButtonStateFromFormContext","formContext","useFormContext","loadingButtonStateFromFormState","formState","isSubmitting","isDirty","isSubmitSuccessful","HookFormProvider","FormProvider","formContextNull","getFormError","errors","fieldName","nestedKeys","split","reduce","errorObj","pathKey","useTranslateString","t","Error","useCallback","input","useMergedFormField","formField","formFieldDefaults","translate","merged","useMemo","builtInDefaults","label","uppercaseFirstLetter","name","required","requiredErrorMessage","validate","undefined","withPlainStrings","translated","InputText","textFieldProps","form","muiFormControl","useFormControl","register","FormControl","InputLabel","OutlinedInput","message","FormHelperText","InputEmail","props","formDefaults","type","emailInput","match","InputPasswordSet","passwordField","passwordValidationField","doNotMatchError","watch","passwordFieldMerged","validationFieldMerged","validatePasswordMatch","value","passwordValue","GroupLabelSorting","useSortedOptionsWithGroup","selectableOptions","sorting","Alphabetical","GroupMemberCountAsc","groupCounts","acc","option","group","sort","a","b","groupA","groupB","icon","CheckBoxOutlineBlank","fontSize","checkedIcon","CheckBox","InputAutocomplete","noOptions","autoCompleteProps","checkboxesForMultiselect","renderCheckboxes","groupSorting","setValue","sortedOptions","multiSelect","multiple","valueToUse","assertTruthy","includes","currentValue","filter","o","Array","isArray","find","renderOption","liProps","Checkbox","sx","mr","checked","item","Autocomplete","options","getOptionLabel","objectHasKey","onChange","e","selectedOption","map","shouldDirty","shouldValidate","shouldTouch","noOptionsText","renderInput","params","TextField","variant","groupBy","InputCheckbox","jsxLabel","checkboxProps","formControlLabelProps","useFormState","changeEv","target","id","registered","FormControlLabel","control","InputDatePicker","datePickerProps","date","setDate","useState","Date","Box","Controller","defaultValue","render","field","restField","DatePicker","event","InputDateTimePicker","dateTimePickerProps","DateTimePicker","ampm","InputRadio","radioGroupProps","FormLabel","RadioGroup","_createElement","key","Radio","InputSelect","placeholderText","selectComponentProps","tooltipHolder","Select","labelId","MenuItem","index","optionBefore","showGroup","disabledText","isDisabled","menuItem","title","selected","wrappedMenuItem","position","Stack","direction","justifyContent","spacing","right","th","top","bottom","Tooltip","ListSubheader","InputSelectFromEnum","enumData","translateFunction","Object","entries","enumToUse","labelsForEnum","syncSubmit","asyncSubmitHandler","catch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C,EAAE,CAACiI,QAAQ,CAACI,SAAS,EAAEJ,QAAQ,CAACK,aAAa,EAAEJ,iBAAiB,CAAC,CAAC,CAAA;EAEnE,oBACElN,GAAA,CAACqL,WAAW,EAAA;AAAA,IAAA,GAAKlH,KAAK;AAAEiB,IAAAA,iBAAiB,EAAE6C,OAAQ;AAACzF,IAAAA,SAAS,EAAEA,SAAAA;GAAa,CAAA,CAAA;AAEhF;;AClCA;;;;;;;;;;AAUG;AACU+K,MAAAA,UAAU,GACrBC,kBAA0C,IACrB;AACrB,EAAA,OAAQnF,CAAC,IAAI;AACXmF,IAAAA,kBAAkB,CAACnF,CAAC,CAAC,CAACoF,KAAK,CAACC,OAAO,CAAC,CAAA;GACrC,CAAA;AACH;;ACaA;;;;;AAKG;AACUC,MAAAA,WAAW,GACtBxJ,KAAwD,IAC5B;AAC5B,EAAA,MAAMV,IAAI,GAAGmK,OAAO,CAAezJ,KAAK,CAAC,CAAA;EAEzC,OAAO;AACL,IAAA,GAAGV,IAAI;AACP7B,IAAAA,SAAS,EAAEiM,QAAAA;GACZ,CAAA;AACH;;AC/CA;;;;;AAKG;AACUC,MAAAA,kBAAkB,GAAGA,MAEF;EAC9B,MAAMrK,IAAI,GAAGxC,cAAc,EAAgB,CAAA;EAE3C,OAAO;AACL,IAAA,GAAGwC,IAAI;AACP7B,IAAAA,SAAS,EAAEiM,QAAAA;GACZ,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"packageExports.js","sources":["../../src/formFields/errorMessages.ts","../../src/formFields/formHelper/getFormErrorForNestedKeys.ts","../../src/errors/FormFieldErrorDisplay.tsx","../../src/errors/FormFieldError.tsx","../../src/formFields/formHelper/useTranslateString.ts","../../src/formFields/formHelper/useMergedFormField.ts","../../src/formFields/baseTypes/InputAutocomplete/useSortedOptionsWithGroup.ts","../../src/formFields/baseTypes/InputAutocomplete/InputAutocomplete.tsx","../../src/formFields/baseTypes/InputCheckbox/InputCheckbox.tsx","../../src/formFields/baseTypes/InputDatePicker/InputDatePicker.tsx","../../src/formFields/baseTypes/InputDateTimePicker/InputDateTimePicker.tsx","../../src/formFields/baseTypes/InputOutlinedInput/InputOutlinedInput.tsx","../../src/formFields/baseTypes/InputRadio/InputRadio.tsx","../../src/formFields/formHelper/useSortedOptionsWithGroup.ts","../../src/formFields/baseTypes/InputSelect/InputSelect.tsx","../../src/formFields/baseTypes/InputSelectFromEnum/InputSelectFromEnum.tsx","../../src/formFields/baseTypes/InputText/InputTextField.tsx","../../src/formFields/formHelper/syncSubmit.ts","../../src/formFields/formHelper/useHookForm.ts","../../src/formFields/formHelper/useHookFormContext.ts","../../src/formFields/HookFormProvider.tsx","../../src/formFields/InputEmail/InputEmail.tsx","../../src/formFields/InputPasswordSet/InputPasswordSet.tsx","../../src/LoadingButton/LoadingButtonInterfaces.ts","../../src/LoadingButton/LoadingButton.tsx","../../src/LoadingButton/getLoadingButtonState.ts"],"sourcesContent":["export const formContextNull =\n \"FormContext is null. This should not happen. You may need to use the HookFormProvider instead of the FormProvider exported by react-hook-form\";\n","import { AnyObject } from \"@nvon/baseline\";\nimport { FieldError, FormState } from \"react-hook-form\";\n\n/**\n * Get the field errors for a (possibly nested) field name.\n *\n * Checking `formState.errors[fieldName]` only works if fieldName is not a path\n * (e.g. Does not include dots).\n *\n * Did not find a built-in way to do this … there might be one though.\n */\nexport const getFormErrorForNestedKeys = (\n errors: FormState<AnyObject>[\"errors\"],\n fieldName: string\n): FieldError | FieldError[] | undefined => {\n const nestedKeys = fieldName.split(\".\");\n\n //\n // To my best knowledge, this works as expected.\n //\n // It recursively walks the error object by the given keys\n // until the lowest level is reached, or undefined returned.\n //\n // Typescript is just not very happy with the dynamic nature of this,\n // hence the errors.\n //\n\n /* eslint-disable @typescript-eslint/ban-ts-comment,@typescript-eslint/no-unsafe-return */\n // @ts-expect-error\n return nestedKeys.reduce(\n // @ts-expect-error\n (errorObj: FieldError | undefined, pathKey) => errorObj?.[pathKey],\n errors\n );\n /* eslint-enable */\n};\n","import { FormHelperText } from \"@mui/material\";\nimport { filterNoUndefinedNoNull } from \"@nvon/baseline\";\nimport { FieldError } from \"react-hook-form\";\n\n/**\n * Renders field errors in an opinionated way.\n *\n */\nexport const FormFieldErrorDisplay = ({\n error,\n}: {\n error: FieldError | FieldError[] | undefined;\n}): JSX.Element | null => {\n if (Array.isArray(error)) {\n return (\n <FormHelperText>\n {error\n .map((e) => e.message)\n .filter(filterNoUndefinedNoNull)\n .join(\", \")}\n </FormHelperText>\n );\n }\n\n if (error?.message) {\n return <FormHelperText>{error?.message}</FormHelperText>;\n }\n\n return null;\n};\n","import { useFormContext } from \"react-hook-form\";\nimport { formContextNull } from \"../formFields/errorMessages\";\nimport { getFormErrorForNestedKeys } from \"../formFields/formHelper/getFormErrorForNestedKeys\";\nimport { FormFieldErrorDisplay } from \"./FormFieldErrorDisplay\";\n\n/**\n * Renders field errors in an opinionated way.\n *\n * @throws Error when FormContext is null.\n */\nexport const FormFieldError = ({\n fieldName,\n}: {\n fieldName: string;\n}): JSX.Element | null => {\n const form = useFormContext();\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { formState } = form;\n\n const error = getFormErrorForNestedKeys(formState.errors, fieldName);\n\n return <FormFieldErrorDisplay error={error} />;\n};\n","import { t, TFunction } from \"i18next\";\nimport { useCallback } from \"react\";\nimport { TranslatedString } from \"../TranslatedString\";\n\n/**\n * Return a function which turns our TranslatedString into a plain string.\n *\n * @throws Error if no t was provided but a translated string.\n */\nexport const useTranslateString = (): ((\n input: TranslatedString | string,\n t?: TFunction\n) => string) => {\n if (!t) {\n throw Error(\n \"If you pass in a translated validate function you need to provide a t\"\n );\n }\n\n return useCallback((input: TranslatedString | string) => {\n return typeof input === \"string\" ? input : input(t);\n }, []);\n};\n","import { uppercaseFirstLetter } from \"@nvon/baseline\";\nimport { TFunction } from \"i18next\";\nimport { useMemo } from \"react\";\nimport { RegisterOptions } from \"react-hook-form\";\nimport {\n FormField,\n FormFieldTranslated,\n TranslatedValidate,\n} from \"../inputTypes\";\nimport { useTranslateString } from \"./useTranslateString\";\n\n/**\n * Merge a form field with defaults.\n */\nexport const useMergedFormField = (\n /**\n * Form fields, typically those passed into a component.\n *\n */\n formField: FormField,\n t?: TFunction,\n /**\n * Additional defaults. Duplicate values will be overridden by the formField.\n */\n formFieldDefaults?: Partial<FormField>\n): FormFieldTranslated => {\n const translate = useTranslateString();\n\n const merged = useMemo(() => {\n const builtInDefaults = {\n label: uppercaseFirstLetter(formField.name),\n required: false,\n requiredErrorMessage: \"Please fill in required information\",\n validate: undefined,\n };\n\n return {\n ...builtInDefaults,\n ...formFieldDefaults,\n ...formField,\n };\n }, [formField, formFieldDefaults]);\n\n const withPlainStrings = useMemo(() => {\n // Translating the validate function is a bit tricky,\n // since it can be an object in both cases.\n const validate = (() => {\n if (\n typeof merged.validate === \"object\" &&\n typeof merged.validate.translated === \"function\"\n ) {\n if (!t) {\n throw Error(\n \"If you pass in a translated validate function you need to provide a t\"\n );\n }\n\n return (merged.validate.translated as TranslatedValidate)(t);\n }\n\n return merged.validate;\n })() as RegisterOptions[\"validate\"]; // This should be fine. Not sure why TS is complaining.\n\n return {\n ...merged,\n label: translate(merged.label, t),\n requiredErrorMessage: translate(merged.requiredErrorMessage, t),\n validate,\n };\n }, [merged, t, translate]);\n\n return withPlainStrings;\n};\n","import { useMemo } from \"react\";\nimport { LabeledValueWithGrouping } from \"../../inputTypes\";\n\nexport enum GroupLabelSorting {\n Alphabetical = \"alphabetical\",\n GroupMemberCountAsc = \"groupMemberCountAsc\",\n}\n\n/**\n * Sorts option in the desired order.\n */\nexport const useSortedOptionsWithGroup = (\n selectableOptions: LabeledValueWithGrouping[],\n sorting: GroupLabelSorting = GroupLabelSorting.Alphabetical\n): LabeledValueWithGrouping[] => {\n return useMemo(() => {\n if (sorting === GroupLabelSorting.GroupMemberCountAsc) {\n const groupCounts = selectableOptions.reduce((acc, option) => {\n if (option.group) {\n acc[option.group] = (acc[option.group] || 0) + 1;\n }\n return acc;\n }, {} as Record<string, number>);\n\n return selectableOptions.sort((a, b) => {\n if (a.group == undefined && !!b.group) {\n return -1;\n }\n\n if (a.group && b.group) {\n const groupA = groupCounts[a.group];\n const groupB = groupCounts[b.group];\n\n if (groupA && groupB && groupA < groupB) {\n return -1;\n } else if (groupCounts[a.group] === groupCounts[b.group]) {\n if (b.label > a.label) {\n return -1;\n }\n\n return 1;\n }\n\n return 1;\n }\n\n if (b.label > a.label) {\n return -1;\n }\n\n return 1;\n });\n }\n\n return selectableOptions.sort((a, b) => {\n if (a.group == undefined && !!b.group) {\n return -1;\n }\n\n if (a.group && b.group && a.group < b.group) {\n return -1;\n }\n\n if (a.group == b.group && b.label > a.label) {\n return 1;\n }\n\n return 0;\n });\n }, [selectableOptions, sorting]);\n};\n","import { CheckBox, CheckBoxOutlineBlank } from \"@mui/icons-material\";\nimport {\n Autocomplete,\n Checkbox,\n ChipTypeMap,\n FormControl,\n TextField,\n useFormControl,\n} from \"@mui/material\";\nimport { assertTruthy, objectHasKey } from \"@nvon/baseline\";\nimport { useMemo } from \"react\";\nimport { useFormContext } from \"react-hook-form\";\nimport { FormFieldError } from \"../../../errors/FormFieldError\";\nimport { formContextNull } from \"../../errorMessages\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport {\n FormField,\n LabeledValue,\n LabeledValueWithGrouping,\n} from \"../../inputTypes\";\nimport { InputAutocompleteProps } from \"./InputAutocompleteInterfaces\";\nimport { useSortedOptionsWithGroup } from \"./useSortedOptionsWithGroup\";\n\nconst icon = <CheckBoxOutlineBlank fontSize=\"small\" />;\nconst checkedIcon = <CheckBox fontSize=\"small\" />;\n\n/**\n * Renders a MUI autocomplete input that is embedded in a react hook form context.\n *\n * @throws Error when FormContext is null.\n */\nexport const InputAutocomplete = <\n T,\n Multiple extends boolean | undefined = false,\n DisableClearable extends boolean | undefined = false,\n FreeSolo extends boolean | undefined = false,\n ChipComponent extends React.ElementType = ChipTypeMap[\"defaultComponent\"],\n>({\n formField,\n selectableOptions,\n noOptions,\n autoCompleteProps,\n checkboxesForMultiselect: renderCheckboxes,\n groupSorting,\n}: InputAutocompleteProps<\n T,\n Multiple,\n DisableClearable,\n FreeSolo,\n ChipComponent\n>): JSX.Element => {\n const form = useFormContext();\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { register, watch, formState, setValue } = form;\n\n const error = getFormErrorForNestedKeys(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField, formField.t);\n\n const sortedOptions = useSortedOptionsWithGroup(\n selectableOptions,\n groupSorting\n );\n\n const value = watch(name) as\n | string\n | number\n | string[]\n | number[]\n | undefined;\n\n const multiSelect = !!autoCompleteProps?.multiple;\n\n let valueToUse = value;\n if (!value) {\n valueToUse = multiSelect ? [] : \"\";\n }\n\n assertTruthy(\n [\"string\", \"number\", \"object\"].includes(typeof valueToUse),\n \"Value for select input has unexpected type\"\n );\n\n const props = register(name, {\n required: required ? requiredErrorMessage : false,\n validate,\n disabled: muiFormControl?.disabled,\n });\n\n const currentValue = useMemo(() => {\n return multiSelect\n ? selectableOptions.filter((o) => {\n if (Array.isArray(valueToUse)) {\n return valueToUse.includes(o.value as never);\n }\n\n return selectableOptions.find(\n (option) => option.value === valueToUse\n );\n })\n : selectableOptions.find((option) => option.value === valueToUse);\n }, [multiSelect, selectableOptions, valueToUse]);\n\n const renderOption = useMemo(() => {\n if (autoCompleteProps?.renderOption) {\n return autoCompleteProps.renderOption;\n }\n\n return multiSelect && renderCheckboxes\n ? (liProps: object, option: LabeledValue) => (\n <li {...liProps}>\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n sx={{ mr: 2 }}\n checked={\n Array.isArray(currentValue)\n ? !!currentValue.find((item) => item.value === option.value)\n : false\n }\n />\n\n {option.label}\n </li>\n )\n : undefined;\n }, [\n autoCompleteProps?.renderOption,\n currentValue,\n multiSelect,\n renderCheckboxes,\n ]);\n\n return (\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <Autocomplete\n options={sortedOptions}\n value={currentValue || \"\"}\n {...props}\n label={label}\n renderOption={renderOption}\n multiple={multiSelect}\n getOptionLabel={(o) => {\n if (objectHasKey(o, \"label\")) {\n return o.label;\n }\n\n return \"\";\n }}\n onChange={(e, selectedOption: LabeledValue | LabeledValue[]) => {\n if (Array.isArray(selectedOption)) {\n setValue(\n name,\n selectedOption.map((o) => o.value),\n {\n shouldDirty: true,\n shouldValidate: true,\n shouldTouch: true,\n }\n );\n } else if (selectedOption) {\n setValue(name, selectedOption.value, {\n shouldDirty: true,\n shouldValidate: true,\n shouldTouch: true,\n });\n }\n }}\n noOptionsText={noOptions}\n renderInput={(params) => (\n <TextField {...params} label={label} variant=\"outlined\" />\n )}\n groupBy={(option: LabeledValueWithGrouping) => option.group || \"Choose\"}\n // need to parse this as any in order to get no typing errors\n // for multiselect\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n {...(autoCompleteProps as any)}\n />\n\n <FormFieldError fieldName={formField.name} />\n </FormControl>\n );\n};\n","import {\n Checkbox,\n CheckboxProps,\n FormControl,\n FormControlLabel,\n FormControlLabelProps,\n useFormControl,\n} from \"@mui/material\";\nimport { ChangeEvent, useCallback } from \"react\";\nimport { useFormContext, useFormState } from \"react-hook-form\";\nimport { FormFieldErrorDisplay } from \"../../../errors/FormFieldErrorDisplay\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\nexport interface InputCheckboxProps {\n formField: FormField;\n checkboxProps?: Omit<CheckboxProps, \"checked\">;\n formControlLabelProps?: Omit<FormControlLabelProps, \"control\" | \"label\">;\n /**\n * In contrast to other FormFields,\n * the checkbox supports jsx elements as a label.\n *\n * If this is provided, formField.label will be ignored.\n */\n jsxLabel?: JSX.Element;\n}\n\n/**\n * Input for Checking a box indicating acceptance of something.\n */\nexport const InputCheckbox = ({\n formField,\n jsxLabel,\n checkboxProps,\n formControlLabelProps,\n}: InputCheckboxProps): JSX.Element => {\n const { register, watch, setValue } = useFormContext();\n const { errors } = useFormState();\n\n const error = getFormErrorForNestedKeys(errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField);\n\n const changeEv = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(name, e.target.checked, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true,\n });\n },\n [name, setValue]\n );\n\n const id = `rvo-input-checkbox-${name}`;\n\n const registered = register(name, {\n required: required ? requiredErrorMessage : false,\n onChange: changeEv,\n validate,\n disabled: muiFormControl?.disabled,\n });\n\n const value = (watch(name, false) as boolean | undefined) ?? false;\n\n return (\n <FormControl error={!!error} disabled={muiFormControl?.disabled}>\n <FormControlLabel\n required={jsxLabel ? false : required} // If jsxLabel is set, we don't want to show the asterisk.\n control={\n <Checkbox\n checked={value}\n aria-labelledby={id}\n {...registered}\n {...checkboxProps}\n />\n }\n label={jsxLabel ?? label}\n {...formControlLabelProps}\n />\n\n <FormFieldErrorDisplay error={error} />\n </FormControl>\n );\n};\n","import {\n Box,\n FormControl,\n TextField,\n TextFieldProps,\n useFormControl,\n} from \"@mui/material\";\nimport {\n DatePicker,\n DatePickerProps as MuiDatePickerProps,\n} from \"@mui/x-date-pickers\";\nimport { useState } from \"react\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport { FormFieldErrorDisplay } from \"../../../errors/FormFieldErrorDisplay\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\n/**\n * Mangled version of the original DatePickerProps type\n * from @mui/x-date-pickers.\n */\ninterface DatePickerProps\n extends Omit<\n MuiDatePickerProps<TextFieldProps, Date>,\n \"label\" | \"onChange\" | \"disabled\" | \"value\" | \"renderInput\"\n > {\n renderInput?: MuiDatePickerProps<TextFieldProps, Date>[\"renderInput\"];\n}\n\nexport interface InputDatePickerProps {\n formField: FormField;\n datePickerProps?: DatePickerProps;\n}\n\n/**\n * A Datetime picker that works with react hook form.\n */\nexport const InputDatePicker = ({\n formField,\n datePickerProps,\n}: InputDatePickerProps): JSX.Element => {\n const { formState, control } = useFormContext();\n const error = getFormErrorForNestedKeys(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required } = useMergedFormField(formField);\n\n const [date, setDate] = useState<Date>(new Date());\n\n return (\n <Box>\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <Controller\n name={name}\n defaultValue={date}\n control={control}\n render={({ field: { onChange, ...restField } }) => (\n <DatePicker\n label={label}\n onChange={(event: Date | null) => {\n onChange(event);\n\n if (event) {\n setDate(event);\n }\n }}\n disabled={muiFormControl?.disabled}\n renderInput={\n datePickerProps?.renderInput\n ? datePickerProps.renderInput\n : (params) => <TextField required={required} {...params} />\n }\n {...restField}\n {...datePickerProps}\n />\n )}\n />\n\n <FormFieldErrorDisplay error={error} />\n </FormControl>\n </Box>\n );\n};\n","import {\n Box,\n FormControl,\n TextField,\n TextFieldProps,\n useFormControl,\n} from \"@mui/material\";\nimport {\n DateTimePicker,\n DateTimePickerProps as MuiDateTimePickerProps,\n} from \"@mui/x-date-pickers\";\nimport { useState } from \"react\";\nimport { Controller, useFormContext } from \"react-hook-form\";\nimport { FormFieldErrorDisplay } from \"../../../errors/FormFieldErrorDisplay\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\n/**\n * Mangled version of the original DateTimePickerProps type\n * from @mui/x-date-pickers.\n */\ninterface DateTimePickerProps\n extends Omit<\n MuiDateTimePickerProps<TextFieldProps, Date>,\n \"label\" | \"onChange\" | \"disabled\" | \"value\" | \"renderInput\"\n > {\n renderInput?: MuiDateTimePickerProps<TextFieldProps, Date>[\"renderInput\"];\n}\n\nexport interface InputDateTimePickerProps {\n formField: FormField;\n dateTimePickerProps?: DateTimePickerProps;\n}\n\n/**\n * A Datetime picker that works with react hook form.\n */\nexport const InputDateTimePicker = ({\n formField,\n dateTimePickerProps,\n}: InputDateTimePickerProps): JSX.Element => {\n const { formState, control } = useFormContext();\n const error = getFormErrorForNestedKeys(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required } = useMergedFormField(formField);\n\n const [date, setDate] = useState<Date>(new Date());\n\n return (\n <Box>\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <Controller\n name={name}\n defaultValue={date}\n control={control}\n render={({ field: { onChange, ...restField } }) => (\n <DateTimePicker\n label={label}\n ampm={\n dateTimePickerProps?.ampm ? dateTimePickerProps.ampm : false\n }\n onChange={(event: Date | null) => {\n onChange(event);\n\n if (event) {\n setDate(event);\n }\n }}\n disabled={muiFormControl?.disabled}\n renderInput={\n dateTimePickerProps?.renderInput\n ? dateTimePickerProps?.renderInput\n : (params) => <TextField required={required} {...params} />\n }\n {...restField}\n {...dateTimePickerProps}\n />\n )}\n />\n\n <FormFieldErrorDisplay error={error} />\n </FormControl>\n </Box>\n );\n};\n","import {\n FormControl,\n InputLabel,\n OutlinedInput,\n OutlinedInputProps,\n useFormControl,\n} from \"@mui/material\";\nimport { useFormContext } from \"react-hook-form\";\nimport { FormFieldErrorDisplay } from \"../../../errors/FormFieldErrorDisplay\";\nimport { formContextNull } from \"../../errorMessages\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\nexport interface InputOutlinedInputProps {\n formField: FormField;\n outlinedInputProps?: Omit<OutlinedInputProps, \"required\" | \"label\">;\n}\n\n/**\n * Renders a MUI input text fields that is embedded in a react\n * hook form context.\n *\n * @throws Error when FormContext is null.\n */\nexport const InputOutlinedInput = ({\n formField,\n outlinedInputProps,\n}: InputOutlinedInputProps): JSX.Element | null => {\n const form = useFormContext();\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate } =\n useMergedFormField(formField, formField.t);\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { register, formState } = form;\n const error = getFormErrorForNestedKeys(formState.errors, formField.name);\n\n return (\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <InputLabel required={required}>{label}</InputLabel>\n\n <OutlinedInput\n {...register(name, {\n required: required ? requiredErrorMessage : false,\n validate,\n disabled: muiFormControl?.disabled,\n })}\n required={required}\n label={label}\n {...outlinedInputProps}\n />\n\n <FormFieldErrorDisplay error={error} />\n </FormControl>\n );\n};\n","import {\n FormControl,\n FormControlLabel,\n FormControlLabelProps,\n FormLabel,\n Radio,\n RadioGroup,\n RadioGroupProps,\n useFormControl,\n} from \"@mui/material\";\nimport { assertTruthy } from \"@nvon/baseline\";\nimport { ChangeEvent, useCallback } from \"react\";\nimport { useFormContext, useFormState } from \"react-hook-form\";\nimport { FormFieldErrorDisplay } from \"../../../errors/FormFieldErrorDisplay\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField, LabeledValue } from \"../../inputTypes\";\n\nexport interface InputRadioProps {\n formField: FormField;\n selectableOptions: LabeledValue[];\n formControlLabelProps?: FormControlLabelProps;\n radioGroupProps?: RadioGroupProps;\n}\n\n/**\n * Input for selecting between a list of options using radio buttons.\n */\nexport const InputRadio = ({\n formField,\n selectableOptions,\n formControlLabelProps,\n radioGroupProps,\n}: InputRadioProps): JSX.Element => {\n const { register, watch, setValue } = useFormContext();\n const { errors } = useFormState();\n\n const error = getFormErrorForNestedKeys(errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField);\n\n const changeEv = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setValue(name, e.target.value, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true,\n });\n },\n [name, setValue]\n );\n\n const value = (watch(name) as string | number | undefined) ?? \"\";\n\n assertTruthy(\n [\"string\", \"number\"].includes(typeof value),\n \"Value for select input has unexpected type\"\n );\n\n const id = `rvo-input-radio-${name}`;\n\n const registered = register(name, {\n required: required ? requiredErrorMessage : false,\n onChange: changeEv,\n validate,\n disabled: muiFormControl?.disabled,\n });\n\n return (\n <FormControl error={!!error} disabled={muiFormControl?.disabled}>\n <FormLabel id={id} required={required}>\n {label}\n </FormLabel>\n\n <RadioGroup value={value} aria-labelledby={id} {...radioGroupProps}>\n {selectableOptions?.map((option) => {\n return (\n <FormControlLabel\n {...registered}\n key={option.value}\n value={option.value}\n control={<Radio />}\n label={option.label}\n {...formControlLabelProps}\n />\n );\n })}\n </RadioGroup>\n\n <FormFieldErrorDisplay error={error} />\n </FormControl>\n );\n};\n","import { useMemo } from \"react\";\nimport { LabeledValueWithGrouping } from \"../inputTypes\";\n\n/**\n * Sorts the options by group and value.\n */\nexport const useSortedOptionsWithGroup = (\n selectableOptions: LabeledValueWithGrouping[]\n): LabeledValueWithGrouping[] => {\n return useMemo(\n () =>\n selectableOptions.sort((a, b) => {\n if (a.group == undefined && !!b.group) {\n return -1;\n }\n\n if (a.group && b.group && a.group < b.group) {\n return -1;\n }\n\n if (a.group == b.group && b.value > a.value) {\n return 1;\n }\n\n return 0;\n }),\n [selectableOptions]\n );\n};\n","import {\n Box,\n FormControl,\n InputLabel,\n ListSubheader,\n MenuItem,\n Select,\n SelectProps,\n Stack,\n Tooltip,\n useFormControl,\n} from \"@mui/material\";\nimport { assertTruthy } from \"@nvon/baseline\";\nimport { useFormContext } from \"react-hook-form\";\nimport { FormFieldErrorDisplay } from \"../../../errors/FormFieldErrorDisplay\";\nimport { formContextNull } from \"../../errorMessages\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { useSortedOptionsWithGroup } from \"../../formHelper/useSortedOptionsWithGroup\";\nimport { FormField, LabeledValueWithGrouping } from \"../../inputTypes\";\n\nexport interface InputSelectProps {\n formField: FormField;\n selectableOptions: LabeledValueWithGrouping[];\n placeholderText: string;\n selectComponentProps?: Omit<\n SelectProps,\n \"labelId\" | \"error\" | \"label\" | \"value\"\n >;\n /**\n * Element that is rendered in the end of a select item and holds\n * a tooltip with the disabled message for this option.\n *\n * If none is given the element is disabled without rendering a tooltip.\n */\n tooltipHolder?: JSX.Element;\n}\n\n/**\n * Renders a MUI select based that is embedded in a react hook\n * form context.\n *\n * @throws Error when FormContext is null.\n */\nexport const InputSelect = ({\n formField,\n selectableOptions,\n placeholderText,\n selectComponentProps,\n tooltipHolder,\n}: InputSelectProps): JSX.Element => {\n const form = useFormContext();\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { register, watch, formState } = form;\n\n const error = getFormErrorForNestedKeys(formState.errors, formField.name);\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate }: FormField =\n useMergedFormField(formField, formField.t);\n\n const defaultValue = selectComponentProps?.multiple ? [] : \"\";\n\n const value =\n (watch(name) as string | number | undefined | string[] | number[]) ??\n defaultValue;\n\n if (selectComponentProps?.multiple && value) {\n assertTruthy(\n Array.isArray(value),\n \"Value for multiple select need to be an array or undefined\"\n );\n } else if (value) {\n assertTruthy(\n [\"string\", \"number\"].includes(typeof value),\n \"Value for select input has unexpected type\"\n );\n }\n\n const id = `input-select-${name}`;\n const sortedOptions = useSortedOptionsWithGroup(selectableOptions);\n\n return (\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <InputLabel id={id} required={required}>\n {label}\n </InputLabel>\n\n <Select\n labelId={id}\n {...selectComponentProps}\n error={!!formState.errors[name]}\n label={label}\n value={value}\n {...register(name, {\n required: required ? requiredErrorMessage : false,\n validate,\n disabled: muiFormControl?.disabled,\n })}\n >\n <MenuItem value=\"\">\n <em>{placeholderText}</em>\n </MenuItem>\n\n {sortedOptions?.map((option, index) => {\n const optionBefore = sortedOptions[index - 1];\n const showGroup =\n (optionBefore || index == 0) &&\n option.group &&\n optionBefore?.group !== option.group;\n const disabledText =\n typeof option.disabled === \"string\" ? option.disabled : undefined;\n const isDisabled = !!disabledText || !!option.disabled;\n\n const menuItem = (\n <MenuItem\n key={option.label}\n value={option.value}\n disabled={isDisabled}\n title={\n typeof option.disabled === \"string\"\n ? option.disabled\n : undefined\n }\n selected={value === option.value}\n >\n {option.label}\n </MenuItem>\n );\n\n const wrappedMenuItem = disabledText ? (\n <Box sx={{ position: \"relative\" }}>\n {menuItem}\n\n <Stack\n direction=\"column\"\n justifyContent={\"center\"}\n spacing={1}\n sx={{\n position: \"absolute\",\n right: (th) => th.spacing(0.5),\n top: 0,\n bottom: 0,\n }}\n >\n {tooltipHolder ? (\n <Tooltip title={disabledText}>{tooltipHolder}</Tooltip>\n ) : null}\n </Stack>\n </Box>\n ) : (\n menuItem\n );\n\n return showGroup\n ? [\n <ListSubheader key={option.group}>\n {option.group}\n </ListSubheader>,\n wrappedMenuItem,\n ]\n : wrappedMenuItem;\n })}\n </Select>\n\n <FormFieldErrorDisplay error={error} />\n </FormControl>\n );\n};\n","import { assertTruthy } from \"@nvon/baseline\";\nimport { useMemo } from \"react\";\nimport { LabeledValue } from \"../../inputTypes\";\nimport { InputSelect } from \"../InputSelect/InputSelect\";\nimport { InputSelectFromEnumProps } from \"./InputSelectFromEnumInterfaces\";\n\n/**\n * Renders a MUI select based on an enum that is embedded in a react hook form context.\n */\nexport const InputSelectFromEnum = <EnumType extends Record<string, string>>(\n props: InputSelectFromEnumProps<EnumType>\n): JSX.Element => {\n const { enumData, formField } = props;\n const translateFunction = formField.t;\n\n const options: LabeledValue[] = useMemo(() => {\n return Object.entries(enumData.enumToUse).map(([, value]) => {\n const label = enumData.labelsForEnum[value];\n\n assertTruthy(label, \"Could not find a label for value\" + value);\n\n if (typeof label === \"string\") {\n return { label, value };\n }\n\n assertTruthy(\n translateFunction,\n \"If you want to use translated labels you need to provide a translate function in the HookFormProvider.\"\n );\n\n return {\n label: label(translateFunction),\n value,\n };\n });\n }, [enumData.enumToUse, enumData.labelsForEnum, translateFunction]);\n\n return (\n <InputSelect {...props} selectableOptions={options} formField={formField} />\n );\n};\n","import {\n FormControl,\n TextField,\n TextFieldProps,\n useFormControl,\n} from \"@mui/material\";\nimport { useFormContext } from \"react-hook-form\";\nimport { FormFieldErrorDisplay } from \"../../../errors/FormFieldErrorDisplay\";\nimport { formContextNull } from \"../../errorMessages\";\nimport { getFormErrorForNestedKeys } from \"../../formHelper/getFormErrorForNestedKeys\";\nimport { useMergedFormField } from \"../../formHelper/useMergedFormField\";\nimport { FormField } from \"../../inputTypes\";\n\nexport interface InputTextFieldProps {\n formField: FormField;\n textFieldProps?: Omit<TextFieldProps, \"required\" | \"label\">;\n}\n\n/**\n * Renders a MUI input text fields that is embedded in a react\n * hook form context.\n *\n * @throws Error when FormContext is null.\n */\nexport const InputTextField = ({\n formField,\n textFieldProps,\n}: InputTextFieldProps): JSX.Element | null => {\n const form = useFormContext();\n const muiFormControl = useFormControl();\n\n const { label, name, required, requiredErrorMessage, validate } =\n useMergedFormField(formField, formField.t);\n\n if (!form) {\n throw Error(formContextNull);\n }\n\n const { register, formState } = form;\n const error = getFormErrorForNestedKeys(formState.errors, formField.name);\n\n return (\n <FormControl\n error={!!error}\n required={required}\n disabled={muiFormControl?.disabled}\n >\n <TextField\n {...register(name, {\n required: required ? requiredErrorMessage : false,\n validate,\n disabled: muiFormControl?.disabled,\n })}\n required={required}\n label={label}\n {...textFieldProps}\n />\n\n <FormFieldErrorDisplay error={error} />\n </FormControl>\n );\n};\n","import { rethrow } from \"@nvon/baseline\";\nimport { FormEvent } from \"react\";\n\nexport type FormSubmitHandlerAsync = (event?: FormEvent) => Promise<void>;\nexport type FormSubmitHandler = (event?: FormEvent) => void;\n\n/**\n * Turn an async submitHandler into a synchronous one.\n *\n * Reasoning:\n * - we're often talking to the API during form submission. The onSubmit handler will be returning a Promise in this case.\n * - the `form` element, per definition, always expects a synchronous function.\n * - creating on inline function in every form is a bit clumsy, and does not look clean.\n *\n * Then/catch cases should be properly handled by the submit handler itself,\n * the catch supplied here is only a last safety net against an \"unhandled promise rejection\" error.\n */\nexport const syncSubmit = (\n asyncSubmitHandler: FormSubmitHandlerAsync\n): FormSubmitHandler => {\n return (e) => {\n asyncSubmitHandler(e).catch(rethrow);\n };\n};\n","import { identity } from \"lodash-es\";\nimport {\n FieldPath,\n FieldValues,\n useForm,\n UseFormProps,\n UseFormReturn,\n} from \"react-hook-form\";\n\n/**\n * Gets a TypeScript-validated field name.\n */\nexport type FieldNameGetter<TFieldValues extends FieldValues> = (\n fieldName: FieldPath<TFieldValues>\n) => FieldPath<TFieldValues>;\n\n/**\n * Not sure what this represents,\n * but it's the seconds generic argument in RHFs type declarations.\n *\n * Using any here seems fine so far.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ReactHookFormContext = any;\n\n/**\n * The react-hook-form useForm returnType,\n * amended with our custom function to validate a field name.\n */\nexport type FormReturn<TFieldValues extends FieldValues> = UseFormReturn<\n TFieldValues,\n ReactHookFormContext\n> & {\n fieldName: FieldNameGetter<TFieldValues>;\n};\n\n/**\n * Wrapper around react-hook-form's useForm.\n *\n * Should behave like the original function, only exposing a \"fieldName\"\n * function on top which is used to validate field names.\n */\nexport const useHookForm = <TFieldValues extends FieldValues>(\n props?: UseFormProps<TFieldValues, ReactHookFormContext>\n): FormReturn<TFieldValues> => {\n const form = useForm<TFieldValues>(props);\n\n return {\n ...form,\n fieldName: identity,\n };\n};\n","import { identity } from \"lodash-es\";\nimport { FieldValues, useFormContext } from \"react-hook-form\";\nimport { FormReturn } from \"./useHookForm\";\n\n/**\n * Wrapper around react-hook-form's useFormContext.\n *\n * Should behave like the original function, only exposing a \"fieldName\"\n * function on top which is used to validate field names.\n */\nexport const useHookFormContext = <\n TFieldValues extends FieldValues\n>(): FormReturn<TFieldValues> => {\n const form = useFormContext<TFieldValues>();\n\n return {\n ...form,\n fieldName: identity,\n };\n};\n","import { FormProvider } from \"react-hook-form\";\n\n/**\n * Reexport of FormProvider.\n *\n * This became necessary as context is not available when the FormProvider is initialized outside of the package. Most likely this is some kind of instance mismatch.\n */\nexport const HookFormProvider = FormProvider;\n","import {\n InputOutlinedInput,\n InputOutlinedInputProps,\n} from \"../baseTypes/InputOutlinedInput/InputOutlinedInput\";\nimport { useMergedFormField } from \"../formHelper/useMergedFormField\";\nimport { FormField } from \"../inputTypes\";\n\nexport interface InputEmailProps {\n formField: FormField;\n outlinedInputProps?: InputOutlinedInputProps[\"outlinedInputProps\"];\n}\n\n/**\n * Renders a MUI input for an email address that is embedded in a react hook form context.\n */\nexport const InputEmail = (props: InputEmailProps): JSX.Element => {\n const merged = useMergedFormField(\n props.formField,\n props.formField.t,\n formDefaults\n );\n\n return (\n <InputOutlinedInput\n outlinedInputProps={{\n type: \"email\",\n ...props.outlinedInputProps,\n autoComplete: \"email\",\n }}\n formField={merged}\n />\n );\n};\n\nconst formDefaults: Omit<FormField, \"name\" | \"t\"> = {\n required: true,\n validate: (emailInput: string) => {\n if (emailInput.match(/.@./)) {\n return true;\n }\n\n return \"E-Mail address invalid\";\n },\n};\n","import { useCallback } from \"react\";\nimport {\n RegisterOptions,\n useFormContext,\n ValidateResult,\n} from \"react-hook-form\";\nimport { InputOutlinedInput } from \"../baseTypes/InputOutlinedInput/InputOutlinedInput\";\nimport { useMergedFormField } from \"../formHelper/useMergedFormField\";\nimport { InputPasswordSetProps } from \"./InputPasswordSetInterfaces\";\n\n/**\n * Two fields for setting a password set: input & validation.\n *\n * Checks for equality of both.\n */\nexport const InputPasswordSet = ({\n passwordField,\n passwordValidationField,\n doNotMatchError,\n}: InputPasswordSetProps): JSX.Element => {\n const { watch } = useFormContext();\n\n const passwordFieldMerged = useMergedFormField(\n passwordField,\n passwordField.t,\n { required: true }\n );\n const validationFieldMerged = useMergedFormField(\n passwordValidationField,\n passwordValidationField.t,\n { required: true }\n );\n\n const validatePasswordMatch: RegisterOptions[\"validate\"] = useCallback(\n (value: string): ValidateResult => {\n const passwordValue = watch(passwordFieldMerged.name) as string;\n\n return value === passwordValue || doNotMatchError;\n },\n [doNotMatchError, passwordFieldMerged.name, watch]\n );\n\n return (\n <>\n <InputOutlinedInput\n formField={passwordFieldMerged}\n outlinedInputProps={{\n type: \"password\",\n autoComplete: \"new-password\",\n }}\n />\n\n <InputOutlinedInput\n formField={{\n ...validationFieldMerged,\n validate: validatePasswordMatch,\n t: passwordValidationField.t,\n }}\n outlinedInputProps={{\n type: \"password\",\n autoComplete: \"new-password\",\n }}\n />\n </>\n );\n};\n","import { LoadingButtonProps as MuiLoadingButtonProps } from \"@mui/lab\";\nimport { ReactElement } from \"react\";\n\nexport enum LoadingButtonState {\n Idle = \"idle\",\n Loading = \"loading\",\n Success = \"success\",\n}\n\ntype SelectedButtonProps = Omit<MuiLoadingButtonProps, \"children\">;\n\nexport interface LoadingButtonProps {\n buttonState: LoadingButtonState;\n /**\n * Button label.\n */\n buttonText: string;\n /**\n * Button label that is displayed on success.\n */\n buttonTextSuccess?: string;\n /**\n * Provide an icon that is displayed in front of the text\n * when state is successful.\n */\n successIcon?: JSX.Element | ReactElement;\n /**\n * Adjust the button when the state is any other than successful.\n */\n loadingButtonProps?: SelectedButtonProps;\n /**\n * Adjust the button when the state is successful.\n */\n loadingButtonPropsPropsSuccess?: SelectedButtonProps;\n}\n","import { LoadingButton as MuiLoadingButton } from \"@mui/lab\";\nimport {\n LoadingButtonProps,\n LoadingButtonState,\n} from \"./LoadingButtonInterfaces\";\n\n/**\n * A loading button component.\n */\nexport const LoadingButton = ({\n buttonText,\n buttonTextSuccess,\n loadingButtonProps,\n loadingButtonPropsPropsSuccess,\n buttonState,\n successIcon,\n}: LoadingButtonProps): JSX.Element => {\n const isSuccess = buttonState === LoadingButtonState.Success;\n\n const propsToSpread = isSuccess\n ? loadingButtonPropsPropsSuccess\n : loadingButtonProps;\n\n return (\n <MuiLoadingButton\n loading={buttonState === LoadingButtonState.Loading}\n disabled={buttonState !== LoadingButtonState.Idle}\n {...propsToSpread}\n >\n {buttonState === LoadingButtonState.Success ? (\n <>\n {successIcon ? successIcon : null}\n\n {buttonTextSuccess ? buttonTextSuccess : buttonText}\n </>\n ) : (\n buttonText\n )}\n </MuiLoadingButton>\n );\n};\n","import { FormState, useFormContext } from \"react-hook-form\";\nimport { LoadingButtonState } from \"./LoadingButtonInterfaces\";\n\n/**\n * Redefinition of mutation status defined by react query. By doing this\n * we don't need to import react-query in the package.\n */\ndeclare type MutationStatus = \"idle\" | \"loading\" | \"success\" | \"error\";\n\n/**\n * Get loading button state from react-query mutation status.\n */\nexport const loadingButtonStateFromReactQueryMutationStatus = (\n mutationStatus: MutationStatus\n): LoadingButtonState => {\n const mapStatus: Record<MutationStatus, LoadingButtonState> = {\n idle: LoadingButtonState.Idle,\n error: LoadingButtonState.Idle,\n success: LoadingButtonState.Success,\n loading: LoadingButtonState.Loading,\n };\n\n return mapStatus[mutationStatus];\n};\n\n/**\n * Get loading button state from a react-hook-form context.\n */\nexport const useLoadingButtonStateFromFormContext = (): LoadingButtonState => {\n const formContext = useFormContext();\n\n return loadingButtonStateFromFormState(formContext.formState);\n};\n\n/**\n * Get loading button state from a react-hook-form state.\n */\nexport const loadingButtonStateFromFormState = (\n // we are not interested in the value types FormState holds\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n formState: FormState<any>\n): LoadingButtonState => {\n if (formState.isSubmitting) {\n return LoadingButtonState.Loading;\n }\n\n if (formState.isDirty) {\n return LoadingButtonState.Idle;\n }\n\n if (formState.isSubmitSuccessful) {\n return LoadingButtonState.Success;\n }\n\n return LoadingButtonState.Idle;\n};\n"],"names":["formContextNull","getFormErrorForNestedKeys","errors","fieldName","nestedKeys","split","reduce","errorObj","pathKey","FormFieldErrorDisplay","error","Array","isArray","_jsx","FormHelperText","children","map","e","message","filter","filterNoUndefinedNoNull","join","FormFieldError","form","useFormContext","Error","formState","useTranslateString","t","useCallback","input","useMergedFormField","formField","formFieldDefaults","translate","merged","useMemo","builtInDefaults","label","uppercaseFirstLetter","name","required","requiredErrorMessage","validate","undefined","withPlainStrings","translated","GroupLabelSorting","useSortedOptionsWithGroup","selectableOptions","sorting","Alphabetical","GroupMemberCountAsc","groupCounts","acc","option","group","sort","a","b","groupA","groupB","icon","CheckBoxOutlineBlank","fontSize","checkedIcon","CheckBox","InputAutocomplete","noOptions","autoCompleteProps","checkboxesForMultiselect","renderCheckboxes","groupSorting","register","watch","setValue","muiFormControl","useFormControl","sortedOptions","value","multiSelect","multiple","valueToUse","assertTruthy","includes","props","disabled","currentValue","o","find","renderOption","liProps","_jsxs","Checkbox","sx","mr","checked","item","FormControl","Autocomplete","options","getOptionLabel","objectHasKey","onChange","selectedOption","shouldDirty","shouldValidate","shouldTouch","noOptionsText","renderInput","params","TextField","variant","groupBy","InputCheckbox","jsxLabel","checkboxProps","formControlLabelProps","useFormState","changeEv","target","id","registered","FormControlLabel","control","InputDatePicker","datePickerProps","date","setDate","useState","Date","Box","Controller","defaultValue","render","field","restField","DatePicker","event","InputDateTimePicker","dateTimePickerProps","DateTimePicker","ampm","InputOutlinedInput","outlinedInputProps","InputLabel","OutlinedInput","InputRadio","radioGroupProps","FormLabel","RadioGroup","_createElement","key","Radio","InputSelect","placeholderText","selectComponentProps","tooltipHolder","Select","labelId","MenuItem","index","optionBefore","showGroup","disabledText","isDisabled","menuItem","title","selected","wrappedMenuItem","position","Stack","direction","justifyContent","spacing","right","th","top","bottom","Tooltip","ListSubheader","InputSelectFromEnum","enumData","translateFunction","Object","entries","enumToUse","labelsForEnum","InputTextField","textFieldProps","syncSubmit","asyncSubmitHandler","catch","rethrow","useHookForm","useForm","identity","useHookFormContext","HookFormProvider","FormProvider","InputEmail","formDefaults","type","autoComplete","emailInput","match","InputPasswordSet","passwordField","passwordValidationField","doNotMatchError","passwordFieldMerged","validationFieldMerged","validatePasswordMatch","passwordValue","_Fragment","LoadingButtonState","LoadingButton","buttonText","buttonTextSuccess","loadingButtonProps","loadingButtonPropsPropsSuccess","buttonState","successIcon","isSuccess","Success","propsToSpread","MuiLoadingButton","loading","Loading","Idle","loadingButtonStateFromReactQueryMutationStatus","mutationStatus","mapStatus","idle","success","useLoadingButtonStateFromFormContext","formContext","loadingButtonStateFromFormState","isSubmitting","isDirty","isSubmitSuccessful"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,eAAe,GAC1B,+IAA+I;;ACEjJ;;;;;;;AAOG;MACUC,yBAAyB,GAAGA,CACvCC,MAAsC,EACtCC,SAAiB,KACwB;AACzC,EAAA,MAAMC,UAAU,GAAGD,SAAS,CAACE,KAAK,CAAC,GAAG,CAAC,CAAA;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;EACA,OAAOD,UAAU,CAACE,MAAM;AACtB;EACA,CAACC,QAAgC,EAAEC,OAAO,KAAKD,QAAQ,GAAGC,OAAO,CAAC,EAClEN,MAAM,CACP,CAAA;AACD;AACF;;AC3BO,MAAMO,qBAAqB,GAAGA,CAAC;AACpCC,EAAAA,KAAAA;AAGD,CAAA,KAAwB;AACvB,EAAA,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;IACxB,oBACEG,GAAA,CAACC,cAAc,EAAA;AAAAC,MAAAA,QAAA,EACZL,KAAK,CACHM,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAAC,CACrBC,MAAM,CAACC,uBAAuB,CAAC,CAC/BC,IAAI,CAAC,IAAI,CAAA;KACG,CAAA,CAAA;AAEpB,GAAA;EAED,IAAIX,KAAK,EAAEQ,OAAO,EAAE;IAClB,oBAAOL,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AA8B,IACR;AACtB,EAAA,MAAMC,SAAS,GAA+C;IAC5DC,IAAI,EAAElB,kBAAkB,CAACc,IAAI;IAC7B3N,KAAK,EAAE6M,kBAAkB,CAACc,IAAI;IAC9BK,OAAO,EAAEnB,kBAAkB,CAACS,OAAO;IACnCG,OAAO,EAAEZ,kBAAkB,CAACa,OAAAA;GAC7B,CAAA;EAED,OAAOI,SAAS,CAACD,cAAc,CAAC,CAAA;AAClC,EAAC;AAED;;AAEG;AACUI,MAAAA,oCAAoC,GAAGA,MAAyB;EAC3E,MAAMC,WAAW,GAAGpN,cAAc,EAAE,CAAA;AAEpC,EAAA,OAAOqN,+BAA+B,CAACD,WAAW,CAAClN,SAAS,CAAC,CAAA;AAC/D,EAAC;AAED;;AAEG;AACI,MAAMmN,+BAA+B,GAAGA;AAC7C;AACA;AACAnN,SAAyB,KACH;EACtB,IAAIA,SAAS,CAACoN,YAAY,EAAE;IAC1B,OAAOvB,kBAAkB,CAACa,OAAO,CAAA;AAClC,GAAA;EAED,IAAI1M,SAAS,CAACqN,OAAO,EAAE;IACrB,OAAOxB,kBAAkB,CAACc,IAAI,CAAA;AAC/B,GAAA;EAED,IAAI3M,SAAS,CAACsN,kBAAkB,EAAE;IAChC,OAAOzB,kBAAkB,CAACS,OAAO,CAAA;AAClC,GAAA;EAED,OAAOT,kBAAkB,CAACc,IAAI,CAAA;AAChC;;;;"}
|
package/package.json
CHANGED
|
@@ -1 +1,79 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@nwon/react-mui-hook-form",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"MUI",
|
|
8
|
+
"React Hook Form",
|
|
9
|
+
"forms",
|
|
10
|
+
"typescript"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://gitlab.com/nwon-group/nwon-tooling/npm-packages/react-mui-hook-form"
|
|
15
|
+
},
|
|
16
|
+
"description": "Making react forms easy - A connection of MUI and React Hook Form",
|
|
17
|
+
"types": "dist/packageExports.d.ts",
|
|
18
|
+
"main": "dist/packageExports.js",
|
|
19
|
+
"cracoConfig": "craco.config.cjs",
|
|
20
|
+
"scripts": {},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"readme.md",
|
|
24
|
+
"license"
|
|
25
|
+
],
|
|
26
|
+
"author": "NWON",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@babel/core": "^7.21.3",
|
|
30
|
+
"@babel/plugin-transform-runtime": "^7.21.0",
|
|
31
|
+
"@babel/preset-flow": "^7.18.6",
|
|
32
|
+
"@babel/preset-react": "^7.18.6",
|
|
33
|
+
"@craco/craco": "^6.4.3",
|
|
34
|
+
"@nvon/eslint-config": "^1.21.1",
|
|
35
|
+
"@nvon/node-toolbox": "^0.20.4",
|
|
36
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
37
|
+
"@types/lodash-es": "^4.17.6",
|
|
38
|
+
"@types/node": "^18.11.11",
|
|
39
|
+
"@types/react-dom": ">=17.0.0",
|
|
40
|
+
"@types/webpack": "^4.41.32",
|
|
41
|
+
"cross-env": "^7.0.3",
|
|
42
|
+
"npm": "^9.5.0",
|
|
43
|
+
"react-scripts": "^4.0.3",
|
|
44
|
+
"rimraf": "^3.0.2",
|
|
45
|
+
"rollup": "^3.19.1",
|
|
46
|
+
"rollup-plugin-sass": "^1.12.17",
|
|
47
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
48
|
+
"typescript": "^4.9.5"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@babel/runtime": "^7.21.0",
|
|
52
|
+
"@mui/icons-material": "^5.15.10",
|
|
53
|
+
"@mui/lab": "^5.0.0-alpha.134",
|
|
54
|
+
"@mui/material": "^5.15.5",
|
|
55
|
+
"@mui/x-date-pickers": "^5.0.20",
|
|
56
|
+
"@nvon/baseline": "^0.33.0",
|
|
57
|
+
"dayjs": "^1.11.10",
|
|
58
|
+
"i18next": "^22.4.10",
|
|
59
|
+
"lodash-es": "^4.17.21",
|
|
60
|
+
"react-hook-form": "^7.41.3",
|
|
61
|
+
"react-i18next": "^11.18.5"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"react": ">=17.0.0",
|
|
65
|
+
"react-dom": ">=17.0.0"
|
|
66
|
+
},
|
|
67
|
+
"browserslist": {
|
|
68
|
+
"production": [
|
|
69
|
+
">0.2%",
|
|
70
|
+
"not dead",
|
|
71
|
+
"not op_mini all"
|
|
72
|
+
],
|
|
73
|
+
"development": [
|
|
74
|
+
"last 1 chrome version",
|
|
75
|
+
"last 1 firefox version",
|
|
76
|
+
"last 1 safari version"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|