@gitlab/ui 72.12.0 → 72.12.1

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 (209) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/charts.js +14 -0
  3. package/dist/components/base/accordion/accordion.js +73 -0
  4. package/dist/components/base/accordion/accordion_item.js +133 -0
  5. package/dist/components/base/alert/alert.js +222 -0
  6. package/dist/components/base/avatar/avatar.js +160 -0
  7. package/dist/components/base/avatar_labeled/avatar_labeled.js +107 -0
  8. package/dist/components/base/avatar_link/avatar_link.js +47 -0
  9. package/dist/components/base/avatars_inline/avatars_inline.js +119 -0
  10. package/dist/components/base/badge/badge.js +105 -0
  11. package/dist/components/base/banner/banner.js +139 -0
  12. package/dist/components/base/breadcrumb/breadcrumb.js +122 -0
  13. package/dist/components/base/breadcrumb/breadcrumb_item.js +73 -0
  14. package/dist/components/base/broadcast_message/broadcast_message.js +112 -0
  15. package/dist/components/base/broadcast_message/constants.js +5 -0
  16. package/dist/components/base/button/button.js +151 -0
  17. package/dist/components/base/button_group/button_group.js +47 -0
  18. package/dist/components/base/card/card.js +71 -0
  19. package/dist/components/base/carousel/carousel.js +48 -0
  20. package/dist/components/base/carousel/carousel_slide.js +47 -0
  21. package/dist/components/base/collapse/collapse.js +59 -0
  22. package/dist/components/base/datepicker/datepicker.js +386 -0
  23. package/dist/components/base/daterange_picker/daterange_picker.js +288 -0
  24. package/dist/components/base/drawer/drawer.js +127 -0
  25. package/dist/components/base/dropdown/dropdown.js +261 -0
  26. package/dist/components/base/dropdown/dropdown_divider.js +48 -0
  27. package/dist/components/base/dropdown/dropdown_form.js +48 -0
  28. package/dist/components/base/dropdown/dropdown_item.js +131 -0
  29. package/dist/components/base/dropdown/dropdown_section_header.js +48 -0
  30. package/dist/components/base/dropdown/dropdown_text.js +48 -0
  31. package/dist/components/base/filtered_search/common_story_options.js +14 -0
  32. package/dist/components/base/filtered_search/filtered_search.js +388 -0
  33. package/dist/components/base/filtered_search/filtered_search_suggestion.js +89 -0
  34. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +138 -0
  35. package/dist/components/base/filtered_search/filtered_search_term.js +203 -0
  36. package/dist/components/base/filtered_search/filtered_search_token.js +384 -0
  37. package/dist/components/base/filtered_search/filtered_search_token_segment.js +420 -0
  38. package/dist/components/base/filtered_search/filtered_search_utils.js +242 -0
  39. package/dist/components/base/form/form.js +49 -0
  40. package/dist/components/base/form/form_checkbox/form_checkbox.js +78 -0
  41. package/dist/components/base/form/form_checkbox/form_checkbox_group.js +60 -0
  42. package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +79 -0
  43. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +138 -0
  44. package/dist/components/base/form/form_checkbox_tree/models/constants.js +12 -0
  45. package/dist/components/base/form/form_checkbox_tree/models/node.js +51 -0
  46. package/dist/components/base/form/form_checkbox_tree/models/tree.js +199 -0
  47. package/dist/components/base/form/form_combobox/constants.js +55 -0
  48. package/dist/components/base/form/form_combobox/form_combobox.js +230 -0
  49. package/dist/components/base/form/form_date/form_date.js +143 -0
  50. package/dist/components/base/form/form_fields/form_field_validator.js +93 -0
  51. package/dist/components/base/form/form_fields/form_fields.js +214 -0
  52. package/dist/components/base/form/form_fields/mappers.js +13 -0
  53. package/dist/components/base/form/form_fields/validators.js +48 -0
  54. package/dist/components/base/form/form_group/form_group.js +97 -0
  55. package/dist/components/base/form/form_input/form_input.js +121 -0
  56. package/dist/components/base/form/form_input_group/form_input_group.js +108 -0
  57. package/dist/components/base/form/form_input_group/form_input_group_mixin.js +41 -0
  58. package/dist/components/base/form/form_radio/form_radio.js +65 -0
  59. package/dist/components/base/form/form_radio_group/form_radio_group.js +78 -0
  60. package/dist/components/base/form/form_select/constants.js +12 -0
  61. package/dist/components/base/form/form_select/form_select.js +82 -0
  62. package/dist/components/base/form/form_text/form_text.js +38 -0
  63. package/dist/components/base/form/form_textarea/form_textarea.js +112 -0
  64. package/dist/components/base/form/input_group_text/input_group_text.js +48 -0
  65. package/dist/components/base/icon/icon.js +111 -0
  66. package/dist/components/base/infinite_scroll/infinite_scroll.js +197 -0
  67. package/dist/components/base/keyset_pagination/keyset_pagination.js +151 -0
  68. package/dist/components/base/label/label.js +163 -0
  69. package/dist/components/base/link/link.js +50 -0
  70. package/dist/components/base/loading_icon/loading_icon.js +111 -0
  71. package/dist/components/base/markdown/markdown.js +52 -0
  72. package/dist/components/base/modal/modal.js +204 -0
  73. package/dist/components/base/nav/nav.js +48 -0
  74. package/dist/components/base/nav/nav_item.js +48 -0
  75. package/dist/components/base/nav/nav_item_dropdown.js +62 -0
  76. package/dist/components/base/navbar/navbar.js +48 -0
  77. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +453 -0
  78. package/dist/components/base/new_dropdowns/base_dropdown/constants.js +4 -0
  79. package/dist/components/base/new_dropdowns/constants.js +21 -0
  80. package/dist/components/base/new_dropdowns/disclosure/constants.js +8 -0
  81. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +370 -0
  82. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +110 -0
  83. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +143 -0
  84. package/dist/components/base/new_dropdowns/disclosure/mock_data.js +147 -0
  85. package/dist/components/base/new_dropdowns/disclosure/utils.js +39 -0
  86. package/dist/components/base/new_dropdowns/listbox/listbox.js +767 -0
  87. package/dist/components/base/new_dropdowns/listbox/listbox_group.js +58 -0
  88. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +91 -0
  89. package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +93 -0
  90. package/dist/components/base/new_dropdowns/listbox/mock_data.js +118 -0
  91. package/dist/components/base/new_dropdowns/listbox/utils.js +34 -0
  92. package/dist/components/base/paginated_list/paginated_list.js +180 -0
  93. package/dist/components/base/pagination/pagination.js +399 -0
  94. package/dist/components/base/path/data.js +34 -0
  95. package/dist/components/base/path/path.js +189 -0
  96. package/dist/components/base/popover/popover.js +110 -0
  97. package/dist/components/base/progress_bar/progress_bar.js +48 -0
  98. package/dist/components/base/search_box_by_click/search_box_by_click.js +235 -0
  99. package/dist/components/base/search_box_by_type/search_box_by_type.js +167 -0
  100. package/dist/components/base/segmented_control/segmented_control.js +109 -0
  101. package/dist/components/base/skeleton_loader/skeleton_loader.js +224 -0
  102. package/dist/components/base/sorting/sorting.js +171 -0
  103. package/dist/components/base/sorting/sorting_item.js +109 -0
  104. package/dist/components/base/table/constants.js +5 -0
  105. package/dist/components/base/table/table.js +89 -0
  106. package/dist/components/base/table_lite/table_lite.js +72 -0
  107. package/dist/components/base/tabs/constants.js +3 -0
  108. package/dist/components/base/tabs/tab/tab.js +83 -0
  109. package/dist/components/base/tabs/tabs/scrollable_tabs.js +143 -0
  110. package/dist/components/base/tabs/tabs/tabs.js +224 -0
  111. package/dist/components/base/toast/toast.js +82 -0
  112. package/dist/components/base/toggle/toggle.js +180 -0
  113. package/dist/components/base/token/token.js +85 -0
  114. package/dist/components/base/token_selector/helpers.js +5 -0
  115. package/dist/components/base/token_selector/token_container.js +165 -0
  116. package/dist/components/base/token_selector/token_selector.js +403 -0
  117. package/dist/components/base/token_selector/token_selector_dropdown.js +199 -0
  118. package/dist/components/base/tooltip/tooltip.js +55 -0
  119. package/dist/components/charts/area/area.js +311 -0
  120. package/dist/components/charts/bar/bar.js +253 -0
  121. package/dist/components/charts/chart/chart.js +215 -0
  122. package/dist/components/charts/column/column.js +226 -0
  123. package/dist/components/charts/discrete_scatter/discrete_scatter.js +203 -0
  124. package/dist/components/charts/gauge/gauge.js +208 -0
  125. package/dist/components/charts/heatmap/heatmap.js +295 -0
  126. package/dist/components/charts/heatmap/index.js +2 -0
  127. package/dist/components/charts/legend/legend.js +228 -0
  128. package/dist/components/charts/line/line.js +308 -0
  129. package/dist/components/charts/series_label/series_label.js +100 -0
  130. package/dist/components/charts/single_stat/single_stat.js +152 -0
  131. package/dist/components/charts/sparkline/sparkline.js +261 -0
  132. package/dist/components/charts/stacked_column/stacked_column.js +335 -0
  133. package/dist/components/charts/tooltip/tooltip.js +251 -0
  134. package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +83 -0
  135. package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +100 -0
  136. package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +35 -0
  137. package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +115 -0
  138. package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +104 -0
  139. package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +64 -0
  140. package/dist/components/experimental/duo/chat/constants.js +23 -0
  141. package/dist/components/experimental/duo/chat/duo_chat.js +359 -0
  142. package/dist/components/experimental/duo/chat/mock_data.js +83 -0
  143. package/dist/components/experimental/duo/user_feedback/user_feedback.js +94 -0
  144. package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +124 -0
  145. package/dist/components/experimental/experiment_badge/constants.js +4 -0
  146. package/dist/components/experimental/experiment_badge/experiment_badge.js +107 -0
  147. package/dist/components/mixins/button_mixin.js +11 -0
  148. package/dist/components/mixins/safe_link_mixin.js +30 -0
  149. package/dist/components/mixins/tooltip_mixin.js +21 -0
  150. package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +53 -0
  151. package/dist/components/regions/empty_state/empty_state.js +154 -0
  152. package/dist/components/shared_components/charts/tooltip_default_format.js +53 -0
  153. package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +64 -0
  154. package/dist/components/shared_components/close_button/close_button.js +54 -0
  155. package/dist/components/utilities/animated_number/animated_number.js +131 -0
  156. package/dist/components/utilities/friendly_wrap/friendly_wrap.js +75 -0
  157. package/dist/components/utilities/intersection_observer/intersection_observer.js +88 -0
  158. package/dist/components/utilities/intersperse/intersperse.js +86 -0
  159. package/dist/components/utilities/sprintf/sprintf.js +172 -0
  160. package/dist/components/utilities/truncate/constants.js +7 -0
  161. package/dist/components/utilities/truncate/truncate.js +111 -0
  162. package/dist/components/utilities/truncate_text/constants.js +7 -0
  163. package/dist/components/utilities/truncate_text/truncate_text.js +146 -0
  164. package/dist/config.js +86 -0
  165. package/dist/directives/collapse_toggle.js +1 -0
  166. package/dist/directives/hover_load/hover_load.js +45 -0
  167. package/dist/directives/modal.js +1 -0
  168. package/dist/directives/outside/get_event_like_time_stamp.js +33 -0
  169. package/dist/directives/outside/outside.js +106 -0
  170. package/dist/directives/resize_observer/resize_observer.js +51 -0
  171. package/dist/directives/safe_html/constants.js +6 -0
  172. package/dist/directives/safe_html/safe_html.js +39 -0
  173. package/dist/directives/safe_link/mock_data.js +10 -0
  174. package/dist/directives/safe_link/safe_link.js +65 -0
  175. package/dist/directives/tooltip.js +1 -0
  176. package/dist/index.css +7 -0
  177. package/dist/index.css.map +1 -0
  178. package/dist/index.js +105 -0
  179. package/dist/tokens/common_story_options.js +54 -0
  180. package/dist/tokens/css/tokens.css +1 -1
  181. package/dist/tokens/css/tokens.dark.css +1 -1
  182. package/dist/tokens/js/tokens.dark.js +1 -1
  183. package/dist/tokens/js/tokens.js +1 -1
  184. package/dist/tokens/scss/_tokens.dark.scss +1 -1
  185. package/dist/tokens/scss/_tokens.scss +1 -1
  186. package/dist/utils/breakpoints.js +20 -0
  187. package/dist/utils/charts/config.js +556 -0
  188. package/dist/utils/charts/constants.js +63 -0
  189. package/dist/utils/charts/mock_data.js +211 -0
  190. package/dist/utils/charts/story_config.js +42 -0
  191. package/dist/utils/charts/theme.js +192 -0
  192. package/dist/utils/charts/utils.js +54 -0
  193. package/dist/utils/constants.js +288 -0
  194. package/dist/utils/data_utils.js +21 -0
  195. package/dist/utils/datetime_utility.js +61 -0
  196. package/dist/utils/i18n.js +15 -0
  197. package/dist/utils/is_slot_empty.js +38 -0
  198. package/dist/utils/number_utils.js +124 -0
  199. package/dist/utils/stories_constants.js +29 -0
  200. package/dist/utils/stories_utils.js +13 -0
  201. package/dist/utils/story_decorators/container.js +16 -0
  202. package/dist/utils/string_utils.js +69 -0
  203. package/dist/utils/svgs/svg_paths.js +7 -0
  204. package/dist/utils/test_utils.js +33 -0
  205. package/dist/utils/use_fake_date.js +29 -0
  206. package/dist/utils/use_mock_intersection_observer.js +108 -0
  207. package/dist/utils/utils.js +197 -0
  208. package/dist/utils.js +5 -0
  209. package/package.json +1 -1
