@nwon/react-mui-hook-form 1.1.6 → 1.2.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 (38) hide show
  1. package/dist/LoadingButton/LoadingButton.d.ts +6 -6
  2. package/dist/LoadingButton/LoadingButtonInterfaces.d.ts +33 -33
  3. package/dist/LoadingButton/getLoadingButtonState.d.ts +20 -20
  4. package/dist/LoadingButton/index.d.ts +4 -4
  5. package/dist/errors/FormFieldError.d.ts +11 -11
  6. package/dist/errors/FormFieldErrorDisplay.d.ts +11 -11
  7. package/dist/formFields/HookFormProvider.d.ts +7 -7
  8. package/dist/formFields/InputEmail/InputEmail.d.ts +11 -11
  9. package/dist/formFields/InputPasswordSet/InputPasswordSet.d.ts +8 -8
  10. package/dist/formFields/InputPasswordSet/InputPasswordSetInterfaces.d.ts +15 -15
  11. package/dist/formFields/TranslatedString.d.ts +13 -13
  12. package/dist/formFields/baseTypes/InputAutocomplete/InputAutocomplete.d.ts +8 -8
  13. package/dist/formFields/baseTypes/InputAutocomplete/InputAutocompleteInterfaces.d.ts +21 -21
  14. package/dist/formFields/baseTypes/InputAutocomplete/useSortedOptionsWithGroup.d.ts +9 -9
  15. package/dist/formFields/baseTypes/InputCheckbox/InputCheckbox.d.ts +19 -19
  16. package/dist/formFields/baseTypes/InputDatePicker/InputDatePicker.d.ts +19 -20
  17. package/dist/formFields/baseTypes/InputDateTimePicker/InputDateTimePicker.d.ts +19 -20
  18. package/dist/formFields/baseTypes/InputOutlinedInput/InputOutlinedInput.d.ts +14 -14
  19. package/dist/formFields/baseTypes/InputRadio/InputRadio.d.ts +13 -13
  20. package/dist/formFields/baseTypes/InputSelect/InputSelect.d.ts +26 -26
  21. package/dist/formFields/baseTypes/InputSelectFromEnum/InputSelectFromEnum.d.ts +6 -6
  22. package/dist/formFields/baseTypes/InputSelectFromEnum/InputSelectFromEnumInterfaces.d.ts +9 -9
  23. package/dist/formFields/baseTypes/InputText/InputTextField.d.ts +14 -14
  24. package/dist/formFields/baseTypes/InputTimePicker/InputTimePicker.d.ts +19 -0
  25. package/dist/formFields/errorMessages.d.ts +1 -1
  26. package/dist/formFields/formHelper/getFormErrorForNestedKeys.d.ts +11 -11
  27. package/dist/formFields/formHelper/syncSubmit.d.ts +15 -15
  28. package/dist/formFields/formHelper/useHookForm.d.ts +50 -50
  29. package/dist/formFields/formHelper/useHookFormContext.d.ts +9 -9
  30. package/dist/formFields/formHelper/useMergedFormField.d.ts +6 -6
  31. package/dist/formFields/formHelper/useSortedOptionsWithGroup.d.ts +5 -5
  32. package/dist/formFields/formHelper/useTranslateString.d.ts +8 -8
  33. package/dist/formFields/index.d.ts +36 -34
  34. package/dist/formFields/inputTypes.d.ts +76 -76
  35. package/dist/packageExports.d.ts +9 -9
  36. package/dist/packageExports.js +59 -77
  37. package/dist/packageExports.js.map +1 -1
  38. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- /// <reference types="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
