UNPKG

@gravity-ui/uikit

Version:

Gravity UI base styling and components

152 lines (151 loc) 3.64 kB
@charset "UTF-8"; .g-switch { position: relative; } .g-switch__control { opacity: 0; cursor: pointer; } .g-switch__indicator { display: inline-block; position: relative; } .g-switch__indicator::before { content: ""; position: absolute; inset: 0; background-color: var(--g-color-base-generic-medium); transition: background 0.1s linear; } .g-switch__indicator::after { content: " "; visibility: hidden; } .g-switch__slider { position: absolute; content: ""; border-radius: 50%; background-color: var(--g-color-base-background); transition: transform 0.15s ease-out; } .g-switch__outline { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 100%; height: 100%; background: none; pointer-events: none; } .g-switch__control:focus-visible + .g-switch__outline { outline: 2px solid var(--g-color-line-focus); } .g-switch_loading .g-switch__slider::after { content: ""; position: absolute; box-sizing: border-box; border-radius: 50%; inset-inline-start: 2px; inset-block-start: 2px; border-color: var(--g-color-base-generic-accent); border-style: solid; border-block-start-color: transparent; animation: g-spin 1s linear infinite; } @media (prefers-reduced-motion: reduce) { .g-switch_loading .g-switch__slider::after { animation: none; } } .g-switch_size_s .g-switch__indicator, .g-switch_size_s .g-switch__indicator::before, .g-switch_size_s .g-switch__outline { width: 28px; height: 16px; border-radius: 10px; } .g-switch_size_s .g-switch__slider { inset-block-start: 2px; inset-inline-start: 2px; width: 12px; height: 12px; } .g-switch_size_s .g-switch__slider::after { width: 8px; height: 8px; border-width: 2px; } .g-switch_size_m .g-switch__indicator, .g-switch_size_m .g-switch__indicator::before, .g-switch_size_m .g-switch__outline { width: 36px; height: 20px; border-radius: 10px; } .g-switch_size_m .g-switch__slider { inset-block-start: 2px; inset-inline-start: 2px; width: 16px; height: 16px; } .g-switch_size_m .g-switch__slider::after { width: 12px; height: 12px; border-width: 2px; } .g-switch_size_m .g-switch__text { margin-block-start: 3px; } .g-switch_size_l .g-switch__indicator, .g-switch_size_l .g-switch__indicator::before, .g-switch_size_l .g-switch__outline { width: 42px; height: 24px; border-radius: 12px; } .g-switch_size_l .g-switch__slider { inset-block-start: 3px; inset-inline-start: 3px; width: 18px; height: 18px; } .g-switch_size_l .g-switch__slider::after { width: 14px; height: 14px; border-width: 2px; } .g-switch_size_l .g-switch__text { margin-block-start: 4px; } .g-switch:hover .g-switch__indicator::before { background-color: var(--g-color-base-generic-medium-hover); } .g-switch_checked .g-switch__slider { --_--translate-x: calc(100% * var(--g-flow-direction)); transform: translateX(var(--_--translate-x)); } .g-switch_checked.g-switch_loading .g-switch__slider::after { border-color: var(--g-color-base-brand); border-block-start-color: transparent; } .g-switch_checked .g-switch__indicator::before, .g-switch_checked:hover .g-switch__indicator::before { background-color: var(--g-color-base-brand); } .g-switch_disabled .g-switch__indicator::before { background-color: var(--g-color-base-generic-accent-disabled); } .g-switch_disabled.g-switch_checked .g-switch__indicator::before { background-color: var(--g-color-base-brand); opacity: 0.5; } .g-switch_disabled .g-switch__slider::after { opacity: 0.5; } @keyframes g-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }