VSliderThumb.sass 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. @use 'sass:map'
  2. @use 'sass:selector'
  3. @use 'sass:math'
  4. @use '../../styles/settings'
  5. @use '../../styles/tools'
  6. @use './variables' as *
  7. @include tools.layer('components')
  8. // Theme
  9. .v-slider-thumb
  10. touch-action: none
  11. color: rgb(var(--v-theme-surface-variant))
  12. .v-input--error:not(.v-input--disabled) &
  13. color: inherit
  14. .v-slider-thumb__label
  15. background: rgba(var(--v-theme-surface-variant), .7)
  16. color: rgb(var(--v-theme-on-surface-variant))
  17. &::before
  18. color: rgba(var(--v-theme-surface-variant), .7)
  19. // Block
  20. .v-slider-thumb
  21. outline: none
  22. position: absolute
  23. transition: $slider-transition
  24. .v-slider-thumb__surface
  25. cursor: pointer
  26. width: var(--v-slider-thumb-size)
  27. height: var(--v-slider-thumb-size)
  28. border-radius: $slider-thumb-border-radius
  29. user-select: none
  30. background-color: currentColor
  31. @media (forced-colors: active)
  32. background-color: highlight
  33. &::before
  34. transition: 0.3s settings.$standard-easing
  35. content: ''
  36. color: inherit
  37. top: 0
  38. left: 0
  39. width: 100%
  40. height: 100%
  41. border-radius: $slider-thumb-border-radius
  42. background: currentColor
  43. position: absolute
  44. pointer-events: none
  45. opacity: 0
  46. &::after
  47. content: ''
  48. width: $slider-thumb-touch-size
  49. height: $slider-thumb-touch-size
  50. position: absolute
  51. top: 50%
  52. left: 50%
  53. transform: translate(-50%, -50%)
  54. .v-slider-thumb__label-container
  55. position: absolute
  56. transition: $slider-thumb-label-transition
  57. .v-slider-thumb__label
  58. display: flex
  59. align-items: center
  60. justify-content: center
  61. font-size: $slider-thumb-label-font-size
  62. min-width: $slider-thumb-label-min-width
  63. height: $slider-thumb-label-height
  64. border-radius: $slider-thumb-label-border-radius
  65. padding: $slider-thumb-label-padding
  66. position: absolute
  67. user-select: none
  68. transition: $slider-thumb-label-transition
  69. &::before
  70. content: ''
  71. width: 0
  72. height: 0
  73. position: absolute
  74. .v-slider-thumb__ripple
  75. position: absolute
  76. left: calc(var(--v-slider-thumb-size) / -2)
  77. top: calc(var(--v-slider-thumb-size) / -2)
  78. width: calc(var(--v-slider-thumb-size) * 2)
  79. height: calc(var(--v-slider-thumb-size) * 2)
  80. background: inherit
  81. // Horizontal
  82. .v-slider.v-input--horizontal
  83. .v-slider-thumb
  84. top: 50%
  85. transform: translateY(-50%)
  86. inset-inline-start: calc(var(--v-slider-thumb-position) - var(--v-slider-thumb-size) / 2)
  87. .v-slider-thumb__label-container
  88. left: calc(var(--v-slider-thumb-size) / 2)
  89. top: 0
  90. .v-slider-thumb__label
  91. bottom: $slider-thumb-label-offset
  92. @include tools.ltr()
  93. transform: translateX(-50%)
  94. @include tools.rtl()
  95. transform: translateX(50%)
  96. &::before
  97. border-left: $slider-thumb-label-wedge-size solid transparent
  98. border-right: $slider-thumb-label-wedge-size solid transparent
  99. border-top: $slider-thumb-label-wedge-size solid currentColor
  100. bottom: -$slider-thumb-label-wedge-size
  101. // Vertical
  102. .v-slider.v-input--vertical
  103. .v-slider-thumb
  104. top: calc(var(--v-slider-thumb-position) - var(--v-slider-thumb-size) / 2)
  105. .v-slider-thumb__label-container
  106. top: calc(var(--v-slider-thumb-size) / 2)
  107. right: 0
  108. .v-slider-thumb__label
  109. top: math.div($slider-thumb-label-height, -2)
  110. left: $slider-thumb-label-offset
  111. &::before
  112. border-right: $slider-thumb-label-wedge-size solid currentColor
  113. border-top: $slider-thumb-label-wedge-size solid transparent
  114. border-bottom: $slider-thumb-label-wedge-size solid transparent
  115. left: -$slider-thumb-label-wedge-size
  116. // Modifiers
  117. .v-slider-thumb--focused
  118. .v-slider-thumb__surface::before
  119. transform: scale(2)
  120. opacity: $slider-thumb-focus-opacity
  121. .v-slider-thumb--pressed
  122. transition: none
  123. .v-slider-thumb__surface::before
  124. opacity: $slider-thumb-pressed-opacity
  125. @media (hover: hover)
  126. .v-slider-thumb:hover
  127. .v-slider-thumb__surface::before
  128. transform: scale(2)
  129. .v-slider-thumb:hover:not(.v-slider-thumb--focused)
  130. .v-slider-thumb__surface::before
  131. opacity: $slider-thumb-hover-opacity