blob: 8b67a81878cd6d7aa1e8947ad84e81dd5c8725e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@import url("chrome://global/skin/design-system/text-and-typography.css");
:host {
display: flex;
flex-direction: column;
gap: 4px;
}
:host([disabled]) {
opacity: 0.4
}
::slotted(a[is="moz-support-link"]) {
display: inline-block;
}
#moz-toggle-label {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.description-wrapper,
.description-wrapper ::slotted([slot="support-link"]) {
margin: 0;
}
.toggle-button {
--toggle-background-color: var(--button-background-color);
--toggle-background-color-hover: var(--button-background-color-hover);
--toggle-background-color-active: var(--button-background-color-active);
--toggle-background-color-pressed: var(--color-accent-primary);
--toggle-background-color-pressed-hover: var(--color-accent-primary-hover);
--toggle-background-color-pressed-active: var(--color-accent-primary-active);
--toggle-border-color: var(--border-interactive-color);
--toggle-border-radius: var(--border-radius-circle);
--toggle-border-width: var(--border-width);
--toggle-height: var(--size-item-small);
--toggle-width: var(--size-item-large);
--toggle-dot-background-color: var(--toggle-border-color);
--toggle-dot-background-color-on-pressed: var(--color-canvas);
--toggle-dot-margin: 1px;
--toggle-dot-height: calc(var(--toggle-height) - 2 * var(--toggle-dot-margin) - 2 * var(--toggle-border-width));
--toggle-dot-width: var(--toggle-dot-height);
--toggle-dot-transform-x: calc(var(--toggle-width) - 4 * var(--toggle-dot-margin) - var(--toggle-dot-width));
}
.toggle-button {
appearance: none;
padding: 0;
margin: 0;
border: var(--toggle-border-width) solid var(--toggle-border-color);
height: var(--toggle-height);
width: var(--toggle-width);
border-radius: var(--toggle-border-radius);
background: var(--toggle-background-color);
box-sizing: border-box;
flex-shrink: 0;
}
.toggle-button:focus-visible {
outline: var(--focus-outline);
outline-offset: var(--focus-outline-offset);
}
.toggle-button:enabled:hover {
background: var(--toggle-background-color-hover);
border-color: var(--toggle-border-color);
}
.toggle-button:enabled:active {
background: var(--toggle-background-color-active);
border-color: var(--toggle-border-color);
}
.toggle-button[aria-pressed="true"] {
background: var(--toggle-background-color-pressed);
border-color: transparent;
}
.toggle-button[aria-pressed="true"]:enabled:hover {
background: var(--toggle-background-color-pressed-hover);
border-color: transparent;
}
.toggle-button[aria-pressed="true"]:enabled:active {
background: var(--toggle-background-color-pressed-active);
border-color: transparent;
}
.toggle-button::before {
display: block;
content: "";
background-color: var(--toggle-dot-background-color);
height: var(--toggle-dot-height);
width: var(--toggle-dot-width);
margin: var(--toggle-dot-margin);
border-radius: var(--toggle-border-radius);
translate: 0;
}
.toggle-button[aria-pressed="true"]::before {
translate: var(--toggle-dot-transform-x);
background-color: var(--toggle-dot-background-color-on-pressed);
}
.toggle-button[aria-pressed="true"]:enabled:hover::before,
.toggle-button[aria-pressed="true"]:enabled:active::before {
background-color: var(--toggle-dot-background-color-on-pressed);
}
.toggle-button[aria-pressed="true"]:-moz-locale-dir(rtl)::before,
.toggle-button[aria-pressed="true"]:dir(rtl)::before {
translate: calc(-1 * var(--toggle-dot-transform-x));
}
@media (prefers-reduced-motion: no-preference) {
.toggle-button::before {
transition: translate 100ms;
}
}
@media (prefers-contrast) {
:host([disabled]) {
opacity: 1;
}
:host([disabled]) > .toggle-button[aria-pressed="true"],
:host([disabled]) > .toggle-button {
background-color: var(--toggle-background-color-disabled);
border-color: var(--toggle-border-color-disabled);
}
:host([disabled]) > .toggle-button[aria-pressed="false"]::before,
:host([disabled]) > .toggle-button[aria-pressed="true"]::before {
background-color: var(--toggle-background-color-disabled);
}
.toggle-button {
--toggle-dot-background-color: var(--color-accent-primary);
--toggle-dot-background-color-hover: var(--color-accent-primary-hover);
--toggle-dot-background-color-active: var(--color-accent-primary-active);
--toggle-dot-background-color-on-pressed: var(--button-background-color);
--toggle-background-color-disabled: var(--button-background-color-disabled);
--toggle-border-color-hover: var(--border-interactive-color-hover);
--toggle-border-color-active: var(--border-interactive-color-active);
--toggle-border-color-disabled: var(--border-interactive-color-disabled);
}
.toggle-button:enabled:hover {
border-color: var(--toggle-border-color-hover);
}
.toggle-button:enabled:active {
border-color: var(--toggle-border-color-active);
}
.toggle-button[aria-pressed="true"]:enabled {
border-color: var(--toggle-border-color);
position: relative;
}
.toggle-button[aria-pressed="true"]:enabled:hover,
.toggle-button[aria-pressed="true"]:enabled:hover:active {
border-color: var(--toggle-border-color-hover);
}
.toggle-button[aria-pressed="true"]:enabled:active {
background-color: var(--toggle-dot-background-color-active);
border-color: var(--toggle-dot-background-color-hover);
}
.toggle-button[aria-pressed="true"]:enabled::after {
border: 1px solid var(--button-background-color);
content: '';
position: absolute;
height: var(--toggle-height);
width: var(--toggle-width);
display: block;
border-radius: var(--toggle-border-radius);
inset: -2px;
}
.toggle-button[aria-pressed="true"]:enabled:active::after {
border-color: var(--toggle-border-color-active);
}
.toggle-button:hover::before,
.toggle-button:hover:active::before,
.toggle-button:active::before {
background-color: var(--toggle-dot-background-color-hover);
}
}
|