@gitlab/ui 82.1.0 → 84.0.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 +30 -0
- package/dist/components/base/badge/badge.js +5 -13
- package/dist/components/experimental/duo/chat/duo_chat.js +26 -8
- package/dist/components/experimental/experiment_badge/experiment_badge.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tokens/tokens_table.js +1 -1
- package/package.json +4 -2
- package/src/components/base/badge/badge.scss +14 -16
- package/src/components/base/badge/badge.vue +7 -18
- package/src/components/base/label/label.scss +7 -5
- package/src/components/experimental/duo/chat/duo_chat.vue +34 -7
- package/src/components/experimental/experiment_badge/experiment_badge.vue +1 -1
- package/src/tokens/tokens_table.vue +1 -1
|
@@ -118,7 +118,7 @@ var ref_item = ref.item;
|
|
|
118
118
|
var name = ref_item.name;
|
|
119
119
|
var deprecated = ref_item.deprecated;
|
|
120
120
|
var description = ref_item.description;
|
|
121
|
-
return [_c('code',{staticClass:"gl-font-base gl-text-strong"},[_vm._v("\n "+_vm._s(name)+"\n ")]),_vm._v(" "),(deprecated)?_c('gl-badge',{attrs:{"
|
|
121
|
+
return [_c('code',{staticClass:"gl-font-base gl-text-strong"},[_vm._v("\n "+_vm._s(name)+"\n ")]),_vm._v(" "),(deprecated)?_c('gl-badge',{attrs:{"variant":"danger"}},[_vm._v("Deprecated")]):_vm._e(),_vm._v(" "),(description)?_c('div',{staticClass:"gl-mt-3 gl-text-subtle"},[_vm._v("\n "+_vm._s(description)+"\n ")]):_vm._e()]}},{key:"cell(value)",fn:function(ref){
|
|
122
122
|
var ref_item = ref.item;
|
|
123
123
|
var type = ref_item.type;
|
|
124
124
|
var value = ref_item.value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "84.0.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -49,9 +49,11 @@
|
|
|
49
49
|
"test:integration:server": "NODE_ENV=test start-test storybook:run http-get://${STORYBOOK_HOST:-localhost}:9001/iframe.html",
|
|
50
50
|
"test:unit": "NODE_ENV=test jest",
|
|
51
51
|
"test:unit:watch": "yarn test:unit --watch",
|
|
52
|
+
"test:unit:coverage": "yarn test:unit --coverage",
|
|
52
53
|
"test:unit:debug": "NODE_ENV=test node --inspect node_modules/.bin/jest --testPathIgnorePatterns storyshot.spec.js --watch --runInBand",
|
|
53
54
|
"test:unit-vue3": "VUE_VERSION=3 NODE_ENV=test jest",
|
|
54
55
|
"test:unit-vue3:watch": "VUE_VERSION=3 yarn test:unit --watch",
|
|
56
|
+
"test:unit-vue3:coverage": "VUE_VERSION=3 yarn test:unit --coverage",
|
|
55
57
|
"test:unit-vue3:debug": "VUE_VERSION=3 NODE_ENV=test node --inspect node_modules/.bin/jest --testPathIgnorePatterns storyshot.spec.js --watch --runInBand",
|
|
56
58
|
"test:visual": "./bin/run-visual-tests.sh 'test-storybook --browsers firefox --verbose --url http://localhost:9001'",
|
|
57
59
|
"test:visual:update": "./bin/run-visual-tests.sh 'test-storybook -u --browsers firefox --verbose --url http://localhost:9001'",
|
|
@@ -108,7 +110,7 @@
|
|
|
108
110
|
"@gitlab/eslint-plugin": "19.5.0",
|
|
109
111
|
"@gitlab/fonts": "^1.3.0",
|
|
110
112
|
"@gitlab/stylelint-config": "6.1.0",
|
|
111
|
-
"@gitlab/svgs": "3.
|
|
113
|
+
"@gitlab/svgs": "3.103.0",
|
|
112
114
|
"@jest/test-sequencer": "^29.7.0",
|
|
113
115
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
114
116
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
$badge-padding-horizontal: 0.75 * $grid-size;
|
|
2
|
+
$badge-min-width: 2.5 * $grid-size;
|
|
3
|
+
|
|
1
4
|
@mixin gl-badge-variant(
|
|
2
5
|
$variant,
|
|
3
6
|
$color,
|
|
@@ -15,7 +18,6 @@
|
|
|
15
18
|
color: $color;
|
|
16
19
|
|
|
17
20
|
.gl-badge-icon {
|
|
18
|
-
color: $icon-color;
|
|
19
21
|
transition: inherit;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -66,29 +68,18 @@
|
|
|
66
68
|
.gl-badge {
|
|
67
69
|
@include gl-display-inline-flex;
|
|
68
70
|
@include gl-align-items-center;
|
|
71
|
+
@include gl-justify-content-center;
|
|
69
72
|
@include gl-font-sm;
|
|
70
73
|
@include gl-font-weight-normal;
|
|
71
74
|
@include gl-line-height-normal;
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
gap: $gl-spacing-scale-2;
|
|
76
|
+
padding: $gl-spacing-scale-1 $badge-padding-horizontal;
|
|
77
|
+
min-width: $badge-min-width;
|
|
74
78
|
|
|
75
79
|
@media (forced-colors: active) {
|
|
76
80
|
border: 1px solid;
|
|
77
81
|
}
|
|
78
82
|
|
|
79
|
-
&.sm {
|
|
80
|
-
@include gl-py-0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&.md {
|
|
84
|
-
@include gl-py-2;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&.lg {
|
|
88
|
-
@include gl-py-3;
|
|
89
|
-
@include gl-font-base;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
83
|
.gl-badge-icon {
|
|
93
84
|
@include gl-h-5;
|
|
94
85
|
@include gl-w-5;
|
|
@@ -193,4 +184,11 @@
|
|
|
193
184
|
// overriding Bootstap's `.btn .badge {top: -1px}` as the badge is not vertically centered otherwise
|
|
194
185
|
.gl-button .gl-badge {
|
|
195
186
|
top: 0;
|
|
187
|
+
@include gl-py-0;
|
|
188
|
+
@include gl-px-2;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.gl-new-dropdown-contents .gl-badge,
|
|
192
|
+
.gl-tab-nav-item .gl-badge {
|
|
193
|
+
@include gl-my-n1;
|
|
196
194
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
2
|
<script>
|
|
3
3
|
import { BBadge } from 'bootstrap-vue';
|
|
4
|
-
import {
|
|
5
|
-
badgeSizeOptions,
|
|
6
|
-
badgeVariantOptions,
|
|
7
|
-
badgeIconSizeOptions,
|
|
8
|
-
} from '../../../utils/constants';
|
|
4
|
+
import { badgeVariantOptions, badgeIconSizeOptions } from '../../../utils/constants';
|
|
9
5
|
import GlIcon from '../icon/icon.vue';
|
|
10
6
|
|
|
11
7
|
export default {
|
|
@@ -16,17 +12,6 @@ export default {
|
|
|
16
12
|
},
|
|
17
13
|
inheritAttrs: false,
|
|
18
14
|
props: {
|
|
19
|
-
/**
|
|
20
|
-
* The size of the badge.
|
|
21
|
-
*/
|
|
22
|
-
size: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: badgeSizeOptions.md,
|
|
25
|
-
validator(value) {
|
|
26
|
-
return badgeSizeOptions[value] !== undefined;
|
|
27
|
-
},
|
|
28
|
-
required: false,
|
|
29
|
-
},
|
|
30
15
|
/**
|
|
31
16
|
* The variant of the badge.
|
|
32
17
|
*/
|
|
@@ -61,6 +46,9 @@ export default {
|
|
|
61
46
|
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
62
47
|
return Boolean(this.icon && Object.keys(this.$slots).length === 0);
|
|
63
48
|
},
|
|
49
|
+
isCircularIcon() {
|
|
50
|
+
return ['issue-open-m', 'issue-close'].includes(this.icon);
|
|
51
|
+
},
|
|
64
52
|
role() {
|
|
65
53
|
return this.hasIconOnly ? 'img' : undefined;
|
|
66
54
|
},
|
|
@@ -82,7 +70,8 @@ export default {
|
|
|
82
70
|
<b-badge
|
|
83
71
|
v-bind="$attrs"
|
|
84
72
|
:variant="variant"
|
|
85
|
-
|
|
73
|
+
class="gl-badge"
|
|
74
|
+
:class="{ 'gl-px-2!': !$scopedSlots.default }"
|
|
86
75
|
:role="role"
|
|
87
76
|
:aria-label="ariaLabel"
|
|
88
77
|
pill
|
|
@@ -91,7 +80,7 @@ export default {
|
|
|
91
80
|
v-if="icon"
|
|
92
81
|
class="gl-badge-icon"
|
|
93
82
|
:size="iconSizeComputed"
|
|
94
|
-
:class="{ 'gl-
|
|
83
|
+
:class="{ '-gl-ml-2 gl-ml-n2': isCircularIcon }"
|
|
95
84
|
:name="icon"
|
|
96
85
|
/>
|
|
97
86
|
<!-- @slot The badge content to display. -->
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
$label-max-width: 100%;
|
|
2
2
|
$label-close-button: '.gl-label-close.gl-button';
|
|
3
|
+
$label-padding-horizontal: 0.75 * $grid-size;
|
|
4
|
+
$label-padding-horizontal-half: 0.375 * $grid-size;
|
|
3
5
|
|
|
4
6
|
.gl-label {
|
|
5
7
|
@include gl-align-items-center;
|
|
@@ -45,7 +47,7 @@ $label-close-button: '.gl-label-close.gl-button';
|
|
|
45
47
|
.gl-label-text,
|
|
46
48
|
.gl-label-text-scoped {
|
|
47
49
|
@include gl-display-block;
|
|
48
|
-
padding: $gl-spacing-scale-1
|
|
50
|
+
padding: $gl-spacing-scale-1 $label-padding-horizontal;
|
|
49
51
|
@include str-truncated($label-max-width);
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -54,8 +56,8 @@ $label-close-button: '.gl-label-close.gl-button';
|
|
|
54
56
|
@include gl-display-flex;
|
|
55
57
|
width: px-to-rem(14px);
|
|
56
58
|
height: px-to-rem(14px);
|
|
57
|
-
margin-left:
|
|
58
|
-
margin-right:
|
|
59
|
+
margin-left: -$label-padding-horizontal-half;
|
|
60
|
+
margin-right: $label-padding-horizontal-half;
|
|
59
61
|
@include gl-p-0;
|
|
60
62
|
@include gl-rounded-full;
|
|
61
63
|
@include gl-shadow-none;
|
|
@@ -152,7 +154,7 @@ $label-close-button: '.gl-label-close.gl-button';
|
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
#{$label-close-button} {
|
|
155
|
-
margin-left: #{-$
|
|
157
|
+
margin-left: #{-$label-padding-horizontal};
|
|
156
158
|
|
|
157
159
|
&:focus,
|
|
158
160
|
&:hover {
|
|
@@ -172,7 +174,7 @@ $label-close-button: '.gl-label-close.gl-button';
|
|
|
172
174
|
|
|
173
175
|
.gl-label-text-scoped {
|
|
174
176
|
@include gl-text-gray-950;
|
|
175
|
-
padding-left:
|
|
177
|
+
padding-left: $gl-spacing-scale-2;
|
|
176
178
|
padding-right: $gl-spacing-scale-3;
|
|
177
179
|
}
|
|
178
180
|
}
|
|
@@ -27,6 +27,7 @@ export const i18n = {
|
|
|
27
27
|
CHAT_PROMPT_PLACEHOLDER_DEFAULT: 'GitLab Duo Chat',
|
|
28
28
|
CHAT_PROMPT_PLACEHOLDER_WITH_COMMANDS: 'Type "/" for slash commands',
|
|
29
29
|
CHAT_SUBMIT_LABEL: 'Send chat message.',
|
|
30
|
+
CHAT_CANCEL_LABEL: 'Cancel',
|
|
30
31
|
CHAT_LEGAL_DISCLAIMER:
|
|
31
32
|
"May provide inappropriate responses not representative of GitLab's views. Do not input personal data.",
|
|
32
33
|
CHAT_DEFAULT_PREDEFINED_PROMPTS: [
|
|
@@ -188,6 +189,7 @@ export default {
|
|
|
188
189
|
prompt: '',
|
|
189
190
|
scrolledToBottom: true,
|
|
190
191
|
activeCommandIndex: 0,
|
|
192
|
+
displaySubmitButton: true,
|
|
191
193
|
};
|
|
192
194
|
},
|
|
193
195
|
computed: {
|
|
@@ -213,7 +215,7 @@ export default {
|
|
|
213
215
|
);
|
|
214
216
|
},
|
|
215
217
|
lastMessage() {
|
|
216
|
-
return this.messages[this.messages.length - 1];
|
|
218
|
+
return this.messages?.[this.messages.length - 1];
|
|
217
219
|
},
|
|
218
220
|
resetDisabled() {
|
|
219
221
|
if (this.isLoading || !this.hasMessages) {
|
|
@@ -221,9 +223,6 @@ export default {
|
|
|
221
223
|
}
|
|
222
224
|
return this.lastMessage?.content === CHAT_RESET_MESSAGE;
|
|
223
225
|
},
|
|
224
|
-
submitDisabled() {
|
|
225
|
-
return this.isLoading || this.isStreaming;
|
|
226
|
-
},
|
|
227
226
|
isStreaming() {
|
|
228
227
|
return Boolean(
|
|
229
228
|
(this.lastMessage?.chunks?.length > 0 && !this.lastMessage?.content) ||
|
|
@@ -256,10 +255,18 @@ export default {
|
|
|
256
255
|
},
|
|
257
256
|
},
|
|
258
257
|
watch: {
|
|
259
|
-
isLoading() {
|
|
258
|
+
isLoading(newVal) {
|
|
259
|
+
if (!newVal && !this.isStreaming) {
|
|
260
|
+
this.displaySubmitButton = true; // Re-enable submit button when loading stops
|
|
261
|
+
}
|
|
260
262
|
this.isHidden = false;
|
|
261
263
|
this.scrollToBottom();
|
|
262
264
|
},
|
|
265
|
+
isStreaming(newVal) {
|
|
266
|
+
if (!newVal && !this.isLoading) {
|
|
267
|
+
this.displaySubmitButton = true; // Re-enable submit button when streaming stops
|
|
268
|
+
}
|
|
269
|
+
},
|
|
263
270
|
},
|
|
264
271
|
created() {
|
|
265
272
|
this.handleScrollingTrottled = throttle(this.handleScrolling, 200); // Assume a 200ms throttle for example
|
|
@@ -275,8 +282,17 @@ export default {
|
|
|
275
282
|
*/
|
|
276
283
|
this.$emit('chat-hidden');
|
|
277
284
|
},
|
|
285
|
+
cancelPrompt() {
|
|
286
|
+
/**
|
|
287
|
+
* Emitted when user clicks the stop button in the textarea
|
|
288
|
+
*/
|
|
289
|
+
|
|
290
|
+
this.displaySubmitButton = true;
|
|
291
|
+
this.$emit('chat-cancel');
|
|
292
|
+
this.setPromptAndFocus();
|
|
293
|
+
},
|
|
278
294
|
sendChatPrompt() {
|
|
279
|
-
if (this.
|
|
295
|
+
if (!this.displaySubmitButton) {
|
|
280
296
|
return;
|
|
281
297
|
}
|
|
282
298
|
if (this.prompt) {
|
|
@@ -289,6 +305,7 @@ export default {
|
|
|
289
305
|
* @param {String} prompt The user prompt to send.
|
|
290
306
|
*/
|
|
291
307
|
this.$emit('send-chat-prompt', this.prompt.trim());
|
|
308
|
+
this.displaySubmitButton = false;
|
|
292
309
|
this.setPromptAndFocus();
|
|
293
310
|
}
|
|
294
311
|
},
|
|
@@ -517,6 +534,7 @@ export default {
|
|
|
517
534
|
</div>
|
|
518
535
|
<template #append>
|
|
519
536
|
<gl-button
|
|
537
|
+
v-if="displaySubmitButton"
|
|
520
538
|
icon="paper-airplane"
|
|
521
539
|
category="primary"
|
|
522
540
|
variant="confirm"
|
|
@@ -524,7 +542,16 @@ export default {
|
|
|
524
542
|
type="submit"
|
|
525
543
|
data-testid="chat-prompt-submit-button"
|
|
526
544
|
:aria-label="$options.i18n.CHAT_SUBMIT_LABEL"
|
|
527
|
-
|
|
545
|
+
/>
|
|
546
|
+
<gl-button
|
|
547
|
+
v-else
|
|
548
|
+
icon="stop"
|
|
549
|
+
category="primary"
|
|
550
|
+
variant="default"
|
|
551
|
+
class="!gl-absolute gl-bottom-2 gl-right-2 gl-rounded-base!"
|
|
552
|
+
data-testid="chat-prompt-cancel-button"
|
|
553
|
+
:aria-label="$options.i18n.CHAT_CANCEL_LABEL"
|
|
554
|
+
@click="cancelPrompt"
|
|
528
555
|
/>
|
|
529
556
|
</template>
|
|
530
557
|
</gl-form-input-group>
|
|
@@ -80,7 +80,7 @@ export default {
|
|
|
80
80
|
</script>
|
|
81
81
|
|
|
82
82
|
<template>
|
|
83
|
-
<gl-badge :id="triggerId" class="gl-mx-4 gl-hover-cursor-pointer" variant="neutral"
|
|
83
|
+
<gl-badge :id="triggerId" class="gl-mx-4 gl-hover-cursor-pointer" variant="neutral">
|
|
84
84
|
<span>{{ activeType.BADGE }}</span>
|
|
85
85
|
<gl-popover
|
|
86
86
|
triggers="click"
|
|
@@ -142,7 +142,7 @@ export default {
|
|
|
142
142
|
<code class="gl-font-base gl-text-strong">
|
|
143
143
|
{{ name }}
|
|
144
144
|
</code>
|
|
145
|
-
<gl-badge v-if="deprecated"
|
|
145
|
+
<gl-badge v-if="deprecated" variant="danger">Deprecated</gl-badge>
|
|
146
146
|
<div v-if="description" class="gl-mt-3 gl-text-subtle">
|
|
147
147
|
{{ description }}
|
|
148
148
|
</div>
|