forked from saadeghi/daisyui
/
toggle.css
118 lines (117 loc) · 3.41 KB
/
toggle.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.toggle {
--tglbg: hsl(var(--b1));
--handleoffset: 1.5rem;
--handleoffsetcalculator: calc(var(--handleoffset) * -1);
--togglehandleborder: 0 0;
@apply h-6 w-12 cursor-pointer appearance-none border border-base-content border-opacity-20 bg-base-content bg-opacity-50 duration-300 ease-in-out rounded-badge;
transition: background, box-shadow var(--animation-input, 0.2s) ease-in-out;
box-shadow: var(--handleoffsetcalculator) 0 0 2px var(--tglbg) inset, 0 0 0 2px var(--tglbg) inset, var(--togglehandleborder);
[dir="rtl"] & {
--handleoffsetcalculator: calc(var(--handleoffset) * 1);
}
&:focus-visible {
outline: 2px solid hsl(var(--bc));
outline-offset: 2px;
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
--handleoffsetcalculator: var(--handleoffset);
@apply border-opacity-100 bg-opacity-100;
[dir="rtl"] & {
--handleoffsetcalculator: calc(var(--handleoffset) * -1);
}
}
&:indeterminate {
@apply border-opacity-100 bg-opacity-100;
box-shadow: calc(var(--handleoffset) / 2) 0 0 2px var(--tglbg) inset, calc(var(--handleoffset) / -2) 0 0 2px var(--tglbg) inset, 0 0 0 2px var(--tglbg) inset;
[dir="rtl"] & {
box-shadow: calc(var(--handleoffset) / 2) 0 0 2px var(--tglbg) inset, calc(var(--handleoffset) / -2) 0 0 2px var(--tglbg) inset, 0 0 0 2px var(--tglbg) inset;
}
}
&-primary {
&:focus-visible {
outline: 2px solid hsl(var(--p));
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
@apply border-primary;
@apply border-primary border-opacity-10 bg-primary text-primary-content;
}
}
&-secondary {
&:focus-visible {
outline: 2px solid hsl(var(--s));
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
@apply border-secondary;
@apply border-secondary border-opacity-10 bg-secondary text-secondary-content;
}
}
&-accent {
&:focus-visible {
outline: 2px solid hsl(var(--a));
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
@apply border-accent;
@apply border-accent border-opacity-10 bg-accent text-accent-content;
}
}
&-success {
&:focus-visible {
outline: 2px solid hsl(var(--su));
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
@apply border-success;
@apply border-success border-opacity-10 bg-success text-success-content;
}
}
&-warning {
&:focus-visible {
outline: 2px solid hsl(var(--wa));
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
@apply border-warning;
@apply border-warning border-opacity-10 bg-warning text-warning-content;
}
}
&-info {
&:focus-visible {
outline: 2px solid hsl(var(--in));
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
@apply border-info;
@apply border-info border-opacity-10 bg-info text-info-content;
}
}
&-error {
&:focus-visible {
outline: 2px solid hsl(var(--er));
}
&:checked,
&[checked="true"],
&[aria-checked=true] {
@apply border-error;
@apply border-error border-opacity-10 bg-error text-error-content;
}
}
&:disabled {
@apply cursor-not-allowed bg-transparent border-base-content opacity-30;
--togglehandleborder: 0 0 0 3px hsl(var(--bc)) inset, var(--handleoffsetcalculator) 0 0 3px hsl(var(--bc)) inset;
}
}
/* backward comptability */
.toggle-mark {
@apply hidden;
}