UNPKG

@leancodepl/utils

Version:

Common utility functions and React hooks for web applications

28 lines (27 loc) 831 B
/** * React hook for managing dialog state with optional callback after closing. * Provides convenient open/close functions and tracks the dialog's open state. * * @param onAfterClose - Optional callback function to execute after the dialog closes * @returns Object containing dialog state and control functions * @example * ```typescript * function MyComponent() { * const { isDialogOpen, openDialog, closeDialog } = useDialog(() => { * console.log('Dialog closed'); * }); * * return ( * <div> * <button onClick={openDialog}>Open Dialog</button> * {isDialogOpen && <Dialog onClose={closeDialog} />} * </div> * ); * } * ``` */ export declare function useDialog(onAfterClose?: () => void): { isDialogOpen: boolean; openDialog: () => void; closeDialog: () => void; };