@luftborn/custom-elements 2.13.1 → 2.13.3

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
@@ -3283,6 +3283,7 @@ exports.CustomForm = void 0;
3283
3283
  var FileFieldElement_1 = require("./elements/FileField/FileFieldElement");
3284
3284
  var ArrayUtil_1 = require("./framework/Utilities/ArrayUtil");
3285
3285
  var MakeRequest_1 = require("./framework/Utilities/MakeRequest");
3286
+ var Elements_1 = require("./elements/Elements");
3286
3287
  var CustomForm = /** @class */ (function () {
3287
3288
  function CustomForm(form) {
3288
3289
  this.form = form;
@@ -3349,7 +3350,13 @@ var CustomForm = /** @class */ (function () {
3349
3350
  }
3350
3351
  }
3351
3352
  else {
3352
- formData.append("Values[" + input.name + "]", input.value);
3353
+ if (input instanceof Elements_1.CheckBoxElement) {
3354
+ var value = JSON.stringify(input.value);
3355
+ formData.append("Values[" + input.name + "]", value);
3356
+ }
3357
+ else {
3358
+ formData.append("Values[" + input.name + "]", input.value);
3359
+ }
3353
3360
  }
3354
3361
  }
3355
3362
  for (var _b = 0, _c = this.nativeInputs; _b < _c.length; _b++) {
@@ -3447,7 +3454,7 @@ var CustomForm = /** @class */ (function () {
3447
3454
  }());
3448
3455
  exports.CustomForm = CustomForm;
3449
3456
 
3450
- },{"./elements/FileField/FileFieldElement":26,"./framework/Utilities/ArrayUtil":62,"./framework/Utilities/MakeRequest":65}],11:[function(require,module,exports){
3457
+ },{"./elements/Elements":24,"./elements/FileField/FileFieldElement":26,"./framework/Utilities/ArrayUtil":62,"./framework/Utilities/MakeRequest":65}],11:[function(require,module,exports){
3451
3458
  "use strict";
3452
3459
  var __extends = (this && this.__extends) || (function () {
3453
3460
  var extendStatics = function (d, b) {
@@ -4435,6 +4442,9 @@ var CustomDatepicker = /** @class */ (function () {
4435
4442
  if (event.key === 'Enter') {
4436
4443
  _this.setDateUsingInputValue();
4437
4444
  }
4445
+ if (event.key === 'Escape' || event.key === 'Tab') {
4446
+ _this.showPicker(false);
4447
+ }
4438
4448
  });
4439
4449
  this.otherTriggers.forEach(function (trigger) {
4440
4450
  trigger.addEventListener('click', function () { return _this.showPicker(true); });
@@ -4468,7 +4478,7 @@ exports.default = CustomDatepicker;
4468
4478
  "use strict";
4469
4479
  Object.defineProperty(exports, "__esModule", { value: true });
4470
4480
  exports.CustomDatepickerStyles = void 0;
4471
- exports.CustomDatepickerStyles = "\n .custom-datepicker {\n position: fixed;\n background-color: #fff;\n display: none;\n width: 12.5rem;\n border: 0.063rem solid #ccc;\n border-radius: 0.313rem;\n padding: 0.625rem;\n margin: 0 auto;\n box-shadow: 0 0 0.625rem 0 #ccc;\n font: 0.75rem Arial, sans-serif;\n }\n\n .custom-datepicker .custom-datepicer-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 0.625rem;\n }\n .custom-datepicker .weekdays {\n display: flex;\n justify-content: space-between;\n }\n .custom-datepicker .weekdays span {\n width: 14.28%;\n text-align: center;\n padding: 0.313rem 0;\n }\n .custom-datepicker .days {\n display: flex;\n flex-wrap: wrap;\n }\n .custom-datepicker .days span {\n width: 14.28%;\n text-align: center;\n padding: 0.313rem 0;\n }\n .custom-datepicker .days span:hover {\n background-color: #B2d5ff;\n cursor: pointer;\n }\n .custom-datepicker .days span.today {\n border: 0.063rem solid #000;\n }\n .custom-datepicker .days span.selected-day {\n background-color: #0075ff;\n color: #fff;\n }\n .custom-datepicker .prev-month, .next-month {\n cursor: pointer;\n }\n .custom-datepicker .month-year {\n font-weight: bold;\n }\n .custom-datepicker .month-year:hover {\n cursor: pointer;\n }\n .custom-datepicker .select-month-year {\n display: none;\n width: 100%;\n overflow-y: auto;\n }\n .custom-datepicker .select-month-year .year {\n text-align: center;\n background-color: #f0f0f0;\n border-bottom: 0.063rem solid #3f3d3d;\n padding: 0.313rem 0;\n cursor: pointer;\n }\n .custom-datepicker .select-month-year .year .months {\n display: flex;\n flex-wrap: wrap;\n }\n .custom-datepicker .select-month-year .year .months span {\n width: 25%;\n text-align: center;\n padding: 0.625rem 0;\n background-color: #fff;\n }\n .custom-datepicker .select-month-year .year .months span:hover {\n background-color: #B2d5ff;\n cursor: pointer;\n }\n .custom-datepicker .actions {\n display: flex;\n justify-content: space-between;\n margin-top: 0.625rem;\n }\n .custom-datepicker .actions input {\n color: #0075ff;\n border: none;\n background-color: transparent;\n padding: 0.313rem;\n border: 0.063rem solid transparent;\n }\n .custom-datepicker .actions input:hover {\n background-color: #B2d5ff;\n border-color: #000;\n }\n";
4481
+ exports.CustomDatepickerStyles = "\n .custom-datepicker {\n position: fixed;\n background-color: #fff;\n display: none;\n width: 12.5rem;\n border: 0.063rem solid #ccc;\n border-radius: 0.313rem;\n padding: 0.625rem;\n margin: 0 auto;\n box-shadow: 0 0 0.625rem 0 #ccc;\n font: 0.75rem Arial, sans-serif;\n }\n\n .custom-datepicker .custom-datepicer-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 0.625rem;\n }\n .custom-datepicker .weekdays {\n display: flex;\n justify-content: space-between;\n }\n .custom-datepicker .weekdays span {\n width: 14.28%;\n text-align: center;\n padding: 0.313rem 0;\n }\n .custom-datepicker .days {\n display: flex;\n flex-wrap: wrap;\n }\n .custom-datepicker .days span {\n width: 14.28%;\n text-align: center;\n padding: 0.313rem 0;\n }\n .custom-datepicker .days span:hover {\n background-color: #B2d5ff;\n cursor: pointer;\n }\n .custom-datepicker .days span.today {\n border: 0.063rem solid #000;\n }\n .custom-datepicker .days span.selected-day {\n background-color: #0070F0;\n color: #fff;\n }\n .custom-datepicker .prev-month, .next-month {\n cursor: pointer;\n }\n .custom-datepicker .month-year {\n font-weight: bold;\n }\n .custom-datepicker .month-year:hover {\n cursor: pointer;\n }\n .custom-datepicker .select-month-year {\n display: none;\n width: 100%;\n overflow-y: auto;\n }\n .custom-datepicker .select-month-year .year {\n text-align: center;\n background-color: #f0f0f0;\n border-bottom: 0.063rem solid #3f3d3d;\n padding: 0.313rem 0;\n cursor: pointer;\n }\n .custom-datepicker .select-month-year .year .months {\n display: flex;\n flex-wrap: wrap;\n }\n .custom-datepicker .select-month-year .year .months span {\n width: 25%;\n text-align: center;\n padding: 0.625rem 0;\n background-color: #fff;\n }\n .custom-datepicker .select-month-year .year .months span:hover {\n background-color: #B2d5ff;\n cursor: pointer;\n }\n .custom-datepicker .actions {\n display: flex;\n justify-content: space-between;\n margin-top: 0.625rem;\n }\n .custom-datepicker .actions input {\n color: #0070F0;\n border: none;\n background-color: transparent;\n padding: 0.313rem;\n border: 0.063rem solid transparent;\n }\n .custom-datepicker .actions input:hover {\n background-color: #B2d5ff;\n border-color: #000;\n }\n";
4472
4482
 
4473
4483
  },{}],18:[function(require,module,exports){
4474
4484
  "use strict";
@@ -5017,8 +5027,8 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
5017
5027
  CustomFormatDateFieldElement = __decorate([
5018
5028
  (0, custom_element_decorator_1.default)({
5019
5029
  selector: 'custom-format-date-element',
5020
- template: "\n\t\t<div class=\"wrapper\">\n\t\t\t<input type=\"text\" id=\"date-field\" />\n\t\t\t<svg id=\"picker-trigger\" data-toggle viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"2\" y=\"4\" width=\"20\" height=\"18\" rx=\"1\" fill=\"#000\"/><rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" fill=\"white\"/><path d=\"M4 10H20\" stroke=\"#000\" stroke-width=\"1\"/><circle cx=\"16\" cy=\"14\" r=\"2\" fill=\"#F44336\"/><rect x=\"6\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/><rect x=\"15\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/></svg>\n\t\t</div>",
5021
- style: "\n\t\t:host{\n\t\t\twidth:100%;\n\t\t}\n\t\t* {\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.wrapper{\n\t\t\tdisplay:flex;\n\t\t\tposition: relative;\n\t\t}\n\t\tinput{\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 0.125rem;\n\t\t\tresize: none;\n\t\t}\n\t\t#date-field::after {\n\t\t\tcontent: url('path/to/datepicker-icon.png'); /* Path to your datepicker icon */\n\t\t\tcursor: pointer;\n\t\t\tright: 0.625rem;\n\t\t}\n\t\t#picker-trigger {\n\t\t\tcursor: pointer;\n\t\t\twidth: 0.938rem;\n\t\t\theight: 0.938rem;\n\t\t\tposition:absolute;\n\t\t\tright: 0.125rem;\n\t\t\ttop: 15%;\n\t\t}\n\t",
5030
+ template: "\n\t\t<div class=\"wrapper\">\n\t\t\t<input type=\"text\" id=\"date-field\">\n\t\t\t<button id=\"picker-trigger\" aria-label=\"Open date picker\">\n\t\t\t\t<svg class=\"svg-picker\" data-toggle viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"2\" y=\"4\" width=\"20\" height=\"18\" rx=\"1\" fill=\"#000\"/><rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" fill=\"white\"/><path d=\"M4 10H20\" stroke=\"#000\" stroke-width=\"1\"/><circle cx=\"16\" cy=\"14\" r=\"2\" fill=\"#F44336\"/><rect x=\"6\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/><rect x=\"15\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/></svg>\n\t\t\t</button>\n\t\t</div>",
5031
+ style: "\n\t\t:host{\n\t\t\twidth:100%;\n\t\t}\n\t\t* {\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.wrapper{\n\t\t\tdisplay:flex;\n\t\t\tposition: relative;\n\t\t}\n\t\tinput{\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 0.125rem;\n\t\t\tresize: none;\n\t\t}\n\t\t#date-field::after {\n\t\t\tcontent: url('path/to/datepicker-icon.png'); /* Path to your datepicker icon */\n\t\t\tcursor: pointer;\n\t\t\tright: 0.625rem;\n\t\t}\n\t\t.svg-picker {\n\t\t\twidth: 0.938rem;\n\t\t\theight: 0.938rem;\n\t\t}\n\t\t#picker-trigger {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: transparent;\n\t\t\tborder: none;\n\t\t\twidth: 0.938rem;\n\t\t\theight: 0.938rem;\n\t\t\tposition:absolute;\n\t\t\tright: 0.125rem;\n\t\t\ttop: 15%;\n\t\t\tpadding: 0;\n\t\t}\n\t",
5022
5032
  useShadow: true,
5023
5033
  })
5024
5034
  ], CustomFormatDateFieldElement);
@@ -6699,7 +6709,8 @@ var TypeAheadElement = /** @class */ (function (_super) {
6699
6709
  TypeAheadElement.prototype.initChildInputs = function () {
6700
6710
  var _this = this;
6701
6711
  this.textInputElement = _super.prototype.getChildInput.call(this, '#text-input');
6702
- this.descriptionElement = _super.prototype.getChildInput.call(this, '#description');
6712
+ this.descriptionElement = _super.prototype.getChildElement.call(this, '#description');
6713
+ this.optionsListElement = _super.prototype.getChildElement.call(this, '#options-list');
6703
6714
  this.componentWrapper = _super.prototype.getChildElement.call(this, '.wrapper');
6704
6715
  if (this.required) {
6705
6716
  this.textInputElement.setAttribute('required', '');
@@ -6744,6 +6755,9 @@ var TypeAheadElement = /** @class */ (function (_super) {
6744
6755
  }
6745
6756
  _this.searchResultOptions.push(option);
6746
6757
  var optionsListItem = document.createElement("div");
6758
+ optionsListItem.setAttribute('role', 'option');
6759
+ optionsListItem.setAttribute('id', "option-" + index);
6760
+ optionsListItem.setAttribute('aria-selected', 'false');
6747
6761
  optionsListItem.classList.add('options-list-item');
6748
6762
  optionsListItem.dataset['value'] = option.value;
6749
6763
  optionslist.appendChild(optionsListItem);
@@ -6758,16 +6772,16 @@ var TypeAheadElement = /** @class */ (function (_super) {
6758
6772
  optionsListItem.addEventListener('mousedown', function () {
6759
6773
  _this.optionSelectedHandler(option);
6760
6774
  });
6761
- _this.componentWrapper.appendChild(optionslist);
6775
+ _this.optionsListElement.appendChild(optionsListItem);
6762
6776
  });
6777
+ this.optionsListElement.hidden = false;
6778
+ this.updateAriaAttributes();
6763
6779
  };
6764
6780
  TypeAheadElement.prototype.closeOptionsList = function () {
6765
6781
  this.currentFoucsedIndex = -1;
6766
- var optionsList = _super.prototype.getChildElement.call(this, '.options-list');
6767
- if (!optionsList) {
6768
- return;
6769
- }
6770
- optionsList.remove();
6782
+ this.optionsListElement.innerHTML = '';
6783
+ this.optionsListElement.hidden = true;
6784
+ this.updateAriaAttributes();
6771
6785
  };
6772
6786
  TypeAheadElement.prototype.optionSelectedHandler = function (option) {
6773
6787
  this.value = option.value;
@@ -6786,6 +6800,7 @@ var TypeAheadElement = /** @class */ (function (_super) {
6786
6800
  }
6787
6801
  _this.currentFoucsedIndex = _this.currentFoucsedIndex === _this.searchResultOptions.length - 1 ? 0 : _this.currentFoucsedIndex + 1;
6788
6802
  _this.highlightFocusedSearchResult();
6803
+ _this.scrollToFocusedOption();
6789
6804
  }
6790
6805
  if (event.key === 'ArrowUp') {
6791
6806
  if (!_this.searchHasResults) {
@@ -6793,6 +6808,7 @@ var TypeAheadElement = /** @class */ (function (_super) {
6793
6808
  }
6794
6809
  _this.currentFoucsedIndex = _this.currentFoucsedIndex === 0 ? _this.searchResultOptions.length - 1 : _this.currentFoucsedIndex - 1;
6795
6810
  _this.highlightFocusedSearchResult();
6811
+ _this.scrollToFocusedOption();
6796
6812
  }
6797
6813
  if (event.key === 'Enter') {
6798
6814
  if (_this.currentFoucsedIndex !== -1 && _this.searchHasResults) {
@@ -6802,6 +6818,12 @@ var TypeAheadElement = /** @class */ (function (_super) {
6802
6818
  }
6803
6819
  });
6804
6820
  };
6821
+ TypeAheadElement.prototype.scrollToFocusedOption = function () {
6822
+ var optionListItems = _super.prototype.getChildElements.call(this, '.options-list-item');
6823
+ if (optionListItems && optionListItems[this.currentFoucsedIndex]) {
6824
+ optionListItems[this.currentFoucsedIndex].scrollIntoView({ block: 'nearest' });
6825
+ }
6826
+ };
6805
6827
  TypeAheadElement.prototype.highlightFocusedSearchResult = function () {
6806
6828
  var _this = this;
6807
6829
  var optionListItems = _super.prototype.getChildElements.call(this, '.options-list-item');
@@ -6809,12 +6831,17 @@ var TypeAheadElement = /** @class */ (function (_super) {
6809
6831
  return;
6810
6832
  }
6811
6833
  optionListItems.forEach(function (listItem, index) {
6834
+ listItem.setAttribute('aria-selected', String(index === _this.currentFoucsedIndex));
6812
6835
  listItem.classList.remove('active');
6813
6836
  if (index === _this.currentFoucsedIndex) {
6814
6837
  listItem.classList.add('active');
6838
+ _this.textInputElement.setAttribute('aria-activedescendant', listItem.id);
6815
6839
  }
6816
6840
  });
6817
6841
  };
6842
+ TypeAheadElement.prototype.updateAriaAttributes = function () {
6843
+ this.textInputElement.setAttribute('aria-expanded', String(!this.optionsListElement.hidden));
6844
+ };
6818
6845
  TypeAheadElement.prototype.change = function ($event) {
6819
6846
  this.touched = true;
6820
6847
  this.onChange.emit(new CustomEvents_1.CustomElementEventArgs(this.value, 'change'));
@@ -6826,8 +6853,8 @@ var TypeAheadElement = /** @class */ (function (_super) {
6826
6853
  TypeAheadElement = __decorate([
6827
6854
  (0, custom_element_decorator_1.default)({
6828
6855
  selector: 'type-ahead-element',
6829
- template: "\n\t\t<div class=\"wrapper\">\n\t\t\t<input type=\"text\" id=\"text-input\">\n\t\t\t<div id=\"description\"></div>\n\t\t</div>",
6830
- style: "\n\t\t:host {\n\t\t\twidth:100%;\n\t\t}\n\t\t.wrapper {\n\t\t\tposition: relative;\n\t\t\tdisplay:flex;\n\t\t\tflex-direction: column;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t}\n\t\t#text-input {\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 0.125rem;\n\t\t\tresize: none;\n\t\t}\n\t\t.wrapper #description {\n\t\t\twidth: 100%;\n\t\t\tpadding: 0 0.125rem;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.options-list {\n\t\t\tposition: absolute;\n\t\t\tborder: 0.063rem solid #E8E8E8;\n\t\t\tborder-bottom: none;\n\t\t\tborder-top: none;\n\t\t\tz-index: 3;\n\t\t\ttop: 100%;\n\t\t\tleft: 0;\n\t\t\tright: 0;\n\t\t\tmax-height: 12.5rem;\n\t\t\toverflow-y: auto;\n\t\t}\n\t\t.options-list-item {\n\t\t\tpadding: 0.625rem;\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: #FFFFFF;\n\t\t\tborder-bottom: 0.063rem solid #E8E8E8;\n\t\t}\n\t\t.options-list-item:hover {\n\t\t\tbackground-color: #E8E8E8;\n\t\t}\n\t\t.options-list-item.active {\n\t\t\t/*when navigating through the items using the arrow keys:*/\n\t\t\tbackground-color: #003E64 !important;\n\t\t\tcolor: #FFFFFF;\n\t\t}\n\t\t.options-list-item-title {\n\t\t\tfont-size: 1rem;\n\t\t}\n\t\t.options-list-item-description {\n\t\t\tfont-size: 0.625rem;\n\t\t}\n\t",
6856
+ template: "\n\t\t<div class=\"wrapper\" role=\"combobox\" aria-expanded=\"false\" aria-owns=\"options-list\" aria-haspopup=\"listbox\">\n\t\t\t<input type=\"text\" id=\"text-input\" aria-autocomplete=\"list\" aria-controls=\"options-list\" aria-activedescendant=\"\" role=\"textbox\">\n\t\t\t<div id=\"description\" aria-live=\"polite\"></div>\n\t\t\t<div id=\"options-list\" role=\"listbox\" class=\"options-list\" hidden>\n\t\t\t\t<!-- Options will be dynamically added here -->\n\t\t\t</div>\n\t\t</div>",
6857
+ style: "\n\t\t:host {\n\t\t\twidth:100%;\n\t\t}\n\t\t.wrapper {\n\t\t\tposition: relative;\n\t\t\tdisplay:flex;\n\t\t\tflex-direction: column;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t}\n\t\t#text-input {\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 0.125rem;\n\t\t\tresize: none;\n\t\t}\n\t\t.wrapper #description {\n\t\t\twidth: 100%;\n\t\t\tpadding: 0 0.125rem;\n\t\t\tbox-sizing: border-box;\n\t\t}\n\t\t.options-list {\n\t\t\tposition: absolute;\n\t\t\tborder: 0.063rem solid #E8E8E8;\n\t\t\tborder-bottom: none;\n\t\t\tborder-top: none;\n\t\t\tz-index: 3;\n\t\t\ttop: 100%;\n\t\t\tleft: 0;\n\t\t\tright: 0;\n\t\t\tmax-height: 12.5rem;\n\t\t\toverflow-y: auto;\n\t\t}\n\t\t.options-list-item {\n\t\t\tpadding: 0.625rem;\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: #FFFFFF;\n\t\t\tborder-bottom: 0.063rem solid #E8E8E8;\n\t\t}\n\t\t.options-list-item:hover {\n\t\t\tbackground-color: #E8E8E8;\n\t\t}\n\t\t.options-list-item.active {\n\t\t\tbackground-color: #003E64 !important;\n\t\t\tcolor: #FFFFFF;\n\t\t}\n\t\t.options-list-item-title {\n\t\t\tfont-size: 1rem;\n\t\t}\n\t\t.options-list-item-description {\n\t\t\tfont-size: 0.625rem;\n\t\t}\n\t",
6831
6858
  useShadow: true,
6832
6859
  })
6833
6860
  ], TypeAheadElement);