summaryrefslogtreecommitdiff
path: root/app/assets/stylesheets/utilities.scss
blob: 0511a17998014785f7c6dbe4925d28699d9be2b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
/**
  Please note: These are deprecated in favor of the Gitlab UI utility classes.
  Check https://unpkg.com/browse/@gitlab/ui/src/scss/utilities.scss
  to see the available utility classes. If you cannot find the class you need,
  consider adding it to Gitlab UI before adding it here.
**/

@each $variant, $range in $color-ranges {
  @each $suffix, $color in $range {
    #{'.bg-#{$variant}-#{$suffix}'} {
      background-color: $color;
    }

    #{'.text-#{$variant}-#{$suffix}'} {
      color: $color;
    }
  }
}

@each $index, $size in $type-scale {
  #{'.text-#{$index}'} {
    font-size: $size;
  }
}

@each $index, $size in $size-scale {
  #{'.mw-#{$index}'} {
    max-width: $size;
  }
}

@each $index, $size in $type-scale {
  #{'.lh-#{$index}'} {
    line-height: $size;
  }
}

@for $i from 1 through 12 {
  #{'.tab-width-#{$i}'} {
    /* stylelint-disable-next-line property-no-vendor-prefix */
    -moz-tab-size: $i;
    tab-size: $i;
  }
}

.border-width-1px { border-width: 1px; }
.border-style-dashed { border-style: dashed; }
.border-style-solid { border-style: solid; }
.border-color-blue-300 { border-color: $blue-300; }
.border-color-default { border-color: $border-color; }
.border-radius-default { border-radius: $border-radius-default; }
.border-radius-small { border-radius: $border-radius-small; }
.box-shadow-default { box-shadow: 0 2px 4px 0 $black-transparent; }

.gl-children-ml-sm-3 > * {
  @include media-breakpoint-up(sm) {
    @include gl-ml-3;
  }
}

.gl-first-child-ml-sm-0 > a:first-child,
.gl-first-child-ml-sm-0 > button:first-child {
  @include media-breakpoint-up(sm) {
    @include gl-ml-0;
  }
}

.mh-50vh { max-height: 50vh; }

.min-width-0 {
  // By default flex items don't shrink below their minimum content size. To change this, set the item's min-width
  min-width: 0;
}

// .gl-font-size-inherit will be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1466
.gl-font-size-inherit,
.font-size-inherit { font-size: inherit; }
.gl-w-8 { width: px-to-rem($grid-size); }
.gl-w-16 { width: px-to-rem($grid-size * 2); }
.gl-w-64 { width: px-to-rem($grid-size * 8); }
.gl-h-8 { height: px-to-rem($grid-size); }
.gl-h-32 { height: px-to-rem($grid-size * 4); }
.gl-h-64 { height: px-to-rem($grid-size * 8); }

// Migrate this to Gitlab UI when FF is removed
// https://gitlab.com/groups/gitlab-org/-/epics/2882
.gl-h-200\! { height: px-to-rem($grid-size * 25) !important; }

.gl-bg-purple-light { background-color: $purple-light; }

// move this to GitLab UI once onboarding experiment is considered a success
.gl-py-8 {
  padding-top: $gl-spacing-scale-8;
  padding-bottom: $gl-spacing-scale-8;
}

.gl-transition-property-stroke-opacity {
  transition-property: stroke-opacity;
}

.gl-transition-property-stroke {
  transition-property: stroke;
}

.gl-top-66vh {
  top: 66vh;
}

.gl-shadow-x0-y0-b3-s1-blue-500 {
  box-shadow: inset 0 0 3px $gl-border-size-1 $blue-500;
}

// This utility is used to force the z-index to match that of dropdown menu's
.gl-z-dropdown-menu\! {
  z-index: $zindex-dropdown-menu !important;
}

