@gitlab/ui 87.1.1 → 87.2.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 (33) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/experimental/duo/chat/duo_chat.js +5 -2
  3. package/dist/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.js +100 -0
  4. package/dist/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.js +238 -0
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.js +2 -0
  7. package/dist/tailwind.css +1 -1
  8. package/dist/tailwind.css.map +1 -1
  9. package/dist/tokens/tokens_table.js +64 -5
  10. package/package.json +4 -4
  11. package/src/components/base/avatar/avatar.scss +2 -2
  12. package/src/components/base/broadcast_message/broadcast_message.scss +2 -2
  13. package/src/components/base/button/button.scss +1 -1
  14. package/src/components/base/card/card.scss +1 -1
  15. package/src/components/base/datepicker/datepicker.scss +3 -3
  16. package/src/components/base/dropdown/dropdown.scss +2 -2
  17. package/src/components/base/filtered_search/filtered_search.scss +1 -1
  18. package/src/components/base/markdown/markdown.scss +3 -3
  19. package/src/components/base/modal/modal.scss +1 -1
  20. package/src/components/base/new_dropdowns/dropdown_item.scss +2 -2
  21. package/src/components/base/segmented_control/segmented_control.scss +1 -1
  22. package/src/components/base/toast/toast.scss +1 -1
  23. package/src/components/base/tooltip/tooltip.scss +1 -1
  24. package/src/components/charts/single_stat/single_stat.scss +1 -1
  25. package/src/components/experimental/duo/chat/duo_chat.scss +1 -1
  26. package/src/components/experimental/duo/chat/duo_chat.vue +3 -0
  27. package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.md +29 -0
  28. package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.vue +87 -0
  29. package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.md +37 -0
  30. package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.vue +261 -0
  31. package/src/index.js +2 -0
  32. package/src/tokens/tokens_table.vue +99 -13
  33. package/translations.js +12 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [87.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v87.1.2...v87.2.0) (2024-07-26)