+ /// <reference types="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 +1,33 @@
1
- import { LoadingButtonProps as MuiLoadingButtonProps } from "@mui/lab";
2
- import { 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
+ import { LoadingButtonProps as MuiLoadingButtonProps } from "@mui/lab";
2
+ import { 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 +1,20 @@
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
+ 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 +1,4 @@
1
- export { LoadingButton } from "./LoadingButton";
2
- export { LoadingButtonState } from "./LoadingButtonInterfaces";
3
- export type { LoadingButtonProps } from "./LoadingButtonInterfaces";
4
- export { loadingButtonStateFromFormState, loadingButtonStateFromReactQueryMutationStatus, useLoadingButtonStateFromFormContext, } from "./getLoadingButtonState";
1
+ export { LoadingButton } from "./LoadingButton";
2
+ export { LoadingButtonState } from "./LoadingButtonInterfaces";
3
+ export type { LoadingButtonProps } from "./LoadingButtonInterfaces";
4
+ export { loadingButtonStateFromFormState, loadingButtonStateFromReactQueryMutationStatus, useLoadingButtonStateFromFormContext, } from "./getLoadingButtonState";
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
2
- import { FormHelperTextProps } from "@mui/material";
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
+ /// <reference types="react" />
2
+ import { FormHelperTextProps } from "@mui/material";
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 +1,11 @@
1
- /// <reference types="react" />
2
- import { FormHelperTextProps } from "@mui/material";
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;
1
+ /// <reference types="react" />
2
+ import { FormHelperTextProps } from "@mui/material";
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;
@@ -1,7 +1,7 @@
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>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext>) => JSX.Element;
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>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext>) => JSX.Element;
@@ -1,11 +1,11 @@
1
- /// <reference types="react" />
2
- import { TextFieldProps } from "@mui/material";
3
- import { FormField } from "../inputTypes";
4
- export interface InputEmailProps {
5
- formField: FormField;
6
- textFieldProps?: TextFieldProps;
7
- }
8
- /**
9
- * Renders a MUI input for an email address that is embedded in a react hook form context.
10
- */
11
- export declare const InputEmail: (props: InputEmailProps) => JSX.Element;
1
+ /// <reference types="react" />
2
+ import { TextFieldProps } from "@mui/material";
3
+ import { FormField } from "../inputTypes";
4
+ export interface InputEmailProps {
5
+ formField: FormField;
6
+ textFieldProps?: TextFieldProps;
7
+ }
8
+ /**
9
+ * Renders a MUI input for an email address that is embedded in a react hook form context.
10
+ */
11
+ export declare const InputEmail: (props: InputEmailProps) => JSX.Element;
@@ -1,8 +1,8 @@
1
- /// <reference types="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, }: InputPasswordSetProps) => JSX.Element;
1
+ /// <reference types="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, }: InputPasswordSetProps) => JSX.Element;
@@ -1,15 +1,15 @@
1
- import { FormField } from "../inputTypes";
2
- export interface InputPasswordSetProps {
3
- /**
4
- * Partial entry, assuming by default a "password"-named field.
5
- */
6
- passwordField: FormField;
7
- /**
8
- * Partial entry, assuming by default a "passwordConfirmation"-named field.
9
- */
10
- passwordValidationField: FormField;
11
- /**
12
- * Error that is displayed when the passwords do not match.
13
- */
14
- doNotMatchError: string;
15
- }
1
+ import { FormField } from "../inputTypes";
2
+ export interface InputPasswordSetProps {
3
+ /**
4
+ * Partial entry, assuming by default a "password"-named field.
5
+ */
6
+ passwordField: FormField;
7
+ /**
8
+ * Partial entry, assuming by default a "passwordConfirmation"-named field.
9
+ */
10
+ passwordValidationField: FormField;
11
+ /**
12
+ * Error that is displayed when the passwords do not match.
13
+ */
14
+ doNotMatchError: string;
15
+ }
@@ -1,13 +1,13 @@
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
+ 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,8 +1,8 @@
1
- /// <reference types="react" />
2
- import { InputAutocompleteProps } from "./InputAutocompleteInterfaces";
3
- /**
4
- * Renders a MUI autocomplete input that is embedded in a react hook form context.
5
- *
6
- * @throws Error when FormContext is null.
7
- */
8
- 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> = "div">({ formField, selectableOptions, noOptions, autoCompleteProps, checkboxesForMultiselect: renderCheckboxes, groupSorting, }: InputAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>) => JSX.Element;
1
+ /// <reference types="react" />
2
+ import { InputAutocompleteProps } from "./InputAutocompleteInterfaces";
3
+ /**
4
+ * Renders a MUI autocomplete input that is embedded in a react hook form context.
5
+ *
6
+ * @throws Error when FormContext is null.
7
+ */
8
+ 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> = "div">({ formField, selectableOptions, noOptions, autoCompleteProps, checkboxesForMultiselect: renderCheckboxes, groupSorting, }: InputAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>) => JSX.Element;
@@ -1,21 +1,21 @@
1
- /// <reference types="react" />
2
- import { AutocompleteProps, ChipTypeMap } from "@mui/material";
3
- import { FormField, 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
- formField: FormField;
10
- groupSorting?: GroupLabelSorting;
11
- selectableOptions: LabeledValueWithGrouping[];
12
- /**
13
- * Text that is displayed when there are no more options.
14
- */
15
- noOptions: string;
16
- autoCompleteProps?: CustomAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>;
17
- /**
18
- * Renders checkboxes next to the options.
19
- */
20
- checkboxesForMultiselect?: boolean;
21
- }
1
+ /// <reference types="react" />
2
+ import { AutocompleteProps, ChipTypeMap } from "@mui/material";
3
+ import { FormField, 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
+ formField: FormField;
10
+ groupSorting?: GroupLabelSorting;
11
+ selectableOptions: LabeledValueWithGrouping[];
12
+ /**
13
+ * Text that is displayed when there are no more options.
14
+ */
15
+ noOptions: string;
16
+ autoCompleteProps?: CustomAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, ChipComponent>;
17
+ /**
18
+ * Renders checkboxes next to the options.
19
+ */
20
+ checkboxesForMultiselect?: boolean;
21
+ }
@@ -1,9 +1,9 @@
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
+ 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,19 +1,19 @@
1
- /// <reference types="react" />
2
- import { CheckboxProps, FormControlLabelProps } from "@mui/material";
3
- import { FormField } from "../../inputTypes";
4
- export interface InputCheckboxProps {
5
- formField: FormField;
6
- checkboxProps?: Omit<CheckboxProps, "checked">;
7
- formControlLabelProps?: Omit<FormControlLabelProps, "control" | "label">;
8
- /**
9
- * In contrast to other FormFields,
10
- * the checkbox supports jsx elements as a label.
11
- *
12
- * If this is provided, formField.label will be ignored.
13
- */
14
- jsxLabel?: JSX.Element;
15
- }
16
- /**
17
- * Input for Checking a box indicating acceptance of something.
18
- */
19
- export declare const InputCheckbox: ({ formField, jsxLabel, checkboxProps, formControlLabelProps, }: InputCheckboxProps) => JSX.Element;
1
+ /// <reference types="react" />
2
+ import { CheckboxProps, FormControlLabelProps } from "@mui/material";
3
+ import { FormField } from "../../inputTypes";
4
+ export interface InputCheckboxProps {
5
+ formField: FormField;
6
+ checkboxProps?: Omit<CheckboxProps, "checked">;
7
+ formControlLabelProps?: Omit<FormControlLabelProps, "control" | "label">;
8
+ /**
9
+ * In contrast to other FormFields,
10
+ * the checkbox supports jsx elements as a label.
11
+ *
12
+ * If this is provided, formField.label will be ignored.
13
+ */
14
+ jsxLabel?: JSX.Element;
15
+ }
16
+ /**
17
+ * Input for Checking a box indicating acceptance of something.
18
+ */
19
+ export declare const InputCheckbox: ({ formField, jsxLabel, checkboxProps, formControlLabelProps, }: InputCheckboxProps) => JSX.Element;
@@ -1,20 +1,19 @@
1
- /// <reference types="react" />
2
- import { TextFieldProps } from "@mui/material";
3
- import { DatePickerProps as MuiDatePickerProps } from "@mui/x-date-pickers";
4
- import { FormField } from "../../inputTypes";
5
- /**
6
- * Mangled version of the original DatePickerProps type
7
- * from @mui/x-date-pickers.
8
- */
9
- interface DatePickerProps extends Omit<MuiDatePickerProps<TextFieldProps, Date>, "label" | "onChange" | "disabled" | "value" | "renderInput"> {
10
- renderInput?: MuiDatePickerProps<TextFieldProps, Date>["renderInput"];
11
- }
12
- export interface InputDatePickerProps {
13
- formField: FormField;
14
- datePickerProps?: DatePickerProps;
15
- }
16
- /**
17
- * A Datetime picker that works with react hook form.
18
- */
19
- export declare const InputDatePicker: ({ formField, datePickerProps, }: InputDatePickerProps) => JSX.Element;
20
- export {};
1
+ /// <reference types="react" />
2
+ import { DatePickerProps as MuiDatePickerProps } from "@mui/x-date-pickers";
3
+ import dayjs from "dayjs";
4
+ import { FormField } from "../../inputTypes";
5
+ /**
6
+ * Mangled version of the original DatePickerProps type
7
+ * from @mui/x-date-pickers.
8
+ */
9
+ interface DatePickerProps extends Omit<MuiDatePickerProps<dayjs.Dayjs, false>, "label" | "onChange" | "disabled" | "value"> {
10
+ }
11
+ export interface InputDatePickerProps {
12
+ formField: FormField;
13
+ datePickerProps?: DatePickerProps;
14
+ }
15
+ /**
16
+ * A Datetime picker that works with react hook form.
17
+ */
18
+ export declare const InputDatePicker: ({ formField, datePickerProps, }: InputDatePickerProps) => JSX.Element;
19
+ export {};
@@ -1,20 +1,19 @@
1
- /// <reference types="react" />
2
- import { TextFieldProps } from "@mui/material";
3
- import { DateTimePickerProps as MuiDateTimePickerProps } from "@mui/x-date-pickers";
4
- import { FormField } from "../../inputTypes";
5
- /**
6
- * Mangled version of the original DateTimePickerProps type
7
- * from @mui/x-date-pickers.
8
- */
9
- interface DateTimePickerProps extends Omit<MuiDateTimePickerProps<TextFieldProps, Date>, "label" | "onChange" | "disabled" | "value" | "renderInput"> {
10
- renderInput?: MuiDateTimePickerProps<TextFieldProps, Date>["renderInput"];
11
- }
12
- export interface InputDateTimePickerProps {
13
- formField: FormField;
14
- dateTimePickerProps?: DateTimePickerProps;
15
- }
16
- /**
17
- * A Datetime picker that works with react hook form.
18
- */
19
- export declare const InputDateTimePicker: ({ formField, dateTimePickerProps, }: InputDateTimePickerProps) => JSX.Element;
20
- export {};
1
+ /// <reference types="react" />
2
+ import { DateTimePickerProps as MuiDateTimePickerProps } from "@mui/x-date-pickers";
3
+ import dayjs from "dayjs";
4
+ import { FormField } from "../../inputTypes";
5
+ /**
6
+ * Mangled version of the original DateTimePickerProps type
7
+ * from @mui/x-date-pickers.
8
+ */
9
+ interface DateTimePickerProps extends Omit<MuiDateTimePickerProps<dayjs.Dayjs, false>, "label" | "onChange" | "disabled" | "value"> {
10
+ }
11
+ export interface InputDateTimePickerProps {
12
+ formField: FormField;
13
+ dateTimePickerProps?: DateTimePickerProps;
14
+ }
15
+ /**
16
+ * A Datetime picker that works with react hook form.
17
+ */
18
+ export declare const InputDateTimePicker: ({ formField, dateTimePickerProps, }: InputDateTimePickerProps) => JSX.Element;
19
+ export {};
@@ -1,14 +1,14 @@
1
- /// <reference types="react" />
2
- import { OutlinedInputProps } from "@mui/material";
3
- import { FormField } from "../../inputTypes";
4
- export interface InputOutlinedInputProps {
5
- formField: FormField;
6
- outlinedInputProps?: Omit<OutlinedInputProps, "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 InputOutlinedInput: ({ formField, outlinedInputProps, }: InputOutlinedInputProps) => JSX.Element | null;
1
+ /// <reference types="react" />
2
+ import { OutlinedInputProps } from "@mui/material";
3
+ import { FormField } from "../../inputTypes";
4
+ export interface InputOutlinedInputProps {
5
+ formField: FormField;
6
+ outlinedInputProps?: Omit<OutlinedInputProps, "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 InputOutlinedInput: ({ formField, outlinedInputProps, }: InputOutlinedInputProps) => JSX.Element | null;
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
2
- import { FormControlLabelProps, RadioGroupProps } from "@mui/material";
3
- import { FormField, LabeledValue } from "../../inputTypes";
4
- export interface InputRadioProps {
5
- formField: FormField;
6
- selectableOptions: LabeledValue[];
7
- formControlLabelProps?: FormControlLabelProps;
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, }: InputRadioProps) => JSX.Element;
1
+ /// <reference types="react" />
2
+ import { FormControlLabelProps, RadioGroupProps } from "@mui/material";
3
+ import { FormField, LabeledValue } from "../../inputTypes";
4
+ export interface InputRadioProps {
5
+ formField: FormField;
6
+ selectableOptions: LabeledValue[];
7
+ formControlLabelProps?: FormControlLabelProps;
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, }: InputRadioProps) => JSX.Element;
@@ -1,26 +1,26 @@
1
- /// <reference types="react" />
2
- import { SelectProps } from "@mui/material";
3
- import { FormField, LabeledValueWithGrouping } from "../../inputTypes";
4
- export interface InputSelectProps {
5
- formField: FormField;
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, }: InputSelectProps) => JSX.Element;
1
+ /// <reference types="react" />
2
+ import { SelectProps } from "@mui/material";
3
+ import { FormField, LabeledValueWithGrouping } from "../../inputTypes";
4
+ export interface InputSelectProps {
5
+ formField: FormField;
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, }: InputSelectProps) => JSX.Element;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
- import { InputSelectFromEnumProps } from "./InputSelectFromEnumInterfaces";
3
- /**
4
- * Renders a MUI select based on an enum that is embedded in a react hook form context.
5
- */
6
- export declare const InputSelectFromEnum: <EnumType extends Record<string, string>>(props: InputSelectFromEnumProps<EnumType>) => JSX.Element;
1
+ /// <reference types="react" />
2
+ import { InputSelectFromEnumProps } from "./InputSelectFromEnumInterfaces";
3
+ /**
4
+ * Renders a MUI select based on an enum that is embedded in a react hook form context.
5
+ */
6
+ export declare const InputSelectFromEnum: <EnumType extends Record<string, string>>(props: InputSelectFromEnumProps<EnumType>) => JSX.Element;