@spartan-ng/brain 1.10.0-beta.4 → 1.10.0-beta.6

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 (44) hide show
  1. package/fesm2022/spartan-ng-brain-autocomplete.mjs +11 -5
  2. package/fesm2022/spartan-ng-brain-autocomplete.mjs.map +1 -1
  3. package/fesm2022/spartan-ng-brain-checkbox.mjs +2 -2
  4. package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
  5. package/fesm2022/spartan-ng-brain-combobox.mjs +18 -14
  6. package/fesm2022/spartan-ng-brain-combobox.mjs.map +1 -1
  7. package/fesm2022/spartan-ng-brain-core.mjs +124 -67
  8. package/fesm2022/spartan-ng-brain-core.mjs.map +1 -1
  9. package/fesm2022/spartan-ng-brain-date-picker.mjs +14 -2
  10. package/fesm2022/spartan-ng-brain-date-picker.mjs.map +1 -1
  11. package/fesm2022/spartan-ng-brain-dialog.mjs +1 -1
  12. package/fesm2022/spartan-ng-brain-dialog.mjs.map +1 -1
  13. package/fesm2022/spartan-ng-brain-forms.mjs +26 -2
  14. package/fesm2022/spartan-ng-brain-forms.mjs.map +1 -1
  15. package/fesm2022/spartan-ng-brain-input.mjs +13 -5
  16. package/fesm2022/spartan-ng-brain-input.mjs.map +1 -1
  17. package/fesm2022/spartan-ng-brain-navigation-menu.mjs +3 -0
  18. package/fesm2022/spartan-ng-brain-navigation-menu.mjs.map +1 -1
  19. package/fesm2022/spartan-ng-brain-overlay.mjs +1 -1
  20. package/fesm2022/spartan-ng-brain-overlay.mjs.map +1 -1
  21. package/fesm2022/spartan-ng-brain-radio-group.mjs +12 -4
  22. package/fesm2022/spartan-ng-brain-radio-group.mjs.map +1 -1
  23. package/fesm2022/spartan-ng-brain-select.mjs +4 -2
  24. package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
  25. package/fesm2022/spartan-ng-brain-slider.mjs +5 -5
  26. package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
  27. package/fesm2022/spartan-ng-brain-sonner.mjs +30 -10
  28. package/fesm2022/spartan-ng-brain-sonner.mjs.map +1 -1
  29. package/fesm2022/spartan-ng-brain-switch.mjs +2 -2
  30. package/fesm2022/spartan-ng-brain-switch.mjs.map +1 -1
  31. package/fesm2022/spartan-ng-brain-textarea.mjs +13 -5
  32. package/fesm2022/spartan-ng-brain-textarea.mjs.map +1 -1
  33. package/fesm2022/spartan-ng-brain-tooltip.mjs +2 -0
  34. package/fesm2022/spartan-ng-brain-tooltip.mjs.map +1 -1
  35. package/package.json +1 -1
  36. package/types/spartan-ng-brain-autocomplete.d.ts +4 -2
  37. package/types/spartan-ng-brain-combobox.d.ts +7 -5
  38. package/types/spartan-ng-brain-date-picker.d.ts +12 -1
  39. package/types/spartan-ng-brain-forms.d.ts +3 -0
  40. package/types/spartan-ng-brain-input.d.ts +9 -2
  41. package/types/spartan-ng-brain-radio-group.d.ts +9 -2
  42. package/types/spartan-ng-brain-select.d.ts +2 -2
  43. package/types/spartan-ng-brain-slider.d.ts +1 -1
  44. package/types/spartan-ng-brain-textarea.d.ts +9 -2
@@ -362,8 +362,9 @@ class BrnComboboxChipInput {
362
362
  /** Manual override for aria-invalid. When not set, auto-detects from the parent combobox error state. */
363
363
  ariaInvalidInput = input(undefined, { ...(ngDevMode ? { debugName: "ariaInvalidInput" } : /* istanbul ignore next */ {}), transform: (v) => (v === '' || v === undefined ? undefined : booleanAttribute(v)),
364
364
  alias: 'aria-invalid' });
365
- /** Computed aria-invalid: uses manual override if provided, otherwise reads from parent error state. */
366
- _ariaInvalid = computed(() => this.ariaInvalidInput() ?? this._combobox.controlState?.()?.invalid, ...(ngDevMode ? [{ debugName: "_ariaInvalid" }] : /* istanbul ignore next */ []));
365
+ /** Computed aria-invalid: uses the manual override if provided, otherwise the error state matcher result. */
366
+ _ariaInvalid = computed(() => this.ariaInvalidInput() ?? !!this._spartanInvalid(), ...(ngDevMode ? [{ debugName: "_ariaInvalid" }] : /* istanbul ignore next */ []));
367
+ _invalid = computed(() => this._combobox.controlState?.()?.invalid, ...(ngDevMode ? [{ debugName: "_invalid" }] : /* istanbul ignore next */ []));
367
368
  _dirty = computed(() => this._combobox.controlState?.()?.dirty, ...(ngDevMode ? [{ debugName: "_dirty" }] : /* istanbul ignore next */ []));
368
369
  _touched = computed(() => this._combobox.controlState?.()?.touched, ...(ngDevMode ? [{ debugName: "_touched" }] : /* istanbul ignore next */ []));
369
370
  _spartanInvalid = computed(() => this._combobox.controlState?.()?.spartanInvalid, ...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : /* istanbul ignore next */ []));
