toast.css 4.4 KB

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