Skip to content

Commit ea80215

Browse files
authored
chore: Rename id to toggle (#1019)
1 parent dc42d53 commit ea80215

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

packages/uui-toggle/lib/uui-toggle.element.ts

+22-22
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class UUIToggleElement extends UUIBooleanInputElement {
3838

3939
renderCheckbox() {
4040
return html`
41-
<div id="slider">
41+
<div id="toggle">
4242
<div id="icon-checked">${iconCheck}</div>
4343
<div id="icon-unchecked">${iconRemove}</div>
4444
</div>
@@ -54,7 +54,7 @@ export class UUIToggleElement extends UUIBooleanInputElement {
5454
--uui-toggle-switch-width: calc(2 * var(--uui-toggle-size));
5555
}
5656
57-
#slider {
57+
#toggle {
5858
position: relative;
5959
grid-area: 'input';
6060
display: flex;
@@ -75,7 +75,7 @@ export class UUIToggleElement extends UUIBooleanInputElement {
7575
font-size: calc(var(--uui-toggle-size) * 0.6);
7676
}
7777
78-
label:hover input:not([disabled]) ~ #slider {
78+
label:hover input:not([disabled]) ~ #toggle {
7979
border-color: var(
8080
--uui-toggle-border-color-hover,
8181
var(--uui-color-border-emphasis)
@@ -86,7 +86,7 @@ export class UUIToggleElement extends UUIBooleanInputElement {
8686
);
8787
}
8888
89-
label:focus #slider {
89+
label:focus #toggle {
9090
border-color: var(
9191
--uui-toggle-border-color-focus,
9292
var(--uui-color-focus)
@@ -97,15 +97,15 @@ export class UUIToggleElement extends UUIBooleanInputElement {
9797
);
9898
}
9999
100-
input:checked ~ #slider {
100+
input:checked ~ #toggle {
101101
background-color: var(--uui-color-selected);
102102
}
103103
104-
label:hover input:checked:not([disabled]) ~ #slider {
104+
label:hover input:checked:not([disabled]) ~ #toggle {
105105
background-color: var(--uui-color-selected-emphasis);
106106
}
107107
108-
label:focus input:checked ~ #slider {
108+
label:focus input:checked ~ #toggle {
109109
background-color: var(--uui-color-selected-emphasis);
110110
}
111111
@@ -131,11 +131,11 @@ export class UUIToggleElement extends UUIBooleanInputElement {
131131
color: var(--uui-color-interactive);
132132
}
133133
134-
input:checked ~ #slider #icon-checked {
134+
input:checked ~ #toggle #icon-checked {
135135
color: var(--uui-color-selected-contrast);
136136
}
137137
138-
#slider::after {
138+
#toggle::after {
139139
content: '';
140140
position: absolute;
141141
top: 2px;
@@ -151,45 +151,45 @@ export class UUIToggleElement extends UUIBooleanInputElement {
151151
background-color 120ms;
152152
}
153153
154-
input:checked ~ #slider::after {
154+
input:checked ~ #toggle::after {
155155
left: calc(100% - 2px);
156156
transform: translateX(-100%);
157157
}
158158
159-
input:focus ~ #slider {
159+
input:focus ~ #toggle {
160160
outline: calc(2px * var(--uui-show-focus-outline, 1)) solid
161161
var(--uui-color-focus);
162162
}
163163
164-
:host(:not([disabled], [readonly])) label:active #slider::after {
164+
:host(:not([disabled], [readonly])) label:active #toggle::after {
165165
/** Stretch when mouse down */
166166
width: calc(1.06 * var(--uui-toggle-size));
167167
}
168168
169-
:host([disabled]) #slider {
169+
:host([disabled]) #toggle {
170170
background-color: var(--uui-color-disabled-standalone);
171171
}
172-
:host([disabled]) input:checked ~ #slider {
172+
:host([disabled]) input:checked ~ #toggle {
173173
background-color: var(--uui-color-disabled-contrast);
174174
}
175-
:host([disabled]) #slider::after {
175+
:host([disabled]) #toggle::after {
176176
background-color: var(--uui-color-disabled);
177177
}
178-
:host([disabled]) #slider #icon-unchecked {
178+
:host([disabled]) #toggle #icon-unchecked {
179179
color: var(--uui-color-disabled-contrast);
180180
}
181-
:host([disabled]) label:active #slider {
181+
:host([disabled]) label:active #toggle {
182182
animation: ${UUIHorizontalShakeAnimationValue};
183183
}
184-
:host([disabled]) input:checked #slider #icon-checked {
184+
:host([disabled]) input:checked #toggle #icon-checked {
185185
color: var(--uui-color-disabled-contrast);
186186
}
187187
188-
:host(:not([pristine]):invalid) #slider,
189-
:host(:not([pristine]):invalid) label:hover #slider,
188+
:host(:not([pristine]):invalid) #toggle,
189+
:host(:not([pristine]):invalid) label:hover #toggle,
190190
/* polyfill support */
191-
:host(:not([pristine])[internals-invalid]) #slider,
192-
:host(:not([pristine])[internals-invalid]) label:hover #slider {
191+
:host(:not([pristine])[internals-invalid]) #toggle,
192+
:host(:not([pristine])[internals-invalid]) label:hover #toggle {
193193
border: 1px solid var(--uui-color-danger-standalone);
194194
}
195195
`,

0 commit comments

Comments
 (0)