slider.css 11 KB

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