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