@ctrliq/quantic-components 1.63.2 → 1.63.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.
@@ -11,6 +11,7 @@ import { quanticElement, QuanticElement } from '../shared/quantic-element';
11
11
  import { A11yAttributesMixin } from '../shared/a11y-attributes.mixin';
12
12
  import { CodeInputSize } from './index.constants';
13
13
  import { event, prop } from '../shared/component-meta.decorators';
14
+ import { emitValueChanged } from '../shared/shared.utils';
14
15
  export { CodeInputSize } from './index.constants';
15
16
  let CodeInput = class CodeInput extends A11yAttributesMixin(QuanticElement) {
16
17
  constructor() {
@@ -43,18 +44,10 @@ let CodeInput = class CodeInput extends A11yAttributesMixin(QuanticElement) {
43
44
  this.updateValidity();
44
45
  this.lineCount = Math.max(1, this.value.split('\n').length);
45
46
  }
47
+ emitValueChanged(this, changedProperties, this.value);
46
48
  }
47
49
  handleInput(e) {
48
- const textarea = e.target;
49
- this.value = textarea.value;
50
- this.lineCount = Math.max(1, this.value.split('\n').length);
51
- this.internals.setFormValue(this.value);
52
- this.updateValidity();
53
- this.dispatchEvent(new CustomEvent('value-changed', {
54
- detail: { value: this.value },
55
- bubbles: true,
56
- composed: true,
57
- }));
50
+ this.value = e.target.value;
58
51
  }
59
52
  forwardNative(e) {
60
53
  const baseInit = {
@@ -410,7 +403,7 @@ __decorate([
410
403
  ], CodeInput.prototype, "lineCount", void 0);
411
404
  CodeInput = __decorate([
412
405
  event('value-changed', {
413
- description: "Fired whenever the textarea's value is updated (on input).",
406
+ description: 'Fired whenever the value changes, from user input or a programmatic update. Not fired on initial render.',
414
407
  detail: '{ value: string }',
415
408
  }),
416
409
  event('change', { forwarded: true }),
@@ -46,7 +46,7 @@ export declare class Combobox extends Combobox_base {
46
46
  private nextNavigableIndex;
47
47
  private openList;
48
48
  private closeList;
49
- private commitCustomValue;
49
+ private commitInputValue;
50
50
  private positionListbox;
51
51
  private selectOption;
52
52
  private handleInput;
@@ -116,8 +116,8 @@ let Combobox = class Combobox extends A11yAttributesMixin(QuanticElement) {
116
116
  this._activeIndex = -1;
117
117
  this.cleanup?.();
118
118
  this.cleanup = undefined;
119
- if (this.allowCustomValue && commit) {
120
- this.commitCustomValue();
119
+ if (commit && (this.allowCustomValue || !this._inputValue.trim())) {
120
+ this.commitInputValue();
121
121
  }
122
122
  else {
123
123
  const selected = this.options.find((o) => o.value === this.value);
@@ -125,7 +125,7 @@ let Combobox = class Combobox extends A11yAttributesMixin(QuanticElement) {
125
125
  selected?.label ?? (this.allowCustomValue ? this.value : '');
126
126
  }
127
127
  }
128
- commitCustomValue() {
128
+ commitInputValue() {
129
129
  const trimmed = this._inputValue.trim();
130
130
  this._inputValue = trimmed;
131
131
  if (trimmed === this.value)
@@ -223,10 +223,10 @@ let Combobox = class Combobox extends A11yAttributesMixin(QuanticElement) {
223
223
  this.selectOption(opt);
224
224
  }
225
225
  }
226
- else if (this.allowCustomValue && this._inputValue.trim()) {
226
+ else if (this._open &&
227
+ (this.allowCustomValue || !this._inputValue.trim())) {
227
228
  e.preventDefault();
228
229
  this.closeList(true);
229
- this.commitCustomValue();
230
230
  }
231
231
  break;
232
232
  case 'Escape':
@@ -757,7 +757,7 @@ __decorate([
757
757
  ], Combobox.prototype, "_activeIndex", void 0);
758
758
  Combobox = __decorate([
759
759
  event('value-changed', {
760
- description: 'Fired when the user selects an option from the list, or commits a custom value when allowCustomValue is enabled.',
760
+ description: 'Fired when the user selects an option from the list, clears the field, or commits a custom value when allowCustomValue is enabled.',
761
761
  detail: '{ value: string }',
762
762
  }),
763
763
  event('input-changed', {