@@ -22,6 +22,10 @@ export interface ModalProps {
2222 cancelButtonText ?: string
2323 confirmButtonDisabled ?: boolean
2424 confirmButtonLoading ?: boolean
25+ beforeClose ?: (
26+ action : 'confirm' | 'cancel' | 'close' ,
27+ done : ( ) => void
28+ ) => void
2529 header ?: boolean
2630 footer ?: boolean
2731 closeOnClickOverlay ?: boolean
@@ -30,7 +34,6 @@ export interface ModalProps {
3034 headerClass ?: HTMLAttributes [ 'class' ]
3135 contentClass ?: HTMLAttributes [ 'class' ]
3236 footerClass ?: HTMLAttributes [ 'class' ]
33- modalId ?: string
3437}
3538export interface ModalEmits {
3639 'update:modelValue' : [ value : boolean ]
@@ -44,13 +47,13 @@ export interface ModalEmits {
4447
4548type alertOptions = Pick < ModalProps , 'title' | 'description' | 'icon' | 'alignCenter' | 'overlay' | 'overlayBlur' | 'confirmButtonText' | 'confirmButtonDisabled' | 'confirmButtonLoading' | 'closeOnClickOverlay' | 'closeOnPressEscape' | 'class' | 'headerClass' | 'contentClass' | 'footerClass' > & {
4649 content : string
47- onConfirm ?: ( ) => any
50+ onConfirm ?: ( ) => void
4851}
4952
50- type confirmOptions = Pick < ModalProps , 'title' | 'description' | 'alignCenter' | 'overlay' | 'overlayBlur' | 'confirmButtonText' | 'cancelButtonText' | 'confirmButtonDisabled' | 'confirmButtonLoading' | 'closeOnClickOverlay' | 'closeOnPressEscape' | 'class' | 'headerClass' | 'contentClass' | 'footerClass' > & {
53+ type confirmOptions = Pick < ModalProps , 'title' | 'description' | 'alignCenter' | 'overlay' | 'overlayBlur' | 'confirmButtonText' | 'cancelButtonText' | 'confirmButtonDisabled' | 'confirmButtonLoading' | 'beforeClose' | ' closeOnClickOverlay' | 'closeOnPressEscape' | 'class' | 'headerClass' | 'contentClass' | 'footerClass' > & {
5154 content : string
52- onConfirm ?: ( ) => any
53- onCancel ?: ( ) => any
55+ onConfirm ?: ( ) => void
56+ onCancel ?: ( ) => void
5457}
5558
5659export function useFaModal ( ) {
@@ -67,7 +70,6 @@ export function useFaModal() {
6770 closeOnClickOverlay : false ,
6871 contentClass : 'py-0 min-h-auto' ,
6972 footerClass : 'p-4' ,
70- modalId : useId ( ) ,
7173 onClosed : ( ) => {
7274 app . unmount ( )
7375 } ,
@@ -89,7 +91,6 @@ export function useFaModal() {
8991 closeOnClickOverlay : false ,
9092 contentClass : 'py-0 min-h-auto' ,
9193 footerClass : 'p-4' ,
92- modalId : useId ( ) ,
9394 onClosed : ( ) => {
9495 app . unmount ( )
9596 } ,
@@ -111,7 +112,6 @@ export function useFaModal() {
111112 closeOnClickOverlay : false ,
112113 contentClass : 'py-0 min-h-auto' ,
113114 footerClass : 'p-4' ,
114- modalId : useId ( ) ,
115115 onClosed : ( ) => {
116116 app . unmount ( )
117117 } ,
@@ -133,7 +133,6 @@ export function useFaModal() {
133133 closeOnClickOverlay : false ,
134134 contentClass : 'py-0 min-h-auto' ,
135135 footerClass : 'p-4' ,
136- modalId : useId ( ) ,
137136 onClosed : ( ) => {
138137 app . unmount ( )
139138 } ,
@@ -155,7 +154,6 @@ export function useFaModal() {
155154 contentClass : 'py-0 min-h-auto' ,
156155 footerClass : 'p-4' ,
157156 showCancelButton : true ,
158- modalId : useId ( ) ,
159157 onClosed : ( ) => {
160158 app . unmount ( )
161159 } ,
0 commit comments