/*! bxs-vue-ui v3.3.0 */
'use strict';

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

require('../utils/entry-virtual.js');
var normalizeComponent = require('../utils/normalize-component.js');
require('../utils/sloppy-array-method.js');
var indexOf = require('../utils/index-of.js');
require('../utils/sloppy-array-method2.js');
require('../utils/es.array.join.js');

var onlyValues = function onlyValues(values) {
  return function (str) {
    return indexOf._indexOfInstanceProperty(values).call(values, str) !== -1;
  };
};

var script = normalizeComponent.create({
  name: 'button',
  props: {
    plain: {
      type: Boolean,
      default: false
    },
    loading: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    },
    nativeType: {
      type: String,
      default: 'button'
    },
    type: {
      type: String,
      default: 'primary',
      validator: onlyValues(['primary', 'minor', 'assist'])
    },
    size: {
      type: String,
      default: 'normal',
      validator: onlyValues(['large', 'middle', 'normal', 'small', 'mini'])
    }
  },
  computed: {
    className: function className() {
      var classArr = [];
      classArr.push("bx-button--" + this.type);
      classArr.push("bx-button--" + this.size);

      if (this.plain) {
        classArr.push('bx-button--plain');
      }

      if (this.disabled) {
        classArr.push('bx-button--disabled');
      }

      return classArr.join(' ');
    }
  },
  methods: {
    onClick: function onClick(event) {
      if (!this.loading && !this.disabled) {
        this.$emit('click', event);
      }
    }
  }
});

/* script */
var __vue_script__ = script;
/* template */

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

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

  return _c('button', {
    tag: "component",
    staticClass: "bx-button",
    class: _vm.className,
    attrs: {
      "type": _vm.nativeType,
      "disabled": _vm.disabled,
      "ontouchstart": !_vm.disabled
    },
    on: {
      "click": _vm.onClick
    }
  }, [_c('span', [_vm._t("default")], 2)]);
};

var __vue_staticRenderFns__ = [];
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = undefined;
/* module identifier */

var __vue_module_identifier__ = undefined;
/* functional template */

var __vue_is_functional_template__ = false;
/* style inject */

/* style inject SSR */

var Button = normalizeComponent.__vue_normalize__({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);

exports.default = Button;
