_Slider.scss 7.1 KB

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