@gitlab/ui 41.0.0 → 41.3.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 +21 -0
- package/dist/components/base/drawer/drawer.js +12 -1
- package/dist/index.css +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/dist/utils/charts/theme.js +1 -1
- package/package.json +3 -3
- package/src/components/base/drawer/drawer.scss +13 -0
- package/src/components/base/drawer/drawer.spec.js +10 -0
- package/src/components/base/drawer/drawer.stories.js +72 -36
- package/src/components/base/drawer/drawer.vue +15 -1
- package/src/scss/utilities.scss +12 -0
- package/src/scss/utility-mixins/display.scss +6 -0
- package/src/utils/charts/theme.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.3.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@popperjs/core": "^2.11.2",
|
|
59
59
|
"bootstrap-vue": "2.20.1",
|
|
60
60
|
"dompurify": "^2.3.8",
|
|
61
|
-
"echarts": "^5.2
|
|
61
|
+
"echarts": "^5.3.2",
|
|
62
62
|
"iframe-resizer": "^4.3.2",
|
|
63
63
|
"lodash": "^4.17.20",
|
|
64
64
|
"portal-vue": "^2.1.6",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@babel/preset-env": "^7.10.2",
|
|
84
84
|
"@gitlab/eslint-plugin": "12.3.0",
|
|
85
85
|
"@gitlab/stylelint-config": "4.0.0",
|
|
86
|
-
"@gitlab/svgs": "2.
|
|
86
|
+
"@gitlab/svgs": "2.15.0",
|
|
87
87
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
88
88
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
89
89
|
"@rollup/plugin-replace": "^2.3.2",
|
|
@@ -11,6 +11,12 @@ $gl-sidebar-width: 290px;
|
|
|
11
11
|
@include gl-font-base;
|
|
12
12
|
@include gl-line-height-normal;
|
|
13
13
|
|
|
14
|
+
.gl-drawer-header-sticky {
|
|
15
|
+
@include gl-bg-white;
|
|
16
|
+
@include gl-top-0;
|
|
17
|
+
@include gl-sticky;
|
|
18
|
+
}
|
|
19
|
+
|
|
14
20
|
@include media-breakpoint-down(sm) {
|
|
15
21
|
@include gl-w-full;
|
|
16
22
|
}
|
|
@@ -34,8 +40,15 @@ $gl-sidebar-width: 290px;
|
|
|
34
40
|
.gl-drawer-header,
|
|
35
41
|
.gl-drawer-body > * {
|
|
36
42
|
@include gl-py-5;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.gl-drawer-body > * {
|
|
37
46
|
@include gl-mx-5;
|
|
38
47
|
}
|
|
48
|
+
|
|
49
|
+
.gl-drawer-header {
|
|
50
|
+
@include gl-px-5;
|
|
51
|
+
}
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
.gl-drawer-header {
|
|
@@ -27,6 +27,16 @@ describe('drawer component', () => {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
+
describe('when sticky header is true', () => {
|
|
31
|
+
it('renders drawer header with sticky position', () => {
|
|
32
|
+
mountWithOpts({ props: { open: true, headerSticky: true } });
|
|
33
|
+
const header = wrapper.find('.gl-drawer-header');
|
|
34
|
+
|
|
35
|
+
expect(header.classes()).toContain('gl-drawer-header-sticky');
|
|
36
|
+
expect(header.attributes('style')).toBe('z-index: 10;');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
30
40
|
describe('when open is false', () => {
|
|
31
41
|
it('cannot find aside html element', () => {
|
|
32
42
|
mountWithOpts({ props: { open: false } });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GlDrawer, GlButton } from '../../../index';
|
|
2
|
+
import { drawerVariants } from '../../../utils/constants';
|
|
2
3
|
import readme from './drawer.md';
|
|
3
4
|
|
|
4
5
|
const components = { GlDrawer, GlButton };
|
|
@@ -14,6 +15,10 @@ const drawerContent = [
|
|
|
14
15
|
'Eight',
|
|
15
16
|
'Nine',
|
|
16
17
|
'Ten',
|
|
18
|
+
'Eleven',
|
|
19
|
+
'Twelve',
|
|
20
|
+
'Thirteen',
|
|
21
|
+
'Fourteen',
|
|
17
22
|
]
|
|
18
23
|
.map(
|
|
19
24
|
(str) => `
|
|
@@ -25,7 +30,32 @@ const drawerContent = [
|
|
|
25
30
|
)
|
|
26
31
|
.join('');
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
const createSidebarTemplate = (content) => `
|
|
34
|
+
<gl-drawer
|
|
35
|
+
:open="open"
|
|
36
|
+
:header-height="headerHeight"
|
|
37
|
+
:header-sticky="headerSticky"
|
|
38
|
+
:z-index="zIndex"
|
|
39
|
+
:variant="variant"
|
|
40
|
+
@close="close">${content}</gl-drawer>
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const defaultValue = (prop) => GlDrawer.props[prop].default;
|
|
44
|
+
|
|
45
|
+
const generateProps = ({
|
|
46
|
+
headerHeight = defaultValue('headerHeight'),
|
|
47
|
+
headerSticky = defaultValue('headerSticky'),
|
|
48
|
+
zIndex = defaultValue('zIndex'),
|
|
49
|
+
variant = defaultValue('variant'),
|
|
50
|
+
} = {}) => ({
|
|
51
|
+
headerHeight,
|
|
52
|
+
headerSticky,
|
|
53
|
+
zIndex,
|
|
54
|
+
variant,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const storyOptions = (viewMode) => ({
|
|
58
|
+
props: Object.keys(generateProps()),
|
|
29
59
|
components,
|
|
30
60
|
methods: {
|
|
31
61
|
toggle() {
|
|
@@ -40,35 +70,27 @@ export const Default = (_args, { viewMode }) => ({
|
|
|
40
70
|
open: viewMode !== 'docs',
|
|
41
71
|
};
|
|
42
72
|
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const Default = (_args, { viewMode }) => ({
|
|
76
|
+
...storyOptions(viewMode),
|
|
43
77
|
template: `
|
|
44
78
|
<div>
|
|
45
79
|
<gl-button @click="toggle">Toggle Drawer</gl-button>
|
|
46
|
-
|
|
80
|
+
${createSidebarTemplate(`
|
|
47
81
|
<template #title>List Settings</template>
|
|
48
82
|
${drawerContent}
|
|
49
|
-
|
|
83
|
+
`)}
|
|
50
84
|
</div>`,
|
|
51
85
|
});
|
|
86
|
+
Default.args = generateProps();
|
|
52
87
|
|
|
53
88
|
export const WithActions = (_args, { viewMode }) => ({
|
|
54
|
-
|
|
55
|
-
methods: {
|
|
56
|
-
toggle() {
|
|
57
|
-
this.open = !this.open;
|
|
58
|
-
},
|
|
59
|
-
close() {
|
|
60
|
-
this.open = false;
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
data() {
|
|
64
|
-
return {
|
|
65
|
-
open: viewMode !== 'docs',
|
|
66
|
-
};
|
|
67
|
-
},
|
|
89
|
+
...storyOptions(viewMode),
|
|
68
90
|
template: `
|
|
69
91
|
<div>
|
|
70
92
|
<gl-button @click="toggle">Toggle Drawer</gl-button>
|
|
71
|
-
|
|
93
|
+
${createSidebarTemplate(`
|
|
72
94
|
<template #title>
|
|
73
95
|
<h3>custom-network-policy</h3>
|
|
74
96
|
</template>
|
|
@@ -79,29 +101,17 @@ export const WithActions = (_args, { viewMode }) => ({
|
|
|
79
101
|
</div>
|
|
80
102
|
</template>
|
|
81
103
|
${drawerContent}
|
|
82
|
-
|
|
104
|
+
`)}
|
|
83
105
|
</div>`,
|
|
84
106
|
});
|
|
107
|
+
WithActions.args = generateProps();
|
|
85
108
|
|
|
86
109
|
export const SidebarVariant = (_args, { viewMode }) => ({
|
|
87
|
-
|
|
88
|
-
methods: {
|
|
89
|
-
toggle() {
|
|
90
|
-
this.open = !this.open;
|
|
91
|
-
},
|
|
92
|
-
close() {
|
|
93
|
-
this.open = false;
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
data() {
|
|
97
|
-
return {
|
|
98
|
-
open: viewMode !== 'docs',
|
|
99
|
-
};
|
|
100
|
-
},
|
|
110
|
+
...storyOptions(viewMode),
|
|
101
111
|
template: `
|
|
102
112
|
<div>
|
|
103
113
|
<gl-button @click="toggle">Toggle Drawer</gl-button>
|
|
104
|
-
|
|
114
|
+
${createSidebarTemplate(`
|
|
105
115
|
<template #title>
|
|
106
116
|
<h3>Sidebar</h3>
|
|
107
117
|
</template>
|
|
@@ -111,16 +121,42 @@ export const SidebarVariant = (_args, { viewMode }) => ({
|
|
|
111
121
|
</div>
|
|
112
122
|
</template>
|
|
113
123
|
${drawerContent}
|
|
114
|
-
|
|
124
|
+
`)}
|
|
115
125
|
</div>`,
|
|
116
126
|
});
|
|
127
|
+
SidebarVariant.args = generateProps({
|
|
128
|
+
variant: drawerVariants.sidebar,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const StickyHeader = (_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
|
+
`)}
|
|
140
|
+
</div>`,
|
|
141
|
+
});
|
|
142
|
+
StickyHeader.args = generateProps({
|
|
143
|
+
headerSticky: true,
|
|
144
|
+
});
|
|
117
145
|
|
|
118
146
|
export default {
|
|
119
147
|
title: 'base/drawer',
|
|
120
148
|
component: GlDrawer,
|
|
149
|
+
argTypes: {
|
|
150
|
+
open: {
|
|
151
|
+
control: false,
|
|
152
|
+
},
|
|
153
|
+
variant: {
|
|
154
|
+
options: Object.keys(drawerVariants),
|
|
155
|
+
control: 'select',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
121
158
|
parameters: {
|
|
122
159
|
knobs: { disabled: true },
|
|
123
|
-
controls: { disable: true },
|
|
124
160
|
docs: {
|
|
125
161
|
description: {
|
|
126
162
|
component: readme,
|
|
@@ -18,6 +18,11 @@ export default {
|
|
|
18
18
|
required: false,
|
|
19
19
|
default: '',
|
|
20
20
|
},
|
|
21
|
+
headerSticky: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
required: false,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
21
26
|
zIndex: {
|
|
22
27
|
type: Number,
|
|
23
28
|
required: false,
|
|
@@ -46,6 +51,11 @@ export default {
|
|
|
46
51
|
|
|
47
52
|
return styles;
|
|
48
53
|
},
|
|
54
|
+
drawerHeaderStyles() {
|
|
55
|
+
return {
|
|
56
|
+
zIndex: this.headerSticky ? maxZIndex : null,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
49
59
|
variantClass() {
|
|
50
60
|
return `gl-drawer-${this.variant}`;
|
|
51
61
|
},
|
|
@@ -79,7 +89,11 @@ export default {
|
|
|
79
89
|
<template>
|
|
80
90
|
<transition name="gl-drawer">
|
|
81
91
|
<aside v-if="open" :style="drawerStyles" class="gl-drawer" :class="variantClass">
|
|
82
|
-
<div
|
|
92
|
+
<div
|
|
93
|
+
class="gl-drawer-header"
|
|
94
|
+
:style="drawerHeaderStyles"
|
|
95
|
+
:class="{ 'gl-drawer-header-sticky': headerSticky }"
|
|
96
|
+
>
|
|
83
97
|
<span class="gl-drawer-title">
|
|
84
98
|
<slot name="title"></slot>
|
|
85
99
|
<gl-button
|
package/src/scss/utilities.scss
CHANGED
|
@@ -2997,6 +2997,18 @@
|
|
|
2997
2997
|
display: grid !important;
|
|
2998
2998
|
}
|
|
2999
2999
|
|
|
3000
|
+
.gl-md-display-table-cell {
|
|
3001
|
+
@include gl-media-breakpoint-up(md) {
|
|
3002
|
+
display: table-cell;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
.gl-md-display-table-cell\! {
|
|
3007
|
+
@include gl-media-breakpoint-up(md) {
|
|
3008
|
+
display: table-cell !important;
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3000
3012
|
.gl-lg-display-table-cell {
|
|
3001
3013
|
@include gl-media-breakpoint-up(lg) {
|
|
3002
3014
|
display: table-cell;
|
|
@@ -187,6 +187,12 @@
|
|
|
187
187
|
display: grid;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
@mixin gl-md-display-table-cell {
|
|
191
|
+
@include gl-media-breakpoint-up(md) {
|
|
192
|
+
@include gl-display-table-cell;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
190
196
|
@mixin gl-lg-display-table-cell {
|
|
191
197
|
@include gl-media-breakpoint-up(lg) {
|
|
192
198
|
@include gl-display-table-cell;
|