@gitlab/ui 72.11.1 → 72.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/tokens/css/tokens.css +1 -1
  3. package/dist/tokens/css/tokens.dark.css +1 -1
  4. package/dist/tokens/js/tokens.dark.js +1 -1
  5. package/dist/tokens/js/tokens.js +1 -1
  6. package/dist/tokens/scss/_tokens.dark.scss +1 -1
  7. package/dist/tokens/scss/_tokens.scss +1 -1
  8. package/package.json +1 -1
  9. package/src/internal/color_contrast/color_contrast.md +8 -0
  10. package/src/internal/color_contrast/color_contrast.spec.js +34 -0
  11. package/src/internal/color_contrast/color_contrast.stories.js +41 -0
  12. package/src/internal/color_contrast/color_contrast.vue +52 -0
  13. package/src/tokens/color.dark.tokens.stories.js +36 -22
  14. package/src/tokens/color.data_viz.dark.tokens.stories.js +13 -30
  15. package/src/tokens/color.data_viz.tokens.stories.js +13 -30
  16. package/src/tokens/color.theme.dark.tokens.stories.js +15 -30
  17. package/src/tokens/color.theme.tokens.stories.js +15 -30
  18. package/src/tokens/color.tokens.stories.js +36 -22
  19. package/src/tokens/color.transparency.tokens.stories.js +9 -12
  20. package/src/tokens/common_story_options.js +22 -80
  21. package/src/utils/constants.js +25 -0
  22. package/src/utils/utils.js +21 -1
  23. package/dist/charts.js +0 -14
  24. package/dist/components/base/accordion/accordion.js +0 -73
  25. package/dist/components/base/accordion/accordion_item.js +0 -133
  26. package/dist/components/base/alert/alert.js +0 -222
  27. package/dist/components/base/avatar/avatar.js +0 -160
  28. package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -107
  29. package/dist/components/base/avatar_link/avatar_link.js +0 -47
  30. package/dist/components/base/avatars_inline/avatars_inline.js +0 -119
  31. package/dist/components/base/badge/badge.js +0 -105
  32. package/dist/components/base/banner/banner.js +0 -139
  33. package/dist/components/base/breadcrumb/breadcrumb.js +0 -122
  34. package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -73
  35. package/dist/components/base/broadcast_message/broadcast_message.js +0 -112
  36. package/dist/components/base/broadcast_message/constants.js +0 -5
  37. package/dist/components/base/button/button.js +0 -151
  38. package/dist/components/base/button_group/button_group.js +0 -47
  39. package/dist/components/base/card/card.js +0 -71
  40. package/dist/components/base/carousel/carousel.js +0 -48
  41. package/dist/components/base/carousel/carousel_slide.js +0 -47
  42. package/dist/components/base/collapse/collapse.js +0 -59
  43. package/dist/components/base/datepicker/datepicker.js +0 -386
  44. package/dist/components/base/daterange_picker/daterange_picker.js +0 -288
  45. package/dist/components/base/drawer/drawer.js +0 -127
  46. package/dist/components/base/dropdown/dropdown.js +0 -261
  47. package/dist/components/base/dropdown/dropdown_divider.js +0 -48
  48. package/dist/components/base/dropdown/dropdown_form.js +0 -48
  49. package/dist/components/base/dropdown/dropdown_item.js +0 -131
  50. package/dist/components/base/dropdown/dropdown_section_header.js +0 -48
  51. package/dist/components/base/dropdown/dropdown_text.js +0 -48
  52. package/dist/components/base/filtered_search/common_story_options.js +0 -14
  53. package/dist/components/base/filtered_search/filtered_search.js +0 -388
  54. package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -89
  55. package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -138
  56. package/dist/components/base/filtered_search/filtered_search_term.js +0 -203
  57. package/dist/components/base/filtered_search/filtered_search_token.js +0 -384
  58. package/dist/components/base/filtered_search/filtered_search_token_segment.js +0 -420
  59. package/dist/components/base/filtered_search/filtered_search_utils.js +0 -242
  60. package/dist/components/base/form/form.js +0 -49
  61. package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -78
  62. package/dist/components/base/form/form_checkbox/form_checkbox_group.js +0 -60
  63. package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -79
  64. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -138
  65. package/dist/components/base/form/form_checkbox_tree/models/constants.js +0 -12
  66. package/dist/components/base/form/form_checkbox_tree/models/node.js +0 -51
  67. package/dist/components/base/form/form_checkbox_tree/models/tree.js +0 -199
  68. package/dist/components/base/form/form_combobox/constants.js +0 -55
  69. package/dist/components/base/form/form_combobox/form_combobox.js +0 -230
  70. package/dist/components/base/form/form_date/form_date.js +0 -143
  71. package/dist/components/base/form/form_fields/form_field_validator.js +0 -93
  72. package/dist/components/base/form/form_fields/form_fields.js +0 -214
  73. package/dist/components/base/form/form_fields/mappers.js +0 -13
  74. package/dist/components/base/form/form_fields/validators.js +0 -48
  75. package/dist/components/base/form/form_group/form_group.js +0 -97
  76. package/dist/components/base/form/form_input/form_input.js +0 -121
  77. package/dist/components/base/form/form_input_group/form_input_group.js +0 -108
  78. package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -41
  79. package/dist/components/base/form/form_radio/form_radio.js +0 -65
  80. package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -78
  81. package/dist/components/base/form/form_select/constants.js +0 -12
  82. package/dist/components/base/form/form_select/form_select.js +0 -82
  83. package/dist/components/base/form/form_text/form_text.js +0 -38
  84. package/dist/components/base/form/form_textarea/form_textarea.js +0 -112
  85. package/dist/components/base/form/input_group_text/input_group_text.js +0 -48
  86. package/dist/components/base/icon/icon.js +0 -111
  87. package/dist/components/base/infinite_scroll/infinite_scroll.js +0 -197
  88. package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -151
  89. package/dist/components/base/label/label.js +0 -163
  90. package/dist/components/base/link/link.js +0 -50
  91. package/dist/components/base/loading_icon/loading_icon.js +0 -111
  92. package/dist/components/base/markdown/markdown.js +0 -52
  93. package/dist/components/base/modal/modal.js +0 -204
  94. package/dist/components/base/nav/nav.js +0 -48
  95. package/dist/components/base/nav/nav_item.js +0 -48
  96. package/dist/components/base/nav/nav_item_dropdown.js +0 -62
  97. package/dist/components/base/navbar/navbar.js +0 -48
  98. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +0 -453
  99. package/dist/components/base/new_dropdowns/base_dropdown/constants.js +0 -4
  100. package/dist/components/base/new_dropdowns/constants.js +0 -21
  101. package/dist/components/base/new_dropdowns/disclosure/constants.js +0 -8
  102. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +0 -370
  103. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_group.js +0 -110
  104. package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown_item.js +0 -143
  105. package/dist/components/base/new_dropdowns/disclosure/mock_data.js +0 -147
  106. package/dist/components/base/new_dropdowns/disclosure/utils.js +0 -39
  107. package/dist/components/base/new_dropdowns/listbox/listbox.js +0 -767
  108. package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -58
  109. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -91
  110. package/dist/components/base/new_dropdowns/listbox/listbox_search_input.js +0 -93
  111. package/dist/components/base/new_dropdowns/listbox/mock_data.js +0 -118
  112. package/dist/components/base/new_dropdowns/listbox/utils.js +0 -34
  113. package/dist/components/base/paginated_list/paginated_list.js +0 -180
  114. package/dist/components/base/pagination/pagination.js +0 -399
  115. package/dist/components/base/path/data.js +0 -34
  116. package/dist/components/base/path/path.js +0 -189
  117. package/dist/components/base/popover/popover.js +0 -110
  118. package/dist/components/base/progress_bar/progress_bar.js +0 -48
  119. package/dist/components/base/search_box_by_click/search_box_by_click.js +0 -235
  120. package/dist/components/base/search_box_by_type/search_box_by_type.js +0 -167
  121. package/dist/components/base/segmented_control/segmented_control.js +0 -109
  122. package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -224
  123. package/dist/components/base/sorting/sorting.js +0 -171
  124. package/dist/components/base/sorting/sorting_item.js +0 -109
  125. package/dist/components/base/table/constants.js +0 -5
  126. package/dist/components/base/table/table.js +0 -89
  127. package/dist/components/base/table_lite/table_lite.js +0 -72
  128. package/dist/components/base/tabs/constants.js +0 -3
  129. package/dist/components/base/tabs/tab/tab.js +0 -83
  130. package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -143
  131. package/dist/components/base/tabs/tabs/tabs.js +0 -224
  132. package/dist/components/base/toast/toast.js +0 -82
  133. package/dist/components/base/toggle/toggle.js +0 -180
  134. package/dist/components/base/token/token.js +0 -85
  135. package/dist/components/base/token_selector/helpers.js +0 -5
  136. package/dist/components/base/token_selector/token_container.js +0 -165
  137. package/dist/components/base/token_selector/token_selector.js +0 -403
  138. package/dist/components/base/token_selector/token_selector_dropdown.js +0 -199
  139. package/dist/components/base/tooltip/tooltip.js +0 -55
  140. package/dist/components/charts/area/area.js +0 -311
  141. package/dist/components/charts/bar/bar.js +0 -253
  142. package/dist/components/charts/chart/chart.js +0 -215
  143. package/dist/components/charts/column/column.js +0 -226
  144. package/dist/components/charts/discrete_scatter/discrete_scatter.js +0 -203
  145. package/dist/components/charts/gauge/gauge.js +0 -208
  146. package/dist/components/charts/heatmap/heatmap.js +0 -295
  147. package/dist/components/charts/heatmap/index.js +0 -2
  148. package/dist/components/charts/legend/legend.js +0 -228
  149. package/dist/components/charts/line/line.js +0 -308
  150. package/dist/components/charts/series_label/series_label.js +0 -100
  151. package/dist/components/charts/single_stat/single_stat.js +0 -152
  152. package/dist/components/charts/sparkline/sparkline.js +0 -261
  153. package/dist/components/charts/stacked_column/stacked_column.js +0 -335
  154. package/dist/components/charts/tooltip/tooltip.js +0 -251
  155. package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +0 -83
  156. package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +0 -100
  157. package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -35
  158. package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +0 -115
  159. package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -104
  160. package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -64
  161. package/dist/components/experimental/duo/chat/constants.js +0 -23
  162. package/dist/components/experimental/duo/chat/duo_chat.js +0 -359
  163. package/dist/components/experimental/duo/chat/mock_data.js +0 -83
  164. package/dist/components/experimental/duo/user_feedback/user_feedback.js +0 -94
  165. package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +0 -124
  166. package/dist/components/experimental/experiment_badge/constants.js +0 -4
  167. package/dist/components/experimental/experiment_badge/experiment_badge.js +0 -107
  168. package/dist/components/mixins/button_mixin.js +0 -11
  169. package/dist/components/mixins/safe_link_mixin.js +0 -30
  170. package/dist/components/mixins/tooltip_mixin.js +0 -21
  171. package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.js +0 -53
  172. package/dist/components/regions/empty_state/empty_state.js +0 -154
  173. package/dist/components/shared_components/charts/tooltip_default_format.js +0 -53
  174. package/dist/components/shared_components/clear_icon_button/clear_icon_button.js +0 -64
  175. package/dist/components/shared_components/close_button/close_button.js +0 -54
  176. package/dist/components/utilities/animated_number/animated_number.js +0 -131
  177. package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -75
  178. package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -88
  179. package/dist/components/utilities/intersperse/intersperse.js +0 -86
  180. package/dist/components/utilities/sprintf/sprintf.js +0 -172
  181. package/dist/components/utilities/truncate/constants.js +0 -7
  182. package/dist/components/utilities/truncate/truncate.js +0 -111
  183. package/dist/components/utilities/truncate_text/constants.js +0 -7
  184. package/dist/components/utilities/truncate_text/truncate_text.js +0 -146
  185. package/dist/config.js +0 -86
  186. package/dist/directives/collapse_toggle.js +0 -1
  187. package/dist/directives/hover_load/hover_load.js +0 -45
  188. package/dist/directives/modal.js +0 -1
  189. package/dist/directives/outside/get_event_like_time_stamp.js +0 -33
  190. package/dist/directives/outside/outside.js +0 -106
  191. package/dist/directives/resize_observer/resize_observer.js +0 -51
  192. package/dist/directives/safe_html/constants.js +0 -6
  193. package/dist/directives/safe_html/safe_html.js +0 -39
  194. package/dist/directives/safe_link/mock_data.js +0 -10
  195. package/dist/directives/safe_link/safe_link.js +0 -65
  196. package/dist/directives/tooltip.js +0 -1
  197. package/dist/index.css +0 -7
  198. package/dist/index.css.map +0 -1
  199. package/dist/index.js +0 -105
  200. package/dist/tokens/common_story_options.js +0 -109
  201. package/dist/utils/breakpoints.js +0 -20
  202. package/dist/utils/charts/config.js +0 -556
  203. package/dist/utils/charts/constants.js +0 -63
  204. package/dist/utils/charts/mock_data.js +0 -211
  205. package/dist/utils/charts/story_config.js +0 -42
  206. package/dist/utils/charts/theme.js +0 -192
  207. package/dist/utils/charts/utils.js +0 -54
  208. package/dist/utils/constants.js +0 -270
  209. package/dist/utils/data_utils.js +0 -21
  210. package/dist/utils/datetime_utility.js +0 -61
  211. package/dist/utils/i18n.js +0 -15
  212. package/dist/utils/is_slot_empty.js +0 -38
  213. package/dist/utils/number_utils.js +0 -124
  214. package/dist/utils/stories_constants.js +0 -29
  215. package/dist/utils/stories_utils.js +0 -13
  216. package/dist/utils/story_decorators/container.js +0 -16
  217. package/dist/utils/string_utils.js +0 -69
  218. package/dist/utils/svgs/svg_paths.js +0 -7
  219. package/dist/utils/test_utils.js +0 -33
  220. package/dist/utils/use_fake_date.js +0 -29
  221. package/dist/utils/use_mock_intersection_observer.js +0 -108
  222. package/dist/utils/utils.js +0 -177
  223. package/dist/utils.js +0 -5
@@ -1,100 +0,0 @@
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 };
@@ -1,35 +0,0 @@
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 };
@@ -1,115 +0,0 @@
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__;
@@ -1,104 +0,0 @@
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 };
@@ -1,64 +0,0 @@
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__;
@@ -1,23 +0,0 @@
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 };