@gitlab/ui 38.9.0 → 38.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "38.9.0",
3
+ "version": "38.10.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -296,11 +296,6 @@ export default {
296
296
  */
297
297
  this.$emit('submit', normalizeTokens(cloneDeep(this.tokens)));
298
298
  },
299
-
300
- clearInput() {
301
- this.tokens = initialState();
302
- this.$emit('clearInput');
303
- },
304
299
  },
305
300
  };
306
301
  </script>
@@ -1,52 +1,76 @@
1
1
  import { setStoryTimeout } from '../../../utils/test_utils';
2
- import { GlInfiniteScroll } from '../../../index';
2
+ import { GlInfiniteScroll, GlLoadingIcon } from '../../../index';
3
3
  import readme from './infinite_scroll.md';
4
4
 
5
5
  const ITEMS_BATCH_SIZE = 20;
6
6
 
7
7
  const template = `
8
8
  <gl-infinite-scroll
9
- :max-list-height="285"
10
- :fetched-items="fetchedItems"
11
- @bottomReached="bottomReached"
9
+ :total-items="totalItems"
10
+ :fetched-items="localFetchedItems"
11
+ :max-list-height="maxListHeight"
12
+ @bottomReached="onBottomReached"
12
13
  >
13
14
  <template #items>
14
15
  <ul class="list-group list-group-flushed list-unstyled">
15
- <li v-for="item in fetchedItems" :key="item" class="list-group-item">Item #{{ item }}</li>
16
+ <li v-for="item in localFetchedItems" :key="item" class="list-group-item">Item #{{ item }}</li>
16
17
  </ul>
17
18
  </template>
18
19
 
19
- <template #default>
20
+ <template v-if="localIsLoading" #default>
20
21
  <div class="gl-mt-3">
21
- <gl-loading-icon v-if="isLoading" />
22
- <span v-else>{{ fetchedItems }} items loaded</span>
22
+ <gl-loading-icon />
23
23
  </div>
24
24
  </template>
25
25
  </gl-infinite-scroll>
26
26
  `;
27
27
 
