mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
234 lines
6.9 KiB
SCSS
234 lines
6.9 KiB
SCSS
@import './mixins/mixins.scss';
|
|
|
|
@mixin radio-group-size-mixin ($size) {
|
|
@include m($size + '-size') {
|
|
line-height: map-get($--n-height, $size);
|
|
height: map-get($--n-height, $size);
|
|
@include b(radio-button) {
|
|
line-height: map-get($--n-height, $size);
|
|
height: map-get($--n-height, $size);
|
|
font-size: map-get($--n-font-size, $size);
|
|
}
|
|
@include e(splitor) {
|
|
height: map-get($--n-height, $size);
|
|
}
|
|
}
|
|
}
|
|
|
|
@include themes-mixin {
|
|
@include b(radio) {
|
|
@include once {
|
|
outline: none;
|
|
position: relative;
|
|
user-select: none;
|
|
display: inline-flex;
|
|
vertical-align: middle;
|
|
align-items: center;
|
|
margin-right: 18px;
|
|
@include e(radio-input) {
|
|
width: 0;
|
|
height: 0;
|
|
opacity: 0;
|
|
margin: 0;
|
|
}
|
|
}
|
|
@include e(control) {
|
|
box-shadow: map-get($--radio-box-shadow, 'default');
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
|
height: 14px;
|
|
width: 14px;
|
|
border-radius: 7px;
|
|
margin-right: 9px;
|
|
position: relative;
|
|
&::before {
|
|
content: "";
|
|
position: absolute;
|
|
left: 4px;
|
|
top: 4px;
|
|
height: 6px;
|
|
width: 6px;
|
|
border-radius: 4px;
|
|
transform: scale(.8);
|
|
background-color: map-get($--radio-control-background-color, 'active');
|
|
opacity: 0;
|
|
transition: opacity .3s $--n-ease-in-cubic-bezier, transform .3s $--n-ease-in-cubic-bezier;
|
|
}
|
|
@include m(checked) {
|
|
box-shadow: map-get($--radio-box-shadow, 'active');
|
|
&::before {
|
|
opacity: 1;
|
|
transform: scale(1);
|
|
transition: opacity .3s $--n-ease-out-cubic-bezier, transform .3s $--n-ease-out-cubic-bezier;
|
|
}
|
|
}
|
|
}
|
|
@include e(label) {
|
|
display: inline-block;
|
|
white-space: nowrap;
|
|
color: $--radio-label-text-color;
|
|
}
|
|
@include not-m(disabled) {
|
|
cursor: pointer;
|
|
&:hover {
|
|
@include e(control) {
|
|
box-shadow: map-get($--radio-box-shadow, 'hover');
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
|
}
|
|
}
|
|
@include m(focus) {
|
|
&:not(:active) {
|
|
@include e(control) {
|
|
box-shadow: map-get($--radio-box-shadow, 'focus');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@include m(disabled) {
|
|
opacity: $--radio-disabled-opacity;
|
|
cursor: not-allowed;
|
|
@include e(control) {
|
|
box-shadow: map-get($--radio-box-shadow, 'disabled');
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
|
&::before {
|
|
transform: scale(.8);
|
|
transform-origin: center;
|
|
opacity: 0;
|
|
background-color: map-get($--radio-control-background-color, 'disabled');
|
|
}
|
|
@include m(checked) {
|
|
&::before {
|
|
transform: scale(1);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
}
|
|
@include e(label) {
|
|
color: $--radio-label-text-color;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@include themes-mixin {
|
|
@include b(radio-group) {
|
|
@include once {
|
|
@include radio-group-size-mixin('small');
|
|
@include radio-group-size-mixin('medium');
|
|
@include radio-group-size-mixin('large');
|
|
display: inline-block;
|
|
@include m(button-group) {
|
|
white-space: nowrap;
|
|
}
|
|
height: 28px;
|
|
line-height: 28px;
|
|
}
|
|
@include b(radio-button) {
|
|
@include once {
|
|
vertical-align: bottom;
|
|
outline: none;
|
|
position: relative;
|
|
user-select: none;
|
|
display: inline-block;
|
|
height: 28px;
|
|
line-height: 28px;
|
|
box-sizing: border-box;
|
|
padding-left: 14px;
|
|
padding-right: 14px;
|
|
white-space: nowrap;
|
|
transition: background-color .3s $--n-ease-in-out-cubic-bezier, opacity .3s $--n-ease-in-out-cubic-bezier, border-color .3s $--n-ease-in-out-cubic-bezier, color .3s $--n-ease-in-out-cubic-bezier;
|
|
@include e(radio-input) {
|
|
width: 0;
|
|
height: 0;
|
|
opacity: 0;
|
|
margin: 0;
|
|
}
|
|
@include e(border-mask) {
|
|
pointer-events: none;
|
|
position: absolute;
|
|
box-shadow: inset 0 0 0 $--radio-border-mask-width transparent;
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
|
left: -1px;
|
|
bottom: -1px;
|
|
right: -1px;
|
|
top: -1px;
|
|
}
|
|
}
|
|
color: map-get($--radio-button-label-color, 'default');
|
|
border-top: 1px solid map-get($--radio-button-border-color, 'default');
|
|
border-bottom: 1px solid map-get($--radio-button-border-color, 'default');
|
|
|
|
&:first-child {
|
|
@include once {
|
|
border-top-left-radius: 6px;
|
|
border-bottom-left-radius: 6px;
|
|
@include e(border-mask) {
|
|
border-top-left-radius: 6px;
|
|
border-bottom-left-radius: 6px;
|
|
}
|
|
}
|
|
border-left: 1px solid map-get($--radio-button-border-color, 'default');
|
|
}
|
|
&:last-child {
|
|
@include once {
|
|
border-top-right-radius: 6px;
|
|
border-bottom-right-radius: 6px;
|
|
@include e(border-mask) {
|
|
border-top-right-radius: 6px;
|
|
border-bottom-right-radius: 6px;
|
|
}
|
|
}
|
|
border-right: 1px solid map-get($--radio-button-border-color, 'default');
|
|
}
|
|
@include not-m(disabled) {
|
|
@include once {
|
|
cursor: pointer;
|
|
}
|
|
&:hover {
|
|
@include e(border-mask) {
|
|
box-shadow: map-get($--radio-button-box-shadow, 'hover');
|
|
@include once {
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
|
}
|
|
}
|
|
@include not-m(checked) {
|
|
color: map-get($--radio-button-label-color, 'hover');
|
|
}
|
|
}
|
|
@include m(focus) {
|
|
&:not(:active) {
|
|
@include e(border-mask) {
|
|
box-shadow: map-get($--radio-button-box-shadow, 'focus')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@include m(checked) {
|
|
background-color: map-get($--radio-button-background-color, 'active');
|
|
color: map-get($--radio-button-label-color, 'active');
|
|
border-color: map-get($--radio-button-border-color, 'active');
|
|
}
|
|
@include m(disabled) {
|
|
@include once {
|
|
cursor: not-allowed;
|
|
}
|
|
opacity: $--radio-disabled-opacity;
|
|
}
|
|
}
|
|
@include e(splitor) {
|
|
@include once {
|
|
display: inline-block;
|
|
vertical-align: bottom;
|
|
height: 28px;
|
|
width: 1px;
|
|
transition: background-color .3s $--n-ease-in-out-cubic-bezier, opacity .3s $--n-ease-in-out-cubic-bezier;
|
|
}
|
|
background-color: map-get($--radio-button-border-color, 'default');
|
|
@include m(checked) {
|
|
background-color: map-get($--radio-button-border-color, 'active');
|
|
}
|
|
@include m(disabled) {
|
|
opacity: $--radio-disabled-opacity;
|
|
}
|
|
}
|
|
}
|
|
} |