"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _create = _interopRequireDefault(require("../utils/create"));

var _utils = require("../utils");

var _event = require("../utils/dom/event");

var _default = (0, _create.default)({
  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: _utils.noop,
    preventTouchMove: function preventTouchMove(event) {
      (0, _event.preventDefault)(event, true);
    }
  },
  computed: {
    style: function style() {
      var style = (0, _extends2.default)({
        zIndex: this.zIndex
      }, this.customStyle);

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

      return style;
    }
  }
});

exports.default = _default;