"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const Overlay = require("../Overlay/Overlay.cjs");
const Transition = require("../Transition/Transition.cjs");
const ModalBase_context = require("./ModalBase.context.cjs");
const useModalTransition = require("./use-modal-transition.cjs");
const ModalBaseOverlay = React.forwardRef(
  ({ onClick, transitionProps, style, visible, ...others }, ref) => {
    const ctx = ModalBase_context.useModalBaseContext();
    const transition = useModalTransition.useModalTransition(transitionProps);
    return /* @__PURE__ */ jsxRuntime.jsx(
      Transition.Transition,
      {
        mounted: visible !== void 0 ? visible : ctx.opened,
        ...transition,
        transition: "fade",
        children: (transitionStyles) => /* @__PURE__ */ jsxRuntime.jsx(
          Overlay.Overlay,
          {
            ref,
            fixed: true,
            style: [style, transitionStyles],
            zIndex: ctx.zIndex,
            unstyled: ctx.unstyled,
            onClick: (event) => {
              onClick == null ? void 0 : onClick(event);
              ctx.closeOnClickOutside && ctx.onClose();
            },
            ...others
          }
        )
      }
    );
  }
);
ModalBaseOverlay.displayName = "@mantine/core/ModalBaseOverlay";
exports.ModalBaseOverlay = ModalBaseOverlay;
