|
1 |
| -.p-inputswitch { |
2 |
| - @apply align-middle h-4 w-8; |
| 1 | +.p-toggleswitch { |
| 2 | + @apply inline-block w-8 h-4; |
3 | 3 |
|
4 |
| - .p-inputswitch-input { |
5 |
| - @apply appearance-none absolute top-0 left-0 w-full h-full p-0 m-0 opacity-0 z-[1] outline-0 outline-none rounded-full; |
| 4 | + &-input { |
| 5 | + @apply cursor-pointer appearance-none absolute top-0 start-0 w-full h-full p-0 m-0 opacity-0 z-[1] outline-0 outline-none rounded-full; |
6 | 6 | }
|
7 | 7 |
|
8 |
| - .p-inputswitch-slider { |
9 |
| - @apply bg-gray-30 rounded-full transition-none outline-transparent |
10 |
| - before:bg-white before:duration-200 before:h-3 before:left-0.5 before:-mt-1.5 before:rounded-full before:w-3; |
11 |
| - } |
| 8 | + &-slider { |
| 9 | + @apply cursor-pointer w-full h-full border-0 border-none bg-gray-30 transition rounded-full drop-shadow-none; |
12 | 10 |
|
13 |
| - &.p-highlight .p-inputswitch-slider { |
14 |
| - @apply bg-secondary |
15 |
| - before:bg-white before:translate-x-4; |
16 |
| - } |
| 11 | + .p-toggleswitch.p-toggleswitch-checked & { |
| 12 | + @apply bg-secondary; |
| 13 | + } |
17 | 14 |
|
18 |
| - &:not(.p-disabled) { |
19 |
| - &:has(.p-inputswitch-input:hover) { |
20 |
| - .p-inputswitch-slider { |
21 |
| - @apply bg-gray-30; |
22 |
| - } |
| 15 | + .p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) & { |
| 16 | + @apply bg-gray-50; |
| 17 | + } |
23 | 18 |
|
24 |
| - &.p-highlight .p-inputswitch-slider { |
25 |
| - @apply bg-secondary; |
26 |
| - } |
| 19 | + .p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked & { |
| 20 | + @apply bg-secondary; |
27 | 21 | }
|
28 | 22 |
|
29 |
| - &:has(.p-inputswitch-input:focus-visible) .p-inputswitch-slider { |
30 |
| - @apply outline-0 outline-none outline-offset-0 shadow-lg; |
| 23 | + .p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:focus-visible) & { |
| 24 | + @apply outline-none outline-0; |
31 | 25 | }
|
32 |
| - } |
33 | 26 |
|
34 |
| - &.p-invalid > .p-inputswitch-slider { |
35 |
| - @apply border-error; |
| 27 | + .p-toggleswitch.p-disabled & { } |
| 28 | + |
| 29 | + .p-toggleswitch.p-invalid > & { |
| 30 | + @apply border border-solid border-danger; |
| 31 | + } |
36 | 32 | }
|
37 |
| -} |
38 | 33 |
|
39 |
| -.p-inputswitch-input { |
40 |
| - @apply cursor-pointer; |
41 |
| -} |
| 34 | + &-handle { |
| 35 | + @apply absolute flex justify-center items-center bg-white text-gray-90 h-3 w-3 top-0.5 left-0.5 rounded-full transition-colors; |
42 | 36 |
|
43 |
| -.p-inputswitch-slider { |
44 |
| - @apply absolute cursor-pointer top-0 left-0 right-0 bottom-0 border border-transparent |
45 |
| - before:absolute before:content-[""] before:top-1/2; |
46 |
| -} |
| 37 | + .p-toggleswitch.p-toggleswitch-checked & { |
| 38 | + @apply translate-x-4; |
| 39 | + } |
| 40 | + |
| 41 | + .p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover) & { } |
| 42 | + |
| 43 | + .p-toggleswitch.p-disabled & { } |
47 | 44 |
|
| 45 | + .p-toggleswitch:not(.p-disabled):has(.p-toggleswitch-input:hover).p-toggleswitch-checked & { } |
| 46 | + } |
| 47 | + |
| 48 | + &.p-disabled { |
| 49 | + @apply opacity-100; |
| 50 | + } |
| 51 | +} |
0 commit comments