@luftborn/custom-elements 2.12.9 → 2.13.0

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.
Files changed (68) hide show
  1. package/demo/index.js +53 -68
  2. package/demo/index.min.js +52 -67
  3. package/demo/index.min.js.map +1 -1
  4. package/dist/elements/Address/AddressElement.js +2 -2
  5. package/dist/elements/Address/AddressElement.js.map +1 -1
  6. package/dist/elements/BankField/BankFieldElement.js +2 -2
  7. package/dist/elements/BankField/BankFieldElement.js.map +1 -1
  8. package/dist/elements/CPRElement/CPRElement.js +2 -2
  9. package/dist/elements/CPRElement/CPRElement.js.map +1 -1
  10. package/dist/elements/CVRElement/CVRElement.js +2 -2
  11. package/dist/elements/CVRElement/CVRElement.js.map +1 -1
  12. package/dist/elements/CheckBoxElement/CheckBoxElement.js +8 -7
  13. package/dist/elements/CheckBoxElement/CheckBoxElement.js.map +1 -1
  14. package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js +2 -2
  15. package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js.map +1 -1
  16. package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.js +2 -2
  17. package/dist/elements/CustomRegularExpression/CustomRegularExpressionElement.js.map +1 -1
  18. package/dist/elements/DateField/DateFieldElement.js +2 -2
  19. package/dist/elements/DateField/DateFieldElement.js.map +1 -1
  20. package/dist/elements/DropDownList/DropDownListElement.js +2 -2
  21. package/dist/elements/DropDownList/DropDownListElement.js.map +1 -1
  22. package/dist/elements/EmailField/EmailFieldElement.js +2 -2
  23. package/dist/elements/EmailField/EmailFieldElement.js.map +1 -1
  24. package/dist/elements/FileField/FileFieldElement.js +2 -2
  25. package/dist/elements/FileField/FileFieldElement.js.map +1 -1
  26. package/dist/elements/IdentificationElement/IdentificationElement.js +2 -2
  27. package/dist/elements/IdentificationElement/IdentificationElement.js.map +1 -1
  28. package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js +2 -2
  29. package/dist/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.js.map +1 -1
  30. package/dist/elements/NumericField/NumericFieldElement.js +2 -2
  31. package/dist/elements/NumericField/NumericFieldElement.js.map +1 -1
  32. package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js +7 -7
  33. package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js.map +1 -1
  34. package/dist/elements/SECompanyRegistrationElement/SECompanyRegistrationElement.js +2 -2
  35. package/dist/elements/SECompanyRegistrationElement/SECompanyRegistrationElement.js.map +1 -1
  36. package/dist/elements/SEPersonalNumberElement/SEPersonalNumberElement.js +2 -2
  37. package/dist/elements/SEPersonalNumberElement/SEPersonalNumberElement.js.map +1 -1
  38. package/dist/elements/TextAreaElement/TextAreaElement.js +2 -2
  39. package/dist/elements/TextAreaElement/TextAreaElement.js.map +1 -1
  40. package/dist/elements/TextField/TextFieldElement.js +2 -2
  41. package/dist/elements/TextField/TextFieldElement.js.map +1 -1
  42. package/dist/elements/TypeAhead/TypeAheadElement.js +2 -2
  43. package/dist/elements/TypeAhead/TypeAheadElement.js.map +1 -1
  44. package/dist/framework/CustomInputElement.d.ts +1 -2
  45. package/dist/framework/CustomInputElement.js +1 -17
  46. package/dist/framework/CustomInputElement.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/elements/Address/AddressElement.ts +2 -2
  49. package/src/elements/BankField/BankFieldElement.ts +2 -2
  50. package/src/elements/CPRElement/CPRElement.ts +2 -2
  51. package/src/elements/CVRElement/CVRElement.ts +2 -2
  52. package/src/elements/CheckBoxElement/CheckBoxElement.ts +19 -5
  53. package/src/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.ts +2 -2
  54. package/src/elements/CustomRegularExpression/CustomRegularExpressionElement.ts +2 -2
  55. package/src/elements/DateField/DateFieldElement.ts +2 -2
  56. package/src/elements/DropDownList/DropDownListElement.ts +2 -2
  57. package/src/elements/EmailField/EmailFieldElement.ts +2 -2
  58. package/src/elements/FileField/FileFieldElement.ts +2 -2
  59. package/src/elements/IdentificationElement/IdentificationElement.ts +2 -2
  60. package/src/elements/InternationaPhoneNumber/InternationaPhoneNumberElement.ts +2 -2
  61. package/src/elements/NumericField/NumericFieldElement.ts +2 -2
  62. package/src/elements/RadioButtonGroup/RadioButtonGroupElement.ts +21 -5
  63. package/src/elements/SECompanyRegistrationElement/SECompanyRegistrationElement.ts +2 -2
  64. package/src/elements/SEPersonalNumberElement/SEPersonalNumberElement.ts +2 -2
  65. package/src/elements/TextAreaElement/TextAreaElement.ts +2 -2
  66. package/src/elements/TextField/TextFieldElement.ts +2 -2
  67. package/src/elements/TypeAhead/TypeAheadElement.ts +2 -2
  68. package/src/framework/CustomInputElement.ts +2 -18
