@luftborn/custom-elements 2.15.7 → 2.15.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/demo/index.min.js CHANGED
@@ -4059,12 +4059,12 @@ var CheckBoxElement = /** @class */ (function (_super) {
4059
4059
  fieldset = document.createElement('fieldset');
4060
4060
  wrapper.appendChild(fieldset);
4061
4061
  }
4062
- this.options.forEach(function (element, index) {
4063
- var existingCheckbox = fieldset.querySelector("input[value='" + element + "']");
4064
- if (!existingCheckbox) {
4062
+ var optionsAlreadyAdded = fieldset.querySelectorAll('input[type="checkbox"]').length;
4063
+ if (!optionsAlreadyAdded) {
4064
+ this.options.forEach(function (element, index) {
4065
4065
  fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.checkboxTemplate, _this.name, element, _this.name + "-" + index));
4066
- }
4067
- });
4066
+ });
4067
+ }
4068
4068
  };
4069
4069
  CheckBoxElement.prototype.addLegend = function () {
4070
4070
  var fieldset = this.shadowRoot.querySelector('fieldset');
@@ -6279,12 +6279,10 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
6279
6279
  fieldset = document.createElement('fieldset');
6280
6280
  wrapper.appendChild(fieldset);
6281
6281
  }
6282
- if (fieldset.children.length === 0) {
6282
+ var optionsAlreadyAdded = fieldset.querySelectorAll('input[type="radio"]').length;
6283
+ if (!optionsAlreadyAdded) {
6283
6284
  this.options.forEach(function (element, index) {
6284
- var existingRadio = fieldset.querySelector("input[value='" + element + "']");
6285
- if (!existingRadio) {
6286
- fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
6287
- }
6285
+ fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
6288
6286
  });
6289
6287
  }
6290
6288
  };
@@ -7391,9 +7389,12 @@ var CustomInputElement = /** @class */ (function (_super) {
7391
7389
  newLabel.setAttribute('for', inputField.id);
7392
7390
  newLabel.classList.add('field-label');
7393
7391
  newLabel.textContent = this.label + ": ";
7394
- var fieldLabel = this.shadowRoot.querySelector('.field-label');
7395
- if (fieldLabel) {
7396
- fieldLabel.appendChild(newLabel);
7392
+ var fieldLabelDiv = this.shadowRoot.querySelector('.field-label');
7393
+ if (fieldLabelDiv) {
7394
+ var existingLabel = fieldLabelDiv.querySelector('label.field-label');
7395
+ if (!existingLabel) {
7396
+ fieldLabelDiv.appendChild(newLabel);
7397
+ }
7397
7398
  }
7398
7399
  if (this.required) {
7399
7400
  newLabel.innerHTML += '<span style="color: #e00040">*</span>';