-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the initial Chips skeleton with a very basic working demo of static, styled chips. References #120.
- Loading branch information
1 parent
009046f
commit e553b8a
Showing
13 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="chips-demo"> | ||
<section> | ||
<h3>Static Chips</h3> | ||
|
||
<md-chips> | ||
<md-chip>Chip 1</md-chip> | ||
<md-chip>Chip 2</md-chip> | ||
<md-chip>Chip 3</md-chip> | ||
</md-chips> | ||
</section> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.chips-demo { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'chips-demo', | ||
templateUrl: 'chips-demo.html', | ||
styleUrls: ['chips-demo.scss'] | ||
}) | ||
export class ChipsDemo { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# md-chips | ||
|
||
`md-chips` provides a horizontal display of (optionally) selectable, addable, and removable, | ||
items and an input to create additional ones (again; optional). You can read more about chips | ||
in the [Material Design spec](https://material.google.com/components/chips.html). | ||
|
||
This is a placeholder README for the eventual chips component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
Component, | ||
ElementRef, | ||
Renderer | ||
} from '@angular/core'; | ||
|
||
@Component(MdChip.COMPONENT_CONFIG) | ||
export class MdChip { | ||
|
||
static COMPONENT_CONFIG:Component = { | ||
selector: 'md-chip, [md-chip]', | ||
template: `<ng-content></ng-content>`, | ||
host: { | ||
// Properties | ||
'tabindex': '-1', | ||
'role': 'option' | ||
} | ||
}; | ||
|
||
constructor(protected _renderer: Renderer, protected _elementRef: ElementRef) { | ||
} | ||
|
||
ngAfterContentInit(): void { | ||
this._elementRef.nativeElement.classList.add('md-chip'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
$md-chip-vertical-padding: 8px; | ||
$md-chip-horizontal-padding: 12px; | ||
|
||
.md-chips { | ||
padding: $md-chip-horizontal-padding; | ||
} | ||
|
||
.md-chip { | ||
display: inline-block; | ||
padding: $md-chip-vertical-padding $md-chip-horizontal-padding | ||
$md-chip-vertical-padding $md-chip-horizontal-padding; | ||
border-radius: $md-chip-horizontal-padding * 2; | ||
|
||
background-color: #E0E0E0; | ||
color: rgba(0, 0, 0, 0.87); | ||
font-size: 13px; | ||
line-height: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
ContentChildren, | ||
ElementRef, | ||
ModuleWithProviders, | ||
NgModule, | ||
QueryList, | ||
ViewEncapsulation | ||
} from '@angular/core'; | ||
|
||
import {MdChip} from './chip'; | ||
|
||
@Component(MdChips.COMPONENT_CONFIG) | ||
export class MdChips { | ||
|
||
static COMPONENT_CONFIG: Component = { | ||
moduleId: module.id, | ||
selector: 'md-chips', | ||
template: `<ng-content></ng-content>`, | ||
host: { | ||
// Properties | ||
'tabindex': '0', | ||
'role': 'listbox', | ||
}, | ||
queries: { | ||
items: new ContentChildren(MdChip) | ||
}, | ||
styleUrls: ['chips.css'], | ||
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}; | ||
|
||
protected items: QueryList<MdChip>; | ||
|
||
constructor(private _elementRef: ElementRef) {} | ||
|
||
ngAfterContentInit(): void { | ||
this._elementRef.nativeElement.classList.add('md-chips'); | ||
} | ||
} | ||
|
||
@NgModule({ | ||
imports: [], | ||
exports: [MdChips, MdChip], | ||
declarations: [MdChips, MdChip] | ||
}) | ||
export class MdChipsModule { | ||
static forRoot(): ModuleWithProviders { | ||
return { | ||
ngModule: MdChipsModule, | ||
providers: [] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './chips'; | ||
export * from './chip'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters