@gitlab/ui 43.9.2 → 43.11.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.
@@ -43,11 +43,6 @@ const variantCssColorMap = {
43
43
  danger: 'gl-text-red-500'
44
44
  };
45
45
  const targetOptions = ['_self', '_blank', '_parent', '_top', null];
46
- const sizeOptions = {
47
- default: null,
48
- sm: 'sm',
49
- lg: 'lg'
50
- };
51
46
  const labelSizeOptions = {
52
47
  default: null,
53
48
  sm: 'sm'
@@ -200,8 +195,7 @@ const tabsButtonDefaults = {
200
195
  };
201
196
  const tokenVariants = ['default', 'search-type', 'search-value'];
202
197
  const resizeDebounceTime = 200;
203
- const variantOptionsWithNoDefault = appendDefaultOption(variantOptions);
204
- const sizeOptionsWithNoDefault = appendDefaultOption(sizeOptions); // Datetime constants
198
+ const variantOptionsWithNoDefault = appendDefaultOption(variantOptions); // Datetime constants
205
199
 
206
200
  const defaultDateFormat = 'YYYY-MM-DD';
207
201
  const bannerVariants = ['promotion', 'introduction'];
@@ -250,4 +244,4 @@ const loadingIconSizes = {
250
244
  'xl (64x64)': 'xl'
251
245
  };
252
246
 
253
- export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, dropdownVariantOptions, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, resizeDebounceTime, sizeOptions, sizeOptionsWithNoDefault, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
247
+ export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, dropdownVariantOptions, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, resizeDebounceTime, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "43.9.2",
3
+ "version": "43.11.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -57,7 +57,7 @@
57
57
  "dependencies": {
58
58
  "@popperjs/core": "^2.11.2",
59
59
  "bootstrap-vue": "2.20.1",
60
- "dompurify": "^2.3.10",
60
+ "dompurify": "^2.4.0",
61
61
  "echarts": "^5.3.2",
62
62
  "iframe-resizer": "^4.3.2",
63
63
  "lodash": "^4.17.20",
@@ -94,9 +94,9 @@
94
94
  "@storybook/theming": "6.5.10",
95
95
  "@storybook/vue": "6.5.10",
96
96
  "@vue/test-utils": "1.3.0",
97
- "@vue/vue2-jest": "27.0.0",
97
+ "@vue/vue2-jest": "29.0.0",
98
98
  "autoprefixer": "^9.7.6",
99
- "babel-jest": "^27.5.1",
99
+ "babel-jest": "29.0.1",
100
100
  "babel-loader": "^8.0.5",
101
101
  "babel-plugin-lodash": "^3.3.4",
102
102
  "babel-plugin-require-context-hook": "^1.0.0",
@@ -112,10 +112,9 @@
112
112
  "glob": "^7.2.0",
113
113
  "identity-obj-proxy": "^3.0.0",
114
114
  "inquirer-select-directory": "^1.2.0",
115
- "jest": "^27.5.1",
116
- "jest-circus": "27.5.1",
117
- "jest-environment-jsdom": "27.5.1",
118
- "jest-raw-loader": "^1.0.1",
115
+ "jest": "^29.0.1",
116
+ "jest-circus": "29.0.1",
117
+ "jest-environment-jsdom": "29.0.1",
119
118
  "jest-serializer-vue": "^2.0.2",
120
119
  "markdownlint-cli": "^0.29.0",
121
120
  "mockdate": "^2.0.5",
@@ -54,4 +54,21 @@ See: https://gitlab.com/gitlab-org/gitlab/issues/30055
54
54
  }
55
55
  }
56
56
  }
