amis2/scss/components/form/_number.scss
AegeanSeaBlue 7f29c70a5a
fix: input-number圆角显示可能不完整,数字颜色跟随主题 (#3471)
Co-authored-by: AegeanSeaBlue <2285105697@qq.com>
2022-03-01 10:46:52 +08:00

203 lines
4.1 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);
overflow: hidden;
@include input-border();
&.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);
color: var(--Form-input-color);
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;
}
.#{$ns}Number--borderHalf,
.#{$ns}Number--borderNone {
.#{$ns}Number-handler-wrap {
border-left: none;
}
}
.#{$ns}NumberControl--withUnit {
display: flex;
.#{$ns}Number {
flex-grow: 1;
}
.#{$ns}Select {
border-left: 0;
}
}