@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,100 @@
1
+ import GlSprintf from '../../../../../utilities/sprintf/sprintf';
2
+ import { LOADING_TRANSITION_DURATION } from '../../constants';
3
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
+
5
+ const i18n = {
6
+ LOADER_LOADING_MESSAGE: '%{tool} is %{transition} an answer',
7
+ LOADER_LOADING_TRANSITIONS: ['finding', 'working on', 'generating', 'producing'],
8
+ GITLAB_DUO: 'GitLab Duo'
9
+ };
10
+ var script = {
11
+ name: 'GlDuoChatLoader',
12
+ components: {
13
+ GlSprintf
14
+ },
15
+ i18n,
16
+ props: {
17
+ /**
18
+ * The message containing the name of the current AI tool working on the answer.
19
+ */
20
+ toolName: {
21
+ type: String,
22
+ required: false,
23
+ default: i18n.GITLAB_DUO
24
+ }
25
+ },
26
+ data() {
27
+ return {
28
+ loadingSequence: 0,
29
+ timeout: null
30
+ };
31
+ },
32
+ beforeDestroy() {
33
+ clearTimeout(this.timeout);
34
+ },
35
+ mounted() {
36
+ this.computeTransitionWidth();
37
+ this.enter();
38
+ },
39
+ methods: {
40
+ computeTransitionWidth() {
41
+ const container = this.$refs.transition;
42
+ const active = this.$refs.currentTransition[0]; // There's only one `currentTransition` ref at a time, but refs in v-for loops are always Arrays
43
+ const {
44
+ width,
45
+ height
46
+ } = active.getBoundingClientRect();
47
+ container.$el.style.width = `${width}px`;
48
+ container.$el.style.height = `${height}px`;
49
+ },
50
+ enter() {
51
+ clearTimeout(this.timeout);
52
+ this.timeout = setTimeout(() => {
53
+ this.loadingSequence = (this.loadingSequence + 1) % this.$options.i18n.LOADER_LOADING_TRANSITIONS.length;
54
+ this.enter();
55
+ }, LOADING_TRANSITION_DURATION);
56
+ },
57
+ isCurrentTransition(index) {
58
+ return index === this.loadingSequence;
59
+ }
60
+ }
61
+ };
62
+
63
+ /* script */
64
+ const __vue_script__ = script;
65
+
66
+ /* template */
67
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"duo-chat-loader"},[_vm._m(0),_vm._v(" "),_c('div',{staticClass:"gl-line-height-24"},[_c('gl-sprintf',{attrs:{"message":_vm.$options.i18n.LOADER_LOADING_MESSAGE},scopedSlots:_vm._u([{key:"tool",fn:function(){return [_c('strong',{attrs:{"data-testid":"tool"}},[_vm._v(_vm._s(_vm.toolName))])]},proxy:true},{key:"transition",fn:function(){return [_c('transition-group',{ref:"transition",staticClass:"transition gl-display-inline-block gl-relative gl-vertical-align-bottom",attrs:{"name":"text"},on:{"after-leave":_vm.computeTransitionWidth}},_vm._l((_vm.$options.i18n.LOADER_LOADING_TRANSITIONS),function(message,index){return _c('span',{directives:[{name:"show",rawName:"v-show",value:(_vm.isCurrentTransition(index)),expression:"isCurrentTransition(index)"}],key:message,ref:_vm.isCurrentTransition(index) ? 'currentTransition' : '',refInFor:true,staticClass:"gl-white-space-nowrap gl-absolute gl-bottom-0 gl-left-0",attrs:{"data-testid":_vm.isCurrentTransition(index) ? 'current-transition' : ''}},[_vm._v(_vm._s(message))])}),0)]},proxy:true}])})],1)])};
68
+ var __vue_staticRenderFns__ = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-display-flex gl-align-items-flex-start gl-mr-3 gl-pt-3"},[_c('div',{staticClass:"duo-chat-loader__dot duo-chat-loader__dot--1"}),_vm._v(" "),_c('div',{staticClass:"duo-chat-loader__dot duo-chat-loader__dot--2"}),_vm._v(" "),_c('div',{staticClass:"duo-chat-loader__dot duo-chat-loader__dot--3"})])}];
69
+
70
+ /* style */
71
+ const __vue_inject_styles__ = undefined;
72
+ /* scoped */
73
+ const __vue_scope_id__ = undefined;
74
+ /* module identifier */
75
+ const __vue_module_identifier__ = undefined;
76
+ /* functional template */
77
+ const __vue_is_functional_template__ = false;
78
+ /* style inject */
79
+
80
+ /* style inject SSR */
81
+
82
+ /* style inject shadow dom */
83
+
84
+
85
+
86
+ const __vue_component__ = __vue_normalize__(
87
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
88
+ __vue_inject_styles__,
89
+ __vue_script__,
90
+ __vue_scope_id__,
91
+ __vue_is_functional_template__,
92
+ __vue_module_identifier__,
93
+ false,
94
+ undefined,
95
+ undefined,
96
+ undefined
97
+ );
98
+
99
+ export default __vue_component__;
100
+ export { i18n };
@@ -0,0 +1,35 @@
1
+ import iconsPath from '@gitlab/svgs/dist/icons.svg';
2
+
3
+ const createButton = () => {
4
+ const button = document.createElement('button');
5
+ button.type = 'button';
6
+ button.classList.add('btn', 'btn-default', 'btn-md', 'gl-button', 'btn-default-secondary', 'btn-icon');
7
+ button.dataset.title = 'Copy to clipboard';
8
+
9
+ // Create an SVG element with the correct namespace
10
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
11
+ svg.setAttribute('role', 'img');
12
+ svg.setAttribute('aria-hidden', 'true');
13
+ svg.classList.add('gl-button-icon', 'gl-icon', 's16');
14
+
15
+ // Create a 'use' element with the correct namespace
16
+ const use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
17
+ use.setAttribute('href', `${iconsPath}#copy-to-clipboard`);
18
+ svg.appendChild(use);
19
+ button.appendChild(svg);
20
+ return button;
21
+ };
22
+ class CopyCodeElement extends HTMLElement {
23
+ constructor() {
24
+ super();
25
+ const btn = createButton();
26
+ const wrapper = this.parentNode;
27
+ this.appendChild(btn);
28
+ btn.addEventListener('click', async () => {
29
+ const textToCopy = wrapper.innerText;
30
+ await navigator.clipboard.writeText(textToCopy);
31
+ });
32
+ }
33
+ }
34
+
35
+ export { CopyCodeElement };
@@ -0,0 +1,115 @@
1
+ import GlDuoUserFeedback from '../../../user_feedback/user_feedback';
2
+ import { SafeHtmlDirective } from '../../../../../../directives/safe_html/safe_html';
3
+ import { MESSAGE_MODEL_ROLES } from '../../constants';
4
+ import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_sources';
5
+ import { CopyCodeElement } from './copy_code_element';
6
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
7
+
8
+ const concatUntilEmpty = arr => {
9
+ if (!arr) return '';
10
+ let end = arr.findIndex(el => !el);
11
+ if (end < 0) end = arr.length;
12
+ return arr.slice(0, end).join('');
13
+ };
14
+ var script = {
15
+ name: 'GlDuoChatMessage',
16
+ safeHtmlConfigExtension: {
17
+ ADD_TAGS: ['copy-code']
18
+ },
19
+ components: {
20
+ DocumentationSources,
21
+ GlDuoUserFeedback
22
+ },
23
+ directives: {
24
+ SafeHtml: SafeHtmlDirective
25
+ },
26
+ inject: ['renderGFM', 'renderMarkdown'],
27
+ props: {
28
+ /**
29
+ * A message object
30
+ */
31
+ message: {
32
+ type: Object,
33
+ required: true
34
+ }
35
+ },
36
+ computed: {
37
+ isAssistantMessage() {
38
+ return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.assistant;
39
+ },
40
+ isUserMessage() {
41
+ return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.user;
42
+ },
43
+ sources() {
44
+ var _this$message$extras;
45
+ return (_this$message$extras = this.message.extras) === null || _this$message$extras === void 0 ? void 0 : _this$message$extras.sources;
46
+ },
47
+ messageContent() {
48
+ if (this.message.errors.length > 0) return this.renderMarkdown(this.message.errors.join('; '));
49
+ if (this.message.contentHtml) {
50
+ return this.message.contentHtml;
51
+ }
52
+ return this.renderMarkdown(this.message.content || concatUntilEmpty(this.message.chunks));
53
+ }
54
+ },
55
+ beforeCreate() {
56
+ if (!customElements.get('copy-code')) {
57
+ customElements.define('copy-code', CopyCodeElement);
58
+ }
59
+ },
60
+ mounted() {
61
+ this.$nextTick(this.hydrateContentWithGFM);
62
+ },
63
+ updated() {
64
+ this.$nextTick(this.hydrateContentWithGFM);
65
+ },
66
+ methods: {
67
+ async hydrateContentWithGFM() {
68
+ if (this.message.contentHtml) {
69
+ this.renderGFM(this.$refs.content);
70
+ }
71
+ }
72
+ }
73
+ };
74
+
75
+ /* script */
76
+ const __vue_script__ = script;
77
+
78
+ /* template */
79
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-p-4 gl-mb-4 gl-rounded-lg gl-line-height-20 gl-word-break-word duo-chat-message",class:{
80
+ 'gl-ml-auto gl-bg-blue-100 gl-text-blue-900 gl-rounded-bottom-right-none': _vm.isUserMessage,
81
+ 'gl-rounded-bottom-left-none gl-text-gray-900 gl-bg-white gl-border-1 gl-border-solid gl-border-gray-50':
82
+ _vm.isAssistantMessage,
83
+ }},[_c('div',{directives:[{name:"safe-html",rawName:"v-safe-html:[$options.safeHtmlConfigExtension]",value:(_vm.messageContent),expression:"messageContent",arg:_vm.$options.safeHtmlConfigExtension}],ref:"content"}),_vm._v(" "),(_vm.isAssistantMessage)?[(_vm.sources)?_c('documentation-sources',{attrs:{"sources":_vm.sources}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-flex-end gl-mt-4"},[_c('gl-duo-user-feedback',{on:{"feedback":function($event){return _vm.$emit('track-feedback', $event)}}})],1)]:_vm._e()],2)};
84
+ var __vue_staticRenderFns__ = [];
85
+
86
+ /* style */
87
+ const __vue_inject_styles__ = undefined;
88
+ /* scoped */
89
+ const __vue_scope_id__ = undefined;
90
+ /* module identifier */
91
+ const __vue_module_identifier__ = undefined;
92
+ /* functional template */
93
+ const __vue_is_functional_template__ = false;
94
+ /* style inject */
95
+
96
+ /* style inject SSR */
97
+
98
+ /* style inject shadow dom */
99
+
100
+
101
+
102
+ const __vue_component__ = __vue_normalize__(
103
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
104
+ __vue_inject_styles__,
105
+ __vue_script__,
106
+ __vue_scope_id__,
107
+ __vue_is_functional_template__,
108
+ __vue_module_identifier__,
109
+ false,
110
+ undefined,
111
+ undefined,
112
+ undefined
113
+ );
114
+
115
+ export default __vue_component__;
@@ -0,0 +1,104 @@
1
+ import GlIcon from '../../../../../base/icon/icon';
2
+ import GlLink from '../../../../../base/link/link';
3
+ import { DOCUMENTATION_SOURCE_TYPES } from '../../constants';
4
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
+
6
+ const i18n = {
7
+ MESSAGE_SOURCE: 'Source',
8
+ MESSAGE_SOURCES: 'Sources'
9
+ };
10
+ var script = {
11
+ name: 'GlDuoChatMessageSources',
12
+ components: {
13
+ GlIcon,
14
+ GlLink
15
+ },
16
+ props: {
17
+ /**
18
+ * The Array of the message sources.
19
+ */
20
+ sources: {
21
+ type: Array,
22
+ required: true
23
+ }
24
+ },
25
+ computed: {
26
+ sourceLabel() {
27
+ return this.sources.length > 1 ? i18n.MESSAGE_SOURCES : i18n.MESSAGE_SOURCES;
28
+ }
29
+ },
30
+ methods: {
31
+ getSourceIcon(sourceType) {
32
+ const currentSourceType = Object.values(DOCUMENTATION_SOURCE_TYPES).find(_ref => {
33
+ let {
34
+ value
35
+ } = _ref;
36
+ return value === sourceType;
37
+ });
38
+ return (currentSourceType === null || currentSourceType === void 0 ? void 0 : currentSourceType.icon) || 'document';
39
+ },
40
+ getSourceTitle(_ref2) {
41
+ let {
42
+ title,
43
+ source_type: sourceType,
44
+ stage,
45
+ group,
46
+ date,
47
+ author
48
+ } = _ref2;
49
+ if (title) {
50
+ return title;
51
+ }
52
+ if (sourceType === DOCUMENTATION_SOURCE_TYPES.DOC.value) {
53
+ if (stage && group) {
54
+ return `${stage} / ${group}`;
55
+ }
56
+ }
57
+ if (sourceType === DOCUMENTATION_SOURCE_TYPES.BLOG.value) {
58
+ if (date && author) {
59
+ return `${date} / ${author}`;
60
+ }
61
+ }
62
+ return i18n.MESSAGE_SOURCE;
63
+ }
64
+ }
65
+ };
66
+
67
+ /* script */
68
+ const __vue_script__ = script;
69
+
70
+ /* template */
71
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-mt-4 gl-mr-3 gl-text-gray-600",attrs:{"data-testid":"duo-chat-message-sources"}},[(_vm.sources.length)?_c('span',[_vm._v(_vm._s(_vm.sourceLabel)+":")]):_vm._e(),_vm._v(" "),_c('ul',{staticClass:"gl-list-style-none gl-p-0 gl-m-0"},_vm._l((_vm.sources),function(source,index){return _c('li',{key:index,staticClass:"gl-display-flex gl-pt-3 gl-align-items-center",attrs:{"data-testid":"source-list-item"}},[(source.source_type)?_c('gl-icon',{staticClass:"gl-flex-shrink-0 gl-mr-2",attrs:{"name":_vm.getSourceIcon(source.source_type)}}):_vm._e(),_vm._v(" "),_c('gl-link',{attrs:{"href":source.source_url}},[_vm._v(_vm._s(_vm.getSourceTitle(source)))])],1)}),0)])};
72
+ var __vue_staticRenderFns__ = [];
73
+
74
+ /* style */
75
+ const __vue_inject_styles__ = undefined;
76
+ /* scoped */
77
+ const __vue_scope_id__ = undefined;
78
+ /* module identifier */
79
+ const __vue_module_identifier__ = undefined;
80
+ /* functional template */
81
+ const __vue_is_functional_template__ = false;
82
+ /* style inject */
83
+
84
+ /* style inject SSR */
85
+
86
+ /* style inject shadow dom */
87
+
88
+
89
+
90
+ const __vue_component__ = __vue_normalize__(
91
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
92
+ __vue_inject_styles__,
93
+ __vue_script__,
94
+ __vue_scope_id__,
95
+ __vue_is_functional_template__,
96
+ __vue_module_identifier__,
97
+ false,
98
+ undefined,
99
+ undefined,
100
+ undefined
101
+ );
102
+
103
+ export default __vue_component__;
104
+ export { i18n };
@@ -0,0 +1,64 @@
1
+ import GlButton from '../../../../../base/button/button';
2
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
3
+
4
+ var script = {
5
+ name: 'GlDuoChatPredefinedPrompts',
6
+ components: {
7
+ GlButton
8
+ },
9
+ props: {
10
+ /**
11
+ * Array of predefined prompts to display. Every prompt should be a string which will be converted into a prompt when clicked.
12
+ */
13
+ prompts: {
14
+ type: Array,
15
+ required: true
16
+ }
17
+ },
18
+ methods: {
19
+ handleClick(prompt) {
20
+ /**
21
+ * Emits the prompt string that was clicked.
22
+ */
23
+ this.$emit('click', prompt);
24
+ }
25
+ }
26
+ };
27
+
28
+ /* script */
29
+ const __vue_script__ = script;
30
+
31
+ /* template */
32
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-text-right"},_vm._l((_vm.prompts),function(prompt,index){return _c('div',{key:("question-" + index),staticClass:"gl-mt-3"},[_c('gl-button',{attrs:{"category":"secondary","variant":"confirm"},on:{"click":function($event){return _vm.handleClick(prompt)}}},[_c('span',{staticClass:"gl-white-space-normal"},[_vm._v(_vm._s(prompt))])])],1)}),0)};
33
+ var __vue_staticRenderFns__ = [];
34
+
35
+ /* style */
36
+ const __vue_inject_styles__ = undefined;
37
+ /* scoped */
38
+ const __vue_scope_id__ = undefined;
39
+ /* module identifier */
40
+ const __vue_module_identifier__ = undefined;
41
+ /* functional template */
42
+ const __vue_is_functional_template__ = false;
43
+ /* style inject */
44
+
45
+ /* style inject SSR */
46
+
47
+ /* style inject shadow dom */
48
+
49
+
50
+
51
+ const __vue_component__ = __vue_normalize__(
52
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
53
+ __vue_inject_styles__,
54
+ __vue_script__,
55
+ __vue_scope_id__,
56
+ __vue_is_functional_template__,
57
+ __vue_module_identifier__,
58
+ false,
59
+ undefined,
60
+ undefined,
61
+ undefined
62
+ );
63
+
64
+ export default __vue_component__;
@@ -0,0 +1,23 @@
1
+ const CHAT_RESET_MESSAGE = '/reset';
2
+ const LOADING_TRANSITION_DURATION = 7500;
3
+ const DOCUMENTATION_SOURCE_TYPES = {
4
+ HANDBOOK: {
5
+ value: 'handbook',
6
+ icon: 'book'
7
+ },
8
+ DOC: {
9
+ value: 'doc',
10
+ icon: 'documents'
11
+ },
12
+ BLOG: {
13
+ value: 'blog',
14
+ icon: 'list-bulleted'
15
+ }
16
+ };
17
+ const MESSAGE_MODEL_ROLES = {
18
+ user: 'user',
19
+ system: 'system',
20
+ assistant: 'assistant'
21
+ };
22
+
23
+ export { CHAT_RESET_MESSAGE, DOCUMENTATION_SOURCE_TYPES, LOADING_TRANSITION_DURATION, MESSAGE_MODEL_ROLES };