2019-05-06 12:04:39 +08:00
|
|
|
@import '../../style/themes/index';
|
2018-12-07 20:02:01 +08:00
|
|
|
@import '../../style/mixins/index';
|
2015-07-08 19:47:45 +08:00
|
|
|
|
2018-12-07 20:02:01 +08:00
|
|
|
@switch-prefix-cls: ~'@{ant-prefix}-switch';
|
|
|
|
@switch-duration: 0.36s;
|
2015-07-09 21:05:33 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
@switch-pin-size: @switch-height - 4px;
|
|
|
|
@switch-sm-pin-size: @switch-sm-height - 4px;
|
|
|
|
|
2015-11-26 19:32:55 +08:00
|
|
|
.@{switch-prefix-cls} {
|
2017-09-22 18:33:29 +08:00
|
|
|
.reset-component;
|
2019-04-15 10:52:00 +08:00
|
|
|
|
2015-07-08 19:47:45 +08:00
|
|
|
position: relative;
|
|
|
|
display: inline-block;
|
2015-07-09 21:05:33 +08:00
|
|
|
box-sizing: border-box;
|
2020-01-11 23:24:10 +08:00
|
|
|
min-width: @switch-min-width;
|
2019-02-15 10:48:07 +08:00
|
|
|
height: @switch-height;
|
2020-05-18 17:31:46 +08:00
|
|
|
line-height: @switch-height;
|
2015-07-08 19:47:45 +08:00
|
|
|
vertical-align: middle;
|
2017-01-01 22:20:06 +08:00
|
|
|
background-color: @disabled-color;
|
2020-05-18 17:31:46 +08:00
|
|
|
border: 0;
|
2019-02-15 10:48:07 +08:00
|
|
|
border-radius: 100px;
|
2015-07-08 19:47:45 +08:00
|
|
|
cursor: pointer;
|
2016-10-21 13:09:29 +08:00
|
|
|
transition: all @switch-duration;
|
2015-09-23 11:44:39 +08:00
|
|
|
user-select: none;
|
2020-03-17 14:22:09 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
&:focus {
|
|
|
|
outline: 0;
|
|
|
|
box-shadow: 0 0 0 2px fade(@disabled-color, 10%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&-checked:focus {
|
|
|
|
box-shadow: 0 0 0 2px fade(@switch-color, 20%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:focus:hover {
|
|
|
|
box-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-checked {
|
|
|
|
background-color: @switch-color;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-loading,
|
|
|
|
&-disabled {
|
|
|
|
cursor: not-allowed;
|
|
|
|
opacity: @switch-disabled-opacity;
|
|
|
|
* {
|
|
|
|
box-shadow: none;
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ========================= Inner ==========================
|
2015-07-09 21:05:33 +08:00
|
|
|
&-inner {
|
2019-02-15 10:48:07 +08:00
|
|
|
display: block;
|
2020-05-18 17:31:46 +08:00
|
|
|
margin: 0 @switch-inner-margin-min 0 @switch-inner-margin-max;
|
2018-12-04 13:11:31 +08:00
|
|
|
color: @text-color-inverse;
|
2017-10-17 15:22:53 +08:00
|
|
|
font-size: @font-size-sm;
|
2020-05-18 17:31:46 +08:00
|
|
|
transition: margin @switch-duration;
|
2015-07-09 21:05:33 +08:00
|
|
|
}
|
2015-07-08 19:47:45 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
&-checked &-inner {
|
|
|
|
margin: 0 @switch-inner-margin-max 0 @switch-inner-margin-min;
|
2016-07-22 14:23:59 +08:00
|
|
|
}
|
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
// ========================= Handle =========================
|
|
|
|
&-handle {
|
|
|
|
position: absolute;
|
|
|
|
top: @switch-padding;
|
|
|
|
left: @switch-padding;
|
|
|
|
width: @switch-pin-size;
|
|
|
|
height: @switch-pin-size;
|
|
|
|
transition: all @switch-duration @ease-in-out-circ;
|
2015-07-08 19:47:45 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
&::before {
|
2018-08-07 16:35:56 +08:00
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
2019-02-15 10:48:07 +08:00
|
|
|
left: 0;
|
2020-05-18 17:31:46 +08:00
|
|
|
background-color: @switch-bg;
|
|
|
|
border-radius: @switch-pin-size / 2;
|
|
|
|
box-shadow: 0 2px 4px 0 @switch-shadow-color;
|
|
|
|
transition: all @switch-duration @ease-in-out-circ;
|
|
|
|
content: '';
|
2018-08-07 16:35:56 +08:00
|
|
|
}
|
2017-12-02 15:57:02 +08:00
|
|
|
}
|
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
&-checked &-handle {
|
|
|
|
left: calc(100% - @switch-pin-size - @switch-padding);
|
2017-12-02 15:57:02 +08:00
|
|
|
}
|
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
&:not(&-disabled):active {
|
|
|
|
.@{switch-prefix-cls}-handle::before {
|
|
|
|
right: -30%;
|
|
|
|
left: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.@{switch-prefix-cls}-checked {
|
|
|
|
.@{switch-prefix-cls}-handle::before {
|
|
|
|
right: 0;
|
|
|
|
left: -30%;
|
|
|
|
}
|
|
|
|
}
|
2017-12-02 15:57:02 +08:00
|
|
|
}
|
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
// ======================== Loading =========================
|
|
|
|
&-loading-icon {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 50%;
|
|
|
|
color: rgba(0, 0, 0, 0.65);
|
|
|
|
transform: translate(-50%, -50%);
|
2016-04-08 18:08:54 +08:00
|
|
|
}
|
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
&-checked &-loading-icon {
|
|
|
|
color: @switch-color;
|
2016-04-08 18:08:54 +08:00
|
|
|
}
|
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
// ========================== Size ==========================
|
2015-12-06 16:39:01 +08:00
|
|
|
&-small {
|
2020-01-11 23:24:10 +08:00
|
|
|
min-width: @switch-sm-min-width;
|
2019-02-15 10:48:07 +08:00
|
|
|
height: @switch-sm-height;
|
2020-05-18 17:31:46 +08:00
|
|
|
line-height: @switch-sm-height;
|
2016-10-21 11:09:24 +08:00
|
|
|
|
|
|
|
.@{switch-prefix-cls}-inner {
|
2020-05-18 17:31:46 +08:00
|
|
|
margin: 0 @switch-sm-inner-margin-min 0 @switch-sm-inner-margin-max;
|
2017-09-27 22:32:49 +08:00
|
|
|
font-size: @font-size-sm;
|
2016-10-21 11:09:24 +08:00
|
|
|
}
|
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
.@{switch-prefix-cls}-handle {
|
|
|
|
width: @switch-sm-pin-size;
|
|
|
|
height: @switch-sm-pin-size;
|
2015-12-06 16:39:01 +08:00
|
|
|
}
|
2016-10-21 11:09:24 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
.@{switch-prefix-cls}-loading-icon {
|
|
|
|
transform: translate(-50%, -50%) scale(0.66667);
|
2016-07-22 14:23:59 +08:00
|
|
|
}
|
2015-12-06 16:39:01 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
&.@{switch-prefix-cls}-checked {
|
|
|
|
.@{switch-prefix-cls}-inner {
|
|
|
|
margin: 0 @switch-sm-inner-margin-max 0 @switch-sm-inner-margin-min;
|
|
|
|
}
|
2018-08-07 16:35:56 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
.@{switch-prefix-cls}-handle {
|
|
|
|
left: calc(100% - @switch-sm-pin-size - @switch-padding);
|
|
|
|
}
|
2015-07-09 21:05:33 +08:00
|
|
|
}
|
2015-07-08 19:47:45 +08:00
|
|
|
}
|
|
|
|
}
|
2020-03-19 12:13:24 +08:00
|
|
|
|
|
|
|
@import './rtl';
|