@spartan-ng/brain 0.0.1-alpha.685 → 0.0.1-alpha.687

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, input, Directive } from '@angular/core';
2
+ import { inject, input, booleanAttribute, computed, Directive } from '@angular/core';
3
3
  import * as i1 from '@spartan-ng/brain/field';
4
4
  import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
5
5
 
@@ -8,13 +8,15 @@ class BrnInput {
8
8
  _fieldControl = inject(BrnFieldControl, { optional: true });
9
9
  /** The id of the input. */
10
10
  id = input(`brn-input-${++BrnInput._id}`, ...(ngDevMode ? [{ debugName: "id" }] : []));
11
+ /** Whether to force the input into an invalid state. */
12
+ forceInvalid = input(false, ...(ngDevMode ? [{ debugName: "forceInvalid", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
11
13
  labelableId = this.id;
12
14
  _ariaInvalid = this._fieldControl?.invalid;
13
15
  _touched = this._fieldControl?.touched;
14
16
  _dirty = this._fieldControl?.dirty;
15
- _spartanInvalid = this._fieldControl?.spartanInvalid;
17
+ _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid(), ...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : []));
16
18
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
17
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.17", type: BrnInput, isStandalone: true, selector: "[brnInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-touched": "_touched?.() ? \"true\" : null", "attr.data-dirty": "_dirty?.() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid?.() ? \"true\" : null" } }, providers: [provideBrnLabelable(BrnInput)], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0 });
19
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.17", type: BrnInput, isStandalone: true, selector: "[brnInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-touched": "_touched?.() ? \"true\" : null", "attr.data-dirty": "_dirty?.() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid() ? \"true\" : null" } }, providers: [provideBrnLabelable(BrnInput)], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0 });
18
20
  }
19
21
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnInput, decorators: [{
20
22
  type: Directive,
@@ -28,10 +30,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
28
30
  '[attr.data-invalid]': '_ariaInvalid?.() ? "true" : null',
29
31
  '[attr.data-touched]': '_touched?.() ? "true" : null',
30
32
  '[attr.data-dirty]': '_dirty?.() ? "true" : null',
31
- '[attr.data-matches-spartan-invalid]': '_spartanInvalid?.() ? "true" : null',
33
+ '[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? "true" : null',
32
34
  },
33
35
  }]
34
- }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
36
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], forceInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "forceInvalid", required: false }] }] } });
35
37
 
36
38
  const BrnInputImports = [BrnInput];
