@gitlab/ui 32.46.0 → 32.50.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/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_radio/form_radio.documentation.js +2 -33
- package/dist/components/base/form/form_radio/form_radio.js +15 -2
- package/dist/components/base/form/input_group_text/input_group_text.documentation.js +1 -5
- package/dist/components/base/keyset_pagination/keyset_pagination.documentation.js +2 -84
- package/dist/components/base/keyset_pagination/keyset_pagination.js +42 -0
- package/dist/components/base/modal/modal.documentation.js +2 -32
- package/dist/components/base/modal/modal.js +1 -1
- package/dist/components/charts/gauge/gauge.documentation.js +2 -6
- package/dist/components/charts/tooltip/tooltip.documentation.js +1 -5
- package/dist/components/utilities/intersperse/intersperse.documentation.js +2 -5
- package/documentation/documented_stories.js +10 -0
- package/package.json +3 -3
- 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_radio/form_radio.documentation.js +0 -31
- package/src/components/base/form/form_radio/form_radio.md +7 -14
- package/src/components/base/form/form_radio/form_radio.stories.js +40 -28
- package/src/components/base/form/form_radio/form_radio.vue +26 -1
- 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/keyset_pagination/keyset_pagination.documentation.js +0 -99
- package/src/components/base/keyset_pagination/keyset_pagination.md +0 -2
- package/src/components/base/keyset_pagination/keyset_pagination.stories.js +60 -58
- package/src/components/base/keyset_pagination/keyset_pagination.vue +35 -1
- package/src/components/base/modal/modal.documentation.js +0 -42
- package/src/components/base/modal/modal.md +2 -7
- package/src/components/base/modal/modal.stories.js +107 -85
- package/src/components/base/modal/modal.vue +20 -0
- 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/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/form_radio/examples/form_radio.basic.example.js +0 -48
- package/dist/components/base/form/form_radio/examples/form_radio.checked_disabled.example.js +0 -48
- package/dist/components/base/form/form_radio/examples/index.js +0 -19
- 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/keyset_pagination/examples/index.js +0 -37
- package/dist/components/base/keyset_pagination/examples/keyset_pagination.basic.example.js +0 -51
- package/dist/components/base/keyset_pagination/examples/keyset_pagination.events.example.js +0 -64
- package/dist/components/base/keyset_pagination/examples/keyset_pagination.internationalization.example.js +0 -59
- package/dist/components/base/keyset_pagination/examples/keyset_pagination.links.example.js +0 -51
- package/dist/components/base/keyset_pagination/examples/keyset_pagination.slots.example.js +0 -51
- package/dist/components/base/modal/examples/index.js +0 -31
- package/dist/components/base/modal/examples/modal.basic.example.js +0 -62
- package/dist/components/base/modal/examples/modal.disabled.example.js +0 -89
- package/dist/components/base/modal/examples/modal.sizes.example.js +0 -62
- 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/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/form_radio/examples/form_radio.basic.example.vue +0 -16
- package/src/components/base/form/form_radio/examples/form_radio.checked_disabled.example.vue +0 -13
- package/src/components/base/form/form_radio/examples/index.js +0 -22
- 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/keyset_pagination/examples/index.js +0 -43
- package/src/components/base/keyset_pagination/examples/keyset_pagination.basic.example.vue +0 -16
- package/src/components/base/keyset_pagination/examples/keyset_pagination.events.example.vue +0 -29
- package/src/components/base/keyset_pagination/examples/keyset_pagination.internationalization.example.vue +0 -23
- package/src/components/base/keyset_pagination/examples/keyset_pagination.links.example.vue +0 -20
- package/src/components/base/keyset_pagination/examples/keyset_pagination.slots.example.vue +0 -23
- package/src/components/base/modal/examples/index.js +0 -39
- package/src/components/base/modal/examples/modal.basic.example.vue +0 -39
- package/src/components/base/modal/examples/modal.disabled.example.vue +0 -58
- package/src/components/base/modal/examples/modal.sizes.example.vue +0 -61
- 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/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
|
@@ -1,62 +1,32 @@
|
|
|
1
|
-
import { text, withKnobs, select } 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_labeled.md';
|
|
7
5
|
|
|
8
6
|
Vue.directive('gl-tooltip', GlTooltipDirective);
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
shape: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: select('shape', avatarShapeOptions, 'circle'),
|
|
27
|
-
},
|
|
28
|
-
src: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: text(
|
|
31
|
-
'src',
|
|
32
|
-
'https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=64'
|
|
33
|
-
),
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return props;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function generateTooltipProps() {
|
|
41
|
-
const props = {
|
|
42
|
-
tooltipText: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: text('tooltipText', 'Avatar tooltip'),
|
|
45
|
-
},
|
|
46
|
-
placement: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: select('placement', tooltipPlacements, 'top'),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
8
|
+
const generateProps = ({
|
|
9
|
+
label = 'GitLab User',
|
|
10
|
+
subLabel = '@gitlab',
|
|
11
|
+
size = 32,
|
|
12
|
+
shape = 'circle',
|
|
13
|
+
src = 'https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=64',
|
|
14
|
+
} = {}) => ({
|
|
15
|
+
label,
|
|
16
|
+
subLabel,
|
|
17
|
+
size,
|
|
18
|
+
shape,
|
|
19
|
+
src,
|
|
20
|
+
});
|
|
51
21
|
|
|
52
|
-
|
|
53
|
-
|
|
22
|
+
const generateTooltipProps = ({ tooltipText = 'Avatar tooltip', placement = 'top' } = {}) => ({
|
|
23
|
+
tooltipText,
|
|
24
|
+
placement,
|
|
25
|
+
});
|
|
54
26
|
|
|
55
|
-
|
|
56
|
-
.
|
|
57
|
-
|
|
58
|
-
props: generateProps(),
|
|
59
|
-
template: `
|
|
27
|
+
export const Default = (args, { argTypes }) => ({
|
|
28
|
+
props: Object.keys(argTypes),
|
|
29
|
+
template: `
|
|
60
30
|
<gl-avatar-labeled
|
|
61
31
|
:shape="shape"
|
|
62
32
|
:size="size"
|
|
@@ -65,13 +35,12 @@ documentedStoriesOf('base/avatar/labeled', readme)
|
|
|
65
35
|
:sub-label="subLabel"
|
|
66
36
|
/>
|
|
67
37
|
`,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
template: `
|
|
38
|
+
});
|
|
39
|
+
Default.args = generateProps();
|
|
40
|
+
|
|
41
|
+
export const WithTooltip = (args, { argTypes }) => ({
|
|
42
|
+
props: Object.keys(argTypes),
|
|
43
|
+
template: `
|
|
75
44
|
<gl-avatar-labeled
|
|
76
45
|
:shape="shape"
|
|
77
46
|
:size="size"
|
|
@@ -82,10 +51,20 @@ documentedStoriesOf('base/avatar/labeled', readme)
|
|
|
82
51
|
v-gl-tooltip="{ placement }"
|
|
83
52
|
/>
|
|
84
53
|
`,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
54
|
+
});
|
|
55
|
+
WithTooltip.args = { ...generateProps(), ...generateTooltipProps() };
|
|
56
|
+
WithTooltip.argTypes = {
|
|
57
|
+
placement: {
|
|
58
|
+
control: {
|
|
59
|
+
type: 'select',
|
|
60
|
+
options: tooltipPlacements,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const WithBadges = (args, { argTypes }) => ({
|
|
66
|
+
props: Object.keys(argTypes),
|
|
67
|
+
template: `
|
|
89
68
|
<gl-avatar-labeled
|
|
90
69
|
:shape="shape"
|
|
91
70
|
:size="size"
|
|
@@ -103,4 +82,31 @@ documentedStoriesOf('base/avatar/labeled', readme)
|
|
|
103
82
|
</template>
|
|
104
83
|
</gl-avatar-labeled>
|
|
105
84
|
`,
|
|
106
|
-
|
|
85
|
+
});
|
|
86
|
+
WithBadges.args = generateProps();
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
title: 'base/avatar/labeled',
|
|
90
|
+
parameters: {
|
|
91
|
+
knobs: { disable: true },
|
|
92
|
+
docs: {
|
|
93
|
+
description: {
|
|
94
|
+
component: readme,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
argTypes: {
|
|
99
|
+
size: {
|
|
100
|
+
control: {
|
|
101
|
+
type: 'select',
|
|
102
|
+
options: avatarSizeOptions,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
shape: {
|
|
106
|
+
control: {
|
|
107
|
+
type: 'select',
|
|
108
|
+
options: avatarShapeOptions,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
@@ -49,6 +49,7 @@ export default {
|
|
|
49
49
|
<span class="gl-avatar-labeled-label">{{ label }}</span>
|
|
50
50
|
</gl-link>
|
|
51
51
|
<span v-else class="gl-avatar-labeled-label">{{ label }}</span>
|
|
52
|
+
<!-- @slot Metadata to add to the avatar. Generally used for badges or user status emoji. -->
|
|
52
53
|
<slot name="meta"></slot>
|
|
53
54
|
</div>
|
|
54
55
|
<gl-link v-if="hasSubLabelLink" :href="subLabelLink" class="gl-avatar-link">
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
## Avatars inline
|
|
2
|
-
|
|
3
1
|
Use `<avatars-inline />` to display multiple avatars organized in a single row.
|
|
4
2
|
|
|
5
3
|
### Basic usage
|
|
6
4
|
|
|
7
5
|
The `avatars` property accepts an array of objects that contains the avatar properties. By default,
|
|
8
6
|
`<avatars-inline />` expects each object contained in the array to have the same shape as the
|
|
9
|
-
properties of the
|
|
7
|
+
properties of the `<avatar />` component. You can customize the display of each avatar by
|
|
10
8
|
overriding the default slot:
|
|
11
9
|
|
|
12
10
|
```html
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { number, boolean, object, select, withKnobs } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { avatarsInlineSizeOptions } from '../../../utils/constants';
|
|
4
|
-
|
|
5
2
|
import readme from './avatars_inline.md';
|
|
6
3
|
|
|
7
4
|
const defaultAvatars = [
|
|
@@ -12,53 +9,61 @@ const defaultAvatars = [
|
|
|
12
9
|
{ src: 'https://picsum.photos/id/1012/32' },
|
|
13
10
|
];
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
size: {
|
|
26
|
-
type: Number,
|
|
27
|
-
default: select('size', avatarsInlineSizeOptions, 24),
|
|
28
|
-
},
|
|
29
|
-
avatars: {
|
|
30
|
-
type: Array,
|
|
31
|
-
default: object('avatars', avatars),
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
return props;
|
|
36
|
-
}
|
|
12
|
+
const generateProps = (
|
|
13
|
+
avatars = defaultAvatars,
|
|
14
|
+
{ maxVisible = 2, collapsed = true, avatarSize = 24 } = {}
|
|
15
|
+
) => ({
|
|
16
|
+
maxVisible,
|
|
17
|
+
collapsed,
|
|
18
|
+
avatarSize,
|
|
19
|
+
avatars,
|
|
20
|
+
});
|
|
37
21
|
|
|
38
|
-
|
|
39
|
-
.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
template: `
|
|
43
|
-
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="size" :max-visible="maxVisible">
|
|
22
|
+
export const Default = (args, { argTypes }) => ({
|
|
23
|
+
props: Object.keys(argTypes),
|
|
24
|
+
template: `
|
|
25
|
+
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
|
|
44
26
|
</gl-avatars-inline>
|
|
45
27
|
`,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}))
|
|
54
|
-
),
|
|
55
|
-
template: `
|
|
56
|
-
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="size" :max-visible="maxVisible">
|
|
28
|
+
});
|
|
29
|
+
Default.args = generateProps();
|
|
30
|
+
|
|
31
|
+
export const WithLinksAndTooltips = (args, { argTypes }) => ({
|
|
32
|
+
props: Object.keys(argTypes),
|
|
33
|
+
template: `
|
|
34
|
+
<gl-avatars-inline :avatars="avatars" :collapsed="collapsed" :avatar-size="avatarSize" :max-visible="maxVisible">
|
|
57
35
|
<template #avatar="{ avatar }">
|
|
58
36
|
<gl-avatar-link target="blank" :href="avatar.href" v-gl-tooltip :title="avatar.tooltip">
|
|
59
|
-
<gl-avatar :src="avatar.src" :size="
|
|
37
|
+
<gl-avatar :src="avatar.src" :size="avatarSize" />
|
|
60
38
|
</gl-avatar-link>
|
|
61
39
|
</template>
|
|
62
40
|
</gl-avatars-inline>
|
|
63
41
|
`,
|
|
64
|
-
|
|
42
|
+
});
|
|
43
|
+
WithLinksAndTooltips.args = generateProps(
|
|
44
|
+
defaultAvatars.map((avatar, index) => ({
|
|
45
|
+
...avatar,
|
|
46
|
+
href: '//gitlab.com',
|
|
47
|
+
tooltip: `Avatar ${index}`,
|
|
48
|
+
}))
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
title: 'base/avatar/avatars-inline',
|
|
53
|
+
parameters: {
|
|
54
|
+
knobs: { disable: true },
|
|
55
|
+
docs: {
|
|
56
|
+
description: {
|
|
57
|
+
component: readme,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
argTypes: {
|
|
62
|
+
avatarSize: {
|
|
63
|
+
control: {
|
|
64
|
+
type: 'select',
|
|
65
|
+
options: avatarsInlineSizeOptions,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import * as description from './form_combobox.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
followsDesignSystem: true,
|
|
6
5
|
description,
|
|
7
|
-
examples,
|
|
8
|
-
events: [
|
|
9
|
-
{
|
|
10
|
-
event: 'value-selected',
|
|
11
|
-
description: 'Emitted when a value is selected.',
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
6
|
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { withKnobs, object, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
1
|
import { tokenList, labelText } from './constants';
|
|
4
2
|
import readme from './form_combobox.md';
|
|
5
3
|
import GlFormCombobox from './form_combobox.vue';
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const getProps = () => {
|
|
12
|
-
return {
|
|
13
|
-
tokenList: {
|
|
14
|
-
type: Array,
|
|
15
|
-
default: object('tokens', tokenList),
|
|
16
|
-
},
|
|
17
|
-
labelText: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: text('label text', labelText),
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
};
|
|
5
|
+
const getProps = () => ({
|
|
6
|
+
tokenList,
|
|
7
|
+
labelText,
|
|
8
|
+
});
|
|
23
9
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
template: `
|
|
10
|
+
const Template = (args) => ({
|
|
11
|
+
components: { GlFormCombobox },
|
|
12
|
+
data: () => {
|
|
13
|
+
return {
|
|
14
|
+
value: '',
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
props: Object.keys(args),
|
|
18
|
+
template: `
|
|
35
19
|
<gl-form-combobox
|
|
36
20
|
v-model="value"
|
|
37
21
|
:token-list="tokenList"
|
|
38
22
|
:labelText="labelText"
|
|
39
23
|
/>
|
|
40
24
|
`,
|
|
41
|
-
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const Default = Template.bind({});
|
|
28
|
+
Default.args = getProps();
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
title: 'base/form/form-combobox',
|
|
32
|
+
component: GlFormCombobox,
|
|
33
|
+
parameters: {
|
|
34
|
+
knobs: { disable: true },
|
|
35
|
+
docs: {
|
|
36
|
+
description: {
|
|
37
|
+
component: readme,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -1,37 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './form_radio.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
description,
|
|
6
|
-
examples,
|
|
7
5
|
followsDesignSystem: true,
|
|
8
|
-
bootstrapComponent: 'b-form-radio',
|
|
9
|
-
propsInfo: {
|
|
10
|
-
checked: {
|
|
11
|
-
additionalInfo: 'The current value of the radio(s)',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
events: [
|
|
15
|
-
{
|
|
16
|
-
event: 'input',
|
|
17
|
-
args: [{ arg: 'checked', description: 'current selected value of radio group' }],
|
|
18
|
-
description: 'Emitted when the selected value is changed',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
event: 'change',
|
|
22
|
-
args: [{ arg: 'checked', description: 'current selected value of radio group' }],
|
|
23
|
-
description: 'Emitted when the selected value is changed due to user interaction',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
slots: [
|
|
27
|
-
{
|
|
28
|
-
name: 'help',
|
|
29
|
-
description:
|
|
30
|
-
'Content provided here will be shown beneath the radio. Typically used for help or descriptive text.',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'default',
|
|
34
|
-
description: 'Content to use for the label',
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
6
|
};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
# GlFormRadio
|
|
2
|
-
|
|
3
|
-
A radio button typically represents a single option in a group of related
|
|
4
|
-
choices. Each radio button is boolean and only one can be selected at a time.
|
|
5
|
-
|
|
6
|
-
## Usage
|
|
7
|
-
|
|
8
1
|
`GlFormRadio` components can be used directly, or via a `GlFormRadioGroup`.
|
|
9
2
|
|
|
10
3
|
Below is an example which demonstrates the direct approach. For examples using
|
|
@@ -12,13 +5,13 @@ Below is an example which demonstrates the direct approach. For examples using
|
|
|
12
5
|
|
|
13
6
|
```html
|
|
14
7
|
<script>
|
|
15
|
-
export default {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
8
|
+
export default {
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
selected: 'yes',
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
};
|
|
22
15
|
</script>
|
|
23
16
|
|
|
24
17
|
<template>
|
|
@@ -1,48 +1,60 @@
|
|
|
1
|
-
import { withKnobs, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
1
|
import { GlFormRadio } from '../../../../../index';
|
|
4
2
|
import readme from './form_radio.md';
|
|
5
3
|
|
|
6
|
-
const components = {
|
|
7
|
-
GlFormRadio,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
4
|
const defaultOptions = [
|
|
11
5
|
{ value: 'Pizza', text: 'Pizza' },
|
|
12
6
|
{ value: 'Tacos', text: 'Tacos' },
|
|
13
7
|
{ value: 'Burger', text: 'Burger', disabled: true },
|
|
14
8
|
];
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
default: text('name', name),
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
10
|
+
const generateProps = ({ name = 'radio-group-name', checked = defaultOptions[0].value } = {}) => ({
|
|
11
|
+
name,
|
|
12
|
+
checked,
|
|
13
|
+
});
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
props: generateProps(),
|
|
30
|
-
data() {
|
|
31
|
-
return {
|
|
32
|
-
selected: defaultOptions[0].value,
|
|
33
|
-
options: defaultOptions,
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
template: `
|
|
15
|
+
const Template = (args) => ({
|
|
16
|
+
components: { GlFormRadio },
|
|
17
|
+
props: Object.keys(args),
|
|
18
|
+
template: `
|
|
37
19
|
<div>
|
|
38
20
|
<gl-form-radio
|
|
39
21
|
v-for="option in options"
|
|
40
22
|
:key="option.value"
|
|
41
|
-
|
|
23
|
+
:checked="checked"
|
|
42
24
|
:value="option.value"
|
|
43
25
|
:disabled="option.disabled"
|
|
44
26
|
:name="name"
|
|
45
27
|
>{{ option.text }}</gl-form-radio>
|
|
46
28
|
</div>
|
|
47
29
|
`,
|
|
48
|
-
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
options: defaultOptions,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const Default = Template.bind({});
|
|
38
|
+
Default.args = generateProps();
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
title: 'base/form/form-radio',
|
|
42
|
+
component: GlFormRadio,
|
|
43
|
+
parameters: {
|
|
44
|
+
bootstrapComponent: 'b-form-radio',
|
|
45
|
+
knobs: { disable: true },
|
|
46
|
+
docs: {
|
|
47
|
+
description: {
|
|
48
|
+
component: readme,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
argTypes: {
|
|
53
|
+
checked: {
|
|
54
|
+
options: defaultOptions.map(({ value }) => value),
|
|
55
|
+
control: {
|
|
56
|
+
type: 'select',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -7,20 +7,45 @@ export default {
|
|
|
7
7
|
name: 'GlFormRadio',
|
|
8
8
|
components: { BFormRadio },
|
|
9
9
|
inheritAttrs: false,
|
|
10
|
-
model
|
|
10
|
+
model: {
|
|
11
|
+
prop: model.prop,
|
|
12
|
+
event: model.event,
|
|
13
|
+
},
|
|
14
|
+
props: {
|
|
15
|
+
/**
|
|
16
|
+
* Whether the radio is checked
|
|
17
|
+
*/
|
|
18
|
+
checked: {
|
|
19
|
+
type: [String, Number, Boolean, Object],
|
|
20
|
+
required: false,
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
11
24
|
};
|
|
12
25
|
</script>
|
|
13
26
|
|
|
14
27
|
<template>
|
|
28
|
+
<!--
|
|
29
|
+
Emitted when the selected value is changed
|
|
30
|
+
@event input
|
|
31
|
+
@type {boolean} current selected value of radio group
|
|
32
|
+
|
|
33
|
+
Emitted when the selected value is changed due to user interaction
|
|
34
|
+
@event change
|
|
35
|
+
@type {boolean} current selected value of radio group
|
|
36
|
+
-->
|
|
15
37
|
<b-form-radio
|
|
16
38
|
class="gl-form-radio"
|
|
39
|
+
:checked="checked"
|
|
17
40
|
v-bind="$attrs"
|
|
18
41
|
v-on="$listeners"
|
|
19
42
|
@input="$emit('input', $event)"
|
|
20
43
|
@change="$emit('change', $event)"
|
|
21
44
|
>
|
|
45
|
+
<!-- @slot Content to use for the label -->
|
|
22
46
|
<slot></slot>
|
|
23
47
|
<p v-if="$scopedSlots.help" class="help-text">
|
|
48
|
+
<!-- @slot Content provided here will be shown beneath the radio. Typically used for help or descriptive text. -->
|
|
24
49
|
<slot name="help"></slot>
|
|
25
50
|
</p>
|
|
26
51
|
</b-form-radio>
|
|
@@ -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
|
+
};
|