@gitlab/duo-ui 10.23.1 → 11.0.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.
File without changes
@@ -0,0 +1,95 @@
1
+ <script>
2
+ import VueResizable from 'vue-resizable';
3
+ import SideRail from '../side_rail/side_rail.vue';
4
+
5
+ export default {
6
+ name: 'DuoLayout',
7
+ components: {
8
+ VueResizable,
9
+ SideRail,
10
+ },
11
+ props: {
12
+ /**
13
+ * Determines if the component should be resizable. When true, it renders inside
14
+ * a `vue-resizable` wrapper; otherwise, a standard `div` is used.
15
+ */
16
+ shouldRenderResizable: {
17
+ type: Boolean,
18
+ required: false,
19
+ default: false,
20
+ },
21
+ /**
22
+ * Defines the dimensions of the layout container when resizable.
23
+ * By default, the height is set to match the height of the browser window,
24
+ * and the width is fixed at 400px. The `top` position is left undefined,
25
+ * allowing it to be dynamically adjusted if needed.
26
+ */
27
+ dimensions: {
28
+ type: Object,
29
+ required: false,
30
+ default: () => ({
31
+ width: undefined,
32
+ height: undefined,
33
+ top: undefined,
34
+ left: undefined,
35
+ maxWidth: undefined,
36
+ minWidth: 400,
37
+ maxHeight: undefined,
38
+ minHeight: 400,
39
+ }),
40
+ },
41
+ /**
42
+ * Whether the layout is hidden
43
+ */
44
+ isHidden: {
45
+ type: Boolean,
46
+ required: false,
47
+ default: false,
48
+ },
49
+ },
50
+ methods: {
51
+ updateSize(e) {
52
+ /**
53
+ * Emitted when the layout is resized
54
+ * @param {Object} e The resize event data
55
+ */
56
+ this.$emit('resize', e);
57
+ },
58
+ },
59
+ };
60
+ </script>
61
+ <template>
62
+ <component
63
+ :is="shouldRenderResizable ? 'vue-resizable' : 'div'"
64
+ v-if="!isHidden"
65
+ :width="shouldRenderResizable ? dimensions.width : null"
66
+ :height="shouldRenderResizable ? dimensions.height : null"
67
+ :max-width="shouldRenderResizable ? dimensions.maxWidth : null"
68
+ :max-height="shouldRenderResizable ? dimensions.maxHeight : null"
69
+ :min-width="shouldRenderResizable ? dimensions.minWidth : null"
70
+ :left="shouldRenderResizable ? dimensions.left : null"
71
+ :top="shouldRenderResizable ? dimensions.top : null"
72
+ :fit-parent="true"
73
+ :min-height="shouldRenderResizable ? dimensions.minHeight : null"
74
+ :class="{
75
+ 'duo-chat-resizable': shouldRenderResizable,
76
+ 'non-resizable-wrapper': !shouldRenderResizable,
77
+ }"
78
+ :active="shouldRenderResizable ? ['l', 't', 'lt'] : null"
79
+ data-testid="duo-layout-component"
80
+ @resize:end="updateSize"
81
+ >
82
+ <aside
83
+ class="markdown-code-block duo-chat gl-align-items gl-bottom-0 gl-flex gl-h-full gl-max-h-full gl-flex-row gl-bg-strong gl-py-3 gl-pl-3"
84
+ >
85
+ <main
86
+ class="content flex-none gl-h-full gl-min-w-0 gl-grow gl-overflow-y-auto gl-rounded-[1rem] gl-bg-neutral-0"
87
+ >
88
+ <slot name="mainview"></slot>
89
+ </main>
90
+ <aside class="gl-flex gl-h-full gl-min-h-full gl-bg-strong gl-px-3 gl-py-2">
91
+ <slot name="siderail"></slot>
92
+ </aside>
93
+ </aside>
94
+ </component>
95
+ </template>
@@ -0,0 +1,56 @@
1
+ <script>
2
+ import { GlButtonGroup, GlButton, GlAvatar, GlTooltipDirective } from '@gitlab/ui';
3
+
4
+ export default {
5
+ name: 'SideRail',
6
+ directives: {
7
+ GlTooltip: GlTooltipDirective,
8
+ },
9
+ components: {
10
+ GlButtonGroup,
11
+ GlButton,
12
+ GlAvatar,
13
+ },
14
+ props: {
15
+ /**
16
+ * String to display the empty state of recent content
17
+ */
18
+ buttons: {
19
+ type: Object,
20
+ required: false,
21
+ default: () => ({}),
22
+ },
23
+ },
24
+ methods: {
25
+ onClick(buttonName) {
26
+ this.$emit('click', buttonName);
27
+ },
28
+ },
29
+ };
30
+ </script>
31
+ <template>
32
+ <gl-button-group :vertical="true">
33
+ <template v-for="(button, buttonName) in buttons">
34
+ <div
35
+ v-if="button.dividerBefore"
36
+ :key="`${buttonName}-divider`"
37
+ class="gl-mx-auto gl-my-3 gl-h-1 gl-w-5 gl-border-0 gl-border-t-1 gl-border-solid gl-border-[#7759C233]"
38
+ name="divider"
39
+ ></div>
40
+ <gl-button
41
+ v-if="button.render"
42
+ :key="`${buttonName}-button`"
43
+ v-gl-tooltip
44
+ :title="button.title"
45
+ category="tertiary"
46
+ variant="default"
47
+ size="medium"
48
+ :icon="button.icon"
49
+ active-class="gl-active"
50
+ @click="onClick(buttonName)"
51
+ >
52
+ <gl-avatar v-if="button.avatar" :size="32" :entity-name="button.avatar" shape="circle" />
53
+ </gl-button>
54
+ </template>
55
+ </gl-button-group>
56
+ </template>
package/src/index.js CHANGED
@@ -44,3 +44,8 @@ export { default as DuoRecentCollapsible } from './components/ui/duo_recent_coll
44
44
  export { default as DuoRecentContent } from './components/ui/duo_recent_content/duo_recent_content.vue';
