/* ToggleSwitch */ /* Catalyst in dotcom applies a display: block to all web component elements. This ** rule overrides it so the status label and toggle switch are laid out correctly. */ .ToggleSwitch.ToggleSwitch { display: inline-flex; } .ToggleSwitch { align-items: center; display: inline-flex; gap: var(--yattho-controlStack-medium-gap-condensed, 8px); } .ToggleSwitch:hover .ToggleSwitch-knob { background-color: var(--color-btn-hover-bg); } .ToggleSwitch:active .ToggleSwitch-knob { background-color: var(--color-btn-active-bg); } .ToggleSwitch--checked .ToggleSwitch-statusOn { height: auto; visibility: visible; } .ToggleSwitch--checked .ToggleSwitch-statusOff { height: 0; visibility: hidden; } .ToggleSwitch-track { position: relative; display: block; width: var(--base-size-64, 64px); height: var(--yattho-control-medium-size, 32px); padding: 0; overflow: hidden; text-decoration: none; cursor: pointer; -webkit-user-select: none; user-select: none; background-color: var(--color-switch-track-bg); border: var(--yattho-borderWidth-thin, 1px) solid var(--color-switch-track-border); border-radius: var(--yattho-borderRadius-medium, 6px); transition-timing-function: cubic-bezier(0.5, 1, 0.89, 1); transition-duration: 80ms; transition-property: background-color, border-color; -webkit-appearance: none; appearance: none; } .ToggleSwitch-track:focus, .ToggleSwitch-track:focus-visible { outline-offset: 0; } @media (pointer: coarse) { .ToggleSwitch-track::before { position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; min-height: 44px; content: ""; transform: translateX(-50%) translateY(-50%); } } @media (prefers-reduced-motion) { .ToggleSwitch-track { transition: none; } .ToggleSwitch-track * { transition: none; } } .ToggleSwitch-track[aria-checked='true'][aria-disabled='true'] { background-color: var(--color-canvas-subtle); border-color: var(--color-border-subtle); } .ToggleSwitch-track[aria-checked='true'][aria-disabled='true']:hover, .ToggleSwitch-track[aria-checked='true'][aria-disabled='true']:active { background-color: var(--color-canvas-subtle); /* This is the most straightforward way of setting the knob's styles when the ** switch is both checked and disabled. */ } .ToggleSwitch-track[aria-checked='true'][aria-disabled='true']:hover .ToggleSwitch-knob, .ToggleSwitch-track[aria-checked='true'][aria-disabled='true']:active .ToggleSwitch-knob { background-color: var(--color-switch-knob-checked-disabled-bg); } .ToggleSwitch-track[aria-checked='true'][aria-disabled='true'] .ToggleSwitch-knob { background-color: var(--color-switch-knob-checked-disabled-bg); } .ToggleSwitch-track[aria-checked='true'] { background-color: var(--color-switch-track-checked-bg); border-color: var(--color-switch-track-checked-border); } .ToggleSwitch-track[aria-checked='true']:hover { background-color: var(--color-switch-track-checked-hover-bg); } .ToggleSwitch-track[aria-checked='true']:active { background-color: var(--color-switch-track-checked-active-bg); } .ToggleSwitch-track[aria-checked='true'] .ToggleSwitch-knob { background-color: var(--color-switch-knob-checked-bg); border: 0; transform: translateX(calc(100% + 1px)); } .ToggleSwitch-track[aria-checked='true'] .ToggleSwitch-lineIcon { transform: translateX(0%); } .ToggleSwitch-track[aria-checked='true'] .ToggleSwitch-circleIcon { transform: translateX(100%); } .ToggleSwitch-track[aria-disabled='true'] { cursor: not-allowed; background-color: var(--color-canvas-subtle); border-color: var(--color-border-subtle); transition-property: none; } .ToggleSwitch-track[aria-disabled='true']:hover .ToggleSwitch-knob, .ToggleSwitch-track[aria-disabled='true']:active .ToggleSwitch-knob { background-color: var(--color-btn-bg); } .ToggleSwitch-track[aria-disabled='true'] .ToggleSwitch-knob { border-color: var(--color-border-default); box-shadow: none; } .ToggleSwitch-track[aria-disabled='true'] .ToggleSwitch-knob:hover, .ToggleSwitch-track[aria-disabled='true'] .ToggleSwitch-knob:active { background-color: var(--color-btn-bg); } .ToggleSwitch-track[aria-disabled='true'] .ToggleSwitch-lineIcon { color: var(--color-fg-subtle); } .ToggleSwitch-track[aria-disabled='true'] .ToggleSwitch-circleIcon { color: var(--color-fg-subtle); } .ToggleSwitch-icons { display: flex; align-items: center; width: 100%; height: 100%; overflow: hidden; } .ToggleSwitch-lineIcon { line-height: 0; color: var(--color-accent-fg); transition-duration: 80ms; transition-property: transform; transform: translateX(-100%); flex: 1 0 50%; } .ToggleSwitch-circleIcon { line-height: 0; color: var(--color-fg-default); transition-duration: 80ms; transition-property: transform; transform: translateX(0); flex: 1 0 50%; } .ToggleSwitch-knob { position: absolute; top: -1px; bottom: -1px; z-index: 1; width: 50%; background-color: var(--color-btn-bg); border: var(--yattho-borderWidth-thin, 1px) solid var(--color-switch-track-border); border-radius: var(--yattho-borderRadius-medium, 6px); box-shadow: var(--color-shadow-medium), var(--color-btn-inset-shadow); transition-timing-function: cubic-bezier(0.5, 1, 0.89, 1); transition-duration: 80ms; transition-property: transform; transform: translateX(-1px); } @media (prefers-reduced-motion) { .ToggleSwitch-knob { transition: none; } } .ToggleSwitch-status { position: relative; font-size: var(--yattho-text-body-size-medium, 14px); line-height: 1.5; color: var(--color-fg-default); text-align: right; } .ToggleSwitch-statusIcon { width: var(--base-size-16, 16px); display: flex; margin-top: 0.063rem; } .ToggleSwitch--small .ToggleSwitch-status { font-size: var(--yattho-text-body-size-small, 12px); } .ToggleSwitch--small .ToggleSwitch-track { width: var(--base-size-48, 48px); height: var(--yattho-control-xsmall-size, 24px); } .ToggleSwitch--disabled .ToggleSwitch-status { color: var(--color-fg-muted); } .ToggleSwitch-statusOn { height: 0; visibility: hidden; } .ToggleSwitch-statusOff { height: auto; visibility: visible; } .ToggleSwitch--statusAtEnd { flex-direction: row-reverse; } .ToggleSwitch--statusAtEnd .ToggleSwitch-status { text-align: left; }