]> BookStack Code Mirror - bookstack/blob - resources/sass/_forms.scss
7e0f72355f3ee1f07275e07260483ecf8f168dea
[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: 10px 12px;
211   background-position: calc(100% - 20px) 64%;
212   background-repeat: no-repeat;
213
214   @include rtl {
215     background-position: 20px 70%;
216   }
217 }
218
219 input[type=date] {
220   width: 190px;
221 }
222
223 input[type=color] {
224   height: 60px;
225   &.small {
226     height: 42px;
227     width: 60px;
228     padding: 2px;
229   }
230 }
231
232 .toggle-switch {
233   user-select: none;
234   display: inline-grid;
235   grid-template-columns: (16px + $-s) 1fr;
236   align-items: center;
237   margin: $-m 0;
238   .custom-checkbox {
239     width: 16px;
240     height: 16px;
241     border-radius: 2px;
242     display: inline-block;
243     border: 2px solid currentColor;
244     opacity: 0.6;
245     overflow: hidden;
246     fill: currentColor;
247     .svg-icon {
248       width: 100%;
249       height: 100%;
250       margin: 0;
251       bottom: auto;
252       top: -1.5px;
253       left: 0;
254       transition: transform ease-in-out 120ms;
255       transform: scale(0);
256       transform-origin: center center;
257     }
258   }
259   input[type=checkbox] {
260     display: none;
261   }
262   input[type=checkbox]:checked + .custom-checkbox .svg-icon {
263     transform: scale(1);
264   }
265   .custom-checkbox:hover {
266     background-color: rgba(0, 0, 0, 0.05);
267     opacity: 0.8;
268   }
269   input[type=checkbox][disabled] ~ * {
270     opacity: 0.8;
271     cursor: not-allowed;
272   }
273   input[type=checkbox][disabled] ~ .custom-checkbox {
274     border-color: #999;
275     color: #999 !important;
276     background: #f2f2f2;
277   }
278 }
279 .toggle-switch-list {
280   .toggle-switch {
281     margin: $-xs 0;
282   }
283   &.compact .toggle-switch {
284     margin: 1px 0;
285   }
286 }
287
288 .form-group {
289   margin-bottom: $-s;
290 }
291
292 .setting-list > div {
293   border-bottom: 1px solid #DDD;
294   padding: $-xl 0;
295   &:last-child {
296     border-bottom: none;
297   }
298 }
299 .setting-list-label {
300   color: #222;
301   font-size: 1rem;
302 }
303 .setting-list-label + p.small {
304   margin-bottom: 0;
305 }
306 .setting-list-label + .grid {
307   margin-top: $-m;
308 }
309
310 .setting-list .grid, .stretch-inputs {
311   input[type=text], input[type=email], input[type=password], select {
312     width: 100%;
313   }
314 }
315
316 .simple-code-input {
317   background-color: #F8F8F8;
318   font-family: monospace;
319   font-size: 12px;
320   min-height: 100px;
321   display: block;
322   width: 100%;
323 }
324
325 .form-group {
326   div.text-pos, div.text-neg, p.text-post, p.text-neg {
327     padding: $-xs 0;
328   }
329 }
330
331 .form-group[collapsible] {
332   padding: 0 $-m;
333   border: 1px solid;
334   @include lightDark(border-color, #DDD, #000);
335   border-radius: 4px;
336   .collapse-title {
337     margin-inline-start: -$-m;
338     margin-inline-end: -$-m;
339     padding: $-s $-m;
340     display: block;
341     width: calc(100% + 32px);
342     text-align: start;
343   }
344   .collapse-title, .collapse-title label {
345     cursor: pointer;
346   }
347   .collapse-title label {
348     padding-bottom: 0;
349     margin-bottom: 0;
350     color: inherit;
351   }
352   .collapse-title label:before {
353     display: inline-block;
354     content: '▸';
355     margin-inline-end: $-m;
356     transition: all ease-in-out 400ms;
357     transform: rotate(0);
358   }
359   .collapse-content {
360     display: none;
361     padding-bottom: $-m;
362   }
363   &.open .collapse-title label:before {
364     transform: rotate(90deg);
365   }
366 }
367
368 .title-input input[type="text"] {
369   display: block;
370   width: 100%;
371   padding: $-s;
372   margin-top: 0;
373   font-size: 2em;
374   height: auto;
375 }
376
377 .title-input.page-title {
378   font-size: 0.8em;
379   @include lightDark(background-color, #fff, #333);
380   .input {
381     border: 0;
382     margin-bottom: -1px;
383   }
384   input[type="text"] {
385     max-width: 840px;
386     margin: 0 auto;
387     border: none;
388     height: auto;
389   }
390 }
391
392 .page-title input {
393   display: block;
394   width: 100%;
395   font-size: 1.4em;
396 }
397
398 .description-input textarea {
399   display: block;
400   width: 100%;
401   padding: $-s;
402   font-size: $fs-m;
403   color: #666;
404   height: auto;
405 }
406
407 div[editor-type="markdown"] .title-input.page-title input[type="text"] {
408   max-width: 100%;
409   border-radius: 0;
410 }
411
412 .search-box {
413   max-width: 100%;
414   position: relative;
415   button {
416     background-color: transparent;
417     border: none;
418     @include lightDark(color, #666, #AAA);
419     padding: 0;
420     cursor: pointer;
421     position: absolute;
422     left: 8px;
423     top: 9px;
424     @include rtl {
425       right: 8px;
426       left: auto;
427     }
428   }
429   input {
430     display: block;
431     padding: $-xs * 1.5;
432     padding-inline-start: $-l + 4px;
433     width: 300px;
434     max-width: 100%;
435     height: auto;
436   }
437   &.flexible input {
438     width: 100%;
439   }
440   .search-box-cancel {
441     left: auto;
442     right: 0;
443   }
444 }
445
446 .outline > input {
447   border: 0;
448   border-bottom: 2px solid #DDD;
449   border-radius: 0;
450   &:focus, &:active {
451     border: 0;
452     border-bottom: 2px solid #AAA;
453     outline: 0;
454   }
455 }
456
457
458 .image-picker img {
459   background-color: #BBB;
460   max-width: 100%;
461 }
462
463 .custom-file-input {
464   overflow: hidden;
465   padding: 0;
466   position: absolute;
467   white-space: nowrap;
468   width: 1px;
469   height: 1px;
470   border: 0;
471   clip: rect(0, 0, 0, 0);
472 }
473 .custom-file-input:focus + label {
474   border-color: var(--color-primary);
475   outline: 1px solid var(--color-primary);
476 }