slider.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. @charset "UTF-8";
  2. /* mixins & extensions */
  3. @keyframes in {
  4. 0% {
  5. opacity: 0;
  6. }
  7. 100% {
  8. opacity: 1;
  9. }
  10. }
  11. @keyframes in-down {
  12. 0% {
  13. opacity: 0;
  14. transform: translate3D(0, -5px, 0);
  15. }
  16. 100% {
  17. opacity: 1;
  18. transform: translate3D(0, 0, 0);
  19. }
  20. }
  21. @keyframes in-up {
  22. 0% {
  23. opacity: 0;
  24. transform: translate3D(0, 5px, 0);
  25. }
  26. 100% {
  27. opacity: 1;
  28. transform: translate3D(0, 0, 0);
  29. }
  30. }
  31. @keyframes in-scale {
  32. 0% {
  33. opacity: 0;
  34. transform: scale3D(0.95, 0.95, 1);
  35. }
  36. 100% {
  37. opacity: 1;
  38. transform: scale3D(1, 1, 1);
  39. }
  40. }
  41. :root {
  42. --calcite-animation-timing: calc(150ms * var(--calcite-internal-duration-factor));
  43. --calcite-internal-duration-factor: var(--calcite-duration-factor, 1);
  44. --calcite-internal-animation-timing-fast: calc(100ms * var(--calcite-internal-duration-factor));
  45. --calcite-internal-animation-timing-medium: calc(200ms * var(--calcite-internal-duration-factor));
  46. --calcite-internal-animation-timing-slow: calc(300ms * var(--calcite-internal-duration-factor));
  47. }
  48. .calcite-animate {
  49. opacity: 0;
  50. animation-fill-mode: both;
  51. animation-duration: var(--calcite-animation-timing);
  52. }
  53. .calcite-animate__in {
  54. animation-name: in;
  55. }
  56. .calcite-animate__in-down {
  57. animation-name: in-down;
  58. }
  59. .calcite-animate__in-up {
  60. animation-name: in-up;
  61. }
  62. .calcite-animate__in-scale {
  63. animation-name: in-scale;
  64. }
  65. /**
  66. * Currently only used in Checkbox.
  67. */
  68. :root {
  69. --calcite-popper-transition: var(--calcite-animation-timing);
  70. }
  71. :host([hidden]) {
  72. display: none;
  73. }
  74. .scale--s {
  75. --calcite-slider-handle-size: 10px;
  76. --calcite-slider-handle-extension-height: 6.5px;
  77. --calcite-slider-container-font-size: var(--calcite-font-size--3);
  78. }
  79. .scale--s .handle__label, .scale--s .tick__label{
  80. line-height: .75rem;
  81. }
  82. .scale--m {
  83. --calcite-slider-handle-size: 14px;
  84. --calcite-slider-handle-extension-height: 8px;
  85. --calcite-slider-container-font-size: var(--calcite-font-size--2);
  86. }
  87. .scale--m .handle__label, .scale--m .tick__label{
  88. line-height: 1rem;
  89. }
  90. .scale--l {
  91. --calcite-slider-handle-size: 16px;
  92. --calcite-slider-handle-extension-height: 10.5px;
  93. --calcite-slider-container-font-size: var(--calcite-font-size--1);
  94. }
  95. .scale--l .handle__label, .scale--l .tick__label{
  96. line-height: 1rem;
  97. }
  98. .handle__label, .tick__label{
  99. font-weight: var(--calcite-font-weight-medium);
  100. color: var(--calcite-ui-text-2);
  101. font-size: var(--calcite-slider-container-font-size);
  102. }
  103. :host{
  104. display: block;
  105. }
  106. .container{
  107. position: relative;
  108. display: block;
  109. overflow-wrap: normal;
  110. word-break: normal;
  111. padding: calc(var(--calcite-slider-handle-size) * 0.5);
  112. margin: calc(var(--calcite-slider-handle-size) * 0.5) 0;
  113. --calcite-slider-full-handle-height: calc(
  114. var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)
  115. );
  116. }
  117. :host([disabled]){
  118. pointer-events: none;
  119. cursor: default;
  120. -webkit-user-select: none;
  121. user-select: none;
  122. opacity: var(--calcite-ui-opacity-disabled);
  123. }
  124. :host([disabled]) .track__range,
  125. :host([disabled]) .tick--active {
  126. background-color: var(--calcite-ui-text-3);
  127. }
  128. :host([disabled]) ::slotted([calcite-hydrated][disabled]),
  129. :host([disabled]) [calcite-hydrated][disabled] {
  130. /* prevent opacity stacking */
  131. opacity: 1;
  132. }
  133. .scale--s .thumb:not(.thumb--precise) {
  134. --calcite-slider-thumb-y-offset: -6px;
  135. }
  136. .scale--m .thumb:not(.thumb--precise) {
  137. --calcite-slider-thumb-y-offset: -8px;
  138. }
  139. .scale--l .thumb:not(.thumb--precise) {
  140. --calcite-slider-thumb-y-offset: -9px;
  141. }
  142. :host([precise]:not([has-histogram])) .container .thumb--value {
  143. --calcite-slider-thumb-y-offset: calc(var(--calcite-slider-full-handle-height) * -1);
  144. }
  145. .thumb-container{
  146. position: relative;
  147. max-width: 100%;
  148. }
  149. .thumb {
  150. --calcite-slider-thumb-x-offset: calc(var(--calcite-slider-handle-size) * 0.5);
  151. position: absolute;
  152. margin: 0px;
  153. display: flex;
  154. cursor: pointer;
  155. flex-direction: column;
  156. align-items: center;
  157. border-style: none;
  158. background-color: transparent;
  159. padding: 0px;
  160. font-family: inherit;
  161. outline: 2px solid transparent;
  162. outline-offset: 2px;
  163. transform: translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset));
  164. }
  165. .thumb .handle__label.static, .thumb .handle__label.transformed{
  166. position: absolute;
  167. top: 0px;
  168. bottom: 0px;
  169. opacity: 0;
  170. }
  171. .thumb .handle__label.hyphen::after {
  172. content: "—";
  173. display: inline-block;
  174. width: 1em;
  175. }
  176. .thumb .handle__label.hyphen--wrap {
  177. display: flex;
  178. }
  179. .thumb .handle{
  180. box-sizing: border-box;
  181. border-radius: 9999px;
  182. background-color: var(--calcite-ui-foreground-1);
  183. outline-offset: 0;
  184. outline-color: transparent;
  185. transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
  186. height: var(--calcite-slider-handle-size);
  187. width: var(--calcite-slider-handle-size);
  188. box-shadow: 0 0 0 2px var(--calcite-ui-text-3) inset;
  189. transition: border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease;
  190. }
  191. .thumb .handle-extension{
  192. width: 0.125rem;
  193. height: var(--calcite-slider-handle-extension-height);
  194. background-color: var(--calcite-ui-text-3);
  195. }
  196. .thumb:hover .handle {
  197. box-shadow: 0 0 0 3px var(--calcite-ui-brand) inset;
  198. }
  199. .thumb:hover .handle-extension{
  200. background-color: var(--calcite-ui-brand);
  201. }
  202. .thumb:focus .handle{
  203. outline: 2px solid var(--calcite-ui-brand);
  204. outline-offset: 2px;
  205. }
  206. .thumb:focus .handle-extension{
  207. background-color: var(--calcite-ui-brand);
  208. }
  209. .thumb.thumb--minValue {
  210. transform: translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset));
  211. }
  212. .thumb.thumb--precise {
  213. --calcite-slider-thumb-y-offset: -2px;
  214. }
  215. :host([label-handles]) .thumb {
  216. --calcite-slider-thumb-x-offset: 50%;
  217. }
  218. :host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise) {
  219. --calcite-slider-thumb-y-offset: -23px;
  220. }
  221. :host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise) {
  222. --calcite-slider-thumb-y-offset: -30px;
  223. }
  224. :host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise) {
  225. --calcite-slider-thumb-y-offset: -32px;
  226. }
  227. :host([has-histogram][label-handles]) .handle__label,
  228. :host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label {
  229. margin-top: 0.5em;
  230. }
  231. :host(:not([has-histogram]):not([precise])) .handle__label,
  232. :host([label-handles]:not([has-histogram])) .thumb--value .handle__label {
  233. margin-bottom: 0.5em;
  234. }
  235. :host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value {
  236. --calcite-slider-thumb-y-offset: -33px;
  237. }
  238. :host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value {
  239. --calcite-slider-thumb-y-offset: -44px;
  240. }
  241. :host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value {
  242. --calcite-slider-thumb-y-offset: -49px;
  243. }
  244. .thumb:focus .handle, .thumb--active .handle{
  245. background-color: var(--calcite-ui-brand);
  246. box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.16);
  247. }
  248. .thumb:hover.thumb--precise:after, .thumb:focus.thumb--precise:after, .thumb--active.thumb--precise:after{
  249. background-color: var(--calcite-ui-brand);
  250. }
  251. .track{
  252. position: relative;
  253. height: 0.125rem;
  254. border-radius: 0px;
  255. background-color: var(--calcite-ui-border-2);
  256. transition: all var(--calcite-internal-animation-timing-medium) ease-in;
  257. }
  258. .track__range{
  259. position: absolute;
  260. top: 0px;
  261. height: 0.125rem;
  262. background-color: var(--calcite-ui-brand);
  263. }
  264. .container--range .track__range:hover {
  265. cursor: ew-resize;
  266. }
  267. .container--range .track__range:after{
  268. position: absolute;
  269. width: 100%;
  270. content: "";
  271. top: calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);
  272. height: calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height));
  273. }
  274. @media (forced-colors: active) {
  275. .thumb {
  276. outline-width: 0;
  277. outline-offset: 0;
  278. }
  279. .handle{
  280. outline: 2px solid transparent;
  281. outline-offset: 2px;
  282. }
  283. .thumb:focus .handle,
  284. .thumb .handle-extension,
  285. .thumb:hover .handle-extension,
  286. .thumb:focus .handle-extension,
  287. .thumb:active .handle-extension {
  288. background-color: canvasText;
  289. }
  290. .track {
  291. background-color: canvasText;
  292. }
  293. .track__range {
  294. background-color: highlight;
  295. }
  296. }
  297. .tick{
  298. position: absolute;
  299. height: 0.25rem;
  300. width: 0.125rem;
  301. border-width: 1px;
  302. border-style: solid;
  303. background-color: var(--calcite-ui-border-input);
  304. border-color: var(--calcite-ui-foreground-1);
  305. top: -2px;
  306. pointer-events: none;
  307. margin-inline-start: calc(-1 * 0.125rem);
  308. }
  309. .tick--active{
  310. background-color: var(--calcite-ui-brand);
  311. }
  312. .tick__label{
  313. pointer-events: none;
  314. margin-top: 0.875rem;
  315. display: flex;
  316. justify-content: center;
  317. }
  318. .tick__label--min {
  319. transition: opacity var(--calcite-animation-timing);
  320. }
  321. .tick__label--max {
  322. transition: opacity var(--calcite-internal-animation-timing-fast);
  323. }
  324. :host([has-histogram][label-handles]) .tick__label--min, :host([has-histogram][label-handles]) .tick__label--max, :host([has-histogram][precise]) .tick__label--min, :host([has-histogram][precise]) .tick__label--max{
  325. font-weight: var(--calcite-font-weight-normal);
  326. color: var(--calcite-ui-text-3);
  327. }
  328. .graph {
  329. color: var(--calcite-ui-foreground-3);
  330. height: 48px;
  331. }
  332. :host([label-ticks][ticks]) .container {
  333. padding-bottom: calc(0.875rem + var(--calcite-slider-container-font-size));
  334. }
  335. :host([has-histogram]):host([precise][label-handles]) .container {
  336. padding-bottom: calc(var(--calcite-slider-full-handle-height) + 1em);
  337. }
  338. :host([has-histogram]):host([label-handles]:not([precise])) .container {
  339. padding-bottom: calc(var(--calcite-slider-handle-size) * 0.5 + 1em);
  340. }
  341. :host([has-histogram]):host([precise]:not([label-handles])) .container {
  342. padding-bottom: var(--calcite-slider-full-handle-height);
  343. }
  344. :host(:not([has-histogram])):host([precise]:not([label-handles])) .container {
  345. padding-top: var(--calcite-slider-full-handle-height);
  346. }
  347. :host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range {
  348. padding-bottom: var(--calcite-slider-full-handle-height);
  349. }
  350. :host(:not([has-histogram])):host([label-handles]:not([precise])) .container {
  351. padding-top: calc(var(--calcite-slider-full-handle-height) + 4px);
  352. }
  353. :host(:not([has-histogram])):host([label-handles][precise]) .container {
  354. padding-top: calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px);
  355. }
  356. :host(:not([has-histogram])):host([label-handles][precise]) .container--range {
  357. padding-bottom: calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px);
  358. }
  359. ::slotted(input[slot=hidden-form-input]) {
  360. bottom: 0 !important;
  361. left: 0 !important;
  362. margin: 0 !important;
  363. opacity: 0 !important;
  364. outline: none !important;
  365. padding: 0 !important;
  366. position: absolute !important;
  367. right: 0 !important;
  368. top: 0 !important;
  369. transform: none !important;
  370. -webkit-appearance: none !important;
  371. z-index: -1 !important;
  372. }