@gitlab/ui 32.43.3 → 32.44.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 +7 -0
- package/dist/components/base/avatar/avatar.documentation.js +2 -5
- package/dist/components/base/avatar_link/avatar_link.documentation.js +2 -5
- package/dist/components/base/form/form_input/form_input.documentation.js +2 -27
- package/dist/components/base/form/form_input/form_input.js +23 -6
- package/dist/components/base/form/form_text/form_text.documentation.js +1 -4
- package/dist/components/base/pagination/pagination.documentation.js +2 -85
- package/dist/components/base/pagination/pagination.js +76 -0
- package/dist/components/base/segmented_control/segmented_control.documentation.js +2 -14
- package/dist/components/base/segmented_control/segmented_control.js +6 -0
- package/documentation/documented_stories.js +5 -0
- package/package.json +11 -10
- package/src/components/base/alert/alert.spec.js +2 -2
- package/src/components/base/avatar/avatar.documentation.js +0 -2
- package/src/components/base/avatar/avatar.md +0 -2
- package/src/components/base/avatar/avatar.spec.js +1 -2
- package/src/components/base/avatar/avatar.stories.js +88 -101
- package/src/components/base/avatar_link/avatar_link.documentation.js +0 -2
- package/src/components/base/avatar_link/avatar_link.md +4 -7
- package/src/components/base/avatar_link/avatar_link.stories.js +66 -54
- package/src/components/base/filtered_search/filtered_search.spec.js +35 -35
- package/src/components/base/filtered_search/filtered_search_term.spec.js +1 -1
- package/src/components/base/form/form_input/form_input.documentation.js +0 -31
- package/src/components/base/form/form_input/form_input.md +0 -2
- package/src/components/base/form/form_input/form_input.stories.js +50 -42
- package/src/components/base/form/form_input/form_input.vue +23 -6
- package/src/components/base/form/form_input_group/form_input_group.spec.js +1 -3
- package/src/components/base/form/form_text/form_text.documentation.js +0 -2
- package/src/components/base/form/form_text/form_text.md +1 -3
- package/src/components/base/form/form_text/form_text.stories.js +20 -8
- package/src/components/base/icon/icon.spec.js +1 -4
- package/src/components/base/infinite_scroll/infinite_scroll.spec.js +1 -4
- package/src/components/base/modal/modal.spec.js +19 -23
- package/src/components/base/paginated_list/__snapshots__/paginated_list.spec.js.snap +10 -10
- package/src/components/base/pagination/pagination.documentation.js +0 -100
- package/src/components/base/pagination/pagination.md +5 -9
- package/src/components/base/pagination/pagination.spec.js +1 -4
- package/src/components/base/pagination/pagination.stories.js +109 -117
- package/src/components/base/pagination/pagination.vue +85 -0
- package/src/components/base/search_box_by_click/search_box_by_click.spec.js +1 -5
- package/src/components/base/segmented_control/segmented_control.documentation.js +0 -15
- package/src/components/base/segmented_control/segmented_control.md +0 -2
- package/src/components/base/segmented_control/segmented_control.stories.js +46 -36
- package/src/components/base/segmented_control/segmented_control.vue +5 -0
- package/src/components/base/sorting/sorting.spec.js +1 -4
- package/src/components/base/toast/toast.spec.js +4 -6
- package/src/components/base/token/token.spec.js +1 -4
- package/src/components/base/token_selector/token_container.spec.js +2 -3
- package/src/components/charts/gauge/gauge.spec.js +7 -7
- package/src/components/charts/sparkline/sparkline.spec.js +1 -4
- package/src/components/utilities/friendly_wrap/friendly_wrap.spec.js +1 -4
- package/src/components/utilities/intersperse/intersperse.spec.js +1 -4
- package/src/directives/hover_load/hover_load.spec.js +2 -13
- package/src/directives/outside/outside.spec.js +1 -6
- package/src/directives/resize_observer/resize_observer.spec.js +4 -10
- package/src/scss/storybook.scss +8 -0
- package/dist/components/base/avatar/examples/avatar.fallback.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.image.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.rect.example.js +0 -38
- package/dist/components/base/avatar/examples/avatar.tooltip.example.js +0 -38
- package/dist/components/base/avatar/examples/index.js +0 -31
- package/dist/components/base/avatar_link/examples/avatar.link.example.js +0 -38
- package/dist/components/base/avatar_link/examples/index.js +0 -13
- package/dist/components/base/form/form_input/examples/form_input/form_input.text.example.js +0 -38
- package/dist/components/base/form/form_input/examples/form_input/form_input.text_disabled.example.js +0 -38
- package/dist/components/base/form/form_input/examples/form_input/form_input.text_reactive.example.js +0 -57
- package/dist/components/base/form/form_input/examples/form_input/index.js +0 -22
- package/dist/components/base/form/form_text/examples/form_text.basic.example.js +0 -38
- package/dist/components/base/form/form_text/examples/index.js +0 -13
- package/dist/components/base/pagination/examples/index.js +0 -37
- package/dist/components/base/pagination/examples/pagination.basic.example.js +0 -45
- package/dist/components/base/pagination/examples/pagination.compact.example.js +0 -58
- package/dist/components/base/pagination/examples/pagination.double_truncation.example.js +0 -45
- package/dist/components/base/pagination/examples/pagination.event.example.js +0 -51
- package/dist/components/base/pagination/examples/pagination.links.example.js +0 -45
- package/dist/components/base/segmented_control/examples/index.js +0 -19
- package/dist/components/base/segmented_control/examples/segmented_control.basic.example.js +0 -65
- package/dist/components/base/segmented_control/examples/segmented_control.whitespace.example.js +0 -55
- package/src/components/base/avatar/examples/avatar.fallback.example.vue +0 -3
- package/src/components/base/avatar/examples/avatar.image.example.vue +0 -3
- package/src/components/base/avatar/examples/avatar.rect.example.vue +0 -6
- package/src/components/base/avatar/examples/avatar.tooltip.example.vue +0 -3
- package/src/components/base/avatar/examples/index.js +0 -36
- package/src/components/base/avatar_link/examples/avatar.link.example.vue +0 -5
- package/src/components/base/avatar_link/examples/index.js +0 -15
- package/src/components/base/form/form_input/examples/form_input/form_input.text.example.vue +0 -3
- package/src/components/base/form/form_input/examples/form_input/form_input.text_disabled.example.vue +0 -3
- package/src/components/base/form/form_input/examples/form_input/form_input.text_reactive.example.vue +0 -24
- package/src/components/base/form/form_input/examples/form_input/index.js +0 -26
- package/src/components/base/form/form_text/examples/form_text.basic.example.vue +0 -5
- package/src/components/base/form/form_text/examples/index.js +0 -15
- package/src/components/base/pagination/examples/index.js +0 -43
- package/src/components/base/pagination/examples/pagination.basic.example.vue +0 -17
- package/src/components/base/pagination/examples/pagination.compact.example.vue +0 -33
- package/src/components/base/pagination/examples/pagination.double_truncation.example.vue +0 -11
- package/src/components/base/pagination/examples/pagination.event.example.vue +0 -26
- package/src/components/base/pagination/examples/pagination.links.example.vue +0 -18
- package/src/components/base/segmented_control/examples/index.js +0 -22
- package/src/components/base/segmented_control/examples/segmented_control.basic.example.vue +0 -19
- package/src/components/base/segmented_control/examples/segmented_control.whitespace.example.vue +0 -18
|
@@ -1,41 +1,19 @@
|
|
|
1
|
-
import { withKnobs, number, text, boolean } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { alignOptions } from '../../../utils/constants';
|
|
4
2
|
import readme from './pagination.md';
|
|
5
3
|
import GlPagination from './pagination.vue';
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
prevText: {
|
|
14
|
-
default: text('Prev button text', 'Prev'),
|
|
15
|
-
},
|
|
16
|
-
nextText: {
|
|
17
|
-
default: text('Next button text', 'Next'),
|
|
18
|
-
},
|
|
19
|
-
disabled: {
|
|
20
|
-
default: boolean('Disabled', false),
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
}
|
|
5
|
+
const generateBaseProps = ({ prevText = 'Prev', nextText = 'Next', disabled = false } = {}) => ({
|
|
6
|
+
prevText,
|
|
7
|
+
nextText,
|
|
8
|
+
disabled,
|
|
9
|
+
});
|
|
24
10
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
default: number('per page', perPage),
|
|
32
|
-
},
|
|
33
|
-
totalItems: {
|
|
34
|
-
default: number('total items', totalItems),
|
|
35
|
-
},
|
|
36
|
-
...generateBaseProps(),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
11
|
+
const generateFullProps = ({ page = 3, perPage = 10, totalItems = 200 } = {}) => ({
|
|
12
|
+
initialPage: page,
|
|
13
|
+
perPage,
|
|
14
|
+
totalItems,
|
|
15
|
+
...generateBaseProps(),
|
|
16
|
+
});
|
|
39
17
|
|
|
40
18
|
const defaults = {
|
|
41
19
|
data() {
|
|
@@ -51,13 +29,10 @@ const defaults = {
|
|
|
51
29
|
},
|
|
52
30
|
};
|
|
53
31
|
|
|
54
|
-
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
...defaults,
|
|
59
|
-
components,
|
|
60
|
-
template: `<gl-pagination
|
|
32
|
+
export const Default = (args, { argTypes }) => ({
|
|
33
|
+
props: Object.keys(argTypes),
|
|
34
|
+
...defaults,
|
|
35
|
+
template: `<gl-pagination
|
|
61
36
|
v-model="page"
|
|
62
37
|
:per-page="perPage"
|
|
63
38
|
:total-items="totalItems"
|
|
@@ -65,84 +40,101 @@ documentedStoriesOf('base/pagination', readme)
|
|
|
65
40
|
:next-text="nextText"
|
|
66
41
|
:disabled="disabled"
|
|
67
42
|
/>`,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
43
|
+
});
|
|
44
|
+
Default.args = generateFullProps();
|
|
45
|
+
|
|
46
|
+
export const Compact = () => ({
|
|
47
|
+
...defaults,
|
|
48
|
+
props: generateFullProps(),
|
|
49
|
+
data() {
|
|
50
|
+
return {
|
|
51
|
+
page: 1,
|
|
52
|
+
alignOptions,
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
computed: {
|
|
56
|
+
prevPage() {
|
|
57
|
+
return Math.max(this.page - 1, 0);
|
|
76
58
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
prevPage() {
|
|
81
|
-
return Math.max(this.page - 1, 0);
|
|
82
|
-
},
|
|
83
|
-
nextPage() {
|
|
84
|
-
const nextPage = this.page + 1;
|
|
85
|
-
return nextPage > 3 ? 0 : nextPage;
|
|
86
|
-
},
|
|
59
|
+
nextPage() {
|
|
60
|
+
const nextPage = this.page + 1;
|
|
61
|
+
return nextPage > 3 ? 0 : nextPage;
|
|
87
62
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<gl-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
63
|
+
},
|
|
64
|
+
template: `
|
|
65
|
+
<div class="text-center gl-font-base">
|
|
66
|
+
<gl-pagination
|
|
67
|
+
v-model="page"
|
|
68
|
+
:prev-page="prevPage"
|
|
69
|
+
:next-page="nextPage"
|
|
70
|
+
:prev-text="prevText"
|
|
71
|
+
:next-text="nextText"
|
|
72
|
+
:disabled="disabled"
|
|
73
|
+
:align="alignOptions.center"
|
|
74
|
+
/>
|
|
75
|
+
Page {{ page }} of 3
|
|
76
|
+
</div>`,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const LinkBased = (args, { argTypes }) => ({
|
|
80
|
+
props: Object.keys(argTypes),
|
|
81
|
+
...defaults,
|
|
82
|
+
methods: {
|
|
83
|
+
linkGen(page) {
|
|
84
|
+
return `/page/${page}`;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
template: `<gl-pagination
|
|
88
|
+
v-model="page"
|
|
89
|
+
:per-page="perPage"
|
|
90
|
+
:total-items="totalItems"
|
|
91
|
+
:prev-text="prevText"
|
|
92
|
+
:next-text="nextText"
|
|
93
|
+
:disabled="disabled"
|
|
94
|
+
:link-gen="linkGen"
|
|
95
|
+
/>`,
|
|
96
|
+
});
|
|
97
|
+
LinkBased.args = generateFullProps();
|
|
98
|
+
|
|
99
|
+
export const AlignCenter = (args, { argTypes }) => ({
|
|
100
|
+
props: Object.keys(argTypes),
|
|
101
|
+
...defaults,
|
|
102
|
+
template: `<gl-pagination
|
|
103
|
+
v-model="page"
|
|
104
|
+
:per-page="perPage"
|
|
105
|
+
:total-items="totalItems"
|
|
106
|
+
:prev-text="prevText"
|
|
107
|
+
:next-text="nextText"
|
|
108
|
+
:disabled="disabled"
|
|
109
|
+
:align="alignOptions.center"
|
|
110
|
+
/>`,
|
|
111
|
+
});
|
|
112
|
+
AlignCenter.args = generateFullProps();
|
|
113
|
+
|
|
114
|
+
export const AlignRight = (args, { argTypes }) => ({
|
|
115
|
+
props: Object.keys(argTypes),
|
|
116
|
+
...defaults,
|
|
117
|
+
template: `<gl-pagination
|
|
118
|
+
v-model="page"
|
|
119
|
+
:per-page="perPage"
|
|
120
|
+
:total-items="totalItems"
|
|
121
|
+
:prev-text="prevText"
|
|
122
|
+
:next-text="nextText"
|
|
123
|
+
:disabled="disabled"
|
|
124
|
+
:align="alignOptions.right"
|
|
125
|
+
/>`,
|
|
126
|
+
});
|
|
127
|
+
AlignRight.args = generateFullProps();
|
|
128
|
+
|
|
129
|
+
export default {
|
|
130
|
+
title: 'base/pagination',
|
|
131
|
+
component: GlPagination,
|
|
132
|
+
parameters: {
|
|
133
|
+
knobs: { disable: true },
|
|
134
|
+
docs: {
|
|
135
|
+
description: {
|
|
136
|
+
component: readme,
|
|
109
137
|
},
|
|
110
138
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
:per-page="perPage"
|
|
114
|
-
:total-items="totalItems"
|
|
115
|
-
:prev-text="prevText"
|
|
116
|
-
:next-text="nextText"
|
|
117
|
-
:disabled="disabled"
|
|
118
|
-
:link-gen="linkGen"
|
|
119
|
-
/>`,
|
|
120
|
-
}))
|
|
121
|
-
.add('align center', () => ({
|
|
122
|
-
props: generateFullProps(),
|
|
123
|
-
...defaults,
|
|
124
|
-
components,
|
|
125
|
-
template: `<gl-pagination
|
|
126
|
-
v-model="page"
|
|
127
|
-
:per-page="perPage"
|
|
128
|
-
:total-items="totalItems"
|
|
129
|
-
:prev-text="prevText"
|
|
130
|
-
:next-text="nextText"
|
|
131
|
-
:disabled="disabled"
|
|
132
|
-
:align="alignOptions.center"
|
|
133
|
-
/>`,
|
|
134
|
-
}))
|
|
135
|
-
.add('align right', () => ({
|
|
136
|
-
props: generateFullProps(),
|
|
137
|
-
...defaults,
|
|
138
|
-
components,
|
|
139
|
-
template: `<gl-pagination
|
|
140
|
-
v-model="page"
|
|
141
|
-
:per-page="perPage"
|
|
142
|
-
:total-items="totalItems"
|
|
143
|
-
:prev-text="prevText"
|
|
144
|
-
:next-text="nextText"
|
|
145
|
-
:disabled="disabled"
|
|
146
|
-
:align="alignOptions.right"
|
|
147
|
-
/>`,
|
|
148
|
-
}));
|
|
139
|
+
},
|
|
140
|
+
};
|
|
@@ -26,17 +26,26 @@ export default {
|
|
|
26
26
|
default: 1,
|
|
27
27
|
validator: (x) => x > 0,
|
|
28
28
|
},
|
|
29
|
+
/**
|
|
30
|
+
* Number of items per page
|
|
31
|
+
*/
|
|
29
32
|
perPage: {
|
|
30
33
|
type: Number,
|
|
31
34
|
required: false,
|
|
32
35
|
default: 20,
|
|
33
36
|
validator: (x) => x > 0,
|
|
34
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Total number of items
|
|
40
|
+
*/
|
|
35
41
|
totalItems: {
|
|
36
42
|
type: Number,
|
|
37
43
|
required: false,
|
|
38
44
|
default: 0,
|
|
39
45
|
},
|
|
46
|
+
/**
|
|
47
|
+
* The object must contain the xs, sm, md and default keys
|
|
48
|
+
*/
|
|
40
49
|
limits: {
|
|
41
50
|
type: Object,
|
|
42
51
|
required: false,
|
|
@@ -51,61 +60,97 @@ export default {
|
|
|
51
60
|
return missingSizes === 0 ? true : value.default;
|
|
52
61
|
},
|
|
53
62
|
},
|
|
63
|
+
/**
|
|
64
|
+
* A function that receives the page number and that returns a string representing the page URL
|
|
65
|
+
*/
|
|
54
66
|
linkGen: {
|
|
55
67
|
type: Function,
|
|
56
68
|
required: false,
|
|
57
69
|
default: null,
|
|
58
70
|
},
|
|
71
|
+
/**
|
|
72
|
+
* When using the compact pagination, use this prop to pass the previous page number
|
|
73
|
+
*/
|
|
59
74
|
prevPage: {
|
|
60
75
|
type: Number,
|
|
61
76
|
required: false,
|
|
62
77
|
default: null,
|
|
63
78
|
},
|
|
79
|
+
/**
|
|
80
|
+
* Text for the previous button (overridden by "previous" slot)
|
|
81
|
+
*/
|
|
64
82
|
prevText: {
|
|
65
83
|
type: String,
|
|
66
84
|
required: false,
|
|
67
85
|
default: 'Prev',
|
|
68
86
|
},
|
|
87
|
+
/**
|
|
88
|
+
* When using the compact pagination, use this prop to pass the next page number
|
|
89
|
+
*/
|
|
69
90
|
nextPage: {
|
|
70
91
|
type: Number,
|
|
71
92
|
required: false,
|
|
72
93
|
default: null,
|
|
73
94
|
},
|
|
95
|
+
/**
|
|
96
|
+
* Text for the next button (overridden by "next" slot)
|
|
97
|
+
*/
|
|
74
98
|
nextText: {
|
|
75
99
|
type: String,
|
|
76
100
|
required: false,
|
|
77
101
|
default: 'Next',
|
|
78
102
|
},
|
|
103
|
+
/**
|
|
104
|
+
* Text for the ellipsis (overridden by "ellipsis-left" and "ellipsis-right" slots)
|
|
105
|
+
*/
|
|
79
106
|
ellipsisText: {
|
|
80
107
|
type: String,
|
|
81
108
|
required: false,
|
|
82
109
|
default: '…',
|
|
83
110
|
},
|
|
111
|
+
/**
|
|
112
|
+
* aria-label for the first page item
|
|
113
|
+
*/
|
|
84
114
|
labelFirstPage: {
|
|
85
115
|
type: String,
|
|
86
116
|
required: false,
|
|
87
117
|
default: 'Go to first page',
|
|
88
118
|
},
|
|
119
|
+
/**
|
|
120
|
+
* aria-label for the previous page item
|
|
121
|
+
*/
|
|
89
122
|
labelPrevPage: {
|
|
90
123
|
type: String,
|
|
91
124
|
required: false,
|
|
92
125
|
default: 'Go to previous page',
|
|
93
126
|
},
|
|
127
|
+
/**
|
|
128
|
+
* aria-label for the next page item
|
|
129
|
+
*/
|
|
94
130
|
labelNextPage: {
|
|
95
131
|
type: String,
|
|
96
132
|
required: false,
|
|
97
133
|
default: 'Go to next page',
|
|
98
134
|
},
|
|
135
|
+
/**
|
|
136
|
+
* aria-label for the last page item
|
|
137
|
+
*/
|
|
99
138
|
labelLastPage: {
|
|
100
139
|
type: String,
|
|
101
140
|
required: false,
|
|
102
141
|
default: 'Go to last page',
|
|
103
142
|
},
|
|
143
|
+
/**
|
|
144
|
+
* aria-label getter for numbered page items, defaults to "Go to page <page_number>"
|
|
145
|
+
*/
|
|
104
146
|
labelPage: {
|
|
105
147
|
type: Function,
|
|
106
148
|
required: false,
|
|
107
149
|
default: (page) => `Go to page ${page}`,
|
|
108
150
|
},
|
|
151
|
+
/**
|
|
152
|
+
* Controls the component\'s horizontal alignment, value should be one of "left", "center", "right" or "fill"
|
|
153
|
+
*/
|
|
109
154
|
align: {
|
|
110
155
|
type: String,
|
|
111
156
|
required: false,
|
|
@@ -281,15 +326,28 @@ export default {
|
|
|
281
326
|
handleClick(event, value) {
|
|
282
327
|
if (!this.isLinkBased) {
|
|
283
328
|
event.preventDefault();
|
|
329
|
+
/**
|
|
330
|
+
* Emitted when the page changes
|
|
331
|
+
* @event input
|
|
332
|
+
* @arg {number} value The page that just got loaded
|
|
333
|
+
*/
|
|
284
334
|
this.$emit('input', value);
|
|
285
335
|
}
|
|
286
336
|
},
|
|
287
337
|
handlePrevious(event, value) {
|
|
288
338
|
this.handleClick(event, value);
|
|
339
|
+
/**
|
|
340
|
+
* Emitted when the "previous" button is clicked
|
|
341
|
+
* @event previous
|
|
342
|
+
*/
|
|
289
343
|
this.$emit('previous');
|
|
290
344
|
},
|
|
291
345
|
handleNext(event, value) {
|
|
292
346
|
this.handleClick(event, value);
|
|
347
|
+
/**
|
|
348
|
+
* Emitted when the "next" button is clicked
|
|
349
|
+
* @event next
|
|
350
|
+
*/
|
|
293
351
|
this.$emit('next');
|
|
294
352
|
},
|
|
295
353
|
},
|
|
@@ -319,6 +377,12 @@ export default {
|
|
|
319
377
|
:href="isLinkBased ? linkGen(value - 1) : '#'"
|
|
320
378
|
@click="handlePrevious($event, value - 1)"
|
|
321
379
|
>
|
|
380
|
+
<!--
|
|
381
|
+
@slot Content for the "previous" button. Overrides the "prevText" prop.
|
|
382
|
+
@binding {boolean} active
|
|
383
|
+
@binding {boolean} disabled
|
|
384
|
+
@binding {number} number
|
|
385
|
+
-->
|
|
322
386
|
<slot name="previous" v-bind="{ page: value - 1, disabled: prevPageIsDisabled }">
|
|
323
387
|
<gl-icon name="chevron-left" />
|
|
324
388
|
<span>{{ prevText }}</span>
|
|
@@ -342,6 +406,21 @@ export default {
|
|
|
342
406
|
v-bind="item.attrs"
|
|
343
407
|
v-on="item.listeners"
|
|
344
408
|
>
|
|
409
|
+
<!--
|
|
410
|
+
Content for page number buttons.
|
|
411
|
+
@slot page-number
|
|
412
|
+
@binding {boolean} active
|
|
413
|
+
@binding {boolean} disabled
|
|
414
|
+
@binding {number} number
|
|
415
|
+
-->
|
|
416
|
+
<!--
|
|
417
|
+
Content for the left ellipsis. Overrides the "ellipsisText" prop.
|
|
418
|
+
@slot ellipsis-left
|
|
419
|
+
-->
|
|
420
|
+
<!--
|
|
421
|
+
Content for the right ellipsis. Overrides the "ellipsisText" prop.
|
|
422
|
+
@slot ellipsis-right
|
|
423
|
+
-->
|
|
345
424
|
<slot :name="item.slot" v-bind="item.slotData">{{ item.content }}</slot>
|
|
346
425
|
</component>
|
|
347
426
|
</li>
|
|
@@ -361,6 +440,12 @@ export default {
|
|
|
361
440
|
:href="isLinkBased ? linkGen(value + 1) : '#'"
|
|
362
441
|
@click="handleNext($event, value + 1)"
|
|
363
442
|
>
|
|
443
|
+
<!--
|
|
444
|
+
@slot Content for the "next" button. Overrides the "nextText" prop.
|
|
445
|
+
@binding {boolean} active
|
|
446
|
+
@binding {boolean} disabled
|
|
447
|
+
@binding {number} number
|
|
448
|
+
-->
|
|
364
449
|
<slot name="next" v-bind="{ page: value + 1, disabled: nextPageIsDisabled }">
|
|
365
450
|
<span>{{ nextText }}</span>
|
|
366
451
|
<gl-icon name="chevron-right" />
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { shallowMount
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import GlDropdownItem from '../dropdown/dropdown_item.vue';
|
|
3
3
|
import GlFormInput from '../form/form_input/form_input.vue';
|
|
4
4
|
import SearchBoxByClick from './search_box_by_click.vue';
|
|
5
5
|
import ClearIcon from '~/components/shared_components/clear_icon_button/clear_icon_button.vue';
|
|
6
6
|
|
|
7
|
-
const localVue = createLocalVue();
|
|
8
|
-
localVue.directive('gl-tooltip', {});
|
|
9
|
-
|
|
10
7
|
const GlFormInputGroupStub = {
|
|
11
8
|
template: `
|
|
12
9
|
<div>
|
|
@@ -24,7 +21,6 @@ describe('search box by click component', () => {
|
|
|
24
21
|
wrapper = shallowMount(SearchBoxByClick, {
|
|
25
22
|
propsData,
|
|
26
23
|
stubs: { GlFormInputGroup: GlFormInputGroupStub },
|
|
27
|
-
localVue,
|
|
28
24
|
});
|
|
29
25
|
};
|
|
30
26
|
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './segmented_control.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
followsDesignSystem: false,
|
|
6
5
|
description,
|
|
7
|
-
examples,
|
|
8
|
-
bootstrapComponent: 'b-form-radio-group',
|
|
9
|
-
events: [
|
|
10
|
-
{
|
|
11
|
-
event: 'input',
|
|
12
|
-
description: 'Emitted when the selection changes',
|
|
13
|
-
args: [
|
|
14
|
-
{
|
|
15
|
-
arg: 'checked',
|
|
16
|
-
description: 'The selected option',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
6
|
};
|
|
@@ -1,52 +1,62 @@
|
|
|
1
|
-
import { withKnobs, object, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { GlSegmentedControl } from '../../../../index';
|
|
4
2
|
import readme from './segmented_control.md';
|
|
5
3
|
|
|
6
|
-
const components = {
|
|
7
|
-
GlSegmentedControl,
|
|
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: object('options', options),
|
|
21
|
-
},
|
|
22
|
-
initSelected: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: text('selected value', 'Tacos'),
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return props;
|
|
29
|
-
}
|
|
10
|
+
const generateProps = ({ options = defaultOptions, initSelected = 'Tacos' } = {}) => ({
|
|
11
|
+
options,
|
|
12
|
+
initSelected,
|
|
13
|
+
});
|
|
30
14
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.selected = val;
|
|
43
|
-
},
|
|
15
|
+
export const Default = (args, { argTypes }) => ({
|
|
16
|
+
components: { GlSegmentedControl },
|
|
17
|
+
props: Object.keys(argTypes),
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
selected: this.initSelected,
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
watch: {
|
|
24
|
+
initSelected(val) {
|
|
25
|
+
this.selected = val;
|
|
44
26
|
},
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
},
|
|
28
|
+
template: `
|
|
47
29
|
<gl-segmented-control
|
|
48
30
|
:options="options"
|
|
49
31
|
v-model="selected"
|
|
50
32
|
/>
|
|
51
33
|
`,
|
|
52
|
-
|
|
34
|
+
});
|
|
35
|
+
Default.args = generateProps();
|
|
36
|
+
|
|
37
|
+
export default {
|
|
38
|
+
title: 'base/segmented control',
|
|
39
|
+
component: GlSegmentedControl,
|
|
40
|
+
parameters: {
|
|
41
|
+
bootstrapComponent: 'b-form-radio-group',
|
|
42
|
+
knobs: { disable: true },
|
|
43
|
+
docs: {
|
|
44
|
+
description: {
|
|
45
|
+
component: readme,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
argTypes: {
|
|
50
|
+
initSelected: {
|
|
51
|
+
options: Object.values(defaultOptions)
|
|
52
|
+
.filter(({ disabled }) => !disabled)
|
|
53
|
+
.map(({ value }) => value),
|
|
54
|
+
control: {
|
|
55
|
+
type: 'radio',
|
|
56
|
+
},
|
|
57
|
+
table: {
|
|
58
|
+
disable: true,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -50,6 +50,11 @@ export default {
|
|
|
50
50
|
if (this.enabledOptions.length) {
|
|
51
51
|
const suggestion =
|
|
52
52
|
oldValue && this.isValidValue(oldValue) ? oldValue : this.enabledOptions[0].value;
|
|
53
|
+
/**
|
|
54
|
+
* Emitted when the selection changes
|
|
55
|
+
* @event input
|
|
56
|
+
* @argument checked The selected option
|
|
57
|
+
*/
|
|
53
58
|
this.$emit('input', suggestion);
|
|
54
59
|
}
|
|
55
60
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { mount
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
2
|
import GlDropdown from '../dropdown/dropdown.vue';
|
|
3
3
|
import GlDropdownItem from '../dropdown/dropdown_item.vue';
|
|
4
4
|
import GlIcon from '../icon/icon.vue';
|
|
5
5
|
import GlSorting from './sorting.vue';
|
|
6
6
|
import GlSortingItem from './sorting_item.vue';
|
|
7
7
|
|
|
8
|
-
const localVue = createLocalVue();
|
|
9
|
-
|
|
10
8
|
describe('sorting component', () => {
|
|
11
9
|
let wrapper;
|
|
12
10
|
|
|
@@ -35,7 +33,6 @@ describe('sorting component', () => {
|
|
|
35
33
|
'<gl-sorting-item>Third item</gl-sorting-item>',
|
|
36
34
|
],
|
|
37
35
|
},
|
|
38
|
-
localVue,
|
|
39
36
|
propsData: {
|
|
40
37
|
...defaultProps,
|
|
41
38
|
...propsData,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
2
3
|
import GlToast from './toast';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
localVue.use(GlToast);
|
|
5
|
+
Vue.use(GlToast);
|
|
6
6
|
const Component = {
|
|
7
7
|
template: `<div />`,
|
|
8
8
|
};
|
|
@@ -11,9 +11,7 @@ describe('GlToast', () => {
|
|
|
11
11
|
let wrapper;
|
|
12
12
|
|
|
13
13
|
beforeEach(() => {
|
|
14
|
-
wrapper = mount(Component
|
|
15
|
-
localVue,
|
|
16
|
-
});
|
|
14
|
+
wrapper = mount(Component);
|
|
17
15
|
});
|
|
18
16
|
|
|
19
17
|
it('attaches $toast propery', () => {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { shallowMount
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
2
|
import CloseButton from '../../shared_components/close_button/close_button.vue';
|
|
3
3
|
import Token from './token.vue';
|
|
4
4
|
|
|
5
|
-
const localVue = createLocalVue();
|
|
6
|
-
|
|
7
5
|
const findIcon = (wrapper) => wrapper.findComponent(CloseButton);
|
|
8
6
|
|
|
9
7
|
describe('Token component', () => {
|
|
@@ -13,7 +11,6 @@ describe('Token component', () => {
|
|
|
13
11
|
|
|
14
12
|
const createComponent = (propsData) =>
|
|
15
13
|
shallowMount(Token, {
|
|
16
|
-
localVue,
|
|
17
14
|
propsData,
|
|
18
15
|
});
|
|
19
16
|
|