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