Skip to content

Commit f0d4c46

Browse files
Moved selection logic into MatChipOption, MatChipList components
1 parent b580d1f commit f0d4c46

File tree

6 files changed

+568
-201
lines changed

6 files changed

+568
-201
lines changed

src/dev-app/mdc-chips/mdc-chips-demo.html

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ <h4>Unstyled</h4>
2121

2222
<h4>Advanced</h4>
2323

24-
<mat-chip-set selectable="false">
25-
<mat-chip color="accent" selected="true">Selected/Colored</mat-chip>
26-
27-
<mat-chip color="warn" selected="true" *ngIf="visible"
28-
(destroyed)="displayMessage('chip destroyed')" (removed)="toggleVisible()">
24+
<mat-chip-list multiple="true">
25+
<mat-chip-option color="accent" selected="true">Selected/Colored</mat-chip-option>
26+
<mat-chip-option color="warn" selected="true" *ngIf="visible"
27+
(destroyed)="displayMessage('chip destroyed')" (removed)="toggleVisible()">
2928
With Events
3029
<mat-icon matChipRemove>cancel</mat-icon>
31-
</mat-chip>
32-
</mat-chip-set>
30+
</mat-chip-option>
31+
</mat-chip-list>
3332
<div>{{message}}</div>
3433

3534
<h4>With avatar and icons</h4>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div #mdcChip
2+
class="mdc-chip"
3+
[class.mat-primary] = "color === 'primary'"
4+
[class.mat-accent] = "color === 'accent'"
5+
[class.mat-warn] = "color === 'warn'"
6+
[ngClass]="_mdcClasses"
7+
(click)='_handleInteraction($event)'
8+
(keydown)='_handleInteraction($event)'
9+
(transitionend)='_chipFoundation.handleTransitionEnd($event)'
10+
tabindex="0">
11+
<svg *ngIf="_chipListMultiple" class="mdc-chip__checkmark-svg" viewBox="-2 -3 30 30">
12+
<path class="mdc-chip__checkmark-path" fill="none" stroke="black"
13+
d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
14+
</svg>
15+
<div class="mdc-chip__text"><ng-content></ng-content></div>
16+
</div>
17+
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<div #mdcChipSet
2-
class="mdc-chip-set"
3-
[class.mdc-chip-set--choice]="selectable && !multiple"
4-
[class.mdc-chip-set--filter]="selectable && multiple">
2+
class="mdc-chip-set"
3+
[ngClass]="_mdcClasses">
54
<ng-content></ng-content>
65
</div>
76

0 commit comments

Comments
 (0)