@gitlab/duo-ui 0.2.0 → 0.4.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 (80) hide show
  1. package/CHANGELOG.md +5 -11696
  2. package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.js +1 -1
  3. package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.js +1 -1
  4. package/dist/components/chat/components/duo_chat_message/constants.js +5 -0
  5. package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_message/duo_chat_message.js +26 -2
  6. package/dist/components/{experimental/duo/chat → chat}/mock_data.js +1 -1
  7. package/dist/components.css +2 -0
  8. package/dist/components.css.map +1 -0
  9. package/dist/config.js +44 -0
  10. package/dist/index.js +3 -0
  11. package/dist/utils/test_utils.js +33 -0
  12. package/package.json +2 -2
  13. package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.vue +1 -1
  14. package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.vue +1 -1
  15. package/src/components/chat/components/duo_chat_message/constants.js +3 -0
  16. package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message/duo_chat_message.scss +31 -2
  17. package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message/duo_chat_message.vue +33 -2
  18. package/src/components/chat/duo_chat.scss +393 -0
  19. package/src/components/{experimental/duo/chat → chat}/mock_data.js +1 -1
  20. package/src/index.js +3 -3
  21. package/src/scss/components.scss +6 -0
  22. package/src/components/experimental/duo/chat/duo_chat.scss +0 -168
  23. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/constants.js +0 -0
  24. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.js +0 -0
  25. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.js +0 -0
  26. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +0 -0
  27. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.js +0 -0
  28. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +0 -0
  29. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +0 -0
  30. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/mock_context_data.js +0 -0
  31. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_context/utils.js +0 -0
  32. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_conversation/duo_chat_conversation.js +0 -0
  33. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_loader/duo_chat_loader.js +0 -0
  34. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_message/buttons_utils.js +0 -0
  35. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_message/copy_code_element.js +0 -0
  36. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_message/insert_code_snippet_element.js +0 -0
  37. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_message/utils.js +0 -0
  38. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -0
  39. /package/dist/components/{experimental/duo/chat → chat}/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -0
  40. /package/dist/components/{experimental/duo/chat → chat}/constants.js +0 -0
  41. /package/dist/components/{experimental/duo/chat → chat}/duo_chat.js +0 -0
  42. /package/dist/components/{experimental/duo/chat → chat}/markdown_renderer.js +0 -0
  43. /package/dist/components/{experimental/duo/user_feedback → user_feedback}/user_feedback.js +0 -0
  44. /package/dist/components/{experimental/duo/user_feedback → user_feedback}/user_feedback_modal.js +0 -0
  45. /package/dist/components/{experimental/duo/workflow → workflow}/components/duo_workflow_panel/duo_workflow_panel.js +0 -0
  46. /package/dist/components/{experimental/duo/workflow → workflow}/components/duo_workflow_prompt/duo_workflow_prompt.js +0 -0
  47. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/constants.js +0 -0
  48. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue +0 -0
  49. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.vue +0 -0
  50. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +0 -0
  51. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.vue +0 -0
  52. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +0 -0
  53. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +0 -0
  54. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/mock_context_data.js +0 -0
  55. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_context/utils.js +0 -0
  56. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_conversation/duo_chat_conversation.md +0 -0
  57. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_conversation/duo_chat_conversation.vue +0 -0
  58. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_loader/duo_chat_loader.md +0 -0
  59. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_loader/duo_chat_loader.scss +0 -0
  60. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_loader/duo_chat_loader.vue +0 -0
  61. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message/buttons_utils.js +0 -0
  62. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message/copy_code_element.js +0 -0
  63. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message/duo_chat_message.md +0 -0
  64. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message/insert_code_snippet_element.js +0 -0
  65. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message/utils.js +0 -0
  66. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message_sources/duo_chat_message_sources.md +0 -0
  67. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_message_sources/duo_chat_message_sources.vue +0 -0
  68. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.md +0 -0
  69. /package/src/components/{experimental/duo/chat → chat}/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue +0 -0
  70. /package/src/components/{experimental/duo/chat → chat}/constants.js +0 -0
  71. /package/src/components/{experimental/duo/chat → chat}/duo_chat.md +0 -0
  72. /package/src/components/{experimental/duo/chat → chat}/duo_chat.vue +0 -0
  73. /package/src/components/{experimental/duo/chat → chat}/markdown_renderer.js +0 -0
  74. /package/src/components/{experimental/duo/user_feedback → user_feedback}/user_feedback.md +0 -0
  75. /package/src/components/{experimental/duo/user_feedback → user_feedback}/user_feedback.vue +0 -0
  76. /package/src/components/{experimental/duo/user_feedback → user_feedback}/user_feedback_modal.vue +0 -0
  77. /package/src/components/{experimental/duo/workflow → workflow}/components/duo_workflow_panel/duo_workflow_panel.md +0 -0
  78. /package/src/components/{experimental/duo/workflow → workflow}/components/duo_workflow_panel/duo_workflow_panel.vue +0 -0
  79. /package/src/components/{experimental/duo/workflow → workflow}/components/duo_workflow_prompt/duo_workflow_prompt.md +0 -0
  80. /package/src/components/{experimental/duo/workflow → workflow}/components/duo_workflow_prompt/duo_workflow_prompt.vue +0 -0
