@nwon/react-mui-hook-form 3.0.4 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/package.json +50 -16
  2. package/dist/LoadingButton/LoadingButton.d.ts +0 -6
  3. package/dist/LoadingButton/LoadingButtonInterfaces.d.ts +0 -33
  4. package/dist/LoadingButton/getLoadingButtonState.d.ts +0 -20
  5. package/dist/LoadingButton/index.d.ts +0 -4
  6. package/dist/formFields/HookFormProvider.d.ts +0 -7
  7. package/dist/formFields/InputEmail/InputEmail.d.ts +0 -10
  8. package/dist/formFields/InputPasswordSet/InputPasswordSet.d.ts +0 -8
  9. package/dist/formFields/InputPasswordSet/InputPasswordSetInterfaces.d.ts +0 -18
  10. package/dist/formFields/TranslatedString.d.ts +0 -13
  11. package/dist/formFields/baseTypes/BaseInputProps.d.ts +0 -33
  12. package/dist/formFields/baseTypes/InputAutocomplete/InputAutocomplete.d.ts +0 -9
  13. package/dist/formFields/baseTypes/InputAutocomplete/InputAutocompleteInterfaces.d.ts +0 -24
  14. package/dist/formFields/baseTypes/InputAutocomplete/useSortedOptionsWithGroup.d.ts +0 -9
  15. package/dist/formFields/baseTypes/InputCheckbox/InputCheckbox.d.ts +0 -18
  16. package/dist/formFields/baseTypes/InputDatePicker/InputDatePicker.d.ts +0 -16
  17. package/dist/formFields/baseTypes/InputDateTimePicker/InputDateTimePicker.d.ts +0 -16
  18. package/dist/formFields/baseTypes/InputNumber/InputNumber.d.ts +0 -15
  19. package/dist/formFields/baseTypes/InputOutlinedInput/InputOutlinedInput.d.ts +0 -13
  20. package/dist/formFields/baseTypes/InputRadio/InputRadio.d.ts +0 -13
  21. package/dist/formFields/baseTypes/InputSelect/InputSelect.d.ts +0 -26
  22. package/dist/formFields/baseTypes/InputSelectFromEnum/InputSelectFromEnum.d.ts +0 -7
  23. package/dist/formFields/baseTypes/InputSelectFromEnum/InputSelectFromEnumInterfaces.d.ts +0 -10
  24. package/dist/formFields/baseTypes/InputSlider/InputSlider.d.ts +0 -13
  25. package/dist/formFields/baseTypes/InputSwitch/InputSwitch.d.ts +0 -11
  26. package/dist/formFields/baseTypes/InputTextField/InputTextField.d.ts +0 -13
  27. package/dist/formFields/baseTypes/InputTimePicker/InputTimePicker.d.ts +0 -16
  28. package/dist/formFields/baseTypes/InputToggleButton/InputToggleButton.d.ts +0 -12
  29. package/dist/formFields/baseTypes/InputToggleButtonGroup/InputToggleButtonGroup.d.ts +0 -34
  30. package/dist/formFields/baseTypes/useEffectFieldUnregisterOnUnmount.d.ts +0 -12
  31. package/dist/formFields/errorMessages.d.ts +0 -1
  32. package/dist/formFields/errors/FormFieldError.d.ts +0 -11
  33. package/dist/formFields/errors/FormFieldErrorDisplay.d.ts +0 -11
  34. package/dist/formFields/errors/getFormErrorForNestedKeys.d.ts +0 -14
  35. package/dist/formFields/errors/useFormFieldError.d.ts +0 -7
  36. package/dist/formFields/errors/useFormFieldHasError.d.ts +0 -6
  37. package/dist/formFields/formHelper/syncSubmit.d.ts +0 -15
  38. package/dist/formFields/formHelper/useHookForm.d.ts +0 -56
  39. package/dist/formFields/formHelper/useHookFormContext.d.ts +0 -9
  40. package/dist/formFields/formHelper/useMergedFormField.d.ts +0 -6
  41. package/dist/formFields/formHelper/useSortedOptionsWithGroup.d.ts +0 -5
  42. package/dist/formFields/formHelper/useTranslateString.d.ts +0 -8
  43. package/dist/formFields/index.d.ts +0 -49
  44. package/dist/formFields/inputTypes.d.ts +0 -76
  45. package/dist/packageExports.d.ts +0 -9
  46. package/dist/packageExports.js +0 -1761
  47. package/dist/packageExports.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nwon/react-mui-hook-form",
