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