@@ -0,0 +1,393 @@
1
+ $duo-chat-scrim-gradient: linear-gradient(to bottom, rgba($gray-10, 0), $gray-10);
2
+
3
+ .duo-chat {
4
+ z-index: 999;
5
+
6
+ .message-enter-active,
7
+ .message-leave-active {
8
+ transition: all 0.5s ease;
9
+ }
10
+
11
+ .message-enter,
12
+ .message-leave-to {
13
+ @apply gl-opacity-0;
14
+ transform: translateY(10px);
15
+ }
16
+
17
+ .duo-chat-loader.message-leave,
18
+ .duo-chat-loader.message-leave-to {
19
+ transition: none;
20
+ }
21
+
22
+ .duo-chat-drawer-body-scrim-on-footer {
23
+ &::before {
24
+ background: $duo-chat-scrim-gradient;
25
+ }
26
+ }
27
+
28
+ .duo-chat-drawer-body {
29
+ overflow-y: auto;
30
+ }
31
+
32
+ .duo-chat-drawer-header,
33
+ .duo-chat-drawer-body > * {
34
+ @apply gl-p-5;
35
+ }
36
+ }
37
+
38
+ .duo-chat-drawer {
39
+ right: 0;
40
+ @apply gl-transition-all;
41
+ position: fixed;
42
+ @apply gl-h-full;
43
+ @apply gl-overflow-y-auto;
44
+ @apply gl-text-base;
45
+ @apply gl-leading-normal;
46
+ @apply gl-flex;
47
+ @apply gl-flex-col;
48
+ }
49
+
50
+ .duo-chat-drawer-header {
51
+ @apply gl-border-b-solid gl-border-b-gray-100 gl-border-b-1;
52
+ }
53
+
54
+ .duo-chat-drawer-header-sticky {
55
+ top: 0;
56
+ position: sticky;
57
+ @apply gl-border-b-solid gl-border-b-gray-100 gl-border-b-1;
58
+ }
59
+
60
+ .duo-chat-drawer-body {
61
+ @apply gl-grow;
62
+ // prevent safari bug where box shadow is visible
63
+ // above the drawer when hovering interactive elements
64
+ // see https://gitlab.com/gitlab-org/gitlab/-/issues/366558
65
+ background-color: inherit;
66
+ }
67
+
68
+ .duo-chat-drawer-footer {
69
+ @apply gl-border-t-solid gl-border-t-gray-100 gl-border-t-1;
70
+ @apply gl-p-5;
71
+ }
72
+
73
+ .duo-chat-drawer-footer-sticky {
74
+ bottom: 0;
75
+ position: sticky;
76
+ }
77
+
78
+ .duo-chat-drawer-body-scrim-on-footer {
79
+ &::before {
80
+ background: $duo-chat-scrim-gradient;
81
+ top: -$gl-border-size-1;
82
+ @apply -gl-translate-y-full;
83
+ content: '';
84
+ left: 0;
85
+ position: absolute;
86
+ @apply gl-pointer-events-none;
87
+ @apply gl-w-full;
88
+ @apply gl-h-7;
89
+ }
90
+ }
91
+
92
+ .duo-chat-history {
93
+ scroll-behavior: smooth;
94
+
95
+ &.force-scroll-bar {
96
+ min-height: calc(100% + 1rem);
97
+ }
98
+
99
+ /*
100
+ Browsers a are pretty good at keeping the focus on an element while
101
+ the parent element grows in size. With this we mark all child elements
102
+ of the chat history as "non" anchors.
103
+ https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-anchor
104
+ */
105
+ * {
106
+ overflow-anchor: none;
107
+ }
108
+
109
+ /*
110
+ Right at the bottom of the chat history we add a scroll-anchor element.
111
+ This scroll-anchor element is the only "possible" anchor. The beauty of it:
112
+ It only will be used as an anchor _if_ it is currently inside the view port.
113
+ So if the user manually scrolls up while a chunked message is coming in,
114
+ it won't stick to the bottom while the message still loads.
115
+ */
116
+ .scroll-anchor {
117
+ overflow-anchor: auto;
118
+ height: 1px;
119
+ margin-top: -1px; // In order to not add 1px vertically, we add a negative margin
120
+ }
121
+ }
122
+
123
+ .duo-chat-input {
124
+ @apply gl-flex;
125
+ @apply gl-flex-col;
126
+ max-height: 240px;
127
+ overflow: hidden;
128
+
129
+ &:focus-within {
130
+ @include gl-focus($color: $gray-900);
131
+ }
132
+
133
+ .gl-form-textarea.form-control {
134
+ flex: 1;
135
+ resize: none;
136
+ max-height: 240px;
137
+ padding-right: 40px;
138
+ }
139
+
140
+ &::after {
141
+ content: attr(data-value) ' ';
142
+ @apply gl-invisible;
143
+ @apply gl-whitespace-pre-wrap;
144
+ @apply gl-py-4;
145
+ }
146
+ }
147
+
148
+ .slash-commands {
149
+ @apply -gl-mt-2;
150
+
151
+ .active-command {
152
+ @apply gl-bg-gray-50;
153
+ @apply gl-rounded-base;
154
+ }
155
+
156
+ .gl-dropdown-item button.dropdown-item {
157
+ @apply gl-text-sm;
158
+ @apply gl-px-3;
159
+ @apply gl-bg-transparent;
160
+
161
+ &:hover {
162
+ @apply gl-bg-transparent;
163
+ }
164
+ }
165
+ }
166
+ // TODO this is techdebt from: https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/3953#note_1762834219
167
+ // once this file is migrated to Duo-UI we need to remove these styles as a markdown fallback
168
+ // and make sure all host-system provide markdown renderer
169
+ .duo-chat-markdown {
170
+ @apply gl-text-lg;
171
+ @apply gl-leading-24;
172
+ color: $gl-text-color;
173
+ @apply gl-font-regular;
174
+ @apply gl-font-normal;
175
+
176
+ :first-child {
177
+ @apply gl-mt-0;
178
+ }
179
+
180
+ h1,
181
+ .gl-h1 {
182
+ @apply gl-heading-1;
183
+ @apply gl-mt-7;
184
+ }
185
+
186
+ h2,
187
+ .gl-h2 {
188
+ @apply gl-heading-2;
189
+ @apply gl-mt-6;
190
+ }
191
+
192
+ h3,
193
+ .gl-h3 {
194
+ @apply gl-heading-3;
195
+ @apply gl-mt-6;
196
+ }
197
+
198
+ h4,
199
+ .gl-h4 {
200
+ @apply gl-heading-4;
201
+ @apply gl-mt-5;
202
+ }
203
+
204
+ h5,
205
+ .gl-h5 {
206
+ @apply gl-heading-5;
207
+ @apply gl-mt-5;
208
+ }
209
+
210
+ h6,
211
+ .gl-h6 {
212
+ @apply gl-heading-6;
213
+ @apply gl-mt-5;
214
+ }
215
+
216
+ p,
217
+ .gl-paragraph {
218
+ @apply gl-mt-0;
219
+ @apply gl-mb-0;
220
+
221
+ + p,
222
+ + .gl-paragraph {
223
+ @apply gl-mt-5;
224
+ }
225
+
226
+ &.sm {
227
+ font-size: $gl-font-size-markdown-sm;
228
+ @apply gl-leading-20;
229
+ }
230
+ }
231
+
232
+ .sm {
233
+ font-size: $gl-font-size-markdown-sm;
234
+ @apply gl-leading-20;
235
+ }
236
+
237
+ .monospace,
238
+ code {
239
+ @apply gl-font-monospace;
240
+ }
241
+
242
+ blockquote {
243
+ @apply gl-text-gray-700;
244
+ @apply gl-py-3;
245
+ @apply gl-pl-6;
246
+ @apply gl-my-3;
247
+ @apply gl-mx-0;
248
+ box-shadow: inset $gl-border-size-4 0 0 0 $gray-100;
249
+ }
250
+
251
+ .idiff {
252
+ @apply gl-rounded-base;
253
+ @apply gl-inline-flex;
254
+ @apply gl-px-2;
255
+ }
256
+
257
+ .deletion {
258
+ @apply gl-bg-red-100;
259
+ }
260
+
261
+ .addition {
262
+ @apply gl-bg-green-100;
263
+ }
264
+
265
+ code {
266
+ @apply gl-rounded-base;
267
+ @apply gl-bg-gray-50;
268
+ @apply gl-text-gray-950;
269
+ @apply gl-px-2;
270
+ @apply gl-py-1;
271
+ }
272
+
273
+ pre {
274
+ @apply gl-rounded-base;
275
+ @apply gl-py-3;
276
+ @apply gl-px-4;
277
+ box-shadow: inset 0 0 0 $gl-border-size-1 $gray-100;
278
+ @apply gl-my-7;
279
+ @apply gl-overflow-auto;
280
+
281
+ code {
282
+ @apply gl-bg-white;
283
+ @apply gl-rounded-none;
284
+ @apply gl-text-gray-900;
285
+ @apply gl-p-0;
286
+ }
287
+ }
288
+
289
+ .audio-container {
290
+ @apply gl-inline-flex;
291
+ @apply gl-flex-col;
292
+ @apply gl-w-full;
293
+
294
+ audio {
295
+ @apply gl-w-full;
296
+ }
297
+
298
+ a {
299
+ @apply gl-mt-3;
300
+
301
+ &::before {
302
+ @apply gl-mr-2;
303
+ text-rendering: auto;
304
+ -webkit-font-smoothing: antialiased;
305
+ content: '📎';
306
+ }
307
+ }
308
+ }
309
+
310
+ table {
311
+ @apply gl-my-7;
312
+
313
+ th,
314
+ td {
315
+ @apply gl-px-3;
316
+ @apply gl-py-4;
317
+ box-shadow: inset 0 -#{$gl-border-size-1} 0 0 $gray-100;
318
+ @apply gl-align-top;
319
+ }
320
+
321
+ th {
322
+ box-shadow:
323
+ inset 0 #{$gl-border-size-1} 0 0 $gray-100,
324
+ inset 0 -#{$gl-border-size-1} 0 0 $gray-100;
325
+ @apply gl-font-bold;
326
+ }
327
+
328
+ thead {
329
+ @apply gl-bg-gray-50;
330
+ }
331
+
332
+ tr:nth-child(even) {
333
+ @apply gl-bg-gray-10;
334
+ }
335
+ }
336
+ }
337
+
338
+ .duo-chat-compact-markdown {
339
+ @apply gl-text-base;
340
+ @apply gl-leading-20;
341
+
342
+ h1,
343
+ .gl-h1 {
344
+ @apply gl-heading-1-fixed;
345
+ @apply gl-mt-7;
346
+ }
347
+
348
+ h2,
349
+ .gl-h2 {
350
+ @apply gl-heading-2-fixed;
351
+ @apply gl-mt-6;
352
+ }
353
+
354
+ h3,
355
+ .gl-h3 {
356
+ @apply gl-heading-3-fixed;
357
+ @apply gl-mt-6;
358
+ }
359
+
360
+ h4,
361
+ .gl-h4 {
362
+ @apply gl-heading-4-fixed;
363
+ @apply gl-mt-5;
364
+ }
365
+
366
+ h5,
367
+ .gl-h5 {
368
+ @apply gl-heading-5-fixed;
369
+ @apply gl-mt-5;
370
+ }
371
+
372
+ h6,
373
+ .gl-h6 {
374
+ @apply gl-heading-6-fixed;
375
+ @apply gl-mt-5;
376
+ }
377
+
378
+ .sm {
379
+ @apply gl-text-sm;
380
+ }
381
+
382
+ .monospace,
383
+ code {
384
+ @apply gl-font-monospace;
385
+ }
386
+
387
+ table {
388
+ th,
389
+ td {
390
+ @apply gl-py-3;
391
+ }
392
+ }
393
+ }
@@ -143,7 +143,7 @@ export const renderMarkdown = (content) => content;
143
143
  export const renderGFM = (el) => {
144
144
  const codeBlock = el.querySelectorAll('.markdown-code-block');
145
145
  codeBlock.forEach((block) => {
146
- block?.classList.add('gl-markdown', 'gl-compact-markdown');
146
+ block?.classList.add('duo-chat-markdown', 'duo-chat-compact-markdown');
147
147
  });
148
148
  };
