naive-ui/styles/InputNumber.scss

156 lines
5.2 KiB
SCSS
Raw Normal View History

@import './mixins/mixins.scss';
@import './themes/vars.scss';
2019-10-22 16:35:44 +08:00
@mixin input-number-size-mixin ($size) {
@include m($size + '-size') {
$height: map-get($--n-height, $size);
height: $height;
line-height: $height;
@include e(minus-button, add-button, input) {
height: $height;
line-height: $height;
}
}
2019-10-22 16:35:44 +08:00
}
@include themes-mixin {
@include b(input-number) {
position: relative;
border-radius: $--input-number-border-radius;
2019-10-29 15:32:03 +08:00
box-sizing: border-box;
2019-10-22 16:35:44 +08:00
width: 152px;
display: inline-block;
outline: none;
@include m(disabled) {
// background: map-get($--input-number-background-color, 'disabled');
@include e(minus-button, add-button) {
background: map-get($--input-number-button-background-color, 'disabled');
2019-12-12 15:41:18 +08:00
@include b(icon) {
fill: map-get($--input-number-button-text-color, 'disabled');
}
2019-10-22 16:35:44 +08:00
pointer-events: none;
}
@include e(input) {
background: map-get($--input-number-background-color, 'disabled');
color: map-get($--input-number-button-text-color, 'disabled');
pointer-events: none;
}
cursor: not-allowed;
}
2019-10-22 16:35:44 +08:00
@include input-number-size-mixin('small');
@include input-number-size-mixin('medium');
@include input-number-size-mixin('large');
@include e(border-layer) {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'default');
border-radius: $--input-number-border-radius;
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
2019-10-22 16:35:44 +08:00
pointer-events: none;
}
2019-10-22 16:35:44 +08:00
@include e(minus-button, add-button) {
outline: none;
position: absolute;
cursor: pointer;
top: 0;
padding: 0;
width: 28px;
border: none;
background-color: map-get($--input-number-button-background-color, 'default');
display: flex;
align-items: center;
justify-content: center;
2019-12-12 15:41:18 +08:00
@include b(icon) {
fill: map-get($--input-number-button-text-color, 'default');
}
2019-10-22 16:35:44 +08:00
font-size: 14px;
transition: background-color .3s $--n-ease-in-out-cubic-bezier, box-shadow .3s $--n-ease-in-out-cubic-bezier;
2019-10-22 16:35:44 +08:00
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'default');
&:hover ~ {
@include e(border-layer) {
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'hover');
}
}
&:hover {
background-color: map-get($--input-number-button-background-color, 'hover');
color: map-get($--input-number-button-text-color, 'hover');
}
&:active {
transition: color .3s $--n-ease-in-out-cubic-bezier, background-color .15s $--n-ease-in-out-cubic-bezier;
2019-10-22 16:35:44 +08:00
background-color: map-get($--input-number-button-background-color, 'active')
}
@include m(disabled) {
2019-10-30 18:10:11 +08:00
cursor: not-allowed;
2019-10-22 16:35:44 +08:00
background-color: map-get($--input-number-button-background-color, 'disabled');
2019-12-12 15:41:18 +08:00
@include b(icon) {
fill: map-get($--input-number-button-text-color, 'disabled');
}
2019-10-22 16:35:44 +08:00
}
}
2019-10-22 16:35:44 +08:00
@include e(minus-button) {
left: 0;
border-top-left-radius: $--input-number-border-radius;
border-bottom-left-radius: $--input-number-border-radius;
}
2019-10-22 16:35:44 +08:00
@include e(add-button) {
right: 0;
border-top-right-radius: $--input-number-border-radius;
border-bottom-right-radius: $--input-number-border-radius;
}
2019-10-22 16:35:44 +08:00
@include e(input) {
outline: none;
2019-10-29 15:32:03 +08:00
box-sizing: border-box;
2019-10-22 16:35:44 +08:00
border-radius: $--input-number-border-radius;
background-color: map-get($--input-number-background-color, 'default');
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'default');
&:hover ~ {
@include e(border-layer) {
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'hover');
}
}
&:focus {
background-color: map-get($--input-number-background-color, 'focus');
& ~ {
@include e(border-layer) {
box-shadow: map-get($--input-number-box-shadow, 'focus');
}
}
}
transition: color .3s $--n-ease-in-out-cubic-bezier, background-color .3s $--n-ease-in-out-cubic-bezier, box-shadow .3s $--n-ease-in-out-cubic-bezier;
2019-10-22 16:35:44 +08:00
border: none;
color: map-get($--input-number-text-color, 'default');
2019-10-29 15:32:03 +08:00
width: 100%;
2019-10-22 16:35:44 +08:00
text-align: center;
padding: 0 34px;
caret-color: $--input-number-caret-color;
}
}
@include as-form-item {
@include with-status(error) {
@include b(input-number) {
@include e(border-layer) {
box-shadow: map-get($--input-number-box-shadow, 'error-default');
}
@include e(input) {
&:hover ~ {
@include e(border-layer) {
box-shadow: map-get($--input-number-box-shadow, 'error-hover');
}
}
&:focus {
background-color: map-get($--input-number-background-color, 'error-focus');
& ~ {
@include e(border-layer) {
box-shadow: map-get($--input-number-box-shadow, 'error-focus');
}
}
}
}
}
}
}
2019-10-22 16:35:44 +08:00
}