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