amis2/scss/components/_button.scss

345 lines
7.2 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}Button {
2019-12-06 09:58:08 +08:00
display: inline-block;
font-weight: $Button-fontWeight;
text-align: center;
vertical-align: middle;
user-select: none;
background-color: transparent;
border: $Button-borderWidth solid transparent;
transition: $Button-transition;
white-space: nowrap;
@if $Button-mimWidth !=auto {
min-width: $Button-mimWidth;
}
@include button-size(
$Button-paddingY,
$Button-paddingX,
$Button-fontSize,
$Button-lineHeight,
$Button-borderRadius,
$Button-height
);
@include hover-focus {
color: $text-color;
text-decoration: none;
}
&:focus,
&.focus {
outline: 0;
box-shadow: $Button-onFocus-boxShadow;
}
&.is-disabled,
&:disabled {
opacity: $Button-onDisabled-opacity;
box-shadow: none;
pointer-events: none;
border-color: $Button-onDisabled-borderColor;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
@if variable-exists(Button-onDisabled-bg) {
background-color: $Button-onDisabled-bg;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
@if variable-exists(Button-onDisabled-color) {
color: $Button-onDisabled-color !important;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&.is-active,
&:active {
@if variable-exists(Button-onDisabledActive-bg) {
background-color: $Button-onDisabledActive-bg !important;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:not(:disabled):not(.is-disabled) {
cursor: pointer;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:not(:disabled):not(.is-disabled):active,
&:not(:disabled):not(.is-disabled).is-active {
box-shadow: $Button-onActive-boxShadow;
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&:focus {
box-shadow: $Button-onActive-boxShadow;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
> .pull-left,
> .pull-right {
line-height: inherit;
}
> .fa,
> .iconfont,
> .glyphicon {
font-size: inherit;
}
2019-04-30 11:11:25 +08:00
}
a.#{$ns}Button.is-disabled,
fieldset:disabled a.#{$ns}Button {
2019-12-06 09:58:08 +08:00
pointer-events: none;
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--primary {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--primary-bg,
$Button--primary-border,
$Button--primary-color,
$Button--primary-onHover-bg,
$Button--primary-onHover-border,
$Button--primary-onHover-color,
$Button--primary-onActive-bg,
$Button--primary-onActive-border,
$Button--primary-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--secondary {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--secondary-bg,
$Button--secondary-border,
$Button--secondary-color,
$Button--secondary-onHover-bg,
$Button--secondary-onHover-border,
$Button--secondary-onHover-color,
$Button--secondary-onActive-bg,
$Button--secondary-onActive-border,
$Button--secondary-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--success {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--success-bg,
$Button--success-border,
$Button--success-color,
$Button--success-onHover-bg,
$Button--success-onHover-border,
$Button--success-onHover-color,
$Button--success-onActive-bg,
$Button--success-onActive-border,
$Button--success-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--info {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--info-bg,
$Button--info-border,
$Button--info-color,
$Button--info-onHover-bg,
$Button--info-onHover-border,
$Button--info-onHover-color,
$Button--info-onActive-bg,
$Button--info-onActive-border,
$Button--info-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--warning {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--warning-bg,
$Button--warning-border,
$Button--warning-color,
$Button--warning-onHover-bg,
$Button--warning-onHover-border,
$Button--warning-onHover-color,
$Button--warning-onActive-bg,
$Button--warning-onActive-border,
$Button--warning-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--danger {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--danger-bg,
$Button--danger-border,
$Button--danger-color,
$Button--danger-onHover-bg,
$Button--danger-onHover-border,
$Button--danger-onHover-color,
$Button--danger-onActive-bg,
$Button--danger-onActive-border,
$Button--danger-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--light {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--light-bg,
$Button--light-border,
$Button--light-color,
$Button--light-onHover-bg,
$Button--light-onHover-border,
$Button--light-onHover-color,
$Button--light-onActive-bg,
$Button--light-onActive-border,
$Button--light-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--dark {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--dark-bg,
$Button--dark-border,
$Button--dark-color,
$Button--dark-onHover-bg,
$Button--dark-onHover-border,
$Button--dark-onHover-color,
$Button--dark-onActive-bg,
$Button--dark-onActive-border,
$Button--dark-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--default {
2019-12-06 09:58:08 +08:00
@include button-variant(
$Button--default-bg,
$Button--default-border,
$Button--default-color,
$Button--default-onHover-bg,
$Button--default-onHover-border,
$Button--default-onHover-color,
$Button--default-onActive-bg,
$Button--default-onActive-border,
$Button--default-onActive-color
);
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--xs {
2019-12-06 09:58:08 +08:00
@include button-size(
$Button--xs-paddingY,
$Button--xs-paddingX,
$Button--xs-fontSize,
$Button--xs-lineHeight,
$Button--sm-borderRadius,
$Button--xs-height
);
&.#{$ns}Button--iconOnly {
min-width: $Button--xs-height * $Button--iconOnly-minWidthRate;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--sm {
2019-12-06 09:58:08 +08:00
@include button-size(
$Button--sm-paddingY,
$Button--sm-paddingX,
$Button--sm-fontSize,
$Button--sm-lineHeight,
$Button--sm-borderRadius,
$Button--sm-height
);
&.#{$ns}Button--iconOnly {
min-width: $Button--sm-height * $Button--iconOnly-minWidthRate;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--md {
2019-12-06 09:58:08 +08:00
@include button-size(
$Button--md-paddingY,
$Button--md-paddingX,
$Button--md-fontSize,
$Button--md-lineHeight,
$Button-borderRadius,
$Button--md-height
);
&.#{$ns}Button--iconOnly {
min-width: $Button--md-height * $Button--iconOnly-minWidthRate;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--lg {
2019-12-06 09:58:08 +08:00
@include button-size(
$Button--lg-paddingY,
$Button--lg-paddingX,
$Button--lg-fontSize,
$Button--lg-lineHeight,
$Button--lg-borderRadius,
$Button--lg-height
);
&.#{$ns}Button--iconOnly {
min-width: $Button--lg-height * $Button--iconOnly-minWidthRate;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--iconOnly {
2019-12-06 09:58:08 +08:00
min-width: $Button-height * $Button--iconOnly-minWidthRate;
2019-12-06 09:58:08 +08:00
&:not(.#{$ns}Button--link) {
> .fa,
> .iconfont {
font-size: $fontSizeMd;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
> .iconfont {
line-height: 1;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--link {
2019-12-06 09:58:08 +08:00
width: auto;
min-width: auto;
font-weight: $fontWeightNormal;
color: $Button--link-color;
text-decoration: $link-decoration;
border: none;
2020-02-24 15:06:05 +08:00
padding-top: 0;
padding-bottom: 0;
height: auto;
2019-12-06 09:58:08 +08:00
@include hover-focus {
color: $Button--link-onHover-color;
text-decoration: $link-onHover-decoration;
box-shadow: none;
}
&:disabled,
&.is-disabled {
color: $text--muted-color;
pointer-events: none;
background-color: transparent;
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--block {
2019-12-06 09:58:08 +08:00
display: block;
width: 100%;
2019-12-06 09:58:08 +08:00
+ .#{$ns}Button--block {
margin-top: $gap-base;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
input[type='submit'],
input[type='reset'],
input[type='button'] {
&.#{$ns}Button--block {
width: 100%;
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}ButtonToolbar {
2019-12-06 09:58:08 +08:00
margin-left: px2rem(-5px);
margin-top: px2rem(-5px);
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
> .#{$ns}Button {
margin-left: px2rem(5px);
margin-top: px2rem(5px);
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Button--disabled-wrap {
2019-12-06 09:58:08 +08:00
display: inline-block !important;
}