@gitlab/ui 66.13.0 → 66.14.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 +15 -0
- package/dist/components/base/broadcast_message/broadcast_message.js +1 -1
- package/dist/components/experimental/experiment_badge/experiment_badge.js +83 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -0
- 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/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +17 -17
- package/src/components/base/broadcast_message/broadcast_message.scss +7 -0
- package/src/components/base/broadcast_message/broadcast_message.vue +2 -2
- package/src/components/experimental/experiment_badge/experiment_badge.md +9 -0
- package/src/components/experimental/experiment_badge/experiment_badge.spec.js +66 -0
- package/src/components/experimental/experiment_badge/experiment_badge.stories.js +56 -0
- package/src/components/experimental/experiment_badge/experiment_badge.vue +84 -0
- package/src/index.js +3 -0
- package/src/scss/utilities.scss +2 -2
- package/src/scss/utility-mixins/text.scss +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "66.
|
|
3
|
+
"version": "66.14.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -94,22 +94,22 @@
|
|
|
94
94
|
"@gitlab/eslint-plugin": "19.0.0",
|
|
95
95
|
"@gitlab/fonts": "^1.2.0",
|
|
96
96
|
"@gitlab/stylelint-config": "5.0.0",
|
|
97
|
-
"@gitlab/svgs": "3.
|
|
97
|
+
"@gitlab/svgs": "3.63.0",
|
|
98
98
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
99
99
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
100
100
|
"@rollup/plugin-replace": "^2.3.2",
|
|
101
|
-
"@storybook/addon-a11y": "7.4.
|
|
102
|
-
"@storybook/addon-docs": "7.4.
|
|
103
|
-
"@storybook/addon-essentials": "7.4.
|
|
104
|
-
"@storybook/addon-storyshots": "7.4.
|
|
105
|
-
"@storybook/addon-storyshots-puppeteer": "7.4.
|
|
106
|
-
"@storybook/addon-viewport": "7.4.
|
|
107
|
-
"@storybook/builder-webpack5": "7.4.
|
|
108
|
-
"@storybook/theming": "7.4.
|
|
109
|
-
"@storybook/vue": "7.4.
|
|
110
|
-
"@storybook/vue-webpack5": "7.4.
|
|
111
|
-
"@storybook/vue3": "7.4.
|
|
112
|
-
"@storybook/vue3-webpack5": "7.4.
|
|
101
|
+
"@storybook/addon-a11y": "7.4.3",
|
|
102
|
+
"@storybook/addon-docs": "7.4.3",
|
|
103
|
+
"@storybook/addon-essentials": "7.4.3",
|
|
104
|
+
"@storybook/addon-storyshots": "7.4.3",
|
|
105
|
+
"@storybook/addon-storyshots-puppeteer": "7.4.3",
|
|
106
|
+
"@storybook/addon-viewport": "7.4.3",
|
|
107
|
+
"@storybook/builder-webpack5": "7.4.3",
|
|
108
|
+
"@storybook/theming": "7.4.3",
|
|
109
|
+
"@storybook/vue": "7.4.3",
|
|
110
|
+
"@storybook/vue-webpack5": "7.4.3",
|
|
111
|
+
"@storybook/vue3": "7.4.3",
|
|
112
|
+
"@storybook/vue3-webpack5": "7.4.3",
|
|
113
113
|
"@vue/compat": "^3.2.40",
|
|
114
114
|
"@vue/compiler-sfc": "^3.2.40",
|
|
115
115
|
"@vue/test-utils": "1.3.0",
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
"emoji-regex": "^10.0.0",
|
|
129
129
|
"eslint": "8.49.0",
|
|
130
130
|
"eslint-import-resolver-jest": "3.0.2",
|
|
131
|
-
"eslint-plugin-cypress": "2.
|
|
132
|
-
"eslint-plugin-storybook": "0.6.
|
|
131
|
+
"eslint-plugin-cypress": "2.15.1",
|
|
132
|
+
"eslint-plugin-storybook": "0.6.14",
|
|
133
133
|
"glob": "10.3.3",
|
|
134
134
|
"identity-obj-proxy": "^3.0.0",
|
|
135
135
|
"inquirer-select-directory": "^1.2.0",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"sass-loader": "^10.2.0",
|
|
161
161
|
"sass-true": "^6.1.0",
|
|
162
162
|
"start-server-and-test": "^1.10.6",
|
|
163
|
-
"storybook": "7.4.
|
|
163
|
+
"storybook": "7.4.3",
|
|
164
164
|
"storybook-dark-mode": "3.0.1",
|
|
165
165
|
"style-dictionary": "^3.8.0",
|
|
166
166
|
"stylelint": "15.10.2",
|
|
@@ -79,12 +79,19 @@
|
|
|
79
79
|
|
|
80
80
|
&-icon {
|
|
81
81
|
@include gl-mr-5;
|
|
82
|
+
line-height: $gl-line-height-16;
|
|
82
83
|
|
|
83
84
|
> svg {
|
|
84
85
|
@include gl-vertical-align-bottom;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
&-text {
|
|
90
|
+
margin-top: -$gl-spacing-scale-1;
|
|
91
|
+
margin-bottom: -$gl-spacing-scale-1;
|
|
92
|
+
@include gl-overflow-break-word;
|
|
93
|
+
}
|
|
94
|
+
|
|
88
95
|
&-dismiss {
|
|
89
96
|
@include gl-my-n2;
|
|
90
97
|
@include gl-ml-5;
|
|
@@ -77,10 +77,10 @@ export default {
|
|
|
77
77
|
<template>
|
|
78
78
|
<div class="gl-broadcast-message" :class="`${theme} ${type}`">
|
|
79
79
|
<div class="gl-broadcast-message-content">
|
|
80
|
-
<div class="gl-broadcast-message-icon
|
|
80
|
+
<div class="gl-broadcast-message-icon">
|
|
81
81
|
<gl-icon :name="iconName" />
|
|
82
82
|
</div>
|
|
83
|
-
<div class="gl-
|
|
83
|
+
<div class="gl-broadcast-message-text">
|
|
84
84
|
<h2 class="gl-sr-only">Admin message</h2>
|
|
85
85
|
<!-- @slot The broadcast message's text -->
|
|
86
86
|
<slot></slot>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The component is representing a badge, marking the experimental features.
|
|
2
|
+
It is supposed to be used with the AI experiments, and comes with a popover explaining
|
|
3
|
+
what experiment means.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<gl-experiment-badge experiment-help-page-url="https://gitlab.com" popover-placement="bottom" />
|
|
9
|
+
```
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import GlBadge from '../../base/badge/badge.vue';
|
|
3
|
+
import GlPopover from '../../base/popover/popover.vue';
|
|
4
|
+
import GlLink from '../../base/link/link.vue';
|
|
5
|
+
import GlSprintf from '../../utilities/sprintf/sprintf.vue';
|
|
6
|
+
import GlExperimentBadge, { i18n } from './experiment_badge.vue';
|
|
7
|
+
|
|
8
|
+
jest.mock('lodash/uniqueId', () => () => 'fakeUniqueId');
|
|
9
|
+
|
|
10
|
+
describe('GlExperimentBadge', () => {
|
|
11
|
+
let wrapper;
|
|
12
|
+
|
|
13
|
+
const findBadge = () => wrapper.findComponent(GlBadge);
|
|
14
|
+
const findPopover = () => wrapper.findComponent(GlPopover);
|
|
15
|
+
const findHelpLink = () => wrapper.findComponent(GlLink);
|
|
16
|
+
|
|
17
|
+
const createComponent = (props = {}) => {
|
|
18
|
+
wrapper = shallowMount(GlExperimentBadge, {
|
|
19
|
+
propsData: {
|
|
20
|
+
...props,
|
|
21
|
+
},
|
|
22
|
+
stubs: {
|
|
23
|
+
GlSprintf,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
createComponent();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('renders main components', () => {
|
|
33
|
+
expect(findBadge().exists()).toBe(true);
|
|
34
|
+
expect(findPopover().exists()).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('sets correct props on the badge', () => {
|
|
38
|
+
const badgeType = 'neutral';
|
|
39
|
+
const badgeSize = 'md';
|
|
40
|
+
expect(findBadge().props('variant')).toBe(badgeType);
|
|
41
|
+
expect(findBadge().props('size')).toBe(badgeSize);
|
|
42
|
+
expect(findBadge().find('span').text()).toBe(i18n.EXPERIMENT_BADGE);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('sets correct props on the popover', () => {
|
|
46
|
+
expect(findPopover().props('triggers')).toBe('click');
|
|
47
|
+
expect(findPopover().props('title')).toBe(i18n.EXPERIMENT_POPOVER_TITLE);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('correctly sets the placement of the popover', () => {
|
|
51
|
+
const popoverPlacement = 'right';
|
|
52
|
+
createComponent({ popoverPlacement });
|
|
53
|
+
expect(findPopover().props('placement')).toBe(popoverPlacement);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('sets the link to the help page if passed', () => {
|
|
57
|
+
const experimentHelpPageUrl = 'https://gitlab.com';
|
|
58
|
+
createComponent({ experimentHelpPageUrl });
|
|
59
|
+
expect(findHelpLink().attributes('href')).toBe(experimentHelpPageUrl);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('generates the unique ID to connect the button and the popover', () => {
|
|
63
|
+
expect(findBadge().attributes('id')).toBe('fakeUniqueId');
|
|
64
|
+
expect(findPopover().attributes('target')).toBe('fakeUniqueId');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import GlExperimentBadge from './experiment_badge.vue';
|
|
2
|
+
import readme from './experiment_badge.md';
|
|
3
|
+
|
|
4
|
+
const defaultValue = (prop) => GlExperimentBadge.props[prop].default;
|
|
5
|
+
|
|
6
|
+
const generateProps = ({
|
|
7
|
+
experimentHelpPageUrl = defaultValue('experimentHelpPageUrl'),
|
|
8
|
+
popoverPlacement = defaultValue('popoverPlacement'),
|
|
9
|
+
} = {}) => ({
|
|
10
|
+
experimentHelpPageUrl,
|
|
11
|
+
popoverPlacement,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const Template = (args, { argTypes }) => ({
|
|
15
|
+
components: { GlExperimentBadge },
|
|
16
|
+
props: Object.keys(argTypes),
|
|
17
|
+
template: `
|
|
18
|
+
<div class='gl-h-13'>
|
|
19
|
+
<gl-experiment-badge
|
|
20
|
+
:experiment-help-page-url='experimentHelpPageUrl'
|
|
21
|
+
:popover-placement='popoverPlacement' />
|
|
22
|
+
</div>
|
|
23
|
+
`,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const Default = Template.bind({});
|
|
27
|
+
Default.args = generateProps();
|
|
28
|
+
|
|
29
|
+
export const WithHelpPageUrl = Template.bind({});
|
|
30
|
+
WithHelpPageUrl.args = {
|
|
31
|
+
...generateProps({
|
|
32
|
+
experimentHelpPageUrl:
|
|
33
|
+
'https://docs.gitlab.com/ee/policy/experiment-beta-support.html#experiment',
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const CustomPlacement = Template.bind({});
|
|
38
|
+
CustomPlacement.args = {
|
|
39
|
+
...generateProps({
|
|
40
|
+
popoverPlacement: 'right',
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
title: 'experimental/experiment_badge',
|
|
46
|
+
component: GlExperimentBadge,
|
|
47
|
+
parameters: {
|
|
48
|
+
storyshots: { disable: true },
|
|
49
|
+
docs: {
|
|
50
|
+
description: {
|
|
51
|
+
component: readme,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
argTypes: {},
|
|
56
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import uniqueId from 'lodash/uniqueId';
|
|
3
|
+
import { GlBadge, GlLink, GlPopover } from '../../../index';
|
|
4
|
+
import GlSprintf from '../../utilities/sprintf/sprintf.vue';
|
|
5
|
+
|
|
6
|
+
export const i18n = {
|
|
7
|
+
EXPERIMENT_BADGE: 'Experiment',
|
|
8
|
+
EXPERIMENT_POPOVER_TITLE: "What's an Experiment?",
|
|
9
|
+
EXPERIMENT_POPOVER_CONTENT:
|
|
10
|
+
"An %{linkStart}Experiment%{linkEnd} is a feature that's in the process of being developed. It's not production-ready. We encourage users to try Experimental features and provide feedback. An Experiment: %{bullets}",
|
|
11
|
+
EXPERIMENT_POPOVER_BULLETS: [
|
|
12
|
+
'May be unstable',
|
|
13
|
+
'Has no support and might not be documented',
|
|
14
|
+
'Can be removed at any time',
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'GlExperimentBadge',
|
|
20
|
+
i18n,
|
|
21
|
+
components: {
|
|
22
|
+
GlBadge,
|
|
23
|
+
GlPopover,
|
|
24
|
+
GlSprintf,
|
|
25
|
+
GlLink,
|
|
26
|
+
},
|
|
27
|
+
props: {
|
|
28
|
+
/**
|
|
29
|
+
* The URL of a page to provide more explanations on the experiment.
|
|
30
|
+
*/
|
|
31
|
+
experimentHelpPageUrl: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: false,
|
|
34
|
+
default: '',
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* The placement of the popover in relation to the button.
|
|
38
|
+
*/
|
|
39
|
+
popoverPlacement: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false,
|
|
42
|
+
default: 'bottom',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
created() {
|
|
46
|
+
this.triggerId = uniqueId('experiment-badge-');
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<gl-badge :id="triggerId" class="gl-mx-4 gl-hover-cursor-pointer" variant="neutral" size="md">
|
|
53
|
+
<span>{{ $options.i18n.EXPERIMENT_BADGE }}</span>
|
|
54
|
+
<gl-popover
|
|
55
|
+
triggers="click"
|
|
56
|
+
show-close-button
|
|
57
|
+
:placement="popoverPlacement"
|
|
58
|
+
:target="triggerId"
|
|
59
|
+
:css-classes="['gl-z-index-9999!']"
|
|
60
|
+
:title="$options.i18n.EXPERIMENT_POPOVER_TITLE"
|
|
61
|
+
>
|
|
62
|
+
<gl-sprintf :message="$options.i18n.EXPERIMENT_POPOVER_CONTENT">
|
|
63
|
+
<template #link="{ content }">
|
|
64
|
+
<gl-link
|
|
65
|
+
v-if="experimentHelpPageUrl"
|
|
66
|
+
:href="experimentHelpPageUrl"
|
|
67
|
+
target="_blank"
|
|
68
|
+
class="gl-font-sm!"
|
|
69
|
+
>
|
|
70
|
+
{{ content }}
|
|
71
|
+
</gl-link>
|
|
72
|
+
<span v-else>{{ content }}</span>
|
|
73
|
+
</template>
|
|
74
|
+
<template #bullets>
|
|
75
|
+
<ul class="gl-mb-0 gl-pl-5">
|
|
76
|
+
<li v-for="(item, i) in $options.i18n.EXPERIMENT_POPOVER_BULLETS" :key="`li-${i}`">
|
|
77
|
+
{{ item }}
|
|
78
|
+
</li>
|
|
79
|
+
</ul>
|
|
80
|
+
</template>
|
|
81
|
+
</gl-sprintf>
|
|
82
|
+
</gl-popover>
|
|
83
|
+
</gl-badge>
|
|
84
|
+
</template>
|
package/src/index.js
CHANGED
|
@@ -96,6 +96,9 @@ export { default as GlAccordionItem } from './components/base/accordion/accordio
|
|
|
96
96
|
export { default as GlCarousel } from './components/base/carousel/carousel.vue';
|
|
97
97
|
export { default as GlCarouselSlide } from './components/base/carousel/carousel_slide.vue';
|
|
98
98
|
|
|
99
|
+
// Experimental
|
|
100
|
+
export { default as GlExperimentBadge } from './components/experimental/experiment_badge/experiment_badge.vue';
|
|
101
|
+
|
|
99
102
|
// Utilities
|
|
100
103
|
export { default as GlAnimatedNumber } from './components/utilities/animated_number/animated_number.vue';
|
|
101
104
|
export { default as GlFriendlyWrap } from './components/utilities/friendly_wrap/friendly_wrap.vue';
|
package/src/scss/utilities.scss
CHANGED
|
@@ -8359,13 +8359,13 @@ $gl-animate-skeleton-loader-max-width: 64 * $grid-size;
|
|
|
8359
8359
|
}
|
|
8360
8360
|
.gl-overflow-break-word {
|
|
8361
8361
|
overflow-wrap: break-word;
|
|
8362
|
-
word-wrap: break-word;
|
|
8363
8362
|
hyphens: auto;
|
|
8363
|
+
-webkit-hyphens: auto;
|
|
8364
8364
|
}
|
|
8365
8365
|
.gl-overflow-break-word\! {
|
|
8366
8366
|
overflow-wrap: break-word !important;
|
|
8367
|
-
word-wrap: break-word !important;
|
|
8368
8367
|
hyphens: auto !important;
|
|
8368
|
+
-webkit-hyphens: auto !important;
|
|
8369
8369
|
}
|
|
8370
8370
|
.gl-str-truncated {
|
|
8371
8371
|
@include str-truncated;
|