@gitlab/ui 94.4.2 → 94.6.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 (77) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/experimental/duo/chat/components/duo_chat_context/constants.js +4 -1
  3. package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +10 -3
  4. package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +12 -21
  5. package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +5 -11
  6. package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +60 -3
  7. package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +71 -1
  8. package/dist/index.css +2 -2
  9. package/dist/index.css.map +1 -1
  10. package/dist/tailwind.css +1 -1
  11. package/dist/tailwind.css.map +1 -1
  12. package/dist/tokens/build/js/tokens.dark.js +1 -1
  13. package/dist/tokens/css/tokens.css +1 -1
  14. package/dist/tokens/css/tokens.dark.css +2 -2
  15. package/dist/tokens/js/tokens.dark.js +1 -1
  16. package/dist/tokens/json/tokens.dark.json +6 -3
  17. package/dist/tokens/json/tokens.json +5 -2
  18. package/dist/tokens/scss/_tokens.dark.scss +2 -2
  19. package/dist/tokens/scss/_tokens.scss +1 -1
  20. package/dist/tokens/tailwind/tokens.cjs +1 -1
  21. package/package.json +3 -3
  22. package/src/components/base/avatar_labeled/avatar_labeled.scss +1 -1
  23. package/src/components/base/breadcrumb/breadcrumb.scss +2 -2
  24. package/src/components/base/broadcast_message/broadcast_message.scss +1 -1
  25. package/src/components/base/button/button.scss +6 -6
  26. package/src/components/base/datepicker/datepicker.scss +7 -7
  27. package/src/components/base/daterange_picker/daterange_picker.scss +2 -2
  28. package/src/components/base/drawer/drawer.scss +3 -3
  29. package/src/components/base/dropdown/dropdown.scss +2 -2
  30. package/src/components/base/dropdown/dropdown_item.scss +4 -4
  31. package/src/components/base/filtered_search/filtered_search_suggestion_list.scss +1 -1
  32. package/src/components/base/filtered_search/filtered_search_term.scss +1 -1
  33. package/src/components/base/filtered_search/filtered_search_token.scss +3 -3
  34. package/src/components/base/filtered_search/filtered_search_token_segment.scss +2 -2
  35. package/src/components/base/form/form_checkbox/form_checkbox.scss +4 -4
  36. package/src/components/base/form/form_input/form_input.scss +3 -3
  37. package/src/components/base/form/form_select/form_select.scss +3 -3
  38. package/src/components/base/label/label.scss +4 -4
  39. package/src/components/base/loading_icon/loading_icon.scss +1 -1
  40. package/src/components/base/markdown/markdown.scss +3 -3
  41. package/src/components/base/markdown/markdown_typescale_demo.html +4 -4
  42. package/src/components/base/modal/modal.scss +1 -1
  43. package/src/components/base/new_dropdowns/dropdown.scss +3 -3
  44. package/src/components/base/new_dropdowns/dropdown_item.scss +2 -2
  45. package/src/components/base/pagination/pagination.scss +1 -1
  46. package/src/components/base/path/path.scss +3 -3
  47. package/src/components/base/popover/popover.scss +1 -1
  48. package/src/components/base/search_box_by_type/search_box_by_type.scss +1 -1
  49. package/src/components/base/segmented_control/segmented_control.scss +3 -3
  50. package/src/components/base/skeleton_loader/skeleton_loader.scss +1 -1
  51. package/src/components/base/tabs/tabs/tabs.scss +4 -4
  52. package/src/components/base/toast/toast.scss +1 -1
  53. package/src/components/base/toggle/toggle.scss +3 -3
  54. package/src/components/charts/heatmap/heatmap.scss +1 -1
  55. package/src/components/charts/legend/legend.scss +2 -2
  56. package/src/components/charts/tooltip/tooltip.scss +1 -1
  57. package/src/components/experimental/duo/chat/components/duo_chat_context/constants.js +4 -0
  58. package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +19 -6
  59. package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +33 -31
  60. package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +16 -18
  61. package/src/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +64 -1
  62. package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +75 -0
  63. package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.scss +4 -4
  64. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +2 -2
  65. package/src/components/experimental/duo/chat/duo_chat.scss +4 -4
  66. package/src/components/shared_components/clear_icon_button/clear_icon_button.scss +1 -1
  67. package/src/scss/typescale/_index.scss +2 -2
  68. package/src/tokens/background.tokens.json +5 -2
  69. package/src/tokens/build/css/tokens.css +1 -1
  70. package/src/tokens/build/css/tokens.dark.css +2 -2
  71. package/src/tokens/build/js/tokens.dark.js +1 -1
  72. package/src/tokens/build/json/tokens.dark.json +6 -3
  73. package/src/tokens/build/json/tokens.json +5 -2
  74. package/src/tokens/build/scss/_tokens.dark.scss +2 -2
  75. package/src/tokens/build/scss/_tokens.scss +1 -1
  76. package/src/tokens/build/tailwind/tokens.cjs +1 -1
  77. package/translations.js +6 -3