@@ -408,7 +409,8 @@ class BrnComboboxChipInput {
408
409
  if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
409
410
  this._combobox.open();
410
411
  }
411
- if (event.key === 'Escape') {
412
+ if (event.key === 'Escape' && this._combobox.hasValue()) {
413
+ event.preventDefault();
412
414
  this._combobox.resetValue();
413
415
  }
414
416
  }
@@ -418,7 +420,7 @@ class BrnComboboxChipInput {
418
420
  this._combobox.keyManager.onKeydown(event);
419
421
  }
420
422
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnComboboxChipInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
421
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnComboboxChipInput, isStandalone: true, selector: "input[brnComboboxChipInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalidInput: { classPropertyName: "ariaInvalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "text", "role": "combobox", "autocomplete": "off", "autocorrect": "off", "autocapitalize": "none", "spellcheck": "false", "aria-autocomplete": "list", "aria-haspopup": "listbox" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput($event)" }, properties: { "id": "id()", "attr.aria-expanded": "_isExpanded()", "attr.aria-controls": "_isExpanded() ? _comboboxListId() : null", "attr.aria-activedescendant": "_isExpanded() ? _activeDescendant() : null", "attr.aria-invalid": "_ariaInvalid() ? \"true\" : null", "attr.data-invalid": "_ariaInvalid() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid() ? \"true\" : null", "attr.data-dirty": "_touched() ? \"true\" : null", "attr.data-touched": "_touched() ? \"true\" : null", "attr.disabled": "_disabled() ? \"\" : null", "attr.data-disabled": "_disabled() ? \"\" : null" } }, exportAs: ["brnComboboxChipInput"], ngImport: i0 });
423
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnComboboxChipInput, isStandalone: true, selector: "input[brnComboboxChipInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalidInput: { classPropertyName: "ariaInvalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "text", "role": "combobox", "autocomplete": "off", "autocorrect": "off", "autocapitalize": "none", "spellcheck": "false", "aria-autocomplete": "list", "aria-haspopup": "listbox" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput($event)" }, properties: { "id": "id()", "attr.aria-expanded": "_isExpanded()", "attr.aria-controls": "_isExpanded() ? _comboboxListId() : null", "attr.aria-activedescendant": "_isExpanded() ? _activeDescendant() : null", "attr.aria-invalid": "_ariaInvalid() ? \"true\" : null", "attr.data-invalid": "_invalid() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid() ? \"true\" : null", "attr.data-dirty": "_touched() ? \"true\" : null", "attr.data-touched": "_touched() ? \"true\" : null", "attr.disabled": "_disabled() ? \"\" : null", "attr.data-disabled": "_disabled() ? \"\" : null" } }, exportAs: ["brnComboboxChipInput"], ngImport: i0 });
422
424
  }
