@gitlab/ui 66.22.0 → 66.23.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [66.23.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.22.0...v66.23.0) (2023-10-03)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlDuoChatPredefinedPrompts:** new component ([c3e2347](https://gitlab.com/gitlab-org/gitlab-ui/commit/c3e234717b9c33ab8bb3d3f66e13387efe235fd7))
7
+
1
8
  # [66.22.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.21.0...v66.22.0) (2023-10-03)
2
9
 
3
10
 
@@ -0,0 +1,64 @@
1
+ import { GlButton } from '../../../../../../index';
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,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 03 Oct 2023 10:22:26 GMT
3
+ * Generated on Tue, 03 Oct 2023 12:19:27 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 03 Oct 2023 10:22:26 GMT
3
+ * Generated on Tue, 03 Oct 2023 12:19:27 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 03 Oct 2023 10:22:26 GMT
3
+ * Generated on Tue, 03 Oct 2023 12:19:27 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 03 Oct 2023 10:22:26 GMT
3
+ * Generated on Tue, 03 Oct 2023 12:19:27 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 03 Oct 2023 10:22:26 GMT
3
+ // Generated on Tue, 03 Oct 2023 12:19:27 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 03 Oct 2023 10:22:26 GMT
3
+ // Generated on Tue, 03 Oct 2023 12:19:27 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "66.22.0",
3
+ "version": "66.23.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -0,0 +1 @@
1
+ The component is a simple list of strings representing possible prompts to AI.
@@ -0,0 +1,35 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { GlButton } from '../../../../../../index';
3
+ import GlDuoChatPredefinedPrompts from './duo_chat_predefined_prompts.vue';
4
+
5
+ describe('GlDuoChatPredefinedPrompts', () => {
6
+ let wrapper;
7
+ const predefinedPrompt1 = 'foo';
8
+ const predefinedPrompt2 = 'bar';
9
+
10
+ const createComponent = () => {
11
+ wrapper = shallowMount(GlDuoChatPredefinedPrompts, {
12
+ propsData: {
13
+ prompts: [predefinedPrompt1, predefinedPrompt2],
14
+ },
15
+ });
16
+ };
17
+
18
+ const findButtons = () => wrapper.findAllComponents(GlButton);
19
+
20
+ it('renders a button for each predefined prompt', () => {
21
+ createComponent();
22
+
23
+ expect(findButtons()).toHaveLength(2);
24
+ });
25
+
26
+ it('emits the click event when a button is clicked', () => {
27
+ createComponent();
28
+
29
+ findButtons().at(0).vm.$emit('click');
30
+ expect(wrapper.emitted('click')).toEqual([[predefinedPrompt1]]);
31
+
32
+ findButtons().at(1).vm.$emit('click');
33
+ expect(wrapper.emitted('click')).toEqual([[predefinedPrompt1], [predefinedPrompt2]]);
34
+ });
35
+ });
@@ -0,0 +1,36 @@
1
+ import GlDuoChatPredefinedPrompts from './duo_chat_predefined_prompts.vue';
2
+ import readme from './duo_chat_predefined_prompts.md';
3
+
4
+ const generateProps = ({ prompts = [] } = {}) => ({
5
+ prompts,
6
+ });
7
+
8
+ const Template = (args, { argTypes }) => ({
9
+ components: { GlDuoChatPredefinedPrompts },
10
+ props: Object.keys(argTypes),
11
+ template: `
12
+ <gl-duo-chat-predefined-prompts :prompts="prompts" />
13
+ `,
14
+ });
15
+
16
+ export const Default = Template.bind({});
17
+ Default.args = generateProps({
18
+ prompts: [
19
+ 'How do I change my password in GitLab?',
20
+ 'How do I fork a project?',
21
+ 'How do I clone a repository?',
22
+ 'How do I create a template?',
23
+ ],
24
+ });
25
+
26
+ export default {
27
+ title: 'experimental/duo/chat/duo_chat_predefined_prompts',
28
+ component: GlDuoChatPredefinedPrompts,
29
+ parameters: {
30
+ docs: {
31
+ description: {
32
+ component: readme,
33
+ },
34
+ },
35
+ },
36
+ };
@@ -0,0 +1,36 @@
1
+ <script>
2
+ import { GlButton } from '../../../../../../index';
3
+
4
+ export default {
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
+ </script>
28
+ <template>
29
+ <div class="gl-text-right">
30
+ <div v-for="(prompt, index) in prompts" :key="`question-${index}`" class="gl-mt-3">
31
+ <gl-button category="secondary" variant="confirm" @click="handleClick(prompt)"
32
+ ><span class="gl-white-space-normal">{{ prompt }}</span></gl-button
33
+ >
34
+ </div>
35
+ </div>
36
+ </template>