'use strict';var utils=require('./utils-307b9d48.js'),BaseIcon=require('./BaseIcon-d76fa559.js'),normalizeComponent=require('./normalize-component-a3a558e7.js');require('./typeof-6b9e62b8.js'),require('./unsupportedIterableToArray-40a00645.js'),require('./es.array.join-d5827db6.js'),require('./well-known-symbol-f1447879.js'),require('./array-method-is-strict-eaf6e6bc.js'),require('./es.array.map-8b8b1771.js'),require('./array-iteration-ec368d38.js'),require('./function-bind-context-6bee5e36.js'),require('./array-species-create-6d7d1ca3.js'),require('./array-method-has-species-support-43b9931e.js'),require('./regexp-exec-abstract-9fcb71e6.js'),require('./string-multibyte-d552dade.js'),require('./regexp-flags-e93c043d.js'),require('./es.string.split-8e95587e.js'),require('./is-regexp-3d2f5c60.js'),require('./create-property-7113990d.js'),require('./es.object.to-string-6eda7e05.js'),require('./classof-b3ccaaa6.js'),require('./es.regexp.to-string-da3f9988.js'),require('./es.string.replace-0a90b609.js'),require('./es.array.includes-cbacb659.js'),require('./object-keys-1798218f.js'),require('./es.string.includes-fd50111e.js'),require('./es.array.sort-71ab4282.js'),require('./web.dom-collections.for-each-a9e9d823.js'),require('./dom-iterables-e2602b7e.js'),require('./es.object.keys-258d7358.js'),require('./es.array.concat-cf822c2c.js');//
/**
 * Checkbox and Radio Button Component
 */

var script = {
  name: 'BaseCheckmark',
  components: {
    BaseIcon: BaseIcon["default"]
  },
  model: {
    prop: 'checked',
    event: 'clicked'
  },
  props: {
    /**
     * choose the style <br>
     * valid values: 'radio' | 'checkbox'
     */
    markStyle: {
      type: String,
      default: 'radio',
      validator: function validator(val) {
        return val === 'radio' || val === 'checkbox';
      }
    },

    /**
     * specify a discriptive label <br>
     * this will not be displayed but is only there for usability purposes <br>
     * TODO: for radio button label should actually be visible!
     */
    label: {
      type: String,
      default: 'select'
    },

    /**
     * specify a value for the radio button - if none is specified the label will be used to
     * determine if radio button should be active!
     */
    radioValue: {
      type: String,
      default: ''
    },

    /**
     * define if label should be visible - default set false because
     * currentyl not needed in base project
     */
    showLabel: {
      type: Boolean,
      default: false
    },

    /**
     * checkbox checked or radio button checked can be set from outside, default
     * value depending on type of selector
     *
     * @model
     */
    checked: {
      type: [Boolean, String],
      default: false
    },

    /**
     * set the size of the checkBox <br>
     * valid values: 'large' | 'small'
     */
    checkBoxSize: {
      type: String,
      default: 'small',
      validator: function validator(val) {
        return val === 'small' || val === 'large';
      }
    }
  },
  data: function data() {
    return {
      checkedInt: false
    };
  },
  computed: {
    internalId: function internalId() {
      return utils.c();
    },
    radioValueInt: function radioValueInt() {
      return this.radioValue || this.label;
    }
  },
  watch: {
    checked: {
      handler: function handler(val) {
        this.checkedInt = val;
      },
      immediate: true
    }
  },
  methods: {
    clicked: function clicked() {
      if (this.markStyle === 'checkbox') {
        this.checkedInt = !this.checkedInt;
      }
      /**
       * event emitted on radio button / checkmark click,
       * emitting input label
       *
       * @type {string | boolean}
       */


      this.$emit('clicked', this.markStyle === 'checkbox' ? this.checkedInt : this.radioValueInt);
    }
  }
};/* 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('div', {
    class: ['base-checkbox-container', 'base-checkbox-container-' + _vm.checkBoxSize],
    on: {
      "click": function click($event) {
        $event.stopPropagation();
        return _vm.clicked.apply(null, arguments);
      }
    }
  }, [_vm._ssrNode(((_vm.markStyle === 'checkbox' ? 'checkbox' : 'radio') === 'checkbox' ? "<input" + _vm._ssrAttr("id", _vm.internalId) + _vm._ssrAttr("name", _vm.label) + " type=\"checkbox\"" + _vm._ssrAttr("value", _vm.radioValueInt) + _vm._ssrAttr("checked", Array.isArray(_vm.checkedInt) ? _vm._i(_vm.checkedInt, _vm.radioValueInt) > -1 : _vm.checkedInt) + _vm._ssrClass(null, ['base-checkbox-input', {
    'base-checkbox-checked': _vm.checkedInt
  }]) + " data-v-441efacd>" : (_vm.markStyle === 'checkbox' ? 'checkbox' : 'radio') === 'radio' ? "<input" + _vm._ssrAttr("id", _vm.internalId) + _vm._ssrAttr("name", _vm.label) + " type=\"radio\"" + _vm._ssrAttr("value", _vm.radioValueInt) + _vm._ssrAttr("checked", _vm._q(_vm.checkedInt, _vm.radioValueInt)) + _vm._ssrClass(null, ['base-checkbox-input', {
    'base-checkbox-checked': _vm.checkedInt
  }]) + " data-v-441efacd>" : "<input" + _vm._ssrAttr("id", _vm.internalId) + _vm._ssrAttr("name", _vm.label) + _vm._ssrAttr("type", _vm.markStyle === 'checkbox' ? 'checkbox' : 'radio') + _vm._ssrAttr("value", _vm.radioValueInt) + _vm._ssrAttr("value", _vm.checkedInt) + _vm._ssrClass(null, ['base-checkbox-input', {
    'base-checkbox-checked': _vm.checkedInt
  }]) + " data-v-441efacd>") + " "), _vm._ssrNode("<div" + _vm._ssrClass(null, ['base-checkmark-container', 'base-checkmark-container-' + _vm.checkBoxSize, {
    'base-radiomark': _vm.markStyle === 'radio' && _vm.checkedInt === _vm.radioValueInt
  }]) + " data-v-441efacd>", "</div>", [_vm.markStyle === 'checkbox' && _vm.checkedInt ? _c('base-icon', {
    class: ['base-checkmark', 'base-checkmark-' + _vm.checkBoxSize],
    attrs: {
      "name": "check-mark"
    }
  }) : _vm._e()], 1), _vm._ssrNode(" <label" + _vm._ssrAttr("for", _vm.internalId) + _vm._ssrClass(null, ['base-checkbox-labeltext', {
    'hide': !_vm.showLabel
  }]) + " data-v-441efacd>" + _vm._ssrEscape(_vm._s(_vm.label)) + "</label>")], 2);
};

var __vue_staticRenderFns__ = [];
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = "data-v-441efacd";
/* module identifier */

var __vue_module_identifier__ = "data-v-441efacd";
/* functional template */

var __vue_is_functional_template__ = false;
/* style inject */

/* style inject SSR */

/* style inject shadow dom */

var __vue_component__ = /*#__PURE__*/normalizeComponent.n({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);

var BaseCheckmark = __vue_component__;exports["default"]=BaseCheckmark;