@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.
- package/CHANGELOG.md +14 -0
- package/dist/components/experimental/duo/chat/duo_chat.js +5 -2
- package/dist/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.js +100 -0
- package/dist/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.js +238 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +2 -0
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/tokens_table.js +64 -5
- package/package.json +4 -4
- package/src/components/base/avatar/avatar.scss +2 -2
- package/src/components/base/broadcast_message/broadcast_message.scss +2 -2
- package/src/components/base/button/button.scss +1 -1
- package/src/components/base/card/card.scss +1 -1
- package/src/components/base/datepicker/datepicker.scss +3 -3
- package/src/components/base/dropdown/dropdown.scss +2 -2
- package/src/components/base/filtered_search/filtered_search.scss +1 -1
- package/src/components/base/markdown/markdown.scss +3 -3
- package/src/components/base/modal/modal.scss +1 -1
- package/src/components/base/new_dropdowns/dropdown_item.scss +2 -2
- package/src/components/base/segmented_control/segmented_control.scss +1 -1
- package/src/components/base/toast/toast.scss +1 -1
- package/src/components/base/tooltip/tooltip.scss +1 -1
- package/src/components/charts/single_stat/single_stat.scss +1 -1
- package/src/components/experimental/duo/chat/duo_chat.scss +1 -1
- package/src/components/experimental/duo/chat/duo_chat.vue +3 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.md +29 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.vue +87 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.md +37 -0
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.vue +261 -0
- package/src/index.js +2 -0
- package/src/tokens/tokens_table.vue +99 -13
- package/translations.js +12 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import GlIcon from '../../../../../base/icon/icon.vue';
|
|
3
|
+
import GlCollapse from '../../../../../base/collapse/collapse.vue';
|
|
4
|
+
import GlButton from '../../../../../base/button/button.vue';
|
|
5
|
+
import { GlTooltipDirective as GlTooltip } from '../../../../../../directives/tooltip';
|
|
6
|
+
import { translate } from '../../../../../../utils/i18n';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: 'GlDuoWorkflowPanel',
|
|
10
|
+
components: { GlCollapse, GlButton, GlIcon },
|
|
11
|
+
directives: { GlTooltip },
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* The icon to show in the header.
|
|
15
|
+
*/
|
|
16
|
+
headerIcon: {
|
|
17
|
+
type: String,
|
|
18
|
+
required: false,
|
|
19
|
+
default: '',
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* The text used as the title and aria-label for the button when the collapse is collapsed
|
|
23
|
+
*/
|
|
24
|
+
expandPanelButtonTitle: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: false,
|
|
27
|
+
default: translate('GlDuoWorkflowPanel.expandButtonTitle', 'Expand'),
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* The text used as the title and aria-label for the button when the collapse is expanded
|
|
31
|
+
*/
|
|
32
|
+
collapsePanelButtonTitle: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: false,
|
|
35
|
+
default: translate('GlDuoWorkflowPanel.collapseButtonTitle', 'Collapse'),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
data() {
|
|
39
|
+
return { expanded: true };
|
|
40
|
+
},
|
|
41
|
+
computed: {
|
|
42
|
+
buttonIcon() {
|
|
43
|
+
return this.expanded ? 'chevron-up' : 'chevron-down';
|
|
44
|
+
},
|
|
45
|
+
buttonTitle() {
|
|
46
|
+
return this.expanded ? this.collapsePanelButtonTitle : this.expandPanelButtonTitle;
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
methods: {
|
|
50
|
+
toggleExpanded() {
|
|
51
|
+
this.expanded = !this.expanded;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
</script>
|
|
56
|
+
<template>
|
|
57
|
+
<div>
|
|
58
|
+
<div class="gl-flex gl-flex-nowrap gl-items-center">
|
|
59
|
+
<gl-icon v-if="headerIcon" :name="headerIcon" :size="24" class="gl-mr-3" />
|
|
60
|
+
<div class="gl-flex gl-flex-grow gl-items-baseline">
|
|
61
|
+
<h2 class="gl-mb-0">
|
|
62
|
+
<!-- @slot Panel title. -->
|
|
63
|
+
<slot name="title"></slot>
|
|
64
|
+
</h2>
|
|
65
|
+
<small class="gl-ml-3">
|
|
66
|
+
<!-- @slot Panel subtitle. -->
|
|
67
|
+
<slot name="subtitle"></slot
|
|
68
|
+
></small>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<gl-button
|
|
72
|
+
v-gl-tooltip
|
|
73
|
+
category="tertiary"
|
|
74
|
+
:icon="buttonIcon"
|
|
75
|
+
:title="buttonTitle"
|
|
76
|
+
:aria-label="buttonTitle"
|
|
77
|
+
@click="toggleExpanded"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
<gl-collapse :visible="expanded">
|
|
81
|
+
<div class="gl-ml-7 gl-mt-4 gl-flex-grow">
|
|
82
|
+
<!-- @slot Panel content. -->
|
|
83
|
+
<slot name="content"></slot>
|
|
84
|
+
</div>
|
|
85
|
+
</gl-collapse>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
This is the UI panel to capture the user's AI prompt for Duo Workflow. This
|
|
2
|
+
prompt is emitted upwards so it may be sent to the Duo Workflow service.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
To use this component, import it and be sure to set the following props:
|
|
7
|
+
|
|
8
|
+
* `prompt`: the prompt the user enters, can be provided if the prompt has been
|
|
9
|
+
cached
|
|
10
|
+
* `summary`: the summary of the goal as provided by the Duo Workflow service,
|
|
11
|
+
displayed adjacent to the title
|
|
12
|
+
* `loading`: sets the loading state for the panel while waiting on responses
|
|
13
|
+
|
|
14
|
+
Also listen to the following events:
|
|
15
|
+
|
|
16
|
+
* `update:prompt`: Emitted when the prompt textarea's `input` event fires, when
|
|
17
|
+
the text within the textarea is changed
|
|
18
|
+
* `update:image`: Emitted when the image input's `input` event fires, when the
|
|
19
|
+
text within the input is changed
|
|
20
|
+
* `confirm`: Emitted when the confirm button is clicked
|
|
21
|
+
* `cancel`: Emitted when the cancel button is clicked
|
|
22
|
+
|
|
23
|
+
Translations for the title of the panel, labels, and other strings can be set via
|
|
24
|
+
the props as documented or via translation configuration:
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
setConfigs({
|
|
28
|
+
translations: {
|
|
29
|
+
'GlDuoWorkflowPrompt.header': __('Plan'),
|
|
30
|
+
'GlDuoWorkflowPrompt.promptLabel': __('Prompt'),
|
|
31
|
+
'GlDuoWorkflowPrompt.promptLabelDescription': __('What is your task?'),
|
|
32
|
+
'GlDuoWorkflowPrompt.promptDescription': __('Be specific and include references!'),
|
|
33
|
+
'GlDuoWorkflowPrompt.confirmButtonText': __('Start plan'),
|
|
34
|
+
'GlDuoWorkflowPrompt.cancelButtonText': __('Stop'),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
```
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import GlDuoWorkflowPanel from '../duo_workflow_panel/duo_workflow_panel.vue';
|
|
3
|
+
import GlButton from '../../../../../base/button/button.vue';
|
|
4
|
+
import GlFormGroup from '../../../../../base/form/form_group/form_group.vue';
|
|
5
|
+
import GlFormTextarea from '../../../../../base/form/form_textarea/form_textarea.vue';
|
|
6
|
+
import GlFormInput from '../../../../../base/form/form_input/form_input.vue';
|
|
7
|
+
import { translate } from '../../../../../../utils/i18n';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
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(
|
|
78
|
+
'GlDuoWorkflowPrompt.promptLabelDescription',
|
|
79
|
+
'What would you like to do and how.'
|
|
80
|
+
),
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* The description of the prompt text area
|
|
84
|
+
*
|
|
85
|
+
* See `GlFormGroup` for text placement.
|
|
86
|
+
*/
|
|
87
|
+
promptDescription: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: false,
|
|
90
|
+
default: translate(
|
|
91
|
+
'GlDuoWorkflowPrompt.promptDescription',
|
|
92
|
+
'Be specific and include any requirements.'
|
|
93
|
+
),
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The HTML ID of the textarea for the prompt
|
|
98
|
+
*/
|
|
99
|
+
promptId: {
|
|
100
|
+
type: String,
|
|
101
|
+
required: false,
|
|
102
|
+
default: 'duo-workflow-prompt',
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* The label of the image input
|
|
106
|
+
*/
|
|
107
|
+
imageLabel: {
|
|
108
|
+
type: String,
|
|
109
|
+
required: false,
|
|
110
|
+
default: translate('GlDuoWorkflowPrompt.imageLabel', 'Image'),
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* The label description of the image input
|
|
114
|
+
*
|
|
115
|
+
* See `GlFormGroup` for text placement.
|
|
116
|
+
*/
|
|
117
|
+
imageLabelDescription: {
|
|
118
|
+
type: String,
|
|
119
|
+
required: false,
|
|
120
|
+
default: translate(
|
|
121
|
+
'GlDuoWorkflowPrompt.imageLabelDescription',
|
|
122
|
+
'The container image to run the workflow in.'
|
|
123
|
+
),
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* The description of the image input
|
|
127
|
+
*
|
|
128
|
+
* See `GlFormGroup` for text placement.
|
|
129
|
+
*/
|
|
130
|
+
imageDescription: {
|
|
131
|
+
type: String,
|
|
132
|
+
required: false,
|
|
133
|
+
default: translate(
|
|
134
|
+
'GlDuoWorkflowPrompt.imageDescription',
|
|
135
|
+
'It should have any tools necessary for the workflow installed.'
|
|
136
|
+
),
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* The ID of the image input
|
|
140
|
+
*/
|
|
141
|
+
imageId: {
|
|
142
|
+
type: String,
|
|
143
|
+
required: false,
|
|
144
|
+
default: 'duo-workflow-image',
|
|
145
|
+
},
|
|
146
|
+
/**
|
|
147
|
+
* The text for the confirmation button. This button emits a `confirm` event.
|
|
148
|
+
*/
|
|
149
|
+
confirmButtonText: {
|
|
150
|
+
type: String,
|
|
151
|
+
required: false,
|
|
152
|
+
default: translate('GlDuoWorkflowPrompt.confirmButtonText', 'Generate plan'),
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* The text for the cancellation button. This button emits a `cancel` event.
|
|
156
|
+
*/
|
|
157
|
+
cancelButtonText: {
|
|
158
|
+
type: String,
|
|
159
|
+
required: false,
|
|
160
|
+
default: translate('GlDuoWorkflowPrompt.cancelButtonText', 'Cancel'),
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* The text used as the title and aria-label for the button when the collapse is collapsed
|
|
164
|
+
*
|
|
165
|
+
* See `GlDuoWorkflowPanel`
|
|
166
|
+
*/
|
|
167
|
+
expandPanelButtonTitle: {
|
|
168
|
+
type: String,
|
|
169
|
+
required: false,
|
|
170
|
+
default: '',
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* The text used as the title and aria-label for the button when the collapse is expanded
|
|
174
|
+
*
|
|
175
|
+
* See `GlDuoWorkflowPanel`
|
|
176
|
+
*/
|
|
177
|
+
collapsePanelButtonTitle: {
|
|
178
|
+
type: String,
|
|
179
|
+
required: false,
|
|
180
|
+
default: '',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
methods: {
|
|
184
|
+
emitChange(prompt) {
|
|
185
|
+
/**
|
|
186
|
+
* Notify listeners about prompt change
|
|
187
|
+
* @param {string} prompt The newly entered prompt
|
|
188
|
+
*/
|
|
189
|
+
this.$emit('update:prompt', prompt);
|
|
190
|
+
},
|
|
191
|
+
emitImage(image) {
|
|
192
|
+
/**
|
|
193
|
+
* Notify listeners about image change
|
|
194
|
+
* @param {string} image The newly entered image
|
|
195
|
+
*/
|
|
196
|
+
this.$emit('update:image', image);
|
|
197
|
+
},
|
|
198
|
+
clickConfirm(event) {
|
|
199
|
+
/**
|
|
200
|
+
* Notify listeners about prompt submission
|
|
201
|
+
* @param {*} event A click event
|
|
202
|
+
*/
|
|
203
|
+
this.$emit('confirm', event);
|
|
204
|
+
},
|
|
205
|
+
clickCancel(event) {
|
|
206
|
+
/**
|
|
207
|
+
* Notify listeners about prompt submission cancellation.
|
|
208
|
+
* @param {*} event A click event
|
|
209
|
+
*/
|
|
210
|
+
this.$emit('cancel', event);
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
</script>
|
|
215
|
+
|
|
216
|
+
<template>
|
|
217
|
+
<gl-duo-workflow-panel
|
|
218
|
+
header-icon="issue-type-objective"
|
|
219
|
+
:expand-panel-button-title="expandPanelButtonTitle"
|
|
220
|
+
:collapse-panel-button-title="collapsePanelButtonTitle"
|
|
221
|
+
>
|
|
222
|
+
<template #title>{{ title }}</template>
|
|
223
|
+
<template #subtitle>{{ summary }}</template>
|
|
224
|
+
<template #content>
|
|
225
|
+
<gl-form-group
|
|
226
|
+
:label="promptLabel"
|
|
227
|
+
:label-for="promptId"
|
|
228
|
+
:label-description="promptLabelDescription"
|
|
229
|
+
:description="promptDescription"
|
|
230
|
+
>
|
|
231
|
+
<gl-form-textarea
|
|
232
|
+
:id="promptId"
|
|
233
|
+
:value="prompt"
|
|
234
|
+
:disable="loading"
|
|
235
|
+
:no-resize="false"
|
|
236
|
+
@input="emitChange"
|
|
237
|
+
/>
|
|
238
|
+
</gl-form-group>
|
|
239
|
+
<gl-form-group
|
|
240
|
+
:label="imageLabel"
|
|
241
|
+
:label-for="imageId"
|
|
242
|
+
:label-description="imageLabelDescription"
|
|
243
|
+
:description="imageDescription"
|
|
244
|
+
>
|
|
245
|
+
<gl-form-input :id="imageId" :value="image" :disable="loading" @input="emitImage" />
|
|
246
|
+
</gl-form-group>
|
|
247
|
+
<div class="gl-flex gl-gap-3">
|
|
248
|
+
<gl-button
|
|
249
|
+
variant="confirm"
|
|
250
|
+
data-test-id="duo-workflow-prompt-confirm"
|
|
251
|
+
:loading="loading"
|
|
252
|
+
@click="clickConfirm"
|
|
253
|
+
>{{ confirmButtonText }}</gl-button
|
|
254
|
+
>
|
|
255
|
+
<gl-button data-test-id="duo-workflow-prompt-cancel" @click="clickCancel">{{
|
|
256
|
+
cancelButtonText
|
|
257
|
+
}}</gl-button>
|
|
258
|
+
</div>
|
|
259
|
+
</template>
|
|
260
|
+
</gl-duo-workflow-panel>
|
|
261
|
+
</template>
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
// Components
|
|
7
7
|
// ADD COMPONENT EXPORTS - needed for yarn generate:component. Do not remove
|
|
8
|
+
export { default as GlDuoWorkflowPrompt } from './components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.vue';
|
|
9
|
+
export { default as GlDuoWorkflowPanel } from './components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.vue';
|
|
8
10
|
export { default as GlTableLite } from './components/base/table_lite/table_lite.vue';
|
|
9
11
|
export { default as GlDropdownForm } from './components/base/dropdown/dropdown_form.vue';
|
|
10
12
|
export { default as GlKeysetPagination } from './components/base/keyset_pagination/keyset_pagination.vue';
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import GlBadge from '../components/base/badge/badge.vue';
|
|
3
|
+
import GlButton from '../components/base/button/button.vue';
|
|
3
4
|
import GlCollapsibleListbox from '../components/base/new_dropdowns/listbox/listbox.vue';
|
|
4
5
|
import GlFormInput from '../components/base/form/form_input/form_input.vue';
|
|
6
|
+
import GlLink from '../components/base/link/link.vue';
|
|
5
7
|
import GlTable from '../components/base/table/table.vue';
|
|
8
|
+
import { GlTooltipDirective } from '../directives/tooltip';
|
|
6
9
|
import TOKENS_DEFAULT from './build/json/tokens.json';
|
|
7
10
|
import TOKENS_DARK from './build/json/tokens.dark.json';
|
|
8
11
|
|
|
@@ -12,10 +15,15 @@ export default {
|
|
|
12
15
|
TOKENS_DARK,
|
|
13
16
|
components: {
|
|
14
17
|
GlBadge,
|
|
18
|
+
GlButton,
|
|
15
19
|
GlCollapsibleListbox,
|
|
16
20
|
GlFormInput,
|
|
21
|
+
GlLink,
|
|
17
22
|
GlTable,
|
|
18
23
|
},
|
|
24
|
+
directives: {
|
|
25
|
+
GlTooltip: GlTooltipDirective,
|
|
26
|
+
},
|
|
19
27
|
fields: [
|
|
20
28
|
{
|
|
21
29
|
key: 'description',
|
|
@@ -29,6 +37,24 @@ export default {
|
|
|
29
37
|
data() {
|
|
30
38
|
return {
|
|
31
39
|
filter: null,
|
|
40
|
+
platforms: [
|
|
41
|
+
{
|
|
42
|
+
value: 'name',
|
|
43
|
+
text: 'Name',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: 'figma',
|
|
47
|
+
text: 'Figma',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
value: 'css',
|
|
51
|
+
text: 'CSS',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
value: 'scss',
|
|
55
|
+
text: 'SCSS',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
32
58
|
modes: [
|
|
33
59
|
{
|
|
34
60
|
value: 'default',
|
|
@@ -39,6 +65,7 @@ export default {
|
|
|
39
65
|
text: 'Dark',
|
|
40
66
|
},
|
|
41
67
|
],
|
|
68
|
+
selectedPlatform: 'name',
|
|
42
69
|
selectedMode: 'default',
|
|
43
70
|
tokens: {
|
|
44
71
|
default: this.$options.TOKENS_DEFAULT,
|
|
@@ -81,7 +108,8 @@ export default {
|
|
|
81
108
|
},
|
|
82
109
|
transformTokenToTableColumns(token) {
|
|
83
110
|
return {
|
|
84
|
-
|
|
111
|
+
id: token.path.filter(Boolean).join('-'),
|
|
112
|
+
name: this.formatTokenName(this.selectedPlatform, token),
|
|
85
113
|
type: token.$type,
|
|
86
114
|
value: token.value,
|
|
87
115
|
valueLabel: this.getValueLabel(token),
|
|
@@ -101,29 +129,79 @@ export default {
|
|
|
101
129
|
}
|
|
102
130
|
});
|
|
103
131
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
132
|
+
tokensArray
|
|
133
|
+
// Sort tokensArray by id
|
|
134
|
+
.sort((a, b) => {
|
|
135
|
+
if (a.id < b.id) {
|
|
136
|
+
return -1;
|
|
137
|
+
}
|
|
138
|
+
if (a.id > b.id) {
|
|
139
|
+
return 1;
|
|
140
|
+
}
|
|
141
|
+
return 0;
|
|
142
|
+
})
|
|
143
|
+
// Sort tokensArray so deprecated items are last
|
|
144
|
+
.sort((a, b) => {
|
|
145
|
+
if (a.deprecated && !b.deprecated) {
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
if (!a.deprecated && b.deprecated) {
|
|
149
|
+
return -1;
|
|
150
|
+
}
|
|
151
|
+
return 0;
|
|
152
|
+
});
|
|
114
153
|
|
|
115
154
|
return tokensArray;
|
|
116
155
|
},
|
|
156
|
+
formatTokenName(format, token) {
|
|
157
|
+
let figmaPrefix = '';
|
|
158
|
+
const prefix = token.prefix === false ? '' : 'gl';
|
|
159
|
+
switch (format) {
|
|
160
|
+
case 'figma':
|
|
161
|
+
if (token.filePath.match('contextual')) {
|
|
162
|
+
figmaPrefix = '🔒/';
|
|
163
|
+
}
|
|
164
|
+
if (token.deprecated) {
|
|
165
|
+
figmaPrefix = '⚠️ DEPRECATED/';
|
|
166
|
+
}
|
|
167
|
+
return `${figmaPrefix}${token.path.filter(Boolean).join('-')}`;
|
|
168
|
+
case 'css':
|
|
169
|
+
return `var(--${[prefix, ...token.path].filter(Boolean).join('-')})`;
|
|
170
|
+
case 'scss':
|
|
171
|
+
return `$${[prefix, ...token.path].filter(Boolean).join('-')}`;
|
|
172
|
+
default:
|
|
173
|
+
return token.path.filter(Boolean).join('.');
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
getTokenName(token) {
|
|
177
|
+
return `$${token.prefix === false ? '' : 'gl-'}${token.path.filter(Boolean).join('-')}`;
|
|
178
|
+
},
|
|
179
|
+
copyToClipboard(value) {
|
|
180
|
+
navigator.clipboard.writeText(value);
|
|
181
|
+
},
|
|
117
182
|
},
|
|
118
183
|
};
|
|
119
184
|
</script>
|
|
120
185
|
|
|
121
186
|
<template>
|
|
122
187
|
<div>
|
|
188
|
+
<p class="gl-text-sm gl-text-subtle">
|
|
189
|
+
For full token details, see
|
|
190
|
+
<gl-link
|
|
191
|
+
href="https://gitlab.com/gitlab-org/gitlab-ui/-/tree/main/src/tokens/build/json"
|
|
192
|
+
target="_blank"
|
|
193
|
+
>https://gitlab.com/gitlab-org/gitlab-ui/-/tree/main/src/tokens/build/json</gl-link
|
|
194
|
+
>
|
|
195
|
+
</p>
|
|
123
196
|
<div class="gl-mb-5 gl-flex gl-items-center gl-gap-3">
|
|
124
197
|
<gl-form-input v-model="filter" placeholder="Type to search" />
|
|
125
198
|
<gl-collapsible-listbox
|
|
126
|
-
|
|
199
|
+
v-model="selectedPlatform"
|
|
200
|
+
:selected="selectedPlatform"
|
|
201
|
+
:items="platforms"
|
|
202
|
+
@search="query = $event"
|
|
203
|
+
/>
|
|
204
|
+
<gl-collapsible-listbox
|
|
127
205
|
v-model="selectedMode"
|
|
128
206
|
:selected="selectedMode"
|
|
129
207
|
:items="modes"
|
|
@@ -134,13 +212,21 @@ export default {
|
|
|
134
212
|
:filter="filter"
|
|
135
213
|
:items="items"
|
|
136
214
|
:fields="$options.fields"
|
|
137
|
-
:tbody-tr-attr="(item) => ({ id: item.
|
|
215
|
+
:tbody-tr-attr="(item) => ({ id: item.id })"
|
|
138
216
|
hover
|
|
139
217
|
stacked="sm"
|
|
140
218
|
>
|
|
141
219
|
<template #cell(description)="{ item: { name, deprecated, description } }">
|
|
142
220
|
<code class="gl-text-base gl-text-strong">
|
|
143
221
|
{{ name }}
|
|
222
|
+
<gl-button
|
|
223
|
+
v-gl-tooltip
|
|
224
|
+
:title="`Copy ${selectedPlatform} value to clipboard`"
|
|
225
|
+
icon="copy-to-clipboard"
|
|
226
|
+
:aria-label="`Copy ${selectedPlatform} value to clipboard`"
|
|
227
|
+
size="small"
|
|
228
|
+
@click="copyToClipboard(name)"
|
|
229
|
+
/>
|
|
144
230
|
</code>
|
|
145
231
|
<gl-badge v-if="deprecated" variant="danger">Deprecated</gl-badge>
|
|
146
232
|
<div v-if="description" class="gl-mt-3 gl-text-subtle">
|
package/translations.js
CHANGED
|
@@ -3,6 +3,18 @@ export default {
|
|
|
3
3
|
'ClearIconButton.title': 'Clear',
|
|
4
4
|
'GlBreadcrumb.showMoreLabel': 'Show more breadcrumbs',
|
|
5
5
|
'GlCollapsibleListbox.srOnlyResultsLabel': null,
|
|
6
|
+
'GlDuoWorkflowPanel.collapseButtonTitle': 'Collapse',
|
|
7
|
+
'GlDuoWorkflowPanel.expandButtonTitle': 'Expand',
|
|
8
|
+
'GlDuoWorkflowPrompt.cancelButtonText': 'Cancel',
|
|
9
|
+
'GlDuoWorkflowPrompt.confirmButtonText': 'Generate plan',
|
|
10
|
+
'GlDuoWorkflowPrompt.imageDescription':
|
|
11
|
+
'It should have any tools necessary for the workflow installed.',
|
|
12
|
+
'GlDuoWorkflowPrompt.imageLabel': 'Image',
|
|
13
|
+
'GlDuoWorkflowPrompt.imageLabelDescription': 'The container image to run the workflow in.',
|
|
14
|
+
'GlDuoWorkflowPrompt.promptDescription': 'Be specific and include any requirements.',
|
|
15
|
+
'GlDuoWorkflowPrompt.promptLabel': 'Description',
|
|
16
|
+
'GlDuoWorkflowPrompt.promptLabelDescription': 'What would you like to do and how.',
|
|
17
|
+
'GlDuoWorkflowPrompt.title': 'Goal',
|
|
6
18
|
'GlKeysetPagination.navigationLabel': 'Pagination',
|
|
7
19
|
'GlKeysetPagination.nextText': 'Next',
|
|
8
20
|
'GlKeysetPagination.prevText': 'Previous',
|