"use strict";

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

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

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

var _info = _interopRequireDefault(require("../info"));

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

var _default = (0, _create.default)({
  render: function render() {
    var _vm = this;

    var _h = _vm.$createElement;

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

    return _c('div', {
      class: [_vm.b({
        active: _vm.isActive,
        disabled: _vm.disabled
      })],
      style: _vm.style,
      attrs: {
        "role": "tab",
        "aria-selected": _vm.isActive
      },
      on: {
        "click": _vm.onClick
      }
    }, [_vm.dot || _vm.isDef(_vm.info) && _vm.info !== '' ? _c('span', {
      class: _vm.b('text-wrapper')
    }, [_c('span', {
      class: _vm.b('text', {
        ellipsis: !_vm.scrollable
      })
    }, [_vm._t("default", [_vm._v("\n        " + _vm._s(_vm.title) + "\n      ")], {
      "title": _vm.title
    })], 2), _c('Info', {
      attrs: {
        "dot": _vm.dot,
        "info": _vm.info
      }
    })], 1) : _c('span', {
      class: _vm.b('text', {
        ellipsis: !_vm.scrollable
      })
    }, [_vm._t("default", [_vm._v("\n      " + _vm._s(_vm.title) + "\n    ")], {
      "title": _vm.title
    })], 2)]);
  },
  components: {
    Info: _info.default
  },
  name: "tab",
  props: {
    dot: Boolean,
    type: String,
    info: [Number, String],
    color: String,
    title: String,
    isActive: Boolean,
    disabled: Boolean,
    scrollable: Boolean,
    activeColor: String,
    inactiveColor: String,
    swipeThreshold: [Number, String]
  },
  methods: {
    onClick: function onClick() {
      this.$emit("click");
    },
    isDef: _utils.isDef
  },
  computed: {
    style: function style() {
      var style = {};
      var color = this.color,
          isActive = this.isActive;
      var isCard = this.type === "card"; // card theme color

      if (color && isCard) {
        style.borderColor = color;

        if (!this.disabled) {
          if (isActive) {
            style.backgroundColor = color;
          } else {
            style.color = color;
          }
        }
      }

      var titleColor = isActive ? this.activeColor : this.inactiveColor;

      if (titleColor) {
        style.color = titleColor;
      }

      return style;
    }
  }
});

exports.default = _default;