blob: 40794ecc0667a01ee8a125ec7deca927f7bc1230 [file] [log] [blame]
Adrià Vilanova Martíneze5263f12022-05-29 19:22:13 +02001import {css} from 'lit';
2
3export const SHARED_STYLES = css`
4 button:not(.notbtn),
5 input,
6 select,
7 option {
8 font-size: 13px !important;
9 }
10
11 button.notbtn {
12 appearance: none;
13 background: none;
14 border: none;
15 border-radius: 0;
16 font: inherit;
17 padding: 0;
18 }
19
20 h1, h2, h3 {
21 user-select: none;
22 font-weight: normal;
23 line-height: 1;
24 }
25
26 h1 {
27 text-align: center;
28 font-size: 30px;
29 }
30
31 h2 {
32 font-size: 20px;
33 margin-bottom: 12px;
34 }
35
36 /* Copy of Chrome stylesheet (widgets.css), adapted by not applying styles
37 * for buttons with the class |nobtn|.
38 **/
39
40 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
41 * Use of this source code is governed by a BSD-style license that can be
42 * found in https://chromium.googlesource.com/chromium/src/+/master/LICENSE */
43
44 /* This file defines styles for form controls. The order of rule blocks is
45 * important as there are some rules with equal specificity that rely on order
46 * as a tiebreaker. These are marked with OVERRIDE. */
47
48 /* Default state **************************************************************/
49
50 :-webkit-any(button:not(.notbtn),
51 input[type='button'],
52 input[type='submit']):not(.custom-appearance):not(.link-button),
53 select,
54 input[type='checkbox'],
55 input[type='radio'] {
56 -webkit-appearance: none;
57 -webkit-user-select: none;
58 background-image: -webkit-linear-gradient(#ededed, #ededed 38%, #dedede);
59 border: 1px solid rgba(0, 0, 0, 0.25);
60 border-radius: 2px;
61 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08),
62 inset 0 1px 2px rgba(255, 255, 255, 0.75);
63 color: #444;
64 font: inherit;
65 margin: 0 1px 0 0;
66 outline: none;
67 text-shadow: 0 1px 0 rgb(240, 240, 240);
68 }
69
70 :-webkit-any(button:not(.notbtn),
71 input[type='button'],
72 input[type='submit']):not(.custom-appearance):not(.link-button),
73 select {
74 min-height: 2em;
75 min-width: 4em;
76
77 }
78
79 :-webkit-any(button:not(.notbtn),
80 input[type='button'],
81 input[type='submit']):not(.custom-appearance):not(.link-button) {
82 -webkit-padding-end: 10px;
83 -webkit-padding-start: 10px;
84 }
85
86 select {
87 -webkit-appearance: none;
88 -webkit-padding-end: 20px;
89 -webkit-padding-start: 6px;
90 /* OVERRIDE */
91 background-image: -webkit-image-set(url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAAUklEQVQY02P4z0AMRGZGMaShwCisyhITmb8huMzfEhOxKvuvsGAh208Ik+3ngoX/FbBbClcIUcSAw21QhXxfIIrwKAMpfNsEUYRXGVCEFc6CQwBqq4CCCtU4VgAAAABJRU5ErkJggg==') 1x, url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAQCAQAAAA/1a6rAAAAQUlEQVR4Xu3MsQnAMBAEMI1+myf9gw0+3ASCenmu+mQn2yGn3S4Mp906DEW3CEPfzTD03QxD380w3OmIUHe9v+u9QwAt93yns5cAAAAASUVORK5CYII=') 2x),
92 -webkit-linear-gradient(#ededed, #ededed 38%, #dedede);
93 background-position: right center;
94 background-repeat: no-repeat;
95 }
96
97 html[dir='rtl'] select {
98 background-position: center left;
99 }
100
101 input[type='checkbox'] {
102
103 bottom: 2px;
104 height: 13px;
105 position: relative;
106 vertical-align: middle;
107 width: 13px;
108 }
109
110 input[type='radio'] {
111 /* OVERRIDE */
112 border-radius: 100%;
113 bottom: 1px;
114 height: 15px;
115 position: relative;
116 vertical-align: middle;
117 width: 15px;
118 }
119
120 /* TODO(estade): add more types here? */
121 input[type='number'],
122 input[type='password'],
123 input[type='search'],
124 input[type='text'],
125 input[type='url'],
126 input:not([type]),
127 textarea {
128 border: 1px solid #bfbfbf;
129 border-radius: 2px;
130 box-sizing: border-box;
131 color: #444;
132 font: inherit;
133 margin: 0;
134 /* Use min-height to accommodate addditional padding for touch as needed. */
135 min-height: 2em;
136 padding: 3px;
137 outline: none;
138 /* For better alignment between adjacent buttons and inputs. */
139 padding-bottom: 4px;
140 }
141
142 input[type='search'] {
143 -webkit-appearance: textfield;
144 /* NOTE: Keep a relatively high min-width for this so we don't obscure the end
145 * of the default text in relatively spacious languages (i.e. German). */
146 min-width: 160px;
147 }
148
149 /* Remove when https://bugs.webkit.org/show_bug.cgi?id=51499 is fixed.
150 * TODO(dbeam): are there more types that would benefit from this? */
151 input[type='search']::-webkit-textfield-decoration-container {
152 direction: inherit;
153 }
154
155 /* Checked ********************************************************************/
156
157 input[type='checkbox']:checked::before {
158 -webkit-user-select: none;
159 background-image: -webkit-image-set(url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAQAAAADpb+tAAAAaElEQVR4Xl3PIQoCQQCF4Y8JW42D1bDZ4iVEjDbxFpstYhC7eIVBZHkXFGw734sv/TqDQQ8Xb1udja/I8igeIm7Aygj2IpoKTGZnVRNxAHYi4iPiDlA9xX+aNQDFySziqDN6uSp6y7ofEMwZ05uUZRkAAAAASUVORK5CYII=') 1x, url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAQAAABuvaSwAAAAvElEQVR4XrXPMUrDYBzG4UeRZnAQnFxq3XT3AsVABm8QPIHQIeAJuoqb2s1BcHAIin4HVLqEvx9NQgb5rc/wvn4mNBUbqlKDcezCp6Qexxx7lbapx/CBe6mrHsYrKXQ7hKtIre1nOD/W9eiQiK80inis680JEc+1kien+TEfzom4sJG2aZXxmG9LIqaRerohx6V2J72zl2NY2OTUgxm7MEU25sURfZg4590Zw5iFZ8mXS0ZwN+eaPjyh/8O/H7bzPJ5NOo0AAAAASUVORK5CYII=') 2x);
160 background-size: 100% 100%;
161 content: '';
162 display: block;
163 height: 100%;
164 width: 100%;
165 }
166
167 input[type='radio']:checked::before {
168 background-color: #666;
169 border-radius: 100%;
170 bottom: 3px;
171 content: '';
172 display: block;
173 left: 3px;
174 position: absolute;
175 right: 3px;
176 top: 3px;
177 }
178
179 /* Hover **********************************************************************/
180
181 :enabled:hover:-webkit-any(
182 select,
183 input[type='checkbox'],
184 input[type='radio'],
185 :-webkit-any(
186 button:not(.notbtn),
187 input[type='button'],
188 input[type='submit']):not(.custom-appearance):not(.link-button)) {
189 background-image: -webkit-linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
190 border-color: rgba(0, 0, 0, 0.3);
191 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12),
192 inset 0 1px 2px rgba(255, 255, 255, 0.95);
193 color: black;
194 }
195
196 :enabled:hover:-webkit-any(select) {
197 /* OVERRIDE */
198 background-image: -webkit-image-set(url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAAUklEQVQY02P4z0AMRGZGMaShwCisyhITmb8huMzfEhOxKvuvsGAh208Ik+3ngoX/FbBbClcIUcSAw21QhXxfIIrwKAMpfNsEUYRXGVCEFc6CQwBqq4CCCtU4VgAAAABJRU5ErkJggg==') 1x, url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAQCAQAAAA/1a6rAAAAQUlEQVR4Xu3MsQnAMBAEMI1+myf9gw0+3ASCenmu+mQn2yGn3S4Mp906DEW3CEPfzTD03QxD380w3OmIUHe9v+u9QwAt93yns5cAAAAASUVORK5CYII=') 2x),
199 -webkit-linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
200 }
201
202 /* Active *********************************************************************/
203
204 :enabled:active:-webkit-any(
205 select,
206 input[type='checkbox'],
207 input[type='radio'],
208 :-webkit-any(
209 button:not(.notbtn),
210 input[type='button'],
211 input[type='submit']):not(.custom-appearance):not(.link-button)) {
212 background-image: -webkit-linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
213 box-shadow: none;
214 text-shadow: none;
215 }
216
217 :enabled:active:-webkit-any(select) {
218 /* OVERRIDE */
219 background-image: -webkit-image-set(url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAAUklEQVQY02P4z0AMRGZGMaShwCisyhITmb8huMzfEhOxKvuvsGAh208Ik+3ngoX/FbBbClcIUcSAw21QhXxfIIrwKAMpfNsEUYRXGVCEFc6CQwBqq4CCCtU4VgAAAABJRU5ErkJggg==') 1x, url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAQCAQAAAA/1a6rAAAAQUlEQVR4Xu3MsQnAMBAEMI1+myf9gw0+3ASCenmu+mQn2yGn3S4Mp906DEW3CEPfzTD03QxD380w3OmIUHe9v+u9QwAt93yns5cAAAAASUVORK5CYII=') 2x),
220 -webkit-linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
221 }
222
223 /* Disabled *******************************************************************/
224
225 :disabled:-webkit-any(
226 button:not(.notbtn),
227 input[type='button'],
228 input[type='submit']):not(.custom-appearance):not(.link-button),
229 select:disabled {
230 background-image: -webkit-linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
231 border-color: rgba(80, 80, 80, 0.2);
232 box-shadow: 0 1px 0 rgba(80, 80, 80, 0.08),
233 inset 0 1px 2px rgba(255, 255, 255, 0.75);
234 color: #aaa;
235 }
236
237 select:disabled {
238 /* OVERRIDE */
239 background-image: -webkit-image-set(url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAAICAQAAACxSAwfAAAASklEQVQY02P4z0AMRGZGMaShwCisyhITG/4jw8RErMr+KyxYiFC0YOF/BeyWIikEKWLA4Ta4QogiPMpACt82QRThVQYUYYWz4BAAGr6Ii6kEPacAAAAASUVORK5CYII=') 1x, url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAQCAQAAADQF8WVAAAARElEQVR4Xu3MsQ0AIAwEsYx+m4fySsgLOuTe1Re9z4De4DzbdVDnmZ0ENcrsZJVkdoIKMzurMLOzSjNhlWfCapBlfpZbeMFeGdxKIEQAAAAASUVORK5CYII=') 2x),
240 -webkit-linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
241 }
242
243 input:disabled:-webkit-any([type='checkbox'],
244 [type='radio']) {
245 opacity: .75;
246 }
247
248 input:disabled:-webkit-any([type='password'],
249 [type='search'],
250 [type='text'],
251 [type='url'],
252 :not([type])) {
253 color: #999;
254 }
255
256 /* Focus **********************************************************************/
257
258 :enabled:focus:-webkit-any(
259 select,
260 input[type='checkbox'],
261 input[type='number'],
262 input[type='password'],
263 input[type='radio'],
264 input[type='search'],
265 input[type='text'],
266 input[type='url'],
267 input:not([type]),
268 :-webkit-any(
269 button:not(.notbtn),
270 input[type='button'],
271 input[type='submit']):not(.custom-appearance):not(.link-button)) {
272 /* OVERRIDE */
273 -webkit-transition: border-color 200ms;
274 /* We use border color because it follows the border radius (unlike outline).
275 * This is particularly noticeable on mac. */
276 border-color: rgb(77, 144, 254);
277 outline: none;
278 }
279
280 /* Link buttons ***************************************************************/
281
282 .link-button {
283 -webkit-box-shadow: none;
284 background: transparent none;
285 border: none;
286 color: rgb(17, 85, 204);
287 cursor: pointer;
288 /* Input elements have -webkit-small-control which can override the body font.
289 * Resolve this by using 'inherit'. */
290 font: inherit;
291 margin: 0;
292 padding: 0;
293 }
294
295 .link-button:hover {
296 text-decoration: underline;
297 }
298
299 .link-button:active {
300 color: rgb(5, 37, 119);
301 text-decoration: underline;
302 }
303
304 .link-button[disabled] {
305 color: #999;
306 cursor: default;
307 text-decoration: none;
308 }
309
310 /* Checkbox/radio helpers ******************************************************
311 *
312 * .checkbox and .radio classes wrap labels. Checkboxes and radios should use
313 * these classes with the markup structure:
314 *
315 * <div class="checkbox">
316 * <label>
317 * <input type="checkbox"></input>
318 * <span>
319 * </label>
320 * </div>
321 */
322
323 :-webkit-any(.checkbox, .radio) label {
324 /* Don't expand horizontally: <http://crbug.com/112091>. */
325 display: -webkit-inline-box;
326 padding-bottom: 7px;
327 padding-top: 7px;
328 }
329
330 :-webkit-any(.checkbox, .radio) label input ~ span {
331 -webkit-margin-start: 0.6em;
332 -webkit-user-select: none;
333 /* Make sure long spans wrap at the same horizontal position they start. */
334 display: block;
335 }
336
337 :-webkit-any(.checkbox, .radio) label:hover {
338 color: black;
339 }
340
341 label > input:disabled:-webkit-any([type='checkbox'], [type='radio']) ~ span {
342 color: #999;
343 }
344`;