@gitlab/ui 40.2.2 → 40.5.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": "40.2.2",
3
+ "version": "40.5.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,7 +1,7 @@
1
1
  $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $green-50, $orange-50,
2
2
  $gray-50;
3
3
 
4
- .gl-avatar {
4
+ @mixin gl-avatar {
5
5
  @include gl-border-1;
6
6
  @include gl-border-solid;
7
7
  @include gl-border-gray-a-08;
@@ -9,7 +9,7 @@ $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $gree
9
9
  @include gl-flex-shrink-0;
10
10
  }
11
11
 
12
- .gl-avatar-s16 {
12
+ @mixin gl-avatar-s16 {
13
13
  @include gl-w-5;
14
14
  @include gl-h-5;
15
15
  @include gl-font-sm;
@@ -17,7 +17,7 @@ $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $gree
17
17
  @include gl-rounded-small;
18
18
  }
19
19
 
20
- .gl-avatar-s24 {
20
+ @mixin gl-avatar-s24 {
21
21
  @include gl-w-6;
22
22
  @include gl-h-6;
23
23
  @include gl-font-sm;
@@ -25,7 +25,7 @@ $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $gree
25
25
  @include gl-rounded-base;
26
26
  }
27
27
 
28
- .gl-avatar-s32 {
28
+ @mixin gl-avatar-s32 {
29
29
  @include gl-w-7;
30
30
  @include gl-h-7;
31
31
  @include gl-font-base;
@@ -33,7 +33,7 @@ $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $gree
33
33
  @include gl-rounded-base;
34
34
  }
35
35
 
36
- .gl-avatar-s48 {
36
+ @mixin gl-avatar-s48 {
37
37
  @include gl-w-9;
38
38
  @include gl-h-9;
39
39
  @include gl-font-size-h2;
@@ -41,7 +41,7 @@ $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $gree
41
41
  @include gl-rounded-lg;
42
42
  }
43
43
 
44
- .gl-avatar-s64 {
44
+ @mixin gl-avatar-s64 {
45
45
  @include gl-w-11;
46
46
  @include gl-h-11;
47
47
  @include gl-font-size-h-display;
@@ -49,7 +49,7 @@ $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $gree
49
49
  @include gl-rounded-lg;
50
50
  }
51
51
 
52
- .gl-avatar-s96 {
52
+ @mixin gl-avatar-s96 {
53
53
  @include gl-w-13;
54
54
  @include gl-h-13;
55
55
  @include gl-font-size-h-display-xl;
@@ -57,6 +57,142 @@ $gl-avatar-identicon-bgs: $red-50, $purple-50, $theme-indigo-50, $blue-50, $gree
57
57
  @include gl-rounded-lg;
58
58
  }
59
59
 
60
+ .gl-avatar {
61
+ @include gl-avatar;
62
+ }
63
+
64
+ .gl-avatar-s16 {
65
+ @include gl-avatar-s16;
66
+ }
67
+
68
+ .gl-avatar-s24 {
69
+ @include gl-avatar-s24;
70
+ }
71
+
72
+ .gl-avatar-s32 {
73
+ @include gl-avatar-s32;
74
+ }
75
+
76
+ .gl-avatar-s48 {
77
+ @include gl-avatar-s48;
78
+ }
79
+
80
+ .gl-avatar-s64 {
81
+ @include gl-avatar-s64;
82
+ }
83
+
84
+ .gl-avatar-s96 {
85
+ @include gl-avatar-s96;
86
+ }
87
+
88
+ .gl-sm-avatar-s16 {
89
+ @include gl-media-breakpoint-up(sm) {
90
+ @include gl-avatar-s16;
91
+ }
92
+ }
93
+
94
+ .gl-md-avatar-s16 {
95
+ @include gl-media-breakpoint-up(md) {
96
+ @include gl-avatar-s16;
97
+ }
98
+ }
99
+
100
+ .gl-lg-avatar-s16 {
101
+ @include gl-media-breakpoint-up(lg) {
102
+ @include gl-avatar-s16;
103
+ }
104
+ }
105
+
106
+ .gl-sm-avatar-s24 {
107
+ @include gl-media-breakpoint-up(sm) {
108
+ @include gl-avatar-s24;
109
+ }
110
+ }
111
+
112
+ .gl-md-avatar-s24 {
113
+ @include gl-media-breakpoint-up(md) {
114
+ @include gl-avatar-s24;
115
+ }
116
+ }
117
+
118
+ .gl-lg-avatar-s24 {
119
+ @include gl-media-breakpoint-up(lg) {
120
+ @include gl-avatar-s24;
121
+ }
122
+ }
123
+
124
+ .gl-sm-avatar-s32 {
125
+ @include gl-media-breakpoint-up(sm) {
126
+ @include gl-avatar-s32;
127
+ }
128
+ }
129
+
130
+ .gl-md-avatar-s32 {
131
+ @include gl-media-breakpoint-up(md) {
132
+ @include gl-avatar-s32;
133
+ }
134
+ }
135
+
136
+ .gl-lg-avatar-s32 {
137
+ @include gl-media-breakpoint-up(lg) {
138
+ @include gl-avatar-s32;
139
+ }
140
+ }
141
+
142
+ .gl-sm-avatar-s48 {
143
+ @include gl-media-breakpoint-up(sm) {
144
+ @include gl-avatar-s48;
145
+ }
146
+ }
147
+
148
+ .gl-md-avatar-s48 {
149
+ @include gl-media-breakpoint-up(md) {
150
+ @include gl-avatar-s48;
151
+ }
152
+ }
153
+
154
+ .gl-lg-avatar-s48 {
155
+ @include gl-media-breakpoint-up(lg) {
156
+ @include gl-avatar-s48;
157
+ }
158
+ }
159
+
160
+ .gl-sm-avatar-s64 {
161
+ @include gl-media-breakpoint-up(sm) {
162
+ @include gl-avatar-s64;
163
+ }
164
+ }
165
+
166
+ .gl-md-avatar-s64 {
167
+ @include gl-media-breakpoint-up(md) {
168
+ @include gl-avatar-s64;
169
+ }
170
+ }
171
+
172
+ .gl-lg-avatar-s64 {
173
+ @include gl-media-breakpoint-up(lg) {
174
+ @include gl-avatar-s64;
175
+ }
176
+ }
177
+
178
+ .gl-sm-avatar-s96 {
179
+ @include gl-media-breakpoint-up(sm) {
180
+ @include gl-avatar-s96;
181
+ }
182
+ }
183
+
184
+ .gl-md-avatar-s96 {
185
+ @include gl-media-breakpoint-up(md) {
186
+ @include gl-avatar-s96;
187
+ }
188
+ }
189
+
190
+ .gl-lg-avatar-s96 {
191
+ @include gl-media-breakpoint-up(lg) {
192
+ @include gl-avatar-s96;
193
+ }
194
+ }
195
+
60
196
  .gl-avatar-circle {
61
197
  @include gl-rounded-full;
62
198
  }
@@ -18,16 +18,42 @@ describe('GlAvatar', () => {
18
18
  expect(wrapper.props('size')).toBe(avatarSizeOptions[1]);
19
19
  });
20
20
 
21
- it.each([96, 64, 48, 32, 24, 16])('accepts size %s', (size) => {
22
- createWrapper({ size });
21
+ describe('when number is passed', () => {
22
+ it.each([96, 64, 48, 32, 24, 16])('accepts size %s', (size) => {
23
+ createWrapper({ size });
23
24
 
24
- expect(wrapper.props('size')).toBe(size);
25
+ expect(wrapper.props('size')).toBe(size);
26
+ });
27
+
28
+ it.each([12, 28, 36, 54, 98])('displays an error for size %s', (size) => {
29
+ createWrapper({ size });
30
+
31
+ expect(wrapper).toHaveLoggedVueErrors();
32
+ });
33
+
34
+ it('adds correct CSS class to avatar', () => {
35
+ createWrapper({ size: 16 });
36
+
37
+ expect(wrapper.classes()).toContain('gl-avatar-s16');
38
+ });
25
39
  });
26
40
 
27
- it.each([12, 28, 36, 54, 98])('displays an error for size %s', (size) => {
28
- createWrapper({ size });
41
+ describe('when object is passed', () => {
42
+ it('displays error if any of the sizes are invalid', () => {
43
+ createWrapper({ size: { default: 16, md: 32, lg: 65 } });
44
+
45
+ expect(wrapper).toHaveLoggedVueErrors();
46
+ });
47
+
48
+ it('adds correct CSS classes to avatar', () => {
49
+ createWrapper({ size: { default: 16, md: 32, lg: 64 } });
29
50
 
30
- expect(wrapper).toHaveLoggedVueErrors();
51
+ expect(wrapper.classes()).toContain(
52
+ 'gl-avatar-s16',
53
+ 'gl-md-avatar-s32',
54
+ 'gl-lg-avatar-s64'
55
+ );
56
+ });
31
57
  });
32
58
  });
33
59
  });
@@ -59,6 +59,22 @@ export const Image = (args, { argTypes }) => ({
59
59
  });
60
60
  Image.args = generateImageProps();
61
61
 
62
+ export const ResponsiveImage = (args, { argTypes }) => ({
63
+ components,
64
+ props: Object.keys(argTypes),
65
+ template: `
66
+ <gl-avatar
67
+ :size="size"
68
+ :shape="shape"
69
+ src="https://about.gitlab.com/images/press/gitlab-summit-south-africa.jpg"
70
+ />
71
+ `,
72
+ });
73
+ ResponsiveImage.args = generateImageProps({ size: { default: 24, sm: 32, md: 48, lg: 96 } });
74
+ ResponsiveImage.argTypes = {
75
+ size: { control: 'object' },
76
+ };
77
+
62
78
  export const ProjectFallback = (args, { argTypes }) => ({
63
79
  components,
64
80
  props: Object.keys(argTypes),
@@ -1,5 +1,6 @@
1
1
  <!-- eslint-disable vue/multi-word-component-names -->
2
2
  <script>
3
+ import { isNumber } from 'lodash';
3
4
  import { avatarShapeOptions, avatarSizeOptions } from '../../../utils/constants';
4
5
  import { getAvatarChar } from '../../../utils/string_utils';
5
6
 
@@ -28,18 +29,24 @@ export default {
28
29
  default: 'avatar',
29
30
  },
30
31
  size: {
31
- type: Number,
32
+ type: [Number, Object],
32
33
  required: false,
33
34
  default: avatarSizeOptions[1],
34
35
  validator: (value) => {
35
- const isValidSize = avatarSizeOptions.includes(value);
36
+ const sizes = isNumber(value) ? [value] : Object.values(value);
37
+
38
+ const areValidSizes = sizes.every((size) => {
39
+ const isValidSize = avatarSizeOptions.includes(size);
40
+
41
+ if (!isValidSize) {
42
+ /* eslint-disable-next-line no-console */
43
+ console.error(`Avatar size should be one of [${avatarSizeOptions}], received: ${size}`);
44
+ }
36
45
 
37
- if (!isValidSize) {
38
- /* eslint-disable-next-line no-console */
39
- console.error(`Avatar size should be one of [${avatarSizeOptions}], received: ${value}`);
40
- }
46
+ return isValidSize;
47
+ });
41
48
 
42
- return isValidSize;
49
+ return areValidSizes;
43
50
  },
44
51
  },
45
52
  shape: {
@@ -49,8 +56,19 @@ export default {
49
56
  },
50
57
  },
51
58
  computed: {
52
- sizeClass() {
53
- return `gl-avatar-s${this.size}`;
59
+ sizeClasses() {
60
+ if (isNumber(this.size)) {
61
+ return `gl-avatar-s${this.size}`;
62
+ }
63
+
64
+ const { default: defaultSize, ...nonDefaultSizes } = this.size;
65
+
66
+ return [
67
+ `gl-avatar-s${defaultSize || avatarSizeOptions[1]}`,
68
+ ...Object.entries(nonDefaultSizes).map(
69
+ ([breakpoint, size]) => `gl-${breakpoint}-avatar-s${size}`
70
+ ),
71
+ ];
54
72
  },
55
73
  isCircle() {
56
74
  return this.shape === avatarShapeOptions.circle;
@@ -74,14 +92,14 @@ export default {
74
92
  v-if="src"
75
93
  :src="src"
76
94
  :alt="alt"
77
- :class="['gl-avatar', { 'gl-avatar-circle': isCircle }, sizeClass]"
95
+ :class="['gl-avatar', { 'gl-avatar-circle': isCircle }, sizeClasses]"
78
96
  />
79
97
  <div
80
98
  v-else
81
99
  :class="[
82
100
  'gl-avatar gl-avatar-identicon',
83
101
  { 'gl-avatar-circle': isCircle },
84
- sizeClass,
102
+ sizeClasses,
85
103
  identiconBackgroundClass,
86
104
  ]"
87
105
  >
@@ -181,6 +181,31 @@
181
181
  }
182
182
  }
183
183
  }
184
+
185
+ table {
186
+ @include gl-my-7;
187
+
188
+ th,
189
+ td {
190
+ @include gl-px-3;
191
+ @include gl-py-4;
192
+ @include gl-inset-border-b-1-gray-100;
193
+ @include gl-vertical-align-top;
194
+ }
195
+
196
+ th {
197
+ @include gl-inset-border-y-1-gray-100;
198
+ @include gl-font-weight-bold;
199
+ }
200
+
201
+ thead {
202
+ @include gl-bg-gray-50;
203
+ }
204
+
205
+ tr:nth-child(even) {
206
+ @include gl-bg-gray-10;
207
+ }
208
+ }
184
209
  }
185
210
 
186
211
  .gl-compact-markdown {
@@ -262,4 +287,11 @@
262
287
  @include gl-font-size-monospace-sm;
263
288
  }
264
289
  }
290
+
291
+ table {
292
+ th,
293
+ td {
294
+ @include gl-py-3;
295
+ }
296
+ }
265
297
  }
@@ -3,7 +3,7 @@ import GlMarkdown from './markdown.vue';
3
3
  import markdownTypescaleDemoContent from './markdown_typescale_demo.html';
4
4
 
5
5
  const template = `
6
- <gl-markdown :compact="compact">${markdownTypescaleDemoContent}</gl-markdown>
6
+ <gl-markdown :compact="compact">${markdownTypescaleDemoContent}</gl-markdown>
7
7
  `;
8
8
 
9
9
  const generateProps = ({ compact = false } = {}) => ({ compact });
@@ -14,8 +14,11 @@ const Template = (args, { argTypes }) => ({
14
14
  template,
15
15
  });
16
16
 
17
- export const Typescale = Template.bind({});
18
- Typescale.args = generateProps();
17
+ export const Documentation = Template.bind({});
18
+ Documentation.args = generateProps();
19
+
20
+ export const Compact = Template.bind({});
21
+ Compact.args = generateProps({ compact: true });
19
22
 
20
23
  export default {
21
24
  title: 'base/markdown',
@@ -27,6 +27,52 @@
27
27
  <p>MD Doc Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
28
28
  significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
29
29
  requests, milestones, snippets and more.</p>
30
+
31
+ <table>
32
+ <thead>
33
+ <tr>
34
+ <th>Widget</th>
35
+ <th>Wording</th>
36
+ <th>Proposed</th>
37
+ </tr>
38
+ </thead>
39
+ <tbody>
40
+ <tr>
41
+ <td>
42
+ Test summary
43
+ </td>
44
+ <td>
45
+ Test summary contained 3 failed, 1 fixed test result out of 15 total tests
46
+ </td>
47
+ <td>
48
+ This is the only one that doesn't include the breakdown in the Level 1 subtext. Does it need to be updated?
49
+ </td>
50
+ </tr>
51
+ <tr>
52
+ <td>
53
+ Browser performance
54
+ </td>
55
+ <td>
56
+ Browser performance test metrics: 7 changes
57
+ </td>
58
+ <td>
59
+ Browser performance test metrics detected 7 changes
60
+ </td>
61
+ </tr>
62
+ <tr>
63
+ <td>
64
+ Load performance
65
+ </td>
66
+ <td>
67
+ Load performance test metrics detected 4 changes
68
+ </td>
69
+ <td>
70
+
71
+ </td>
72
+ </tr>
73
+ </tbody>
74
+ </table>
75
+
30
76
  <blockquote>
31
77
  <p>
32
78
  MD Doc Blockquote • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
@@ -418,6 +418,14 @@
418
418
  background-color: $purple-50 !important
419
419
  }
420
420
 
421
+ .gl-bg-purple-800 {
422
+ background-color: $purple-800
423
+ }
424
+
425
+ .gl-bg-purple-800\! {
426
+ background-color: $purple-800 !important
427
+ }
428
+
421
429
  .gl-bg-red-50 {
422
430
  background-color: $red-50
423
431
  }
@@ -1197,6 +1205,14 @@
1197
1205
  border-color: $blue-700 !important;
1198
1206
  }
1199
1207
 
1208
+ .gl-border-purple-700 {
1209
+ border-color: $purple-700;
1210
+ }
1211
+
1212
+ .gl-border-purple-700\! {
1213
+ border-color: $purple-700 !important;
1214
+ }
1215
+
1200
1216
  .gl-border-gray-a-08 {
1201
1217
  border-color: $t-gray-a-08;
1202
1218
  }
@@ -1760,6 +1776,24 @@
1760
1776
  inset 0 -#{$gl-border-size-1} 0 0 $gray-200 !important
1761
1777
  }
1762
1778
 
1779
+ .gl-inset-border-y-1-gray-100 {
1780
+ box-shadow: inset 0 #{$gl-border-size-1} 0 0 $gray-100,
1781
+ inset 0 -#{$gl-border-size-1} 0 0 $gray-100
1782
+ }
1783
+
1784
+ .gl-inset-border-y-1-gray-100\! {
1785
+ box-shadow: inset 0 #{$gl-border-size-1} 0 0 $gray-100,
1786
+ inset 0 -#{$gl-border-size-1} 0 0 $gray-100 !important
1787
+ }
1788
+
1789
+ .gl-inset-border-b-1-gray-100 {
1790
+ box-shadow: inset 0 -#{$gl-border-size-1} 0 0 $gray-100
1791
+ }
1792
+
1793
+ .gl-inset-border-b-1-gray-100\! {
1794
+ box-shadow: inset 0 -#{$gl-border-size-1} 0 0 $gray-100 !important
1795
+ }
1796
+
1763
1797
  .gl-inset-border-b-2-gray-100 {
1764
1798
  box-shadow: inset 0 -#{$gl-border-size-2} 0 0 $gray-100
1765
1799
  }
@@ -2457,6 +2491,14 @@
2457
2491
  color: $purple-700 !important;
2458
2492
  }
2459
2493
 
2494
+ .gl-text-purple-800 {
2495
+ color: $purple-800;
2496
+ }
2497
+
2498
+ .gl-text-purple-800\! {
2499
+ color: $purple-800 !important;
2500
+ }
2501
+
2460
2502
  .gl-text-theme-indigo-200 {
2461
2503
  color: $theme-indigo-200;
2462
2504
  }
@@ -4705,6 +4747,14 @@
4705
4747
  min-height: $gl-spacing-scale-7 !important;
4706
4748
  }
4707
4749
 
4750
+ .gl-min-h-8 {
4751
+ min-height: $gl-spacing-scale-8;
4752
+ }
4753
+
4754
+ .gl-min-h-8\! {
4755
+ min-height: $gl-spacing-scale-8 !important;
4756
+ }
4757
+
4708
4758
  .gl-max-w-15 {
4709
4759
  max-width: $gl-spacing-scale-15;
4710
4760
  }
@@ -146,6 +146,10 @@
146
146
  background-color: $purple-50;
147
147
  }
148
148
 
149
+ @mixin gl-bg-purple-800 {
150
+ background-color: $purple-800;
151
+ }
152
+
149
153
  @mixin gl-bg-red-50 {
150
154
  background-color: $red-50;
151
155
  }
@@ -147,6 +147,10 @@
147
147
  border-color: $blue-700;
148
148
  }
