@gitlab/ui 66.24.0 → 66.25.1
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/charts/legend/legend.js +1 -1
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +1 -1
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/dist/utils/charts/constants.js +1 -1
- package/package.json +1 -1
- package/src/components/charts/legend/legend.scss +34 -19
- package/src/components/charts/legend/legend.stories.js +41 -4
- package/src/components/charts/legend/legend.vue +1 -1
- package/src/components/experimental/duo/user_feedback/user_feedback.md +52 -6
- package/src/components/experimental/duo/user_feedback/user_feedback.spec.js +20 -3
- package/src/components/experimental/duo/user_feedback/user_feedback.stories.js +68 -8
- package/src/components/experimental/duo/user_feedback/user_feedback.vue +6 -1
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.spec.js +18 -1
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.vue +10 -6
- package/src/utils/charts/constants.js +2 -1
package/dist/tokens/js/tokens.js
CHANGED
|
@@ -65,7 +65,7 @@ const CHART_TYPE_BAR = 'bar';
|
|
|
65
65
|
const CHART_TYPE_LINE = 'line';
|
|
66
66
|
|
|
67
67
|
// Constants for height "auto"
|
|
68
|
-
const HEIGHT_AUTO_CLASSES = 'gl-display-flex gl-flex-direction-column gl-h-full';
|
|
68
|
+
const HEIGHT_AUTO_CLASSES = 'gl-chart-h-auto gl-display-flex gl-flex-direction-column gl-h-full';
|
|
69
69
|
const HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES = 'gl-display-flex gl-h-full';
|
|
70
70
|
|
|
71
71
|
export { ANNOTATIONS_COMPONENT_TYPE, ANNOTATIONS_SERIES_NAME, ANNOTATION_TOOLTIP_TOP_OFFSET, CHART_TYPE_BAR, CHART_TYPE_LINE, DATA_TOOLTIP_LEFT_OFFSET, HEIGHT_AUTO_CLASSES, HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES, LEGEND_AVERAGE_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, TOOLTIP_LEFT_OFFSET, arrowSymbol };
|
package/package.json
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
|
+
// shorter height by half a line, so table body is cut off,
|
|
2
|
+
// suggesting there's more to scroll
|
|
3
|
+
$legend-body-h: $gl-spacing-scale-13 - $gl-spacing-scale-4;
|
|
4
|
+
|
|
5
|
+
.gl-legend {
|
|
6
|
+
@include gl-relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.gl-chart-h-auto {
|
|
10
|
+
.gl-legend-inline {
|
|
11
|
+
// match the height of gl-legend-tabular (header + body)
|
|
12
|
+
max-height: $gl-line-height-24 + $legend-body-h;
|
|
13
|
+
@include gl-overflow-auto;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.gl-legend-tabular,
|
|
18
|
+
.gl-chart-h-auto .gl-legend-inline {
|
|
19
|
+
&::after {
|
|
20
|
+
background-image: linear-gradient(to bottom, $transparent-rgba, $white);
|
|
21
|
+
@include gl-bottom-0;
|
|
22
|
+
@include gl-content-empty;
|
|
23
|
+
@include gl-display-block;
|
|
24
|
+
@include gl-h-4;
|
|
25
|
+
@include gl-absolute;
|
|
26
|
+
@include gl-w-full;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
1
30
|
.gl-legend-inline {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
31
|
+
@include gl-display-flex;
|
|
32
|
+
@include gl-flex-wrap;
|
|
33
|
+
@include gl-flex-shrink-0;
|
|
34
|
+
@include gl-text-gray-900;
|
|
6
35
|
|
|
7
36
|
.gl-legend-inline-series {
|
|
8
37
|
@include gl-display-flex;
|
|
@@ -23,18 +52,6 @@
|
|
|
23
52
|
}
|
|
24
53
|
|
|
25
54
|
.gl-legend-tabular {
|
|
26
|
-
@include gl-relative;
|
|
27
|
-
|
|
28
|
-
&::after {
|
|
29
|
-
background-image: linear-gradient(to bottom, $transparent-rgba, $white);
|
|
30
|
-
@include gl-bottom-0;
|
|
31
|
-
@include gl-content-empty;
|
|
32
|
-
@include gl-display-block;
|
|
33
|
-
@include gl-h-4;
|
|
34
|
-
@include gl-absolute;
|
|
35
|
-
@include gl-w-full;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
55
|
.gl-legend-tabular-header {
|
|
39
56
|
@include gl-display-flex;
|
|
40
57
|
@include gl-justify-content-end;
|
|
@@ -56,9 +73,7 @@
|
|
|
56
73
|
}
|
|
57
74
|
|
|
58
75
|
.gl-legend-tabular-body {
|
|
59
|
-
|
|
60
|
-
// suggesting there's more to scroll
|
|
61
|
-
height: $gl-spacing-scale-13 - $gl-spacing-scale-4;
|
|
76
|
+
height: $legend-body-h;
|
|
62
77
|
@include gl-overflow-y-auto;
|
|
63
78
|
|
|
64
79
|
> *:nth-child(odd) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GlChart, GlChartLegend } from '../../../charts';
|
|
2
|
-
import { LEGEND_LAYOUT_TABLE } from '../../../utils/charts/constants';
|
|
2
|
+
import { HEIGHT_AUTO_CLASSES, LEGEND_LAYOUT_TABLE } from '../../../utils/charts/constants';
|
|
3
3
|
import { generateSeriesData } from '../../../utils/charts/story_config';
|
|
4
4
|
import {
|
|
5
5
|
SERIES_NAME_SHORT,
|
|
@@ -43,13 +43,14 @@ const generateSeriesInfo = (amount, nameType) => {
|
|
|
43
43
|
}));
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const generateTemplate = (type) => {
|
|
46
|
+
const generateTemplate = (type, wrapperAttrs = {}, chartAttrs = {}) => {
|
|
47
47
|
const layoutTypeAttribute =
|
|
48
48
|
type === LEGEND_LAYOUT_TABLE ? `:layout="'${LEGEND_LAYOUT_TABLE}'"` : '';
|
|
49
49
|
|
|
50
|
-
return `<div>
|
|
50
|
+
return `<div v-bind='${JSON.stringify(wrapperAttrs)}'>
|
|
51
51
|
<gl-chart
|
|
52
52
|
:options="$options.options"
|
|
53
|
+
v-bind='${JSON.stringify(chartAttrs)}'
|
|
53
54
|
@created="onCreated"
|
|
54
55
|
/>
|
|
55
56
|
<gl-chart-legend
|
|
@@ -93,7 +94,7 @@ const getStoryOptions = (seriesLength, seriesNameType, legendLayoutType) => {
|
|
|
93
94
|
...baseStoryOptions,
|
|
94
95
|
options: generateOptions(seriesLength, seriesNameType),
|
|
95
96
|
seriesInfo: generateSeriesInfo(seriesLength, seriesNameType),
|
|
96
|
-
template:
|
|
97
|
+
template: generateTemplate(legendLayoutType),
|
|
97
98
|
};
|
|
98
99
|
};
|
|
99
100
|
|
|
@@ -110,6 +111,24 @@ export const DefaultWithLongSeriesNames = () => getStoryOptions(10, SERIES_NAME_
|
|
|
110
111
|
export const DefaultWithLongSeriesNamesAndNoSpaces = () =>
|
|
111
112
|
getStoryOptions(10, SERIES_NAME_LONG_WITHOUT_SPACES);
|
|
112
113
|
|
|
114
|
+
export const DefaultWithOverflowingFixedContainerHeight = () => {
|
|
115
|
+
const storyOptions = getStoryOptions(50, SERIES_NAME_LONG_WITHOUT_SPACES, null);
|
|
116
|
+
|
|
117
|
+
storyOptions.template = generateTemplate(
|
|
118
|
+
null,
|
|
119
|
+
{
|
|
120
|
+
class: HEIGHT_AUTO_CLASSES, // line, area, heatmap etc charts all have these classes on the wrapper element in auto height mode
|
|
121
|
+
style: 'height: 400px; overflow: hidden; outline: 1px solid red;', // Simulate being inside a dashboard panel with fixed height and no overflow
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
height: 'auto',
|
|
125
|
+
class: 'gl-flex-grow-1', // line, area, heatmap etc charts all have gl-flex-grow-1 on the <gl-chart> element in auto height mode
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
return storyOptions;
|
|
130
|
+
};
|
|
131
|
+
|
|
113
132
|
export const WithTabularLayout = () => getStoryOptions(10, SERIES_NAME_SHORT, LEGEND_LAYOUT_TABLE);
|
|
114
133
|
export const WithTabularLayoutAndDisabledLegendItem = () => {
|
|
115
134
|
const storyOptions = getStoryOptions(10, SERIES_NAME_SHORT, LEGEND_LAYOUT_TABLE);
|
|
@@ -123,6 +142,24 @@ export const WithTabularLayoutAndLongSeriesNames = () =>
|
|
|
123
142
|
export const WithTabularLayoutAndLongSeriesNamesWithNoSpaces = () =>
|
|
124
143
|
getStoryOptions(10, SERIES_NAME_LONG_WITHOUT_SPACES, LEGEND_LAYOUT_TABLE);
|
|
125
144
|
|
|
145
|
+
export const WithTabularOverflowingFixedContainerHeight = () => {
|
|
146
|
+
const storyOptions = getStoryOptions(50, SERIES_NAME_LONG_WITHOUT_SPACES, LEGEND_LAYOUT_TABLE);
|
|
147
|
+
|
|
148
|
+
storyOptions.template = generateTemplate(
|
|
149
|
+
LEGEND_LAYOUT_TABLE,
|
|
150
|
+
{
|
|
151
|
+
class: HEIGHT_AUTO_CLASSES, // line, area, heatmap etc charts all have these classes on the wrapper element in auto height mode
|
|
152
|
+
style: 'height: 400px; overflow: hidden; outline: 1px solid red;', // Simulate being inside a dashboard panel with fixed height and no overflow
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
height: 'auto',
|
|
156
|
+
class: 'gl-flex-grow-1', // line, area, heatmap etc charts all have gl-flex-grow-1 on the <gl-chart> element in auto height mode
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
return storyOptions;
|
|
161
|
+
};
|
|
162
|
+
|
|
126
163
|
export default {
|
|
127
164
|
title: 'charts/chart-legend',
|
|
128
165
|
component: GlChartLegend,
|
|
@@ -172,7 +172,7 @@ export default {
|
|
|
172
172
|
</script>
|
|
173
173
|
|
|
174
174
|
<template>
|
|
175
|
-
<div data-testid="gl-chart-legend">
|
|
175
|
+
<div class="gl-legend" data-testid="gl-chart-legend">
|
|
176
176
|
<template v-if="layout === $options.legendLayoutTypes.LEGEND_LAYOUT_INLINE">
|
|
177
177
|
<div class="gl-legend-inline">
|
|
178
178
|
<div
|
|
@@ -5,7 +5,7 @@ the form data on submission.
|
|
|
5
5
|
|
|
6
6
|
## Custom button text
|
|
7
7
|
|
|
8
|
-
The component allows to customize the button text
|
|
8
|
+
The component allows to customize the button text presented to the user.
|
|
9
9
|
|
|
10
10
|
```html
|
|
11
11
|
<gl-duo-user-feedback feedback-link-text="Leave your custom feedback" />
|
|
@@ -13,9 +13,9 @@ The component allows to customize the button text, presented to the user.
|
|
|
13
13
|
|
|
14
14
|
## Linking to a separate feedback form
|
|
15
15
|
|
|
16
|
-
The main goal of this component is to provide
|
|
17
|
-
be necessary for
|
|
18
|
-
form and
|
|
16
|
+
The main goal of this component is to provide an advanced feedback form. However, it might only
|
|
17
|
+
be necessary for some consumers. In such a case, the component bypasses the default
|
|
18
|
+
form and links to an external feedback page/form.
|
|
19
19
|
|
|
20
20
|
```html
|
|
21
21
|
<gl-duo-user-feedback feedback-link-url="https://gitlab.com" />
|
|
@@ -29,8 +29,8 @@ This component emits the `feedback` event with all the options selected in the f
|
|
|
29
29
|
<gl-duo-user-feedback @feedback="myEventTracker" />
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
The returned event contains two props (`feedbackChoices` and `extendedTextFeedback`)
|
|
33
|
-
the underlying `FeedbackModal` component. Here's
|
|
32
|
+
The returned event contains two props (`feedbackChoices` and `extendedTextFeedback`) from
|
|
33
|
+
the underlying `FeedbackModal` component. Here's an example of a possible event:
|
|
34
34
|
|
|
35
35
|
```json
|
|
36
36
|
{
|
|
@@ -38,3 +38,49 @@ the underlying `FeedbackModal` component. Here's the example of a possible event
|
|
|
38
38
|
"extendedTextFeedback": "The answer was too long to understand"
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
|
+
|
|
42
|
+
## Using the `feedback-extra-fields` slot
|
|
43
|
+
|
|
44
|
+
By default, the component renders one extra textarea field to gather additional feedback
|
|
45
|
+
information from users. However, it may not be enough sometimes, and different use cases of
|
|
46
|
+
this component might need to fine-tune the form to gather information most suitable for that
|
|
47
|
+
or another use case. For this purpose, the component provides the `feedback-extra-fields`
|
|
48
|
+
slot, which can override the default textarea with different fields/information.
|
|
49
|
+
|
|
50
|
+
Note, however, that the content put into this slot will override the default textarea. So,
|
|
51
|
+
if you want to append additional fields, instead of completely overriding the default textarea,
|
|
52
|
+
you must copy the textarea field from the `DuoChatFeedbackModal` component into the slot.
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<gl-duo-user-feedback
|
|
56
|
+
:feedback-link-text="feedbackLinkText"
|
|
57
|
+
:feedback-link-url="feedbackLinkUrl"
|
|
58
|
+
@feedback="logEvent"
|
|
59
|
+
>
|
|
60
|
+
<template #feedback-extra-fields>
|
|
61
|
+
<div class="gl-mb-5">
|
|
62
|
+
<gl-alert variant="info" :dismissible="false">
|
|
63
|
+
GitLab team members can not see your conversation. Please be as descriptive as possible.
|
|
64
|
+
</gl-alert>
|
|
65
|
+
</div>
|
|
66
|
+
<gl-form-group label="What were you doing?" optional>
|
|
67
|
+
<gl-form-textarea
|
|
68
|
+
placeholder="The situation in which you interacted with GitLab Duo Chat."
|
|
69
|
+
v-model="didWhat"
|
|
70
|
+
/>
|
|
71
|
+
</gl-form-group>
|
|
72
|
+
<gl-form-group label="What were you expecting from the response?" optional>
|
|
73
|
+
<gl-form-textarea
|
|
74
|
+
placeholder="What kind of information or assistance were you hoping to receive?"
|
|
75
|
+
v-model="expectedWhat"
|
|
76
|
+
/>
|
|
77
|
+
</gl-form-group>
|
|
78
|
+
<gl-form-group label="How could the response be improved?" optional>
|
|
79
|
+
<gl-form-textarea
|
|
80
|
+
placeholder="How the response might better meet your needs."
|
|
81
|
+
v-model="improveWhat"
|
|
82
|
+
/>
|
|
83
|
+
</gl-form-group>
|
|
84
|
+
</template>
|
|
85
|
+
</gl-duo-user-feedback>
|
|
86
|
+
```
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { nextTick } from 'vue';
|
|
2
2
|
import { shallowMount } from '@vue/test-utils';
|
|
3
3
|
import { GlButton } from '../../../../index';
|
|
4
|
-
import
|
|
4
|
+
import FeedbackModal from './user_feedback_modal.vue';
|
|
5
5
|
import UserFeedback, { i18n } from './user_feedback.vue';
|
|
6
6
|
|
|
7
|
+
const DummyComponent = {
|
|
8
|
+
template: '<p>dummy</p>',
|
|
9
|
+
};
|
|
10
|
+
|
|
7
11
|
describe('UserFeedback', () => {
|
|
8
12
|
let wrapper;
|
|
9
13
|
const eventName = 'test_event_name';
|
|
10
14
|
|
|
11
|
-
const createComponent = ({ props, data = {} } = {}) => {
|
|
15
|
+
const createComponent = ({ props, data = {}, slots = {} } = {}) => {
|
|
12
16
|
wrapper = shallowMount(UserFeedback, {
|
|
13
17
|
data() {
|
|
14
18
|
return data;
|
|
@@ -17,11 +21,15 @@ describe('UserFeedback', () => {
|
|
|
17
21
|
eventName,
|
|
18
22
|
...props,
|
|
19
23
|
},
|
|
24
|
+
stubs: {
|
|
25
|
+
FeedbackModal,
|
|
26
|
+
},
|
|
27
|
+
slots,
|
|
20
28
|
});
|
|
21
29
|
};
|
|
22
30
|
|
|
23
31
|
const findButton = () => wrapper.findComponent(GlButton);
|
|
24
|
-
const findModal = () => wrapper.findComponent(
|
|
32
|
+
const findModal = () => wrapper.findComponent(FeedbackModal);
|
|
25
33
|
|
|
26
34
|
beforeEach(() => {
|
|
27
35
|
createComponent();
|
|
@@ -77,4 +85,13 @@ describe('UserFeedback', () => {
|
|
|
77
85
|
expect(findModal().exists()).toBe(false);
|
|
78
86
|
});
|
|
79
87
|
});
|
|
88
|
+
|
|
89
|
+
describe('slots', () => {
|
|
90
|
+
it('renders the `feedback-extra-fields` slot', () => {
|
|
91
|
+
expect(wrapper.findComponent(DummyComponent).exists()).toBe(false);
|
|
92
|
+
wrapper.destroy();
|
|
93
|
+
createComponent({ slots: { 'feedback-extra-fields': DummyComponent } });
|
|
94
|
+
expect(wrapper.findComponent(DummyComponent).exists()).toBe(true);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
80
97
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GlAlert, GlFormGroup, GlFormTextarea } from '../../../../index';
|
|
2
|
+
import GlDuoUserFeedback from './user_feedback.vue';
|
|
2
3
|
import readme from './user_feedback.md';
|
|
3
4
|
|
|
4
5
|
const generateProps = ({ feedbackLinkText, feedbackLinkUrl } = {}) => ({
|
|
@@ -6,8 +7,13 @@ const generateProps = ({ feedbackLinkText, feedbackLinkUrl } = {}) => ({
|
|
|
6
7
|
feedbackLinkUrl,
|
|
7
8
|
});
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
-
components: {
|
|
10
|
+
export const Default = (args, { argTypes }) => ({
|
|
11
|
+
components: {
|
|
12
|
+
GlDuoUserFeedback,
|
|
13
|
+
GlAlert,
|
|
14
|
+
GlFormGroup,
|
|
15
|
+
GlFormTextarea,
|
|
16
|
+
},
|
|
11
17
|
props: Object.keys(argTypes),
|
|
12
18
|
data() {
|
|
13
19
|
return {
|
|
@@ -21,7 +27,7 @@ const Template = (args, { argTypes }) => ({
|
|
|
21
27
|
},
|
|
22
28
|
template: `
|
|
23
29
|
<div>
|
|
24
|
-
<gl-user-feedback
|
|
30
|
+
<gl-duo-user-feedback
|
|
25
31
|
:feedback-link-text="feedbackLinkText"
|
|
26
32
|
:feedback-link-url="feedbackLinkUrl"
|
|
27
33
|
@feedback="logEvent"/>
|
|
@@ -29,13 +35,67 @@ const Template = (args, { argTypes }) => ({
|
|
|
29
35
|
</div>
|
|
30
36
|
`,
|
|
31
37
|
});
|
|
32
|
-
|
|
33
|
-
export const Default = Template.bind({});
|
|
34
38
|
Default.args = generateProps();
|
|
35
39
|
|
|
40
|
+
export const Slots = (args, { argTypes }) => ({
|
|
41
|
+
components: {
|
|
42
|
+
GlDuoUserFeedback,
|
|
43
|
+
GlAlert,
|
|
44
|
+
GlFormGroup,
|
|
45
|
+
GlFormTextarea,
|
|
46
|
+
},
|
|
47
|
+
props: Object.keys(argTypes),
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
eventOutput: '',
|
|
51
|
+
didWhat: '',
|
|
52
|
+
expectedWhat: '',
|
|
53
|
+
improveWhat: '',
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
logEvent(event) {
|
|
58
|
+
const { feedbackChoices } = event;
|
|
59
|
+
this.eventOutput = JSON.stringify({
|
|
60
|
+
feedbackChoices,
|
|
61
|
+
didWhat: this.didWhat,
|
|
62
|
+
expectedWhat: this.expectedWhat,
|
|
63
|
+
improveWhat: this.improveWhat,
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
template: `
|
|
68
|
+
<div>
|
|
69
|
+
<gl-duo-user-feedback
|
|
70
|
+
:feedback-link-text="feedbackLinkText"
|
|
71
|
+
:feedback-link-url="feedbackLinkUrl"
|
|
72
|
+
@feedback="logEvent">
|
|
73
|
+
<template #feedback-extra-fields>
|
|
74
|
+
<div class="gl-mb-5">
|
|
75
|
+
<gl-alert variant="info" :dismissible="false">
|
|
76
|
+
GitLab team members can not see your conversation. Please be as descriptive as possible.
|
|
77
|
+
</gl-alert>
|
|
78
|
+
</div>
|
|
79
|
+
<gl-form-group label="What were you doing?" optional>
|
|
80
|
+
<gl-form-textarea placeholder="The situation in which you interacted with GitLab Duo Chat." v-model="didWhat" />
|
|
81
|
+
</gl-form-group>
|
|
82
|
+
<gl-form-group label="What were you expecting from the response?" optional>
|
|
83
|
+
<gl-form-textarea placeholder="What kind of information or assistance were you hoping to receive?" v-model="expectedWhat" />
|
|
84
|
+
</gl-form-group>
|
|
85
|
+
<gl-form-group label="How could the response be improved?" optional>
|
|
86
|
+
<gl-form-textarea placeholder="How the response might better meet your needs."v-model="improveWhat" />
|
|
87
|
+
</gl-form-group>
|
|
88
|
+
</template>
|
|
89
|
+
</gl-duo-user-feedback>
|
|
90
|
+
<p v-if="eventOutput"><code>{{ eventOutput }}</code></p>
|
|
91
|
+
</div>
|
|
92
|
+
`,
|
|
93
|
+
});
|
|
94
|
+
Slots.parameters = { controls: { disable: true } };
|
|
95
|
+
|
|
36
96
|
export default {
|
|
37
|
-
title: 'experimental/duo/user-feedback',
|
|
38
|
-
component:
|
|
97
|
+
title: 'experimental/duo/duo-user-feedback',
|
|
98
|
+
component: GlDuoUserFeedback,
|
|
39
99
|
parameters: {
|
|
40
100
|
storyshots: { disable: true },
|
|
41
101
|
docs: {
|
|
@@ -72,6 +72,11 @@ export default {
|
|
|
72
72
|
{{ $options.i18n.FEEDBACK_THANKS }}
|
|
73
73
|
</span>
|
|
74
74
|
</div>
|
|
75
|
-
<feedback-modal v-if="shouldRenderModal" ref="feedbackModal" @feedback-submitted="notify"
|
|
75
|
+
<feedback-modal v-if="shouldRenderModal" ref="feedbackModal" @feedback-submitted="notify">
|
|
76
|
+
<template #feedback-extra-fields>
|
|
77
|
+
<!-- @slot The addition Feedback form fields. -->
|
|
78
|
+
<slot name="feedback-extra-fields"></slot>
|
|
79
|
+
</template>
|
|
80
|
+
</feedback-modal>
|
|
76
81
|
</div>
|
|
77
82
|
</template>
|
|
@@ -2,6 +2,10 @@ import { shallowMount } from '@vue/test-utils';
|
|
|
2
2
|
import { GlModal, GlFormCheckboxGroup, GlFormCheckbox, GlFormTextarea } from '../../../../index';
|
|
3
3
|
import FeedbackModal, { feedbackOptions } from './user_feedback_modal.vue';
|
|
4
4
|
|
|
5
|
+
const DummyComponent = {
|
|
6
|
+
template: '<p>dummy</p>',
|
|
7
|
+
};
|
|
8
|
+
|
|
5
9
|
describe('FeedbackModal', () => {
|
|
6
10
|
let wrapper;
|
|
7
11
|
|
|
@@ -15,8 +19,9 @@ describe('FeedbackModal', () => {
|
|
|
15
19
|
.at(index)
|
|
16
20
|
.vm.$emit('input', [feedbackOptions[index].value]);
|
|
17
21
|
};
|
|
18
|
-
const createComponent = () => {
|
|
22
|
+
const createComponent = (options = {}) => {
|
|
19
23
|
wrapper = shallowMount(FeedbackModal, {
|
|
24
|
+
...options,
|
|
20
25
|
stubs: {
|
|
21
26
|
GlModal,
|
|
22
27
|
GlFormCheckboxGroup,
|
|
@@ -58,4 +63,16 @@ describe('FeedbackModal', () => {
|
|
|
58
63
|
expect(wrapper.emitted('feedback-submitted')).toBeUndefined();
|
|
59
64
|
});
|
|
60
65
|
});
|
|
66
|
+
|
|
67
|
+
describe('slots', () => {
|
|
68
|
+
it('renders the `feedback-extra-fields` slot with default content', () => {
|
|
69
|
+
expect(wrapper.findComponent(DummyComponent).exists()).toBe(false);
|
|
70
|
+
expect(findTextarea().exists()).toBe(true);
|
|
71
|
+
wrapper.destroy();
|
|
72
|
+
|
|
73
|
+
createComponent({ slots: { 'feedback-extra-fields': DummyComponent } });
|
|
74
|
+
expect(wrapper.findComponent(DummyComponent).exists()).toBe(true);
|
|
75
|
+
expect(findTextarea().exists()).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
61
78
|
});
|
|
@@ -114,11 +114,15 @@ export default {
|
|
|
114
114
|
:options="$options.feedbackOptions"
|
|
115
115
|
/>
|
|
116
116
|
</gl-form-group>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
|
|
118
|
+
<!-- @slot The addition Feedback form fields. -->
|
|
119
|
+
<slot name="feedback-extra-fields">
|
|
120
|
+
<gl-form-group :label="$options.i18n.MODAL_MORE_LABEL" optional>
|
|
121
|
+
<gl-form-textarea
|
|
122
|
+
v-model="extendedFeedback"
|
|
123
|
+
:placeholder="$options.i18n.MODAL_MORE_PLACEHOLDER"
|
|
124
|
+
/>
|
|
125
|
+
</gl-form-group>
|
|
126
|
+
</slot>
|
|
123
127
|
</gl-modal>
|
|
124
128
|
</template>
|
|
@@ -65,5 +65,6 @@ export const CHART_TYPE_BAR = 'bar';
|
|
|
65
65
|
export const CHART_TYPE_LINE = 'line';
|
|
66
66
|
|
|
67
67
|
// Constants for height "auto"
|
|
68
|
-
export const HEIGHT_AUTO_CLASSES =
|
|
68
|
+
export const HEIGHT_AUTO_CLASSES =
|
|
69
|
+
'gl-chart-h-auto gl-display-flex gl-flex-direction-column gl-h-full';
|
|
69
70
|
export const HEIGHT_AUTO_HORIZONTAL_LAYOUT_CLASSES = 'gl-display-flex gl-h-full';
|