@gitlab/ui 66.8.0 → 66.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,3 +11,80 @@
11
11
  @mixin gl-spin {
12
12
  animation: gl-spinner-rotate 2s infinite linear;
13
13
  }
14
+
15
+ $gl-animate-skeleton-loader-max-width: 64 * $grid-size;
16
+ // Adds a sliding shining wave to element's background to indicate loading
17
+ //
18
+ // USAGE NOTES: if you're using `gl-max-w-xx` you'll need to add
19
+ // important (e.g. `gl-max-w-20!`). This is because `.gl-animate-skeleton-loader` already
20
+ // has a `max-width` statement, and we need to override it. You can override it
21
+ // only with lower numbers. Width rules (`gl-w-xx`) don't need an override, you
22
+ // can use them as-is. If you want to "synchronize" two elements next to each
23
+ // other, try adding `animation-delay` to offset elements.
24
+ //
25
+ // Simple example:
26
+ // ```html
27
+ // <div>
28
+ // <div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-3"></div>
29
+ // <div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-3"></div>
30
+ // <div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-3"></div>
31
+ // </div>
32
+ // ```
33
+ //
34
+ // More complex example:
35
+ // (with different shapes and an animation delay for offset elements):
36
+ // ```html
37
+ // <div class="gl-display-flex gl-flex-direction-column gl-gap-2 gl-w-30">
38
+ // <div class="gl-animate-skeleton-loader gl-h-8 gl-rounded-base gl-mb-4"></div>
39
+ // <div class="gl-display-flex gl-flex-direction-row gl-gap-2">
40
+ // <div class="gl-animate-skeleton-loader gl-h-8 gl-w-8 gl-rounded-full"></div>
41
+ // <div class="gl-flex-grow-1" style="animation-delay: 100ms">
42
+ // <div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-2"></div>
43
+ // <div class="gl-animate-skeleton-loader gl-h-4 gl-rounded-base gl-my-2"></div>
44
+ // <div class="gl-animate-skeleton-loader gl-display-inline-block gl-h-4 gl-w-10 gl-rounded-base gl-my-2"></div>
45
+ // <div class="gl-animate-skeleton-loader gl-display-inline-block gl-h-4 gl-w-10 gl-rounded-base gl-my-2" style="animation-delay: 250ms"></div>
46
+ // </div>
47
+ // </div>
48
+ // </div>
49
+ // ```
50
+ @mixin gl-animate-skeleton-loader {
51
+ $max-width: $gl-animate-skeleton-loader-max-width;
52
+
53
+ overflow: hidden;
54
+ max-width: $max-width;
55
+ background-size: $max-width 100%;
56
+ background-position: -$max-width 0;
57
+ background-color: $gray-100;
58
+ background-image: linear-gradient(to right,
59
+ $gray-100 0,
60
+ $gray-50 23%,
61
+ $gray-50 27%,
62
+ $gray-100 50%);
63
+ background-repeat: no-repeat;
64
+
65
+ // Enable animation only for users who don't have a preference
66
+ // for reduced animation
67
+ @media (prefers-reduced-motion: no-preference) {
68
+ animation: gl-keyframes-skeleton-loader 2.5s linear;
69
+ animation-delay: inherit;
70
+ animation-iteration-count: 3;
71
+ }
72
+ }
73
+
74
+ @keyframes gl-keyframes-skeleton-loader {
75
+ // Skeleton loader animation basically moves background from `x=-100%` to
76
+ // `x=+100%`, so that at the beginning and at the end of the animation loop no
77
+ // gradient is leaking to the visible part. But we can't use percent-based
78
+ // positioning, for animation speed would be different for elements with
79
+ // different width. So we use a predefined max-width for
80
+ // `.gl-animate-skeleton-loader`, and use its value for `-100%` and `+100%`
81
+ // positioning.
82
+
83
+ 0% {
84
+ background-position-x: -$gl-animate-skeleton-loader-max-width;
85
+ }
86
+
87
+ 100% {
88
+ background-position-x: $gl-animate-skeleton-loader-max-width;
89
+ }
90
+ }
@@ -428,10 +428,18 @@
428
428
  max-width: $gl-spacing-scale-15;
429
429
  }
430
430
 
431
+ @mixin gl-max-w-20 {
432
+ max-width: $gl-spacing-scale-20;
433
+ }
434
+
431
435
  @mixin gl-max-w-26 {
432
436
  max-width: $gl-spacing-scale-26;
433
437
  }
434
438
 
439
+ @mixin gl-max-w-30 {
440
+ max-width: $gl-spacing-scale-30;
441
+ }
442
+
435
443
  @mixin gl-max-w-34 {
436
444
  max-width: $gl-spacing-scale-34;
437
445
  }
@@ -338,6 +338,18 @@ $gl-line-height-42: px-to-rem(42px);
338
338
  $gl-line-height-44: px-to-rem(44px);
339
339
  $gl-line-height-52: px-to-rem(52px);
340
340
 
