f187cd40c91f31ea2128773749122c532f79cf05
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / style / layout / form.scss
1 input[type="date"],
2 input[type="datetime"],
3 input[type="email"],
4 input[type="number"],
5 input[type="password"],
6 input[type="search"],
7 input[type="tel"],
8 input[type="text"],
9 input[type="url"],
10 select,
11 textarea {
12 margin: 0; /* safari fix */
13 @include input;
14 }
15
16 /* set placeholder color */
17 input[type="date"],
18 input[type="datetime"],
19 input[type="email"],
20 input[type="number"],
21 input[type="password"],
22 input[type="search"],
23 input[type="tel"],
24 input[type="text"],
25 input[type="url"] {
26 &::placeholder {
27 color: var(--wcfInputPlaceholder);
28
29 &:focus,
30 &:hover {
31 color: var(--wcfInputPlaceholderActive);
32 }
33 }
34
35 &[disabled],
36 &[readonly] {
37 background-color: var(--wcfInputDisabledBackground) !important;
38 border-color: var(--wcfInputDisabledBorder) !important;
39 color: var(--wcfInputDisabledText) !important;
40 }
41 }
42
43 textarea::placeholder {
44 color: var(--wcfInputPlaceholder);
45
46 &:focus,
47 &:hover {
48 color: var(--wcfInputPlaceholderActive);
49 }
50 }
51
52 input[type="search"],
53 input[type="text"] {
54 -webkit-appearance: none;
55 }
56
57 @media (pointer: coarse) {
58 input[type="date"],
59 input[type="datetime"],
60 input[type="email"],
61 input[type="number"],
62 input[type="password"],
63 input[type="search"],
64 input[type="tel"],
65 input[type="text"],
66 input[type="url"],
67 select,
68 textarea {
69 font-size: 16px;
70 padding: 6px 8px;
71 }
72 }
73
74 textarea {
75 border-width: 1px;
76 font-weight: 400;
77 resize: vertical;
78 vertical-align: top;
79 width: 100%;
80
81 @include wcfFontDefault;
82
83 &[disabled],
84 &[readonly] {
85 background-color: var(--wcfInputDisabledBackground) !important;
86 border-color: var(--wcfInputDisabledBorder) !important;
87 color: var(--wcfInputDisabledText) !important;
88 }
89 }
90
91 input[disabled],
92 textarea[disabled] {
93 -webkit-text-fill-color: var(--wcfInputDisabledText); /* override safari font color change */
94 -webkit-opacity: 1; /* override mobile safari opacity change affecting text color */
95 }
96
97 select {
98 // The width is determined by the browser based upon the longest <option> contained,
99 // but this can cause the <select> to overflow the parent container. This is acceptable
100 // to some extent, but on mobile it can cause the entire site to have a horizontal
101 // scrollbar instead. Setting a `max-width` will cause the browser to respect the page
102 // boundaries and nicely wrap the displayed value instead.
103 max-width: 100%;
104
105 &.fullWidth {
106 width: 100%;
107 }
108 }
109
110 .formSubmit {
111 display: flex;
112 flex-direction: row-reverse;
113 flex-wrap: wrap;
114 gap: 10px;
115 justify-content: center;
116
117 &:not(:first-child) {
118 margin-top: 30px;
119 }
120 }
121
122 @include screen-xs {
123 .formSubmit {
124 input[type="button"],
125 input[type="reset"],
126 input[type="submit"],
127 .button,
128 a.button {
129 flex: 1;
130 }
131 }
132 }
133
134 .formSubmit.formSubmit.formSubmit + .section {
135 /* Intentional selector to overwrite existing selector. */
136 margin-top: 20px;
137 }
138
139 .inputAddon {
140 column-gap: 5px;
141 display: flex;
142
143 &:not(:last-child) {
144 margin-bottom: 5px;
145 }
146
147 > .inputPrefix,
148 > .inputSuffix {
149 align-items: center;
150 display: flex;
151 flex: 0 0 auto;
152 }
153
154 input {
155 flex: 1 auto;
156
157 & + .inputPrefix {
158 margin-left: 5px;
159 }
160 }
161 }
162
163 .inputAddonTextarea {
164 column-gap: 0;
165 flex-wrap: wrap;
166 row-gap: 5px;
167
168 > textarea {
169 flex: 0 0 100%;
170 }
171
172 > .ck.ck-editor {
173 flex: 0 0 100%;
174 margin-top: 0 !important;
175 }
176 }
177
178 .inputAddon input,
179 input {
180 &.tiny {
181 flex-grow: 0;
182 width: 80px;
183 }
184
185 &.long {
186 width: 100%;
187 }
188
189 @include screen-xs {
190 &.short {
191 flex-grow: 0;
192 width: 150px;
193 }
194
195 &.medium {
196 width: 100%;
197 }
198 }
199
200 @include screen-sm-up {
201 &.short {
202 flex-grow: 0;
203 min-width: 80px;
204 width: 10%;
205 }
206
207 &.medium {
208 flex-grow: 0;
209 min-width: 150px;
210 width: 30%;
211 }
212 }
213 }
214
215 .formError {
216 --color-error: #c00;
217
218 dt {
219 color: var(--color-error) !important;
220 }
221
222 input,
223 select,
224 textarea {
225 border-color: var(--color-error) !important;
226 }
227 }
228
229 html[data-color-scheme="dark"] .formError {
230 --color-error: #ff4747;
231 }
232
233 .formSuccess {
234 --color-success: rgb(46, 139, 87);
235
236 dt {
237 color: var(--color-success) !important;
238 }
239
240 input,
241 select,
242 textarea {
243 border-color: var(--color-success) !important;
244 }
245 }
246
247 /* grid-based form controls */
248 .formGrid {
249 dt {
250 display: none;
251 }
252
253 select {
254 width: 100%;
255 }
256 }
257
258 .formFieldRequired,
259 .customOptionRequired {
260 color: rgba(204, 0, 1, 1) !important;
261 }
262
263 .formFieldRequiredNotice {
264 color: var(--wcfContentDimmedText);
265 margin-top: 20px;
266 @include wcfFontSmall;
267 }
268
269 html[data-color-scheme="dark"] :is(.formFieldRequired, .customOptionRequired) {
270 color: #ff4444 !important;
271 }
272
273 /* password strength estimator */
274 .inputAddonPasswordStrength {
275 align-items: flex-start;
276
277 input.medium {
278 align-self: stretch;
279 }
280
281 @include screen-xs {
282 flex-wrap: wrap;
283
284 input:is(.medium, .long) {
285 width: auto;
286 }
287 }
288 }
289
290 .passwordStrengthRating {
291 flex: 0 0 auto;
292
293 @include screen-sm-up {
294 margin-left: 10px;
295 }
296
297 @include screen-xs {
298 margin-top: 5px;
299 width: 100%;
300 }
301 }
302
303 .passwordStrengthScore {
304 background-color: rgb(224, 224, 224);
305 border-radius: 3px;
306 display: block;
307 height: 10px;
308 overflow: hidden;
309 position: relative;
310
311 &::before {
312 background-color: transparent;
313 bottom: 0;
314 content: "";
315 left: 0;
316 position: absolute;
317 top: 0;
318 transition:
319 background-color 0.12s linear,
320 width 0.12s linear;
321 width: 0;
322 }
323
324 &[data-score="0"]::before {
325 background-color: #dd2c00;
326 width: 5%;
327 }
328 &[data-score="1"]::before {
329 background-color: #ff9100;
330 width: 20%;
331 }
332 &[data-score="2"]::before {
333 background-color: #cddc39;
334 width: 50%;
335 }
336 &[data-score="3"]::before {
337 background-color: #64dd17;
338 width: 85%;
339 }
340 &[data-score="4"]::before {
341 background-color: #2e7d32;
342 width: 100%;
343 }
344 }