chore(core): update

This commit is contained in:
Adam Bradley
2017-05-03 14:03:49 -05:00
parent 10dca2d574
commit 0084cf01ff
10 changed files with 179 additions and 54 deletions

View File

@ -16,10 +16,12 @@ $badge-ios-text-color: color-contrast($colors-ios, $badge-ios-background
.badge-ios {
@include host-context() {
border-radius: $badge-ios-border-radius;
color: $badge-ios-text-color;
background-color: $badge-ios-background-color;
}
}
// Generate iOS Badge Colors
@ -28,8 +30,10 @@ $badge-ios-text-color: color-contrast($colors-ios, $badge-ios-background
@each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
.badge-ios-#{$color-name} {
@include host-context() {
color: $color-contrast;
background-color: $color-base;
}
}
}

View File

@ -16,10 +16,21 @@ $badge-md-text-color: color-contrast($colors-md, $badge-md-backgro
.badge-md {
@include host-context() {
border-radius: $badge-md-border-radius;
color: $badge-md-text-color;
background-color: $badge-md-background-color;
}
}
.badge-md {
@include host-context() {
border-radius: $badge-md-border-radius;
color: $badge-md-text-color;
background-color: $badge-md-background-color;
}
}
// Generate Material Design Badge Colors
@ -28,8 +39,10 @@ $badge-md-text-color: color-contrast($colors-md, $badge-md-backgro
@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
.badge-md-#{$color-name} {
@include host-context() {
color: $color-contrast;
background-color: $color-base;
}
}
}

View File

