naive-ui/styles/BasePicker.scss
2019-09-27 16:02:20 +08:00

277 lines
8.4 KiB
SCSS

@import './mixins/mixins.scss';
@import './themes/vars.scss';
@mixin base-picker-size-mixin ($size) {
$base-picker-tag-margin: 3px;
$base-picker-height: map-get($map: $--n-height, $key: $size);
@include m($size + '-size') {
font-size: map-get($map: $--n-font-size, $key: $size);
@include e(placeholder) {
height: $base-picker-height;
line-height: $base-picker-height;
}
@include b(base-picker-tags) {
min-height: $base-picker-height;
@include b(base-picker-tag) {
padding: 0px 20px 0 7px;
height: $base-picker-height - 2 * $base-picker-tag-margin;
line-height: $base-picker-height - 2 * $base-picker-tag-margin;
}
@include b(base-picker-input-tag) {
height: $base-picker-height - 2 * $base-picker-tag-margin;
line-height: $base-picker-height - 2 * $base-picker-tag-margin;
}
}
@include b(base-picker-label) {
height: $base-picker-height;
line-height: $base-picker-height;
}
}
}
@include themes-mixin {
@include b(base-picker) {
@include once {
@include base-picker-size-mixin('small');
@include base-picker-size-mixin('medium');
@include base-picker-size-mixin('large');
position: relative;
box-shadow: none;
border-radius: $--base-picker-border-radius;
width: 100%;
max-width: 100%;
display: inline-block;
vertical-align: bottom;
@include e(mark) {
cursor: pointer;
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 14px;
}
@include m(selected) {
@include e(placeholder) {
opacity: 0;
}
}
}
@include e(placeholder) {
@include once {
pointer-events: none;
position: absolute;
left: 14px;
top: 0;
opacity: 1;
}
color: map-get($--base-picker-placeholder-color, 'default');
}
@include b(base-picker-tags) {
@include once {
cursor: pointer;
outline: none;
box-sizing: border-box;
position: relative;
transition: box-shadow .3s $default-cubic-bezier, background-color .3s $default-cubic-bezier;
border-radius: $--base-picker-border-radius;
}
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "default");
background-color: map-get($--base-picker-background-color, "default");
}
@include b(base-picker-label) {
@include once {
display: inline-block;
width: 100%;
vertical-align: bottom;
cursor: pointer;
outline: none;
box-sizing: border-box;
position: relative;
transition: box-shadow .3s $default-cubic-bezier, background-color .3s $default-cubic-bezier;
border-radius: $--base-picker-border-radius;
}
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "default");
background-color: map-get($--base-picker-background-color, "default");
@include e(input) {
@include once {
outline: none;
cursor: pointer;
box-sizing: border-box;
text-overflow: ellipsis;
overflow: hidden;
border:none;
width: 100%;
white-space: nowrap;
transition: color .3s $default-cubic-bezier;
padding: 0 32px 0 14px;
background-color: transparent;
height: 100%;
}
color: $--base-picker-color;
&::placeholder {
color: map-get($--base-picker-placeholder-color, 'default');
}
@include m(placeholder) {
color: map-get($--base-picker-placeholder-color, 'default');
}
}
}
@include b(base-picker-tags) {
@include once {
display: flex;
padding: 3px 32px 0 14px;
flex-wrap: wrap;
align-items: center;
width: 100%;
vertical-align: bottom;
}
@include b(tag) {
@include once {
// vertical-align: bottom;
// box-sizing: border-box;
// position: relative;
// display: inline-block;
// border-radius: 4px;
margin-right: 7px;
margin-bottom: 3px;
font-size: 14px;
max-width: 100%;
// @include e(content) {
// transform: translateY(-1px);
// white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
// }
}
// border: 1px solid #63E2B7FF;
// color: #63E2B7FF;
// @include e(icon) {
// @include once {
// position: absolute;
// right: 4px;
// top: 50%;
// transform: translateY(-50%);
// }
// i::before {
// color: #63E2B7FF;
// }
// }
}
}
@include not-m(disabled) {
@include m(active) {
@include b(base-picker-label) {
// box-shadow: inset 0 0 0 1px $select-border-color--active, 0px 0px 10px 1px #366555;
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "active");
background-color: map-get($map: $--base-picker-background-color, $key: "active");
}
@include b(base-picker-tags) {
// box-shadow: inset 0 0 0 1px $select-border-color--active, 0px 0px 10px 1px #366555;
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "active");
background-color: map-get($map: $--base-picker-background-color, $key: "active");
}
@include once {
@include b(base-picker-input-tag) {
display: inline-block;
}
}
}
@include b(base-picker-label) {
&:hover {
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "hover");
}
&:focus {
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "focus");
}
}
@include b(base-picker-tags) {
&:hover {
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "hover");
}
&:focus {
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "focus");
}
}
@include m(focus) {
@include b(base-picker-label) {
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "focus");
}
@include b(base-picker-tags) {
box-shadow: map-get($map: $--base-picker-box-shadow, $key: "focus");
}
}
}
@include m(disabled) {
cursor: not-allowed;
@include b(base-picker-label) {
cursor: not-allowed;
background-color: map-get($map: $--base-picker-background-color, $key: "disabled");
// background-color: rgba(255, 255, 255, 0.08);
@include e(input) {
cursor: not-allowed;
color: map-get($--base-picker-placeholder-color, 'disabled');
@include m(placeholder) {
color: map-get($--base-picker-placeholder-color, 'disabled');
// color: rgba(255, 255, 255, 0.20);
}
&::placeholder {
color: map-get($--base-picker-placeholder-color, 'disabled');
}
}
}
@include b(base-picker-tags) {
cursor: not-allowed;
background-color: map-get($map: $--base-picker-background-color, $key: "disabled");
}
@include b(base-picker-tag) {
cursor: not-allowed;
border-color: rgba(255, 255, 255, 0.20);
color: rgba(255, 255, 255, 0.20);
}
@include e(placeholder) {
cursor: not-allowed;
color: map-get($--base-picker-placeholder-color, 'disabled');
}
}
@include b(base-picker-input-tag) {
@include once {
outline: none;
display: none;
position: relative;
margin-bottom: 3px;
max-width: 100%;
vertical-align: bottom;
}
@include e(input) {
@include once {
padding: 0;
background-color: transparent;
outline: none;
border: none;
max-width: 100%;
height: 100%;
width: 1em;
line-height: inherit;
cursor: pointer;
}
caret-color: $--base-picker-caret-color;
color: $--base-picker-color;
}
@include once {
@include e(mirror) {
position: absolute;
padding-right: 1em;
left: 0;
top: 0;
white-space: pre;
visibility: hidden;
user-select: none;
opacity: 0;
}
}
}
}
}