@gitlab/ui 32.45.0 → 32.48.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 +28 -0
- package/config.js +15 -3
- package/dist/components/base/avatar_labeled/avatar_labeled.documentation.js +2 -9
- package/dist/components/base/avatars_inline/avatars_inline.documentation.js +2 -5
- package/dist/components/base/form/form_combobox/form_combobox.documentation.js +2 -9
- package/dist/components/base/form/form_combobox/form_combobox.js +5 -0
- package/dist/components/base/form/form_group/form_group.js +11 -1
- package/dist/components/base/form/input_group_text/input_group_text.documentation.js +1 -5
- package/dist/components/base/label/label.documentation.js +2 -9
- package/dist/components/base/label/label.js +23 -1
- 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/discrete_scatter/discrete_scatter.documentation.js +1 -7
- package/dist/components/charts/gauge/gauge.documentation.js +2 -6
- package/dist/components/charts/stacked_column/stacked_column.documentation.js +2 -5
- package/dist/components/charts/tooltip/tooltip.documentation.js +1 -5
- package/dist/components/utilities/intersperse/intersperse.documentation.js +2 -5
- package/dist/config.js +15 -3
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/documentation/documented_stories.js +11 -0
- package/package.json +1 -1
- package/src/components/base/avatar_labeled/avatar_labeled.documentation.js +0 -9
- package/src/components/base/avatar_labeled/avatar_labeled.md +2 -5
- package/src/components/base/avatar_labeled/avatar_labeled.stories.js +68 -62
- package/src/components/base/avatar_labeled/avatar_labeled.vue +1 -0
- package/src/components/base/avatars_inline/avatars_inline.documentation.js +0 -2
- package/src/components/base/avatars_inline/avatars_inline.md +1 -3
- package/src/components/base/avatars_inline/avatars_inline.stories.js +49 -44
- package/src/components/base/form/form_combobox/form_combobox.documentation.js +0 -8
- package/src/components/base/form/form_combobox/form_combobox.md +0 -2
- package/src/components/base/form/form_combobox/form_combobox.stories.js +30 -30
- package/src/components/base/form/form_combobox/form_combobox.vue +4 -0
- package/src/components/base/form/form_group/form_group.scss +4 -0
- package/src/components/base/form/form_group/form_group.spec.js +66 -64
- package/src/components/base/form/form_group/form_group.stories.js +36 -13
- package/src/components/base/form/form_group/form_group.vue +15 -2
- package/src/components/base/form/input_group_text/input_group_text.documentation.js +0 -3
- package/src/components/base/form/input_group_text/input_group_text.stories.js +24 -18
- 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/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/charts/discrete_scatter/discrete_scatter.documentation.js +0 -5
- package/src/components/charts/discrete_scatter/discrete_scatter.stories.js +34 -46
- package/src/components/charts/gauge/gauge.documentation.js +0 -3
- package/src/components/charts/gauge/gauge.md +0 -2
- package/src/components/charts/gauge/gauge.stories.js +70 -86
- package/src/components/charts/stacked_column/stacked_column.documentation.js +0 -2
- package/src/components/charts/stacked_column/stacked_column.md +0 -2
- package/src/components/charts/stacked_column/stacked_column.stories.js +74 -99
- package/src/components/charts/tooltip/tooltip.documentation.js +0 -3
- package/src/components/charts/tooltip/tooltip.stories.js +59 -44
- package/src/components/utilities/intersperse/intersperse.documentation.js +0 -2
- package/src/components/utilities/intersperse/intersperse.md +0 -2
- package/src/components/utilities/intersperse/intersperse.stories.js +38 -38
- package/dist/components/base/avatar_labeled/examples/avatar.labeled.example.js +0 -38
- package/dist/components/base/avatar_labeled/examples/avatar.labeled_badges.example.js +0 -38
- package/dist/components/base/avatar_labeled/examples/avatar.labeled_links.example.js +0 -38
- package/dist/components/base/avatar_labeled/examples/avatar.labeled_tooltip.example.js +0 -38
- package/dist/components/base/avatar_labeled/examples/index.js +0 -31
- package/dist/components/base/avatars_inline/examples/avatars.inline.example.js +0 -58
- package/dist/components/base/avatars_inline/examples/avatars.inline_large.example.js +0 -58
- package/dist/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips.example.js +0 -70
- package/dist/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips_badge.example.js +0 -70
- package/dist/components/base/avatars_inline/examples/index.js +0 -31
- package/dist/components/base/form/form_combobox/examples/form_combobox.basic.example.js +0 -50
- package/dist/components/base/form/form_combobox/examples/index.js +0 -13
- package/dist/components/base/form/input_group_text/examples/index.js +0 -13
- package/dist/components/base/form/input_group_text/examples/input_group_text.basic.example.js +0 -38
- 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/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/dist/components/charts/discrete_scatter/examples/discrete_scatter.basic.example.js +0 -51
- package/dist/components/charts/discrete_scatter/examples/index.js +0 -13
- package/dist/components/charts/gauge/examples/gauge.basic.example.js +0 -38
- package/dist/components/charts/gauge/examples/gauge.no_thresholds.example.js +0 -38
- package/dist/components/charts/gauge/examples/gauge.no_value.example.js +0 -38
- package/dist/components/charts/gauge/examples/gauge.with_text.example.js +0 -38
- package/dist/components/charts/gauge/examples/index.js +0 -31
- package/dist/components/charts/stacked_column/examples/index.js +0 -13
- package/dist/components/charts/stacked_column/examples/stacked_column.basic.example.js +0 -46
- package/dist/components/charts/tooltip/examples/chart_tooltip.basic.example.js +0 -54
- package/dist/components/charts/tooltip/examples/index.js +0 -13
- package/dist/components/utilities/intersperse/examples/index.js +0 -31
- package/dist/components/utilities/intersperse/examples/intersperse.custom_last_separator.example.js +0 -38
- package/dist/components/utilities/intersperse/examples/intersperse.custom_last_separator_two_items.example.js +0 -38
- package/dist/components/utilities/intersperse/examples/intersperse.custom_separator.example.js +0 -38
- package/dist/components/utilities/intersperse/examples/intersperse.default.example.js +0 -38
- package/src/components/base/avatar_labeled/examples/avatar.labeled.example.vue +0 -8
- package/src/components/base/avatar_labeled/examples/avatar.labeled_badges.example.vue +0 -17
- package/src/components/base/avatar_labeled/examples/avatar.labeled_links.example.vue +0 -10
- package/src/components/base/avatar_labeled/examples/avatar.labeled_tooltip.example.vue +0 -10
- package/src/components/base/avatar_labeled/examples/index.js +0 -36
- package/src/components/base/avatars_inline/examples/avatars.inline.example.vue +0 -18
- package/src/components/base/avatars_inline/examples/avatars.inline_large.example.vue +0 -18
- package/src/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips.example.vue +0 -24
- package/src/components/base/avatars_inline/examples/avatars.inline_links_and_tooltips_badge.example.vue +0 -31
- package/src/components/base/avatars_inline/examples/index.js +0 -36
- package/src/components/base/form/form_combobox/examples/form_combobox.basic.example.vue +0 -31
- package/src/components/base/form/form_combobox/examples/index.js +0 -15
- package/src/components/base/form/input_group_text/examples/index.js +0 -15
- package/src/components/base/form/input_group_text/examples/input_group_text.basic.example.vue +0 -3
- 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/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
- package/src/components/charts/discrete_scatter/discrete_scatter.md +0 -1
- package/src/components/charts/discrete_scatter/examples/discrete_scatter.basic.example.vue +0 -31
- package/src/components/charts/discrete_scatter/examples/index.js +0 -15
- package/src/components/charts/gauge/examples/gauge.basic.example.vue +0 -5
- package/src/components/charts/gauge/examples/gauge.no_thresholds.example.vue +0 -5
- package/src/components/charts/gauge/examples/gauge.no_value.example.vue +0 -5
- package/src/components/charts/gauge/examples/gauge.with_text.example.vue +0 -12
- package/src/components/charts/gauge/examples/index.js +0 -36
- package/src/components/charts/stacked_column/examples/index.js +0 -15
- package/src/components/charts/stacked_column/examples/stacked_column.basic.example.vue +0 -18
- package/src/components/charts/tooltip/examples/chart_tooltip.basic.example.vue +0 -32
- package/src/components/charts/tooltip/examples/index.js +0 -15
- package/src/components/utilities/intersperse/examples/index.js +0 -36
- package/src/components/utilities/intersperse/examples/intersperse.custom_last_separator.example.vue +0 -7
- package/src/components/utilities/intersperse/examples/intersperse.custom_last_separator_two_items.example.vue +0 -6
- package/src/components/utilities/intersperse/examples/intersperse.custom_separator.example.vue +0 -7
- package/src/components/utilities/intersperse/examples/intersperse.default.example.vue +0 -7
|
@@ -13,6 +13,8 @@ function generateProps({
|
|
|
13
13
|
label = 'Label Name',
|
|
14
14
|
description = 'form group description',
|
|
15
15
|
labelDescription = 'form label description',
|
|
16
|
+
optional = GlFormGroup.props.optional.default,
|
|
17
|
+
optionalText = GlFormGroup.props.optionalText.default,
|
|
16
18
|
horizontal = false,
|
|
17
19
|
} = {}) {
|
|
18
20
|
return {
|
|
@@ -36,6 +38,14 @@ function generateProps({
|
|
|
36
38
|
type: String,
|
|
37
39
|
default: text('label-description', labelDescription),
|
|
38
40
|
},
|
|
41
|
+
optional: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: boolean('optional', optional),
|
|
44
|
+
},
|
|
45
|
+
optionalText: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: text('optional-text', optionalText),
|
|
48
|
+
},
|
|
39
49
|
horizontal: {
|
|
40
50
|
type: Boolean,
|
|
41
51
|
default: boolean('horizontal', horizontal),
|
|
@@ -53,6 +63,8 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
53
63
|
:id="id"
|
|
54
64
|
:label="label"
|
|
55
65
|
:label-size="labelSize"
|
|
66
|
+
:optional="optional"
|
|
67
|
+
:optional-text="optionalText"
|
|
56
68
|
:description="description"
|
|
57
69
|
:horizontal="horizontal"
|
|
58
70
|
label-for="label1"
|
|
@@ -69,6 +81,8 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
69
81
|
id="group-id"
|
|
70
82
|
label="Label Name"
|
|
71
83
|
label-size="sm"
|
|
84
|
+
:optional="optional"
|
|
85
|
+
:optional-text="optionalText"
|
|
72
86
|
description="This feature is disabled"
|
|
73
87
|
label-for="input1"
|
|
74
88
|
>
|
|
@@ -77,14 +91,21 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
77
91
|
`,
|
|
78
92
|
}))
|
|
79
93
|
.add('with textarea', () => ({
|
|
94
|
+
props: generateProps({ optional: true }),
|
|
80
95
|
template: `
|
|
81
|
-
<gl-form-group
|
|
96
|
+
<gl-form-group
|
|
97
|
+
id="group-id-textarea2"
|
|
98
|
+
label="Label Name"
|
|
99
|
+
label-for="textarea2"
|
|
100
|
+
:optional="optional"
|
|
101
|
+
:optional-text="optionalText"
|
|
102
|
+
>
|
|
82
103
|
<gl-form-textarea id="textarea2" placeholder="Enter something" />
|
|
83
104
|
</gl-form-group>
|
|
84
105
|
`,
|
|
85
106
|
}))
|
|
86
107
|
.add('with label description', () => ({
|
|
87
|
-
props: generateProps(),
|
|
108
|
+
props: generateProps({ optional: true }),
|
|
88
109
|
components,
|
|
89
110
|
template: `
|
|
90
111
|
<gl-form-group
|
|
@@ -93,6 +114,8 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
93
114
|
:label-size="labelSize"
|
|
94
115
|
:description="description"
|
|
95
116
|
:label-description="labelDescription"
|
|
117
|
+
:optional="optional"
|
|
118
|
+
:optional-text="optionalText"
|
|
96
119
|
:horizontal="horizontal"
|
|
97
120
|
label-for="label1"
|
|
98
121
|
>
|
|
@@ -125,16 +148,16 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
125
148
|
};
|
|
126
149
|
},
|
|
127
150
|
template: `
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
151
|
+
<gl-form-group
|
|
152
|
+
:id="id"
|
|
153
|
+
:label="label"
|
|
154
|
+
:label-size="labelSize"
|
|
155
|
+
:description="description"
|
|
156
|
+
:invalid-feedback="invalidFeedback"
|
|
157
|
+
:state="state"
|
|
158
|
+
label-for="label1"
|
|
159
|
+
>
|
|
160
|
+
<gl-form-input id="input1" :state="state" v-model.trim="name" />
|
|
161
|
+
</gl-form-group>
|
|
139
162
|
`,
|
|
140
163
|
}));
|
|
@@ -20,6 +20,16 @@ export default {
|
|
|
20
20
|
required: false,
|
|
21
21
|
default: '',
|
|
22
22
|
},
|
|
23
|
+
optional: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
required: false,
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
optionalText: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: false,
|
|
31
|
+
default: '(optional)',
|
|
32
|
+
},
|
|
23
33
|
},
|
|
24
34
|
computed: {
|
|
25
35
|
actualLabelClass() {
|
|
@@ -45,11 +55,14 @@ export default {
|
|
|
45
55
|
</script>
|
|
46
56
|
<template>
|
|
47
57
|
<b-form-group v-bind="$attrs" class="gl-form-group" :label-class="actualLabelClass">
|
|
48
|
-
<template
|
|
58
|
+
<template #label>
|
|
49
59
|
<slot name="label">
|
|
50
60
|
{{ $attrs.label }}
|
|
61
|
+
<span v-if="optional" class="optional-label" data-testid="optional-label">{{
|
|
62
|
+
optionalText
|
|
63
|
+
}}</span>
|
|
51
64
|
</slot>
|
|
52
|
-
<gl-form-text data-testid="label-description">
|
|
65
|
+
<gl-form-text v-if="hasLabelDescription" data-testid="label-description">
|
|
53
66
|
<slot name="label-description">{{ labelDescription }}</slot>
|
|
54
67
|
</gl-form-text>
|
|
55
68
|
</template>
|
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
2
1
|
import readme from './input_group_text.md';
|
|
3
2
|
import GlInputGroupText from './input_group_text.vue';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const defaultProps = {};
|
|
10
|
-
|
|
11
|
-
function generateProps(props = {}) {
|
|
12
|
-
return {
|
|
13
|
-
...defaultProps,
|
|
14
|
-
...props,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
4
|
+
const generateProps = (props = {}) => ({
|
|
5
|
+
...props,
|
|
6
|
+
});
|
|
17
7
|
|
|
18
|
-
|
|
19
|
-
components,
|
|
20
|
-
props:
|
|
21
|
-
data: () => ({}),
|
|
8
|
+
const Template = (args) => ({
|
|
9
|
+
components: { GlInputGroupText },
|
|
10
|
+
props: Object.keys(args),
|
|
22
11
|
template: `
|
|
23
12
|
<gl-input-group-text>Some text</gl-input-group-text>
|
|
24
13
|
`,
|
|
25
|
-
})
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = generateProps();
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'base/form/input-group-text',
|
|
21
|
+
component: GlInputGroupText,
|
|
22
|
+
parameters: {
|
|
23
|
+
controls: { disable: true },
|
|
24
|
+
knobs: { disable: true },
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component: readme,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import description from './label.vue';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
followsDesignSystem: true,
|
|
5
|
-
|
|
6
|
-
events: [
|
|
7
|
-
{
|
|
8
|
-
event: 'click',
|
|
9
|
-
description: 'Emitted when label is clicked',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
event: 'close',
|
|
13
|
-
description: 'Emitted when x is clicked',
|
|
14
|
-
},
|
|
15
|
-
],
|
|
5
|
+
description,
|
|
16
6
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
# Label
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
## Usage
|
|
5
|
-
|
|
6
1
|
Labels are editable objects that allow users to manually categorize other objects, like issues,
|
|
7
2
|
merge requests, and epics. They have a name, description, and a customizable background color.
|
|
8
3
|
They provide a quick way to recognize which categories the labeled object belongs to.
|
|
9
4
|
|
|
10
5
|
## Using the component
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
```js
|
|
13
8
|
<gl-label
|
|
14
9
|
background-color="#D9C2EE"
|
|
15
10
|
title="Label content"
|
|
@@ -18,4 +13,4 @@ They provide a quick way to recognize which categories the labeled object belong
|
|
|
18
13
|
tooltipPlacement="top"
|
|
19
14
|
target="http://some.url"
|
|
20
15
|
/>
|
|
21
|
-
|
|
16
|
+
```
|
|
@@ -1,110 +1,84 @@
|
|
|
1
|
-
import { withKnobs, text, color, select, boolean } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { GlLabel } from '../../../../index';
|
|
4
2
|
import { labelSizeOptions, tooltipPlacements } from '../../../utils/constants';
|
|
5
3
|
import readme from './label.md';
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const template = `
|
|
6
|
+
<div class="gl-display-flex">
|
|
7
|
+
<gl-label
|
|
8
|
+
:background-color="backgroundColor"
|
|
9
|
+
:size="size"
|
|
10
|
+
:title="title"
|
|
11
|
+
:description="description"
|
|
12
|
+
:tooltip-placement="tooltipPlacement"
|
|
13
|
+
:target="target"
|
|
14
|
+
:scoped="scoped"
|
|
15
|
+
:show-close-button="showCloseButton"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
/>
|
|
18
|
+
</div>`;
|
|
19
|
+
|
|
20
|
+
const Template = (args, { argTypes }) => ({
|
|
21
|
+
components: { GlLabel },
|
|
22
|
+
props: Object.keys(argTypes),
|
|
23
|
+
template,
|
|
24
|
+
});
|
|
10
25
|
|
|
11
26
|
const generateProps = ({
|
|
12
27
|
title = 'Label title',
|
|
13
28
|
size = labelSizeOptions.default,
|
|
14
29
|
tooltipPlacement = tooltipPlacements.top,
|
|
15
30
|
scoped = false,
|
|
31
|
+
description = '',
|
|
32
|
+
target = '#',
|
|
33
|
+
backgroundColor = '#D9C2EE',
|
|
16
34
|
showCloseButton = false,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
disabled = false,
|
|
36
|
+
} = {}) => ({
|
|
37
|
+
backgroundColor,
|
|
38
|
+
title,
|
|
39
|
+
description,
|
|
40
|
+
size,
|
|
41
|
+
tooltipPlacement,
|
|
42
|
+
target,
|
|
43
|
+
scoped,
|
|
44
|
+
showCloseButton,
|
|
45
|
+
disabled,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const Default = Template.bind({});
|
|
49
|
+
Default.args = generateProps();
|
|
50
|
+
|
|
51
|
+
export const Scoped = Template.bind({});
|
|
52
|
+
Scoped.args = generateProps({ title: 'scoped::label', scoped: true });
|
|
53
|
+
|
|
54
|
+
export const WithCloseButton = Template.bind({});
|
|
55
|
+
WithCloseButton.args = generateProps({ showCloseButton: true });
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
title: 'base/label',
|
|
59
|
+
component: GlLabel,
|
|
60
|
+
parameters: {
|
|
61
|
+
knobs: { disable: true },
|
|
62
|
+
docs: {
|
|
63
|
+
description: {
|
|
64
|
+
component: readme,
|
|
65
|
+
},
|
|
24
66
|
},
|
|
25
|
-
|
|
26
|
-
|
|
67
|
+
},
|
|
68
|
+
argTypes: {
|
|
69
|
+
backgroundColor: {
|
|
70
|
+
control: {
|
|
71
|
+
type: 'color',
|
|
72
|
+
},
|
|
27
73
|
},
|
|
28
74
|
size: {
|
|
29
|
-
|
|
30
|
-
default: select('Size', labelSizeOptions, size),
|
|
75
|
+
options: labelSizeOptions,
|
|
31
76
|
},
|
|
32
77
|
tooltipPlacement: {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
default: text('Link to label target', '#'),
|
|
38
|
-
},
|
|
39
|
-
scoped: {
|
|
40
|
-
default: boolean('Label is scoped', scoped),
|
|
41
|
-
},
|
|
42
|
-
showCloseButton: {
|
|
43
|
-
default: boolean('Show close button', showCloseButton),
|
|
78
|
+
options: tooltipPlacements,
|
|
79
|
+
control: {
|
|
80
|
+
type: 'select',
|
|
81
|
+
},
|
|
44
82
|
},
|
|
45
|
-
|
|
46
|
-
default: boolean('Close button disabled', false),
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return props;
|
|
83
|
+
},
|
|
51
84
|
};
|
|
52
|
-
|
|
53
|
-
documentedStoriesOf('base/label', readme)
|
|
54
|
-
.addDecorator(withKnobs)
|
|
55
|
-
.add('default', () => ({
|
|
56
|
-
props: generateProps(),
|
|
57
|
-
components,
|
|
58
|
-
template: `
|
|
59
|
-
<div class="gl-display-flex">
|
|
60
|
-
<gl-label
|
|
61
|
-
:background-color="backgroundColor"
|
|
62
|
-
:size="size"
|
|
63
|
-
:title="title"
|
|
64
|
-
:description="description"
|
|
65
|
-
:tooltip-placement="tooltipPlacement"
|
|
66
|
-
:target="target"
|
|
67
|
-
:scoped="scoped"
|
|
68
|
-
:show-close-button="showCloseButton"
|
|
69
|
-
:disabled="disabled"
|
|
70
|
-
/>
|
|
71
|
-
</div>`,
|
|
72
|
-
}))
|
|
73
|
-
.add('scoped', () => ({
|
|
74
|
-
props: generateProps({ title: 'scoped::label', scoped: true }),
|
|
75
|
-
components,
|
|
76
|
-
template: `
|
|
77
|
-
<div class="gl-display-flex">
|
|
78
|
-
<gl-label
|
|
79
|
-
:background-color="backgroundColor"
|
|
80
|
-
:size="size"
|
|
81
|
-
:title="title"
|
|
82
|
-
:description="description"
|
|
83
|
-
:tooltip-placement="tooltipPlacement"
|
|
84
|
-
:target="target"
|
|
85
|
-
:scoped="scoped"
|
|
86
|
-
:show-close-button="showCloseButton"
|
|
87
|
-
:disabled="disabled"
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
`,
|
|
91
|
-
}))
|
|
92
|
-
.add('with close button', () => ({
|
|
93
|
-
props: generateProps({ showCloseButton: true }),
|
|
94
|
-
components,
|
|
95
|
-
template: `
|
|
96
|
-
<div class="gl-display-flex">
|
|
97
|
-
<gl-label
|
|
98
|
-
:background-color="backgroundColor"
|
|
99
|
-
:size="size"
|
|
100
|
-
:title="title"
|
|
101
|
-
:description="description"
|
|
102
|
-
:tooltip-placement="tooltipPlacement"
|
|
103
|
-
:target="target"
|
|
104
|
-
:scoped="scoped"
|
|
105
|
-
:show-close-button="showCloseButton"
|
|
106
|
-
:disabled="disabled"
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
`,
|
|
110
|
-
}));
|
|
@@ -96,6 +96,26 @@ export default {
|
|
|
96
96
|
this.splitScopedLabelIndex = this.title.lastIndexOf('::');
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
|
+
methods: {
|
|
100
|
+
onClick(e) {
|
|
101
|
+
/**
|
|
102
|
+
* Emitted when label is clicked
|
|
103
|
+
*
|
|
104
|
+
* @event click
|
|
105
|
+
* @type {object}
|
|
106
|
+
*/
|
|
107
|
+
this.$emit('click', e);
|
|
108
|
+
},
|
|
109
|
+
onClose(e) {
|
|
110
|
+
/**
|
|
111
|
+
* Emitted when x is clicked
|
|
112
|
+
*
|
|
113
|
+
* @event close
|
|
114
|
+
* @type {object}
|
|
115
|
+
*/
|
|
116
|
+
this.$emit('close', e);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
99
119
|
};
|
|
100
120
|
</script>
|
|
101
121
|
|
|
@@ -106,7 +126,7 @@ export default {
|
|
|
106
126
|
:class="cssClasses"
|
|
107
127
|
:style="cssVariables"
|
|
108
128
|
v-bind="$attrs"
|
|
109
|
-
@click="
|
|
129
|
+
@click="onClick"
|
|
110
130
|
>
|
|
111
131
|
<gl-link :href="target" class="gl-label-link">
|
|
112
132
|
<span class="gl-label-text">
|
|
@@ -122,7 +142,7 @@ export default {
|
|
|
122
142
|
label="Remove label"
|
|
123
143
|
variant="reset"
|
|
124
144
|
:disabled="disabled"
|
|
125
|
-
@click="
|
|
145
|
+
@click="onClose"
|
|
126
146
|
/>
|
|
127
147
|
<gl-tooltip
|
|
128
148
|
v-if="description"
|
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import * as description from './skeleton_loader.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
followsDesignSystem: true,
|
|
6
5
|
description,
|
|
7
|
-
examples,
|
|
8
|
-
propsInfo: {
|
|
9
|
-
width: {
|
|
10
|
-
additionalInfo:
|
|
11
|
-
'It will be set in the viewbox attr in the <svg />. Defaults to 400 when skeleton is passed via the slot. Defaults to 235 when default skeleton is used',
|
|
12
|
-
},
|
|
13
|
-
height: {
|
|
14
|
-
additionalInfo:
|
|
15
|
-
'It will be set in the viewbox attr in the <svg />. Defaults to 130 when skeleton is passed via the slot. Defaults to the combined height of the lines when default skeleton is used',
|
|
16
|
-
},
|
|
17
|
-
uniqueKey: {
|
|
18
|
-
additionalInfo: 'Defaults to unique id',
|
|
19
|
-
},
|
|
20
|
-
preserveAspectRatio: {
|
|
21
|
-
additionalInfo: 'Aspect ratio option of <svg/>',
|
|
22
|
-
},
|
|
23
|
-
baseUrl: {
|
|
24
|
-
additionalInfo: `Required if you're using <base url="/" /> in your <head />. Defaults to an empty string. This prop is common used as: <gl-skeleton-loader :base-url="$route.fullPath" /> which will fill the SVG attribute with the relative path.`,
|
|
25
|
-
},
|
|
26
|
-
lines: {
|
|
27
|
-
additionalInfo: 'Number of lines to show when using the default skeleton',
|
|
28
|
-
},
|
|
29
|
-
equalWidthLines: {
|
|
30
|
-
additionalInfo: 'If the default skeleton lines should all be the same width',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
6
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
## Usage
|
|
2
|
-
|
|
3
1
|
Skeleton loaders are to be used when pages or sections can be progressively populated with content,
|
|
4
2
|
such as text and images, as they become available. Generally speaking the first batch of content
|
|
5
3
|
will be the lightest to load and is followed by secondary and tertiary content batches. Each loading
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
2
1
|
import { GlSkeletonLoader } from '../../../../index';
|
|
3
2
|
import readme from './skeleton_loader.md';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
GlSkeletonLoader,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
documentedStoriesOf('base/skeleton-loader', readme).add('default', () => ({
|
|
10
|
-
props: {},
|
|
11
|
-
components,
|
|
4
|
+
const Template = (args) => ({
|
|
5
|
+
components: { GlSkeletonLoader },
|
|
6
|
+
props: Object.keys(args),
|
|
12
7
|
template: `
|
|
13
8
|
<div style="background: #fff; border: 1px solid #dfdfdf; box-shadow: 0 1px 2px rgba(0,0,0,0.1); width: 359px; height: 135px; padding: 1rem; border-radius: 0.25rem;">
|
|
14
9
|
<div style="width: 327px; height: 102px;">
|
|
@@ -24,4 +19,23 @@ documentedStoriesOf('base/skeleton-loader', readme).add('default', () => ({
|
|
|
24
19
|
</gl-skeleton-loader>
|
|
25
20
|
</div>
|
|
26
21
|
</div>`,
|
|
27
|
-
})
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({});
|
|
25
|
+
Default.args = {};
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
title: 'base/skeleton-loader',
|
|
29
|
+
component: GlSkeletonLoader,
|
|
30
|
+
parameters: {
|
|
31
|
+
knobs: { disable: true },
|
|
32
|
+
docs: {
|
|
33
|
+
description: {
|
|
34
|
+
component: readme,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
controls: {
|
|
38
|
+
disable: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -13,36 +13,60 @@ export default {
|
|
|
13
13
|
name: 'GlSkeletonLoader',
|
|
14
14
|
functional: true,
|
|
15
15
|
props: {
|
|
16
|
+
/**
|
|
17
|
+
* It will be set in the viewbox attr in the <svg />.
|
|
18
|
+
* Defaults to 400 when skeleton is passed via the slot. Defaults to 235 when default skeleton is used
|
|
19
|
+
*/
|
|
16
20
|
width: {
|
|
17
21
|
type: Number,
|
|
18
22
|
default: null,
|
|
19
23
|
required: false,
|
|
20
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* It will be set in the viewbox attr in the <svg />. Defaults to 130 when skeleton is passed via the slot.
|
|
27
|
+
* Defaults to the combined height of the lines when default skeleton is used
|
|
28
|
+
*/
|
|
21
29
|
height: {
|
|
22
30
|
type: Number,
|
|
23
31
|
default: null,
|
|
24
32
|
required: false,
|
|
25
33
|
},
|
|
34
|
+
/**
|
|
35
|
+
* Aspect ratio option of <svg/>
|
|
36
|
+
*/
|
|
26
37
|
preserveAspectRatio: {
|
|
27
38
|
type: String,
|
|
28
39
|
default: 'xMidYMid meet',
|
|
29
40
|
required: false,
|
|
30
41
|
},
|
|
42
|
+
/**
|
|
43
|
+
* Required if you're using <base url="/" /> in your <head />. Defaults to an empty string.
|
|
44
|
+
* This prop is common used as: <gl-skeleton-loader :base-url="$route.fullPath" /> which will fill the SVG attribute with the relative path.
|
|
45
|
+
*/
|
|
31
46
|
baseUrl: {
|
|
32
47
|
type: String,
|
|
33
48
|
default: '',
|
|
34
49
|
required: false,
|
|
35
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* Defaults to unique id
|
|
53
|
+
*/
|
|
36
54
|
uniqueKey: {
|
|
37
55
|
type: String,
|
|
38
56
|
default: () => uid(),
|
|
39
57
|
required: false,
|
|
40
58
|
},
|
|
59
|
+
/**
|
|
60
|
+
* Number of lines to show when using the default skeleton
|
|
61
|
+
*/
|
|
41
62
|
lines: {
|
|
42
63
|
type: Number,
|
|
43
64
|
default: 3,
|
|
44
65
|
required: false,
|
|
45
66
|
},
|
|
67
|
+
/**
|
|
68
|
+
* If the default skeleton lines should all be the same width
|
|
69
|
+
*/
|
|
46
70
|
equalWidthLines: {
|
|
47
71
|
type: Boolean,
|
|
48
72
|
default: false,
|