import { Component, Event, h, Host, Prop } from '@stencil/core';
function toggleOption(value = [], option) {
  if (value.indexOf(option) > -1) {
    return value.filter(o => o !== option);
  }
  else {
    return [...value, option];
  }
}
export class DvnCheckboxGroup {
  constructor() {
    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 })))));
  }
  static get is() { return "dvn-checkbox-group"; }
  static get encapsulation() { return "shadow"; }
  static get properties() { return {
    "name": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "name",
      "reflect": false
    },
    "scale": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Scale",
        "resolved": "\"large\" | \"medium\" | \"small\"",
        "references": {
          "Scale": {
            "location": "import",
            "path": "../../theme"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "scale",
      "reflect": false,
      "defaultValue": "'medium'"
    },
    "value": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "string[]",
        "resolved": "string[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "defaultValue": "[]"
    },
    "disabled": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "disabled",
      "reflect": false,
      "defaultValue": "false"
    },
    "inline": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "inline",
      "reflect": false,
      "defaultValue": "false"
    },
    "options": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "{ label: string, value: string, disabled?: boolean }[]",
        "resolved": "{ label: string; value: string; disabled?: boolean; }[]",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "defaultValue": "[]"
    },
    "tint": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Tint",
        "resolved": "\"danger\" | \"neutral\" | \"primary\" | \"secondary\" | \"warning\"",
        "references": {
          "Tint": {
            "location": "import",
            "path": "../../theme"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "tint",
      "reflect": false,
      "defaultValue": "'primary'"
    }
  }; }
  static get events() { return [{
      "method": "change",
      "name": "change",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "any",
        "resolved": "any",
        "references": {}
      }
    }]; }
}
