naive-ui/styles/Radio.scss
2019-07-16 17:20:43 +08:00

185 lines
4.9 KiB
SCSS

@import './mixins/mixins.scss';
@import './theme/default.scss';
@include b(radio) {
position: relative;
user-select: none;
display: inline-flex;
vertical-align: middle;
align-items: center;
margin-right: 18px;
.n-radio__control {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
transition: box-shadow .2s $default-cubic-bezier;
height: 14px;
width: 14px;
border-radius: 7px;
margin-right: 9px;
position: relative;
&::before {
content: "";
position: absolute;
left: 3px;
top: 3px;
height: 8px;
width: 8px;
border-radius: 4px;
transform: scale(.8);
background-color: rgba(99, 226, 183, 1);
opacity: 0;
transition: opacity .15s $slow-out-cubic-bezier, transform .15s $slow-out-cubic-bezier;
}
&.n-radio__control--checked {
box-shadow: inset 0 0 0 1px rgba(99, 226, 183, 1);
&::before {
opacity: 1;
transform: scale(1);
transition: opacity .15s $fast-in-cubic-bezier, transform .15s $fast-in-cubic-bezier;
}
}
}
.n-radio__label {
display: inline-block;
color: rgba(233,233,236,1);
}
&:not(.n-radio--disabled) {
cursor: pointer;
&:hover .n-radio__control {
box-shadow: inset 0 0 0 1px rgba(99, 226, 183, 1);
transition: box-shadow .2s $default-cubic-bezier;
}
&:active .n-radio__control {
box-shadow: inset 0 0 0 1px rgba(99, 226, 183, 1), 0px 0px 10px 1px rgba(99,226,183,0.3);
}
}
&.n-radio--disabled {
cursor: not-allowed;
.n-radio__control {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
transition: box-shadow .2s $default-cubic-bezier;
&::before {
transform: scale(.8);
transform-origin: center;
opacity: 0;
background-color: rgba(233,233,236,0.25);
}
&.n-radio__control--checked {
&::before {
transform: scale(1);
opacity: 1;
}
}
}
.n-radio__label {
color: rgba(233,233,236,0.25);
}
}
}
@include b(radio-group) {
display: inline-flex;
vertical-align: middle;
.n-radio-group__splitor {
height: 100%;
width: 1px;
background-color: rgba(255,255,255,0.5);
transition: background-color .2s $default-cubic-bezier;
&.n-radio-group__splitor--checked {
background-color: #63E2B7;
&.n-radio-group__splitor--disabled {
background-color: rgba(99, 226, 183, .4);
}
}
&.n-radio-group__splitor--disabled {
background-color: rgba(255,255,255,0.25);
}
}
}
@include b(radio-button) {
position: relative;
user-select: none;
display: inline-flex;
vertical-align: middle;
align-items: center;
height: 28px;
line-height: 28px;
border-top: 1px solid rgba(255,255,255,0.5);
border-bottom: 1px solid rgba(255,255,255,0.5);
box-sizing: content-box;
color: rgba(233,233,236,1);
transition: background-color .2s $default-cubic-bezier, border-color .2s $default-cubic-bezier;
.n-radio-button__label {
height: 28px;
line-height: 28px;
display: inline-block;
margin: 0 14px;
transition: color .2s $default-cubic-bezier;
}
.n-radio-button__border-mask {
pointer-events: none;
position: absolute;
box-shadow: inset 0 0 0 1px transparent;
transition: box-shadow .2s $default-cubic-bezier;
left: -1px;
bottom: -1px;
right: -1px;
top: -1px;
}
&:first-child {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
border-left: 1px solid rgba(255,255,255,0.5);
.n-radio-button__border-mask {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
}
&:last-child {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
border-right: 1px solid rgba(255,255,255,0.5);
.n-radio-button__border-mask {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
}
&:not(.n-radio-button--disabled) {
cursor: pointer;
&.n-radio-button--checked {
background-color: #63E2B7;
color: #1F263E;
border-color: #63E2B7;
.n-radio-button__label {
color: #1F263E;
transition: color .2s $fast-in-cubic-bezier;
}
}
&:hover .n-radio-button__border-mask {
box-shadow: inset 0 0 0 1px rgba(99, 226, 183, 1);
transition: box-shadow .2s $default-cubic-bezier;
}
&:hover:not(.n-radio-button--checked) .n-radio-button__label {
color: #63E2B7;
}
&:active .n-radio-button__border-mask {
box-shadow: inset 0 0 0 1px rgba(99, 226, 183, 1), 0px 0px 10px 1px rgba(99,226,183,0.3);
}
}
&.n-radio-button--disabled {
cursor: not-allowed;
border-color: rgba(255,255,255,0.16);
.n-radio-button__label {
color: rgba(255,255,255,0.25);
}
&.n-radio-button--checked {
color: rgba(31, 38, 62, .25);
border-color: transparent;
background-color: rgba(99, 226, 183, .4);
.n-radio-button__label {
color: rgba(31, 38, 62, .4);
}
}
}
}