@gitlab/ui 91.9.0 → 91.11.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 +14 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.js +17 -2
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.js +127 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.js +53 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +1 -1
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +1 -1
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue +28 -11
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.vue +144 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.vue +34 -0
- package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +2 -2
- package/tailwind.defaults.js +5 -5
- package/translations.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [91.11.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.10.0...v91.11.0) (2024-09-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Tailwind:** use border default design token for border classes ([642bc1c](https://gitlab.com/gitlab-org/gitlab-ui/commit/642bc1c3776402cd30d84452374805811d2246bb))
|
|
7
|
+
|
|
8
|
+
# [91.10.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.9.0...v91.10.0) (2024-09-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add duo chat context menu search ([6ac53de](https://gitlab.com/gitlab-org/gitlab-ui/commit/6ac53dee88bcd395b85bacd68ebde35ae56149ff))
|
|
14
|
+
|
|
1
15
|
# [91.9.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.8.0...v91.9.0) (2024-09-04)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import debounce from 'lodash/debounce';
|
|
1
2
|
import { translate } from '../../../../../../../utils/i18n';
|
|
2
3
|
import GlCard from '../../../../../../base/card/card';
|
|
3
4
|
import { contextItemsValidator, categoriesValidator } from '../utils';
|
|
4
5
|
import GlDuoChatContextItemSelections from '../duo_chat_context_item_selections/duo_chat_context_item_selections';
|
|
5
6
|
import GlDuoChatContextItemMenuCategoryItems from './duo_chat_context_item_menu_category_items';
|
|
7
|
+
import GlDuoChatContextItemMenuSearchItems from './duo_chat_context_item_menu_search_items';
|
|
6
8
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
7
9
|
|
|
10
|
+
const SEARCH_DEBOUNCE_MS = 30;
|
|
8
11
|
var script = {
|
|
9
12
|
name: 'GlDuoChatContextItemMenu',
|
|
10
13
|
components: {
|
|
11
14
|
GlCard,
|
|
12
15
|
GlDuoChatContextItemMenuCategoryItems,
|
|
16
|
+
GlDuoChatContextItemMenuSearchItems,
|
|
13
17
|
GlDuoChatContextItemSelections
|
|
14
18
|
},
|
|
15
19
|
props: {
|
|
@@ -63,6 +67,7 @@ var script = {
|
|
|
63
67
|
data() {
|
|
64
68
|
return {
|
|
65
69
|
activeIndex: 0,
|
|
70
|
+
searchQuery: '',
|
|
66
71
|
selectedCategory: null
|
|
67
72
|
};
|
|
68
73
|
},
|
|
@@ -76,12 +81,16 @@ var script = {
|
|
|
76
81
|
if (!isOpen) {
|
|
77
82
|
this.resetSelection();
|
|
78
83
|
}
|
|
84
|
+
},
|
|
85
|
+
searchQuery(query) {
|
|
86
|
+
this.debouncedSearch(query);
|
|
79
87
|
}
|
|
80
88
|
},
|
|
81
89
|
methods: {
|
|
82
90
|
selectCategory(category) {
|
|
83
|
-
this.selectedCategory = category;
|
|
84
91
|
this.activeIndex = 0;
|
|
92
|
+
this.searchQuery = '';
|
|
93
|
+
this.selectedCategory = category;
|
|
85
94
|
|
|
86
95
|
/**
|
|
87
96
|
* Emitted when a search should be performed.
|
|
@@ -118,6 +127,12 @@ var script = {
|
|
|
118
127
|
*/
|
|
119
128
|
this.$emit('remove', item);
|
|
120
129
|
},
|
|
130
|
+
debouncedSearch: debounce(function search(query) {
|
|
131
|
+
this.$emit('search', {
|
|
132
|
+
category: this.selectedCategory.value,
|
|
133
|
+
query
|
|
134
|
+
});
|
|
135
|
+
}, SEARCH_DEBOUNCE_MS),
|
|
121
136
|
resetSelection() {
|
|
122
137
|
this.selectedCategory = null;
|
|
123
138
|
this.activeIndex = 0;
|
|
@@ -132,7 +147,7 @@ var script = {
|
|
|
132
147
|
const __vue_script__ = script;
|
|
133
148
|
|
|
134
149
|
/* template */
|
|
135
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.selections.length)?_c('gl-duo-chat-context-item-selections',{staticClass:"gl-mb-3",attrs:{"selections":_vm.selections,"removable":true,"title":_vm.$options.i18n.selectedContextItemsTitle,"default-collapsed":false},on:{"remove":_vm.removeItem}}):_vm._e(),_vm._v(" "),(_vm.open)?_c('gl-card',{staticClass:"slash-commands !gl-absolute gl-bottom-0 gl-w-full gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2","data-testid":"context-item-menu"}},[(_vm.showCategorySelection)?_c('gl-duo-chat-context-item-menu-category-items',{attrs:{"active-index":_vm.activeIndex,"categories":_vm.categories},on:{"select":_vm.selectCategory,"active-index-change":function($event){_vm.activeIndex = $event;}}}):_c('
|
|
150
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.selections.length)?_c('gl-duo-chat-context-item-selections',{staticClass:"gl-mb-3",attrs:{"selections":_vm.selections,"removable":true,"title":_vm.$options.i18n.selectedContextItemsTitle,"default-collapsed":false},on:{"remove":_vm.removeItem}}):_vm._e(),_vm._v(" "),(_vm.open)?_c('gl-card',{staticClass:"slash-commands !gl-absolute gl-bottom-0 gl-w-full gl-pl-0 gl-shadow-md",attrs:{"body-class":"!gl-p-2","data-testid":"context-item-menu"}},[(_vm.showCategorySelection)?_c('gl-duo-chat-context-item-menu-category-items',{attrs:{"active-index":_vm.activeIndex,"categories":_vm.categories},on:{"select":_vm.selectCategory,"active-index-change":function($event){_vm.activeIndex = $event;}}}):_c('gl-duo-chat-context-item-menu-search-items',{attrs:{"active-index":_vm.activeIndex,"category":_vm.selectedCategory,"loading":_vm.loading,"error":_vm.error,"results":_vm.results},on:{"select":_vm.selectItem,"active-index-change":function($event){_vm.activeIndex = $event;}},model:{value:(_vm.searchQuery),callback:function ($$v) {_vm.searchQuery=$$v;},expression:"searchQuery"}})],1):_vm._e()],1)};
|
|
136
151
|
var __vue_staticRenderFns__ = [];
|
|
137
152
|
|
|
138
153
|
/* style */
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import GlDropdownItem from '../../../../../../base/dropdown/dropdown_item';
|
|
2
|
+
import GlFormInput from '../../../../../../base/form/form_input/form_input';
|
|
3
|
+
import GlAlert from '../../../../../../base/alert/alert';
|
|
4
|
+
import { sprintf, translate } from '../../../../../../../utils/i18n';
|
|
5
|
+
import { categoryValidator, contextItemsValidator } from '../utils';
|
|
6
|
+
import GlDuoChatContextItemMenuSearchItemsLoading from './duo_chat_context_item_menu_search_items_loading';
|
|
7
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
8
|
+
|
|
9
|
+
var script = {
|
|
10
|
+
name: 'GlDuoChatContextItemMenuSearchItems',
|
|
11
|
+
components: {
|
|
12
|
+
GlAlert,
|
|
13
|
+
GlFormInput,
|
|
14
|
+
GlDropdownItem,
|
|
15
|
+
GlDuoChatContextItemMenuSearchItemsLoading
|
|
16
|
+
},
|
|
17
|
+
model: {
|
|
18
|
+
prop: 'searchQuery',
|
|
19
|
+
event: 'update:searchQuery'
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
activeIndex: {
|
|
23
|
+
type: Number,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
searchQuery: {
|
|
27
|
+
type: String,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
category: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true,
|
|
33
|
+
validator: categoryValidator
|
|
34
|
+
},
|
|
35
|
+
loading: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
error: {
|
|
40
|
+
type: [String, null],
|
|
41
|
+
required: false,
|
|
42
|
+
default: null
|
|
43
|
+
},
|
|
44
|
+
results: {
|
|
45
|
+
type: Array,
|
|
46
|
+
required: true,
|
|
47
|
+
validator: contextItemsValidator
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
userInitiatedSearch: false,
|
|
53
|
+
numLoadingItems: 3
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
computed: {
|
|
57
|
+
showEmptyState() {
|
|
58
|
+
return Boolean(this.userInitiatedSearch && !this.loading && !this.error && !this.results.length);
|
|
59
|
+
},
|
|
60
|
+
searchInputPlaceholder() {
|
|
61
|
+
return sprintf(translate('GlDuoChatContextItemMenu.searchInputPlaceholder', 'Search %{categoryLabel}...'), {
|
|
62
|
+
categoryLabel: this.category.label.toLowerCase()
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
watch: {
|
|
67
|
+
searchQuery() {
|
|
68
|
+
this.userInitiatedSearch = true;
|
|
69
|
+
},
|
|
70
|
+
results(results) {
|
|
71
|
+
this.numLoadingItems = Math.max(1, results.length);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
selectItem(item) {
|
|
76
|
+
this.$emit('select', item);
|
|
77
|
+
this.userInitiatedSearch = false;
|
|
78
|
+
},
|
|
79
|
+
setActiveIndex(index) {
|
|
80
|
+
var _this$results$index;
|
|
81
|
+
if ((_this$results$index = this.results[index]) !== null && _this$results$index !== void 0 && _this$results$index.isEnabled) {
|
|
82
|
+
this.$emit('active-index-change', index);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
i18n: {
|
|
87
|
+
emptyStateMessage: translate('GlDuoChatContextItemMenu.emptyStateMessage', 'No results found')
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/* script */
|
|
92
|
+
const __vue_script__ = script;
|
|
93
|
+
|
|
94
|
+
/* 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)};
|
|
96
|
+
var __vue_staticRenderFns__ = [];
|
|
97
|
+
|
|
98
|
+
/* style */
|
|
99
|
+
const __vue_inject_styles__ = undefined;
|
|
100
|
+
/* scoped */
|
|
101
|
+
const __vue_scope_id__ = undefined;
|
|
102
|
+
/* module identifier */
|
|
103
|
+
const __vue_module_identifier__ = undefined;
|
|
104
|
+
/* functional template */
|
|
105
|
+
const __vue_is_functional_template__ = false;
|
|
106
|
+
/* style inject */
|
|
107
|
+
|
|
108
|
+
/* style inject SSR */
|
|
109
|
+
|
|
110
|
+
/* style inject shadow dom */
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const __vue_component__ = __vue_normalize__(
|
|
115
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
116
|
+
__vue_inject_styles__,
|
|
117
|
+
__vue_script__,
|
|
118
|
+
__vue_scope_id__,
|
|
119
|
+
__vue_is_functional_template__,
|
|
120
|
+
__vue_module_identifier__,
|
|
121
|
+
false,
|
|
122
|
+
undefined,
|
|
123
|
+
undefined,
|
|
124
|
+
undefined
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
export default __vue_component__;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { translate } from '../../../../../../../utils/i18n';
|
|
2
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
3
|
+
|
|
4
|
+
var script = {
|
|
5
|
+
name: 'GlDuoChatContextItemMenuSearchItemsLoading',
|
|
6
|
+
props: {
|
|
7
|
+
rows: {
|
|
8
|
+
type: Number,
|
|
9
|
+
required: true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
i18n: {
|
|
13
|
+
loadingMessage: translate('GlDuoChatContextItemMenu.loadingMessage', 'Loading...')
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/* script */
|
|
18
|
+
const __vue_script__ = script;
|
|
19
|
+
|
|
20
|
+
/* template */
|
|
21
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._l((_vm.rows),function(index){return _c('div',{key:index,staticClass:"gl-mx-3 gl-mb-4 gl-pt-3",attrs:{"data-testid":"search-results-loading"}},[_vm._m(0,true),_vm._v(" "),_c('div',{staticClass:"gl-animate-skeleton-loader gl-h-4 gl-w-1/2 gl-rounded-base"})])}),_vm._v(" "),_c('span',{staticClass:"sr-only"},[_vm._v(_vm._s(_vm.$options.i18n.loadingMessage))])],2)};
|
|
22
|
+
var __vue_staticRenderFns__ = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mb-2 gl-flex"},[_c('div',{staticClass:"gl-animate-skeleton-loader gl-mr-3 gl-h-5 gl-w-5 gl-rounded-base"}),_vm._v(" "),_c('div',{staticClass:"gl-animate-skeleton-loader gl-h-5 gl-grow gl-rounded-base"})])}];
|
|
23
|
+
|
|
24
|
+
/* style */
|
|
25
|
+
const __vue_inject_styles__ = undefined;
|
|
26
|
+
/* scoped */
|
|
27
|
+
const __vue_scope_id__ = undefined;
|
|
28
|
+
/* module identifier */
|
|
29
|
+
const __vue_module_identifier__ = undefined;
|
|
30
|
+
/* functional template */
|
|
31
|
+
const __vue_is_functional_template__ = false;
|
|
32
|
+
/* style inject */
|
|
33
|
+
|
|
34
|
+
/* style inject SSR */
|
|
35
|
+
|
|
36
|
+
/* style inject shadow dom */
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const __vue_component__ = __vue_normalize__(
|
|
41
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
42
|
+
__vue_inject_styles__,
|
|
43
|
+
__vue_script__,
|
|
44
|
+
__vue_scope_id__,
|
|
45
|
+
__vue_is_functional_template__,
|
|
46
|
+
__vue_module_identifier__,
|
|
47
|
+
false,
|
|
48
|
+
undefined,
|
|
49
|
+
undefined,
|
|
50
|
+
undefined
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export default __vue_component__;
|
|
@@ -14,4 +14,4 @@ function contextItemsValidator(items) {
|
|
|
14
14
|
return Array.isArray(items) && items.every(item => contextItemValidator(item));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export { categoriesValidator, contextItemsValidator };
|
|
17
|
+
export { categoriesValidator, categoryValidator, contextItemValidator, contextItemsValidator };
|