3
- "version": "3.0.4",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "react",
@@ -17,7 +17,28 @@
17
17
  "types": "dist/packageExports.d.ts",
18
18
  "main": "dist/packageExports.js",
19
19
  "cracoConfig": "craco.config.cjs",
20
- "scripts": {},
20
+ "scripts": {
21
+ "prebuild-rollup": "rimraf esm/dist && rimraf cjs/dist",
22
+ "build-rollup": "rollup -c",
23
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0",
24
+ "lint-fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
25
+ "prettify": "npx prettier --write .",
26
+ "typecheck": "npx tsc",
27
+ "full-check": "npm run typecheck && npm run lint && npm run prettify",
28
+ "prescripts-compile": "rimraf scripts/dist",
29
+ "scripts-compile": "npx tsc -p scripts/tsconfig-scripts.json",
30
+ "prepublish-package": "npm run scripts-compile",
31
+ "publish-package": "node --es-module-specifier-resolution=node scripts/dist/publish-to-npm.js",
32
+ "publish-package-patch": "npm run publish-package -- --patch",
33
+ "publish-package-minor": "npm run publish-package -- --minor",
34
+ "publish-package-major": "npm run publish-package -- --major",
35
+ "craco": "cross-env NODE_OPTIONS=--openssl-legacy-provider DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true TSC_COMPILE_ON_ERROR=true BROWSER=none craco",
36
+ "start": "npm run craco -- start",
37
+ "build": "npm run craco -- build",
38
+ "test": "craco test",
39
+ "eject": "react-scripts eject",
40
+ "watch": "npm run start"
41
+ },
21
42
  "files": [
22
43
  "dist",
23
44
  "readme.md",
@@ -32,27 +53,35 @@
32
53
  "@babel/preset-react": "^7.24.7",
33
54
  "@babel/runtime": "^7.21.0",
34
55
  "@craco/craco": "^7.1.0",
35
- "@mui/icons-material": "^6.4.3",
36
- "@mui/lab": "^6.0.0-beta.26",
37
- "@mui/material": "^6.4.3",
38
- "@mui/x-date-pickers": "^7.27.0",
56
+ "@eslint/js": "^9.30.1",
57
+ "eslint": "^9.30.1",
58
+ "eslint-import-resolver-typescript": "^4.4.4",
59
+ "eslint-plugin-i18next": "^6.1.2",
60
+ "eslint-plugin-import": "^2.32.0",
61
+ "eslint-plugin-react": "^7.37.5",
62
+ "eslint-plugin-react-hooks": "^5.2.0",
63
+ "typescript-eslint": "^8.35.1",
64
+ "@mui/icons-material": "^7.3.6",
65
+ "@mui/lab": "^7.0.1-beta.20",
66
+ "@mui/material": "^7.3.6",
67
+ "@mui/x-date-pickers": "^8.11.1",
39
68
  "@nvon/baseline": "^1.0.0",
40
- "@nvon/eslint-config": "^1.21.1",
41
69
  "@nvon/node-toolbox": "^0.20.4",
42
70
  "@rollup/plugin-babel": "^6.0.4",
43
71
  "@rollup/plugin-typescript": "^11.1.6",
44
72
  "@types/lodash-es": "^4.17.6",
45
73
  "@types/node": "^18.11.11",
46
- "@types/react-dom": ">=17.0.0",
74
+ "@types/react": "^19.1.1",
75
+ "@types/react-dom": "^19.1.9",
47
76
  "@types/webpack": "^4.41.32",
48
77
  "cross-env": "^7.0.3",
49
78
  "dayjs": "^1.11.10",
50
79
  "i18next": "^22.4.10",
51
80
  "lodash-es": "^4.17.21",
52
81
  "npm": "^9.5.0",
53
- "react-hook-form": "^7.41.3",
82
+ "react-hook-form": "^7.68",
54
83
  "react-i18next": "^11.18.5",
55
- "react-number-format": "^5.4.2",
84
+ "react-number-format": "^5.4.4",
56
85
  "react-scripts": "^5.0.1",
57
86
  "rimraf": "^3.0.2",
58
87
  "rollup": "^3.29.4",
@@ -60,20 +89,25 @@
60
89
  "typescript": "^4.9.5"
61
90
  },
