@gitlab/ui 37.5.0 → 37.6.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 +21 -0
- package/dist/components/base/dropdown/dropdown.js +2 -2
- package/dist/components/base/filtered_search/filtered_search.js +24 -8
- package/dist/components/base/filtered_search/filtered_search_term.js +10 -1
- package/dist/components/base/filtered_search/filtered_search_utils.js +2 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +2 -2
- package/src/components/base/dropdown/dropdown.spec.js +29 -0
- package/src/components/base/dropdown/dropdown.vue +5 -3
- package/src/components/base/filtered_search/filtered_search.spec.js +106 -12
- package/src/components/base/filtered_search/filtered_search.stories.js +3 -0
- package/src/components/base/filtered_search/filtered_search.vue +21 -6
- package/src/components/base/filtered_search/filtered_search_term.spec.js +14 -9
- package/src/components/base/filtered_search/filtered_search_term.vue +7 -1
- package/src/components/base/filtered_search/filtered_search_utils.js +2 -0
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/box-shadow.scss +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [37.6.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.5.2...v37.6.0) (2022-03-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **css:** Add a 600 red left inset border of size 3 ([5b37b86](https://gitlab.com/gitlab-org/gitlab-ui/commit/5b37b86e80179e56a9d7961c04ad4de6c8183205))
|
|
7
|
+
|
|
8
|
+
## [37.5.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.5.1...v37.5.2) (2022-03-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **GlFilteredSearch:** Token activation after destruction ([40b0513](https://gitlab.com/gitlab-org/gitlab-ui/commit/40b051307065ff29fea53ad65457d6b99f116c92))
|
|
14
|
+
|
|
15
|
+
## [37.5.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.5.0...v37.5.1) (2022-03-10)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **GlDropdown:** spinner replaces icon when icon dropdown is loading ([027a8a7](https://gitlab.com/gitlab-org/gitlab-ui/commit/027a8a7011c336b7c2562e4e839d4d8b4f7a4fe9))
|
|
21
|
+
|
|
1
22
|
# [37.5.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.4.2...v37.5.0) (2022-03-10)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -147,7 +147,7 @@ var script = {
|
|
|
147
147
|
isIconOnly() {
|
|
148
148
|
var _this$text;
|
|
149
149
|
|
|
150
|
-
return Boolean(this.icon && (!((_this$text = this.text) !== null && _this$text !== void 0 && _this$text.length) || this.textSrOnly));
|
|
150
|
+
return Boolean(this.icon && (!((_this$text = this.text) !== null && _this$text !== void 0 && _this$text.length) || this.textSrOnly) && !this.hasSlotContents('button-text'));
|
|
151
151
|
},
|
|
152
152
|
|
|
153
153
|
isIconWithText() {
|
|
@@ -209,7 +209,7 @@ var script = {
|
|
|
209
209
|
const __vue_script__ = script;
|
|
210
210
|
|
|
211
211
|
/* template */
|
|
212
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-dropdown',_vm._g(_vm._b({ref:"dropdown",staticClass:"gl-new-dropdown",attrs:{"split":_vm.split,"variant":_vm.variant,"size":_vm.buttonSize,"toggle-class":[_vm.toggleButtonClasses],"split-class":_vm.splitButtonClasses,"block":_vm.block,"disabled":_vm.disabled || _vm.loading,"right":_vm.right},scopedSlots:_vm._u([{key:"button-content",fn:function(){return [_vm._t("button-content",[(_vm.loading)?_c('gl-loading-icon',{
|
|
212
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-dropdown',_vm._g(_vm._b({ref:"dropdown",staticClass:"gl-new-dropdown",attrs:{"split":_vm.split,"variant":_vm.variant,"size":_vm.buttonSize,"toggle-class":[_vm.toggleButtonClasses],"split-class":_vm.splitButtonClasses,"block":_vm.block,"disabled":_vm.disabled || _vm.loading,"right":_vm.right},scopedSlots:_vm._u([{key:"button-content",fn:function(){return [_vm._t("button-content",[(_vm.loading)?_c('gl-loading-icon',{class:{ 'gl-mr-2': !_vm.isIconOnly }}):_vm._e(),_vm._v(" "),(_vm.icon && !(_vm.isIconOnly && _vm.loading))?_c('gl-icon',{staticClass:"dropdown-icon",attrs:{"name":_vm.icon}}):_vm._e(),_vm._v(" "),_c('span',{staticClass:"gl-new-dropdown-button-text",class:{ 'gl-sr-only': _vm.textSrOnly }},[_vm._t("button-text",[_vm._v(_vm._s(_vm.buttonText))])],2),_vm._v(" "),(_vm.renderCaret)?_c('gl-icon',{staticClass:"gl-button-icon dropdown-chevron",attrs:{"name":"chevron-down"}}):_vm._e()])]},proxy:true}],null,true)},'b-dropdown',_vm.$attrs,false),_vm.$listeners),[_c('div',{staticClass:"gl-new-dropdown-inner"},[(_vm.hasSlotContents('header') || _vm.headerText)?_c('div',{staticClass:"gl-new-dropdown-header",class:{ 'gl-border-b-0!': _vm.hideHeaderBorder }},[(_vm.headerText)?_c('p',{staticClass:"gl-new-dropdown-header-top"},[_vm._v("\n "+_vm._s(_vm.headerText)+"\n ")]):_vm._e(),_vm._v(" "),_vm._t("header")],2):_vm._e(),_vm._v(" "),(_vm.hasHighlightedItemsOrClearAll)?_c('div',{staticClass:"gl-display-flex gl-flex-direction-row gl-justify-content-space-between gl-align-items-center"},[(_vm.hasHighlightedItemsContent && _vm.showHighlightedItemsTitle)?_c('div',{staticClass:"gl-display-flex gl-flex-grow-1 gl-justify-content-flex-start",class:_vm.highlightedItemsTitleClass},[_c('span',{staticClass:"gl-font-weight-bold",attrs:{"data-testid":"highlighted-items-title"}},[_vm._v(_vm._s(_vm.highlightedItemsTitle))])]):_vm._e(),_vm._v(" "),(_vm.showClearAll)?_c('div',{staticClass:"gl-display-flex gl-flex-grow-1 gl-justify-content-end",class:_vm.clearAllTextClass},[_c('gl-button',{attrs:{"size":"small","category":"tertiary","variant":"link","data-testid":"clear-all-button"},on:{"click":function($event){return _vm.$emit('clear-all', $event)}}},[_vm._v(_vm._s(_vm.clearAllText))])],1):_vm._e()]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-new-dropdown-contents"},[(_vm.hasHighlightedItemsContent)?_c('div',{staticClass:"gl-overflow-visible",attrs:{"data-testid":"highlighted-items"}},[_vm._t("highlighted-items"),_vm._v(" "),_c('gl-dropdown-divider')],2):_vm._e(),_vm._v(" "),_vm._t("default")],2),_vm._v(" "),(_vm.hasSlotContents('footer'))?_c('div',{staticClass:"gl-new-dropdown-footer"},[_vm._t("footer")],2):_vm._e()])])};
|
|
213
213
|
var __vue_staticRenderFns__ = [];
|
|
214
214
|
|
|
215
215
|
/* style */
|
|
@@ -5,7 +5,7 @@ import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
|
5
5
|
import GlIcon from '../icon/icon';
|
|
6
6
|
import GlSearchBoxByClick from '../search_box_by_click/search_box_by_click';
|
|
7
7
|
import GlFilteredSearchTerm from './filtered_search_term';
|
|
8
|
-
import { TERM_TOKEN_TYPE, needDenormalization, denormalizeTokens, isEmptyTerm, normalizeTokens } from './filtered_search_utils';
|
|
8
|
+
import { TERM_TOKEN_TYPE, needDenormalization, denormalizeTokens, isEmptyTerm, INTENT_ACTIVATE_PREVIOUS, normalizeTokens } from './filtered_search_utils';
|
|
9
9
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
10
10
|
|
|
11
11
|
Vue.use(PortalVue);
|
|
@@ -184,8 +184,8 @@ var script = {
|
|
|
184
184
|
return ((_this$getTokenEntry = this.getTokenEntry(type)) === null || _this$getTokenEntry === void 0 ? void 0 : _this$getTokenEntry.token) || GlFilteredSearchTerm;
|
|
185
185
|
},
|
|
186
186
|
|
|
187
|
-
activate(
|
|
188
|
-
this.activeTokenIdx =
|
|
187
|
+
activate(idx) {
|
|
188
|
+
this.activeTokenIdx = idx;
|
|
189
189
|
},
|
|
190
190
|
|
|
191
191
|
alignSuggestions(ref) {
|
|
@@ -216,15 +216,31 @@ var script = {
|
|
|
216
216
|
},
|
|
217
217
|
|
|
218
218
|
destroyToken(idx) {
|
|
219
|
+
let {
|
|
220
|
+
intent
|
|
221
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
222
|
+
|
|
219
223
|
if (this.tokens.length === 1) {
|
|
220
224
|
return;
|
|
221
225
|
}
|
|
222
226
|
|
|
223
|
-
this.tokens.splice(idx, 1);
|
|
227
|
+
this.tokens.splice(idx, 1); // First, attempt to honor the user's activation intent behind the
|
|
228
|
+
// destruction of the token, if any. Otherwise, try to maintain the
|
|
229
|
+
// active state for the token that was active at the time. If that's not
|
|
230
|
+
// possible, make sure no token is active.
|
|
231
|
+
|
|
232
|
+
if (intent === INTENT_ACTIVATE_PREVIOUS) {
|
|
233
|
+
// If there is a previous token, activate it; else, deactivate all tokens
|
|
234
|
+
this.activeTokenIdx = idx > 0 ? idx - 1 : null;
|
|
235
|
+
} else if (idx < this.activeTokenIdx) {
|
|
236
|
+
// Preserve the active token's active status (it shifted down one index)
|
|
237
|
+
this.activeTokenIdx -= 1;
|
|
238
|
+
} else if (idx === this.activeTokenIdx) {
|
|
239
|
+
// User destroyed the active token; don't activate another one.
|
|
240
|
+
this.activeTokenIdx = null;
|
|
241
|
+
} // Do nothing if there was no active token, or if idx > this.activeTokenIdx,
|
|
242
|
+
// to preserve the active state of the remaining tokens.
|
|
224
243
|
|
|
225
|
-
if (idx !== 0) {
|
|
226
|
-
this.activeTokenIdx = idx - 1;
|
|
227
|
-
}
|
|
228
244
|
},
|
|
229
245
|
|
|
230
246
|
replaceToken(idx, token) {
|
|
@@ -281,7 +297,7 @@ const __vue_script__ = script;
|
|
|
281
297
|
/* template */
|
|
282
298
|
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-search-box-by-click',_vm._b({attrs:{"value":_vm.tokens,"history-items":_vm.historyItems,"clearable":_vm.hasValue,"search-button-attributes":_vm.searchButtonAttributes,"data-testid":"filtered-search-input"},on:{"submit":_vm.submit,"input":_vm.applyNewValue,"history-item-selected":function($event){return _vm.$emit('history-item-selected', $event)},"clear":function($event){return _vm.$emit('clear')},"clear-history":function($event){return _vm.$emit('clear-history')}},scopedSlots:_vm._u([{key:"history-item",fn:function(slotScope){return [_vm._t("history-item",null,null,slotScope)]}},{key:"input",fn:function(){return [_c('div',{staticClass:"gl-filtered-search-scrollable"},[_vm._l((_vm.tokens),function(token,idx){return [_c(_vm.getTokenComponent(token.type),{key:((token.type) + "-" + idx),ref:"tokens",refInFor:true,tag:"component",staticClass:"gl-filtered-search-item",class:{
|
|
283
299
|
'gl-filtered-search-last-item': _vm.isLastToken(idx),
|
|
284
|
-
},attrs:{"config":_vm.getTokenEntry(token.type),"active":_vm.activeTokenIdx === idx,"available-tokens":_vm.currentAvailableTokens,"current-value":_vm.tokens,"index":idx,"placeholder":_vm.termPlaceholder,"show-friendly-text":_vm.showFriendlyText,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken(idx)},on:{"activate":function($event){return _vm.activate(idx)},"deactivate":function($event){return _vm.deactivate(token)},"destroy":function($event){return _vm.destroyToken(idx)},"replace":function($event){return _vm.replaceToken(idx, $event)},"complete":_vm.completeToken,"submit":_vm.submit,"split":function($event){return _vm.createTokens(idx, $event)}},model:{value:(token.value),callback:function ($$v) {_vm.$set(token, "value", $$v);},expression:"token.value"}})]})],2),_vm._v(" "),_c('portal-target',{key:_vm.activeTokenIdx,ref:"menu",style:(_vm.suggestionsStyle),attrs:{"name":_vm.portalName,"slim":""}})]},proxy:true}],null,true)},'gl-search-box-by-click',_vm.$attrs,false))};
|
|
300
|
+
},attrs:{"config":_vm.getTokenEntry(token.type),"active":_vm.activeTokenIdx === idx,"available-tokens":_vm.currentAvailableTokens,"current-value":_vm.tokens,"index":idx,"placeholder":_vm.termPlaceholder,"show-friendly-text":_vm.showFriendlyText,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken(idx)},on:{"activate":function($event){return _vm.activate(idx)},"deactivate":function($event){return _vm.deactivate(token)},"destroy":function($event){return _vm.destroyToken(idx, $event)},"replace":function($event){return _vm.replaceToken(idx, $event)},"complete":_vm.completeToken,"submit":_vm.submit,"split":function($event){return _vm.createTokens(idx, $event)}},model:{value:(token.value),callback:function ($$v) {_vm.$set(token, "value", $$v);},expression:"token.value"}})]})],2),_vm._v(" "),_c('portal-target',{key:_vm.activeTokenIdx,ref:"menu",style:(_vm.suggestionsStyle),attrs:{"name":_vm.portalName,"slim":""}})]},proxy:true}],null,true)},'gl-search-box-by-click',_vm.$attrs,false))};
|
|
285
301
|
var __vue_staticRenderFns__ = [];
|
|
286
302
|
|
|
287
303
|
/* style */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import GlFilteredSearchSuggestion from './filtered_search_suggestion';
|
|
2
2
|
import GlFilteredSearchTokenSegment from './filtered_search_token_segment';
|
|
3
|
+
import { INTENT_ACTIVATE_PREVIOUS } from './filtered_search_utils';
|
|
3
4
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
5
|
|
|
5
6
|
var script = {
|
|
@@ -63,6 +64,14 @@ var script = {
|
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
}
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
onBackspace() {
|
|
70
|
+
this.$emit('destroy', {
|
|
71
|
+
intent: INTENT_ACTIVATE_PREVIOUS
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
66
75
|
}
|
|
67
76
|
};
|
|
68
77
|
|
|
@@ -70,7 +79,7 @@ var script = {
|
|
|
70
79
|
const __vue_script__ = script;
|
|
71
80
|
|
|
72
81
|
/* template */
|
|
73
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-h-auto gl-filtered-search-term"},[_c('gl-filtered-search-token-segment',{staticClass:"gl-filtered-search-term-token",class:{ 'gl-w-full': _vm.placeholder },attrs:{"active":_vm.active,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken,"current-value":_vm.currentValue},on:{"activate":function($event){return _vm.$emit('activate')},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":function($event){return _vm.$emit('replace', { type: $event })},"backspace":
|
|
82
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-h-auto gl-filtered-search-term"},[_c('gl-filtered-search-token-segment',{staticClass:"gl-filtered-search-term-token",class:{ 'gl-w-full': _vm.placeholder },attrs:{"active":_vm.active,"search-input-attributes":_vm.searchInputAttributes,"is-last-token":_vm.isLastToken,"current-value":_vm.currentValue},on:{"activate":function($event){return _vm.$emit('activate')},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":function($event){return _vm.$emit('replace', { type: $event })},"backspace":_vm.onBackspace,"submit":function($event){return _vm.$emit('submit')},"split":function($event){return _vm.$emit('split', $event)}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return _vm._l((_vm.suggestedTokens),function(item,idx){return _c('gl-filtered-search-suggestion',{key:idx,attrs:{"value":item.type,"icon-name":item.icon}},[_vm._v("\n "+_vm._s(item.title)+"\n ")])})},proxy:true},{key:"view",fn:function(){return [(_vm.placeholder)?_c('input',_vm._b({staticClass:"gl-filtered-search-term-input",attrs:{"placeholder":_vm.placeholder,"aria-label":_vm.placeholder}},'input',_vm.searchInputAttributes,false)):[_vm._v(_vm._s(_vm.value.data))]]},proxy:true}]),model:{value:(_vm.internalValue),callback:function ($$v) {_vm.internalValue=$$v;},expression:"internalValue"}})],1)};
|
|
74
83
|
var __vue_staticRenderFns__ = [];
|
|
75
84
|
|
|
76
85
|
/* style */
|
|
@@ -3,6 +3,7 @@ import _last from 'lodash/last';
|
|
|
3
3
|
import _first from 'lodash/first';
|
|
4
4
|
|
|
5
5
|
const TERM_TOKEN_TYPE = 'filtered-search-term';
|
|
6
|
+
const INTENT_ACTIVATE_PREVIOUS = 'intent-activate-previous';
|
|
6
7
|
function isEmptyTerm(token) {
|
|
7
8
|
return token.type === TERM_TOKEN_TYPE && token.value.data.trim() === '';
|
|
8
9
|
}
|
|
@@ -134,4 +135,4 @@ function wrapTokenInQuotes(token) {
|
|
|
134
135
|
return `"${token}"`;
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
export { TERM_TOKEN_TYPE, denormalizeTokens, isEmptyTerm, needDenormalization, normalizeTokens, splitOnQuotes, wrapTokenInQuotes };
|
|
138
|
+
export { INTENT_ACTIVATE_PREVIOUS, TERM_TOKEN_TYPE, denormalizeTokens, isEmptyTerm, needDenormalization, normalizeTokens, splitOnQuotes, wrapTokenInQuotes };
|