57
+
58
+ @each $name, $size in $gl-form-input-sizes {
59
+ .gl-form-select-#{$name} {
60
+ max-width: $size;
61
+ }
62
+
63
+ @each $breakpointName, $breakpointSize in $gl-form-input-sizes {
64
+ @if $breakpointName != xs {
65
+ .gl-#{$breakpointName}-form-select-#{$name} {
66
+ @include gl-media-breakpoint-up($breakpointName) {
67
+ max-width: $size;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+
57
74
  /* stylelint-enable property-no-vendor-prefix */
@@ -1,5 +1,5 @@
1
1
  import { mount } from '@vue/test-utils';
2
- import { sizeOptions, formStateOptions } from '../../../../utils/constants';
2
+ import { formStateOptions, formInputSizes } from '../../../../utils/constants';
3
3
  import { formSelectOptions } from './constants';
4
4
  import GlFormSelect from './form_select.vue';
5
5
 
@@ -33,13 +33,13 @@ describe('GlFormSelect', () => {
33
33
 
34
34
  describe('size prop', () => {
35
35
  // Exclude the default null value
36
- const nonNullSizes = excludeDefaultNull(sizeOptions);
36
+ const nonNullSizes = excludeDefaultNull(formInputSizes);
37
37
 
38
38
  it.each(nonNullSizes)('adds correct class for size %s', (size) => {
39
39
  createComponent({ size });
40
40
 
41
41
  expect(wrapper.classes().sort()).toEqual(
42
- [...DEFAULT_SELECT_CLASSES, `custom-select-${size}`].sort()
42
+ [...DEFAULT_SELECT_CLASSES, `gl-form-select-${size}`].sort()
43
43
  );
44
44
  });
45
45
 
@@ -1,5 +1,5 @@
1
1
  import { GlFormSelect } from '../../../../index';
2
- import { sizeOptions, formStateOptions } from '../../../../utils/constants';
2
+ import { formStateOptions, formInputSizes } from '../../../../utils/constants';
3
3
  import { formSelectOptions } from './constants';
4
4
  import readme from './form_select.md';
5
5
 
@@ -90,7 +90,7 @@ export default {
90
90
  },
91
91
  argTypes: {
92
92
  size: {
93
- options: sizeOptions,
93
+ options: formInputSizes,
94
94
  control: 'select',
95
95
  },
96
96
  state: {
@@ -1,15 +1,52 @@
1
1
  <script>
2
2
  import { BFormSelect } from 'bootstrap-vue';
3
+ import { isObject } from 'lodash';
4
+ import { formInputSizes } from '../../../../utils/constants';
3
5
 
4
6
  export default {
5
7
  components: {
6
8
  BFormSelect,
7
9
  },
8
10
  inheritAttrs: false,
11
+ props: {
12
+ /**
13
+ * Maximum width of the Select
14
+ */
15
+ size: {
16
+ type: [String, Object],
17
+ required: false,
18
+ default: null,
19
+ validator: (value) => {
20
+ const sizes = isObject(value) ? Object.values(value) : [value];
21
+
22
+ return sizes.every((size) => Object.values(formInputSizes).includes(size));
23
+ },
24
+ },
25
+ },
26
+ computed: {
27
+ cssClasses() {
28
+ if (this.size === null) {
29
+ return [];
30
+ }
31
+
32
+ if (isObject(this.size)) {
33
+ const { default: defaultSize, ...nonDefaultSizes } = this.size;
34
+
35
+ return [
36
+ ...(defaultSize ? [`gl-form-select-${defaultSize}`] : []),
37
+ ...Object.entries(nonDefaultSizes).map(
38
+ ([breakpoint, size]) => `gl-${breakpoint}-form-select-${size}`
39
+ ),
40
+ ];
41
+ }
42
+
43
+ return [`gl-form-select-${this.size}`];
44
+ },
45
+ },
9
46
  };
10
47
  </script>
11
48
  <template>
12
- <b-form-select class="gl-form-select" v-bind="$attrs" v-on="$listeners">
49
+ <b-form-select class="gl-form-select" v-bind="$attrs" :class="cssClasses" v-on="$listeners">
13
50
  <!-- eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots -->
14
51
  <template v-for="slot in Object.keys($slots)" #[slot]>
15
52
  <slot :name="slot"></slot>
@@ -155,6 +155,22 @@
155
155
  @include gl-py-1;
156
156
  }
157
157
 
158
+ pre {
159
+ @include gl-py-3;
160
+ @include gl-px-4;
161
+ @include gl-rounded-base;
162
+ @include gl-inset-border-1-gray-100;
163
+ @include gl-my-7;
164
+ @include gl-overflow-auto;
165
+
166
+ code {
167
+ @include gl-bg-white;
168
+ @include gl-rounded-0;
169
+ @include gl-text-gray-900;
170
+ @include gl-p-0;
171
+ }
172
+ }
173
+
158
174
  .audio-container {
159
175
  @include gl-display-inline-flex;
160
176
  @include gl-flex-direction-column;
@@ -1,32 +1,46 @@
1
1
  <h1>MD Doc h1 • GitLab uses "GitLab Flavored Markdown" (GFM)</h1>
2
- <p>MD Doc Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
3
- significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
4
- requests, milestones, snippets and more.</p>
5
- <p class="sm">MD Doc Small Paragraph GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown
6
- in a few significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues,
7
- merge requests, milestones, snippets and more.</p>
2
+ <p>
3
+ MD Doc Paragraph GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown
4
+ in a few significant ways to add some useful functionality. You can use GFM in the following
5
+ areas: comments, issues, merge requests, milestones, snippets and more.
6
+ </p>
7
+ <p class="sm">
8
+ MD Doc Small Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard
9
+ Markdown in a few significant ways to add some useful functionality. You can use GFM in the
10
+ following areas: comments, issues, merge requests, milestones, snippets and more.
11
+ </p>
8
12
  <p class="monospace">UI Monospace</p>
9
13
  <p class="monospace sm">UI Small Monospace</p>
10
14
  <h2>MD Doc h2 • GitLab uses "GitLab Flavored Markdown" (GFM)</h2>
11
- <p>MD Doc Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
12
- significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
13
- requests, milestones, snippets and more.</p>
15
+ <p>
16
+ MD Doc Paragraph GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown
17
+ in a few significant ways to add some useful functionality. You can use GFM in the following
18
+ areas: comments, issues, merge requests, milestones, snippets and more.
19
+ </p>
14
20
  <h3>MD Doc h3 • GitLab uses "GitLab Flavored Markdown" (GFM)</h3>
15
- <p>MD Doc Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
16
- significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
17
- requests, milestones, snippets and more.</p>
21
+ <p>
22
+ MD Doc Paragraph GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown
23
+ in a few significant ways to add some useful functionality. You can use GFM in the following
24
+ areas: comments, issues, merge requests, milestones, snippets and more.
25
+ </p>
18
26
  <h4>MD Doc h4 • GitLab uses "GitLab Flavored Markdown" (GFM)</h4>
19
- <p>MD Doc Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
20
- significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
21
- requests, milestones, snippets and more.</p>
27
+ <p>
28
+ MD Doc Paragraph GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown
29
+ in a few significant ways to add some useful functionality. You can use GFM in the following
30
+ areas: comments, issues, merge requests, milestones, snippets and more.
31
+ </p>
22
32
  <h5>MD Doc h5 • GitLab uses "GitLab Flavored Markdown" (GFM)</h5>
23
- <p>MD Doc Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
24
- significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
25
- requests, milestones, snippets and more.</p>
33
+ <p>
34
+ MD Doc Paragraph GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown
35
+ in a few significant ways to add some useful functionality. You can use GFM in the following
36
+ areas: comments, issues, merge requests, milestones, snippets and more.
37
+ </p>
26
38
  <h6>MD Doc h6 • GitLab uses "GitLab Flavored Markdown" (GFM)</h6>
27
- <p>MD Doc Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
28
- significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
29
- requests, milestones, snippets and more.</p>
39
+ <p>
40
+ MD Doc Paragraph GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown
41
+ in a few significant ways to add some useful functionality. You can use GFM in the following
42
+ areas: comments, issues, merge requests, milestones, snippets and more.
43
+ </p>
30
44
 
31
45
  <table>
32
46
  <thead>
@@ -38,46 +52,31 @@
38
52
  </thead>
39
53
  <tbody>
40
54
  <tr>
55
+ <td>Test summary</td>
56
+ <td>Test summary contained 3 failed, 1 fixed test result out of 15 total tests</td>
41
57
  <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?
58
+ This is the only one that doesn't include the breakdown in the Level 1 subtext. Does it need
59
+ to be updated?
49
60
  </td>
50
61
  </tr>
51
62
  <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>
63
+ <td>Browser performance</td>
64
+ <td>Browser performance test metrics: 7 changes</td>
65
+ <td>Browser performance test metrics detected 7 changes</td>
61
66
  </tr>
62
67
  <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>
68
+ <td>Load performance</td>
69
+ <td>Load performance test metrics detected 4 changes</td>
70
+ <td>✅</td>
72
71
  </tr>
73
72
  </tbody>
74
73
  </table>
75
74
 
76
75
  <blockquote>
77
76
  <p>
78
- MD Doc Blockquote • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
79
- significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge
80
- requests, milestones, snippets and more.
77
+ MD Doc Blockquote • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard
78
+ Markdown in a few significant ways to add some useful functionality. You can use GFM in the
79
+ following areas: comments, issues, merge requests, milestones, snippets and more.
81
80
  </p>
82
81
  </blockquote>
83
82
  <blockquote>
@@ -102,26 +101,55 @@
102
101
  </blockquote>
103
102
  <blockquote>
104
103
  <blockquote>
105
- <p>
106
- Nested blockquote
107
- </p>
104
+ <p>Nested blockquote</p>
108
105
  </blockquote>
109
106
  </blockquote>
110
107
  <p>
111
108
  This is a paragraph with two types inline diff <span class="idiff addition">addition</span> and
112
109
  <span class="idiff deletion">deletion</span>
113
110
  </p>
114
- <p>
115
- This block implements the "GitLab Flavored Markdown" <code>Code span</code> styles.
116
- </p>
111
+ <p>This block implements the "GitLab Flavored Markdown" <code>Code span</code> styles.</p>
117
112
 
118
113
  <p>
119
114
  This is an audio file
120
115
  <span class="media-container audio-container">
121
- <audio src="file.mp3" controls="true" data-setup="{}" data-title="file.mp3" data-canonical-src="file.mp3"
122
- class="gfm">
123
- </audio>
124
- <a href="file.mp3" target="_blank" rel="noopener noreferrer" title="Download file.mp3" data-canonical-src="file.mp3"
125
- data-link="true" class="gfm">file.mp3</a>
116
+ <audio
117
+ src="file.mp3"
118
+ controls="true"
119
+ data-setup="{}"
120
+ data-title="file.mp3"
121
+ data-canonical-src="file.mp3"
122
+ class="gfm"
123
+ ></audio>
124
+ <a
125
+ href="file.mp3"
126
+ target="_blank"
127
+ rel="noopener noreferrer"
128
+ title="Download file.mp3"
129
+ data-canonical-src="file.mp3"
130
+ data-link="true"
131
+ class="gfm"
132
+ >file.mp3</a
133
+ >
126
134
  </span>
127
135
  </p>
136
+ <p>Code block</p>
137
+ <pre class="code"><code>pre {
138
+ @include gl-py-4;
139
+ @include gl-px-6;
140
+
141
+ code {
142
+ @include gl-bg-white;
143
+ @include gl-rounded-0;
144
+ @include gl-text-gray-900;
145
+ @include gl-px-0;
146
+ @include gl-py-0;
147
+ }
148
+ }
149
+ </code></pre>
150
+ <p>Code block with long lines scrolls horizontally</p>
151
+ <pre
152
+ class="code"
153
+ ><code>MD Doc Small Paragraph • GitLab uses "GitLab Flavored Markdown" (GFM). It extends the standard Markdown in a few
154
+ significant ways to add some useful functionality. You can use GFM in the following areas: comments, issues, merge requests, milestones, snippets and more.
155
+ </code></pre>
@@ -48,12 +48,6 @@ export const variantCssColorMap = {
48
48
 
49
49
  export const targetOptions = ['_self', '_blank', '_parent', '_top', null];
50
50
 
51
- export const sizeOptions = {
52
- default: null,
53
- sm: 'sm',
54
- lg: 'lg',
55
- };
56
-
57
51
  export const labelSizeOptions = {
58
52
  default: null,
59
53
  sm: 'sm',
@@ -234,7 +228,6 @@ export const tokenVariants = ['default', 'search-type', 'search-value'];
234
228
  export const resizeDebounceTime = 200;
235
229
 
236
230
  export const variantOptionsWithNoDefault = appendDefaultOption(variantOptions);
237
- export const sizeOptionsWithNoDefault = appendDefaultOption(sizeOptions);
238
231
 
239
232
  // Datetime constants
240
233
  export const defaultDateFormat = 'YYYY-MM-DD';