423
425
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnComboboxChipInput, decorators: [{
424
426
  type: Directive,
@@ -439,7 +441,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
439
441
  '[attr.aria-controls]': '_isExpanded() ? _comboboxListId() : null',
440
442
  '[attr.aria-activedescendant]': '_isExpanded() ? _activeDescendant() : null',
441
443
  '[attr.aria-invalid]': '_ariaInvalid() ? "true" : null',
442
- '[attr.data-invalid]': '_ariaInvalid() ? "true" : null',
444
+ '[attr.data-invalid]': '_invalid() ? "true" : null',
443
445
  '[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? "true" : null',
444
446
  '[attr.data-dirty]': '_touched() ? "true" : null',
445
447
  '[attr.data-touched]': '_touched() ? "true" : null',
@@ -615,8 +617,9 @@ class BrnComboboxInput {
615
617
  /** Whether the combobox panel is expanded */
616
618
  _isExpanded = this._combobox.isExpanded;
617
619
  _activeDescendant = signal(undefined, ...(ngDevMode ? [{ debugName: "_activeDescendant" }] : /* istanbul ignore next */ []));
618
- /** Computed aria-invalid: uses manual override if provided, otherwise reads from parent error state. */
619
- _ariaInvalid = computed(() => this.ariaInvalidInput() ?? this._combobox.controlState?.()?.invalid, ...(ngDevMode ? [{ debugName: "_ariaInvalid" }] : /* istanbul ignore next */ []));
620
+ /** Computed aria-invalid: uses the manual override if provided, otherwise the error state matcher result. */
621
+ _ariaInvalid = computed(() => this.ariaInvalidInput() ?? !!this._spartanInvalid(), ...(ngDevMode ? [{ debugName: "_ariaInvalid" }] : /* istanbul ignore next */ []));
622
+ _invalid = computed(() => this._combobox.controlState?.()?.invalid, ...(ngDevMode ? [{ debugName: "_invalid" }] : /* istanbul ignore next */ []));
620
623
  _dirty = computed(() => this._combobox.controlState?.()?.dirty, ...(ngDevMode ? [{ debugName: "_dirty" }] : /* istanbul ignore next */ []));
621
624
  _touched = computed(() => this._combobox.controlState?.()?.touched, ...(ngDevMode ? [{ debugName: "_touched" }] : /* istanbul ignore next */ []));
622
625
  _spartanInvalid = computed(() => this.forceInvalid() || this._combobox.controlState?.()?.spartanInvalid, ...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : /* istanbul ignore next */ []));
@@ -679,14 +682,15 @@ class BrnComboboxInput {
679
682
  if (event.key === 'Enter' || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
680
683
  this._combobox.open();
681
684
  }
682
- if (event.key === 'Escape') {
685
+ if (event.key === 'Escape' && this._combobox.hasValue()) {
686
+ event.preventDefault();
683
687
  this._combobox.resetValue();
684
688
  }
685
689
  }
686
690
  this._combobox.keyManager.onKeydown(event);
687
691
  }
688
692
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnComboboxInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
689
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnComboboxInput, isStandalone: true, selector: "input[brnComboboxInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalidInput: { classPropertyName: "ariaInvalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "text", "role": "combobox", "autocomplete": "off", "autocorrect": "off", "autocapitalize": "none", "spellcheck": "false", "aria-autocomplete": "list", "aria-haspopup": "listbox" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput($event)" }, properties: { "id": "id()", "attr.aria-expanded": "_isExpanded()", "attr.aria-controls": "_isExpanded() ? _comboboxListId() : null", "attr.aria-activedescendant": "_isExpanded() ? _activeDescendant() : null", "attr.aria-invalid": "_isCombobox() && _ariaInvalid() ? \"true\": null", "attr.data-invalid": "_isCombobox() && _ariaInvalid() ? \"true\": null", "attr.data-matches-spartan-invalid": "_isCombobox() && _spartanInvalid() ? \"true\": null", "attr.data-touched": "_isCombobox() && _touched() ? \"true\": null", "attr.data-dirty": "_isCombobox() && _dirty() ? \"true\": null", "attr.disabled": "disabled() ? \"\" : null" } }, exportAs: ["brnComboboxInput"], ngImport: i0 });
693
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnComboboxInput, isStandalone: true, selector: "input[brnComboboxInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalidInput: { classPropertyName: "ariaInvalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "text", "role": "combobox", "autocomplete": "off", "autocorrect": "off", "autocapitalize": "none", "spellcheck": "false", "aria-autocomplete": "list", "aria-haspopup": "listbox" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput($event)" }, properties: { "id": "id()", "attr.aria-expanded": "_isExpanded()", "attr.aria-controls": "_isExpanded() ? _comboboxListId() : null", "attr.aria-activedescendant": "_isExpanded() ? _activeDescendant() : null", "attr.aria-invalid": "_isCombobox() && _ariaInvalid() ? \"true\": null", "attr.data-invalid": "_isCombobox() && _invalid() ? \"true\": null", "attr.data-matches-spartan-invalid": "_isCombobox() && _spartanInvalid() ? \"true\": null", "attr.data-touched": "_isCombobox() && _touched() ? \"true\": null", "attr.data-dirty": "_isCombobox() && _dirty() ? \"true\": null", "attr.disabled": "disabled() ? \"\" : null" } }, exportAs: ["brnComboboxInput"], ngImport: i0 });
690
694
  }
