]> BookStack Code Mirror - bookstack/blob - resources/sass/_forms.scss
Added test to preference boolean endpoint
[bookstack] / resources / sass / _forms.scss
1
2 .input-base {
3   border-radius: 3px;
4   border: 1px solid #D4D4D4;
5   @include lightDark(background-color, #fff, #333);
6   @include lightDark(border-color, #d4d4d4, #111);
7   @include lightDark(color, #666, #AAA);
8   display: inline-block;
9   font-size: $fs-m;
10   padding: $-xs*1.8;
11   height: 40px;
12   width: 250px;
13   max-width: 100%;
14
15   &.neg, &.invalid {
16     border: 1px solid $negative;
17   }
18   &.pos, &.valid {
19     border: 1px solid $positive;
20   }
21   &.disabled, &[disabled] {
22     background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAYAAADEUlfTAAAAMUlEQVQIW2NkwAGuXbv2nxGbHEhCS0uLEUMSJgHShCKJLIEiiS4Bl8QmAZbEJQGSBAC62BuJ+tt7zgAAAABJRU5ErkJggg==);
23   }
24   &[readonly] {
25     background-color: #f8f8f8;
26   }
27   &:focus {
28     border-color: var(--color-primary);
29     outline: 1px solid var(--color-primary);
30   }
31 }
32
33 .input-fill-width {
34   width: 100% !important;
35 }
36
37 .fake-input {
38   @extend .input-base;
39   overflow: auto;
40 }
41
42 #html-editor {
43   display: none;
44 }
45
46 #markdown-editor {
47   position: relative;
48   z-index: 5;
49   #markdown-editor-input {
50     font-style: normal;
51     font-weight: 400;
52     padding: $-xs $-m;
53     color: #444;
54     border-radius: 0;
55     max-height: 100%;
56     flex: 1;
57     border: 0;
58     width: 100%;
59     &:focus {
60       outline: 0;
61     }
62   }
63   .markdown-display, .markdown-editor-wrap {
64     flex: 1;
65     position: relative;
66   }
67   &.fullscreen {
68     position: fixed;
69     top: 0;
70     left: 0;
71     height: 100%;
72     z-index: 2;
73   }
74 }
75
76 .markdown-editor-wrap {
77   display: flex;
78   flex-direction: column;
79   border-top: 1px solid #DDD;
80   border-bottom: 1px solid #DDD;
81   @include lightDark(border-color, #ddd, #000);
82   width: 50%;
83 }
84
85 .markdown-editor-wrap + .markdown-editor-wrap {
86   border-inline-start: 1px solid;
87   @include lightDark(border-color, #ddd, #000);
88 }
89
90 @include smaller-than($m) {
91   #markdown-editor {
92     flex-direction: column;
93   }
94   #markdown-editor .markdown-editor-wrap {
95     width: 100%;
96     max-width: 100%;
97     flex-grow: 1;
98   }
99   .editor-toolbar-label {
100     float: none !important;
101     @include lightDark(border-color, #DDD, #555);
102     display: block;
103   }
104   .markdown-editor-wrap:not(.active) .editor-toolbar + div,
105   .markdown-editor-wrap:not(.active) .editor-toolbar .buttons,
106   .markdown-editor-wrap:not(.active) .markdown-display {
107     display: none;
108   }
109   #markdown-editor .markdown-editor-wrap:not(.active) {
110     flex-grow: 0;
111     flex: none;
112     min-height: 0;
113   }
114 }
115
116 .markdown-editor-display {
117   background-color: #fff;
118   body {
119     display: block;
120     background-color: #fff;
121     padding-inline-start: 16px;
122     padding-inline-end: 16px;
123   }
124   [drawio-diagram]:hover {
125     outline: 2px solid var(--color-primary);
126   }
127 }
128
129 html.markdown-editor-display.dark-mode {
130   background-color: #222;
131   body {
132     background-color: #222;
133   }
134 }
135
136 .editor-toolbar {
137   height: 32px;
138   width: 100%;
139   font-size: 11px;
140   line-height: 1.6;
141   border-bottom: 1px solid #DDD;
142   background-color: #EEE;
143   @include lightDark(background-color, #eee, #111);
144   @include lightDark(border-color, #ddd, #000);
145   flex: none;
146   @include whenDark {
147     button {
148       color: #AAA;
149     }
150   }
151 }
152
153 .editor-toolbar .buttons {
154   font-size: $fs-m;
155   .dropdown-menu {
156     padding: 0;
157   }
158   .toggle-switch {
159     margin: $-s 0;
160   }
161 }
162
163 .editor-toolbar .buttons button {
164   font-size: .9rem;
165   width: 2rem;
166   text-align: center;
167   border-left: 1px solid;
168   @include lightDark(border-color, #DDD, #555);
169   svg {
170     margin-inline-end: 0;
171   }
172   &:hover {
173     @include lightDark(background-color, #DDD, #222);
174   }
175 }
176
177
178 label {
179   @include lightDark(color, #666, #ddd);
180   display: block;
181   line-height: 1.4em;
182   font-size: 0.94em;
183   font-weight: 400;
184   padding-bottom: 2px;
185   margin-bottom: 0.2em;
186   &.inline {
187     display: inline-block;
188   }
189 }
190
191 label.radio, label.checkbox {
192   font-weight: 400;
193   user-select: none;
194   input[type="radio"], input[type="checkbox"] {
195     margin-inline-end: $-xs;
196   }
197 }
198
199 label.inline.checkbox {
200   margin-inline-end: $-m;
201 }
202
203 label + p.small {
204   margin-bottom: 0.8em;
205 }
206
207 table.form-table {
208   max-width: 100%;
209   td {
210     overflow: hidden;
211     padding: math.div($-xxs, 2) 0;
212   }
213 }
214
215 input[type="text"], input[type="number"], input[type="email"], input[type="date"], input[type="search"], input[type="url"],
216 input[type="color"], input[type="password"], select, textarea {
217   @extend .input-base;
218 }
219
220 select {
221   -webkit-appearance: none;
222   -moz-appearance: none;
223   appearance: none;
224   background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23666666'><polygon points='0,0 100,0 50,50'/></svg>");
225   background-size: 10px 12px;
226   background-position: calc(100% - 20px) 64%;
227   background-repeat: no-repeat;
228
229   @include rtl {
230     background-position: 20px 70%;
231   }
232 }
233
234 input[type=date] {
235   width: 190px;
236 }
237
238 input[type=color] {
239   height: 60px;
240   &.small {
241     height: 42px;
242     width: 60px;
243     padding: 2px;
244   }
245 }
246
247 .toggle-switch {
248   user-select: none;
249   display: inline-grid;
250   grid-template-columns: (16px + $-s) 1fr;
251   align-items: center;
252   margin: $-m 0;
253   .custom-checkbox {
254     width: 16px;
255     height: 16px;
256     border-radius: 2px;
257     display: inline-block;
258     border: 2px solid currentColor;
259     opacity: 0.6;
260     overflow: hidden;
261     fill: currentColor;
262     .svg-icon {
263       width: 100%;
264       height: 100%;
265       margin: 0;
266       bottom: auto;
267       top: -1.5px;
268       left: 0;
269       transition: transform ease-in-out 120ms;
270       transform: scale(0);
271       transform-origin: center center;
272     }
273   }
274   input[type=checkbox] {
275     display: none;
276   }
277   input[type=checkbox]:checked + .custom-checkbox .svg-icon {
278     transform: scale(1);
279   }
280   .custom-checkbox:hover {
281     background-color: rgba(0, 0, 0, 0.05);
282     opacity: 0.8;
283   }
284   input[type=checkbox][disabled] ~ * {
285     opacity: 0.8;
286     cursor: not-allowed;
287   }
288   input[type=checkbox][disabled] ~ .custom-checkbox {
289     border-color: #999;
290     color: #999 !important;
291     background: #f2f2f2;
292   }
293 }
294 .toggle-switch-list {
295   .toggle-switch {
296     margin: $-xs 0;
297   }
298   &.compact .toggle-switch {
299     margin: 1px 0;
300   }
301 }
302
303 .form-group {
304   margin-bottom: $-s;
305 }
306
307 .setting-list > div {
308   border-bottom: 1px solid #DDD;
309   padding: $-xl 0;
310   &:last-child {
311     border-bottom: none;
312   }
313 }
314 .setting-list-label {
315   color: #222;
316   font-size: 1rem;
317 }
318 .setting-list-label + p.small {
319   margin-bottom: 0;
320 }
321 .setting-list-label + .grid {
322   margin-top: $-m;
323 }
324
325 .setting-list .grid, .stretch-inputs {
326   input[type=text], input[type=email], input[type=password], select {
327     width: 100%;
328   }
329 }
330
331 .simple-code-input {
332   background-color: #F8F8F8;
333   font-family: monospace;
334   font-size: 12px;
335   min-height: 100px;
336   display: block;
337   width: 100%;
338 }
339
340 .form-group {
341   div.text-pos, div.text-neg, p.text-post, p.text-neg {
342     padding: $-xs 0;
343   }
344 }
345
346 .form-group.collapsible {
347   padding: 0 $-m;
348   border: 1px solid;
349   @include lightDark(border-color, #DDD, #000);
350   border-radius: 4px;
351   .collapse-title {
352     margin-inline-start: -$-m;
353     margin-inline-end: -$-m;
354     padding: $-s $-m;
355     display: block;
356     width: calc(100% + 32px);
357     text-align: start;
358   }
359   .collapse-title, .collapse-title label {
360     cursor: pointer;
361   }
362   .collapse-title label {
363     padding-bottom: 0;
364     margin-bottom: 0;
365     color: inherit;
366   }
367   .collapse-title label:before {
368     display: inline-block;
369     content: '▸';
370     margin-inline-end: $-m;
371     transition: all ease-in-out 400ms;
372     transform: rotate(0);
373   }
374   .collapse-content {
375     display: none;
376     padding-bottom: $-m;
377   }
378   &.open .collapse-title label:before {
379     transform: rotate(90deg);
380   }
381 }
382
383 .title-input input[type="text"] {
384   display: block;
385   width: 100%;
386   padding: $-s;
387   margin-top: 0;
388   font-size: 2em;
389   height: auto;
390 }
391
392 .title-input.page-title {
393   font-size: 0.8em;
394   @include lightDark(background-color, #fff, #333);
395   .input {
396     border: 0;
397     margin-bottom: -1px;
398   }
399   input[type="text"] {
400     max-width: 840px;
401     margin: 0 auto;
402     border: none;
403     height: auto;
404   }
405 }
406
407 .page-title input {
408   display: block;
409   width: 100%;
410   font-size: 1.4em;
411 }
412
413 .description-input textarea {
414   display: block;
415   width: 100%;
416   padding: $-s;
417   font-size: $fs-m;
418   color: #666;
419   height: auto;
420 }
421
422 div[editor-type="markdown"] .title-input.page-title input[type="text"] {
423   max-width: 100%;
424   border-radius: 0;
425 }
426
427 .search-box {
428   max-width: 100%;
429   position: relative;
430   button[tabindex="-1"] {
431     background-color: transparent;
432     border: none;
433     @include lightDark(color, #666, #AAA);
434     padding: 0;
435     cursor: pointer;
436     position: absolute;
437     left: 8px;
438     top: 9px;
439     @include rtl {
440       right: 8px;
441       left: auto;
442     }
443   }
444   input {
445     display: block;
446     padding: $-xs * 1.5;
447     padding-inline-start: $-l + 4px;
448     width: 300px;
449     max-width: 100%;
450     height: auto;
451   }
452   &.flexible input {
453     width: 100%;
454   }
455   .search-box-cancel {
456     left: auto;
457     right: 0;
458   }
459 }
460
461 .outline > input {
462   border: 0;
463   border-bottom: 2px solid #DDD;
464   border-radius: 0;
465   &:focus, &:active {
466     border: 0;
467     border-bottom: 2px solid #AAA;
468     outline: 0;
469   }
470 }
471
472
473 .image-picker img {
474   background-color: #BBB;
475   max-width: 100%;
476 }
477
478 .custom-file-input {
479   overflow: hidden;
480   padding: 0;
481   position: absolute;
482   white-space: nowrap;
483   width: 1px;
484   height: 1px;
485   border: 0;
486   clip: rect(0, 0, 0, 0);
487 }
488 .custom-file-input:focus + label {
489   border-color: var(--color-primary);
490   outline: 1px solid var(--color-primary);
491 }
492
493 input.shortcut-input {
494   width: auto;
495   max-width: 120px;
496   height: auto;
497 }