You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

209 lines
5.5 KiB

  1. // .modal-open - body class for killing the scroll
  2. // .modal - container to scroll within
  3. // .modal-dialog - positioning shell for the actual modal
  4. // .modal-content - actual modal w/ bg and corners and stuff
  5. // Container that the modal scrolls within
  6. .modal {
  7. position: fixed;
  8. top: 0;
  9. left: 0;
  10. z-index: $zindex-modal;
  11. display: none;
  12. width: 100%;
  13. height: 100%;
  14. overflow-x: hidden;
  15. overflow-y: auto;
  16. // Prevent Chrome on Windows from adding a focus outline. For details, see
  17. // https://github.com/twbs/bootstrap/pull/10951.
  18. outline: 0;
  19. // We deliberately don't use `-webkit-overflow-scrolling: touch;` due to a
  20. // gnarly iOS Safari bug: https://bugs.webkit.org/show_bug.cgi?id=158342
  21. // See also https://github.com/twbs/bootstrap/issues/17695
  22. }
  23. // Shell div to position the modal with bottom padding
  24. .modal-dialog {
  25. position: relative;
  26. width: auto;
  27. margin: $modal-dialog-margin;
  28. // allow clicks to pass through for custom click handling to close modal
  29. pointer-events: none;
  30. // When fading in the modal, animate it to slide down
  31. .modal.fade & {
  32. @include transition($modal-transition);
  33. transform: $modal-fade-transform;
  34. }
  35. .modal.show & {
  36. transform: $modal-show-transform;
  37. }
  38. // When trying to close, animate focus to scale
  39. .modal.modal-static & {
  40. transform: $modal-scale-transform;
  41. }
  42. }
  43. .modal-dialog-scrollable {
  44. height: subtract(100%, $modal-dialog-margin * 2);
  45. .modal-content {
  46. max-height: 100%;
  47. overflow: hidden;
  48. }
  49. .modal-body {
  50. overflow-y: auto;
  51. }
  52. }
  53. .modal-dialog-centered {
  54. display: flex;
  55. align-items: center;
  56. min-height: subtract(100%, $modal-dialog-margin * 2);
  57. }
  58. // Actual modal
  59. .modal-content {
  60. position: relative;
  61. display: flex;
  62. flex-direction: column;
  63. width: 100%; // Ensure `.modal-content` extends the full width of the parent `.modal-dialog`
  64. // counteract the pointer-events: none; in the .modal-dialog
  65. color: $modal-content-color;
  66. pointer-events: auto;
  67. background-color: $modal-content-bg;
  68. background-clip: padding-box;
  69. border: $modal-content-border-width solid $modal-content-border-color;
  70. @include border-radius($modal-content-border-radius);
  71. @include box-shadow($modal-content-box-shadow-xs);
  72. // Remove focus outline from opened modal
  73. outline: 0;
  74. }
  75. // Modal background
  76. .modal-backdrop {
  77. @include overlay-backdrop($zindex-modal-backdrop, $modal-backdrop-bg, $modal-backdrop-opacity);
  78. }
  79. // Modal header
  80. // Top section of the modal w/ title and dismiss
  81. .modal-header {
  82. display: flex;
  83. flex-shrink: 0;
  84. align-items: center;
  85. justify-content: space-between; // Put modal header elements (title and dismiss) on opposite ends
  86. padding: $modal-header-padding;
  87. border-bottom: $modal-header-border-width solid $modal-header-border-color;
  88. @include border-top-radius($modal-content-inner-border-radius);
  89. .btn-close {
  90. padding: ($modal-header-padding-y * .5) ($modal-header-padding-x * .5);
  91. margin: ($modal-header-padding-y * -.5) ($modal-header-padding-x * -.5) ($modal-header-padding-y * -.5) auto;
  92. }
  93. }
  94. // Title text within header
  95. .modal-title {
  96. margin-bottom: 0;
  97. line-height: $modal-title-line-height;
  98. }
  99. // Modal body
  100. // Where all modal content resides (sibling of .modal-header and .modal-footer)
  101. .modal-body {
  102. position: relative;
  103. // Enable `flex-grow: 1` so that the body take up as much space as possible
  104. // when there should be a fixed height on `.modal-dialog`.
  105. flex: 1 1 auto;
  106. padding: $modal-inner-padding;
  107. }
  108. // Footer (for actions)
  109. .modal-footer {
  110. display: flex;
  111. flex-wrap: wrap;
  112. flex-shrink: 0;
  113. align-items: center; // vertically center
  114. justify-content: flex-end; // Right align buttons with flex property because text-align doesn't work on flex items
  115. padding: $modal-inner-padding - $modal-footer-margin-between * .5;
  116. border-top: $modal-footer-border-width solid $modal-footer-border-color;
  117. @include border-bottom-radius($modal-content-inner-border-radius);
  118. // Place margin between footer elements
  119. // This solution is far from ideal because of the universal selector usage,
  120. // but is needed to fix https://github.com/twbs/bootstrap/issues/24800
  121. > * {
  122. margin: $modal-footer-margin-between * .5;
  123. }
  124. }
  125. // Scale up the modal
  126. @include media-breakpoint-up(sm) {
  127. // Automatically set modal's width for larger viewports
  128. .modal-dialog {
  129. max-width: $modal-md;
  130. margin: $modal-dialog-margin-y-sm-up auto;
  131. }
  132. .modal-dialog-scrollable {
  133. height: subtract(100%, $modal-dialog-margin-y-sm-up * 2);
  134. }
  135. .modal-dialog-centered {
  136. min-height: subtract(100%, $modal-dialog-margin-y-sm-up * 2);
  137. }
  138. .modal-content {
  139. @include box-shadow($modal-content-box-shadow-sm-up);
  140. }
  141. .modal-sm { max-width: $modal-sm; }
  142. }
  143. @include media-breakpoint-up(lg) {
  144. .modal-lg,
  145. .modal-xl {
  146. max-width: $modal-lg;
  147. }
  148. }
  149. @include media-breakpoint-up(xl) {
  150. .modal-xl { max-width: $modal-xl; }
  151. }
  152. // scss-docs-start modal-fullscreen-loop
  153. @each $breakpoint in map-keys($grid-breakpoints) {
  154. $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
  155. $postfix: if($infix != "", $infix + "-down", "");
  156. @include media-breakpoint-down($breakpoint) {
  157. .modal-fullscreen#{$postfix} {
  158. width: 100vw;
  159. max-width: none;
  160. height: 100%;
  161. margin: 0;
  162. .modal-content {
  163. height: 100%;
  164. border: 0;
  165. @include border-radius(0);
  166. }
  167. .modal-header {
  168. @include border-radius(0);
  169. }
  170. .modal-body {
  171. overflow-y: auto;
  172. }
  173. .modal-footer {
  174. @include border-radius(0);
  175. }
  176. }
  177. }
  178. }
  179. // scss-docs-end modal-fullscreen-loop