'use strict';var utils=require('./utils-08ccde2c.js'),BaseIcon=require('./BaseIcon-2d6ac6a6.js'),normalizeComponent=require('./normalize-component-d9981c57.js');require('./typeof-6b9e62b8.js'),require('./unsupportedIterableToArray-40a00645.js'),require('./es.array.join-88750c41.js'),require('./export-61511812.js'),require('./array-method-is-strict-99341ee3.js'),require('./es.array.map-30953c40.js'),require('./array-iteration-f35df2b6.js'),require('./function-bind-context-e4685306.js'),require('./array-method-has-species-support-983ac207.js'),require('./regexp-exec-abstract-216cd44a.js'),require('./string-multibyte-a2dff6e3.js'),require('./regexp-flags-abc49c4a.js'),require('./es.string.split-98e29ede.js'),require('./is-regexp-d6f1551e.js'),require('./create-property-240c71a5.js'),require('./es.object.to-string-f27a75a8.js'),require('./classof-819fc780.js'),require('./es.regexp.to-string-5606f728.js'),require('./es.string.replace-25e9e098.js'),require('./es.array.includes-3990bfec.js'),require('./object-keys-12f2c5e5.js'),require('./es.string.includes-ec03e639.js'),require('./es.array.sort-60060df6.js'),require('./web.dom-collections.for-each-721f3fb0.js'),require('./dom-iterables-e2602b7e.js'),require('./es.object.keys-c57f02bd.js'),require('vue-svgicon');//
/**
 * 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;