@gitlab/ui 32.34.0 → 32.37.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.
@@ -97,7 +97,7 @@ const badgeForButtonOptions = {
97
97
  [buttonVariantOptions.confirm]: badgeVariantOptions.info,
98
98
  [buttonVariantOptions.danger]: badgeVariantOptions.danger
99
99
  };
100
- const newDropdownVariantOptions = {
100
+ const dropdownVariantOptions = {
101
101
  default: 'default',
102
102
  confirm: 'confirm',
103
103
  info: 'info (deprecated)',
@@ -251,4 +251,4 @@ const loadingIconSizes = {
251
251
  'xl (64x64)': 'xl'
252
252
  };
253
253
 
254
- export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, newDropdownVariantOptions, popoverPlacements, resizeDebounceTime, sizeOptions, sizeOptionsWithNoDefault, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
254
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.34.0",
3
+ "version": "32.37.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -226,6 +226,8 @@ export const tGrayA04 = 'rgba(0, 0, 0, 0.04)'
226
226
  export const tGrayA06 = 'rgba(0, 0, 0, 0.06)'
227
227
  export const tGrayA08 = 'rgba(0, 0, 0, 0.08)'
228
228
  export const tGrayA24 = 'rgba(0, 0, 0, 0.24)'
229
+ export const glTextColor = '#303030'
230
+ export const glTextColorSecondary = '#666'
229
231
  export const glFontWeightLight = '300'
230
232
  export const glFontWeightNormal = '400'
231
233
  export const glFontWeightBold = '600'
@@ -1167,6 +1167,16 @@
1167
1167
  "value": "rgba(#000, 0.24)",
1168
1168
  "compiledValue": "rgba(0, 0, 0, 0.24)"
1169
1169
  },
1170
+ {
1171
+ "name": "$gl-text-color",
1172
+ "value": "$gray-900",
1173
+ "compiledValue": "#303030"
1174
+ },
1175
+ {
1176
+ "name": "$gl-text-color-secondary",
1177
+ "value": "$gray-500",
1178
+ "compiledValue": "#666"
1179
+ },
1170
1180
  {
1171
1181
  "name": "$gl-font-weight-light",
1172
1182
  "value": "300",
@@ -1624,7 +1634,7 @@
1624
1634
  },
1625
1635
  {
1626
1636
  "name": "$body-color",
1627
- "value": "$gray-900",
1637
+ "value": "$gl-text-color",
1628
1638
  "compiledValue": "#303030"
1629
1639
  },
1630
1640
  {
@@ -1,6 +1,6 @@
1
1
  import { mount } from '@vue/test-utils';
2
2
 
3
- import { newDropdownVariantOptions } from '../../../utils/constants';
3
+ import { dropdownVariantOptions } from '../../../utils/constants';
4
4
  import GlLoadingIcon from '../loading_icon/loading_icon.vue';
5
5
  import GlDropdown from './dropdown.vue';
6
6
 
@@ -175,14 +175,11 @@ describe('new dropdown', () => {
175
175
  });
176
176
 
177
177
  describe('secondary category', () => {
178
- it.each(Object.keys(newDropdownVariantOptions))(
179
- 'applies %s variant class properly',
180
- (variant) => {
181
- buildWrapper({ category: 'secondary', variant });
182
-
183
- expect(findDropdownToggle().classes()).toContain(`btn-${variant}-secondary`);
184
- }
185
- );
178
+ it.each(Object.keys(dropdownVariantOptions))('applies %s variant class properly', (variant) => {
179
+ buildWrapper({ category: 'secondary', variant });
180
+
181
+ expect(findDropdownToggle().classes()).toContain(`btn-${variant}-secondary`);
182
+ });
186
183
  });
187
184
 
188
185
  describe('when the header slot exists', () => {
@@ -12,8 +12,8 @@ import {
12
12
  } from '../../../../index';
13
13
  import {
14
14
  buttonCategoryOptions,
15
- newDropdownVariantOptions,
16
15
  buttonSizeOptions,
16
+ dropdownVariantOptions,
17
17
  } from '../../../utils/constants';
18
18
  import readme from './dropdown.md';
19
19
 
@@ -57,7 +57,7 @@ function generateProps({
57
57
  },
58
58
  variant: {
59
59
  type: String,
60
- default: select('variant', Object.values(newDropdownVariantOptions), variant),
60
+ default: select('variant', Object.values(dropdownVariantOptions), variant),
61
61
  },
62
62
  size: {
63
63
  type: String,
@@ -197,7 +197,7 @@ documentedStoriesOf('base/dropdown', readme)
197
197
  props: generateProps({
198
198
  text: 'Some dropdown',
199
199
  category: buttonCategoryOptions.secondary,
200
- variant: newDropdownVariantOptions.confirm,
200
+ variant: dropdownVariantOptions.confirm,
201
201
  }),
202
202
  components,
203
203
  template: wrap`
@@ -3,8 +3,8 @@ import { BDropdown } from 'bootstrap-vue';
3
3
  import { isVisible, selectAll } from 'bootstrap-vue/src/utils/dom';
4
4
  import {
5
5
  buttonCategoryOptions,
6
- newDropdownVariantOptions,
7
6
  buttonSizeOptions,
7
+ dropdownVariantOptions,
8
8
  } from '../../../utils/constants';
9
9
  import { ButtonMixin } from '../../mixins/button_mixin';
10
10
  import GlButton from '../button/button.vue';
@@ -106,8 +106,8 @@ export default {
106
106
  variant: {
107
107
  type: String,
108
108
  required: false,
109
- default: newDropdownVariantOptions.default,
110
- validator: (value) => Object.keys(newDropdownVariantOptions).includes(value),
109
+ default: dropdownVariantOptions.default,
110
+ validator: (value) => Object.keys(dropdownVariantOptions).includes(value),
111
111
  },
112
112
  size: {
113
113
  type: String,
@@ -82,8 +82,8 @@ describe('Filtered search suggestion list component', () => {
82
82
  },
83
83
  template: `
84
84
  <div>
85
- <gl-filtered-search-suggestion value="1">1</gl-filtered-search-suggestion>
86
- <gl-filtered-search-suggestion value="2">2</gl-filtered-search-suggestion>
85
+ <gl-filtered-search-suggestion value="One">One</gl-filtered-search-suggestion>
86
+ <gl-filtered-search-suggestion value="Two">Two</gl-filtered-search-suggestion>
87
87
  </div>
88
88
  `,
89
89
  };
@@ -112,7 +112,7 @@ describe('Filtered search suggestion list component', () => {
112
112
  it('selects first suggestion', () => {
113
113
  wrapper.vm.nextItem();
114
114
  return wrapper.vm.$nextTick().then(() => {
115
- expect(wrapper.vm.getValue()).toBe('1');
115
+ expect(wrapper.vm.getValue()).toBe('One');
116
116
  });
117
117
  });
118
118
 
@@ -120,7 +120,7 @@ describe('Filtered search suggestion list component', () => {
120
120
  wrapper.vm.nextItem();
121
121
  wrapper.vm.nextItem();
122
122
  return wrapper.vm.$nextTick().then(() => {
123
- expect(wrapper.vm.getValue()).toBe('2');
123
+ expect(wrapper.vm.getValue()).toBe('Two');
124
124
  });
125
125
  });
126
126
 
@@ -146,7 +146,7 @@ describe('Filtered search suggestion list component', () => {
146
146
  wrapper.vm.prevItem();
147
147
  wrapper.vm.prevItem();
148
148
  return wrapper.vm.$nextTick().then(() => {
149
- expect(wrapper.vm.getValue()).toBe('2');
149
+ expect(wrapper.vm.getValue()).toBe('Two');
150
150
  });
151
151
  });
152
152
 
@@ -156,14 +156,21 @@ describe('Filtered search suggestion list component', () => {
156
156
  wrapper.vm.nextItem();
157
157
  wrapper.vm.nextItem();
158
158
  return wrapper.vm.$nextTick().then(() => {
159
- expect(wrapper.vm.getValue()).toBe('1');
159
+ expect(wrapper.vm.getValue()).toBe('One');
160
160
  });
161
161
  });
162
162
 
163
163
  it('highlights suggestion if initial-value is provided', () => {
164
- wrapper.setProps({ initialValue: '2' });
164
+ wrapper.setProps({ initialValue: 'Two' });
165
165
  return wrapper.vm.$nextTick().then(() => {
166
- expect(wrapper.find('.gl-filtered-search-suggestion-active').text()).toBe('2');
166
+ expect(wrapper.find('.gl-filtered-search-suggestion-active').text()).toBe('Two');
167
+ });
168
+ });
169
+
170
+ it('highlights suggestion if initial-value is provided, regardless of case sensitivity', async () => {
171
+ wrapper.setProps({ initialValue: 'two' });
172
+ return wrapper.vm.$nextTick().then(() => {
173
+ expect(wrapper.find('.gl-filtered-search-suggestion-active').text()).toBe('Two');
167
174
  });
168
175
  });
169
176
 
@@ -33,14 +33,23 @@ export default {
33
33
 
34
34
  watch: {
35
35
  initialValue(newValue) {
36
- this.activeIdx = this.registeredItems.findIndex((item) => item.value === newValue);
36
+ this.activeIdx = this.registeredItems.findIndex((item) =>
37
+ this.valuesMatch(item.value, newValue)
38
+ );
37
39
  },
38
40
  },
39
41
 
40
42
  methods: {
43
+ valuesMatch(firstValue, secondValue) {
44
+ if (!firstValue || !secondValue) return false;
45
+
46
+ return typeof firstValue === 'string'
47
+ ? firstValue.toLowerCase() === secondValue.toLowerCase()
48
+ : firstValue === secondValue;
49
+ },
41
50
  register(item) {
42
51
  this.registeredItems.push(item);
43
- if (item.value === this.initialValue) {
52
+ if (this.valuesMatch(item.value, this.initialValue)) {
44
53
  this.activeIdx = this.registeredItems.length - 1;
45
54
  }
46
55
  },
@@ -42,4 +42,13 @@ describe('GlPopover', () => {
42
42
  expect(findBVPopover().props('triggers')).toBe(triggers);
43
43
  });
44
44
  });
45
+
46
+ describe('title slot', () => {
47
+ it('renders title slot content', () => {
48
+ const title = 'Popover title';
49
+ createWrapper({ title });
50
+
51
+ expect(findBVPopover().props('title')).toBe(title);
52
+ });
53
+ });
45
54
  });
@@ -2,6 +2,12 @@ import { withKnobs, select, text } from '@storybook/addon-knobs';
2
2
  import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
3
  import { popoverPlacements } from '../../../utils/constants';
4
4
 
5
+ const contentString = `
6
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat a nisi non
7
+ pellentesque. Pellentesque efficitur vulputate rutrum. Fusce nisl magna, porttitor in
8
+ massa ac, porta condimentum libero. Ut id lacus tristique, egestas arcu non, molestie nisi.
9
+ `;
10
+
5
11
  const template = `
6
12
  <div class="gl-display-flex gl-justify-content-center gl-p-6">
7
13
  <gl-button id="pop-top">{{placement}}</gl-button>
@@ -9,13 +15,29 @@ const template = `
9
15
  triggers="hover focus"
10
16
  :title="title"
11
17
  :placement="placement"
12
- :content="content"
18
+ content="${contentString}"
19
+ data-testid="popover-with-props"
13
20
  show
14
21
  />
15
22
  </div>
16
23
  `;
17
24
 
18
- function generateProps({ placement = popoverPlacements.top, title = 'Popover' } = {}) {
25
+ const scopedSlotTemplate = `
26
+ <div class="gl-display-flex gl-justify-content-center gl-p-6">
27
+ <gl-button id="pop-top-two" data-testid="popover-button-click">{{placement}}</gl-button>
28
+ <gl-popover target="pop-top-two"
29
+ triggers="click"
30
+ :placement="placement"
31
+ content="${contentString}"
32
+ >
33
+ <template #title>
34
+ <span data-testid="popover-title">Popover title</span>
35
+ </template>
36
+ </gl-popover>
37
+ </div>
38
+ `;
39
+
40
+ function generateProps({ placement = popoverPlacements.top, title = 'Popover', triggers } = {}) {
19
41
  return {
20
42
  placement: {
21
43
  type: String,
@@ -25,6 +47,10 @@ function generateProps({ placement = popoverPlacements.top, title = 'Popover' }
25
47
  type: String,
26
48
  default: text('title', title),
27
49
  },
50
+ triggers: {
51
+ type: String,
52
+ default: text('hover focus', triggers),
53
+ },
28
54
  };
29
55
  }
30
56
 
@@ -33,13 +59,12 @@ documentedStoriesOf('base/popover', '')
33
59
  .add('default', () => ({
34
60
  template,
35
61
  props: generateProps(),
36
- computed: {
37
- content() {
38
- return `
39
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat a nisi non
40
- pellentesque. Pellentesque efficitur vulputate rutrum. Fusce nisl magna, porttitor in
41
- massa ac, porta condimentum libero. Ut id lacus tristique, egestas arcu non, molestie nisi.
42
- `;
43
- },
44
- },
45
- }));
62
+ }))
63
+ .add(
64
+ 'on click',
65
+ () => ({
66
+ template: scopedSlotTemplate,
67
+ props: generateProps(),
68
+ }),
69
+ { storyshots: false }
70
+ );
@@ -39,8 +39,7 @@ export default {
39
39
  v-bind="$attrs"
40
40
  v-on="$listeners"
41
41
  >
42
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
43
- <template slot="title">
42
+ <template v-if="$scopedSlots.title" #title>
44
43
  <slot name="title"></slot>
45
44
  </template>
46
45
  <slot></slot>
@@ -1997,6 +1997,14 @@
1997
1997
  color: $body-color !important;
1998
1998
  }
1999
1999
 
2000
+ .gl-text-secondary {
2001
+ color: $gl-text-color-secondary;
2002
+ }
2003
+
2004
+ .gl-text-secondary\! {
2005
+ color: $gl-text-color-secondary !important;
2006
+ }
2007
+
2000
2008
  .gl-sm-text-body {
2001
2009
  @include gl-media-breakpoint-up(sm) {
2002
2010
  color: $body-color;
@@ -4201,6 +4209,18 @@
4201
4209
  }
4202
4210
  }
4203
4211
 
4212
+ .gl-lg-w-1px {
4213
+ @media (min-width: $breakpoint-lg) {
4214
+ width: 1px;
4215
+ }
4216
+ }
4217
+
4218
+ .gl-lg-w-1px\! {
4219
+ @media (min-width: $breakpoint-lg) {
4220
+ width: 1px !important;
4221
+ }
4222
+ }
4223
+
4204
4224
  .gl-md-w-50p {
4205
4225
  @include gl-media-breakpoint-up(md) {
4206
4226
  width: 50%;
@@ -4352,6 +4372,18 @@
4352
4372
  max-width: 30% !important;
4353
4373
  }
4354
4374
  }
4375
+
4376
+ .gl-md-max-w-50p {
4377
+ @include gl-media-breakpoint-up(md) {
4378
+ max-width: 50%;
4379
+ }
4380
+ }
4381
+
4382
+ .gl-md-max-w-50p\! {
4383
+ @include gl-media-breakpoint-up(md) {
4384
+ max-width: 50% !important;
4385
+ }
4386
+ }
4355
4387
  .gl-p-0 {
4356
4388
  padding: 0;
4357
4389
  }
@@ -19,6 +19,10 @@
19
19
  color: $body-color;
20
20
  }
21
21
 
22
+ @mixin gl-text-secondary {
23
+ color: $gl-text-color-secondary;
24
+ }
25
+
22
26
  @mixin gl-sm-text-body {
23
27
  @include gl-media-breakpoint-up(sm) {
24
28
  @include gl-text-body;
@@ -212,6 +212,12 @@
212
212
  }
213
213
  }
214
214
 
215
+ @mixin gl-lg-w-1px {
216
+ @media (min-width: $breakpoint-lg) {
217
+ width: 1px;
218
+ }
219
+ }
220
+
215
221
  @mixin gl-md-w-50p {
216
222
  @include gl-media-breakpoint-up(md) {
217
223
  width: 50%;
@@ -302,3 +308,9 @@
302
308
  max-width: 30%;
303
309
  }
304
310
  }
311
+
312
+ @mixin gl-md-max-w-50p {
313
+ @include gl-media-breakpoint-up(md) {
314
+ max-width: 50%;
315
+ }
316
+ }
@@ -295,6 +295,9 @@ $t-gray-a-08: rgba(#000, 0.08);
295
295
  $t-gray-a-24: rgba(#000, 0.24);
296
296
 
297
297
  // Text
298
+ $gl-text-color: $gray-900 !default;
299
+ $gl-text-color-secondary: $gray-500 !default;
300
+
298
301
  $gl-font-weight-light: 300;
299
302
  $gl-font-weight-normal: 400;
300
303
  $gl-font-weight-bold: 600;
@@ -453,7 +456,7 @@ $modal-backdrop-opacity: 0.64;
453
456
  // Bootstrap overrides
454
457
  // these should ideally be moved further up in the file to the compoent-relevant sections
455
458
  // but they can wait here for now
456
- $body-color: $gray-900 !default;
459
+ $body-color: $gl-text-color !default;
457
460
 
458
461
  $secondary: $gray-50;
459
462
  $success: $green-500;
@@ -115,7 +115,7 @@ export const badgeForButtonOptions = {
115
115
  [buttonVariantOptions.danger]: badgeVariantOptions.danger,
116
116
  };
117
117
 
118
- export const newDropdownVariantOptions = {
118
+ export const dropdownVariantOptions = {
119
119
  default: 'default',
120
120
  confirm: 'confirm',
121
121
  info: 'info (deprecated)',