@gitlab/ui 32.47.0 → 32.51.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.documentation.js +1 -5
- 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/form_select/form_select.documentation.js +2 -17
- 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 +15 -1
- package/dist/components/charts/gauge/gauge.documentation.js +2 -6
- package/dist/components/utilities/intersperse/intersperse.documentation.js +2 -5
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/documentation/documented_stories.js +9 -0
- package/package.json +3 -3
- package/scss_to_js/scss_variables.js +2 -0
- package/scss_to_js/scss_variables.json +10 -0
- 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.documentation.js +0 -3
- package/src/components/base/form/form.stories.js +99 -14
- 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/form_select/form_select.documentation.js +0 -19
- package/src/components/base/form/form_select/form_select.md +0 -2
- package/src/components/base/form/form_select/form_select.stories.js +98 -80
- 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 +73 -32
- 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/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/src/scss/utilities.scss +16 -0
- package/src/scss/utility-mixins/sizing.scss +8 -0
- package/src/scss/variables.scss +2 -0
- 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/examples/form.basic.example.js +0 -76
- package/dist/components/base/form/examples/form.edit.example.js +0 -66
- package/dist/components/base/form/examples/form.inline.example.js +0 -62
- package/dist/components/base/form/examples/form.novalidate.example.js +0 -61
- package/dist/components/base/form/examples/index.js +0 -27
- 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/form_select/examples/form_select.basic.example.js +0 -55
- package/dist/components/base/form/form_select/examples/form_select.disabled.example.js +0 -55
- package/dist/components/base/form/form_select/examples/form_select.manual_options.example.js +0 -48
- package/dist/components/base/form/form_select/examples/form_select.mixed_options.example.js +0 -55
- package/dist/components/base/form/form_select/examples/index.js +0 -27
- 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/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/examples/form.basic.example.vue +0 -73
- package/src/components/base/form/examples/form.edit.example.vue +0 -37
- package/src/components/base/form/examples/form.inline.example.vue +0 -36
- package/src/components/base/form/examples/form.novalidate.example.vue +0 -30
- package/src/components/base/form/examples/index.js +0 -32
- 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/form_select/examples/form_select.basic.example.vue +0 -17
- package/src/components/base/form/form_select/examples/form_select.disabled.example.vue +0 -17
- package/src/components/base/form/form_select/examples/form_select.manual_options.example.vue +0 -17
- package/src/components/base/form/form_select/examples/form_select.mixed_options.example.vue +0 -21
- package/src/components/base/form/form_select/examples/index.js +0 -32
- 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/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,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,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './form_select.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
description,
|
|
6
|
-
examples,
|
|
7
5
|
followDesignSystem: true,
|
|
8
|
-
bootstrapComponent: 'b-form-select',
|
|
9
|
-
events: [
|
|
10
|
-
{
|
|
11
|
-
event: 'change',
|
|
12
|
-
description: 'Emitted with the select value changes via user interaction.',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
event: 'input',
|
|
16
|
-
description: 'Emitted with the select value changes.',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
slots: [
|
|
20
|
-
{
|
|
21
|
-
name: 'first',
|
|
22
|
-
description: 'Slot to place option tags above options provided via options prop',
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
6
|
};
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import { withKnobs, boolean, select, number, object } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
1
|
import { GlFormSelect } from '../../../../../index';
|
|
4
2
|
import { sizeOptions, formStateOptions } from '../../../../utils/constants';
|
|
5
3
|
import { formSelectOptions } from './constants';
|
|
6
4
|
import readme from './form_select.md';
|
|
7
5
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const data = () => {
|
|
13
|
-
return {
|
|
14
|
-
selected: 'Pizza',
|
|
15
|
-
};
|
|
16
|
-
};
|
|
6
|
+
const data = () => ({
|
|
7
|
+
selected: 'Pizza',
|
|
8
|
+
});
|
|
17
9
|
|
|
18
10
|
const template = `
|
|
19
11
|
<gl-form-select
|
|
@@ -27,86 +19,112 @@ const template = `
|
|
|
27
19
|
</gl-form-select>
|
|
28
20
|
`;
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
const generateProps = ({
|
|
31
23
|
size = null,
|
|
32
24
|
state = null,
|
|
33
25
|
disabled = false,
|
|
34
26
|
multiple = false,
|
|
35
27
|
selectSize = 1,
|
|
36
28
|
options = formSelectOptions,
|
|
37
|
-
} = {}) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
} = {}) => ({
|
|
30
|
+
size,
|
|
31
|
+
disabled,
|
|
32
|
+
state,
|
|
33
|
+
multiple,
|
|
34
|
+
selectSize,
|
|
35
|
+
options,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const Template = (args) => ({
|
|
39
|
+
components: { GlFormSelect },
|
|
40
|
+
props: Object.keys(args),
|
|
41
|
+
data,
|
|
42
|
+
template,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const Default = Template.bind({});
|
|
46
|
+
Default.args = generateProps();
|
|
47
|
+
|
|
48
|
+
export const Disabled = Template.bind({});
|
|
49
|
+
Disabled.args = generateProps({ disabled: true });
|
|
50
|
+
|
|
51
|
+
export const ValidState = Template.bind({});
|
|
52
|
+
ValidState.args = generateProps({ state: true });
|
|
53
|
+
|
|
54
|
+
export const InvalidState = Template.bind({});
|
|
55
|
+
InvalidState.args = generateProps({ state: false });
|
|
56
|
+
|
|
57
|
+
export const WithTruncation = (args, { argTypes }) => ({
|
|
58
|
+
components: { GlFormSelect },
|
|
59
|
+
props: Object.keys(argTypes),
|
|
60
|
+
data() {
|
|
61
|
+
return {
|
|
62
|
+
selected: 1,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
template: `
|
|
66
|
+
<div style="max-width: 300px;">
|
|
67
|
+
${template}
|
|
68
|
+
</div>
|
|
69
|
+
`,
|
|
70
|
+
});
|
|
71
|
+
WithTruncation.args = generateProps({
|
|
72
|
+
options: [
|
|
73
|
+
{
|
|
74
|
+
value: 1,
|
|
75
|
+
text: 'A form select option with a very looooooooong label',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
title: 'base/form/form-select',
|
|
82
|
+
component: GlFormSelect,
|
|
83
|
+
parameters: {
|
|
84
|
+
bootstrapComponent: 'b-form-select',
|
|
85
|
+
knobs: { disable: true },
|
|
86
|
+
docs: {
|
|
87
|
+
description: {
|
|
88
|
+
component: readme,
|
|
89
|
+
},
|
|
42
90
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
91
|
+
},
|
|
92
|
+
argTypes: {
|
|
93
|
+
size: {
|
|
94
|
+
control: {
|
|
95
|
+
type: 'select',
|
|
96
|
+
options: sizeOptions,
|
|
97
|
+
},
|
|
46
98
|
},
|
|
47
99
|
state: {
|
|
48
|
-
|
|
49
|
-
|
|
100
|
+
control: {
|
|
101
|
+
type: 'select',
|
|
102
|
+
options: formStateOptions,
|
|
103
|
+
},
|
|
50
104
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
105
|
+
input: {
|
|
106
|
+
description: 'Emitted with the select value changes.',
|
|
107
|
+
table: {
|
|
108
|
+
category: 'events',
|
|
109
|
+
},
|
|
54
110
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
111
|
+
change: {
|
|
112
|
+
description: 'Emitted with the select value changes via user interaction.',
|
|
113
|
+
table: {
|
|
114
|
+
category: 'events',
|
|
115
|
+
},
|
|
58
116
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
117
|
+
first: {
|
|
118
|
+
description: 'Slot to place option tags above options provided via options prop.',
|
|
119
|
+
table: {
|
|
120
|
+
category: 'slots',
|
|
121
|
+
},
|
|
62
122
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.add('default', () => ({
|
|
69
|
-
components,
|
|
70
|
-
props: generateProps(),
|
|
71
|
-
data,
|
|
72
|
-
template,
|
|
73
|
-
}))
|
|
74
|
-
.add('disabled', () => ({
|
|
75
|
-
components,
|
|
76
|
-
props: generateProps({ disabled: true }),
|
|
77
|
-
data,
|
|
78
|
-
template,
|
|
79
|
-
}))
|
|
80
|
-
.add('valid state', () => ({
|
|
81
|
-
components,
|
|
82
|
-
props: generateProps({ state: true }),
|
|
83
|
-
data,
|
|
84
|
-
template,
|
|
85
|
-
}))
|
|
86
|
-
.add('invalid state', () => ({
|
|
87
|
-
components,
|
|
88
|
-
props: generateProps({ state: false }),
|
|
89
|
-
data,
|
|
90
|
-
template,
|
|
91
|
-
}))
|
|
92
|
-
.add('with truncation', () => ({
|
|
93
|
-
components,
|
|
94
|
-
props: generateProps({
|
|
95
|
-
options: [
|
|
96
|
-
{
|
|
97
|
-
value: 1,
|
|
98
|
-
text: 'A form select option with a very looooooooong label',
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
}),
|
|
102
|
-
data() {
|
|
103
|
-
return {
|
|
104
|
-
selected: 1,
|
|
105
|
-
};
|
|
123
|
+
default: {
|
|
124
|
+
description: 'Slot to place explicit option tags.',
|
|
125
|
+
table: {
|
|
126
|
+
category: 'slots',
|
|
127
|
+
},
|
|
106
128
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
${template}
|
|
110
|
-
</div>
|
|
111
|
-
`,
|
|
112
|
-
}));
|
|
129
|
+
},
|
|
130
|
+
};
|
|
@@ -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
|
+
};
|