LEFT | RIGHT |
1 io-toggle { | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ |
| 17 |
| 18 io-toggle |
| 19 { |
| 20 --width: 30px; |
| 21 --height: 8px; |
| 22 --translateY: -4px; |
| 23 --translateX: 14px; |
2 display: inline-block; | 24 display: inline-block; |
3 display: inline-block; | 25 width: var(--width); |
4 width: 30px; | 26 height: var(--height); |
5 height: 8px; | |
6 border-radius: 4px; | 27 border-radius: 4px; |
7 background-color: #9b9b9b; | 28 background-color: #9b9b9b; |
8 transition: background .2s ease-out; | 29 transition: background .2s ease-out; |
9 will-change: background; | 30 will-change: background; |
10 transform: translateY(4px); | |
11 cursor: pointer; | 31 cursor: pointer; |
12 } | 32 } |
13 | 33 |
14 io-toggle[checked] { | 34 io-toggle[checked] |
| 35 { |
15 background-color: #92d3ea; | 36 background-color: #92d3ea; |
16 } | 37 } |
17 | 38 |
18 io-toggle[disabled] { | 39 io-toggle[disabled] |
| 40 { |
19 opacity: 0.5; | 41 opacity: 0.5; |
20 cursor: default; | 42 cursor: default; |
21 } | 43 } |
22 | 44 |
23 io-toggle button { | 45 io-toggle button |
24 width: 16px; | 46 { |
25 height: 16px; | 47 width: calc(var(--height) * 2); |
| 48 height: calc(var(--height) * 2); |
26 padding: 0; | 49 padding: 0; |
27 border: 2px solid #e1e0e1; | 50 border: 2px solid #e1e0e1; |
28 border-radius: 8px; | 51 border-radius: var(--height); |
29 transition: border .2s ease-out, box-shadow .2s ease-out, | 52 transition: border .2s ease-out, box-shadow .2s ease-out, |
30 transform .2s ease-out, width .2s ease-out; | 53 transform .2s ease-out, width .2s ease-out; |
31 will-change: border, box-shadow, transform, width; | 54 will-change: border, box-shadow, transform, width; |
32 transform: translateY(-4px); | 55 transform: translateY(var(--translateY)); |
33 outline: none; | 56 outline: none; |
34 cursor: pointer; | 57 cursor: pointer; |
35 } | 58 } |
36 | 59 |
37 io-toggle button[aria-checked="false"] | 60 io-toggle button[aria-checked="false"] |
38 { | 61 { |
39 background-color: #f1f1f1; | 62 background-color: #f1f1f1; |
40 box-shadow: 0 1px 2px 0 #e5d1d1; | 63 box-shadow: 0 1px 2px 0 #e5d1d1; |
41 } | 64 } |
42 | 65 |
43 io-toggle button[aria-checked="false"]:hover | 66 io-toggle button[aria-checked="false"]:hover |
44 { | 67 { |
45 box-shadow: 0 2px 4px 0 #d3b0b0; | 68 box-shadow: 0 2px 4px 0 #d3b0b0; |
46 } | 69 } |
47 | 70 |
48 io-toggle button[aria-checked="true"] | 71 io-toggle button[aria-checked="true"] |
49 { | 72 { |
50 background-color: #059cd0; | 73 background-color: #059cd0; |
51 border: 2px solid #059cd0; | 74 border: 2px solid #059cd0; |
52 box-shadow: 0 1px 2px 0 #a6cede; | 75 box-shadow: 0 1px 2px 0 #a6cede; |
53 transform: translateY(-4px) translateX(14px); | 76 transform: translateY(var(--translateY)) translateX(var(--translateX)); |
54 } | 77 } |
55 | 78 |
56 io-toggle button[aria-checked="true"]:hover | 79 io-toggle button[aria-checked="true"]:hover |
57 { | 80 { |
58 box-shadow: 0 2px 4px 0 #a6cede; | 81 box-shadow: 0 2px 4px 0 #a6cede; |
59 } | 82 } |
60 | 83 |
61 io-toggle button:focus, | 84 io-toggle button:focus, |
62 io-toggle button[aria-checked="true"]:focus | 85 io-toggle button[aria-checked="true"]:focus |
63 { | 86 { |
64 border: 2px solid #87bffe; | 87 border: 2px solid #87bffe; |
65 } | 88 } |
66 | 89 |
67 /* in case we will need to switch active/disabled direction | |
68 body[dir="rtl"] io-toggle button[aria-checked="true"] | 90 body[dir="rtl"] io-toggle button[aria-checked="true"] |
69 { | 91 { |
70 transform: translateY(-4px) translateX(-14px); | 92 transform: translateY(var(--translateY)) translateX(calc(var(--translateX) * -
1)); |
71 } | 93 } |
72 */ | |
LEFT | RIGHT |