@gitlab/ui 137.3.0 → 137.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/alert/alert.js +2 -1
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +4 -1
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +35 -20
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/components/base/alert/alert.scss +18 -18
- package/src/components/base/alert/alert.vue +2 -0
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.scss +2 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.vue +4 -0
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.vue +33 -14
package/package.json
CHANGED
|
@@ -26,20 +26,24 @@ $gl-alert-padding-x: var(--gl-alert-padding-x, 0px);
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.gl-alert {
|
|
29
|
-
@apply gl-py-
|
|
29
|
+
@apply gl-py-3;
|
|
30
30
|
@apply gl-text-base;
|
|
31
31
|
border-radius: var(--gl-alert-border-radius);
|
|
32
|
-
padding-inline: calc(#{$gl-spacing-scale-
|
|
32
|
+
padding-inline: calc(#{$gl-spacing-scale-7} + #{$gl-alert-padding-x});
|
|
33
33
|
position: relative;
|
|
34
34
|
border: 1px solid;
|
|
35
35
|
|
|
36
36
|
&-not-dismissible {
|
|
37
|
-
padding-right: calc(#{$gl-spacing-scale-
|
|
37
|
+
padding-right: calc(#{$gl-spacing-scale-4} + #{$gl-alert-padding-x});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.gl-link:not(.gl-label-link) {
|
|
41
41
|
@apply gl-underline;
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
&.gl-alert-has-actions {
|
|
45
|
+
@apply gl-pb-4;
|
|
46
|
+
}
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
.gl-alert-sticky {
|
|
@@ -48,20 +52,19 @@ $gl-alert-padding-x: var(--gl-alert-padding-x, 0px);
|
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
.gl-alert-title {
|
|
51
|
-
@apply gl-heading-scale-
|
|
55
|
+
@apply gl-heading-scale-300;
|
|
56
|
+
@apply gl-mb-2;
|
|
57
|
+
@apply gl-leading-20;
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
.gl-alert-icon-container {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
left: calc(#{$gl-spacing-scale-
|
|
61
|
+
@apply gl-absolute;
|
|
62
|
+
@apply gl-top-3;
|
|
63
|
+
left: calc(#{$gl-spacing-scale-3} + #{$gl-alert-padding-x});
|
|
58
64
|
@apply gl-flex;
|
|
59
65
|
@apply gl-items-center;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.gl-alert-has-title & {
|
|
63
|
-
top: $gl-spacing-scale-4;
|
|
64
|
-
}
|
|
66
|
+
// Match line-height on first line of title or slot text content
|
|
67
|
+
height: $gl-line-height-20;
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
.gl-alert-body {
|
|
@@ -89,12 +92,9 @@ $gl-alert-padding-x: var(--gl-alert-padding-x, 0px);
|
|
|
89
92
|
// This is the replacement for .gl-alert-dismiss
|
|
90
93
|
.gl-dismiss-btn {
|
|
91
94
|
position: absolute;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.gl-alert-has-title & {
|
|
96
|
-
top: $gl-spacing-scale-4;
|
|
97
|
-
}
|
|
95
|
+
// Pull the button up by half its overhang so it aligns with first line title or slot text content
|
|
96
|
+
top: calc(#{$gl-spacing-scale-3} - (#{$gl-button-small-size} - #{$gl-line-height-20}) / 2);
|
|
97
|
+
right: calc(#{$gl-spacing-scale-2} + #{$gl-alert-padding-x});
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/* Variants */
|
|
@@ -239,6 +239,7 @@ export default {
|
|
|
239
239
|
{ 'gl-alert-sticky': sticky },
|
|
240
240
|
{ 'gl-alert-not-dismissible': !dismissible },
|
|
241
241
|
{ 'gl-alert-has-title': !!title },
|
|
242
|
+
{ 'gl-alert-has-actions': shouldRenderActions },
|
|
242
243
|
{ 'gl-focus': hasProgrammaticFocus },
|
|
243
244
|
variantClass,
|
|
244
245
|
]"
|
|
@@ -263,6 +264,7 @@ export default {
|
|
|
263
264
|
v-for="(actionButton, index) in actionButtons"
|
|
264
265
|
:key="index"
|
|
265
266
|
class="gl-alert-action"
|
|
267
|
+
size="small"
|
|
266
268
|
v-bind="actionButton.attrs"
|
|
267
269
|
v-on="actionButton.listeners"
|
|
268
270
|
>
|
|
@@ -378,6 +378,9 @@ export default {
|
|
|
378
378
|
this.closeAndFocus();
|
|
379
379
|
}
|
|
380
380
|
},
|
|
381
|
+
isDisabled(item) {
|
|
382
|
+
return item.disabled;
|
|
383
|
+
},
|
|
381
384
|
uniqueItemId() {
|
|
382
385
|
return uniqueId(`disclosure-item-`);
|
|
383
386
|
},
|
|
@@ -443,6 +446,7 @@ export default {
|
|
|
443
446
|
:key="uniqueItemId()"
|
|
444
447
|
:siblings-have-icons="siblingsHaveIcons"
|
|
445
448
|
:item="item"
|
|
449
|
+
:disabled="isDisabled(item)"
|
|
446
450
|
@action="handleAction"
|
|
447
451
|
>
|
|
448
452
|
<template v-if="'list-item' in $scopedSlots" #list-item>
|
|
@@ -50,6 +50,15 @@ export default {
|
|
|
50
50
|
default: false,
|
|
51
51
|
required: false,
|
|
52
52
|
},
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Is the item able to be selected
|
|
56
|
+
*/
|
|
57
|
+
disabled: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
required: false,
|
|
61
|
+
},
|
|
53
62
|
},
|
|
54
63
|
computed: {
|
|
55
64
|
isLink() {
|
|
@@ -108,6 +117,7 @@ export default {
|
|
|
108
117
|
? // eslint-disable-next-line @gitlab/tailwind-no-interpolation
|
|
109
118
|
`gl-new-dropdown-item-${this.itemVariant}`
|
|
110
119
|
: '',
|
|
120
|
+
this.disabled ? 'disabled' : '',
|
|
111
121
|
];
|
|
112
122
|
},
|
|
113
123
|
iconName() {
|
|
@@ -125,22 +135,24 @@ export default {
|
|
|
125
135
|
},
|
|
126
136
|
methods: {
|
|
127
137
|
onKeydown(event) {
|
|
128
|
-
|
|
138
|
+
if (!this.disabled) {
|
|
139
|
+
const { code } = event;
|
|
129
140
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
} else {
|
|
134
|
-
stopEvent(event);
|
|
135
|
-
/** Instead of simply navigating or calling the action, we want
|
|
136
|
-
* the `a/button` to be the target of the event as it might have additional attributes.
|
|
137
|
-
* E.g. `a` might have `target` attribute.
|
|
138
|
-
*/
|
|
139
|
-
const e = new MouseEvent('click', { bubbles: true, cancelable: true });
|
|
140
|
-
if (this.isLink) {
|
|
141
|
-
this.$refs.item.$el.dispatchEvent(e);
|
|
141
|
+
if (code === ENTER || code === SPACE) {
|
|
142
|
+
if (this.isCustomContent) {
|
|
143
|
+
this.action();
|
|
142
144
|
} else {
|
|
143
|
-
|
|
145
|
+
stopEvent(event);
|
|
146
|
+
/** Instead of simply navigating or calling the action, we want
|
|
147
|
+
* the `a/button` to be the target of the event as it might have additional attributes.
|
|
148
|
+
* E.g. `a` might have `target` attribute.
|
|
149
|
+
*/
|
|
150
|
+
const e = new MouseEvent('click', { bubbles: true, cancelable: true });
|
|
151
|
+
if (this.isLink) {
|
|
152
|
+
this.$refs.item.$el.dispatchEvent(e);
|
|
153
|
+
} else {
|
|
154
|
+
this.$refs.item?.dispatchEvent(e);
|
|
155
|
+
}
|
|
144
156
|
}
|
|
145
157
|
}
|
|
146
158
|
}
|
|
@@ -148,6 +160,11 @@ export default {
|
|
|
148
160
|
action() {
|
|
149
161
|
this.$emit('action', this.item);
|
|
150
162
|
},
|
|
163
|
+
handleClick(event) {
|
|
164
|
+
if (this.disabled) {
|
|
165
|
+
stopEvent(event);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
151
168
|
},
|
|
152
169
|
};
|
|
153
170
|
</script>
|
|
@@ -157,6 +174,7 @@ export default {
|
|
|
157
174
|
:tabindex="listIndex"
|
|
158
175
|
:class="classes"
|
|
159
176
|
data-testid="disclosure-dropdown-item"
|
|
177
|
+
:aria-disabled="disabled"
|
|
160
178
|
v-on="wrapperListeners"
|
|
161
179
|
>
|
|
162
180
|
<slot>
|
|
@@ -167,6 +185,7 @@ export default {
|
|
|
167
185
|
class="gl-new-dropdown-item-content"
|
|
168
186
|
:tabindex="componentIndex"
|
|
169
187
|
v-on="itemComponent.listeners"
|
|
188
|
+
@click="handleClick"
|
|
170
189
|
>
|
|
171
190
|
<span class="gl-new-dropdown-item-text-wrapper">
|
|
172
191
|
<slot name="list-item">
|