mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
using `range-left` and `range-right` inside of `ion-range` will place the element to the left or right of the range. references #5422
175 lines
4.1 KiB
SCSS
175 lines
4.1 KiB
SCSS
@import "../../globals.md";
|
|
|
|
// Material Design Range
|
|
// --------------------------------------------------
|
|
|
|
$range-md-padding-vertical: 8px !default;
|
|
$range-md-padding-horizontal: 8px !default;
|
|
|
|
$range-md-slider-height: 42px !default;
|
|
|
|
$range-md-hit-width: 42px !default;
|
|
$range-md-hit-height: $range-md-slider-height !default;
|
|
|
|
$range-md-bar-height: 2px !default;
|
|
$range-md-bar-background-color: #bdbdbd !default;
|
|
$range-md-bar-active-background-color: color($colors-md, primary) !default;
|
|
|
|
$range-md-knob-width: 12px !default;
|
|
$range-md-knob-height: $range-md-knob-width !default;
|
|
$range-md-knob-background-color: $range-md-bar-active-background-color !default;
|
|
|
|
$range-md-tick-width: 2px !default;
|
|
$range-md-tick-height: $range-md-tick-width !default;
|
|
$range-md-tick-border-radius: 50% !default;
|
|
$range-md-tick-background-color: #000 !default;
|
|
$range-md-tick-active-background-color: $range-md-tick-background-color !default;
|
|
|
|
$range-md-pin-background-color: $range-md-bar-active-background-color !default;
|
|
$range-md-pin-color: color-contrast($colors-md, $range-md-bar-active-background-color) !default;
|
|
$range-md-pin-font-size: 12px !default;
|
|
$range-md-pin-padding: 8px !default;
|
|
|
|
|
|
ion-range {
|
|
padding: $range-md-padding-vertical $range-md-padding-horizontal;
|
|
}
|
|
|
|
.range-has-pin {
|
|
padding-top: $range-md-padding-vertical + $range-md-pin-font-size + $range-md-pin-padding;
|
|
}
|
|
|
|
.range-slider {
|
|
height: $range-md-slider-height;
|
|
}
|
|
|
|
.range-bar {
|
|
position: absolute;
|
|
top: ($range-md-slider-height / 2);
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
height: $range-md-bar-height;
|
|
|
|
background: $range-md-bar-background-color;
|
|
|
|
pointer-events: none;
|
|
}
|
|
|
|
.range-pressed .range-bar-active {
|
|
will-change: left, right;
|
|
}
|
|
|
|
.range-pressed .range-knob-handle {
|
|
will-change: left;
|
|
}
|
|
|
|
.range-bar-active {
|
|
bottom: 0;
|
|
|
|
width: auto;
|
|
|
|
background: $range-md-bar-active-background-color;
|
|
}
|
|
|
|
.range-knob-handle {
|
|
position: absolute;
|
|
top: ($range-md-slider-height / 2);
|
|
left: 0%;
|
|
|
|
margin-top: -($range-md-hit-height / 2);
|
|
margin-left: -($range-md-hit-width / 2);
|
|
|
|
width: $range-md-hit-width;
|
|
height: $range-md-hit-height;
|
|
|
|
text-align: center;
|
|
}
|
|
|
|
.range-knob {
|
|
position: absolute;
|
|
|
|
top: ($range-md-hit-height / 2) - ($range-md-knob-height / 2) + ($range-md-bar-height / 2);
|
|
left: ($range-md-hit-width / 2) - ($range-md-knob-width / 2);
|
|
|
|
z-index: 2;
|
|
|
|
width: $range-md-knob-width;
|
|
height: $range-md-knob-height;
|
|
|
|
border-radius: 50%;
|
|
|
|
background: $range-md-knob-background-color;
|
|
|
|
pointer-events: none;
|
|
}
|
|
|
|
.range-tick {
|
|
position: absolute;
|
|
|
|
top: ($range-md-hit-height / 2) - ($range-md-tick-height / 2) + ($range-md-bar-height / 2);
|
|
|
|
z-index: 1;
|
|
|
|
margin-left: ($range-md-tick-width / 2) * -1;
|
|
|
|
width: $range-md-tick-width;
|
|
height: $range-md-tick-height;
|
|
|
|
border-radius: $range-md-tick-border-radius;
|
|
|
|
background: $range-md-tick-background-color;
|
|
|
|
pointer-events: none;
|
|
}
|
|
|
|
.range-tick-active {
|
|
background: $range-md-tick-active-background-color;
|
|
}
|
|
|
|
.range-pin {
|
|
position: relative;
|
|
top: -20px;
|
|
display: inline-block;
|
|
|
|
padding: $range-md-pin-padding;
|
|
|
|
min-width: 28px;
|
|
|
|
border-radius: 50%;
|
|
|
|
font-size: $range-md-pin-font-size;
|
|
|
|
text-align: center;
|
|
|
|
color: $range-md-pin-color;
|
|
|
|
background: $range-md-pin-background-color;
|
|
|
|
transform: translate3d(0, 28px, 0) scale(.01);
|
|
transition: transform 120ms ease;
|
|
}
|
|
|
|
.range-knob-pressed .range-pin {
|
|
transform: translate3d(0, 0, 0) scale(1);
|
|
}
|
|
|
|
.range-knob-pressed .range-knob {
|
|
transform: scale(1.5);
|
|
}
|
|
|
|
// Generate Material Design Range Colors
|
|
// --------------------------------------------------
|
|
|
|
@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
|
|
|
|
ion-range[#{$color-name}] {
|
|
.range-bar-active,
|
|
.range-knob,
|
|
.range-pin {
|
|
background: $color-base;
|
|
}
|
|
}
|
|
|
|
}
|