import * as tslib_1 from "tslib";
import React, { useEffect } from 'react';
import classNames from 'classnames';
import Portal from '../portal';
import { CSSTransition } from 'react-transition-group';
var defaultProps = {
    isShow: false,
    unmountOnExit: true,
    zIndex: 1000,
    prefixCls: 'ty-overlay',
    type: 'default',
};
var Overlay = function (props) {
    var isShow = props.isShow, unmountOnExit = props.unmountOnExit, type = props.type, zIndex = props.zIndex, clickCallback = props.clickCallback, onEnter = props.onEnter, onEntered = props.onEntered, onExit = props.onExit, onExited = props.onExited, prefixCls = props.prefixCls, children = props.children, style = props.style;
    var cls = classNames(prefixCls, prefixCls + "_" + type);
    useEffect(function () {
        if (isShow) {
            document.body.style.overflow = 'hidden';
        }
        else {
            document.body.style.overflow = null;
        }
    }, [isShow]);
    return (React.createElement(Portal, null,
        React.createElement(CSSTransition, { appear: true, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExited: onExited, in: isShow, mountOnEnter: true, unmountOnExit: unmountOnExit, classNames: prefixCls + "_fade", timeout: { exit: 300, enter: 0 } },
            React.createElement("div", { className: cls, onClick: clickCallback, style: tslib_1.__assign({ zIndex: zIndex }, style) }, children))));
};
Overlay.defaultProps = defaultProps;
export default Overlay;
//# sourceMappingURL=index.js.map