Skip to content

Commit dbb98c4

Browse files
committed
address comments
1 parent 8712a6a commit dbb98c4

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

src/lib/chips/chip-input.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export interface MdChipInputEvent {
3535

3636
/**
3737
* A material design chips input component working with chip list component.
38-
* To be placed inside md-form-field. Can be placed inside <md-chip-list> or outside <md-chip-list>.
38+
* To be placed inside <md-form-field>. Can be placed inside <md-chip-list> or outside
39+
* <md-chip-list>.
3940
*
4041
* Example:
4142
* <md-form-field>

src/lib/chips/chip-list.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {MdChip, MdChipEvent, MdChipSelectionChange} from './chip';
4141
import {MdChipInput} from './chip-input';
4242
import {MdFormFieldControl} from '../form-field/form-field-control';
4343

44-
44+
// Increasing integer for generating unique ids for chip-list components.
4545
let nextUniqueId = 0;
4646

4747
/** Change event object that is emitted when the chip list value has changed. */
@@ -138,7 +138,7 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
138138

139139
protected _value: any;
140140

141-
/** Placeholder for the chip list. Alternatively, placeholder can set to MdChipInput */
141+
/** Placeholder for the chip list. Alternatively, placeholder can be set on MdChipInput */
142142
protected _placeholder: string;
143143

144144
/** Tab index for the chip list. */
@@ -246,7 +246,7 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
246246

247247
/**
248248
* Whether or not this chip is selectable. When a chip is not selectable,
249-
* it's selected state is always ignored.
249+
* its selected state is always ignored.
250250
*/
251251
@Input()
252252
get selectable(): boolean { return this._selectable; }
@@ -277,7 +277,7 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
277277
@Output() change: EventEmitter<MdChipListChange> = new EventEmitter<MdChipListChange>();
278278

279279
/**
280-
* Event that emits whenever the raw value of the select changes. This is here primarily
280+
* Event that emits whenever the raw value of the chip-list changes. This is here primarily
281281
* to facilitate the two-way binding for the `value` input.
282282
* @docs-private
283283
*/
@@ -452,7 +452,7 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
452452
let chipIndex: number = this.chips.toArray().indexOf(chip);
453453
if (this._isValidIndex(chipIndex)) {
454454
if (chip._hasFocus) {
455-
// Check whether the chip is the last item
455+
// Check whether the chip is not the last item
456456
if (chipIndex < this.chips.length - 1) {
457457
this._keyManager.setActiveItem(chipIndex);
458458
} else if (chipIndex - 1 >= 0) {
@@ -519,8 +519,8 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
519519
}
520520

521521
/**
522-
* Finds and selects and option based on its value.
523-
* @returns Option that has the corresponding value.
522+
* Finds and selects the chip based on its value.
523+
* @returns Chip that has the corresponding value.
524524
*/
525525
private _selectValue(value: any, isUserInput: boolean = true): MdChip | undefined {
526526

@@ -546,8 +546,8 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
546546
}
547547

548548
/**
549-
* Clears the select trigger and deselects every option in the list.
550-
* @param skip Option that should not be deselected.
549+
* Deselects every chip in the list.
550+
* @param skip Chip that should not be deselected.
551551
*/
552552
private _clearSelection(skip?: MdChip): void {
553553
this._selectionModel.clear();
@@ -625,7 +625,7 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
625625
}
626626
}
627627

628-
/** Listens to user-generated selection events on each option. */
628+
/** Listens to user-generated selection events on each chip. */
629629
private _listenToChipsSelection(): void {
630630
this._chipSelectionSubscription = this.chipSelectionChanges.subscribe(event => {
631631
event.source.selected
@@ -637,7 +637,7 @@ export class MdChipList implements MdFormFieldControl<any>, ControlValueAccessor
637637
});
638638
}
639639

640-
/** Listens to user-generated selection events on each option. */
640+
/** Listens to user-generated selection events on each chip. */
641641
private _listenToChipsFocus(): void {
642642
this._chipFocusSubscription = this.chipFocusChanges.subscribe(event => {
643643
let chipIndex: number = this.chips.toArray().indexOf(event.chip);

src/lib/chips/chip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class MdChip extends _MdChipMixinBase implements FocusableOption, OnDestr
9595
this.onSelectionChange.emit({source: this, isUserInput: false});
9696
}
9797

98-
/** The value of the chip. Default to the content inside <md-chip> tags. */
98+
/** The value of the chip. Defaults to the content inside <md-chip> tags. */
9999
@Input()
100100
get value(): any {
101101
return this._value != undefined

src/lib/chips/chips.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ $mat-chip-remove-margin-after: -4px;
99
$mat-chips-chip-margin: 8px;
1010
$mat-chips-chip-bottom-margin: 3px;
1111

12+
$mat-chip-input-width: 150px;
13+
$mat-chip-input-margin: 3px;
14+
1215
.mat-chip-list-wrapper {
1316
display: flex;
1417
flex-direction: row;
@@ -93,6 +96,6 @@ $mat-chips-chip-bottom-margin: 3px;
9396
}
9497

9598
input.mat-chip-input {
96-
width: 150px;
97-
margin: 3px;
99+
width: $mat-chip-input-width;
100+
margin: $mat-chip-input-margin;
98101
}

0 commit comments

Comments
 (0)