@gitlab/ui 42.4.1 → 42.5.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 +7 -0
- package/dist/components/base/drawer/drawer.js +5 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/components/base/drawer/drawer.scss +20 -0
- package/src/components/base/drawer/drawer.spec.js +1 -0
- package/src/components/base/drawer/drawer.stories.js +55 -13
- package/src/components/base/drawer/drawer.vue +10 -0
package/package.json
CHANGED
|
@@ -10,6 +10,8 @@ $gl-sidebar-width: 290px;
|
|
|
10
10
|
@include gl-shadow-drawer;
|
|
11
11
|
@include gl-font-base;
|
|
12
12
|
@include gl-line-height-normal;
|
|
13
|
+
@include gl-display-flex;
|
|
14
|
+
@include gl-flex-direction-column;
|
|
13
15
|
|
|
14
16
|
.gl-drawer-header-sticky {
|
|
15
17
|
@include gl-bg-white;
|
|
@@ -51,6 +53,20 @@ $gl-sidebar-width: 290px;
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
.gl-drawer-footer {
|
|
57
|
+
@include gl-border-t-solid;
|
|
58
|
+
@include gl-border-t-gray-100;
|
|
59
|
+
@include gl-border-t-1;
|
|
60
|
+
@include gl-px-6;
|
|
61
|
+
@include gl-py-5;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.gl-drawer-footer-sticky {
|
|
65
|
+
@include gl-bg-white;
|
|
66
|
+
@include gl-bottom-0;
|
|
67
|
+
@include gl-sticky;
|
|
68
|
+
}
|
|
69
|
+
|
|
54
70
|
.gl-drawer-header {
|
|
55
71
|
@include gl-border-b-solid;
|
|
56
72
|
@include gl-border-b-gray-100;
|
|
@@ -74,6 +90,10 @@ $gl-sidebar-width: 290px;
|
|
|
74
90
|
@include gl-border-none;
|
|
75
91
|
}
|
|
76
92
|
|
|
93
|
+
.gl-drawer-body {
|
|
94
|
+
@include gl-flex-grow-1;
|
|
95
|
+
}
|
|
96
|
+
|
|
77
97
|
.gl-drawer-body > * {
|
|
78
98
|
@include gl-border-b-solid;
|
|
79
99
|
@include gl-border-b-gray-100;
|
|
@@ -90,6 +90,7 @@ describe('drawer component', () => {
|
|
|
90
90
|
${'title'} | ${'.gl-drawer-title'}
|
|
91
91
|
${'header'} | ${'.gl-drawer-header'}
|
|
92
92
|
${'default'} | ${'.gl-drawer-body'}
|
|
93
|
+
${'footer'} | ${'.gl-drawer-footer'}
|
|
93
94
|
`('renders nodes when added to the $slot slot', ({ slot, parentSelector }) => {
|
|
94
95
|
mountWithOpts({
|
|
95
96
|
slots: {
|
|
@@ -4,7 +4,19 @@ import readme from './drawer.md';
|
|
|
4
4
|
|
|
5
5
|
const components = { GlDrawer, GlButton };
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const generateDrawerContent = (items) =>
|
|
8
|
+
items
|
|
9
|
+
.map(
|
|
10
|
+
(str) => `
|
|
11
|
+
<div>
|
|
12
|
+
<label class="gl-font-weight-bold">${str}</label>
|
|
13
|
+
<div>None</div>
|
|
14
|
+
</div>
|
|
15
|
+
`
|
|
16
|
+
)
|
|
17
|
+
.join('');
|
|
18
|
+
|
|
19
|
+
const drawerContent = generateDrawerContent([
|
|
8
20
|
'One',
|
|
9
21
|
'Two',
|
|
10
22
|
'Three',
|
|
@@ -19,16 +31,9 @@ const drawerContent = [
|
|
|
19
31
|
'Twelve',
|
|
20
32
|
'Thirteen',
|
|
21
33
|
'Fourteen',
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<div>
|
|
26
|
-
<label class="gl-font-weight-bold">${str}</label>
|
|
27
|
-
<div>None</div>
|
|
28
|
-
</div>
|
|
29
|
-
`
|
|
30
|
-
)
|
|
31
|
-
.join('');
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const drawerContentShortList = generateDrawerContent(['One', 'Two', 'Three']);
|
|
32
37
|
|
|
33
38
|
const createSidebarTemplate = (content) => `
|
|
34
39
|
<gl-drawer
|
|
@@ -106,6 +111,40 @@ export const WithActions = (_args, { viewMode }) => ({
|
|
|
106
111
|
});
|
|
107
112
|
WithActions.args = generateProps();
|
|
108
113
|
|
|
114
|
+
export const WithStickyFooterShortContent = (_args, { viewMode }) => ({
|
|
115
|
+
...storyOptions(viewMode),
|
|
116
|
+
template: `
|
|
117
|
+
<div>
|
|
118
|
+
<gl-button @click="toggle">Toggle Drawer</gl-button>
|
|
119
|
+
${createSidebarTemplate(`
|
|
120
|
+
<template #title>List Settings</template>
|
|
121
|
+
${drawerContentShortList}
|
|
122
|
+
<template #footer>
|
|
123
|
+
Drawer footer
|
|
124
|
+
</template>
|
|
125
|
+
`)}
|
|
126
|
+
</div>`,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
WithStickyFooterShortContent.args = generateProps();
|
|
130
|
+
|
|
131
|
+
export const WithStickyFooter = (_args, { viewMode }) => ({
|
|
132
|
+
...storyOptions(viewMode),
|
|
133
|
+
template: `
|
|
134
|
+
<div>
|
|
135
|
+
<gl-button @click="toggle">Toggle Drawer</gl-button>
|
|
136
|
+
${createSidebarTemplate(`
|
|
137
|
+
<template #title>List Settings</template>
|
|
138
|
+
${drawerContent}
|
|
139
|
+
<template #footer>
|
|
140
|
+
Drawer footer
|
|
141
|
+
</template>
|
|
142
|
+
`)}
|
|
143
|
+
</div>`,
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
WithStickyFooter.args = generateProps();
|
|
147
|
+
|
|
109
148
|
export const SidebarVariant = (_args, { viewMode }) => ({
|
|
110
149
|
...storyOptions(viewMode),
|
|
111
150
|
template: `
|
|
@@ -128,7 +167,7 @@ SidebarVariant.args = generateProps({
|
|
|
128
167
|
variant: drawerVariants.sidebar,
|
|
129
168
|
});
|
|
130
169
|
|
|
131
|
-
export const
|
|
170
|
+
export const StickyHeaderFooter = (_args, { viewMode }) => ({
|
|
132
171
|
...storyOptions(viewMode),
|
|
133
172
|
template: `
|
|
134
173
|
<div>
|
|
@@ -136,10 +175,13 @@ export const StickyHeader = (_args, { viewMode }) => ({
|
|
|
136
175
|
${createSidebarTemplate(`
|
|
137
176
|
<template #title>List Settings</template>
|
|
138
177
|
${drawerContent}
|
|
178
|
+
<template #footer>
|
|
179
|
+
Drawer footer
|
|
180
|
+
</template>
|
|
139
181
|
`)}
|
|
140
182
|
</div>`,
|
|
141
183
|
});
|
|
142
|
-
|
|
184
|
+
StickyHeaderFooter.args = generateProps({
|
|
143
185
|
headerSticky: true,
|
|
144
186
|
});
|
|
145
187
|
|
|
@@ -56,6 +56,9 @@ export default {
|
|
|
56
56
|
zIndex: this.headerSticky ? maxZIndex : null,
|
|
57
57
|
};
|
|
58
58
|
},
|
|
59
|
+
shouldRenderFooter() {
|
|
60
|
+
return Boolean(this.$slots.footer);
|
|
61
|
+
},
|
|
59
62
|
variantClass() {
|
|
60
63
|
return `gl-drawer-${this.variant}`;
|
|
61
64
|
},
|
|
@@ -110,6 +113,13 @@ export default {
|
|
|
110
113
|
<div class="gl-drawer-body">
|
|
111
114
|
<slot></slot>
|
|
112
115
|
</div>
|
|
116
|
+
<div
|
|
117
|
+
v-if="shouldRenderFooter"
|
|
118
|
+
class="gl-drawer-footer gl-drawer-footer-sticky"
|
|
119
|
+
:style="{ zIndex }"
|
|
120
|
+
>
|
|
121
|
+
<slot name="footer"></slot>
|
|
122
|
+
</div>
|
|
113
123
|
</aside>
|
|
114
124
|
</transition>
|
|
115
125
|
</template>
|