691
695
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnComboboxInput, decorators: [{
692
696
  type: Directive,
@@ -707,7 +711,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
707
711
  '[attr.aria-controls]': '_isExpanded() ? _comboboxListId() : null',
708
712
  '[attr.aria-activedescendant]': '_isExpanded() ? _activeDescendant() : null',
709
713
  '[attr.aria-invalid]': '_isCombobox() && _ariaInvalid() ? "true": null',
710
- '[attr.data-invalid]': '_isCombobox() && _ariaInvalid() ? "true": null',
714
+ '[attr.data-invalid]': '_isCombobox() && _invalid() ? "true": null',
711
715
  '[attr.data-matches-spartan-invalid]': '_isCombobox() && _spartanInvalid() ? "true": null',
712
716
  '[attr.data-touched]': '_isCombobox() && _touched() ? "true": null',
713
717
  '[attr.data-dirty]': '_isCombobox() && _dirty() ? "true": null',
@@ -1151,7 +1155,7 @@ class BrnComboboxTrigger {
1151
1155
  _contentId = this._combobox.contentId;
1152
1156
  _disabled = this._combobox.disabledState;
1153
1157
  _isPlaceholder = computed(() => !this._combobox.hasValue(), ...(ngDevMode ? [{ debugName: "_isPlaceholder" }] : /* istanbul ignore next */ []));
1154
- _ariaInvalid = computed(() => this._combobox.controlState?.()?.invalid, ...(ngDevMode ? [{ debugName: "_ariaInvalid" }] : /* istanbul ignore next */ []));
1158
+ _invalid = computed(() => this._combobox.controlState?.()?.invalid, ...(ngDevMode ? [{ debugName: "_invalid" }] : /* istanbul ignore next */ []));
1155
1159
  _dirty = computed(() => this._combobox.controlState?.()?.dirty, ...(ngDevMode ? [{ debugName: "_dirty" }] : /* istanbul ignore next */ []));
1156
1160
  _touched = computed(() => this._combobox.controlState?.()?.touched, ...(ngDevMode ? [{ debugName: "_touched" }] : /* istanbul ignore next */ []));
1157
1161
  _spartanInvalid = computed(() => this.forceInvalid() || this._combobox.controlState?.()?.spartanInvalid, ...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : /* istanbul ignore next */ []));
@@ -1169,7 +1173,7 @@ class BrnComboboxTrigger {
1169
1173
  }
1170
1174
  }
1171
1175
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnComboboxTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1172
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnComboboxTrigger, isStandalone: true, selector: "button[brnComboboxTrigger]", inputs: { forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button", "role": "combobox", "aria-haspopup": "dialog" }, listeners: { "keydown": "onKeyDown($event)" }, properties: { "attr.aria-controls": "_isExpanded() ? _contentId() : null", "attr.aria-expanded": "_isExpanded()", "attr.aria-disabled": "_disabled() || null", "attr.disabled": "_disabled() ? \"\" : null", "attr.data-disabled": "_disabled() || null", "attr.data-placeholder": "_isPlaceholder() ? \"\" : null", "attr.aria-invalid": " _ariaInvalid() ? \"true\": null", "attr.data-invalid": " _ariaInvalid() ? \"true\": null", "attr.data-matches-spartan-invalid": " _spartanInvalid() ? \"true\": null", "attr.data-touched": " _touched() ? \"true\": null", "attr.data-dirty": " _dirty() ? \"true\": null" } }, exportAs: ["brnComboboxTrigger"], ngImport: i0 });
1176
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.16", type: BrnComboboxTrigger, isStandalone: true, selector: "button[brnComboboxTrigger]", inputs: { forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button", "role": "combobox", "aria-haspopup": "dialog" }, listeners: { "keydown": "onKeyDown($event)" }, properties: { "attr.aria-controls": "_isExpanded() ? _contentId() : null", "attr.aria-expanded": "_isExpanded()", "attr.aria-disabled": "_disabled() || null", "attr.disabled": "_disabled() ? \"\" : null", "attr.data-disabled": "_disabled() || null", "attr.data-placeholder": "_isPlaceholder() ? \"\" : null", "attr.aria-invalid": " _spartanInvalid() ? \"true\": null", "attr.data-invalid": " _invalid() ? \"true\": null", "attr.data-matches-spartan-invalid": " _spartanInvalid() ? \"true\": null", "attr.data-touched": " _touched() ? \"true\": null", "attr.data-dirty": " _dirty() ? \"true\": null" } }, exportAs: ["brnComboboxTrigger"], ngImport: i0 });
1173
1177
  }
1174
1178
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImport: i0, type: BrnComboboxTrigger, decorators: [{
1175
1179
  type: Directive,
@@ -1186,8 +1190,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
1186
1190
  '[attr.disabled]': '_disabled() ? "" : null',
1187
1191
  '[attr.data-disabled]': '_disabled() || null',
1188
1192
  '[attr.data-placeholder]': '_isPlaceholder() ? "" : null',
1189
- '[attr.aria-invalid]': ' _ariaInvalid() ? "true": null',
1190
- '[attr.data-invalid]': ' _ariaInvalid() ? "true": null',
1193
+ '[attr.aria-invalid]': ' _spartanInvalid() ? "true": null',
1194
+ '[attr.data-invalid]': ' _invalid() ? "true": null',
1191
1195
  '[attr.data-matches-spartan-invalid]': ' _spartanInvalid() ? "true": null',
1192
1196
  '[attr.data-touched]': ' _touched() ? "true": null',
1193
1197
  '[attr.data-dirty]': ' _dirty() ? "true": null',