index.less 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @slider-prefix-cls: ~'@{ant-prefix}-slider';
  4. .@{slider-prefix-cls} {
  5. .reset-component();
  6. position: relative;
  7. height: 12px;
  8. margin: @slider-margin;
  9. padding: 4px 0;
  10. cursor: pointer;
  11. touch-action: none;
  12. .vertical();
  13. &-with-marks {
  14. margin-bottom: 28px;
  15. }
  16. &-rail {
  17. position: absolute;
  18. width: 100%;
  19. height: 4px;
  20. background-color: @slider-rail-background-color;
  21. border-radius: @border-radius-base;
  22. transition: background-color 0.3s;
  23. }
  24. &-track {
  25. position: absolute;
  26. height: 4px;
  27. background-color: @slider-track-background-color;
  28. border-radius: @border-radius-base;
  29. transition: background-color 0.3s;
  30. }
  31. &-handle {
  32. position: absolute;
  33. width: @slider-handle-size;
  34. height: @slider-handle-size;
  35. margin-top: @slider-handle-margin-top;
  36. background-color: @slider-handle-background-color;
  37. border: solid @slider-handle-border-width @slider-handle-color;
  38. border-radius: 50%;
  39. box-shadow: @slider-handle-shadow;
  40. cursor: pointer;
  41. transition: border-color 0.3s, box-shadow 0.6s,
  42. transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  43. // &-dragging&-dragging&-dragging {
  44. // border-color: @slider-handle-color-focus;
  45. // box-shadow: 0 0 0 5px @slider-handle-color-focus-shadow;
  46. // }
  47. &-dragging {
  48. z-index: 1;
  49. }
  50. &:focus {
  51. border-color: @slider-handle-color-focus;
  52. outline: none;
  53. box-shadow: 0 0 0 5px @slider-handle-color-focus-shadow;
  54. }
  55. &.@{ant-prefix}-tooltip-open {
  56. border-color: @slider-handle-color-tooltip-open;
  57. }
  58. &::after {
  59. position: absolute;
  60. top: -6px;
  61. right: -6px;
  62. bottom: -6px;
  63. left: -6px;
  64. content: '';
  65. }
  66. }
  67. &:hover {
  68. .@{slider-prefix-cls}-rail {
  69. background-color: @slider-rail-background-color-hover;
  70. }
  71. .@{slider-prefix-cls}-track {
  72. background-color: @slider-track-background-color-hover;
  73. }
  74. .@{slider-prefix-cls}-handle:not(.@{ant-prefix}-tooltip-open) {
  75. border-color: @slider-handle-color-hover;
  76. }
  77. }
  78. &-mark {
  79. position: absolute;
  80. top: 14px;
  81. left: 0;
  82. width: 100%;
  83. font-size: @font-size-base;
  84. }
  85. &-mark-text {
  86. position: absolute;
  87. display: inline-block;
  88. color: @text-color-secondary;
  89. text-align: center;
  90. word-break: keep-all;
  91. cursor: pointer;
  92. user-select: none;
  93. &-active {
  94. color: @text-color;
  95. }
  96. }
  97. &-step {
  98. position: absolute;
  99. width: 100%;
  100. height: 4px;
  101. background: transparent;
  102. pointer-events: none;
  103. }
  104. &-dot {
  105. position: absolute;
  106. top: -2px;
  107. width: 8px;
  108. height: 8px;
  109. background-color: @component-background;
  110. border: 2px solid @slider-dot-border-color;
  111. border-radius: 50%;
  112. cursor: pointer;
  113. &-active {
  114. border-color: @slider-dot-border-color-active;
  115. }
  116. }
  117. &-disabled {
  118. cursor: not-allowed;
  119. .@{slider-prefix-cls}-rail {
  120. background-color: @slider-rail-background-color !important;
  121. }
  122. .@{slider-prefix-cls}-track {
  123. background-color: @slider-disabled-color !important;
  124. }
  125. .@{slider-prefix-cls}-handle,
  126. .@{slider-prefix-cls}-dot {
  127. background-color: @component-background;
  128. border-color: @slider-disabled-color !important;
  129. box-shadow: none;
  130. cursor: not-allowed;
  131. }
  132. .@{slider-prefix-cls}-mark-text,
  133. .@{slider-prefix-cls}-dot {
  134. cursor: not-allowed !important;
  135. }
  136. }
  137. }
  138. .vertical() {
  139. &-vertical {
  140. width: 12px;
  141. height: 100%;
  142. margin: 6px 10px;
  143. padding: 0 4px;
  144. .@{slider-prefix-cls}-rail {
  145. width: 4px;
  146. height: 100%;
  147. }
  148. .@{slider-prefix-cls}-track {
  149. width: 4px;
  150. }
  151. .@{slider-prefix-cls}-handle {
  152. margin-top: -6px; // we chould consider border width as well: (10 + 2 ) / 2
  153. margin-left: @slider-handle-margin-left;
  154. }
  155. .@{slider-prefix-cls}-mark {
  156. top: 0;
  157. left: 12px;
  158. width: 18px;
  159. height: 100%;
  160. }
  161. .@{slider-prefix-cls}-mark-text {
  162. left: 4px;
  163. white-space: nowrap;
  164. }
  165. .@{slider-prefix-cls}-step {
  166. width: 4px;
  167. height: 100%;
  168. }
  169. .@{slider-prefix-cls}-dot {
  170. top: auto;
  171. margin-left: -2px;
  172. }
  173. }
  174. &-tooltip {
  175. // https://github.com/ant-design/ant-design/issues/20014
  176. .@{ant-prefix}-tooltip-inner {
  177. min-width: unset;
  178. }
  179. }
  180. }
  181. @import './rtl';