@gitlab/ui 132.0.1 → 132.0.3

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 (427) hide show
  1. package/dist/charts.js +13 -0
  2. package/dist/components/base/accordion/accordion.js +69 -0
  3. package/dist/components/base/accordion/accordion_item.js +160 -0
  4. package/dist/components/base/accordion/constants.js +3 -0
  5. package/dist/components/base/alert/alert.js +263 -0
  6. package/dist/components/base/animated_icon/animated_chevron_down_up_icon.js +45 -0
  7. package/dist/components/base/animated_icon/animated_chevron_lg_down_up_icon.js +45 -0
  8. package/dist/components/base/animated_icon/animated_chevron_lg_right_down_icon.js +45 -0
  9. package/dist/components/base/animated_icon/animated_chevron_right_down_icon.js +45 -0
  10. package/dist/components/base/animated_icon/animated_duo_chat_icon.js +45 -0
  11. package/dist/components/base/animated_icon/animated_loader_icon.js +45 -0
  12. package/dist/components/base/animated_icon/animated_notifications_icon.js +45 -0
  13. package/dist/components/base/animated_icon/animated_sidebar_icon.js +45 -0
  14. package/dist/components/base/animated_icon/animated_smile_icon.js +45 -0
  15. package/dist/components/base/animated_icon/animated_sort_icon.js +45 -0
  16. package/dist/components/base/animated_icon/animated_star_icon.js +45 -0
  17. package/dist/components/base/animated_icon/animated_todo_icon.js +45 -0
  18. package/dist/components/base/animated_icon/animated_upload_icon.js +45 -0
  19. package/dist/components/base/animated_icon/base_animated_icon.js +77 -0
  20. package/dist/components/base/attribute_list/attribute_list.js +100 -0
  21. package/dist/components/base/avatar/avatar.js +175 -0
  22. package/dist/components/base/avatar/utils.js +17 -0
  23. package/dist/components/base/avatar_labeled/avatar_labeled.js +198 -0
  24. package/dist/components/base/avatar_link/avatar_link.js +47 -0
  25. package/dist/components/base/avatars_inline/avatars_inline.js +139 -0
  26. package/dist/components/base/badge/badge.js +197 -0
  27. package/dist/components/base/banner/banner.js +149 -0
  28. package/dist/components/base/breadcrumb/breadcrumb.js +282 -0
  29. package/dist/components/base/breadcrumb/breadcrumb_item.js +96 -0
  30. package/dist/components/base/broadcast_message/broadcast_message.js +113 -0
  31. package/dist/components/base/broadcast_message/constants.js +5 -0
  32. package/dist/components/base/button/button.js +419 -0
  33. package/dist/components/base/button_group/button_group.js +53 -0
  34. package/dist/components/base/card/card.js +69 -0
  35. package/dist/components/base/collapse/collapse.js +163 -0
  36. package/dist/components/base/color_mode_toggle/color_mode_toggle.js +92 -0
  37. package/dist/components/base/datepicker/datepicker.js +475 -0
  38. package/dist/components/base/daterange_picker/daterange_picker.js +394 -0
  39. package/dist/components/base/drawer/drawer.js +156 -0
  40. package/dist/components/base/dropdown/dropdown.js +330 -0
  41. package/dist/components/base/dropdown/dropdown_divider.js +48 -0
  42. package/dist/components/base/dropdown/dropdown_form.js +48 -0
  43. package/dist/components/base/dropdown/dropdown_item.js +175 -0
  44. package/dist/components/base/dropdown/dropdown_section_header.js +48 -0
  45. package/dist/components/base/dropdown/dropdown_text.js +48 -0
  46. package/dist/components/base/filtered_search/common_story_options.js +14 -0
  47. package/dist/components/base/filtered_search/filtered_search.js +428 -0
  48. package/dist/components/base/filtered_search/filtered_search_suggestion.js +95 -0
  49. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +139 -0
  50. package/dist/components/base/filtered_search/filtered_search_term.js +217 -0
  51. package/dist/components/base/filtered_search/filtered_search_token.js +383 -0
  52. package/dist/components/base/filtered_search/filtered_search_token_segment.js +444 -0
  53. package/dist/components/base/filtered_search/filtered_search_utils.js +241 -0
  54. package/dist/components/base/form/form.js +43 -0
  55. package/dist/components/base/form/form_character_count/form_character_count.js +107 -0
  56. package/dist/components/base/form/form_checkbox/form_checkbox.js +342 -0
  57. package/dist/components/base/form/form_checkbox/form_checkbox_group.js +188 -0
  58. package/dist/components/base/form/form_combobox/constants.js +55 -0
  59. package/dist/components/base/form/form_combobox/form_combobox.js +239 -0
  60. package/dist/components/base/form/form_date/form_date.js +143 -0
  61. package/dist/components/base/form/form_fields/form_field_validator.js +93 -0
  62. package/dist/components/base/form/form_fields/form_fields.js +289 -0
  63. package/dist/components/base/form/form_fields/form_fields_loop.js +75 -0
  64. package/dist/components/base/form/form_fields/mappers.js +13 -0
  65. package/dist/components/base/form/form_fields/validators.js +48 -0
  66. package/dist/components/base/form/form_group/form_group.js +119 -0
  67. package/dist/components/base/form/form_input/form_input.js +695 -0
  68. package/dist/components/base/form/form_input_group/form_input_group.js +120 -0
  69. package/dist/components/base/form/form_input_group/form_input_group_mixin.js +41 -0
  70. package/dist/components/base/form/form_radio/form_radio.js +259 -0
  71. package/dist/components/base/form/form_radio_group/form_radio_group.js +189 -0
  72. package/dist/components/base/form/form_select/constants.js +12 -0
  73. package/dist/components/base/form/form_select/form_select.js +96 -0
  74. package/dist/components/base/form/form_textarea/form_textarea.js +166 -0
  75. package/dist/components/base/form/input_group_text/input_group_text.js +43 -0
  76. package/dist/components/base/icon/icon.js +113 -0
  77. package/dist/components/base/illustration/illustration.js +80 -0
  78. package/dist/components/base/infinite_scroll/infinite_scroll.js +196 -0
  79. package/dist/components/base/keyset_pagination/keyset_pagination.js +152 -0
  80. package/dist/components/base/label/label.js +174 -0
  81. package/dist/components/base/link/link.js +330 -0
  82. package/dist/components/base/loading_icon/loading_icon.js +120 -0
  83. package/dist/components/base/markdown/markdown.js +50 -0
  84. package/dist/components/base/modal/modal.js +259 -0
  85. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +716 -0
  86. package/dist/components/base/new_dropdowns/base_dropdown/constants.js +5 -0
  87. package/dist/components/base/new_dropdowns/base_dropdown/dropdown_container.js +32 -0
  88. package/dist/components/base/new_dropdowns/constants.js +24 -0
  89. package/dist/components/base/new_dropdowns/disclosure/constants.js +8 -0
  90. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +400 -0
  91. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +112 -0
  92. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +196 -0
  93. package/dist/components/base/new_dropdowns/disclosure/mock_data.js +168 -0
  94. package/dist/components/base/new_dropdowns/disclosure/utils.js +84 -0
  95. package/dist/components/base/new_dropdowns/listbox/listbox.js +997 -0
  96. package/dist/components/base/new_dropdowns/listbox/listbox_group.js +58 -0
  97. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +112 -0
  98. package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +94 -0
  99. package/dist/components/base/new_dropdowns/listbox/mock_data.js +131 -0
  100. package/dist/components/base/new_dropdowns/listbox/utils.js +33 -0
  101. package/dist/components/base/pagination/pagination.js +397 -0
  102. package/dist/components/base/path/data.js +34 -0
  103. package/dist/components/base/path/path.js +177 -0
  104. package/dist/components/base/popover/popover.js +142 -0
  105. package/dist/components/base/progress_bar/progress_bar.js +117 -0
  106. package/dist/components/base/search_box_by_click/search_box_by_click.js +245 -0
  107. package/dist/components/base/search_box_by_type/search_box_by_type.js +187 -0
  108. package/dist/components/base/segmented_control/segmented_control.js +73 -0
  109. package/dist/components/base/skeleton_loader/skeleton_loader.js +232 -0
  110. package/dist/components/base/sorting/sorting.js +180 -0
  111. package/dist/components/base/table/constants.js +5 -0
  112. package/dist/components/base/table/table.js +187 -0
  113. package/dist/components/base/table_lite/table_lite.js +80 -0
  114. package/dist/components/base/tabs/constants.js +3 -0
  115. package/dist/components/base/tabs/tab/tab.js +113 -0
  116. package/dist/components/base/tabs/tabs/scrollable_tabs.js +162 -0
  117. package/dist/components/base/tabs/tabs/tabs.js +223 -0
  118. package/dist/components/base/toast/index.js +66 -0
  119. package/dist/components/base/toast/toast.js +125 -0
  120. package/dist/components/base/toast/toaster.js +87 -0
  121. package/dist/components/base/toggle/toggle.js +178 -0
  122. package/dist/components/base/token/token.js +97 -0
  123. package/dist/components/base/token_selector/helpers.js +5 -0
  124. package/dist/components/base/token_selector/token_container.js +160 -0
  125. package/dist/components/base/token_selector/token_selector.js +454 -0
  126. package/dist/components/base/token_selector/token_selector_dropdown.js +223 -0
  127. package/dist/components/base/tooltip/tooltip.js +54 -0
  128. package/dist/components/charts/area/area.js +329 -0
  129. package/dist/components/charts/bar/bar.js +207 -0
  130. package/dist/components/charts/chart/chart.js +215 -0
  131. package/dist/components/charts/column/column.js +221 -0
  132. package/dist/components/charts/discrete_scatter/discrete_scatter.js +199 -0
  133. package/dist/components/charts/gauge/gauge.js +205 -0
  134. package/dist/components/charts/heatmap/heatmap.js +299 -0
  135. package/dist/components/charts/heatmap/index.js +2 -0
  136. package/dist/components/charts/legend/legend.js +245 -0
  137. package/dist/components/charts/line/line.js +340 -0
  138. package/dist/components/charts/series_label/series_label.js +101 -0
  139. package/dist/components/charts/shared/tooltip/tooltip.js +369 -0
  140. package/dist/components/charts/shared/tooltip/tooltip_default_format/tooltip_default_format.js +53 -0
  141. package/dist/components/charts/single_stat/single_stat.js +164 -0
  142. package/dist/components/charts/sparkline/sparkline.js +299 -0
  143. package/dist/components/charts/stacked_column/stacked_column.js +380 -0
  144. package/dist/components/dashboards/dashboard_layout/dashboard_layout.js +125 -0
  145. package/dist/components/dashboards/dashboard_layout/grid_layout/grid_layout.js +326 -0
  146. package/dist/components/dashboards/dashboard_layout/validators.js +14 -0
  147. package/dist/components/dashboards/dashboard_panel/dashboard_panel.js +236 -0
  148. package/dist/components/dashboards/mock_data.js +49 -0
  149. package/dist/components/experimental/experiment_badge/constants.js +4 -0
  150. package/dist/components/experimental/experiment_badge/experiment_badge.js +102 -0
  151. package/dist/components/extended/multi_step_form_template/multi_step_form_template.js +87 -0
  152. package/dist/components/index.js +107 -0
  153. package/dist/components/mixins/button_mixin.js +11 -0
  154. package/dist/components/mixins/safe_link_mixin.js +30 -0
  155. package/dist/components/mixins/tooltip_mixin.js +21 -0
  156. package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +53 -0
  157. package/dist/components/regions/empty_state/empty_state.js +181 -0
  158. package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +64 -0
  159. package/dist/components/shared_components/clipboard_button/clipboard_button.js +100 -0
  160. package/dist/components/shared_components/close_button/close_button.js +55 -0
  161. package/dist/components/utilities/animated_number/animated_number.js +131 -0
  162. package/dist/components/utilities/friendly_wrap/friendly_wrap.js +75 -0
  163. package/dist/components/utilities/intersection_observer/intersection_observer.js +88 -0
  164. package/dist/components/utilities/intersperse/intersperse.js +104 -0
  165. package/dist/components/utilities/sprintf/sprintf.js +171 -0
  166. package/dist/components/utilities/truncate/constants.js +8 -0
  167. package/dist/components/utilities/truncate/truncate.js +154 -0
  168. package/dist/components/utilities/truncate_text/constants.js +7 -0
  169. package/dist/components/utilities/truncate_text/truncate_text.js +146 -0
  170. package/dist/config.js +53 -0
  171. package/dist/directives/hover_load/hover_load.js +45 -0
  172. package/dist/directives/index.js +8 -0
  173. package/dist/directives/modal.js +1 -0
  174. package/dist/directives/outside/outside.js +149 -0
  175. package/dist/directives/resize_observer/resize_observer.js +58 -0
  176. package/dist/directives/safe_html/constants.js +6 -0
  177. package/dist/directives/safe_html/safe_html.js +39 -0
  178. package/dist/directives/safe_link/mock_data.js +10 -0
  179. package/dist/directives/safe_link/safe_link.js +67 -0
  180. package/dist/directives/tooltip/container.js +7 -0
  181. package/dist/directives/tooltip/tooltip.js +18 -0
  182. package/dist/index.css +7 -0
  183. package/dist/index.css.map +1 -0
  184. package/dist/index.js +2 -0
  185. package/dist/tailwind.css +2 -0
  186. package/dist/tailwind.css.map +1 -0
  187. package/dist/tokens/build/js/tokens.dark.js +1410 -0
  188. package/dist/tokens/build/js/tokens.js +1410 -0
  189. package/dist/tokens/common_story_options.js +29 -0
  190. package/dist/tokens/tokens_story.js +76 -0
  191. package/dist/utils/breakpoints.js +20 -0
  192. package/dist/utils/charts/config.js +616 -0
  193. package/dist/utils/charts/constants.js +69 -0
  194. package/dist/utils/charts/mock_data.js +191 -0
  195. package/dist/utils/charts/story_config.js +24 -0
  196. package/dist/utils/charts/theme.js +200 -0
  197. package/dist/utils/charts/utils.js +54 -0
  198. package/dist/utils/constants.js +331 -0
  199. package/dist/utils/data_utils.js +19 -0
  200. package/dist/utils/datetime_utility.js +61 -0
  201. package/dist/utils/equality_utils.js +84 -0
  202. package/dist/utils/form_options_utils.js +46 -0
  203. package/dist/utils/i18n.js +65 -0
  204. package/dist/utils/is_slot_empty.js +34 -0
  205. package/dist/utils/number_utils.js +132 -0
  206. package/dist/utils/play_utils.js +11 -0
  207. package/dist/utils/set_utils.js +25 -0
  208. package/dist/utils/stories_constants.js +29 -0
  209. package/dist/utils/stories_utils.js +62 -0
  210. package/dist/utils/story_decorators/container.js +19 -0
  211. package/dist/utils/string_utils.js +69 -0
  212. package/dist/utils/svgs/svg_paths.js +7 -0
  213. package/dist/utils/test_utils.js +33 -0
  214. package/dist/utils/url_utils.js +56 -0
  215. package/dist/utils/use_fake_date.js +29 -0
  216. package/dist/utils/use_mock_intersection_observer.js +105 -0
  217. package/dist/utils/utils.js +205 -0
  218. package/dist/utils/vue_utils.js +57 -0
  219. package/dist/utils.js +5 -0
  220. package/dist/vendor/bootstrap-vue/src/bv-config.js +8 -0
  221. package/dist/vendor/bootstrap-vue/src/components/button/button-close.js +81 -0
  222. package/dist/vendor/bootstrap-vue/src/components/button/button.js +204 -0
  223. package/dist/vendor/bootstrap-vue/src/components/button/index.js +2 -0
  224. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.js +44 -0
  225. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.js +59 -0
  226. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.js +98 -0
  227. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.js +63 -0
  228. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.js +108 -0
  229. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-item.js +97 -0
  230. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown-text.js +60 -0
  231. package/dist/vendor/bootstrap-vue/src/components/dropdown/dropdown.js +270 -0
  232. package/dist/vendor/bootstrap-vue/src/components/dropdown/index.js +8 -0
  233. package/dist/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.js +80 -0
  234. package/dist/vendor/bootstrap-vue/src/components/form/form-text.js +55 -0
  235. package/dist/vendor/bootstrap-vue/src/components/form/form-valid-feedback.js +80 -0
  236. package/dist/vendor/bootstrap-vue/src/components/form/form.js +56 -0
  237. package/dist/vendor/bootstrap-vue/src/components/form/index.js +4 -0
  238. package/dist/vendor/bootstrap-vue/src/components/form-group/form-group.js +347 -0
  239. package/dist/vendor/bootstrap-vue/src/components/form-group/index.js +1 -0
  240. package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.js +56 -0
  241. package/dist/vendor/bootstrap-vue/src/components/form-select/form-select-option.js +47 -0
  242. package/dist/vendor/bootstrap-vue/src/components/form-select/form-select.js +154 -0
  243. package/dist/vendor/bootstrap-vue/src/components/form-select/helpers/mixin-options.js +63 -0
  244. package/dist/vendor/bootstrap-vue/src/components/form-select/index.js +3 -0
  245. package/dist/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +236 -0
  246. package/dist/vendor/bootstrap-vue/src/components/form-textarea/index.js +1 -0
  247. package/dist/vendor/bootstrap-vue/src/components/layout/col.js +155 -0
  248. package/dist/vendor/bootstrap-vue/src/components/layout/form-row.js +34 -0
  249. package/dist/vendor/bootstrap-vue/src/components/layout/index.js +2 -0
  250. package/dist/vendor/bootstrap-vue/src/components/link/index.js +1 -0
  251. package/dist/vendor/bootstrap-vue/src/components/link/link.js +283 -0
  252. package/dist/vendor/bootstrap-vue/src/components/modal/helpers/bv-modal-event.class.js +21 -0
  253. package/dist/vendor/bootstrap-vue/src/components/modal/helpers/modal-manager.js +212 -0
  254. package/dist/vendor/bootstrap-vue/src/components/modal/index.js +1 -0
  255. package/dist/vendor/bootstrap-vue/src/components/modal/modal.js +1059 -0
  256. package/dist/vendor/bootstrap-vue/src/components/popover/helpers/bv-popover-template.js +55 -0
  257. package/dist/vendor/bootstrap-vue/src/components/popover/helpers/bv-popover.js +31 -0
  258. package/dist/vendor/bootstrap-vue/src/components/popover/index.js +1 -0
  259. package/dist/vendor/bootstrap-vue/src/components/popover/popover.js +64 -0
  260. package/dist/vendor/bootstrap-vue/src/components/table/helpers/constants.js +22 -0
  261. package/dist/vendor/bootstrap-vue/src/components/table/helpers/default-sort-compare.js +64 -0
  262. package/dist/vendor/bootstrap-vue/src/components/table/helpers/filter-event.js +40 -0
  263. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-bottom-row.js +43 -0
  264. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-busy.js +86 -0
  265. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-caption.js +57 -0
  266. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-colgroup.js +32 -0
  267. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-empty.js +101 -0
  268. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-filtering.js +292 -0
  269. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-items.js +169 -0
  270. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-pagination.js +51 -0
  271. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-provider.js +210 -0
  272. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-selectable.js +227 -0
  273. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-sorting.js +328 -0
  274. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-stacked.js +42 -0
  275. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-table-renderer.js +241 -0
  276. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-tbody-row.js +349 -0
  277. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-tbody.js +247 -0
  278. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-tfoot.js +69 -0
  279. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-thead.js +233 -0
  280. package/dist/vendor/bootstrap-vue/src/components/table/helpers/mixin-top-row.js +42 -0
  281. package/dist/vendor/bootstrap-vue/src/components/table/helpers/normalize-fields.js +86 -0
  282. package/dist/vendor/bootstrap-vue/src/components/table/helpers/sanitize-row.js +31 -0
  283. package/dist/vendor/bootstrap-vue/src/components/table/helpers/stringify-record-values.js +11 -0
  284. package/dist/vendor/bootstrap-vue/src/components/table/helpers/text-selection-active.js +14 -0
  285. package/dist/vendor/bootstrap-vue/src/components/table/index.js +9 -0
  286. package/dist/vendor/bootstrap-vue/src/components/table/table-lite.js +51 -0
  287. package/dist/vendor/bootstrap-vue/src/components/table/table-simple.js +44 -0
  288. package/dist/vendor/bootstrap-vue/src/components/table/table.js +67 -0
  289. package/dist/vendor/bootstrap-vue/src/components/table/tbody.js +116 -0
  290. package/dist/vendor/bootstrap-vue/src/components/table/td.js +204 -0
  291. package/dist/vendor/bootstrap-vue/src/components/table/tfoot.js +96 -0
  292. package/dist/vendor/bootstrap-vue/src/components/table/th.js +26 -0
  293. package/dist/vendor/bootstrap-vue/src/components/table/thead.js +99 -0
  294. package/dist/vendor/bootstrap-vue/src/components/table/tr.js +121 -0
  295. package/dist/vendor/bootstrap-vue/src/components/tabs/index.js +2 -0
  296. package/dist/vendor/bootstrap-vue/src/components/tabs/tab.js +238 -0
  297. package/dist/vendor/bootstrap-vue/src/components/tabs/tabs.js +690 -0
  298. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-popper.js +278 -0
  299. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip-template.js +125 -0
  300. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +932 -0
  301. package/dist/vendor/bootstrap-vue/src/components/tooltip/index.js +1 -0
  302. package/dist/vendor/bootstrap-vue/src/components/tooltip/tooltip.js +337 -0
  303. package/dist/vendor/bootstrap-vue/src/components/transition/bv-transition.js +118 -0
  304. package/dist/vendor/bootstrap-vue/src/components/transporter/transporter.js +220 -0
  305. package/dist/vendor/bootstrap-vue/src/constants/components.js +55 -0
  306. package/dist/vendor/bootstrap-vue/src/constants/config.js +11 -0
  307. package/dist/vendor/bootstrap-vue/src/constants/env.js +36 -0
  308. package/dist/vendor/bootstrap-vue/src/constants/events.js +56 -0
  309. package/dist/vendor/bootstrap-vue/src/constants/key-codes.js +11 -0
  310. package/dist/vendor/bootstrap-vue/src/constants/popper.js +10 -0
  311. package/dist/vendor/bootstrap-vue/src/constants/props.js +24 -0
  312. package/dist/vendor/bootstrap-vue/src/constants/regex.js +35 -0
  313. package/dist/vendor/bootstrap-vue/src/constants/safe-types.js +15 -0
  314. package/dist/vendor/bootstrap-vue/src/constants/slots.js +36 -0
  315. package/dist/vendor/bootstrap-vue/src/directives/modal/index.js +1 -0
  316. package/dist/vendor/bootstrap-vue/src/directives/modal/modal.js +112 -0
  317. package/dist/vendor/bootstrap-vue/src/directives/tooltip/index.js +1 -0
  318. package/dist/vendor/bootstrap-vue/src/directives/tooltip/tooltip.js +267 -0
  319. package/dist/vendor/bootstrap-vue/src/directives/visible/index.js +1 -0
  320. package/dist/vendor/bootstrap-vue/src/directives/visible/visible.js +187 -0
  321. package/dist/vendor/bootstrap-vue/src/mixins/attrs.js +5 -0
  322. package/dist/vendor/bootstrap-vue/src/mixins/click-out.js +54 -0
  323. package/dist/vendor/bootstrap-vue/src/mixins/dropdown.js +470 -0
  324. package/dist/vendor/bootstrap-vue/src/mixins/focus-in.js +46 -0
  325. package/dist/vendor/bootstrap-vue/src/mixins/form-control.js +73 -0
  326. package/dist/vendor/bootstrap-vue/src/mixins/form-custom.js +26 -0
  327. package/dist/vendor/bootstrap-vue/src/mixins/form-options.js +91 -0
  328. package/dist/vendor/bootstrap-vue/src/mixins/form-selection.js +62 -0
  329. package/dist/vendor/bootstrap-vue/src/mixins/form-size.js +26 -0
  330. package/dist/vendor/bootstrap-vue/src/mixins/form-state.js +50 -0
  331. package/dist/vendor/bootstrap-vue/src/mixins/form-text.js +293 -0
  332. package/dist/vendor/bootstrap-vue/src/mixins/form-validity.js +50 -0
  333. package/dist/vendor/bootstrap-vue/src/mixins/has-listener.js +29 -0
  334. package/dist/vendor/bootstrap-vue/src/mixins/id.js +57 -0
  335. package/dist/vendor/bootstrap-vue/src/mixins/listen-on-document.js +62 -0
  336. package/dist/vendor/bootstrap-vue/src/mixins/listen-on-root.js +120 -0
  337. package/dist/vendor/bootstrap-vue/src/mixins/listen-on-window.js +62 -0
  338. package/dist/vendor/bootstrap-vue/src/mixins/listeners.js +25 -0
  339. package/dist/vendor/bootstrap-vue/src/mixins/model.js +10 -0
  340. package/dist/vendor/bootstrap-vue/src/mixins/normalize-slot.js +30 -0
  341. package/dist/vendor/bootstrap-vue/src/mixins/scoped-style.js +18 -0
  342. package/dist/vendor/bootstrap-vue/src/mixins/use-parent.js +14 -0
  343. package/dist/vendor/bootstrap-vue/src/utils/array.js +27 -0
  344. package/dist/vendor/bootstrap-vue/src/utils/bv-event.class.js +60 -0
  345. package/dist/vendor/bootstrap-vue/src/utils/cache.js +60 -0
  346. package/dist/vendor/bootstrap-vue/src/utils/clone-deep.js +18 -0
  347. package/dist/vendor/bootstrap-vue/src/utils/config-set.js +86 -0
  348. package/dist/vendor/bootstrap-vue/src/utils/config.js +71 -0
  349. package/dist/vendor/bootstrap-vue/src/utils/create-new-child-component.js +133 -0
  350. package/dist/vendor/bootstrap-vue/src/utils/css-escape.js +70 -0
  351. package/dist/vendor/bootstrap-vue/src/utils/dom.js +298 -0
  352. package/dist/vendor/bootstrap-vue/src/utils/element-to-vue-instance-registry.js +28 -0
  353. package/dist/vendor/bootstrap-vue/src/utils/env.js +16 -0
  354. package/dist/vendor/bootstrap-vue/src/utils/events.js +78 -0
  355. package/dist/vendor/bootstrap-vue/src/utils/get-event-root.js +5 -0
  356. package/dist/vendor/bootstrap-vue/src/utils/get-instance-from-directive.js +3 -0
  357. package/dist/vendor/bootstrap-vue/src/utils/get-scope-id.js +9 -0
  358. package/dist/vendor/bootstrap-vue/src/utils/get.js +63 -0
  359. package/dist/vendor/bootstrap-vue/src/utils/html.js +16 -0
  360. package/dist/vendor/bootstrap-vue/src/utils/identity.js +3 -0
  361. package/dist/vendor/bootstrap-vue/src/utils/inspect.js +35 -0
  362. package/dist/vendor/bootstrap-vue/src/utils/locale.js +18 -0
  363. package/dist/vendor/bootstrap-vue/src/utils/loose-equal.js +59 -0
  364. package/dist/vendor/bootstrap-vue/src/utils/loose-index-of.js +13 -0
  365. package/dist/vendor/bootstrap-vue/src/utils/math.js +9 -0
  366. package/dist/vendor/bootstrap-vue/src/utils/memoize.js +14 -0
  367. package/dist/vendor/bootstrap-vue/src/utils/model.js +33 -0
  368. package/dist/vendor/bootstrap-vue/src/utils/noop.js +3 -0
  369. package/dist/vendor/bootstrap-vue/src/utils/normalize-slot.js +51 -0
  370. package/dist/vendor/bootstrap-vue/src/utils/number.js +23 -0
  371. package/dist/vendor/bootstrap-vue/src/utils/object.js +72 -0
  372. package/dist/vendor/bootstrap-vue/src/utils/observe-dom.js +76 -0
  373. package/dist/vendor/bootstrap-vue/src/utils/on-instance-destroy.js +22 -0
  374. package/dist/vendor/bootstrap-vue/src/utils/plugins.js +124 -0
  375. package/dist/vendor/bootstrap-vue/src/utils/props.js +67 -0
  376. package/dist/vendor/bootstrap-vue/src/utils/router.js +150 -0
  377. package/dist/vendor/bootstrap-vue/src/utils/safe-vue-instance.js +14 -0
  378. package/dist/vendor/bootstrap-vue/src/utils/stable-sort.js +28 -0
  379. package/dist/vendor/bootstrap-vue/src/utils/string.js +47 -0
  380. package/dist/vendor/bootstrap-vue/src/utils/stringify-object-values.js +31 -0
  381. package/dist/vendor/bootstrap-vue/src/utils/warn.js +45 -0
  382. package/dist/vendor/bootstrap-vue/src/vue.js +55 -0
  383. package/package.json +4 -3
  384. package/src/components/base/link/link.vue +2 -2
  385. package/src/utils/url_utils.js +66 -0
  386. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-divider.js +5 -2
  387. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-form.js +16 -4
  388. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-group.js +31 -8
  389. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-header.js +15 -4
  390. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown-item-button.js +32 -8
  391. package/src/vendor/bootstrap-vue/src/components/dropdown/dropdown.js +2 -2
  392. package/src/vendor/bootstrap-vue/src/components/form/form-invalid-feedback.js +35 -8
  393. package/src/vendor/bootstrap-vue/src/components/form/form-valid-feedback.js +35 -8
  394. package/src/vendor/bootstrap-vue/src/components/form-group/form-group.js +2 -2
  395. package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option-group.js +4 -2
  396. package/src/vendor/bootstrap-vue/src/components/form-select/form-select-option.js +9 -3
  397. package/src/vendor/bootstrap-vue/src/components/form-select/form-select.js +16 -9
  398. package/src/vendor/bootstrap-vue/src/components/form-select/helpers/mixin-options.js +10 -3
  399. package/src/vendor/bootstrap-vue/src/components/form-textarea/form-textarea.js +26 -7
  400. package/src/vendor/bootstrap-vue/src/components/layout/col.js +2 -2
  401. package/src/vendor/bootstrap-vue/src/components/modal/modal.js +2 -2
  402. package/src/vendor/bootstrap-vue/src/components/popover/popover.js +23 -7
  403. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-busy.js +5 -2
  404. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-caption.js +10 -3
  405. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-empty.js +25 -6
  406. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-items.js +20 -5
  407. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-pagination.js +11 -4
  408. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-provider.js +27 -7
  409. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-selectable.js +21 -7
  410. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-sorting.js +72 -18
  411. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-stacked.js +6 -3
  412. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-table-renderer.js +72 -17
  413. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-tbody-row.js +18 -6
  414. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-tbody.js +7 -3
  415. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-tfoot.js +27 -7
  416. package/src/vendor/bootstrap-vue/src/components/table/helpers/mixin-thead.js +21 -6
  417. package/src/vendor/bootstrap-vue/src/components/tabs/tabs.js +2 -2
  418. package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-popper.js +36 -13
  419. package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip-template.js +10 -3
  420. package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +8 -9
  421. package/src/vendor/bootstrap-vue/src/components/transition/bv-transition.js +20 -5
  422. package/src/vendor/bootstrap-vue/src/components/transporter/transporter.js +22 -6
  423. package/src/vendor/bootstrap-vue/src/mixins/listen-on-document.js +1 -2
  424. package/src/vendor/bootstrap-vue/src/mixins/listen-on-root.js +1 -2
  425. package/src/vendor/bootstrap-vue/src/mixins/listen-on-window.js +1 -2
  426. package/src/vendor/bootstrap-vue/src/utils/array.js +0 -1
  427. package/src/vendor/bootstrap-vue/src/utils/locale.js +1 -2
