@gitlab/ui 91.12.0 → 91.14.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/base/form/form_date/form_date.js +2 -2
  3. package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +81 -0
  4. package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.js +10 -5
  5. package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +19 -15
  6. package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +5 -5
  7. package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +4 -1
  8. package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +9 -1
  9. package/dist/index.css +1 -1
  10. package/dist/index.css.map +1 -1
  11. package/dist/tailwind.css +1 -1
  12. package/dist/tailwind.css.map +1 -1
  13. package/dist/tokens/build/js/tokens.dark.js +4 -1
  14. package/dist/tokens/build/js/tokens.js +4 -1
  15. package/dist/tokens/css/tokens.css +3 -0
  16. package/dist/tokens/css/tokens.dark.css +3 -0
  17. package/dist/tokens/js/tokens.dark.js +3 -0
  18. package/dist/tokens/js/tokens.js +3 -0
  19. package/dist/tokens/json/tokens.dark.json +63 -0
  20. package/dist/tokens/json/tokens.json +63 -0
  21. package/dist/tokens/scss/_tokens.dark.scss +3 -0
  22. package/dist/tokens/scss/_tokens.scss +3 -0
  23. package/dist/tokens/scss/_tokens_custom_properties.scss +3 -0
  24. package/dist/tokens/tailwind/tokens.cjs +3 -0
  25. package/package.json +5 -5
  26. package/src/components/base/form/form_character_count/form_character_count.md +2 -2
  27. package/src/components/base/form/form_character_count/form_character_count.vue +2 -2
  28. package/src/components/base/form/form_date/form_date.vue +2 -2
  29. package/src/components/base/form/form_textarea/form_textarea.vue +2 -2
  30. package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +71 -0
  31. package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.vue +19 -12
  32. package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +24 -20
  33. package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +12 -12
  34. package/src/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +4 -0
  35. package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +12 -0
  36. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +2 -2
  37. package/src/tokens/background.tokens.json +13 -0
  38. package/src/tokens/border.tokens.json +8 -0
  39. package/src/tokens/build/css/tokens.css +3 -0
  40. package/src/tokens/build/css/tokens.dark.css +3 -0
  41. package/src/tokens/build/js/tokens.dark.js +3 -0
  42. package/src/tokens/build/js/tokens.js +3 -0
  43. package/src/tokens/build/json/tokens.dark.json +63 -0
  44. package/src/tokens/build/json/tokens.json +63 -0
  45. package/src/tokens/build/scss/_tokens.dark.scss +3 -0
  46. package/src/tokens/build/scss/_tokens.scss +3 -0
  47. package/src/tokens/build/scss/_tokens_custom_properties.scss +3 -0
  48. package/src/tokens/build/tailwind/tokens.cjs +3 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [91.14.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.13.0...v91.14.0) (2024-09-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * add duo chat context menu search item styling ([1b97743](https://gitlab.com/gitlab-org/gitlab-ui/commit/1b977438f4566fc24e51cab05b3b5dd3553cc61a))
7
+
8
+ # [91.13.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.12.0...v91.13.0) (2024-09-06)
9
+
10
+
11
+ ### Features
12
+
13
+ * **DesignTokens:** add overlap and section design tokens ([f6ebeec](https://gitlab.com/gitlab-org/gitlab-ui/commit/f6ebeec8558401a724ddc98a2ec483f840943127))
14
+ * **DuoChat:** Adjust right alignment of copy code and insert code ([aba2397](https://gitlab.com/gitlab-org/gitlab-ui/commit/aba23970cebfa7cf5279daa9a9890c2920d8e161))
15
+
1
16
  # [91.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.11.0...v91.12.0) (2024-09-06)
2
17
 
3
18
 
@@ -31,12 +31,12 @@ var script = {
31
31
  minInvalidFeedback: {
32
32
  type: String,
33
33
  required: false,
34
- default: 'Must be after minimum date'
34
+ default: 'Must be after minimum date.'
35
35
  },
36
36
  maxInvalidFeedback: {
37
37
  type: String,
38
38
  required: false,
39
- default: 'Must be before maximum date'
39
+ default: 'Must be before maximum date.'
40
40
  },
41
41
  value: {
42
42
  type: String,
@@ -0,0 +1,81 @@
1
+ import GlDuoChatContextItemPopover from '../duo_chat_context_item_popover/duo_chat_context_item_popover';
2
+ import GlIcon from '../../../../../../base/icon/icon';
3
+ import { categoryValidator, contextItemValidator, formatMergeRequestId, formatIssueId } from '../utils';
4
+ import { CONTEXT_ITEM_TYPE_MERGE_REQUEST, CONTEXT_ITEM_TYPE_ISSUE, CONTEXT_ITEM_TYPE_PROJECT_FILE } from '../constants';
5
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
+
7
+ var script = {
8
+ name: 'GlDuoChatContextItemMenuSearchItem',
9
+ components: {
10
+ GlIcon,
11
+ GlDuoChatContextItemPopover
12
+ },
13
+ props: {
14
+ category: {
15
+ type: Object,
16
+ required: true,
17
+ validator: categoryValidator
18
+ },
19
+ contextItem: {
20
+ type: Object,
21
+ required: true,
22
+ validator: contextItemValidator
23
+ }
24
+ },
25
+ computed: {
26
+ title() {
27
+ var _this$contextItem$met;
28
+ return ((_this$contextItem$met = this.contextItem.metadata) === null || _this$contextItem$met === void 0 ? void 0 : _this$contextItem$met.name) || '';
29
+ },
30
+ secondaryText() {
31
+ switch (this.category.value) {
32
+ case CONTEXT_ITEM_TYPE_PROJECT_FILE:
33
+ return this.contextItem.metadata.info.relFilePath;
34
+ case CONTEXT_ITEM_TYPE_ISSUE:
35
+ return formatIssueId(this.contextItem.metadata.info.iid);
36
+ case CONTEXT_ITEM_TYPE_MERGE_REQUEST:
37
+ return formatMergeRequestId(this.contextItem.metadata.info.iid);
38
+ default:
39
+ return '';
40
+ }
41
+ }
42
+ }
43
+ };
44
+
45
+ /* script */
46
+ const __vue_script__ = script;
47
+
48
+ /* template */
49
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-flex gl-flex-col"},[_c('div',{staticClass:"gl-flex gl-items-center"},[_c('gl-icon',{staticClass:"gl-mr-2 gl-shrink-0",attrs:{"name":_vm.category.icon,"data-testid":"category-icon"}}),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.title))]),_vm._v(" "),_c('gl-icon',{staticClass:"gl-ml-2 gl-shrink-0 gl-cursor-pointer gl-text-secondary",attrs:{"id":("info-icon-" + (_vm.contextItem.id)),"name":"information-o","size":12}}),_vm._v(" "),_c('gl-duo-chat-context-item-popover',{attrs:{"context-item":_vm.contextItem,"target":("info-icon-" + (_vm.contextItem.id)),"placement":"left"}})],1),_vm._v(" "),_c('div',{staticClass:"gl-mt-1 gl-shrink-0 gl-whitespace-nowrap gl-text-secondary"},[_vm._v("\n "+_vm._s(_vm.secondaryText)+"\n ")])])};
50
+ var __vue_staticRenderFns__ = [];
51
+
52
+ /* style */
53
+ const __vue_inject_styles__ = undefined;
54
+ /* scoped */
55
+ const __vue_scope_id__ = undefined;
56
+ /* module identifier */
57
+ const __vue_module_identifier__ = undefined;
58
+ /* functional template */
59
+ const __vue_is_functional_template__ = false;
60
+ /* style inject */
61
+
62
+ /* style inject SSR */
63
+
64
+ /* style inject shadow dom */
65
+
66
+
67
+
68
+ const __vue_component__ = __vue_normalize__(
69
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
70
+ __vue_inject_styles__,
71
+ __vue_script__,
72
+ __vue_scope_id__,
73
+ __vue_is_functional_template__,
74
+ __vue_module_identifier__,
75
+ false,
76
+ undefined,
77
+ undefined,
78
+ undefined
79
+ );
80
+
81
+ export default __vue_component__;
@@ -4,15 +4,17 @@ import GlAlert from '../../../../../../base/alert/alert';
4
4
  import { sprintf, translate } from '../../../../../../../utils/i18n';
5
5
  import { categoryValidator, contextItemsValidator } from '../utils';
6
6
  import GlDuoChatContextItemMenuSearchItemsLoading from './duo_chat_context_item_menu_search_items_loading';
7
+ import GlDuoChatContextItemMenuSearchItem from './duo_chat_context_item_menu_search_item';
7
8
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
8
9
 
9
10
  var script = {
10
11
  name: 'GlDuoChatContextItemMenuSearchItems',
11
12
  components: {
12
13
  GlAlert,
13
- GlFormInput,
14
14
  GlDropdownItem,
15
- GlDuoChatContextItemMenuSearchItemsLoading
15
+ GlDuoChatContextItemMenuSearchItem,
16
+ GlDuoChatContextItemMenuSearchItemsLoading,
17
+ GlFormInput
16
18
  },
17
19
  model: {
18
20
  prop: 'searchQuery',
@@ -72,8 +74,8 @@ var script = {
72
74
  }
73
75
  },
74
76
  methods: {
75
- selectItem(item) {
76
- this.$emit('select', item);
77
+ selectItem(contextItem) {
78
+ this.$emit('select', contextItem);
77
79
  this.userInitiatedSearch = false;
78
80
  },
79
81
  setActiveIndex(index) {
@@ -92,7 +94,10 @@ var script = {
92
94
  const __vue_script__ = script;
93
95
 
94
96
  /* template */
95
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-max-h-31 gl-overflow-y-scroll"},[(_vm.loading)?_c('gl-duo-chat-context-item-menu-search-items-loading',{attrs:{"rows":_vm.numLoadingItems}}):(_vm.error)?_c('gl-alert',{staticClass:"gl-m-3",attrs:{"variant":"danger","dismissible":false,"data-testid":"search-results-error"}},[_vm._v("\n "+_vm._s(_vm.error)+"\n ")]):(_vm.showEmptyState)?_c('div',{staticClass:"gl-rounded-base gl-p-3 gl-text-center gl-text-secondary",attrs:{"data-testid":"search-results-empty-state"}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.emptyStateMessage)+"\n ")]):_c('ul',{staticClass:"gl-mb-1 gl-list-none gl-flex-row gl-pl-0"},_vm._l((_vm.results),function(item,index){return _c('gl-dropdown-item',{key:item.id,staticClass:"duo-chat-context-search-result-item",class:[{ 'active-command': index === _vm.activeIndex, disabled: !item.isEnabled }],attrs:{"id":("dropdown-item-" + index),"tabindex":!item.isEnabled ? -1 : undefined,"data-testid":"search-result-item"},on:{"click":function($event){return _vm.selectItem(item)}}},[_c('div',{on:{"mouseenter":function($event){return _vm.setActiveIndex(index)}}},[_c('div',{attrs:{"data-testid":"search-result-item-details"}},[_vm._v("\n "+_vm._s(item.metadata.name)+" "+_vm._s(item.isEnabled ? '' : '(disabled)')+"\n ")])])])}),1)],1),_vm._v(" "),_c('gl-form-input',{ref:"contextMenuSearchInput",attrs:{"value":_vm.searchQuery,"placeholder":_vm.searchInputPlaceholder,"autofocus":"","data-testid":"context-menu-search-input"},on:{"input":function($event){return _vm.$emit('update:searchQuery', $event)}}})],1)};
97
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-max-h-31 gl-overflow-y-scroll"},[(_vm.loading)?_c('gl-duo-chat-context-item-menu-search-items-loading',{attrs:{"rows":_vm.numLoadingItems}}):(_vm.error)?_c('gl-alert',{staticClass:"gl-m-3",attrs:{"variant":"danger","dismissible":false,"data-testid":"search-results-error"}},[_vm._v("\n "+_vm._s(_vm.error)+"\n ")]):(_vm.showEmptyState)?_c('div',{staticClass:"gl-rounded-base gl-p-3 gl-text-center gl-text-secondary",attrs:{"data-testid":"search-results-empty-state"}},[_vm._v("\n "+_vm._s(_vm.$options.i18n.emptyStateMessage)+"\n ")]):_c('ul',{staticClass:"gl-mb-1 gl-list-none gl-flex-row gl-pl-0"},_vm._l((_vm.results),function(contextItem,index){return _c('gl-dropdown-item',{key:contextItem.id,staticClass:"duo-chat-context-search-result-item",class:{
98
+ 'active-command': index === _vm.activeIndex,
99
+ 'gl-cursor-not-allowed [&>button]:focus-within:!gl-shadow-none': !contextItem.isEnabled,
100
+ },attrs:{"id":("dropdown-item-" + index),"tabindex":!contextItem.isEnabled ? -1 : undefined,"data-testid":"search-result-item"},on:{"click":function($event){return _vm.selectItem(contextItem)}}},[_c('div',{on:{"mouseenter":function($event){return _vm.setActiveIndex(index)}}},[_c('gl-duo-chat-context-item-menu-search-item',{class:{ 'gl-text-secondary': !contextItem.isEnabled },attrs:{"context-item":contextItem,"category":_vm.category,"data-testid":"search-result-item-details"}})],1)])}),1)],1),_vm._v(" "),_c('gl-form-input',{ref:"contextMenuSearchInput",attrs:{"value":_vm.searchQuery,"placeholder":_vm.searchInputPlaceholder,"autofocus":"","data-testid":"context-menu-search-input"},on:{"input":function($event){return _vm.$emit('update:searchQuery', $event)}}})],1)};
96
101
  var __vue_staticRenderFns__ = [];
97
102
 
98
103
  /* style */
@@ -1,12 +1,9 @@
1
1
  import GlPopover from '../../../../../../base/popover/popover';
2
2
  import { translate } from '../../../../../../../utils/i18n';
3
3
  import { CONTEXT_ITEM_TYPE_ISSUE, CONTEXT_ITEM_TYPE_MERGE_REQUEST, CONTEXT_ITEM_TYPE_PROJECT_FILE } from '../constants';
4
+ import { formatMergeRequestId, formatIssueId } from '../utils';
4
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
6
 
6
- const ID_PREFIXES = {
7
- issue: '#',
8
- merge_request: '!'
9
- };
10
7
  var script = {
11
8
  name: 'DuoChatContextItemPopover',
12
9
  components: {
@@ -14,9 +11,9 @@ var script = {
14
11
  },
15
12
  props: {
16
13
  /**
17
- * The context item to display in the popover.
14
+ * The context contextItem to display in the popover.
18
15
  */
19
- item: {
16
+ contextItem: {
20
17
  type: Object,
21
18
  required: true
22
19
  },
@@ -38,24 +35,31 @@ var script = {
38
35
  },
39
36
  computed: {
40
37
  itemInfo() {
41
- var _this$item$metadata;
42
- return ((_this$item$metadata = this.item.metadata) === null || _this$item$metadata === void 0 ? void 0 : _this$item$metadata.info) || {};
38
+ var _this$contextItem$met;
39
+ return ((_this$contextItem$met = this.contextItem.metadata) === null || _this$contextItem$met === void 0 ? void 0 : _this$contextItem$met.info) || {};
43
40
  },
44
41
  id() {
45
- const isIssuable = this.item.type === CONTEXT_ITEM_TYPE_ISSUE || this.item.type === CONTEXT_ITEM_TYPE_MERGE_REQUEST;
42
+ const isIssuable = this.contextItem.type === CONTEXT_ITEM_TYPE_ISSUE || this.contextItem.type === CONTEXT_ITEM_TYPE_MERGE_REQUEST;
46
43
  return isIssuable ? this.itemInfo.iid || '' : null;
47
44
  },
48
- idPrefix() {
49
- return ID_PREFIXES[this.item.type] || '';
45
+ formattedId() {
46
+ switch (this.contextItem.type) {
47
+ case CONTEXT_ITEM_TYPE_ISSUE:
48
+ return formatIssueId(this.id);
49
+ case CONTEXT_ITEM_TYPE_MERGE_REQUEST:
50
+ return formatMergeRequestId(this.id);
51
+ default:
52
+ return '';
53
+ }
50
54
  },
51
55
  filePath() {
52
- return this.item.type === CONTEXT_ITEM_TYPE_PROJECT_FILE ? this.itemInfo.relFilePath || '' : null;
56
+ return this.contextItem.type === CONTEXT_ITEM_TYPE_PROJECT_FILE ? this.itemInfo.relFilePath || '' : null;
53
57
  },
54
58
  isEnabled() {
55
- return this.item.isEnabled !== false;
59
+ return this.contextItem.isEnabled !== false;
56
60
  },
57
61
  disabledMessage() {
58
- return Array.isArray(this.item.disabledReasons) && this.item.disabledReasons.length > 0 ? this.item.disabledReasons.join(', ') : translate('DuoChatContextItemPopover.DisabledReason', 'This item is disabled');
62
+ return Array.isArray(this.contextItem.disabledReasons) && this.contextItem.disabledReasons.length > 0 ? this.contextItem.disabledReasons.join(', ') : translate('DuoChatContextItemPopover.DisabledReason', 'This item is disabled');
59
63
  }
60
64
  },
61
65
  methods: {
@@ -67,7 +71,7 @@ var script = {
67
71
  const __vue_script__ = script;
68
72
 
69
73
  /* template */
70
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-popover',{attrs:{"target":_vm.target,"triggers":"hover focus","placement":_vm.placement,"title":_vm.item.metadata.name,"custom-class":"gl-duo-chat-item-popover"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('span',{staticClass:"gl-text-sm gl-text-gray-500",attrs:{"data-testid":"chat-context-popover-title"}},[_vm._v(_vm._s(_vm.item.metadata.name))])]},proxy:true}])},[_vm._v(" "),_c('div',{staticClass:"gl-p-3"},[_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.ProjectLabel', 'Project:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.itemInfo.project))])]),_vm._v(" "),(_vm.filePath !== null)?_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.PathLabel', 'Path:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.filePath))])]):_vm._e(),_vm._v(" "),(_vm.id !== null)?_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.IdLabel', 'ID:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.idPrefix)+_vm._s(_vm.id))])]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.TypeLabel', 'Type:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.item.type))])]),_vm._v(" "),(!_vm.isEnabled)?_c('div',{staticClass:"gl-text-red-500",attrs:{"data-testid":"chat-context-popover-disabled"}},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.DisabledMessageLabel', 'Note:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.disabledMessage))])]):_vm._e()])])};
74
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-popover',{attrs:{"target":_vm.target,"triggers":"hover focus","placement":_vm.placement,"title":_vm.contextItem.metadata.name,"custom-class":"gl-duo-chat-item-popover"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('span',{staticClass:"gl-text-sm gl-text-gray-500",attrs:{"data-testid":"chat-context-popover-title"}},[_vm._v(_vm._s(_vm.contextItem.metadata.name))])]},proxy:true}])},[_vm._v(" "),_c('div',{staticClass:"gl-p-3"},[_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.ProjectLabel', 'Project:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.itemInfo.project))])]),_vm._v(" "),(_vm.filePath !== null)?_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.PathLabel', 'Path:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.filePath))])]):_vm._e(),_vm._v(" "),(_vm.id !== null)?_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.IdLabel', 'ID:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.formattedId))])]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-mb-2"},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.TypeLabel', 'Type:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.contextItem.type))])]),_vm._v(" "),(!_vm.isEnabled)?_c('div',{staticClass:"gl-text-red-500",attrs:{"data-testid":"chat-context-popover-disabled"}},[_c('strong',{staticClass:"gl-mr-1"},[_vm._v(_vm._s(_vm.translate('DuoChatContextItemPopover.DisabledMessageLabel', 'Note:')))]),_vm._v(" "),_c('span',[_vm._v(_vm._s(_vm.disabledMessage))])]):_vm._e()])])};
71
75
  var __vue_staticRenderFns__ = [];
72
76
 
73
77
  /* style */
@@ -68,12 +68,12 @@ var script = {
68
68
  toggleCollapse() {
69
69
  this.isCollapsed = !this.isCollapsed;
70
70
  },
71
- onRemoveItem(item) {
71
+ onRemoveItem(contextItem) {
72
72
  /**
73
- * Emitted when a context item should be removed.
74
- * @property {Object} item - The context item to be removed
73
+ * Emitted when a context contextItem should be removed.
74
+ * @property {Object} item - The context contextItem to be removed
75
75
  */
76
- this.$emit('remove', item);
76
+ this.$emit('remove', contextItem);
77
77
  }
78
78
  }
79
79
  };
@@ -82,7 +82,7 @@ var script = {
82
82
  const __vue_script__ = script;
83
83
 
84
84
  /* template */
85
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mb-3 gl-flex gl-flex-col"},[_c('button',{staticClass:"gl-flex gl-w-full gl-items-center gl-border-0 gl-bg-transparent gl-p-0 gl-text-left gl-text-xs gl-lowercase gl-text-gray-500",attrs:{"data-testid":"chat-context-selections-title"},on:{"click":_vm.toggleCollapse}},[_c('gl-icon',{attrs:{"name":_vm.collapseIconName,"data-testid":"chat-context-collapse-icon"}}),_vm._v(" "+_vm._s(_vm.title)+"\n ")],1),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(!_vm.isCollapsed),expression:"!isCollapsed"}],staticClass:"gl-mt-1 gl-flex gl-grow gl-flex-wrap",attrs:{"data-testid":"chat-context-tokens-wrapper"}},_vm._l((_vm.selections),function(item){return _c('gl-token',{key:item.id,staticClass:"gl-mb-2 gl-mr-2",attrs:{"view-only":!_vm.removable,"variant":"default"},on:{"close":function($event){return _vm.onRemoveItem(item)}}},[_c('div',{staticClass:"gl-flex gl-items-center",attrs:{"id":("context-item-" + (item.id) + "-" + _vm.selectionsId)}},[_c('gl-icon',{staticClass:"gl-mr-1",attrs:{"name":_vm.getIconName(item.type),"size":12}}),_vm._v("\n "+_vm._s(item.metadata.name)+"\n ")],1),_vm._v(" "),_c('gl-duo-chat-context-item-popover',{attrs:{"item":item,"target":("context-item-" + (item.id) + "-" + _vm.selectionsId),"placement":"bottom"}})],1)}),1)])};
85
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mb-3 gl-flex gl-flex-col"},[_c('button',{staticClass:"gl-flex gl-w-full gl-items-center gl-border-0 gl-bg-transparent gl-p-0 gl-text-left gl-text-xs gl-lowercase gl-text-gray-500",attrs:{"data-testid":"chat-context-selections-title"},on:{"click":_vm.toggleCollapse}},[_c('gl-icon',{attrs:{"name":_vm.collapseIconName,"data-testid":"chat-context-collapse-icon"}}),_vm._v(" "+_vm._s(_vm.title)+"\n ")],1),_vm._v(" "),_c('div',{directives:[{name:"show",rawName:"v-show",value:(!_vm.isCollapsed),expression:"!isCollapsed"}],staticClass:"gl-mt-1 gl-flex gl-grow gl-flex-wrap",attrs:{"data-testid":"chat-context-tokens-wrapper"}},_vm._l((_vm.selections),function(contextItem){return _c('gl-token',{key:contextItem.id,staticClass:"gl-mb-2 gl-mr-2",attrs:{"view-only":!_vm.removable,"variant":"default"},on:{"close":function($event){return _vm.onRemoveItem(contextItem)}}},[_c('div',{staticClass:"gl-flex gl-items-center",attrs:{"id":("context-item-" + (contextItem.id) + "-" + _vm.selectionsId)}},[_c('gl-icon',{staticClass:"gl-mr-1",attrs:{"name":_vm.getIconName(contextItem.type),"size":12}}),_vm._v("\n "+_vm._s(contextItem.metadata.name)+"\n ")],1),_vm._v(" "),_c('gl-duo-chat-context-item-popover',{attrs:{"context-item":contextItem,"target":("context-item-" + (contextItem.id) + "-" + _vm.selectionsId),"placement":"bottom"}})],1)}),1)])};
86
86
  var __vue_staticRenderFns__ = [];
87
87
 
88
88
  /* style */
@@ -13,6 +13,9 @@ const MOCK_CATEGORIES = [{
13
13
  value: CONTEXT_ITEM_TYPE_MERGE_REQUEST,
14
14
  icon: 'merge-request'
15
15
  }];
16
+ function getMockCategory(categoryValue) {
17
+ return MOCK_CATEGORIES.find(cat => cat.value === categoryValue);
18
+ }
16
19
  const MOCK_CONTEXT_ITEM_FILE = {
17
20
  id: '123e4567-e89b-12d3-a456-426614174000',
18
21
  isEnabled: true,
@@ -133,4 +136,4 @@ const getMockContextItems = () => {
133
136
  return [...enabledItems, ...disabledItems];
134
137
  };
135
138
 
136
- export { MOCK_CATEGORIES, MOCK_CONTEXT_ITEM_FILE, MOCK_CONTEXT_ITEM_FILE_DISABLED, MOCK_CONTEXT_ITEM_ISSUE, MOCK_CONTEXT_ITEM_ISSUE_DISABLED, MOCK_CONTEXT_ITEM_MERGE_REQUEST, MOCK_CONTEXT_ITEM_MERGE_REQUEST_DISABLED, getMockContextItems };
139
+ export { MOCK_CATEGORIES, MOCK_CONTEXT_ITEM_FILE, MOCK_CONTEXT_ITEM_FILE_DISABLED, MOCK_CONTEXT_ITEM_ISSUE, MOCK_CONTEXT_ITEM_ISSUE_DISABLED, MOCK_CONTEXT_ITEM_MERGE_REQUEST, MOCK_CONTEXT_ITEM_MERGE_REQUEST_DISABLED, getMockCategory, getMockContextItems };
@@ -13,5 +13,13 @@ function contextItemValidator(item) {
13
13
  function contextItemsValidator(items) {
14
14
  return Array.isArray(items) && items.every(item => contextItemValidator(item));
15
15
  }
16
+ function formatIssueId(iid) {
17
+ if (!iid) return '';
18
+ return `#${iid}`;
19
+ }
20
+ function formatMergeRequestId(iid) {
21
+ if (!iid) return '';
22
+ return `!${iid}`;
23
+ }
16
24
 
17
- export { categoriesValidator, categoryValidator, contextItemValidator, contextItemsValidator };
25
+ export { categoriesValidator, categoryValidator, contextItemValidator, contextItemsValidator, formatIssueId, formatMergeRequestId };