@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
|
@@ -16,47 +16,79 @@ export default {
|
|
|
16
16
|
// GraphQL type, allowing the returned `pageInfo` object to
|
|
17
17
|
// be bound directly to this component:
|
|
18
18
|
// `<gl-keyset-pagination v-bind="pageInfo">`
|
|
19
|
+
/**
|
|
20
|
+
* Whether or not the "Prev" button should be enabled
|
|
21
|
+
*/
|
|
19
22
|
hasPreviousPage: {
|
|
20
23
|
type: Boolean,
|
|
21
24
|
required: false,
|
|
22
25
|
default: false,
|
|
23
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* Whether or not the "Next" button should be enabled
|
|
29
|
+
*/
|
|
24
30
|
hasNextPage: {
|
|
25
31
|
type: Boolean,
|
|
26
32
|
required: false,
|
|
27
33
|
default: false,
|
|
28
34
|
},
|
|
35
|
+
/**
|
|
36
|
+
* A cursor that points to the first item in the current page.
|
|
37
|
+
* Will be passed as an event parameter when the "prev" event is fired.
|
|
38
|
+
*/
|
|
29
39
|
startCursor: {
|
|
30
40
|
type: String,
|
|
31
41
|
required: false,
|
|
32
42
|
default: null,
|
|
33
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* A cursor that points to the last item in the current page.
|
|
46
|
+
* Will be passed as an event parameter when the "next" event is fired.
|
|
47
|
+
*/
|
|
34
48
|
endCursor: {
|
|
35
49
|
type: String,
|
|
36
50
|
required: false,
|
|
37
51
|
default: null,
|
|
38
52
|
},
|
|
39
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The text that will be rendered inside the "Prev" button.
|
|
55
|
+
* It\'s important to provide this parameter since the default text is not translatable.
|
|
56
|
+
*/
|
|
40
57
|
prevText: {
|
|
41
58
|
type: String,
|
|
42
59
|
required: false,
|
|
43
60
|
default: 'Prev',
|
|
44
61
|
},
|
|
62
|
+
/**
|
|
63
|
+
* A link that will be used as the "Prev" button\'s "href" attribute.
|
|
64
|
+
* If provided, the "Prev" button renders as a link button; otherwise, it is rendered as a regular button.
|
|
65
|
+
*/
|
|
45
66
|
prevButtonLink: {
|
|
46
67
|
type: String,
|
|
47
68
|
required: false,
|
|
48
69
|
default: null,
|
|
49
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* The text that will be rendered inside the "Next" button.
|
|
73
|
+
* It\'s important to provide this parameter since the default text is not translatable.
|
|
74
|
+
*/
|
|
50
75
|
nextText: {
|
|
51
76
|
type: String,
|
|
52
77
|
required: false,
|
|
53
78
|
default: 'Next',
|
|
54
79
|
},
|
|
80
|
+
/**
|
|
81
|
+
* A link that will be used as the "Next" button\'s "href" attribute.
|
|
82
|
+
* If provided, the "Next" button renders as a link button; otherwise, it is rendered as a regular button.
|
|
83
|
+
*/
|
|
55
84
|
nextButtonLink: {
|
|
56
85
|
type: String,
|
|
57
86
|
required: false,
|
|
58
87
|
default: null,
|
|
59
88
|
},
|
|
89
|
+
/**
|
|
90
|
+
* Whether or not both buttons should be disabled (regardless of the "hasPreviousPage" and "hasNextPage" values).
|
|
91
|
+
*/
|
|
60
92
|
disabled: {
|
|
61
93
|
type: Boolean,
|
|
62
94
|
required: false,
|
|
@@ -74,6 +106,7 @@ export default {
|
|
|
74
106
|
data-testid="prevButton"
|
|
75
107
|
@click="$emit('prev', startCursor)"
|
|
76
108
|
>
|
|
109
|
+
<!-- @slot Used to customize the appearance of the "Prev" button -->
|
|
77
110
|
<slot name="previous-button-content">
|
|
78
111
|
<div class="gl-display-flex gl-align-center">
|
|
79
112
|
<gl-icon name="chevron-left" />
|
|
@@ -87,6 +120,7 @@ export default {
|
|
|
87
120
|
data-testid="nextButton"
|
|
88
121
|
@click="$emit('next', endCursor)"
|
|
89
122
|
>
|
|
123
|
+
<!-- @slot Used to customize the appearance of the "Next" button -->
|
|
90
124
|
<slot name="next-button-content">
|
|
91
125
|
<div class="gl-display-flex gl-align-center">
|
|
92
126
|
{{ nextText }}
|
|
@@ -1,48 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './modal.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
|
-
bootstrapComponent: 'b-modal',
|
|
6
4
|
followsDesignSystem: true,
|
|
7
5
|
description,
|
|
8
|
-
examples,
|
|
9
|
-
slots: [
|
|
10
|
-
{
|
|
11
|
-
name: 'modal-header',
|
|
12
|
-
description:
|
|
13
|
-
'Entire modal header container contents (including the close button on the top right corner)',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'modal-title',
|
|
17
|
-
description: 'Modal title. If modal-header slot is used, this slot will not be shown.',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'modal-header-close',
|
|
21
|
-
description:
|
|
22
|
-
'Content of Modal header close button. If modal-header slot is used, this slot will not be shown.',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: 'modal-footer',
|
|
26
|
-
description:
|
|
27
|
-
'Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary.',
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
events: [
|
|
31
|
-
{
|
|
32
|
-
event: '@primary',
|
|
33
|
-
description: 'Emitted when clicked on modal-action-primary',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
event: '@secondary',
|
|
37
|
-
description: 'Emitted when clicked on modal-action-secondary',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
event: '@canceled',
|
|
41
|
-
description: 'Emitted when clicked on modal-action-cancel',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
event: '@change',
|
|
45
|
-
description: 'Emitted when the modal visibility changes',
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
6
|
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
# Modal
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
## Usage
|
|
5
|
-
|
|
6
1
|
Modals are used to reveal critical information, show information without losing context, or when the
|
|
7
2
|
system requires a user response. Modals can also fragment a complex workflow into simpler steps and
|
|
8
3
|
should serve a single purpose dedicated to completing the user’s task.
|
|
@@ -22,7 +17,7 @@ The `modal-footer` slot should only be populated via props: `action-primary`, `a
|
|
|
22
17
|
`action-cancel`. These props allow you to handle how a primary, secondary and cancel button will
|
|
23
18
|
behave in the modals footer. The props receive an object as such:
|
|
24
19
|
|
|
25
|
-
|
|
20
|
+
```js
|
|
26
21
|
{
|
|
27
22
|
text: 'Save Changes',
|
|
28
23
|
attributes: [
|
|
@@ -32,4 +27,4 @@ behave in the modals footer. The props receive an object as such:
|
|
|
32
27
|
...
|
|
33
28
|
]
|
|
34
29
|
}
|
|
35
|
-
|
|
30
|
+
```
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import { withKnobs, select, number, boolean } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { GlModal, GlModalDirective, GlButton } from '../../../../index';
|
|
4
2
|
import { variantOptionsWithNoDefault } from '../../../utils/constants';
|
|
5
3
|
import readme from './modal.md';
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
GlModal,
|
|
9
|
-
GlButton,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const directives = {
|
|
13
|
-
GlModalDirective,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function generateTemplate({ props = {}, slots = {} } = {}) {
|
|
5
|
+
const generateTemplate = ({ props = {}, slots = {} } = {}) => {
|
|
17
6
|
const extraProps = Object.entries(props)
|
|
18
7
|
.map(([key, value]) => `:${key}="${value}"`)
|
|
19
8
|
.join('\n ');
|
|
@@ -51,97 +40,130 @@ function generateTemplate({ props = {}, slots = {} } = {}) {
|
|
|
51
40
|
</gl-modal>
|
|
52
41
|
</div>
|
|
53
42
|
`;
|
|
54
|
-
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const Template = (args, { argTypes }) => ({
|
|
46
|
+
components: { GlModal, GlButton },
|
|
47
|
+
directives: { GlModalDirective },
|
|
48
|
+
props: Object.keys(argTypes),
|
|
49
|
+
template: generateTemplate(),
|
|
50
|
+
});
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
const generateProps = ({
|
|
57
53
|
variant = variantOptionsWithNoDefault.default,
|
|
58
54
|
contentPagraphs = 1,
|
|
59
55
|
scrollable = false,
|
|
60
56
|
visible = false,
|
|
61
|
-
} = {}) {
|
|
62
|
-
|
|
57
|
+
} = {}) => ({
|
|
58
|
+
headerBgVariant: variant,
|
|
59
|
+
headerBorderVariant: variant,
|
|
60
|
+
headerTextVariant: variant,
|
|
61
|
+
bodyBgVariant: variant,
|
|
62
|
+
bodyTextVariant: variant,
|
|
63
|
+
footerBgVariant: variant,
|
|
64
|
+
footerBorderVariant: variant,
|
|
65
|
+
footerTextVariant: variant,
|
|
66
|
+
contentParagraphs: contentPagraphs,
|
|
67
|
+
scrollable,
|
|
68
|
+
visible,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export const Default = Template.bind({});
|
|
72
|
+
Default.args = generateProps();
|
|
73
|
+
|
|
74
|
+
export const OpenedModal = Template.bind({});
|
|
75
|
+
OpenedModal.args = generateProps({ visible: true });
|
|
76
|
+
|
|
77
|
+
export const WithScrollingContent = Template.bind({});
|
|
78
|
+
WithScrollingContent.args = generateProps({
|
|
79
|
+
contentPagraphs: 100,
|
|
80
|
+
scrollable: true,
|
|
81
|
+
visible: true,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export const WithAHeader = (args, { argTypes }) => ({
|
|
85
|
+
components: { GlModal, GlButton },
|
|
86
|
+
directives: { GlModalDirective },
|
|
87
|
+
props: Object.keys(argTypes),
|
|
88
|
+
template: generateTemplate({
|
|
89
|
+
slots: {
|
|
90
|
+
'modal-header': '<h4>A custom header</h4>',
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
94
|
+
WithAHeader.args = generateProps({ visible: true });
|
|
95
|
+
|
|
96
|
+
export const WithoutAFooter = (args, { argTypes }) => ({
|
|
97
|
+
components: { GlModal, GlButton },
|
|
98
|
+
directives: { GlModalDirective },
|
|
99
|
+
props: Object.keys(argTypes),
|
|
100
|
+
template: generateTemplate({
|
|
101
|
+
props: { 'hide-footer': true },
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
WithoutAFooter.args = generateProps({ visible: true });
|
|
105
|
+
|
|
106
|
+
export default {
|
|
107
|
+
title: 'base/modal',
|
|
108
|
+
components: { GlModal, GlButton },
|
|
109
|
+
directives: { GlModalDirective },
|
|
110
|
+
bootstrapComponent: 'b-modal',
|
|
111
|
+
parameters: {
|
|
112
|
+
knobs: { disable: true },
|
|
113
|
+
docs: {
|
|
114
|
+
description: {
|
|
115
|
+
component: readme,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
argTypes: {
|
|
63
120
|
headerBgVariant: {
|
|
64
|
-
|
|
65
|
-
|
|
121
|
+
control: {
|
|
122
|
+
type: 'select',
|
|
123
|
+
options: variantOptionsWithNoDefault,
|
|
124
|
+
},
|
|
66
125
|
},
|
|
67
126
|
headerBorderVariant: {
|
|
68
|
-
|
|
69
|
-
|
|
127
|
+
control: {
|
|
128
|
+
type: 'select',
|
|
129
|
+
options: variantOptionsWithNoDefault,
|
|
130
|
+
},
|
|
70
131
|
},
|
|
71
132
|
headerTextVariant: {
|
|
72
|
-
|
|
73
|
-
|
|
133
|
+
control: {
|
|
134
|
+
type: 'select',
|
|
135
|
+
options: variantOptionsWithNoDefault,
|
|
136
|
+
},
|
|
74
137
|
},
|
|
75
138
|
bodyBgVariant: {
|
|
76
|
-
|
|
77
|
-
|
|
139
|
+
control: {
|
|
140
|
+
type: 'select',
|
|
141
|
+
options: variantOptionsWithNoDefault,
|
|
142
|
+
},
|
|
78
143
|
},
|
|
79
144
|
bodyTextVariant: {
|
|
80
|
-
|
|
81
|
-
|
|
145
|
+
control: {
|
|
146
|
+
type: 'select',
|
|
147
|
+
options: variantOptionsWithNoDefault,
|
|
148
|
+
},
|
|
82
149
|
},
|
|
83
150
|
footerBgVariant: {
|
|
84
|
-
|
|
85
|
-
|
|
151
|
+
control: {
|
|
152
|
+
type: 'select',
|
|
153
|
+
options: variantOptionsWithNoDefault,
|
|
154
|
+
},
|
|
86
155
|
},
|
|
87
156
|
footerBorderVariant: {
|
|
88
|
-
|
|
89
|
-
|
|
157
|
+
control: {
|
|
158
|
+
type: 'select',
|
|
159
|
+
options: variantOptionsWithNoDefault,
|
|
160
|
+
},
|
|
90
161
|
},
|
|
91
162
|
footerTextVariant: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
contentParagraphs: {
|
|
96
|
-
type: Number,
|
|
97
|
-
default: number('content paragraphs', contentPagraphs),
|
|
98
|
-
},
|
|
99
|
-
scrollable: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: boolean('scrollable', scrollable),
|
|
102
|
-
},
|
|
103
|
-
visible: {
|
|
104
|
-
type: Boolean,
|
|
105
|
-
default: visible,
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
documentedStoriesOf('base/modal', readme)
|
|
111
|
-
.addDecorator(withKnobs)
|
|
112
|
-
.add('default', () => ({
|
|
113
|
-
props: generateProps(),
|
|
114
|
-
components,
|
|
115
|
-
directives,
|
|
116
|
-
template: generateTemplate(),
|
|
117
|
-
}))
|
|
118
|
-
.add('opened modal', () => ({
|
|
119
|
-
props: generateProps({ visible: true }),
|
|
120
|
-
components,
|
|
121
|
-
directives,
|
|
122
|
-
template: generateTemplate(),
|
|
123
|
-
}))
|
|
124
|
-
.add('with scrolling content', () => ({
|
|
125
|
-
props: generateProps({ contentPagraphs: 100, scrollable: true, visible: true }),
|
|
126
|
-
components,
|
|
127
|
-
directives,
|
|
128
|
-
template: generateTemplate(),
|
|
129
|
-
}))
|
|
130
|
-
.add('with a header', () => ({
|
|
131
|
-
props: generateProps({ visible: true }),
|
|
132
|
-
components,
|
|
133
|
-
directives,
|
|
134
|
-
template: generateTemplate({
|
|
135
|
-
slots: {
|
|
136
|
-
'modal-header': '<h4>A custom header</h4>',
|
|
163
|
+
control: {
|
|
164
|
+
type: 'select',
|
|
165
|
+
options: variantOptionsWithNoDefault,
|
|
137
166
|
},
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
props: generateProps({ visible: true }),
|
|
142
|
-
components,
|
|
143
|
-
directives,
|
|
144
|
-
template: generateTemplate({
|
|
145
|
-
props: { 'hide-footer': true },
|
|
146
|
-
}),
|
|
147
|
-
}));
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
};
|
|
@@ -80,6 +80,22 @@ export default {
|
|
|
80
80
|
default: false,
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
|
+
computed: {
|
|
84
|
+
shouldRenderModalOk() {
|
|
85
|
+
return Boolean(this.$slots['modal-ok']);
|
|
86
|
+
},
|
|
87
|
+
shouldRenderModalCancel() {
|
|
88
|
+
return Boolean(this.$slots['modal-cancel']);
|
|
89
|
+
},
|
|
90
|
+
shouldRenderModalFooter() {
|
|
91
|
+
return Boolean(
|
|
92
|
+
this.actionCancel ||
|
|
93
|
+
this.actionSecondary ||
|
|
94
|
+
this.actionPrimary ||
|
|
95
|
+
this.$slots['modal-footer']
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
},
|
|
83
99
|
methods: {
|
|
84
100
|
show() {
|
|
85
101
|
this.$refs.modal.show();
|
|
@@ -139,6 +155,10 @@ export default {
|
|
|
139
155
|
</script>
|
|
140
156
|
|
|
141
157
|
<template>
|
|
158
|
+
<!--
|
|
159
|
+
Emitted when the modal visibility changes
|
|
160
|
+
@event change
|
|
161
|
+
-->
|
|
142
162
|
<b-modal
|
|
143
163
|
:id="modalId"
|
|
144
164
|
ref="modal"
|
|
@@ -154,45 +174,66 @@ export default {
|
|
|
154
174
|
@cancel="canceled"
|
|
155
175
|
@change="$emit('change', $event)"
|
|
156
176
|
>
|
|
157
|
-
<
|
|
177
|
+
<template #default>
|
|
178
|
+
<slot name="default"></slot>
|
|
179
|
+
</template>
|
|
158
180
|
<template #modal-header>
|
|
181
|
+
<!-- @slot Entire modal header container contents (including the close button on the top right corner) -->
|
|
159
182
|
<slot name="modal-header">
|
|
160
183
|
<h4 class="modal-title">
|
|
184
|
+
<!-- @slot Modal title. If modal-header slot is used, this slot will not be shown. -->
|
|
161
185
|
<slot name="modal-title">{{ title }}</slot>
|
|
162
186
|
</h4>
|
|
163
187
|
</slot>
|
|
188
|
+
<!-- @slot Content of Modal header close button. If modal-header slot is used, this slot will not be shown. -->
|
|
164
189
|
<close-button ref="close-button" :label="dismissLabel" @click="close" />
|
|
165
190
|
</template>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
<template v-if="shouldRenderModalOk" #modal-ok>
|
|
192
|
+
<slot name="modal-ok"></slot>
|
|
193
|
+
</template>
|
|
194
|
+
<template v-if="shouldRenderModalCancel" #modal-cancel>
|
|
195
|
+
<slot name="modal-cancel"></slot>
|
|
196
|
+
</template>
|
|
197
|
+
<!-- @slot Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary. -->
|
|
198
|
+
<template v-if="shouldRenderModalFooter" #modal-footer>
|
|
199
|
+
<slot name="modal-footer">
|
|
200
|
+
<!--
|
|
201
|
+
Emitted when clicked on modal-action-cancel
|
|
202
|
+
@event canceled
|
|
203
|
+
-->
|
|
204
|
+
<gl-button
|
|
205
|
+
v-if="actionCancel"
|
|
206
|
+
class="js-modal-action-cancel"
|
|
207
|
+
v-bind="buttonBinding(actionCancel, 'actionCancel')"
|
|
208
|
+
@click="cancel"
|
|
209
|
+
>
|
|
210
|
+
{{ actionCancel.text }}
|
|
211
|
+
</gl-button>
|
|
212
|
+
<!--
|
|
213
|
+
Emitted when clicked on modal-action-secondary
|
|
214
|
+
@event secondary
|
|
215
|
+
-->
|
|
216
|
+
<gl-button
|
|
217
|
+
v-if="actionSecondary"
|
|
218
|
+
class="js-modal-action-secondary"
|
|
219
|
+
v-bind="buttonBinding(actionSecondary, 'actionSecondary')"
|
|
220
|
+
@click="secondary"
|
|
221
|
+
>
|
|
222
|
+
{{ actionSecondary.text }}
|
|
223
|
+
</gl-button>
|
|
224
|
+
<!--
|
|
225
|
+
Emitted when clicked on modal-action-primary
|
|
226
|
+
@event primary
|
|
227
|
+
-->
|
|
228
|
+
<gl-button
|
|
229
|
+
v-if="actionPrimary"
|
|
230
|
+
class="js-modal-action-primary"
|
|
231
|
+
v-bind="buttonBinding(actionPrimary, 'actionPrimary')"
|
|
232
|
+
@click="ok"
|
|
233
|
+
>
|
|
234
|
+
{{ actionPrimary.text }}
|
|
235
|
+
</gl-button>
|
|
236
|
+
</slot>
|
|
237
|
+
</template>
|
|
197
238
|
</b-modal>
|
|
198
239
|
</template>
|