@@ -0,0 +1,444 @@
1
+ import { last } from 'lodash-es';
2
+ import { Portal } from 'portal-vue';
3
+ import { LEFT_MOUSE_BUTTON } from '../../../utils/constants';
4
+ import GlFilteredSearchSuggestion from './filtered_search_suggestion';
5
+ import GlFilteredSearchSuggestionList from './filtered_search_suggestion_list';
6
+ import { TERM_TOKEN_TYPE, splitOnQuotes, match, wrapTokenInQuotes, FILTERED_SEARCH_SUGGESTIONS_CLASS } from './filtered_search_utils';
7
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
8
+
9
+ // We need some helpers to ensure @vue/compat compatibility
10
+ // @vue/compat will render comment nodes for v-if and comments in HTML
11
+ // Also it makes use of fragments - both comments and nodes are Symbols.
12
+ // In Vue3 all of them (Comment, Fragment) are exposed as named exports on vue module
13
+ // However we want to maintain compatibility with Vue2, so taking this hacky approach
14
+ // relying on Symbol.toString()
15
+
16
+ // I'm keeping this directly here instead of helper to increase probability of
17
+ // fixing ASAP and because I don't want this helper to be reused
18
+ // FIXME: replace with Symbols when we will switch to Vue3
19
+
20
+ const isVue3Comment = vnode => {
21
+ var _vnode$type, _vnode$type$toString;
22
+ return (vnode === null || vnode === void 0 ? void 0 : (_vnode$type = vnode.type) === null || _vnode$type === void 0 ? void 0 : (_vnode$type$toString = _vnode$type.toString) === null || _vnode$type$toString === void 0 ? void 0 : _vnode$type$toString.call(_vnode$type)) === 'Symbol(Comment)';
23
+ };
24
+ const isVue3Fragment = vnode => {
25
+ var _vnode$type2, _vnode$type2$toString;
26
+ return (vnode === null || vnode === void 0 ? void 0 : (_vnode$type2 = vnode.type) === null || _vnode$type2 === void 0 ? void 0 : (_vnode$type2$toString = _vnode$type2.toString) === null || _vnode$type2$toString === void 0 ? void 0 : _vnode$type2$toString.call(_vnode$type2)) === 'Symbol(Fragment)';
27
+ };
28
+ const isVNodeEmpty = vnode => {
29
+ if (isVue3Fragment(vnode)) {
30
+ // vnode.children might be an array or single node in edge cases
31
+ return Array.isArray(vnode.children) ?
32
+ // eslint-disable-next-line unicorn/no-array-callback-reference
33
+ vnode.children.every(isVNodeEmpty) : isVNodeEmpty(vnode.children);
34
+ }
35
+ if (isVue3Comment(vnode)) {
36
+ return true;
37
+ }
38
+ return false;
39
+ };
40
+ const isSlotNotEmpty = slot => {
41
+ if (!slot) {
42
+ return false;
43
+ }
44
+ const vnodes = typeof slot === 'function' ? slot() : slot;
45
+ // eslint-disable-next-line unicorn/no-array-callback-reference
46
+ return !(Array.isArray(vnodes) ? vnodes.every(isVNodeEmpty) : isVNodeEmpty(vnodes));
47
+ };
48
+ var script = {
49
+ name: 'GlFilteredSearchTokenSegment',
50
+ components: {
51
+ Portal,
52
+ GlFilteredSearchSuggestionList,
53
+ GlFilteredSearchSuggestion
54
+ },
55
+ inject: ['portalName', 'alignSuggestions', 'termsAsTokens'],
56
+ inheritAttrs: false,
57
+ props: {
58
+ /**
59
+ * If this token segment is currently being edited.
60
+ */
61
+ active: {
62
+ type: Boolean,
63
+ required: false,
64
+ default: false
65
+ },
66
+ isTerm: {
67
+ type: Boolean,
68
+ required: false,
69
+ default: false
70
+ },
71
+ label: {
72
+ type: String,
73
+ required: false,
74
+ default: 'Search'
75
+ },
76
+ multiSelect: {
77
+ type: Boolean,
78
+ required: false,
79
+ default: false
80
+ },
81
+ options: {
82
+ type: Array,
83
+ required: false,
84
+ default: () => null
85
+ },
86
+ optionTextField: {
87
+ type: String,
88
+ required: false,
89
+ default: 'title'
90
+ },
91
+ customInputKeydownHandler: {
92
+ type: Function,
93
+ required: false,
94
+ default: () => () => false
95
+ },
96
+ /**
97
+ * Current term value
98
+ */
99
+ value: {
100
+ required: true,
101
+ validator: () => true
102
+ },
103
+ /**
104
+ * HTML attributes to add to the search input
105
+ */
106
+ searchInputAttributes: {
107
+ type: Object,
108
+ required: false,
109
+ default: () => ({})
110
+ },
111
+ /**
112
+ * If this is the last token
113
+ */
114
+ isLastToken: {
115
+ type: Boolean,
116
+ required: false,
117
+ default: false
118
+ },
119
+ currentValue: {
120
+ type: Array,
121
+ required: false,
122
+ default: () => []
123
+ },
124
+ cursorPosition: {
125
+ type: String,
126
+ required: false,
127
+ default: 'end',
128
+ validator: value => ['start', 'end'].includes(value)
129
+ },
130
+ viewOnly: {
131
+ type: Boolean,
132
+ required: false,
133
+ default: false
134
+ }
135
+ },
136
+ data() {
137
+ return {
138
+ fallbackValue: this.value
139
+ };
140
+ },
141
+ computed: {
142
+ hasTermSuggestion() {
143
+ if (!this.termsAsTokens()) return false;
144
+ if (!this.options) return false;
145
+ return this.options.some(_ref => {
146
+ let {
147
+ value
148
+ } = _ref;
149
+ return value === TERM_TOKEN_TYPE;
150
+ });
151
+ },
152
+ matchingOption() {
153
+ var _this$options;
154
+ return (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.find(o => o.value === this.value);
155
+ },
156
+ nonMultipleValue() {
157
+ return Array.isArray(this.value) ? last(this.value) : this.value;
158
+ },
159
+ inputValue: {
160
+ get() {
161
+ if (this.isTerm) {
162
+ return this.nonMultipleValue;
163
+ }
164
+ return this.matchingOption ? this.matchingOption[this.optionTextField] : this.nonMultipleValue;
165
+ },
166
+ set(inputValue) {
167
+ /**
168
+ * Emitted when this token segment's value changes.
169
+ *
170
+ * @type {object} option The current option.
171
+ */
172
+ this.$emit('input', inputValue);
173
+ }
174
+ },
175
+ hasOptionsOrSuggestions() {
176
+ var _this$options2;
177
+ // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
178
+ return ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.length) || isSlotNotEmpty(this.$slots.suggestions);
179
+ },
180
+ defaultSuggestedValue() {
181
+ var _this$options$;
182
+ if (!this.options) {
183
+ return this.nonMultipleValue;
184
+ }
185
+ if (this.value) {
186
+ const option = this.getMatchingOptionForInputValue(this.inputValue) || this.getMatchingOptionForInputValue(this.inputValue, {
187
+ loose: true
188
+ });
189
+ if (option) return option.value;
190
+ if (this.hasTermSuggestion) return TERM_TOKEN_TYPE;
191
+ return null;
192
+ }
193
+ const defaultOption = this.options.find(op => op.default);
194
+ if (defaultOption) {
195
+ return defaultOption.value;
196
+ }
197
+ return this.isTerm ? undefined : (_this$options$ = this.options[0]) === null || _this$options$ === void 0 ? void 0 : _this$options$.value;
198
+ },
199
+ containerAttributes() {
200
+ return this.isLastToken && !this.active && this.currentValue.length > 1 && this.searchInputAttributes;
201
+ }
202
+ },
203
+ watch: {
204
+ active: {
205
+ immediate: true,
206
+ handler(newValue) {
207
+ if (newValue) {
208
+ this.activate();
209
+ } else {
210
+ this.deactivate();
211
+ }
212
+ }
213
+ },
214
+ inputValue(newValue) {
215
+ if (this.termsAsTokens()) return;
216
+ if (this.multiSelect) return;
217
+
218
+ /**
219
+ * This is a temporary workaround to implement the same behaviour
220
+ * implemented in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2381
221
+ * for tokens with `terms-as-tokens=false` and `multi-select=false`.
222
+ *
223
+ * We're aiming to remove this temporary fix when
224
+ * https://gitlab.com/groups/gitlab-org/-/epics/15948 gets completed, as
225
+ * that refactoring will use the `@input` handler on the GlFilteredSearch
226
+ * component to handle tokens instead of doing workarounds.
227
+ */
228
+ if (typeof newValue !== 'string') return;
229
+ const hasUnclosedQuote = newValue.split('"').length % 2 === 0;
230
+ if (newValue.indexOf(' ') === -1 || hasUnclosedQuote) {
231
+ return;
232
+ }
233
+ const [firstWord, ...otherWords] = splitOnQuotes(newValue).filter((w, idx, arr) => Boolean(w) || idx === arr.length - 1);
234
+ this.$emit('input', firstWord);
235
+ if (otherWords.length) {
236
+ /**
237
+ * Emitted when Space appears in token segment value
238
+ * @property {array|string} newStrings New strings to be converted into term tokens
239
+ */
240
+ this.$emit('split', otherWords);
241
+ }
242
+ }
243
+ },
244
+ methods: {
245
+ emitIfInactive(e) {
246
+ if (e.button === LEFT_MOUSE_BUTTON && !this.active) {
247
+ /**
248
+ * Emitted on mousedown event on the main component.
249
+ */
250
+ this.$emit('activate');
251
+ e.preventDefault();
252
+ }
253
+ },
254
+ getMatchingOptionForInputValue(inputValue) {
255
+ var _this$options3;
256
+ let {
257
+ loose
258
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
259
+ loose: false
260
+ };
261
+ return (_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.find(option => loose ? match(option[this.optionTextField], inputValue) : option[this.optionTextField] === inputValue);
262
+ },
263
+ activate() {
264
+ this.fallbackValue = this.value;
265
+ this.$nextTick(() => {
266
+ const {
267
+ input
268
+ } = this.$refs;
269
+ if (input) {
270
+ input.focus();
271
+ input.scrollIntoView({
272
+ block: 'nearest',
273
+ inline: 'end'
274
+ });
275
+ this.alignSuggestions(input);
276
+ if (this.cursorPosition === 'start') {
277
+ input === null || input === void 0 ? void 0 : input.setSelectionRange(0, 0);
278
+ }
279
+ }
280
+ });
281
+ },
282
+ deactivate() {
283
+ var _this$matchingOption;
284
+ if (!this.options || this.isTerm) {
285
+ return;
286
+ }
287
+ if (((_this$matchingOption = this.matchingOption) === null || _this$matchingOption === void 0 ? void 0 : _this$matchingOption.value) !== this.value) {
288
+ this.$emit('input', this.fallbackValue);
289
+ }
290
+ },
291
+ applySuggestion(suggestedValue) {
292
+ const formattedSuggestedValue = this.termsAsTokens() ? suggestedValue : wrapTokenInQuotes(suggestedValue);
293
+
294
+ /**
295
+ * Emitted when autocomplete entry is selected.
296
+ *
297
+ * @type {string} value The selected value.
298
+ */
299
+ this.$emit('select', formattedSuggestedValue);
300
+ if (!this.multiSelect) {
301
+ this.$emit('input', formattedSuggestedValue === TERM_TOKEN_TYPE ? this.inputValue : formattedSuggestedValue);
302
+ this.$emit('complete', formattedSuggestedValue);
303
+ }
304
+ },
305
+ showHeader(option) {
306
+ var _option$value;
307
+ return (_option$value = option.value) === null || _option$value === void 0 ? void 0 : _option$value.toString().startsWith('gl-filtered-search-suggestion-group-');
308
+ },
309
+ handleInputKeydown(e) {
310
+ const {
311
+ key
312
+ } = e;
313
+ const {
314
+ suggestions,
315
+ input
316
+ } = this.$refs;
317
+ const suggestedValue = suggestions === null || suggestions === void 0 ? void 0 : suggestions.getValue();
318
+ const handlers = {
319
+ ArrowLeft: () => {
320
+ if (input.selectionStart === 0) {
321
+ e.preventDefault();
322
+ this.$emit('previous');
323
+ }
324
+ },
325
+ ArrowRight: () => {
326
+ if (input.selectionEnd === this.inputValue.length) {
327
+ e.preventDefault();
328
+ this.$emit('next');
329
+ }
330
+ },
331
+ Backspace: () => {
332
+ if (this.inputValue === '') {
333
+ e.preventDefault();
334
+ /**
335
+ * Emitted when Backspace is pressed and the value is empty
336
+ */
337
+ this.$emit('backspace');
338
+ }
339
+ },
340
+ Enter: () => {
341
+ e.preventDefault();
342
+ if (suggestedValue != null) {
343
+ this.applySuggestion(suggestedValue);
344
+ } else {
345
+ /**
346
+ * Emitted when Enter is pressed and no suggestion is selected
347
+ */
348
+ this.$emit('submit');
349
+ }
350
+ },
351
+ ':': () => {
352
+ if (suggestedValue != null) {
353
+ e.preventDefault();
354
+ this.applySuggestion(suggestedValue);
355
+ }
356
+ },
357
+ Escape: () => {
358
+ e.preventDefault();
359
+ /**
360
+ * Emitted when suggestion is selected from the suggestion list
361
+ */
362
+ this.$emit('complete');
363
+ }
364
+ };
365
+ const suggestionsHandlers = {
366
+ ArrowDown: () => suggestions.nextItem(),
367
+ Down: () => suggestions.nextItem(),
368
+ ArrowUp: () => suggestions.prevItem(),
369
+ Up: () => suggestions.prevItem()
370
+ };
371
+ if (this.hasOptionsOrSuggestions) {
372
+ Object.assign(handlers, suggestionsHandlers);
373
+ }
374
+ if (Object.keys(handlers).includes(key)) {
375
+ handlers[key]();
376
+ return;
377
+ }
378
+ this.customInputKeydownHandler(e, {
379
+ suggestedValue,
380
+ inputValue: this.inputValue,
381
+ applySuggestion: v => this.applySuggestion(v)
382
+ });
383
+ },
384
+ handleBlur(e) {
385
+ var _e$relatedTarget;
386
+ // Keep focus on input when blur event is on same element
387
+ // (e.g. scrollbar in filtered search suggestions list)
388
+ if ((_e$relatedTarget = e.relatedTarget) !== null && _e$relatedTarget !== void 0 && _e$relatedTarget.classList.contains(FILTERED_SEARCH_SUGGESTIONS_CLASS)) {
389
+ var _this$$refs$input;
390
+ (_this$$refs$input = this.$refs.input) === null || _this$$refs$input === void 0 ? void 0 : _this$$refs$input.focus();
391
+ return;
392
+ }
393
+ if (this.multiSelect) {
394
+ this.$emit('complete');
395
+ } else if (this.active) {
396
+ /**
397
+ * Emitted when this term token will lose its focus.
398
+ */
399
+ this.$emit('deactivate');
400
+ }
401
+ }
402
+ }
403
+ };
404
+
405
+ /* script */
406
+ const __vue_script__ = script;
407
+
408
+ /* template */
409
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',_vm._g(_vm._b({staticClass:"gl-filtered-search-token-segment",class:{
410
+ 'gl-filtered-search-token-segment-active': _vm.active,
411
+ '!gl-cursor-text': _vm.viewOnly,
412
+ },attrs:{"data-testid":"filtered-search-token-segment"}},'div',_vm.containerAttributes,false),_vm.viewOnly ? {} : { mousedown: _vm.emitIfInactive }),[(_vm.active)?[_vm._t("before-input",null,null,{ submitValue: _vm.applySuggestion }),_vm._v(" "),_vm._t("input",function(){return [(((_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",class:{ 'gl-filtered-search-token-segment-input-disabled': _vm.viewOnly },attrs:{"data-testid":"filtered-search-token-segment-input","aria-label":_vm.label,"disabled":_vm.viewOnly,"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",class:{ 'gl-filtered-search-token-segment-input-disabled': _vm.viewOnly },attrs:{"data-testid":"filtered-search-token-segment-input","aria-label":_vm.label,"disabled":_vm.viewOnly,"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",class:{ 'gl-filtered-search-token-segment-input-disabled': _vm.viewOnly },attrs:{"data-testid":"filtered-search-token-segment-input","aria-label":_vm.label,"disabled":_vm.viewOnly,"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))]},null,{ submitValue: _vm.applySuggestion }),_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:{"role":"list","tabindex":"-1","data-testid":"filtered-search-suggestion-list","initial-value":_vm.defaultSuggestedValue},on:{"suggestion":_vm.applySuggestion}},[(_vm.options)?[_vm._l((_vm.options),function(option,idx){return [(_vm.showHeader(option))?[(idx > 0)?_c('li',{key:("separator-" + idx)},[_c('hr',{staticClass:"gl-border-t -gl-mx-2 gl-my-2"})]):_vm._e(),_vm._v(" "),_c('li',{key:("header-" + idx),staticClass:"gl-mx-0 gl-pb-2 gl-pl-5 gl-pt-3 gl-text-sm gl-font-bold gl-text-strong",attrs:{"role":"presentation","data-testid":"filtered-search-section-header"}},[_vm._v("\n "+_vm._s(option.title)+"\n ")])]:_c('gl-filtered-search-suggestion',{key:((option.value) + "-" + idx),attrs:{"value":option.value,"icon-name":option.icon}},[_vm._t("option",function(){return [(option.component)?[_c(option.component,{tag:"component",attrs:{"option":option}})]:[_vm._v("\n "+_vm._s(option[_vm.optionTextField])+"\n ")]]},null,{ option: option })],2)]})]:_vm._t("suggestions")],2):_vm._e()],1)]:_vm._t("view",function(){return [_vm._v(_vm._s(_vm.inputValue))]},null,{ label: _vm.label, inputValue: _vm.inputValue })],2)};
413
+ var __vue_staticRenderFns__ = [];
414
+
415
+ /* style */
416
+ const __vue_inject_styles__ = undefined;
417
+ /* scoped */
418
+ const __vue_scope_id__ = undefined;
419
+ /* module identifier */
420
+ const __vue_module_identifier__ = undefined;
421
+ /* functional template */
422
+ const __vue_is_functional_template__ = false;
423
+ /* style inject */
424
+
425
+ /* style inject SSR */
426
+
427
+ /* style inject shadow dom */
428
+
429
+
430
+
431
+ const __vue_component__ = /*#__PURE__*/__vue_normalize__(
432
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
433
+ __vue_inject_styles__,
434
+ __vue_script__,
435
+ __vue_scope_id__,
436
+ __vue_is_functional_template__,
437
+ __vue_module_identifier__,
438
+ false,
439
+ undefined,
440
+ undefined,
441
+ undefined
442
+ );
443
+
444
+ export { __vue_component__ as default };
@@ -0,0 +1,241 @@
1
+ import { first, last, isString } from 'lodash-es';
2
+ import { modulo } from '../../../utils/number_utils';
3
+
4
+ const TERM_TOKEN_TYPE = 'filtered-search-term';
5
+ const INTENT_ACTIVATE_PREVIOUS = 'intent-activate-previous';
6
+ const TOKEN_CLOSE_SELECTOR = '.gl-token-close';
7
+ const FILTERED_SEARCH_SUGGESTIONS_CLASS = 'gl-filtered-search-suggestion-list';
8
+ function isEmptyTerm(token) {
9
+ return token.type === TERM_TOKEN_TYPE && token.value.data.trim() === '';
10
+ }
11
+ function normalizeTokens(tokens) {
12
+ const result = [];
13
+ tokens.forEach(token => {
14
+ if (isEmptyTerm(token)) {
15
+ return;
16
+ }
17
+ if (token.type !== TERM_TOKEN_TYPE) {
18
+ result.push({
19
+ ...token
20
+ });
21
+ } else if (result.length > 0 && typeof result[result.length - 1] === 'string') {
22
+ result[result.length - 1] += ` ${token.value.data}`;
23
+ } else {
24
+ result.push(token.value.data);
25
+ }
26
+ });
27
+ return result;
28
+ }
29
+ function assertValidTokens(tokens) {
30
+ if (!Array.isArray(tokens) && !typeof tokens === 'string') {
31
+ throw new TypeError('Either string or array of tokens is expected');
32
+ }
33
+ }
34
+ function needDenormalization(tokens) {
35
+ if (typeof tokens === 'string') {
36
+ return true;
37
+ }
38
+ assertValidTokens(tokens);
39
+ return tokens.some(t => typeof t === 'string' || !t.id);
40
+ }
41
+
42
+ /**
43
+ * Given an initial index, step size and array length, returns an index that is
44
+ * within the array bounds (unless step is 0; see † below).
45
+ *
46
+ * The step can be any positive or negative integer, including zero.
47
+ *
48
+ * An out-of-bounds index is considered 'uninitialised', and is handled
49
+ * specially. For instance, the 'next' index of 'uninitialised' is the first
50
+ * index:
51
+ *
52
+ * stepIndexAndWrap(-1, 1, 5) === 0
53
+ *
54
+ * The 'previous' index of 'uninitialised' is the last index:
55
+ *
56
+ * stepIndexAndWrap(-1, -1, 5) === 4
57
+ *
58
+ * †: If step is 0, the index is returned as-is, which may be out-of-bounds.
59
+ *
60
+ * @param {number} index The initial index.
61
+ * @param {number} step The amount to step by (positive or negative).
62
+ * @param {number} length The length of the array.
63
+ * @returns {number}
64
+ */
65
+ function stepIndexAndWrap(index, step, length) {
66
+ if (step === 0) return index;
67
+ let start;
68
+ const indexInRange = index >= 0 && index < length;
69
+ if (indexInRange) {
70
+ // Step from the valid index.
71
+ start = index;
72
+ } else if (step > 0) {
73
+ // Step forwards from the beginning of the array.
74
+ start = -1;
75
+ } else {
76
+ // Step backwards from the end of the array.
77
+ start = length;
78
+ }
79
+ return modulo(start + step, length);
80
+ }
81
+
82
+ /**
83
+ * Transforms a given token definition to an option definition.
84
+ *
85
+ * @param {Object} token A token definition (see GlFilteredSearch's
86
+ * availableTokens prop).
87
+ * @returns {Object} A option definition (see GlFilteredSearchTokenSegment's
88
+ * options prop).
89
+ */
90
+ function tokenToOption(_ref) {
91
+ let {
92
+ icon,
93
+ title,
94
+ type,
95
+ optionComponent
96
+ } = _ref;
97
+ return {
98
+ icon,
99
+ title,
100
+ value: type,
101
+ component: optionComponent
102
+ };
103
+ }
104
+ let tokenIdCounter = 0;
105
+ const getTokenId = () => {
106
+ const tokenId = `token-${tokenIdCounter}`;
107
+ tokenIdCounter += 1;
108
+ return tokenId;
109
+ };
110
+ /**
111
+ * Ensure the given token has an `id` property, which `GlFilteredSearch` relies
112
+ * on as a unique key for the token.
113
+ *
114
+ * If the given token does not have an `id`, it returns a shallow copy of the
115
+ * token with an `id`. Otherwise, it returns the given token.
116
+ *
117
+ * @param {object} token The token to check.
118
+ * @returns {object} A token with an `id`.
119
+ */
120
+ function ensureTokenId(token) {
121
+ if (!token.id) {
122
+ return {
123
+ ...token,
124
+ id: getTokenId()
125
+ };
126
+ }
127
+ return token;
128
+ }
129
+ function createTerm() {
130
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
131
+ return {
132
+ id: getTokenId(),
133
+ type: TERM_TOKEN_TYPE,
134
+ value: {
135
+ data
136
+ }
137
+ };
138
+ }
139
+ function denormalizeTokens(inputTokens) {
140
+ let termsAsTokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
141
+ assertValidTokens(inputTokens);
142
+ const tokens = Array.isArray(inputTokens) ? inputTokens : [inputTokens];
143
+ return tokens.reduce((result, t) => {
144
+ if (typeof t === 'string') {
145
+ if (termsAsTokens) {
146
+ const trimmedText = t.trim();
147
+ if (trimmedText) result.push(createTerm(trimmedText));
148
+ } else {
149
+ const stringTokens = t.split(' ').filter(Boolean);
150
+ stringTokens.forEach(strToken => result.push(createTerm(strToken)));
151
+ }
152
+ } else {
153
+ result.push(ensureTokenId(t));
154
+ }
155
+ return result;
156
+ }, []);
157
+ }
158
+
159
+ /**
160
+ * Returns `true` if `text` contains `query` (case insensitive).
161
+ *
162
+ * This is used in `filter` and `find` array methods for token segment options.
163
+ *
164
+ * @param {string} text The string to look within.
165
+ * @param {string} query The string to find inside the text.
166
+ * @returns {boolean}
167
+ */
168
+ function match(text, query) {
169
+ return text.toLowerCase().includes(query.toLowerCase());
170
+ }
171
+ const termTokenDefinition = {
172
+ type: TERM_TOKEN_TYPE,
173
+ icon: 'title',
174
+ title: 'Search for this text'
175
+ };
176
+ function splitOnQuotes(str) {
177
+ if (first(str) === "'" && last(str) === "'") {
178
+ return [str];
179
+ }
180
+ if (first(str) === '"' && last(str) === '"') {
181
+ return [str];
182
+ }
183
+ const queue = str.split(' ');
184
+ const result = [];
185
+ let waitingForMatchingQuote = false;
186
+ let quoteContent = '';
187
+ while (queue.length) {
188
+ const part = queue.shift();
189
+ const quoteIndex = part.indexOf('"');
190
+ if (quoteIndex === -1) {
191
+ if (waitingForMatchingQuote) {
192
+ quoteContent += ` ${part}`;
193
+ } else {
194
+ result.push(part);
195
+ }
196
+ } else {
197
+ const [firstPart, secondPart] = part.split('"', 2);
198
+ if (waitingForMatchingQuote) {
199
+ waitingForMatchingQuote = false;
200
+ quoteContent += ` ${firstPart}"`;
201
+ result.push(quoteContent);
202
+ quoteContent = '';
203
+ if (secondPart.length) {
204
+ queue.unshift(secondPart);
205
+ }
206
+ } else {
207
+ waitingForMatchingQuote = true;
208
+ if (firstPart.length) {
209
+ result.push(firstPart);
210
+ }
211
+ quoteContent = `"${secondPart}`;
212
+ }
213
+ }
214
+ }
215
+ return result;
216
+ }
217
+
218
+ /**
219
+ * wraps the incoming token in double quotes.
220
+ * Eg. Foo Bar becomes "Foo Bar"
221
+ *
222
+ * 1. token must have space.
223
+ * 2. token should not already have a quote around it.
224
+ */
225
+ function wrapTokenInQuotes(token) {
226
+ if (!isString(token)) {
227
+ return token;
228
+ }
229
+ if (!token.includes(' ')) {
230
+ return token;
231
+ }
232
+ const quotes = ["'", '"'];
233
+
234
+ // If the token starts and ends with a quote, eg. "Foo Bar", then return the original token.
235
+ if (quotes.some(quote => first(token) === quote && last(token) === quote)) {
236
+ return token;
237
+ }
238
+ return `"${token}"`;
239
+ }
240
+
241
+ export { FILTERED_SEARCH_SUGGESTIONS_CLASS, INTENT_ACTIVATE_PREVIOUS, TERM_TOKEN_TYPE, TOKEN_CLOSE_SELECTOR, createTerm, denormalizeTokens, ensureTokenId, isEmptyTerm, match, needDenormalization, normalizeTokens, splitOnQuotes, stepIndexAndWrap, termTokenDefinition, tokenToOption, wrapTokenInQuotes };