naive-ui/styles/Checkbox.scss

154 lines
4.2 KiB
SCSS
Raw Normal View History

2019-09-29 16:02:28 +08:00
@import "./mixins/mixins.scss";
2019-06-13 19:17:41 +08:00
2019-09-29 16:02:28 +08:00
@include themes-mixin {
@include once {
@include b(checkbox-group) {
font-size: 14px;
@include b(checkbox) {
2019-09-29 16:02:28 +08:00
margin-right: 18px;
}
2019-06-28 15:08:31 +08:00
}
2019-09-29 16:02:28 +08:00
@include b(checkbox) {
outline: none;
font-size: 14px;
cursor: pointer;
display: inline-block;
white-space: nowrap;
@include b(checkbox-box) {
display: inline-block;
2019-09-29 16:02:28 +08:00
height: 14px;
width: 14px;
vertical-align: middle;
2019-09-29 16:02:28 +08:00
box-sizing: border-box;
border-radius: 4px;
position: relative;
transition: box-shadow 0.3s $default-cubic-bezier,
background-color 0.3s $default-cubic-bezier;
@include e(line-mark, check-mark) {
path {
transition: fill .3s $default-cubic-bezier;
2019-10-23 16:51:29 +08:00
fill: $--checkbox-icon-fill;
}
}
@include e(line-mark) {
2019-09-29 16:02:28 +08:00
position: absolute;
top: 1px;
left: 1px;
right: 1px;
bottom: 1px;
width: calc(100% - 2px);
2019-09-29 16:02:28 +08:00
opacity: 0;
transform: scale(0.5);
transform-origin: center;
transition: transform 0.3s $default-cubic-bezier,
opacity 0.3s $default-cubic-bezier,
border-color 0.3s $default-cubic-bezier;
2019-09-29 16:02:28 +08:00
}
@include e(check-mark) {
2019-09-29 16:02:28 +08:00
content: "";
position: absolute;
top: 1px;
left: 1px;
right: 1px;
bottom: 1px;
width: calc(100% - 2px);
2019-09-29 16:02:28 +08:00
opacity: 0;
transform: scale(0.5);
2019-09-29 16:02:28 +08:00
transform-origin: center;
transition: transform 0.3s $default-cubic-bezier,
opacity 0.3s $default-cubic-bezier,
border-color 0.3s $default-cubic-bezier;
2019-09-29 16:02:28 +08:00
}
}
@include e(label) {
transition: color .3s $default-cubic-bezier;
user-select: none;
padding-left: 8px;
}
@include m(checked) {
@include b(checkbox-box) {
@include e(check-mark) {
2019-09-29 16:02:28 +08:00
opacity: 1;
transform: scale(1);
2019-09-29 16:02:28 +08:00
}
}
}
@include m(indeterminate) {
@include b(checkbox-box) {
@include e(check-mark) {
2019-09-29 16:02:28 +08:00
opacity: 0;
transform: scale(.5);
2019-09-29 16:02:28 +08:00
}
@include e(line-mark) {
2019-09-29 16:02:28 +08:00
opacity: 1;
transform: scale(1);
}
}
}
@include m(disabled) {
cursor: not-allowed;
}
}
}
2019-09-29 16:02:28 +08:00
@include b(checkbox) {
&:hover {
@include b(checkbox-box) {
box-shadow: inset 0 0 0 1px $--checkbox-border-color--active;
}
2019-09-29 16:02:28 +08:00
}
&:focus {
@include b(checkbox-box) {
2019-09-29 16:02:28 +08:00
box-shadow: inset 0 0 0 1px $--checkbox-border-color--active;
}
}
@include b(checkbox-box) {
2019-11-08 16:40:53 +08:00
background-color: map-get($--checkbox-background-color, 'default');
box-shadow: inset 0 0 0 1px $--checkbox-border-color;
@include e(line-mark) {
path {
fill: $--checkbox-indeterminate-color;
}
}
@include e(check-mark) {
path {
fill: $--checkbox-indeterminate-color;
}
}
2019-09-29 16:02:28 +08:00
}
2019-10-12 00:50:34 +08:00
@include e(label) {
2019-12-04 18:43:55 +08:00
color: map-get($--checkbox-label-text-color, 'default');
2019-10-12 00:50:34 +08:00
}
@include m(checked, indeterminate) {
&:focus {
@include b(checkbox-box) {
box-shadow: inset 0 0 0 1px $--checkbox-border-color--active, 0 0 0 2px change-color($--checkbox-border-color--active, $alpha: .3);
}
}
@include b(checkbox-box) {
2019-09-29 16:02:28 +08:00
background-color: $--checkbox-border-color--active;
box-shadow: inset 0 0 0 1px $--checkbox-border-color--active;
border-left: 0;
border-top: 0;
}
}
@include m(disabled) {
@include b(checkbox-box) {
2019-11-08 16:40:53 +08:00
background-color: map-get($--checkbox-background-color, 'disabled');
2019-09-29 16:02:28 +08:00
box-shadow: inset 0 0 0 1px $--checkbox-disabled;
@include e(check-mark) {
path {
fill: $--checkbox-disabled;
}
2019-09-29 16:02:28 +08:00
}
@include e(line-mark) {
path {
fill: $--checkbox-disabled;
}
2019-09-29 16:02:28 +08:00
}
}
@include e(label) {
2019-12-04 18:43:55 +08:00
color: map-get($--checkbox-label-text-color, 'disabled');
}
2019-06-13 19:17:41 +08:00
}
}
}