@haiilo/catalyst 13.2.0 → 13.3.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.
@@ -7982,6 +7982,7 @@ const CatInput = class {
7982
7982
  this.catChange = index.createEvent(this, "catChange");
7983
7983
  this.catFocus = index.createEvent(this, "catFocus");
7984
7984
  this.catBlur = index.createEvent(this, "catBlur");
7985
+ this.catChangeFiles = index.createEvent(this, "catChangeFiles");
7985
7986
  if (hostRef.$hostElement$["s-ei"]) {
7986
7987
  this.internals = hostRef.$hostElement$["s-ei"];
7987
7988
  }
@@ -8088,6 +8089,9 @@ const CatInput = class {
8088
8089
  async clear() {
8089
8090
  this.value = '';
8090
8091
  this.catChange.emit(this.value);
8092
+ if (this.type === 'file') {
8093
+ this.catChangeFiles.emit(null);
8094
+ }
8091
8095
  }
8092
8096
  onErrorsChanged(newValue, _oldValue, update = true) {
8093
8097
  if (!coerceBoolean(this.errorUpdate)) {
@@ -8104,24 +8108,24 @@ const CatInput = class {
8104
8108
  }
8105
8109
  render() {
8106
8110
  this.hostElement.tabIndex = Number(this.hostElement.getAttribute('tabindex')) || 0;
8107
- return (index.h("div", { key: '50c440a0998694c006b5a6cad4125bc395a159f1', class: {
8111
+ return (index.h("div", { key: 'ffc4412a1f7c10431da8c4b6380fd8218298ac5a', class: {
8108
8112
  'input-field': true,
8109
8113
  'input-horizontal': this.horizontal ?? this.fallbackHorizontal ?? false
8110
- } }, index.h("div", { key: 'daa77827a09a7a06a5984498ad5537c1e7b07605', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: 'a39c7bd5557d03d0cb92713229da76fcf9c2e4f4', htmlFor: this.id, part: "label" }, index.h("span", { key: 'bddb726ce5a13891f316cd6961f2313103ffaa06', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: '9d9b6db604192d7da651e84c786eaab140faa951', name: "label" })) || this.label, index.h("div", { key: 'f59ccad528690950b12a582df7bc3580e40f3a84', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: 'f8d8b6ddd9a3056986bfc9bc2cbc3196c3241891', class: "label-optional", "aria-hidden": "true" }, "(", index$1.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: '93034a970baf7e474934ba6b5327550678abd096', class: "label-optional", "aria-hidden": "true" }, "(", index$1.catI18nRegistry.t('input.required'), ")")), (this.maxLength || this.hasSlottedCounter) && (index.h("div", { key: '458caee7098e89168d779b776030e24be1c8fce0', class: "label-character-count", "aria-hidden": "true" }, this.hasSlottedCounter ? (index.h("slot", { name: "counter" })) : (`${this.value?.length ?? 0}/${this.maxLength}`)))))))), index.h("div", { key: 'c8583c36bf7cef298d1d0f50c942f43dbc8d9cab', class: { 'input-color': this.type === 'color', 'input-container': true } }, index.h("div", { key: '937aacc0c048c44ca710f3b14e71b436ac3d0039', class: "input-outer-wrapper" }, index.h("div", { key: '02d657ad1dad507dfcd63863a12da02c46ceeb20', class: {
8114
+ } }, index.h("div", { key: '212806d23ea27c6bcfd8850ee3da759014ca78ad', class: { 'label-container': true, hidden: this.labelHidden } }, (this.hasSlottedLabel || this.label) && (index.h("label", { key: '78072a1cba66307777885eb284c8e1bdd58e16a1', htmlFor: this.id, part: "label" }, index.h("span", { key: '8418283fde42db3445d5ca9b10559684c8bcd7d7', class: "label-wrapper" }, (this.hasSlottedLabel && index.h("slot", { key: '6676d6381311ed2d171cb807598de2c408d017bf', name: "label" })) || this.label, index.h("div", { key: '5ae2d177c55c34663304c8d844e232fda8378067', class: "label-metadata" }, !this.required && (this.requiredMarker ?? 'optional').startsWith('optional') && (index.h("span", { key: '21f4e5a75faa4753f75a5a08de6cad4fdcf685fd', class: "label-optional", "aria-hidden": "true" }, "(", index$1.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker?.startsWith('required') && (index.h("span", { key: 'ea4c178c57d407e09bb8b10f14016c4987db4874', class: "label-optional", "aria-hidden": "true" }, "(", index$1.catI18nRegistry.t('input.required'), ")")), (this.maxLength || this.hasSlottedCounter) && (index.h("div", { key: '43e04d882ca31ad03a66fbc148594cbcdb9ee313', class: "label-character-count", "aria-hidden": "true" }, this.hasSlottedCounter ? (index.h("slot", { name: "counter" })) : (`${this.value?.length ?? 0}/${this.maxLength}`)))))))), index.h("div", { key: '06b53fdb4df82aeb736ae19d73b2a11d1c4e9af0', class: { 'input-color': this.type === 'color', 'input-container': true } }, index.h("div", { key: 'edb77ce73acff3cbcc0f4228a3c9ac95dbaca2d8', class: "input-outer-wrapper" }, index.h("div", { key: 'b39ccf857a38b31e2f15885f11c6d5f75f335aa3', class: {
8111
8115
  'input-wrapper': true,
8112
8116
  'input-round': this.round,
8113
8117
  'input-readonly': this.readonly,
8114
8118
  'input-disabled': this.disabled,
8115
8119
  'input-invalid': this.invalid
8116
- }, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { key: 'fa5b35337dda6e3132f392133a914ae43e70c94e', class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && (index.h("cat-icon", { key: '4d06684dc073e4dcc2b1703fa56e7e386901a632', icon: this.icon, class: "icon-prefix", size: "l", onClick: () => this.doFocus() })), index.h("div", { key: 'e839a75201951e435a88fd6b740d1143d912c13b', class: {
8120
+ }, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { key: 'f075bb5d4a81c2ccf35d7c50fd3ec65a6b9ab37e', class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && (index.h("cat-icon", { key: '12013d6b78cd440b99982c12aef4af31dcd91246', icon: this.icon, class: "icon-prefix", size: "l", onClick: () => this.doFocus() })), index.h("div", { key: '6d339cfe079f7926b4263b161ff08f4c6b9a4a43', class: {
8117
8121
  'has-clearable': this.clearable && !this.disabled && !this.readonly && !!this.value,
8118
8122
  'has-toggle-password': this.togglePassword && !this.disabled && !this.readonly && !!this.value,
8119
8123
  'input-inner-wrapper': true,
8120
8124
  'type-color': this.type === 'color'
8121
- } }, this.type === 'color' && index.h("span", { key: '1ba9f12990e0ec1ac114186d9784dbcc9dd57644', class: "color-value" }, this.value ?? '#000000'), index.h("input", { key: '6e089b3f68e7deb4912f16dd68a49f31821d0bfc', "data-test": this.testId, ...this.nativeAttributes, part: "input", ref: el => (this.input = el), id: this.id, class: {
8125
+ } }, this.type === 'color' && index.h("span", { key: 'cf422632d44d234e7a9aef52572665a9a28ecc9d', class: "color-value" }, this.value ?? '#000000'), index.h("input", { key: 'ebc4a025956a028f1f73958486fa7e37dcd585a3', "data-test": this.testId, ...this.nativeAttributes, part: "input", ref: el => (this.input = el), id: this.id, class: {
8122
8126
  'has-clearable': this.clearable && !this.disabled && !this.readonly && !!this.value,
8123
8127
  'has-toggle-password': this.togglePassword && !this.disabled && !this.readonly && !!this.value
8124
- }, autocomplete: this.autoComplete, disabled: this.disabled, accept: this.type === 'file' ? this.accept : undefined, multiple: this.type === 'file' ? this.multiple : undefined, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.isPasswordShown ? 'text' : this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined }), this.clearable && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: '5462cce12644d0ba36763e3a477c5953283fb884', class: "clearable", icon: "$cat:input-close", "icon-only": "true", size: "s", variant: "text", "a11y-label": index$1.catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this), "data-dropdown-no-close": true })), this.togglePassword && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: 'd45bc4743ba06802ddf4cfbbd413cad94611bcae', class: "toggle-password", icon: this.isPasswordShown ? '$cat:input-password-hide' : '$cat:input-password-show', "icon-only": "true", size: "s", variant: "text", "a11y-label": index$1.catI18nRegistry.t(this.isPasswordShown ? 'input.hidePassword' : 'input.showPassword'), onClick: this.doTogglePassword.bind(this) }))), this.loading && index.h("cat-spinner", { key: '63ab5d0a0dd36ef44ec8952dbeb09e336af3f231', size: "m", class: "icon-loading" }), !this.invalid && this.icon && this.iconRight && (index.h("cat-icon", { key: '977d45f4d87510f41642566856fabc36db0727b9', icon: this.icon, class: "icon-suffix", size: "l", onClick: () => this.doFocus() })), this.invalid && (index.h("cat-icon", { key: '4a71c080f96ab75de98624d553f159ec19155880', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), this.textSuffix && (index.h("span", { key: 'cdf4a92c9de5e483b914e7a1f33fab72db57ab0d', class: "text-suffix", part: "suffix" }, this.textSuffix))), index.h("slot", { key: 'c8e42694679b3d1f0fecbfcaba6fccc9ef18eff0', name: "addon" })), this.hasHint && (index.h(CatFormHint, { key: 'a5690f41eec951c3d88db93bf5c8527c53756945', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))));
8128
+ }, autocomplete: this.autoComplete, disabled: this.disabled, accept: this.type === 'file' ? this.accept : undefined, multiple: this.type === 'file' ? this.multiple : undefined, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.isPasswordShown ? 'text' : this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this), "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hasHint ? this.id + '-hint' : undefined }), this.clearable && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: 'c60b67e4b261a08d91180a92618fdfc692d239bf', class: "clearable", icon: "$cat:input-close", "icon-only": "true", size: "s", variant: "text", "a11y-label": index$1.catI18nRegistry.t('input.clear'), onClick: this.clear.bind(this), "data-dropdown-no-close": true })), this.togglePassword && !this.disabled && !this.readonly && this.value && (index.h("cat-button", { key: 'db6c218c74a241f626e5c2fdc767fa8f63d33a86', class: "toggle-password", icon: this.isPasswordShown ? '$cat:input-password-hide' : '$cat:input-password-show', "icon-only": "true", size: "s", variant: "text", "a11y-label": index$1.catI18nRegistry.t(this.isPasswordShown ? 'input.hidePassword' : 'input.showPassword'), onClick: this.doTogglePassword.bind(this) }))), this.loading && index.h("cat-spinner", { key: 'b2179d6109246c579189f0911faeb95168b96016', size: "m", class: "icon-loading" }), !this.invalid && this.icon && this.iconRight && (index.h("cat-icon", { key: '52487c6ce3219d9b60f4af4f3360691bd7c34ace', icon: this.icon, class: "icon-suffix", size: "l", onClick: () => this.doFocus() })), this.invalid && (index.h("cat-icon", { key: '18a27e11f4c4501d17758af16953ee2e23a1f0b9', icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), this.textSuffix && (index.h("span", { key: '670348803c9828e4cf0587dd24de55273611f3a1', class: "text-suffix", part: "suffix" }, this.textSuffix))), index.h("slot", { key: '31969e55553baa41f18f60af3f81add74dafc6a7', name: "addon" })), this.hasHint && (index.h(CatFormHint, { key: '3a240f0af4686de4c2fc66c267e0e8c6b5f26157', id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && index.h("slot", { name: "hint" }), errorMap: this.errorMap })))));
8125
8129
  }
8126
8130
  get hasHint() {
8127
8131
  return !!this.hint || !!this.hasSlottedHint || this.invalid;
@@ -8142,6 +8146,9 @@ const CatInput = class {
8142
8146
  this.value = formattedValue;
8143
8147
  this.internals.setFormValue(this.input.value);
8144
8148
  this.catChange.emit(this.value);
8149
+ if (this.type === 'file') {
8150
+ this.catChangeFiles.emit(this.input.files);
8151
+ }
8145
8152
  this.showErrorsIfTimeout();
8146
8153
  }
8147
8154
  onFocus(event) {