.gl-flex-basis-quarter {
  flex-basis: 25%;
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1168
.gl-md-ml-3 {
  @media (min-width: $breakpoint-md) {
    margin-left: $gl-spacing-scale-3;
  }
}

// Will be moved to @gitlab/ui (without the !important) in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1462
// We only need the bang (!) version until the non-bang version is added to
// @gitlab/ui utitlities.scss. Once there, it will get loaded in the correct
// order to properly override `.gl-mt-6` which is used for narrower screen
// widths (currently that style gets added to the application.css stylesheet
// after this one, so it takes precedence).
.gl-md-mt-11\! {
  @media (min-width: $breakpoint-md) {
    margin-top: $gl-spacing-scale-11 !important;
  }
}

// Same as above (also without the !important) but for overriding `.gl-pt-6`
.gl-md-pt-11\! {
  @media (min-width: $breakpoint-md) {
    padding-top: $gl-spacing-scale-11 !important;
  }
}

// This is used to help prevent issues with margin collapsing.
// See https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing.
.gl-force-block-formatting-context::after {
  content: '';
  display: flex;
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1085
.gl-md-flex-direction-column {
  @media (min-width: $breakpoint-md) {
    flex-direction: column;
  }
}

// Same as above
.gl-md-flex-direction-column\! {
  @media (min-width: $breakpoint-md) {
    flex-direction: column !important;
  }
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1165
.gl-xs-mb-4 {
  @media (max-width: $breakpoint-sm) {
    margin-bottom: $gl-spacing-scale-4;
  }
}

// Same as above
.gl-xs-mb-4\! {
  @media (max-width: $breakpoint-sm) {
    margin-bottom: $gl-spacing-scale-4 !important;
  }
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1168
.gl-sm-pr-3 {
  @media (min-width: $breakpoint-sm) {
    padding-right: $gl-spacing-scale-3;
  }
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1168
.gl-sm-w-half {
  @media (min-width: $breakpoint-sm) {
    width: 50%;
  }
}

.gl-sm-mr-3 {
  @include media-breakpoint-up(sm) {
    margin-right: $gl-spacing-scale-3;
  }
}

.gl-xl-ml-3 {
  @include media-breakpoint-up(lg) {
    margin-left: $gl-spacing-scale-3;
  }
}

.gl-mb-n3 {
  margin-bottom: -$gl-spacing-scale-3;
}

.gl-mr-n2 {
  margin-right: -$gl-spacing-scale-2;
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1408
$gl-line-height-42: px-to-rem(42px);

.gl-line-height-42 {
  line-height: $gl-line-height-42;
}

.gl-w-grid-size-30 {
  width: $grid-size * 30;
}

.gl-w-grid-size-40 {
  width: $grid-size * 40;
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2209
.gl-max-w-none\! {
  max-width: none !important;
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2209
.gl-max-h-none\! {
  max-height: none !important;
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1655
.gl-max-w-62 {
  max-width: $grid-size * 62;
}

// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1655
.gl-max-w-26 {
  max-width: $grid-size * 26;
}

.gl-max-w-50p {
  max-width: 50%;
}

/**
  Note: ::-webkit-scrollbar is a non-standard rule only
  supported by webkit browsers.

  It is added here to migrate components that use
  scrolling-links() mixin from `app/assets/stylesheets/framework/mixins.scss`.

  It should not be used elsewhere: it may impact accessibility as well as
  add browser compatibility issues.

  See: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-scrollbar
**/
.gl-webkit-scrollbar-display-none {
  &::-webkit-scrollbar {
    display: none;
  }
}

// Will both be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1465
.gl-text-transparent {
  color: transparent;
}

.gl-focus-ring-border-1-gray-900\! {
  @include gl-focus($gl-border-size-1, $gray-900, true);
}

// Will be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2600
.gl-pr-10 {
  padding-right: $gl-spacing-scale-10;
}

/*
All of the following (up until the "End gitlab-ui#1709" comment) will be moved
to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1709
*/
.gl-sm-grid-template-columns-2 {
  @include media-breakpoint-up(sm) {
    grid-template-columns: 1fr 1fr;
  }
}

.gl-md-grid-template-columns-2 {
  @include media-breakpoint-up(md) {
    grid-template-columns: 1fr 1fr;
  }
}

.gl-md-grid-template-columns-3 {
  @include media-breakpoint-up(md) {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gl-lg-grid-template-columns-4 {
  @include media-breakpoint-up(lg) {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gl-gap-6 {
  gap: $gl-spacing-scale-6;
}

.gl-max-w-48 {
  max-width: $gl-spacing-scale-48;
}

.gl-max-w-75 {
  max-width: $gl-spacing-scale-75;
}

.gl-md-pt-11 {
  @include media-breakpoint-up(md) {
    padding-top: $gl-spacing-scale-11 !important; // only need !important for now so that it overrides styles from @gitlab/ui which currently take precedence
  }
}

.gl-md-mb-6 {
  @include media-breakpoint-up(md) {
    margin-bottom: $gl-spacing-scale-6 !important; // only need !important for now so that it overrides styles from @gitlab/ui which currently take precedence
  }
}

.gl-md-mb-12 {
  @include media-breakpoint-up(md) {
    margin-bottom: $gl-spacing-scale-12 !important; // only need !important for now so that it overrides styles from @gitlab/ui which currently take precedence
  }
}

/* End gitlab-ui#1709 */

/*
 * The below two styles will be moved to @gitlab/ui by
 * https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1750
 */
.gl-max-w-34 {
  max-width: 34 * $grid-size;
}

.gl-max-w-80 {
  max-width: 80 * $grid-size;
}

/*
 * The below style will be moved to @gitlab/ui by
 * https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1751
 */
.gl-filter-blur-1 {
  backdrop-filter: blur(2px);
  /* stylelint-disable property-no-vendor-prefix */
  -webkit-backdrop-filter: blur(2px); // still required by Safari
}

// Will be moved to @gitlab/ui by https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2708
.gl-inset-border-l-3-red-600 {
  box-shadow: inset $gl-border-size-3 0 0 0 $red-600;
}