@cscfi/csc-ui 1.3.2 → 1.3.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.
@@ -223,14 +223,14 @@ const CAutocomplete = class {
223
223
  'c-input-menu__chevron': true,
224
224
  'c-input-menu__chevron--active': this.dropdownVisible,
225
225
  };
226
- return (h("c-icon-button", { size: "x-small", class: classes, text: true, onClick: (event) => this._toggleDropdown(event), onKeyDown: (event) => this._onButtonKeyDown('chevron', event) }, h("c-icon", { path: mdiChevronDown, size: 24 })));
226
+ return (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) }, h("c-icon", { path: mdiChevronDown, size: 24 })));
227
227
  }
228
228
  _renderReset() {
229
- return (h("c-icon-button", { "aria-label": "", size: "x-small", text: true, onClick: (event) => this._reset(event), onKeyDown: (event) => this._onButtonKeyDown('reset', event) }, h("c-icon", { path: mdiClose, size: 20 })));
229
+ return (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) }, h("c-icon", { path: mdiClose, size: 20 })));
230
230
  }
231
231
  _renderInputElement() {
232
232
  var _a;
233
- return (h("div", { class: "c-input-menu__input" }, 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() })));
233
+ return (h("div", { class: "c-input-menu__input" }, 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() })));
234
234
  }
235
235
  componentWillLoad() {
236
236
  CAutocomplete._uniqueId += 1;
@@ -1802,6 +1802,8 @@ const CSelect = class {
1802
1802
  this._dropdownElement.updateList();
1803
1803
  };
1804
1804
  this._onInputFocus = () => {
1805
+ if (this.disabled)
1806
+ return;
1805
1807
  if (!this._preventDialogOpen) {
1806
1808
  this._dropdownElement.open();
1807
1809
  }
@@ -1862,6 +1864,8 @@ const CSelect = class {
1862
1864
  }
1863
1865
  handleKeyDown(event) {
1864
1866
  const alphanumeric = /^[0-9a-zA-Z ]+$/;
1867
+ if (this.disabled)
1868
+ return;
1865
1869
  if (event.key.match(alphanumeric) && event.key.length === 1) {
1866
1870
  if (this.dropdownVisible)
1867
1871
  return;
@@ -2018,18 +2022,18 @@ const CSelect = class {
2018
2022
  'c-input-menu__chevron': true,
2019
2023
  'c-input-menu__chevron--active': this.dropdownVisible,
2020
2024
  };
2021
- return (h("c-icon-button", { size: "x-small", class: classes, text: true, onClick: (event) => this._toggleDropdown(event), onKeyDown: (event) => this._onButtonKeyDown('chevron', event) }, h("c-icon", { path: mdiChevronDown, size: 24 })));
2025
+ return (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) }, h("c-icon", { path: mdiChevronDown, size: 24 })));
2022
2026
  }
2023
2027
  _renderInputElement() {
2024
2028
  var _a;
2025
- return (h("div", { class: "c-input-menu__input" }, 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() }), h("div", { ref: (el) => (this._selectionElement = el), class: "c-input-menu__selection" })));
2029
+ return (h("div", { class: "c-input-menu__input" }, 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() }), h("div", { ref: (el) => (this._selectionElement = el), class: "c-input-menu__selection" })));
2026
2030
  }
2027
2031
  _renderReset() {
2028
- return (h("c-icon-button", { "aria-label": "", size: "x-small", text: true, onClick: (event) => this._onReset(event), onKeyDown: (event) => this._onButtonKeyDown('reset', event) }, h("c-icon", { path: mdiClose, size: 20 })));
2032
+ return (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) }, h("c-icon", { path: mdiClose, size: 20 })));
2029
2033
  }
2030
2034
  render() {
2031
2035
  const itemType = this.optionElementsExist ? 'option' : 'item';
2032
- return (h(Host, null, 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" }, 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() }, h("slot", { name: "pre", slot: "pre" }), h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading &&
2036
+ return (h(Host, null, 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" }, 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() }, h("slot", { name: "pre", slot: "pre" }), h("div", { class: "c-input__content" }, this._renderInputElement(), this.loading && this._renderLoader(), !this.loading &&
2033
2037
  this.value &&
2034
2038
  this.clearable &&
2035
2039
  this._renderReset(), !this.loading &&