ant-design/style/components/select.less
2015-08-31 12:10:54 +08:00

427 lines
8.1 KiB
Plaintext

@select-prefix-cls: ant-select;
@import "../mixins/iconfont";
//mixin
.selection__clear() {
cursor: pointer;
float: right;
font-weight: bold;
}
.selected_icon() {
position: relative;
&:after {
.iconfont-size-under-12px(10px);
display: inline-block;
content: '\e613';
font-family: 'anticon';
font-weight: bold;
position: absolute;
top: 7px;
right: 0;
padding-right: 15px;
color: @primary-color;
}
}
.@{select-prefix-cls} {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle;
color: #666;
font-size: @font-size-base;
> ul > li > a {
padding: 0;
background-color: #fff;
}
// arrow
&-arrow {
.iconfont-mixin();
position: absolute;
top: 50%;
right: 8px;
line-height: 1;
margin-top: -5px;
font-size: 8px;
* {
display: none;
}
&:before {
content: '\e600';
transition: transform 0.2s ease;
}
}
&-selection {
outline: none;
user-select: none;
-webkit-user-select: none;
box-sizing: border-box;
display: block;
background-color: #fff;
border-radius: 6px;
border: 1px solid #d9d9d9;
.transition(all .3s @ease-in-out);
&:hover {
border-color: tint(@primary-color, 20%);
}
&:active {
border-color: tint(@primary-color, 20%);
outline: 0;
box-shadow: 0 0 0 2px tint(@primary-color, 80%);
}
}
&-disabled {
color: #ccc;
cursor: not-allowed;
pointer-events: none;
}
&-disabled &-selection {
&:hover, &:active {
border-color: #d9d9d9;
}
}
&-selection--single {
height: 28px;
cursor: pointer;
.@{select-prefix-cls}-selection__rendered {
display: block;
overflow: hidden;
text-overflow: ellipsis;
padding-left: 10px;
padding-right: 20px;
line-height: 26px;
}
.@{select-prefix-cls}-selection__clear {
.selection__clear();
}
.@{select-prefix-cls}-selection__placeholder {
color: #ccc;
}
}
&-lg {
.@{select-prefix-cls}-selection--single {
height: 32px;
.@{select-prefix-cls}-selection__rendered {
line-height: 30px;
}
}
.@{select-prefix-cls}-selection--multiple {
min-height: 32px;
.@{select-prefix-cls}-selection__rendered {
li {
height: 24px;
.@{select-prefix-cls}-selection__choice__content {
font-size: 14px;
line-height: 24px;
}
}
}
}
}
&-sm {
.@{select-prefix-cls}-selection--single {
height: 22px;
.@{select-prefix-cls}-selection__rendered {
line-height: 20px;
}
}
.@{select-prefix-cls}-selection--multiple {
min-height: 22px;
.@{select-prefix-cls}-selection__rendered {
li {
height: 14px;
.@{select-prefix-cls}-selection__choice__content {
line-height: 14px;
position: relative;
top: -3px;
}
.@{select-prefix-cls}-selection__choice__remove {
position: relative;
top: -4px;
}
}
}
}
}
&-disabled &-selection__choice__remove {
color: #ccc;
cursor: default;
&:hover {
color: #ccc;
}
}
.@{select-prefix-cls}-search__field__wrap {
display: inline-block;
position: relative;
}
.@{select-prefix-cls}-search__field__placeholder {
position: absolute;
top: 0;
left: 3px;
color: #aaa;
}
&-search--inline {
float: left;
.@{select-prefix-cls}-search__field {
border: none;
font-size: 100%;
background: transparent;
outline: 0;
}
> i {
float: right;
}
}
&-selection--multiple {
min-height: 28px;
cursor: text;
.@{select-prefix-cls}-search--inline {
width: auto;
.@{select-prefix-cls}-search__field {
width: 0.75em;
}
}
.@{select-prefix-cls}-selection__rendered {
overflow: hidden;
text-overflow: ellipsis;
padding-left: 4px;
padding-bottom: 4px;
}
.@{select-prefix-cls}-selection__clear {
.selection__clear();
margin-top: 5px;
margin-right: 10px;
}
> ul > li {
margin-top: 4px;
height: 20px;
line-height: 20px;
}
.@{select-prefix-cls}-selection__choice {
background-color: #f3f3f3;
border-radius: 4px;
cursor: default;
float: left;
padding: 0 8px;
margin-right: 4px;
}
.@{select-prefix-cls}-selection__choice__remove {
.iconfont-mixin();
color: #919191;
cursor: pointer;
display: inline-block;
font-weight: bold;
font-size: 8px;
padding: 0 0 0 4px;
position: relative;
top: -1px;
left: 4px;
&:hover {
color: #333;
}
&:before {
content: "\e61e";
}
}
}
&-open {
.@{select-prefix-cls}-arrow {
.ie-rotate(2);
transform: rotate(180deg);
}
.@{select-prefix-cls}-selection {
.active();
}
}
&-combobox {
.@{select-prefix-cls}-arrow {
display: none;
}
.@{select-prefix-cls}-search--inline {
height: 100%;
float: none;
}
.@{select-prefix-cls}-search__field__placeholder {
left: 10px;
cursor: text;
}
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
height: 100%;
}
.@{select-prefix-cls}-search__field {
padding: 0 10px;
width: 100%;
height: 100%;
position: relative;
z-index: 1;
}
.@{select-prefix-cls}-selection__rendered {
padding: 0;
height: 100%;
}
}
}
.@{select-prefix-cls}-dropdown {
&--single &-menu-item-selected {
background-color: tint(@primary-color, 90%);
.selected_icon();
}
&--multiple &-menu-item {
padding: 7px 33px 7px 16px;
}
&--multiple &-menu-item-selected {
background-color: tint(@primary-color, 90%);
.selected_icon();
}
&-hidden {
display: none;
}
background-color: white;
border: 1px solid #d9d9d9;
box-shadow: @overlay-shadow;
border-radius: 4px;
box-sizing: border-box;
z-index: 1070;
left: -9999px;
top: -9999px;
position: absolute;
outline: none;
overflow: hidden;
font-size: @font-size-base;
&-menu {
outline: none;
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
max-height: 250px;
overflow: auto;
&-item-group-list {
margin: 0;
padding: 0;
> .@{select-prefix-cls}-dropdown-menu-item {
padding-left: 24px;
}
}
&-item-group-title {
color: #999;
line-height: 1.5;
padding: 8px 16px;
}
&-item {
position: relative;
display: block;
padding: 7px 16px;
font-weight: normal;
color: #666;
white-space: nowrap;
cursor: pointer;
&:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
&:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
&:hover, &-active {
background-color: tint(@primary-color, 90%) !important;
}
&-disabled {
color: #ccc;
cursor: not-allowed;
pointer-events: none;
&:hover {
color: #ccc;
background-color: #fff;
cursor: not-allowed;
}
}
&-divider {
height: 1px;
margin: 1px 0;
overflow: hidden;
background-color: #e5e5e5;
line-height: 0;
}
}
}
&-container-open, &-open {
.@{select-prefix-cls}-dropdown {
display: block;
}
}
.@{select-prefix-cls}-search--dropdown {
display: block;
padding: 4px;
.@{select-prefix-cls}-search__field__placeholder {
left: 4px;
}
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
}
.@{select-prefix-cls}-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box;
border: 1px solid #d9d9d9;
border-radius: 4px;
outline: none;
}
&.@{select-prefix-cls}-search--hide {
display: none;
}
}
}