28
- const generateProps = ({ isLoading = false, fetchedItems = ITEMS_BATCH_SIZE } = {}) => ({
28
+ const generateProps = ({
29
+ isLoading = false,
30
+ totalItems = null,
31
+ fetchedItems = ITEMS_BATCH_SIZE,
32
+ maxListHeight = 285,
33
+ } = {}) => ({
29
34
  isLoading,
35
+ totalItems,
30
36
  fetchedItems,
37
+ maxListHeight,
31
38
  });
32
39
 
33
40
  const Template = (args, { argTypes }) => ({
34
41
  components: {
35
42
  GlInfiniteScroll,
43
+ GlLoadingIcon,
36
44
  },
37
45
  props: Object.keys(argTypes),
46
+ watch: {
47
+ fetchedItems: {
48
+ immediate: true,
49
+ handler(fetchedItems) {
50
+ this.localFetchedItems = fetchedItems;
51
+ },
52
+ },
53
+ isLoading: {
54
+ immediate: true,
55
+ handler(isLoading) {
56
+ this.localIsLoading = isLoading;
57
+ },
58
+ },
59
+ },
38
60
  data() {
39
61
  return {
40
62
  loadTimer: null,
63
+ localFetchedItems: null,
64
+ localIsLoading: false,
41
65
  };
42
66
  },
43
67
  methods: {
44
- bottomReached() {
68
+ onBottomReached() {
45
69
  clearTimeout(this.loadTimer);
46
- this.isLoading = true;
70
+ this.localIsLoading = true;
47
71
  this.loadTimer = setStoryTimeout(() => {
48
- this.fetchedItems += ITEMS_BATCH_SIZE;
49
- this.isLoading = false;
72
+ this.localFetchedItems += ITEMS_BATCH_SIZE;
73
+ this.localIsLoading = false;
50
74
  }, 500);
51
75
  },
52
76
  },
@@ -67,10 +67,12 @@ $gl-popover-max-width: $grid-size * 35;
67
67
  @include gl-font-sm;
68
68
  @include gl-font-weight-bold;
69
69
  @include gl-m-0;
70
+ @include gl-border-bottom-0;
71
+ @include gl-pb-0;
70
72
  }
71
73
 
72
74
  .popover-body {
73
- @include gl-py-5;
75
+ @include gl-py-3;
74
76
  @include gl-px-4;
75
77
 
76
78
  > .popover-hr {
@@ -1,5 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { tooltipActionEvents } from '../../../utils/constants';
2
+ import { tooltipActionEvents, popoverPlacements } from '../../../utils/constants';
3
3
  import GlPopover from './popover.vue';
4
4
 
5
5
  describe('GlPopover', () => {
@@ -49,6 +49,20 @@ describe('GlPopover', () => {
49
49
  });
50
50
  });
51
51
 
52
+ describe('placement', () => {
53
+ it(`uses "${popoverPlacements.top}" placement by default`, () => {
54
+ createWrapper();
55
+
56
+ expect(findBVPopover().props('placement')).toBe(popoverPlacements.top);
57
+ });
58
+
59
+ it('uses a defined placement', () => {
60
+ createWrapper({ placement: popoverPlacements.right });
61
+
62
+ expect(findBVPopover().props('placement')).toBe(popoverPlacements.right);
63
+ });
64
+ });
65
+
52
66
  describe('close button', () => {
53
67
  let doCloseMock;
54
68
 
@@ -26,7 +26,7 @@ const getTemplate = (id, slots = '') => `
26
26
  </div>`;
27
27
 
28
28
  const generateProps = ({
29
- placement = popoverPlacements.top,
29
+ placement = defaultValue('placement'),
30
30
  title = 'Popover',
31
31
  triggers = defaultValue('triggers'),
32
32
  cssClasses = defaultValue('cssClasses'),
@@ -2,6 +2,7 @@
2
2
  import { BPopover } from 'bootstrap-vue';
3
3
  import tooltipMixin from '../../mixins/tooltip_mixin';
4
4
  import CloseButton from '../../shared_components/close_button/close_button.vue';
5
+ import { popoverPlacements } from '../../../utils/constants';
5
6
 
6
7
  const popoverRefName = 'bPopover';
7
8
 
@@ -38,6 +39,11 @@ export default {
38
39
  required: false,
39
40
  default: false,
40
41
  },
42
+ placement: {
43
+ type: String,
44
+ required: false,
45
+ default: popoverPlacements.top,
46
+ },
41
47
  },
42
48
  computed: {
43
49
  customClass() {
@@ -66,6 +72,7 @@ export default {
66
72
  :custom-class="customClass"
67
73
  :triggers="triggers"
68
74
  :title="title"
75
+ :placement="placement"
69
76
  v-bind="$attrs"
70
77
  v-on="$listeners"
71
78
  >
@@ -2433,6 +2433,14 @@
2433
2433
  color: $purple-600 !important;
2434
2434
  }
2435
2435
 
2436
+ .gl-text-purple-700 {
2437
+ color: $purple-700;
2438
+ }
2439
+
2440
+ .gl-text-purple-700\! {
2441
+ color: $purple-700 !important;
2442
+ }
2443
+
2436
2444
  .gl-text-theme-indigo-200 {
2437
2445
  color: $theme-indigo-200;
2438
2446
  }
@@ -4495,6 +4503,30 @@
4495
4503
  }
4496
4504
  }
4497
4505
 
4506
+ .gl-md-w-half {
4507
+ @include gl-media-breakpoint-up(md) {
4508
+ width: 50%;
4509
+ }
4510
+ }
4511
+
4512
+ .gl-md-w-half\! {
4513
+ @include gl-media-breakpoint-up(md) {
4514
+ width: 50% !important;
4515
+ }
4516
+ }
4517
+
4518
+ .gl-lg-w-half {
4519
+ @include gl-media-breakpoint-up(lg) {
4520
+ width: 50%;
4521
+ }
4522
+ }
4523
+
4524
+ .gl-lg-w-half\! {
4525
+ @include gl-media-breakpoint-up(lg) {
4526
+ width: 50% !important;
4527
+ }
4528
+ }
4529
+
4498
4530
  .gl-md-w-auto {
4499
4531
  @include gl-media-breakpoint-up(md) {
4500
4532
  width: auto;
@@ -185,6 +185,10 @@
185
185
  color: $purple-600;
186
186
  }
187
187
 
188
+ @mixin gl-text-purple-700 {
189
+ color: $purple-700;
190
+ }
191
+
188
192
  @mixin gl-text-theme-indigo-200 {
189
193
  color: $theme-indigo-200;
190
194
  }
@@ -234,6 +234,18 @@
234
234
  }
235
235
  }
236
236
 
237
+ @mixin gl-md-w-half {
238
+ @include gl-media-breakpoint-up(md) {
239
+ width: 50%;
240
+ }
241
+ }
242
+
243
+ @mixin gl-lg-w-half {
244
+ @include gl-media-breakpoint-up(lg) {
245
+ width: 50%;
246
+ }
247
+ }
248
+
237
249
  @mixin gl-md-w-auto {
238
250
  @include gl-media-breakpoint-up(md) {
239
251
  width: auto;