@gitlab/ui 37.5.1 → 37.7.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/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/components/regions/empty_state/empty_state.js +6 -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/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/components/regions/empty_state/empty_state.vue +13 -1
- package/src/scss/utilities.scss +20 -0
- package/src/scss/utility-mixins/box-shadow.scss +4 -0
- package/src/scss/utility-mixins/color.scss +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [37.7.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.6.0...v37.7.0) (2022-03-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **EmptyState:** Invert empty state illustrations in dark mode ([3112d43](https://gitlab.com/gitlab-org/gitlab-ui/commit/3112d43ac5ffba58a6ed3357c87e43d8ad10363d))
|
|
7
|
+
|
|
8
|
+
# [37.6.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.5.2...v37.6.0) (2022-03-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **css:** Add a 600 red left inset border of size 3 ([5b37b86](https://gitlab.com/gitlab-org/gitlab-ui/commit/5b37b86e80179e56a9d7961c04ad4de6c8183205))
|
|
14
|
+
|
|
15
|
+
## [37.5.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.5.1...v37.5.2) (2022-03-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **GlFilteredSearch:** Token activation after destruction ([40b0513](https://gitlab.com/gitlab-org/gitlab-ui/commit/40b051307065ff29fea53ad65457d6b99f116c92))
|
|
21
|
+
|
|
1
22
|
## [37.5.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v37.5.0...v37.5.1) (2022-03-10)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -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 };
|
|
@@ -85,6 +85,11 @@ var script = {
|
|
|
85
85
|
type: Boolean,
|
|
86
86
|
required: false,
|
|
87
87
|
default: false
|
|
88
|
+
},
|
|
89
|
+
invertInDarkMode: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
required: false,
|
|
92
|
+
default: true
|
|
88
93
|
}
|
|
89
94
|
},
|
|
90
95
|
computed: {
|
|
@@ -114,7 +119,7 @@ const __vue_script__ = script;
|
|
|
114
119
|
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:"gl-display-flex",class:{
|
|
115
120
|
'empty-state gl-text-center gl-flex-direction-column': !_vm.compact,
|
|
116
121
|
'gl-flex-direction-row': _vm.compact,
|
|
117
|
-
}},[_c('div',{class:{ 'gl-display-none gl-sm-display-block gl-px-4': _vm.compact, 'gl-max-w-full': !_vm.compact }},[(_vm.svgPath)?_c('div',{staticClass:"svg-250",class:{ 'svg-content': !_vm.compact }},[_c('img',{staticClass:"gl-max-w-full",attrs:{"src":_vm.svgPath,"alt":"","role":"img","height":_vm.height}})]):_vm._e()]),_vm._v(" "),_c('div',{class:_vm.compact ? 'gl-flex-grow-1 gl-flex-basis-0 gl-px-4' : 'gl-max-w-full gl-m-auto'},[_c('div',{staticClass:"gl-mx-auto gl-my-0",class:{ 'gl-p-5': !_vm.compact }},[_vm._t("title",[_c('h1',{staticClass:"gl-font-size-h-display gl-line-height-36",class:_vm.compact ? 'h5' : 'h4'},[_vm._v("\n "+_vm._s(_vm.title)+"\n ")])]),_vm._v(" "),(_vm.description || _vm.$scopedSlots.description)?_c('p',{ref:"description",staticClass:"gl-mt-3"},[_vm._t("description",[_vm._v("\n "+_vm._s(_vm.description)+"\n ")])],2):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-flex-wrap",class:{ 'gl-justify-content-center': !_vm.compact }},[_vm._t("actions",[(_vm.shouldRenderPrimaryButton)?_c('gl-button',{staticClass:"gl-mb-3",class:_vm.compact ? 'gl-mr-3' : 'gl-mx-2',attrs:{"variant":"confirm","href":_vm.primaryButtonLink}},[_vm._v(_vm._s(_vm.primaryButtonText))]):_vm._e(),_vm._v(" "),(_vm.shouldRenderSecondaryButton)?_c('gl-button',{staticClass:"gl-mb-3 gl-mr-3",class:{ 'gl-mx-2!': !_vm.compact },attrs:{"href":_vm.secondaryButtonLink}},[_vm._v(_vm._s(_vm.secondaryButtonText)+"\n ")]):_vm._e()])],2)],2)])])};
|
|
122
|
+
}},[_c('div',{class:{ 'gl-display-none gl-sm-display-block gl-px-4': _vm.compact, 'gl-max-w-full': !_vm.compact }},[(_vm.svgPath)?_c('div',{staticClass:"svg-250",class:{ 'svg-content': !_vm.compact }},[_c('img',{staticClass:"gl-max-w-full",class:{ 'gl-dark-invert-keep-hue': _vm.invertInDarkMode },attrs:{"src":_vm.svgPath,"alt":"","role":"img","height":_vm.height}})]):_vm._e()]),_vm._v(" "),_c('div',{class:_vm.compact ? 'gl-flex-grow-1 gl-flex-basis-0 gl-px-4' : 'gl-max-w-full gl-m-auto'},[_c('div',{staticClass:"gl-mx-auto gl-my-0",class:{ 'gl-p-5': !_vm.compact }},[_vm._t("title",[_c('h1',{staticClass:"gl-font-size-h-display gl-line-height-36",class:_vm.compact ? 'h5' : 'h4'},[_vm._v("\n "+_vm._s(_vm.title)+"\n ")])]),_vm._v(" "),(_vm.description || _vm.$scopedSlots.description)?_c('p',{ref:"description",staticClass:"gl-mt-3"},[_vm._t("description",[_vm._v("\n "+_vm._s(_vm.description)+"\n ")])],2):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-flex-wrap",class:{ 'gl-justify-content-center': !_vm.compact }},[_vm._t("actions",[(_vm.shouldRenderPrimaryButton)?_c('gl-button',{staticClass:"gl-mb-3",class:_vm.compact ? 'gl-mr-3' : 'gl-mx-2',attrs:{"variant":"confirm","href":_vm.primaryButtonLink}},[_vm._v(_vm._s(_vm.primaryButtonText))]):_vm._e(),_vm._v(" "),(_vm.shouldRenderSecondaryButton)?_c('gl-button',{staticClass:"gl-mb-3 gl-mr-3",class:{ 'gl-mx-2!': !_vm.compact },attrs:{"href":_vm.secondaryButtonLink}},[_vm._v(_vm._s(_vm.secondaryButtonText)+"\n ")]):_vm._e()])],2)],2)])])};
|
|
118
123
|
var __vue_staticRenderFns__ = [];
|
|
119
124
|
|
|
120
125
|
/* style */
|