@@ -0,0 +1,83 @@
1
+ import { BTab } from 'bootstrap-vue/esm/index.js';
2
+ import isPlainObject from 'lodash/isPlainObject';
3
+ import { DEFAULT_TAB_TITLE_LINK_CLASS } from '../constants';
4
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
+
6
+ //
7
+ var script = {
8
+ name: 'GlTab',
9
+ components: {
10
+ BTab
11
+ },
12
+ inheritAttrs: false,
13
+ props: {
14
+ titleLinkClass: {
15
+ type: [String, Array, Object],
16
+ required: false,
17
+ default: ''
18
+ },
19
+ /**
20
+ * Query string parameter value to use when `gl-tabs` `sync-active-tab-with-query-params` prop is set to `true`.
21
+ */
22
+ queryParamValue: {
23
+ type: String,
24
+ required: false,
25
+ default: null
26
+ }
27
+ },
28
+ computed: {
29
+ linkClass() {
30
+ const {
31
+ titleLinkClass
32
+ } = this;
33
+ if (Array.isArray(titleLinkClass)) {
34
+ return [...titleLinkClass, DEFAULT_TAB_TITLE_LINK_CLASS];
35
+ }
36
+ if (isPlainObject(titleLinkClass)) {
37
+ return {
38
+ ...titleLinkClass,
39
+ [DEFAULT_TAB_TITLE_LINK_CLASS]: true
40
+ };
41
+ }
42
+ return `${titleLinkClass} ${DEFAULT_TAB_TITLE_LINK_CLASS}`.trim();
43
+ }
44
+ }
45
+ };
46
+
47
+ /* script */
48
+ const __vue_script__ = script;
49
+
50
+ /* template */
51
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-tab',_vm._g(_vm._b({attrs:{"title-link-class":_vm.linkClass,"query-param-value":_vm.queryParamValue},scopedSlots:_vm._u([_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}})],null,true)},'b-tab',_vm.$attrs,false),_vm.$listeners))};
52
+ var __vue_staticRenderFns__ = [];
53
+
54
+ /* style */
55
+ const __vue_inject_styles__ = undefined;
56
+ /* scoped */
57
+ const __vue_scope_id__ = undefined;
58
+ /* module identifier */
59
+ const __vue_module_identifier__ = undefined;
60
+ /* functional template */
61
+ const __vue_is_functional_template__ = false;
62
+ /* style inject */
63
+
64
+ /* style inject SSR */
65
+
66
+ /* style inject shadow dom */
67
+
68
+
69
+
70
+ const __vue_component__ = __vue_normalize__(
71
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
72
+ __vue_inject_styles__,
73
+ __vue_script__,
74
+ __vue_scope_id__,
75
+ __vue_is_functional_template__,
76
+ __vue_module_identifier__,
77
+ false,
78
+ undefined,
79
+ undefined,
80
+ undefined
81
+ );
82
+
83
+ export default __vue_component__;
@@ -0,0 +1,143 @@
1
+ import debounce from 'lodash/debounce';
2
+ import { GlResizeObserverDirective } from '../../../../directives/resize_observer/resize_observer';
3
+ import GlIcon from '../../icon/icon';
4
+ import GlTabs from './tabs';
5
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
+
7
+ const NAV_CLASS = 'gl-scrollable-tabs-nav';
8
+ var script = {
9
+ name: 'GlScrollableTabs',
10
+ components: {
11
+ GlTabs,
12
+ GlIcon
13
+ },
14
+ directives: {
15
+ GlResizeObserverDirective
16
+ },
17
+ inheritAttrs: false,
18
+ data() {
19
+ return {
20
+ width: 0,
21
+ // This is a reactive value of a child element's scrollLeft. It is not two-way bound.
22
+ // Do not set manually outside of "scroll" callback.
23
+ scrollLeft: 0,
24
+ navScrollWidth: 0
25
+ };
26
+ },
27
+ computed: {
28
+ navClass() {
29
+ const attrsNavClass = this.$attrs.navClass;
30
+ if (!attrsNavClass) {
31
+ return [NAV_CLASS];
32
+ }
33
+ if (Array.isArray(attrsNavClass)) {
34
+ return [NAV_CLASS, ...attrsNavClass];
35
+ }
36
+ return [NAV_CLASS, attrsNavClass];
37
+ },
38
+ displayScrollLeft() {
39
+ // if we have scrolled && there's overflow
40
+ return this.scrollLeft && this.width < this.navScrollWidth;
41
+ },
42
+ displayScrollRight() {
43
+ // if there's more overflow to the right
44
+ return this.scrollLeft + this.width < this.navScrollWidth;
45
+ },
46
+ passthroughAttrs() {
47
+ return Object.keys(this.$attrs).filter(key => !key.startsWith('action')).reduce((acc, key) => Object.assign(acc, {
48
+ [key]: this.$attrs[key]
49
+ }), {});
50
+ }
51
+ },
52
+ mounted() {
53
+ this.$nextTick(() => {
54
+ this.navScrollWidth = this.getScrollWidth();
55
+ });
56
+ this.handleNavScroll = debounce(e => {
57
+ this.scrollLeft = e.target.scrollLeft;
58
+ }, 100);
59
+ this.getNavContainer().addEventListener('scroll', this.handleNavScroll);
60
+ },
61
+ beforeDestroy() {
62
+ this.getNavContainer().removeEventListener('scroll', this.handleNavScroll);
63
+ },
64
+ updated() {
65
+ // Whenever tabs are added or removed we need to recalculate the reactive scrollWidth
66
+ this.$nextTick(() => {
67
+ this.navScrollWidth = this.getScrollWidth();
68
+ });
69
+ },
70
+ methods: {
71
+ handleResize(_ref) {
72
+ let {
73
+ contentRect: {
74
+ width
75
+ }
76
+ } = _ref;
77
+ this.width = width;
78
+ this.navScrollWidth = this.getScrollWidth();
79
+ },
80
+ scrollTabsLeft() {
81
+ const scrollTo = this.scrollLeft - this.width;
82
+ this.scrollTabs(Math.max(scrollTo, 0));
83
+ },
84
+ scrollTabsRight() {
85
+ const scrollTo = this.scrollLeft + this.width;
86
+ this.scrollTabs(Math.min(scrollTo, this.getScrollWidth() - this.width));
87
+ },
88
+ scrollTabs(scrollTo) {
89
+ this.getNavContainer().scrollTo({
90
+ left: scrollTo,
91
+ behavior: 'smooth'
92
+ });
93
+ this.scrollLeft = scrollTo;
94
+ },
95
+ getScrollWidth() {
96
+ var _this$getNavContainer;
97
+ return ((_this$getNavContainer = this.getNavContainer()) === null || _this$getNavContainer === void 0 ? void 0 : _this$getNavContainer.scrollWidth) || 0;
98
+ },
99
+ getNavContainer() {
100
+ var _this$$el;
101
+ return (_this$$el = this.$el) === null || _this$$el === void 0 ? void 0 : _this$$el.querySelector(`.${NAV_CLASS}`);
102
+ }
103
+ },
104
+ NAV_CLASS
105
+ };
106
+
107
+ /* script */
108
+ const __vue_script__ = script;
109
+
110
+ /* template */
111
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-tabs',_vm._g(_vm._b({directives:[{name:"gl-resize-observer-directive",rawName:"v-gl-resize-observer-directive",value:(_vm.handleResize),expression:"handleResize"}],attrs:{"nav-class":_vm.navClass},scopedSlots:_vm._u([_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}}),{key:"tabs-start",fn:function(){return [_c('li',{directives:[{name:"show",rawName:"v-show",value:(_vm.displayScrollLeft),expression:"displayScrollLeft"}],staticClass:"gl-tabs-fade gl-tabs-fade-left"},[_c('button',{staticClass:"gl-tabs-fade-icon-button",attrs:{"aria-label":"Scroll left","tabindex":"-1"},on:{"click":_vm.scrollTabsLeft}},[_c('gl-icon',{attrs:{"size":16,"name":"chevron-lg-left"}})],1)])]},proxy:true},{key:"tabs-end",fn:function(){return [_c('li',{directives:[{name:"show",rawName:"v-show",value:(_vm.displayScrollRight),expression:"displayScrollRight"}],staticClass:"gl-tabs-fade gl-tabs-fade-right"},[_c('button',{staticClass:"gl-tabs-fade-icon-button",attrs:{"aria-label":"Scroll right","tabindex":"-1"},on:{"click":_vm.scrollTabsRight}},[_c('gl-icon',{attrs:{"size":16,"name":"chevron-lg-right"}})],1)])]},proxy:true}],null,true)},'gl-tabs',_vm.passthroughAttrs,false),_vm.$listeners))};
112
+ var __vue_staticRenderFns__ = [];
113
+
114
+ /* style */
115
+ const __vue_inject_styles__ = undefined;
116
+ /* scoped */
117
+ const __vue_scope_id__ = undefined;
118
+ /* module identifier */
119
+ const __vue_module_identifier__ = undefined;
120
+ /* functional template */
121
+ const __vue_is_functional_template__ = false;
122
+ /* style inject */
123
+
124
+ /* style inject SSR */
125
+
126
+ /* style inject shadow dom */
127
+
128
+
129
+
130
+ const __vue_component__ = __vue_normalize__(
131
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
132
+ __vue_inject_styles__,
133
+ __vue_script__,
134
+ __vue_scope_id__,
135
+ __vue_is_functional_template__,
136
+ __vue_module_identifier__,
137
+ false,
138
+ undefined,
139
+ undefined,
140
+ undefined
141
+ );
142
+
143
+ export default __vue_component__;
@@ -0,0 +1,224 @@
1
+ import { BTabs } from 'bootstrap-vue/esm/index.js';
2
+ import { tabsButtonDefaults } from '../../../../utils/constants';
3
+ import GlButton from '../../button/button';
4
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
+
6
+ //
7
+ const validatorHelper = obj => Object.keys(obj).every(val => val === 'text' || val === 'attributes');
8
+ var script = {
9
+ name: 'GlTabs',
10
+ components: {
11
+ BTabs,
12
+ GlButton
13
+ },
14
+ inheritAttrs: false,
15
+ props: {
16
+ actionPrimary: {
17
+ type: Object,
18
+ required: false,
19
+ default: null,
20
+ validator: obj => validatorHelper(obj)
21
+ },
22
+ actionSecondary: {
23
+ type: Object,
24
+ required: false,
25
+ default: null,
26
+ validator: obj => validatorHelper(obj)
27
+ },
28
+ actionTertiary: {
29
+ type: Object,
30
+ required: false,
31
+ default: null,
32
+ validator: obj => validatorHelper(obj)
33
+ },
34
+ contentClass: {
35
+ type: [String, Array, Object],
36
+ required: false,
37
+ default: null
38
+ },
39
+ navClass: {
40
+ type: [String, Array, Object],
41
+ required: false,
42
+ default: null
43
+ },
44
+ justified: {
45
+ type: Boolean,
46
+ required: false,
47
+ default: false
48
+ },
49
+ /**
50
+ * Sync active tab with query string parameters. Allows for deep linking into specific tabs.
51
+ */
52
+ syncActiveTabWithQueryParams: {
53
+ type: Boolean,
54
+ required: false,
55
+ default: false
56
+ },
57
+ /**
58
+ * Name to use for query string parameter.
59
+ */
60
+ queryParamName: {
61
+ type: String,
62
+ required: false,
63
+ default: 'tab'
64
+ },
65
+ value: {
66
+ type: Number,
67
+ required: false,
68
+ default: 0
69
+ }
70
+ },
71
+ data() {
72
+ return {
73
+ activeTabIndex: 0
74
+ };
75
+ },
76
+ computed: {
77
+ hasActions() {
78
+ return [this.actionPrimary, this.actionSecondary, this.actionTertiary].some(Boolean);
79
+ },
80
+ listeners() {
81
+ return {
82
+ ...this.$listeners,
83
+ input: this.handleInput
84
+ };
85
+ }
86
+ },
87
+ watch: {
88
+ value: {
89
+ handler(newValue) {
90
+ if (this.activeTabIndex !== newValue) {
91
+ this.activeTabIndex = newValue;
92
+ }
93
+ },
94
+ immediate: true
95
+ }
96
+ },
97
+ mounted() {
98
+ if (this.syncActiveTabWithQueryParams) {
99
+ this.syncActiveTabFromQueryParams();
100
+ window.addEventListener('popstate', this.syncActiveTabFromQueryParams);
101
+ }
102
+
103
+ // Because we are manually binding `value` attribute to `b-tabs` the `input`
104
+ // event is no longer automatically fired when the component is mounted.
105
+ // To maintain parity with original `b-tabs` functionality
106
+ // we manually fire the `input` event when the component is mounted.
107
+ this.$emit('input', this.activeTabIndex);
108
+ },
109
+ destroyed() {
110
+ window.removeEventListener('popstate', this.syncActiveTabFromQueryParams);
111
+ },
112
+ methods: {
113
+ buttonBinding(prop, name) {
114
+ if (!prop.attributes) {
115
+ return tabsButtonDefaults[name];
116
+ }
117
+ return prop.attributes;
118
+ },
119
+ primary() {
120
+ this.$emit('primary');
121
+ },
122
+ secondary() {
123
+ this.$emit('secondary');
124
+ },
125
+ tertiary() {
126
+ this.$emit('tertiary');
127
+ },
128
+ /**
129
+ * When the query parameter is updated, update the active tab to match.
130
+ */
131
+ async syncActiveTabFromQueryParams() {
132
+ await this.$nextTick();
133
+ const queryParamValue = this.getQueryParamValue();
134
+ const tabIndexToActivate = this.getTabs().findIndex((tab, tabIndex) => this.getTabQueryParamValue(tabIndex) === queryParamValue);
135
+ this.activeTabIndex = tabIndexToActivate !== -1 ? tabIndexToActivate : 0;
136
+ },
137
+ /**
138
+ * Returns a list of all <b-tab> instances associated with this tab control.
139
+ */
140
+ getTabs() {
141
+ return this.$refs.bTabs.getTabs();
142
+ },
143
+ /**
144
+ * Get the value of the query param as defined by the `queryParamName` prop.
145
+ */
146
+ getQueryParamValue() {
147
+ const searchParams = new URLSearchParams(window.location.search);
148
+ return searchParams.get(this.queryParamName);
149
+ },
150
+ /**
151
+ * Set the value of the query param as defined by the `queryParamName` prop.
152
+ * This method does nothing if the query param is already up to date.
153
+ */
154
+ setQueryParamValueIfNecessary(tabIndex) {
155
+ const currentQueryParamValue = this.getQueryParamValue();
156
+ const newQueryParamValue = this.getTabQueryParamValue(tabIndex);
157
+
158
+ // If the current query parameter is already up-to-date,
159
+ // avoid creating a duplicate history entry.
160
+ if (tabIndex === 0 && !currentQueryParamValue || tabIndex !== 0 && currentQueryParamValue === newQueryParamValue) {
161
+ return;
162
+ }
163
+ const searchParams = new URLSearchParams(window.location.search);
164
+ searchParams.set(this.queryParamName, newQueryParamValue);
165
+ window.history.pushState({}, '', `${window.location.pathname}?${searchParams.toString()}`);
166
+ },
167
+ /**
168
+ * Returns the query param value for a tab.
169
+ * Defaults to the tab index unless the `query-param-value` attribute is set.
170
+ */
171
+ getTabQueryParamValue(tabIndex) {
172
+ const tab = this.getTabs()[tabIndex];
173
+ return (tab === null || tab === void 0 ? void 0 : tab.$attrs['query-param-value']) || tabIndex.toString();
174
+ },
175
+ /**
176
+ * Event handler for `input` event.
177
+ */
178
+ handleInput(tabIndex) {
179
+ this.$emit('input', tabIndex);
180
+ this.activeTabIndex = tabIndex;
181
+ if (this.syncActiveTabWithQueryParams) {
182
+ this.setQueryParamValueIfNecessary(tabIndex);
183
+ }
184
+ }
185
+ }
186
+ };
187
+
188
+ /* script */
189
+ const __vue_script__ = script;
190
+
191
+ /* template */
192
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-tabs',_vm._g(_vm._b({ref:"bTabs",staticClass:"gl-tabs",attrs:{"no-nav-style":true,"no-fade":true,"active-nav-item-class":"gl-tab-nav-item-active","content-class":[_vm.contentClass, 'gl-tab-content'],"nav-class":[_vm.navClass, 'gl-tabs-nav'],"justified":_vm.justified,"value":_vm.activeTabIndex},scopedSlots:_vm._u([_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}}),(_vm.hasActions)?{key:"tabs-start",fn:function(){return [_c('div',{staticClass:"gl-actions-tabs-start",attrs:{"data-testid":"actions-tabs-start"}},[(_vm.actionPrimary)?_c('gl-button',_vm._b({attrs:{"data-testid":"action-primary"},on:{"click":_vm.primary}},'gl-button',_vm.buttonBinding(_vm.actionPrimary, 'actionPrimary'),false),[_vm._v("\n "+_vm._s(_vm.actionPrimary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionSecondary)?_c('gl-button',_vm._b({attrs:{"data-testid":"action-secondary"},on:{"click":_vm.secondary}},'gl-button',_vm.buttonBinding(_vm.actionSecondary, 'actionSecondary'),false),[_vm._v("\n "+_vm._s(_vm.actionSecondary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionTertiary)?_c('gl-button',_vm._b({attrs:{"data-testid":"action-tertiary"},on:{"click":_vm.tertiary}},'gl-button',_vm.buttonBinding(_vm.actionTertiary, 'actionTertiary'),false),[_vm._v("\n "+_vm._s(_vm.actionTertiary.text)+"\n ")]):_vm._e()],1)]},proxy:true}:null,(_vm.hasActions)?{key:"tabs-end",fn:function(){return [_c('div',{staticClass:"gl-actions-tabs-end",attrs:{"data-testid":"actions-tabs-end"}},[(_vm.actionPrimary)?_c('gl-button',_vm._b({attrs:{"data-testid":"action-primary"},on:{"click":_vm.primary}},'gl-button',_vm.buttonBinding(_vm.actionPrimary, 'actionPrimary'),false),[_vm._v("\n "+_vm._s(_vm.actionPrimary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionSecondary)?_c('gl-button',_vm._b({attrs:{"data-testid":"action-secondary"},on:{"click":_vm.secondary}},'gl-button',_vm.buttonBinding(_vm.actionSecondary, 'actionSecondary'),false),[_vm._v("\n "+_vm._s(_vm.actionSecondary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionTertiary)?_c('gl-button',_vm._b({attrs:{"data-testid":"action-tertiary"},on:{"click":_vm.tertiary}},'gl-button',_vm.buttonBinding(_vm.actionTertiary, 'actionTertiary'),false),[_vm._v("\n "+_vm._s(_vm.actionTertiary.text)+"\n ")]):_vm._e()],1)]},proxy:true}:null],null,true)},'b-tabs',_vm.$attrs,false),_vm.listeners))};
193
+ var __vue_staticRenderFns__ = [];
194
+
195
+ /* style */
196
+ const __vue_inject_styles__ = undefined;
197
+ /* scoped */
198
+ const __vue_scope_id__ = undefined;
199
+ /* module identifier */
200
+ const __vue_module_identifier__ = undefined;
201
+ /* functional template */
202
+ const __vue_is_functional_template__ = false;
203
+ /* style inject */
204
+
205
+ /* style inject SSR */
206
+
207
+ /* style inject shadow dom */
208
+
209
+
210
+
211
+ const __vue_component__ = __vue_normalize__(
212
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
213
+ __vue_inject_styles__,
214
+ __vue_script__,
215
+ __vue_scope_id__,
216
+ __vue_is_functional_template__,
217
+ __vue_module_identifier__,
218
+ false,
219
+ undefined,
220
+ undefined,
221
+ undefined
222
+ );
223
+
224
+ export default __vue_component__;
@@ -0,0 +1,82 @@
1
+ import { ToastPlugin } from 'bootstrap-vue/esm/index.js';
2
+ import isFunction from 'lodash/isFunction';
3
+ import CloseButton from '../../shared_components/close_button/close_button';
4
+
5
+ /* eslint-disable import/no-default-export */
6
+ const DEFAULT_OPTIONS = {
7
+ autoHideDelay: 5000,
8
+ toastClass: 'gl-toast',
9
+ isStatus: true,
10
+ noCloseButton: true,
11
+ toaster: 'b-toaster-bottom-left'
12
+ };
13
+ let toastsCount = 0;
14
+ function renderTitle(h, toast, options) {
15
+ const nodes = [h(CloseButton, {
16
+ class: ['gl-toast-close-button', 'gl-close-btn-color-inherit'],
17
+ on: {
18
+ click: toast.hide
19
+ }
20
+ })];
21
+ if (options.action) {
22
+ nodes.splice(0, 0, h('a', {
23
+ role: 'button',
24
+ class: ['gl-toast-action'],
25
+ on: {
26
+ click: e => options.action.onClick(e, toast)
27
+ }
28
+ }, options.action.text));
29
+ }
30
+ return nodes;
31
+ }
32
+ function showToast(message) {
33
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34
+ const id = `gl-toast-${toastsCount}`;
35
+ toastsCount += 1;
36
+ const hide = () => {
37
+ this.$bvToast.hide(id);
38
+ };
39
+ const toast = {
40
+ id,
41
+ hide
42
+ };
43
+ if (isFunction(options.onComplete)) {
44
+ const toastHiddenCallback = e => {
45
+ if (e.componentId === id) {
46
+ this.$root.$off('bv::toast:hidden', toastHiddenCallback);
47
+ options.onComplete(e);
48
+ }
49
+ };
50
+ this.$root.$on('bv::toast:hidden', toastHiddenCallback);
51
+ }
52
+ this.$bvToast.toast(message, {
53
+ ...DEFAULT_OPTIONS,
54
+ id,
55
+ title: renderTitle(this.$createElement, toast, options)
56
+ });
57
+ return toast;
58
+ }
59
+
60
+ /**
61
+ * Note: This is not a typical Vue component and needs to be registered before instantiating a Vue app.
62
+ * Once registered, the toast will be globally available throughout your app.
63
+ *
64
+ * See https://gitlab-org.gitlab.io/gitlab-ui/ for detailed documentation.
65
+ */
66
+ var toast = {
67
+ install(Vue) {
68
+ Vue.use(ToastPlugin);
69
+ Vue.mixin({
70
+ beforeCreate() {
71
+ if (this.$toast) {
72
+ return;
73
+ }
74
+ this.$toast = {
75
+ show: showToast.bind(this)
76
+ };
77
+ }
78
+ });
79
+ }
80
+ };
81
+
82
+ export default toast;