import { jsxs, jsx } from 'react/jsx-runtime';
import { useRef, useEffect } from 'react';
import LoadingOutlined from '@iam-com/icons/LoadingF';
import { $ as $prefixCls } from '../_verture/constant-66aa48a1.js';
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';

var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-loading {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n}\n@keyframes rotateLoading {\n  0% {\n    transformOrigin: 50% 50%;\n  }\n  100% {\n    transform: rotate(360deg);\n  }\n}\n.paraui-v3-loading .loading-mask {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  background-color: white;\n  z-index: 100;\n}\n.paraui-v3-loading .loading-box {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  z-index: 101;\n}\n.paraui-v3-loading .loading-box > svg {\n  transition: all 0.3s ease-in-out;\n  animation: rotateLoading 1s infinite linear;\n  font-size: 20px;\n}";
styleInject(css_248z);

var Loading = function Loading(props) {
  var className = props.className,
    style = props.style,
    _props$opacity = props.opacity,
    opacity = _props$opacity === void 0 ? 0.7 : _props$opacity;
  var dom = useRef(null);
  useEffect(function () {
    if (dom && dom.current && dom.current.parentNode) {
      if (!dom.current.parentNode.style.position) {
        dom.current.parentNode.style.position = 'relative';
      }
    }
  }, []);
  // 处理class
  var handClass = function handClass() {
    var str = "".concat($prefixCls, "-loading");
    if (className) str += ' ' + className;
    return str;
  };
  return jsxs("div", Object.assign({
    className: handClass(),
    style: style,
    ref: dom
  }, {
    children: [jsx("div", Object.assign({
      className: "loading-box"
    }, {
      children: jsx(LoadingOutlined, {})
    })), jsx("div", {
      className: "loading-mask",
      style: {
        opacity: opacity
      }
    })]
  }));
};

export { Loading, Loading as default };
