| 1 |
/* -------------------------------------------------------------------------- |
| 2 |
Toggle switch (wpsubs-toggle + wpsubs-toggle-ui) |
| 3 |
|
| 4 |
Usage: |
| 5 |
<input type="checkbox" class="wpsubs-toggle" id="my-toggle"> |
| 6 |
<span class="wpsubs-toggle-ui" aria-hidden="true"></span> |
| 7 |
-------------------------------------------------------------------------- */ |
| 8 |
.wpsubs-toggle { |
| 9 |
position: absolute !important; |
| 10 |
opacity: 0 !important; |
| 11 |
width: 0 !important; |
| 12 |
height: 0 !important; |
| 13 |
margin: 0 !important; |
| 14 |
padding: 0 !important; |
| 15 |
border: 0 !important; |
| 16 |
overflow: hidden; |
| 17 |
clip: rect(0 0 0 0); |
| 18 |
pointer-events: none; |
| 19 |
} |
| 20 |
|
| 21 |
.wpsubs-toggle + .wpsubs-toggle-ui { |
| 22 |
position: relative; |
| 23 |
display: inline-block; |
| 24 |
width: 40px; |
| 25 |
height: 20px; |
| 26 |
border-radius: 999px; |
| 27 |
background: #cbd5e1; |
| 28 |
transition: all 0.2s cubic-bezier(0.27, 0.2, 0.25, 1.51); |
| 29 |
vertical-align: middle; |
| 30 |
cursor: pointer; |
| 31 |
} |
| 32 |
|
| 33 |
.wpsubs-toggle + .wpsubs-toggle-ui::after { |
| 34 |
content: ""; |
| 35 |
position: absolute; |
| 36 |
top: 2px; |
| 37 |
left: 2px; |
| 38 |
width: 16px; |
| 39 |
height: 16px; |
| 40 |
border-radius: 50%; |
| 41 |
background: #fff; |
| 42 |
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); |
| 43 |
transition: all 0.2s cubic-bezier(0.27, 0.2, 0.25, 1.51); |
| 44 |
} |
| 45 |
|
| 46 |
.wpsubs-toggle:checked + .wpsubs-toggle-ui { |
| 47 |
background: var(--wpsubs-brand); |
| 48 |
} |
| 49 |
|
| 50 |
.wpsubs-toggle:checked + .wpsubs-toggle-ui::after { |
| 51 |
transform: translateX(20px); |
| 52 |
} |
| 53 |
|
| 54 |
.wpsubs-toggle:focus + .wpsubs-toggle-ui { |
| 55 |
outline: none; |
| 56 |
} |
| 57 |
|
| 58 |
.wpsubs-toggle:disabled + .wpsubs-toggle-ui { |
| 59 |
background: #e5e7eb; |
| 60 |
cursor: not-allowed; |
| 61 |
} |
| 62 |
|
| 63 |
/* A toggle whose write is in flight. It shows the state it is moving to, |
| 64 |
dimmed and inert, until the server confirms. */ |
| 65 |
.wpsubs-toggle-busy { |
| 66 |
opacity: 0.55; |
| 67 |
pointer-events: none; |
| 68 |
} |
| 69 |
|