@gitlab/ui 38.0.0 → 38.2.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 (138) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -1
  3. package/dist/components/base/breadcrumb/breadcrumb.js +10 -5
  4. package/dist/components/base/{filtered_search/examples/filtered_search.single_unique.example.js → breadcrumb/breadcrumb_item.js} +32 -28
  5. package/dist/components/base/dropdown/dropdown.documentation.js +1 -5
  6. package/dist/components/base/dropdown/dropdown_item.documentation.js +2 -3
  7. package/dist/components/base/filtered_search/filtered_search.documentation.js +2 -66
  8. package/dist/components/base/filtered_search/filtered_search.js +38 -0
  9. package/dist/components/base/filtered_search/filtered_search_suggestion.documentation.js +2 -8
  10. package/dist/components/base/filtered_search/filtered_search_suggestion.js +4 -0
  11. package/dist/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +2 -7
  12. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +4 -0
  13. package/dist/components/base/filtered_search/filtered_search_term.documentation.js +2 -44
  14. package/dist/components/base/filtered_search/filtered_search_term.js +37 -0
  15. package/dist/components/base/filtered_search/filtered_search_token.documentation.js +2 -31
  16. package/dist/components/base/filtered_search/filtered_search_token.js +77 -16
  17. package/dist/components/base/filtered_search/filtered_search_token_segment.documentation.js +2 -46
  18. package/dist/components/base/filtered_search/filtered_search_token_segment.js +48 -0
  19. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +2 -27
  20. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +16 -1
  21. package/dist/components/base/form/form_radio/form_radio.js +1 -1
  22. package/dist/components/charts/series_label/series_label.js +6 -1
  23. package/dist/index.css +1 -1
  24. package/dist/index.css.map +1 -1
  25. package/dist/utils/use_mock_intersection_observer.js +2 -2
  26. package/documentation/components_documentation.js +0 -4
  27. package/documentation/documented_stories.js +10 -1
  28. package/package.json +11 -9
  29. package/src/components/base/avatar_link/avatar_link.stories.js +2 -2
  30. package/src/components/base/breadcrumb/breadcrumb.spec.js +24 -10
  31. package/src/components/base/breadcrumb/breadcrumb.vue +11 -6
  32. package/src/components/base/breadcrumb/breadcrumb_item.spec.js +45 -0
  33. package/src/components/base/breadcrumb/breadcrumb_item.vue +43 -0
  34. package/src/components/base/dropdown/dropdown.documentation.js +0 -3
  35. package/src/components/base/dropdown/dropdown.md +7 -2
  36. package/src/components/base/dropdown/dropdown.stories.js +487 -439
  37. package/src/components/base/dropdown/dropdown_item.documentation.js +0 -1
  38. package/src/components/base/dropdown/dropdown_item.md +0 -6
  39. package/src/components/base/dropdown/dropdown_item.stories.js +107 -35
  40. package/src/components/base/filtered_search/filtered_search.documentation.js +0 -76
  41. package/src/components/base/filtered_search/filtered_search.md +3 -4
  42. package/src/components/base/filtered_search/filtered_search.stories.js +249 -13
  43. package/src/components/base/filtered_search/filtered_search.vue +45 -0
  44. package/src/components/base/filtered_search/filtered_search_suggestion.documentation.js +0 -6
  45. package/src/components/base/filtered_search/filtered_search_suggestion.md +1 -7
  46. package/src/components/base/filtered_search/filtered_search_suggestion.stories.js +26 -18
  47. package/src/components/base/filtered_search/filtered_search_suggestion.vue +5 -0
  48. package/src/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +0 -5
  49. package/src/components/base/filtered_search/filtered_search_suggestion_list.md +1 -7
  50. package/src/components/base/filtered_search/filtered_search_suggestion_list.stories.js +33 -25
  51. package/src/components/base/filtered_search/filtered_search_suggestion_list.vue +5 -0
  52. package/src/components/base/filtered_search/filtered_search_term.documentation.js +0 -41
  53. package/src/components/base/filtered_search/filtered_search_term.md +0 -2
  54. package/src/components/base/filtered_search/filtered_search_term.stories.js +33 -26
  55. package/src/components/base/filtered_search/filtered_search_term.vue +54 -0
  56. package/src/components/base/filtered_search/filtered_search_token.documentation.js +0 -26
  57. package/src/components/base/filtered_search/filtered_search_token.md +1 -3
  58. package/src/components/base/filtered_search/filtered_search_token.spec.js +22 -0
  59. package/src/components/base/filtered_search/filtered_search_token.stories.js +137 -132
  60. package/src/components/base/filtered_search/filtered_search_token.vue +90 -19
  61. package/src/components/base/filtered_search/filtered_search_token_segment.documentation.js +0 -43
  62. package/src/components/base/filtered_search/filtered_search_token_segment.md +0 -2
  63. package/src/components/base/filtered_search/filtered_search_token_segment.stories.js +86 -79
  64. package/src/components/base/filtered_search/filtered_search_token_segment.vue +42 -0
  65. package/src/components/base/form/form.stories.js +2 -0
  66. package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +0 -26
  67. package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.md +0 -4
  68. package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.stories.js +123 -92
  69. package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.vue +13 -1
  70. package/src/components/base/form/form_radio/form_radio.spec.js +21 -8
  71. package/src/components/base/form/form_radio/form_radio.vue +0 -1
  72. package/src/components/base/form/form_radio_group/form_radio_group.stories.js +2 -1
  73. package/src/components/base/markdown/markdown.scss +21 -0
  74. package/src/components/base/markdown/markdown_typescale_demo.html +17 -6
  75. package/src/components/base/navbar/navbar.stories.js +2 -1
  76. package/src/components/base/tabs/tabs/tabs.stories.js +2 -2
  77. package/src/components/charts/series_label/series_label.stories.js +6 -3
  78. package/src/components/charts/series_label/series_label.vue +3 -0
  79. package/src/scss/typescale/typescale.md +0 -2
  80. package/src/scss/typescale/typescale.stories.js +17 -4
  81. package/src/utils/use_mock_intersection_observer.js +3 -3
  82. package/dist/components/base/dropdown/dropdown_divider.documentation.js +0 -8
  83. package/dist/components/base/dropdown/dropdown_form.documentation.js +0 -17
  84. package/dist/components/base/dropdown/dropdown_section_header.documentation.js +0 -8
  85. package/dist/components/base/dropdown/dropdown_text.documentation.js +0 -8
  86. package/dist/components/base/dropdown/examples/dropdown.default.example.js +0 -38
  87. package/dist/components/base/dropdown/examples/dropdown.links.example.js +0 -38
  88. package/dist/components/base/dropdown/examples/dropdown.with_avatar_and_secondary_text.example.js +0 -38
  89. package/dist/components/base/dropdown/examples/dropdown.with_checked_items.example.js +0 -38
  90. package/dist/components/base/dropdown/examples/dropdown.with_clear_all.example.js +0 -38
  91. package/dist/components/base/dropdown/examples/dropdown.with_divider.example.js +0 -38
  92. package/dist/components/base/dropdown/examples/dropdown.with_form.example.js +0 -38
  93. package/dist/components/base/dropdown/examples/dropdown.with_header.example.js +0 -38
  94. package/dist/components/base/dropdown/examples/dropdown.with_highlighted_items.example.js +0 -38
  95. package/dist/components/base/dropdown/examples/dropdown.with_icons.example.js +0 -38
  96. package/dist/components/base/dropdown/examples/dropdown.with_right_align.example.js +0 -38
  97. package/dist/components/base/dropdown/examples/dropdown.with_search.example.js +0 -67
  98. package/dist/components/base/dropdown/examples/dropdown.with_section_headers.example.js +0 -38
  99. package/dist/components/base/dropdown/examples/index.js +0 -85
  100. package/dist/components/base/filtered_search/examples/filtered_search.default.example.js +0 -422
  101. package/dist/components/base/filtered_search/examples/filtered_search.friendly.example.js +0 -423
  102. package/dist/components/base/filtered_search/examples/filtered_search.history.example.js +0 -91
  103. package/dist/components/base/filtered_search/examples/filtered_search.multi_select.example.js +0 -196
  104. package/dist/components/base/filtered_search/examples/index.js +0 -32
  105. package/dist/components/base/form/form_checkbox_tree/examples/form_checkbox_tree.basic.example.js +0 -103
  106. package/dist/components/base/form/form_checkbox_tree/examples/index.js +0 -13
  107. package/src/components/base/dropdown/dropdown_divider.documentation.js +0 -6
  108. package/src/components/base/dropdown/dropdown_divider.md +0 -7
  109. package/src/components/base/dropdown/dropdown_divider.stories.js +0 -16
  110. package/src/components/base/dropdown/dropdown_form.documentation.js +0 -9
  111. package/src/components/base/dropdown/dropdown_form.md +0 -4
  112. package/src/components/base/dropdown/dropdown_form.stories.js +0 -17
  113. package/src/components/base/dropdown/dropdown_section_header.documentation.js +0 -6
  114. package/src/components/base/dropdown/dropdown_section_header.stories.js +0 -17
  115. package/src/components/base/dropdown/dropdown_text.documentation.js +0 -6
  116. package/src/components/base/dropdown/dropdown_text.stories.js +0 -16
  117. package/src/components/base/dropdown/examples/dropdown.default.example.vue +0 -7
  118. package/src/components/base/dropdown/examples/dropdown.links.example.vue +0 -7
  119. package/src/components/base/dropdown/examples/dropdown.with_avatar_and_secondary_text.example.vue +0 -7
  120. package/src/components/base/dropdown/examples/dropdown.with_checked_items.example.vue +0 -6
  121. package/src/components/base/dropdown/examples/dropdown.with_clear_all.example.vue +0 -7
  122. package/src/components/base/dropdown/examples/dropdown.with_divider.example.vue +0 -9
  123. package/src/components/base/dropdown/examples/dropdown.with_form.example.vue +0 -10
  124. package/src/components/base/dropdown/examples/dropdown.with_header.example.vue +0 -7
  125. package/src/components/base/dropdown/examples/dropdown.with_highlighted_items.example.vue +0 -9
  126. package/src/components/base/dropdown/examples/dropdown.with_icons.example.vue +0 -43
  127. package/src/components/base/dropdown/examples/dropdown.with_right_align.example.vue +0 -7
  128. package/src/components/base/dropdown/examples/dropdown.with_search.example.vue +0 -38
  129. package/src/components/base/dropdown/examples/dropdown.with_section_headers.example.vue +0 -10
  130. package/src/components/base/dropdown/examples/index.js +0 -99
  131. package/src/components/base/filtered_search/examples/filtered_search.default.example.vue +0 -298
  132. package/src/components/base/filtered_search/examples/filtered_search.friendly.example.vue +0 -300
  133. package/src/components/base/filtered_search/examples/filtered_search.history.example.vue +0 -50
  134. package/src/components/base/filtered_search/examples/filtered_search.multi_select.example.vue +0 -132
  135. package/src/components/base/filtered_search/examples/filtered_search.single_unique.example.vue +0 -31
  136. package/src/components/base/filtered_search/examples/index.js +0 -38
  137. package/src/components/base/form/form_checkbox_tree/examples/form_checkbox_tree.basic.example.vue +0 -77
  138. package/src/components/base/form/form_checkbox_tree/examples/index.js +0 -15
