2
0

_dialog.scss 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. @use '../tools' as *;
  2. .w-dialog {
  3. --w-dialog-close-icon-color: theme('colors.icon-primary');
  4. position: fixed;
  5. display: flex;
  6. inset-inline-start: 0;
  7. inset-inline-end: 0;
  8. bottom: 0;
  9. top: 0;
  10. z-index: theme('zIndex.dialog');
  11. padding: theme('spacing.4');
  12. &[aria-hidden='true'] {
  13. display: none;
  14. }
  15. &__overlay {
  16. position: fixed;
  17. inset-inline-start: 0;
  18. inset-inline-end: 0;
  19. bottom: 0;
  20. top: 0;
  21. opacity: theme('opacity.80');
  22. background: theme('colors.black-50');
  23. }
  24. &__box {
  25. width: 100%;
  26. position: relative;
  27. margin: auto;
  28. max-width: theme('maxWidth.2xl');
  29. z-index: theme('zIndex.dialog');
  30. background: theme('colors.surface-page');
  31. box-shadow: theme('boxShadow.DEFAULT');
  32. border-radius: theme('borderRadius.md');
  33. animation: theme('animation.fade-in');
  34. @include media-breakpoint-up(sm) {
  35. width: 600px;
  36. }
  37. @media (forced-colors: active) {
  38. border: 5px solid currentColor;
  39. }
  40. }
  41. &__close-button {
  42. position: absolute;
  43. display: inline-flex;
  44. justify-content: center;
  45. align-items: center;
  46. background: transparent;
  47. padding: 0;
  48. top: theme('spacing.2');
  49. inset-inline-end: theme('spacing.2');
  50. width: theme('spacing.12');
  51. height: theme('spacing.12');
  52. }
  53. &__close-icon {
  54. width: theme('spacing.4');
  55. height: theme('spacing.4');
  56. color: var(--w-dialog-close-icon-color, #{theme('colors.icon-primary')});
  57. }
  58. &__content {
  59. // Using apply for scrollbars to avoid having to overwrite scrollbar with excess css
  60. overflow: auto;
  61. padding: theme('spacing.8');
  62. max-height: calc(100vh - 180px);
  63. min-height: min(100vh - 180px, 320px);
  64. @include media-breakpoint-up(sm) {
  65. padding: theme('spacing.12');
  66. }
  67. @include media-breakpoint-up(md) {
  68. padding-inline-start: theme('spacing.20');
  69. padding-inline-end: theme('spacing.20');
  70. }
  71. }
  72. &__icon {
  73. position: absolute;
  74. display: none;
  75. width: theme('spacing.5');
  76. height: theme('spacing.5');
  77. color: theme('colors.icon-primary');
  78. top: theme('spacing.[0.5]');
  79. transform: translateY(theme('spacing.2'));
  80. inset-inline-start: calc(0 - theme('spacing.10'));
  81. @include media-breakpoint-up(md) {
  82. display: block;
  83. }
  84. }
  85. &__title {
  86. position: relative;
  87. margin-top: 0;
  88. margin-bottom: theme('spacing.1');
  89. }
  90. &__subtitle {
  91. margin-bottom: theme('spacing.4');
  92. }
  93. &__message {
  94. display: flex;
  95. align-items: center;
  96. padding: theme('spacing.5');
  97. border-start-start-radius: theme('borderRadius.md');
  98. border-start-end-radius: theme('borderRadius.md');
  99. @media (forced-colors: active) {
  100. border-bottom: 1px solid currentColor;
  101. }
  102. &--info {
  103. background: theme('colors.info.50');
  104. color: theme('colors.info.100');
  105. }
  106. &--warning {
  107. background: theme('colors.warning.50');
  108. color: theme('colors.primary.DEFAULT');
  109. }
  110. &--critical {
  111. background: theme('colors.critical.50');
  112. color: theme('colors.critical.200');
  113. }
  114. &--success {
  115. background: theme('colors.positive.50');
  116. color: theme('colors.positive.100');
  117. }
  118. }
  119. &--message {
  120. --w-dialog-close-icon-color: theme('colors.grey.600');
  121. }
  122. &__message-icon {
  123. width: theme('spacing.5');
  124. height: theme('spacing.5');
  125. flex-shrink: 0;
  126. }
  127. &__message-header {
  128. margin-inline-start: theme('spacing[2.5]');
  129. padding-inline-end: theme('spacing.8');
  130. color: theme('colors.grey.600');
  131. font-size: theme('fontSize.14');
  132. }
  133. &__message-description {
  134. margin-bottom: 0;
  135. }
  136. }
  137. // Variant of the dialog which allows viewing other page content.
  138. .w-dialog--floating {
  139. pointer-events: none;
  140. .w-dialog__box {
  141. pointer-events: auto;
  142. box-shadow: theme('boxShadow.md');
  143. }
  144. .w-dialog__overlay {
  145. display: none;
  146. }
  147. }