@gitlab/ui 32.43.2 → 32.45.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 +29 -0
- package/README.md +6 -1
- package/config.js +15 -3
- package/dist/components/base/avatar/avatar.documentation.js +2 -5
- package/dist/components/base/avatar_link/avatar_link.documentation.js +2 -5
- package/dist/components/base/form/form_input/form_input.documentation.js +2 -27
- package/dist/components/base/form/form_input/form_input.js +23 -6
- package/dist/components/base/form/form_text/form_text.documentation.js +1 -4
- package/dist/components/base/form/form_textarea/form_textarea.documentation.js +1 -20
- package/dist/components/base/form/form_textarea/form_textarea.js +8 -0
- package/dist/components/base/label/label.documentation.js +2 -9
- package/dist/components/base/label/label.js +23 -1
- package/dist/components/base/pagination/pagination.documentation.js +2 -85
- package/dist/components/base/pagination/pagination.js +76 -0
- package/dist/components/base/segmented_control/segmented_control.documentation.js +2 -14
- package/dist/components/base/segmented_control/segmented_control.js +6 -0
- package/dist/components/base/skeleton_loader/skeleton_loader.documentation.js +2 -28
- package/dist/components/base/skeleton_loader/skeleton_loader.js +30 -0
- package/dist/components/charts/chart/chart.js +17 -4
- package/dist/components/charts/heatmap/heatmap.js +1 -9
- package/dist/components/charts/sparkline/sparkline.js +1 -1
- package/dist/config.js +15 -3
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/documentation/documented_stories.js +8 -0
- package/package.json +13 -12
- package/src/components/base/alert/alert.spec.js +2 -2
- package/src/components/base/avatar/avatar.documentation.js +0 -2
- package/src/components/base/avatar/avatar.md +0 -2
- package/src/components/base/avatar/avatar.spec.js +1 -2
- package/src/components/base/avatar/avatar.stories.js +88 -101
- package/src/components/base/avatar_link/avatar_link.documentation.js +0 -2
- package/src/components/base/avatar_link/avatar_link.md +4 -7
- package/src/components/base/avatar_link/avatar_link.stories.js +66 -54
- package/src/components/base/filtered_search/filtered_search.spec.js +35 -35
- package/src/components/base/filtered_search/filtered_search_term.spec.js +1 -1
- package/src/components/base/form/form_input/form_input.documentation.js +0 -31
- package/src/components/base/form/form_input/form_input.md +0 -2
- package/src/components/base/form/form_input/form_input.stories.js +50 -42
- package/src/components/base/form/form_input/form_input.vue +23 -6
- package/src/components/base/form/form_input_group/form_input_group.spec.js +1 -3
- package/src/components/base/form/form_text/form_text.documentation.js +0 -2
- package/src/components/base/form/form_text/form_text.md +1 -3
- package/src/components/base/form/form_text/form_text.stories.js +20 -8
- package/src/components/base/form/form_textarea/form_textarea.documentation.js +0 -25
- package/src/components/base/form/form_textarea/form_textarea.stories.js +31 -30
- package/src/components/base/form/form_textarea/form_textarea.vue +8 -0
- package/src/components/base/icon/icon.spec.js +1 -4
- package/src/components/base/infinite_scroll/infinite_scroll.spec.js +1 -4
- package/src/components/base/label/label.documentation.js +2 -12
- package/src/components/base/label/label.md +2 -7
- package/src/components/base/label/label.stories.js +66 -92
- package/src/components/base/label/label.vue +22 -2
- package/src/components/base/modal/modal.spec.js +19 -23
- package/src/components/base/paginated_list/__snapshots__/paginated_list.spec.js.snap +10 -10
- package/src/components/base/pagination/pagination.documentation.js +0 -100
- package/src/components/base/pagination/pagination.md +5 -9
- package/src/components/base/pagination/pagination.spec.js +1 -4
- package/src/components/base/pagination/pagination.stories.js +109 -117
- package/src/components/base/pagination/pagination.vue +85 -0
- package/src/components/base/search_box_by_click/search_box_by_click.spec.js +1 -5
- package/src/components/base/segmented_control/segmented_control.documentation.js +0 -15
- package/src/components/base/segmented_control/segmented_control.md +0 -2
- package/src/components/base/segmented_control/segmented_control.stories.js +46 -36
- package/src/components/base/segmented_control/segmented_control.vue +5 -0
- package/src/components/base/skeleton_loader/skeleton_loader.documentation.js +0 -27
- package/src/components/base/skeleton_loader/skeleton_loader.md +0 -2
- package/src/components/base/skeleton_loader/skeleton_loader.stories.js +23 -9
- package/src/components/base/skeleton_loader/skeleton_loader.vue +24 -0
- package/src/components/base/sorting/sorting.spec.js +1 -4
- package/src/components/base/toast/toast.spec.js +4 -6
- package/src/components/base/token/token.spec.js +1 -4
- package/src/components/base/token_selector/token_container.spec.js +2 -3
- package/src/components/charts/chart/chart.spec.js +33 -4
- package/src/components/charts/chart/chart.vue +16 -4
- package/src/components/charts/gauge/gauge.spec.js +7 -7
- package/src/components/charts/heatmap/heatmap.vue +2 -9
- package/src/components/charts/sparkline/sparkline.spec.js +1 -4
- package/src/components/charts/sparkline/sparkline.vue +7 -1
- package/src/components/utilities/friendly_wrap/friendly_wrap.spec.js +1 -4
- package/src/components/utilities/intersperse/intersperse.spec.js +1 -4
- package/src/directives/hover_load/hover_load.spec.js +2 -13
- package/src/directives/outside/outside.spec.js +1 -6
- package/src/directives/resize_observer/resize_observer.spec.js +4 -10
- package/src/scss/storybook.scss +8 -0
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/transform.scss +4 -0
- package/dist/components/base/avatar/examples/avatar.fallback.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.image.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.rect.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.tooltip.example.js +0 -38
- package/dist/components/base/avatar/examples/index.js +0 -31
- package/dist/components/base/avatar_link/examples/avatar.link.example.js +0 -38
- package/dist/components/base/avatar_link/examples/index.js +0 -13
- package/dist/components/base/form/form_input/examples/form_input/form_input.text.example.js +0 -38
- package/dist/components/base/form/form_input/examples/form_input/form_input.text_disabled.example.js +0 -38
- package/dist/components/base/form/form_input/examples/form_input/form_input.text_reactive.example.js +0 -57
- package/dist/components/base/form/form_input/examples/form_input/index.js +0 -22
- package/dist/components/base/form/form_text/examples/form_text.basic.example.js +0 -38
- package/dist/components/base/form/form_text/examples/index.js +0 -13
- package/dist/components/base/form/form_textarea/examples/form_textarea.basic.example.js +0 -47
- package/dist/components/base/form/form_textarea/examples/form_textarea.invalid.example.js +0 -47
- package/dist/components/base/form/form_textarea/examples/form_textarea.plaintext.example.js +0 -47
- package/dist/components/base/form/form_textarea/examples/form_textarea.readonly.example.js +0 -45
- package/dist/components/base/form/form_textarea/examples/form_textarea.submit.example.js +0 -47
- package/dist/components/base/form/form_textarea/examples/index.js +0 -37
- package/dist/components/base/label/examples/index.js +0 -19
- package/dist/components/base/label/examples/label.basic.example.js +0 -38
- package/dist/components/base/label/examples/label.scoped.example.js +0 -38
- package/dist/components/base/pagination/examples/index.js +0 -37
- package/dist/components/base/pagination/examples/pagination.basic.example.js +0 -45
- package/dist/components/base/pagination/examples/pagination.compact.example.js +0 -58
- package/dist/components/base/pagination/examples/pagination.double_truncation.example.js +0 -45
- package/dist/components/base/pagination/examples/pagination.event.example.js +0 -51
- package/dist/components/base/pagination/examples/pagination.links.example.js +0 -45
- package/dist/components/base/segmented_control/examples/index.js +0 -19
- package/dist/components/base/segmented_control/examples/segmented_control.basic.example.js +0 -65
- package/dist/components/base/segmented_control/examples/segmented_control.whitespace.example.js +0 -55
- package/dist/components/base/skeleton_loader/examples/ci_header_skeleton.basic.example.js +0 -38
- package/dist/components/base/skeleton_loader/examples/default_skeleton.basic.example.js +0 -38
- package/dist/components/base/skeleton_loader/examples/default_skeleton_custom_props.basic.example.js +0 -38
- package/dist/components/base/skeleton_loader/examples/index.js +0 -37
- package/dist/components/base/skeleton_loader/examples/issue_card_skeleton.basic.example.js +0 -38
- package/dist/components/base/skeleton_loader/examples/job_log_skeleton.basic.example.js +0 -38
- package/src/components/base/avatar/examples/avatar.fallback.example.vue +0 -3
- package/src/components/base/avatar/examples/avatar.image.example.vue +0 -3
- package/src/components/base/avatar/examples/avatar.rect.example.vue +0 -6
- package/src/components/base/avatar/examples/avatar.tooltip.example.vue +0 -3
- package/src/components/base/avatar/examples/index.js +0 -36
- package/src/components/base/avatar_link/examples/avatar.link.example.vue +0 -5
- package/src/components/base/avatar_link/examples/index.js +0 -15
- package/src/components/base/form/form_input/examples/form_input/form_input.text.example.vue +0 -3
- package/src/components/base/form/form_input/examples/form_input/form_input.text_disabled.example.vue +0 -3
- package/src/components/base/form/form_input/examples/form_input/form_input.text_reactive.example.vue +0 -24
- package/src/components/base/form/form_input/examples/form_input/index.js +0 -26
- package/src/components/base/form/form_text/examples/form_text.basic.example.vue +0 -5
- package/src/components/base/form/form_text/examples/index.js +0 -15
- package/src/components/base/form/form_textarea/examples/form_textarea.basic.example.vue +0 -11
- package/src/components/base/form/form_textarea/examples/form_textarea.invalid.example.vue +0 -11
- package/src/components/base/form/form_textarea/examples/form_textarea.plaintext.example.vue +0 -13
- package/src/components/base/form/form_textarea/examples/form_textarea.readonly.example.vue +0 -9
- package/src/components/base/form/form_textarea/examples/form_textarea.submit.example.vue +0 -11
- package/src/components/base/form/form_textarea/examples/index.js +0 -43
- package/src/components/base/label/examples/index.js +0 -22
- package/src/components/base/label/examples/label.basic.example.vue +0 -3
- package/src/components/base/label/examples/label.scoped.example.vue +0 -3
- package/src/components/base/pagination/examples/index.js +0 -43
- package/src/components/base/pagination/examples/pagination.basic.example.vue +0 -17
- package/src/components/base/pagination/examples/pagination.compact.example.vue +0 -33
- package/src/components/base/pagination/examples/pagination.double_truncation.example.vue +0 -11
- package/src/components/base/pagination/examples/pagination.event.example.vue +0 -26
- package/src/components/base/pagination/examples/pagination.links.example.vue +0 -18
- package/src/components/base/segmented_control/examples/index.js +0 -22
- package/src/components/base/segmented_control/examples/segmented_control.basic.example.vue +0 -19
- package/src/components/base/segmented_control/examples/segmented_control.whitespace.example.vue +0 -18
- package/src/components/base/skeleton_loader/examples/ci_header_skeleton.basic.example.vue +0 -10
- package/src/components/base/skeleton_loader/examples/default_skeleton.basic.example.vue +0 -3
- package/src/components/base/skeleton_loader/examples/default_skeleton_custom_props.basic.example.vue +0 -9
- package/src/components/base/skeleton_loader/examples/index.js +0 -44
- package/src/components/base/skeleton_loader/examples/issue_card_skeleton.basic.example.vue +0 -26
- package/src/components/base/skeleton_loader/examples/job_log_skeleton.basic.example.vue +0 -13
|
@@ -94,6 +94,14 @@ export const setupStorybookReadme = () =>
|
|
|
94
94
|
'GlMarkdown',
|
|
95
95
|
'GlTokenSelector',
|
|
96
96
|
'GlTooltip',
|
|
97
|
+
'GlFormTextarea',
|
|
98
|
+
'GlFormInput',
|
|
99
|
+
'GlSegmentedControl',
|
|
100
|
+
'GlAvatar',
|
|
101
|
+
'GlAvatarLink',
|
|
102
|
+
'GlPagination',
|
|
103
|
+
'GlSkeletonLoader',
|
|
104
|
+
'GlLabel',
|
|
97
105
|
],
|
|
98
106
|
components: {
|
|
99
107
|
GlComponentDocumentation,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.45.1",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -60,9 +60,10 @@
|
|
|
60
60
|
"@babel/standalone": "^7.0.0",
|
|
61
61
|
"bootstrap-vue": "2.20.1",
|
|
62
62
|
"copy-to-clipboard": "^3.0.8",
|
|
63
|
-
"dompurify": "^2.3.
|
|
63
|
+
"dompurify": "^2.3.4",
|
|
64
64
|
"echarts": "^5.2.1",
|
|
65
65
|
"highlight.js": "^10.6.0",
|
|
66
|
+
"iframe-resizer": "^4.3.2",
|
|
66
67
|
"js-beautify": "^1.8.8",
|
|
67
68
|
"lodash": "^4.17.20",
|
|
68
69
|
"portal-vue": "^2.1.6",
|
|
@@ -84,20 +85,20 @@
|
|
|
84
85
|
"@babel/preset-env": "^7.10.2",
|
|
85
86
|
"@gitlab/eslint-plugin": "10.0.0",
|
|
86
87
|
"@gitlab/stylelint-config": "2.6.0",
|
|
87
|
-
"@gitlab/svgs": "1.
|
|
88
|
+
"@gitlab/svgs": "1.226.0",
|
|
88
89
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
89
90
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
90
91
|
"@rollup/plugin-replace": "^2.3.2",
|
|
91
|
-
"@storybook/addon-a11y": "6.4.
|
|
92
|
-
"@storybook/addon-docs": "6.4.
|
|
93
|
-
"@storybook/addon-essentials": "6.4.
|
|
92
|
+
"@storybook/addon-a11y": "6.4.9",
|
|
93
|
+
"@storybook/addon-docs": "6.4.9",
|
|
94
|
+
"@storybook/addon-essentials": "6.4.9",
|
|
94
95
|
"@storybook/addon-knobs": "6.4.0",
|
|
95
|
-
"@storybook/addon-storyshots": "6.4.
|
|
96
|
-
"@storybook/addon-storyshots-puppeteer": "6.4.
|
|
97
|
-
"@storybook/addon-viewport": "6.4.
|
|
98
|
-
"@storybook/theming": "6.4.
|
|
99
|
-
"@storybook/vue": "6.4.
|
|
100
|
-
"@vue/test-utils": "1.
|
|
96
|
+
"@storybook/addon-storyshots": "6.4.9",
|
|
97
|
+
"@storybook/addon-storyshots-puppeteer": "6.4.9",
|
|
98
|
+
"@storybook/addon-viewport": "6.4.9",
|
|
99
|
+
"@storybook/theming": "6.4.9",
|
|
100
|
+
"@storybook/vue": "6.4.9",
|
|
101
|
+
"@vue/test-utils": "1.3.0",
|
|
101
102
|
"autoprefixer": "^9.7.6",
|
|
102
103
|
"babel-jest": "^26.6.3",
|
|
103
104
|
"babel-loader": "^8.0.5",
|
|
@@ -50,7 +50,7 @@ describe('Alert component', () => {
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it('renders default slot content', () => {
|
|
53
|
-
expect(findBodyContainer().
|
|
53
|
+
expect(findBodyContainer().findComponent(DummyComponent).exists()).toBe(true);
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -148,7 +148,7 @@ describe('Alert component', () => {
|
|
|
148
148
|
|
|
149
149
|
const actionsContainer = findActionsContainer();
|
|
150
150
|
expect(actionsContainer.exists()).toBe(true);
|
|
151
|
-
expect(actionsContainer.
|
|
151
|
+
expect(actionsContainer.findComponent(DummyComponent).exists()).toBe(true);
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
describe('top-level classes', () => {
|
|
@@ -27,8 +27,7 @@ describe('GlAvatar', () => {
|
|
|
27
27
|
it.each([12, 28, 36, 54, 98])('displays an error for size %s', (size) => {
|
|
28
28
|
createWrapper({ size });
|
|
29
29
|
|
|
30
|
-
expect(
|
|
31
|
-
global.console.error.mockReset();
|
|
30
|
+
expect(wrapper).toHaveLoggedVueErrors();
|
|
32
31
|
});
|
|
33
32
|
});
|
|
34
33
|
});
|
|
@@ -1,121 +1,75 @@
|
|
|
1
|
-
import { select, text, number, withKnobs } from '@storybook/addon-knobs';
|
|
2
1
|
import Vue from 'vue';
|
|
3
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
4
2
|
import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
5
3
|
import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
|
|
6
4
|
import readme from './avatar.md';
|
|
7
5
|
|
|
8
6
|
Vue.directive('gl-tooltip', GlTooltipDirective);
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type: Number,
|
|
15
|
-
default: select('size', avatarSizeOptions, defaultSize),
|
|
16
|
-
},
|
|
17
|
-
shape: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: select('shape', avatarShapeOptions, 'circle'),
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return props;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function generateProjectFallbackProps() {
|
|
27
|
-
const defaultSize = avatarSizeOptions[1];
|
|
28
|
-
const props = {
|
|
29
|
-
entityId: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: number('entityId', 123),
|
|
32
|
-
},
|
|
33
|
-
entityName: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: text('entityName', 'Some Project'),
|
|
36
|
-
},
|
|
37
|
-
size: {
|
|
38
|
-
type: Number,
|
|
39
|
-
default: select('size', avatarSizeOptions, defaultSize),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
8
|
+
const generateImageProps = ({ size = 64, shape = 'circle' } = {}) => ({
|
|
9
|
+
size,
|
|
10
|
+
shape,
|
|
11
|
+
});
|
|
42
12
|
|
|
43
|
-
|
|
44
|
-
|
|
13
|
+
const generateProjectFallbackProps = ({
|
|
14
|
+
size = 64,
|
|
15
|
+
entityId = 123,
|
|
16
|
+
entityName = 'Some Project',
|
|
17
|
+
} = {}) => ({
|
|
18
|
+
entityId,
|
|
19
|
+
entityName,
|
|
20
|
+
size,
|
|
21
|
+
});
|
|
45
22
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
default: text('entityName', '🦊Tanuki'),
|
|
56
|
-
},
|
|
57
|
-
size: {
|
|
58
|
-
type: Number,
|
|
59
|
-
default: select('size', avatarSizeOptions, defaultSize),
|
|
60
|
-
},
|
|
61
|
-
};
|
|
23
|
+
const generateEmojiProjectProps = ({
|
|
24
|
+
size = 64,
|
|
25
|
+
entityId = 123,
|
|
26
|
+
entityName = '🦊Tanuki',
|
|
27
|
+
} = {}) => ({
|
|
28
|
+
entityId,
|
|
29
|
+
entityName,
|
|
30
|
+
size,
|
|
31
|
+
});
|
|
62
32
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const props = {
|
|
68
|
-
tooltipText: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: text('tooltipText', 'Avatar tooltip'),
|
|
71
|
-
},
|
|
72
|
-
placement: {
|
|
73
|
-
type: String,
|
|
74
|
-
default: select('placement', tooltipPlacements, 'top'),
|
|
75
|
-
},
|
|
76
|
-
};
|
|
33
|
+
const generateTooltipProps = ({ tooltipText = 'Avatar tooltip', placement = 'top' } = {}) => ({
|
|
34
|
+
tooltipText,
|
|
35
|
+
placement,
|
|
36
|
+
});
|
|
77
37
|
|
|
78
|
-
|
|
79
|
-
|
|
38
|
+
const template = `
|
|
39
|
+
<gl-avatar
|
|
40
|
+
:entity-name="entityName"
|
|
41
|
+
:entity-id="entityId"
|
|
42
|
+
:size="size"
|
|
43
|
+
shape="rect" />
|
|
44
|
+
`;
|
|
80
45
|
|
|
81
|
-
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
props: generateImageProps(),
|
|
85
|
-
template: `
|
|
46
|
+
export const Image = (args, { argTypes }) => ({
|
|
47
|
+
props: Object.keys(argTypes),
|
|
48
|
+
template: `
|
|
86
49
|
<gl-avatar
|
|
87
50
|
:size="size"
|
|
88
51
|
:shape="shape"
|
|
89
52
|
src="https://about.gitlab.com/images/press/gitlab-summit-south-africa.jpg"
|
|
90
53
|
/>
|
|
91
54
|
`,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
shape="rect" />
|
|
111
|
-
`,
|
|
112
|
-
}))
|
|
113
|
-
.add('with-tooltip', () => ({
|
|
114
|
-
props: {
|
|
115
|
-
...generateImageProps(),
|
|
116
|
-
...generateTooltipProps(),
|
|
117
|
-
},
|
|
118
|
-
template: `
|
|
55
|
+
});
|
|
56
|
+
Image.args = generateImageProps();
|
|
57
|
+
|
|
58
|
+
export const ProjectFallback = (args, { argTypes }) => ({
|
|
59
|
+
props: Object.keys(argTypes),
|
|
60
|
+
template,
|
|
61
|
+
});
|
|
62
|
+
ProjectFallback.args = generateProjectFallbackProps();
|
|
63
|
+
|
|
64
|
+
export const EmojiProjectName = (args, { argTypes }) => ({
|
|
65
|
+
props: Object.keys(argTypes),
|
|
66
|
+
template,
|
|
67
|
+
});
|
|
68
|
+
EmojiProjectName.args = generateEmojiProjectProps();
|
|
69
|
+
|
|
70
|
+
export const WithTooltip = (args, { argTypes }) => ({
|
|
71
|
+
props: Object.keys(argTypes),
|
|
72
|
+
template: `
|
|
119
73
|
<gl-avatar
|
|
120
74
|
:size="size"
|
|
121
75
|
:shape="shape"
|
|
@@ -124,4 +78,37 @@ documentedStoriesOf('base/avatar', readme)
|
|
|
124
78
|
v-gl-tooltip="{ placement }"
|
|
125
79
|
/>
|
|
126
80
|
`,
|
|
127
|
-
|
|
81
|
+
});
|
|
82
|
+
WithTooltip.args = { ...generateImageProps(), ...generateTooltipProps() };
|
|
83
|
+
|
|
84
|
+
export default {
|
|
85
|
+
title: 'base/avatar',
|
|
86
|
+
parameters: {
|
|
87
|
+
knobs: { disable: true },
|
|
88
|
+
docs: {
|
|
89
|
+
description: {
|
|
90
|
+
component: readme,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
argTypes: {
|
|
95
|
+
size: {
|
|
96
|
+
options: avatarSizeOptions,
|
|
97
|
+
control: {
|
|
98
|
+
type: 'select',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
shape: {
|
|
102
|
+
options: avatarShapeOptions,
|
|
103
|
+
control: {
|
|
104
|
+
type: 'select',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
placement: {
|
|
108
|
+
options: tooltipPlacements,
|
|
109
|
+
control: {
|
|
110
|
+
type: 'select',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
## Avatar link
|
|
2
|
-
|
|
3
1
|
`<gl-avatar-link>` decorates `<gl-avatar>` with hyperlink functionality. It accepts the same
|
|
4
2
|
properties as the `<gl-link>` component and it works in the same way too. The main purpose of this
|
|
5
3
|
component is to apply visual enhancements that makes evident that the user can interact with the
|
|
@@ -10,20 +8,20 @@ avatar.
|
|
|
10
8
|
When wrapping an `<gl-avatar>` component, `<gl-avatar-link>` darkens
|
|
11
9
|
the border that surrounds the avatar image or fallback text when hovering over it.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
```vue
|
|
14
12
|
<gl-avatar-link target="blank" href="https://gitlab.com/gitlab-org/gitlab">
|
|
15
13
|
<gl-avatar
|
|
16
14
|
:size="32"
|
|
17
15
|
:src="avatarUrl"
|
|
18
16
|
/>
|
|
19
17
|
</gl-avatar-link>
|
|
20
|
-
|
|
18
|
+
```
|
|
21
19
|
|
|
22
20
|
When wrapping an `<avatar-labeled>` component, `<avatar-link>` underlines
|
|
23
21
|
the label and sub-label text when hovering over the avatar. It also applies the
|
|
24
22
|
same effects described in the first example.
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
```vue
|
|
27
25
|
<gl-avatar-link target="blank" href="https://gitlab.com/gitlab-org/gitlab">
|
|
28
26
|
<gl-avatar-labeled
|
|
29
27
|
:size="32"
|
|
@@ -32,5 +30,4 @@ same effects described in the first example.
|
|
|
32
30
|
sub-label="@gitlab"
|
|
33
31
|
/>
|
|
34
32
|
</gl-avatar-link>
|
|
35
|
-
|
|
36
|
-
~~~
|
|
33
|
+
```
|
|
@@ -1,71 +1,83 @@
|
|
|
1
|
-
import { select, text, withKnobs } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { avatarSizeOptions, avatarShapeOptions } from '../../../utils/constants';
|
|
4
2
|
import readme from './avatar_link.md';
|
|
5
3
|
|
|
6
|
-
const generateDefaultProps = (
|
|
7
|
-
href
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
size: {
|
|
16
|
-
type: Number,
|
|
17
|
-
default: select('size', avatarSizeOptions, 32),
|
|
18
|
-
},
|
|
4
|
+
const generateDefaultProps = ({
|
|
5
|
+
href = 'https://gitlab.com/gitlab-org/gitlab',
|
|
6
|
+
shape = 'circle',
|
|
7
|
+
size = 32,
|
|
8
|
+
} = {}) => ({
|
|
9
|
+
href,
|
|
10
|
+
shape,
|
|
11
|
+
size,
|
|
19
12
|
});
|
|
20
13
|
|
|
21
|
-
const generateLabelsProps = () => ({
|
|
22
|
-
label
|
|
23
|
-
|
|
24
|
-
default: text('label', 'GitLab User'),
|
|
25
|
-
},
|
|
26
|
-
subLabel: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: text('subLabel', '@gitlab'),
|
|
29
|
-
},
|
|
14
|
+
const generateLabelsProps = ({ label = 'GitLab User', subLabel = '@gitlab' } = {}) => ({
|
|
15
|
+
label,
|
|
16
|
+
subLabel,
|
|
30
17
|
});
|
|
31
18
|
|
|
32
|
-
const generateImageProps = (
|
|
33
|
-
src
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'src',
|
|
37
|
-
'https://assets.gitlab-static.net/uploads/-/system/project/avatar/278964/logo-extra-whitespace.png?width=64'
|
|
38
|
-
),
|
|
39
|
-
},
|
|
19
|
+
const generateImageProps = ({
|
|
20
|
+
src = 'https://assets.gitlab-static.net/uploads/-/system/project/avatar/278964/logo-extra-whitespace.png?width=64',
|
|
21
|
+
} = {}) => ({
|
|
22
|
+
src,
|
|
40
23
|
});
|
|
41
24
|
|
|
42
|
-
|
|
43
|
-
.
|
|
44
|
-
|
|
45
|
-
props: { ...generateDefaultProps(), ...generateImageProps() },
|
|
46
|
-
template: `
|
|
25
|
+
export const Default = (args, { argTypes }) => ({
|
|
26
|
+
props: Object.keys(argTypes),
|
|
27
|
+
template: `
|
|
47
28
|
<gl-avatar-link target="blank" :href="href">
|
|
48
29
|
<gl-avatar :src="src" :size="size" :shape="shape" />
|
|
49
30
|
</gl-avatar-link>
|
|
50
31
|
`,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
32
|
+
});
|
|
33
|
+
Default.args = { ...generateDefaultProps(), ...generateImageProps() };
|
|
34
|
+
|
|
35
|
+
export const WithLabeledAvatar = (args, { argTypes }) => ({
|
|
36
|
+
props: Object.keys(argTypes),
|
|
37
|
+
template: `
|
|
38
|
+
<gl-avatar-link target="blank" :href="href">
|
|
39
|
+
<gl-avatar-labeled :src="src" :size="size" :shape="shape" :label="label" :sub-label="subLabel" />
|
|
40
|
+
</gl-avatar-link>
|
|
41
|
+
`,
|
|
42
|
+
});
|
|
43
|
+
WithLabeledAvatar.args = {
|
|
44
|
+
...generateDefaultProps({}),
|
|
45
|
+
...generateLabelsProps({}),
|
|
46
|
+
...generateImageProps({}),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const WithNoImageAvatar = (args, { argTypes }) => ({
|
|
50
|
+
props: Object.keys(argTypes),
|
|
51
|
+
template: `
|
|
67
52
|
<gl-avatar-link target="blank" :href="href">
|
|
68
53
|
<gl-avatar-labeled :entity-name="label" :label="label" :sub-label="subLabel" :size="size" :shape="shape" />
|
|
69
54
|
</gl-avatar-link>
|
|
70
55
|
`,
|
|
71
|
-
|
|
56
|
+
});
|
|
57
|
+
WithNoImageAvatar.args = { ...generateDefaultProps({}), ...generateLabelsProps({}) };
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
title: 'base/avatar/avatar-link',
|
|
61
|
+
parameters: {
|
|
62
|
+
knobs: { disable: true },
|
|
63
|
+
docs: {
|
|
64
|
+
description: {
|
|
65
|
+
component: readme,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
argTypes: {
|
|
70
|
+
shape: {
|
|
71
|
+
options: avatarShapeOptions,
|
|
72
|
+
control: {
|
|
73
|
+
type: 'select',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
size: {
|
|
77
|
+
options: avatarSizeOptions,
|
|
78
|
+
control: {
|
|
79
|
+
type: 'select',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|