62
91
  "peerDependencies": {
63
- "@mui/icons-material": "^6.4.3",
64
- "@mui/lab": "^6.0.0-beta.26",
65
- "@mui/material": "^6.4.3",
66
- "@mui/x-date-pickers": "^7.25.0",
92
+ "@mui/icons-material": "^7.3.6",
93
+ "@mui/lab": "^7.0.1-beta.20",
94
+ "@mui/material": "^7.3.6",
95
+ "@mui/x-date-pickers": "^8.11.1",
67
96
  "@nvon/baseline": "^1.0.0",
68
97
  "dayjs": "^1.11.10",
69
98
  "i18next": ">=22.4.10",
70
99
  "lodash-es": "^4.17.21",
71
- "react": ">=17.0.0",
72
- "react-dom": ">=17.0.0",
100
+ "react": "^19.1.1",
101
+ "react-dom": "^19.1.1",
73
102
  "react-hook-form": "^7.41.3",
74
103
  "react-i18next": ">=11.18.5",
75
104
  "react-number-format": "^5.4.2"
76
105
  },
106
+ "overrides": {
107
+ "@mui/x-date-pickers": {
108
+ "@mui/system": "^7.3.2"
109
+ }
110
+ },
77
111
  "browserslist": {
78
112
  "production": [
79
113
  ">0.2%",
@@ -1,6 +0,0 @@
1
- import { JSX } from "react";
2
- import { LoadingButtonProps } from "./LoadingButtonInterfaces";
3
- /**
4
- * A loading button component.
5
- */
6
- export declare const LoadingButton: ({ buttonText, buttonTextSuccess, loadingButtonProps, loadingButtonPropsPropsSuccess, buttonState, successIcon, }: LoadingButtonProps) => JSX.Element;
@@ -1,33 +0,0 @@
1
- import { LoadingButtonProps as MuiLoadingButtonProps } from "@mui/lab";
2
- import { JSX, ReactElement } from "react";
3
- export declare enum LoadingButtonState {
4
- Idle = "idle",
5
- Loading = "loading",
6
- Success = "success"
7
- }
8
- type SelectedButtonProps = Omit<MuiLoadingButtonProps, "children">;
9
- export interface LoadingButtonProps {
10
- buttonState: LoadingButtonState;
11
- /**
12
- * Button label.
13
- */
14
- buttonText: string;
15
- /**
16
- * Button label that is displayed on success.
17
- */
18
- buttonTextSuccess?: string;
19
- /**
20
- * Provide an icon that is displayed in front of the text
21
- * when state is successful.
22
- */
23
- successIcon?: JSX.Element | ReactElement;
24
- /**
25
- * Adjust the button when the state is any other than successful.
26
- */
27
- loadingButtonProps?: SelectedButtonProps;
28
- /**
29
- * Adjust the button when the state is successful.
30
- */
31
- loadingButtonPropsPropsSuccess?: SelectedButtonProps;
32
- }
33
- export {};
@@ -1,20 +0,0 @@
1
- import { FormState } from "react-hook-form";
2
- import { LoadingButtonState } from "./LoadingButtonInterfaces";
3
- /**
4
- * Redefinition of mutation status defined by react query. By doing this
5
- * we don't need to import react-query in the package.
6
- */
7
- declare type MutationStatus = "idle" | "loading" | "success" | "error";
8
- /**
9
- * Get loading button state from react-query mutation status.
10
- */
11
- export declare const loadingButtonStateFromReactQueryMutationStatus: (mutationStatus: MutationStatus) => LoadingButtonState;
12
- /**
13
- * Get loading button state from a react-hook-form context.
14
- */
15
- export declare const useLoadingButtonStateFromFormContext: () => LoadingButtonState;
16
- /**
17
- * Get loading button state from a react-hook-form state.
18
- */
19
- export declare const loadingButtonStateFromFormState: (formState: FormState<any>) => LoadingButtonState;
20
- export {};
@@ -1,4 +0,0 @@
1
- export { LoadingButton } from "./LoadingButton";
2
- export { LoadingButtonState } from "./LoadingButtonInterfaces";
3
- export type { LoadingButtonProps } from "./LoadingButtonInterfaces";
4
- export { loadingButtonStateFromFormState, loadingButtonStateFromReactQueryMutationStatus, useLoadingButtonStateFromFormContext, } from "./getLoadingButtonState";
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * Reexport of FormProvider.
4
- *
5
- * 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.
6
- */
7
- export declare const HookFormProvider: <TFieldValues extends import("react-hook-form").FieldValues, TContext = any, TTransformedValues extends import("react-hook-form").FieldValues | undefined = undefined>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => import("react").JSX.Element;
@@ -1,10 +0,0 @@
1
- import { TextFieldProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../baseTypes/BaseInputProps";
4
- export interface InputEmailProps {
5
- textFieldProps?: TextFieldProps;
6
- }
7
- /**
8
- * Renders a MUI input for an email address that is embedded in a react hook form context.
9
- */
10
- export declare const InputEmail: (props: BaseInputProps<InputEmailProps>) => JSX.Element;
@@ -1,8 +0,0 @@
1
- import { JSX } from "react";
2
- import { InputPasswordSetProps } from "./InputPasswordSetInterfaces";
3
- /**
4
- * Two fields for setting a password set: input & validation.
5
- *
6
- * Checks for equality of both.
7
- */
8
- export declare const InputPasswordSet: ({ passwordField, passwordValidationField, doNotMatchError, passwordValidationTextFieldProps, passwordTextFieldProps, }: InputPasswordSetProps) => JSX.Element;
@@ -1,18 +0,0 @@
1
- import { TextFieldProps } from "@mui/material";
2
- import { FormField } from "../inputTypes";
3
- export interface InputPasswordSetProps {
4
- /**
5
- * Partial entry, assuming by default a "password"-named field.
6
- */
7
- passwordField: FormField;
8
- passwordTextFieldProps?: TextFieldProps;
9
- /**
10
- * Partial entry, assuming by default a "passwordConfirmation"-named field.
11
- */
12
- passwordValidationField: FormField;
13
- passwordValidationTextFieldProps?: TextFieldProps;
14
- /**
15
- * Error that is displayed when the passwords do not match.
16
- */
17
- doNotMatchError: string;
18
- }
@@ -1,13 +0,0 @@
1
- import { TFunction } from "react-i18next";
2
- /**
3
- * Used for static data definitions outside of react:
4
- * ```.
5
- * // Static definition, somewhere:
6
- * const myString = (t) => t("my.string");
7
- *
8
- * // Using the translated string inside a component:
9
- * const t = useTranslation();
10
- * const string = myString(t);
11
- * ```.
12
- */
13
- export type TranslatedString = (t: TFunction) => string;
@@ -1,33 +0,0 @@
1
- import { FormField } from "../inputTypes";
2
- import { UnregisterOptions } from "./useEffectFieldUnregisterOnUnmount";
3
- interface SharedProps {
4
- /**
5
- * The form field that the input is bound to.
6
- *
7
- * Central configurations like the name of the field, label and validations
8
- * are stored here.
9
- */
10
- formField: FormField;
11
- /**
12
- * If true, the field will unregister when the component unmounts. In that
13
- * case additional options for handling the unregistering can be passed in.
14
- *
15
- * @default false
16
- */
17
- isUnregisteringOnUnmount?: boolean;
18
- }
19
- interface UnregisterOnUnmountProps extends SharedProps {
20
- isUnregisteringOnUnmount?: true;
21
- /**
22
- * Options for handling the current state when unregistering the field.
23
- *
24
- * Documentation: https://react-hook-form.com/docs/useform/unregister.
25
- */
26
- unregisterOptions?: UnregisterOptions;
27
- }
28
- interface DontUnregisterOnUnmountProps extends SharedProps {
29
- isUnregisteringOnUnmount?: false;
30
- unregisterOptions?: never;
31
- }
32
- export type BaseInputProps<T> = (T & UnregisterOnUnmountProps) | (T & DontUnregisterOnUnmountProps);
33
- export {};
@@ -1,9 +0,0 @@
1
- import { JSX } from "react";
2
- import { BaseInputProps } from "../BaseInputProps";
3
- import { InputAutocompleteProps } from "./InputAutocompleteInterfaces";
4
- /**
5
- * Renders a MUI autocomplete input that is embedded in a react hook form context.
6
- *
7
- * @throws Error when FormContext is null.
8
- */
9
- export declare const InputAutocomplete: <T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends import("react").ElementType<any, keyof JSX.IntrinsicElements> = "div">({ formField, selectableOptions, noOptions, autoCompleteProps, checkboxesForMultiselect: renderCheckboxes, groupSorting, inputTextFieldProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>>) => JSX.Element;
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- import { AutocompleteProps, ChipTypeMap, TextFieldProps } from "@mui/material";
3
- import { LabeledValueWithGrouping } from "../../inputTypes";
4
- import { GroupLabelSorting } from "./useSortedOptionsWithGroup";
5
- export interface CustomAutocompleteProps<T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> extends Omit<AutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>, "renderInput" | "options"> {
6
- renderInput?: AutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>["renderInput"];
7
- }
8
- export interface InputAutocompleteProps<T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType = ChipTypeMap["defaultComponent"]> {
9
- groupSorting?: GroupLabelSorting;
10
- selectableOptions: LabeledValueWithGrouping[];
11
- /**
12
- * Text that is displayed when there are no more options.
13
- */
14
- noOptions: string;
15
- autoCompleteProps?: CustomAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>;
16
- /**
17
- * Renders checkboxes next to the options.
18
- */
19
- checkboxesForMultiselect?: boolean;
20
- /**
21
- * Props that are passed to the input rendered for the autocomplete field.
22
- */
23
- inputTextFieldProps?: TextFieldProps;
24
- }
@@ -1,9 +0,0 @@
1
- import { LabeledValueWithGrouping } from "../../inputTypes";
2
- export declare enum GroupLabelSorting {
3
- Alphabetical = "alphabetical",
4
- GroupMemberCountAsc = "groupMemberCountAsc"
5
- }
6
- /**
7
- * Sorts option in the desired order.
8
- */
9
- export declare const useSortedOptionsWithGroup: (selectableOptions: LabeledValueWithGrouping[], sorting?: GroupLabelSorting) => LabeledValueWithGrouping[];
@@ -1,18 +0,0 @@
1
- import { CheckboxProps, FormControlLabelProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- export interface InputCheckboxProps {
5
- checkboxProps?: Omit<CheckboxProps, "checked">;
6
- formControlLabelProps?: Omit<FormControlLabelProps, "control" | "label">;
7
- /**
8
- * In contrast to other FormFields,
9
- * the checkbox supports jsx elements as a label.
10
- *
11
- * If this is provided, formField.label will be ignored.
12
- */
13
- jsxLabel?: JSX.Element;
14
- }
15
- /**
16
- * Input for Checking a box indicating acceptance of something.
17
- */
18
- export declare const InputCheckbox: ({ formField, jsxLabel, checkboxProps, formControlLabelProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputCheckboxProps>) => JSX.Element;
@@ -1,16 +0,0 @@
1
- import { DatePickerProps as MuiDatePickerProps } from "@mui/x-date-pickers";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- /**
5
- * Mangled version of the original DatePickerProps type
6
- * from @mui/x-date-pickers.
7
- */
8
- type DatePickerProps = Omit<MuiDatePickerProps, "label" | "onChange" | "value">;
9
- export interface InputDatePickerProps {
10
- datePickerProps?: DatePickerProps;
11
- }
12
- /**
13
- * A Datetime picker that works with react hook form.
14
- */
15
- export declare const InputDatePicker: ({ formField, datePickerProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputDatePickerProps>) => JSX.Element;
16
- export {};
@@ -1,16 +0,0 @@
1
- import { DateTimePickerProps as MuiDateTimePickerProps } from "@mui/x-date-pickers";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- /**
5
- * Mangled version of the original DateTimePickerProps type
6
- * from @mui/x-date-pickers.
7
- */
8
- type DateTimePickerProps = Omit<MuiDateTimePickerProps, "label" | "onChange" | "value">;
9
- export interface InputDateTimePickerProps {
10
- dateTimePickerProps?: DateTimePickerProps;
11
- }
12
- /**
13
- * A Datetime picker that works with react hook form.
14
- */
15
- export declare const InputDateTimePicker: ({ formField, dateTimePickerProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputDateTimePickerProps>) => JSX.Element;
16
- export {};
@@ -1,15 +0,0 @@
1
- import { TextFieldProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { NumericFormatProps } from "react-number-format";
4
- import { BaseInputProps } from "../BaseInputProps";
5
- export interface InputNumberProps {
6
- textFieldProps?: Omit<TextFieldProps, "required" | "label" | "value">;
7
- numericFormatProps?: Omit<NumericFormatProps, "customInput">;
8
- }
9
- /**
10
- * Renders a MUI input text fields that handles input of number in a nice
11
- * way and is embedded in a react hook form context.
12
- *
13
- * @throws Error when FormContext is null.
14
- */
15
- export declare const InputNumber: ({ formField, textFieldProps, numericFormatProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputNumberProps>) => JSX.Element | null;
@@ -1,13 +0,0 @@
1
- import { OutlinedInputProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- export interface InputOutlinedInputProps {
5
- outlinedInputProps?: Omit<OutlinedInputProps, "required" | "label">;
6
- }
7
- /**
8
- * Renders a MUI input text fields that is embedded in a react
9
- * hook form context.
10
- *
11
- * @throws Error when FormContext is null.
12
- */
13
- export declare const InputOutlinedInput: ({ formField, outlinedInputProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputOutlinedInputProps>) => JSX.Element | null;
@@ -1,13 +0,0 @@
1
- import { FormControlLabelProps, RadioGroupProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { LabeledValue } from "../../inputTypes";
4
- import { BaseInputProps } from "../BaseInputProps";
5
- export interface InputRadioProps {
6
- selectableOptions: LabeledValue[];
7
- formControlLabelProps?: Omit<FormControlLabelProps, "control" | "label" | "value">;
8
- radioGroupProps?: RadioGroupProps;
9
- }
10
- /**
11
- * Input for selecting between a list of options using radio buttons.
12
- */
13
- export declare const InputRadio: ({ formField, selectableOptions, formControlLabelProps, radioGroupProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputRadioProps>) => JSX.Element;
@@ -1,26 +0,0 @@
1
- import { SelectProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { LabeledValueWithGrouping } from "../../inputTypes";
4
- import { BaseInputProps } from "../BaseInputProps";
5
- export interface InputSelectProps {
6
- selectableOptions: LabeledValueWithGrouping[];
7
- /**
8
- * Text of an disabled item that can be rendered above the selectable options.
9
- */
10
- optionsTitle?: string;
11
- selectComponentProps?: Omit<SelectProps, "labelId" | "error" | "label" | "value">;
12
- /**
13
- * Element that is rendered in the end of a select item and holds
14
- * a tooltip with the disabled message for this option.
15
- *
16
- * If none is given the element is disabled without rendering a tooltip.
17
- */
18
- tooltipHolder?: JSX.Element;
19
- }
20
- /**
21
- * Renders a MUI select based that is embedded in a react hook
22
- * form context.
23
- *
24
- * @throws Error when FormContext is null.
25
- */
26
- export declare const InputSelect: ({ formField, selectableOptions, optionsTitle, selectComponentProps, tooltipHolder, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputSelectProps>) => JSX.Element;
@@ -1,7 +0,0 @@
1
- import { JSX } from "react";
2
- import { BaseInputProps } from "../BaseInputProps";
3
- import { InputSelectFromEnumProps } from "./InputSelectFromEnumInterfaces";
4
- /**
5
- * Renders a MUI select based on an enum that is embedded in a react hook form context.
6
- */
7
- export declare const InputSelectFromEnum: <EnumType extends Record<string, string>>(props: BaseInputProps<InputSelectFromEnumProps<EnumType>>) => JSX.Element;
@@ -1,10 +0,0 @@
1
- import { TranslatedString } from "../../TranslatedString";
2
- import { InputSelectProps } from "../InputSelect/InputSelect";
3
- export interface InputSelectFromEnumProps<EnumType> extends Omit<InputSelectProps, "selectableOptions"> {
4
- enumData: EnumSelectData<EnumType>;
5
- limitOptions?: (keyof EnumType)[];
6
- }
7
- export interface EnumSelectData<EnumType> {
8
- enumToUse: EnumType;
9
- labelsForEnum: Record<keyof EnumType, TranslatedString | string>;
10
- }
@@ -1,13 +0,0 @@
1
- import { SliderProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- export interface InputSliderProps {
5
- sliderProps?: Omit<SliderProps, "required" | "label">;
6
- }
7
- /**
8
- * Renders a MUI input text fields that is embedded in a react
9
- * hook form context.
10
- *
11
- * @throws Error when FormContext is null.
12
- */
13
- export declare const InputSlider: ({ formField, sliderProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputSliderProps>) => JSX.Element | null;
@@ -1,11 +0,0 @@
1
- import { FormControlLabelProps, SwitchProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- export interface InputSwitchProps {
5
- switchProps?: Omit<SwitchProps, "checked">;
6
- formControlLabelProps?: Omit<FormControlLabelProps, "control" | "label">;
7
- }
8
- /**
9
- * Input for Checking a box indicating acceptance of something.
10
- */
11
- export declare const InputSwitch: ({ formField, switchProps, formControlLabelProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputSwitchProps>) => JSX.Element;
@@ -1,13 +0,0 @@
1
- import { TextFieldProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- export interface InputTextFieldProps {
5
- textFieldProps?: Omit<TextFieldProps, "required" | "label">;
6
- }
7
- /**
8
- * Renders a MUI input text field that is embedded in a react
9
- * hook form context.
10
- *
11
- * @throws Error when FormContext is null.
12
- */
13
- export declare const InputTextField: ({ formField, textFieldProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputTextFieldProps>) => JSX.Element | null;
@@ -1,16 +0,0 @@
1
- import { TimePickerProps } from "@mui/x-date-pickers";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- /**
5
- * Mangled version of the original DateTimePickerProps type
6
- * from @mui/x-date-pickers.
7
- */
8
- type MangledTimePickerProps = Omit<TimePickerProps, "label" | "onChange" | "value">;
9
- export interface InputTimePickerProps {
10
- timePickerProps?: MangledTimePickerProps;
11
- }
12
- /**
13
- * A Datetime picker that works with react hook form.
14
- */
15
- export declare const InputTimePicker: ({ formField, timePickerProps, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputTimePickerProps>) => JSX.Element;
16
- export {};
@@ -1,12 +0,0 @@
1
- import { FormControlLabelProps, ToggleButtonProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- export interface InputToggleButtonProps {
5
- toggleButtonProps?: Omit<ToggleButtonProps, "children" | "value">;
6
- formControlLabelProps?: Omit<FormControlLabelProps, "control" | "label">;
7
- children: React.ReactNode;
8
- }
9
- /**
10
- * Input Toggle button.
11
- */
12
- export declare const InputToggleButton: ({ formField, toggleButtonProps, formControlLabelProps, children, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputToggleButtonProps>) => JSX.Element;
@@ -1,34 +0,0 @@
1
- import { StackProps, ToggleButtonGroupProps, ToggleButtonProps, TypographyProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { BaseInputProps } from "../BaseInputProps";
4
- export interface InputToggleButtonGroupProps {
5
- toggleButtonGroupProps?: Omit<ToggleButtonGroupProps, "onChange" | "value">;
6
- /**
7
- * Props for the Stack component acting as the label-element.
8
- * Only used if a label is set.
9
- *
10
- * Use `direction` to change the label placement.
11
- */
12
- stackProps?: StackProps;
13
- /**
14
- * Props for the Typography component inside the label.
15
- * Does not include the required-asterisk.
16
- */
17
- typographyProps?: TypographyProps;
18
- buttons: SingleToggleButton[];
19
- /**
20
- * Ensures that at least one value needs to be selected.
21
- *
22
- * @default false
23
- */
24
- enforceValueSelected?: boolean;
25
- }
26
- export interface SingleToggleButton {
27
- icon: JSX.Element;
28
- value: string | number | boolean;
29
- toggleButtonProps?: ToggleButtonProps;
30
- }
31
- /**
32
- * Input for a toggle button group.
33
- */
34
- export declare const InputToggleButtonGroup: ({ formField, toggleButtonGroupProps, stackProps, typographyProps, buttons, enforceValueSelected, unregisterOptions, isUnregisteringOnUnmount, }: BaseInputProps<InputToggleButtonGroupProps>) => JSX.Element;
@@ -1,12 +0,0 @@
1
- import { UseFormUnregister } from "react-hook-form";
2
- export type UnregisterOptions = Parameters<UseFormUnregister<any>>[1];
3
- /**
4
- * An effect that unregisters a field from the form when the component unmounts.
5
- *
6
- * @throws Error when FormContext is null.
7
- */
8
- export declare const useEffectFieldUnregisterOnUnmount: ({ name, unregisterOptions, isUnregisteringOnUnmount, }: {
9
- name: string;
10
- isUnregisteringOnUnmount?: boolean | undefined;
11
- unregisterOptions?: UnregisterOptions;
12
- }) => void;
@@ -1 +0,0 @@
1
- export declare 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";
@@ -1,11 +0,0 @@
1
- import { FormHelperTextProps } from "@mui/material";
2
- import { JSX } from "react";
3
- /**
4
- * Renders field errors in an opinionated way.
5
- *
6
- * @throws Error when FormContext is null.
7
- */
8
- export declare const FormFieldError: ({ fieldName, formHelperTextProps, }: {
9
- fieldName: string;
10
- formHelperTextProps?: FormHelperTextProps<"p", {}> | undefined;
11
- }) => JSX.Element | null;
@@ -1,11 +0,0 @@
1
- import { FormHelperTextProps } from "@mui/material";
2
- import { JSX } from "react";
3
- import { FieldError } from "react-hook-form";
4
- /**
5
- * Renders field errors in an opinionated way.
6
- *
7
- */
8
- export declare const FormFieldErrorDisplay: ({ error, formHelperTextProps, }: {
9
- error: FieldError | FieldError[] | undefined;
10
- formHelperTextProps?: FormHelperTextProps<"p", {}> | undefined;
11
- }) => JSX.Element | null;