@@ -47,7 +47,7 @@
47
47
  .custom-control-input:disabled,
48
48
  .custom-control-input:disabled ~ .custom-control-label,
49
49
  .custom-control-input:disabled ~ .custom-control-label > .help-text {
50
- @include gl-cursor-not-allowed;
50
+ @apply gl-cursor-not-allowed;
51
51
  color: var(--gl-text-color-disabled);
52
52
  }
53
53
 
@@ -55,7 +55,7 @@
55
55
  @apply gl-pl-5;
56
56
 
57
57
  .custom-control-input ~ .custom-control-label {
58
- @include gl-cursor-pointer;
58
+ @apply gl-cursor-pointer;
59
59
  @apply gl-pl-3;
60
60
  @apply gl-mb-3;
61
61
 
@@ -171,10 +171,10 @@
171
171
  }
172
172
 
173
173
  .custom-control-input:disabled ~ .custom-control-label {
174
- @include gl-cursor-not-allowed;
174
+ @apply gl-cursor-not-allowed;
175
175
 
176
176
  &::before {
177
- @include gl-pointer-events-auto;
177
+ @apply gl-pointer-events-auto;
178
178
  background-color: var(--gl-control-background-color-disabled);
179
179
  border-color: var(--gl-control-border-color-disabled);
180
180
 
@@ -1,6 +1,6 @@
1
1
  .gl-form-input,
2
2
  .gl-form-input.form-control {
3
- @include gl-font-regular;
3
+ @apply gl-font-regular;
4
4
  @apply gl-text-base;
5
5
  @apply gl-leading-normal;
6
6
  @apply gl-py-3;
@@ -28,7 +28,7 @@
28
28
  }
29
29
 
30
30
  &:disabled {
31
- @include gl-cursor-not-allowed;
31
+ @apply gl-cursor-not-allowed;
32
32
  background: var(--gl-control-background-color-disabled);
33
33
  box-shadow: inset 0 0 0 $gl-border-size-1 var(--gl-control-border-color-disabled);
34
34
  color: var(--gl-text-color-disabled);
@@ -53,7 +53,7 @@
53
53
  }
54
54
 
55
55
  &.form-control-plaintext {
56
- @include gl-shadow-none;
56
+ @apply gl-shadow-none;
57
57
  }
58
58
  }
59
59
 
@@ -10,8 +10,8 @@ See: https://gitlab.com/gitlab-org/gitlab/issues/30055
10
10
  /* stylelint-disable property-no-vendor-prefix */
11
11
  .gl-form-select {
12
12
  @apply gl-text-base;
13
- @include gl-font-regular;
14
- @include gl-opacity-10;
13
+ @apply gl-font-regular;
14
+ @apply gl-opacity-10;
15
15
  @apply gl-leading-normal;
16
16
  @apply gl-py-3;
17
17
  @apply gl-pl-4;
@@ -42,7 +42,7 @@ See: https://gitlab.com/gitlab-org/gitlab/issues/30055
42
42
  }
43
43
 
44
44
  &:disabled {
45
- @include gl-cursor-not-allowed;
45
+ @apply gl-cursor-not-allowed;
46
46
  color: var(--gl-text-color-disabled);
47
47
  background-color: var(--gl-control-background-color-disabled);
48
48
  box-shadow: inset 0 0 0 $gl-border-size-1 var(--gl-control-border-color-disabled);
@@ -10,7 +10,7 @@ $label-padding-horizontal-half: 0.375 * $grid-size;
10
10
  @apply gl-inline-flex;
11
11
  @apply gl-rounded-pill;
12
12
  position: relative;
13
- @include gl-max-w-full;
13
+ @apply gl-max-w-full;
14
14
  @apply gl-text-sm;
15
15
  @apply gl-leading-normal;
16
16
  box-shadow: var(--label-inset-border) !important;
@@ -32,13 +32,13 @@ $label-padding-horizontal-half: 0.375 * $grid-size;
32
32
  @apply gl-font-normal;
33
33
  @apply gl-overflow-hidden;
34
34
  @apply gl-text-inherit;
35
- @include gl-max-w-full;
35
+ @apply gl-max-w-full;
36
36
 
37
37
  &:hover,
38
38
  &:focus,
39
39
  &:focus:active {
40
40
  @apply gl-text-inherit;
41
- @include gl-shadow-none;
41
+ @apply gl-shadow-none;
42
42
  @include gl-outline-none;
43
43
  }
44
44
  }
@@ -72,7 +72,7 @@ $label-padding-horizontal-half: 0.375 * $grid-size;
72
72
  margin-right: $label-padding-horizontal-half;
73
73
  @apply gl-p-0;
74
74
  @apply gl-rounded-full;
75
- @include gl-shadow-none;
75
+ @apply gl-shadow-none;
76
76
 
77
77
  &:focus,
78
78
  &:active {
@@ -38,7 +38,7 @@ $gl-loader-dots-size-xl: 1rem;
38
38
  @apply gl-inline-flex;
39
39
  @apply gl-rounded-full;
40
40
  @apply gl-border-solid;
41
- @include gl-mx-auto;
41
+ @apply gl-mx-auto;
42
42
  @apply gl-my-0;
43
43
  @apply gl-text-base;
44
44
 
@@ -2,7 +2,7 @@
2
2
  @apply gl-text-lg;
3
3
  @apply gl-leading-24;
4
4
  color: $gl-text-color;
5
- @include gl-font-regular;
5
+ @apply gl-font-regular;
6
6
  @apply gl-font-normal;
7
7
 
8
8
  :first-child {
@@ -68,7 +68,7 @@
68
68
 
69
69
  .monospace,
70
70
  code {
71
- @include gl-font-monospace;
71
+ @apply gl-font-monospace;
72
72
  }
73
73
 
74
74
  blockquote {
@@ -211,7 +211,7 @@
211
211
 
212
212
  .monospace,
213
213
  code {
214
- @include gl-font-monospace;
214
+ @apply gl-font-monospace;
215
215
  }
216
216
 
217
217
  table {
@@ -135,15 +135,15 @@
135
135
  </p>
136
136
  <p>Code block</p>
137
137
  <pre class="code"><code>pre {
138
- @include gl-py-4;
139
- @include gl-px-6;
138
+ @apply gl-py-4;
139
+ @apply gl-px-6;
140
140
 
141
141
  code {
142
142
  @apply gl-bg-white;
143
143
  @apply gl-rounded-none;
144
144
  @apply gl-text-gray-900;
145
- @include gl-px-0;
146
- @include gl-py-0;
145
+ @apply gl-px-0;
146
+ @apply gl-py-0;
147
147
  }
148
148
  }
149
149
  </code></pre>
@@ -120,7 +120,7 @@ body.modal-open {
120
120
 
121
121
  @include media-breakpoint-up(sm) {
122
122
  .modal-dialog {
123
- @include gl-mx-auto;
123
+ @apply gl-mx-auto;
124
124
  @apply gl-my-0;
125
125
  @apply gl-flex;
126
126
  @apply gl-items-center;
@@ -4,7 +4,7 @@
4
4
 
5
5
  .gl-new-dropdown-custom-toggle {
6
6
  *:first-child {
7
- @include gl-cursor-pointer;
7
+ @apply gl-cursor-pointer;
8
8
 
9
9
  &:focus {
10
10
  @apply gl-focus;
@@ -17,7 +17,7 @@
17
17
  @apply gl-bg-white;
18
18
  @apply gl-border-1 gl-border-solid gl-border-gray-200;
19
19
  @apply gl-rounded-lg;
20
- @include gl-shadow-md;
20
+ @apply gl-shadow-md;
21
21
  top: 0;
22
22
  left: 0;
23
23
  min-width: $gl-new-dropdown-min-width;
@@ -71,7 +71,7 @@
71
71
  }
72
72
 
73
73
  .gl-new-dropdown-button-text {
74
- @include gl-mr-auto;
74
+ @apply gl-mr-auto;
75
75
  @apply gl-overflow-hidden;
76
76
  @apply gl-text-ellipsis;
77
77
  }
@@ -1,5 +1,5 @@
1
1
  .gl-new-dropdown-item {
2
- @include gl-cursor-pointer;
2
+ @apply gl-cursor-pointer;
3
3
  @apply gl-px-2;
4
4
  @apply gl-my-1;
5
5
 
@@ -109,7 +109,7 @@
109
109
  }
110
110
 
111
111
  .gl-new-dropdown-item-text-wrapper {
112
- @include gl-min-w-0;
112
+ @apply gl-min-w-0;
113
113
  @apply gl-grow;
114
114
  @apply gl-py-3;
115
115
  }
@@ -51,7 +51,7 @@
51
51
  @apply gl-border-blue-500;
52
52
  @apply gl-text-white;
53
53
  @apply gl-z-2;
54
- @include gl-shadow-none;
54
+ @apply gl-shadow-none;
55
55
 
56
56
  &:focus {
57
57
  @include gl-focus();
@@ -41,7 +41,7 @@ $path-chevron-right-margin: px-to-rem(14px);
41
41
  }
42
42
 
43
43
  .gl-path-nav-list-item {
44
- @include gl-min-w-fit-content;
44
+ @apply gl-min-w-fit;
45
45
  padding-top: 1px;
46
46
  padding-bottom: 1px;
47
47
 
@@ -56,7 +56,7 @@ $path-chevron-right-margin: px-to-rem(14px);
56
56
  @apply gl-py-3;
57
57
  @apply gl-flex;
58
58
  @apply gl-text-base;
59
- @include gl-z-index-0;
59
+ @apply gl-z-0;
60
60
  @apply gl-font-bold;
61
61
  @apply gl-leading-normal;
62
62
  @apply gl-rounded-tl-base;
@@ -120,7 +120,7 @@ $path-chevron-right-margin: px-to-rem(14px);
120
120
  }
121
121
 
122
122
  &:disabled {
123
- @include gl-cursor-not-allowed;
123
+ @apply gl-cursor-not-allowed;
124
124
  background-color: var(--gl-color-alpha-0);
125
125
  box-shadow: none;
126
126
  color: var(--gl-action-disabled-foreground-color);
@@ -5,7 +5,7 @@ $gl-popover-max-width: $grid-size * 35;
5
5
  .gl-popover {
6
6
  max-width: $gl-popover-max-width;
7
7
  @apply gl-border-none;
8
- @include gl-shadow-md;
8
+ @apply gl-shadow-md;
9
9
  @apply gl-text-sm;
10
10
 
11
11
  &,
@@ -43,7 +43,7 @@ $gl-search-box-by-type-input-padding: 3.5 * $grid-size;
43
43
  @apply gl-leading-normal;
44
44
  @apply gl-pl-7;
45
45
  @apply gl-py-4;
46
- @include gl-shadow-none;
46
+ @apply gl-shadow-none;
47
47
  @apply gl-w-full;
48
48
  border-radius: 0;
49
49
  padding-right: calc(#{$gl-spacing-scale-6} + #{$gl-spacing-scale-2});
@@ -29,7 +29,7 @@
29
29
 
30
30
  .gl-segmented-control {
31
31
  label:not(.disabled) {
32
- @include gl-cursor-pointer;
32
+ @apply gl-cursor-pointer;
33
33
  }
34
34
 
35
35
  .btn-gl-segmented-button {
@@ -86,8 +86,8 @@
86
86
  &[disabled]:hover {
87
87
  @apply gl-text-gray-400;
88
88
  @include gl-inset-border-y-1-gray-200;
89
- @include gl-z-index-0;
90
- @include gl-cursor-not-allowed;
89
+ @apply gl-z-0;
90
+ @apply gl-cursor-not-allowed;
91
91
 
92
92
  &:first-child {
93
93
  @include gl-btn-gl-segmented-button-first;
@@ -4,7 +4,7 @@
4
4
 
5
5
  .gl-skeleton-loader {
6
6
  stop {
7
- @include gl-opacity-10;
7
+ @apply gl-opacity-10;
8
8
  }
9
9
 
10
10
  .background-stop {
@@ -47,12 +47,12 @@
47
47
  }
48
48
 
49
49
  &.disabled {
50
- @include gl-pointer-events-auto;
51
- @include gl-cursor-not-allowed;
50
+ @apply gl-pointer-events-auto;
51
+ @apply gl-cursor-not-allowed;
52
52
  color: var(--gl-action-disabled-foreground-color);
53
53
 
54
54
  &:hover {
55
- @include gl-shadow-none;
55
+ @apply gl-shadow-none;
56
56
  }
57
57
  }
58
58
 
@@ -160,5 +160,5 @@
160
160
  .gl-scrollable-tabs-nav {
161
161
  @apply gl-overflow-hidden;
162
162
  position: relative;
163
- @include gl-flex-nowrap;
163
+ @apply gl-flex-nowrap;
164
164
  }
@@ -52,7 +52,7 @@
52
52
  @apply gl-text-base;
53
53
  @apply gl-whitespace-nowrap;
54
54
  @apply gl-font-bold;
55
- @include gl-cursor-pointer;
55
+ @apply gl-cursor-pointer;
56
56
  }
57
57
 
58
58
  .gl-toast-close-button {
@@ -28,10 +28,10 @@ $toggle-height: 2.5 * $grid-size;
28
28
  @apply gl-inline-flex;
29
29
 
30
30
  &.is-disabled {
31
- @include gl-cursor-not-allowed;
31
+ @apply gl-cursor-not-allowed;
32
32
 
33
33
  .gl-toggle {
34
- @include gl-cursor-not-allowed;
34
+ @apply gl-cursor-not-allowed;
35
35
  @apply gl-bg-gray-200;
36
36
 
37
37
  .toggle-icon > svg {
@@ -85,7 +85,7 @@ $toggle-height: 2.5 * $grid-size;
85
85
  @apply gl-items-center;
86
86
  @apply gl-justify-center;
87
87
  @apply gl-border-0;
88
- @include gl-cursor-pointer;
88
+ @apply gl-cursor-pointer;
89
89
  @apply gl-bg-gray-600;
90
90
  position: relative;
91
91
  width: $toggle-width;
@@ -2,6 +2,6 @@
2
2
  position: relative;
3
3
 
4
4
  .gl-legend-inline-series {
5
- @include gl-pointer-events-none;
5
+ @apply gl-pointer-events-none;
6
6
  }
7
7
  }
@@ -29,7 +29,7 @@ $legend-body-h: $gl-spacing-scale-13 - $gl-spacing-scale-4;
29
29
 
30
30
  .gl-legend-inline {
31
31
  @apply gl-flex;
32
- @include gl-flex-wrap;
32
+ @apply gl-flex-wrap;
33
33
  @apply gl-shrink-0;
34
34
 
35
35
  .gl-legend-inline-series {
@@ -40,7 +40,7 @@ $legend-body-h: $gl-spacing-scale-13 - $gl-spacing-scale-4;
40
40
  @apply gl-pr-5;
41
41
 
42
42
  &:hover {
43
- @include gl-cursor-pointer;
43
+ @apply gl-cursor-pointer;
44
44
  @apply gl-underline;
45
45
  }
46
46
 
@@ -2,7 +2,7 @@
2
2
  position: absolute;
3
3
 
4
4
  > .popover {
5
- @include gl-min-w-0;
5
+ @apply gl-min-w-0;
6
6
  @apply gl-w-max;
7
7
  max-width: $chart-tooltip-max-width;
8
8
  }
@@ -1,3 +1,7 @@
1
1
  export const CONTEXT_ITEM_CATEGORY_ISSUE = 'issue';
2
2
  export const CONTEXT_ITEM_CATEGORY_MERGE_REQUEST = 'merge_request';
3
3
  export const CONTEXT_ITEM_CATEGORY_FILE = 'file';
4
+ export const CONTEXT_ITEM_CATEGORY_LOCAL_GIT = 'local_git';
5
+
6
+ export const CONTEXT_ITEM_LOCAL_GIT_COMMIT = 'commit';
7
+ export const CONTEXT_ITEM_LOCAL_GIT_DIFF = 'diff';
@@ -1,21 +1,25 @@
1
1
  <script>
2
2
  import GlDuoChatContextItemPopover from '../duo_chat_context_item_popover/duo_chat_context_item_popover.vue';
3
+ import GlTruncate from '../../../../../../utilities/truncate/truncate.vue';
3
4
  import GlIcon from '../../../../../../base/icon/icon.vue';
4
5
  import {
5
6
  categoryValidator,
6
7
  contextItemValidator,
8
+ formatGitItemSecondaryText,
7
9
  formatIssueId,
8
10
  formatMergeRequestId,
11
+ getContextItemIcon,
9
12
  } from '../utils';
10
13
  import {
14
+ CONTEXT_ITEM_CATEGORY_FILE,
11
15
  CONTEXT_ITEM_CATEGORY_ISSUE,
16
+ CONTEXT_ITEM_CATEGORY_LOCAL_GIT,
12
17
  CONTEXT_ITEM_CATEGORY_MERGE_REQUEST,
13
- CONTEXT_ITEM_CATEGORY_FILE,
14
18
  } from '../constants';
15
19
 
16
20
  export default {
17
21
  name: 'GlDuoChatContextItemMenuSearchItem',
18
- components: { GlIcon, GlDuoChatContextItemPopover },
22
+ components: { GlTruncate, GlIcon, GlDuoChatContextItemPopover },
19
23
  props: {
20
24
  category: {
21
25
  type: Object,
@@ -40,18 +44,23 @@ export default {
40
44
  return formatIssueId(this.contextItem.metadata.iid);
41
45
  case CONTEXT_ITEM_CATEGORY_MERGE_REQUEST:
42
46
  return formatMergeRequestId(this.contextItem.metadata.iid);
47
+ case CONTEXT_ITEM_CATEGORY_LOCAL_GIT:
48
+ return formatGitItemSecondaryText(this.contextItem);
43
49
  default:
44
50
  return '';
45
51
  }
46
52
  },
53
+ icon() {
54
+ return getContextItemIcon(this.contextItem, this.category);
55
+ },
47
56
  },
48
57
  };
49
58
  </script>
50
59
  <template>
51
60
  <div class="gl-flex gl-flex-col">
52
61
  <div class="gl-flex gl-items-center">
53
- <gl-icon :name="category.icon" class="gl-mr-2 gl-shrink-0" data-testid="category-icon" />
54
- <span>{{ title }}</span>
62
+ <gl-icon :name="icon" class="gl-mr-2 gl-shrink-0" data-testid="category-icon" />
63
+ <gl-truncate :text="title" class="gl-min-w-0" data-testid="item-title" />
55
64
  <gl-icon
56
65
  :id="`info-icon-${contextItem.id}`"
57
66
  name="information-o"
@@ -64,8 +73,12 @@ export default {
64
73
  placement="left"
65
74
  />
66
75
  </div>
67
- <div class="gl-mt-1 gl-shrink-0 gl-whitespace-nowrap gl-text-secondary">
68
- {{ secondaryText }}
76
+ <div
77
+ v-if="secondaryText"
78
+ class="gl-mt-1 gl-shrink-0 gl-whitespace-nowrap gl-text-secondary"
79
+ data-testid="item-secondary-text"
80
+ >
81
+ <gl-truncate :text="secondaryText" />
69
82
  </div>
70
83
  </div>
71
84
  </template>
@@ -1,18 +1,27 @@
1
1
  <script>
2
- import GlPopover from '../../../../../../base/popover/popover.vue';
2
+ import GlAlert from '../../../../../../base/alert/alert.vue';
3
3
  import GlIcon from '../../../../../../base/icon/icon.vue';
4
+ import GlPopover from '../../../../../../base/popover/popover.vue';
5
+ import GlTruncate from '../../../../../../utilities/truncate/truncate.vue';
4
6
  import { translate } from '../../../../../../../utils/i18n';
5
7
  import {
8
+ CONTEXT_ITEM_CATEGORY_FILE,
6
9
  CONTEXT_ITEM_CATEGORY_ISSUE,
10
+ CONTEXT_ITEM_CATEGORY_LOCAL_GIT,
7
11
  CONTEXT_ITEM_CATEGORY_MERGE_REQUEST,
8
- CONTEXT_ITEM_CATEGORY_FILE,
9
12
  } from '../constants';
10
- import { formatIssueId, formatMergeRequestId } from '../utils';
11
- import GlAlert from '../../../../../../base/alert/alert.vue';
13
+ import {
14
+ formatGitItemSecondaryText,
15
+ formatIssueId,
16
+ formatMergeRequestId,
17
+ getContextItemIcon,
18
+ getContextItemTypeLabel,
19
+ } from '../utils';
12
20
 
13
21
  export default {
14
22
  name: 'DuoChatContextItemPopover',
15
23
  components: {
24
+ GlTruncate,
16
25
  GlAlert,
17
26
  GlIcon,
18
27
  GlPopover,
@@ -69,6 +78,11 @@ export default {
69
78
  filePathArray() {
70
79
  return this.filePath?.split('/');
71
80
  },
81
+ gitDetails() {
82
+ return this.contextItem.category === CONTEXT_ITEM_CATEGORY_LOCAL_GIT
83
+ ? formatGitItemSecondaryText(this.contextItem)
84
+ : null;
85
+ },
72
86
  isEnabled() {
73
87
  return this.contextItem.metadata.enabled !== false;
74
88
  },
@@ -79,24 +93,10 @@ export default {
79
93
  : translate('DuoChatContextItemPopover.DisabledReason', 'This item is disabled');
80
94
  },
81
95
  iconName() {
82
- switch (this.contextItem.category) {
83
- case 'merge_request':
84
- return 'merge-request';
85
- case 'issue':
86
- return 'issues';
87
- default:
88
- return 'project';
89
- }
96
+ return getContextItemIcon(this.contextItem);
90
97
  },
91
98
  itemTypeLabel() {
92
- switch (this.contextItem.category) {
93
- case 'merge_request':
94
- return translate('DuoChatContextItemPopover.MergeRequest', 'Merge request');
95
- case 'issue':
96
- return translate('DuoChatContextItemPopover.Issue', 'Issue');
97
- default:
98
- return translate('DuoChatContextItemPopover.File', 'Project file');
99
- }
99
+ return getContextItemTypeLabel(this.contextItem);
100
100
  },
101
101
  },
102
102
  methods: {
@@ -118,25 +118,27 @@ export default {
118
118
  class="gl-heading-3 gl-mb-1 gl-mt-2 gl-leading-1"
119
119
  data-testid="chat-context-popover-title"
120
120
  >
121
- {{ contextItem.metadata.title }}
121
+ {{ title }}
122
122
  </div>
123
- <div class="gl-font-normal gl-text-subtle">{{ itemTypeLabel }}</div>
123
+ <div v-if="itemTypeLabel" class="gl-font-normal gl-text-subtle">{{ itemTypeLabel }}</div>
124
124
  </div>
125
125
  </template>
126
126
  <div>
127
- <div v-if="filePath !== null">
128
- <gl-icon name="document" :size="12" variant="subtle" class="gl-mr-1" /><span
129
- class="gl-break-all"
130
- >{{ contextItem.metadata.project }}</span
131
- ><span v-for="(pathPart, index) in filePathArray" :key="pathPart" class="gl-break-all"
127
+ <div v-if="filePath">
128
+ <gl-icon name="document" :size="12" variant="subtle" />
129
+ <span class="gl-break-all">{{ contextItem.metadata.project }}</span>
130
+ <span v-for="(pathPart, index) in filePathArray" :key="pathPart" class="gl-break-all"
132
131
  >{{ pathPart }}{{ index + 1 < filePathArray.length ? '/' : '' }}</span
133
132
  >
134
133
  </div>
134
+ <div v-else-if="gitDetails" class="gl-flex gl-items-center" data-testid="git-details">
135
+ <gl-icon :name="iconName" :size="12" variant="subtle" class="gl-mr-1 gl-shrink-0" />
136
+ <gl-truncate :text="gitDetails" class="gl-min-w-0" />
137
+ </div>
135
138
  <div v-else>
136
- <gl-icon :name="iconName" :size="12" variant="subtle" class="gl-mr-1" /><span
137
- class="gl-break-all"
138
- >{{ contextItem.metadata.project }}</span
139
- ><span v-if="id !== null" class="gl-break-all">{{ formattedId }}</span>
139
+ <gl-icon v-if="iconName" :name="iconName" :size="12" variant="subtle" />
140
+ <span class="gl-break-all">{{ contextItem.metadata.project }}</span>
141
+ <span v-if="id" class="gl-break-all">{{ formattedId }}</span>
140
142
  </div>
141
143
  <gl-alert
142
144
  v-if="!isEnabled"
@@ -2,17 +2,14 @@
2
2
  import uniqueId from 'lodash/uniqueId';
3
3
  import GlIcon from '../../../../../../base/icon/icon.vue';
4
4
  import GlToken from '../../../../../../base/token/token.vue';
5
+ import GlTruncate from '../../../../../../utilities/truncate/truncate.vue';
5
6
  import GlDuoChatContextItemPopover from '../duo_chat_context_item_popover/duo_chat_context_item_popover.vue';
6
- import {
7
- CONTEXT_ITEM_CATEGORY_ISSUE,
8
- CONTEXT_ITEM_CATEGORY_MERGE_REQUEST,
9
- CONTEXT_ITEM_CATEGORY_FILE,
10
- } from '../constants';
11
- import { contextItemsValidator } from '../utils';
7
+ import { contextItemsValidator, getContextItemIcon } from '../utils';
12
8
 
13
9
  export default {
14
10
  name: 'GlDuoChatContextItemSelections',
15
11
  components: {
12
+ GlTruncate,
16
13
  GlIcon,
17
14
  GlDuoChatContextItemPopover,
18
15
  GlToken,
@@ -78,14 +75,7 @@ export default {
78
75
  },
79
76
  },
80
77
  methods: {
81
- getIconName(category) {
82
- const iconMap = {
83
- [CONTEXT_ITEM_CATEGORY_FILE]: 'document',
84
- [CONTEXT_ITEM_CATEGORY_ISSUE]: 'issues',
85
- [CONTEXT_ITEM_CATEGORY_MERGE_REQUEST]: 'merge-request',
86
- };
87
- return iconMap[category] || 'document';
88
- },
78
+ getContextItemIcon,
89
79
  toggleCollapse() {
90
80
  this.isCollapsed = !this.isCollapsed;
91
81
  },
@@ -122,13 +112,21 @@ export default {
122
112
  :key="item.id"
123
113
  :view-only="!removable"
124
114
  variant="default"
125
- class="gl-mb-2 gl-mr-2"
115
+ class="gl-mb-2 gl-mr-2 gl-max-w-full"
126
116
  :class="tokenVariantClasses"
127
117
  @close="onRemoveItem(item)"
128
118
  >
129
- <div :id="`context-item-${item.id}-${selectionsId}`" class="gl-flex gl-items-center">
130
- <gl-icon :name="getIconName(item.category)" :size="12" class="gl-mr-1" />
131
- {{ item.metadata.title }}
119
+ <div
120
+ :id="`context-item-${item.id}-${selectionsId}`"
121
+ class="gl-flex gl-min-w-0 gl-items-center"
122
+ >
123
+ <gl-icon
124
+ v-if="getContextItemIcon(item)"
125
+ :name="getContextItemIcon(item)"
126
+ :size="12"
127
+ class="gl-mr-1"
128
+ />
129
+ <gl-truncate :text="item.metadata.title" position="middle" />
132
130
  </div>
133
131
  <gl-duo-chat-context-item-popover
134
132
  :context-item="item"