UNPKG

@yamada-ui/modal

Version:

Yamada UI modal component

54 lines (52 loc) 1.32 kB
"use client" import { useModal } from "./chunk-64A25YOZ.mjs"; // src/modal-overlay.tsx import { motion, motionForwardRef } from "@yamada-ui/motion"; import { fadeProps } from "@yamada-ui/transitions"; import { cx, handlerAll } from "@yamada-ui/utils"; import { jsx } from "react/jsx-runtime"; var ModalOverlay = motionForwardRef( ({ className, onClick, __css, ...rest }, ref) => { const { animation, closeOnOverlay, duration, styles, onClose, onOverlayClick } = useModal(); const css = { h: "100dvh", left: 0, position: "fixed", top: 0, w: "100vw", ...__css ? __css : styles.overlay }; const props = animation !== "none" ? fadeProps : {}; return /* @__PURE__ */ jsx( motion.div, { ref, className: cx("ui-modal__overlay", className), "aria-hidden": true, custom: { duration }, onClick: handlerAll(onClick, onOverlayClick, (ev) => { ev.stopPropagation(); if (closeOnOverlay) onClose == null ? void 0 : onClose(); }), __css: css, ...props, ...rest } ); } ); ModalOverlay.displayName = "ModalOverlay"; ModalOverlay.__ui__ = "ModalOverlay"; export { ModalOverlay }; //# sourceMappingURL=chunk-XDFGVPCC.mjs.map