2
+
3
+
4
+ ### Features
5
+
6
+ * **DuoWorkflow:** add component to take prompt ([3b7617d](https://gitlab.com/gitlab-org/gitlab-ui/commit/3b7617dcb12f2254f8d7844a86da4b908a6a8178))
7
+
8
+ ## [87.1.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v87.1.1...v87.1.2) (2024-07-26)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add cancel case to isStreaming state ([86e84bd](https://gitlab.com/gitlab-org/gitlab-ui/commit/86e84bd5db5782f603d0ca252420db792477bcd1))
14
+
1
15
  ## [87.1.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v87.1.0...v87.1.1) (2024-07-24)
2
16
 
3
17
 
@@ -232,8 +232,11 @@ var script = {
232
232
  return ((_this$lastMessage = this.lastMessage) === null || _this$lastMessage === void 0 ? void 0 : _this$lastMessage.content) === CHAT_RESET_MESSAGE;
233
233
  },
234
234
  isStreaming() {
235
- var _this$lastMessage2, _this$lastMessage2$ch, _this$lastMessage3, _this$lastMessage4;
236
- return Boolean(((_this$lastMessage2 = this.lastMessage) === null || _this$lastMessage2 === void 0 ? void 0 : (_this$lastMessage2$ch = _this$lastMessage2.chunks) === null || _this$lastMessage2$ch === void 0 ? void 0 : _this$lastMessage2$ch.length) > 0 && !((_this$lastMessage3 = this.lastMessage) !== null && _this$lastMessage3 !== void 0 && _this$lastMessage3.content) || typeof ((_this$lastMessage4 = this.lastMessage) === null || _this$lastMessage4 === void 0 ? void 0 : _this$lastMessage4.chunkId) === 'number');
235
+ var _this$lastMessage2, _this$lastMessage3, _this$lastMessage3$ch, _this$lastMessage4, _this$lastMessage5;
236
+ if (this.canceledRequestIds.includes((_this$lastMessage2 = this.lastMessage) === null || _this$lastMessage2 === void 0 ? void 0 : _this$lastMessage2.requestId)) {
237
+ return false;
238
+ }
239
+ return Boolean(((_this$lastMessage3 = this.lastMessage) === null || _this$lastMessage3 === void 0 ? void 0 : (_this$lastMessage3$ch = _this$lastMessage3.chunks) === null || _this$lastMessage3$ch === void 0 ? void 0 : _this$lastMessage3$ch.length) > 0 && !((_this$lastMessage4 = this.lastMessage) !== null && _this$lastMessage4 !== void 0 && _this$lastMessage4.content) || typeof ((_this$lastMessage5 = this.lastMessage) === null || _this$lastMessage5 === void 0 ? void 0 : _this$lastMessage5.chunkId) === 'number');
237
240
  },
238
241
  filteredSlashCommands() {
239
242
  const caseInsensitivePrompt = this.prompt.toLowerCase();
@@ -0,0 +1,100 @@
1
+ import GlIcon from '../../../../../base/icon/icon';
2
+ import GlCollapse from '../../../../../base/collapse/collapse';
3
+ import GlButton from '../../../../../base/button/button';
4
+ import { GlTooltipDirective } from '../../../../../../directives/tooltip';
5
+ import { translate } from '../../../../../../utils/i18n';
6
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
7
+
8
+ var script = {
9
+ name: 'GlDuoWorkflowPanel',
10
+ components: {
11
+ GlCollapse,
12
+ GlButton,
13
+ GlIcon
14
+ },
15
+ directives: {
16
+ GlTooltip: GlTooltipDirective
17
+ },
18
+ props: {
19
+ /**
20
+ * The icon to show in the header.
21
+ */
22
+ headerIcon: {
23
+ type: String,
24
+ required: false,
25
+ default: ''
26
+ },
27
+ /**
28
+ * The text used as the title and aria-label for the button when the collapse is collapsed
29
+ */
30
+ expandPanelButtonTitle: {
31
+ type: String,
32
+ required: false,
33
+ default: translate('GlDuoWorkflowPanel.expandButtonTitle', 'Expand')
34
+ },
35
+ /**
36
+ * The text used as the title and aria-label for the button when the collapse is expanded
37
+ */
38
+ collapsePanelButtonTitle: {
39
+ type: String,
40
+ required: false,
41
+ default: translate('GlDuoWorkflowPanel.collapseButtonTitle', 'Collapse')
42
+ }
43
+ },
44
+ data() {
45
+ return {
46
+ expanded: true
47
+ };
48
+ },
49
+ computed: {
50
+ buttonIcon() {
51
+ return this.expanded ? 'chevron-up' : 'chevron-down';
52
+ },
53
+ buttonTitle() {
54
+ return this.expanded ? this.collapsePanelButtonTitle : this.expandPanelButtonTitle;
55
+ }
56
+ },
57
+ methods: {
58
+ toggleExpanded() {
59
+ this.expanded = !this.expanded;
60
+ }
61
+ }
62
+ };
63
+
64
+ /* script */
65
+ const __vue_script__ = script;
66
+
67
+ /* template */
68
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-flex gl-flex-nowrap gl-items-center"},[(_vm.headerIcon)?_c('gl-icon',{staticClass:"gl-mr-3",attrs:{"name":_vm.headerIcon,"size":24}}):_vm._e(),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-flex-grow gl-items-baseline"},[_c('h2',{staticClass:"gl-mb-0"},[_vm._t("title")],2),_vm._v(" "),_c('small',{staticClass:"gl-ml-3"},[_vm._t("subtitle")],2)]),_vm._v(" "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip"}],attrs:{"category":"tertiary","icon":_vm.buttonIcon,"title":_vm.buttonTitle,"aria-label":_vm.buttonTitle},on:{"click":_vm.toggleExpanded}})],1),_vm._v(" "),_c('gl-collapse',{attrs:{"visible":_vm.expanded}},[_c('div',{staticClass:"gl-ml-7 gl-mt-4 gl-flex-grow"},[_vm._t("content")],2)])],1)};
69
+ var __vue_staticRenderFns__ = [];
70
+
71
+ /* style */
72
+ const __vue_inject_styles__ = undefined;
73
+ /* scoped */
74
+ const __vue_scope_id__ = undefined;
75
+ /* module identifier */
76
+ const __vue_module_identifier__ = undefined;
77
+ /* functional template */
78
+ const __vue_is_functional_template__ = false;
79
+ /* style inject */
80
+
81
+ /* style inject SSR */
82
+
83
+ /* style inject shadow dom */
84
+
85
+
86
+
87
+ const __vue_component__ = __vue_normalize__(
88
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
89
+ __vue_inject_styles__,
90
+ __vue_script__,
91
+ __vue_scope_id__,
92
+ __vue_is_functional_template__,
93
+ __vue_module_identifier__,
94
+ false,
95
+ undefined,
96
+ undefined,
97
+ undefined
98
+ );
99
+
100
+ export default __vue_component__;
@@ -0,0 +1,238 @@
1
+ import GlDuoWorkflowPanel from '../duo_workflow_panel/duo_workflow_panel';
2
+ import GlButton from '../../../../../base/button/button';
3
+ import GlFormGroup from '../../../../../base/form/form_group/form_group';
4
+ import GlFormTextarea from '../../../../../base/form/form_textarea/form_textarea';
5
+ import GlFormInput from '../../../../../base/form/form_input/form_input';
6
+ import { translate } from '../../../../../../utils/i18n';
7
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
8
+
9
+ var script = {
10
+ name: 'GlDuoWorkflowPrompt',
11
+ components: {
12
+ GlDuoWorkflowPanel,
13
+ GlButton,
14
+ GlFormGroup,
15
+ GlFormInput,
16
+ GlFormTextarea
17
+ },
18
+ props: {
19
+ /**
20
+ * The prompt the user has entered
21
+ */
22
+ prompt: {
23
+ type: String,
24
+ required: false,
25
+ default: ''
26
+ },
27
+ /**
28
+ * The image to run the workflow in
29
+ */
30
+ image: {
31
+ type: String,
32
+ required: false,
33
+ default: ''
34
+ },
35
+ /**
36
+ * The text for the title of the panel
37
+ */
38
+ title: {
39
+ type: String,
40
+ required: false,
41
+ default: translate('GlDuoWorkflowPrompt.title', 'Goal')
42
+ },
43
+ /**
44
+ * The summary of the ongoing workflow plan
45
+ */
46
+ summary: {
47
+ type: String,
48
+ required: false,
49
+ default: ''
50
+ },
51
+ /**
52
+ * Whether or not the panel is loading
53
+ */
54
+ loading: {
55
+ type: Boolean,
56
+ required: false,
57
+ default: false
58
+ },
59
+ /**
60
+ * The label of the prompt text area
61
+ *
62
+ * See `GlFormGroup` for text placement.
63
+ */
64
+ promptLabel: {
65
+ type: String,
66
+ required: false,
67
+ default: translate('GlDuoWorkflowPrompt.promptLabel', 'Description')
68
+ },
69
+ /**
70
+ * The label description of the prompt text area
71
+ *
72
+ * See `GlFormGroup` for text placement.
73
+ */
74
+ promptLabelDescription: {
75
+ type: String,
76
+ required: false,
77
+ default: translate('GlDuoWorkflowPrompt.promptLabelDescription', 'What would you like to do and how.')
78
+ },
79
+ /**
80
+ * The description of the prompt text area
81
+ *
82
+ * See `GlFormGroup` for text placement.
83
+ */
84
+ promptDescription: {
85
+ type: String,
86
+ required: false,
87
+ default: translate('GlDuoWorkflowPrompt.promptDescription', 'Be specific and include any requirements.')
88
+ },
89
+ /**
90
+ * The HTML ID of the textarea for the prompt
91
+ */
92
+ promptId: {
93
+ type: String,
94
+ required: false,
95
+ default: 'duo-workflow-prompt'
96
+ },
97
+ /**
98
+ * The label of the image input
99
+ */
100
+ imageLabel: {
101
+ type: String,
102
+ required: false,
103
+ default: translate('GlDuoWorkflowPrompt.imageLabel', 'Image')
104
+ },
105
+ /**
106
+ * The label description of the image input
107
+ *
108
+ * See `GlFormGroup` for text placement.
109
+ */
110
+ imageLabelDescription: {
111
+ type: String,
112
+ required: false,
113
+ default: translate('GlDuoWorkflowPrompt.imageLabelDescription', 'The container image to run the workflow in.')
114
+ },
115
+ /**
116
+ * The description of the image input
117
+ *
118
+ * See `GlFormGroup` for text placement.
119
+ */
120
+ imageDescription: {
121
+ type: String,
122
+ required: false,
123
+ default: translate('GlDuoWorkflowPrompt.imageDescription', 'It should have any tools necessary for the workflow installed.')
124
+ },
125
+ /**
126
+ * The ID of the image input
127
+ */
128
+ imageId: {
129
+ type: String,
130
+ required: false,
131
+ default: 'duo-workflow-image'
132
+ },
133
+ /**
134
+ * The text for the confirmation button. This button emits a `confirm` event.
135
+ */
136
+ confirmButtonText: {
137
+ type: String,
138
+ required: false,
139
+ default: translate('GlDuoWorkflowPrompt.confirmButtonText', 'Generate plan')
140
+ },
141
+ /**
142
+ * The text for the cancellation button. This button emits a `cancel` event.
143
+ */
144
+ cancelButtonText: {
145
+ type: String,
146
+ required: false,
147
+ default: translate('GlDuoWorkflowPrompt.cancelButtonText', 'Cancel')
148
+ },
149
+ /**
150
+ * The text used as the title and aria-label for the button when the collapse is collapsed
151
+ *
152
+ * See `GlDuoWorkflowPanel`
153
+ */
154
+ expandPanelButtonTitle: {
155
+ type: String,
156
+ required: false,
157
+ default: ''
158
+ },
159
+ /**
160
+ * The text used as the title and aria-label for the button when the collapse is expanded
161
+ *
162
+ * See `GlDuoWorkflowPanel`
163
+ */
164
+ collapsePanelButtonTitle: {
165
+ type: String,
166
+ required: false,
167
+ default: ''
168
+ }
169
+ },
170
+ methods: {
171
+ emitChange(prompt) {
172
+ /**
173
+ * Notify listeners about prompt change
174
+ * @param {string} prompt The newly entered prompt
175
+ */
176
+ this.$emit('update:prompt', prompt);
177
+ },
178
+ emitImage(image) {
179
+ /**
180
+ * Notify listeners about image change
181
+ * @param {string} image The newly entered image
182
+ */
183
+ this.$emit('update:image', image);
184
+ },
185
+ clickConfirm(event) {
186
+ /**
187
+ * Notify listeners about prompt submission
188
+ * @param {*} event A click event
189
+ */
190
+ this.$emit('confirm', event);
191
+ },
192
+ clickCancel(event) {
193
+ /**
194
+ * Notify listeners about prompt submission cancellation.
195
+ * @param {*} event A click event
196
+ */
197
+ this.$emit('cancel', event);
198
+ }
199
+ }
200
+ };
201
+
202
+ /* script */
203
+ const __vue_script__ = script;
204
+
205
+ /* template */
206
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-duo-workflow-panel',{attrs:{"header-icon":"issue-type-objective","expand-panel-button-title":_vm.expandPanelButtonTitle,"collapse-panel-button-title":_vm.collapsePanelButtonTitle},scopedSlots:_vm._u([{key:"title",fn:function(){return [_vm._v(_vm._s(_vm.title))]},proxy:true},{key:"subtitle",fn:function(){return [_vm._v(_vm._s(_vm.summary))]},proxy:true},{key:"content",fn:function(){return [_c('gl-form-group',{attrs:{"label":_vm.promptLabel,"label-for":_vm.promptId,"label-description":_vm.promptLabelDescription,"description":_vm.promptDescription}},[_c('gl-form-textarea',{attrs:{"id":_vm.promptId,"value":_vm.prompt,"disable":_vm.loading,"no-resize":false},on:{"input":_vm.emitChange}})],1),_vm._v(" "),_c('gl-form-group',{attrs:{"label":_vm.imageLabel,"label-for":_vm.imageId,"label-description":_vm.imageLabelDescription,"description":_vm.imageDescription}},[_c('gl-form-input',{attrs:{"id":_vm.imageId,"value":_vm.image,"disable":_vm.loading},on:{"input":_vm.emitImage}})],1),_vm._v(" "),_c('div',{staticClass:"gl-flex gl-gap-3"},[_c('gl-button',{attrs:{"variant":"confirm","data-test-id":"duo-workflow-prompt-confirm","loading":_vm.loading},on:{"click":_vm.clickConfirm}},[_vm._v(_vm._s(_vm.confirmButtonText))]),_vm._v(" "),_c('gl-button',{attrs:{"data-test-id":"duo-workflow-prompt-cancel"},on:{"click":_vm.clickCancel}},[_vm._v(_vm._s(_vm.cancelButtonText))])],1)]},proxy:true}])})};
207
+ var __vue_staticRenderFns__ = [];
208
+
209
+ /* style */
210
+ const __vue_inject_styles__ = undefined;
211
+ /* scoped */
212
+ const __vue_scope_id__ = undefined;
213
+ /* module identifier */
214
+ const __vue_module_identifier__ = undefined;
215
+ /* functional template */
216
+ const __vue_is_functional_template__ = false;
217
+ /* style inject */
218
+
219
+ /* style inject SSR */
220
+
221
+ /* style inject shadow dom */
222
+
223
+
224
+
225
+ const __vue_component__ = __vue_normalize__(
226
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
227
+ __vue_inject_styles__,
228
+ __vue_script__,
229
+ __vue_scope_id__,
230
+ __vue_is_functional_template__,
231
+ __vue_module_identifier__,
232
+ false,
233
+ undefined,
234
+ undefined,
235
+ undefined
236
+ );
237
+
238
+ export default __vue_component__;