@gitlab/ui 32.27.0 → 32.28.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.27.0",
3
+ "version": "32.28.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -15,10 +15,11 @@ export const glSpacingScale12 = '5rem'
15
15
  export const glSpacingScale13 = '6rem'
16
16
  export const glSpacingScale15 = '7.5rem'
17
17
  export const glSpacingScale20 = '10rem'
18
- export const breakpointSm = '36rem'
19
- export const breakpointMd = '48rem'
20
- export const breakpointLg = '62rem'
21
- export const breakpointXl = '75rem'
18
+ export const breakpointSm = '576px'
19
+ export const breakpointMd = '768px'
20
+ export const breakpointLg = '992px'
21
+ export const breakpointXl = '1200px'
22
+ export const breakpoints = '(xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)'
22
23
  export const limitedLayoutWidth = '990px'
23
24
  export const black = '#000'
24
25
  export const blackNormal = '#333'
@@ -87,23 +87,55 @@
87
87
  },
88
88
  {
89
89
  "name": "$breakpoint-sm",
90
- "value": "px-to-rem(576px)",
91
- "compiledValue": "36rem"
90
+ "value": "576px",
91
+ "compiledValue": "576px"
92
92
  },
93
93
  {
94
94
  "name": "$breakpoint-md",
95
- "value": "px-to-rem(768px)",
96
- "compiledValue": "48rem"
95
+ "value": "768px",
96
+ "compiledValue": "768px"
97
97
  },
98
98
  {
99
99
  "name": "$breakpoint-lg",
100
- "value": "px-to-rem(992px)",
101
- "compiledValue": "62rem"
100
+ "value": "992px",
101
+ "compiledValue": "992px"
102
102
  },
103
103
  {
104
104
  "name": "$breakpoint-xl",
105
- "value": "px-to-rem(1200px)",
106
- "compiledValue": "75rem"
105
+ "value": "1200px",
106
+ "compiledValue": "1200px"
107
+ },
108
+ {
109
+ "name": "$breakpoints",
110
+ "value": "( xs: 0, sm: $breakpoint-sm, md: $breakpoint-md, lg: $breakpoint-lg, xl: $breakpoint-xl, )",
111
+ "mapValue": [
112
+ {
113
+ "name": "xs",
114
+ "value": "0",
115
+ "compiledValue": "0"
116
+ },
117
+ {
118
+ "name": "sm",
119
+ "value": "$breakpoint-sm",
120
+ "compiledValue": "576px"
121
+ },
122
+ {
123
+ "name": "md",
124
+ "value": "$breakpoint-md",
125
+ "compiledValue": "768px"
126
+ },
127
+ {
128
+ "name": "lg",
129
+ "value": "$breakpoint-lg",
130
+ "compiledValue": "992px"
131
+ },
132
+ {
133
+ "name": "xl",
134
+ "value": "$breakpoint-xl",
135
+ "compiledValue": "1200px"
136
+ }
137
+ ],
138
+ "compiledValue": "(xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)"
107
139
  },
108
140
  {
109
141
  "name": "$limited-layout-width",
@@ -62,7 +62,7 @@
62
62
  }
63
63
  }
64
64
 
