naive-ui/styles/Select.scss

322 lines
9.0 KiB
SCSS
Raw Normal View History

2019-06-14 17:39:56 +08:00
@import './mixins/mixins.scss';
@import './theme/default.scss';
2019-06-14 19:33:41 +08:00
@include b(select) {
2019-06-14 17:39:56 +08:00
display: inline-block;
border: none;
outline: none;
width: 100%;
2019-06-25 14:59:26 +08:00
color: $select-text-color;
2019-06-14 17:39:56 +08:00
font-family: $default-font-family;
2019-06-27 11:02:01 +08:00
text-align: start;
2019-06-14 17:39:56 +08:00
cursor: pointer;
2019-06-17 18:06:42 +08:00
.n-select-link {
2019-06-14 17:39:56 +08:00
position: relative;
2019-06-25 14:59:26 +08:00
box-shadow: none;
2019-06-14 17:39:56 +08:00
&::after {
2019-06-25 14:59:26 +08:00
transition: transform .3s $default-cubic-bezier, border-color .3s $default-cubic-bezier;
2019-06-14 17:39:56 +08:00
position: absolute;
content: '';
width: 6px;
height: 6px;
border-left: 1px solid rgba(255, 255, 255, .4);
border-bottom: 1px solid rgba(255, 255, 255, .4);
right: 14px;
2019-06-14 17:39:56 +08:00
top: calc(50% - 5px);
transform: rotate(-45deg);
transform-origin: 25% 75%;
}
.n-select-link__placeholder {
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;
}
}
2019-06-25 14:59:26 +08:00
.n-select-link__label, .n-select-link__tags {
position: relative;
2019-06-25 14:59:26 +08:00
transition: box-shadow .3s $default-cubic-bezier, background-color .3s $default-cubic-bezier;
box-sizing: border-box;
2019-06-25 14:59:26 +08:00
border-radius: $select-border-radius;
background-color: $select-background-color;
}
.n-select-link__label {
display: flex;
.n-select-link-label__placeholder {
vertical-align: baseline;
2019-06-25 14:59:26 +08:00
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: pointer;
background: transparent;
outline: none;
color: $select-text-color;
padding: 0 28px 0 14px;
&::placeholder {
color: $select-placeholder-color;
}
2019-06-14 17:39:56 +08:00
}
}
2019-06-17 18:06:42 +08:00
.n-select-link__tags {
padding: 4px 20px 0 14px;
display: flex;
flex-wrap: wrap;
align-items: center;
.n-select-link__tag {
2019-06-25 14:59:26 +08:00
box-sizing: border-box;
position: relative;
display: inline-block;
border: 1px solid #63E2B7FF;
color: #63E2B7FF;
border-radius: 4px;
margin-right: 7px;
2019-06-25 14:59:26 +08:00
margin-bottom: 4px;
font-size: 14px;
transition: opacity .3s $default-cubic-bezier, transform .3s $default-cubic-bezier;
2019-06-19 14:46:41 +08:00
.n-select-link-tag__content {
transform: translateY(-1px);
}
.n-select-link-tag__icon {
position: absolute;
2019-06-25 14:59:26 +08:00
right: 4px;
top: 50%;
transform: translateY(-50%);
i::before {
color: #63E2B7FF;
}
}
}
2019-06-14 19:33:41 +08:00
}
2019-06-17 18:06:42 +08:00
.n-select-menu {
2019-06-20 12:46:29 +08:00
z-index: 1;
2019-06-14 17:39:56 +08:00
overflow: hidden;
position: absolute;
top: calc(100% + 4px);
overflow-y: auto;
left: 0;
right: 0;
2019-06-14 17:39:56 +08:00
border-radius: 9px;
background-color: rgba(75, 81, 106, 1);
box-shadow: 0px 2px 20px 0px rgba(0,0,0,0.16);
@include scrollbar;
2019-06-26 19:25:19 +08:00
.n-select-menu__light-bar {
position: absolute;
width:100%;
background-color: rgba(96, 220, 178, 0.3);
top: 0;
left: 0;
z-index: -1;
transition: top .3s $default-cubic-bezier;
2019-06-26 19:25:19 +08:00
}
&.n-select-menu--multiple {
.n-select-menu__item {
2019-06-26 19:25:19 +08:00
position: relative;
transition: color .3s $default-cubic-bezier;
&::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;
}
2019-07-03 18:43:11 +08:00
&.n-select-menu__item--selected, &:active {
background: none;
&::after {
2019-06-26 19:25:19 +08:00
opacity: 1;
transform: rotate(45deg) scale(1);
}
2019-06-19 14:32:42 +08:00
}
&:active {
color: #63E2B7FF;
}
}
}
2019-06-17 18:06:42 +08:00
.n-select-menu__item {
padding: 0px 14px;
2019-07-03 18:43:11 +08:00
&.n-select-menu__item--selected {
color: #63E2B7FF;
}
2019-07-03 18:43:11 +08:00
&.n-select-menu__item--not-found {
color: rgba(255, 255, 255, .5);
text-align: center;
}
2019-06-14 17:39:56 +08:00
}
}
2019-06-25 14:59:26 +08:00
&:hover {
.n-select-link__label, .n-select-link__tags {
box-shadow: inset 0 0 0 1px $select-border-color--active;
}
2019-06-25 14:59:26 +08:00
}
&.n-select-link--selected {
.n-select-link__placeholder {
opacity: 0;
&.n-select-link__placeholder--verbose-transition {
transition: opacity .3s $fast-in-cubic-bezier;
}
}
}
2019-06-25 14:59:26 +08:00
&.n-select-link--active {
&::after {
transform: rotate(135deg);
border-left: 1px solid #63E2B7FF;
2019-06-25 14:59:26 +08:00
border-bottom: 1px solid #63E2B7FF;
}
.n-select-link__label, .n-select-link__tags {
2019-06-25 14:59:26 +08:00
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 {
2019-06-26 19:25:19 +08:00
min-height: $small-height;
.n-select-link__tag {
padding: 0px 20px 0 7px;
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-menu {
max-height: $small-height * 8;
2019-06-26 19:25:19 +08:00
.n-select-menu__item, .n-select-menu__light-bar {
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 {
2019-06-26 19:25:19 +08:00
min-height: $default-height;
.n-select-link__tag {
padding: 0px 20px 0 7px;
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-menu {
max-height: $default-height * 8;
2019-06-26 19:25:19 +08:00
.n-select-menu__item, .n-select-menu__light-bar {
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 {
2019-06-26 19:25:19 +08:00
min-height: 32px;
.n-select-link__tag {
padding: 0px 20px 0 7px;
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 {
2019-06-26 19:25:19 +08:00
.n-select-menu__item, .n-select-menu__light-bar {
height: $large-height;
line-height: $large-height;
}
max-height: $large-height * 8;
}
2019-06-14 17:39:56 +08:00
}
2019-06-25 14:59:26 +08:00
/** transition of menu */
2019-06-25 14:59:26 +08:00
.n-select-menu--transition-enter-active {
transition: opacity .3s $fast-in-cubic-bezier, transform .3s $fast-in-cubic-bezier;
}
.n-select-menu--transition-leave-active {
transition: opacity .3s $slow-out-cubic-bezier, transform .3s $slow-out-cubic-bezier;
}
2019-06-26 19:25:19 +08:00
.n-select-menu--transition-enter, .n-select-menu--transition-leave-to {
2019-06-25 14:59:26 +08:00
opacity: 0;
transform: translateY(4px);
}
/** transition of menu light bar */
2019-06-26 19:25:19 +08:00
.n-select-menu__light-bar--transition-enter-active {
transition: opacity .15s $fast-in-cubic-bezier, top .3s $default-cubic-bezier!important;
2019-06-26 19:25:19 +08:00
}
.n-select-menu__light-bar--transition-leave-active {
transition: opacity .15s $slow-out-cubic-bezier, top .3s $default-cubic-bezier!important;
2019-06-26 19:25:19 +08:00
}
.n-select-menu__light-bar--transition-enter, .n-select-menu__light-bar--transition-leave-to {
opacity: 0;
}
/**
* transition of tag in tags
*/
2019-06-26 19:25:19 +08:00
.n-select-menu__tags--transition-enter, .n-select-menu__tags--transition-leave-to {
transition: opacity .3s $fast-in-cubic-bezier;
2019-06-26 19:25:19 +08:00
opacity: 0;
}
.n-select-menu__tags--transition-enter-active {
transition: opacity .3s $slow-out-cubic-bezier;
2019-06-26 19:25:19 +08:00
}
.n-select-menu__tags--transition-leave-active {
transition: opacity .3s $slow-out-cubic-bezier;
2019-06-26 19:25:19 +08:00
position: absolute!important;
// transform: translateY(0)!important;
top: 4px!important;
2019-06-26 19:25:19 +08:00
}
.n-select-menu__tags--transition-move {
transition: transform .3s $default-cubic-bezier;
2019-06-26 19:25:19 +08:00
}
2019-06-14 17:39:56 +08:00
}