import { Host, h } from '@stencil/core';
export class BsFormCheckGroup {
  constructor() {
    this.value = undefined;
  }
  valueChanged(value) {
    this.bsChange.emit(value);
  }
  handleChange(e) {
    const radioList = this.el.querySelectorAll("bs-form-check");
    radioList.forEach((radioItem) => {
      if (radioItem.value !== e.detail.value) {
        radioItem.checked = false;
      }
      else {
        this.value = e.detail;
      }
    });
  }
  componentDidLoad() {
    const radioList = this.el.querySelectorAll('bs-form-check[type="radio"]');
    radioList.forEach(radioItem => {
      radioItem.addEventListener('bsInput', this.handleChange.bind(this));
    });
  }
  render() {
    return (h(Host, null, h("slot", null)));
  }
  static get is() { return "bs-form-check-group"; }
  static get originalStyleUrls() {
    return {
      "$": ["bs-form-check-group.scss"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["bs-form-check-group.css"]
    };
  }
  static get properties() {
    return {
      "value": {
        "type": "any",
        "mutable": true,
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The value of the radio selection"
        },
        "attribute": "value",
        "reflect": false
      }
    };
  }
  static get events() {
    return [{
        "method": "bsChange",
        "name": "bsChange",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "The value of the radio select emitted"
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }];
  }
  static get elementRef() { return "el"; }
  static get watchers() {
    return [{
        "propName": "value",
        "methodName": "valueChanged"
      }];
  }
}
//# sourceMappingURL=bs-form-check-group.js.map
