mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
236 lines
6.4 KiB
SCSS
236 lines
6.4 KiB
SCSS
@import './mixins/mixins.scss';
|
|
@import './themes/vars.scss';
|
|
|
|
@mixin input-size-mixin ($size) {
|
|
$font-size: map-get($map: $--n-font-size, $key: $size);
|
|
$height: map-get($map: $--n-height, $key: $size);
|
|
$line-height: round($font-size * 1.5);
|
|
@include m($size + "-size") {
|
|
font-size: $font-size;
|
|
line-height: $line-height;
|
|
@include e(input) {
|
|
height: $height;
|
|
}
|
|
@include e(input, textarea, textarea-mirror, splitor) {
|
|
padding-left: 14px;
|
|
padding-right: 14px;
|
|
line-height: $line-height;
|
|
font-size: $font-size;
|
|
padding-top: ($height - $line-height) / 2;
|
|
padding-bottom: ($height - $line-height) / 2;
|
|
}
|
|
@include m(suffix) {
|
|
@include not-m(split) {
|
|
@include e(input) {
|
|
padding-right: 38px!important;
|
|
}
|
|
}
|
|
@include m(split) {
|
|
@include e(input) {
|
|
&:not(:first-child) {
|
|
padding-right: 38px!important;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@include m(affix) {
|
|
@include not-m(split) {
|
|
@include e(input) {
|
|
padding-left: 38px!important;
|
|
}
|
|
}
|
|
@include m(split) {
|
|
@include e(input) {
|
|
&:first-child {
|
|
padding-left: 38px!important;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@include m(clearable) {
|
|
@include not-m(split) {
|
|
@include e(input) {
|
|
padding-right: 38px!important;
|
|
}
|
|
}
|
|
@include m(split) {
|
|
@include e(input) {
|
|
&:not(:first-child) {
|
|
padding-right: 38px!important;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@include m(round) {
|
|
@include not-m(textarea) {
|
|
@include e(input) {
|
|
padding-left: $height / 2;
|
|
padding-right: $height / 2;
|
|
}
|
|
border-radius: $height / 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@include themes-mixin {
|
|
@include b(input) {
|
|
@include once {
|
|
outline: none;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
width: 100%;
|
|
display: inline-block;
|
|
border-radius: $--input-border-radius;
|
|
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier, background-color .3s $--n-ease-in-out-cubic-bezier;
|
|
@include input-size-mixin("small");
|
|
@include input-size-mixin("medium");
|
|
@include input-size-mixin("large");
|
|
@include e(suffix, affix) {
|
|
transition: opacity .3s $--n-ease-in-out-cubic-bezier;
|
|
position: absolute;
|
|
line-height: $--input-icon-size;
|
|
height: $--input-icon-size;
|
|
width: $--input-icon-size;
|
|
@include b(icon) {
|
|
font-size: $--input-icon-size;
|
|
}
|
|
top: calc(50% - 9px);
|
|
}
|
|
@include e(suffix) {
|
|
right: 12px;
|
|
}
|
|
@include e(affix) {
|
|
left: 12px;
|
|
}
|
|
@include e(cancel-mark) {
|
|
position: absolute;
|
|
right: 14px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
line-height: 12px;
|
|
}
|
|
@include e(textarea, textarea-mirror) {
|
|
display: inline-block;
|
|
vertical-align: bottom;
|
|
box-sizing: border-box;
|
|
font-family: inherit;
|
|
font-size: inherit;
|
|
line-height: 1.5;
|
|
margin: 0;
|
|
resize: vertical;
|
|
}
|
|
@include e(textarea) {
|
|
@include m(autosize) {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100%;
|
|
resize: none;
|
|
}
|
|
}
|
|
@include e(textarea-mirror) {
|
|
overflow: hidden;
|
|
visibility: hidden;
|
|
position: static;
|
|
white-space: pre-wrap;
|
|
overflow-wrap: break-word;
|
|
}
|
|
@include m(split) {
|
|
display: inline-flex;
|
|
@include e(input) {
|
|
text-align: center;
|
|
}
|
|
}
|
|
}
|
|
background-color: map-get($--input-background-color, 'default');
|
|
box-shadow: map-get($--input-box-shadow, 'default');
|
|
&:hover {
|
|
box-shadow: map-get($--input-box-shadow, 'hover');
|
|
}
|
|
@include m(focus) {
|
|
box-shadow: map-get($--input-box-shadow, 'focus');
|
|
background-color: map-get($--input-background-color, 'focus');
|
|
}
|
|
@include m(textarea) {
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
@include e(textarea, textarea-mirror) {
|
|
padding-left: 14px;
|
|
padding-right: 14px;
|
|
}
|
|
}
|
|
@include e(suffix, affix) {
|
|
opacity: 1;
|
|
@include m(hide) {
|
|
opacity: 0;
|
|
}
|
|
@include b(icon) {
|
|
fill: $--input-icon-color;
|
|
}
|
|
}
|
|
@include e(input, textarea) {
|
|
@include once {
|
|
-webkit-appearance: none;
|
|
box-sizing: border-box;
|
|
border: none;
|
|
font-size: inherit;
|
|
outline: none;
|
|
font-family: $--n-font-family;
|
|
width: 100%;
|
|
transition: color .3s $--n-ease-in-out-cubic-bezier, text-decoration-color .3s $--n-ease-in-out-cubic-bezier;
|
|
}
|
|
color: map-get($--input-color, 'default');
|
|
caret-color: map-get($--input-caret-color, 'default');
|
|
background-color: transparent;
|
|
&::placeholder {
|
|
transition: color .3s $--n-ease-in-out-cubic-bezier;
|
|
color: map-get($--input-placeholder-color, 'default');
|
|
opacity: 1;
|
|
}
|
|
}
|
|
@include e(splitor) {
|
|
transition: color .3s $--n-ease-in-out-cubic-bezier;
|
|
color: map-get($--input-color, 'default');
|
|
padding-left: 0px;
|
|
padding-right: 0px;
|
|
}
|
|
@include m(disabled) {
|
|
cursor: not-allowed;
|
|
box-shadow: map-get($--input-box-shadow, 'disabled') !important;
|
|
background-color: map-get($--input-background-color, 'disabled');
|
|
@include e(input, textarea) {
|
|
cursor: not-allowed;
|
|
color: map-get($--input-color, 'disabled');
|
|
&::placeholder {
|
|
color: map-get($--input-placeholder-color, 'disabled');
|
|
}
|
|
}
|
|
@include e(suffix, affix) {
|
|
@include b(icon) {
|
|
fill: map-get($--input-placeholder-color, 'disabled');
|
|
}
|
|
}
|
|
@include e(splitor) {
|
|
color: map-get($--input-color, 'disabled');
|
|
}
|
|
}
|
|
}
|
|
@include as-form-item {
|
|
@include with-status(error) {
|
|
@include b(input) {
|
|
box-shadow: map-get($--input-box-shadow, 'error-default');
|
|
&:hover {
|
|
box-shadow: map-get($--input-box-shadow, 'error-hover');
|
|
}
|
|
@include m(focus) {
|
|
box-shadow: map-get($--input-box-shadow, 'error-focus');
|
|
background-color: map-get($--input-background-color, 'error-focus');
|
|
}
|
|
@include e(input, textarea) {
|
|
caret-color: map-get($--input-caret-color, 'error');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |