Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

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