"use strict";

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

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

require("./option.css");

var _base = require("../../utils/base.js");

var _vueNormalizeComponent = _interopRequireDefault(require("../../utils/vue-normalize-component.js"));

/* script */
//
//
//
//
//
//
//
//
//
//
var __vue_script__ = {
  name: (0, _base.createComponentName)('select-option'),
  mixins: [_base.componentMixin],
  inject: ['select'],
  props: {
    value: {
      require: true,
      type: [String, Number, Array]
    },
    label: {
      type: String,
      require: true
    }
  },

  mounted() {
    if (this.value === this.select.currentValue) {
      this.selectOption(this.value, this.label);
    }
  },

  methods: {
    selectOption(value) {
      this.$emit('click', value);
      this.select.setOption(value, this.label);
    }

  }
};
/* template */

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

  var _h = _vm.$createElement;

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

  return _c("div", {
    class: _vm.bem({
      "is-active": _vm.value === _vm.select.currentValue
    }),
    on: {
      click: function click($event) {
        _vm.selectOption(_vm.value);
      }
    }
  }, [_vm._t("default", [_c("div", {
    class: _vm.bem("content")
  }, [_vm._v(_vm._s(_vm.label))])])], 2);
};

var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* 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;
/* component normalizer */

/* style inject */

/* style inject SSR */
var _default = (0, _vueNormalizeComponent.default)({
  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 = _default;