2019-07-15 15:05:56 +08:00
|
|
|
@import './mixins/mixins.scss';
|
2019-09-17 19:21:07 +08:00
|
|
|
@import './themes/vars.scss';
|
2019-07-15 15:05:56 +08:00
|
|
|
|
2019-12-13 17:54:57 +08:00
|
|
|
@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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-21 14:49:08 +08:00
|
|
|
@include themes-mixin {
|
|
|
|
@include b(radio) {
|
2019-10-25 11:36:24 +08:00
|
|
|
@include once {
|
|
|
|
outline: none;
|
|
|
|
position: relative;
|
|
|
|
user-select: none;
|
|
|
|
display: inline-flex;
|
|
|
|
vertical-align: middle;
|
|
|
|
align-items: center;
|
|
|
|
margin-right: 18px;
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
@include e(control) {
|
|
|
|
box-shadow: map-get($--radio-box-shadow, 'default');
|
2019-12-22 15:50:37 +08:00
|
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
2019-10-21 14:49:08 +08:00
|
|
|
height: 14px;
|
|
|
|
width: 14px;
|
|
|
|
border-radius: 7px;
|
|
|
|
margin-right: 9px;
|
|
|
|
position: relative;
|
2019-07-15 15:05:56 +08:00
|
|
|
&::before {
|
2019-10-21 14:49:08 +08:00
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
left: 4px;
|
|
|
|
top: 4px;
|
|
|
|
height: 6px;
|
|
|
|
width: 6px;
|
|
|
|
border-radius: 4px;
|
2019-07-15 19:14:33 +08:00
|
|
|
transform: scale(.8);
|
2019-10-21 14:49:08 +08:00
|
|
|
background-color: map-get($--radio-control-background-color, 'active');
|
2019-07-15 19:14:33 +08:00
|
|
|
opacity: 0;
|
2019-10-21 14:49:08 +08:00
|
|
|
transition: opacity .3s $slow-out-cubic-bezier, transform .3s $slow-out-cubic-bezier;
|
2019-07-15 15:05:56 +08:00
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
@include m(checked) {
|
|
|
|
box-shadow: map-get($--radio-box-shadow, 'active');
|
2019-07-15 15:05:56 +08:00
|
|
|
&::before {
|
|
|
|
opacity: 1;
|
2019-10-21 14:49:08 +08:00
|
|
|
transform: scale(1);
|
|
|
|
transition: opacity .3s $fast-in-cubic-bezier, transform .3s $fast-in-cubic-bezier;
|
2019-07-15 15:05:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
@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');
|
2019-12-22 15:50:37 +08:00
|
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
2019-10-21 14:49:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
&:focus:not(:active) {
|
|
|
|
@include e(control) {
|
|
|
|
box-shadow: map-get($--radio-box-shadow, 'focus');
|
|
|
|
}
|
2019-07-16 17:20:43 +08:00
|
|
|
}
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
@include m(disabled) {
|
|
|
|
opacity: $--radio-disabled-opacity;
|
|
|
|
cursor: not-allowed;
|
|
|
|
@include e(control) {
|
|
|
|
box-shadow: map-get($--radio-box-shadow, 'disabled');
|
2019-12-22 15:50:37 +08:00
|
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
2019-10-21 14:49:08 +08:00
|
|
|
&::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;
|
|
|
|
}
|
2019-07-16 17:20:43 +08:00
|
|
|
}
|
|
|
|
}
|
2019-07-15 19:14:33 +08:00
|
|
|
}
|
|
|
|
|
2019-10-21 14:49:08 +08:00
|
|
|
@include themes-mixin {
|
|
|
|
@include b(radio-group) {
|
2019-12-13 17:54:57 +08:00
|
|
|
@include once {
|
|
|
|
@include radio-group-size-mixin('small');
|
|
|
|
@include radio-group-size-mixin('medium');
|
|
|
|
@include radio-group-size-mixin('large');
|
2019-10-21 14:49:08 +08:00
|
|
|
display: inline-block;
|
2019-12-13 17:54:57 +08:00
|
|
|
white-space: nowrap;
|
2019-10-21 14:49:08 +08:00
|
|
|
height: 28px;
|
|
|
|
line-height: 28px;
|
2019-12-13 17:54:57 +08:00
|
|
|
}
|
|
|
|
@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;
|
2019-12-22 15:50:37 +08:00
|
|
|
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;
|
2019-12-13 17:54:57 +08:00
|
|
|
@include e(border-mask) {
|
|
|
|
pointer-events: none;
|
|
|
|
position: absolute;
|
|
|
|
box-shadow: inset 0 0 0 $--radio-border-mask-width transparent;
|
2019-12-22 15:50:37 +08:00
|
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
2019-12-13 17:54:57 +08:00
|
|
|
left: -1px;
|
|
|
|
bottom: -1px;
|
|
|
|
right: -1px;
|
|
|
|
top: -1px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
color: map-get($--radio-button-label-color, 'default');
|
2019-10-21 14:49:08 +08:00
|
|
|
border-top: 1px solid map-get($--radio-button-border-color, 'default');
|
|
|
|
border-bottom: 1px solid map-get($--radio-button-border-color, 'default');
|
2019-12-13 17:54:57 +08:00
|
|
|
|
2019-10-21 14:49:08 +08:00
|
|
|
&:first-child {
|
2019-12-13 17:54:57 +08:00
|
|
|
@include once {
|
2019-10-21 14:49:08 +08:00
|
|
|
border-top-left-radius: 6px;
|
|
|
|
border-bottom-left-radius: 6px;
|
2019-12-13 17:54:57 +08:00
|
|
|
@include e(border-mask) {
|
|
|
|
border-top-left-radius: 6px;
|
|
|
|
border-bottom-left-radius: 6px;
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
}
|
2019-12-13 17:54:57 +08:00
|
|
|
border-left: 1px solid map-get($--radio-button-border-color, 'default');
|
2019-10-21 14:49:08 +08:00
|
|
|
}
|
|
|
|
&:last-child {
|
2019-12-13 17:54:57 +08:00
|
|
|
@include once {
|
2019-10-21 14:49:08 +08:00
|
|
|
border-top-right-radius: 6px;
|
|
|
|
border-bottom-right-radius: 6px;
|
2019-12-13 17:54:57 +08:00
|
|
|
@include e(border-mask) {
|
|
|
|
border-top-right-radius: 6px;
|
|
|
|
border-bottom-right-radius: 6px;
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
}
|
2019-12-13 17:54:57 +08:00
|
|
|
border-right: 1px solid map-get($--radio-button-border-color, 'default');
|
2019-10-21 14:49:08 +08:00
|
|
|
}
|
|
|
|
@include not-m(disabled) {
|
2019-12-13 17:54:57 +08:00
|
|
|
@include once {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
&:hover {
|
|
|
|
@include e(border-mask) {
|
2019-11-28 14:42:11 +08:00
|
|
|
box-shadow: map-get($--radio-button-box-shadow, 'hover');
|
2019-12-13 17:54:57 +08:00
|
|
|
@include once {
|
2019-12-22 15:50:37 +08:00
|
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
|
2019-12-13 17:54:57 +08:00
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
}
|
|
|
|
@include not-m(checked) {
|
|
|
|
color: map-get($--radio-button-label-color, 'hover');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&:focus:not(:active) {
|
|
|
|
@include e(border-mask) {
|
2019-11-28 14:42:11 +08:00
|
|
|
box-shadow: map-get($--radio-button-box-shadow, 'focus')
|
2019-10-21 14:49:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@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) {
|
2019-12-13 17:54:57 +08:00
|
|
|
@include once {
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
opacity: $--radio-disabled-opacity;
|
2019-07-16 17:20:43 +08:00
|
|
|
}
|
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
@include e(splitor) {
|
2019-12-13 17:54:57 +08:00
|
|
|
@include once {
|
|
|
|
display: inline-block;
|
|
|
|
vertical-align: bottom;
|
|
|
|
height: 28px;
|
|
|
|
width: 1px;
|
2019-12-22 15:50:37 +08:00
|
|
|
transition: background-color .3s $--n-ease-in-out-cubic-bezier, opacity .3s $--n-ease-in-out-cubic-bezier;
|
2019-12-13 17:54:57 +08:00
|
|
|
}
|
2019-10-21 14:49:08 +08:00
|
|
|
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;
|
2019-07-16 17:20:43 +08:00
|
|
|
}
|
2019-07-15 19:14:33 +08:00
|
|
|
}
|
|
|
|
}
|
2019-07-15 15:05:56 +08:00
|
|
|
}
|