149
149
 
150
+ @mixin gl-border-purple-700 {
151
+ border-color: $purple-700;
152
+ }
153
+
150
154
  @mixin gl-border-gray-a-08 {
151
155
  border-color: $t-gray-a-08;
152
156
  }
@@ -36,6 +36,15 @@
36
36
  inset 0 -#{$gl-border-size-1} 0 0 $gray-200;
37
37
  }
38
38
 
39
+ @mixin gl-inset-border-y-1-gray-100 {
40
+ box-shadow: inset 0 #{$gl-border-size-1} 0 0 $gray-100,
41
+ inset 0 -#{$gl-border-size-1} 0 0 $gray-100;
42
+ }
43
+
44
+ @mixin gl-inset-border-b-1-gray-100 {
45
+ box-shadow: inset 0 -#{$gl-border-size-1} 0 0 $gray-100;
46
+ }
47
+
39
48
  @mixin gl-inset-border-b-2-gray-100 {
40
49
  box-shadow: inset 0 -#{$gl-border-size-2} 0 0 $gray-100;
41
50
  }
@@ -193,6 +193,10 @@
193
193
  color: $purple-700;
194
194
  }
195
195
 
196
+ @mixin gl-text-purple-800 {
197
+ color: $purple-800;
198
+ }
199
+
196
200
  @mixin gl-text-theme-indigo-200 {
197
201
  color: $theme-indigo-200;
198
202
  }
@@ -329,6 +329,10 @@
329
329
  min-height: $gl-spacing-scale-7;
330
330
  }
331
331
 
332
+ @mixin gl-min-h-8 {
333
+ min-height: $gl-spacing-scale-8;
334
+ }
335
+
332
336
  @mixin gl-max-w-15 {
333
337
  max-width: $gl-spacing-scale-15;
334
338
  }