amis2/scss/components/form/_range.scss

275 lines
6.0 KiB
SCSS
Raw Normal View History

.#{$ns}InputRange {
display: flex;
justify-content: space-between;
padding: var(--InputRange-padding) 0;
width: 100%;
&-wrap {
position: relative;
flex: auto;
}
&-input {
width: 20 * 4px;
height: 8 * 4px;
margin: 0 2 * 4px;
.#{$ns}Number {
overflow: hidden;
2019-12-06 09:58:08 +08:00
}
.#{$ns}Number-handler {
transition: 0.3s opacity;
color: var(--Number-handler-color);
&-up-inner,
&-down-inner {
cursor: pointer;
&:hover {
color: var(--Number-handler-onHover-color);
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
&-clear {
display: flex;
align-items: center;
cursor: pointer;
svg {
height: px2rem(12px);
width: px2rem(12px);
fill: #999;
2019-04-30 11:11:25 +08:00
}
}
2019-04-30 11:11:25 +08:00
// disabled
&.is-disabled {
.#{$ns}InputRange-track {
cursor: not-allowed;
2019-04-30 11:11:25 +08:00
}
.#{$ns}InputRange-track-active {
background-color: var(--InputRange-track-onActive-onDisabled-bg);
cursor: not-allowed;
}
2019-12-06 09:58:08 +08:00
.#{$ns}InputRange-handle-icon {
border-color: var(--InputRange-handle-onDisabled-border-color);
cursor: not-allowed;
&:hover {
transform: none;
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}
.#{$ns}Number-handler {
cursor: not-allowed;
2019-12-06 09:58:08 +08:00
&-up-inner,
&-down-inner {
cursor: not-allowed;
&:hover {
color: var(--text--muted-color);
}
}
}
}
// hander
&-handle {
2019-12-06 09:58:08 +08:00
position: absolute;
top: 0;
bottom: 0;
margin: auto 0 auto calc(var(--InputRange-handle-width) / -2);
width: var(--InputRange-handle-width);
height: var(--InputRange-handle-height);
&-icon,
&-drage {
width: 100%;
height: 100%;
appearance: none;
background-color: var(--InputRange-handle-bg);
border: var(--InputRange-handle-border);
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
outline: none;
border-radius: 50%;
transition: var(--InputRange-handle-transition);
&:hover {
transform: var(--InputRange-handle-onActive-transform);
box-shadow: var(--InputRange-handle-onFocus-boxShadow);
}
2019-12-06 09:58:08 +08:00
&:active {
transform: var(--InputRange-handle-onActive-transform);
}
&:focus {
box-shadow: var(--InputRange-handle-onFocus-boxShadow);
}
2019-04-30 11:11:25 +08:00
}
&-drage {
transform: var(--InputRange-handle-onActive-transform);
box-shadow: var(--InputRange-handle-onFocus-boxShadow);
border-width: var(--InputRange-handle-onDrage-border-width);
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
}
.icon-slider-handle {
width: var(--InputRange-handle-icon-width);
height: var(--InputRange-handle-icon-height);
top: 0;
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
// track
&-track {
background: var(--InputRange-track-bg);
border-radius: var(--InputRange-track-border-radius);
2019-12-06 09:58:08 +08:00
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
&.is-active {
background: var(--InputRange-track-onActive-bg);
transition: 0.3s all;
}
&-dot {
width: var(--InputRange-track-dot-height);
height: var(--InputRange-track-dot-height);
border-radius: 50%;
background-color: var(--InputRange-track-dot-bg);
position: absolute;
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%;
}
2019-12-06 09:58:08 +08:00
&-track-active {
background: var(--InputRange-track-onActive-bg);
border-radius: var(--InputRange-track-border-radius);
position: absolute;
height: 100%;
left: 0;
top: 0;
}
// label
&-label {
position: absolute;
padding: var(--InputRange-label-padding);
background-color: var(--InputRange-label-bg);
color: var(--InputRange-label-color);
font-size: var(--InputRange-label-font-size);
border-radius: var(--InputRange-label-border-radius);
visibility: hidden;
&-visible {
visibility: visible;
}
&.pos-top {
left: 50%;
bottom: var(--InputRange-label-position-bottom);
transform: translateX(-50%);
&::after {
content: '';
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: -4px;
border-width: 4px 4px 0 4px;
border-style: solid;
border-color: #000 transparent transparent transparent;
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
&.pos-bottom {
top: var(--InputRange-label-position-bottom);
left: 50%;
transform: translateX(-50%);
&::after {
content: '';
position: absolute;
left: 50%;
transform: translateX(-50%);
top: -4px;
border-width: 0 4px 4px 4px;
border-style: solid;
border-color: transparent transparent #000 transparent;
}
}
&.pos-left {
top: 50%;
transform: translateY(-50%) translateX(-100%) translateX(-12px);
&::after {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
right: -4px;
border-width: 4px 0 4px 4px;
border-style: solid;
border-color: transparent transparent transparent #000;
}
2019-04-30 11:11:25 +08:00
}
&.pos-right {
top: 50%;
transform: translateY(-50%) translateX(26px);
&::after {
content: '';
position: absolute;
top: 50%;
transform: translateY(-50%);
left: -4px;
border-width: 4px 4px 4px 0;
border-style: solid;
border-color: transparent #000 transparent transparent;
}
2019-04-30 11:11:25 +08:00
}
2019-12-06 09:58:08 +08:00
}
// marks
&-marks {
position: relative;
top: 8px;
div {
position: absolute;
top: 0;
span {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
}
2019-12-06 09:58:08 +08:00
}
2019-04-30 11:11:25 +08:00
}