Toast.module.css 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* The fade delay comes from the component as `--dsh-toast-hold`, so one value
  2. drives both the unmount timer and this animation; the fallback matches the
  3. component's own default. The fade DURATION still has to agree with FADE_MS
  4. in Toast.tsx, which no owner varies. */
  5. .toast {
  6. position: fixed;
  7. top: 120px;
  8. left: 50%;
  9. /* Above the 1000 the image lightbox backdrop uses: a failure reported while
  10. a preview is open must stay readable. */
  11. z-index: 1100;
  12. /* Announcements never intercept clicks. */
  13. pointer-events: none;
  14. display: flex;
  15. align-items: center;
  16. gap: 10px;
  17. max-width: min(560px, calc(100vw - 48px));
  18. padding: 12px 16px;
  19. border-radius: 14px;
  20. background: var(--dsw-alias-button-contrast-fill);
  21. color: var(--dsw-alias-label-primary-inverted);
  22. font-size: 14px;
  23. line-height: 22px;
  24. box-shadow: var(--dsw-shadow-lv3);
  25. transform: translateX(-50%);
  26. animation:
  27. dsh-toast-in 160ms ease-out,
  28. dsh-toast-fade 1000ms ease var(--dsh-toast-hold, 3000ms) forwards;
  29. }
  30. .icon {
  31. display: grid;
  32. place-items: center;
  33. flex: none;
  34. color: var(--dsw-alias-state-warn-label);
  35. }
  36. .text {
  37. min-width: 0;
  38. }
  39. @keyframes dsh-toast-in {
  40. from {
  41. opacity: 0;
  42. transform: translate(-50%, -6px);
  43. }
  44. to {
  45. opacity: 1;
  46. transform: translate(-50%, 0);
  47. }
  48. }
  49. @keyframes dsh-toast-fade {
  50. to {
  51. opacity: 0;
  52. }
  53. }
  54. /* Reduced motion drops the slide-in; the delayed fade (an opacity change,
  55. not movement) still ends the banner before the timed unmount. */
  56. @media (prefers-reduced-motion: reduce) {
  57. .toast {
  58. animation: dsh-toast-fade 1000ms ease var(--dsh-toast-hold, 3000ms) forwards;
  59. }
  60. }