mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
chore(core): update
This commit is contained in:
@ -16,9 +16,11 @@ $badge-ios-text-color: color-contrast($colors-ios, $badge-ios-background
|
||||
|
||||
|
||||
.badge-ios {
|
||||
border-radius: $badge-ios-border-radius;
|
||||
color: $badge-ios-text-color;
|
||||
background-color: $badge-ios-background-color;
|
||||
@include host-context() {
|
||||
border-radius: $badge-ios-border-radius;
|
||||
color: $badge-ios-text-color;
|
||||
background-color: $badge-ios-background-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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} {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
@include host-context() {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,9 +16,20 @@ $badge-md-text-color: color-contrast($colors-md, $badge-md-backgro
|
||||
|
||||
|
||||
.badge-md {
|
||||
border-radius: $badge-md-border-radius;
|
||||
color: $badge-md-text-color;
|
||||
background-color: $badge-md-background-color;
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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} {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
@include host-context() {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,28 +11,32 @@ $badge-font-size: 1.3rem !default;
|
||||
$badge-font-weight: bold !default;
|
||||
|
||||
|
||||
ion-badge,
|
||||
:host {
|
||||
display: inline-block;
|
||||
visibility: inherit !important;
|
||||
contain: content;
|
||||
ion-badge {
|
||||
@include host() {
|
||||
display: inline-block;
|
||||
visibility: inherit !important;
|
||||
contain: content;
|
||||
}
|
||||
}
|
||||
|
||||
.badge {
|
||||
padding: 3px 8px;
|
||||
@include host() {
|
||||
padding: 3px 8px;
|
||||
|
||||
min-width: 10px;
|
||||
min-width: 10px;
|
||||
|
||||
font-size: $badge-font-size;
|
||||
font-weight: $badge-font-weight;
|
||||
line-height: 1;
|
||||
font-size: $badge-font-size;
|
||||
font-weight: $badge-font-weight;
|
||||
line-height: 1;
|
||||
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
}
|
||||
|
||||
ion-badge:empty,
|
||||
:host(:empty) {
|
||||
display: none;
|
||||
}
|
||||
ion-badge:empty {
|
||||
@include host(':empty') {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,11 @@ $badge-wp-text-color: color-contrast($colors-wp, $badge-wp-backgro
|
||||
|
||||
|
||||
.badge-wp {
|
||||
border-radius: $badge-wp-border-radius;
|
||||
color: $badge-wp-text-color;
|
||||
background-color: $badge-wp-background-color;
|
||||
@include host-context() {
|
||||
border-radius: $badge-wp-border-radius;
|
||||
color: $badge-wp-text-color;
|
||||
background-color: $badge-wp-background-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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} {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
@include host-context() {
|
||||
color: $color-contrast;
|
||||
background-color: $color-base;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
@import "../../themes/ionic.globals.ios";
|
||||
@import "./button";
|
||||
@import "./toolbar-button";
|
||||
|
||||
// iOS Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
@import "../../themes/ionic.globals.md";
|
||||
@import "./button";
|
||||
@import "./toolbar-button";
|
||||
|
||||
// Material Design Button
|
||||
// --------------------------------------------------
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
@import "../../themes/ionic.globals.wp";
|
||||
@import "./button";
|
||||
@import "./toolbar-button";
|
||||
|
||||
// Windows Button
|
||||
// --------------------------------------------------
|
||||
|
||||
67
src/components/button/toolbar-button.scss
Normal file
67
src/components/button/toolbar-button.scss
Normal 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;
|
||||
}
|
||||
@ -155,4 +155,34 @@
|
||||
} @else {
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user