@gitlab/ui 38.10.2 → 39.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.
Files changed (26) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/components/base/alert/alert.js +1 -1
  3. package/dist/components/base/filtered_search/filtered_search.js +18 -2
  4. package/dist/components/base/filtered_search/filtered_search_term.js +6 -1
  5. package/dist/components/base/filtered_search/filtered_search_token.js +32 -4
  6. package/dist/components/base/filtered_search/filtered_search_token_segment.js +36 -16
  7. package/dist/components/base/form/form_textarea/form_textarea.js +2 -62
  8. package/dist/index.css +1 -1
  9. package/dist/index.css.map +1 -1
  10. package/dist/utils/constants.js +1 -5
  11. package/package.json +9 -9
  12. package/src/components/base/alert/alert.vue +8 -8
  13. package/src/components/base/filtered_search/__snapshots__/filtered_search_term.spec.js.snap +4 -4
  14. package/src/components/base/filtered_search/filtered_search.stories.js +8 -1
  15. package/src/components/base/filtered_search/filtered_search.vue +19 -0
  16. package/src/components/base/filtered_search/filtered_search_term.spec.js +1 -0
  17. package/src/components/base/filtered_search/filtered_search_term.vue +11 -1
  18. package/src/components/base/filtered_search/filtered_search_token.spec.js +1 -0
  19. package/src/components/base/filtered_search/filtered_search_token.vue +41 -1
  20. package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +2 -2
  21. package/src/components/base/filtered_search/filtered_search_token_segment.vue +33 -12
  22. package/src/components/base/form/form_checkbox/form_checkbox.scss +4 -2
  23. package/src/components/base/form/form_textarea/form_textarea.spec.js +8 -115
  24. package/src/components/base/form/form_textarea/form_textarea.stories.js +0 -21
  25. package/src/components/base/form/form_textarea/form_textarea.vue +8 -73
  26. package/src/utils/constants.js +0 -5
