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