kui-vue
Version:
A lightweight desktop UI component library suitable for Vue.js 2.
597 lines (512 loc) • 10.5 kB
text/less
@import "../../styles/var.less";
.k-select {
display: inline-flex;
min-width: 0;
min-width: 80px;
box-sizing: border-box;
vertical-align: middle;
color: var(--kui-color-font);
font-size: 14px;
position: relative;
outline: none;
box-sizing: border-box;
// flex-shrink: 0;
align-items: center;
background-color: var(--kui-color-back);
border-radius: var(--kui-border-radius);
border: 1px solid var(--kui-color-border);
padding: 0 8px;
transition: border 0.3s ease-in-out;
line-height: 1.571;
position: relative;
// max-width: 100%;
&:not(.k-select-disabled, .k-select-borderless):focus {
outline: 2px solid var(--kui-color-main-80);
outline-offset: 1px;
}
&:hover {
border-color: var(--kui-color-main);
box-shadow: 0 0 0 2px var(--kui-color-main-90);
}
&-selection {
box-sizing: border-box;
outline: 0;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
position: relative;
min-height: 30px;
position: relative;
display: inline-flex;
align-items: center;
width: 100%;
max-width: 100%;
overflow: hidden;
height: 100%;
box-sizing: border-box;
contain: layout;
}
.k-select-icon {
font-size: 16px;
color: var(--kui-color-icon);
margin-right: 5px;
}
&-search-wrap {
position: absolute;
z-index: 1;
background: none;
overflow: hidden;
max-width: 100%;
.k-select-search {
border: none;
width: 7px;
min-width: 7px;
height: 22px;
padding: 0;
background: none;
outline: none;
font-size: 14px;
color: var(--kui-color-font);
}
}
&-labels {
transition: font-size 0.25s ease-in-out;
overflow: hidden;
display: flex;
flex-wrap: wrap;
gap: 3px;
margin: 3px 0;
.k-select-tag {
padding: 2px 5px;
border: 1px solid var(--kui-color-border);
background-color: var(--kui-color-border);
border-radius: var(--kui-border-radius);
display: inline-flex;
align-items: center;
font-size: 12px;
position: relative;
line-height: 18px;
transition: all 0.25s ease-in-out;
.k-icon {
// position: absolute;
// right: 3px;
font-size: 16px;
text-align: center;
display: block;
// top: 50%;
// transform: translateY(-50%);
}
}
.k-select-search-wrap {
display: inline-block;
position: relative;
transform: none;
left: 0;
top: 0;
margin: 0;
vertical-align: middle;
}
}
&-search-mirror {
opacity: 0;
white-space: pre;
pointer-events: none;
position: absolute;
left: 0;
top: 0;
z-index: 1;
font-size: 12px;
}
&-placeholder {
font-size: 14px;
z-index: 0;
line-height: 1.571;
overflow: hidden;
text-overflow: ellipsis;
color: var(--kui-color-disabled);
white-space: nowrap;
max-width: 100%;
box-sizing: border-box;
transition: font-size 0.25s ease-in-out;
line-height: 1;
}
&-label {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border: none;
background: transparent;
box-sizing: border-box;
width: 100%;
line-height: 1.571;
cursor: pointer;
font-size: 14px;
transition: font-size 0.25s ease-in-out;
}
&-arrow {
font-size: 14px;
box-sizing: border-box;
transform: rotate(0deg);
transform-origin: center;
transition: transform 0.3s ease-in-out;
transition: font-size 0.25s ease-in-out;
color: var(--kui-color-icon);
margin-left: 8px;
#chevron-up {
transform: rotate(180deg);
}
}
.k-select-suffix {
display: flex;
align-items: center;
}
&-clearable {
position: absolute;
right: 8px;
font-size: 14px;
color: var(--kui-color-icon);
display: none;
cursor: pointer;
&:hover {
color: var(--kui-color-font);
}
}
.k-select-search-mirror,
.k-select-search {
font-size: 14px;
color: var(--kui-color-font);
}
&.k-select-circle {
border-radius: 30px;
}
&:not(.k-select-disabled) .k-select-tag .k-icon :hover {
color: var(--kui-color-danger);
}
}
.k-select-show-tags {
padding-left: 4px;
.k-select-icon {
margin-left: 4px;
}
}
.k-select-show-search {
.k-select-placeholder {
position: absolute;
}
}
.k-select-multiple {
.k-select-placeholder {
position: absolute;
}
}
.k-select-light {
&.k-select {
border-color: transparent;
background: var(--kui-color-gray-80);
transition: none;
// box-shadow: none;
&:hover {
box-shadow: none;
border-color: transparent;
}
.k-select-tag {
background-color: var(--kui-color-gray-80);
border-color: transparent;
}
}
&:focus .k-select {
box-shadow: none;
border-color: transparent;
}
}
.k-select-block {
width: 100%;
}
.k-select-dropdown {
user-select: none;
border-radius: var(--kui-border-radius);
width: inherit;
max-height: 200px;
overflow: auto;
background-color: var(--kui-color-back-10);
box-sizing: border-box;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
position: absolute;
z-index: 1003;
padding: 5px;
box-sizing: border-box;
border: 1px solid var(--kui-color-gray-80);
ul {
padding: 0;
margin: 0;
list-style: none;
left: 0;
}
.k-select-loading {
padding: 10px;
font-size: 14px;
color: var(--kui-color-font);
display: flex;
align-items: center;
.k-icon {
font-size: 14px;
}
span {
margin-left: 8px;
}
}
.k-select-item {
margin: 0;
line-height: 1;
padding: 8px 8px;
clear: both;
color: var(--kui-color-font);
font-size: 14px;
white-space: nowrap;
list-style: none;
width: 100%;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
position: relative;
border-radius: @radius;
margin-bottom: 1px;
&:not(.k-select-item-disabled):hover {
background: var(--kui-color-hover);
}
&:not(.k-select-item-disabled):active {
background: var(--kui-color-active);
}
.k-icon {
position: absolute;
top: 0;
right: 9px;
font-size: 15px;
top: 50%;
transform: translateY(-50%);
display: none;
color: var(--kui-color-icon);
}
&:hover .k-icon,
.k-icon {
display: block;
}
}
.k-select-item-active {
background: var(--kui-color-hover);
}
.k-select-item-selected {
background: var(--kui-color-selected);
font-weight: 500;
&:hover {
background: var(--kui-color-selected);
}
.k-icon {
color: var(--kui-color-main);
display: block;
}
}
.k-select-item-disabled {
background: var(--kui-color-disable-back);
color: var(--kui-color-disabled);
cursor: not-allowed;
}
}
.k-select-dropdown-multiple {
.k-select-item {
padding-right: 31px;
}
}
.k-select-dropdown-sm {
.k-select-item {
font-size: 12px;
}
}
.k-select-sm {
padding: 0 var(--kui-padding-inline-sm);
.k-select-icon {
font-size: 14px;
margin-right: 3px;
}
.k-select-selection {
min-height: 22px;
}
&.k-select-show-tags {
padding-left: 2px;
.k-select-icon {
margin-left: 2px;
}
}
.k-select-arrow {
font-size: 12px;
margin-left: 4px;
}
.k-select-clearable {
right: 4px;
font-size: 12px;
}
.k-select-label {
line-height: 22px;
height: 22px;
// padding-right: 23px;
font-size: 12px;
}
.k-select-placeholder {
font-size: 12px;
}
.k-select-search-wrap {
.k-select-search {
height: 12px;
font-size: 12px;
}
}
.k-select-labels {
gap: 2px;
margin: 2px 0;
.k-select-tag {
padding: 1px 5px;
line-height: 1;
.k-icon {
font-size: 14px;
}
}
.k-select-search-wrap {
padding: 2px 0;
.k-select-search {
font-size: 12px;
height: 12px;
line-height: 12px;
left: 0;
float: left;
}
}
}
.k-select-search-mirror,
.k-select-search {
font-size: 12px;
color: var(--kui-color-font);
}
}
.k-select-lg {
.k-select-placeholder {
font-size: 16px;
}
.k-select-selection {
font-size: 16px;
min-height: 38px;
}
.k-select-icon {
font-size: 18px;
}
.k-select-arrow {
font-size: 18px;
}
.k-select-clearable {
font-size: 18px;
}
.k-select-label {
line-height: 38px;
height: 38px;
font-size: 16px;
}
.k-select-search-wrap {
.k-select-search {
height: 28px;
}
}
.k-select-labels {
.k-select-tag {
padding: 7px;
font-size: 14px;
line-height: 1;
.k-icon {
font-size: 16px;
}
}
.k-select-search-wrap {
.k-select-search {
height: 28px;
line-height: 28px;
left: 0;
float: left;
font-size: 16px;
}
}
}
}
.k-select-opened {
border-color: var(--kui-color-main);
box-shadow: 0 0 0 2px var(--kui-color-main-90);
.k-select-label {
opacity: 0.5;
}
&.k-select-light .k-select-selection {
box-shadow: none;
border-color: transparent;
}
}
.k-select-disabled {
color: var(--kui-color-disabled);
background: var(--kui-color-disable-back);
.k-select-label {
cursor: not-allowed;
}
* {
cursor: not-allowed;
}
.k-select-arrow {
color: var(--kui-color-disable-border);
}
&:hover,
&:focus {
border-color: var(--kui-color-disable-border);
box-shadow: none;
}
}
.k-select-has-clear {
&:hover {
.k-select-clearable {
display: block;
}
.k-select-arrow {
opacity: 0;
}
}
}
.k-select-borderless {
border-color: transparent;
background-color: transparent;
box-shadow: none;
&:hover,
&:focus {
border-color: transparent;
box-shadow: none;
}
.k-select-selection {
box-shadow: none;
border-color: transparent;
background-color: transparent;
}
}
@keyframes drop-down {
0% {
opacity: 0;
transform: scaleY(0);
}
to {
opacity: 1;
transform: scaleY(1);
}
}
.k-select-enter-active {
transform-origin: 0 0;
animation: drop-down 0.3s;
}
.k-select-leave-active {
transform-origin: 0 0;
animation: drop-down 0.3s reverse;
}