toast.css 4.8 KB

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