@@ -43,44 +43,40 @@ export function ModalForm<TFieldValues extends FieldValues>({
4343 overlay = true ,
4444} : ModalFormProps < TFieldValues > ) {
4545 const id = useId ( )
46-
4746 const { isSubmitting } = form . formState
48-
4947 return (
50- < >
51- < Modal isOpen onDismiss = { onDismiss } title = { title } width = { width } overlay = { overlay } >
52- < Modal . Body >
53- < Modal . Section >
54- { submitError && (
55- < Message variant = "error" title = "Error" content = { submitError . message } />
56- ) }
57- < form
58- id = { id }
59- className = "ox-form"
60- autoComplete = "off"
61- onSubmit = { ( e ) => {
62- if ( ! onSubmit ) return
63- // This modal being in a portal doesn't prevent the submit event
64- // from bubbling up out of the portal. Normally that's not a
65- // problem, but sometimes (e.g., instance create) we render the
66- // SideModalForm from inside another form, in which case submitting
67- // the inner form submits the outer form unless we stop propagation
68- e . stopPropagation ( )
69- form . handleSubmit ( onSubmit ) ( e )
70- } }
71- >
72- { children }
73- </ form >
74- </ Modal . Section >
75- </ Modal . Body >
76- < Modal . Footer
77- onDismiss = { onDismiss }
78- formId = { id }
79- actionText = { submitLabel }
80- disabled = { ! ! submitDisabled }
81- actionLoading = { loading || isSubmitting }
82- />
83- </ Modal >
84- </ >
48+ < Modal isOpen onDismiss = { onDismiss } title = { title } width = { width } overlay = { overlay } >
49+ < Modal . Body >
50+ < Modal . Section >
51+ { submitError && (
52+ < Message variant = "error" title = "Error" content = { submitError . message } />
53+ ) }
54+ < form
55+ id = { id }
56+ className = "ox-form"
57+ autoComplete = "off"
58+ onSubmit = { ( e ) => {
59+ if ( ! onSubmit ) return
60+ // This modal being in a portal doesn't prevent the submit event
61+ // from bubbling up out of the portal. Normally that's not a
62+ // problem, but sometimes (e.g., instance create) we render the
63+ // SideModalForm from inside another form, in which case submitting
64+ // the inner form submits the outer form unless we stop propagation
65+ e . stopPropagation ( )
66+ form . handleSubmit ( onSubmit ) ( e )
67+ } }
68+ >
69+ { children }
70+ </ form >
71+ </ Modal . Section >
72+ </ Modal . Body >
73+ < Modal . Footer
74+ onDismiss = { onDismiss }
75+ formId = { id }
76+ actionText = { submitLabel }
77+ disabled = { ! ! submitDisabled }
78+ actionLoading = { loading || isSubmitting }
79+ />
80+ </ Modal >
8581 )
8682}
0 commit comments