45
45
 
46
46
  export { addDuoMarkdownPlugin } from './components/chat/markdown_renderer';
47
+
48
+ export { default as DuoLayout } from './components/ui/duo_layout/duo_layout.vue';
49
+ export { default as SideRail } from './components/ui/side_rail/side_rail.vue';
50
+ export { default as WebDuoChat } from './components/chat/web_duo_chat.vue';
51
+ export { default as WebAgenticDuoChat } from './components/agentic_chat/web_agentic_duo_chat.vue';
package/translations.js CHANGED
@@ -142,4 +142,46 @@ export default {
142
142
  'MessageToolApproval.toolLabel': 'Tool:',
143
143
  'MessageToolApproval.toolStatus': 'Pending',
144
144
  'MessageToolApproval.toolUnknown': 'Unknown',
145
+ 'WebAgenticDuoChat.chatCancelLabel': 'Cancel',
146
+ 'WebAgenticDuoChat.chatDefaultPredefinedPromptsChangePassword':
147
+ 'How do I change my password in GitLab?',
148
+ 'WebAgenticDuoChat.chatDefaultPredefinedPromptsCloneRepository': 'How do I clone a repository?',
149
+ 'WebAgenticDuoChat.chatDefaultPredefinedPromptsCreateTemplate': 'How do I create a template?',
150
+ 'WebAgenticDuoChat.chatDefaultPredefinedPromptsForkProject': 'How do I fork a project?',
151
+ 'WebAgenticDuoChat.chatDefaultTitle': 'GitLab Duo Agentic Chat',
152
+ 'WebAgenticDuoChat.chatDisclamer': 'Responses may be inaccurate. Verify before use.',
153
+ 'WebAgenticDuoChat.chatEmptyStateTitle':
154
+ '👋 I am GitLab Duo Agentic Chat, your personal AI-powered assistant. How can I help you today?',
155
+ 'WebAgenticDuoChat.chatHistoryTitle': 'Chat history',
156
+ 'WebAgenticDuoChat.chatModelPlaceholder': 'GitLab Duo Agentic Chat',
157
+ 'WebAgenticDuoChat.chatPromptPlaceholderDefault': "Let's work through this together...",
158
+ 'WebAgenticDuoChat.chatPromptPlaceholderWithCommands': 'Type /help to learn more',
159
+ 'WebAgenticDuoChat.chatSubmitLabel': 'Send chat message.',
160
+ 'WebAgenticDuoChat.overLimitCharacterCountMessage': null,
161
+ 'WebAgenticDuoChat.remainingCharacterCountMessage': null,
162
+ 'WebDuoChat.chatBackLabel': 'Back to history',
163
+ 'WebDuoChat.chatBackToChatToolTip': 'Back to chat',
164
+ 'WebDuoChat.chatCancelLabel': 'Cancel',
165
+ 'WebDuoChat.chatDefaultPredefinedPromptsChangePassword': 'How do I change my password in GitLab?',
166
+ 'WebDuoChat.chatDefaultPredefinedPromptsCloneRepository': 'How do I clone a repository?',
167
+ 'WebDuoChat.chatDefaultPredefinedPromptsCreateTemplate': 'How do I create a template?',
168
+ 'WebDuoChat.chatDefaultPredefinedPromptsForkProject': 'How do I fork a project?',
169
+ 'WebDuoChat.chatDefaultTitle': 'GitLab Duo Chat',
170
+ 'WebDuoChat.chatDisclamer': 'Responses may be inaccurate. Verify before use.',
171
+ 'WebDuoChat.chatDropdownMoreOptions': 'More options',
172
+ 'WebDuoChat.chatEmptyStateTitle':
173
+ '👋 I am GitLab Duo Chat, your personal AI-powered assistant. How can I help you today?',
174
+ 'WebDuoChat.chatHistoryTitle': 'Chat history',
175
+ 'WebDuoChat.chatHistoryToolTip': 'Chat history',
176
+ 'WebDuoChat.chatModelPlaceholder': 'GitLab Duo Chat',
177
+ 'WebDuoChat.chatNewLabel': 'New chat',
178
+ 'WebDuoChat.chatNewToolTip': 'New chat',
179
+ 'WebDuoChat.chatPromptPlaceholderDefault': "Let's work through this together...",
180
+ 'WebDuoChat.chatPromptPlaceholderWithCommands': 'Type /help to learn more',
181
+ 'WebDuoChat.chatSubmitLabel': 'Send chat message.',
182
+ 'WebDuoChat.chatTitle': 'GitLab Duo Chat',
183
+ 'WebDuoChat.closeChatHeaderLabel': 'Close chat',
184
+ 'WebDuoChat.copySessionIdFailedToast': 'Could not copy session ID',
185
+ 'WebDuoChat.copySessionIdSuccessToast': 'Session ID copied to clipboard',
186
+ 'WebDuoChat.copySessionIdTooltip': 'Copy session ID',
145
187
  };