amis2/scss/components/form/_range.scss

214 lines
4.1 KiB
SCSS
Raw Normal View History

2019-04-30 11:11:25 +08:00
.#{$ns}RangeControl {
2019-12-06 09:58:08 +08:00
position: relative;
@include clearfix();
2019-12-06 09:58:08 +08:00
padding-top: 1rem;
padding-bottom: 1.1rem;
2019-12-06 09:58:08 +08:00
&--withInput {
2019-04-30 11:11:25 +08:00
.#{$ns}InputRange {
2019-12-06 09:58:08 +08:00
width: calc(100% - 120px);
}
2019-12-06 09:58:08 +08:00
.#{$ns}InputRange-label--mid {
left: calc(50% - 60px);
}
2019-12-06 09:58:08 +08:00
&.is-multiple {
.#{$ns}InputRange {
width: calc(100% - 210px);
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}InputRange {
&-input {
font-size: var(--fontSizeSm);
2019-12-06 09:58:08 +08:00
position: absolute;
right: px2rem(26px);
top: px2rem(12px);
height: px2rem(30px);
2019-12-06 09:58:08 +08:00
input {
padding: px2rem(10px);
width: px2rem(74px);
height: 100%;
2019-12-06 09:58:08 +08:00
&:focus {
outline: none;
border: var(--borderWidth) solid var(--info);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-12-06 09:58:08 +08:00
&-separator {
display: inline-block;
padding: 0 5px;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&-unit {
position: absolute;
right: px2rem(10px);
top: px2rem(7px);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&-clear {
position: absolute;
top: px2rem(18px);
right: 0;
cursor: pointer;
svg {
height: px2rem(16px);
width: px2rem(16px);
fill: #999;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}InputRange {
height: var(--InputRange-slider-height);
2019-12-06 09:58:08 +08:00
position: relative;
width: 100%;
// slider
&-slider {
appearance: none;
background: var(--InputRange-slider-bg);
border: var(--InputRange-slider-border);
2019-12-06 09:58:08 +08:00
// border-radius: 100%;
cursor: pointer;
display: block;
width: var(--InputRange-slider-width);
height: var(--InputRange-slider-height);
margin-left: calc(var(--InputRange-slider-width) / -2);
margin-top: calc(
var(--InputRange-slider-height) / -2 + var(--InputRange-track-height) / -2
);
2019-12-06 09:58:08 +08:00
outline: none;
position: absolute;
z-index: 2;
top: 50%;
transition: var(--InputRange-slider-transition);
2019-12-06 09:58:08 +08:00
&:active {
transform: var(--InputRange-slider-onActive-transform);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&:focus {
box-shadow: var(--InputRange-slider-onFocus-boxShadow);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
.input-range--disabled & {
background: var(--InputRange-slider-onDisabled-bg);
border: var(--InputRange-slider-onDisabled-border);
2019-12-06 09:58:08 +08:00
box-shadow: none;
transform: none;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&:before {
content: '||';
color: #fff;
display: block;
line-height: px2rem(22px);
text-align: center;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
&-sliderContainer {
transition: var(--InputRange-sliderContainer-transition);
2019-12-06 09:58:08 +08:00
}
// label
&-label {
color: var(--InputRange-label-color);
font-size: var(--InputRange-label-fontSize);
2019-12-06 09:58:08 +08:00
transform: translateZ(0);
white-space: nowrap;
}
&-label--min,
&-label--max,
&-label--mid {
bottom: var(--InputRange-label-positionBottom);
2019-12-06 09:58:08 +08:00
position: absolute;
}
&-label--mid {
left: 50%;
bottom: calc(var(--gap-xs) * -1);
2019-12-06 09:58:08 +08:00
}
&-label--max {
right: 0;
}
&-label--value {
position: absolute;
display: var(--InputRange-label--value-display);
top: var(--InputRange-label--value-positionTop);
left: var(--InputRange-label--value-positionLeft);
2019-12-06 09:58:08 +08:00
}
// label Container
// &-labelContainer {
// left: -50%;
// position: relative;
// .#{$ns}InputRange-label--max & {
// left: 50%;
// }
// }
// track
&-track {
background: var(--InputRange-track-bg);
2019-12-06 09:58:08 +08:00
// border-radius: 0;
cursor: pointer;
display: block;
height: var(--InputRange-track-height);
2019-12-06 09:58:08 +08:00
position: relative;
transition: var(--InputRange-track-transition);
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
.#{$ns}InputRange.is-disabled & {
background: var(--InputRange-track-onDisabled-bg);
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&.is-active {
background: var(--InputRange-track-onActive-bg);
2019-12-06 09:58:08 +08:00
}
}
&-track--background {
left: 0.5rem;
margin-top: calc(-0.5 * var(--InputRange-track-height));
2019-12-06 09:58:08 +08:00
position: absolute;
right: 0.5rem;
top: 50%;
&::before,
&::after {
content: '';
width: 0.5rem;
height: 100%;
position: absolute;
top: 0;
background: inherit;
z-index: 1;
}
2019-04-30 11:11:25 +08:00
2019-12-06 09:58:08 +08:00
&::before {
left: -0.5rem;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
&::after {
right: -0.5rem;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
&-track--active {
background: var(--InputRange-track-onActive-bg);
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}