import type { ComponentType } from 'react'; import type { ModalComponentProps, UseModalReturn } from './ModalContext.types'; /** * Custom hook that provides an abstraction layer over the modal context. * Takes a component type and returns functions to open/close that specific modal. * Uses React's useId hook to generate a unique identifier for the modal instance. * * @template T - The props type for the modal component (must extend ModalComponentProps) * @param Component - React component to use for the modal * @returns An object containing openModal, closeModal functions and the modalId * * @example * ```tsx * function MyComponent() { * const confirmationModal = useModal(ConfirmationModal); * * const handleDelete = () => { * confirmationModal.openModal({ * title: 'Delete Item', * message: 'Are you sure you want to delete this item?', * show: true, * onConfirm: () => { * // perform delete * confirmationModal.closeModal(); * }, * onCancel: confirmationModal.closeModal * }); * }; * * return ; * } * ``` */ export declare const useModal: (Component: ComponentType) => UseModalReturn;