@gitlab/ui 32.49.0 → 32.51.2
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/breadcrumb/breadcrumb.documentation.js +1 -1
- package/dist/components/base/form/form.documentation.js +1 -5
- package/dist/components/base/form/form_select/form_select.documentation.js +2 -17
- package/dist/components/base/modal/modal.js +15 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/string_utils.js +6 -2
- package/documentation/documented_stories.js +2 -0
- package/package.json +5 -3
- package/scss_to_js/scss_variables.js +2 -0
- package/scss_to_js/scss_variables.json +10 -0
- package/src/components/base/breadcrumb/breadcrumb.md +6 -5
- package/src/components/base/breadcrumb/breadcrumb.scss +1 -1
- package/src/components/base/breadcrumb/breadcrumb.stories.js +4 -1
- 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_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/modal/modal.vue +56 -35
- package/src/scss/utilities.scss +16 -0
- package/src/scss/utility-mixins/sizing.scss +8 -0
- package/src/scss/variables.scss +2 -0
- package/src/utils/string_utils.js +6 -2
- package/src/utils/string_utils.spec.js +8 -0
- 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_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/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_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
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import emojiRegexFactory from 'emoji-regex';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Split the given string after each occurrence of each of the given symbols.
|
|
3
5
|
*
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
* @param {string} string The string to split.
|
|
17
19
|
* @returns {string[]} The resulting strings.
|
|
18
20
|
*/
|
|
21
|
+
|
|
19
22
|
const splitAfterSymbols = (symbols, string) => {
|
|
20
23
|
const textParts = [];
|
|
21
24
|
let textPartStartIndex = 0;
|
|
@@ -60,10 +63,11 @@ const splitAfterSymbols = (symbols, string) => {
|
|
|
60
63
|
|
|
61
64
|
return textParts;
|
|
62
65
|
};
|
|
66
|
+
const startsWithEmojiRegex = `^(${emojiRegexFactory().source})`;
|
|
63
67
|
const getAvatarChar = name => {
|
|
64
68
|
if (name) {
|
|
65
|
-
// Check if
|
|
66
|
-
const match = name.match(
|
|
69
|
+
// Check if string starts with an emoji (which could be multiple characters and zero-width joined)
|
|
70
|
+
const match = name.match(startsWithEmojiRegex);
|
|
67
71
|
|
|
68
72
|
if (match) {
|
|
69
73
|
// Return the first match
|
|
@@ -90,6 +90,7 @@ export const setupStorybookReadme = () =>
|
|
|
90
90
|
'GlAccordion',
|
|
91
91
|
'GlAccordionItem',
|
|
92
92
|
'GlIntersperse',
|
|
93
|
+
'GlFormSelect',
|
|
93
94
|
'GlDaterangePicker',
|
|
94
95
|
'GlAvatarLabeled',
|
|
95
96
|
'GlBarChart',
|
|
@@ -114,6 +115,7 @@ export const setupStorybookReadme = () =>
|
|
|
114
115
|
'GlFormRadio',
|
|
115
116
|
'GlModal',
|
|
116
117
|
'GlKeysetPagination',
|
|
118
|
+
'GlForm',
|
|
117
119
|
],
|
|
118
120
|
components: {
|
|
119
121
|
GlComponentDocumentation,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.51.2",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"vue-runtime-helpers": "^1.1.2"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@gitlab/svgs": "^1.116.0",
|
|
74
|
+
"@gitlab/svgs": "^1.116.0 || ^2.0.0",
|
|
75
|
+
"emoji-regex": ">=10.0.0",
|
|
75
76
|
"bootstrap": "4.5.3",
|
|
76
77
|
"pikaday": "^1.8.0",
|
|
77
78
|
"vue": "^2.6.10"
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
"@babel/preset-env": "^7.10.2",
|
|
86
87
|
"@gitlab/eslint-plugin": "10.0.0",
|
|
87
88
|
"@gitlab/stylelint-config": "2.6.0",
|
|
88
|
-
"@gitlab/svgs": "
|
|
89
|
+
"@gitlab/svgs": "2.0.0",
|
|
89
90
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
90
91
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
91
92
|
"@rollup/plugin-replace": "^2.3.2",
|
|
@@ -107,6 +108,7 @@
|
|
|
107
108
|
"babel-preset-vue": "^2.0.2",
|
|
108
109
|
"bootstrap": "4.5.3",
|
|
109
110
|
"cypress": "^6.6.0",
|
|
111
|
+
"emoji-regex": "^10.0.0",
|
|
110
112
|
"eslint": "7.32.0",
|
|
111
113
|
"eslint-import-resolver-jest": "3.0.2",
|
|
112
114
|
"eslint-plugin-cypress": "2.12.1",
|
|
@@ -15,6 +15,8 @@ export const glSpacingScale12 = '5rem'
|
|
|
15
15
|
export const glSpacingScale13 = '6rem'
|
|
16
16
|
export const glSpacingScale15 = '7.5rem'
|
|
17
17
|
export const glSpacingScale20 = '10rem'
|
|
18
|
+
export const glSpacingScale26 = '13rem'
|
|
19
|
+
export const glSpacingScale62 = '31rem'
|
|
18
20
|
export const breakpointSm = '576px'
|
|
19
21
|
export const breakpointMd = '768px'
|
|
20
22
|
export const breakpointLg = '992px'
|
|
@@ -85,6 +85,16 @@
|
|
|
85
85
|
"value": "20 * $grid-size",
|
|
86
86
|
"compiledValue": "10rem"
|
|
87
87
|
},
|
|
88
|
+
{
|
|
89
|
+
"name": "$gl-spacing-scale-26",
|
|
90
|
+
"value": "26 * $grid-size",
|
|
91
|
+
"compiledValue": "13rem"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "$gl-spacing-scale-62",
|
|
95
|
+
"value": "62 * $grid-size",
|
|
96
|
+
"compiledValue": "31rem"
|
|
97
|
+
},
|
|
88
98
|
{
|
|
89
99
|
"name": "$breakpoint-sm",
|
|
90
100
|
"value": "576px",
|
|
@@ -15,15 +15,16 @@ to draw a `/`
|
|
|
15
15
|
```html
|
|
16
16
|
<gl-breadcrumb :items="items">
|
|
17
17
|
<template #avatar>
|
|
18
|
-
<img
|
|
18
|
+
<img
|
|
19
|
+
alt=""
|
|
19
20
|
class="gl-breadcrumb-avatar-tile"
|
|
20
|
-
src="https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=
|
|
21
|
-
width="
|
|
22
|
-
height="
|
|
21
|
+
src="https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=16"
|
|
22
|
+
width="16"
|
|
23
|
+
height="16"
|
|
23
24
|
/>
|
|
24
25
|
</template>
|
|
25
26
|
<template #separator>
|
|
26
|
-
<svg
|
|
27
|
+
<svg height="16">
|
|
27
28
|
<line x1="100%" y1="0" x2="0" y2="100%" stroke="gray" />
|
|
28
29
|
</svg>
|
|
29
30
|
</template>
|
|
@@ -6,7 +6,10 @@ const template = `
|
|
|
6
6
|
:items="items"
|
|
7
7
|
>
|
|
8
8
|
<template #avatar>
|
|
9
|
-
<img
|
|
9
|
+
<img alt=""
|
|
10
|
+
class="gl-breadcrumb-avatar-tile" src="https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=16"
|
|
11
|
+
width="16"
|
|
12
|
+
height="16" />
|
|
10
13
|
</template>
|
|
11
14
|
</gl-breadcrumb>
|
|
12
15
|
`;
|
|
@@ -1,17 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
GlForm,
|
|
3
|
+
GlFormGroup,
|
|
4
|
+
GlFormInput,
|
|
5
|
+
GlFormSelect,
|
|
6
|
+
GlFormCheckbox,
|
|
7
|
+
GlButton,
|
|
8
|
+
} from '../../../../index';
|
|
9
|
+
import { setStoryTimeout } from '../../../utils/test_utils';
|
|
4
10
|
import readme from './form.md';
|
|
5
11
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
export const Default = (args) => ({
|
|
13
|
+
components: {
|
|
14
|
+
GlForm,
|
|
15
|
+
GlFormGroup,
|
|
16
|
+
GlFormInput,
|
|
17
|
+
GlFormSelect,
|
|
18
|
+
GlFormCheckbox,
|
|
19
|
+
GlButton,
|
|
20
|
+
},
|
|
21
|
+
props: Object.keys(args),
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
form: {
|
|
25
|
+
submitDisabled: false,
|
|
26
|
+
email: '',
|
|
27
|
+
name: '',
|
|
28
|
+
mergeState: null,
|
|
29
|
+
checked: [],
|
|
30
|
+
},
|
|
31
|
+
states: [{ text: 'Select One', value: null }, 'Open', 'Resolved', 'Closed', 'Blocked'],
|
|
32
|
+
show: true,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
onReset() {
|
|
37
|
+
this.form.name = '';
|
|
38
|
+
this.form.submitDisabled = false;
|
|
39
|
+
},
|
|
40
|
+
onSubmit(evt) {
|
|
41
|
+
evt.preventDefault();
|
|
42
|
+
this.form.submitDisabled = true;
|
|
43
|
+
setStoryTimeout(() => {
|
|
44
|
+
this.form.submitDisabled = false;
|
|
45
|
+
// eslint-disable-next-line no-alert
|
|
46
|
+
alert(JSON.stringify(this.form));
|
|
47
|
+
}, 1000);
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
template: `
|
|
51
|
+
<gl-form @submit="onSubmit" @reset="onReset">
|
|
52
|
+
<gl-form-group
|
|
53
|
+
id="input-group-1"
|
|
54
|
+
label="Email address:"
|
|
55
|
+
label-for="input-1"
|
|
56
|
+
description="We'll never share your email with anyone else."
|
|
57
|
+
>
|
|
58
|
+
<gl-form-input
|
|
59
|
+
id="input-1"
|
|
60
|
+
v-model="form.email"
|
|
61
|
+
type="email"
|
|
62
|
+
required
|
|
63
|
+
placeholder="Enter email"
|
|
64
|
+
/>
|
|
65
|
+
</gl-form-group>
|
|
66
|
+
|
|
67
|
+
<gl-form-group id="input-group-2" label="Your Name:" label-for="input-2">
|
|
68
|
+
<gl-form-input id="input-2" v-model="form.name" required placeholder="Enter name" />
|
|
69
|
+
</gl-form-group>
|
|
9
70
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
71
|
+
<gl-form-group id="input-group-3" label="Merge State:" label-for="input-3">
|
|
72
|
+
<gl-form-select id="input-3" v-model="form.mergeState" :options="states" required />
|
|
73
|
+
</gl-form-group>
|
|
74
|
+
|
|
75
|
+
<gl-form-group id="input-group-4">
|
|
76
|
+
<gl-form-checkbox-group id="checkboxes-4" v-model="form.checked">
|
|
77
|
+
<gl-form-checkbox value="squash">Squash Commits</gl-form-checkbox>
|
|
78
|
+
<gl-form-checkbox value="new">Create New Issue</gl-form-checkbox>
|
|
79
|
+
</gl-form-checkbox-group>
|
|
80
|
+
</gl-form-group>
|
|
81
|
+
|
|
82
|
+
<div class="gl-display-flex gl-justify-content-end">
|
|
83
|
+
<gl-button type="reset" class="gl-mr-3">Cancel</gl-button>
|
|
84
|
+
<gl-button type="submit" variant="confirm">Submit</gl-button>
|
|
85
|
+
</div>
|
|
86
|
+
</gl-form>
|
|
87
|
+
`,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export default {
|
|
91
|
+
title: 'base/form/form',
|
|
92
|
+
component: GlForm,
|
|
93
|
+
parameters: {
|
|
94
|
+
bootstrapComponent: 'b-form',
|
|
95
|
+
knobs: { disable: true },
|
|
96
|
+
docs: {
|
|
97
|
+
description: {
|
|
98
|
+
component: readme,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -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();
|
|
@@ -158,7 +174,9 @@ export default {
|
|
|
158
174
|
@cancel="canceled"
|
|
159
175
|
@change="$emit('change', $event)"
|
|
160
176
|
>
|
|
161
|
-
<
|
|
177
|
+
<template #default>
|
|
178
|
+
<slot name="default"></slot>
|
|
179
|
+
</template>
|
|
162
180
|
<template #modal-header>
|
|
163
181
|
<!-- @slot Entire modal header container contents (including the close button on the top right corner) -->
|
|
164
182
|
<slot name="modal-header">
|
|
@@ -170,49 +188,52 @@ export default {
|
|
|
170
188
|
<!-- @slot Content of Modal header close button. If modal-header slot is used, this slot will not be shown. -->
|
|
171
189
|
<close-button ref="close-button" :label="dismissLabel" @click="close" />
|
|
172
190
|
</template>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<
|
|
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>
|
|
177
197
|
<!-- @slot Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary. -->
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
198
|
+
<template v-if="shouldRenderModalFooter" #modal-footer>
|
|
199
|
+
<slot name="modal-footer">
|
|
200
|
+
<!--
|
|
181
201
|
Emitted when clicked on modal-action-cancel
|
|
182
202
|
@event canceled
|
|
183
203
|
-->
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
+
<!--
|
|
193
213
|
Emitted when clicked on modal-action-secondary
|
|
194
214
|
@event secondary
|
|
195
215
|
-->
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
+
<!--
|
|
205
225
|
Emitted when clicked on modal-action-primary
|
|
206
226
|
@event primary
|
|
207
227
|
-->
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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>
|
|
217
238
|
</b-modal>
|
|
218
239
|
</template>
|
package/src/scss/utilities.scss
CHANGED
|
@@ -4313,6 +4313,22 @@
|
|
|
4313
4313
|
max-width: $gl-spacing-scale-15 !important;
|
|
4314
4314
|
}
|
|
4315
4315
|
|
|
4316
|
+
.gl-max-w-26 {
|
|
4317
|
+
max-width: $gl-spacing-scale-26;
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4320
|
+
.gl-max-w-26\! {
|
|
4321
|
+
max-width: $gl-spacing-scale-26 !important;
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
.gl-max-w-62 {
|
|
4325
|
+
max-width: $gl-spacing-scale-62;
|
|
4326
|
+
}
|
|
4327
|
+
|
|
4328
|
+
.gl-max-w-62\! {
|
|
4329
|
+
max-width: $gl-spacing-scale-62 !important;
|
|
4330
|
+
}
|
|
4331
|
+
|
|
4316
4332
|
.gl-max-w-none {
|
|
4317
4333
|
max-width: none;
|
|
4318
4334
|
}
|
|
@@ -271,6 +271,14 @@
|
|
|
271
271
|
max-width: $gl-spacing-scale-15;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
@mixin gl-max-w-26 {
|
|
275
|
+
max-width: $gl-spacing-scale-26;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@mixin gl-max-w-62 {
|
|
279
|
+
max-width: $gl-spacing-scale-62;
|
|
280
|
+
}
|
|
281
|
+
|
|
274
282
|
@mixin gl-max-w-none {
|
|
275
283
|
max-width: none;
|
|
276
284
|
}
|