toast.css 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. [data-component="toast-region"] {
  2. position: fixed;
  3. bottom: 48px;
  4. right: 32px;
  5. z-index: 1000;
  6. display: flex;
  7. flex-direction: column;
  8. gap: 8px;
  9. max-width: 400px;
  10. width: 100%;
  11. pointer-events: none;
  12. [data-slot="toast-list"] {
  13. display: flex;
  14. flex-direction: column;
  15. gap: 8px;
  16. list-style: none;
  17. margin: 0;
  18. padding: 0;
  19. }
  20. }
  21. [data-component="toast"] {
  22. display: flex;
  23. align-items: flex-start;
  24. gap: 20px;
  25. padding: 16px 20px;
  26. pointer-events: auto;
  27. transition: all 150ms ease-out;
  28. border-radius: var(--radius-lg);
  29. border: 1px solid var(--border-weak-base);
  30. background: var(--surface-float-base);
  31. color: var(--text-invert-base);
  32. box-shadow: var(--shadow-md);
  33. [data-slot="toast-inner"] {
  34. display: flex;
  35. align-items: flex-start;
  36. gap: 10px;
  37. }
  38. &[data-opened] {
  39. animation: toastPopIn 150ms ease-out;
  40. }
  41. &[data-closed] {
  42. animation: toastPopOut 100ms ease-in forwards;
  43. }
  44. &[data-swipe="move"] {
  45. transform: translateX(var(--kb-toast-swipe-move-x));
  46. }
  47. &[data-swipe="cancel"] {
  48. transform: translateX(0);
  49. transition: transform 200ms ease-out;
  50. }
  51. &[data-swipe="end"] {
  52. animation: toastSwipeOut 100ms ease-out forwards;
  53. }
  54. /* &[data-variant="success"] { */
  55. /* border-color: var(--color-semantic-positive); */
  56. /* } */
  57. /**/
  58. /* &[data-variant="error"] { */
  59. /* border-color: var(--color-semantic-danger); */
  60. /* } */
  61. /**/
  62. /* &[data-variant="loading"] { */
  63. /* border-color: var(--color-semantic-info); */
  64. /* } */
  65. [data-slot="toast-icon"] {
  66. flex-shrink: 0;
  67. display: flex;
  68. align-items: center;
  69. justify-content: center;
  70. [data-component="icon"] {
  71. color: var(--text-invert-stronger);
  72. /* color: var(--icon-invert-base); */
  73. }
  74. }
  75. [data-slot="toast-content"] {
  76. flex: 1;
  77. display: flex;
  78. flex-direction: column;
  79. gap: 2px;
  80. min-width: 0;
  81. }
  82. [data-slot="toast-title"] {
  83. color: var(--text-invert-strong);
  84. /* text-14-medium */
  85. font-family: var(--font-family-sans);
  86. font-size: 14px;
  87. font-style: normal;
  88. font-weight: var(--font-weight-medium);
  89. line-height: var(--line-height-large); /* 142.857% */
  90. letter-spacing: var(--letter-spacing-normal);
  91. margin: 0;
  92. }
  93. [data-slot="toast-description"] {
  94. color: var(--text-invert-base);
  95. text-wrap-style: pretty;
  96. /* text-14-regular */
  97. font-family: var(--font-family-sans);
  98. font-size: var(--font-size-base);
  99. font-style: normal;
  100. font-weight: var(--font-weight-regular);
  101. line-height: var(--line-height-x-large); /* 171.429% */
  102. letter-spacing: var(--letter-spacing-normal);
  103. margin: 0;
  104. }
  105. [data-slot="toast-actions"] {
  106. display: flex;
  107. gap: 16px;
  108. margin-top: 8px;
  109. }
  110. [data-slot="toast-action"] {
  111. background: none;
  112. border: none;
  113. padding: 0;
  114. cursor: pointer;
  115. color: var(--text-invert-weak);
  116. font-family: var(--font-family-sans);
  117. font-size: var(--font-size-base);
  118. font-weight: var(--font-weight-medium);
  119. line-height: var(--line-height-large);
  120. letter-spacing: var(--letter-spacing-normal);
  121. &:hover {
  122. text-decoration: underline;
  123. }
  124. &:first-child {
  125. color: var(--text-invert-strong);
  126. }
  127. }
  128. [data-slot="toast-close-button"] {
  129. flex-shrink: 0;
  130. }
  131. [data-slot="toast-progress-track"] {
  132. position: absolute;
  133. bottom: 0;
  134. left: 0;
  135. right: 0;
  136. height: 3px;
  137. background-color: var(--surface-base);
  138. border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  139. overflow: hidden;
  140. }
  141. [data-slot="toast-progress-fill"] {
  142. height: 100%;
  143. width: var(--kb-toast-progress-fill-width);
  144. background-color: var(--color-primary);
  145. transition: width 250ms linear;
  146. }
  147. }
  148. @keyframes toastPopIn {
  149. from {
  150. opacity: 0;
  151. transform: translateY(20px);
  152. }
  153. to {
  154. opacity: 1;
  155. transform: translateY(0);
  156. }
  157. }
  158. @keyframes toastPopOut {
  159. from {
  160. opacity: 1;
  161. transform: translateY(0);
  162. }
  163. to {
  164. opacity: 0;
  165. transform: translateY(20px);
  166. }
  167. }
  168. @keyframes toastSwipeOut {
  169. from {
  170. transform: translateX(var(--kb-toast-swipe-end-x));
  171. }
  172. to {
  173. transform: translateX(100%);
  174. }
  175. }