@db-ux/ngx-core-components 4.13.1-angular-signal-forms4-d3a9db2 → 4.13.1-angular-signal-forms5-fe63b55

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.
@@ -1425,7 +1425,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
1425
1425
  const defaultProps$B = {};
1426
1426
  class DBCheckbox {
1427
1427
  hasValidState() {
1428
- return !!(this.validMessage() ?? this.validation() === "valid");
1428
+ return !!(this.validMessage() || this._valid() === 'valid' || this.validation() === "valid");
1429
1429
  }
1430
1430
  handleValidation() {
1431
1431
  // Signal Forms validation bridge: errors InputSignal has priority
@@ -1441,8 +1441,8 @@ class DBCheckbox {
1441
1441
  }
1442
1442
  return; // Signal Forms errors take priority
1443
1443
  }
1444
- else if (this.errors() !== undefined) {
1445
- // Signal Forms provided errors=[] (valid state)
1444
+ else if (Array.isArray(signalFormErrors) && signalFormErrors.length === 0 && this._valid() === 'invalid') {
1445
+ // Signal Forms provided errors=[] after previous invalid state → now valid
1446
1446
  this._valid.set('valid');
1447
1447
  this._validMessage.set(DEFAULT_VALID_MESSAGE);
1448
1448
  this._invalidMessage.set('');
@@ -1754,8 +1754,8 @@ class DBCheckbox {
1754
1754
  <label [attr.for]="_id()"
1755
1755
  ><input
1756
1756
  type="checkbox"
1757
- [attr.aria-invalid]="validation() === 'invalid'"
1758
- [attr.data-custom-validity]="validation()"
1757
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
1758
+ [attr.data-custom-validity]="_valid() ?? validation()"
1759
1759
  #_ref
1760
1760
  [attr.id]="_id()"
1761
1761
  [attr.name]="name()"
@@ -1812,8 +1812,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
1812
1812
  <label [attr.for]="_id()"
1813
1813
  ><input
1814
1814
  type="checkbox"
1815
- [attr.aria-invalid]="validation() === 'invalid'"
1816
- [attr.data-custom-validity]="validation()"
1815
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
1816
+ [attr.data-custom-validity]="_valid() ?? validation()"
1817
1817
  #_ref
1818
1818
  [attr.id]="_id()"
1819
1819
  [attr.name]="name()"
@@ -2901,7 +2901,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
2901
2901
  const defaultProps$w = {};
2902
2902
  class DBInput {
2903
2903
  hasValidState() {
2904
- return !!(this.validMessage() ?? this.validation() === "valid");
2904
+ return !!(this.validMessage() || this._valid() === 'valid' || this.validation() === "valid");
2905
2905
  }
2906
2906
  getPatternAttr() {
2907
2907
  const p = this.pattern();
@@ -2925,8 +2925,8 @@ class DBInput {
2925
2925
  }
2926
2926
  return; // Signal Forms errors take priority
2927
2927
  }
2928
- else if (this.errors() !== undefined) {
2929
- // Signal Forms provided errors=[] (valid state)
2928
+ else if (Array.isArray(signalFormErrors) && signalFormErrors.length === 0 && this._valid() === 'invalid') {
2929
+ // Signal Forms provided errors=[] after previous invalid state → now valid
2930
2930
  this._valid.set('valid');
2931
2931
  this._validMessage.set(DEFAULT_VALID_MESSAGE);
2932
2932
  this._invalidMessage.set('');
@@ -3285,8 +3285,8 @@ class DBInput {
3285
3285
  >
3286
3286
  <label [attr.for]="_id()">{{label() ?? DEFAULT_LABEL}}</label>
3287
3287
  <input
3288
- [attr.aria-invalid]="validation() === 'invalid'"
3289
- [attr.data-custom-validity]="validation()"
3288
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
3289
+ [attr.data-custom-validity]="_valid() ?? validation()"
3290
3290
  [attr.data-field-sizing]="fieldSizing()"
3291
3291
  #_ref
3292
3292
  [attr.id]="_id()"
@@ -3374,8 +3374,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
3374
3374
  >
3375
3375
  <label [attr.for]="_id()">{{label() ?? DEFAULT_LABEL}}</label>
3376
3376
  <input
3377
- [attr.aria-invalid]="validation() === 'invalid'"
3378
- [attr.data-custom-validity]="validation()"
3377
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
3378
+ [attr.data-custom-validity]="_valid() ?? validation()"
3379
3379
  [attr.data-field-sizing]="fieldSizing()"
3380
3380
  #_ref
3381
3381
  [attr.id]="_id()"
@@ -3953,7 +3953,7 @@ class DBCustomSelect {
3953
3953
  }
3954
3954
  }
3955
3955
  hasValidState() {
3956
- return !!(this.validMessage() ?? this.validation() === "valid");
3956
+ return !!(this.validMessage() || this._valid() === 'valid' || this.validation() === "valid");
3957
3957
  }
3958
3958
  handleValidation() {
3959
3959
  // Signal Forms validation bridge: errors InputSignal has priority
@@ -3967,11 +3967,13 @@ class DBCustomSelect {
3967
3967
  this._voiceOverFallback.set(this._invalidMessage());
3968
3968
  void delay(() => this._voiceOverFallback.set(""), 1000);
3969
3969
  }
3970
+ this._validity.set('invalid');
3970
3971
  return; // Signal Forms errors take priority
3971
3972
  }
3972
- else if (this.errors() !== undefined) {
3973
- // Signal Forms provided errors=[] (valid state)
3973
+ else if (Array.isArray(signalFormErrors) && signalFormErrors.length === 0 && this._valid() === 'invalid') {
3974
+ // Signal Forms provided errors=[] after previous invalid state → now valid
3974
3975
  this._valid.set('valid');
3976
+ this._validity.set('valid');
3975
3977
  this._validMessage.set(DEFAULT_VALID_MESSAGE);
3976
3978
  this._invalidMessage.set('');
3977
3979
  }
@@ -4536,20 +4538,28 @@ class DBCustomSelect {
4536
4538
  this._valid = signal(undefined, ...(ngDevMode ? [{ debugName: "_valid" }] : /* istanbul ignore next */ []));
4537
4539
  /** Signal Forms alias — maps to 'values' for FormValueControl duck-typing */
4538
4540
  this.value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
4541
+ /** @internal Flag to prevent circular sync between value↔values */
4542
+ this._syncing = false;
4539
4543
  /** @internal Sync value → values (Signal Forms writes to value) */
4540
4544
  this._syncValueToValues = effect(() => {
4541
4545
  const v = this.value();
4546
+ if (this._syncing)
4547
+ return;
4548
+ this._syncing = true;
4542
4549
  if (v !== undefined) {
4543
4550
  this.values.set(Array.isArray(v) ? v : v ? [v] : []);
4544
4551
  }
4552
+ this._syncing = false;
4545
4553
  }, ...(ngDevMode ? [{ debugName: "_syncValueToValues" }] : /* istanbul ignore next */ []));
4546
4554
  /** @internal Sync values → value (CVA/user interaction writes to values) */
4547
4555
  this._syncValuesToValue = effect(() => {
4548
4556
  const vals = this.values();
4549
- const current = vals && vals.length > 0 ? vals[0] : undefined;
4550
- if (current !== this.value()) {
4551
- this.value.set(current);
4552
- }
4557
+ if (this._syncing)
4558
+ return;
4559
+ this._syncing = true;
4560
+ const current = vals && vals.length > 0 ? vals : undefined;
4561
+ this.value.set(current);
4562
+ this._syncing = false;
4553
4563
  }, ...(ngDevMode ? [{ debugName: "_syncValuesToValue" }] : /* istanbul ignore next */ []));
4554
4564
  if (typeof window !== "undefined") {
4555
4565
  effect(() => {
@@ -7943,7 +7953,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
7943
7953
  const defaultProps$f = {};
7944
7954
  class DBSelect {
7945
7955
  hasValidState() {
7946
- return !!(this.validMessage() ?? this.validation() === "valid");
7956
+ return !!(this.validMessage() || this._valid() === 'valid' || this.validation() === "valid");
7947
7957
  }
7948
7958
  handleValidation() {
7949
7959
  // Signal Forms validation bridge: errors InputSignal has priority
@@ -7959,8 +7969,8 @@ class DBSelect {
7959
7969
  }
7960
7970
  return; // Signal Forms errors take priority
7961
7971
  }
7962
- else if (this.errors() !== undefined) {
7963
- // Signal Forms provided errors=[] (valid state)
7972
+ else if (Array.isArray(signalFormErrors) && signalFormErrors.length === 0 && this._valid() === 'invalid') {
7973
+ // Signal Forms provided errors=[] after previous invalid state → now valid
7964
7974
  this._valid.set('valid');
7965
7975
  this._validMessage.set(DEFAULT_VALID_MESSAGE);
7966
7976
  this._invalidMessage.set('');
@@ -8313,8 +8323,8 @@ class DBSelect {
8313
8323
  >
8314
8324
  <label [attr.for]="_id()">{{label() ?? DEFAULT_LABEL}}</label>
8315
8325
  <select
8316
- [attr.aria-invalid]="validation() === 'invalid'"
8317
- [attr.data-custom-validity]="validation()"
8326
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
8327
+ [attr.data-custom-validity]="_valid() ?? validation()"
8318
8328
  #_ref
8319
8329
  [required]="getBoolean(required(), 'required')"
8320
8330
  [disabled]="getBoolean(disabled(), 'disabled')"
@@ -8417,8 +8427,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
8417
8427
  >
8418
8428
  <label [attr.for]="_id()">{{label() ?? DEFAULT_LABEL}}</label>
8419
8429
  <select
8420
- [attr.aria-invalid]="validation() === 'invalid'"
8421
- [attr.data-custom-validity]="validation()"
8430
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
8431
+ [attr.data-custom-validity]="_valid() ?? validation()"
8422
8432
  #_ref
8423
8433
  [required]="getBoolean(required(), 'required')"
8424
8434
  [disabled]="getBoolean(disabled(), 'disabled')"
@@ -8636,7 +8646,7 @@ const StackJustifyContentList = ['space-between', 'start', 'end', 'center'];
8636
8646
  const defaultProps$d = {};
8637
8647
  class DBSwitch {
8638
8648
  hasValidState() {
8639
- return !!(this.validMessage() ?? this.validation() === "valid");
8649
+ return !!(this.validMessage() || this._valid() === 'valid' || this.validation() === "valid");
8640
8650
  }
8641
8651
  handleValidation() {
8642
8652
  // Signal Forms validation bridge: errors InputSignal has priority
@@ -8652,8 +8662,8 @@ class DBSwitch {
8652
8662
  }
8653
8663
  return; // Signal Forms errors take priority
8654
8664
  }
8655
- else if (this.errors() !== undefined) {
8656
- // Signal Forms provided errors=[] (valid state)
8665
+ else if (Array.isArray(signalFormErrors) && signalFormErrors.length === 0 && this._valid() === 'invalid') {
8666
+ // Signal Forms provided errors=[] after previous invalid state → now valid
8657
8667
  this._valid.set('valid');
8658
8668
  this._validMessage.set(DEFAULT_VALID_MESSAGE);
8659
8669
  this._invalidMessage.set('');
@@ -8944,7 +8954,7 @@ class DBSwitch {
8944
8954
  [attr.data-hide-label]="getHideProp(showLabel())"
8945
8955
  [attr.data-variant]="variant()"
8946
8956
  [attr.data-hide-asterisk]="getHideProp(showRequiredAsterisk())"
8947
- [attr.data-custom-validity]="validation()"
8957
+ [attr.data-custom-validity]="_valid() ?? validation()"
8948
8958
  [class]="cls('db-switch', className())"
8949
8959
  >
8950
8960
  <label [attr.for]="_id()"
@@ -9009,7 +9019,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
9009
9019
  [attr.data-hide-label]="getHideProp(showLabel())"
9010
9020
  [attr.data-variant]="variant()"
9011
9021
  [attr.data-hide-asterisk]="getHideProp(showRequiredAsterisk())"
9012
- [attr.data-custom-validity]="validation()"
9022
+ [attr.data-custom-validity]="_valid() ?? validation()"
9013
9023
  [class]="cls('db-switch', className())"
9014
9024
  >
9015
9025
  <label [attr.for]="_id()"
@@ -11002,7 +11012,7 @@ const TagBehaviorList = ['static', 'removable'];
11002
11012
  const defaultProps = {};
11003
11013
  class DBTextarea {
11004
11014
  hasValidState() {
11005
- return !!(this.validMessage() ?? this.validation() === "valid");
11015
+ return !!(this.validMessage() || this._valid() === 'valid' || this.validation() === "valid");
11006
11016
  }
11007
11017
  handleValidation() {
11008
11018
  // Signal Forms validation bridge: errors InputSignal has priority
@@ -11018,8 +11028,8 @@ class DBTextarea {
11018
11028
  }
11019
11029
  return; // Signal Forms errors take priority
11020
11030
  }
11021
- else if (this.errors() !== undefined) {
11022
- // Signal Forms provided errors=[] (valid state)
11031
+ else if (Array.isArray(signalFormErrors) && signalFormErrors.length === 0 && this._valid() === 'invalid') {
11032
+ // Signal Forms provided errors=[] after previous invalid state → now valid
11023
11033
  this._valid.set('valid');
11024
11034
  this._validMessage.set(DEFAULT_VALID_MESSAGE);
11025
11035
  this._invalidMessage.set('');
@@ -11337,8 +11347,8 @@ class DBTextarea {
11337
11347
  >
11338
11348
  <label [attr.for]="_id()">{{label() ?? DEFAULT_LABEL}}</label>
11339
11349
  <textarea
11340
- [attr.aria-invalid]="validation() === 'invalid'"
11341
- [attr.data-custom-validity]="validation()"
11350
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
11351
+ [attr.data-custom-validity]="_valid() ?? validation()"
11342
11352
  [attr.data-field-sizing]="fieldSizing()"
11343
11353
  #_ref
11344
11354
  [attr.id]="_id()"
@@ -11406,8 +11416,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
11406
11416
  >
11407
11417
  <label [attr.for]="_id()">{{label() ?? DEFAULT_LABEL}}</label>
11408
11418
  <textarea
11409
- [attr.aria-invalid]="validation() === 'invalid'"
11410
- [attr.data-custom-validity]="validation()"
11419
+ [attr.aria-invalid]="(_valid() ?? validation()) === 'invalid'"
11420
+ [attr.data-custom-validity]="_valid() ?? validation()"
11411
11421
  [attr.data-field-sizing]="fieldSizing()"
11412
11422
  #_ref
11413
11423
  [attr.id]="_id()"