@gitlab/ui 126.3.0 → 126.3.1
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/dist/components/base/avatars_inline/avatars_inline.js +21 -0
- package/dist/components/base/badge/badge.js +7 -7
- package/dist/components/base/drawer/drawer.js +19 -0
- package/dist/components/base/dropdown/dropdown_item.js +34 -0
- package/dist/components/base/form/form_input_group/form_input_group.js +6 -0
- package/dist/components/base/label/label.js +26 -6
- package/dist/components/base/popover/popover.js +15 -0
- package/dist/components/base/progress_bar/progress_bar.js +15 -0
- package/dist/components/base/search_box_by_type/search_box_by_type.js +20 -0
- package/dist/components/base/tabs/tab/tab.js +31 -2
- package/dist/components/base/token/token.js +3 -0
- package/dist/components/dashboards/dashboard_layout/dashboard_layout.js +27 -1
- package/dist/components/dashboards/dashboard_layout/grid_layout/grid_layout.js +28 -6
- package/package.json +2 -2
- package/src/components/base/avatars_inline/avatars_inline.vue +22 -0
- package/src/components/base/badge/badge.vue +9 -8
- package/src/components/base/drawer/drawer.vue +23 -0
- package/src/components/base/dropdown/dropdown_item.vue +35 -0
- package/src/components/base/form/form_input_group/form_input_group.vue +6 -0
- package/src/components/base/label/label.vue +26 -6
- package/src/components/base/popover/popover.vue +20 -1
- package/src/components/base/progress_bar/progress_bar.vue +15 -0
- package/src/components/base/search_box_by_type/search_box_by_type.vue +18 -0
- package/src/components/base/tabs/tab/tab.vue +46 -2
- package/src/components/base/token/token.vue +4 -0
- package/src/components/dashboards/dashboard_layout/dashboard_layout.vue +29 -0
- package/src/components/dashboards/dashboard_layout/grid_layout/grid_layout.vue +29 -6
|
@@ -12,33 +12,54 @@ export default {
|
|
|
12
12
|
GlTooltip,
|
|
13
13
|
},
|
|
14
14
|
props: {
|
|
15
|
+
/**
|
|
16
|
+
* Array of avatar objects to display
|
|
17
|
+
*/
|
|
15
18
|
avatars: {
|
|
16
19
|
type: Array,
|
|
17
20
|
required: true,
|
|
18
21
|
},
|
|
22
|
+
/**
|
|
23
|
+
* Maximum number of avatars to display before collapsing
|
|
24
|
+
*/
|
|
19
25
|
maxVisible: {
|
|
20
26
|
type: Number,
|
|
21
27
|
required: true,
|
|
22
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* Size of each avatar in pixels
|
|
31
|
+
*/
|
|
23
32
|
avatarSize: {
|
|
24
33
|
type: Number,
|
|
25
34
|
required: true,
|
|
26
35
|
validator: (value) => avatarsInlineSizeOptions.includes(value),
|
|
27
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* Whether to show the avatars in collapsed state
|
|
39
|
+
*/
|
|
28
40
|
collapsed: {
|
|
29
41
|
type: Boolean,
|
|
30
42
|
required: false,
|
|
31
43
|
default: false,
|
|
32
44
|
},
|
|
45
|
+
/**
|
|
46
|
+
* Screen reader text for the collapsed avatars badge
|
|
47
|
+
*/
|
|
33
48
|
badgeSrOnlyText: {
|
|
34
49
|
type: String,
|
|
35
50
|
required: true,
|
|
36
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* Property name to extract tooltip text from each hidden avatar object
|
|
54
|
+
*/
|
|
37
55
|
badgeTooltipProp: {
|
|
38
56
|
type: String,
|
|
39
57
|
required: false,
|
|
40
58
|
default: '',
|
|
41
59
|
},
|
|
60
|
+
/**
|
|
61
|
+
* Maximum number of characters to display in the badge tooltip
|
|
62
|
+
*/
|
|
42
63
|
badgeTooltipMaxChars: {
|
|
43
64
|
type: Number,
|
|
44
65
|
required: false,
|
|
@@ -88,6 +109,7 @@ export default {
|
|
|
88
109
|
<template>
|
|
89
110
|
<div class="gl-avatars-inline" :class="`gl-avatars-inline-${badgeSize}`">
|
|
90
111
|
<div v-for="(avatar, index) in visibleAvatars" :key="index" class="gl-avatars-inline-child">
|
|
112
|
+
<!-- @slot Custom avatar rendering. Provide avatar object as slot prop. -->
|
|
91
113
|
<slot name="avatar" :avatar="avatar">
|
|
92
114
|
<gl-avatar v-bind="avatar" :size="avatarSize" />
|
|
93
115
|
</slot>
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
linkVariantUnstyled,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
9
|
import GlIcon from '../icon/icon.vue';
|
|
10
|
+
import { logWarning } from '../../../utils/utils';
|
|
10
11
|
|
|
11
12
|
const variantClass = {
|
|
12
13
|
[badgeVariantOptions.neutral]: 'badge-neutral',
|
|
@@ -120,13 +121,6 @@ export default {
|
|
|
120
121
|
role() {
|
|
121
122
|
return this.hasIconOnly ? 'img' : undefined;
|
|
122
123
|
},
|
|
123
|
-
ariaLabel() {
|
|
124
|
-
if (this.$attrs['aria-label']) {
|
|
125
|
-
return this.$attrs['aria-label'];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return this.role === 'img' ? this.icon : undefined;
|
|
129
|
-
},
|
|
130
124
|
iconSizeComputed() {
|
|
131
125
|
return badgeIconSizeOptions[this.iconSize];
|
|
132
126
|
},
|
|
@@ -152,6 +146,14 @@ export default {
|
|
|
152
146
|
];
|
|
153
147
|
},
|
|
154
148
|
},
|
|
149
|
+
mounted() {
|
|
150
|
+
if (this.hasIconOnly && !this.$attrs['aria-label']) {
|
|
151
|
+
logWarning(
|
|
152
|
+
'[GlBadge] Icon-only badges require an aria-label for accessibility. The label should describe the metadata (e.g., "Due date", "Open issue"), not the icon name. See https://design.gitlab.com/components/badge#using-icon-only-badges',
|
|
153
|
+
this.$el,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
155
157
|
};
|
|
156
158
|
</script>
|
|
157
159
|
|
|
@@ -161,7 +163,6 @@ export default {
|
|
|
161
163
|
v-bind="computedProps"
|
|
162
164
|
:class="classes"
|
|
163
165
|
:role="role"
|
|
164
|
-
:aria-label="ariaLabel"
|
|
165
166
|
v-on="$listeners"
|
|
166
167
|
>
|
|
167
168
|
<gl-icon
|
|
@@ -10,25 +10,40 @@ export default {
|
|
|
10
10
|
GlButton,
|
|
11
11
|
},
|
|
12
12
|
props: {
|
|
13
|
+
/**
|
|
14
|
+
* Controls the visibility state of the drawer.
|
|
15
|
+
*/
|
|
13
16
|
open: {
|
|
14
17
|
type: Boolean,
|
|
15
18
|
required: true,
|
|
16
19
|
},
|
|
20
|
+
/**
|
|
21
|
+
* Height of the header element (e.g., '64px'). Used to position the drawer below a fixed header.
|
|
22
|
+
*/
|
|
17
23
|
headerHeight: {
|
|
18
24
|
type: String,
|
|
19
25
|
required: false,
|
|
20
26
|
default: '',
|
|
21
27
|
},
|
|
28
|
+
/**
|
|
29
|
+
* When true, makes the drawer header sticky so it remains visible when scrolling the drawer content.
|
|
30
|
+
*/
|
|
22
31
|
headerSticky: {
|
|
23
32
|
type: Boolean,
|
|
24
33
|
required: false,
|
|
25
34
|
default: false,
|
|
26
35
|
},
|
|
36
|
+
/**
|
|
37
|
+
* Z-index value for the drawer. Useful for controlling stacking order with other elements.
|
|
38
|
+
*/
|
|
27
39
|
zIndex: {
|
|
28
40
|
type: Number,
|
|
29
41
|
required: false,
|
|
30
42
|
default: maxZIndex,
|
|
31
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* Visual variant of the drawer.
|
|
46
|
+
*/
|
|
32
47
|
variant: {
|
|
33
48
|
type: String,
|
|
34
49
|
required: false,
|
|
@@ -93,6 +108,10 @@ export default {
|
|
|
93
108
|
const ESC = 27;
|
|
94
109
|
|
|
95
110
|
if (this.open && e.keyCode === ESC) {
|
|
111
|
+
/**
|
|
112
|
+
* Emits when drawer gets closed (by pressing ESC or clicking the close button).
|
|
113
|
+
* @event close
|
|
114
|
+
*/
|
|
96
115
|
this.$emit('close');
|
|
97
116
|
}
|
|
98
117
|
},
|
|
@@ -108,6 +127,7 @@ export default {
|
|
|
108
127
|
:class="{ 'gl-drawer-header-sticky': headerSticky }"
|
|
109
128
|
>
|
|
110
129
|
<div class="gl-drawer-title">
|
|
130
|
+
<!-- @slot Content for the drawer title area in the header. -->
|
|
111
131
|
<slot name="title"></slot>
|
|
112
132
|
<gl-button
|
|
113
133
|
category="tertiary"
|
|
@@ -118,6 +138,7 @@ export default {
|
|
|
118
138
|
@click="$emit('close')"
|
|
119
139
|
/>
|
|
120
140
|
</div>
|
|
141
|
+
<!-- @slot Additional content below the title in the header section. -->
|
|
121
142
|
<slot name="header"></slot>
|
|
122
143
|
</div>
|
|
123
144
|
<div
|
|
@@ -127,6 +148,7 @@ export default {
|
|
|
127
148
|
'gl-drawer-body-scrim': !shouldRenderFooter,
|
|
128
149
|
}"
|
|
129
150
|
>
|
|
151
|
+
<!-- @slot Main content of the drawer body. -->
|
|
130
152
|
<slot></slot>
|
|
131
153
|
</div>
|
|
132
154
|
<div
|
|
@@ -134,6 +156,7 @@ export default {
|
|
|
134
156
|
class="gl-drawer-footer gl-drawer-footer-sticky gl-drawer-body-scrim-on-footer"
|
|
135
157
|
:style="{ zIndex }"
|
|
136
158
|
>
|
|
159
|
+
<!-- @slot Content for the sticky footer at the bottom of the drawer. -->
|
|
137
160
|
<slot name="footer"></slot>
|
|
138
161
|
</div>
|
|
139
162
|
</aside>
|
|
@@ -15,51 +15,81 @@ export default {
|
|
|
15
15
|
},
|
|
16
16
|
inheritAttrs: false,
|
|
17
17
|
props: {
|
|
18
|
+
/**
|
|
19
|
+
* URL for the avatar image to display
|
|
20
|
+
*/
|
|
18
21
|
avatarUrl: {
|
|
19
22
|
type: String,
|
|
20
23
|
required: false,
|
|
21
24
|
default: '',
|
|
22
25
|
},
|
|
26
|
+
/**
|
|
27
|
+
* Color variant for the icon on the left side
|
|
28
|
+
*/
|
|
23
29
|
iconColor: {
|
|
24
30
|
type: String,
|
|
25
31
|
required: false,
|
|
26
32
|
default: '',
|
|
27
33
|
},
|
|
34
|
+
/**
|
|
35
|
+
* Name of the icon to display on the left side
|
|
36
|
+
*/
|
|
28
37
|
iconName: {
|
|
29
38
|
type: String,
|
|
30
39
|
required: false,
|
|
31
40
|
default: '',
|
|
32
41
|
},
|
|
42
|
+
/**
|
|
43
|
+
* Aria label for the right icon button
|
|
44
|
+
*/
|
|
33
45
|
iconRightAriaLabel: {
|
|
34
46
|
type: String,
|
|
35
47
|
required: false,
|
|
36
48
|
default: '',
|
|
37
49
|
},
|
|
50
|
+
/**
|
|
51
|
+
* Name of the icon to display on the right side
|
|
52
|
+
*/
|
|
38
53
|
iconRightName: {
|
|
39
54
|
type: String,
|
|
40
55
|
required: false,
|
|
41
56
|
default: '',
|
|
42
57
|
},
|
|
58
|
+
/**
|
|
59
|
+
* Whether the dropdown item is checked
|
|
60
|
+
*/
|
|
43
61
|
isChecked: {
|
|
44
62
|
type: Boolean,
|
|
45
63
|
required: false,
|
|
46
64
|
default: false,
|
|
47
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* Whether to show a check icon for this item
|
|
68
|
+
*/
|
|
48
69
|
isCheckItem: {
|
|
49
70
|
type: Boolean,
|
|
50
71
|
required: false,
|
|
51
72
|
default: false,
|
|
52
73
|
},
|
|
74
|
+
/**
|
|
75
|
+
* Whether to center the check icon vertically
|
|
76
|
+
*/
|
|
53
77
|
isCheckCentered: {
|
|
54
78
|
type: Boolean,
|
|
55
79
|
required: false,
|
|
56
80
|
default: false,
|
|
57
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* Secondary text to display below the main content
|
|
84
|
+
*/
|
|
58
85
|
secondaryText: {
|
|
59
86
|
type: String,
|
|
60
87
|
required: false,
|
|
61
88
|
default: '',
|
|
62
89
|
},
|
|
90
|
+
/**
|
|
91
|
+
* ARIA role for the dropdown item
|
|
92
|
+
*/
|
|
63
93
|
role: {
|
|
64
94
|
type: String,
|
|
65
95
|
required: false,
|
|
@@ -93,6 +123,10 @@ export default {
|
|
|
93
123
|
},
|
|
94
124
|
methods: {
|
|
95
125
|
handleClickIconRight() {
|
|
126
|
+
/**
|
|
127
|
+
* Emitted when right icon is clicked.
|
|
128
|
+
* @event handleClickIconRight
|
|
129
|
+
*/
|
|
96
130
|
this.$emit('click-icon-right');
|
|
97
131
|
},
|
|
98
132
|
},
|
|
@@ -115,6 +149,7 @@ export default {
|
|
|
115
149
|
<gl-icon v-if="iconName" :name="iconName" :class="['gl-dropdown-item-icon', iconColorCss]" />
|
|
116
150
|
<gl-avatar v-if="avatarUrl" :size="32" :src="avatarUrl" />
|
|
117
151
|
<div class="gl-dropdown-item-text-wrapper">
|
|
152
|
+
<!-- @slot Main content of the dropdown item. -->
|
|
118
153
|
<p class="gl-dropdown-item-text-primary"><slot></slot></p>
|
|
119
154
|
<p v-if="secondaryText" class="gl-dropdown-item-text-secondary">{{ secondaryText }}</p>
|
|
120
155
|
</div>
|
|
@@ -31,11 +31,17 @@ export default {
|
|
|
31
31
|
default: () => [{ value: '', name: '' }],
|
|
32
32
|
validator: (options) => options.every((opt) => Object.keys(opt).includes('name', 'value')),
|
|
33
33
|
},
|
|
34
|
+
/**
|
|
35
|
+
* Accessible label for the input field. Used for the aria-label attribute.
|
|
36
|
+
*/
|
|
34
37
|
label: {
|
|
35
38
|
type: String,
|
|
36
39
|
required: false,
|
|
37
40
|
default: undefined,
|
|
38
41
|
},
|
|
42
|
+
/**
|
|
43
|
+
* Additional CSS class(es) to apply to the input element.
|
|
44
|
+
*/
|
|
39
45
|
inputClass: {
|
|
40
46
|
type: [String, Array, Object],
|
|
41
47
|
required: false,
|
|
@@ -16,41 +16,65 @@ export default {
|
|
|
16
16
|
GlTooltip,
|
|
17
17
|
},
|
|
18
18
|
props: {
|
|
19
|
+
/**
|
|
20
|
+
* Background color of the label in hex, rgb, or rgba format
|
|
21
|
+
*/
|
|
19
22
|
backgroundColor: {
|
|
20
23
|
type: String,
|
|
21
24
|
required: true,
|
|
22
25
|
validator: (value) => /^(#|rgb|rgba)/.test(value),
|
|
23
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Title text of the label
|
|
29
|
+
*/
|
|
24
30
|
title: {
|
|
25
31
|
type: String,
|
|
26
32
|
required: true,
|
|
27
33
|
default: '',
|
|
28
34
|
},
|
|
35
|
+
/**
|
|
36
|
+
* Description text shown in tooltip
|
|
37
|
+
*/
|
|
29
38
|
description: {
|
|
30
39
|
type: String,
|
|
31
40
|
required: false,
|
|
32
41
|
default: '',
|
|
33
42
|
},
|
|
43
|
+
/**
|
|
44
|
+
* Placement of the tooltip
|
|
45
|
+
*/
|
|
34
46
|
tooltipPlacement: {
|
|
35
47
|
type: String,
|
|
36
48
|
required: false,
|
|
37
49
|
default: 'top',
|
|
38
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* Target URL for the label link
|
|
53
|
+
*/
|
|
39
54
|
target: {
|
|
40
55
|
type: String,
|
|
41
56
|
required: false,
|
|
42
57
|
default: '',
|
|
43
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* Whether the label is scoped (uses :: separator)
|
|
61
|
+
*/
|
|
44
62
|
scoped: {
|
|
45
63
|
type: Boolean,
|
|
46
64
|
required: false,
|
|
47
65
|
default: false,
|
|
48
66
|
},
|
|
67
|
+
/**
|
|
68
|
+
* Whether to show the close button
|
|
69
|
+
*/
|
|
49
70
|
showCloseButton: {
|
|
50
71
|
type: Boolean,
|
|
51
72
|
required: false,
|
|
52
73
|
default: false,
|
|
53
74
|
},
|
|
75
|
+
/**
|
|
76
|
+
* Whether the label is disabled
|
|
77
|
+
*/
|
|
54
78
|
disabled: {
|
|
55
79
|
type: Boolean,
|
|
56
80
|
required: false,
|
|
@@ -98,19 +122,15 @@ export default {
|
|
|
98
122
|
methods: {
|
|
99
123
|
onClick(e) {
|
|
100
124
|
/**
|
|
101
|
-
* Emitted when label is clicked
|
|
102
|
-
*
|
|
125
|
+
* Emitted when the label is clicked.
|
|
103
126
|
* @event click
|
|
104
|
-
* @type {object}
|
|
105
127
|
*/
|
|
106
128
|
this.$emit('click', e);
|
|
107
129
|
},
|
|
108
130
|
onClose(e) {
|
|
109
131
|
/**
|
|
110
|
-
* Emitted when
|
|
111
|
-
*
|
|
132
|
+
* Emitted when the close button is clicked.
|
|
112
133
|
* @event close
|
|
113
|
-
* @type {object}
|
|
114
134
|
*/
|
|
115
135
|
this.$emit('close', e);
|
|
116
136
|
},
|
|
@@ -16,6 +16,9 @@ export default {
|
|
|
16
16
|
mixins: [tooltipMixin(popoverRefName)],
|
|
17
17
|
inheritAttrs: false,
|
|
18
18
|
props: {
|
|
19
|
+
/**
|
|
20
|
+
* Additional CSS class(es) to apply to the popover.
|
|
21
|
+
*/
|
|
19
22
|
cssClasses: {
|
|
20
23
|
type: [Array, String, Object],
|
|
21
24
|
required: false,
|
|
@@ -31,21 +34,33 @@ export default {
|
|
|
31
34
|
required: false,
|
|
32
35
|
default: 'hover focus',
|
|
33
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* Title text to display in the popover header.
|
|
39
|
+
*/
|
|
34
40
|
title: {
|
|
35
41
|
type: String,
|
|
36
42
|
required: false,
|
|
37
43
|
default: '',
|
|
38
44
|
},
|
|
45
|
+
/**
|
|
46
|
+
* When true, displays a close button in the popover header.
|
|
47
|
+
*/
|
|
39
48
|
showCloseButton: {
|
|
40
49
|
type: Boolean,
|
|
41
50
|
required: false,
|
|
42
51
|
default: false,
|
|
43
52
|
},
|
|
53
|
+
/**
|
|
54
|
+
* Placement of the popover relative to the target element.
|
|
55
|
+
*/
|
|
44
56
|
placement: {
|
|
45
57
|
type: String,
|
|
46
58
|
required: false,
|
|
47
59
|
default: popoverPlacements.top,
|
|
48
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* Padding (in pixels) between the popover and the viewport boundary.
|
|
63
|
+
*/
|
|
49
64
|
boundaryPadding: {
|
|
50
65
|
type: [Number, String],
|
|
51
66
|
required: false,
|
|
@@ -113,6 +128,7 @@ export default {
|
|
|
113
128
|
v-on="$listeners"
|
|
114
129
|
>
|
|
115
130
|
<template v-if="shouldShowTitle" #title>
|
|
131
|
+
<!-- @slot Custom content for the popover title -->
|
|
116
132
|
<slot name="title">
|
|
117
133
|
{{ title }}
|
|
118
134
|
</slot>
|
|
@@ -124,6 +140,9 @@ export default {
|
|
|
124
140
|
/>
|
|
125
141
|
</div>
|
|
126
142
|
</template>
|
|
127
|
-
<template v-if="$scopedSlots.default" #default
|
|
143
|
+
<template v-if="$scopedSlots.default" #default>
|
|
144
|
+
<!-- @slot Main content of the popover body-->
|
|
145
|
+
<slot></slot>
|
|
146
|
+
</template>
|
|
128
147
|
</b-popover>
|
|
129
148
|
</template>
|
|
@@ -13,27 +13,42 @@ const backgroundClasses = {
|
|
|
13
13
|
export default {
|
|
14
14
|
name: 'GlProgressBar',
|
|
15
15
|
props: {
|
|
16
|
+
/**
|
|
17
|
+
* Accessible label for the progress bar. Used for the aria-label attribute.
|
|
18
|
+
*/
|
|
16
19
|
ariaLabel: {
|
|
17
20
|
type: String,
|
|
18
21
|
required: false,
|
|
19
22
|
default: translate('GlProgressBar.ariaLabel', 'Progress bar'),
|
|
20
23
|
},
|
|
24
|
+
/**
|
|
25
|
+
* Current progress value. Should be between 0 and the max value.
|
|
26
|
+
*/
|
|
21
27
|
value: {
|
|
22
28
|
type: [Number, String],
|
|
23
29
|
required: false,
|
|
24
30
|
default: 0,
|
|
25
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* Visual variant of the progress bar.
|
|
34
|
+
*/
|
|
26
35
|
variant: {
|
|
27
36
|
type: String,
|
|
28
37
|
required: false,
|
|
29
38
|
default: 'primary',
|
|
30
39
|
validator: (value) => Object.keys(progressBarVariantOptions).includes(value),
|
|
31
40
|
},
|
|
41
|
+
/**
|
|
42
|
+
* Maximum value for the progress bar. The value prop is calculated as a percentage of this.
|
|
43
|
+
*/
|
|
32
44
|
max: {
|
|
33
45
|
type: [Number, String],
|
|
34
46
|
required: false,
|
|
35
47
|
default: 100,
|
|
36
48
|
},
|
|
49
|
+
/**
|
|
50
|
+
* Custom height for the progress bar (e.g., '8px', '1rem').
|
|
51
|
+
*/
|
|
37
52
|
height: {
|
|
38
53
|
type: String,
|
|
39
54
|
required: false,
|
|
@@ -27,11 +27,17 @@ export default {
|
|
|
27
27
|
required: false,
|
|
28
28
|
default: '',
|
|
29
29
|
},
|
|
30
|
+
/**
|
|
31
|
+
* Whether to render the search box without borders
|
|
32
|
+
*/
|
|
30
33
|
borderless: {
|
|
31
34
|
type: Boolean,
|
|
32
35
|
required: false,
|
|
33
36
|
default: false,
|
|
34
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Title text for the clear button
|
|
40
|
+
*/
|
|
35
41
|
clearButtonTitle: {
|
|
36
42
|
type: String,
|
|
37
43
|
required: false,
|
|
@@ -104,6 +110,10 @@ export default {
|
|
|
104
110
|
this.$refs.input.$el.focus();
|
|
105
111
|
},
|
|
106
112
|
onInput(value) {
|
|
113
|
+
/**
|
|
114
|
+
* Emitted when the input value changes or gets cleared.
|
|
115
|
+
* @event input
|
|
116
|
+
*/
|
|
107
117
|
this.$emit('input', value);
|
|
108
118
|
},
|
|
109
119
|
onFocusout(event) {
|
|
@@ -113,6 +123,10 @@ export default {
|
|
|
113
123
|
return;
|
|
114
124
|
}
|
|
115
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Emitted when focus leaves the search box (input and clear button).
|
|
128
|
+
* @event focusout
|
|
129
|
+
*/
|
|
116
130
|
this.$emit('focusout', event);
|
|
117
131
|
},
|
|
118
132
|
onFocusin(event) {
|
|
@@ -122,6 +136,10 @@ export default {
|
|
|
122
136
|
return;
|
|
123
137
|
}
|
|
124
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Emitted when focus enters the search box (input or clear button).
|
|
141
|
+
* @event focusin
|
|
142
|
+
*/
|
|
125
143
|
this.$emit('focusin', event);
|
|
126
144
|
},
|
|
127
145
|
},
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<script>
|
|
3
3
|
import isPlainObject from 'lodash/isPlainObject';
|
|
4
4
|
import { BTab } from '../../../../vendor/bootstrap-vue/src/components/tabs/tab';
|
|
5
|
+
import GlBadge from '../../badge/badge.vue';
|
|
5
6
|
|
|
6
7
|
import { DEFAULT_TAB_TITLE_LINK_CLASS } from '../constants';
|
|
7
8
|
|
|
@@ -9,6 +10,7 @@ export default {
|
|
|
9
10
|
name: 'GlTab',
|
|
10
11
|
components: {
|
|
11
12
|
BTab,
|
|
13
|
+
GlBadge,
|
|
12
14
|
},
|
|
13
15
|
inheritAttrs: false,
|
|
14
16
|
props: {
|
|
@@ -25,6 +27,24 @@ export default {
|
|
|
25
27
|
required: false,
|
|
26
28
|
default: null,
|
|
27
29
|
},
|
|
30
|
+
/**
|
|
31
|
+
* Display a count badge next to the tab title.
|
|
32
|
+
*/
|
|
33
|
+
tabCount: {
|
|
34
|
+
type: Number,
|
|
35
|
+
required: false,
|
|
36
|
+
default: null,
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Screen reader text to provide context for the tab count value.
|
|
40
|
+
* Should be the result of calling n__() with the count.
|
|
41
|
+
* Example: :tab-count-sr-text="n__('%d changed file', '%d changed files', count)"
|
|
42
|
+
*/
|
|
43
|
+
tabCountSrText: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: false,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
28
48
|
},
|
|
29
49
|
computed: {
|
|
30
50
|
linkClass() {
|
|
@@ -38,19 +58,43 @@ export default {
|
|
|
38
58
|
}
|
|
39
59
|
return `${titleLinkClass} ${DEFAULT_TAB_TITLE_LINK_CLASS}`.trim();
|
|
40
60
|
},
|
|
61
|
+
hasTabCount() {
|
|
62
|
+
return this.tabCount != null && this.tabCount >= 0;
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
created() {
|
|
66
|
+
if (process.env.NODE_ENV !== 'production' && this.hasTabCount && !this.tabCountSrText) {
|
|
67
|
+
// eslint-disable-next-line no-console
|
|
68
|
+
console.warn(
|
|
69
|
+
'[GlTab] When using "tab-count", you should also provide "tab-count-sr-text" for screen reader accessibility. Example: :tab-count-sr-text="n__(\'%d item\', \'%d items\', count)"',
|
|
70
|
+
);
|
|
71
|
+
}
|
|
41
72
|
},
|
|
42
73
|
};
|
|
43
74
|
</script>
|
|
44
75
|
|
|
45
76
|
<template>
|
|
46
77
|
<b-tab
|
|
78
|
+
:title="hasTabCount ? null : $attrs.title"
|
|
47
79
|
:title-link-class="linkClass"
|
|
48
80
|
:query-param-value="queryParamValue"
|
|
49
81
|
v-bind="$attrs"
|
|
50
82
|
v-on="$listeners"
|
|
51
83
|
>
|
|
52
|
-
|
|
53
|
-
|
|
84
|
+
<template v-if="hasTabCount" #title>
|
|
85
|
+
<slot name="title">{{ $attrs.title }}</slot>
|
|
86
|
+
<gl-badge
|
|
87
|
+
class="gl-ml-2"
|
|
88
|
+
variant="neutral"
|
|
89
|
+
aria-hidden="true"
|
|
90
|
+
data-testid="tab-counter-badge"
|
|
91
|
+
>
|
|
92
|
+
{{ tabCount }}
|
|
93
|
+
</gl-badge>
|
|
94
|
+
<span v-if="tabCountSrText" class="gl-sr-only">{{ tabCountSrText }}</span>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<template v-for="slot in Object.keys($scopedSlots)" #[slot]>
|
|
54
98
|
<slot :name="slot"></slot>
|
|
55
99
|
</template>
|
|
56
100
|
</b-tab>
|
|
@@ -10,6 +10,9 @@ export default {
|
|
|
10
10
|
CloseButton,
|
|
11
11
|
},
|
|
12
12
|
props: {
|
|
13
|
+
/**
|
|
14
|
+
* When true, hides the close button and makes the token non-removable.
|
|
15
|
+
*/
|
|
13
16
|
viewOnly: {
|
|
14
17
|
type: Boolean,
|
|
15
18
|
required: false,
|
|
@@ -60,6 +63,7 @@ export default {
|
|
|
60
63
|
<template>
|
|
61
64
|
<span :class="['gl-token', variantClass, viewOnlyClass]" v-on="$listeners">
|
|
62
65
|
<span class="gl-token-content">
|
|
66
|
+
<!-- @slot Content to display inside the token -->
|
|
63
67
|
<slot></slot>
|
|
64
68
|
<close-button v-if="!viewOnly" class="gl-token-close" :label="removeLabel" @click="close" />
|
|
65
69
|
</span>
|
|
@@ -35,6 +35,33 @@ export default {
|
|
|
35
35
|
required: false,
|
|
36
36
|
default: true,
|
|
37
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Adjusts the cell height of the grid. Setting this too high can leave unwanted whitespace
|
|
40
|
+
* between grid panels. Reduce the number to allow for a more compact grid.
|
|
41
|
+
* For more information, see:
|
|
42
|
+
* https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com/-/issues/3051
|
|
43
|
+
*/
|
|
44
|
+
cellHeight: {
|
|
45
|
+
type: Number,
|
|
46
|
+
required: false,
|
|
47
|
+
|
|
48
|
+
/* Magic number:
|
|
49
|
+
* After allowing for padding, and the panel title row, this leaves us with minimum 48px height for the cell content.
|
|
50
|
+
* This means text/content with our spacing scale can fit up to 49px without scrolling.
|
|
51
|
+
*/
|
|
52
|
+
default: 137,
|
|
53
|
+
validator: (value) => value > 0,
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Sets a default minimum height for grid panels. This can still be overriden on a per-panel
|
|
57
|
+
* basis by setting `value.panels[].gridAttributes.minHeight`
|
|
58
|
+
*/
|
|
59
|
+
minCellHeight: {
|
|
60
|
+
type: Number,
|
|
61
|
+
required: false,
|
|
62
|
+
default: 1,
|
|
63
|
+
validator: (value) => value > 0,
|
|
64
|
+
},
|
|
38
65
|
},
|
|
39
66
|
computed: {
|
|
40
67
|
dashboardHasPanels() {
|
|
@@ -104,6 +131,8 @@ export default {
|
|
|
104
131
|
v-if="dashboardHasPanels"
|
|
105
132
|
:value="config"
|
|
106
133
|
:is-static-grid="isStaticGrid"
|
|
134
|
+
:cell-height="cellHeight"
|
|
135
|
+
:min-cell-height="minCellHeight"
|
|
107
136
|
class="-gl-mx-3"
|
|
108
137
|
@input="emitChanges"
|
|
109
138
|
>
|