@coin-voyage/paykit
Version:
Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.
28 lines (27 loc) • 1.22 kB
TypeScript
import type React from "react";
/**
* Manage modal mount/unmount transitions and provide measured content dimensions.
*
* - Controls mount state via react-transition-state (timeout: 160ms).
* - Locks body scroll when the modal is mounted and rendered outside the trigger.
* - Measures content size (width/height) and exposes a CSS-friendly object for use by the modal.
* - `resizeDependency` may be changed by callers (e.g. triggerResize()) to force a re-measure.
*
* The hook attempts to avoid transient zero-size measurements and keeps a short
* "inTransition" window after content is attached so layout can settle before consumers
* react to the new dimensions.
*/
export declare function useModalTransition({ open, positionInside, onClose, resizeDependency, }: {
open: boolean;
positionInside?: boolean;
onClose?: () => void;
/** When this value changes, the modal re-measures its content (e.g. from triggerResize()). */
resizeDependency?: number;
}): {
state: import("react-transition-state").TransitionState;
mounted: boolean;
rendered: boolean;
inTransition: boolean;
contentRef: (node: HTMLDivElement | null) => void;
dimensionsCSS: React.CSSProperties;
};