@gitlab/ui 33.1.0 → 35.0.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 +48 -0
- package/dist/components/base/accordion/accordion.js +6 -2
- package/dist/components/base/accordion/accordion_item.js +2 -2
- package/dist/components/base/avatars_inline/avatars_inline.documentation.js +1 -1
- package/dist/components/base/avatars_inline/avatars_inline.js +5 -1
- package/dist/components/base/tabs/tabs/tabs.documentation.js +1 -1
- package/dist/components/base/tabs/tabs/tabs.js +2 -12
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/package.json +12 -10
- package/src/components/base/accordion/accordion.vue +5 -2
- package/src/components/base/accordion/accordion_item.spec.js +2 -2
- package/src/components/base/accordion/accordion_item.stories.js +2 -2
- package/src/components/base/accordion/accordion_item.vue +2 -2
- package/src/components/base/avatar/avatar.stories.js +8 -0
- package/src/components/base/avatar_labeled/avatar_labeled.stories.js +7 -0
- package/src/components/base/avatar_link/avatar_link.stories.js +7 -0
- package/src/components/base/avatars_inline/avatars_inline.md +5 -0
- package/src/components/base/avatars_inline/avatars_inline.spec.js +21 -1
- package/src/components/base/avatars_inline/avatars_inline.stories.js +23 -9
- package/src/components/base/avatars_inline/avatars_inline.vue +11 -1
- package/src/components/base/badge/badge.stories.js +114 -9
- package/src/components/base/broadcast_message/broadcast_message.stories.js +2 -2
- package/src/components/base/button/button.stories.js +11 -11
- package/src/components/base/dropdown/dropdown.stories.js +4 -2
- package/src/components/base/filtered_search/filtered_search.stories.js +11 -1
- package/src/components/base/filtered_search/filtered_search_suggestion.stories.js +2 -0
- package/src/components/base/filtered_search/filtered_search_suggestion_list.stories.js +2 -0
- package/src/components/base/filtered_search/filtered_search_token.stories.js +2 -0
- package/src/components/base/filtered_search/filtered_search_token_segment.stories.js +2 -0
- package/src/components/base/form/form_group/form_group.stories.js +6 -5
- package/src/components/base/form/form_radio_group/form_radio_group.stories.js +2 -1
- package/src/components/base/loading_icon/loading_icon.stories.js +1 -0
- package/src/components/base/nav/nav_item_dropdown.stories.js +3 -2
- package/src/components/base/pagination/pagination.stories.js +7 -0
- package/src/components/base/path/path.stories.js +2 -2
- package/src/components/base/popover/popover.stories.js +6 -0
- package/src/components/base/table/table.stories.js +6 -1
- package/src/components/base/tabs/tabs/scrollable_tabs.spec.js +0 -1
- package/src/components/base/tabs/tabs/tabs.md +2 -2
- package/src/components/base/tabs/tabs/tabs.scss +3 -115
- package/src/components/base/tabs/tabs/tabs.spec.js +7 -4
- package/src/components/base/tabs/tabs/tabs.stories.js +8 -12
- package/src/components/base/tabs/tabs/tabs.vue +2 -11
- package/src/components/base/toast/toast.stories.js +6 -4
- package/src/components/base/token/token.stories.js +2 -2
- package/src/components/base/tooltip/tooltip.stories.js +2 -1
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/box-shadow.scss +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.0.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"test:unit:watch": "yarn test:unit --watch --notify",
|
|
42
42
|
"test:unit:debug": "NODE_ENV=test node --inspect node_modules/.bin/jest --testPathIgnorePatterns storyshot.spec.js --watch --runInBand",
|
|
43
43
|
"test:visual": "NODE_ENV=test IS_VISUAL_TEST=true start-test http-get://localhost:9001 'jest ./tests/storyshots.spec.js'",
|
|
44
|
+
"test:visual:minimal": "node ./bin/run_minimal_visual_tests.js",
|
|
44
45
|
"test:visual:update": "NODE_ENV=test IS_VISUAL_TEST=true JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE=1 start-test http-get://localhost:9001 'jest ./tests/storyshots.spec.js --updateSnapshot'",
|
|
45
46
|
"prettier": "prettier --check '**/*.{js,vue}'",
|
|
46
47
|
"prettier:fix": "prettier --write '**/*.{js,vue}'",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"@babel/standalone": "^7.0.0",
|
|
61
62
|
"bootstrap-vue": "2.20.1",
|
|
62
63
|
"copy-to-clipboard": "^3.0.8",
|
|
63
|
-
"dompurify": "^2.3.
|
|
64
|
+
"dompurify": "^2.3.5",
|
|
64
65
|
"echarts": "^5.2.1",
|
|
65
66
|
"highlight.js": "^10.6.0",
|
|
66
67
|
"iframe-resizer": "^4.3.2",
|
|
@@ -90,15 +91,15 @@
|
|
|
90
91
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
91
92
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
92
93
|
"@rollup/plugin-replace": "^2.3.2",
|
|
93
|
-
"@storybook/addon-a11y": "6.4.
|
|
94
|
-
"@storybook/addon-docs": "6.4.
|
|
95
|
-
"@storybook/addon-essentials": "6.4.
|
|
94
|
+
"@storybook/addon-a11y": "6.4.15",
|
|
95
|
+
"@storybook/addon-docs": "6.4.15",
|
|
96
|
+
"@storybook/addon-essentials": "6.4.15",
|
|
96
97
|
"@storybook/addon-knobs": "6.4.0",
|
|
97
|
-
"@storybook/addon-storyshots": "6.4.
|
|
98
|
-
"@storybook/addon-storyshots-puppeteer": "6.4.
|
|
99
|
-
"@storybook/addon-viewport": "6.4.
|
|
100
|
-
"@storybook/theming": "6.4.
|
|
101
|
-
"@storybook/vue": "6.4.
|
|
98
|
+
"@storybook/addon-storyshots": "6.4.15",
|
|
99
|
+
"@storybook/addon-storyshots-puppeteer": "6.4.15",
|
|
100
|
+
"@storybook/addon-viewport": "6.4.15",
|
|
101
|
+
"@storybook/theming": "6.4.15",
|
|
102
|
+
"@storybook/vue": "6.4.15",
|
|
102
103
|
"@vue/test-utils": "1.3.0",
|
|
103
104
|
"autoprefixer": "^9.7.6",
|
|
104
105
|
"babel-jest": "^26.6.3",
|
|
@@ -113,6 +114,7 @@
|
|
|
113
114
|
"eslint-import-resolver-jest": "3.0.2",
|
|
114
115
|
"eslint-plugin-cypress": "2.12.1",
|
|
115
116
|
"file-loader": "^4.2.0",
|
|
117
|
+
"glob": "^7.2.0",
|
|
116
118
|
"identity-obj-proxy": "^3.0.0",
|
|
117
119
|
"inquirer-select-directory": "^1.2.0",
|
|
118
120
|
"jest": "^26.6.3",
|
|
@@ -4,9 +4,12 @@ import { uniqueId } from 'lodash';
|
|
|
4
4
|
export default {
|
|
5
5
|
name: 'GlAccordion',
|
|
6
6
|
provide() {
|
|
7
|
+
const accordionId = uniqueId('accordion-set-');
|
|
8
|
+
// temporary fix for this issue: https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2019#note_514671251
|
|
9
|
+
// MR for the upstream pending: https://github.com/vuejs/apollo/pull/1153
|
|
7
10
|
return {
|
|
8
|
-
defaultHeaderLevel: this.headerLevel,
|
|
9
|
-
accordionSetId: this.autoCollapse &&
|
|
11
|
+
defaultHeaderLevel: () => this.headerLevel,
|
|
12
|
+
accordionSetId: () => this.autoCollapse && accordionId,
|
|
10
13
|
};
|
|
11
14
|
},
|
|
12
15
|
props: {
|
|
@@ -16,8 +16,8 @@ describe('GlAccordionItem', () => {
|
|
|
16
16
|
GlCollapseToggle: GlCollapseToggleDirective,
|
|
17
17
|
},
|
|
18
18
|
provide: {
|
|
19
|
-
defaultHeaderLevel,
|
|
20
|
-
accordionSetId,
|
|
19
|
+
defaultHeaderLevel: () => defaultHeaderLevel,
|
|
20
|
+
accordionSetId: () => accordionSetId,
|
|
21
21
|
},
|
|
22
22
|
propsData: {
|
|
23
23
|
title: defaultTitle,
|
|
@@ -26,8 +26,8 @@ const Template = (args) => ({
|
|
|
26
26
|
props: Object.keys(args),
|
|
27
27
|
template,
|
|
28
28
|
provide: {
|
|
29
|
-
defaultHeaderLevel: defaultValue('headerLevel'),
|
|
30
|
-
accordionSetId: '1',
|
|
29
|
+
defaultHeaderLevel: () => defaultValue('headerLevel'),
|
|
30
|
+
accordionSetId: () => '1',
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -51,11 +51,11 @@ When set, it will ensure the accordion item is initially visible
|
|
|
51
51
|
},
|
|
52
52
|
computed: {
|
|
53
53
|
headerComponent() {
|
|
54
|
-
const level = this.headerLevel || this.defaultHeaderLevel;
|
|
54
|
+
const level = this.headerLevel || this.defaultHeaderLevel();
|
|
55
55
|
return `h${level}`;
|
|
56
56
|
},
|
|
57
57
|
accordion() {
|
|
58
|
-
return this.accordionSetId || undefined;
|
|
58
|
+
return this.accordionSetId() || undefined;
|
|
59
59
|
},
|
|
60
60
|
icon() {
|
|
61
61
|
return this.isVisible ? 'chevron-down' : 'chevron-right';
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import Vue from 'vue';
|
|
2
|
+
import { GlAvatar } from '../../../../index';
|
|
2
3
|
import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
3
4
|
import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
|
|
4
5
|
import readme from './avatar.md';
|
|
5
6
|
|
|
6
7
|
Vue.directive('gl-tooltip', GlTooltipDirective);
|
|
7
8
|
|
|
9
|
+
const components = { GlAvatar };
|
|
10
|
+
|
|
8
11
|
const generateImageProps = ({ size = 64, shape = 'circle' } = {}) => ({
|
|
9
12
|
size,
|
|
10
13
|
shape,
|
|
@@ -44,6 +47,7 @@ const template = `
|
|
|
44
47
|
`;
|
|
45
48
|
|
|
46
49
|
export const Image = (args, { argTypes }) => ({
|
|
50
|
+
components,
|
|
47
51
|
props: Object.keys(argTypes),
|
|
48
52
|
template: `
|
|
49
53
|
<gl-avatar
|
|
@@ -56,18 +60,21 @@ export const Image = (args, { argTypes }) => ({
|
|
|
56
60
|
Image.args = generateImageProps();
|
|
57
61
|
|
|
58
62
|
export const ProjectFallback = (args, { argTypes }) => ({
|
|
63
|
+
components,
|
|
59
64
|
props: Object.keys(argTypes),
|
|
60
65
|
template,
|
|
61
66
|
});
|
|
62
67
|
ProjectFallback.args = generateProjectFallbackProps();
|
|
63
68
|
|
|
64
69
|
export const EmojiProjectName = (args, { argTypes }) => ({
|
|
70
|
+
components,
|
|
65
71
|
props: Object.keys(argTypes),
|
|
66
72
|
template,
|
|
67
73
|
});
|
|
68
74
|
EmojiProjectName.args = generateEmojiProjectProps();
|
|
69
75
|
|
|
70
76
|
export const WithTooltip = (args, { argTypes }) => ({
|
|
77
|
+
components,
|
|
71
78
|
props: Object.keys(argTypes),
|
|
72
79
|
template: `
|
|
73
80
|
<gl-avatar
|
|
@@ -83,6 +90,7 @@ WithTooltip.args = { ...generateImageProps(), ...generateTooltipProps() };
|
|
|
83
90
|
|
|
84
91
|
export default {
|
|
85
92
|
title: 'base/avatar',
|
|
93
|
+
component: GlAvatar,
|
|
86
94
|
parameters: {
|
|
87
95
|
knobs: { disable: true },
|
|
88
96
|
docs: {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import Vue from 'vue';
|
|
2
|
+
import { GlAvatarLabeled, GlBadge } from '../../../../index';
|
|
2
3
|
import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
3
4
|
import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
|
|
4
5
|
import readme from './avatar_labeled.md';
|
|
5
6
|
|
|
6
7
|
Vue.directive('gl-tooltip', GlTooltipDirective);
|
|
7
8
|
|
|
9
|
+
const components = { GlAvatarLabeled };
|
|
10
|
+
|
|
8
11
|
const generateProps = ({
|
|
9
12
|
label = 'GitLab User',
|
|
10
13
|
subLabel = '@gitlab',
|
|
@@ -25,6 +28,7 @@ const generateTooltipProps = ({ tooltipText = 'Avatar tooltip', placement = 'top
|
|
|
25
28
|
});
|
|
26
29
|
|
|
27
30
|
export const Default = (args, { argTypes }) => ({
|
|
31
|
+
components,
|
|
28
32
|
props: Object.keys(argTypes),
|
|
29
33
|
template: `
|
|
30
34
|
<gl-avatar-labeled
|
|
@@ -39,6 +43,7 @@ export const Default = (args, { argTypes }) => ({
|
|
|
39
43
|
Default.args = generateProps();
|
|
40
44
|
|
|
41
45
|
export const WithTooltip = (args, { argTypes }) => ({
|
|
46
|
+
components,
|
|
42
47
|
props: Object.keys(argTypes),
|
|
43
48
|
template: `
|
|
44
49
|
<gl-avatar-labeled
|
|
@@ -63,6 +68,7 @@ WithTooltip.argTypes = {
|
|
|
63
68
|
};
|
|
64
69
|
|
|
65
70
|
export const WithBadges = (args, { argTypes }) => ({
|
|
71
|
+
components: { GlAvatarLabeled, GlBadge },
|
|
66
72
|
props: Object.keys(argTypes),
|
|
67
73
|
template: `
|
|
68
74
|
<gl-avatar-labeled
|
|
@@ -87,6 +93,7 @@ WithBadges.args = generateProps();
|
|
|
87
93
|
|
|
88
94
|
export default {
|
|
89
95
|
title: 'base/avatar/labeled',
|
|
96
|
+
component: GlAvatarLabeled,
|
|
90
97
|
parameters: {
|
|
91
98
|
knobs: { disable: true },
|
|
92
99
|
docs: {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { GlAvatarLink, GlAvatar, GlAvatarLabeled } from '../../../../index';
|
|
1
2
|
import { avatarSizeOptions, avatarShapeOptions } from '../../../utils/constants';
|
|
2
3
|
import readme from './avatar_link.md';
|
|
3
4
|
|
|
5
|
+
const components = { GlAvatarLink, GlAvatar };
|
|
6
|
+
|
|
4
7
|
const generateDefaultProps = ({
|
|
5
8
|
href = 'https://gitlab.com/gitlab-org/gitlab',
|
|
6
9
|
shape = 'circle',
|
|
@@ -23,6 +26,7 @@ const generateImageProps = ({
|
|
|
23
26
|
});
|
|
24
27
|
|
|
25
28
|
export const Default = (args, { argTypes }) => ({
|
|
29
|
+
components,
|
|
26
30
|
props: Object.keys(argTypes),
|
|
27
31
|
template: `
|
|
28
32
|
<gl-avatar-link target="blank" :href="href">
|
|
@@ -33,6 +37,7 @@ export const Default = (args, { argTypes }) => ({
|
|
|
33
37
|
Default.args = { ...generateDefaultProps(), ...generateImageProps() };
|
|
34
38
|
|
|
35
39
|
export const WithLabeledAvatar = (args, { argTypes }) => ({
|
|
40
|
+
components: { GlAvatarLink, GlAvatarLabeled },
|
|
36
41
|
props: Object.keys(argTypes),
|
|
37
42
|
template: `
|
|
38
43
|
<gl-avatar-link target="blank" :href="href">
|
|
@@ -47,6 +52,7 @@ WithLabeledAvatar.args = {
|
|
|
47
52
|
};
|
|
48
53
|
|
|
49
54
|
export const WithNoImageAvatar = (args, { argTypes }) => ({
|
|
55
|
+
components,
|
|
50
56
|
props: Object.keys(argTypes),
|
|
51
57
|
template: `
|
|
52
58
|
<gl-avatar-link target="blank" :href="href">
|
|
@@ -58,6 +64,7 @@ WithNoImageAvatar.args = { ...generateDefaultProps({}), ...generateLabelsProps({
|
|
|
58
64
|
|
|
59
65
|
export default {
|
|
60
66
|
title: 'base/avatar/avatar-link',
|
|
67
|
+
component: GlAvatarLink,
|
|
61
68
|
parameters: {
|
|
62
69
|
knobs: { disable: true },
|
|
63
70
|
docs: {
|
|
@@ -28,6 +28,11 @@ When the `collapse` property value is `true` and the `maxVisible` property value
|
|
|
28
28
|
than the length of the `avatars` property array, `<avatars-inline>` will hide the overflown avatars
|
|
29
29
|
and display a badge instead.
|
|
30
30
|
|
|
31
|
+
### Badge description in screen readers
|
|
32
|
+
|
|
33
|
+
The `badgeSrOnlyText` property provides a meaningful description of the badge that appears
|
|
34
|
+
when avatars are collapsed for screen reader users.
|
|
35
|
+
|
|
31
36
|
### Supported sizes
|
|
32
37
|
|
|
33
38
|
`<avatars-inline>` only supports avatars with `24` or `32` size.
|
|
@@ -11,10 +11,14 @@ describe('avatars inline', () => {
|
|
|
11
11
|
{ src: 'avatar 2', tooltip: 'Avatar 2' },
|
|
12
12
|
{ src: 'avatar 3', tooltip: 'Avatar 3' },
|
|
13
13
|
];
|
|
14
|
+
const badgeSrOnlyText = 'additional users';
|
|
14
15
|
|
|
15
16
|
const buildWrapper = (propsData = {}) => {
|
|
16
17
|
wrapper = shallowMount(AvatarsInline, {
|
|
17
|
-
propsData
|
|
18
|
+
propsData: {
|
|
19
|
+
badgeSrOnlyText,
|
|
20
|
+
...propsData,
|
|
21
|
+
},
|
|
18
22
|
stubs: {
|
|
19
23
|
GlTooltip,
|
|
20
24
|
},
|
|
@@ -107,4 +111,20 @@ describe('avatars inline', () => {
|
|
|
107
111
|
});
|
|
108
112
|
});
|
|
109
113
|
});
|
|
114
|
+
|
|
115
|
+
describe('a11y', () => {
|
|
116
|
+
it('renders screen reader only text for the collapse badge', () => {
|
|
117
|
+
buildWrapper({ avatars, maxVisible: 1, collapsed: true, avatarSize: 32 });
|
|
118
|
+
|
|
119
|
+
expect(wrapper.find('[data-testid="badge-sr-only-text"]').text()).toBe(badgeSrOnlyText);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('hides badge text for screen readers', () => {
|
|
123
|
+
buildWrapper({ avatars, maxVisible: 1, collapsed: true, avatarSize: 32 });
|
|
124
|
+
|
|
125
|
+
expect(
|
|
126
|
+
wrapper.find('[data-testid="collapsed-avatars-badge"]').attributes('aria-hidden')
|
|
127
|
+
).toBe('true');
|
|
128
|
+
});
|
|
129
|
+
});
|
|
110
130
|
});
|
|
@@ -1,37 +1,49 @@
|
|
|
1
|
+
import { GlAvatarsInline, GlAvatar, GlAvatarLink, GlTooltipDirective } from '../../../../index';
|
|
1
2
|
import { avatarsInlineSizeOptions } from '../../../utils/constants';
|
|
2
3
|
import readme from './avatars_inline.md';
|
|
3
4
|
|
|
4
5
|
const defaultAvatars = [
|
|
5
|
-
{ src: 'https://picsum.photos/id/1005/32' },
|
|
6
|
-
{ src: 'https://picsum.photos/id/1006/32' },
|
|
7
|
-
{ src: 'https://picsum.photos/id/1009/32' },
|
|
8
|
-
{ src: 'https://picsum.photos/id/1011/32' },
|
|
9
|
-
{ src: 'https://picsum.photos/id/1012/32' },
|
|
6
|
+
{ src: 'https://picsum.photos/id/1005/32', alt: 'Administrator’s user avatar' },
|
|
7
|
+
{ src: 'https://picsum.photos/id/1006/32', alt: 'Ops Manager’s user avatar' },
|
|
8
|
+
{ src: 'https://picsum.photos/id/1009/32', alt: 'Developer’s user avatar' },
|
|
9
|
+
{ src: 'https://picsum.photos/id/1011/32', alt: 'Business Admin’s user avatar' },
|
|
10
|
+
{ src: 'https://picsum.photos/id/1012/32', alt: 'Product designer’s user avatar' },
|
|
10
11
|
];
|
|
11
12
|
|
|
12
13
|
const generateProps = (
|
|
13
14
|
avatars = defaultAvatars,
|
|
14
|
-
{
|
|
15
|
+
{
|
|
16
|
+
maxVisible = 2,
|
|
17
|
+
collapsed = true,
|
|
18
|
+
avatarSize = 24,
|
|
19
|
+
badgeTooltipProp = '',
|
|
20
|
+
badgeSrOnlyText = `${avatars.length - maxVisible} additional users`,
|
|
21
|
+
} = {}
|
|
15
22
|
) => ({
|
|
16
23
|
maxVisible,
|
|
17
24
|
collapsed,
|
|
18
25
|
avatarSize,
|
|
19
26
|
avatars,
|
|
27
|
+
badgeTooltipProp,
|
|
28
|
+
badgeSrOnlyText,
|
|
20
29
|
});
|
|
21
30
|
|
|
22
31
|
export const Default = (args, { argTypes }) => ({
|
|
32
|
+
components: { GlAvatarsInline },
|
|
23
33
|
props: Object.keys(argTypes),
|
|
24
34
|
template: `
|
|
25
|
-
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
|
|
35
|
+
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible" :badgeTooltipProp="badgeTooltipProp" :badgeSrOnlyText="badgeSrOnlyText">
|
|
26
36
|
</gl-avatars-inline>
|
|
27
37
|
`,
|
|
28
38
|
});
|
|
29
39
|
Default.args = generateProps();
|
|
30
40
|
|
|
31
41
|
export const WithLinksAndTooltips = (args, { argTypes }) => ({
|
|
42
|
+
components: { GlAvatarsInline, GlAvatar, GlAvatarLink },
|
|
43
|
+
directives: { GlTooltip: GlTooltipDirective },
|
|
32
44
|
props: Object.keys(argTypes),
|
|
33
45
|
template: `
|
|
34
|
-
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
|
|
46
|
+
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible" :badgeTooltipProp="badgeTooltipProp" :badgeSrOnlyText="badgeSrOnlyText">
|
|
35
47
|
<template #avatar="{ avatar }">
|
|
36
48
|
<gl-avatar-link target="blank" :href="avatar.href" v-gl-tooltip :title="avatar.tooltip">
|
|
37
49
|
<gl-avatar :src="avatar.src" :size="avatarSize" />
|
|
@@ -45,11 +57,13 @@ WithLinksAndTooltips.args = generateProps(
|
|
|
45
57
|
...avatar,
|
|
46
58
|
href: '//gitlab.com',
|
|
47
59
|
tooltip: `Avatar ${index}`,
|
|
48
|
-
}))
|
|
60
|
+
})),
|
|
61
|
+
{ badgeTooltipProp: 'tooltip' }
|
|
49
62
|
);
|
|
50
63
|
|
|
51
64
|
export default {
|
|
52
65
|
title: 'base/avatar/avatars-inline',
|
|
66
|
+
component: GlAvatarsInline,
|
|
53
67
|
parameters: {
|
|
54
68
|
knobs: { disable: true },
|
|
55
69
|
docs: {
|
|
@@ -29,6 +29,10 @@ export default {
|
|
|
29
29
|
required: false,
|
|
30
30
|
default: false,
|
|
31
31
|
},
|
|
32
|
+
badgeSrOnlyText: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
32
36
|
badgeTooltipProp: {
|
|
33
37
|
type: String,
|
|
34
38
|
required: false,
|
|
@@ -111,9 +115,15 @@ export default {
|
|
|
111
115
|
<gl-tooltip v-if="badgeTooltipProp" :target="() => $refs.badge">
|
|
112
116
|
{{ badgeTooltipTitle }}
|
|
113
117
|
</gl-tooltip>
|
|
114
|
-
<span
|
|
118
|
+
<span
|
|
119
|
+
ref="badge"
|
|
120
|
+
data-testid="collapsed-avatars-badge"
|
|
121
|
+
:class="['gl-avatars-inline-badge', badgeSize]"
|
|
122
|
+
aria-hidden="true"
|
|
123
|
+
>
|
|
115
124
|
{{ badgeLabel }}
|
|
116
125
|
</span>
|
|
126
|
+
<span data-testid="badge-sr-only-text" class="sr-only">{{ badgeSrOnlyText }}</span>
|
|
117
127
|
</div>
|
|
118
128
|
</div>
|
|
119
129
|
</template>
|
|
@@ -36,23 +36,128 @@ const Template = (args, { argTypes }) => ({
|
|
|
36
36
|
|
|
37
37
|
export const Default = Template.bind({});
|
|
38
38
|
Default.args = generateProps();
|
|
39
|
+
Default.parameters = {
|
|
40
|
+
storyshots: { disable: true },
|
|
41
|
+
};
|
|
39
42
|
|
|
40
|
-
export const
|
|
41
|
-
|
|
43
|
+
export const Variants = (args, { argTypes }) => ({
|
|
44
|
+
components: { GlBadge },
|
|
45
|
+
props: Object.keys(argTypes),
|
|
46
|
+
template: `
|
|
47
|
+
<div>
|
|
48
|
+
<gl-badge
|
|
49
|
+
v-for="variant in $options.badgeVariantOptions"
|
|
50
|
+
:key="variant"
|
|
51
|
+
:href="href"
|
|
52
|
+
:variant="variant"
|
|
53
|
+
:size="size"
|
|
54
|
+
:icon="icon"
|
|
55
|
+
class="gl-mr-3"
|
|
56
|
+
>{{ variant }}</gl-badge>
|
|
57
|
+
</div>
|
|
58
|
+
`,
|
|
59
|
+
badgeVariantOptions,
|
|
60
|
+
});
|
|
61
|
+
Variants.args = generateProps({
|
|
62
|
+
variant: badgeVariantOptions.warning,
|
|
63
|
+
});
|
|
64
|
+
Variants.argTypes = {
|
|
65
|
+
content: {
|
|
66
|
+
control: { disable: true },
|
|
67
|
+
},
|
|
68
|
+
variant: {
|
|
69
|
+
control: { disable: true },
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const Actionable = (args, { argTypes }) => ({
|
|
74
|
+
components: { GlBadge },
|
|
75
|
+
props: Object.keys(argTypes),
|
|
76
|
+
template: `
|
|
77
|
+
<div>
|
|
78
|
+
<gl-badge
|
|
79
|
+
v-for="variant in $options.badgeVariantOptions"
|
|
80
|
+
:key="variant"
|
|
81
|
+
:href="href"
|
|
82
|
+
:variant="variant"
|
|
83
|
+
:size="size"
|
|
84
|
+
:icon="icon"
|
|
85
|
+
class="gl-mr-3"
|
|
86
|
+
>{{ variant }}</gl-badge>
|
|
87
|
+
</div>
|
|
88
|
+
`,
|
|
89
|
+
badgeVariantOptions,
|
|
90
|
+
});
|
|
91
|
+
Actionable.args = generateProps({
|
|
42
92
|
href: '#foo',
|
|
43
93
|
variant: badgeVariantOptions.warning,
|
|
44
94
|
});
|
|
95
|
+
Actionable.parameters = {
|
|
96
|
+
storyshots: { disable: true },
|
|
97
|
+
};
|
|
98
|
+
Actionable.argTypes = {
|
|
99
|
+
content: {
|
|
100
|
+
control: { disable: true },
|
|
101
|
+
},
|
|
102
|
+
variant: {
|
|
103
|
+
control: { disable: true },
|
|
104
|
+
},
|
|
105
|
+
};
|
|
45
106
|
|
|
46
|
-
export const
|
|
47
|
-
|
|
48
|
-
|
|
107
|
+
export const Sizes = (args, { argTypes }) => ({
|
|
108
|
+
components: { GlBadge },
|
|
109
|
+
props: Object.keys(argTypes),
|
|
110
|
+
template: `
|
|
111
|
+
<div>
|
|
112
|
+
<gl-badge
|
|
113
|
+
v-for="size in $options.badgeSizeOptions"
|
|
114
|
+
:key="size"
|
|
115
|
+
:href="href"
|
|
116
|
+
:variant="variant"
|
|
117
|
+
:size="size"
|
|
118
|
+
:icon="icon"
|
|
119
|
+
class="gl-mr-3"
|
|
120
|
+
>{{ size }}</gl-badge>
|
|
121
|
+
</div>
|
|
122
|
+
`,
|
|
123
|
+
badgeSizeOptions,
|
|
124
|
+
});
|
|
125
|
+
Sizes.args = generateProps({
|
|
49
126
|
variant: badgeVariantOptions.danger,
|
|
50
127
|
});
|
|
128
|
+
Sizes.argTypes = {
|
|
129
|
+
content: {
|
|
130
|
+
control: { disable: true },
|
|
131
|
+
},
|
|
132
|
+
size: {
|
|
133
|
+
control: { disable: true },
|
|
134
|
+
},
|
|
135
|
+
};
|
|
51
136
|
|
|
52
|
-
export const BadgeIcon =
|
|
137
|
+
export const BadgeIcon = (args, { argTypes }) => ({
|
|
138
|
+
components: { GlBadge },
|
|
139
|
+
props: Object.keys(argTypes),
|
|
140
|
+
template: `
|
|
141
|
+
<div>
|
|
142
|
+
<gl-badge
|
|
143
|
+
:href="href"
|
|
144
|
+
:variant="variant"
|
|
145
|
+
:size="size"
|
|
146
|
+
:icon="icon"
|
|
147
|
+
>{{ content }}</gl-badge>
|
|
148
|
+
<gl-badge
|
|
149
|
+
:href="href"
|
|
150
|
+
:variant="variant"
|
|
151
|
+
:size="size"
|
|
152
|
+
:icon="icon"
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
`,
|
|
156
|
+
});
|
|
53
157
|
BadgeIcon.args = generateProps({
|
|
54
158
|
variant: badgeVariantOptions.success,
|
|
55
159
|
icon: 'calendar',
|
|
160
|
+
content: 'Badge icon',
|
|
56
161
|
});
|
|
57
162
|
|
|
58
163
|
export default {
|
|
@@ -68,21 +173,21 @@ export default {
|
|
|
68
173
|
},
|
|
69
174
|
argTypes: {
|
|
70
175
|
variant: {
|
|
176
|
+
options: Object.keys(badgeVariantOptions),
|
|
71
177
|
control: {
|
|
72
178
|
type: 'select',
|
|
73
|
-
options: badgeVariantOptions,
|
|
74
179
|
},
|
|
75
180
|
},
|
|
76
181
|
size: {
|
|
182
|
+
options: Object.keys(badgeSizeOptions),
|
|
77
183
|
control: {
|
|
78
184
|
type: 'select',
|
|
79
|
-
options: badgeSizeOptions,
|
|
80
185
|
},
|
|
81
186
|
},
|
|
82
187
|
icon: {
|
|
188
|
+
options: ['', ...iconSpriteInfo.icons],
|
|
83
189
|
control: {
|
|
84
190
|
type: 'select',
|
|
85
|
-
options: ['', ...iconSpriteInfo.icons],
|
|
86
191
|
},
|
|
87
192
|
},
|
|
88
193
|
},
|
|
@@ -29,7 +29,7 @@ const generateProps = ({
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
const Template = (args, { argTypes }) => ({
|
|
32
|
-
|
|
32
|
+
components: {
|
|
33
33
|
GlBroadcastMessage,
|
|
34
34
|
},
|
|
35
35
|
props: Object.keys(argTypes),
|
|
@@ -39,7 +39,7 @@ export const Default = Template.bind({});
|
|
|
39
39
|
Default.args = generateProps();
|
|
40
40
|
|
|
41
41
|
const StackedStory = (args, { argTypes }) => ({
|
|
42
|
-
|
|
42
|
+
components: {
|
|
43
43
|
GlBroadcastMessage,
|
|
44
44
|
},
|
|
45
45
|
props: Object.keys(argTypes),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlButton } from '../../../../index';
|
|
1
|
+
import { GlButton, GlButtonGroup, GlBadge, GlDropdown, GlDropdownItem } from '../../../../index';
|
|
2
2
|
import {
|
|
3
3
|
buttonCategoryOptions,
|
|
4
4
|
buttonVariantOptions,
|
|
@@ -111,7 +111,7 @@ IconButton.args = generateProps({
|
|
|
111
111
|
|
|
112
112
|
export const DropdownButton = (args, { argTypes }) => ({
|
|
113
113
|
props: Object.keys(argTypes),
|
|
114
|
-
components,
|
|
114
|
+
components: { GlDropdown, GlDropdownItem },
|
|
115
115
|
template: wrapDropdownButton(`
|
|
116
116
|
<gl-dropdown
|
|
117
117
|
text="Some dropdown"
|
|
@@ -129,7 +129,7 @@ DropdownButton.args = generateProps();
|
|
|
129
129
|
|
|
130
130
|
export const DropdownIconButton = (args, { argTypes }) => ({
|
|
131
131
|
props: Object.keys(argTypes),
|
|
132
|
-
components,
|
|
132
|
+
components: { GlDropdown, GlDropdownItem },
|
|
133
133
|
template: wrapDropdownButton(`
|
|
134
134
|
<gl-dropdown
|
|
135
135
|
icon="download"
|
|
@@ -149,7 +149,7 @@ DropdownIconButton.args = generateProps();
|
|
|
149
149
|
|
|
150
150
|
export const DropdownIconTextButton = (args, { argTypes }) => ({
|
|
151
151
|
props: Object.keys(argTypes),
|
|
152
|
-
components,
|
|
152
|
+
components: { GlDropdown, GlDropdownItem },
|
|
153
153
|
template: wrapDropdownButton(`
|
|
154
154
|
<gl-dropdown
|
|
155
155
|
icon="notifications"
|
|
@@ -168,7 +168,7 @@ DropdownIconTextButton.args = generateProps();
|
|
|
168
168
|
|
|
169
169
|
export const DropdownIconOnlyButton = (args, { argTypes }) => ({
|
|
170
170
|
props: Object.keys(argTypes),
|
|
171
|
-
components,
|
|
171
|
+
components: { GlDropdown, GlDropdownItem },
|
|
172
172
|
template: wrapDropdownButton(`
|
|
173
173
|
<gl-dropdown
|
|
174
174
|
icon="ellipsis_v"
|
|
@@ -191,7 +191,7 @@ DropdownIconOnlyButton.args = generateProps({
|
|
|
191
191
|
|
|
192
192
|
export const DropdownSplitButton = (args, { argTypes }) => ({
|
|
193
193
|
props: Object.keys(argTypes),
|
|
194
|
-
components,
|
|
194
|
+
components: { GlDropdown, GlDropdownItem },
|
|
195
195
|
template: wrapDropdownButton(`
|
|
196
196
|
<gl-dropdown
|
|
197
197
|
split
|
|
@@ -210,7 +210,7 @@ DropdownSplitButton.args = generateProps({ category: 'primary', variant: 'confir
|
|
|
210
210
|
|
|
211
211
|
export const DropdownIconSplitButton = (args, { argTypes }) => ({
|
|
212
212
|
props: Object.keys(argTypes),
|
|
213
|
-
components,
|
|
213
|
+
components: { GlDropdown, GlDropdownItem },
|
|
214
214
|
template: wrapDropdownButton(`
|
|
215
215
|
<gl-dropdown
|
|
216
216
|
split
|
|
@@ -230,7 +230,7 @@ DropdownIconSplitButton.args = generateProps({ category: 'secondary', variant: '
|
|
|
230
230
|
|
|
231
231
|
export const DropdownLoadingButton = (args, { argTypes }) => ({
|
|
232
232
|
props: Object.keys(argTypes),
|
|
233
|
-
components,
|
|
233
|
+
components: { GlDropdown, GlDropdownItem },
|
|
234
234
|
template: `
|
|
235
235
|
<gl-dropdown text="Some dropdown" :category="category" :loading="true">
|
|
236
236
|
<gl-dropdown-item>Dropdown item</gl-dropdown-item>
|
|
@@ -333,7 +333,7 @@ BorderlessTertiary.args = generateProps({ category: 'tertiary' });
|
|
|
333
333
|
|
|
334
334
|
export const LabelButton = (args, { argTypes = {} }) => ({
|
|
335
335
|
props: Object.keys(argTypes),
|
|
336
|
-
components,
|
|
336
|
+
components: { GlButton, GlButtonGroup },
|
|
337
337
|
template: `
|
|
338
338
|
<div>
|
|
339
339
|
<gl-button label>Label</gl-button>
|
|
@@ -451,7 +451,7 @@ Sizes.parameters = { controls: { disable: true } };
|
|
|
451
451
|
|
|
452
452
|
export const Badges = (args, { argTypes = {} }) => ({
|
|
453
453
|
props: Object.keys(argTypes),
|
|
454
|
-
components,
|
|
454
|
+
components: { GlButton, GlBadge },
|
|
455
455
|
variants: Object.keys(badgeForButtonOptions),
|
|
456
456
|
categories: buttonCategoryOptions,
|
|
457
457
|
style: {
|
|
@@ -483,7 +483,7 @@ Badges.parameters = { controls: { disable: true } };
|
|
|
483
483
|
|
|
484
484
|
export const BadgeWithSROnlyText = (args, { argTypes = {} }) => ({
|
|
485
485
|
props: Object.keys(argTypes),
|
|
486
|
-
components,
|
|
486
|
+
components: { GlButton, GlBadge },
|
|
487
487
|
template: `
|
|
488
488
|
<gl-button variant="confirm" buttonTextClasses="gl-display-flex gl-align-items-center">
|
|
489
489
|
Submit review
|