@gitlab/ui 33.1.2 → 36.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 +55 -0
- 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/nav/nav.documentation.js +2 -7
- package/dist/components/base/tabs/tabs/tabs.documentation.js +1 -1
- package/dist/components/base/tabs/tabs/tabs.js +2 -12
- package/dist/components/utilities/truncate/truncate.documentation.js +2 -17
- package/dist/components/utilities/truncate/truncate.js +11 -0
- 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/documentation/all_components.js +2 -2
- package/documentation/components_documentation.js +0 -2
- package/documentation/documented_stories.js +4 -0
- package/package.json +15 -18
- package/src/charts.js +19 -0
- package/src/components/base/alert/alert.stories.js +1 -1
- 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 +115 -10
- package/src/components/base/banner/banner.stories.js +1 -1
- package/src/components/base/breadcrumb/breadcrumb.stories.js +1 -1
- package/src/components/base/broadcast_message/broadcast_message.stories.js +3 -3
- package/src/components/base/button/button.stories.js +11 -11
- package/src/components/base/button_group/button_group.stories.js +1 -1
- package/src/components/base/collapse/collapse.stories.js +1 -1
- package/src/components/base/drawer/drawer.stories.js +1 -1
- package/src/components/base/dropdown/dropdown.stories.js +5 -3
- package/src/components/base/dropdown/dropdown_divider.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_form.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_item.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_section_header.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_text.stories.js +1 -1
- 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.stories.js +1 -1
- package/src/components/base/form/form_checkbox/form_checkbox.stories.js +1 -1
- package/src/components/base/form/form_group/form_group.stories.js +6 -5
- package/src/components/base/form/form_input/form_input.stories.js +1 -1
- package/src/components/base/form/form_input_group/form_input_group.stories.js +1 -1
- package/src/components/base/form/form_radio/form_radio.stories.js +1 -1
- package/src/components/base/form/form_radio_group/form_radio_group.stories.js +2 -1
- package/src/components/base/form/form_select/form_select.stories.js +1 -1
- package/src/components/base/form/form_text/form_text.vue +3 -1
- package/src/components/base/form/form_textarea/form_textarea.stories.js +1 -1
- package/src/components/base/icon/icon.stories.js +1 -1
- package/src/components/base/infinite_scroll/infinite_scroll.stories.js +1 -1
- package/src/components/base/label/label.stories.js +1 -1
- package/src/components/base/link/link.stories.js +1 -1
- package/src/components/base/loading_icon/loading_icon.stories.js +2 -1
- package/src/components/base/modal/modal.scss +5 -2
- package/src/components/base/modal/modal.stories.js +1 -1
- package/src/components/base/nav/nav.documentation.js +0 -4
- package/src/components/base/nav/nav.md +8 -5
- package/src/components/base/nav/nav.stories.js +52 -15
- package/src/components/base/navbar/navbar.stories.js +1 -1
- package/src/components/base/paginated_list/paginated_list.stories.js +1 -1
- 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/progress_bar/progress_bar.stories.js +1 -1
- package/src/components/base/search_box_by_click/search_box_by_click.stories.js +1 -1
- package/src/components/base/search_box_by_type/search_box_by_type.stories.js +1 -1
- package/src/components/base/segmented_control/segmented_control.stories.js +1 -1
- package/src/components/base/skeleton_loader/skeleton_loader.stories.js +1 -1
- package/src/components/base/skeleton_loading/skeleton_loading.stories.js +1 -1
- package/src/components/base/sorting/sorting.stories.js +1 -1
- package/src/components/base/sorting/sorting_item.stories.js +1 -1
- 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 +8 -5
- package/src/components/base/tabs/tabs/tabs.stories.js +9 -13
- package/src/components/base/tabs/tabs/tabs.vue +2 -11
- package/src/components/base/toast/toast.stories.js +6 -4
- package/src/components/base/toggle/toggle.stories.js +1 -1
- package/src/components/base/token/token.stories.js +2 -2
- package/src/components/base/tooltip/tooltip.stories.js +2 -1
- package/src/components/charts/area/area.stories.js +1 -1
- package/src/components/charts/bar/bar.stories.js +1 -1
- package/src/components/charts/chart/chart.stories.js +2 -2
- package/src/components/charts/column/column.stories.js +1 -1
- package/src/components/charts/discrete_scatter/discrete_scatter.stories.js +1 -1
- package/src/components/charts/heatmap/heatmap.stories.js +1 -1
- package/src/components/charts/legend/legend.stories.js +1 -1
- package/src/components/charts/line/line.stories.js +1 -1
- package/src/components/charts/series_label/series_label.stories.js +1 -1
- package/src/components/charts/single_stat/single_stat.stories.js +1 -1
- package/src/components/charts/sparkline/sparkline.stories.js +1 -1
- package/src/components/charts/stacked_column/stacked_column.stories.js +1 -1
- package/src/components/charts/tooltip/tooltip.stories.js +1 -1
- package/src/components/regions/dashboard_skeleton/dashboard_skeleton.stories.js +1 -1
- package/src/components/regions/empty_state/empty_state.stories.js +1 -1
- package/src/components/utilities/friendly_wrap/friendly_wrap.stories.js +1 -1
- package/src/components/utilities/intersection_observer/intersection_observer.stories.js +1 -1
- package/src/components/utilities/intersperse/intersperse.stories.js +1 -1
- package/src/components/utilities/sprintf/sprintf.stories.js +1 -1
- package/src/components/utilities/truncate/truncate.documentation.js +0 -14
- package/src/components/utilities/truncate/truncate.md +0 -4
- package/src/components/utilities/truncate/truncate.stories.js +38 -27
- package/src/components/utilities/truncate/truncate.vue +9 -0
- package/{config.js → src/config.js} +1 -1
- package/src/directives/hover_load/hover_load.stories.js +1 -1
- package/src/directives/outside/outside.stories.js +1 -1
- package/src/directives/resize_observer/resize_observer.stories.js +1 -1
- package/src/directives/safe_html/safe_html.stories.js +1 -1
- package/src/index.js +111 -0
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/box-shadow.scss +4 -0
- package/{utils.js → src/utils.js} +1 -1
- package/charts.js +0 -19
- package/dist/components/base/nav/examples/index.js +0 -13
- package/dist/components/base/nav/examples/nav.basic.example.js +0 -38
- package/dist/components/base/nav/nav_item.documentation.js +0 -13
- package/dist/components/base/nav/nav_item_dropdown.documentation.js +0 -14
- package/dist/components/utilities/truncate/examples/index.js +0 -13
- package/dist/components/utilities/truncate/examples/truncate.basic.example.js +0 -38
- package/index.js +0 -111
- package/src/components/base/nav/examples/index.js +0 -15
- package/src/components/base/nav/examples/nav.basic.example.vue +0 -8
- package/src/components/base/nav/nav_item.documentation.js +0 -6
- package/src/components/base/nav/nav_item.md +0 -7
- package/src/components/base/nav/nav_item.stories.js +0 -23
- package/src/components/base/nav/nav_item_dropdown.documentation.js +0 -7
- package/src/components/base/nav/nav_item_dropdown.md +0 -7
- package/src/components/base/nav/nav_item_dropdown.stories.js +0 -51
- package/src/components/utilities/truncate/examples/index.js +0 -15
- package/src/components/utilities/truncate/examples/truncate.basic.example.vue +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as chartComponents from '../charts';
|
|
2
|
-
import * as components from '../
|
|
1
|
+
import * as chartComponents from '../src/charts';
|
|
2
|
+
import * as components from '../src';
|
|
3
3
|
|
|
4
4
|
export const gitlabComponents = { ...components, ...chartComponents };
|
|
5
5
|
export const gitlabChartComponents = { ...chartComponents };
|
|
@@ -9,9 +9,7 @@ export { default as GlFormTextDocumentation } from '../src/components/base/form/
|
|
|
9
9
|
export { default as GlFormComboboxDocumentation } from '../src/components/base/form/form_combobox/form_combobox.documentation';
|
|
10
10
|
export { default as GlGaugeChartDocumentation } from '../src/components/charts/gauge/gauge.documentation';
|
|
11
11
|
export { default as GlTokenSelectorDocumentation } from '../src/components/base/token_selector/token_selector.documentation';
|
|
12
|
-
export { default as GlNavItemDropdownDocumentation } from '../src/components/base/nav/nav_item_dropdown.documentation';
|
|
13
12
|
export { default as GlNavDocumentation } from '../src/components/base/nav/nav.documentation';
|
|
14
|
-
export { default as GlNavItemDocumentation } from '../src/components/base/nav/nav_item.documentation';
|
|
15
13
|
export { default as GlFormCheckboxTreeDocumentation } from '../src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation';
|
|
16
14
|
export { default as GlMarkdownDocumentation } from '../src/components/base/markdown/markdown.documentation';
|
|
17
15
|
export { default as GlNavbarDocumentation } from '../src/components/base/navbar/navbar.documentation';
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "36.0.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"jsnext:main": "dist/index.js",
|
|
9
|
+
"source": "src/index.js",
|
|
9
10
|
"sideEffects": [
|
|
10
11
|
"*.css",
|
|
11
12
|
"*.scss"
|
|
@@ -17,11 +18,7 @@
|
|
|
17
18
|
"src",
|
|
18
19
|
"dist",
|
|
19
20
|
"scss_to_js",
|
|
20
|
-
"documentation"
|
|
21
|
-
"index.js",
|
|
22
|
-
"charts.js",
|
|
23
|
-
"utils.js",
|
|
24
|
-
"config.js"
|
|
21
|
+
"documentation"
|
|
25
22
|
],
|
|
26
23
|
"scripts": {
|
|
27
24
|
"build": "NODE_ENV=production rollup -c",
|
|
@@ -85,21 +82,21 @@
|
|
|
85
82
|
"@arkweid/lefthook": "^0.7.6",
|
|
86
83
|
"@babel/core": "^7.10.2",
|
|
87
84
|
"@babel/preset-env": "^7.10.2",
|
|
88
|
-
"@gitlab/eslint-plugin": "10.0.
|
|
89
|
-
"@gitlab/stylelint-config": "
|
|
85
|
+
"@gitlab/eslint-plugin": "10.0.2",
|
|
86
|
+
"@gitlab/stylelint-config": "4.0.0",
|
|
90
87
|
"@gitlab/svgs": "2.2.0",
|
|
91
88
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
92
89
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
93
90
|
"@rollup/plugin-replace": "^2.3.2",
|
|
94
|
-
"@storybook/addon-a11y": "6.4.
|
|
95
|
-
"@storybook/addon-docs": "6.4.
|
|
96
|
-
"@storybook/addon-essentials": "6.4.
|
|
91
|
+
"@storybook/addon-a11y": "6.4.15",
|
|
92
|
+
"@storybook/addon-docs": "6.4.15",
|
|
93
|
+
"@storybook/addon-essentials": "6.4.15",
|
|
97
94
|
"@storybook/addon-knobs": "6.4.0",
|
|
98
|
-
"@storybook/addon-storyshots": "6.4.
|
|
99
|
-
"@storybook/addon-storyshots-puppeteer": "6.4.
|
|
100
|
-
"@storybook/addon-viewport": "6.4.
|
|
101
|
-
"@storybook/theming": "6.4.
|
|
102
|
-
"@storybook/vue": "6.4.
|
|
95
|
+
"@storybook/addon-storyshots": "6.4.15",
|
|
96
|
+
"@storybook/addon-storyshots-puppeteer": "6.4.15",
|
|
97
|
+
"@storybook/addon-viewport": "6.4.15",
|
|
98
|
+
"@storybook/theming": "6.4.15",
|
|
99
|
+
"@storybook/vue": "6.4.15",
|
|
103
100
|
"@vue/test-utils": "1.3.0",
|
|
104
101
|
"autoprefixer": "^9.7.6",
|
|
105
102
|
"babel-jest": "^26.6.3",
|
|
@@ -129,7 +126,7 @@
|
|
|
129
126
|
"npm-run-all": "^4.1.5",
|
|
130
127
|
"pikaday": "^1.8.0",
|
|
131
128
|
"plop": "^2.5.4",
|
|
132
|
-
"postcss": "
|
|
129
|
+
"postcss": "8.4.5",
|
|
133
130
|
"postcss-loader": "^3.0.0",
|
|
134
131
|
"postcss-scss": "^2.1.1",
|
|
135
132
|
"prettier": "2.2.1",
|
|
@@ -147,7 +144,7 @@
|
|
|
147
144
|
"sass-true": "^5.0.0",
|
|
148
145
|
"start-server-and-test": "^1.10.6",
|
|
149
146
|
"storybook-readme": "5.0.9",
|
|
150
|
-
"stylelint": "
|
|
147
|
+
"stylelint": "14.3.0",
|
|
151
148
|
"stylelint-config-prettier": "9.0.3",
|
|
152
149
|
"stylelint-prettier": "2.0.0",
|
|
153
150
|
"vue": "^2.6.11",
|
package/src/charts.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Add config files
|
|
2
|
+
import setConfigs from './config';
|
|
3
|
+
|
|
4
|
+
setConfigs();
|
|
5
|
+
|
|
6
|
+
export { default as GlChart } from './components/charts/chart/chart.vue';
|
|
7
|
+
export { default as GlAreaChart } from './components/charts/area/area.vue';
|
|
8
|
+
export { default as GlBarChart } from './components/charts/bar/bar.vue';
|
|
9
|
+
export { default as GlGaugeChart } from './components/charts/gauge/gauge.vue';
|
|
10
|
+
export { default as GlLineChart } from './components/charts/line/line.vue';
|
|
11
|
+
export { default as GlChartLegend } from './components/charts/legend/legend.vue';
|
|
12
|
+
export { default as GlChartSeriesLabel } from './components/charts/series_label/series_label.vue';
|
|
13
|
+
export { default as GlChartTooltip } from './components/charts/tooltip/tooltip.vue';
|
|
14
|
+
export { default as GlHeatmap } from './components/charts/heatmap';
|
|
15
|
+
export { default as GlColumnChart } from './components/charts/column/column.vue';
|
|
16
|
+
export { default as GlStackedColumnChart } from './components/charts/stacked_column/stacked_column.vue';
|
|
17
|
+
export { default as GlDiscreteScatterChart } from './components/charts/discrete_scatter/discrete_scatter.vue';
|
|
18
|
+
export { default as GlSingleStat } from './components/charts/single_stat/single_stat.vue';
|
|
19
|
+
export { default as GlSparklineChart } from './components/charts/sparkline/sparkline.vue';
|
|
@@ -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>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import iconSpriteInfo from '@gitlab/svgs/dist/icons.json';
|
|
2
|
-
import { GlBadge } from '
|
|
2
|
+
import { GlBadge } from '../../../index';
|
|
3
3
|
import { badgeSizeOptions, badgeVariantOptions } from '../../../utils/constants';
|
|
4
4
|
import readme from './badge.md';
|
|
5
5
|
|
|
@@ -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
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clusterPopoverSvg from '@gitlab/svgs/dist/illustrations/cluster_popover.svg';
|
|
2
2
|
import serviceDeskCalloutSvg from '@gitlab/svgs/dist/illustrations/service_desk_callout.svg';
|
|
3
|
-
import { GlBanner, GlButton } from '
|
|
3
|
+
import { GlBanner, GlButton } from '../../../index';
|
|
4
4
|
import { bannerVariants } from '../../../utils/constants';
|
|
5
5
|
import readme from './banner.md';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import iconSpriteInfo from '@gitlab/svgs/dist/icons.json';
|
|
2
|
-
import { GlBroadcastMessage } from '
|
|
2
|
+
import { GlBroadcastMessage } from '../../../index';
|
|
3
3
|
import { colorThemes } from '../../../utils/constants';
|
|
4
4
|
import readme from './broadcast_message.md';
|
|
5
5
|
|
|
@@ -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),
|