mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-01 23:29:30 +08:00
160 lines
2.9 KiB
Plaintext
160 lines
2.9 KiB
Plaintext
.antCheckboxFn();
|
|
|
|
.antCheckboxFn(@checkbox-prefix-cls: ant-checkbox) {
|
|
|
|
@checkbox-wrap-prefix-cls: @checkbox-prefix-cls;
|
|
@checkbox-inner-prefix-cls: ~"@{checkbox-wrap-prefix-cls}-inner";
|
|
|
|
// 一般状态
|
|
.@{checkbox-wrap-prefix-cls} {
|
|
white-space: nowrap;
|
|
cursor: pointer;
|
|
outline: none;
|
|
display: inline-block;
|
|
line-height: 1;
|
|
position: relative;
|
|
vertical-align: middle;
|
|
|
|
&:hover {
|
|
.@{checkbox-inner-prefix-cls} {
|
|
border-color: #bcbcbc;
|
|
}
|
|
}
|
|
|
|
&-inner {
|
|
&:after {
|
|
transform: rotate(45deg) scale(0);
|
|
position: absolute;
|
|
left: 4px;
|
|
top: 1px;
|
|
display: table;
|
|
width: 5px;
|
|
height: 8px;
|
|
border: 2px solid #fff;
|
|
border-top: 0;
|
|
border-left: 0;
|
|
content: ' ';
|
|
transition: all .1s @ease-in-back;
|
|
}
|
|
|
|
position: relative;
|
|
top: 0;
|
|
left: 0;
|
|
display: inline-block;
|
|
width: 14px;
|
|
height: 14px;
|
|
border-width: 1px;
|
|
border-style: solid;
|
|
border-radius: 3px;
|
|
border-color: #d9d9d9;
|
|
background-color: #fff;
|
|
transition: border-color 0.1s @ease-in-out-back, background-color 0.1s @ease-in-out-back;
|
|
}
|
|
|
|
&-input {
|
|
position: absolute;
|
|
left: 0;
|
|
z-index: 1;
|
|
cursor: pointer;
|
|
.opacity(0);
|
|
top: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
// 半选状态
|
|
.@{checkbox-wrap-prefix-cls}-indeterminate {
|
|
.@{checkbox-inner-prefix-cls} {
|
|
border-color: @primary-color;
|
|
background-color: @primary-color;
|
|
&:after {
|
|
content: ' ';
|
|
transform: scale(1);
|
|
position: absolute;
|
|
left: 2px;
|
|
top: 5px;
|
|
width: 8px;
|
|
height: 1px;
|
|
}
|
|
}
|
|
}
|
|
// 选中状态
|
|
.@{checkbox-wrap-prefix-cls}-checked {
|
|
|
|
&:hover {
|
|
.@{checkbox-inner-prefix-cls} {
|
|
border-color: @primary-color;
|
|
}
|
|
}
|
|
|
|
.@{checkbox-inner-prefix-cls} {
|
|
border-color: @primary-color;
|
|
background-color: @primary-color;
|
|
|
|
&:after {
|
|
transform: rotate(45deg) scale(1);
|
|
position: absolute;
|
|
left: 4px;
|
|
top: 1px;
|
|
display: table;
|
|
width: 5px;
|
|
height: 8px;
|
|
border: 2px solid #fff;
|
|
border-top: 0;
|
|
border-left: 0;
|
|
content: ' ';
|
|
transition: all .2s @ease-out-back .1s;
|
|
}
|
|
}
|
|
}
|
|
|
|
.@{checkbox-wrap-prefix-cls}-disabled {
|
|
|
|
&.@{checkbox-wrap-prefix-cls}-checked {
|
|
|
|
&:hover {
|
|
.@{checkbox-inner-prefix-cls} {
|
|
border-color: #d9d9d9;
|
|
}
|
|
}
|
|
|
|
.@{checkbox-inner-prefix-cls} {
|
|
background-color: #f3f3f3;
|
|
border-color: #d9d9d9;
|
|
|
|
&:after {
|
|
animation-name: none;
|
|
border-color: #ccc;
|
|
}
|
|
}
|
|
}
|
|
|
|
&:hover {
|
|
.@{checkbox-inner-prefix-cls} {
|
|
border-color: #d9d9d9;
|
|
}
|
|
}
|
|
|
|
.@{checkbox-inner-prefix-cls} {
|
|
border-color: #d9d9d9;
|
|
background-color: #f3f3f3;
|
|
&:after {
|
|
animation-name: none;
|
|
border-color: #f3f3f3;
|
|
}
|
|
}
|
|
|
|
.@{checkbox-inner-prefix-cls}-input {
|
|
cursor: default;
|
|
}
|
|
}
|
|
|
|
.@{checkbox-wrap-prefix-cls} + span {
|
|
margin-left: 8px;
|
|
}
|
|
|
|
}
|