naive-ui/styles/Checkbox.scss
2019-08-14 19:28:03 +08:00

104 lines
2.6 KiB
SCSS

@import './mixins/mixins.scss';
@import './theme/default.scss';
@include b(checkbox-group) {
.n-checkbox {
margin-right: 18px;
}
}
@include b(checkbox) {
& {
display: inline-flex;
align-items: center;
justify-content: center;
}
.n-checkbox__label {
user-select: none;
cursor: pointer;
font-size: 13px;
color: #fff;
margin-left: 8px;
}
.n-checkbox__checkbox {
cursor: pointer;
height: 14px;
width: 14px;
box-sizing: border-box;
box-shadow: inset 0 0 0 1px $checkbox-border-color;
background-color: transparent;
border-radius: 4px;
position: relative;
transition: box-shadow .3s $default-cubic-bezier, background-color .3s $default-cubic-bezier;
&:hover {
box-shadow: inset 0 0 0 1px $checkbox-border-color--active;
}
&::before {
box-sizing: content-box;
content: "";
border-bottom: 2px solid #5C647B;
width: 8px;
left: 3px;
position: absolute;
top: 6px;
opacity: 0;
transform: scale(.5);
transform-origin: center;
transition: transform .3s $default-cubic-bezier, opacity .3s $default-cubic-bezier, border-color .3s $default-cubic-bezier;
}
&::after {
box-sizing: content-box;
content: "";
border: 1.5px solid #5C647B;
border-left: 0;
border-top: 0;
height: 8px;
left: 5px;
position: absolute;
top: 1px;
opacity: 0;
transform: rotate(45deg) scale(.5);
width: 3px;
transform-origin: center;
transition: transform .3s $default-cubic-bezier, opacity .3s $default-cubic-bezier, border-color .3s $default-cubic-bezier;
}
}
&.n-checkbox--checked {
.n-checkbox__checkbox {
background-color: $checkbox-background--active;
box-shadow: inset 0 0 0 1px $checkbox-border-color--active;
&::after {
opacity: 1;
transform: rotate(45deg) scale(1);
}
}
}
&.n-checkbox--indeterminate {
.n-checkbox__checkbox {
background-color: $checkbox-background--active;
box-shadow: inset 0 0 0 1px $checkbox-border-color--active;
&::after {
opacity: 0;
}
&::before {
opacity: 1;
transform: scale(1);
}
}
}
&.n-checkbox--disabled {
.n-checkbox__checkbox {
cursor: not-allowed;
background-color: rgba(255,255,255,.4);
box-shadow: inset 0 0 0 1px $checkbox-border-color;
&::after {
border: 1.5px solid rgba(255,255,255,.4);
border-left: 0;
border-top: 0;
}
&::before {
border-bottom: 1.5px solid rgba(255,255,255,.4);
}
}
}
}