'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-ce58ddc5.js');

function toggleOption(value = [], option) {
  if (value.indexOf(option) > -1) {
    return value.filter(o => o !== option);
  }
  else {
    return [...value, option];
  }
}
let DvnCheckboxGroup = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.change = index.createEvent(this, "change", 7);
    this.scale = 'medium';
    this.value = [];
    this.disabled = false;
    this.inline = false;
    this.options = [];
    this.tint = 'primary';
  }
  render() {
    const checkName = this.name || Math.random().toString(36).substr(2, 5);
    return (index.h(index.Host, null, this.options.map(option => (index.h("dvn-checkbox", { onChange: (e) => {
        e.stopPropagation();
        this.change.emit(toggleOption(this.value, option.value));
      }, checked: this.value.indexOf(option.value) > -1, value: option.value, label: option.label, name: checkName, inline: this.inline, disabled: this.disabled || option.disabled, scale: this.scale, tint: this.tint })))));
  }
};

exports.dvn_checkbox_group = DvnCheckboxGroup;