37
39
 
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-input.mjs","sources":["../../../../libs/brain/input/src/lib/brn-input.ts","../../../../libs/brain/input/src/index.ts","../../../../libs/brain/input/src/spartan-ng-brain-input.ts"],"sourcesContent":["import { Directive, inject, input } from '@angular/core';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnInput]',\n\tproviders: [provideBrnLabelable(BrnInput)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.aria-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid?.() ? \"true\" : null',\n\t},\n})\nexport class BrnInput {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\t/** The id of the input. */\n\tpublic readonly id = input<string | undefined>(`brn-input-${++BrnInput._id}`);\n\n\tpublic readonly labelableId = this.id;\n\n\tprotected readonly _ariaInvalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = this._fieldControl?.spartanInvalid;\n}\n","import { BrnInput } from './lib/brn-input';\n\nexport * from './lib/brn-input';\n\nexport const BrnInputImports = [BrnInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAgBa,QAAQ,CAAA;AACZ,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,aAAa,GAAG,MAAM,CAAC,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AA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,mBAAmB,EAAE,4BAA4B;AACjD,wBAAA,qCAAqC,EAAE,qCAAqC;AAC5E,qBAAA;AACD,iBAAA;;;ACXM,MAAM,eAAe,GAAG,CAAC,QAAQ;;ACJxC;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-input.mjs","sources":["../../../../libs/brain/input/src/lib/brn-input.ts","../../../../libs/brain/input/src/index.ts","../../../../libs/brain/input/src/spartan-ng-brain-input.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, inject, input } from '@angular/core';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnInput]',\n\tproviders: [provideBrnLabelable(BrnInput)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.aria-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? \"true\" : null',\n\t},\n})\nexport class BrnInput {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\t/** The id of the input. */\n\tpublic readonly id = input<string | undefined>(`brn-input-${++BrnInput._id}`);\n\n\t/** Whether to force the input into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\tpublic readonly labelableId = this.id;\n\n\tprotected readonly _ariaInvalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());\n}\n","import { BrnInput } from './lib/brn-input';\n\nexport * from './lib/brn-input';\n\nexport const BrnInputImports = [BrnInput] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAiBa,QAAQ,CAAA;AACZ,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,aAAa,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAG5D,EAAE,GAAG,KAAK,CAAqB,CAAA,UAAA,EAAa,EAAE,QAAQ,CAAC,GAAG,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;AAG7D,IAAA,YAAY,GAAG,KAAK,CAAwB,KAAK,gDAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;AAEnF,IAAA,WAAW,GAAG,IAAI,CAAC,EAAE;AAElB,IAAA,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO;AAC1C,IAAA,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO;AACtC,IAAA,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK;AAClC,IAAA,eAAe,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,IAAI,IAAI,CAAC,aAAa,EAAE,cAAc,EAAE,2DAAC;2HAhBpG,QAAQ,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAR,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,QAAQ,qpBAXT,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,eAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAW9B,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAbpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,YAAY;AACtB,oBAAA,SAAS,EAAE,CAAC,mBAAmB,CAAA,QAAA,CAAU,CAAC;oBAC1C,cAAc,EAAE,CAAC,eAAe,CAAC;AACjC,oBAAA,IAAI,EAAE;AACL,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,mBAAmB,EAAE,4BAA4B;AACjD,wBAAA,qCAAqC,EAAE,mCAAmC;AAC1E,qBAAA;AACD,iBAAA;;;ACZM,MAAM,eAAe,GAAG,CAAC,QAAQ;;ACJxC;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, input, Directive } from '@angular/core';
2
+ import { inject, input, booleanAttribute, computed, Directive } from '@angular/core';
3
3
  import * as i1 from '@spartan-ng/brain/field';
4
4
  import { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';
5
5
 
@@ -8,13 +8,15 @@ class BrnTextarea {
8
8
  _fieldControl = inject(BrnFieldControl, { optional: true });
9
9
  /** The id of the textarea. */
10
10
  id = input(`brn-textarea-${++BrnTextarea._id}`, ...(ngDevMode ? [{ debugName: "id" }] : []));
11
+ /** Whether to force the textarea into an invalid state. */
12
+ forceInvalid = input(false, ...(ngDevMode ? [{ debugName: "forceInvalid", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
11
13
  labelableId = this.id;
12
14
  _ariaInvalid = this._fieldControl?.invalid;
13
15
  _touched = this._fieldControl?.touched;
14
16
  _dirty = this._fieldControl?.dirty;
15
- _spartanInvalid = this._fieldControl?.spartanInvalid;
17
+ _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid(), ...(ngDevMode ? [{ debugName: "_spartanInvalid" }] : []));
16
18
  /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnTextarea, deps: [], target: i0.ɵɵFactoryTarget.Directive });
17
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.17", type: BrnTextarea, isStandalone: true, selector: "[brnTextarea]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-touched": "_touched?.() ? \"true\" : null", "attr.data-dirty": "_dirty?.() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid?.() ? \"true\" : null" } }, providers: [provideBrnLabelable(BrnTextarea)], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0 });
19
+ /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.17", type: BrnTextarea, isStandalone: true, selector: "[brnTextarea]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, forceInvalid: { classPropertyName: "forceInvalid", publicName: "forceInvalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id()", "attr.aria-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-invalid": "_ariaInvalid?.() ? \"true\" : null", "attr.data-touched": "_touched?.() ? \"true\" : null", "attr.data-dirty": "_dirty?.() ? \"true\" : null", "attr.data-matches-spartan-invalid": "_spartanInvalid() ? \"true\" : null" } }, providers: [provideBrnLabelable(BrnTextarea)], hostDirectives: [{ directive: i1.BrnFieldControl }], ngImport: i0 });
18
20
  }
19
21
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImport: i0, type: BrnTextarea, decorators: [{
20
22
  type: Directive,
@@ -28,10 +30,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.17", ngImpo
28
30
  '[attr.data-invalid]': '_ariaInvalid?.() ? "true" : null',
29
31
  '[attr.data-touched]': '_touched?.() ? "true" : null',
30
32
  '[attr.data-dirty]': '_dirty?.() ? "true" : null',
31
- '[attr.data-matches-spartan-invalid]': '_spartanInvalid?.() ? "true" : null',
33
+ '[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? "true" : null',
32
34
  },
33
35
  }]
