message-box.scss 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. @use 'sass:map';
  2. @use 'mixins/mixins' as *;
  3. @use 'mixins/var' as *;
  4. @use 'common/var' as *;
  5. @use 'common/popup' as *;
  6. @include b(message-box) {
  7. @include set-component-css-var('messagebox', $messagebox);
  8. }
  9. @include b(message-box) {
  10. display: inline-block;
  11. position: relative;
  12. max-width: getCssVar('messagebox-width');
  13. width: 100%;
  14. padding: getCssVar('messagebox-padding-primary');
  15. vertical-align: middle;
  16. background-color: getCssVar('bg-color');
  17. border-radius: getCssVar('messagebox-border-radius');
  18. font-size: getCssVar('messagebox-font-size');
  19. box-shadow: getCssVar('messagebox-box-shadow');
  20. text-align: left;
  21. overflow: hidden;
  22. backface-visibility: hidden;
  23. // To avoid small screen overflowing, see #11919
  24. box-sizing: border-box;
  25. overflow-wrap: break-word;
  26. &:focus {
  27. outline: none !important;
  28. }
  29. @at-root .#{$namespace}-overlay.is-message-box {
  30. .#{$namespace}-overlay-message-box {
  31. text-align: center;
  32. position: fixed;
  33. top: 0;
  34. right: 0;
  35. bottom: 0;
  36. left: 0;
  37. padding: 16px;
  38. overflow: auto;
  39. &::after {
  40. content: '';
  41. display: inline-block;
  42. height: 100%;
  43. width: 0;
  44. vertical-align: middle;
  45. }
  46. }
  47. }
  48. @include when(draggable) {
  49. @include e(header) {
  50. cursor: move;
  51. user-select: none;
  52. }
  53. }
  54. @include e(header) {
  55. padding-bottom: getCssVar('messagebox-padding-primary');
  56. &.show-close {
  57. padding-right: calc(
  58. getCssVar('messagebox-padding-primary') +
  59. var(
  60. #{getCssVarName('message-close-size')},
  61. map.get($message, 'close-size')
  62. )
  63. );
  64. }
  65. }
  66. @include e(title) {
  67. font-size: getCssVar('messagebox-font-size');
  68. line-height: getCssVar('messagebox-font-line-height');
  69. color: getCssVar('messagebox-title-color');
  70. }
  71. @include e(headerbtn) {
  72. position: absolute;
  73. top: 0;
  74. right: 0;
  75. padding: 0;
  76. width: 40px;
  77. height: 40px;
  78. border: none;
  79. outline: none;
  80. background: transparent;
  81. font-size: var(
  82. #{getCssVarName('message-close-size')},
  83. map.get($message, 'close-size')
  84. );
  85. cursor: pointer;
  86. .#{$namespace}-message-box__close {
  87. color: getCssVar('color-info');
  88. font-size: inherit;
  89. }
  90. &:focus,
  91. &:hover {
  92. .#{$namespace}-message-box__close {
  93. color: getCssVar('color-primary');
  94. }
  95. }
  96. }
  97. @include e(content) {
  98. color: getCssVar('messagebox-content-color');
  99. font-size: getCssVar('messagebox-content-font-size');
  100. }
  101. @include e(container) {
  102. display: flex;
  103. align-items: center;
  104. gap: 12px;
  105. }
  106. @include e(input) {
  107. padding-top: 12px;
  108. & div.invalid > input {
  109. border-color: getCssVar('color-error');
  110. &:focus {
  111. border-color: getCssVar('color-error');
  112. }
  113. }
  114. }
  115. @include e(status) {
  116. font-size: 24px;
  117. @each $type in (success, info, warning, error) {
  118. &.#{$namespace}-message-box-icon--#{$type} {
  119. @include css-var-from-global(('messagebox', 'color'), ('color', $type));
  120. color: getCssVar('messagebox-color');
  121. }
  122. }
  123. }
  124. @include e(message) {
  125. margin: 0;
  126. & p {
  127. margin: 0;
  128. line-height: getCssVar('messagebox-font-line-height');
  129. }
  130. }
  131. @include e(errormsg) {
  132. color: getCssVar('color-error');
  133. font-size: getCssVar('messagebox-error-font-size');
  134. line-height: getCssVar('messagebox-font-line-height');
  135. }
  136. @include e(btns) {
  137. display: flex;
  138. flex-wrap: wrap;
  139. justify-content: flex-end;
  140. align-items: center;
  141. padding-top: getCssVar('messagebox-padding-primary');
  142. }
  143. // centerAlign 布局
  144. @include m(center) {
  145. @include e(title) {
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. gap: 6px;
  150. }
  151. @include e(status) {
  152. font-size: inherit;
  153. }
  154. @include e(btns) {
  155. justify-content: center;
  156. }
  157. @include e(container) {
  158. justify-content: center;
  159. }
  160. }
  161. }
  162. .fade-in-linear-enter-active {
  163. .#{$namespace}-overlay-message-box {
  164. animation: msgbox-fade-in getCssVar('transition-duration');
  165. }
  166. }
  167. .fade-in-linear-leave-active {
  168. .#{$namespace}-overlay-message-box {
  169. animation: msgbox-fade-in getCssVar('transition-duration') reverse;
  170. }
  171. }
  172. @keyframes msgbox-fade-in {
  173. 0% {
  174. transform: translate3d(0, -20px, 0);
  175. opacity: 0;
  176. }
  177. 100% {
  178. transform: translate3d(0, 0, 0);
  179. opacity: 1;
  180. }
  181. }