@gitlab/ui 42.7.0 → 42.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/CHANGELOG.md +26 -0
- package/dist/components/base/accordion/accordion_item.js +10 -1
- package/dist/components/base/form/form_checkbox/form_checkbox.js +9 -1
- package/dist/directives/hover_load/hover_load.js +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +2 -2
- package/src/components/base/accordion/accordion_item.spec.js +10 -0
- package/src/components/base/accordion/accordion_item.vue +9 -1
- package/src/components/base/form/form_checkbox/form_checkbox.vue +15 -1
- package/src/directives/hover_load/hover_load.js +1 -1
- package/src/directives/hover_load/hover_load.spec.js +19 -20
- package/src/scss/utilities.scss +18 -8
- package/src/scss/utility-mixins/grid.scss +0 -4
- package/src/scss/utility-mixins/spacing.scss +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "42.
|
|
3
|
+
"version": "42.10.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"bootstrap": "4.5.3",
|
|
106
106
|
"cypress": "^6.6.0",
|
|
107
107
|
"emoji-regex": "^10.0.0",
|
|
108
|
-
"eslint": "8.
|
|
108
|
+
"eslint": "8.18.0",
|
|
109
109
|
"eslint-import-resolver-jest": "3.0.2",
|
|
110
110
|
"eslint-plugin-cypress": "2.12.1",
|
|
111
111
|
"eslint-plugin-storybook": "0.5.12",
|
|
@@ -32,6 +32,7 @@ describe('GlAccordionItem', () => {
|
|
|
32
32
|
|
|
33
33
|
const findButton = () => wrapper.findComponent(GlButton);
|
|
34
34
|
const findCollapse = () => wrapper.findComponent(BCollapse);
|
|
35
|
+
const findHeader = () => wrapper.find('.gl-accordion-item-header');
|
|
35
36
|
|
|
36
37
|
it('renders button text', () => {
|
|
37
38
|
createComponent();
|
|
@@ -64,6 +65,15 @@ describe('GlAccordionItem', () => {
|
|
|
64
65
|
expect(wrapper.find('h4.gl-accordion-item-header').exists()).toBeTruthy();
|
|
65
66
|
});
|
|
66
67
|
|
|
68
|
+
it.each(['custom-header-class', ['custom-header-class'], { 'custom-header-class': true }])(
|
|
69
|
+
'applies custom classes to the header',
|
|
70
|
+
(customClassProp) => {
|
|
71
|
+
createComponent({ headerClass: customClassProp }, { defaultHeaderLevel: 3 });
|
|
72
|
+
|
|
73
|
+
expect(findHeader().classes()).toContain('custom-header-class');
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
|
|
67
77
|
it('renders slot text', () => {
|
|
68
78
|
createComponent();
|
|
69
79
|
|
|
@@ -54,6 +54,14 @@ When set, it will ensure the accordion item is initially visible
|
|
|
54
54
|
return value > 0 && value <= 6;
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
|
+
/**
|
|
58
|
+
* Additional CSS class(es) to be applied to the header.
|
|
59
|
+
*/
|
|
60
|
+
headerClass: {
|
|
61
|
+
type: [String, Object, Array],
|
|
62
|
+
required: false,
|
|
63
|
+
default: '',
|
|
64
|
+
},
|
|
57
65
|
},
|
|
58
66
|
data() {
|
|
59
67
|
return {
|
|
@@ -89,7 +97,7 @@ When set, it will ensure the accordion item is initially visible
|
|
|
89
97
|
|
|
90
98
|
<template>
|
|
91
99
|
<div class="gl-accordion-item">
|
|
92
|
-
<component :is="headerComponent" class="gl-accordion-item-header">
|
|
100
|
+
<component :is="headerComponent" class="gl-accordion-item-header" :class="headerClass">
|
|
93
101
|
<gl-button
|
|
94
102
|
v-gl-collapse-toggle="accordionItemId"
|
|
95
103
|
variant="link"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BFormCheckbox } from 'bootstrap-vue';
|
|
3
|
+
import { uniqueId } from 'lodash';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
name: 'GlFormCheckbox',
|
|
@@ -11,6 +12,13 @@ export default {
|
|
|
11
12
|
prop: 'checked',
|
|
12
13
|
event: 'input',
|
|
13
14
|
},
|
|
15
|
+
props: {
|
|
16
|
+
id: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false,
|
|
19
|
+
default: () => uniqueId(),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
14
22
|
methods: {
|
|
15
23
|
change($event) {
|
|
16
24
|
/**
|
|
@@ -33,7 +41,13 @@ export default {
|
|
|
33
41
|
</script>
|
|
34
42
|
|
|
35
43
|
<template>
|
|
36
|
-
<b-form-checkbox
|
|
44
|
+
<b-form-checkbox
|
|
45
|
+
v-bind="$attrs"
|
|
46
|
+
:id="id"
|
|
47
|
+
class="gl-form-checkbox"
|
|
48
|
+
@change="change"
|
|
49
|
+
@input="input"
|
|
50
|
+
>
|
|
37
51
|
<!-- @slot The checkbox content to display. -->
|
|
38
52
|
<slot></slot>
|
|
39
53
|
<p v-if="Boolean($scopedSlots.help)" class="help-text">
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { HoverLoadDirective as hoverLoad } from './hover_load';
|
|
2
|
+
import { HoverLoadDirective as hoverLoad, DELAY_ON_HOVER } from './hover_load';
|
|
3
|
+
|
|
4
|
+
jest.useFakeTimers();
|
|
3
5
|
|
|
4
6
|
describe('hover load directive', () => {
|
|
5
7
|
let wrapper;
|
|
@@ -26,28 +28,25 @@ describe('hover load directive', () => {
|
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
it.each`
|
|
29
|
-
hoverDuration |
|
|
30
|
-
${
|
|
31
|
-
${
|
|
32
|
-
`(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
hoverDuration | action | expectedCalls
|
|
32
|
+
${DELAY_ON_HOVER} | ${'triggers'} | ${1}
|
|
33
|
+
${DELAY_ON_HOVER - 1} | ${'does not trigger'} | ${0}
|
|
34
|
+
`('$action the callback after $hoverDuration ms', ({ hoverDuration, expectedCalls }) => {
|
|
35
|
+
const mockHandleLoad = jest.fn();
|
|
36
|
+
createComponent(mockHandleLoad);
|
|
37
|
+
|
|
38
|
+
findTarget().trigger('mouseover');
|
|
39
|
+
|
|
40
|
+
jest.advanceTimersByTime(hoverDuration);
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
await new Promise((resolve) => {
|
|
40
|
-
setTimeout(resolve, hoverDuration);
|
|
41
|
-
});
|
|
42
|
-
findTarget().trigger('mouseout');
|
|
42
|
+
findTarget().trigger('mouseout');
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
44
|
+
expect(mockHandleLoad).toHaveBeenCalledTimes(expectedCalls);
|
|
45
|
+
|
|
46
|
+
if (expectedCalls) {
|
|
47
|
+
expect(mockHandleLoad).toHaveBeenCalledWith(findTarget().element);
|
|
49
48
|
}
|
|
50
|
-
);
|
|
49
|
+
});
|
|
51
50
|
|
|
52
51
|
it('cleans up the mouseover event when component is destroyed', () => {
|
|
53
52
|
createComponent(jest.fn());
|
package/src/scss/utilities.scss
CHANGED
|
@@ -3599,14 +3599,6 @@
|
|
|
3599
3599
|
}
|
|
3600
3600
|
}
|
|
3601
3601
|
|
|
3602
|
-
.gl-grid-gap-6 {
|
|
3603
|
-
gap: $gl-spacing-scale-6;
|
|
3604
|
-
}
|
|
3605
|
-
|
|
3606
|
-
.gl-grid-gap-6\! {
|
|
3607
|
-
gap: $gl-spacing-scale-6 !important;
|
|
3608
|
-
}
|
|
3609
|
-
|
|
3610
3602
|
.gl-list-style-none {
|
|
3611
3603
|
list-style-type: none
|
|
3612
3604
|
}
|
|
@@ -6138,6 +6130,24 @@
|
|
|
6138
6130
|
margin-left: #{$gl-spacing-scale-5} !important;
|
|
6139
6131
|
}
|
|
6140
6132
|
}
|
|
6133
|
+
.gl-gap-3 {
|
|
6134
|
+
gap: $gl-spacing-scale-3;
|
|
6135
|
+
}
|
|
6136
|
+
.gl-gap-3\! {
|
|
6137
|
+
gap: $gl-spacing-scale-3 !important;
|
|
6138
|
+
}
|
|
6139
|
+
.gl-gap-6 {
|
|
6140
|
+
gap: $gl-spacing-scale-6;
|
|
6141
|
+
}
|
|
6142
|
+
.gl-gap-6\! {
|
|
6143
|
+
gap: $gl-spacing-scale-6 !important;
|
|
6144
|
+
}
|
|
6145
|
+
.gl-grid-gap-6 {
|
|
6146
|
+
gap: $gl-spacing-scale-6;
|
|
6147
|
+
}
|
|
6148
|
+
.gl-grid-gap-6\! {
|
|
6149
|
+
gap: $gl-spacing-scale-6 !important;
|
|
6150
|
+
}
|
|
6141
6151
|
.gl-xs-mb-3 {
|
|
6142
6152
|
@include gl-media-breakpoint-down(sm) {
|
|
6143
6153
|
margin-bottom: $gl-spacing-scale-3;
|
|
@@ -785,6 +785,19 @@
|
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
787
|
|
|
788
|
+
@mixin gl-gap-3 {
|
|
789
|
+
gap: $gl-spacing-scale-3;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
@mixin gl-gap-6 {
|
|
793
|
+
gap: $gl-spacing-scale-6;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/* Deprecated */
|
|
797
|
+
@mixin gl-grid-gap-6 {
|
|
798
|
+
@include gl-gap-6;
|
|
799
|
+
}
|
|
800
|
+
|
|
788
801
|
/**
|
|
789
802
|
* Responsive margin utilities.
|
|
790
803
|
*
|