'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var index = require('../../svg-icon/index.js');

"use strict";
const _hoisted_1 = { class: "loading-body" };
const _hoisted_2 = { class: "loading-icon" };
const __default__ = vue.defineComponent({
  name: "me-loading"
});
var script = /* @__PURE__ */ vue.defineComponent({
  ...__default__,
  props: {
    show: { type: Boolean, required: false, default: true },
    icon: { type: String, required: false, default: "ri-shopping-bag-4-fill" },
    width: { type: String, required: false, default: "50px" },
    loadingWidth: { type: String, required: false, default: "3px" },
    loadingColor: { type: String, required: false, default: "red" }
  },
  setup(__props, { expose: __expose }) {
    const props = __props;
    vue.watch(() => props.show, (val) => {
      if (val) {
        document.body.style.overflow = "hidden";
      } else {
        document.body.style.overflow = "auto";
      }
    }, { immediate: true });
    const icon = vue.ref(props.icon);
    const loadingStyle = vue.computed(() => {
      return {
        "--me-loading-width": props.width,
        "--me-loading-loader-width": props.loadingWidth,
        "--me-loading-loader-color": props.loadingColor
      };
    });
    const setIcon = (iconName) => {
      icon.value = iconName;
    };
    __expose({
      setIcon,
      icon
    });
    return (_ctx, _cache) => {
      return __props.show ? (vue.openBlock(), vue.createElementBlock(
        "div",
        {
          key: 0,
          class: "me-loading",
          style: vue.normalizeStyle({ ...loadingStyle.value })
        },
        [
          vue.createElementVNode("div", _hoisted_1, [
            vue.createElementVNode("div", _hoisted_2, [
              vue.renderSlot(_ctx.$slots, "default", {}, () => [
                vue.createVNode(vue.unref(index.MeSvgIcon), {
                  size: 20,
                  name: icon.value
                }, null, 8, ["name"])
              ])
            ]),
            _cache[0] || (_cache[0] = vue.createElementVNode(
              "div",
              { class: "loader" },
              null,
              -1
              /* CACHED */
            ))
          ])
        ],
        4
        /* STYLE */
      )) : vue.createCommentVNode("v-if", true);
    };
  }
});

exports.default = script;
//# sourceMappingURL=loading.vue2.js.map