341
+ // Fonts
342
+ $gl-monospace-font: 'GitLab Mono', 'JetBrains Mono', 'Menlo', 'DejaVu Sans Mono', 'Liberation Mono',
343
+ 'Consolas', 'Ubuntu Mono', 'Courier New', 'andale mono', 'lucida console', monospace !default;
344
+ $gl-regular-font: 'GitLab Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans',
345
+ Ubuntu, Cantarell, 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
346
+ 'Segoe UI Symbol', 'Noto Color Emoji' !default;
347
+
348
+ $gl-fonts: (
349
+ 'monospace': $gl-monospace-font,
350
+ 'regular': $gl-regular-font,
351
+ );
352
+
341
353
  // New UI type scale
342
354
  // Implements the type scale from https://gitlab.com/groups/gitlab-org/gitlab-services/-/epics/15
343
355
  // Old variables and styles need to be removed after intergration
@@ -345,24 +357,44 @@ $gl-line-height-52: px-to-rem(52px);
345
357
  // Font size scale
346
358
 
347
359
  // fixed scale (compact markdown)
348
- $gl-font-size-100-fixed: px-to-rem(12px);
349
- $gl-font-size-200-fixed: px-to-rem(13px);
350
- $gl-font-size-300-fixed: px-to-rem(14px);
351
- $gl-font-size-400-fixed: px-to-rem(16px);
352
- $gl-font-size-500-fixed: px-to-rem(18px);
353
- $gl-font-size-600-fixed: px-to-rem(21px);
354
- $gl-font-size-700-fixed: px-to-rem(24px);
355
- $gl-font-size-800-fixed: px-to-rem(28px);
360
+ $gl-font-sizes-fixed: (
361
+ 100: px-to-rem(12px),
362
+ 200: px-to-rem(13px),
363
+ 300: px-to-rem(14px),
364
+ 400: px-to-rem(16px),
365
+ 500: px-to-rem(18px),
366
+ 600: px-to-rem(21px),
367
+ 700: px-to-rem(24px),
368
+ 800: px-to-rem(28px),
369
+ );
356
370
 
357
371
  // dynamic scale (default) resizes based on viewport width
358
- $gl-font-size-100: $gl-font-size-100-fixed;
359
- $gl-font-size-200: $gl-font-size-200-fixed;
360
- $gl-font-size-300: $gl-font-size-300-fixed;
361
- $gl-font-size-400: $gl-font-size-400-fixed;
362
- $gl-font-size-500: #{clamp-between($gl-font-size-500-fixed, px-to-rem(20px))};
363
- $gl-font-size-600: #{clamp-between($gl-font-size-600-fixed, px-to-rem(25px))};
364
- $gl-font-size-700: #{clamp-between($gl-font-size-700-fixed, px-to-rem(30px))};
365
- $gl-font-size-800: #{clamp-between($gl-font-size-800-fixed, px-to-rem(36px))};
372
+ $gl-font-sizes: (
373
+ 100: map-get($gl-font-sizes-fixed, 100),
374
+ 200: map-get($gl-font-sizes-fixed, 200),
375
+ 300: map-get($gl-font-sizes-fixed, 300),
376
+ 400: map-get($gl-font-sizes-fixed, 400),
377
+ 500: clamp-between(map-get($gl-font-sizes-fixed, 500), px-to-rem(20px)),
378
+ 600: clamp-between(map-get($gl-font-sizes-fixed, 600), px-to-rem(25px)),
379
+ 700: clamp-between(map-get($gl-font-sizes-fixed, 700), px-to-rem(30px)),
380
+ 800: clamp-between(map-get($gl-font-sizes-fixed, 800), px-to-rem(36px)),
381
+ );
382
+
383
+ // Heading variables
384
+ // Not all are currently used, but documented here to capture intent
385
+ $gl-font-heading: $gl-regular-font;
386
+ $gl-font-weight-heading: 600;
387
+ $gl-letter-spacing-heading: inherit;
388
+ $gl-letter-spacing-heading-reduced: -0.01em;
389
+ $gl-line-height-heading: 1.25;
390
+ $gl-line-height-heading-display: 1.125;
391
+ $gl-mb-heading: $gl-spacing-scale-5;
392
+ $gl-mb-heading-display: $gl-spacing-scale-6;
393
+ $gl-text-color-heading: $gl-text-color;
394
+ // Not yet supported, but we'll be ready
395
+ $gl-text-wrap-heading: pretty;
396
+
397
+ // END New UI type scale
366
398
 
367
399
  // UI typescale
368
400
 
@@ -417,18 +449,6 @@ $gl-font-size-compact-markdown-h1-md: px-to-rem(20px);
417
449
  // media xl (min-width: 1200px)
418
450
  $gl-font-size-compact-markdown-h1-xl: px-to-rem(23px);
419
451
 
420
- // Fonts
421
- $gl-monospace-font: 'GitLab Mono', 'JetBrains Mono', 'Menlo', 'DejaVu Sans Mono', 'Liberation Mono',
422
- 'Consolas', 'Ubuntu Mono', 'Courier New', 'andale mono', 'lucida console', monospace !default;
423
- $gl-regular-font: 'GitLab Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans',
424
- Ubuntu, Cantarell, 'Helvetica Neue', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
425
- 'Segoe UI Symbol', 'Noto Color Emoji' !default;
426
-
427
- $gl-fonts: (
428
- 'monospace': $gl-monospace-font,
429
- 'regular': $gl-regular-font,
430
- );
431
-
432
452
  $border-color: $gray-100 !default;
433
453
 
434
454
  // use px for borders rather than rem