@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
package/dist/types.d.ts
CHANGED
|
@@ -2,59 +2,22 @@ import type { ButtonProps, CircularProgressProps, DialogActionsProps, DialogCont
|
|
|
2
2
|
import { MouseEvent, PropsWithChildren, ReactNode, type Dispatch, type SetStateAction } from "react";
|
|
3
3
|
import { FieldValues, type FormContainerProps } from "react-hook-form-mui";
|
|
4
4
|
/**
|
|
5
|
-
* Props for the
|
|
5
|
+
* Props for the Form Buttons
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
7
|
+
export type FormButtonProps = LoadingButtonProps & {
|
|
8
8
|
/**
|
|
9
9
|
* Display variant for the button, determining whether to show icon, text, or both.
|
|
10
10
|
* Inherited from FormDialogActionsProps.
|
|
11
11
|
*/
|
|
12
12
|
iconVariant?: FormDialogActionsProps['variant'];
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* Props for the FormResetButton component
|
|
16
|
-
*/
|
|
17
|
-
export type FormResetButtonProps = ButtonProps & {
|
|
18
|
-
/**
|
|
19
|
-
* Display variant for the button.
|
|
20
|
-
*/
|
|
21
|
-
iconVariant?: FormDialogActionsProps['variant'];
|
|
22
|
-
/**
|
|
23
|
-
* A unique identifier for the form associated with this reset button
|
|
24
|
-
* When provided, also clears persisted form data from storage
|
|
25
|
-
*/
|
|
26
|
-
formKey?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Whether to preserve the submission count when resetting the form.
|
|
29
|
-
* When true, the form's submitCount will be maintained after reset.
|
|
30
|
-
*/
|
|
31
|
-
keepCount?: boolean;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Props for the FormSubmitButton component
|
|
35
|
-
*/
|
|
36
|
-
export type FormSubmitButtonProps = Omit<LoadingButtonProps, "onClick"> & {
|
|
37
|
-
/**
|
|
38
|
-
* Display variant for the button.
|
|
39
|
-
*/
|
|
40
|
-
iconVariant?: FormDialogActionsProps['variant'];
|
|
41
|
-
/**
|
|
42
|
-
* Whether to show the submission attempt count badge
|
|
43
|
-
*/
|
|
44
|
-
showAttempts?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Maximum number of submission attempts allowed
|
|
47
|
-
* When reached, the button displays a visual indicator
|
|
48
|
-
*/
|
|
49
|
-
maxAttempts?: number;
|
|
50
|
-
};
|
|
51
14
|
/**
|
|
52
15
|
* Props for the LoadingButton component
|
|
53
16
|
*/
|
|
54
17
|
export type LoadingButtonProps = ButtonProps & {
|
|
55
18
|
/**
|
|
56
19
|
* Controls the loading state of the button
|
|
57
|
-
* When
|
|
20
|
+
* When true, displays a loading spinner; when false or undefined, displays normal content
|
|
58
21
|
*/
|
|
59
22
|
loading?: boolean;
|
|
60
23
|
/**
|
|
@@ -137,15 +100,15 @@ export type FormDialogActionsProps = Partial<PropsWithChildren> & {
|
|
|
137
100
|
/**
|
|
138
101
|
* Props to customize the cancel button
|
|
139
102
|
*/
|
|
140
|
-
cancelProps?:
|
|
103
|
+
cancelProps?: FormButtonProps;
|
|
141
104
|
/**
|
|
142
105
|
* Props to customize the reset button
|
|
143
106
|
*/
|
|
144
|
-
resetProps?:
|
|
107
|
+
resetProps?: FormButtonProps;
|
|
145
108
|
/**
|
|
146
109
|
* Props to customize the "submit button"
|
|
147
110
|
*/
|
|
148
|
-
submitProps?:
|
|
111
|
+
submitProps?: FormButtonProps;
|
|
149
112
|
/**
|
|
150
113
|
* Display variant for the buttons
|
|
151
114
|
* - "icon": Shows only icons
|
|
@@ -197,9 +160,6 @@ export interface UseDialogReturn {
|
|
|
197
160
|
keepMounted: boolean;
|
|
198
161
|
};
|
|
199
162
|
}
|
|
200
|
-
export type UseMaxAttemptProps = {
|
|
201
|
-
maxAttempts?: number;
|
|
202
|
-
};
|
|
203
163
|
export type FormDialogContextType = {
|
|
204
164
|
open?: boolean;
|
|
205
165
|
closeDialog?: DialogProps['onClose'];
|