naive-ui/styles/Tag.scss

147 lines
4.5 KiB
SCSS
Raw Normal View History

2019-08-07 14:21:15 +08:00
@import './mixins/mixins.scss';
2020-02-11 14:44:29 +08:00
2019-09-27 16:02:20 +08:00
@mixin tag-size-mixin($size) {
$height: map-get($--n-height, $size) - 6px;
$font-size: (
2020-03-02 22:41:52 +08:00
"small": 13px,
2019-09-27 16:02:20 +08:00
"medium": 14px,
"large": 14px
);
@include m($size + "-size") {
line-height: $height;
height: $height;
font-size: map-get($font-size, $size);
2019-11-29 16:28:59 +08:00
@include m(round) {
padding-left: $height / 2;
padding-right: $height / 2;
border-radius: $height / 2;
@include m(closable) {
2020-02-20 13:22:48 +08:00
padding-right: 10px + $height / 2;
2020-02-19 21:08:31 +08:00
@include e(close) {
2020-02-20 13:22:48 +08:00
right: $height / 2 - 6px;
2019-11-29 16:28:59 +08:00
}
}
}
2019-08-07 14:21:15 +08:00
}
2019-09-27 16:02:20 +08:00
}
@mixin tag-type-mixin($type) {
@include m($type + '-type') {
2019-11-29 16:28:59 +08:00
@include not-m(checkable) {
2020-02-23 14:13:30 +08:00
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);
}
2019-11-29 16:28:59 +08:00
@include not-m(disabled) {
2020-02-19 21:08:31 +08:00
@include e(close) {
2019-11-29 16:28:59 +08:00
&:hover {
2020-02-21 14:59:17 +08:00
fill: map-get($--tag-close-color, $type + '-hover');
2019-11-29 16:28:59 +08:00
}
&:active {
2020-02-21 14:59:17 +08:00
fill: map-get($--tag-close-color, $type + '-active');
2019-09-27 16:02:20 +08:00
}
}
2019-11-29 16:28:59 +08:00
&:hover {
2020-02-21 14:59:17 +08:00
background-color: map-get($--tag-background-color, $type + '-hover');
2019-11-29 16:28:59 +08:00
}
2019-09-27 16:02:20 +08:00
&:active {
2020-02-21 14:59:17 +08:00
background-color: map-get($--tag-background-color, $type + '-active');
2019-09-27 16:02:20 +08:00
}
2019-08-12 14:30:08 +08:00
}
2019-11-29 16:28:59 +08:00
@include m(disabled) {
2020-02-21 14:59:17 +08:00
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');
2020-02-19 21:08:31 +08:00
@include e(close) {
2020-02-21 14:59:17 +08:00
fill: map-get($--tag-close-color, $type + '-disabled');
2019-09-27 16:02:20 +08:00
}
2019-08-12 14:30:08 +08:00
}
}
2019-08-07 14:21:15 +08:00
}
2019-09-27 16:02:20 +08:00
}
@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;
2020-02-28 22:57:10 +08:00
border-radius: $--n-tag-border-radius;
2019-09-27 16:02:20 +08:00
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;
2020-02-19 21:08:31 +08:00
@include e(close) {
2019-09-27 16:02:20 +08:00
cursor: pointer;
}
2019-11-29 16:28:59 +08:00
@include m(checkable) {
cursor: pointer;
}
2019-09-27 16:02:20 +08:00
@include m(disabled) {
cursor: not-allowed !important;
2020-02-19 21:08:31 +08:00
@include e(close) {
2019-09-27 16:02:20 +08:00
cursor: not-allowed !important;
}
2019-11-29 16:28:59 +08:00
@include m(checkable) {
opacity: .4;
}
2019-09-27 16:02:20 +08:00
}
@include m(closable) {
padding-right: 18px;
2020-02-19 21:08:31 +08:00
@include e(close) {
transition: fill .2s $--n-ease-in-out-cubic-bezier, color .3s $--n-ease-in-out-cubic-bezier;
2019-09-27 16:02:20 +08:00
right: 3px;
top: 50%;
transform: translateY(-50%);
height: 14px;
width: 14px;
line-height: 14px;
position: absolute;
}
2019-08-12 14:30:08 +08:00
}
}
2019-09-27 16:02:20 +08:00
@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');
2019-11-29 16:28:59 +08:00
@include m(checkable) {
2020-02-21 14:59:17 +08:00
@include once {
box-shadow: none;
}
color: map-get($--tag-text-color, 'checkable-default');
background-color: map-get($--tag-background-color, 'checkable-default');
2019-11-29 16:28:59 +08:00
@include not-m(disabled) {
&:hover {
@include not-m(checked) {
2020-02-21 14:59:17 +08:00
color: map-get($--tag-text-color, 'checkable-hover');
2019-11-29 16:28:59 +08:00
}
2020-02-21 14:59:17 +08:00
background-color: map-get($--tag-background-color, 'checkable-hover');
2019-11-29 16:28:59 +08:00
}
&:active {
@include not-m(checked) {
2020-02-21 14:59:17 +08:00
color: map-get($--tag-text-color, 'checkable-active');
2019-11-29 16:28:59 +08:00
}
2020-02-21 14:59:17 +08:00
background-color: map-get($--tag-background-color, 'checkable-active');
2019-11-29 16:28:59 +08:00
}
}
@include m(checked) {
2020-02-21 14:59:17 +08:00
color: map-get($--tag-text-color, 'checkable-active');
background-color: map-get($--tag-background-color, 'checkable-active');
2019-11-29 16:28:59 +08:00
@include not-m(disabled) {
&:hover {
2020-02-21 14:59:17 +08:00
background-color: map-get($--tag-background-color, 'checkable-checked-hover');
2019-11-29 16:28:59 +08:00
}
&:active {
2020-02-21 14:59:17 +08:00
background-color: map-get($--tag-background-color, 'checkable-checked-active');
2019-11-29 16:28:59 +08:00
}
}
}
}
2019-08-07 14:21:15 +08:00
}
}