| 1 |
/* 'shiny' skin for Ion.RangeSlider, largely based on the 'big' skin, but with smaller dimensions, grayscale grid text, and without gradients |
| 2 |
© Posit, PBC, 2023 |
| 3 |
© RStudio, Inc, 2014 |
| 4 |
© Denis Ineshin, 2014 https://github.com/IonDen |
| 5 |
© guybowden, 2014 https://github.com/guybowden |
| 6 |
*/ |
| 7 |
|
| 8 |
@import "_base"; |
| 9 |
|
| 10 |
// Both BS3 and BS4 define a border radius mixin, but just in case |
| 11 |
// we're trying to compile this without bootstrapSass |
| 12 |
@mixin border-radius-shim($radius) { |
| 13 |
@if mixin-exists("border-radius") { |
| 14 |
@include border-radius($radius); |
| 15 |
} @else { |
| 16 |
border-radius: $radius; |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
//////////////////////////////////////////////////////////////////////////// |
| 22 |
|
| 23 |
$font-family: $font-family-base !default; |
| 24 |
.irs { |
| 25 |
font-family: $font-family; |
| 26 |
} |
| 27 |
|
| 28 |
.irs--shiny { |
| 29 |
$name: irs !default; |
| 30 |
|
| 31 |
// Sizing controls |
| 32 |
$top: 25px !default; |
| 33 |
$line_height: 8px !default; |
| 34 |
$handle_width: 22px !default; |
| 35 |
$handle_height: 22px !default; |
| 36 |
$custom_radius: 3px !default; |
| 37 |
|
| 38 |
// "High-level" coloring |
| 39 |
$bg: $body-bg !default; |
| 40 |
$fg: color-contrast($body-bg) !default; |
| 41 |
$accent: #428bca !default; |
| 42 |
|
| 43 |
// "Low-level" coloring, borders, and fonts |
| 44 |
$line_bg: linear-gradient(to bottom, mix($bg, $fg, 87%) -50%, $bg 150%) !default; |
| 45 |
$line_bg_color: mix($bg, $fg, 93%) !default; |
| 46 |
$line_border: 1px solid mix($bg, $fg, 80%) !default; |
| 47 |
|
| 48 |
$bar_color: $accent !default; |
| 49 |
|
| 50 |
$handle_color: mix($bg, $fg, 87%) !default; |
| 51 |
$handle_color_hover: $bg !default; |
| 52 |
$handle_border: 1px solid mix($bg, $fg, 67%) !default; |
| 53 |
$handle_box_shadow: 1px 1px 3px rgba($bg, 0.3) !default; |
| 54 |
|
| 55 |
$minmax_text_color: null !default; |
| 56 |
$minmax_bg_color: rgba($fg, 0.1) !default; |
| 57 |
$minmax_font_size: 10px !default; |
| 58 |
$minmax_line_height: 1.333 !default; |
| 59 |
|
| 60 |
$fromto_bg_color: $accent !default; |
| 61 |
$fromto_color: color-contrast($fromto_bg_color) !default; |
| 62 |
$fromto_font_size: 11px !default; |
| 63 |
$fromto_line_height: 1.333 !default; |
| 64 |
|
| 65 |
$grid_major_color: $fg !default; |
| 66 |
$grid_minor_color: mix($bg, $fg, 60%) !default; |
| 67 |
$grid_text_color: null !default; |
| 68 |
|
| 69 |
|
| 70 |
height: 40px; |
| 71 |
|
| 72 |
&.irs-with-grid { |
| 73 |
height: 60px; |
| 74 |
} |
| 75 |
|
| 76 |
.#{$name}-line { |
| 77 |
top: $top; |
| 78 |
height: $line_height; |
| 79 |
background: $line_bg; |
| 80 |
background-color: $line_bg_color; |
| 81 |
border: $line_border; |
| 82 |
@include border-radius-shim($line_height); |
| 83 |
|
| 84 |
// Increase the touch target area of the slider line |
| 85 |
overflow: visible; |
| 86 |
&::before { |
| 87 |
content: ""; |
| 88 |
display: block; |
| 89 |
position: relative; |
| 90 |
cursor: s-resize; // downward arrow |
| 91 |
width: 100%; |
| 92 |
height: $handle_height; |
| 93 |
top: -(($handle_height - $line_height / 2) / 2); |
| 94 |
z-index: 1; // raise touch area above grid |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
.#{$name}-bar { |
| 99 |
top: $top; |
| 100 |
height: $line_height; |
| 101 |
border-top: 1px solid $bar_color; |
| 102 |
border-bottom: 1px solid $bar_color; |
| 103 |
background: $bar_color; |
| 104 |
cursor: s-resize; // downard arrow, overwritten when a range |
| 105 |
z-index: 2; |
| 106 |
|
| 107 |
&--single { |
| 108 |
@include border-radius-shim($line_height 0 0 $line_height); |
| 109 |
} |
| 110 |
|
| 111 |
// Increase the touch target area of the slider bar |
| 112 |
&::before { |
| 113 |
content: ""; |
| 114 |
display: block; |
| 115 |
position: relative; |
| 116 |
width: 100%; |
| 117 |
height: $handle_height; |
| 118 |
top: -(($handle_height - $line_height / 2) / 2); |
| 119 |
z-index: 2; // raise touch area above line touch target |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
// sliderInput() doesn't currently support from_min/from_max, so this isn't relevant |
| 124 |
.#{$name}-shadow { |
| 125 |
top: 38px; |
| 126 |
height: 2px; |
| 127 |
background: rgba($fg, 0.3); |
| 128 |
@include border-radius-shim(5px); |
| 129 |
} |
| 130 |
.lt-ie9 .#{$name}-shadow { |
| 131 |
filter: alpha(opacity=30); |
| 132 |
} |
| 133 |
|
| 134 |
// .irs-slider changed to .irs-handle in v2.3.0 |
| 135 |
// https://github.com/IonDen/ion.rangeSlider/commit/c98c10d3d360aa52e997bb8e4fd371c958f78e4b#diff-91cc6fde25fe380ac2a7ac58e1538dceR140 |
| 136 |
.#{$name}-handle { |
| 137 |
top: 17px; |
| 138 |
width: $handle_width; |
| 139 |
height: $handle_height; |
| 140 |
border: $handle_border; |
| 141 |
background-color: $handle_color; |
| 142 |
box-shadow: $handle_box_shadow; |
| 143 |
border-radius: $handle_width; |
| 144 |
z-index: 2; |
| 145 |
|
| 146 |
&.type_last { |
| 147 |
// Ensure last-used handle is on top if it overlaps with another handle |
| 148 |
z-index: 3; |
| 149 |
} |
| 150 |
|
| 151 |
&.state_hover, |
| 152 |
&:hover { |
| 153 |
background: $handle_color_hover; |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
.#{$name}-min, |
| 158 |
.#{$name}-max { |
| 159 |
top: 0; |
| 160 |
padding: 1px 3px; |
| 161 |
color: $minmax_text_color; |
| 162 |
text-shadow: none; |
| 163 |
background-color: $minmax_bg_color; |
| 164 |
@include border-radius-shim($custom_radius); |
| 165 |
font-size: $minmax_font_size; |
| 166 |
line-height: $minmax_line_height; |
| 167 |
} |
| 168 |
|
| 169 |
.lt-ie9 .#{$name}-min, |
| 170 |
.lt-ie9 .#{$name}-max { |
| 171 |
background: mix($bg, $fg, 80%); |
| 172 |
} |
| 173 |
|
| 174 |
.#{$name}-from, |
| 175 |
.#{$name}-to, |
| 176 |
.#{$name}-single { |
| 177 |
color: $fromto_color; |
| 178 |
text-shadow: none; |
| 179 |
padding: 1px 3px; |
| 180 |
background-color: $fromto_bg_color; |
| 181 |
@include border-radius-shim($custom_radius); |
| 182 |
font-size: $fromto_font_size; |
| 183 |
line-height: $fromto_line_height; |
| 184 |
} |
| 185 |
|
| 186 |
.lt-ie9 .#{$name}-from, |
| 187 |
.lt-ie9 .#{$name}-to, |
| 188 |
.lt-ie9 .#{$name}-single { |
| 189 |
background: mix($bg, $fg, 60%); |
| 190 |
} |
| 191 |
|
| 192 |
.#{$name}-grid { |
| 193 |
height: 27px; |
| 194 |
&-pol { |
| 195 |
background-color: $grid_major_color; |
| 196 |
} |
| 197 |
&-text { |
| 198 |
bottom: 5px; |
| 199 |
color: $grid_text_color; |
| 200 |
} |
| 201 |
&-pol.small { |
| 202 |
background-color: $grid_minor_color; |
| 203 |
} |
| 204 |
} |
| 205 |
|
| 206 |
} |