| 1 |
/* -------------------------------------------------------------------------- |
| 2 |
Toast (wpsubs-toast) |
| 3 |
|
| 4 |
Transient confirmation, bottom-right. Use for something that already |
| 5 |
happened and needs no decision — a save, a delete. Anything the merchant |
| 6 |
must act on belongs in the page, not here: a toast leaves on its own and |
| 7 |
takes its message with it. |
| 8 |
|
| 9 |
JS: WPSubsToast.show(message, type) — see admin-components/toast.js. |
| 10 |
-------------------------------------------------------------------------- */ |
| 11 |
.wpsubs-toast-host { |
| 12 |
position: fixed; |
| 13 |
right: 24px; |
| 14 |
bottom: 24px; |
| 15 |
z-index: 100001; /* Above the modal layer, so a save behind one still shows. */ |
| 16 |
display: flex; |
| 17 |
flex-direction: column; |
| 18 |
align-items: flex-end; |
| 19 |
gap: 8px; |
| 20 |
pointer-events: none; |
| 21 |
} |
| 22 |
|
| 23 |
.wpsubs-toast { |
| 24 |
display: flex; |
| 25 |
align-items: center; |
| 26 |
gap: 9px; |
| 27 |
max-width: min(380px, calc(100vw - 48px)); |
| 28 |
padding: 11px 14px; |
| 29 |
border: 1px solid var(--wpsubs-border, #e5e7eb); |
| 30 |
border-radius: 6px; |
| 31 |
background: var(--wpsubs-surface, #fff); |
| 32 |
box-shadow: |
| 33 |
0 4px 16px rgba(0, 0, 0, 0.1), |
| 34 |
0 1px 4px rgba(0, 0, 0, 0.06); |
| 35 |
font-size: 13px; |
| 36 |
line-height: 1.45; |
| 37 |
color: var(--wpsubs-text, #374151); |
| 38 |
pointer-events: auto; |
| 39 |
|
| 40 |
/* The entry animates the slide only — never opacity. Animation is not |
| 41 |
guaranteed to run (a throttled background tab, a starved renderer), and a |
| 42 |
save confirmation that is stuck at opacity 0 is worse than one that never |
| 43 |
moved. Frozen, this is simply a toast sitting 6px low. */ |
| 44 |
animation: wpsubs-toast-in 0.18s ease-out; |
| 45 |
} |
| 46 |
|
| 47 |
@keyframes wpsubs-toast-in { |
| 48 |
from { |
| 49 |
transform: translateY(6px); |
| 50 |
} |
| 51 |
to { |
| 52 |
transform: translateY(0); |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
/* Leaving is the reverse, and safe to miss: the element is removed on a timer |
| 57 |
whether or not this runs. */ |
| 58 |
.wpsubs-toast.is-out { |
| 59 |
opacity: 0; |
| 60 |
transform: translateY(6px); |
| 61 |
transition: |
| 62 |
opacity 0.18s ease, |
| 63 |
transform 0.18s ease; |
| 64 |
} |
| 65 |
|
| 66 |
.wpsubs-toast__icon { |
| 67 |
flex: 0 0 auto; |
| 68 |
display: inline-flex; |
| 69 |
align-items: center; |
| 70 |
justify-content: center; |
| 71 |
width: 18px; |
| 72 |
height: 18px; |
| 73 |
border-radius: 50%; |
| 74 |
color: #fff; |
| 75 |
background: #16a34a; |
| 76 |
} |
| 77 |
|
| 78 |
.wpsubs-toast__icon svg { |
| 79 |
width: 11px; |
| 80 |
height: 11px; |
| 81 |
display: block; |
| 82 |
} |
| 83 |
|
| 84 |
.wpsubs-toast--error .wpsubs-toast__icon { |
| 85 |
background: #dc2626; |
| 86 |
} |
| 87 |
|
| 88 |
.wpsubs-toast__text { |
| 89 |
min-width: 0; |
| 90 |
} |
| 91 |
|
| 92 |
/* A toast that slides is decoration; one that appears is information. */ |
| 93 |
@media (prefers-reduced-motion: reduce) { |
| 94 |
.wpsubs-toast { |
| 95 |
animation: none; |
| 96 |
} |
| 97 |
|
| 98 |
.wpsubs-toast.is-out { |
| 99 |
transition: none; |
| 100 |
} |
| 101 |
} |
| 102 |
|