@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
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
# [84.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v83.0.0...v84.0.0) (2024-06-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlBadge:** One size fits all ([91f2129](https://gitlab.com/gitlab-org/gitlab-ui/commit/91f2129ed2fef3eb47c48cce2a5af1a38844f280))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* **GlBadge:** The `size` prop has been removed from `GlBadge`. This
|
|
12
|
+
might affect test which check that the prop was provided, but more
|
|
13
|
+
importantly this could affect layout for badges which were set small or
|
|
14
|
+
large.
|
|
15
|
+
|
|
16
|
+
# [83.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v82.1.0...v83.0.0) (2024-06-21)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **DuoChat:** add propmpt abort functionality ([3792308](https://gitlab.com/gitlab-org/gitlab-ui/commit/3792308a7c086e9e3588a0793be10d41473f473f))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### BREAKING CHANGES
|
|
25
|
+
|
|
26
|
+
* **DuoChat:** This commit adds an abort button to the
|
|
27
|
+
DuoChat textarea, it also introduces the
|
|
28
|
+
chat-abort event that can be caught
|
|
29
|
+
by the client.
|
|
30
|
+
|
|
1
31
|
# [82.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v82.0.1...v82.1.0) (2024-06-20)
|
|
2
32
|
|
|
3
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BBadge } from 'bootstrap-vue/esm/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { badgeVariantOptions, badgeIconSizeOptions } from '../../../utils/constants';
|
|
3
3
|
import GlIcon from '../icon/icon';
|
|
4
4
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
5
|
|
|
@@ -12,17 +12,6 @@ var script = {
|
|
|
12
12
|
},
|
|
13
13
|
inheritAttrs: false,
|
|
14
14
|
props: {
|
|
15
|
-
/**
|
|
16
|
-
* The size of the badge.
|
|
17
|
-
*/
|
|
18
|
-
size: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: badgeSizeOptions.md,
|
|
21
|
-
validator(value) {
|
|
22
|
-
return badgeSizeOptions[value] !== undefined;
|
|
23
|
-
},
|
|
24
|
-
required: false
|
|
25
|
-
},
|
|
26
15
|
/**
|
|
27
16
|
* The variant of the badge.
|
|
28
17
|
*/
|
|
@@ -57,6 +46,9 @@ var script = {
|
|
|
57
46
|
// eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
|
|
58
47
|
return Boolean(this.icon && Object.keys(this.$slots).length === 0);
|
|
59
48
|
},
|
|
49
|
+
isCircularIcon() {
|
|
50
|
+
return ['issue-open-m', 'issue-close'].includes(this.icon);
|
|
51
|
+
},
|
|
60
52
|
role() {
|
|
61
53
|
return this.hasIconOnly ? 'img' : undefined;
|
|
62
54
|
},
|
|
@@ -76,7 +68,7 @@ var script = {
|
|
|
76
68
|
const __vue_script__ = script;
|
|
77
69
|
|
|
78
70
|
/* template */
|
|
79
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-badge',_vm._b({class:
|
|
71
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-badge',_vm._b({staticClass:"gl-badge",class:{ 'gl-px-2!': !_vm.$scopedSlots.default },attrs:{"variant":_vm.variant,"role":_vm.role,"aria-label":_vm.ariaLabel,"pill":""}},'b-badge',_vm.$attrs,false),[(_vm.icon)?_c('gl-icon',{staticClass:"gl-badge-icon",class:{ '-gl-ml-2 gl-ml-n2': _vm.isCircularIcon },attrs:{"size":_vm.iconSizeComputed,"name":_vm.icon}}):_vm._e(),_vm._v(" "),_vm._t("default")],2)};
|
|
80
72
|
var __vue_staticRenderFns__ = [];
|
|
81
73
|
|
|
82
74
|
/* style */
|
|
@@ -27,6 +27,7 @@ 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: "May provide inappropriate responses not representative of GitLab's views. Do not input personal data.",
|
|
31
32
|
CHAT_DEFAULT_PREDEFINED_PROMPTS: ['How do I change my password in GitLab?', 'How do I fork a project?', 'How do I clone a repository?', 'How do I create a template?']
|
|
32
33
|
};
|
|
@@ -179,7 +180,8 @@ var script = {
|
|
|
179
180
|
isHidden: false,
|
|
180
181
|
prompt: '',
|
|
181
182
|
scrolledToBottom: true,
|
|
182
|
-
activeCommandIndex: 0
|
|
183
|
+
activeCommandIndex: 0,
|
|
184
|
+
displaySubmitButton: true
|
|
183
185
|
};
|
|
184
186
|
},
|
|
185
187
|
computed: {
|
|
@@ -202,7 +204,8 @@ var script = {
|
|
|
202
204
|
}, [[]]);
|
|
203
205
|
},
|
|
204
206
|
lastMessage() {
|
|
205
|
-
|
|
207
|
+
var _this$messages2;
|
|
208
|
+
return (_this$messages2 = this.messages) === null || _this$messages2 === void 0 ? void 0 : _this$messages2[this.messages.length - 1];
|
|
206
209
|
},
|
|
207
210
|
resetDisabled() {
|
|
208
211
|
var _this$lastMessage;
|
|
@@ -211,9 +214,6 @@ var script = {
|
|
|
211
214
|
}
|
|
212
215
|
return ((_this$lastMessage = this.lastMessage) === null || _this$lastMessage === void 0 ? void 0 : _this$lastMessage.content) === CHAT_RESET_MESSAGE;
|
|
213
216
|
},
|
|
214
|
-
submitDisabled() {
|
|
215
|
-
return this.isLoading || this.isStreaming;
|
|
216
|
-
},
|
|
217
217
|
isStreaming() {
|
|
218
218
|
var _this$lastMessage2, _this$lastMessage2$ch, _this$lastMessage3, _this$lastMessage4;
|
|
219
219
|
return Boolean(((_this$lastMessage2 = this.lastMessage) === null || _this$lastMessage2 === void 0 ? void 0 : (_this$lastMessage2$ch = _this$lastMessage2.chunks) === null || _this$lastMessage2$ch === void 0 ? void 0 : _this$lastMessage2$ch.length) > 0 && !((_this$lastMessage3 = this.lastMessage) !== null && _this$lastMessage3 !== void 0 && _this$lastMessage3.content) || typeof ((_this$lastMessage4 = this.lastMessage) === null || _this$lastMessage4 === void 0 ? void 0 : _this$lastMessage4.chunkId) === 'number');
|
|
@@ -237,9 +237,17 @@ var script = {
|
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
239
|
watch: {
|
|
240
|
-
isLoading() {
|
|
240
|
+
isLoading(newVal) {
|
|
241
|
+
if (!newVal && !this.isStreaming) {
|
|
242
|
+
this.displaySubmitButton = true; // Re-enable submit button when loading stops
|
|
243
|
+
}
|
|
241
244
|
this.isHidden = false;
|
|
242
245
|
this.scrollToBottom();
|
|
246
|
+
},
|
|
247
|
+
isStreaming(newVal) {
|
|
248
|
+
if (!newVal && !this.isLoading) {
|
|
249
|
+
this.displaySubmitButton = true; // Re-enable submit button when streaming stops
|
|
250
|
+
}
|
|
243
251
|
}
|
|
244
252
|
},
|
|
245
253
|
created() {
|
|
@@ -256,8 +264,17 @@ var script = {
|
|
|
256
264
|
*/
|
|
257
265
|
this.$emit('chat-hidden');
|
|
258
266
|
},
|
|
267
|
+
cancelPrompt() {
|
|
268
|
+
/**
|
|
269
|
+
* Emitted when user clicks the stop button in the textarea
|
|
270
|
+
*/
|
|
271
|
+
|
|
272
|
+
this.displaySubmitButton = true;
|
|
273
|
+
this.$emit('chat-cancel');
|
|
274
|
+
this.setPromptAndFocus();
|
|
275
|
+
},
|
|
259
276
|
sendChatPrompt() {
|
|
260
|
-
if (this.
|
|
277
|
+
if (!this.displaySubmitButton) {
|
|
261
278
|
return;
|
|
262
279
|
}
|
|
263
280
|
if (this.prompt) {
|
|
@@ -270,6 +287,7 @@ var script = {
|
|
|
270
287
|
* @param {String} prompt The user prompt to send.
|
|
271
288
|
*/
|
|
272
289
|
this.$emit('send-chat-prompt', this.prompt.trim());
|
|
290
|
+
this.displaySubmitButton = false;
|
|
273
291
|
this.setPromptAndFocus();
|
|
274
292
|
}
|
|
275
293
|
},
|
|
@@ -364,7 +382,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
|
|
|
364
382
|
{
|
|
365
383
|
'gl-h-full': !_vm.hasMessages,
|
|
366
384
|
'force-scroll-bar': _vm.hasMessages,
|
|
367
|
-
} ],attrs:{"tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('gl-duo-chat-conversation',{key:("conversation-" + index),attrs:{"messages":conversation,"show-delimiter":index > 0},on:{"track-feedback":_vm.onTrackFeedback}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('gl-empty-state',{key:"empty-state",staticClass:"gl-flex-grow gl-justify-content-center",attrs:{"svg-path":_vm.$options.emptySvg,"svg-height":145,"title":_vm.emptyStateTitle,"description":_vm.emptyStateDescription}}),_vm._v(" "),_c('gl-duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('gl-duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable)?_c('footer',{staticClass:"duo-chat-drawer-footer duo-chat-drawer-footer-sticky gl-p-5 gl-border-t gl-bg-gray-10",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 gl-rounded-base!",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL,"
|
|
385
|
+
} ],attrs:{"tag":"section","name":"message"}},[_vm._l((_vm.conversations),function(conversation,index){return _c('gl-duo-chat-conversation',{key:("conversation-" + index),attrs:{"messages":conversation,"show-delimiter":index > 0},on:{"track-feedback":_vm.onTrackFeedback}})}),_vm._v(" "),(!_vm.hasMessages && !_vm.isLoading)?[_c('gl-empty-state',{key:"empty-state",staticClass:"gl-flex-grow gl-justify-content-center",attrs:{"svg-path":_vm.$options.emptySvg,"svg-height":145,"title":_vm.emptyStateTitle,"description":_vm.emptyStateDescription}}),_vm._v(" "),_c('gl-duo-chat-predefined-prompts',{key:"predefined-prompts",attrs:{"prompts":_vm.predefinedPrompts},on:{"click":_vm.sendPredefinedPrompt}})]:_vm._e(),_vm._v(" "),(_vm.isLoading)?_c('gl-duo-chat-loader',{key:"loader",attrs:{"tool-name":_vm.toolName}}):_vm._e(),_vm._v(" "),_c('div',{key:"anchor",ref:"anchor",staticClass:"scroll-anchor"})],2)],1),_vm._v(" "),(_vm.isChatAvailable)?_c('footer',{staticClass:"duo-chat-drawer-footer duo-chat-drawer-footer-sticky gl-p-5 gl-border-t gl-bg-gray-10",class:{ 'duo-chat-drawer-body-scrim-on-footer': !_vm.scrolledToBottom },attrs:{"data-testid":"chat-footer"}},[_c('gl-form',{attrs:{"data-testid":"chat-prompt-form"},on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return _vm.sendChatPrompt.apply(null, arguments)}}},[_c('gl-form-input-group',{scopedSlots:_vm._u([{key:"append",fn:function(){return [(_vm.displaySubmitButton)?_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 gl-rounded-base!",attrs:{"icon":"paper-airplane","category":"primary","variant":"confirm","type":"submit","data-testid":"chat-prompt-submit-button","aria-label":_vm.$options.i18n.CHAT_SUBMIT_LABEL}}):_c('gl-button',{staticClass:"!gl-absolute gl-bottom-2 gl-right-2 gl-rounded-base!",attrs:{"icon":"stop","category":"primary","variant":"default","data-testid":"chat-prompt-cancel-button","aria-label":_vm.$options.i18n.CHAT_CANCEL_LABEL},on:{"click":_vm.cancelPrompt}})]},proxy:true}],null,false,2711323372)},[_c('div',{staticClass:"duo-chat-input gl-flex-grow-1 gl-vertical-align-top gl-max-w-full gl-min-h-8 gl-inset-border-1-gray-400 gl-rounded-base gl-bg-white",attrs:{"data-value":_vm.prompt}},[(_vm.shouldShowSlashCommands)?_c('gl-card',{ref:"commands",staticClass:"slash-commands !gl-absolute gl-translate-y-n100 gl-list-style-none gl-pl-0 gl-w-full gl-shadow-md",attrs:{"body-class":"gl-p-2!"}},_vm._l((_vm.filteredSlashCommands),function(command,index){return _c('gl-dropdown-item',{key:command.name,class:{ 'active-command': index === _vm.activeCommandIndex },on:{"click":function($event){return _vm.selectSlashCommand(index)}},nativeOn:{"mouseenter":function($event){_vm.activeCommandIndex = index;}}},[_c('span',{staticClass:"gl-display-flex gl-justify-content-space-between"},[_c('span',{staticClass:"gl-display-block"},[_vm._v(_vm._s(command.name))]),_vm._v(" "),_c('small',{staticClass:"gl-text-gray-500 gl-font-style-italic gl-text-right gl-pl-3"},[_vm._v(_vm._s(command.description))])])])}),1):_vm._e(),_vm._v(" "),_c('gl-form-textarea',{ref:"prompt",staticClass:"gl-absolute gl-h-full! gl-py-4! gl-bg-transparent! gl-rounded-top-right-none gl-rounded-bottom-right-none gl-shadow-none!",class:{ 'gl-text-truncate': !_vm.prompt },attrs:{"data-testid":"chat-prompt-input","placeholder":_vm.inputPlaceholder,"autofocus":""},nativeOn:{"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }if($event.ctrlKey||$event.shiftKey||$event.altKey||$event.metaKey){ return null; }$event.preventDefault();},"keyup":function($event){return _vm.onInputKeyup.apply(null, arguments)}},model:{value:(_vm.prompt),callback:function ($$v) {_vm.prompt=$$v;},expression:"prompt"}})],1)]),_vm._v(" "),_c('gl-form-text',{staticClass:"gl-text-gray-400 gl-line-height-20 gl-mt-3",attrs:{"data-testid":"chat-legal-disclaimer"}},[_vm._v(_vm._s(_vm.$options.i18n.CHAT_LEGAL_DISCLAIMER))])],1)],1):_vm._e()]):_vm._e()};
|
|
368
386
|
var __vue_staticRenderFns__ = [];
|
|
369
387
|
|
|
370
388
|
/* style */
|
|
@@ -69,7 +69,7 @@ var script = {
|
|
|
69
69
|
const __vue_script__ = script;
|
|
70
70
|
|
|
71
71
|
/* template */
|
|
72
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-badge',{staticClass:"gl-mx-4 gl-hover-cursor-pointer",attrs:{"id":_vm.triggerId,"variant":"neutral"
|
|
72
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-badge',{staticClass:"gl-mx-4 gl-hover-cursor-pointer",attrs:{"id":_vm.triggerId,"variant":"neutral"}},[_c('span',[_vm._v(_vm._s(_vm.activeType.BADGE))]),_vm._v(" "),_c('gl-popover',{attrs:{"triggers":"click","show-close-button":"","placement":_vm.popoverPlacement,"target":_vm.triggerId,"css-classes":['gl-z-index-9999!'],"title":_vm.activeType.POPOVER_TITLE}},[_c('gl-sprintf',{attrs:{"message":_vm.activeType.POPOVER_CONTENT},scopedSlots:_vm._u([{key:"link",fn:function(ref){
|
|
73
73
|
var content = ref.content;
|
|
74
74
|
return [(_vm.helpPageUrl)?_c('gl-link',{staticClass:"gl-font-sm!",attrs:{"href":_vm.helpPageUrl,"target":"_blank"}},[_vm._v("\n "+_vm._s(content)+"\n ")]):_c('span',[_vm._v(_vm._s(content))])]}},{key:"bullets",fn:function(){return [_c('ul',{staticClass:"gl-mb-0 gl-pl-5"},_vm._l((_vm.activeType.POPOVER_BULLETS),function(item,i){return _c('li',{key:("li-" + i)},[_vm._v("\n "+_vm._s(item)+"\n ")])}),0)]},proxy:true},{key:"line-break",fn:function(ref){
|
|
75
75
|
var content = ref.content;
|