scrollbar.scss 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. @use 'sass:map';
  2. @use 'mixins/mixins' as *;
  3. @use 'mixins/var' as *;
  4. @use 'common/var' as *;
  5. @include b(scrollbar) {
  6. @include set-component-css-var('scrollbar', $scrollbar);
  7. }
  8. @include b(scrollbar) {
  9. overflow: hidden;
  10. position: relative;
  11. height: 100%;
  12. @include e(wrap) {
  13. overflow: auto;
  14. height: 100%;
  15. @include m(hidden-default) {
  16. scrollbar-width: none;
  17. &::-webkit-scrollbar {
  18. display: none;
  19. }
  20. }
  21. }
  22. @include e(thumb) {
  23. position: relative;
  24. display: block;
  25. width: 0;
  26. height: 0;
  27. cursor: pointer;
  28. border-radius: inherit;
  29. background-color: var(
  30. #{getCssVarName('scrollbar-bg-color')},
  31. map.get($scrollbar, 'bg-color')
  32. );
  33. transition: getCssVar('transition-duration') background-color;
  34. opacity: var(
  35. #{getCssVarName('scrollbar-opacity')},
  36. map.get($scrollbar, 'opacity')
  37. );
  38. &:hover {
  39. background-color: var(
  40. #{getCssVarName('scrollbar-hover-bg-color')},
  41. map.get($scrollbar, 'hover-bg-color')
  42. );
  43. opacity: var(
  44. #{getCssVarName('scrollbar-hover-opacity')},
  45. map.get($scrollbar, 'hover-opacity')
  46. );
  47. }
  48. }
  49. @include e(bar) {
  50. position: absolute;
  51. right: 2px;
  52. bottom: 2px;
  53. z-index: 1;
  54. border-radius: 4px;
  55. @include when(vertical) {
  56. width: 6px;
  57. top: 2px;
  58. > div {
  59. width: 100%;
  60. }
  61. }
  62. @include when(horizontal) {
  63. height: 6px;
  64. left: 2px;
  65. > div {
  66. height: 100%;
  67. }
  68. }
  69. }
  70. }
  71. .#{$namespace}-scrollbar-fade {
  72. &-enter-active {
  73. transition: opacity 340ms ease-out;
  74. }
  75. &-leave-active {
  76. transition: opacity 120ms ease-out;
  77. }
  78. &-enter-from,
  79. &-leave-active {
  80. opacity: 0;
  81. }
  82. }