'use strict';var utils=require('./utils-b175a405.js'),BaseIcon=require('./BaseIcon-2385428f.js'),normalizeComponent=require('./normalize-component-ebe0c011.js');require('./typeof-6b9e62b8.js'),require('./unsupportedIterableToArray-40a00645.js'),require('./es.array.join-443a49dd.js'),require('./well-known-symbol-d17f132e.js'),require('./array-method-is-strict-46936434.js'),require('./es.array.map-9ed24b81.js'),require('./array-iteration-7bef1cbf.js'),require('./function-bind-context-e4685306.js'),require('./array-species-create-cd337f69.js'),require('./array-method-has-species-support-73df5c77.js'),require('./regexp-exec-abstract-f1889c3e.js'),require('./string-multibyte-7b9a9b5a.js'),require('./regexp-flags-cc8e8e8b.js'),require('./es.string.split-a55a52d4.js'),require('./is-regexp-3bdf4eae.js'),require('./create-property-843cca47.js'),require('./es.object.to-string-36cdf22d.js'),require('./classof-5cc7a6a8.js'),require('./es.regexp.to-string-bb35129d.js'),require('./es.string.replace-9de5b0e2.js'),require('./es.array.includes-8b336760.js'),require('./object-keys-68ce563f.js'),require('./es.string.includes-42971fd6.js'),require('./es.array.sort-904aa90f.js'),require('./web.dom-collections.for-each-56c57b78.js'),require('./dom-iterables-e2602b7e.js'),require('./es.object.keys-bf503f80.js'),require('./es.array.concat-dd2e767c.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;