@@ -3,32 +3,36 @@ import {
33 Output ,
44 EventEmitter ,
55 HostBinding ,
6- Input
6+ Input ,
7+ TemplateRef
78} from "@angular/core" ;
89import { Tag } from "./tag.component" ;
910
1011@Component ( {
1112 selector : "cds-tag-filter, ibm-tag-filter" ,
1213 template : `
13- <span
14- class="cds--tag__label"
15- [attr.title]="title ? title : null"
16- (click)="onClick($event)">
17- <ng-content></ng-content>
18- </span>
19- <button
20- class="cds--tag__close-icon"
21- (click)="onClose($event)"
22- [disabled]="disabled"
23- [title]="closeButtonLabel">
24- <span class="cds--visually-hidden">{{closeButtonLabel}}</span>
25- <svg cdsIcon="close" size="16"></svg>
26- </button>
14+ <ng-container *ngIf="!skeleton">
15+ <ng-content select="[cdsTagIcon],[ibmTagIcon]"></ng-content>
16+ <span
17+ class="cds--tag__label"
18+ [attr.title]="title ? title : null"
19+ (click)="onClick($event)">
20+ <ng-content></ng-content>
21+ </span>
22+ <button
23+ class="cds--tag__close-icon"
24+ (click)="onClose($event)"
25+ [disabled]="disabled"
26+ [title]="closeButtonLabel">
27+ <span class="cds--visually-hidden">{{closeButtonLabel}}</span>
28+ <svg cdsIcon="close" size="16"></svg>
29+ </button>
30+ </ng-container>
2731 `
2832} )
2933export class TagFilter extends Tag {
3034 @Input ( ) closeButtonLabel = "Clear Filter" ;
31- @Input ( ) disabled : boolean ;
35+ @Input ( ) disabled = false ;
3236 @Input ( ) title : string ;
3337
3438 /**
@@ -59,8 +63,16 @@ export class TagFilter extends Tag {
5963 this . close . emit ( ) ;
6064 }
6165
66+ /**
67+ * @todo
68+ * Remove `cds--tag--${this.size}` in v7
69+ */
6270 @HostBinding ( "attr.class" ) get attrClass ( ) {
63- return `cds--tag cds--tag--filter cds--tag--${ this . type } cds--tag--${ this . size } cds--layout--size-${ this . size } ${ this . class } ${ this . disabled ? " cds--tag--disabled" : "" } ` ;
71+ const disabledClass = this . disabled ? "cds--tag--disabled" : "" ;
72+ const sizeClass = `cds--tag--${ this . size } cds--layout--size-${ this . size } ` ;
73+ const skeletonClass = this . skeleton ? "cds--skeleton" : "" ;
74+
75+ return `cds--tag cds--tag--filter cds--tag--${ this . type } ${ disabledClass } ${ sizeClass } ${ skeletonClass } ${ this . class } ` ;
6476 }
6577
6678 @HostBinding ( "attr.aria-label" ) get attrAriaLabel ( ) {
0 commit comments