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';
|
2020-06-22 19:51:23 +08:00
|
|
|
@switch-duration: 0.2s;
|
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} {
|
2020-12-22 11:08:12 +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;
|
2022-09-08 13:35:44 +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 {
|
2021-09-01 10:56:50 +08:00
|
|
|
box-shadow: 0 0 0 2px @primary-1;
|
2020-05-18 17:31:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&:focus:hover {
|
|
|
|
box-shadow: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-checked {
|
2022-09-08 13:35:44 +08:00
|
|
|
background-color: @switch-color;
|
2020-05-18 17:31:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&-loading,
|
|
|
|
&-disabled {
|
|
|
|
cursor: not-allowed;
|
|
|
|
opacity: @switch-disabled-opacity;
|
2021-10-13 15:38:59 +08:00
|
|
|
|
2020-05-18 17:31:46 +08:00
|
|
|
* {
|
|
|
|
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;
|
2020-06-22 19:51:23 +08:00
|
|
|
transition: all @switch-duration ease-in-out;
|
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;
|
2020-12-25 14:31:44 +08:00
|
|
|
border-radius: (@switch-pin-size / 2);
|
2020-05-18 17:31:46 +08:00
|
|
|
box-shadow: 0 2px 4px 0 @switch-shadow-color;
|
2020-06-22 19:51:23 +08:00
|
|
|
transition: all @switch-duration ease-in-out;
|
2020-05-18 17:31:46 +08:00
|
|
|
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 =========================
|
2021-09-18 16:18:08 +08:00
|
|
|
&-loading-icon.@{iconfont-css-prefix} {
|
2020-11-18 19:01:56 +08:00
|
|
|
position: relative;
|
2020-12-25 14:31:44 +08:00
|
|
|
top: ((@switch-pin-size - @font-size-base) / 2);
|
2020-05-18 17:31:46 +08:00
|
|
|
color: rgba(0, 0, 0, 0.65);
|
2020-11-18 19:01:56 +08:00
|
|
|
vertical-align: top;
|
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 {
|
2020-12-25 14:31:44 +08:00
|
|
|
top: ((@switch-sm-pin-size - 9px) / 2);
|
2020-11-18 19:01:56 +08:00
|
|
|
font-size: 9px;
|
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';
|