@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.
- package/dist/components/buttons/FormCancelButton.d.ts +2 -1
- package/dist/components/buttons/FormResetButton.d.ts +3 -8
- package/dist/components/buttons/FormSubmitButton.d.ts +4 -11
- package/dist/components/buttons/LoadingButton.d.ts +2 -2
- package/dist/components/dialogs/FormDialogActions.d.ts +1 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useFormButton.d.ts +5 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +106 -17342
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +106 -17342
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +6 -46
- package/dist/utils/applyDefaultFormDialogProps.d.ts +256 -358
- package/dist/utils/formState.d.ts +7 -0
- package/dist/utils/index.d.ts +1 -1
- package/package.json +25 -29
|
@@ -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").
|
|
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
|
-
* //
|
|
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").
|
|
27
|
+
export declare const FormResetButton: import("react").MemoExoticComponent<(props?: FormButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
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
|
|
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").
|
|
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
|
|
13
|
-
* - When `loading` is
|
|
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={{
|
|
29
|
-
* resetProps={{ formKey: "user-profile" }}
|
|
28
|
+
* submitProps={{ children: "Save Changes" }}
|
|
30
29
|
* />
|
|
31
30
|
*
|
|
32
31
|
* @example
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -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