-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
button.css
234 lines (226 loc) 路 4.95 KB
/
button.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
.btn {
@apply font-semibold uppercase;
border-width: var(--border-btn, 1px);
animation: button-pop var(--animation-btn, 0.25s) ease-out;
text-transform: var(--btn-text-case, uppercase);
&:active:hover,
&:active:focus {
animation: none;
}
&:active:hover,
&:active:focus {
transform: scale(var(--btn-focus-scale, 0.95));
}
/* default btn */
& {
@apply border-neutral bg-neutral text-neutral-content;
&:hover,
&-active {
@apply border-neutral-focus bg-neutral-focus;
}
&:focus-visible {
outline: 2px solid hsl(var(--nf));
outline-offset: 2px;
}
}
/* brand colors */
&-primary {
@apply border-primary bg-primary text-primary-content;
&:hover,
&.btn-active {
@apply border-primary-focus bg-primary-focus;
}
&:focus-visible {
outline: 2px solid hsl(var(--p));
}
}
&-secondary {
@apply border-secondary bg-secondary text-secondary-content;
&:hover,
&.btn-active {
@apply border-secondary-focus bg-secondary-focus;
}
&:focus-visible {
outline: 2px solid hsl(var(--s));
}
}
&-accent {
@apply border-accent bg-accent text-accent-content;
&:hover,
&.btn-active {
@apply border-accent-focus bg-accent-focus;
}
&:focus-visible {
outline: 2px solid hsl(var(--a));
}
}
/* btn with state colors */
&-info {
@apply border-info bg-info text-info-content;
&:hover,
&.btn-active {
@apply border-info bg-info;
}
&:focus-visible {
outline: 2px solid hsl(var(--in));
}
}
&-success {
@apply border-success bg-success text-success-content;
&:hover,
&.btn-active {
@apply border-success bg-success;
}
&:focus-visible {
outline: 2px solid hsl(var(--su));
}
}
&-warning {
@apply border-warning bg-warning text-warning-content;
&:hover,
&.btn-active {
@apply border-warning bg-warning;
}
&:focus-visible {
outline: 2px solid hsl(var(--wa));
}
}
&-error {
@apply border-error bg-error text-error-content;
&:hover,
&.btn-active {
@apply border-error bg-error;
}
&:focus-visible {
outline: 2px solid hsl(var(--er));
}
}
/* glass */
&.glass {
&:hover,
&.btn-active {
--glass-opacity: 25%;
--glass-border-opacity: 15%;
}
&:focus-visible {
outline: 2px solid 0 0 2px currentColor;
}
}
/* btn variants */
&-ghost {
@apply border border-transparent bg-transparent text-current;
&:hover,
&.btn-active {
@apply border-opacity-0 bg-base-content bg-opacity-20;
}
&:focus-visible {
outline: 2px solid 0 0 2px currentColor;
}
}
&-link {
@apply border-transparent bg-transparent text-primary;
&:hover,
&.btn-active {
@apply border-transparent bg-transparent underline;
}
&:focus-visible {
outline: 2px solid 0 0 2px currentColor;
}
}
/* outline */
&-outline {
@apply border-current bg-transparent text-base-content;
&:hover {
@apply border-base-content bg-base-content text-base-100;
}
&.btn-primary {
@apply text-primary;
&:hover {
@apply border-primary-focus bg-primary-focus text-primary-content;
}
}
&.btn-secondary {
@apply text-secondary;
&:hover {
@apply border-secondary-focus bg-secondary-focus text-secondary-content;
}
}
&.btn-accent {
@apply text-accent;
&:hover {
@apply border-accent-focus bg-accent-focus text-accent-content;
}
}
&.btn-success {
@apply text-success;
&:hover {
@apply border-success bg-success text-success-content;
}
}
&.btn-info {
@apply text-info;
&:hover {
@apply border-info bg-info text-info-content;
}
}
&.btn-warning {
@apply text-warning;
&:hover {
@apply border-warning bg-warning text-warning-content;
}
}
&.btn-error {
@apply text-error;
&:hover {
@apply border-error bg-error text-error-content;
}
}
}
/* disabled */
&-disabled,
&[disabled] {
@apply border-opacity-0 bg-neutral bg-opacity-20 text-base-content text-opacity-20;
}
/* loading */
&.loading {
&.btn-square:before,
&.btn-circle:before {
@apply mr-0;
}
&.btn-xl:before,
&.btn-lg:before {
@apply h-5 w-5;
}
&.btn-sm:before,
&.btn-xs:before {
@apply h-3 w-3;
}
}
}
/* group */
.btn-group {
& > input[type="radio"]:checked.btn,
& > .btn-active {
@apply border-primary bg-primary text-primary-content;
&:focus-visible {
outline: 2px solid hsl(var(--p));
}
}
& > .btn:not(:first-of-type) {
@apply -ml-px rounded-l-none;
}
& > .btn:not(:last-of-type) {
@apply rounded-r-none;
}
}
@keyframes button-pop {
0% {
transform: scale(var(--btn-focus-scale, 0.95));
}
40% {
transform: scale(1.02);
}
100% {
transform: scale(1);
}
}