|
16 | 16 | @switch-prefix-cls: ~'@{css-prefix}switch'; |
17 | 17 |
|
18 | 18 | .@{switch-prefix-cls} { |
19 | | - .component-css-vars-switch(); |
| 19 | + .inject-Switch-vars(); |
20 | 20 |
|
21 | 21 | display: inline-block; |
22 | | - width: var(--ti-switch-width); |
23 | | - height: var(--ti-switch-height); |
24 | | - line-height: calc(var(--ti-switch-height) - var(--ti-switch-border-weight) * 2); |
25 | | - border-radius: var(--ti-switch-border-radius); |
| 22 | + width: var(--tv-Switch-width); |
| 23 | + height: var(--tv-Switch-height); |
| 24 | + line-height: var(--tv-Switch-height); |
| 25 | + border-radius: var(--tv-Switch-border-radius); |
26 | 26 | vertical-align: middle; |
27 | | - border: var(--ti-switch-border-weight) solid var(--ti-switch-off-bg-color); |
28 | | - background-color: var(--ti-switch-off-bg-color); |
| 27 | + background-color: var(--tv-Switch-off-bg-color); |
29 | 28 | position: relative; |
30 | 29 | cursor: pointer; |
31 | 30 | outline: none; |
|
34 | 33 | background-color 0.2s ease-in-out; |
35 | 34 |
|
36 | 35 | &:focus-visible { |
37 | | - outline: 2px solid var(--ti-switch-on-bg-color); |
| 36 | + outline: 2px solid var(--tv-Switch-on-bg-color); |
38 | 37 | outline-offset: 1px; |
39 | 38 | } |
40 | 39 |
|
41 | 40 | & &-inner { |
42 | | - color: var(--ti-switch-text-color); |
43 | | - font-size: var(--ti-switch-inner-font-size); |
| 41 | + color: var(--tv-Switch-text-color); |
| 42 | + font-size: var(--tv-Switch-inner-font-size); |
44 | 43 | position: absolute; |
45 | 44 | } |
46 | 45 |
|
47 | 46 | &__text { |
48 | | - width: var(--ti-switch-text-width); |
| 47 | + width: var(--tv-Switch-text-width); |
49 | 48 | .@{switch-prefix-cls}-inner { |
50 | | - left: calc(var(--ti-switch-dot-size)); |
51 | | - width: calc(100% - var(--ti-switch-dot-size)); |
| 49 | + left: calc(var(--tv-Switch-dot-size)); |
| 50 | + width: calc(100% - var(--tv-Switch-dot-size)); |
52 | 51 | text-align: center; |
53 | 52 | overflow: hidden; |
54 | 53 | } |
55 | 54 | } |
56 | 55 |
|
57 | 56 | &__on-loading { |
58 | | - font-size: var(--ti-switch-on-loading-font-size); |
59 | | - fill: var(--ti-switch-on-loading-fill); |
| 57 | + font-size: var(--tv-Switch-on-loading-font-size); |
| 58 | + fill: var(--tv-Switch-on-loading-fill); |
60 | 59 | } |
| 60 | + |
61 | 61 | &__off-loading { |
62 | | - font-size: var(--ti-switch-off-loading-font-size); |
63 | | - fill: var(--ti-switch-off-loading-fill); |
| 62 | + font-size: var(--tv-Switch-off-loading-font-size); |
| 63 | + fill: var(--tv-Switch-off-loading-fill); |
64 | 64 | } |
| 65 | + |
65 | 66 | &__loading-mini { |
66 | | - font-size: var(--ti-switch-loading-mini-font-size); |
| 67 | + font-size: var(--tv-Switch-loading-mini-font-size); |
67 | 68 | } |
68 | 69 |
|
69 | 70 | &.mini { |
70 | | - width: var(--ti-switch-mini-width); |
71 | | - height: var(--ti-switch-mini-height); |
| 71 | + width: var(--tv-Switch-mini-width); |
| 72 | + height: var(--tv-Switch-mini-height); |
72 | 73 | } |
73 | 74 |
|
74 | 75 | &&-checked.disabled, |
75 | 76 | &.disabled { |
76 | 77 | cursor: not-allowed; |
77 | | - background: var(--ti-switch-disabled-bg-color); |
78 | | - border-color: var(--ti-switch-disabled-bg-color); |
| 78 | + background: var(--tv-Switch-disabled-bg-color); |
| 79 | + border-color: var(--tv-Switch-disabled-bg-color); |
79 | 80 |
|
80 | | - &::after { |
81 | | - background: var(--ti-switch-disabled-dot-bg-color); |
| 81 | + &:after { |
82 | 82 | cursor: not-allowed; |
83 | 83 | } |
84 | | - |
85 | | - .@{switch-prefix-cls}-inner { |
86 | | - color: var(--ti-switch-disabled-text-color); |
87 | | - } |
88 | 84 | } |
89 | 85 |
|
90 | 86 | &&-checked.disabled { |
91 | | - background: var(--ti-switch-checked-disabled-bg-color); |
92 | | - border-color: var(--ti-switch-checked-disabled-border-color); |
| 87 | + background: var(--tv-Switch-checked-disabled-bg-color); |
93 | 88 | } |
94 | 89 |
|
95 | 90 | &__button { |
96 | 91 | display: flex; |
97 | 92 | justify-content: center; |
98 | 93 | align-items: center; |
99 | 94 | content: ''; |
100 | | - width: var(--ti-switch-dot-size); |
101 | | - height: var(--ti-switch-dot-size); |
| 95 | + width: var(--tv-Switch-dot-size); |
| 96 | + height: var(--tv-Switch-dot-size); |
102 | 97 | border-radius: 50%; |
103 | | - background-color: var(--ti-switch-dot-bg-color); |
| 98 | + background-color: var(--tv-Switch-dot-bg-color); |
104 | 99 | position: absolute; |
105 | | - left: var(--ti-switch-dot-position-left); // smb新增 |
106 | | - top: var(--ti-switch-dot-position-top); // smb新增 |
| 100 | + left: var(--tv-Switch-dot-position-left); |
| 101 | + top: var(--tv-Switch-dot-position-top); |
107 | 102 | cursor: pointer; |
108 | 103 | transition: |
109 | 104 | left 0.2s ease-in-out, |
110 | 105 | width 0.2s ease-in-out; |
111 | 106 | } |
112 | 107 |
|
113 | 108 | &.mini &__button { |
114 | | - height: var(--ti-switch-mini-button-height); |
115 | | - width: var(--ti-switch-mini-button-width); |
116 | | - } |
| 109 | + height: var(--tv-Switch-mini-button-height); |
| 110 | + width: var(--tv-Switch-mini-button-width); |
| 111 | + } |
117 | 112 |
|
118 | 113 | &&-checked { |
119 | | - border-color: var(--ti-switch-on-bg-color); |
120 | | - background-color: var(--ti-switch-on-bg-color); |
| 114 | + background-color: var(--tv-Switch-on-bg-color); |
121 | 115 |
|
122 | 116 | .@{switch-prefix-cls}-inner { |
123 | 117 | left: 2px; |
124 | | - width: calc(100% - var(--ti-switch-dot-size)); |
| 118 | + width: calc(100% - var(--tv-Switch-dot-size)); |
125 | 119 | text-align: center; |
126 | 120 | overflow: hidden; |
127 | 121 | } |
128 | 122 | } |
129 | 123 |
|
130 | 124 | &&-checked .@{switch-prefix-cls}__button { |
131 | | - left: calc(100% - var(--ti-switch-dot-offset)); |
| 125 | + left: calc(100% - var(--tv-Switch-dot-offset)); |
132 | 126 | } |
| 127 | + |
133 | 128 | &&-checked&.mini &__button { |
134 | | - left: var(--ti-switch-mini-button-left); |
| 129 | + left: var(--tv-Switch-mini-button-left); |
135 | 130 | } |
136 | 131 | } |
0 commit comments