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