amis/scss/components/form/_number.scss
吴多益 35711ace89
feat:增加 animation-duration,可以控制所有动画时长,也能用于一次性关闭所有动画效果 (#1303)
* feat:增加 animation-duration,可以控制所有动画时长,也能用于一次性关闭所有动画效果

* 补充文档
2021-01-04 16:45:43 +08:00

183 lines
3.8 KiB
SCSS

.#{$ns}Number {
margin: 0;
padding: 0;
line-height: var(--Form-input-height);
font-size: var(--Form-input-fontSize);
height: var(--Form-input-height);
display: inline-block;
vertical-align: middle;
background: var(--Number-bg);
border: var(--Number-borderWidth) solid var(--Number-borderColor);
border-radius: var(--Number-borderRadius);
&.no-steps > &-handler-wrap {
display: none;
}
&-focused {
border-color: var(--Form-input-onFocused-borderColor);
box-shadow: var(--Form-input-boxShadow);
}
&-handler {
text-align: center;
overflow: hidden;
display: block;
touch-action: none;
&-active {
background: #ddd;
}
}
&-handler-up-inner,
&-handler-down-inner {
user-select: none;
-webkit-user-select: none;
display: inline-block;
}
&:hover {
border-color: var(--Form-input-onFocused-borderColor);
.#{$ns}Number-handler-up,
.#{$ns}Number-handler-wrap {
border-color: var(--Form-input-onFocused-borderColor);
}
}
&-disabled:hover {
border-color: var(--Form-input-borderColor);
.#{$ns}Number-handler-up,
.#{$ns}Number-handler-wrap {
border-color: var(--Form-input-borderColor);
}
}
&-input-wrap {
overflow: hidden;
height: 100%;
}
&-input {
width: 100%;
background: transparent;
text-align: left;
vertical-align: top;
outline: 0;
-moz-appearance: textfield;
line-height: calc(var(--Form-input-height) - var(--Number-borderWidth) * 2);
height: 100%;
transition: all var(--animation-duration) ease;
border: 0;
border-radius: var(--Form-input-borderRadius);
padding: 0 var(--Form-input-paddingX);
}
&-handler {
background: var(--Number-handler-bg);
color: var(--Number-handler-color);
font-family: var(--Number-handler-fontFamily);
font-size: var(--Number-handler-fontSize);
&:hover {
background: var(--Number-handler-onHover-bg);
color: var(--Number-handler-onHover-color);
}
&:hover:active {
background: var(--Number-handler-onActive-bg);
}
}
&-handler-up {
&-inner {
transform: var(--Number-handler--up-transform);
&:after {
content: var(--Number-handler--up-content);
}
}
}
&-handler-down {
&-inner {
&:after {
content: var(--Number-handler--down-content);
}
}
}
@if $Number-handler-mode==vertical {
&-handler-wrap {
float: right;
border-left: px2rem(1px) solid var(--Form-input-borderColor);
width: var(--Number-handler-width);
height: 100%;
}
&-handler {
line-height: calc((var(--Form-input-height) - #{px2rem(6px)}) / 2);
height: calc(
(var(--Form-input-height) - var(--Number-borderWidth) * 2) / 2
);
}
&-handler-up {
border-bottom: var(--Number-handler-borderBottom);
padding-top: px2rem(1px);
}
} @else {
position: relative;
&-input {
text-align: center;
}
&-handler-up,
&-handler-down {
position: absolute;
width: var(--Number-handler-width);
height: 100%;
top: 0;
}
&-handler-down {
left: 0;
}
&-handler-up {
right: 0;
}
}
&-handler-down-disabled,
&-handler-up-disabled {
background: var(--Number-handler-onDisabled-bg);
pointer-events: none;
color: var(--Number-handler-onDisabled-color);
}
&-disabled {
.#{$ns}Number-input {
opacity: 0.72;
cursor: not-allowed;
background: var(--Number-onDisabled-bg);
}
.#{$ns}Number-handler {
opacity: 0.72;
&:hover {
color: var(--text--muted-color);
border-color: var(--Form-input-borderColor);
}
}
}
}
.#{$ns}NumberControl:not(.is-inline) > .#{$ns}Number {
display: block;
}