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