import _extends from "@babel/runtime/helpers/esm/extends";
import create from "../utils/create";
import { isDef, noop } from "../utils";
import { preventDefault } from "../utils/dom/event";
export default create({
  render: function render() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('transition', {
      attrs: {
        "name": "vm-fade"
      }
    }, [_c('div', {
      directives: [{
        name: "show",
        rawName: "v-show",
        value: _vm.show,
        expression: "show"
      }],
      class: [_vm.b(), _vm.className],
      style: _vm.style,
      on: {
        "touchmove": function touchmove($event) {
          _vm.lockScroll ? _vm.preventTouchMove : _vm.noop;
        },
        "click": function click($event) {
          return _vm.$emit('click', $event);
        }
      }
    }, [_vm._t("default")], 2)]);
  },
  name: "overlay",
  props: {
    show: Boolean,
    zIndex: [Number, String],
    duration: [Number, String],
    className: null,
    customStyle: Object,
    lockScroll: {
      type: Boolean,
      default: true
    }
  },
  methods: {
    noop: noop,
    preventTouchMove: function preventTouchMove(event) {
      preventDefault(event, true);
    }
  },
  computed: {
    style: function style() {
      var style = _extends({
        zIndex: this.zIndex
      }, this.customStyle);

      if (isDef(this.duration)) {
        style.animationDuration = this.duration + "s";
      }

      return style;
    }
  }
});