naive-ui/styles/InputNumber.scss

290 lines
9.4 KiB
SCSS
Raw Normal View History

@import './mixins/mixins.scss';
2020-02-11 14:44:29 +08:00
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
}
@include e(minus-button, add-button) {
width: map-get($--n-input-number-button-width, $size);
}
@include e(input) {
font-size: map-get($--n-font-size, $size);
padding: 0 map-get($--n-input-number-button-width, $size);
}
}
2019-10-22 16:35:44 +08:00
}
@include themes-mixin {
@include b(input-number) {
2020-02-21 16:48:45 +08:00
@include once {
position: relative;
border-radius: $--n-input-number-border-radius;
box-sizing: border-box;
width: 152px;
display: inline-block;
outline: none;
z-index: auto;
@include input-number-size-mixin('small');
@include input-number-size-mixin('medium');
@include input-number-size-mixin('large');
@include e(border-mask) {
position: absolute;
z-index: 1;
top: 0;
right: 0;
bottom: 0;
left: 0;
box-shadow: inset 0 0 0px 1px transparent;
border-radius: $--n-input-number-border-radius;
transition: box-shadow .3s $--n-ease-in-out-cubic-bezier;
pointer-events: none;
}
@include e(minus-button) {
left: 0;
border-top-left-radius: $--n-input-number-border-radius;
border-bottom-left-radius: $--n-input-number-border-radius;
2020-03-07 15:48:49 +08:00
@include b(input-number-button-border-mask) {
border-top-left-radius: $--n-input-number-border-radius;
2020-03-09 10:46:38 +08:00
border-bottom-left-radius: $--n-input-number-border-radius;
2020-03-07 15:48:49 +08:00
}
@include b(input-number-button-body) {
left: 1px;
right: 0;
@include b(icon) {
transform: translateX(-1px);
}
}
@include b(input-number-button-boundary) {
left: 0;
}
2020-02-21 16:48:45 +08:00
}
@include e(add-button) {
right: 0;
border-top-right-radius: $--n-input-number-border-radius;
border-bottom-right-radius: $--n-input-number-border-radius;
2020-03-07 15:48:49 +08:00
@include b(input-number-button-border-mask) {
border-top-right-radius: $--n-input-number-border-radius;
border-bottom-right-radius: $--n-input-number-border-radius;
}
@include b(input-number-button-body) {
right: 1px;
left: 0;
@include b(icon) {
transform: translateX(1px);
}
}
@include b(input-number-button-boundary) {
right: 0;
}
2020-02-21 16:48:45 +08:00
}
}
2019-10-22 16:35:44 +08:00
@include m(disabled) {
@include e(minus-button, add-button) {
2020-03-07 15:48:49 +08:00
@include b(input-number-button-body) {
background-color: map-get($--input-number-button-background-color, 'disabled');
}
@include b(input-number-button-boundary) {
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');
2020-02-07 20:04:20 +08:00
stroke: map-get($--input-number-button-text-color, 'disabled');
2019-12-12 15:41:18 +08:00
}
2020-02-21 16:48:45 +08:00
@include once {
pointer-events: none;
}
2019-10-22 16:35:44 +08:00
}
@include e(input) {
2020-01-29 16:14:59 +08:00
&::placeholder {
color: map-get( $--input-placeholder-color, 'disabled');
}
2019-10-22 16:35:44 +08:00
background: map-get($--input-number-background-color, 'disabled');
color: map-get($--input-number-text-color, 'disabled');
2020-02-21 16:48:45 +08:00
@include once {
pointer-events: none;
}
}
@include once {
cursor: not-allowed;
2019-10-22 16:35:44 +08:00
}
}
2020-01-29 16:14:59 +08:00
@include m(invalid) {
@include e(input) {
2020-02-21 16:48:45 +08:00
@include once {
text-decoration: line-through;
}
text-decoration-color: $--input-number-text-decoration-color;
2020-01-29 16:14:59 +08:00
}
}
2019-10-22 16:35:44 +08:00
@include e(minus-button, add-button) {
2020-02-21 16:48:45 +08:00
@include once {
2020-03-07 15:48:49 +08:00
background-color: transparent;
overflow: hidden;
2020-02-21 16:48:45 +08:00
outline: none;
position: absolute;
cursor: pointer;
z-index: auto;
top: 0;
padding: 0;
border: none;
font-size: 14px;
}
2020-03-07 15:48:49 +08:00
@include b(input-number-button-border-mask) {
@include once {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
transition:
box-shadow .3s $--n-ease-in-out-cubic-bezier;
}
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'default');
}
@include b(input-number-button-body) {
@include once {
position: absolute;
top: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
}
background-color: map-get($--input-number-button-background-color, 'default');
}
@include b(input-number-button-boundary) {
@include once {
width: 1px;
position: absolute;
top: 0;
bottom: 0;
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
}
background-color: map-get($--input-number-button-background-color, 'default');
}
2019-12-12 15:41:18 +08:00
@include b(icon) {
fill: map-get($--input-number-button-text-color, 'default');
2020-02-07 20:04:20 +08:00
stroke: map-get($--input-number-button-text-color, 'default');
2019-12-12 15:41:18 +08:00
}
2019-10-22 16:35:44 +08:00
&:hover ~ {
@include e(border-mask) {
2019-10-22 16:35:44 +08:00
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'hover');
}
}
&:hover {
2020-03-07 15:48:49 +08:00
@include b(input-number-button-body) {
background-color: map-get($--input-number-button-background-color, 'hover');
}
@include b(input-number-button-boundary) {
background-color: map-get($--input-number-button-background-color, 'hover');
}
@include b(icon) {
fill:map-get($--input-number-button-text-color, 'hover');
stroke: map-get($--input-number-button-text-color, 'hover');
}
2019-10-22 16:35:44 +08:00
}
&:active {
2020-02-21 16:48:45 +08:00
@include once {
transition:
color .3s $--n-ease-in-out-cubic-bezier,
background-color .15s $--n-ease-in-out-cubic-bezier;
}
2020-03-07 15:48:49 +08:00
@include b(input-number-button-body) {
background-color: map-get($--input-number-button-background-color, 'active');
}
@include b(input-number-button-boundary) {
background-color: map-get($--input-number-button-background-color, 'active');
}
@include b(icon) {
fill:map-get($--input-number-button-text-color, 'active');
stroke: map-get($--input-number-button-text-color, 'active');
}
2019-10-22 16:35:44 +08:00
}
@include m(disabled) {
2020-02-21 16:48:45 +08:00
@include once {
cursor: not-allowed;
}
2020-03-07 15:48:49 +08:00
@include b(input-number-button-body) {
background-color: map-get($--input-number-button-background-color, 'disabled');
}
@include b(input-number-button-boundary) {
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');
2020-02-07 20:04:20 +08:00
stroke: map-get($--input-number-button-text-color, 'disabled');
2019-12-12 15:41:18 +08:00
}
2019-10-22 16:35:44 +08:00
}
}
2019-10-22 16:35:44 +08:00
@include e(input) {
2020-02-21 16:48:45 +08:00
@include once {
outline: none;
box-sizing: border-box;
border-radius: $--n-input-number-border-radius;
transition:
color .3s $--n-ease-in-out-cubic-bezier,
caret-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,
text-decoration-color .3s $--n-ease-in-out-cubic-bezier;
border: none;
width: 100%;
text-align: center;
}
2019-10-22 16:35:44 +08:00
background-color: map-get($--input-number-background-color, 'default');
box-shadow: inset 0 0 0px 1px map-get($--input-number-border-color, 'default');
2020-02-21 16:48:45 +08:00
color: map-get($--input-number-text-color, 'default');
caret-color: $--input-number-caret-color;
2020-01-29 16:14:59 +08:00
&::placeholder {
2020-02-21 16:48:45 +08:00
@include once {
transition: color .3s $--n-ease-in-out-cubic-bezier;
}
2020-01-29 16:14:59 +08:00
color: map-get( $--input-placeholder-color, 'default');
}
2019-10-22 16:35:44 +08:00
&:hover ~ {
@include e(border-mask) {
2019-10-22 16:35:44 +08:00
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-mask) {
2019-10-22 16:35:44 +08:00
box-shadow: map-get($--input-number-box-shadow, 'focus');
}
}
}
}
}
@include as-form-item {
@include with-status(error) {
@include b(input-number) {
@include e(border-mask) {
box-shadow: map-get($--input-number-box-shadow, 'error-default');
}
@include e(input) {
&:hover ~ {
@include e(border-mask) {
box-shadow: map-get($--input-number-box-shadow, 'error-hover');
}
}
&:focus {
background-color: map-get($--input-number-background-color, 'error-focus');
& ~ {
@include e(border-mask) {
box-shadow: map-get($--input-number-box-shadow, 'error-focus');
}
}
}
}
}
}
}
2019-10-22 16:35:44 +08:00
}