Skip to content

Commit d8df570

Browse files
committed
sync
1 parent 0fd32a9 commit d8df570

File tree

3 files changed

+21
-82
lines changed

3 files changed

+21
-82
lines changed

src/demo-app/chips/chips-demo.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import {Component} from '@angular/core';
2-
import {MdChipInputEvent, ENTER, COMMA} from '@angular/material';
2+
import {MdChipInputEvent, ENTER} from '@angular/material';
3+
4+
const COMMA = 188;
35

46
export interface Person {
57
name: string;

src/lib/chips/chip-list.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import {
2222

2323
import {MdChip} from './chip';
2424
import {FocusKeyManager} from '../core/a11y/focus-key-manager';
25-
import {SPACE, LEFT_ARROW, RIGHT_ARROW} from '../core/keyboard/keycodes';
26-
import {Subscription} from 'rxjs/Subscription';
25+
import {BACKSPACE, DELETE, SPACE, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, UP_ARROW} from '../core/keyboard/keycodes';
2726
import {coerceBooleanProperty, Directionality} from '@angular/cdk';
2827
import {Subscription} from 'rxjs/Subscription';
2928

src/lib/chips/chips.scss

Lines changed: 17 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3,89 +3,18 @@
33
$mat-chip-vertical-padding: 8px;
44
$mat-chip-horizontal-padding: 12px;
55

6-
$mat-chip-vertical-padding: 8px - $mat-chip-border-width;
7-
$mat-chip-horizontal-padding: 12px - $mat-chip-border-width;
8-
9-
$mat-chip-margin: ($mat-chip-horizontal-padding / 4);
10-
11-
$mat-chip-remove-margin: $mat-chip-line-height * 2;
12-
$mat-chip-remove-icon-offset: 3px;
13-
$mat-chip-remove-size: 24px;
14-
$mat-chip-remove-font-size: 18px;
15-
16-
@mixin chip-margin() {
17-
[dir='rtl'] & {
18-
margin-right: $mat-chip-margin;
19-
margin-left: $mat-chip-margin;
20-
}
21-
22-
[dir='ltr'] & {
23-
margin-right: $mat-chip-margin;
24-
margin-left: $mat-chip-margin;
25-
}
26-
}
27-
28-
@mixin chip-margin-last() {
29-
[dir='rtl'] & {
30-
margin-left: 0;
31-
margin-right: $mat-chip-margin;
32-
}
33-
34-
[dir='ltr'] & {
35-
margin-right: 0;
36-
margin-left: $mat-chip-margin;
37-
}
38-
}
39-
40-
@mixin chip-margin-first() {
41-
[dir='ltr'] & {
42-
margin-left: 0;
43-
margin-right: $mat-chip-margin;
44-
}
45-
46-
[dir='rtl'] & {
47-
margin-right: 0;
48-
margin-left: $mat-chip-margin;
49-
}
50-
}
6+
$mat-chips-chip-margin: $mat-chip-horizontal-padding / 4;
517

528
.mat-chip-list-wrapper {
53-
549
display: flex;
5510
flex-direction: row;
5611
flex-wrap: wrap;
5712
align-items: flex-start;
58-
59-
.mat-chip {
60-
margin: $mat-chip-margin;
61-
62-
// Do not apply the special margins inside an input container
63-
// Remove the margin from the first element (in both LTR and RTL)
64-
&:first-child {
65-
@include chip-margin-first();
66-
}
67-
68-
// Remove the margin from the last element (in both LTR and RTL)
69-
&:last-child {
70-
@include chip-margin-last();
71-
}
72-
}
73-
}
74-
75-
.mat-input-container .mat-chip-list-wrapper .map-chip:last-child {
76-
@include chip-margin();
7713
}
7814

79-
.mat-input-prefix .mat-chip-list-wrapper {
80-
flex-wrap: nowrap;
81-
}
82-
83-
.mat-chip {
15+
.mat-chip:not(.mat-basic-chip) {
8416
display: inline-block;
85-
position: relative;
86-
87-
padding: $mat-chip-vertical-padding $mat-chip-horizontal-padding;
88-
border: $mat-chip-border-width solid transparent;
17+
padding: $mat-chip-vertical-padding $mat-chip-horizontal-padding $mat-chip-vertical-padding $mat-chip-horizontal-padding;
8918
border-radius: $mat-chip-horizontal-padding * 2;
9019

9120
// Apply a margin to adjacent sibling chips.
@@ -105,17 +34,26 @@ $mat-chip-remove-font-size: 18px;
10534
.mat-chip-list-stacked .mat-chip-list-wrapper {
10635
display: block;
10736

108-
.mat-chip {
37+
.mat-chip:not(.mat-basic-chip) {
10938
display: block;
11039
margin: 0;
11140
margin-bottom: $mat-chip-vertical-padding;
41+
42+
[dir='rtl'] & {
43+
margin: 0;
44+
margin-bottom: $mat-chip-vertical-padding;
45+
}
46+
47+
&:last-child, [dir='rtl'] &:last-child {
48+
margin-bottom: 0;
49+
}
11250
}
11351
}
11452

115-
.mat-chip-remove.mat-chip-remove-hidden {
116-
display: none;
53+
.mat-input-prefix .mat-chip-list-wrapper {
54+
margin-bottom: $mat-chip-vertical-padding;
11755
}
11856

119-
.mat-chip-input {
120-
@include chip-margin-last();
57+
.mat-chip-remove.mat-chip-remove-hidden {
58+
display: none;
12159
}

0 commit comments

Comments
 (0)