149
149
 
package/src/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { default as DuoUserFeedback } from './components/experimental/duo/user_feedback/user_feedback.vue';
2
- export { default as DuoChat } from './components/experimental/duo/chat/duo_chat.vue';
3
- export { default as DuoChatContextItemMenu } from './components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue';
1
+ export { default as DuoUserFeedback } from './components/user_feedback/user_feedback.vue';
2
+ export { default as DuoChat } from './components/chat/duo_chat.vue';
3
+ export { default as DuoChatContextItemMenu } from './components/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue';
@@ -0,0 +1,6 @@
1
+ @import '@gitlab/ui/src/scss/variables';
2
+ @import '@gitlab/ui/src/scss/mixins';
3
+
4
+ @import '../components/chat/duo_chat';
5
+ @import '../components/chat/components/duo_chat_loader/duo_chat_loader';
6
+ @import '../components/chat/components/duo_chat_message/duo_chat_message';
@@ -1,168 +0,0 @@
1
- $duo-chat-scrim-gradient: linear-gradient(to bottom, rgba($gray-10, 0), $gray-10);
2
-
3
- .duo-chat {
4
- z-index: 999;
5
-
6
- .message-enter-active,
7
- .message-leave-active {
8
- transition: all 0.5s ease;
9
- }
10
-
11
- .message-enter,
12
- .message-leave-to {
13
- @apply gl-opacity-0;
14
- transform: translateY(10px);
15
- }
16
-
17
- .duo-chat-loader.message-leave,
18
- .duo-chat-loader.message-leave-to {
19
- transition: none;
20
- }
21
-
22
- .duo-chat-drawer-body-scrim-on-footer {
23
- &::before {
24
- background: $duo-chat-scrim-gradient;
25
- }
26
- }
27
-
28
- .duo-chat-drawer-body {
29
- overflow-y: auto;
30
- }
31
-
32
- .duo-chat-drawer-header,
33
- .duo-chat-drawer-body > * {
34
- @apply gl-p-5;
35
- }
36
- }
37
-
38
- .duo-chat-drawer {
39
- right: 0;
40
- @apply gl-transition-all;
41
- position: fixed;
42
- @apply gl-h-full;
43
- @apply gl-w-full;
44
- @apply gl-overflow-y-auto;
45
- @apply gl-shadow-lg;
46
- @apply gl-text-base;
47
- @apply gl-leading-normal;
48
- @apply gl-flex;
49
- @apply gl-flex-col;
50
- }
51
-
52
- .duo-chat-drawer-header {
53
- @apply gl-border-b-solid gl-border-b-gray-100 gl-border-b-1;
54
- }
55
-
56
- .duo-chat-drawer-header-sticky {
57
- top: 0;
58
- position: sticky;
59
- @apply gl-border-b-solid gl-border-b-gray-100 gl-border-b-1;
60
- }
61
-
62
- .duo-chat-drawer-body {
63
- @apply gl-grow;
64
- // prevent safari bug where box shadow is visible
65
- // above the drawer when hovering interactive elements
66
- // see https://gitlab.com/gitlab-org/gitlab/-/issues/366558
67
- background-color: inherit;
68
- }
69
-
70
- .duo-chat-drawer-footer {
71
- @apply gl-border-t-solid gl-border-t-gray-100 gl-border-t-1;
72
- @apply gl-p-5;
73
- }
74
-
75
- .duo-chat-drawer-footer-sticky {
76
- @apply gl-bg-white;
77
- bottom: 0;
78
- position: sticky;
79
- }
80
-
81
- .duo-chat-drawer-body-scrim-on-footer {
82
- &::before {
83
- background: $duo-chat-scrim-gradient;
84
- top: -$gl-border-size-1;
85
- @apply -gl-translate-y-full;
86
- content: '';
87
- left: 0;
88
- position: absolute;
89
- @apply gl-pointer-events-none;
90
- @apply gl-w-full;
91
- @apply gl-h-7;
92
- }
93
- }
94
-
95
- .duo-chat-history {
96
- scroll-behavior: smooth;
97
-
98
- &.force-scroll-bar {
99
- min-height: calc(100% + 1rem);
100
- }
101
-
102
- /*
103
- Browsers a are pretty good at keeping the focus on an element while
104
- the parent element grows in size. With this we mark all child elements
105
- of the chat history as "non" anchors.
106
- https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-anchor
107
- */
108
- * {
109
- overflow-anchor: none;
110
- }
111
-
112
- /*
113
- Right at the bottom of the chat history we add a scroll-anchor element.
114
- This scroll-anchor element is the only "possible" anchor. The beauty of it:
115
- It only will be used as an anchor _if_ it is currently inside the view port.
116
- So if the user manually scrolls up while a chunked message is coming in,
117
- it won't stick to the bottom while the message still loads.
118
- */
119
- .scroll-anchor {
120
- overflow-anchor: auto;
121
- height: 1px;
122
- margin-top: -1px; // In order to not add 1px vertically, we add a negative margin
123
- }
124
- }
125
-
126
- .duo-chat-input {
127
- @apply gl-flex;
128
- @apply gl-flex-col;
129
- max-height: 240px;
130
- overflow: hidden;
131
-
132
- &:focus-within {
133
- @include gl-focus($color: $gray-900);
134
- }
135
-
136
- .gl-form-textarea.form-control {
137
- flex: 1;
138
- resize: none;
139
- max-height: 240px;
140
- padding-right: 40px;
141
- }
142
-
143
- &::after {
144
- content: attr(data-value) ' ';
145
- @apply gl-invisible;
146
- @apply gl-whitespace-pre-wrap;
147
- @apply gl-py-4;
148
- }
149
- }
150
-
151
- .slash-commands {
152
- @apply -gl-mt-2;
153
-
154
- .active-command {
155
- @apply gl-bg-gray-50;
156
- @apply gl-rounded-base;
157
- }
158
-
159
- .gl-dropdown-item button.dropdown-item {
160
- @apply gl-text-sm;
161
- @apply gl-px-3;
162
- @apply gl-bg-transparent;
163
-
164
- &:hover {
165
- @apply gl-bg-transparent;
166
- }
167
- }
168
- }