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