naive-ui/styles/Input.scss

188 lines
4.7 KiB
SCSS
Raw Normal View History

2019-06-14 14:46:13 +08:00
@import './mixins/mixins.scss';
@import './theme/default.scss';
@include b(input) {
position: relative;
2019-06-24 15:11:27 +08:00
width: 100%;
2019-09-12 11:56:49 +08:00
display: inline-block;
vertical-align: baseline;
2019-09-13 16:17:46 +08:00
@include e(icon) {
position: absolute;
line-height: 18px;
height: 18px;
width: 18px;
2019-07-03 18:43:11 +08:00
i {
height: 18px;
width: 18px;
&::before {
font-size: 20px;
line-height: 18px;
height: 18px;
width: 18px;
color: $input-icon-color;
}
}
left: 0;
2019-07-03 18:43:11 +08:00
top: calc(50% - 9px);
2019-06-25 11:09:11 +08:00
margin-left: 12px;
}
2019-09-13 16:17:46 +08:00
@include e(cancel-mark) {
2019-08-23 14:20:10 +08:00
position: absolute;
2019-08-23 15:59:50 +08:00
right: 14px;
2019-08-23 14:20:10 +08:00
top: 50%;
transform: translateY(-50%);
2019-08-23 15:59:50 +08:00
line-height: 12px;
2019-08-23 14:20:10 +08:00
}
2019-09-13 16:17:46 +08:00
@include e(input, textarea) {
-webkit-appearance: none;
2019-06-14 14:46:13 +08:00
box-sizing: border-box;
border: none;
2019-09-13 16:17:46 +08:00
font-size: inherit;
2019-06-25 11:09:11 +08:00
border-radius: $input-border-radius;
2019-06-14 14:46:13 +08:00
outline: none;
color: #fff;
font-family: $default-font-family;
2019-06-25 11:09:11 +08:00
background-color: $input-background-color;
width: 100%;
2019-06-25 11:09:11 +08:00
caret-color: $input-caret-color;
box-shadow: none;
2019-06-24 18:05:00 +08:00
transition: box-shadow .3s $default-cubic-bezier, background-color .3s $default-cubic-bezier;
2019-08-23 14:20:10 +08:00
vertical-align: bottom;
2019-06-24 18:05:00 +08:00
&:focus:hover {
2019-06-25 11:09:11 +08:00
box-shadow: inset 0 0 0px 1px $main-color, 0px 0px 10px 1px #366555;
2019-06-24 18:05:00 +08:00
}
&:hover {
2019-06-25 11:09:11 +08:00
box-shadow: inset 0 0 0px 1px $main-color;
2019-06-24 18:05:00 +08:00
}
2019-06-21 10:57:07 +08:00
&:focus {
2019-06-25 11:09:11 +08:00
box-shadow: inset 0 0 0px 1px $main-color;
2019-06-25 14:59:26 +08:00
background-color: $focus-input-background-color;
2019-06-25 11:09:11 +08:00
}
&::placeholder {
color: $input-placeholder-color;
opacity: 1;
2019-06-21 10:57:07 +08:00
}
}
2019-09-13 16:17:46 +08:00
@include m(small-size) {
font-size: $small-input-font-size;
2019-08-23 14:20:10 +08:00
&:not(.n-input--textarea) {
height: $small-height;
2019-09-12 11:56:49 +08:00
line-height: $small-height;
2019-08-23 14:20:10 +08:00
}
2019-09-13 16:17:46 +08:00
@include e(input) {
2019-06-18 18:09:42 +08:00
height: $small-height;
line-height: $small-height;
2019-06-25 11:09:11 +08:00
padding: 0 14px;
2019-09-13 16:17:46 +08:00
}
@include e(textarea, textarea-mirror) {
$height: round($small-input-font-size * 1.5);
line-height: $height;
2019-06-18 18:09:42 +08:00
font-size: $small-input-font-size;
2019-09-13 16:17:46 +08:00
padding-top: ($small-height - $height) / 2;
padding-bottom: ($small-height - $height) / 2;
2019-06-18 18:09:42 +08:00
}
2019-08-23 14:20:10 +08:00
}
2019-09-13 16:17:46 +08:00
@include m(medium-size) {
font-size: $default-input-font-size;
2019-08-23 14:20:10 +08:00
&:not(.n-input--textarea) {
height: $default-height;
2019-09-12 11:56:49 +08:00
line-height: $default-height;
2019-08-23 14:20:10 +08:00
}
2019-09-13 16:17:46 +08:00
@include e(input) {
2019-06-18 18:09:42 +08:00
height: $default-height;
line-height: $default-height;
2019-06-25 11:09:11 +08:00
padding: 0 14px;
2019-09-13 16:17:46 +08:00
}
@include e(textarea, textarea-mirror) {
$height: round($medium-input-font-size * 1.5);
line-height: $height;
font-size: $medium-input-font-size;
padding-top: ($medium-height - $height) / 2;
padding-bottom: ($medium-height - $height) / 2;
2019-06-18 18:09:42 +08:00
}
2019-08-23 14:20:10 +08:00
}
2019-09-13 16:17:46 +08:00
@include m(large-size) {
font-size: $large-input-font-size;
2019-08-23 14:20:10 +08:00
&:not(.n-input--textarea) {
height: $large-height;
2019-09-12 11:56:49 +08:00
line-height: $large-height;
2019-08-23 14:20:10 +08:00
}
2019-09-13 16:17:46 +08:00
@include e(input) {
2019-06-18 18:09:42 +08:00
height: $large-height;
line-height: $large-height;
2019-06-25 11:09:11 +08:00
padding: 0 14px;
2019-09-13 16:17:46 +08:00
}
@include e(textarea, textarea-mirror) {
$height: round($large-input-font-size * 1.5);
line-height: $height;
2019-06-18 18:09:42 +08:00
font-size: $large-input-font-size;
2019-09-13 16:17:46 +08:00
padding-top: ($large-height - $height) / 2;
padding-bottom: ($large-height - $height) / 2;
2019-06-18 18:09:42 +08:00
}
2019-06-14 14:46:13 +08:00
}
2019-09-13 20:48:27 +08:00
@include m(round) {
2019-08-23 14:20:10 +08:00
&.n-input--small-size {
2019-08-23 15:59:50 +08:00
.n-input__input {
2019-08-23 14:20:10 +08:00
border-radius: $small-height / 2;
2019-08-23 15:59:50 +08:00
padding-left: $small-height / 2;
2019-08-23 14:20:10 +08:00
}
}
2019-08-23 14:20:10 +08:00
&.n-input--default-size, &.n-input--medium-size {
2019-08-23 15:59:50 +08:00
.n-input__input {
2019-08-23 14:20:10 +08:00
border-radius: $default-height / 2;
2019-08-23 15:59:50 +08:00
padding-left: $default-height / 2;
2019-08-23 14:20:10 +08:00
}
}
&.n-input--large-size {
2019-08-23 15:59:50 +08:00
.n-input__input {
2019-08-23 14:20:10 +08:00
border-radius: $large-height / 2;
2019-08-23 15:59:50 +08:00
padding-left: $large-height / 2;
2019-08-23 14:20:10 +08:00
}
}
}
2019-09-13 20:48:27 +08:00
@include m(icon) {
2019-08-23 14:20:10 +08:00
.n-input__input {
2019-08-23 15:59:50 +08:00
padding-left: 38px!important;
}
2019-08-23 14:20:10 +08:00
}
2019-09-13 20:48:27 +08:00
@include m(disabled) {
2019-08-23 14:20:10 +08:00
cursor: not-allowed;
.n-input__input, .n-input__textarea {
cursor: not-allowed;
background-color: $disabled-input-background-color;
color: $disabled-input-text-color;
box-shadow: none!important;
&::placeholder {
color: $disabled-input-placeholder-color;
}
}
}
2019-09-13 20:48:27 +08:00
@include m(clearable) {
@include e(input, textarea, textarea-mirror) {
2019-08-23 15:59:50 +08:00
padding-right: 32px;
2019-08-23 14:20:10 +08:00
}
}
2019-09-13 16:17:46 +08:00
@include e(textarea, textarea-mirror) {
font-family: inherit;
font-size: inherit;
line-height: 1.5;
2019-09-12 12:09:11 +08:00
margin: 0;
2019-09-13 16:17:46 +08:00
padding-left: 14px;
padding-right: 14px;
2019-06-14 15:25:50 +08:00
resize: vertical;
2019-09-13 16:17:46 +08:00
}
@include e(textarea) {
@include m(autosize) {
position: absolute;
top: 0;
left: 0;
height: 100%;
2019-06-18 18:09:42 +08:00
}
2019-06-14 14:46:13 +08:00
}
2019-09-13 16:17:46 +08:00
@include e(textarea-mirror) {
visibility: hidden;
position: static;
white-space: pre-wrap;
overflow-wrap: break-word;
}
2019-06-14 14:46:13 +08:00
}