_dialog.scss 3.8 KB

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