diff --git a/projects/legacy/components/input-tag/input-tag.component.ts b/projects/legacy/components/input-tag/input-tag.component.ts index c6849f1c8887..24dd8b386da2 100644 --- a/projects/legacy/components/input-tag/input-tag.component.ts +++ b/projects/legacy/components/input-tag/input-tag.component.ts @@ -113,6 +113,9 @@ export class TuiInputTagComponent @ContentChild(TuiDataListDirective, {read: TemplateRef}) protected readonly datalist?: TemplateRef>; + @ContentChild('content') + protected readonly valueContent?: ElementRef; + @ViewChild('errorIcon') protected readonly errorIconTemplate?: TemplateRef>; @@ -219,6 +222,16 @@ export class TuiInputTagComponent return tuiIsNativeFocusedIn(this.el) || !!this.dropdown?.tuiDropdownOpen; } + public get tagsEmpty(): boolean { + return ( + ((!this.focused || this.inputHidden) && + !this.value.length && + !this.search?.trim()?.length && + !this.placeholder) || + !!this.valueContent + ); + } + public onTagEdited(value: string, index: number): void { this.focusInput(value === ''); this.value = this.filterValue( diff --git a/projects/legacy/components/input-tag/input-tag.style.less b/projects/legacy/components/input-tag/input-tag.style.less index 926d1f2f13a8..dc7d650a7ab4 100644 --- a/projects/legacy/components/input-tag/input-tag.style.less +++ b/projects/legacy/components/input-tag/input-tag.style.less @@ -63,7 +63,7 @@ overflow: hidden; } - &_empty:not(.t-with-placeholder) { + &_empty { block-size: 0; } diff --git a/projects/legacy/components/input-tag/input-tag.template.html b/projects/legacy/components/input-tag/input-tag.template.html index 4117dba306fb..4a28c68c52c2 100644 --- a/projects/legacy/components/input-tag/input-tag.template.html +++ b/projects/legacy/components/input-tag/input-tag.template.html @@ -47,8 +47,7 @@ >