/* Copyright 2019 Adobe. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Default */ .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-track-color); /* :after is the focus ring */ /* :before is used for the handle of the switch */ &:before { background-color: var(--spectrum-switch-m-handle-background-color); border-color: var(--spectrum-switch-m-handle-border-color); } } .spectrum-Switch-input ~ .spectrum-Switch-label { color: var(--spectrum-switch-m-text-color); } /* Selected */ .spectrum-Switch-input { &:checked + .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-track-color-selected); &:before { border-color: var(--spectrum-switch-m-handle-border-color-selected); } } } /* Hover */ .spectrum-Switch:hover { .spectrum-Switch-input { & + .spectrum-Switch-switch { &:before { border-color: var(--spectrum-switch-m-handle-border-color-hover); box-shadow: none; } } & ~ .spectrum-Switch-label { color: var(--spectrum-switch-m-text-color-hover); } /* Selected Hover */ &:checked:enabled + .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-track-color-selected-hover); &:before { border-color: var(--spectrum-switch-m-handle-border-color-selected-hover); } } } } /* Down */ .spectrum-Switch:active { .spectrum-Switch-input { & + .spectrum-Switch-switch { &:before { border-color: var(--spectrum-switch-m-handle-border-color-down); } } & ~ .spectrum-Switch-label { color: var(--spectrum-switch-m-text-color-down); } /* Selected Down */ &:checked:enabled + .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-track-color-selected-down); &:before { border-color: var(--spectrum-switch-m-handle-border-color-selected-down); } } } } /* Disabled */ .spectrum-Switch .spectrum-Switch-input:disabled { & + .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-track-color-disabled); &:before { border-color: var(--spectrum-switch-m-handle-border-color-disabled); } } & ~ .spectrum-Switch-label { color: var(--spectrum-switch-m-text-color-disabled); } /* Selected Disabled */ &:checked { & + .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-track-color-selected-disabled); &:before { border-color: var( --spectrum-switch-m-handle-border-color-selected-disabled ); } } & ~ .spectrum-Switch-label { color: var(--spectrum-switch-m-text-color-selected-disabled); } } } /* Emphasized */ /* Emphasized Selected */ .spectrum-Switch--emphasized { .spectrum-Switch-input:checked + .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-emphasized-track-color-selected); &:before { border-color: var( --spectrum-switch-m-emphasized-handle-border-color-selected ); } } } /* Emphasized Selected Hover */ .spectrum-Switch--emphasized:hover { .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch { background-color: var( --spectrum-switch-m-emphasized-track-color-selected-hover ); &:before { border-color: var( --spectrum-switch-m-emphasized-handle-border-color-selected-hover ); } } } /* Emphasized Selected Down */ .spectrum-Switch.spectrum-Switch--emphasized:active { .spectrum-Switch-input:checked:enabled + .spectrum-Switch-switch { background-color: var( --spectrum-switch-m-emphasized-track-color-selected-down ); &:before { border-color: var( --spectrum-switch-m-emphasized-handle-border-color-selected-down ); } } } /* Key Focus */ .spectrum-Switch, .spectrum-Switch:hover { .spectrum-Switch-input:focus-ring { & + .spectrum-Switch-switch { &:after { box-shadow: 0 0 0 var(--spectrum-switch-m-focus-ring-size-key-focus) var(--spectrum-switch-m-focus-ring-color-key-focus); } &:before { border-color: var(--spectrum-switch-m-handle-border-color-key-focus); } } /* Selected Key Focus */ &:checked { & + .spectrum-Switch-switch { background-color: var(--spectrum-switch-m-track-color-selected-key-focus); &:before { border-color: var( --spectrum-switch-m-handle-border-color-selected-key-focus ); } } } } } .spectrum-Switch--emphasized, .spectrum-Switch--emphasized:hover { .spectrum-Switch-input:focus-ring { /* Selected Key Focus */ &:checked { & + .spectrum-Switch-switch { background-color: var( --spectrum-switch-m-emphasized-track-color-selected-key-focus ); &:before { border-color: var( --spectrum-switch-m-emphasized-handle-border-color-selected-key-focus ); } } } } }