@cscfi/csc-ui 1.3.2 → 1.3.4

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 (40) hide show
  1. package/dist/cjs/c-autocomplete_34.cjs.entry.js +17 -8
  2. package/dist/cjs/c-autocomplete_34.cjs.entry.js.map +1 -1
  3. package/dist/cjs/c-data-table.cjs.entry.js +1 -0
  4. package/dist/cjs/c-data-table.cjs.entry.js.map +1 -1
  5. package/dist/cjs/csc-ui.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/collection/components/c-autocomplete/c-autocomplete.js +3 -3
  8. package/dist/collection/components/c-autocomplete/c-autocomplete.js.map +1 -1
  9. package/dist/collection/components/c-checkbox/c-checkbox.js +7 -0
  10. package/dist/collection/components/c-checkbox/c-checkbox.js.map +1 -1
  11. package/dist/collection/components/c-data-table/c-data-table.js +1 -0
  12. package/dist/collection/components/c-data-table/c-data-table.js.map +1 -1
  13. package/dist/collection/components/c-select/c-select.js +8 -4
  14. package/dist/collection/components/c-select/c-select.js.map +1 -1
  15. package/dist/components/c-autocomplete.js +3 -3
  16. package/dist/components/c-autocomplete.js.map +1 -1
  17. package/dist/components/c-checkbox2.js +8 -2
  18. package/dist/components/c-checkbox2.js.map +1 -1
  19. package/dist/components/c-data-table.js +1 -0
  20. package/dist/components/c-data-table.js.map +1 -1
  21. package/dist/components/c-select.js +8 -4
  22. package/dist/components/c-select.js.map +1 -1
  23. package/dist/csc-ui/csc-ui.esm.js +1 -1
  24. package/dist/csc-ui/csc-ui.esm.js.map +1 -1
  25. package/dist/csc-ui/p-d457b878.entry.js +2 -0
  26. package/dist/csc-ui/p-d457b878.entry.js.map +1 -0
  27. package/dist/csc-ui/p-ed924115.entry.js +2 -0
  28. package/dist/csc-ui/p-ed924115.entry.js.map +1 -0
  29. package/dist/esm/c-autocomplete_34.entry.js +17 -8
  30. package/dist/esm/c-autocomplete_34.entry.js.map +1 -1
  31. package/dist/esm/c-data-table.entry.js +1 -0
  32. package/dist/esm/c-data-table.entry.js.map +1 -1
  33. package/dist/esm/csc-ui.js +1 -1
  34. package/dist/esm/loader.js +1 -1
  35. package/dist/types/components/c-checkbox/c-checkbox.d.ts +1 -0
  36. package/package.json +1 -1
  37. package/dist/csc-ui/p-df913633.entry.js +0 -2
  38. package/dist/csc-ui/p-df913633.entry.js.map +0 -1
  39. package/dist/csc-ui/p-e7b91787.entry.js +0 -2
  40. package/dist/csc-ui/p-e7b91787.entry.js.map +0 -1
@@ -227,14 +227,14 @@ const CAutocomplete = class {
227
227
  'c-input-menu__chevron': true,
228
228
  'c-input-menu__chevron--active': this.dropdownVisible,
229
229
  };
230
- return (index.h("c-icon-button", { size: "x-small", class: classes, text: true, onClick: (event) => this._toggleDropdown(event), onKeyDown: (event) => this._onButtonKeyDown('chevron', event) }, index.h("c-icon", { path: mdi.mdiChevronDown, size: 24 })));
230
+ return (index.h("c-icon-button", { size: "x-small", class: classes, disabled: this.disabled, text: true, onClick: (event) => this._toggleDropdown(event), onKeyDown: (event) => this._onButtonKeyDown('chevron', event) }, index.h("c-icon", { path: mdi.mdiChevronDown, size: 24 })));
231
231
  }
232
232
  _renderReset() {
233
- return (index.h("c-icon-button", { "aria-label": "", size: "x-small", text: true, onClick: (event) => this._reset(event), onKeyDown: (event) => this._onButtonKeyDown('reset', event) }, index.h("c-icon", { path: mdi.mdiClose, size: 20 })));
233
+ return (index.h("c-icon-button", { "aria-label": "", size: "x-small", disabled: this.disabled, text: true, onClick: (event) => this._reset(event), onKeyDown: (event) => this._onButtonKeyDown('reset', event) }, index.h("c-icon", { path: mdi.mdiClose, size: 20 })));
234
234
  }
235
235
  _renderInputElement() {
236
236
  var _a;
237
- return (index.h("div", { class: "c-input-menu__input" }, index.h("input", { type: "text", ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this.query, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, onInput: () => this._updateInput(), onFocus: () => this._onInputFocus() })));
237
+ return (index.h("div", { class: "c-input-menu__input" }, index.h("input", { type: "text", ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this.query, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, disabled: this.disabled, onInput: () => this._updateInput(), onFocus: () => this._onInputFocus() })));
238
238
  }
