naive-ui/styles/Radio.scss
2019-07-15 19:14:33 +08:00

152 lines
3.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-block;
vertical-align: middle;
}
@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: border-box;
.n-radio-button__label {
height: 28px;
line-height: 28px;
display: inline-block;
color: rgba(233,233,236,1);
margin: 0 14px;
}
.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);
border-right: 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(:first-child):not(:last-child) {
border-right: 1px solid rgba(255,255,255,0.5);
}
&:not(.n-radio-button--disabled) {
cursor: pointer;
&: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;
}
&: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;
.n-radio__label {
color: rgba(233,233,236,0.25);
}
}
}