65
- @media (max-width: $breakpoint-sm) {
65
+ @include gl-media-breakpoint-down(sm) {
66
66
  .gl-pagination {
67
67
  .prev-page-item,
68
68
  .next-page-item {
@@ -33,8 +33,8 @@
33
33
  $breakpoint-min: $breakpoint-md,
34
34
  $breakpoint-max: $breakpoint-xl
35
35
  ) {
36
- $breakpoint-range: ($breakpoint-max - $breakpoint-min) / 1rem;
37
36
  $property-range: ($property-max - $property-min) / 1rem;
37
+ $breakpoint-range: px-to-rem($breakpoint-max - $breakpoint-min) / 1rem;
38
38
 
39
39
  @media (min-width: $breakpoint-min) {
40
40
  #{$property}: calc(
@@ -68,3 +68,51 @@
68
68
  @mixin gl-bg-gradient-blur($direction, $color) {
69
69
  background-image: linear-gradient(to $direction, $transparent-rgba, $color 33%);
70
70
  }
71
+
72
+ /**
73
+ * Helper function for @media of at least the minimum
74
+ * breakpoint width.
75
+ *
76
+ * @param $name Breakpoint name, such as `sm` or `md`.
77
+ */
78
+ @mixin gl-media-breakpoint-up($name) {
79
+ $min: map-get($breakpoints, $name);
80
+ @if $min == null {
81
+ @error;
82
+ }
83
+ @if $min != 0 {
84
+ @media (min-width: $min) {
85
+ @content;
86
+ }
87
+ } @else {
88
+ @content;
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Helper function for @media of at most the maximum
94
+ * breakpoint width.
95
+ *
96
+ * Note: Before using, consider using a mobile-first
97
+ * approach, and define @media for larger breakpoints
98
+ * using `gl-media-breakpoint-up` while using this rule as
99
+ * the starting point instead.
100
+ *
101
+ * @param $name Breakpoint, such as `sm` or `md`. `xs` is not valid
102
+ */
103
+ @mixin gl-media-breakpoint-down($name) {
104
+ $max: map-get($breakpoints, $name);
105
+ @if ($max == null or $max == 0) {
106
+ @error;
107
+ }
108
+ // The maximum value is reduced by 0.02px to work around the limitations of
109
+ // `min-` and `max-` prefixes and with fractional viewport sizes.
110
+ // See: https://www.w3.org/TR/mediaqueries-4/#mq-min-max
111
+ // Use 0.02px rather than 0.01px to work around a current rounding bug in Safari.
112
+ // See https://bugs.webkit.org/show_bug.cgi?id=178261
113
+ $breakpoint-max-range-precision: 0.02px;
114
+
115
+ @media (max-width: $max - $breakpoint-max-range-precision) {
116
+ @content;
117
+ }
118
+ }
@@ -0,0 +1,103 @@
1
+ @import './mixins';
2
+ @import './variables';
3
+ @import 'true';
4
+
5
+ @include describe('gl-fluid-font-size') {
6
+ @include it('returns fluid font-size') {
7
+ @include assert {
8
+ @include output {
9
+ @include gl-fluid-font-size(2rem, 3.5rem);
10
+ }
11
+ @include expect {
12
+ @media (min-width: 768px) {
13
+ // prettier-ignore
14
+ font-size: calc( 2rem + 1.5 * ((100vw - 768px) / 27));
15
+ }
16
+
17
+ @media (min-width: 1200px) {
18
+ font-size: 3.5rem;
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+
25
+ @include describe('gl-fluid-line-height') {
26
+ @include it('returns fluid line-height') {
27
+ @include assert {
28
+ @include output {
29
+ @include gl-fluid-line-height(2rem, 3.5rem);
30
+ }
31
+ @include expect {
32
+ @media (min-width: 768px) {
33
+ // prettier-ignore
34
+ line-height: calc( 2rem + 1.5 * ((100vw - 768px) / 27));
35
+ }
36
+
37
+ @media (min-width: 1200px) {
38
+ line-height: 3.5rem;
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ @include describe('gl-media-breakpoint-up') {
46
+ @include it('returns no media query for xs') {
47
+ @include assert {
48
+ @include output {
49
+ @include gl-media-breakpoint-up(xs) {
50
+ color: $green-100;
51
+ }
52
+ }
53
+ @include expect {
54
+ color: $green-100;
55
+ }
56
+ }
57
+ }
58
+ @include it('returns min-width media query for sm') {
59
+ @include assert {
60
+ @include output {
61
+ @include gl-media-breakpoint-up(sm) {
62
+ color: $blue-100;
63
+ }
64
+ }
65
+ @include expect {
66
+ @media (min-width: '576px') {
67
+ color: $blue-100;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ @include describe('gl-media-breakpoint-down') {
75
+ @include it('returns max-width media query for lg') {
76
+ @include assert {
77
+ @include output {
78
+ @include gl-media-breakpoint-down(lg) {
79
+ color: $red-100;
80
+ }
81
+ }
82
+ @include expect {
83
+ @media (max-width: '991.98px') {
84
+ color: $red-100;
85
+ }
86
+ }
87
+ }
88
+ }
89
+ @include it('returns max-width media query for md') {
90
+ @include assert {
91
+ @include output {
92
+ @include gl-media-breakpoint-down(md) {
93
+ color: $orange-100;
94
+ }
95
+ }
96
+ @include expect {
97
+ @media (max-width: '767.98px') {
98
+ color: $orange-100;
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }