import { r as registerInstance, c as createEvent, h, H as Host } from './index-b7735e0d.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) {
    registerInstance(this, hostRef);
    this.change = 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 (h(Host, null, this.options.map(option => (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 })))));
  }
};

export { DvnCheckboxGroup as dvn_checkbox_group };
