naive-ui/styles/Tag.scss
2020-02-28 22:57:10 +08:00

147 lines
4.5 KiB
SCSS

@import './mixins/mixins.scss';
@mixin tag-size-mixin($size) {
$height: map-get($--n-height, $size) - 6px;
$font-size: (
"small": 12px,
"medium": 14px,
"large": 14px
);
@include m($size + "-size") {
line-height: $height;
height: $height;
font-size: map-get($font-size, $size);
@include m(round) {
padding-left: $height / 2;
padding-right: $height / 2;
border-radius: $height / 2;
@include m(closable) {
padding-right: 10px + $height / 2;
@include e(close) {
right: $height / 2 - 6px;
}
}
}
}
}
@mixin tag-type-mixin($type) {
@include m($type + '-type') {
@include not-m(checkable) {
box-shadow: inset 0 0 0 1px map-get($--tag-border-color, $type);
color: map-get($--tag-text-color, $type);
background-color: map-get($--tag-background-color, $type);
@include e(close) {
fill: map-get($--tag-close-color, $type);
}
@include not-m(disabled) {
@include e(close) {
&:hover {
fill: map-get($--tag-close-color, $type + '-hover');
}
&:active {
fill: map-get($--tag-close-color, $type + '-active');
}
}
&:hover {
background-color: map-get($--tag-background-color, $type + '-hover');
}
&:active {
background-color: map-get($--tag-background-color, $type + '-active');
}
}
@include m(disabled) {
box-shadow: inset 0 0 0 1px map-get($--tag-border-color, $type + '-disabled');
color: map-get($--tag-text-color, $type + '-disabled');
background-color: map-get($--tag-background-color, $type + '-disabled');
@include e(close) {
fill: map-get($--tag-close-color, $type + '-disabled');
}
}
}
}
}
@include themes-mixin {
@include b(tag) {
@include once {
@include tag-size-mixin("small");
@include tag-size-mixin("medium");
@include tag-size-mixin("large");
white-space: nowrap;
position: relative;
padding: 0 7px;
border-radius: $--n-tag-border-radius;
box-sizing: border-box;
cursor: default;
display: inline-block;
transition: background-color .2s $--n-ease-in-out-cubic-bezier, color .3s $--n-ease-in-out-cubic-bezier, box-shadow .3s $--n-ease-in-out-cubic-bezier, opacity .3s $--n-ease-in-out-cubic-bezier;
@include e(close) {
cursor: pointer;
}
@include m(checkable) {
cursor: pointer;
}
@include m(disabled) {
cursor: not-allowed !important;
@include e(close) {
cursor: not-allowed !important;
}
@include m(checkable) {
opacity: .4;
}
}
@include m(closable) {
padding-right: 18px;
@include e(close) {
transition: fill .2s $--n-ease-in-out-cubic-bezier, color .3s $--n-ease-in-out-cubic-bezier;
right: 3px;
top: 50%;
transform: translateY(-50%);
height: 14px;
width: 14px;
line-height: 14px;
position: absolute;
}
}
}
@include tag-type-mixin('default');
@include tag-type-mixin('info');
@include tag-type-mixin('success');
@include tag-type-mixin('warning');
@include tag-type-mixin('error');
@include m(checkable) {
@include once {
box-shadow: none;
}
color: map-get($--tag-text-color, 'checkable-default');
background-color: map-get($--tag-background-color, 'checkable-default');
@include not-m(disabled) {
&:hover {
@include not-m(checked) {
color: map-get($--tag-text-color, 'checkable-hover');
}
background-color: map-get($--tag-background-color, 'checkable-hover');
}
&:active {
@include not-m(checked) {
color: map-get($--tag-text-color, 'checkable-active');
}
background-color: map-get($--tag-background-color, 'checkable-active');
}
}
@include m(checked) {
color: map-get($--tag-text-color, 'checkable-active');
background-color: map-get($--tag-background-color, 'checkable-active');
@include not-m(disabled) {
&:hover {
background-color: map-get($--tag-background-color, 'checkable-checked-hover');
}
&:active {
background-color: map-get($--tag-background-color, 'checkable-checked-active');
}
}
}
}
}
}