ant-design/components/select/style/index.less

524 lines
10 KiB
Plaintext
Raw Normal View History

@import "../../style/themes/default";
@import "../../style/mixins/index";
@import "../../input/style/mixin";
2015-12-02 14:59:48 +08:00
@select-prefix-cls: ~"@{ant-prefix}-select";
2015-08-10 15:39:50 +08:00
.selection__clear() {
display: inline-block;
font-style: normal;
vertical-align: baseline;
text-align: center;
text-transform: none;
text-rendering: auto;
opacity: 0;
position: absolute;
right: 8px;
z-index: 1;
background: @component-background;
top: 50%;
2016-11-08 20:57:07 +08:00
font-size: @font-size-base;
color: @disabled-color;
width: 12px;
height: 12px;
margin-top: -6px;
line-height: 12px;
cursor: pointer;
transition: color 0.3s ease, opacity 0.15s ease;
&:before {
display: block;
.iconfont-font("\e62e");
}
&:hover {
color: @text-color-secondary;
}
}
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls} {
2015-06-09 21:16:59 +08:00
box-sizing: border-box;
display: inline-block;
position: relative;
2016-11-08 20:50:59 +08:00
color: @text-color;
2015-06-14 15:52:47 +08:00
font-size: @font-size-base;
2015-06-09 21:16:59 +08:00
> ul > li > a {
padding: 0;
background-color: @component-background;
2015-06-09 21:16:59 +08:00
}
// arrow
&-arrow {
2015-07-09 17:47:21 +08:00
.iconfont-mixin();
2015-06-09 21:16:59 +08:00
position: absolute;
top: 50%;
right: 8px;
line-height: 1;
margin-top: -6px;
.iconfont-size-under-12px(9px);
2015-07-09 17:47:21 +08:00
* {
display: none;
}
2015-06-15 19:29:32 +08:00
&:before {
content: '\e61d';
2015-07-15 15:19:04 +08:00
transition: transform 0.2s ease;
2015-06-09 21:16:59 +08:00
}
}
2015-06-11 19:23:35 +08:00
&-selection {
outline: none;
2015-06-09 21:16:59 +08:00
user-select: none;
2015-06-11 19:23:35 +08:00
box-sizing: border-box;
display: block;
background-color: @component-background;
2015-11-05 21:25:43 +08:00
border-radius: @border-radius-base;
2016-01-30 15:13:25 +08:00
border: 1px solid @border-color-base;
2016-04-19 15:15:54 +08:00
transition: all .3s @ease-in-out;
2015-06-15 11:01:15 +08:00
2015-06-11 19:23:35 +08:00
&:hover {
2015-08-31 12:20:04 +08:00
.hover;
2015-06-11 19:23:35 +08:00
}
2016-04-28 16:28:08 +08:00
.@{select-prefix-cls}-focused &,
&:focus,
2015-06-11 19:23:35 +08:00
&:active {
2015-08-31 12:20:04 +08:00
.active;
2015-06-11 19:23:35 +08:00
}
2016-02-19 16:16:49 +08:00
&__clear {
.selection__clear();
2016-02-19 16:16:49 +08:00
}
&:hover &__clear {
opacity: 1;
}
&-selected-value {
2016-10-20 11:59:38 +08:00
float: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 100%;
2016-11-17 17:08:17 +08:00
padding-right: 14px;
}
2015-06-11 19:23:35 +08:00
}
2015-06-15 19:29:32 +08:00
&-disabled {
color: @disabled-color;
2015-06-15 19:29:32 +08:00
}
&-disabled &-selection {
2016-07-21 15:02:24 +08:00
background: @background-color-base;
cursor: not-allowed;
2015-11-26 19:32:55 +08:00
&:hover,
&:focus,
2015-11-26 19:32:55 +08:00
&:active {
2016-01-30 15:13:25 +08:00
border-color: @border-color-base;
box-shadow: none;
2015-06-15 19:29:32 +08:00
}
&__clear {
display: none;
2016-05-26 16:00:55 +08:00
visibility: hidden;
pointer-events: none;
}
2015-06-15 19:29:32 +08:00
}
&-disabled &-selection--multiple &-selection__choice {
background: #e9e9e9;
color: #aaa;
padding-right: 10px;
&__remove {
display: none;
}
2016-01-05 11:45:13 +08:00
}
2015-06-11 19:23:35 +08:00
&-selection--single {
height: @input-height-base;
2016-04-27 17:57:35 +08:00
position: relative;
2015-06-11 19:23:35 +08:00
cursor: pointer;
}
2015-06-09 21:16:59 +08:00
&-selection__rendered {
display: block;
margin-left: 8px;
margin-right: 8px;
position: relative;
line-height: 26px;
// https://github.com/ant-design/ant-design/issues/3481#issuecomment-254721026
&:after {
content: '.';
visibility: hidden;
pointer-events: none;
display: inline-block;
width: 0;
2015-06-09 21:16:59 +08:00
}
}
2015-06-09 21:16:59 +08:00
2015-08-10 15:39:50 +08:00
&-lg {
2016-08-17 13:47:23 +08:00
.@{select-prefix-cls}-selection--single {
height: @input-height-lg;
2015-08-08 19:11:10 +08:00
}
.@{select-prefix-cls}-selection__rendered {
line-height: 30px;
}
2016-08-17 13:47:23 +08:00
.@{select-prefix-cls}-selection--multiple {
min-height: @input-height-lg;
2016-08-17 13:47:23 +08:00
.@{select-prefix-cls}-selection__rendered {
2015-08-10 15:39:50 +08:00
li {
2015-08-08 19:11:10 +08:00
height: 24px;
2016-02-25 11:49:40 +08:00
line-height: 24px;
2015-08-08 19:11:10 +08:00
}
}
}
}
2015-08-10 15:39:50 +08:00
&-sm {
2016-08-17 13:47:23 +08:00
.@{select-prefix-cls}-selection {
border-radius: @border-radius-sm;
}
2016-08-17 13:47:23 +08:00
.@{select-prefix-cls}-selection--single {
height: @input-height-sm;
}
.@{select-prefix-cls}-selection__rendered {
line-height: 20px;
2015-08-08 19:11:10 +08:00
}
2016-08-17 13:47:23 +08:00
.@{select-prefix-cls}-selection--multiple {
min-height: @input-height-sm;
2016-08-17 13:47:23 +08:00
.@{select-prefix-cls}-selection__rendered {
2015-08-10 15:39:50 +08:00
li {
2015-08-08 19:11:10 +08:00
height: 14px;
2016-02-25 11:49:40 +08:00
line-height: 14px;
2015-08-08 19:11:10 +08:00
}
}
}
}
2015-07-14 20:16:05 +08:00
&-disabled &-selection__choice__remove {
color: @disabled-color;
2015-07-14 20:16:05 +08:00
cursor: default;
&:hover {
color: @disabled-color;
2015-07-14 20:16:05 +08:00
}
}
2015-09-17 19:31:52 +08:00
&-search__field__wrap {
display: inline-block;
position: relative;
}
&-selection__placeholder,
&-search__field__placeholder { // for TreeSelect compatibility
position: absolute;
2016-02-25 11:49:40 +08:00
top: 50%;
left: 0;
right: 9px;
color: @input-placeholder-color;
2016-02-25 11:49:40 +08:00
line-height: 20px;
height: 20px;
max-width: 100%;
2016-02-25 11:49:40 +08:00
margin-top: -10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&-search__field__placeholder {
left: 8px;
}
2015-07-14 20:16:05 +08:00
&-search--inline {
position: absolute;
height: 100%;
2015-07-14 20:16:05 +08:00
2016-10-14 15:47:08 +08:00
.@{select-prefix-cls}-selection--multiple & {
float: left;
position: static;
}
2015-09-17 19:31:52 +08:00
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
height: 100%;
2015-09-17 19:31:52 +08:00
}
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-search__field {
2015-11-26 19:32:55 +08:00
border: 0;
2015-07-14 20:16:05 +08:00
font-size: 100%;
height: 100%;
width: 100%;
2015-07-14 20:16:05 +08:00
background: transparent;
outline: 0;
2016-02-02 12:27:22 +08:00
border-radius: @border-radius-base;
2015-07-14 20:16:05 +08:00
}
2016-05-27 15:00:22 +08:00
.@{select-prefix-cls}-search__field__mirror {
position: absolute;
top: 0;
2016-10-24 11:34:50 +08:00
left: -9999px;
2016-05-27 15:00:22 +08:00
white-space: pre;
2016-06-01 11:23:14 +08:00
pointer-events: none;
2016-05-27 15:00:22 +08:00
}
2015-07-14 20:16:05 +08:00
> i {
float: right;
}
}
2015-06-09 21:16:59 +08:00
&-selection--multiple {
min-height: @input-height-base;
2015-06-09 21:16:59 +08:00
cursor: text;
padding-bottom: 3px;
.clearfix;
2015-06-09 21:16:59 +08:00
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-search--inline {
2015-07-15 19:59:54 +08:00
width: auto;
padding: 0;
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-search__field {
2015-07-15 19:59:54 +08:00
width: 0.75em;
}
}
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-selection__rendered {
margin-left: 5px;
margin-bottom: -3px;
height: auto;
}
> ul > li,
.@{select-prefix-cls}-selection__rendered > ul > li { // for tree-select
margin-top: 3px;
height: 20px;
line-height: 20px;
2015-06-15 19:29:32 +08:00
}
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-selection__choice {
2015-06-09 21:16:59 +08:00
background-color: #f3f3f3;
border-radius: 4px;
cursor: default;
float: left;
2016-10-14 15:40:39 +08:00
padding: 0 16px;
2015-06-09 21:16:59 +08:00
margin-right: 4px;
max-width: 99%;
position: relative;
2015-12-02 14:59:48 +08:00
overflow: hidden;
transition: padding .3s @ease-in-out;
2015-12-16 22:34:03 +08:00
padding: 0 20px 0 10px;
&__disabled {
padding: 0 10px;
}
}
.@{select-prefix-cls}-selection__choice__content {
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
transition: margin .3s @ease-in-out;
2015-06-09 21:16:59 +08:00
}
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-selection__choice__remove {
2015-07-08 22:07:15 +08:00
.iconfont-mixin();
color: @text-color-secondary;
2016-02-25 11:49:40 +08:00
line-height: inherit;
2015-06-09 21:16:59 +08:00
cursor: pointer;
display: inline-block;
font-weight: bold;
2015-12-16 22:34:03 +08:00
transition: all 0.3s @ease-in-out;
.iconfont-size-under-12px(8px);
position: absolute;
right: 4px;
2015-12-02 14:59:48 +08:00
padding: 0 0 0 8px;
2015-06-09 21:16:59 +08:00
&:hover {
2015-12-16 22:24:24 +08:00
color: #404040;
2015-06-09 21:16:59 +08:00
}
2015-07-08 22:07:15 +08:00
&:before {
content: "\e633";
2015-07-08 22:07:15 +08:00
}
2015-06-09 21:16:59 +08:00
}
}
2015-08-23 15:42:38 +08:00
&-open {
.@{select-prefix-cls}-arrow {
2015-11-13 18:04:39 +08:00
.ie-rotate(2);
-ms-transform: rotate(180deg);
2015-08-31 12:20:04 +08:00
&:before {
transform: rotate(180deg);
2015-08-31 12:20:04 +08:00
}
}
2015-08-23 15:42:38 +08:00
.@{select-prefix-cls}-selection {
.active();
2015-07-20 21:32:31 +08:00
}
}
2015-08-23 15:42:38 +08:00
&-combobox {
.@{select-prefix-cls}-arrow {
2015-08-20 17:27:40 +08:00
display: none;
}
2015-08-23 15:42:38 +08:00
.@{select-prefix-cls}-search--inline {
height: 100%;
width: 100%;
2015-08-23 15:42:38 +08:00
float: none;
}
.@{select-prefix-cls}-search__field__wrap {
width: 100%;
height: 100%;
}
.@{select-prefix-cls}-search__field {
width: 100%;
height: 100%;
position: relative;
z-index: 1;
2016-02-02 12:27:22 +08:00
transition: all .3s @ease-in-out;
2016-05-13 23:16:59 +08:00
box-shadow: none;
2015-08-23 15:42:38 +08:00
}
}
}
.@{select-prefix-cls}-dropdown {
2015-11-11 12:00:54 +08:00
&.slide-up-enter.slide-up-enter-active&-placement-bottomLeft,
&.slide-up-appear.slide-up-appear-active&-placement-bottomLeft {
2015-10-22 18:27:17 +08:00
animation-name: antSlideUpIn;
}
2015-11-11 12:00:54 +08:00
&.slide-up-enter.slide-up-enter-active&-placement-topLeft,
&.slide-up-appear.slide-up-appear-active&-placement-topLeft {
2015-10-22 18:27:17 +08:00
animation-name: antSlideDownIn;
}
2015-11-11 12:00:54 +08:00
&.slide-up-leave.slide-up-leave-active&-placement-bottomLeft {
2015-10-22 18:27:17 +08:00
animation-name: antSlideUpOut;
}
2015-11-11 12:00:54 +08:00
&.slide-up-leave.slide-up-leave-active&-placement-topLeft {
2015-10-22 18:27:17 +08:00
animation-name: antSlideDownOut;
}
2015-08-23 15:42:38 +08:00
&-hidden {
display: none;
}
background-color: @component-background;
2015-12-02 11:53:37 +08:00
box-shadow: @box-shadow-base;
2015-11-06 16:06:18 +08:00
border-radius: @border-radius-base;
2015-08-23 15:42:38 +08:00
box-sizing: border-box;
2016-03-28 16:01:37 +08:00
z-index: @zindex-dropdown;
2015-08-23 15:42:38 +08:00
left: -9999px;
top: -9999px;
position: absolute;
outline: none;
overflow: hidden;
2015-08-24 16:07:44 +08:00
font-size: @font-size-base;
2015-08-23 15:42:38 +08:00
&-menu {
2015-06-09 21:16:59 +08:00
outline: none;
2015-08-23 15:42:38 +08:00
margin-bottom: 0;
padding-left: 0; // Override default ul/ol
list-style: none;
max-height: 250px;
overflow: auto;
2015-07-14 20:16:05 +08:00
2015-08-23 15:42:38 +08:00
&-item-group-list {
margin: 0;
padding: 0;
> .@{select-prefix-cls}-dropdown-menu-item {
padding-left: 24px;
2015-07-14 20:16:05 +08:00
}
2015-08-23 15:42:38 +08:00
}
2015-07-14 20:16:05 +08:00
2015-08-23 15:42:38 +08:00
&-item-group-title {
color: @text-color-secondary;
2015-08-23 15:42:38 +08:00
line-height: 1.5;
2016-10-14 15:40:39 +08:00
padding: 8px 16px;
2015-08-23 15:42:38 +08:00
}
2015-08-01 17:51:55 +08:00
2015-08-23 15:42:38 +08:00
&-item {
position: relative;
display: block;
2016-10-14 15:40:39 +08:00
padding: 7px 16px;
2015-08-23 15:42:38 +08:00
font-weight: normal;
2016-11-08 20:50:59 +08:00
color: @text-color;
2015-08-23 15:42:38 +08:00
white-space: nowrap;
cursor: pointer;
2015-12-31 16:52:05 +08:00
white-space: nowrap;
2015-09-24 22:16:28 +08:00
overflow: hidden;
transition: background 0.3s ease;
2015-08-01 17:51:55 +08:00
2015-11-26 19:32:55 +08:00
&:hover,
&-active {
background-color: @primary-1;
}
2015-08-23 15:42:38 +08:00
&-disabled {
color: @disabled-color;
2015-08-23 15:42:38 +08:00
cursor: not-allowed;
2015-07-14 20:16:05 +08:00
2015-08-23 15:42:38 +08:00
&:hover {
color: @disabled-color;
background-color: @component-background;
2015-07-14 20:16:05 +08:00
cursor: not-allowed;
}
2015-08-23 15:42:38 +08:00
}
2015-07-14 20:16:05 +08:00
&-selected {
&,
&:hover {
2016-07-21 15:02:24 +08:00
background-color: @background-color-base;
font-weight: bold;
2016-11-08 20:50:59 +08:00
color: @text-color;
}
}
2015-08-23 15:42:38 +08:00
&-divider {
height: 1px;
margin: 1px 0;
overflow: hidden;
background-color: #e5e5e5;
line-height: 0;
2015-07-14 20:16:05 +08:00
}
}
}
&&--multiple {
.@{select-prefix-cls}-dropdown-menu-item {
&:after {
.iconfont-font("\e632");
color: transparent;
.iconfont-size-under-12px(10px);
transition: all 0.2s ease;
position: absolute;
2016-10-21 20:21:40 +08:00
top: 50%;
transform: translateY(-50%);
2016-10-14 15:40:39 +08:00
right: 16px;
font-weight: bold;
text-shadow: 0 0.1px 0, 0.1px 0 0, 0 -0.1px 0, -0.1px 0;
}
&:hover:after {
color: #ddd;
}
&-disabled:after {
display: none;
}
&-selected:after,
&-selected:hover:after {
color: @primary-color;
display: inline-block;
}
}
}
2015-11-26 19:32:55 +08:00
&-container-open,
&-open {
2015-08-20 16:55:42 +08:00
.@{select-prefix-cls}-dropdown {
2015-07-14 20:16:05 +08:00
display: block;
2015-06-09 21:16:59 +08:00
}
}
2015-06-14 15:52:47 +08:00
}