package/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ # [39.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.12.0...v39.0.0) (2022-04-21)
2
+
3
+
4
+ ### Reverts
5
+
6
+ * add character counter to gl-form-textarea ([70a7a3f](https://gitlab.com/gitlab-org/gitlab-ui/commit/70a7a3fd9c2729b739020d167043490da72a556b))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * The feature added in
12
+ https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2738 has been
13
+ removed, as it causes complications regarding a validator used in
14
+ GitLab. This feature will be reconsidered and re-implemented later.
15
+
16
+ # [38.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.11.0...v38.12.0) (2022-04-21)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **Alert:** change Dismiss button DOM order ([5afc9a4](https://gitlab.com/gitlab-org/gitlab-ui/commit/5afc9a4b7f6585d30a09914021219492644b2571))
22
+
23
+
24
+ ### Features
25
+
26
+ * **checkbox:** Fix disabled custom control color ([ddcdca9](https://gitlab.com/gitlab-org/gitlab-ui/commit/ddcdca9b5d192cfe1c3710e73ae31c07fac6bd75))
27
+
28
+ # [38.11.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.10.2...v38.11.0) (2022-04-18)
29
+
30
+
31
+ ### Features
32
+
33
+ * **GlFilteredSearch:** Allow token navigation with arrows ([80844aa](https://gitlab.com/gitlab-org/gitlab-ui/commit/80844aac908452e626d1c3e4fb0c9aef9c8a5e25))
34
+ * **GlFilteredSearch:** Allow token navigation with arrows ([b7d1519](https://gitlab.com/gitlab-org/gitlab-ui/commit/b7d15196145f53bb5d7be0361e7d7a692c2b5dc4))
35
+ * **GlFilteredSearch:** Allow token navigation with arrows ([9f2a449](https://gitlab.com/gitlab-org/gitlab-ui/commit/9f2a44951657a4aeaaa162f1bd31d60231eb8be1))
36
+
1
37
  ## [38.10.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v38.10.1...v38.10.2) (2022-04-14)
2
38
 
3
39
 
@@ -175,7 +175,7 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
175
175
  'gl-alert',
176
176
  { 'gl-alert-sticky': _vm.sticky },
177
177
  { 'gl-alert-not-dismissible': !_vm.dismissible },
178
- _vm.variantClass ]},[_c('gl-icon',{class:{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !_vm.title },attrs:{"name":_vm.iconName}}),_vm._v(" "),(_vm.dismissible)?_c('close-button',{ref:"dismiss",staticClass:"gl-dismiss-btn",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.onDismiss}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-content",attrs:{"role":"alert"}},[(_vm.title)?_c('h4',{staticClass:"gl-alert-title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-body"},[_vm._t("default")],2),_vm._v(" "),(_vm.shouldRenderActions)?_c('div',{staticClass:"gl-alert-actions"},[_vm._t("actions",_vm._l((_vm.actionButtons),function(actionButton,index){return _c('gl-button',_vm._g(_vm._b({key:index,staticClass:"gl-alert-action"},'gl-button',actionButton.attrs,false),actionButton.listeners),[_vm._v("\n "+_vm._s(actionButton.text)+"\n ")])}))],2):_vm._e()])],1)};
178
+ _vm.variantClass ]},[_c('gl-icon',{class:{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !_vm.title },attrs:{"name":_vm.iconName}}),_vm._v(" "),_c('div',{staticClass:"gl-alert-content",attrs:{"role":"alert"}},[(_vm.title)?_c('h4',{staticClass:"gl-alert-title"},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-alert-body"},[_vm._t("default")],2),_vm._v(" "),(_vm.shouldRenderActions)?_c('div',{staticClass:"gl-alert-actions"},[_vm._t("actions",_vm._l((_vm.actionButtons),function(actionButton,index){return _c('gl-button',_vm._g(_vm._b({key:index,staticClass:"gl-alert-action"},'gl-button',actionButton.attrs,false),actionButton.listeners),[_vm._v("\n "+_vm._s(actionButton.text)+"\n ")])}))],2):_vm._e()]),_vm._v(" "),(_vm.dismissible)?_c('close-button',{ref:"dismiss",staticClass:"gl-dismiss-btn",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.onDismiss}}):_vm._e()],1)};
179
179
  var __vue_staticRenderFns__ = [];
180
180
 
181
181
  /* style */
@@ -120,7 +120,8 @@ var script = {
120
120
  return {
121
121
  tokens: initialState(),
122
122
  activeTokenIdx: null,
123
- suggestionsStyle: {}
123
+ suggestionsStyle: {},
124
+ intendedCursorPosition: 'end'
124
125
  };
125
126
  },
126
127
 
@@ -224,6 +225,20 @@ var script = {
224
225
  this.activeTokenIdx = idx;
225
226
  },
226
227
 
228
+ activatePreviousToken() {
229
+ if (this.activeTokenIdx > 0) {
230
+ this.activeTokenIdx -= 1;
231
+ this.intendedCursorPosition = 'end';
232
+ }
233
+ },
234
+
235
+ activateNextToken() {
236
+ if (this.activeTokenIdx < this.value.length) {
237
+ this.activeTokenIdx += 1;
238
+ this.intendedCursorPosition = 'start';
239
+ }
240
+ },
241
+
227
242
  alignSuggestions(ref) {
228
243
  const offsetRef = ref.getBoundingClientRect().left;
229
244
  const offsetMenu = this.$el.getBoundingClientRect().left;
@@ -234,6 +249,7 @@ var script = {
234
249
  },
235
250
 
236
251
  deactivate(token) {
252
+ this.intendedCursorPosition = 'end';
237
253
  const tokenIdx = this.tokens.indexOf(token);
238
254
 
239
255
  if (tokenIdx === -1 || this.activeTokenIdx !== tokenIdx) {
@@ -327,7 +343,7 @@ const __vue_script__ = script;
327
343
  /* template */
328
344
  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.id,ref:"tokens",refInFor:true,tag:"component",staticClass:"gl-filtered-search-item",class:{
329
345
  'gl-filtered-search-last-item': _vm.isLastToken(idx),
330
- },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))};
346
+ },attrs:{"config":_vm.getTokenEntry(token.type),"active":_vm.activeTokenIdx === idx,"cursor-position":_vm.intendedCursorPosition,"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)},"previous":_vm.activatePreviousToken,"next":_vm.activateNextToken},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))};
331
347
  var __vue_staticRenderFns__ = [];
332
348
 
333
349
  /* style */
@@ -69,6 +69,11 @@ var script = {
69
69
  type: Array,
70
70
  required: false,
71
71
  default: () => []
72
+ },
73
+ cursorPosition: {
74
+ type: String,
75
+ required: true,
76
+ validator: value => ['start', 'end'].includes(value)
72
77
  }
73
78
  },
74
79
  computed: {
@@ -116,7 +121,7 @@ var script = {
116
121
  const __vue_script__ = script;
117
122
 
118
123
  /* template */
119
- 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)};
124
+ 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",attrs:{"data-testid":"filtered-search-term"}},[_c('gl-filtered-search-token-segment',{ref:"segment",staticClass:"gl-filtered-search-term-token",class:{ 'gl-w-full': _vm.placeholder },attrs:{"active":_vm.active,"cursor-position":_vm.cursorPosition,"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)},"previous":function($event){return _vm.$emit('previous')},"next":function($event){return _vm.$emit('next')}},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,"data-testid":"filtered-search-term-input"}},'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)};
120
125
  var __vue_staticRenderFns__ = [];
121
126
 
122
127
  /* style */
@@ -73,13 +73,19 @@ var script = {
73
73
  type: Boolean,
74
74
  required: false,
75
75
  default: false
76
+ },
77
+ cursorPosition: {
78
+ type: String,
79
+ required: true,
80
+ validator: value => ['start', 'end'].includes(value)
76
81
  }
77
82
  },
78
83
 
79
84
  data() {
80
85
  return {
81
86
  activeSegment: null,
82
- tokenValue: _cloneDeep(this.value)
87
+ tokenValue: _cloneDeep(this.value),
88
+ intendedCursorPosition: this.cursorPosition
83
89
  };
84
90
  },
85
91
 
@@ -139,6 +145,8 @@ var script = {
139
145
 
140
146
  handler(newValue) {
141
147
  if (newValue) {
148
+ this.intendedCursorPosition = this.cursorPosition;
149
+
142
150
  if (!this.activeSegment) {
143
151
  this.activateSegment(this.tokenValue.data !== '' ? SEGMENT_DATA : SEGMENT_OPERATOR);
144
152
  }
@@ -274,6 +282,26 @@ var script = {
274
282
  this.activateSegment(this.$options.segments.SEGMENT_DATA);
275
283
  },
276
284
 
285
+ activatePreviousOperatorSegment() {
286
+ this.activateSegment(this.$options.segments.SEGMENT_OPERATOR);
287
+ this.intendedCursorPosition = 'end';
288
+ },
289
+
290
+ activatePreviousTitleSegment() {
291
+ this.activateSegment(this.$options.segments.SEGMENT_TITLE);
292
+ this.intendedCursorPosition = 'end';
293
+ },
294
+
295
+ activateNextDataSegment() {
296
+ this.activateDataSegment();
297
+ this.intendedCursorPosition = 'start';
298
+ },
299
+
300
+ activateNextOperatorSegment() {
301
+ this.activateSegment(this.$options.segments.SEGMENT_OPERATOR);
302
+ this.intendedCursorPosition = 'start';
303
+ },
304
+
277
305
  handleComplete() {
278
306
  if (this.config.multiSelect) {
279
307
  this.$emit('input', { ...this.tokenValue,
@@ -305,11 +333,11 @@ var script = {
305
333
  const __vue_script__ = script;
306
334
 
307
335
  /* template */
308
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-filtered-search-token",class:{ 'gl-filtered-search-token-active': _vm.active }},[_c('gl-filtered-search-token-segment',{key:"title-segment",attrs:{"value":_vm.config.title,"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_TITLE),"options":_vm.availableTokensWithSelf},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_TITLE)},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":_vm.replaceToken,"backspace":function($event){return _vm.$emit('destroy')},"submit":function($event){return _vm.$emit('submit')}},scopedSlots:_vm._u([{key:"view",fn:function(ref){
336
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-filtered-search-token",class:{ 'gl-filtered-search-token-active': _vm.active },attrs:{"data-testid":"filtered-search-token"}},[_c('gl-filtered-search-token-segment',{key:"title-segment",attrs:{"value":_vm.config.title,"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_TITLE),"cursor-position":_vm.intendedCursorPosition,"options":_vm.availableTokensWithSelf},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_TITLE)},"deactivate":function($event){return _vm.$emit('deactivate')},"complete":_vm.replaceToken,"backspace":function($event){return _vm.$emit('destroy')},"submit":function($event){return _vm.$emit('submit')},"previous":function($event){return _vm.$emit('previous')},"next":_vm.activateNextOperatorSegment},scopedSlots:_vm._u([{key:"view",fn:function(ref){
309
337
  var inputValue = ref.inputValue;
310
- return [_c('gl-token',{staticClass:"gl-filtered-search-token-type",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_TITLE),attrs:{"view-only":""}},[_vm._v(_vm._s(inputValue))])]}}])}),_vm._v(" "),_c('gl-filtered-search-token-segment',{key:"operator-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_OPERATOR),"options":_vm.operators,"custom-input-keydown-handler":_vm.handleOperatorKeydown,"view-only":""},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"backspace":_vm.replaceWithTermIfEmpty,"complete":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_DATA)},"deactivate":function($event){return _vm.$emit('deactivate')}},scopedSlots:_vm._u([{key:"view",fn:function(){return [_c('gl-token',{staticClass:"gl-filtered-search-token-operator",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_OPERATOR),attrs:{"variant":"search-value","view-only":""}},[_vm._v(_vm._s(_vm.operatorDescription))])]},proxy:true},{key:"option",fn:function(ref){
338
+ return [_c('gl-token',{staticClass:"gl-filtered-search-token-type",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_TITLE),attrs:{"view-only":""}},[_vm._v(_vm._s(inputValue))])]}}])}),_vm._v(" "),_c('gl-filtered-search-token-segment',{key:"operator-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_OPERATOR),"cursor-position":_vm.intendedCursorPosition,"options":_vm.operators,"custom-input-keydown-handler":_vm.handleOperatorKeydown,"view-only":""},on:{"activate":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"backspace":_vm.replaceWithTermIfEmpty,"complete":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_DATA)},"deactivate":function($event){return _vm.$emit('deactivate')},"previous":_vm.activatePreviousTitleSegment,"next":_vm.activateNextDataSegment},scopedSlots:_vm._u([{key:"view",fn:function(){return [_c('gl-token',{staticClass:"gl-filtered-search-token-operator",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_OPERATOR),attrs:{"variant":"search-value","view-only":""}},[_vm._v(_vm._s(_vm.operatorDescription))])]},proxy:true},{key:"option",fn:function(ref){
311
339
  var option = ref.option;
312
- return [_c('div',{staticClass:"gl-display-flex"},[_vm._v("\n "+_vm._s(option.value)+"\n "),(option.description)?_c('span',{staticClass:"gl-filtered-search-token-operator-description"},[_vm._v("\n "+_vm._s(option.description)+"\n ")]):_vm._e()])]}}]),model:{value:(_vm.tokenValue.operator),callback:function ($$v) {_vm.$set(_vm.tokenValue, "operator", $$v);},expression:"tokenValue.operator"}}),_vm._v(" "),(_vm.hasDataOrDataSegmentIsCurrentlyActive)?_c('gl-filtered-search-token-segment',{key:"data-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_DATA),"multi-select":_vm.config.multiSelect,"options":_vm.config.options,"option-text-field":"title"},on:{"activate":_vm.activateDataSegment,"backspace":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"complete":_vm.handleComplete,"select":function($event){return _vm.$emit('select', $event)},"submit":function($event){return _vm.$emit('submit')},"deactivate":function($event){return _vm.$emit('deactivate')},"split":function($event){return _vm.$emit('split', $event)}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return [_vm._t("suggestions")]},proxy:true},{key:"view",fn:function(ref){
340
+ return [_c('div',{staticClass:"gl-display-flex"},[_vm._v("\n "+_vm._s(option.value)+"\n "),(option.description)?_c('span',{staticClass:"gl-filtered-search-token-operator-description"},[_vm._v("\n "+_vm._s(option.description)+"\n ")]):_vm._e()])]}}]),model:{value:(_vm.tokenValue.operator),callback:function ($$v) {_vm.$set(_vm.tokenValue, "operator", $$v);},expression:"tokenValue.operator"}}),_vm._v(" "),(_vm.hasDataOrDataSegmentIsCurrentlyActive)?_c('gl-filtered-search-token-segment',{key:"data-segment",attrs:{"active":_vm.isSegmentActive(_vm.$options.segments.SEGMENT_DATA),"cursor-position":_vm.intendedCursorPosition,"multi-select":_vm.config.multiSelect,"options":_vm.config.options,"option-text-field":"title"},on:{"activate":_vm.activateDataSegment,"backspace":function($event){return _vm.activateSegment(_vm.$options.segments.SEGMENT_OPERATOR)},"complete":_vm.handleComplete,"select":function($event){return _vm.$emit('select', $event)},"submit":function($event){return _vm.$emit('submit')},"deactivate":function($event){return _vm.$emit('deactivate')},"split":function($event){return _vm.$emit('split', $event)},"previous":_vm.activatePreviousOperatorSegment,"next":function($event){return _vm.$emit('next')}},scopedSlots:_vm._u([{key:"suggestions",fn:function(){return [_vm._t("suggestions")]},proxy:true},{key:"view",fn:function(ref){
313
341
  var inputValue = ref.inputValue;
314
342
  return [_vm._t("view-token",[_c('gl-token',{staticClass:"gl-filtered-search-token-data",class:_vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_DATA),attrs:{"variant":"search-value"},on:{"mousedown":_vm.destroyByClose}},[_c('span',{staticClass:"gl-filtered-search-token-data-content"},[_vm._t("view",[_vm._v(_vm._s(inputValue))],null,{ inputValue: inputValue })],2)])],null,{
315
343
  inputValue: inputValue,
@@ -79,6 +79,11 @@ var script = {
79
79
  type: Array,
80
80
  required: false,
81
81
  default: () => []
82
+ },
83
+ cursorPosition: {
84
+ type: String,
85
+ required: true,
86
+ validator: value => ['start', 'end'].includes(value)
82
87
  }
83
88
  },
84
89
 
@@ -218,6 +223,10 @@ var script = {
218
223
  inline: 'end'
219
224
  });
220
225
  this.alignSuggestions(input);
226
+
227
+ if (this.cursorPosition === 'start') {
228
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 0);
229
+ }
221
230
  }
222
231
  });
223
232
  },
@@ -255,24 +264,33 @@ var script = {
255
264
  key
256
265
  } = e;
257
266
  const {
258
- suggestions
267
+ suggestions,
268
+ input
259
269
  } = this.$refs;
260
270
  const suggestedValue = suggestions === null || suggestions === void 0 ? void 0 : suggestions.getValue();
261
-
262
- if (key === 'Backspace') {
263
- if (this.inputValue === '') {
264
- e.preventDefault();
265
- /**
266
- * Emitted when Backspace is pressed and the value is empty
267
- */
268
-
269
- this.$emit('backspace');
270
- }
271
-
272
- return;
273
- }
274
-
275
271
  const handlers = {
272
+ ArrowLeft: () => {
273
+ if (input.selectionStart === 0) {
274
+ e.preventDefault();
275
+ this.$emit('previous');
276
+ }
277
+ },
278
+ ArrowRight: () => {
279
+ if (input.selectionEnd === this.inputValue.length) {
280
+ e.preventDefault();
281
+ this.$emit('next');
282
+ }
283
+ },
284
+ Backspace: () => {
285
+ if (this.inputValue === '') {
286
+ e.preventDefault();
287
+ /**
288
+ * Emitted when Backspace is pressed and the value is empty
289
+ */
290
+
291
+ this.$emit('backspace');
292
+ }
293
+ },
276
294
  Enter: () => {
277
295
  e.preventDefault();
278
296
 
@@ -341,7 +359,9 @@ var script = {
341
359
  const __vue_script__ = script;
342
360
 
343
361
  /* template */
344
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._b({staticClass:"gl-filtered-search-token-segment",class:{ 'gl-filtered-search-token-segment-active': _vm.active },attrs:{"data-testid":"filtered-search-token-segment"},on:{"mousedown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"left",37,$event.key,["Left","ArrowLeft"])){ return null; }if('button' in $event && $event.button !== 0){ return null; }return _vm.emitIfInactive($event)}}},'div',_vm.containerAttributes,false),[(_vm.active)?[(((_vm.searchInputAttributes).type)==='checkbox')?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":"checkbox"},domProps:{"checked":Array.isArray(_vm.inputValue)?_vm._i(_vm.inputValue,null)>-1:(_vm.inputValue)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"change":function($event){var $$a=_vm.inputValue,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.inputValue=$$a.concat([$$v]));}else {$$i>-1&&(_vm.inputValue=$$a.slice(0,$$i).concat($$a.slice($$i+1)));}}else {_vm.inputValue=$$c;}}}},'input',_vm.searchInputAttributes,false)):(((_vm.searchInputAttributes).type)==='radio')?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":"radio"},domProps:{"checked":_vm._q(_vm.inputValue,null)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"change":function($event){_vm.inputValue=null;}}},'input',_vm.searchInputAttributes,false)):_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":(_vm.searchInputAttributes).type},domProps:{"value":(_vm.inputValue)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"input":function($event){if($event.target.composing){ return; }_vm.inputValue=$event.target.value;}}},'input',_vm.searchInputAttributes,false)),_vm._v(" "),_c('portal',{key:("operator-" + _vm._uid),attrs:{"to":_vm.portalName}},[(_vm.hasOptionsOrSuggestions)?_c('gl-filtered-search-suggestion-list',{key:("operator-" + _vm._uid),ref:"suggestions",attrs:{"initial-value":_vm.defaultSuggestedValue},on:{"suggestion":_vm.applySuggestion}},[(_vm.options)?_vm._l((_vm.options),function(option,idx){return _c('gl-filtered-search-suggestion',{key:((option.value) + "-" + idx),attrs:{"value":option.value,"icon-name":option.icon}},[_vm._t("option",[_vm._v("\n "+_vm._s(option[_vm.optionTextField])+"\n ")],null,{ option: option })],2)}):_vm._t("suggestions")],2):_vm._e()],1)]:_vm._t("view",[_vm._v(_vm._s(_vm.inputValue))],null,{ inputValue: _vm.inputValue })],2)};
362
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._b({staticClass:"gl-filtered-search-token-segment",class:{
363
+ 'gl-filtered-search-token-segment-active': _vm.active,
364
+ },attrs:{"data-testid":"filtered-search-token-segment"},on:{"mousedown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"left",37,$event.key,["Left","ArrowLeft"])){ return null; }if('button' in $event && $event.button !== 0){ return null; }return _vm.emitIfInactive($event)}}},'div',_vm.containerAttributes,false),[(_vm.active)?[(((_vm.searchInputAttributes).type)==='checkbox')?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":"checkbox"},domProps:{"checked":Array.isArray(_vm.inputValue)?_vm._i(_vm.inputValue,null)>-1:(_vm.inputValue)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"change":function($event){var $$a=_vm.inputValue,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.inputValue=$$a.concat([$$v]));}else {$$i>-1&&(_vm.inputValue=$$a.slice(0,$$i).concat($$a.slice($$i+1)));}}else {_vm.inputValue=$$c;}}}},'input',_vm.searchInputAttributes,false)):(((_vm.searchInputAttributes).type)==='radio')?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":"radio"},domProps:{"checked":_vm._q(_vm.inputValue,null)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"change":function($event){_vm.inputValue=null;}}},'input',_vm.searchInputAttributes,false)):_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.inputValue),expression:"inputValue"}],ref:"input",staticClass:"gl-filtered-search-token-segment-input",attrs:{"aria-label":_vm.label,"type":(_vm.searchInputAttributes).type},domProps:{"value":(_vm.inputValue)},on:{"keydown":_vm.handleInputKeydown,"blur":_vm.handleBlur,"input":function($event){if($event.target.composing){ return; }_vm.inputValue=$event.target.value;}}},'input',_vm.searchInputAttributes,false)),_vm._v(" "),_c('portal',{key:("operator-" + _vm._uid),attrs:{"to":_vm.portalName}},[(_vm.hasOptionsOrSuggestions)?_c('gl-filtered-search-suggestion-list',{key:("operator-" + _vm._uid),ref:"suggestions",attrs:{"initial-value":_vm.defaultSuggestedValue},on:{"suggestion":_vm.applySuggestion}},[(_vm.options)?_vm._l((_vm.options),function(option,idx){return _c('gl-filtered-search-suggestion',{key:((option.value) + "-" + idx),attrs:{"value":option.value,"icon-name":option.icon}},[_vm._t("option",[_vm._v("\n "+_vm._s(option[_vm.optionTextField])+"\n ")],null,{ option: option })],2)}):_vm._t("suggestions")],2):_vm._e()],1)]:_vm._t("view",[_vm._v(_vm._s(_vm.inputValue))],null,{ inputValue: _vm.inputValue })],2)};
345
365
  var __vue_staticRenderFns__ = [];