239
239
  componentWillLoad() {
240
240
  CAutocomplete._uniqueId += 1;
@@ -571,6 +571,10 @@ const CCheckbox = class {
571
571
  onValidChange(valid) {
572
572
  this._handleValidation(valid || this.valid);
573
573
  }
574
+ onValueChange(value) {
575
+ this.checked = this.trueValue === value;
576
+ this.internals.setFormValue(this.checked ? this.trueValue.toString() : this.falseValue.toString());
577
+ }
574
578
  handleKeyDown(event) {
575
579
  if (['Space'].includes(event.code)) {
576
580
  event.preventDefault();
@@ -632,7 +636,8 @@ const CCheckbox = class {
632
636
  get el() { return index.getElement(this); }
633
637
  static get watchers() { return {
634
638
  "validation": ["onValidationMessageChange"],
635
- "valid": ["onValidChange"]
639
+ "valid": ["onValidChange"],
640
+ "value": ["onValueChange"]
636
641
  }; }
637
642
  };
638
643
  CCheckbox.style = cCheckboxCss;
@@ -1806,6 +1811,8 @@ const CSelect = class {
1806
1811
  this._dropdownElement.updateList();
1807
1812
  };
1808
1813
  this._onInputFocus = () => {
1814
+ if (this.disabled)
1815
+ return;
1809
1816
  if (!this._preventDialogOpen) {
1810
1817
  this._dropdownElement.open();
1811
1818
  }
@@ -1866,6 +1873,8 @@ const CSelect = class {
1866
1873
  }
1867
1874
  handleKeyDown(event) {
1868
1875
  const alphanumeric = /^[0-9a-zA-Z ]+$/;
1876
+ if (this.disabled)
1877
+ return;
1869
1878
  if (event.key.match(alphanumeric) && event.key.length === 1) {
1870
1879
  if (this.dropdownVisible)
1871
1880
  return;
@@ -2022,18 +2031,18 @@ const CSelect = class {
2022
2031
  'c-input-menu__chevron': true,
2023
2032
  'c-input-menu__chevron--active': this.dropdownVisible,
2024
2033
  };
2025
- return (index.h("c-icon-button", { size: "x-small", class: classes, text: true, onClick: (event) => this._toggleDropdown(event), onKeyDown: (event) => this._onButtonKeyDown('chevron', event) }, index.h("c-icon", { path: mdi.mdiChevronDown, size: 24 })));
2034
+ return (index.h("c-icon-button", { size: "x-small", class: classes, disabled: this.disabled, text: true, onClick: (event) => this._toggleDropdown(event), onKeyDown: (event) => this._onButtonKeyDown('chevron', event) }, index.h("c-icon", { path: mdi.mdiChevronDown, size: 24 })));
2026
2035
  }
2027
2036
  _renderInputElement() {
2028
2037
  var _a;
2029
- return (index.h("div", { class: "c-input-menu__input" }, index.h("input", { type: "text", readonly: true, ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this._value, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, onInput: () => this._updateInput(), onFocus: () => this._onInputFocus() }), index.h("div", { ref: (el) => (this._selectionElement = el), class: "c-input-menu__selection" })));
2038
+ return (index.h("div", { class: "c-input-menu__input" }, index.h("input", { type: "text", readonly: true, ref: (el) => (this._inputElement = el), "aria-expanded": this.dropdownVisible.toString(), "aria-owns": this._inputId + '-items', "aria-autocomplete": "list", autocomplete: "off", class: "c-input__input", role: "combobox", value: this._value, name: (_a = this.name) !== null && _a !== void 0 ? _a : null, disabled: this.disabled, onInput: () => this._updateInput(), onFocus: () => this._onInputFocus() }), index.h("div", { ref: (el) => (this._selectionElement = el), class: "c-input-menu__selection" })));
2030
2039
  }
2031
2040
  _renderReset() {
2032
- return (index.h("c-icon-button", { "aria-label": "", size: "x-small", text: true, onClick: (event) => this._onReset(event), onKeyDown: (event) => this._onButtonKeyDown('reset', event) }, index.h("c-icon", { path: mdi.mdiClose, size: 20 })));
2041
+ return (index.h("c-icon-button", { "aria-label": "", size: "x-small", disabled: this.disabled, text: true, onClick: (event) => this._onReset(event), onKeyDown: (event) => this._onButtonKeyDown('reset', event) }, index.h("c-icon", { path: mdi.mdiClose, size: 20 })));
2033
2042
  }
2034
2043
  render() {
2035
2044
  const itemType = this.optionElementsExist ? 'option' : 'item';
2036
- return (index.h(index.Host, null, index.h("c-dropdown", { ref: (el) => (this._dropdownElement = el), id: `${this._id}-dropdown`, index: this.currentIndex, "items-per-page": this.itemsPerPage, "item-type": itemType, items: this._items, parent: this.el, type: "select" }, index.h("c-input", { slot: "default", ref: (el) => (this._cInputElement = el), active: this.dropdownVisible, disabled: this.disabled, "hide-details": this.hideDetails, hint: this.hint, id: this.hostId, "input-id": this._inputId, label: this.label, name: this.name, placeholder: this.placeholder, required: this.required, shadow: this.shadow, valid: this.valid, validate: this.validate, "validate-on-blur": this.validateOnBlur, validation: this.validation, value: this.value, variant: "select", onClick: () => this._dropdownElement.open() }, index.h("slot", { name: "pre", slot: "pre" }), index.h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading &&
2045
+ return (index.h(index.Host, null, index.h("c-dropdown", { ref: (el) => (this._dropdownElement = el), id: `${this._id}-dropdown`, index: this.currentIndex, "items-per-page": this.itemsPerPage, "item-type": itemType, items: this._items, parent: this.el, type: "select" }, index.h("c-input", { slot: "default", ref: (el) => (this._cInputElement = el), active: this.dropdownVisible, disabled: this.disabled, "hide-details": this.hideDetails, hint: this.hint, id: this.hostId, "input-id": this._inputId, label: this.label, name: this.name, placeholder: this.placeholder, required: this.required, shadow: this.shadow, valid: this.valid, validate: this.validate, "validate-on-blur": this.validateOnBlur, validation: this.validation, value: this.value, variant: "select", onClick: () => !this.disabled && this._dropdownElement.open() }, index.h("slot", { name: "pre", slot: "pre" }), index.h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading &&
2037
2046
  this.value &&
2038
2047
  this.clearable &&
2039
2048
  this._renderReset(), !this.loading &&