@taiga-ui/kit 4.34.0-canary.f8df2a7 → 4.35.0-canary.ab84480
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.
- package/components/textarea/index.d.ts +1 -0
- package/directives/index.d.ts +0 -1
- package/esm2022/components/files/file/file.component.mjs +7 -3
- package/esm2022/components/input-month/input-month.directive.mjs +2 -2
- package/esm2022/components/input-month/native-month-picker/native-month-picker.component.mjs +3 -3
- package/esm2022/components/input-number/input-number.directive.mjs +2 -2
- package/esm2022/components/textarea/index.mjs +2 -1
- package/esm2022/components/textarea/textarea-limit.directive.mjs +94 -0
- package/esm2022/components/textarea/textarea.component.mjs +3 -3
- package/esm2022/directives/index.mjs +1 -2
- package/fesm2022/taiga-ui-kit-components-files.mjs +6 -2
- package/fesm2022/taiga-ui-kit-components-files.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-month.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-input-month.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-number.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-number.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-textarea.mjs +91 -6
- package/fesm2022/taiga-ui-kit-components-textarea.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives.mjs +0 -1
- package/fesm2022/taiga-ui-kit-directives.mjs.map +1 -1
- package/package.json +46 -52
- package/directives/textarea-limit/index.d.ts +0 -1
- package/esm2022/directives/textarea-limit/index.mjs +0 -2
- package/esm2022/directives/textarea-limit/taiga-ui-kit-directives-textarea-limit.mjs +0 -5
- package/esm2022/directives/textarea-limit/textarea-limit.directive.mjs +0 -94
- package/fesm2022/taiga-ui-kit-directives-textarea-limit.mjs +0 -98
- package/fesm2022/taiga-ui-kit-directives-textarea-limit.mjs.map +0 -1
- /package/{directives/textarea-limit → components/textarea}/textarea-limit.directive.d.ts +0 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { NgIf } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, ViewContainerRef, ElementRef, TemplateRef, Component, ChangeDetectionStrategy, ViewChild, Input } from '@angular/core';
|
|
3
|
+
import { inject, ViewContainerRef, ElementRef, TemplateRef, Component, ChangeDetectionStrategy, ViewChild, Input, signal, Directive } from '@angular/core';
|
|
4
4
|
import { TUI_IS_MOBILE } from '@taiga-ui/cdk/tokens';
|
|
5
5
|
import { tuiInjectElement } from '@taiga-ui/cdk/utils/dom';
|
|
6
6
|
import { tuiProvide } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
7
7
|
import { TuiScrollControls } from '@taiga-ui/core/components/scrollbar';
|
|
8
8
|
import * as i1 from '@taiga-ui/core/components/textfield';
|
|
9
|
-
import { TuiTextfieldComponent, TuiWithTextfield } from '@taiga-ui/core/components/textfield';
|
|
9
|
+
import { TuiTextfieldComponent, TuiWithTextfield, TUI_TEXTFIELD_OPTIONS } from '@taiga-ui/core/components/textfield';
|
|
10
10
|
import { TUI_SCROLL_REF } from '@taiga-ui/core/tokens';
|
|
11
|
-
import { PolymorpheusOutlet } from '@taiga-ui/polymorpheus';
|
|
11
|
+
import { PolymorpheusOutlet, injectContext, PolymorpheusComponent } from '@taiga-ui/polymorpheus';
|
|
12
12
|
import { tuiCreateOptions } from '@taiga-ui/cdk/utils/di';
|
|
13
|
+
import { Validators, NG_VALIDATORS } from '@angular/forms';
|
|
13
14
|
|
|
14
15
|
const [TUI_TEXTAREA_OPTIONS, tuiTextareaOptionsProvider] = tuiCreateOptions({
|
|
15
16
|
min: 1,
|
|
@@ -37,7 +38,7 @@ class TuiTextarea {
|
|
|
37
38
|
this.text?.nativeElement.scrollTo({ top: this.el.scrollTop });
|
|
38
39
|
}
|
|
39
40
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextarea, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
40
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextarea, isStandalone: true, selector: "textarea[tuiTextarea]", inputs: { min: "min", max: "max", content: "content" }, host: { listeners: { "scroll.zoneless": "onScroll()", "scroll.once": "onScroll()" }, properties: { "class._mobile": "isMobile" } }, providers: [tuiProvide(TUI_SCROLL_REF, ElementRef)], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }, { propertyName: "text", first: true, predicate: ["text"], descendants: true }], hostDirectives: [{ directive: i1.TuiWithTextfield }], ngImport: i0, template: "<ng-template #template>\n <tui-scroll-controls\n *ngIf=\"!isMobile\"\n class=\"t-scroll\"\n />\n <span\n #text\n aria-hidden=\"true\"\n class=\"t-text\"\n [style.max-height.em]=\"1.25 * max\"\n [style.min-height.em]=\"1.25 * min\"\n >\n <ng-container *polymorpheusOutlet=\"content as text; context: {$implicit: el.value}\">{{ text }}</ng-container>\n </span>\n</ng-template>\n", styles: [":host-context(tui-textfield._with-label[data-size=\"m\"]){border-top-width:calc(.5rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield._with-label[data-size=\"l\"]){border-top-width:calc(.625rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield[data-size=\"s\"]){
|
|
41
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextarea, isStandalone: true, selector: "textarea[tuiTextarea]", inputs: { min: "min", max: "max", content: "content" }, host: { listeners: { "scroll.zoneless": "onScroll()", "scroll.once": "onScroll()" }, properties: { "class._mobile": "isMobile" } }, providers: [tuiProvide(TUI_SCROLL_REF, ElementRef)], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }, { propertyName: "text", first: true, predicate: ["text"], descendants: true }], hostDirectives: [{ directive: i1.TuiWithTextfield }], ngImport: i0, template: "<ng-template #template>\n <tui-scroll-controls\n *ngIf=\"!isMobile\"\n class=\"t-scroll\"\n />\n <span\n #text\n aria-hidden=\"true\"\n class=\"t-text\"\n [style.max-height.em]=\"1.25 * max\"\n [style.min-height.em]=\"1.25 * min\"\n >\n <ng-container *polymorpheusOutlet=\"content as text; context: {$implicit: el.value}\">{{ text }}</ng-container>\n </span>\n <span class=\"t-hack\"></span>\n</ng-template>\n", styles: [":host-context(tui-textfield._with-label[data-size=\"m\"]){border-top-width:calc(.5rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield._with-label[data-size=\"l\"]){border-top-width:calc(.625rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield[data-size=\"s\"]){padding-block-start:.5rem;padding-block-end:.25rem}:host-context(tui-textfield[data-size=\"m\"]){padding-block-start:.875rem;padding-block-end:.25rem}:host-context(tui-textfield[data-size=\"l\"]){padding-block-start:1.125rem;padding-block-end:.375rem}:host{word-break:break-word;border:0 solid transparent}:host[data-appearance=table]{border-top:1px solid transparent;border-bottom:none!important}:host:not(._mobile){scrollbar-width:none;-ms-overflow-style:none}:host:not(._mobile)::-webkit-scrollbar,:host:not(._mobile)::-webkit-scrollbar-thumb{display:none}.t-scroll{position:absolute;top:0;left:0;bottom:0;right:0;top:.25rem;bottom:.25rem;min-block-size:0}::ng-deep tui-textfield._with-label[data-size=m] .t-scroll{top:calc(.5rem + var(--t-height) / 3)}::ng-deep tui-textfield._with-label[data-size=l] .t-scroll{top:calc(.625rem + var(--t-height) / 3)}.t-text{z-index:1;order:1;inline-size:-webkit-fill-available;inline-size:-moz-available;inline-size:stretch;white-space:pre-wrap;word-break:break-word;overflow-wrap:break-word;padding-inline-start:var(--t-left);padding-inline-end:calc(var(--t-right, 0rem) + var(--t-side));pointer-events:none;box-sizing:content-box;overflow:hidden;color:transparent}.t-text:after{content:\" \"}::ng-deep tui-textfield._with-label[data-size=m] .t-text{margin-block-start:-1.375rem;padding-block-end:.3125rem}::ng-deep tui-textfield._with-label[data-size=l] .t-text{margin-block-start:-1.75rem;padding-block-end:.5rem}::ng-deep tui-textfield[data-size=s] .t-text{margin-block-start:-1.5rem;padding-block-end:.5rem}::ng-deep tui-textfield[data-size=m] .t-text{margin-block-start:-2rem;padding-block-end:.875rem}::ng-deep tui-textfield[data-size=l] .t-text{margin-block-start:-2.5rem;padding-block-end:1rem}.t-hack{transition-property:box-shadow;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:0;left:0;inline-size:100%;block-size:100%;pointer-events:none;border-radius:inherit;box-shadow:inset 0 0 0 1px transparent}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: PolymorpheusOutlet, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }, { kind: "component", type: TuiScrollControls, selector: "tui-scroll-controls" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
41
42
|
}
|
|
42
43
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextarea, decorators: [{
|
|
43
44
|
type: Component,
|
|
@@ -46,7 +47,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
46
47
|
'(scroll.zoneless)': 'onScroll()',
|
|
47
48
|
// To trigger CD for #text
|
|
48
49
|
'(scroll.once)': 'onScroll()',
|
|
49
|
-
}, template: "<ng-template #template>\n <tui-scroll-controls\n *ngIf=\"!isMobile\"\n class=\"t-scroll\"\n />\n <span\n #text\n aria-hidden=\"true\"\n class=\"t-text\"\n [style.max-height.em]=\"1.25 * max\"\n [style.min-height.em]=\"1.25 * min\"\n >\n <ng-container *polymorpheusOutlet=\"content as text; context: {$implicit: el.value}\">{{ text }}</ng-container>\n </span>\n</ng-template>\n", styles: [":host-context(tui-textfield._with-label[data-size=\"m\"]){border-top-width:calc(.5rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield._with-label[data-size=\"l\"]){border-top-width:calc(.625rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield[data-size=\"s\"]){
|
|
50
|
+
}, template: "<ng-template #template>\n <tui-scroll-controls\n *ngIf=\"!isMobile\"\n class=\"t-scroll\"\n />\n <span\n #text\n aria-hidden=\"true\"\n class=\"t-text\"\n [style.max-height.em]=\"1.25 * max\"\n [style.min-height.em]=\"1.25 * min\"\n >\n <ng-container *polymorpheusOutlet=\"content as text; context: {$implicit: el.value}\">{{ text }}</ng-container>\n </span>\n <span class=\"t-hack\"></span>\n</ng-template>\n", styles: [":host-context(tui-textfield._with-label[data-size=\"m\"]){border-top-width:calc(.5rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield._with-label[data-size=\"l\"]){border-top-width:calc(.625rem + var(--t-height) / 3);padding-block-start:0}:host-context(tui-textfield[data-size=\"s\"]){padding-block-start:.5rem;padding-block-end:.25rem}:host-context(tui-textfield[data-size=\"m\"]){padding-block-start:.875rem;padding-block-end:.25rem}:host-context(tui-textfield[data-size=\"l\"]){padding-block-start:1.125rem;padding-block-end:.375rem}:host{word-break:break-word;border:0 solid transparent}:host[data-appearance=table]{border-top:1px solid transparent;border-bottom:none!important}:host:not(._mobile){scrollbar-width:none;-ms-overflow-style:none}:host:not(._mobile)::-webkit-scrollbar,:host:not(._mobile)::-webkit-scrollbar-thumb{display:none}.t-scroll{position:absolute;top:0;left:0;bottom:0;right:0;top:.25rem;bottom:.25rem;min-block-size:0}::ng-deep tui-textfield._with-label[data-size=m] .t-scroll{top:calc(.5rem + var(--t-height) / 3)}::ng-deep tui-textfield._with-label[data-size=l] .t-scroll{top:calc(.625rem + var(--t-height) / 3)}.t-text{z-index:1;order:1;inline-size:-webkit-fill-available;inline-size:-moz-available;inline-size:stretch;white-space:pre-wrap;word-break:break-word;overflow-wrap:break-word;padding-inline-start:var(--t-left);padding-inline-end:calc(var(--t-right, 0rem) + var(--t-side));pointer-events:none;box-sizing:content-box;overflow:hidden;color:transparent}.t-text:after{content:\" \"}::ng-deep tui-textfield._with-label[data-size=m] .t-text{margin-block-start:-1.375rem;padding-block-end:.3125rem}::ng-deep tui-textfield._with-label[data-size=l] .t-text{margin-block-start:-1.75rem;padding-block-end:.5rem}::ng-deep tui-textfield[data-size=s] .t-text{margin-block-start:-1.5rem;padding-block-end:.5rem}::ng-deep tui-textfield[data-size=m] .t-text{margin-block-start:-2rem;padding-block-end:.875rem}::ng-deep tui-textfield[data-size=l] .t-text{margin-block-start:-2.5rem;padding-block-end:1rem}.t-hack{transition-property:box-shadow;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:0;left:0;inline-size:100%;block-size:100%;pointer-events:none;border-radius:inherit;box-shadow:inset 0 0 0 1px transparent}\n"] }]
|
|
50
51
|
}], propDecorators: { template: [{
|
|
51
52
|
type: ViewChild,
|
|
52
53
|
args: [TemplateRef]
|
|
@@ -61,9 +62,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
61
62
|
type: Input
|
|
62
63
|
}] } });
|
|
63
64
|
|
|
65
|
+
class TuiTextareaLimitComponent {
|
|
66
|
+
constructor() {
|
|
67
|
+
this.limit = inject(TuiTextareaLimit).limit;
|
|
68
|
+
this.context = injectContext();
|
|
69
|
+
this.background = 'linear-gradient(transparent 0.125rem, var(--tui-status-negative-pale) 0.125rem, var(--tui-status-negative-pale) calc(100% - 0.125rem), transparent calc(100% - 0.125rem))';
|
|
70
|
+
}
|
|
71
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
72
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaLimitComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
|
|
73
|
+
<span [textContent]="context.$implicit.slice(0, limit())"></span>
|
|
74
|
+
<span
|
|
75
|
+
[style.background]="background"
|
|
76
|
+
[textContent]="context.$implicit.slice(limit())"
|
|
77
|
+
></span>
|
|
78
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
79
|
+
}
|
|
80
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimitComponent, decorators: [{
|
|
81
|
+
type: Component,
|
|
82
|
+
args: [{
|
|
83
|
+
standalone: true,
|
|
84
|
+
template: `
|
|
85
|
+
<span [textContent]="context.$implicit.slice(0, limit())"></span>
|
|
86
|
+
<span
|
|
87
|
+
[style.background]="background"
|
|
88
|
+
[textContent]="context.$implicit.slice(limit())"
|
|
89
|
+
></span>
|
|
90
|
+
`,
|
|
91
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
92
|
+
}]
|
|
93
|
+
}] });
|
|
94
|
+
class TuiTextareaCounterComponent {
|
|
95
|
+
constructor() {
|
|
96
|
+
this.limit = signal(0);
|
|
97
|
+
this.length = signal(0);
|
|
98
|
+
}
|
|
99
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaCounterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
100
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaCounterComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '{{ length() }} / {{ limit() }}', isInline: true, styles: [":host{z-index:1;inline-size:100%;order:2;text-align:end;pointer-events:none;padding-bottom:.75rem;font:var(--tui-font-text-ui-xs);color:var(--tui-text-secondary)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
101
|
+
}
|
|
102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaCounterComponent, decorators: [{
|
|
103
|
+
type: Component,
|
|
104
|
+
args: [{ standalone: true, template: '{{ length() }} / {{ limit() }}', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{z-index:1;inline-size:100%;order:2;text-align:end;pointer-events:none;padding-bottom:.75rem;font:var(--tui-font-text-ui-xs);color:var(--tui-text-secondary)}\n"] }]
|
|
105
|
+
}] });
|
|
106
|
+
const COMPONENT = new PolymorpheusComponent(TuiTextareaLimitComponent);
|
|
107
|
+
class TuiTextareaLimit {
|
|
108
|
+
constructor() {
|
|
109
|
+
this.textfield = inject(TuiTextfieldComponent);
|
|
110
|
+
this.ref = inject(ViewContainerRef).createComponent(TuiTextareaCounterComponent);
|
|
111
|
+
this.size = inject(TUI_TEXTFIELD_OPTIONS).size;
|
|
112
|
+
this.limit = signal(0);
|
|
113
|
+
}
|
|
114
|
+
// TODO: Use signal inputs in v5
|
|
115
|
+
set limitSetter(limit) {
|
|
116
|
+
this.limit.set(limit);
|
|
117
|
+
}
|
|
118
|
+
ngDoCheck() {
|
|
119
|
+
this.ref.instance.length.set(this.textfield.value().length);
|
|
120
|
+
this.ref.instance.limit.set(this.limit());
|
|
121
|
+
}
|
|
122
|
+
validate(control) {
|
|
123
|
+
return Validators.maxLength(this.limit())(control);
|
|
124
|
+
}
|
|
125
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimit, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
126
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaLimit, isStandalone: true, selector: "[tuiTextarea][limit]", inputs: { limitSetter: ["limit", "limitSetter"] }, host: { properties: { "style.border-block-end-width.rem": "size() === \"l\" ? 1.875 : 1.75" } }, providers: [
|
|
127
|
+
tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),
|
|
128
|
+
tuiTextareaOptionsProvider({ content: COMPONENT }),
|
|
129
|
+
], ngImport: i0 }); }
|
|
130
|
+
}
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimit, decorators: [{
|
|
132
|
+
type: Directive,
|
|
133
|
+
args: [{
|
|
134
|
+
standalone: true,
|
|
135
|
+
selector: '[tuiTextarea][limit]',
|
|
136
|
+
providers: [
|
|
137
|
+
tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),
|
|
138
|
+
tuiTextareaOptionsProvider({ content: COMPONENT }),
|
|
139
|
+
],
|
|
140
|
+
host: {
|
|
141
|
+
'[style.border-block-end-width.rem]': 'size() === "l" ? 1.875 : 1.75',
|
|
142
|
+
},
|
|
143
|
+
}]
|
|
144
|
+
}], propDecorators: { limitSetter: [{
|
|
145
|
+
type: Input,
|
|
146
|
+
args: ['limit']
|
|
147
|
+
}] } });
|
|
148
|
+
|
|
64
149
|
/**
|
|
65
150
|
* Generated bundle index. Do not edit.
|
|
66
151
|
*/
|
|
67
152
|
|
|
68
|
-
export { TUI_TEXTAREA_OPTIONS, TuiTextarea, tuiTextareaOptionsProvider };
|
|
153
|
+
export { TUI_TEXTAREA_OPTIONS, TuiTextarea, TuiTextareaCounterComponent, TuiTextareaLimit, TuiTextareaLimitComponent, tuiTextareaOptionsProvider };
|
|
69
154
|
//# sourceMappingURL=taiga-ui-kit-components-textarea.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-textarea.mjs","sources":["../../../projects/kit/components/textarea/textarea.options.ts","../../../projects/kit/components/textarea/textarea.component.ts","../../../projects/kit/components/textarea/textarea.template.html","../../../projects/kit/components/textarea/taiga-ui-kit-components-textarea.ts"],"sourcesContent":["import type {TuiContext} from '@taiga-ui/cdk/types';\nimport {tuiCreateOptions} from '@taiga-ui/cdk/utils/di';\nimport type {PolymorpheusContent} from '@taiga-ui/polymorpheus';\n\nexport interface TuiTextareaOptions {\n min: number;\n max: number;\n content: PolymorpheusContent<TuiContext<string>>;\n}\n\nexport const [TUI_TEXTAREA_OPTIONS, tuiTextareaOptionsProvider] =\n tuiCreateOptions<TuiTextareaOptions>({\n min: 1,\n max: 3,\n content: ({$implicit}) => $implicit,\n });\n","import {NgIf} from '@angular/common';\nimport type {AfterViewInit} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n inject,\n Input,\n TemplateRef,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport {TUI_IS_MOBILE} from '@taiga-ui/cdk/tokens';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiProvide} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {TuiScrollControls} from '@taiga-ui/core/components/scrollbar';\nimport {\n TuiTextfieldComponent,\n TuiWithTextfield,\n} from '@taiga-ui/core/components/textfield';\nimport {TUI_SCROLL_REF} from '@taiga-ui/core/tokens';\nimport {PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\n\nimport type {TuiTextareaOptions} from './textarea.options';\nimport {TUI_TEXTAREA_OPTIONS} from './textarea.options';\n\n@Component({\n standalone: true,\n selector: 'textarea[tuiTextarea]',\n imports: [NgIf, PolymorpheusOutlet, TuiScrollControls],\n templateUrl: './textarea.template.html',\n styleUrls: ['./textarea.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [tuiProvide(TUI_SCROLL_REF, ElementRef)],\n hostDirectives: [TuiWithTextfield],\n host: {\n '[class._mobile]': 'isMobile',\n '(scroll.zoneless)': 'onScroll()',\n // To trigger CD for #text\n '(scroll.once)': 'onScroll()',\n },\n})\nexport class TuiTextarea implements AfterViewInit {\n @ViewChild(TemplateRef)\n private readonly template?: TemplateRef<any>;\n\n private readonly options = inject(TUI_TEXTAREA_OPTIONS);\n private readonly vcr = inject(ViewContainerRef);\n\n @ViewChild('text')\n protected readonly text?: ElementRef<HTMLElement>;\n\n protected readonly el = tuiInjectElement<HTMLTextAreaElement>();\n protected readonly textfield = inject(TuiTextfieldComponent<string>);\n protected readonly isMobile = inject(TUI_IS_MOBILE);\n\n @Input()\n public min = this.options.min;\n\n @Input()\n public max = this.options.max;\n\n @Input()\n public content: TuiTextareaOptions['content'] = this.options.content;\n\n public ngAfterViewInit(): void {\n if (this.template) {\n this.vcr.createEmbeddedView(this.template);\n }\n }\n\n protected onScroll(): void {\n this.text?.nativeElement.scrollTo({top: this.el.scrollTop});\n }\n}\n","<ng-template #template>\n <tui-scroll-controls\n *ngIf=\"!isMobile\"\n class=\"t-scroll\"\n />\n <span\n #text\n aria-hidden=\"true\"\n class=\"t-text\"\n [style.max-height.em]=\"1.25 * max\"\n [style.min-height.em]=\"1.25 * min\"\n >\n <ng-container *polymorpheusOutlet=\"content as text; context: {$implicit: el.value}\">{{ text }}</ng-container>\n </span>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAUa,CAAC,oBAAoB,EAAE,0BAA0B,CAAC,GAC3D,gBAAgB,CAAqB;AACjC,IAAA,GAAG,EAAE,CAAC;AACN,IAAA,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC,EAAC,SAAS,EAAC,KAAK,SAAS;AACtC,CAAA;;ACWL,MAgBa,WAAW,CAAA;AAhBxB,IAAA,WAAA,GAAA;AAoBqB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACvC,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAK7B,IAAE,CAAA,EAAA,GAAG,gBAAgB,EAAuB,CAAC;AAC7C,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,EAAC,qBAA6B,EAAC,CAAC;AAClD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAG7C,QAAA,IAAA,CAAA,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;AAGvB,QAAA,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CAAA,CAAA,EAAA;;4FAa5C,WAAW,EAAA,UAAA,EAAA,CAAA;kBAhBvB,SAAS;iCACM,IAAI,EAAA,QAAA,EACN,uBAAuB,EAAA,OAAA,EACxB,CAAC,IAAI,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,EAAA,eAAA,EAGrC,uBAAuB,CAAC,MAAM,EAAA,SAAA,EACpC,CAAC,UAAU,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,EACnC,cAAA,EAAA,CAAC,gBAAgB,CAAC,EAC5B,IAAA,EAAA;AACF,wBAAA,iBAAiB,EAAE,UAAU;AAC7B,wBAAA,mBAAmB,EAAE,YAAY;;AAEjC,wBAAA,eAAe,EAAE,YAAY;AAChC,qBAAA,EAAA,QAAA,EAAA,icAAA,EAAA,MAAA,EAAA,CAAA,i8DAAA,CAAA,EAAA,CAAA;8BAIgB,QAAQ,EAAA,CAAA;sBADxB,SAAS;uBAAC,WAAW,CAAA;gBAOH,IAAI,EAAA,CAAA;sBADtB,SAAS;uBAAC,MAAM,CAAA;gBAQV,GAAG,EAAA,CAAA;sBADT,KAAK;gBAIC,GAAG,EAAA,CAAA;sBADT,KAAK;gBAIC,OAAO,EAAA,CAAA;sBADb,KAAK;;;AE9DV;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-textarea.mjs","sources":["../../../projects/kit/components/textarea/textarea.options.ts","../../../projects/kit/components/textarea/textarea.component.ts","../../../projects/kit/components/textarea/textarea.template.html","../../../projects/kit/components/textarea/textarea-limit.directive.ts","../../../projects/kit/components/textarea/taiga-ui-kit-components-textarea.ts"],"sourcesContent":["import type {TuiContext} from '@taiga-ui/cdk/types';\nimport {tuiCreateOptions} from '@taiga-ui/cdk/utils/di';\nimport type {PolymorpheusContent} from '@taiga-ui/polymorpheus';\n\nexport interface TuiTextareaOptions {\n min: number;\n max: number;\n content: PolymorpheusContent<TuiContext<string>>;\n}\n\nexport const [TUI_TEXTAREA_OPTIONS, tuiTextareaOptionsProvider] =\n tuiCreateOptions<TuiTextareaOptions>({\n min: 1,\n max: 3,\n content: ({$implicit}) => $implicit,\n });\n","import {NgIf} from '@angular/common';\nimport type {AfterViewInit} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n inject,\n Input,\n TemplateRef,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport {TUI_IS_MOBILE} from '@taiga-ui/cdk/tokens';\nimport {tuiInjectElement} from '@taiga-ui/cdk/utils/dom';\nimport {tuiProvide} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {TuiScrollControls} from '@taiga-ui/core/components/scrollbar';\nimport {\n TuiTextfieldComponent,\n TuiWithTextfield,\n} from '@taiga-ui/core/components/textfield';\nimport {TUI_SCROLL_REF} from '@taiga-ui/core/tokens';\nimport {PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\n\nimport type {TuiTextareaOptions} from './textarea.options';\nimport {TUI_TEXTAREA_OPTIONS} from './textarea.options';\n\n@Component({\n standalone: true,\n selector: 'textarea[tuiTextarea]',\n imports: [NgIf, PolymorpheusOutlet, TuiScrollControls],\n templateUrl: './textarea.template.html',\n styleUrls: ['./textarea.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [tuiProvide(TUI_SCROLL_REF, ElementRef)],\n hostDirectives: [TuiWithTextfield],\n host: {\n '[class._mobile]': 'isMobile',\n '(scroll.zoneless)': 'onScroll()',\n // To trigger CD for #text\n '(scroll.once)': 'onScroll()',\n },\n})\nexport class TuiTextarea implements AfterViewInit {\n @ViewChild(TemplateRef)\n private readonly template?: TemplateRef<any>;\n\n private readonly options = inject(TUI_TEXTAREA_OPTIONS);\n private readonly vcr = inject(ViewContainerRef);\n\n @ViewChild('text')\n protected readonly text?: ElementRef<HTMLElement>;\n\n protected readonly el = tuiInjectElement<HTMLTextAreaElement>();\n protected readonly textfield = inject(TuiTextfieldComponent<string>);\n protected readonly isMobile = inject(TUI_IS_MOBILE);\n\n @Input()\n public min = this.options.min;\n\n @Input()\n public max = this.options.max;\n\n @Input()\n public content: TuiTextareaOptions['content'] = this.options.content;\n\n public ngAfterViewInit(): void {\n if (this.template) {\n this.vcr.createEmbeddedView(this.template);\n }\n }\n\n protected onScroll(): void {\n this.text?.nativeElement.scrollTo({top: this.el.scrollTop});\n }\n}\n","<ng-template #template>\n <tui-scroll-controls\n *ngIf=\"!isMobile\"\n class=\"t-scroll\"\n />\n <span\n #text\n aria-hidden=\"true\"\n class=\"t-text\"\n [style.max-height.em]=\"1.25 * max\"\n [style.min-height.em]=\"1.25 * min\"\n >\n <ng-container *polymorpheusOutlet=\"content as text; context: {$implicit: el.value}\">{{ text }}</ng-container>\n </span>\n <span class=\"t-hack\"></span>\n</ng-template>\n","import type {DoCheck} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n inject,\n Input,\n signal,\n ViewContainerRef,\n} from '@angular/core';\nimport type {AbstractControl, ValidationErrors, Validator} from '@angular/forms';\nimport {NG_VALIDATORS, Validators} from '@angular/forms';\nimport type {TuiContext} from '@taiga-ui/cdk/types';\nimport {tuiProvide} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {\n TUI_TEXTFIELD_OPTIONS,\n TuiTextfieldComponent,\n} from '@taiga-ui/core/components/textfield';\nimport {injectContext, PolymorpheusComponent} from '@taiga-ui/polymorpheus';\n\nimport {tuiTextareaOptionsProvider} from './textarea.options';\n\n@Component({\n standalone: true,\n template: `\n <span [textContent]=\"context.$implicit.slice(0, limit())\"></span>\n <span\n [style.background]=\"background\"\n [textContent]=\"context.$implicit.slice(limit())\"\n ></span>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiTextareaLimitComponent {\n protected readonly limit = inject(TuiTextareaLimit).limit;\n protected readonly context = injectContext<TuiContext<string>>();\n protected readonly background =\n 'linear-gradient(transparent 0.125rem, var(--tui-status-negative-pale) 0.125rem, var(--tui-status-negative-pale) calc(100% - 0.125rem), transparent calc(100% - 0.125rem))';\n}\n\n@Component({\n standalone: true,\n template: '{{ length() }} / {{ limit() }}',\n styleUrls: ['./textarea-limit.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiTextareaCounterComponent {\n public readonly limit = signal(0);\n public readonly length = signal(0);\n}\n\nconst COMPONENT = new PolymorpheusComponent(TuiTextareaLimitComponent);\n\n@Directive({\n standalone: true,\n selector: '[tuiTextarea][limit]',\n providers: [\n tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),\n tuiTextareaOptionsProvider({content: COMPONENT}),\n ],\n host: {\n '[style.border-block-end-width.rem]': 'size() === \"l\" ? 1.875 : 1.75',\n },\n})\nexport class TuiTextareaLimit implements Validator, DoCheck {\n private readonly textfield = inject(TuiTextfieldComponent);\n private readonly ref = inject(ViewContainerRef).createComponent(\n TuiTextareaCounterComponent,\n );\n\n public readonly size = inject(TUI_TEXTFIELD_OPTIONS).size;\n public readonly limit = signal(0);\n\n // TODO: Use signal inputs in v5\n @Input('limit')\n public set limitSetter(limit: number) {\n this.limit.set(limit);\n }\n\n public ngDoCheck(): void {\n this.ref.instance.length.set(this.textfield.value().length);\n this.ref.instance.limit.set(this.limit());\n }\n\n public validate(control: AbstractControl): ValidationErrors | null {\n return Validators.maxLength(this.limit())(control);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAUa,CAAC,oBAAoB,EAAE,0BAA0B,CAAC,GAC3D,gBAAgB,CAAqB;AACjC,IAAA,GAAG,EAAE,CAAC;AACN,IAAA,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC,EAAC,SAAS,EAAC,KAAK,SAAS;AACtC,CAAA;;ACWL,MAgBa,WAAW,CAAA;AAhBxB,IAAA,WAAA,GAAA;AAoBqB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACvC,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,g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B;;AAEG;;;;"}
|
|
@@ -14,7 +14,6 @@ export * from '@taiga-ui/kit/directives/password';
|
|
|
14
14
|
export * from '@taiga-ui/kit/directives/present';
|
|
15
15
|
export * from '@taiga-ui/kit/directives/sensitive';
|
|
16
16
|
export * from '@taiga-ui/kit/directives/skeleton';
|
|
17
|
-
export * from '@taiga-ui/kit/directives/textarea-limit';
|
|
18
17
|
export * from '@taiga-ui/kit/directives/tooltip';
|
|
19
18
|
export * from '@taiga-ui/kit/directives/unfinished-validator';
|
|
20
19
|
export * from '@taiga-ui/kit/directives/unmask-handler';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-directives.mjs","sources":["../../../projects/kit/directives/taiga-ui-kit-directives.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-directives.mjs","sources":["../../../projects/kit/directives/taiga-ui-kit-directives.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;AAEG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiga-ui/kit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.35.0-canary.ab84480",
|
|
4
4
|
"description": "Taiga UI Angular main components kit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
"esm": "./esm2022/components/taiga-ui-kit-components.mjs",
|
|
30
30
|
"default": "./fesm2022/taiga-ui-kit-components.mjs"
|
|
31
31
|
},
|
|
32
|
+
"./directives": {
|
|
33
|
+
"types": "./directives/index.d.ts",
|
|
34
|
+
"esm2022": "./esm2022/directives/taiga-ui-kit-directives.mjs",
|
|
35
|
+
"esm": "./esm2022/directives/taiga-ui-kit-directives.mjs",
|
|
36
|
+
"default": "./fesm2022/taiga-ui-kit-directives.mjs"
|
|
37
|
+
},
|
|
32
38
|
"./pipes": {
|
|
33
39
|
"types": "./pipes/index.d.ts",
|
|
34
40
|
"esm2022": "./esm2022/pipes/taiga-ui-kit-pipes.mjs",
|
|
@@ -41,12 +47,6 @@
|
|
|
41
47
|
"esm": "./esm2022/tokens/taiga-ui-kit-tokens.mjs",
|
|
42
48
|
"default": "./fesm2022/taiga-ui-kit-tokens.mjs"
|
|
43
49
|
},
|
|
44
|
-
"./directives": {
|
|
45
|
-
"types": "./directives/index.d.ts",
|
|
46
|
-
"esm2022": "./esm2022/directives/taiga-ui-kit-directives.mjs",
|
|
47
|
-
"esm": "./esm2022/directives/taiga-ui-kit-directives.mjs",
|
|
48
|
-
"default": "./fesm2022/taiga-ui-kit-directives.mjs"
|
|
49
|
-
},
|
|
50
50
|
"./utils": {
|
|
51
51
|
"types": "./utils/index.d.ts",
|
|
52
52
|
"esm2022": "./esm2022/utils/taiga-ui-kit-utils.mjs",
|
|
@@ -401,42 +401,6 @@
|
|
|
401
401
|
"esm": "./esm2022/components/tree/taiga-ui-kit-components-tree.mjs",
|
|
402
402
|
"default": "./fesm2022/taiga-ui-kit-components-tree.mjs"
|
|
403
403
|
},
|
|
404
|
-
"./pipes/emails": {
|
|
405
|
-
"types": "./pipes/emails/index.d.ts",
|
|
406
|
-
"esm2022": "./esm2022/pipes/emails/taiga-ui-kit-pipes-emails.mjs",
|
|
407
|
-
"esm": "./esm2022/pipes/emails/taiga-ui-kit-pipes-emails.mjs",
|
|
408
|
-
"default": "./fesm2022/taiga-ui-kit-pipes-emails.mjs"
|
|
409
|
-
},
|
|
410
|
-
"./pipes/field-error": {
|
|
411
|
-
"types": "./pipes/field-error/index.d.ts",
|
|
412
|
-
"esm2022": "./esm2022/pipes/field-error/taiga-ui-kit-pipes-field-error.mjs",
|
|
413
|
-
"esm": "./esm2022/pipes/field-error/taiga-ui-kit-pipes-field-error.mjs",
|
|
414
|
-
"default": "./fesm2022/taiga-ui-kit-pipes-field-error.mjs"
|
|
415
|
-
},
|
|
416
|
-
"./pipes/filter-by-input": {
|
|
417
|
-
"types": "./pipes/filter-by-input/index.d.ts",
|
|
418
|
-
"esm2022": "./esm2022/pipes/filter-by-input/taiga-ui-kit-pipes-filter-by-input.mjs",
|
|
419
|
-
"esm": "./esm2022/pipes/filter-by-input/taiga-ui-kit-pipes-filter-by-input.mjs",
|
|
420
|
-
"default": "./fesm2022/taiga-ui-kit-pipes-filter-by-input.mjs"
|
|
421
|
-
},
|
|
422
|
-
"./pipes/sort-countries": {
|
|
423
|
-
"types": "./pipes/sort-countries/index.d.ts",
|
|
424
|
-
"esm2022": "./esm2022/pipes/sort-countries/taiga-ui-kit-pipes-sort-countries.mjs",
|
|
425
|
-
"esm": "./esm2022/pipes/sort-countries/taiga-ui-kit-pipes-sort-countries.mjs",
|
|
426
|
-
"default": "./fesm2022/taiga-ui-kit-pipes-sort-countries.mjs"
|
|
427
|
-
},
|
|
428
|
-
"./pipes/stringify": {
|
|
429
|
-
"types": "./pipes/stringify/index.d.ts",
|
|
430
|
-
"esm2022": "./esm2022/pipes/stringify/taiga-ui-kit-pipes-stringify.mjs",
|
|
431
|
-
"esm": "./esm2022/pipes/stringify/taiga-ui-kit-pipes-stringify.mjs",
|
|
432
|
-
"default": "./fesm2022/taiga-ui-kit-pipes-stringify.mjs"
|
|
433
|
-
},
|
|
434
|
-
"./pipes/stringify-content": {
|
|
435
|
-
"types": "./pipes/stringify-content/index.d.ts",
|
|
436
|
-
"esm2022": "./esm2022/pipes/stringify-content/taiga-ui-kit-pipes-stringify-content.mjs",
|
|
437
|
-
"esm": "./esm2022/pipes/stringify-content/taiga-ui-kit-pipes-stringify-content.mjs",
|
|
438
|
-
"default": "./fesm2022/taiga-ui-kit-pipes-stringify-content.mjs"
|
|
439
|
-
},
|
|
440
404
|
"./directives/button-close": {
|
|
441
405
|
"types": "./directives/button-close/index.d.ts",
|
|
442
406
|
"esm2022": "./esm2022/directives/button-close/taiga-ui-kit-directives-button-close.mjs",
|
|
@@ -533,12 +497,6 @@
|
|
|
533
497
|
"esm": "./esm2022/directives/skeleton/taiga-ui-kit-directives-skeleton.mjs",
|
|
534
498
|
"default": "./fesm2022/taiga-ui-kit-directives-skeleton.mjs"
|
|
535
499
|
},
|
|
536
|
-
"./directives/textarea-limit": {
|
|
537
|
-
"types": "./directives/textarea-limit/index.d.ts",
|
|
538
|
-
"esm2022": "./esm2022/directives/textarea-limit/taiga-ui-kit-directives-textarea-limit.mjs",
|
|
539
|
-
"esm": "./esm2022/directives/textarea-limit/taiga-ui-kit-directives-textarea-limit.mjs",
|
|
540
|
-
"default": "./fesm2022/taiga-ui-kit-directives-textarea-limit.mjs"
|
|
541
|
-
},
|
|
542
500
|
"./directives/tooltip": {
|
|
543
501
|
"types": "./directives/tooltip/index.d.ts",
|
|
544
502
|
"esm2022": "./esm2022/directives/tooltip/taiga-ui-kit-directives-tooltip.mjs",
|
|
@@ -557,6 +515,42 @@
|
|
|
557
515
|
"esm": "./esm2022/directives/unmask-handler/taiga-ui-kit-directives-unmask-handler.mjs",
|
|
558
516
|
"default": "./fesm2022/taiga-ui-kit-directives-unmask-handler.mjs"
|
|
559
517
|
},
|
|
518
|
+
"./pipes/emails": {
|
|
519
|
+
"types": "./pipes/emails/index.d.ts",
|
|
520
|
+
"esm2022": "./esm2022/pipes/emails/taiga-ui-kit-pipes-emails.mjs",
|
|
521
|
+
"esm": "./esm2022/pipes/emails/taiga-ui-kit-pipes-emails.mjs",
|
|
522
|
+
"default": "./fesm2022/taiga-ui-kit-pipes-emails.mjs"
|
|
523
|
+
},
|
|
524
|
+
"./pipes/field-error": {
|
|
525
|
+
"types": "./pipes/field-error/index.d.ts",
|
|
526
|
+
"esm2022": "./esm2022/pipes/field-error/taiga-ui-kit-pipes-field-error.mjs",
|
|
527
|
+
"esm": "./esm2022/pipes/field-error/taiga-ui-kit-pipes-field-error.mjs",
|
|
528
|
+
"default": "./fesm2022/taiga-ui-kit-pipes-field-error.mjs"
|
|
529
|
+
},
|
|
530
|
+
"./pipes/filter-by-input": {
|
|
531
|
+
"types": "./pipes/filter-by-input/index.d.ts",
|
|
532
|
+
"esm2022": "./esm2022/pipes/filter-by-input/taiga-ui-kit-pipes-filter-by-input.mjs",
|
|
533
|
+
"esm": "./esm2022/pipes/filter-by-input/taiga-ui-kit-pipes-filter-by-input.mjs",
|
|
534
|
+
"default": "./fesm2022/taiga-ui-kit-pipes-filter-by-input.mjs"
|
|
535
|
+
},
|
|
536
|
+
"./pipes/sort-countries": {
|
|
537
|
+
"types": "./pipes/sort-countries/index.d.ts",
|
|
538
|
+
"esm2022": "./esm2022/pipes/sort-countries/taiga-ui-kit-pipes-sort-countries.mjs",
|
|
539
|
+
"esm": "./esm2022/pipes/sort-countries/taiga-ui-kit-pipes-sort-countries.mjs",
|
|
540
|
+
"default": "./fesm2022/taiga-ui-kit-pipes-sort-countries.mjs"
|
|
541
|
+
},
|
|
542
|
+
"./pipes/stringify": {
|
|
543
|
+
"types": "./pipes/stringify/index.d.ts",
|
|
544
|
+
"esm2022": "./esm2022/pipes/stringify/taiga-ui-kit-pipes-stringify.mjs",
|
|
545
|
+
"esm": "./esm2022/pipes/stringify/taiga-ui-kit-pipes-stringify.mjs",
|
|
546
|
+
"default": "./fesm2022/taiga-ui-kit-pipes-stringify.mjs"
|
|
547
|
+
},
|
|
548
|
+
"./pipes/stringify-content": {
|
|
549
|
+
"types": "./pipes/stringify-content/index.d.ts",
|
|
550
|
+
"esm2022": "./esm2022/pipes/stringify-content/taiga-ui-kit-pipes-stringify-content.mjs",
|
|
551
|
+
"esm": "./esm2022/pipes/stringify-content/taiga-ui-kit-pipes-stringify-content.mjs",
|
|
552
|
+
"default": "./fesm2022/taiga-ui-kit-pipes-stringify-content.mjs"
|
|
553
|
+
},
|
|
560
554
|
"./components/preview/preview-dialog": {
|
|
561
555
|
"types": "./components/preview/preview-dialog/index.d.ts",
|
|
562
556
|
"esm2022": "./esm2022/components/preview/preview-dialog/taiga-ui-kit-components-preview-preview-dialog.mjs",
|
|
@@ -583,9 +577,9 @@
|
|
|
583
577
|
"@ng-web-apis/intersection-observer": "^4.12.0",
|
|
584
578
|
"@ng-web-apis/mutation-observer": "^4.12.0",
|
|
585
579
|
"@ng-web-apis/resize-observer": "^4.12.0",
|
|
586
|
-
"@taiga-ui/cdk": "^4.
|
|
587
|
-
"@taiga-ui/core": "^4.
|
|
588
|
-
"@taiga-ui/i18n": "^4.
|
|
580
|
+
"@taiga-ui/cdk": "^4.35.0",
|
|
581
|
+
"@taiga-ui/core": "^4.35.0",
|
|
582
|
+
"@taiga-ui/i18n": "^4.35.0",
|
|
589
583
|
"@taiga-ui/polymorpheus": "^4.9.0",
|
|
590
584
|
"rxjs": ">=7.0.0"
|
|
591
585
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './textarea-limit.directive';
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export * from './textarea-limit.directive';
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9raXQvZGlyZWN0aXZlcy90ZXh0YXJlYS1saW1pdC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDRCQUE0QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi90ZXh0YXJlYS1saW1pdC5kaXJlY3RpdmUnO1xuIl19
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated bundle index. Do not edit.
|
|
3
|
-
*/
|
|
4
|
-
export * from './index';
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFpZ2EtdWkta2l0LWRpcmVjdGl2ZXMtdGV4dGFyZWEtbGltaXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9raXQvZGlyZWN0aXZlcy90ZXh0YXJlYS1saW1pdC90YWlnYS11aS1raXQtZGlyZWN0aXZlcy10ZXh0YXJlYS1saW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectionStrategy, Component, Directive, inject, Input, signal, ViewContainerRef, } from '@angular/core';
|
|
2
|
-
import { NG_VALIDATORS, Validators } from '@angular/forms';
|
|
3
|
-
import { tuiProvide } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
4
|
-
import { TUI_TEXTFIELD_OPTIONS, TuiTextfieldComponent, } from '@taiga-ui/core/components/textfield';
|
|
5
|
-
import { tuiTextareaOptionsProvider } from '@taiga-ui/kit/components/textarea';
|
|
6
|
-
import { injectContext, PolymorpheusComponent } from '@taiga-ui/polymorpheus';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
class TuiTextareaLimitComponent {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.limit = inject(TuiTextareaLimit).limit;
|
|
11
|
-
this.context = injectContext();
|
|
12
|
-
this.background = 'linear-gradient(transparent 0.125rem, var(--tui-status-negative-pale) 0.125rem, var(--tui-status-negative-pale) calc(100% - 0.125rem), transparent calc(100% - 0.125rem))';
|
|
13
|
-
}
|
|
14
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
15
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaLimitComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
|
|
16
|
-
<span [textContent]="context.$implicit.slice(0, limit())"></span>
|
|
17
|
-
<span
|
|
18
|
-
[style.background]="background"
|
|
19
|
-
[textContent]="context.$implicit.slice(limit())"
|
|
20
|
-
></span>
|
|
21
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
22
|
-
}
|
|
23
|
-
export { TuiTextareaLimitComponent };
|
|
24
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimitComponent, decorators: [{
|
|
25
|
-
type: Component,
|
|
26
|
-
args: [{
|
|
27
|
-
standalone: true,
|
|
28
|
-
template: `
|
|
29
|
-
<span [textContent]="context.$implicit.slice(0, limit())"></span>
|
|
30
|
-
<span
|
|
31
|
-
[style.background]="background"
|
|
32
|
-
[textContent]="context.$implicit.slice(limit())"
|
|
33
|
-
></span>
|
|
34
|
-
`,
|
|
35
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
36
|
-
}]
|
|
37
|
-
}] });
|
|
38
|
-
class TuiTextareaCounterComponent {
|
|
39
|
-
constructor() {
|
|
40
|
-
this.limit = signal(0);
|
|
41
|
-
this.length = signal(0);
|
|
42
|
-
}
|
|
43
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaCounterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
44
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaCounterComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '{{ length() }} / {{ limit() }}', isInline: true, styles: [":host{z-index:1;inline-size:100%;order:2;text-align:end;pointer-events:none;padding-bottom:.75rem;font:var(--tui-font-text-ui-xs);color:var(--tui-text-secondary)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
45
|
-
}
|
|
46
|
-
export { TuiTextareaCounterComponent };
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaCounterComponent, decorators: [{
|
|
48
|
-
type: Component,
|
|
49
|
-
args: [{ standalone: true, template: '{{ length() }} / {{ limit() }}', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{z-index:1;inline-size:100%;order:2;text-align:end;pointer-events:none;padding-bottom:.75rem;font:var(--tui-font-text-ui-xs);color:var(--tui-text-secondary)}\n"] }]
|
|
50
|
-
}] });
|
|
51
|
-
const COMPONENT = new PolymorpheusComponent(TuiTextareaLimitComponent);
|
|
52
|
-
class TuiTextareaLimit {
|
|
53
|
-
constructor() {
|
|
54
|
-
this.textfield = inject(TuiTextfieldComponent);
|
|
55
|
-
this.ref = inject(ViewContainerRef).createComponent(TuiTextareaCounterComponent);
|
|
56
|
-
this.size = inject(TUI_TEXTFIELD_OPTIONS).size;
|
|
57
|
-
this.limit = signal(0);
|
|
58
|
-
}
|
|
59
|
-
// TODO: Use signal inputs in v5
|
|
60
|
-
set limitSetter(limit) {
|
|
61
|
-
this.limit.set(limit);
|
|
62
|
-
}
|
|
63
|
-
ngDoCheck() {
|
|
64
|
-
this.ref.instance.length.set(this.textfield.value().length);
|
|
65
|
-
this.ref.instance.limit.set(this.limit());
|
|
66
|
-
}
|
|
67
|
-
validate(control) {
|
|
68
|
-
return Validators.maxLength(this.limit())(control);
|
|
69
|
-
}
|
|
70
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimit, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
71
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaLimit, isStandalone: true, selector: "[tuiTextarea][limit]", inputs: { limitSetter: ["limit", "limitSetter"] }, host: { properties: { "style.border-block-end-width.rem": "size() === \"l\" ? 1.875 : 1.75" } }, providers: [
|
|
72
|
-
tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),
|
|
73
|
-
tuiTextareaOptionsProvider({ content: COMPONENT }),
|
|
74
|
-
], ngImport: i0 }); }
|
|
75
|
-
}
|
|
76
|
-
export { TuiTextareaLimit };
|
|
77
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimit, decorators: [{
|
|
78
|
-
type: Directive,
|
|
79
|
-
args: [{
|
|
80
|
-
standalone: true,
|
|
81
|
-
selector: '[tuiTextarea][limit]',
|
|
82
|
-
providers: [
|
|
83
|
-
tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),
|
|
84
|
-
tuiTextareaOptionsProvider({ content: COMPONENT }),
|
|
85
|
-
],
|
|
86
|
-
host: {
|
|
87
|
-
'[style.border-block-end-width.rem]': 'size() === "l" ? 1.875 : 1.75',
|
|
88
|
-
},
|
|
89
|
-
}]
|
|
90
|
-
}], propDecorators: { limitSetter: [{
|
|
91
|
-
type: Input,
|
|
92
|
-
args: ['limit']
|
|
93
|
-
}] } });
|
|
94
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGV4dGFyZWEtbGltaXQuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMva2l0L2RpcmVjdGl2ZXMvdGV4dGFyZWEtbGltaXQvdGV4dGFyZWEtbGltaXQuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFDSCx1QkFBdUIsRUFDdkIsU0FBUyxFQUNULFNBQVMsRUFDVCxN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bHVlKCkubGVuZ3RoKTtcbiAgICAgICAgdGhpcy5yZWYuaW5zdGFuY2UubGltaXQuc2V0KHRoaXMubGltaXQoKSk7XG4gICAgfVxuXG4gICAgcHVibGljIHZhbGlkYXRlKGNvbnRyb2w6IEFic3RyYWN0Q29udHJvbCk6IFZhbGlkYXRpb25FcnJvcnMgfCBudWxsIHtcbiAgICAgICAgcmV0dXJuIFZhbGlkYXRvcnMubWF4TGVuZ3RoKHRoaXMubGltaXQoKSkoY29udHJvbCk7XG4gICAgfVxufVxuIl19
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, Component, ChangeDetectionStrategy, signal, ViewContainerRef, Directive, Input } from '@angular/core';
|
|
3
|
-
import { Validators, NG_VALIDATORS } from '@angular/forms';
|
|
4
|
-
import { tuiProvide } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
5
|
-
import { TuiTextfieldComponent, TUI_TEXTFIELD_OPTIONS } from '@taiga-ui/core/components/textfield';
|
|
6
|
-
import { tuiTextareaOptionsProvider } from '@taiga-ui/kit/components/textarea';
|
|
7
|
-
import { injectContext, PolymorpheusComponent } from '@taiga-ui/polymorpheus';
|
|
8
|
-
|
|
9
|
-
class TuiTextareaLimitComponent {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.limit = inject(TuiTextareaLimit).limit;
|
|
12
|
-
this.context = injectContext();
|
|
13
|
-
this.background = 'linear-gradient(transparent 0.125rem, var(--tui-status-negative-pale) 0.125rem, var(--tui-status-negative-pale) calc(100% - 0.125rem), transparent calc(100% - 0.125rem))';
|
|
14
|
-
}
|
|
15
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
16
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaLimitComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `
|
|
17
|
-
<span [textContent]="context.$implicit.slice(0, limit())"></span>
|
|
18
|
-
<span
|
|
19
|
-
[style.background]="background"
|
|
20
|
-
[textContent]="context.$implicit.slice(limit())"
|
|
21
|
-
></span>
|
|
22
|
-
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
23
|
-
}
|
|
24
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimitComponent, decorators: [{
|
|
25
|
-
type: Component,
|
|
26
|
-
args: [{
|
|
27
|
-
standalone: true,
|
|
28
|
-
template: `
|
|
29
|
-
<span [textContent]="context.$implicit.slice(0, limit())"></span>
|
|
30
|
-
<span
|
|
31
|
-
[style.background]="background"
|
|
32
|
-
[textContent]="context.$implicit.slice(limit())"
|
|
33
|
-
></span>
|
|
34
|
-
`,
|
|
35
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
36
|
-
}]
|
|
37
|
-
}] });
|
|
38
|
-
class TuiTextareaCounterComponent {
|
|
39
|
-
constructor() {
|
|
40
|
-
this.limit = signal(0);
|
|
41
|
-
this.length = signal(0);
|
|
42
|
-
}
|
|
43
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaCounterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
44
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaCounterComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '{{ length() }} / {{ limit() }}', isInline: true, styles: [":host{z-index:1;inline-size:100%;order:2;text-align:end;pointer-events:none;padding-bottom:.75rem;font:var(--tui-font-text-ui-xs);color:var(--tui-text-secondary)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
45
|
-
}
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaCounterComponent, decorators: [{
|
|
47
|
-
type: Component,
|
|
48
|
-
args: [{ standalone: true, template: '{{ length() }} / {{ limit() }}', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{z-index:1;inline-size:100%;order:2;text-align:end;pointer-events:none;padding-bottom:.75rem;font:var(--tui-font-text-ui-xs);color:var(--tui-text-secondary)}\n"] }]
|
|
49
|
-
}] });
|
|
50
|
-
const COMPONENT = new PolymorpheusComponent(TuiTextareaLimitComponent);
|
|
51
|
-
class TuiTextareaLimit {
|
|
52
|
-
constructor() {
|
|
53
|
-
this.textfield = inject(TuiTextfieldComponent);
|
|
54
|
-
this.ref = inject(ViewContainerRef).createComponent(TuiTextareaCounterComponent);
|
|
55
|
-
this.size = inject(TUI_TEXTFIELD_OPTIONS).size;
|
|
56
|
-
this.limit = signal(0);
|
|
57
|
-
}
|
|
58
|
-
// TODO: Use signal inputs in v5
|
|
59
|
-
set limitSetter(limit) {
|
|
60
|
-
this.limit.set(limit);
|
|
61
|
-
}
|
|
62
|
-
ngDoCheck() {
|
|
63
|
-
this.ref.instance.length.set(this.textfield.value().length);
|
|
64
|
-
this.ref.instance.limit.set(this.limit());
|
|
65
|
-
}
|
|
66
|
-
validate(control) {
|
|
67
|
-
return Validators.maxLength(this.limit())(control);
|
|
68
|
-
}
|
|
69
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimit, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
70
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: TuiTextareaLimit, isStandalone: true, selector: "[tuiTextarea][limit]", inputs: { limitSetter: ["limit", "limitSetter"] }, host: { properties: { "style.border-block-end-width.rem": "size() === \"l\" ? 1.875 : 1.75" } }, providers: [
|
|
71
|
-
tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),
|
|
72
|
-
tuiTextareaOptionsProvider({ content: COMPONENT }),
|
|
73
|
-
], ngImport: i0 }); }
|
|
74
|
-
}
|
|
75
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiTextareaLimit, decorators: [{
|
|
76
|
-
type: Directive,
|
|
77
|
-
args: [{
|
|
78
|
-
standalone: true,
|
|
79
|
-
selector: '[tuiTextarea][limit]',
|
|
80
|
-
providers: [
|
|
81
|
-
tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),
|
|
82
|
-
tuiTextareaOptionsProvider({ content: COMPONENT }),
|
|
83
|
-
],
|
|
84
|
-
host: {
|
|
85
|
-
'[style.border-block-end-width.rem]': 'size() === "l" ? 1.875 : 1.75',
|
|
86
|
-
},
|
|
87
|
-
}]
|
|
88
|
-
}], propDecorators: { limitSetter: [{
|
|
89
|
-
type: Input,
|
|
90
|
-
args: ['limit']
|
|
91
|
-
}] } });
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Generated bundle index. Do not edit.
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
export { TuiTextareaCounterComponent, TuiTextareaLimit, TuiTextareaLimitComponent };
|
|
98
|
-
//# sourceMappingURL=taiga-ui-kit-directives-textarea-limit.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-directives-textarea-limit.mjs","sources":["../../../projects/kit/directives/textarea-limit/textarea-limit.directive.ts","../../../projects/kit/directives/textarea-limit/taiga-ui-kit-directives-textarea-limit.ts"],"sourcesContent":["import type {DoCheck} from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n Directive,\n inject,\n Input,\n signal,\n ViewContainerRef,\n} from '@angular/core';\nimport type {AbstractControl, ValidationErrors, Validator} from '@angular/forms';\nimport {NG_VALIDATORS, Validators} from '@angular/forms';\nimport type {TuiContext} from '@taiga-ui/cdk/types';\nimport {tuiProvide} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {\n TUI_TEXTFIELD_OPTIONS,\n TuiTextfieldComponent,\n} from '@taiga-ui/core/components/textfield';\nimport {tuiTextareaOptionsProvider} from '@taiga-ui/kit/components/textarea';\nimport {injectContext, PolymorpheusComponent} from '@taiga-ui/polymorpheus';\n\n@Component({\n standalone: true,\n template: `\n <span [textContent]=\"context.$implicit.slice(0, limit())\"></span>\n <span\n [style.background]=\"background\"\n [textContent]=\"context.$implicit.slice(limit())\"\n ></span>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiTextareaLimitComponent {\n protected readonly limit = inject(TuiTextareaLimit).limit;\n protected readonly context = injectContext<TuiContext<string>>();\n protected readonly background =\n 'linear-gradient(transparent 0.125rem, var(--tui-status-negative-pale) 0.125rem, var(--tui-status-negative-pale) calc(100% - 0.125rem), transparent calc(100% - 0.125rem))';\n}\n\n@Component({\n standalone: true,\n template: '{{ length() }} / {{ limit() }}',\n styleUrls: ['./textarea-limit.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiTextareaCounterComponent {\n public readonly limit = signal(0);\n public readonly length = signal(0);\n}\n\nconst COMPONENT = new PolymorpheusComponent(TuiTextareaLimitComponent);\n\n@Directive({\n standalone: true,\n selector: '[tuiTextarea][limit]',\n providers: [\n tuiProvide(NG_VALIDATORS, TuiTextareaLimit, true),\n tuiTextareaOptionsProvider({content: COMPONENT}),\n ],\n host: {\n '[style.border-block-end-width.rem]': 'size() === \"l\" ? 1.875 : 1.75',\n },\n})\nexport class TuiTextareaLimit implements Validator, DoCheck {\n private readonly textfield = inject(TuiTextfieldComponent);\n private readonly ref = inject(ViewContainerRef).createComponent(\n TuiTextareaCounterComponent,\n );\n\n public readonly size = inject(TUI_TEXTFIELD_OPTIONS).size;\n public readonly limit = signal(0);\n\n // TODO: Use signal inputs in v5\n @Input('limit')\n public set limitSetter(limit: number) {\n this.limit.set(limit);\n }\n\n public ngDoCheck(): void {\n this.ref.instance.length.set(this.textfield.value().length);\n this.ref.instance.limit.set(this.limit());\n }\n\n public validate(control: AbstractControl): ValidationErrors | null {\n return Validators.maxLength(this.limit())(control);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAqBA,MAWa,yBAAyB,CAAA;AAXtC,IAAA,WAAA,GAAA;AAYuB,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC;QACvC,IAAO,CAAA,OAAA,GAAG,aAAa,EAAsB,CAAC;QAC9C,IAAU,CAAA,UAAA,GACzB,2KAA2K,CAAC;AACnL,KAAA;+GALY,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAAzB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,yBAAyB,EATxB,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,CAAA;;;;;;AAMT,IAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA,EAAA;;4FAGQ,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAXrC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,CAAA;;;;;;AAMT,IAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAClD,iBAAA,CAAA;;AAQD,MAMa,2BAA2B,CAAA;AANxC,IAAA,WAAA,GAAA;AAOoB,QAAA,IAAA,CAAA,KAAK,GAAG,MAA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