346
366
 
347
367
  /* style */
@@ -1,6 +1,4 @@
1
1
  import { BFormTextarea } from 'bootstrap-vue/esm/index.js';
2
- import GlSprintf from '../../../utilities/sprintf/sprintf';
3
- import { textareaCountOptions } from '../../../../utils/constants';
4
2
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
3
 
6
4
  const model = {
@@ -9,8 +7,7 @@ const model = {
9
7
  };
10
8
  var script = {
11
9
  components: {
12
- BFormTextarea,
13
- GlSprintf
10
+ BFormTextarea
14
11
  },
15
12
  inheritAttrs: false,
16
13
  model,
@@ -31,27 +28,6 @@ var script = {
31
28
  type: Boolean,
32
29
  required: false,
33
30
  default: false
34
- },
35
- count: {
36
- type: Number,
37
- required: false,
38
- default: 0
39
- },
40
- countType: {
41
- required: false,
42
- type: String,
43
- default: textareaCountOptions.max,
44
- validator: value => Object.keys(textareaCountOptions).includes(value)
45
- },
46
- characterCountText: {
47
- required: false,
48
- type: String,
49
- default: ''
50
- },
51
- characterCountOverLimitText: {
52
- required: false,
53
- type: String,
54
- default: ''
55
31
  }
56
32
  },
57
33
  computed: {
@@ -88,42 +64,6 @@ var script = {
88
64
 
89
65
  keypressEvent() {
90
66
  return this.submitOnEnter ? 'keyup' : null;
91
- },
92
-
93
- characters() {
94
- return this.value.length;
95
- },
96
-
97
- remainingCharacters() {
98
- if (this.count) {
99
- return Math.abs(this.count - this.characters);
100
- }
101
-
102
- return null;
103
- },
104
-
105
- characterCountClasses() {
106
- switch (this.countType) {
107
- case textareaCountOptions.max:
108
- return {
109
- 'gl-text-red-500': this.value.length > this.count,
110
- 'gl-text-gray-500': this.value.length <= this.count
111
- };
112
-
113
- case textareaCountOptions.recommended:
114
- return 'gl-text-gray-500';
115
-
116
- default:
117
- return {};
118
- }
119
- },
120
-
121
- hasCount() {
122
- return this.remainingCharacters != null;
123
- },
124
-
125
- characterCountMessage() {
126
- return this.characters > this.count ? this.characterCountOverLimitText : this.characterCountText;
127
67
  }
128
68
 
129
69
  },
@@ -141,7 +81,7 @@ var script = {
141
81
  const __vue_script__ = script;
142
82
 
143
83
  /* template */
144
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('b-form-textarea',_vm._g(_vm._b({ref:"textarea",staticClass:"gl-form-input gl-form-textarea",attrs:{"no-resize":_vm.noResize,"value":_vm.value},nativeOn:_vm._d({},[_vm.keypressEvent,function($event){return _vm.handleKeyPress($event)}])},'b-form-textarea',_vm.$attrs,false),_vm.listeners)),_vm._v(" "),(_vm.hasCount)?_c('div',[_c('small',{class:_vm.characterCountClasses,attrs:{"aria-live":"polite"}},[_c('gl-sprintf',{attrs:{"message":_vm.characterCountMessage},scopedSlots:_vm._u([{key:"count",fn:function(){return [_vm._v(_vm._s(_vm.remainingCharacters))]},proxy:true}],null,false,2559963941)})],1)]):_vm._e()],1)};
84
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-textarea',_vm._g(_vm._b({staticClass:"gl-form-input gl-form-textarea",attrs:{"no-resize":_vm.noResize,"value":_vm.value},nativeOn:_vm._d({},[_vm.keypressEvent,function($event){return _vm.handleKeyPress($event)}])},'b-form-textarea',_vm.$attrs,false),_vm.listeners))};
145
85
  var __vue_staticRenderFns__ = [];
146
86
 
147
87
  /* style */