34
- }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
36
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], forceInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "forceInvalid", required: false }] }] } });
35
37
 
36
38
  const BrnTextareaImports = [BrnTextarea];
37
39
 
@@ -1 +1 @@
1
- {"version":3,"file":"spartan-ng-brain-textarea.mjs","sources":["../../../../libs/brain/textarea/src/lib/brn-textarea.ts","../../../../libs/brain/textarea/src/index.ts","../../../../libs/brain/textarea/src/spartan-ng-brain-textarea.ts"],"sourcesContent":["import { Directive, inject, input } from '@angular/core';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnTextarea]',\n\tproviders: [provideBrnLabelable(BrnTextarea)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.aria-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid?.() ? \"true\" : null',\n\t},\n})\nexport class BrnTextarea {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\t/** The id of the textarea. */\n\tpublic readonly id = input<string | undefined>(`brn-textarea-${++BrnTextarea._id}`);\n\n\tpublic readonly labelableId = this.id;\n\n\tprotected readonly _ariaInvalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = this._fieldControl?.spartanInvalid;\n}\n","import { BrnTextarea } from './lib/brn-textarea';\n\nexport * from './lib/brn-textarea';\n\nexport const BrnTextareaImports = [BrnTextarea] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAgBa,WAAW,CAAA;AACf,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,aAAa,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAG5D,EAAE,GAAG,KAAK,CAAqB,CAAA,aAAA,EAAgB,EAAE,WAAW,CAAC,GAAG,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;AAEnE,IAAA,WAAW,GAAG,IAAI,CAAC,EAAE;AAElB,IAAA,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO;AAC1C,IAAA,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO;AACtC,IAAA,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK;AAClC,IAAA,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc;2HAb3D,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAX,uBAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,WAAW,6gBAXZ,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,eAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAWjC,WAAW,EAAA,UAAA,EAAA,CAAA;kBAbvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,SAAS,EAAE,CAAC,mBAAmB,CAAA,WAAA,CAAa,CAAC;oBAC7C,cAAc,EAAE,CAAC,eAAe,CAAC;AACjC,oBAAA,IAAI,EAAE;AACL,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,kCAAkC;AACzD,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,mBAAmB,EAAE,4BAA4B;AACjD,wBAAA,qCAAqC,EAAE,qCAAqC;AAC5E,qBAAA;AACD,iBAAA;;;ACXM,MAAM,kBAAkB,GAAG,CAAC,WAAW;;ACJ9C;;AAEG;;;;"}
1
+ {"version":3,"file":"spartan-ng-brain-textarea.mjs","sources":["../../../../libs/brain/textarea/src/lib/brn-textarea.ts","../../../../libs/brain/textarea/src/index.ts","../../../../libs/brain/textarea/src/spartan-ng-brain-textarea.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, inject, input } from '@angular/core';\nimport { BrnFieldControl, provideBrnLabelable } from '@spartan-ng/brain/field';\n\n@Directive({\n\tselector: '[brnTextarea]',\n\tproviders: [provideBrnLabelable(BrnTextarea)],\n\thostDirectives: [BrnFieldControl],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.aria-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-invalid]': '_ariaInvalid?.() ? \"true\" : null',\n\t\t'[attr.data-touched]': '_touched?.() ? \"true\" : null',\n\t\t'[attr.data-dirty]': '_dirty?.() ? \"true\" : null',\n\t\t'[attr.data-matches-spartan-invalid]': '_spartanInvalid() ? \"true\" : null',\n\t},\n})\nexport class BrnTextarea {\n\tprivate static _id = 0;\n\n\tprivate readonly _fieldControl = inject(BrnFieldControl, { optional: true });\n\n\t/** The id of the textarea. */\n\tpublic readonly id = input<string | undefined>(`brn-textarea-${++BrnTextarea._id}`);\n\n\t/** Whether to force the textarea into an invalid state. */\n\tpublic readonly forceInvalid = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n\tpublic readonly labelableId = this.id;\n\n\tprotected readonly _ariaInvalid = this._fieldControl?.invalid;\n\tprotected readonly _touched = this._fieldControl?.touched;\n\tprotected readonly _dirty = this._fieldControl?.dirty;\n\tprotected readonly _spartanInvalid = computed(() => this.forceInvalid() || this._fieldControl?.spartanInvalid());\n}\n","import { BrnTextarea } from './lib/brn-textarea';\n\nexport * from './lib/brn-textarea';\n\nexport const BrnTextareaImports = [BrnTextarea] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAiBa,WAAW,CAAA;AACf,IAAA,OAAO,GAAG,GAAG,CAAC;IAEL,aAAa,GAAG,MAAM,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;IAG5D,EAAE,GAAG,KAAK,CAAqB,CAAA,aAAA,EAAgB,EAAE,WAAW,CAAC,GAAG,CAAA,CAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;AAGnE,IAAA,YAAY,GAAG,KAAK,CAAwB,KAAK,gDAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;AAEnF,IAAA,WAAW,GAAG,IAAI,CAAC,EAAE;AAElB,IAAA,YAAY,G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1
  import * as _angular_core from '@angular/core';
2
+ import { BooleanInput } from '@angular/cdk/coercion';
2
3
  import * as i1 from '@spartan-ng/brain/field';
3
4
 
4
5
  declare class BrnInput {
@@ -6,13 +7,15 @@ declare class BrnInput {
6
7
  private readonly _fieldControl;
7
8
  /** The id of the input. */
8
9
  readonly id: _angular_core.InputSignal<string | undefined>;
10
+ /** Whether to force the input into an invalid state. */
11
+ readonly forceInvalid: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
9
12
  readonly labelableId: _angular_core.InputSignal<string | undefined>;
10
13
  protected readonly _ariaInvalid: _angular_core.Signal<boolean | null> | undefined;
11
14
  protected readonly _touched: _angular_core.Signal<boolean | null> | undefined;
12
15
  protected readonly _dirty: _angular_core.Signal<boolean | null> | undefined;
13
- protected readonly _spartanInvalid: _angular_core.Signal<boolean | null> | undefined;
16
+ protected readonly _spartanInvalid: _angular_core.Signal<boolean | null | undefined>;
14
17
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnInput, never>;
15
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnInput, "[brnInput]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnFieldControl; inputs: {}; outputs: {}; }]>;
18
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnInput, "[brnInput]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "forceInvalid": { "alias": "forceInvalid"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnFieldControl; inputs: {}; outputs: {}; }]>;
16
19
  }
17
20
 
18
21
  declare const BrnInputImports: readonly [typeof BrnInput];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spartan-ng/brain",
3
- "version": "0.0.1-alpha.685",
3
+ "version": "0.0.1-alpha.687",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/spartan-ng/spartan"
@@ -1,4 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
+ import { BooleanInput } from '@angular/cdk/coercion';
2
3
  import * as i1 from '@spartan-ng/brain/field';
3
4
 
4
5
  declare class BrnTextarea {
@@ -6,13 +7,15 @@ declare class BrnTextarea {
6
7
  private readonly _fieldControl;
7
8
  /** The id of the textarea. */
8
9
  readonly id: _angular_core.InputSignal<string | undefined>;
10
+ /** Whether to force the textarea into an invalid state. */
11
+ readonly forceInvalid: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
9
12
  readonly labelableId: _angular_core.InputSignal<string | undefined>;
10
13
  protected readonly _ariaInvalid: _angular_core.Signal<boolean | null> | undefined;
11
14
  protected readonly _touched: _angular_core.Signal<boolean | null> | undefined;
12
15
  protected readonly _dirty: _angular_core.Signal<boolean | null> | undefined;
13
- protected readonly _spartanInvalid: _angular_core.Signal<boolean | null> | undefined;
16
+ protected readonly _spartanInvalid: _angular_core.Signal<boolean | null | undefined>;
14
17
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<BrnTextarea, never>;
15
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnTextarea, "[brnTextarea]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnFieldControl; inputs: {}; outputs: {}; }]>;
18
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<BrnTextarea, "[brnTextarea]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "forceInvalid": { "alias": "forceInvalid"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.BrnFieldControl; inputs: {}; outputs: {}; }]>;
16
19
  }
17
20
 
18
21
  declare const BrnTextareaImports: readonly [typeof BrnTextarea];