naive-ui/styles/Select.scss
2019-08-22 23:44:45 +08:00

428 lines
12 KiB
SCSS

@import './mixins/mixins.scss';
@import './theme/default.scss';
@include b(select) {
display: inline-block;
border: none;
outline: none;
width: 100%;
color: $select-text-color;
font-family: $default-font-family;
text-align: start;
cursor: pointer;
&.n-select--disabled {
cursor: not-allowed;
.n-select-link {
.n-select-link__label, .n-select-link__tags {
background-color: rgba(255, 255, 255, 0.08);
}
.n-select-link__tag-wrapper {
.n-select-link__tag {
border-color: rgba(255, 255, 255, 0.20);
color: rgba(255, 255, 255, 0.20);
}
}
.n-select-link__placeholder {
color: rgba(255, 255, 255, 0.20);
}
.n-select-link__label {
.n-select-link-label__input {
color: rgba(255, 255, 255, 0.20);
&::placeholder {
color: rgba(255, 255, 255, 0.20);
}
}
}
}
}
&:not(.n-select--disabled) {
.n-select-link:hover {
.n-select-link__label, .n-select-link__tags {
box-shadow: inset 0 0 0 1px $select-border-color--active;
}
}
}
.n-select-link {
position: relative;
box-shadow: none;
.n-select-link__mark {
position: absolute;
top: calc(50% - 8px);
right: 8px;
}
.n-select-link__placeholder {
pointer-events: none;
position: absolute;
left: 14px;
top: 0;
color: $select-placeholder-color;
opacity: 1;
&.n-select-link__placeholder--verbose-transition {
transition: opacity .3s $slow-out-cubic-bezier;
}
}
.n-select-link__tag-wrapper {
width: 100%;
}
.n-select-link__label, .n-select-link__tags {
position: relative;
transition: box-shadow .3s $default-cubic-bezier, background-color .3s $default-cubic-bezier;
box-sizing: border-box;
border-radius: $select-border-radius;
background-color: $select-background-color;
}
.n-select-link__label {
display: flex;
.n-select-link-label__placeholder {
vertical-align: baseline;
color: $select-placeholder-color;
padding: 0 28px 0 14px;
}
.n-select-link-label__input {
vertical-align: baseline;
display: inline-block;
border:none;
width: 100%;
cursor: inherit;
background: transparent;
outline: none;
color: $select-text-color;
padding: 0 32px 0 14px;
&::placeholder {
color: $select-placeholder-color;
}
}
}
.n-select-link__tags {
padding: 4px 32px 0 14px;
display: flex;
flex-wrap: wrap;
align-items: center;
.n-select-link__tag {
vertical-align: bottom;
box-sizing: border-box;
position: relative;
display: inline-block;
border: 1px solid #63E2B7FF;
color: #63E2B7FF;
border-radius: 4px;
margin-right: 7px;
margin-bottom: 4px;
font-size: 14px;
max-width: 100%;
.n-select-link-tag__content {
transform: translateY(-1px);
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.n-select-link-tag__icon {
position: absolute;
right: 4px;
top: 50%;
transform: translateY(-50%);
i::before {
color: #63E2B7FF;
}
}
/**
* transition of tag in tags
*/
&.n-select-menu__tags--transition-enter, &.n-select-menu__tags--transition-leave-to {
opacity: 0!important;
}
&.n-select-menu__tags--transition-enter-active {
transition: opacity .3s $default-cubic-bezier;
opacity: 1;
}
&.n-select-menu__tags--transition-leave-active {
transition: opacity .3s $default-cubic-bezier;
opacity: 1;
// transition: opacity 3s $default-cubic-bezier;
position: absolute!important;
transform: translateY(0)!important;
top: 4px!important;
}
&.n-select-menu__tags--transition-move {
transition: transform .3s $default-cubic-bezier;
}
}
}
&.n-select-link--selected {
.n-select-link__placeholder {
opacity: 0;
&.n-select-link__placeholder--verbose-transition {
transition: opacity .3s $fast-in-cubic-bezier;
}
}
}
&.n-select-link--active {
.n-select-link__label, .n-select-link__tags {
box-shadow: inset 0 0 0 1px $select-border-color--active, 0px 0px 10px 1px #366555;
background-color: $select-background-color--active;
}
}
}
&.n-select--small-size {
font-size: 13px;
.n-select-link {
.n-select-link__placeholder {
height: $small-height;
line-height: $small-height;
}
.n-select-link__tags {
min-height: $small-height;
.n-select-link__tag {
font-size: 13px;
padding: 0px 20px 0 7px;
height: 20px;
line-height: 20px;
}
.n-select-input-tag {
height: 20px;
line-height: 20px;
}
}
.n-select-link__label {
height: $small-height;
line-height: $small-height;
.n-select-lint-label__input {
height: $small-height;
line-height: $small-height;
}
}
}
}
&.n-select--default-size, &.n-select--medium-size {
font-size: 14px;
.n-select-link {
.n-select-link__placeholder {
height: $default-height;
line-height: $default-height;
}
.n-select-link__tags {
min-height: $default-height;
.n-select-link__tag {
padding: 0px 20px 0 7px;
height: 26px;
line-height: 26px;
}
.n-select-input-tag {
height: 26px;
line-height: 26px;
}
}
.n-select-link__label {
height: $default-height;
line-height: $default-height;
.n-select-lint-label__input {
height: $default-height;
line-height: $default-height;
}
}
}
}
&.n-select--large-size {
.n-select-link__placeholder {
height: $large-height;
line-height: $large-height;
}
.n-select-link__tags {
min-height: 32px;
.n-select-link__tag {
padding: 0px 20px 0 7px;
height: 32px;
line-height: 32px;
}
.n-select-input-tag {
height: 32px;
line-height: 32px;
}
}
.n-select-link {
.n-select-link__label{
height: $large-height;
line-height: $large-height;
.n-select-lint-label__input {
height: $large-height;
line-height: $large-height;
}
}
}
}
}
.n-select-menu__content-wrapper {
@include detachedContentWrapper;
transform: translateZ(0);
.n-select-menu__content {
@include detachedContent;
border-radius: 6px;
.n-select-menu-wrapper {
margin-top: 4px;
margin-bottom: 4px;
@include fade-in-scale-up-transition(select-menu);
.n-select-menu {
z-index: 0;
position: relative;
overflow: hidden;
border-radius: 6px;
background-color: rgba(75, 81, 106, 1);
box-shadow: 0px 2px 20px 0px rgba(0,0,0,0.16);
.n-select-menu__item-wrapper {
position: relative;
width: 100%;
}
.n-select-menu__item {
cursor: pointer;
position: relative;
padding: 0px 14px;
white-space: nowrap;
&.n-select-menu__item--disabled {
color: rgba(255, 255, 255, .3)!important;
&::after {
display: none;
}
&.n-select-menu__item--selected {
color: rgba(99, 226, 183, .3)!important;
&::after {
border-right: 1px solid rgba(99, 226, 183, .3);
border-bottom: 1px solid rgba(99, 226, 183, .3);
display: block;
}
}
cursor: not-allowed;
}
&.n-select-menu__item--selected {
color: #63E2B7FF;
}
&.n-select-menu__item--no-data {
color: rgba(255, 255, 255, .5);
text-align: center;
pointer-events: none;
}
&.n-select-menu__item--not-found {
color: rgba(255, 255, 255, .5);
text-align: center;
pointer-events: none;
}
&.n-select-menu__item--loading {
color: rgba(255, 255, 255, .5);
text-align: center;
pointer-events: none;
}
}
.n-select-menu__light-bar {
position: absolute;
width:100%;
background-color: $select-item-background-color--active;
top: 0;
left: 0;
transition: top .15s $default-cubic-bezier;
}
&.n-select-menu--small-size {
.n-scrollbar-container {
max-height: $small-height * 7.6;
}
.n-select-menu__item, .n-select-menu__light-bar {
height: $small-height;
line-height: $small-height;
font-size: 13px;
}
}
&.n-select-menu--default-size, &.n-select-menu--medium-size {
.n-scrollbar-container {
max-height: $default-height * 7.6;
}
.n-select-menu__item, .n-select-menu__light-bar {
height: $default-height;
line-height: $default-height;
font-size: 14px;
}
}
&.n-select-menu--large-size {
.n-select-menu__item, .n-select-menu__light-bar {
height: $large-height;
line-height: $large-height;
}
.n-scrollbar-container {
max-height: $large-height * 7.6;
}
}
&.n-select-menu--multiple {
.n-select-menu__item {
position: relative;
transition: color .3s $default-cubic-bezier;
padding-right: 28px;
&::after {
content: '';
height: 6px;
width: 3px;
border-right: 1px solid #63E2B7FF;
border-bottom: 1px solid #63E2B7FF;
position: absolute;
right: 14px;
transform: rotate(45deg) scale(.5);
top: calc(50% - 4px);
opacity: 0;
transition: transform .3s $default-cubic-bezier, opacity .3s $default-cubic-bezier;
}
&.n-select-menu__item--selected {
background: none;
&::after {
opacity: 1;
transform: rotate(45deg) scale(1);
}
}
&:active {
color: #63E2B7FF;
}
}
}
}
}
/** transition of menu light bar */
.n-select-menu__light-bar--transition-enter-active {
transition: opacity .15s $fast-in-cubic-bezier, top .3s $default-cubic-bezier!important;
}
.n-select-menu__light-bar--transition-leave-active {
transition: opacity .15s $slow-out-cubic-bezier, top .3s $default-cubic-bezier!important;
}
.n-select-menu__light-bar--transition-enter, .n-select-menu__light-bar--transition-leave-to {
opacity: 0;
}
}
}
@include b(select-input-tag) {
position: relative;
margin-bottom: 4px;
display: inline-block;
max-width: 100%;
vertical-align: bottom;
.n-select-input-tag__input {
padding: 0;
background-color: transparent;
outline: none;
border: none;
max-width: 100%;
caret-color: $input-caret-color;
color: $select-text-color;
height: 100%;
width: 1em;
line-height: inherit;
cursor: pointer;
}
.n-select-input-tag__mirror {
position: absolute;
padding-right: .5em;
left: 0;
top: 0;
white-space: pre;
visibility: hidden;
user-select: none;
opacity: 0;
}
}