_Slider.scss 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. @mixin slider() {
  2. $slider-track-thickness: 2px !default;
  3. $slider-anchor-thickness: 1px !default;
  4. $slider-tick-thickness: 1px !default;
  5. $slider-tick-length: 5px !default;
  6. $slider-ticks-z-index: 0;
  7. $slider-thumb-size: 16px !default;
  8. $slider-thumb-offset: ($slider-thumb-size * 0.5) - 1 !default;
  9. $slider-thumb-hover-scale: 1.2 !default;
  10. $slider-thumb-size--hover: $slider-thumb-size * $slider-thumb-hover-scale !default;
  11. $slider-thumb-offset--hover: ($slider-thumb-size--hover * 0.5) - 1 !default;
  12. .esri-slider {
  13. direction: ltr;
  14. display: flex;
  15. height: 100%;
  16. width: 100%;
  17. -webkit-user-select: none;
  18. user-select: none;
  19. }
  20. .esri-disabled {
  21. .esri-slider__content,
  22. .esri-slider__min,
  23. .esri-slider__max {
  24. opacity: 0.4;
  25. }
  26. .esri-slider__thumb {
  27. &:hover {
  28. transform: none;
  29. border-color: $button-color;
  30. cursor: default;
  31. }
  32. }
  33. .esri-slider__label {
  34. &:hover {
  35. cursor: default;
  36. }
  37. }
  38. .esri-slider__segment {
  39. &:hover {
  40. cursor: default;
  41. }
  42. }
  43. .esri-slider {
  44. &--horizontal,
  45. &--vertical {
  46. .esri-slider__segment--interactive {
  47. &:hover {
  48. cursor: default;
  49. }
  50. }
  51. }
  52. }
  53. }
  54. .esri-slider--reversed.esri-slider--horizontal {
  55. flex-direction: row-reverse;
  56. }
  57. .esri-slider--reversed.esri-slider--vertical {
  58. flex-direction: column;
  59. }
  60. .esri-slider--horizontal {
  61. flex-direction: row;
  62. .esri-slider__content {
  63. height: auto;
  64. }
  65. .esri-slider__track {
  66. height: $slider-track-thickness;
  67. width: 100%;
  68. }
  69. .esri-slider__segment--interactive {
  70. &:hover {
  71. cursor: ew-resize;
  72. }
  73. }
  74. .esri-slider__anchor {
  75. height: 100%;
  76. width: $slider-anchor-thickness;
  77. }
  78. .esri-slider__label {
  79. left: -50px;
  80. margin: 0 $side-spacing--three-quarters;
  81. top: -30px;
  82. text-align: center;
  83. }
  84. .esri-slider__label-input {
  85. text-align: center;
  86. }
  87. .esri-slider__max,
  88. .esri-slider__min {
  89. flex: 0 0 auto;
  90. margin: auto;
  91. height: auto;
  92. width: 50px;
  93. }
  94. .esri-slider__ticks {
  95. left: 0;
  96. margin: $cap-spacing--three-quarters 0 0 0;
  97. top: 100%;
  98. width: 100%;
  99. }
  100. .esri-slider__tick {
  101. height: $slider-tick-length;
  102. width: $slider-tick-thickness;
  103. }
  104. .esri-slider__tick-label {
  105. margin-top: $cap-spacing--plus-half;
  106. }
  107. }
  108. .esri-slider--vertical {
  109. flex-direction: column-reverse;
  110. .esri-slider__content {
  111. flex-direction: column;
  112. width: auto;
  113. }
  114. .esri-slider__track {
  115. flex: 1 0 0px;
  116. flex-direction: column;
  117. height: 100%;
  118. width: $slider-track-thickness;
  119. }
  120. .esri-slider__segment--interactive {
  121. &:hover {
  122. cursor: ns-resize;
  123. }
  124. }
  125. .esri-slider__anchor {
  126. height: $slider-anchor-thickness;
  127. width: 100%;
  128. }
  129. .esri-slider__label {
  130. left: 20px;
  131. text-align: left;
  132. top: -10px;
  133. }
  134. .esri-slider__max,
  135. .esri-slider__min {
  136. margin: auto;
  137. width: 100%;
  138. }
  139. .esri-slider__max {
  140. flex: 0 0 22px;
  141. }
  142. .esri-slider__min {
  143. flex: 0 0 22px;
  144. }
  145. .esri-slider__ticks {
  146. left: 100%;
  147. margin: 0 0 0 $side-spacing--three-quarters;
  148. top: 0;
  149. }
  150. .esri-slider__tick {
  151. height: $slider-tick-thickness;
  152. width: $slider-tick-length;
  153. }
  154. .esri-slider__tick-label {
  155. margin-left: 30px;
  156. }
  157. }
  158. .esri-slider__content {
  159. display: flex;
  160. flex: 1 0 auto;
  161. line-height: 0;
  162. margin: auto;
  163. position: relative;
  164. align-items: center;
  165. justify-content: center;
  166. z-index: 0;
  167. }
  168. .esri-slider__track {
  169. background-color: $border-color--contrast;
  170. display: inline-block;
  171. touch-action: none;
  172. position: relative;
  173. }
  174. .esri-slider__segment {
  175. height: 100%;
  176. left: 0;
  177. position: absolute;
  178. top: 0;
  179. touch-action: none;
  180. transform-origin: 0 0;
  181. width: 100%;
  182. will-change: transform;
  183. &:hover {
  184. cursor: pointer;
  185. }
  186. }
  187. .esri-slider__anchor {
  188. background-color: $background-color--inverse;
  189. position: absolute;
  190. touch-action: none;
  191. -webkit-user-select: none;
  192. user-select: none;
  193. &:focus {
  194. .esri-slider__thumb,
  195. .esri-slider__label {
  196. outline: inherit;
  197. }
  198. }
  199. }
  200. .esri-slider__anchor--moving {
  201. .esri-slider__label {
  202. &:hover {
  203. cursor: grabbing;
  204. }
  205. }
  206. .esri-slider__label--interactive {
  207. &:hover {
  208. cursor: grabbing;
  209. }
  210. }
  211. &:focus {
  212. .esri-slider__thumb {
  213. border: 3px solid $button-color--hover;
  214. cursor: grabbing;
  215. }
  216. }
  217. }
  218. .esri-slider__thumb {
  219. background-color: $background-color;
  220. border: 2px solid $button-color;
  221. border-radius: $slider-thumb-size;
  222. height: $slider-thumb-size;
  223. left: -$slider-thumb-offset;
  224. position: absolute;
  225. top: -$slider-thumb-offset;
  226. touch-action: none;
  227. width: $slider-thumb-size;
  228. transition: all 125ms ease-in-out;
  229. z-index: $slider-ticks-z-index + 1; // Make sure the thumb goes on top of the ticks
  230. &:hover {
  231. border-color: $button-color--hover;
  232. border-width: 3px;
  233. height: $slider-thumb-size--hover;
  234. left: -$slider-thumb-offset--hover;
  235. top: -$slider-thumb-offset--hover;
  236. width: $slider-thumb-size--hover;
  237. cursor: pointer; // Fallback for IE11
  238. cursor: grab;
  239. }
  240. }
  241. .esri-slider__label {
  242. line-height: 22px;
  243. min-width: 80px;
  244. position: absolute;
  245. &:hover {
  246. cursor: pointer; // Fallback for IE11
  247. cursor: grab;
  248. }
  249. }
  250. .esri-slider__label--interactive,
  251. .esri-slider__max--interactive,
  252. .esri-slider__min--interactive {
  253. &:hover {
  254. cursor: pointer;
  255. text-decoration: underline;
  256. }
  257. }
  258. .esri-slider__label-input {
  259. position: relative;
  260. width: 100%;
  261. z-index: $slider-ticks-z-index + 1;
  262. }
  263. .esri-slider__extra-content {
  264. display: inline-block;
  265. }
  266. .esri-slider__max,
  267. .esri-slider__min {
  268. height: 22px;
  269. line-height: 22px;
  270. text-align: center;
  271. display: flex;
  272. align-items: center;
  273. justify-content: center;
  274. }
  275. .esri-slider__max--interactive,
  276. .esri-slider__min--interactive {
  277. &:hover {
  278. background-color: $background-color--offset;
  279. }
  280. }
  281. .esri-slider__range-input {
  282. padding: 1px 0;
  283. text-align: center;
  284. width: 100%;
  285. }
  286. .esri-slider__ticks {
  287. display: inline-block;
  288. height: 100%;
  289. position: absolute;
  290. z-index: $slider-ticks-z-index;
  291. }
  292. .esri-slider__tick {
  293. background: $border-color--contrast;
  294. position: absolute;
  295. }
  296. .esri-slider__tick-label {
  297. position: absolute;
  298. width: max-content;
  299. }
  300. [dir="rtl"] {
  301. .esri-slider__label,
  302. .esri-slider__max,
  303. .esri-slider__min,
  304. .esri-slider__tick-label {
  305. direction: rtl;
  306. unicode-bidi: plaintext;
  307. }
  308. .esri-slider__range-input,
  309. .esri-slider__label-input {
  310. unicode-bidi: plaintext;
  311. }
  312. }
  313. }
  314. /*
  315. #22969 - Focus outline does not appear as expected in Edge
  316. Slider includes thumb/label elements in anchor focus outline when 'handle' is focused
  317. Default browser style for focus outline is not included on parent element in Edge
  318. This means using 'outline: inherit' on thumb/label elements does nothing
  319. ... unless we define an outline on the parent
  320. */
  321. @supports (-ms-ime-align: auto) {
  322. .esri-slider {
  323. &__anchor {
  324. &:focus {
  325. outline: 1px dotted black;
  326. }
  327. }
  328. }
  329. }
  330. @if $include_Slider == true {
  331. @include slider();
  332. }