@gitlab/ui 32.45.1 → 32.49.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_group/form_group.js +11 -1
- 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/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/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/documentation/documented_stories.js +12 -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/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/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/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/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/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/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,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
|
+
};
|
|
@@ -1,105 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import * as description from './keyset_pagination.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
description,
|
|
6
5
|
followsDesignSystem: true,
|
|
7
|
-
bootstrapComponent: false,
|
|
8
|
-
examples,
|
|
9
|
-
propsInfo: {
|
|
10
|
-
hasPreviousPage: {
|
|
11
|
-
type: Boolean,
|
|
12
|
-
required: false,
|
|
13
|
-
default: false,
|
|
14
|
-
additionalInfo: 'Whether or not the "Prev" button should be enabled',
|
|
15
|
-
},
|
|
16
|
-
hasNextPage: {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
required: false,
|
|
19
|
-
default: false,
|
|
20
|
-
additionalInfo: 'Whether or not the "Next" button should be enabled',
|
|
21
|
-
},
|
|
22
|
-
startCursor: {
|
|
23
|
-
type: String,
|
|
24
|
-
required: false,
|
|
25
|
-
default: null,
|
|
26
|
-
additionalInfo:
|
|
27
|
-
'A cursor that points to the first item in the current page. Will be passed as an event parameter when the "prev" event is fired.',
|
|
28
|
-
},
|
|
29
|
-
endCursor: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: false,
|
|
32
|
-
default: null,
|
|
33
|
-
additionalInfo:
|
|
34
|
-
'A cursor that points to the last item in the current page. Will be passed as an event parameter when the "next" event is fired.',
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
prevText: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: false,
|
|
40
|
-
default: 'Prev',
|
|
41
|
-
additionalInfo:
|
|
42
|
-
'The text that will be rendered inside the "Prev" button. It\'s important to provide this parameter since the default text is not translatable.',
|
|
43
|
-
},
|
|
44
|
-
prevButtonLink: {
|
|
45
|
-
type: String,
|
|
46
|
-
required: false,
|
|
47
|
-
default: null,
|
|
48
|
-
additionalInfo:
|
|
49
|
-
'A link that will be used as the "Prev" button\'s "href" attribute. If provided, the "Prev" button renders as a link button; otherwise, it is rendered as a regular button.',
|
|
50
|
-
},
|
|
51
|
-
nextText: {
|
|
52
|
-
type: String,
|
|
53
|
-
required: false,
|
|
54
|
-
default: 'Next',
|
|
55
|
-
additionalInfo:
|
|
56
|
-
'The text that will be rendered inside the "Next" button. It\'s important to provide this parameter since the default text is not translatable.',
|
|
57
|
-
},
|
|
58
|
-
nextButtonLink: {
|
|
59
|
-
type: String,
|
|
60
|
-
required: false,
|
|
61
|
-
default: null,
|
|
62
|
-
additionalInfo:
|
|
63
|
-
'A link that will be used as the "Next" button\'s "href" attribute. If provided, the "Next" button renders as a link button; otherwise, it is rendered as a regular button.',
|
|
64
|
-
},
|
|
65
|
-
disabled: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
required: false,
|
|
68
|
-
default: false,
|
|
69
|
-
additionalInfo:
|
|
70
|
-
'Whether or not both buttons should be disabled (regardless of the "hasPreviousPage" and "hasNextPage" values).',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
events: [
|
|
74
|
-
{
|
|
75
|
-
event: 'prev',
|
|
76
|
-
description: 'Emitted when the "Prev" button is clicked',
|
|
77
|
-
args: [
|
|
78
|
-
{
|
|
79
|
-
arg: 'startCursor',
|
|
80
|
-
description: 'A cursor that points to the first item in the current page.',
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
event: 'next',
|
|
86
|
-
description: 'Emitted when the "Next" button is clicked',
|
|
87
|
-
args: [
|
|
88
|
-
{
|
|
89
|
-
arg: 'endCursor',
|
|
90
|
-
description: 'A cursor that points to the last item in the current page',
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
slots: [
|
|
96
|
-
{
|
|
97
|
-
name: 'previous-button-content',
|
|
98
|
-
description: 'Used to customize the appearance of the "Prev" button',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'next-button-content',
|
|
102
|
-
description: 'Used to customize the appearance of the "Next" button',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
6
|
};
|
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import readme from './keyset_pagination.md';
|
|
4
2
|
import GlKeysetPagination from './keyset_pagination.vue';
|
|
5
3
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const generateProps = ({
|
|
5
|
+
hasPreviousPage = false,
|
|
6
|
+
hasNextPage = true,
|
|
7
|
+
startCursor = 'eyJpZCI6IjE3NTg1ODciLCJyZWxlYXNlZF9hdCI6IjIwMjAtMDgtMjAgMTQ6NDc6MDguNTQ1MjE1MDAwIFVUQyJ9',
|
|
8
|
+
endCursor = 'eyJpZCI6IjEyNjcxNzkiLCJyZWxlYXNlZF9hdCI6IjIwMjAtMDItMTkgMjE6MDA6MDUuODU5NTQ2MDAwIFVUQyJ9',
|
|
9
|
+
prevText = 'Prev',
|
|
10
|
+
nextText = 'Next',
|
|
11
|
+
prevButtonLink = '',
|
|
12
|
+
nextButtonLink = '',
|
|
13
|
+
disabled = false,
|
|
14
|
+
} = {}) => ({
|
|
15
|
+
hasPreviousPage,
|
|
16
|
+
hasNextPage,
|
|
17
|
+
startCursor,
|
|
18
|
+
endCursor,
|
|
19
|
+
prevText,
|
|
20
|
+
nextText,
|
|
21
|
+
prevButtonLink,
|
|
22
|
+
nextButtonLink,
|
|
23
|
+
disabled,
|
|
24
|
+
});
|
|
9
25
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
),
|
|
26
|
-
},
|
|
27
|
-
endCursor: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: text(
|
|
30
|
-
'endCursor',
|
|
31
|
-
'eyJpZCI6IjEyNjcxNzkiLCJyZWxlYXNlZF9hdCI6IjIwMjAtMDItMTkgMjE6MDA6MDUuODU5NTQ2MDAwIFVUQyJ9'
|
|
32
|
-
),
|
|
33
|
-
},
|
|
34
|
-
prevText: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: text('prevText'),
|
|
37
|
-
},
|
|
38
|
-
nextText: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: text('nextText'),
|
|
41
|
-
},
|
|
42
|
-
prevButtonLink: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: text('prevButtonLink'),
|
|
45
|
-
},
|
|
46
|
-
nextButtonLink: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: text('nextButtonLink'),
|
|
26
|
+
const Template = (args, { argTypes }) => ({
|
|
27
|
+
components: { GlKeysetPagination },
|
|
28
|
+
props: Object.keys(argTypes),
|
|
29
|
+
template: `
|
|
30
|
+
<gl-keyset-pagination v-bind="$props"/>
|
|
31
|
+
`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/* eslint-disable no-alert */
|
|
35
|
+
export const Events = (args, { argTypes }) => ({
|
|
36
|
+
components: { GlKeysetPagination },
|
|
37
|
+
props: Object.keys(argTypes),
|
|
38
|
+
methods: {
|
|
39
|
+
onPrev(startCursor) {
|
|
40
|
+
alert(`"prev" event fired with start cursor: "${startCursor}"`);
|
|
49
41
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
default: boolean('disabled', false),
|
|
42
|
+
onNext(endCursor) {
|
|
43
|
+
alert(`"next" event fired with end cursor: "${endCursor}"`);
|
|
53
44
|
},
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
documentedStoriesOf('base/keyset-pagination', readme)
|
|
58
|
-
.addDecorator(withKnobs)
|
|
59
|
-
.add('default', () => ({
|
|
60
|
-
components,
|
|
61
|
-
props: generateProps(),
|
|
62
|
-
template: `
|
|
63
|
-
<gl-keyset-pagination v-bind="$props"/>
|
|
45
|
+
},
|
|
46
|
+
template: `
|
|
47
|
+
<gl-keyset-pagination v-bind="$props" @prev="onPrev($event)" @next="onNext($event)" />
|
|
64
48
|
`,
|
|
65
|
-
|
|
49
|
+
});
|
|
50
|
+
Events.args = generateProps({ hasPreviousPage: true });
|
|
51
|
+
|
|
52
|
+
export const Default = Template.bind({});
|
|
53
|
+
Default.args = generateProps();
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
title: 'base/keyset-pagination',
|
|
57
|
+
component: GlKeysetPagination,
|
|
58
|
+
parameters: {
|
|
59
|
+
bootstrapComponent: false,
|
|
60
|
+
knobs: { disable: true },
|
|
61
|
+
docs: {
|
|
62
|
+
description: {
|
|
63
|
+
component: readme,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|