@gitlab/ui 41.6.0 → 41.8.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/modal/modal.js +15 -1
- package/dist/components/base/tabs/tab/tab.js +10 -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 +1 -1
- package/src/components/base/modal/modal.md +5 -1
- package/src/components/base/modal/modal.vue +24 -2
- package/src/components/base/tabs/tab/tab.spec.js +19 -9
- package/src/components/base/tabs/tab/tab.vue +9 -0
- package/src/components/base/tabs/tabs/tabs.stories.js +14 -0
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/background.scss +10 -0
package/package.json
CHANGED
|
@@ -7,7 +7,11 @@ should serve a single purpose dedicated to completing the user’s task.
|
|
|
7
7
|
You can use the `v-model` directive to control the modal’s visibility. The `v-model`
|
|
8
8
|
directive interfaces with the `visible` property and the `@change` event.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Deprecation Warning
|
|
11
|
+
|
|
12
|
+
We are deprecating the `modal-ok` and `modal-cancel` slots. We are also changing the way the
|
|
13
|
+
`modal-footer` slot content is populated. This is in order to align this component with the design
|
|
14
|
+
system.
|
|
11
15
|
|
|
12
16
|
The `modal-footer` slot should only be populated via props: `action-primary`, `action-secondary` and
|
|
13
17
|
`action-cancel`. These props allow you to handle how a primary, secondary and cancel button will
|
|
@@ -86,6 +86,22 @@ export default {
|
|
|
86
86
|
default: '',
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
|
+
computed: {
|
|
90
|
+
shouldRenderModalOk() {
|
|
91
|
+
return Boolean(this.$slots['modal-ok']);
|
|
92
|
+
},
|
|
93
|
+
shouldRenderModalCancel() {
|
|
94
|
+
return Boolean(this.$slots['modal-cancel']);
|
|
95
|
+
},
|
|
96
|
+
shouldRenderModalFooter() {
|
|
97
|
+
return Boolean(
|
|
98
|
+
this.actionCancel ||
|
|
99
|
+
this.actionSecondary ||
|
|
100
|
+
this.actionPrimary ||
|
|
101
|
+
this.$slots['modal-footer']
|
|
102
|
+
);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
89
105
|
mounted() {
|
|
90
106
|
if (!this.ariaLabel && !this.title) {
|
|
91
107
|
logWarning(
|
|
@@ -152,7 +168,7 @@ export default {
|
|
|
152
168
|
</script>
|
|
153
169
|
|
|
154
170
|
<template>
|
|
155
|
-
<!--
|
|
171
|
+
<!--
|
|
156
172
|
Emitted when the modal visibility changes
|
|
157
173
|
@event change
|
|
158
174
|
-->
|
|
@@ -186,8 +202,14 @@ export default {
|
|
|
186
202
|
<!-- @slot Content of Modal header close button. If modal-header slot is used, this slot will not be shown. -->
|
|
187
203
|
<close-button ref="close-button" :label="dismissLabel" @click="close" />
|
|
188
204
|
</template>
|
|
205
|
+
<template v-if="shouldRenderModalOk" #modal-ok>
|
|
206
|
+
<slot name="modal-ok"></slot>
|
|
207
|
+
</template>
|
|
208
|
+
<template v-if="shouldRenderModalCancel" #modal-cancel>
|
|
209
|
+
<slot name="modal-cancel"></slot>
|
|
210
|
+
</template>
|
|
189
211
|
<!-- @slot Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary. -->
|
|
190
|
-
<template #modal-footer>
|
|
212
|
+
<template v-if="shouldRenderModalFooter" #modal-footer>
|
|
191
213
|
<slot name="modal-footer">
|
|
192
214
|
<!--
|
|
193
215
|
Emitted when clicked on modal-action-cancel
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { BTab } from 'bootstrap-vue';
|
|
2
3
|
import { DEFAULT_TAB_TITLE_LINK_CLASS } from '../constants';
|
|
3
4
|
import GlTab from './tab.vue';
|
|
4
5
|
|
|
@@ -6,9 +7,7 @@ describe('Tab component', () => {
|
|
|
6
7
|
let wrapper;
|
|
7
8
|
|
|
8
9
|
const createComponent = (options) => {
|
|
9
|
-
wrapper = shallowMount(GlTab, {
|
|
10
|
-
...options,
|
|
11
|
-
});
|
|
10
|
+
wrapper = shallowMount(GlTab, { ...options });
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
it.each`
|
|
@@ -22,14 +21,25 @@ describe('Tab component', () => {
|
|
|
22
21
|
'computed title link class is $expectedProp when titleLinkClass is $titleLinkClass',
|
|
23
22
|
({ titleLinkClass, expectedProp }) => {
|
|
24
23
|
createComponent({
|
|
25
|
-
propsData: {
|
|
26
|
-
titleLinkClass,
|
|
27
|
-
},
|
|
24
|
+
propsData: { titleLinkClass },
|
|
28
25
|
});
|
|
29
26
|
|
|
30
|
-
expect(wrapper.
|
|
31
|
-
`<b-tab-stub tag="div" title="" titlelinkclass="${expectedProp}"></b-tab-stub>`
|
|
32
|
-
);
|
|
27
|
+
expect(wrapper.findComponent(BTab).props('titleLinkClass')).toEqual(expectedProp);
|
|
33
28
|
}
|
|
34
29
|
);
|
|
30
|
+
|
|
31
|
+
it('passes title-link-attributes to b-tab when href is explicitly passed', () => {
|
|
32
|
+
const titleLinkAttributes = 'href-example';
|
|
33
|
+
const expectedProp = { href: titleLinkAttributes };
|
|
34
|
+
createComponent({
|
|
35
|
+
propsData: { href: titleLinkAttributes },
|
|
36
|
+
});
|
|
37
|
+
expect(wrapper.findComponent(BTab).props('titleLinkAttributes')).toEqual(expectedProp);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('passes # as href to b-tab when href is not passed', () => {
|
|
41
|
+
const expectedProp = { href: '#' };
|
|
42
|
+
createComponent();
|
|
43
|
+
expect(wrapper.findComponent(BTab).props('titleLinkAttributes')).toEqual(expectedProp);
|
|
44
|
+
});
|
|
35
45
|
});
|
|
@@ -24,6 +24,14 @@ export default {
|
|
|
24
24
|
required: false,
|
|
25
25
|
default: null,
|
|
26
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Provide an `href` for the tab, for example to associate the tab with the tab panel's ID
|
|
29
|
+
*/
|
|
30
|
+
href: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: false,
|
|
33
|
+
default: '#',
|
|
34
|
+
},
|
|
27
35
|
},
|
|
28
36
|
computed: {
|
|
29
37
|
linkClass() {
|
|
@@ -46,6 +54,7 @@ export default {
|
|
|
46
54
|
:title-link-class="linkClass"
|
|
47
55
|
:query-param-value="queryParamValue"
|
|
48
56
|
v-bind="$attrs"
|
|
57
|
+
:title-link-attributes="{ href }"
|
|
49
58
|
v-on="$listeners"
|
|
50
59
|
>
|
|
51
60
|
<template v-for="slot in Object.keys($slots)" #[slot]>
|
|
@@ -226,6 +226,20 @@ WithScrollAndGrowing.parameters = {
|
|
|
226
226
|
storyshots: { disable: true },
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
+
export const WithHref = (_args, { argTypes }) => ({
|
|
230
|
+
props: Object.keys(argTypes),
|
|
231
|
+
components: { ...components, GlBadge },
|
|
232
|
+
template: wrap(`
|
|
233
|
+
<gl-tab href="#tab-1" title="Tab 1">
|
|
234
|
+
<h2 id="tab-1">Tab panel 1</h2>
|
|
235
|
+
<p>Some paragraph text<p>
|
|
236
|
+
</gl-tab>
|
|
237
|
+
<gl-tab href="#tab-2" title="Tab 2">
|
|
238
|
+
<h2 id="tab-2">Tab panel 2</h2>
|
|
239
|
+
<p>Some paragraph text<p>
|
|
240
|
+
</gl-tab>`),
|
|
241
|
+
});
|
|
242
|
+
|
|
229
243
|
export default {
|
|
230
244
|
title: 'base/tabs',
|
|
231
245
|
component: GlTabs,
|
package/src/scss/utilities.scss
CHANGED
|
@@ -881,6 +881,14 @@
|
|
|
881
881
|
.gl-bg-chevron-down\! {
|
|
882
882
|
background-image: url($gl-icon-chevron-down) !important
|
|
883
883
|
}
|
|
884
|
+
|
|
885
|
+
.gl-backdrop-filter-blur-1 {
|
|
886
|
+
backdrop-filter: blur($gl-spacing-scale-1)
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
.gl-backdrop-filter-blur-1\! {
|
|
890
|
+
backdrop-filter: blur($gl-spacing-scale-1) !important
|
|
891
|
+
}
|
|
884
892
|
.gl-border {
|
|
885
893
|
border: solid $gl-border-size-1 $border-color;
|
|
886
894
|
}
|
|
@@ -397,3 +397,13 @@
|
|
|
397
397
|
@mixin gl-bg-chevron-down {
|
|
398
398
|
background-image: url($gl-icon-chevron-down);
|
|
399
399
|
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Backdrop filter utilities
|
|
403
|
+
*
|
|
404
|
+
* naming convention: gl-filter-{filter-type}-{filter-intensity}
|
|
405
|
+
*/
|
|
406
|
+
|
|
407
|
+
@mixin gl-backdrop-filter-blur-1 {
|
|
408
|
+
backdrop-filter: blur($gl-spacing-scale-1);
|
|
409
|
+
}
|