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