@luftborn/custom-elements 2.15.4 → 2.15.6

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
@@ -4058,6 +4058,8 @@ var CheckBoxElement = /** @class */ (function (_super) {
4058
4058
  if (!fieldset) {
4059
4059
  fieldset = document.createElement('fieldset');
4060
4060
  wrapper.appendChild(fieldset);
4061
+ }
4062
+ if (fieldset.children.length === 0) {
4061
4063
  this.options.forEach(function (element, index) {
4062
4064
  fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.checkboxTemplate, _this.name, element, _this.name + "-" + index));
4063
4065
  });
@@ -4067,8 +4069,9 @@ var CheckBoxElement = /** @class */ (function (_super) {
4067
4069
  var fieldset = this.shadowRoot.querySelector('fieldset');
4068
4070
  if (this.label) {
4069
4071
  fieldset.setAttribute('aria-label', this.label);
4070
- if (!this.hideLabel) {
4071
- var legend = document.createElement('legend');
4072
+ var legend = fieldset.querySelector('legend');
4073
+ if (!this.hideLabel && !legend) {
4074
+ legend = document.createElement('legend');
4072
4075
  legend.textContent = this.label;
4073
4076
  legend.classList.add('field-label');
4074
4077
  fieldset.insertAdjacentElement('afterbegin', legend);
@@ -6274,6 +6277,8 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
6274
6277
  if (!fieldset) {
6275
6278
  fieldset = document.createElement('fieldset');
6276
6279
  wrapper.appendChild(fieldset);
6280
+ }
6281
+ if (fieldset.children.length === 0) {
6277
6282
  this.options.forEach(function (element, index) {
6278
6283
  fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
6279
6284
  });
@@ -6283,8 +6288,9 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
6283
6288
  var fieldset = this.shadowRoot.querySelector('fieldset');
6284
6289
  if (this.label) {
6285
6290
  fieldset.setAttribute('aria-label', this.label);
6286
- if (!this.hideLabel) {
6287
- var legend = document.createElement('legend');
6291
+ var legend = fieldset.querySelector('legend');
6292
+ if (!this.hideLabel && !legend) {
6293
+ legend = document.createElement('legend');
6288
6294
  legend.textContent = this.label;
6289
6295
  legend.classList.add('field-label');
6290
6296
  fieldset.insertAdjacentElement('afterbegin', legend);