-
Notifications
You must be signed in to change notification settings - Fork 1
/
_Forms.css
282 lines (222 loc) · 6.35 KB
/
_Forms.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.Forms__field {
@apply form-control flex-col;
}
.Forms__field--buttons {
@apply flex flex-row justify-end items-center mt-4;
}
.Forms__button {
@apply btn btn-primary;
}
.Forms__button--submit {
/*@apply ;*/
}
.Forms__error_text {
@apply mt-2 text-sm text-red-600 dark:text-red-500;
}
.Forms__input {
@apply input w-full input-bordered input-secondary;
}
.Forms__textarea {
@apply textarea w-full textarea-bordered textarea-secondary h-auto;
}
.Forms__required-note {
@apply label-text-alt badge badge-accent text-accent-content
}
/* standard select */
.Forms__select {
@apply select select-bordered select-secondary w-full;
}
.Forms__label-widget {
@apply label;
}
.Forms__label {
@apply label-text;
}
.Forms__help_text {
@apply label-text;
}
.Forms__field--error .Forms__input {
@apply input-error;
}
.Forms__field--error .Forms__select {
@apply select-error;
}
.Forms__field--error .Forms__label {
@apply text-red-700 dark:text-red-500;
}
/* FILE INPUT related styles */
.Forms__field--file .Forms__widget {
@apply flex flex-col;
}
.Forms__file-state {
/* status located in right */
@apply
w-auto self-end md:self-center border-secondary border-[1px] border-b-0 rounded-t
pl-2 md:pl-4
flex flex-row items-center gap-x-1 md:gap-x-2
;
height: 2em;
margin-top: -2em;
}
.Forms__file-state a {
/* link to current file */
@apply btn btn-sm btn-link text-secondary max-w-[5rem] truncate;
}
.Forms__file-state input[type=checkbox] {
/* checkbox to delete file, hidden */
@apply hidden;
}
.Forms__file-state label {
/* clear btn */
@apply
lowercase btn btn-sm btn-link text-gray-700 rounded-none rounded-tr-sm
px-1 md:px-2
;
}
.Forms__file-state input[type=checkbox]:checked + label {
/* activate CLEAR btn */
@apply btn-secondary;
}
.Forms__field--file .Forms__file {
/* file input bordered cover */
@apply w-full pl-0;
}
.Forms__field--file .Forms__file::file-selector-button {
/* file selector button styled as part of input */
@apply btn btn-link hover:bg-white hover:border-transparent;
}
/* single checkbox */
.Forms__checkbox:is(input) {
@apply toggle toggle-lg toggle-secondary mx-auto;
}
.Forms__field--checkbox .Forms__widget {
@apply text-center
}
/* checkbox list */
.Forms__checkbox:not(input) {
@apply h-auto p-2 pb-0 flex flex-row flex-wrap justify-evenly;
}
.Forms__checkbox:not(input) > div {
@apply flex-shrink-0 w-min mr-1.5 mb-2;
}
.Forms__checkbox:not(input) input {
@apply hidden;
}
.Forms__checkbox:not(input) label {
@apply badge badge-lg badge-outline flex flex-row items-center gap-x-2
whitespace-nowrap select-none cursor-pointer;
}
.Forms__field--disabled .Forms__checkbox:not(input) {
@apply bg-base-200 border-base-200 !cursor-not-allowed [&_*]:!cursor-not-allowed;
}
.Forms__field--disabled .Forms__checkbox:not(input) label {
@apply opacity-70;
}
.Forms__checkbox:not(input) input:checked + label {
@apply badge-primary
}
/* tom select styles */
.Forms__field--select .ts-wrapper {
@apply bg-transparent h-auto;
}
.Forms__field--select .ts-wrapper.disabled {
@apply bg-base-200 border-base-200 !cursor-not-allowed [&_*]:!cursor-not-allowed;
}
.Forms__field--select .ts-dropdown,
.Forms__field--select .ts-control,
.Forms__field--select .ts-control input {
@apply text-inherit;
}
.Forms__field--select .ts-control {
/* fight versus tom-select styles */
@apply bg-transparent !border-none p-0 flex flex-row items-center;
}
.Forms__field--select .ts-control input {
@apply focus-visible:outline-0 min-w-[auto]
}
.Forms__field--select .ts-control .item {
@apply text-sm font-bold;
line-height: 2;
}
.Forms__field--select .ts-dropdown {
/* fight versus tom-select styles */
@apply rounded shadow -mt-1;
}
.Forms__field--select .ts-dropdown .option {
@apply px-4 py-4
}
}
/* auto-generated by django, cannot be in component (or it's gonna be striped) */
.Forms__form--basefilterform {
@apply
flex flex-col space-y-2 items-start
md:flex-row md:space-x-2 md:space-y-0
;
}
.Forms__form--basefilterform .Forms__select {
@apply select-sm font-normal;
}
.Forms__form--basefilterform .Forms__input {
@apply input-sm;
}
.Forms__form--basefilterform .Forms__label-widget {
@apply pb-1;
}
.Forms__form--basefilterform .Forms__widget {
@apply flex flex-row items-center space-x-0.5;
}
.Forms__form--basefilterform .Forms__field--buttons {
@apply self-end;
}
/* all configuration forms rendered */
.Forms__form--basemodelform[class*="configurationform"] {
@apply flex flex-row flex-wrap;
.Forms__field {
@apply w-full md:w-1/2 px-2 flex-col md:flex-col;
&.Forms__field--buttons {
@apply w-full flex-row;
}
}
.Forms__label {
@apply font-bold;
}
}
/* basically disables all the responsiveness to keep the layout */
.Forms__form--loginform,
.Forms__form--resetpasswordform,
.Forms__form--signupform {
@apply flex flex-col flex-wrap;
.Forms__field {
@apply w-full flex-col;
&.Forms__field--buttons {
@apply w-full flex-row;
}
}
}
/* loading indicator for buttons with htmx */
[hx-post] {
@apply relative
}
[hx-post]:not(form).htmx-request:after {
@apply right-2 absolute transform text-lg;
content: "⏳";
animation: flipHourglass 1.5s infinite;
animation-direction: alternate;
animation-delay: 500ms;
}
@keyframes flipHourglass {
from, 20% {
transform: rotate(0deg);
}
80%, to {
transform: rotate(180deg);
}
}
/* TODO: needed after daysiui migration to v4, probably better would be to drop it */
.btn {
@apply uppercase
}