@@ -1,3 +1,4 @@
1
+ import _cloneDeep from 'lodash/cloneDeep';
1
2
  import { COMMA } from '../../../utils/constants';
2
3
  import GlToken from '../token/token';
3
4
  import GlFilteredSearchTokenSegment from './filtered_search_token_segment';
@@ -17,6 +18,7 @@ const DEFAULT_OPERATORS = [{
17
18
  description: 'is not'
18
19
  }];
19
20
  var script = {
21
+ name: 'GlFilteredSearchToken',
20
22
  components: {
21
23
  GlToken,
22
24
  GlFilteredSearchTokenSegment
@@ -28,11 +30,19 @@ var script = {
28
30
  required: false,
29
31
  default: () => []
30
32
  },
33
+
34
+ /**
35
+ * Token configuration with available operators and options.
36
+ */
31
37
  config: {
32
38
  type: Object,
33
39
  required: false,
34
40
  default: () => ({})
35
41
  },
42
+
43
+ /**
44
+ * Determines if the token is being edited or not.
45
+ */
36
46
  active: {
37
47
  type: Boolean,
38
48
  required: false,
@@ -43,6 +53,10 @@ var script = {
43
53
  required: false,
44
54
  default: () => []
45
55
  },
56
+
57
+ /**
58
+ * Current token value.
59
+ */
46
60
  value: {
47
61
  type: Object,
48
62
  required: false,
@@ -51,6 +65,10 @@ var script = {
51
65
  data: ''
52
66
  })
53
67
  },
68
+
69
+ /**
70
+ * Display operators' descriptions instead of their values (e.g., "is" instead of "=").
71
+ */
54
72
  showFriendlyText: {
55
73
  type: Boolean,
56
74
  required: false,
@@ -60,7 +78,8 @@ var script = {
60
78
 
61
79
  data() {
62
80
  return {
63
- activeSegment: null
81
+ activeSegment: null,
82
+ tokenValue: _cloneDeep(this.value)
64
83
  };
65
84
  },
66
85
 
@@ -70,7 +89,7 @@ var script = {
70
89
  },
71
90
 
72
91
  hasDataOrDataSegmentIsCurrentlyActive() {
73
- return this.value.data !== '' || this.isSegmentActive(SEGMENT_DATA);
92
+ return this.tokenValue.data !== '' || this.isSegmentActive(SEGMENT_DATA);
74
93
  },
75
94
 
76
95
  availableTokensWithSelf() {
@@ -80,7 +99,7 @@ var script = {
80
99
  },
81
100
 
82
101
  operatorDescription() {
83
- const operator = this.operators.find(op => op.value === this.value.operator);
102
+ const operator = this.operators.find(op => op.value === this.tokenValue.operator);
84
103
  return this.showFriendlyText ? operator === null || operator === void 0 ? void 0 : operator.description : operator === null || operator === void 0 ? void 0 : operator.value;
85
104
  }
86
105
 
@@ -91,13 +110,29 @@ var script = {
91
110
  SEGMENT_OPERATOR
92
111
  },
93
112
  watch: {
94
- value: {
113
+ tokenValue: {
95
114
  deep: true,
96
115
 
97
116
  handler(newValue) {
117
+ /**
118
+ * Emitted when the token changes its value.
119
+ *
120
+ * @event input
121
+ * @type {object} dataObj Object containing the update value.
122
+ */
98
123
  this.$emit('input', newValue);
99
124
  }
100
125
 
126
+ },
127
+ value: {
128
+ handler(newValue, oldValue) {
129
+ if ((newValue === null || newValue === void 0 ? void 0 : newValue.data) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.data) && (newValue === null || newValue === void 0 ? void 0 : newValue.operator) === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.operator)) {
130
+ return;
131
+ }
132
+
133
+ this.tokenValue = _cloneDeep(newValue);
134
+ }
135
+
101
136
  },
102
137
  active: {
103
138
  immediate: true,
@@ -105,10 +140,16 @@ var script = {
105
140
  handler(newValue) {
106
141
  if (newValue) {
107
142
  if (!this.activeSegment) {
108
- this.activateSegment(this.value.data !== '' ? SEGMENT_DATA : SEGMENT_OPERATOR);
143
+ this.activateSegment(this.tokenValue.data !== '' ? SEGMENT_DATA : SEGMENT_OPERATOR);
109
144
  }
110
- } else if (this.value.data === '') {
145
+ } else if (this.tokenValue.data === '') {
111
146
  this.activeSegment = null;
147
+ /**
148
+ * Emitted when token is about to be destroyed.
149
+ *
150
+ * @event destroy
151
+ */
152
+
112
153
  this.$emit('destroy');
113
154
  }
114
155
  }
@@ -117,15 +158,15 @@ var script = {
117
158
  },
118
159
 
119
160
  created() {
120
- if (!('operator' in this.value)) {
161
+ if (!('operator' in this.tokenValue)) {
121
162
  if (this.operators.length === 1) {
122
163
  const operator = this.operators[0].value;
123
- this.$emit('input', { ...this.value,
164
+ this.$emit('input', { ...this.tokenValue,
124
165
  operator
125
166
  });
126
167
  this.activeSegment = SEGMENT_DATA;
127
168
  } else {
128
- this.$emit('input', { ...this.value,
169
+ this.$emit('input', { ...this.tokenValue,
129
170
  operator: ''
130
171
  });
131
172
  }
@@ -137,6 +178,11 @@ var script = {
137
178
  this.activeSegment = segment;
138
179
 
139
180
  if (!this.active) {
181
+ /**
182
+ * Emitted when this term token is clicked.
183
+ *
184
+ * @event activate
185
+ */
140
186
  this.$emit('activate');
141
187
  }
142
188
  },
@@ -152,7 +198,11 @@ var script = {
152
198
  },
153
199
 
154
200
  replaceWithTermIfEmpty() {
155
- if (this.value.operator === '' && this.value.data === '') {
201
+ if (this.tokenValue.operator === '' && this.tokenValue.data === '') {
202
+ /**
203
+ * Emitted when this token is converted to another type
204
+ * @property {object} token Replacement token configuration
205
+ */
156
206
  this.$emit('replace', {
157
207
  type: TERM_TOKEN_TYPE,
158
208
  value: {
@@ -167,6 +217,11 @@ var script = {
167
217
 
168
218
  if (newTokenConfig === this.config) {
169
219
  this.$nextTick(() => {
220
+ /**
221
+ * Emitted when this term token will lose its focus.
222
+ *
223
+ * @event deactivate
224
+ */
170
225
  this.$emit('deactivate');
171
226
  });
172
227
  return;
@@ -176,7 +231,7 @@ var script = {
176
231
  const isCompatible = this.config.dataType && this.config.dataType === newTokenConfig.dataType;
177
232
  this.$emit('replace', {
178
233
  type: newTokenConfig.type,
179
- value: isCompatible ? this.value : {
234
+ value: isCompatible ? this.tokenValue : {
180
235
  data: ''
181
236
  }
182
237
  });
@@ -206,7 +261,7 @@ var script = {
206
261
  } = _ref2;
207
262
  return value.startsWith(potentialValue);
208
263
  })) {
209
- if (this.value.data === '') {
264
+ if (this.tokenValue.data === '') {
210
265
  applySuggestion(suggestedValue);
211
266
  } else {
212
267
  evt.preventDefault();
@@ -216,7 +271,7 @@ var script = {
216
271
 
217
272
  activateDataSegment() {
218
273
  if (this.config.multiSelect) {
219
- this.$emit('input', { ...this.value,
274
+ this.$emit('input', { ...this.tokenValue,
220
275
  data: ''
221
276
  });
222
277
  }
@@ -226,10 +281,16 @@ var script = {
226
281
 
227
282
  handleComplete() {
228
283
  if (this.config.multiSelect) {
229
- this.$emit('input', { ...this.value,
284
+ this.$emit('input', { ...this.tokenValue,
230
285
  data: this.multiSelectValues.join(COMMA)
231
286
  });
232
287
  }
288
+ /**
289
+ * Emitted when the token entry has been completed.
290
+ *
291
+ * @event complete
292
+ */
293
+
233
294
 
234
295
  this.$emit('complete');
235
296
  },
@@ -252,14 +313,14 @@ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=
252
313
  var inputValue = ref.inputValue;
253
314
  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){
254
315
  var option = ref.option;
255
- 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.value.operator),callback:function ($$v) {_vm.$set(_vm.value, "operator", $$v);},expression:"value.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){
316
+ 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){
256
317
  var inputValue = ref.inputValue;
257
318
  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,{
258
319
  inputValue: inputValue,
259
320
  listeners: { mousedown: _vm.destroyByClose },
260
321
  cssClasses: Object.assign({}, {'gl-filtered-search-token-data': true},
261
322
  _vm.getAdditionalSegmentClasses(_vm.$options.segments.SEGMENT_DATA)),
262
- })]}}],null,true),model:{value:(_vm.value.data),callback:function ($$v) {_vm.$set(_vm.value, "data", $$v);},expression:"value.data"}}):_vm._e()],1)};
323
+ })]}}],null,true),model:{value:(_vm.tokenValue.data),callback:function ($$v) {_vm.$set(_vm.tokenValue, "data", $$v);},expression:"tokenValue.data"}}):_vm._e()],1)};
263
324
  var __vue_staticRenderFns__ = [];
264
325
 
265
326
  /* style */
@@ -1,4 +1,4 @@
1
- var filtered_search_token_segment = "# Filtered Search Token Segment\n\nThe filtered search token segment is a component for managing token input either via free typing\nor by selecting item through dropdown list\n\n## Usage\n\nThis component is internal and is not intended to be used by `@gitlab/ui` users.\n\n## Internet Explorer 11\n\nThis component uses [`String.prototype.startsWith()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith)\nand [`String.prototype.endsWith()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith)\nunder the hood. Make sure those methods are polyfilled if you plan on using the component on IE11.\n\n> NOTE: These methods are already polyfilled in GitLab: [`app/assets/javascripts/commons/polyfills.js#L15-16`](https://gitlab.com/gitlab-org/gitlab/blob/dc60dee6ed6234dda9f032195577cd8fad9646d8/app/assets/javascripts/commons/polyfills.js#L15-16)\n";
1
+ var filtered_search_token_segment = "The filtered search token segment is a component for managing token input either via free typing\nor by selecting item through dropdown list\n\n## Usage\n\nThis component is internal and is not intended to be used by `@gitlab/ui` users.\n\n## Internet Explorer 11\n\nThis component uses [`String.prototype.startsWith()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith)\nand [`String.prototype.endsWith()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith)\nunder the hood. Make sure those methods are polyfilled if you plan on using the component on IE11.\n\n> NOTE: These methods are already polyfilled in GitLab: [`app/assets/javascripts/commons/polyfills.js#L15-16`](https://gitlab.com/gitlab-org/gitlab/blob/dc60dee6ed6234dda9f032195577cd8fad9646d8/app/assets/javascripts/commons/polyfills.js#L15-16)\n";
2
2
 
3
3
  var description = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
@@ -6,51 +6,7 @@ var description = /*#__PURE__*/Object.freeze({
6
6
  });
7
7
 
8
8
  var filtered_search_token_segment_documentation = {
9
- description,
10
- bootstrapComponent: null,
11
- propsInfo: {
12
- active: {
13
- additionalInfo: 'If this term token is currently active'
14
- },
15
- options: {
16
- additionalInfo: ''
17
- },
18
- optionTextField: {
19
- additionalInfo: ''
20
- },
21
- customInputKeydownHandler: {
22
- additionalInfo: ''
23
- },
24
- value: {
25
- additionalInfo: 'Current term value'
26
- },
27
- searchInputAttributes: {
28
- additionalInfo: 'HTML attributes to add to the search input'
29
- },
30
- isLastToken: {
31
- additionalInfo: 'If this is the last token'
32
- }
33
- },
34
- events: [{
35
- event: 'activate',
36
- description: 'Emitted on mousedown event on the main component'
37
- }, {
38
- event: 'backspace',
39
- description: 'Emitted when Backspace is pressed and the value is empty'
40
- }, {
41
- event: 'complete',
42
- description: 'Emitted when suggestion is selected from the suggestion list'
43
- }, {
44
- event: 'submit',
45
- description: 'Emitted when Enter is pressed and no suggestion is selected'
46
- }, {
47
- event: 'split',
48
- args: [{
49
- arg: 'newStrings',
50
- description: '(Array of strings) New strings to be converted into term tokens'
51
- }],
52
- description: 'Emitted when Space appears in token segment value'
53
- }]
9
+ description
54
10
  };
55
11
 
56
12
  export default filtered_search_token_segment_documentation;
@@ -7,6 +7,7 @@ import { splitOnQuotes, wrapTokenInQuotes } from './filtered_search_utils';
7
7
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
8
8
 
9
9
  var script = {
10
+ name: 'GlFilteredSearchTokenSegment',
10
11
  components: {
11
12
  Portal,
12
13
  GlFilteredSearchSuggestionList,
@@ -15,6 +16,9 @@ var script = {
15
16
  inject: ['portalName', 'alignSuggestions'],
16
17
  inheritAttrs: false,
17
18
  props: {
19
+ /**
20
+ * If this token segment is currently being edited.
21
+ */
18
22
  active: {
19
23
  type: Boolean,
20
24
  required: false,
@@ -45,15 +49,27 @@ var script = {
45
49
  required: false,
46
50
  default: () => () => false
47
51
  },
52
+
53
+ /**
54
+ * Current term value
55
+ */
48
56
  value: {
49
57
  required: true,
50
58
  validator: () => true
51
59
  },
60
+
61
+ /**
62
+ * HTML attributes to add to the search input
63
+ */
52
64
  searchInputAttributes: {
53
65
  type: Object,
54
66
  required: false,
55
67
  default: () => ({})
56
68
  },
69
+
70
+ /**
71
+ * If this is the last token
72
+ */
57
73
  isLastToken: {
58
74
  type: Boolean,
59
75
  required: false,
@@ -91,6 +107,11 @@ var script = {
91
107
  set(v) {
92
108
  var _this$getMatchingOpti, _this$getMatchingOpti2;
93
109
 
110
+ /**
111
+ * Emitted when this token segment's value changes.
112
+ *
113
+ * @type {object} option The current option.
114
+ */
94
115
  this.$emit('input', (_this$getMatchingOpti = (_this$getMatchingOpti2 = this.getMatchingOptionForInputValue(v)) === null || _this$getMatchingOpti2 === void 0 ? void 0 : _this$getMatchingOpti2.value) !== null && _this$getMatchingOpti !== void 0 ? _this$getMatchingOpti : v);
95
116
  }
96
117
 
@@ -152,6 +173,10 @@ var script = {
152
173
  this.$emit('input', (_this$getMatchingOpti3 = (_this$getMatchingOpti4 = this.getMatchingOptionForInputValue(firstWord)) === null || _this$getMatchingOpti4 === void 0 ? void 0 : _this$getMatchingOpti4.value) !== null && _this$getMatchingOpti3 !== void 0 ? _this$getMatchingOpti3 : firstWord);
153
174
 
154
175
  if (otherWords.length) {
176
+ /**
177
+ * Emitted when Space appears in token segment value
178
+ * @property {array|string} newStrings New strings to be converted into term tokens
179
+ */
155
180
  this.$emit('split', otherWords);
156
181
  }
157
182
  }
@@ -160,6 +185,9 @@ var script = {
160
185
  methods: {
161
186
  emitIfInactive(e) {
162
187
  if (!this.active) {
188
+ /**
189
+ * Emitted on mousedown event on the main component.
190
+ */
163
191
  this.$emit('activate');
164
192
  e.preventDefault();
165
193
  }
@@ -208,6 +236,12 @@ var script = {
208
236
 
209
237
  applySuggestion(suggestedValue) {
210
238
  const formattedSuggestedValue = wrapTokenInQuotes(suggestedValue);
239
+ /**
240
+ * Emitted when autocomplete entry is selected.
241
+ *
242
+ * @type {string} value The selected value.
243
+ */
244
+
211
245
  this.$emit('select', formattedSuggestedValue);
212
246
 
213
247
  if (!this.multiSelect) {
@@ -228,6 +262,10 @@ var script = {
228
262
  if (key === 'Backspace') {
229
263
  if (this.inputValue === '') {
230
264
  e.preventDefault();
265
+ /**
266
+ * Emitted when Backspace is pressed and the value is empty
267
+ */
268
+
231
269
  this.$emit('backspace');
232
270
  }
233
271
 
@@ -241,6 +279,9 @@ var script = {
241
279
  if (suggestedValue != null) {
242
280
  this.applySuggestion(suggestedValue);
243
281
  } else {
282
+ /**
283
+ * Emitted when Enter is pressed and no suggestion is selected
284
+ */
244
285
  this.$emit('submit');
245
286
  }
246
287
  },
@@ -252,6 +293,10 @@ var script = {
252
293
  },
253
294
  Escape: () => {
254
295
  e.preventDefault();
296
+ /**
297
+ * Emitted when suggestion is selected from the suggestion list
298
+ */
299
+
255
300
  this.$emit('complete');
256
301
  }
257
302
  };
@@ -282,6 +327,9 @@ var script = {
282
327
  if (this.multiSelect) {
283
328
  this.$emit('complete');
284
329
  } else if (this.active) {
330
+ /**
331
+ * Emitted when this term token will lose its focus.
332
+ */
285
333
  this.$emit('deactivate');
286
334
  }
287
335
  }
@@ -1,7 +1,4 @@
1
- import examples from './examples';
2
- import { V_MODEL } from './models/constants';
3
-
4
- var form_checkbox_tree = "# GlFormCheckboxTree\n\n<!-- STORY -->\n\n`GlFormCheckboxTree` lets you display an options structure where any option can have n-level of\nchildren. It can be useful for creating a search filter that has nested facets.\n\n## Usage\n\n`GlFormCheckboxTree` accepts an `options` prop representing the available options in the form of\nan n-level deep tree. Each option should have a `value` and can have optional\n`label` and `children`. If `label` is omitted, `value` is used as the checkbox's label.\nHere's a simple `options` tree for example:\n\n```js\n[\n {\n label: 'Option #1',\n value: 1,\n children: [\n {\n label: 'Option #2',\n value: 2,\n },\n ],\n },\n {\n label: 'Option #3',\n value: 3,\n },\n]\n```\n\n`GlFormCheckboxTree` exposes the selected options via a `v-model` which is being kept in sync with\nthe `change` event.\n\n## Dos and don'ts\n\n### Don't\n\nWhen rendering a `GlFormCheckboxTree` with pre-selected options, all the selected values should be\npassed to the component via the `v-model`/`value` property. For example, with the options tree\nabove, if you wanted options `1` and `2` to be pre-selected, make sure that they are both included\nin the initial value, don't rely on the component to infer initially checked boxes by only passing\n`1` or `2`.\n\n```html\n<!-- Good -->\n<gl-form-checkbox-tree\n :value=\"[1, 2]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n\n<!-- Bad -->\n<gl-form-checkbox-tree\n :value=\"[1]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n```\n";
1
+ var form_checkbox_tree = "`GlFormCheckboxTree` lets you display an options structure where any option can have n-level of\nchildren. It can be useful for creating a search filter that has nested facets.\n\n## Usage\n\n`GlFormCheckboxTree` accepts an `options` prop representing the available options in the form of\nan n-level deep tree. Each option should have a `value` and can have optional\n`label` and `children`. If `label` is omitted, `value` is used as the checkbox's label.\nHere's a simple `options` tree for example:\n\n```js\n[\n {\n label: 'Option #1',\n value: 1,\n children: [\n {\n label: 'Option #2',\n value: 2,\n },\n ],\n },\n {\n label: 'Option #3',\n value: 3,\n },\n]\n```\n\n`GlFormCheckboxTree` exposes the selected options via a `v-model` which is being kept in sync with\nthe `change` event.\n\n## Dos and don'ts\n\n### Don't\n\nWhen rendering a `GlFormCheckboxTree` with pre-selected options, all the selected values should be\npassed to the component via the `v-model`/`value` property. For example, with the options tree\nabove, if you wanted options `1` and `2` to be pre-selected, make sure that they are both included\nin the initial value, don't rely on the component to infer initially checked boxes by only passing\n`1` or `2`.\n\n```html\n<!-- Good -->\n<gl-form-checkbox-tree\n :value=\"[1, 2]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n\n<!-- Bad -->\n<gl-form-checkbox-tree\n :value=\"[1]\"\n :options=\"[\n {\n value: 1,\n children: [\n {\n value: 2,\n },\n ],\n },\n ]\"\n/>\n```\n";
5
2
 
6
3
  var description = /*#__PURE__*/Object.freeze({
7
4
  __proto__: null,
@@ -9,29 +6,7 @@ var description = /*#__PURE__*/Object.freeze({
9
6
  });
10
7
 
11
8
  var form_checkbox_tree_documentation = {
12
- description,
13
- examples,
14
- propsInfo: {
15
- options: {
16
- additionalInfo: 'The options tree.'
17
- },
18
- [V_MODEL.PROP]: {
19
- additionalInfo: 'The selected options as an array of values.'
20
- },
21
- hideToggleAll: {
22
- additionalInfo: 'Set to true to hide the "Select/unselect all" checkbox'
23
- },
24
- selectAllLabel: {
25
- additionalInfo: 'Label for the toggle all checkbox when some or all options are unchecked'
26
- },
27
- unselectAllLabel: {
28
- additionalInfo: 'Label for the toggle all checkbox when all options are checked'
29
- }
30
- },
31
- events: [{
32
- event: V_MODEL.EVENT,
33
- description: 'Emitted the selection changes.'
34
- }]
9
+ description
35
10
  };
36
11
 
37
12
  export default form_checkbox_tree_documentation;
@@ -37,23 +37,35 @@ var script = {
37
37
  },
38
38
 
39
39
  /**
40
- * Selected options
40
+ * The selected options as an array of values
41
41
  */
42
42
  value: {
43
43
  type: Array,
44
44
  required: false,
45
45
  default: () => []
46
46
  },
47
+
48
+ /**
49
+ * Set to true to hide the "Select/unselect all" checkbox
50
+ */
47
51
  hideToggleAll: {
48
52
  type: Boolean,
49
53
  required: false,
50
54
  default: false
51
55
  },
56
+
57
+ /**
58
+ * Label for the toggle all checkbox when some or all options are unchecked
59
+ */
52
60
  selectAllLabel: {
53
61
  type: String,
54
62
  required: false,
55
63
  default: 'Select all'
56
64
  },
65
+
66
+ /**
67
+ * Label for the toggle all checkbox when all options are checked
68
+ */
57
69
  unselectAllLabel: {
58
70
  type: String,
59
71
  required: false,
@@ -86,6 +98,9 @@ var script = {
86
98
  watch: {
87
99
  'tree.selected': {
88
100
  handler(selected) {
101
+ /**
102
+ * Emitted when the selection changes.
103
+ */
89
104
  this.$emit(V_MODEL.EVENT, selected);
90
105
  }
91
106
 
@@ -30,7 +30,7 @@ var script = {
30
30
  const __vue_script__ = script;
31
31
 
32
32
  /* template */
33
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-radio',_vm._g(_vm._b({staticClass:"gl-form-radio",attrs:{"checked":_vm.checked},on:{"input":function($event){return _vm.$emit('input', $event)},"change":function($event){return _vm.$emit('change', $event)}}},'b-form-radio',_vm.$attrs,false),_vm.$listeners),[_vm._t("default"),_vm._v(" "),(_vm.$scopedSlots.help)?_c('p',{staticClass:"help-text"},[_vm._t("help")],2):_vm._e()],2)};
33
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-radio',_vm._b({staticClass:"gl-form-radio",attrs:{"checked":_vm.checked},on:{"input":function($event){return _vm.$emit('input', $event)},"change":function($event){return _vm.$emit('change', $event)}}},'b-form-radio',_vm.$attrs,false),[_vm._t("default"),_vm._v(" "),(_vm.$scopedSlots.help)?_c('p',{staticClass:"help-text"},[_vm._t("help")],2):_vm._e()],2)};
34
34
  var __vue_staticRenderFns__ = [];
35
35
 
36
36
  /* style */
@@ -11,7 +11,12 @@ var script = {
11
11
  type: {
12
12
  type: String,
13
13
  required: false,
14
- default: 'solid'
14
+ default: 'solid',
15
+
16
+ validator(value) {
17
+ return ['solid', 'dashed'].indexOf(value) !== -1;
18
+ }
19
+
15
20
  }
16
21
  },
17
22