@chris-c-brine/form-dialog 1.2.0 → 1.3.1

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.
@@ -1,3 +1,4 @@
1
+ import { FormButtonProps } from "../../types";
1
2
  /**
2
3
  * A cancel button component that integrates with FormDialogContext.
3
4
  * Automatically closes the parent dialog when clicked.
@@ -14,4 +15,4 @@
14
15
  * children="Go Back"
15
16
  * />
16
17
  */
17
- export declare const FormCancelButton: import("react").NamedExoticComponent<object>;
18
+ export declare const FormCancelButton: import("react").MemoExoticComponent<(props?: FormButtonProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1,9 +1,9 @@
1
+ import { FormButtonProps } from "../../types";
1
2
  /**
2
3
  * A reset button for forms with context awareness and persistence integration
3
4
  *
4
5
  * This component extends the Material UI Button with form-specific reset functionality:
5
6
  * - Automatically resets the form using React Hook Form's reset method
6
- * - Optionally clears persisted form data when a formKey is provided
7
7
  * - Auto-disables when the form is pristine (no changes to reset)
8
8
  * - Respects the form's busy state (submitting/loading)
9
9
  * - Integrates with FormDialog context for form-wide disabled state
@@ -15,13 +15,8 @@
15
15
  * - Form-wide disabled state from FormDialogContext
16
16
  *
17
17
  * @example
18
- * // With persistence integration
19
- * <FormResetButton formKey="user-profile-form" />
20
- *
21
- * @example
22
- * // Preserve submission count and customize appearance
18
+ * // Customize appearance
23
19
  * <FormResetButton
24
- * keepCount
25
20
  * color="secondary"
26
21
  * variant="text"
27
22
  * size="small"
@@ -29,4 +24,4 @@
29
24
  * Clear Form
30
25
  * </FormResetButton>
31
26
  */
32
- export declare const FormResetButton: import("react").NamedExoticComponent<object>;
27
+ export declare const FormResetButton: import("react").MemoExoticComponent<(props?: FormButtonProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1,6 +1,6 @@
1
- import type { FormSubmitButtonProps } from "../../types";
1
+ import type { FormButtonProps } from "../../types";
2
2
  /**
3
- * A "submit button" for forms with loading state, attempt tracking and form context awareness
3
+ * A "submit button" for forms with loading state, attempt tracking, and form context awareness
4
4
  *
5
5
  * This component extends the LoadingButton with form-specific features:
6
6
  * - Automatically displays loading state during form submission
@@ -16,19 +16,12 @@ import type { FormSubmitButtonProps } from "../../types";
16
16
  *
17
17
  *
18
18
  * @example
19
- * // With custom text and max attempts
20
- * <FormSubmitButton maxAttempts={3}>
21
- * Submit Form
22
- * </FormSubmitButton>
23
- *
24
- * @example
25
- * // With visible attempt counter and custom props
19
+ * // With custom text and props
26
20
  * <FormSubmitButton
27
- * showAttempts
28
21
  * color="secondary"
29
22
  * fullWidth
30
23
  * >
31
24
  * Save Changes
32
25
  * </FormSubmitButton>
33
26
  */
34
- export declare const FormSubmitButton: import("react").NamedExoticComponent<FormSubmitButtonProps>;
27
+ export declare const FormSubmitButton: import("react").MemoExoticComponent<({ children, ...props }: FormButtonProps) => import("react/jsx-runtime").JSX.Element>;
@@ -9,8 +9,8 @@ import { LoadingButtonProps } from "../../types";
9
9
  * - Automatically sizes the spinner based on the current theme's font size
10
10
  *
11
11
  * The loading state can be controlled through the `loading` prop:
12
- * - When `loading` is false, the button shows a circular progress indicator
13
- * - When `loading` is true or undefined, the button shows its normal content
12
+ * - When `loading` is true, the button shows a circular progress indicator
13
+ * - When `loading` is false or undefined, the button shows its normal content
14
14
  *
15
15
  * @example
16
16
  * // Basic usage
@@ -25,8 +25,7 @@ import { FormDialogActionsProps } from "../../types";
25
25
  * @example
26
26
  * // With maximum attempts and customized buttons
27
27
  * <FormDialogActions
28
- * submitProps={{ maxAttempts: 3, children: "Save Changes" }}
29
- * resetProps={{ formKey: "user-profile" }}
28
+ * submitProps={{ children: "Save Changes" }}
30
29
  * />
31
30
  *
32
31
  * @example
@@ -1,3 +1,3 @@
1
1
  export * from "./useFormDialog";
2
- export * from "./useMaxAttempts";
3
2
  export * from "./useDialog";
3
+ export * from "./useFormButton";
@@ -0,0 +1,5 @@
1
+ export declare const useFormButton: () => {
2
+ formState: import("react-hook-form-mui").UseFormStateReturn<import("react-hook-form-mui").FieldValues>;
3
+ dialogState: import("..").FormDialogContextType;
4
+ formContext: import("react-hook-form-mui").UseFormReturn<import("react-hook-form-mui").FieldValues, any, import("react-hook-form-mui").FieldValues>;
5
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from "./components";
2
- export { useFormDialog, useDialog } from "./hooks";
3
- export { FormDialogProvider } from "./state/FormDialogProvider";
2
+ export * from "./hooks";
3
+ export * from "./state/FormDialogProvider";
4
4
  export * from "./types";