]> BookStack Code Mirror - bookstack/blob - resources/sass/_forms.scss
whitespace only
[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: 12px;
132     padding-inline-end: 12px;
133     max-width: 864px;
134   }
135   [drawio-diagram]:hover {
136     outline: 2px solid var(--color-primary);
137   }
138 }
139
140 html.markdown-editor-display.dark-mode {
141   background-color: #222;
142   body {
143     background-color: #222;
144   }
145 }
146
147 .editor-toolbar {
148   height: 32px;
149   width: 100%;
150   font-size: 11px;
151   line-height: 1.6;
152   border-bottom: 1px solid #CCC;
153   @include lightDark(background-color, #FFF, #333);
154   @include lightDark(border-color, #CCC, #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 .form-group.ambrosia-container, .form-group.ambrosia-container * {
393     position:absolute !important;
394     height:1px !important;
395     width:1px !important;
396     margin:-1px !important;
397     padding:0 !important;
398     background:transparent !important;
399     color:transparent !important;
400     border:none !important;
401     overflow: hidden !important;
402     clip: rect(0,0,0,0) !important;
403     white-space: nowrap !important;
404 }
405
406 .title-input input[type="text"] {
407   display: block;
408   width: 100%;
409   padding: $-s;
410   margin-top: 0;
411   font-size: 2em;
412   height: auto;
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 .description-input > .tox-tinymce {
425   border: 1px solid #DDD !important;
426   @include lightDark(border-color, #DDD !important, #000 !important);
427   border-radius: 3px;
428   .tox-toolbar__primary {
429     justify-content: end;
430   }
431 }
432
433 .search-box {
434   max-width: 100%;
435   position: relative;
436   button[tabindex="-1"] {
437     background-color: transparent;
438     border: none;
439     @include lightDark(color, #666, #AAA);
440     padding: 0;
441     cursor: pointer;
442     position: absolute;
443     left: 8px;
444     top: 9px;
445     @include rtl {
446       right: 8px;
447       left: auto;
448     }
449   }
450   input {
451     display: block;
452     padding: $-xs * 1.5;
453     padding-inline-start: $-l + 4px;
454     width: 300px;
455     max-width: 100%;
456     height: auto;
457   }
458   &.flexible input {
459     width: 100%;
460   }
461   button.search-box-cancel {
462     left: auto;
463     right: 0;
464   }
465 }
466
467 .contained-search-box {
468   display: flex;
469   height: 38px;
470   z-index: -1;
471   &.floating {
472     box-shadow: $bs-med;
473     border-radius: 4px;
474     overflow: hidden;
475     @include whenDark {
476       border: 1px solid #000;
477     }
478   }
479   input, button {
480     height: 100%;
481     border-radius: 0;
482     border: 1px solid #ddd;
483     @include lightDark(border-color, #ddd, #000);
484     margin-inline-start: -1px;
485     &:last-child {
486       border-inline-end: 0;
487     }
488   }
489   input {
490     border: 0;
491     flex: 5;
492     padding: $-xs $-s;
493     &:focus, &:active {
494       outline: 1px dotted var(--color-primary);
495       outline-offset: -2px;
496       border: 0;
497     }
498   }
499   button {
500     border: 0;
501     width: 48px;
502     border-inline-start: 1px solid #DDD;
503     background-color: #FFF;
504     @include lightDark(background-color, #FFF, #333);
505     @include lightDark(color, #444, #AAA);
506   }
507   button:focus {
508     outline: 1px dotted var(--color-primary);
509     outline-offset: -2px;
510   }
511   svg {
512     margin: 0;
513   }
514   @include smaller-than($s) {
515     width: 180px;
516   }
517 }
518
519 .outline > input {
520   border: 0;
521   border-bottom: 2px solid #DDD;
522   border-radius: 0;
523   &:focus, &:active {
524     border: 0;
525     border-bottom: 2px solid #AAA;
526     outline: 0;
527   }
528 }
529
530
531 .image-picker img {
532   background-color: #BBB;
533   max-width: 100%;
534 }
535
536 .custom-file-input {
537   overflow: hidden;
538   padding: 0;
539   position: absolute;
540   white-space: nowrap;
541   width: 1px;
542   height: 1px;
543   border: 0;
544   clip: rect(0, 0, 0, 0);
545 }
546 .custom-file-input:focus + label {
547   border-color: var(--color-primary);
548   outline: 1px solid var(--color-primary);
549 }
550
551 input.shortcut-input {
552   width: auto;
553   max-width: 120px;
554   height: auto;
555 }