@ -11,14 +11,16 @@ $badge-font-size: 1.3rem !default;
$badge-font-weight: bold !default;
ion-badge,
:host {
ion-badge {
@include host() {
display: inline-block;
visibility: inherit !important;
contain: content;
}
}
.badge {
@include host() {
padding: 3px 8px;
min-width: 10px;
@ -31,8 +33,10 @@ ion-badge,
white-space: nowrap;
vertical-align: baseline;
}
}
ion-badge:empty,
:host(:empty) {
ion-badge:empty {
@include host(':empty') {
display: none;
}
}

View File

@ -16,10 +16,12 @@ $badge-wp-text-color: color-contrast($colors-wp, $badge-wp-backgro
.badge-wp {
@include host-context() {
border-radius: $badge-wp-border-radius;
color: $badge-wp-text-color;
background-color: $badge-wp-background-color;
}
}
// Generate Windows Badge Colors
@ -28,8 +30,10 @@ $badge-wp-text-color: color-contrast($colors-wp, $badge-wp-backgro
@each $color-name, $color-base, $color-contrast in get-colors($colors-wp) {
.badge-wp-#{$color-name} {
@include host-context() {
color: $color-contrast;
background-color: $color-base;
}
}
}

View File

@ -1,5 +1,6 @@
@import "../../themes/ionic.globals.ios";
@import "./button";
@import "./toolbar-button";
// iOS Button
// --------------------------------------------------

View File

@ -1,5 +1,6 @@
@import "../../themes/ionic.globals.md";
@import "./button";
@import "./toolbar-button";
// Material Design Button
// --------------------------------------------------

View File

@ -76,7 +76,7 @@ export class Button {
* @Prop {boolean} If true, activates the large button size.
* Type: size
*/
@Prop() role: string = 'button';
@Prop() buttonType: string = 'button';
/**
* @Prop {boolean} If true, activates the large button size.
@ -161,13 +161,13 @@ export class Button {
/**
* @hidden
*/
getElementClassList(role: string, mode: string): string[] {
if (!role) {
getElementClassList(buttonType: string, mode: string): string[] {
if (!buttonType) {
return [];
}
return [
role,
`${role}-${mode}`
buttonType,
`${buttonType}-${mode}`
];
}
@ -175,24 +175,24 @@ export class Button {
/**
* @hidden
*/
getClassList(role: string, type: string, mode: string): string[] {
getClassList(buttonType: string, type: string, mode: string): string[] {
if (!type) {
return [];
}
type = type.toLocaleLowerCase();
return [
`${role}-${type}`,
`${role}-${type}-${mode}`
`${buttonType}-${type}`,
`${buttonType}-${type}-${mode}`
];
}
/**
* @hidden
*/
getColorClassList(color: string, role: string, style: string, mode: string): string[] {
style = (role !== 'bar-button' && style === 'solid') ? 'default' : style;
getColorClassList(color: string, buttonType: string, style: string, mode: string): string[] {
style = (buttonType !== 'bar-button' && style === 'solid') ? 'default' : style;
let className =
role +
buttonType +
((style && style !== 'default') ?
'-' + style.toLowerCase() :
'');
@ -203,15 +203,15 @@ export class Button {
);
}
getStyleClassList(role: string): string[] {
getStyleClassList(buttonType: string): string[] {
var classList = [].concat(
this.outline ? this.getColorClassList(this.color, role, 'outline', this.mode) : [],
this.clear ? this.getColorClassList(this.color, role, 'clear', this.mode) : [],
this.solid ? this.getColorClassList(this.color, role, 'solid', this.mode) : []
this.outline ? this.getColorClassList(this.color, buttonType, 'outline', this.mode) : [],
this.clear ? this.getColorClassList(this.color, buttonType, 'clear', this.mode) : [],
this.solid ? this.getColorClassList(this.color, buttonType, 'solid', this.mode) : []
);
if (classList.length === 0) {
classList = [this.getColorClassList(this.color, role, 'default', this.mode)];
classList = [this.getColorClassList(this.color, buttonType, 'default', this.mode)];
}
return classList;
@ -233,12 +233,12 @@ export class Button {
var buttonClasses: CssClassObject = []
.concat(
this.getElementClassList(this.role, this.mode),
this.getClassList(this.role, shape, this.mode),
this.getClassList(this.role, display, this.mode),
this.getClassList(this.role, size, this.mode),
this.getClassList(this.role, decorator, this.mode),
this.getStyleClassList(this.role)
this.getElementClassList(this.buttonType, this.mode),
this.getClassList(this.buttonType, shape, this.mode),
this.getClassList(this.buttonType, display, this.mode),
this.getClassList(this.buttonType, size, this.mode),
this.getClassList(this.buttonType, decorator, this.mode),
this.getStyleClassList(this.buttonType)
)
.reduce((prevValue, cssClass) => {
prevValue[cssClass] = true;

View File

@ -1,5 +1,6 @@
@import "../../themes/ionic.globals.wp";
@import "./button";
@import "./toolbar-button";
// Windows Button
// --------------------------------------------------

View File

@ -0,0 +1,67 @@
@import "../../themes/ionic.globals";
// Toolbar Buttons
// --------------------------------------------------
.bar-button {
@include text-align(center);
@include appearance(none);
border: 0;
position: relative;
display: inline-block;
margin: 0;
padding: 0;
line-height: 1;
text-overflow: ellipsis;
text-transform: none;
white-space: nowrap;
cursor: pointer;
vertical-align: top; // the better option for most scenarios
vertical-align: -webkit-baseline-middle; // the best for those that support it
user-select: none;
}
.bar-button::after {
// used to make the button's hit area larger
position: absolute;
top: -7px;
right: -2px;
bottom: -6px;
left: -2px;
content: "";
}
// Menu Toggle
// --------------------------------------------------
.bar-button-menutoggle {
display: flex;
align-items: center;
}
// Back Button
// --------------------------------------------------
.back-button {
display: none;
}
.back-button.show-back-button {
display: inline-block;
}
.back-button-text {
display: flex;
align-items: center;
}

View File

@ -156,3 +156,33 @@
@content;
}
}
// Based on a selector, apply the content to that selector and the :host
@mixin host($selector: null) {
@debug $selector;
@at-root {
@if ($selector) {
:host(#{$selector}),
#{&} {
@content;
}
} @else {
:host,
#{&} {
@content;
}
}
}
}
// Based on a selector, apply the content to that selector and the :host-context
@mixin host-context() {
@at-root {
:host-context(#{&}),
#{&} {
@content;
}
}
}