naive-ui/styles/Input.scss

161 lines
3.8 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%;
.n-input__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-08-23 14:20:10 +08:00
.n-input__cancel-mark {
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
}
.n-input__input, .n-input__textarea {
-webkit-appearance: none;
2019-06-14 14:46:13 +08:00
box-sizing: border-box;
border: none;
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-08-23 14:20:10 +08:00
&.n-input--small-size {
&:not(.n-input--textarea) {
height: $small-height;
}
.n-input__textarea {
font-size: $small-input-font-size;
}
.n-input__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-06-18 18:09:42 +08:00
font-size: $small-input-font-size;
}
2019-08-23 14:20:10 +08:00
}
&.n-input--default-size, &.n-input--medium-size {
&:not(.n-input--textarea) {
height: $default-height;
}
.n-input__textarea {
font-size: $default-input-font-size;
}
.n-input__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-06-18 18:09:42 +08:00
font-size: $default-input-font-size;
}
2019-08-23 14:20:10 +08:00
}
&.n-input--large-size {
&:not(.n-input--textarea) {
height: $large-height;
}
.n-input__textarea {
font-size: $large-input-font-size;
}
.n-input__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-06-18 18:09:42 +08:00
font-size: $large-input-font-size;
}
2019-06-14 14:46:13 +08:00
}
2019-08-23 14:20:10 +08:00
&.n-input--round {
&.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
}
}
}
&.n-input--icon {
.n-input__input {
2019-08-23 15:59:50 +08:00
padding-left: 38px!important;
}
2019-08-23 14:20:10 +08:00
}
&.n-input--disabled {
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-08-23 14:20:10 +08:00
&.n-input--clearable {
.n-input__input, .n-input__textarea {
2019-08-23 15:59:50 +08:00
padding-right: 32px;
2019-08-23 14:20:10 +08:00
}
}
2019-06-17 19:58:09 +08:00
.n-input__textarea {
padding: 10px 14px;
2019-06-14 15:25:50 +08:00
resize: vertical;
2019-07-26 18:09:39 +08:00
@include scrollbar;
2019-06-18 18:09:42 +08:00
&.n-input__textarea--small-size {
font-size: $small-input-font-size;
}
&.n-input__textarea--default-size, &.n-input__input--medium-size {
font-size: $default-input-font-size;
}
&.n-input__textarea--large-size {
font-size: $large-input-font-size;
}
2019-06-14 14:46:13 +08:00
}
}