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