package/demo/index.min.js CHANGED
@@ -3543,8 +3543,8 @@ var AddressElement = /** @class */ (function (_super) {
3543
3543
  this.country.setAttribute('required', '');
3544
3544
  this.zip.setAttribute('required', '');
3545
3545
  }
3546
- if (this.labelId) {
3547
- this.address.setAttribute('aria-labelledby', this.labelId);
3546
+ if (this.label) {
3547
+ this.address.setAttribute('aria-label', this.label);
3548
3548
  }
3549
3549
  };
3550
3550
  // events
@@ -3748,8 +3748,8 @@ var BankFieldElement = /** @class */ (function (_super) {
3748
3748
  this.account.setAttribute('required', '');
3749
3749
  this.regNumber.setAttribute('required', '');
3750
3750
  }
3751
- if (this.labelId) {
3752
- this.regNumber.setAttribute('aria-labelledby', this.labelId);
3751
+ if (this.label) {
3752
+ this.regNumber.setAttribute('aria-label', this.label);
3753
3753
  }
3754
3754
  };
3755
3755
  // events
@@ -3855,8 +3855,8 @@ var CPRElement = /** @class */ (function (_super) {
3855
3855
  if (this.initialValue) {
3856
3856
  this.value = this.initialValue;
3857
3857
  }
3858
- if (this.labelId) {
3859
- this.text.setAttribute('aria-labelledby', this.labelId);
3858
+ if (this.label) {
3859
+ this.text.setAttribute('aria-label', this.label);
3860
3860
  }
3861
3861
  };
3862
3862
  // events
@@ -3945,8 +3945,8 @@ var CVRElement = /** @class */ (function (_super) {
3945
3945
  if (this.initialValue) {
3946
3946
  this.value = this.initialValue;
3947
3947
  }
3948
- if (this.labelId) {
3949
- this.text.setAttribute('aria-labelledby', this.labelId);
3948
+ if (this.label) {
3949
+ this.text.setAttribute('aria-label', this.label);
3950
3950
  }
3951
3951
  };
3952
3952
  // events
@@ -4038,16 +4038,17 @@ var CheckBoxElement = /** @class */ (function (_super) {
4038
4038
  this.checkbox.forEach(function (c) {
4039
4039
  return c.addEventListener('change', _this.change.bind(_this));
4040
4040
  });
4041
- if (this.labelId) {
4042
- this.checkbox[0].setAttribute('aria-labelledby', this.labelId);
4043
- }
4044
4041
  };
4045
4042
  CheckBoxElement.prototype.addCheckBoxes = function () {
4046
4043
  var _this = this;
4047
4044
  var wrapper = _super.prototype.getChildElement.call(this, '.wrapper');
4048
- wrapper.innerHTML = "";
4045
+ var fieldset = wrapper.querySelector('fieldset');
4046
+ if (this.label) {
4047
+ // fieldset.setAttribute('aria-label', this.label);
4048
+ fieldset.insertAdjacentHTML('beforeend', "<legend class=\"sr-only\">" + this.label + "</legend>");
4049
+ }
4049
4050
  this.options.forEach(function (element, index) {
4050
- wrapper.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.checkboxTemplate, _this.name, element, _this.name + "-" + index));
4051
+ fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.checkboxTemplate, _this.name, element, _this.name + "-" + index));
4051
4052
  });
4052
4053
  };
4053
4054
  // events
@@ -4062,8 +4063,8 @@ var CheckBoxElement = /** @class */ (function (_super) {
4062
4063
  CheckBoxElement = __decorate([
4063
4064
  (0, custom_element_decorator_1.default)({
4064
4065
  selector: 'checkbox-element',
4065
- template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t</div>",
4066
- style: "\n\t\t\t:host{\n\t\t\t\twidth:100%;\n\t\t\t}\n\t\t\t.checkbox {\n\t\t\t\twidth: auto;\n\t\t\t\tmargin: auto 3px;\n\t\t\t\tcolor: rgba(72, 72, 72, 0.75);\n\t\t\t\tfont-size: 13px;\n\t\t\t}\n\t\t\tinput[type='checkbox']{\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: auto !important;\n\t\t\t\tborder: none;\n\t\t\t\tbackground-color: #f1f4ff;\n\t\t\t\tmargin: 2px;\n\t\t\t\tresize: none;\n\t\t\t}\n\t\t",
4066
+ template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t\t<fieldset></fieldset>\n\t\t\t</div>",
4067
+ style: "\n\t\t\t:host{\n\t\t\t\twidth:100%;\n\t\t\t}\n\t\t\t.checkbox {\n\t\t\t\twidth: auto;\n\t\t\t\tmargin: auto 3px;\n\t\t\t\tcolor: rgba(72, 72, 72, 0.75);\n\t\t\t\tfont-size: 13px;\n\t\t\t}\n\t\t\tinput[type='checkbox']{\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: auto !important;\n\t\t\t\tborder: none;\n\t\t\t\tbackground-color: #f1f4ff;\n\t\t\t\tmargin: 2px;\n\t\t\t\tresize: none;\n\t\t\t}\n\t\t\t.sr-only:not(:focus):not(:active) {\n\t\t\t\tclip: rect(0 0 0 0); \n\t\t\t\tclip-path: inset(50%);\n\t\t\t\theight: 1px;\n\t\t\t\toverflow: hidden;\n\t\t\t\tposition: absolute;\n\t\t\t\twhite-space: nowrap; \n\t\t\t\twidth: 1px;\n\t\t\t}\n\t\t",
4067
4068
  useShadow: true,
4068
4069
  })
4069
4070
  ], CheckBoxElement);
@@ -4977,8 +4978,8 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
4977
4978
  if (!this.justPreview) {
4978
4979
  this.initCustomPicker();
4979
4980
  }
4980
- if (this.labelId) {
4981
- this.date.setAttribute('aria-labelledby', this.labelId);
4981
+ if (this.label) {
4982
+ this.date.setAttribute('aria-label', this.label);
4982
4983
  }
4983
4984
  };
4984
4985
  // events
@@ -5096,8 +5097,8 @@ var CustomRegularExpressionElement = /** @class */ (function (_super) {
5096
5097
  if (this.placeholder) {
5097
5098
  this.text.setAttribute('placeholder', this.placeholder);
5098
5099
  }
5099
- if (this.labelId) {
5100
- this.text.setAttribute('aria-labelledby', this.labelId);
5100
+ if (this.label) {
5101
+ this.text.setAttribute('aria-label', this.label);
5101
5102
  }
5102
5103
  };
5103
5104
  // events
@@ -5189,8 +5190,8 @@ var DateFieldElement = /** @class */ (function (_super) {
5189
5190
  if (this.initialValue) {
5190
5191
  this.value = this.initialValue;
5191
5192
  }
5192
- if (this.labelId) {
5193
- this.date.setAttribute('aria-labelledby', this.labelId);
5193
+ if (this.label) {
5194
+ this.date.setAttribute('aria-label', this.label);
5194
5195
  }
5195
5196
  };
5196
5197
  // events
@@ -5288,8 +5289,8 @@ var DropDownListElement = /** @class */ (function (_super) {
5288
5289
  this.value = this.initialValue;
5289
5290
  }
5290
5291
  this.select.addEventListener('change', this.change.bind(this));
5291
- if (this.labelId) {
5292
- this.select.setAttribute('aria-labelledby', this.labelId);
5292
+ if (this.label) {
5293
+ this.select.setAttribute('aria-label', this.label);
5293
5294
  }
5294
5295
  };
5295
5296
  DropDownListElement.prototype.addOptions = function () {
@@ -5438,8 +5439,8 @@ var EmailFieldElement = /** @class */ (function (_super) {
5438
5439
  if (this.initialValue) {
5439
5440
  this.value = this.initialValue;
5440
5441
  }
5441
- if (this.labelId) {
5442
- this.email.setAttribute('aria-labelledby', this.labelId);
5442
+ if (this.label) {
5443
+ this.email.setAttribute('aria-label', this.label);
5443
5444
  }
5444
5445
  };
5445
5446
  // events
@@ -5574,8 +5575,8 @@ var FileFieldElement = /** @class */ (function (_super) {
5574
5575
  if (this.multi) {
5575
5576
  this.file.setAttribute('multiple', '');
5576
5577
  }
5577
- if (this.labelId) {
5578
- this.file.setAttribute('aria-labelledby', this.labelId);
5578
+ if (this.label) {
5579
+ this.file.setAttribute('aria-label', this.label);
5579
5580
  }
5580
5581
  };
5581
5582
  // events
@@ -5868,8 +5869,8 @@ var IdentificationElement = /** @class */ (function (_super) {
5868
5869
  this.text.setAttribute('required', '');
5869
5870
  }
5870
5871
  this.type = this.typeSelector.value;
5871
- if (this.labelId) {
5872
- this.text.setAttribute('aria-labelledby', this.labelId);
5872
+ if (this.label) {
5873
+ this.text.setAttribute('aria-label', this.label);
5873
5874
  }
5874
5875
  };
5875
5876
  // events
@@ -5980,8 +5981,8 @@ var IntPhoneFieldElement = /** @class */ (function (_super) {
5980
5981
  this.phone.setAttribute('placeholder', this.placeholder);
5981
5982
  this.intlTelInput.options.autoPlaceholder = 'off';
5982
5983
  }
5983
- if (this.labelId) {
5984
- this.phone.setAttribute('aria-labelledby', this.labelId);
5984
+ if (this.label) {
5985
+ this.phone.setAttribute('aria-label', this.label);
5985
5986
  }
5986
5987
  };
5987
5988
  IntPhoneFieldElement.prototype.setIntlTelInput = function () {
@@ -6122,8 +6123,8 @@ var NumericFieldElement = /** @class */ (function (_super) {
6122
6123
  if (this.initialValue) {
6123
6124
  this.value = this.initialValue;
6124
6125
  }
6125
- if (this.labelId) {
6126
- this.number.setAttribute('aria-labelledby', this.labelId);
6126
+ if (this.label) {
6127
+ this.number.setAttribute('aria-label', this.label);
6127
6128
  }
6128
6129
  };
6129
6130
  // events
@@ -6221,16 +6222,16 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
6221
6222
  if (this.initialValue) {
6222
6223
  this.value = this.initialValue;
6223
6224
  }
6224
- if (this.labelId) {
6225
- this.radioButton[0].setAttribute('aria-labelledby', this.labelId);
6226
- }
6227
6225
  };
6228
6226
  RadioButtonGroupElement.prototype.addRadioButtons = function () {
6229
6227
  var _this = this;
6230
6228
  var wrapper = _super.prototype.getChildElement.call(this, '.wrapper');
6231
- wrapper.innerHTML = "";
6229
+ var fieldset = wrapper.querySelector('fieldset');
6230
+ if (this.label) {
6231
+ fieldset.insertAdjacentHTML('beforeend', "<legend class=\"sr-only\">" + this.label + "</legend>");
6232
+ }
6232
6233
  this.options.forEach(function (element, index) {
6233
- wrapper.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
6234
+ fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
6234
6235
  });
6235
6236
  };
6236
6237
  // events
@@ -6245,8 +6246,8 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
6245
6246
  RadioButtonGroupElement = __decorate([
6246
6247
  (0, custom_element_decorator_1.default)({
6247
6248
  selector: 'radio-group-element',
6248
- template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t</div>",
6249
- style: "\n\t\t\t:host{\n\t\t\t\twidth:100%;\n\t\t\t}\n\t\t\t.radio-button {\n\t\t\t\twidth: auto;\n\t\t\t\tmargin: auto 3px;\n\t\t\t\tcolor: rgba(72, 72, 72, 0.75);\n\t\t\t\tfont-size: 13px;\n\t\t\t}\n\t\t\tinput{\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: auto !important;\n\t\t\t\tborder: none;\n\t\t\t\tbackground-color: #f1f4ff;\n\t\t\t\tmargin: 2px;\n\t\t\t\tresize: none;\n\t\t\t}\n\t\t",
6249
+ template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t\t<fieldset></fieldset>\n\t\t\t</div>",
6250
+ style: "\n\t\t\t:host{\n\t\t\t\twidth:100%;\n\t\t\t}\n\t\t\t.radio-button {\n\t\t\t\twidth: auto;\n\t\t\t\tmargin: auto 3px;\n\t\t\t\tcolor: rgba(72, 72, 72, 0.75);\n\t\t\t\tfont-size: 13px;\n\t\t\t}\n\t\t\tinput{\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: auto !important;\n\t\t\t\tborder: none;\n\t\t\t\tbackground-color: #f1f4ff;\n\t\t\t\tmargin: 2px;\n\t\t\t\tresize: none;\n\t\t\t}\n\t\t\t.sr-only:not(:focus):not(:active) {\n\t\t\t\tclip: rect(0 0 0 0); \n\t\t\t\tclip-path: inset(50%);\n\t\t\t\theight: 1px;\n\t\t\t\toverflow: hidden;\n\t\t\t\tposition: absolute;\n\t\t\t\twhite-space: nowrap; \n\t\t\t\twidth: 1px;\n\t\t\t}\n\t\t\tfieldset {\n\t\t\t\tborder: none;\n\t\t\t}\n\t\t",
6250
6251
  useShadow: true,
6251
6252
  })
6252
6253
  ], RadioButtonGroupElement);
@@ -6319,8 +6320,8 @@ var SECompanyRegistrationElement = /** @class */ (function (_super) {
6319
6320
  if (this.initialValue) {
6320
6321
  this.value = this.initialValue;
6321
6322
  }
6322
- if (this.labelId) {
6323
- this.text.setAttribute('aria-labelledby', this.labelId);
6323
+ if (this.label) {
6324
+ this.text.setAttribute('aria-label', this.label);
6324
6325
  }
6325
6326
  };
6326
6327
  // events
@@ -6409,8 +6410,8 @@ var SEPersonalNumberElement = /** @class */ (function (_super) {
6409
6410
  if (this.initialValue) {
6410
6411
  this.value = this.initialValue;
6411
6412
  }
6412
- if (this.labelId) {
6413
- this.text.setAttribute('aria-labelledby', this.labelId);
6413
+ if (this.label) {
6414
+ this.text.setAttribute('aria-label', this.label);
6414
6415
  }
6415
6416
  };
6416
6417
  // events
@@ -6499,8 +6500,8 @@ var TextAreaElement = /** @class */ (function (_super) {
6499
6500
  if (this.initialValue) {
6500
6501
  this.value = this.initialValue;
6501
6502
  }
6502
- if (this.labelId) {
6503
- this.text.setAttribute('aria-labelledby', this.labelId);
6503
+ if (this.label) {
6504
+ this.text.setAttribute('aria-label', this.label);
6504
6505
  }
6505
6506
  };
6506
6507
  // events
@@ -6589,8 +6590,8 @@ var TextFieldElement = /** @class */ (function (_super) {
6589
6590
  if (this.initialValue) {
6590
6591
  this.value = this.initialValue;
6591
6592
  }
6592
- if (this.labelId) {
6593
- this.text.setAttribute('aria-labelledby', this.labelId);
6593
+ if (this.label) {
6594
+ this.text.setAttribute('aria-label', this.label);
6594
6595
  }
6595
6596
  };
6596
6597
  // events
@@ -6709,8 +6710,8 @@ var TypeAheadElement = /** @class */ (function (_super) {
6709
6710
  if (this.initialValue) {
6710
6711
  this.value = this.initialValue;
6711
6712
  }
6712
- if (this.labelId) {
6713
- this.textInputElement.setAttribute('aria-labelledby', this.labelId);
6713
+ if (this.label) {
6714
+ this.textInputElement.setAttribute('aria-label', this.label);
6714
6715
  }
6715
6716
  this.textInputElement.addEventListener('change', this.change.bind(this));
6716
6717
  this.textInputElement.addEventListener('input', function () {
@@ -6978,7 +6979,7 @@ var CustomInputElement = /** @class */ (function (_super) {
6978
6979
  this.customValue = data.value;
6979
6980
  this.dateFormat = data.dateFormat;
6980
6981
  this.initialValue = data.value;
6981
- this.labelId = data.labelId;
6982
+ this.label = data.label;
6982
6983
  }
6983
6984
  catch (ex) {
6984
6985
  console.error(ex);
@@ -7006,9 +7007,6 @@ var CustomInputElement = /** @class */ (function (_super) {
7006
7007
  _this.validate();
7007
7008
  }
7008
7009
  });
7009
- if (this.labelId) {
7010
- this.createLabelEventListener(this.labelId);
7011
- }
7012
7010
  };
7013
7011
  CustomInputElement.prototype.setAttributes = function () {
7014
7012
  this.setAttribute("custom-input", "");
@@ -7107,19 +7105,6 @@ var CustomInputElement = /** @class */ (function (_super) {
7107
7105
  this.closest('.custom-validation-target').removeAttribute("hidden");
7108
7106
  }
7109
7107
  };
7110
- CustomInputElement.prototype.createLabelEventListener = function (labelId) {
7111
- var _this = this;
7112
- var label = document.querySelector("[id=\"" + labelId + "\"]");
7113
- if (label) {
7114
- label.addEventListener("click", function () {
7115
- // the input is that have aria-labelledby attribute equal to the this.labelId
7116
- var input = _this.getChildElement("[aria-labelledby=\"" + labelId + "\"]");
7117
- if (input) {
7118
- input.focus();
7119
- }
7120
- });
7121
- }
7122
- };
7123
7108
  CustomInputElement.prototype.getChildInput = function (selector) {
7124
7109
  var element = this;
7125
7110
  if (this.shadowRoot) {