@ebay/skin
Version:
Skin - CSS modules that represent the brand eBay
164 lines (143 loc) • 4.36 kB
CSS
:root {
--state-layer-neutral-on-strong: rgb(var(--color-neutral-900-rgb), 0);
--state-layer-neutral: rgb(var(--color-neutral-900-rgb), 0);
}
.switch {
box-sizing: border-box;
height: 40px;
position: relative;
vertical-align: middle;
}
div.switch {
display: flex;
}
span.switch {
display: inline-flex;
}
span.switch__button {
align-self: center;
background-color: var(
--switch-unchecked-background-color,
var(--color-background-secondary)
);
border-color: var(--switch-border-color, var(--color-border-strong));
border-radius: 400px;
border-style: solid;
border-width: 1px;
color: transparent;
display: inline-block;
position: relative;
text-indent: 100%;
width: 40px;
}
span.switch__button,
span.switch__button:after {
height: 24px;
transition: left 0.15s ease-out 0s;
}
span.switch__button:after {
background-color: var(
--switch-foreground-color,
var(--color-background-primary)
);
border-color: var(
--switch-foreground-border-color,
var(--color-border-strong)
);
border-radius: 50%;
border-style: solid;
border-width: 1px;
content: "";
display: block;
left: -1px;
position: absolute;
top: -1px;
transform: translateZ(0);
width: 24px;
}
input.switch__control,
span.switch__control {
height: 24px;
left: 0;
margin: 0;
outline: 0;
padding: 0;
position: absolute;
top: 8px;
width: 40px;
z-index: 1;
}
input.switch__control[disabled] + span.switch__button,
span.switch__control[aria-disabled="true"] + span.switch__button {
border-color: var(--switch-border-color, var(--color-border-disabled));
}
input.switch__control {
opacity: 0;
}
input.switch__control:focus + span.switch__button {
outline: 1px auto
var(--switch-custom-outline-color, var(--color-foreground-secondary));
}
input.switch__control:focus:not(:focus-visible) + span.switch__button {
outline: none;
}
input.switch__control[disabled] + span.switch__button:after,
span.switch__control[aria-disabled="true"] + span.switch__button:after {
border-color: var(--switch-border-color, var(--color-background-disabled));
}
input.switch__control:not([disabled]):focus + span.switch__button,
input.switch__control:not([disabled]):hover + span.switch__button,
span.switch__control:not([aria-disabled="true"]):focus + span.switch__button,
span.switch__control:not([aria-disabled="true"]):hover + span.switch__button {
overflow: hidden;
position: relative;
}
input.switch__control:not([disabled]):focus + span.switch__button:before,
input.switch__control:not([disabled]):hover + span.switch__button:before,
span.switch__control:not([aria-disabled="true"]):focus
+ span.switch__button:before,
span.switch__control:not([aria-disabled="true"]):hover
+ span.switch__button:before {
background-color: var(--color-state-layer-neutral);
background-color: var(--color-state-layer-hover);
content: "";
inset: 0;
pointer-events: none;
position: absolute;
}
input.switch__control:not([disabled]):checked + span.switch__button,
span.switch__control:not([aria-disabled="true"])[aria-checked="true"]
+ span.switch__button {
background-color: var(
--switch-checked-background-color,
var(--color-background-accent)
);
}
input.switch__control[disabled]:checked + span.switch__button,
span.switch__control[aria-disabled="true"][aria-checked="true"]
+ span.switch__button {
background-color: var(
--switch-disabled-background-color,
var(--color-background-disabled)
);
border-color: var(--switch-border-color, var(--color-background-disabled));
}
input.switch__control:not([disabled]):focus-visible + span.switch__button,
span.switch__control:not([aria-disabled="true"]):focus-visible
+ span.switch__button {
box-shadow:
0 0 0 2px var(--color-background-primary),
0 0 0 4px var(--color-background-accent);
}
input.switch__control:checked + span.switch__button:after,
span.switch__control[aria-checked="true"] + span.switch__button:after {
left: 15px;
}
span.switch__control:focus:not(:focus-visible) {
outline: 0;
}
@media screen and (-ms-high-contrast: active) {
input.switch__control {
opacity: 1;
}
}