VSwitch.css 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. .v-switch .v-label {
  2. padding-inline-start: 10px;
  3. }
  4. .v-switch__loader {
  5. display: flex;
  6. }
  7. .v-switch__loader .v-progress-circular {
  8. color: rgb(var(--v-theme-surface));
  9. }
  10. .v-switch__track,
  11. .v-switch__thumb {
  12. transition: none;
  13. }
  14. .v-selection-control--error:not(.v-selection-control--disabled) .v-switch__track,
  15. .v-selection-control--error:not(.v-selection-control--disabled) .v-switch__thumb {
  16. background-color: rgb(var(--v-theme-error));
  17. color: rgb(var(--v-theme-on-error));
  18. }
  19. .v-switch__track-true {
  20. margin-inline-end: auto;
  21. }
  22. .v-selection-control:not(.v-selection-control--dirty) .v-switch__track-true {
  23. opacity: 0;
  24. }
  25. .v-switch__track-false {
  26. margin-inline-start: auto;
  27. }
  28. .v-selection-control--dirty .v-switch__track-false {
  29. opacity: 0;
  30. }
  31. .v-switch__track {
  32. display: inline-flex;
  33. align-items: center;
  34. font-size: 0.5rem;
  35. padding: 0 5px;
  36. background-color: rgb(var(--v-theme-surface-variant));
  37. border-radius: 9999px;
  38. height: 14px;
  39. opacity: 0.6;
  40. min-width: 36px;
  41. cursor: pointer;
  42. transition: 0.2s background-color cubic-bezier(0.4, 0, 0.2, 1);
  43. }
  44. .v-switch--inset .v-switch__track {
  45. border-radius: 9999px;
  46. font-size: 0.75rem;
  47. height: 32px;
  48. min-width: 52px;
  49. }
  50. .v-switch__thumb {
  51. align-items: center;
  52. background-color: rgb(var(--v-theme-surface-bright));
  53. color: rgb(var(--v-theme-on-surface-bright));
  54. border-radius: 50%;
  55. display: flex;
  56. font-size: 0.75rem;
  57. height: 20px;
  58. justify-content: center;
  59. width: 20px;
  60. pointer-events: none;
  61. transition: 0.15s 0.05s transform cubic-bezier(0, 0, 0.2, 1), 0.2s color cubic-bezier(0.4, 0, 0.2, 1), 0.2s background-color cubic-bezier(0.4, 0, 0.2, 1);
  62. position: relative;
  63. overflow: hidden;
  64. }
  65. .v-switch:not(.v-switch--inset) .v-switch__thumb {
  66. box-shadow: 0px 2px 4px -1px var(--v-shadow-key-umbra-opacity, rgba(0, 0, 0, 0.2)), 0px 4px 5px 0px var(--v-shadow-key-penumbra-opacity, rgba(0, 0, 0, 0.14)), 0px 1px 10px 0px var(--v-shadow-key-ambient-opacity, rgba(0, 0, 0, 0.12));
  67. }
  68. .v-switch.v-switch--flat:not(.v-switch--inset) .v-switch__thumb {
  69. background: rgb(var(--v-theme-surface-variant));
  70. color: rgb(var(--v-theme-on-surface-variant));
  71. }
  72. .v-switch.v-switch--flat:not(.v-switch--inset) .v-switch__thumb {
  73. box-shadow: 0px 0px 0px 0px var(--v-shadow-key-umbra-opacity, rgba(0, 0, 0, 0.2)), 0px 0px 0px 0px var(--v-shadow-key-penumbra-opacity, rgba(0, 0, 0, 0.14)), 0px 0px 0px 0px var(--v-shadow-key-ambient-opacity, rgba(0, 0, 0, 0.12));
  74. }
  75. .v-switch--inset .v-switch__thumb {
  76. height: 24px;
  77. width: 24px;
  78. transform: scale(0.6666666667);
  79. }
  80. .v-switch--inset .v-switch__thumb--filled {
  81. transform: none;
  82. }
  83. .v-switch--inset .v-selection-control--dirty .v-switch__thumb {
  84. transform: none;
  85. transition: 0.15s 0.05s transform cubic-bezier(0, 0, 0.2, 1);
  86. }
  87. .v-switch.v-input {
  88. flex: 0 1 auto;
  89. }
  90. .v-switch .v-selection-control {
  91. min-height: var(--v-input-control-height);
  92. }
  93. .v-switch .v-selection-control__input {
  94. border-radius: 50%;
  95. transition: 0.2s transform cubic-bezier(0.4, 0, 0.2, 1);
  96. position: absolute;
  97. }
  98. .v-locale--is-ltr.v-switch .v-selection-control__input, .v-locale--is-ltr .v-switch .v-selection-control__input {
  99. transform: translateX(-10px);
  100. }
  101. .v-locale--is-rtl.v-switch .v-selection-control__input, .v-locale--is-rtl .v-switch .v-selection-control__input {
  102. transform: translateX(10px);
  103. }
  104. .v-switch .v-selection-control__input .v-icon {
  105. position: absolute;
  106. }
  107. .v-locale--is-ltr.v-switch .v-selection-control--dirty .v-selection-control__input, .v-locale--is-ltr .v-switch .v-selection-control--dirty .v-selection-control__input {
  108. transform: translateX(10px);
  109. }
  110. .v-locale--is-rtl.v-switch .v-selection-control--dirty .v-selection-control__input, .v-locale--is-rtl .v-switch .v-selection-control--dirty .v-selection-control__input {
  111. transform: translateX(-10px);
  112. }
  113. .v-switch.v-switch--indeterminate .v-selection-control__input {
  114. transform: scale(0.8);
  115. }
  116. .v-switch.v-switch--indeterminate .v-switch__thumb {
  117. transform: scale(0.75);
  118. box-shadow: none;
  119. }
  120. .v-switch.v-switch--inset .v-selection-control__wrapper {
  121. width: auto;
  122. }
  123. .v-switch.v-input--vertical .v-label {
  124. min-width: max-content;
  125. }
  126. .v-switch.v-input--vertical .v-selection-control__wrapper {
  127. transform: rotate(-90deg);
  128. }
  129. @media (forced-colors: active) {
  130. .v-switch .v-switch__loader .v-progress-circular {
  131. color: currentColor;
  132. }
  133. .v-switch .v-switch__thumb {
  134. background-color: buttontext;
  135. }
  136. .v-switch .v-switch__track,
  137. .v-switch .v-switch__thumb {
  138. border: 1px solid;
  139. color: buttontext;
  140. }
  141. .v-switch:not(.v-switch--loading):not(.v-input--disabled) .v-selection-control--dirty .v-switch__thumb {
  142. background-color: highlight;
  143. }
  144. .v-switch:not(.v-input--disabled) .v-selection-control--dirty .v-switch__track {
  145. background-color: highlight;
  146. }
  147. .v-switch:not(.v-input--disabled) .v-selection-control--dirty .v-switch__track,
  148. .v-switch:not(.v-input--disabled) .v-selection-control--dirty .v-switch__thumb {
  149. color: highlight;
  150. }
  151. .v-switch.v-switch--inset .v-switch__track {
  152. border-width: 2px;
  153. }
  154. .v-switch.v-switch--inset:not(.v-switch--loading):not(.v-input--disabled) .v-selection-control--dirty .v-switch__thumb {
  155. background-color: highlighttext;
  156. color: highlighttext;
  157. }
  158. .v-switch.v-input--disabled .v-switch__thumb {
  159. background-color: graytext;
  160. }
  161. .v-switch.v-input--disabled .v-switch__track,
  162. .v-switch.v-input--disabled .v-switch__thumb {
  163. color: graytext;
  164. }
  165. .v-switch.v-switch--loading .v-switch__thumb {
  166. background-color: canvas;
  167. }
  168. .v-switch.v-switch--loading.v-switch--inset .v-switch__thumb, .v-switch.v-switch--loading.v-switch--indeterminate .v-switch__thumb {
  169. border-width: 0;
  170. }
  171. }