@gitlab/ui 34.0.0 → 36.1.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 +45 -0
- package/dist/components/base/filtered_search/filtered_search.documentation.js +6 -0
- package/dist/components/base/filtered_search/filtered_search.js +12 -2
- package/dist/components/base/filtered_search/filtered_search_term.documentation.js +6 -0
- package/dist/components/base/filtered_search/filtered_search_term.js +11 -1
- package/dist/components/base/filtered_search/filtered_search_token_segment.documentation.js +6 -0
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +11 -1
- package/dist/components/base/nav/nav.documentation.js +2 -7
- package/dist/components/base/search_box_by_click/search_box_by_click.documentation.js +3 -0
- package/dist/components/base/search_box_by_click/search_box_by_click.js +6 -1
- package/dist/components/base/tabs/tabs/tabs.documentation.js +1 -1
- package/dist/components/base/tabs/tabs/tabs.js +2 -12
- package/dist/components/utilities/truncate/truncate.documentation.js +2 -17
- package/dist/components/utilities/truncate/truncate.js +11 -0
- 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/documentation/all_components.js +2 -2
- package/documentation/components_documentation.js +0 -2
- package/documentation/documented_stories.js +4 -0
- package/package.json +7 -10
- package/src/charts.js +19 -0
- package/src/components/base/alert/alert.stories.js +1 -1
- package/src/components/base/avatar/avatar.stories.js +8 -0
- package/src/components/base/avatar_labeled/avatar_labeled.stories.js +7 -0
- package/src/components/base/avatar_link/avatar_link.stories.js +7 -0
- package/src/components/base/avatars_inline/avatars_inline.stories.js +1 -1
- package/src/components/base/badge/badge.stories.js +115 -10
- package/src/components/base/banner/banner.stories.js +1 -1
- package/src/components/base/breadcrumb/breadcrumb.stories.js +1 -1
- package/src/components/base/broadcast_message/broadcast_message.stories.js +3 -3
- package/src/components/base/button/button.stories.js +11 -11
- package/src/components/base/button_group/button_group.stories.js +1 -1
- package/src/components/base/collapse/collapse.stories.js +1 -1
- package/src/components/base/drawer/drawer.stories.js +1 -1
- package/src/components/base/dropdown/dropdown.stories.js +5 -3
- package/src/components/base/dropdown/dropdown_divider.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_form.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_item.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_section_header.stories.js +1 -1
- package/src/components/base/dropdown/dropdown_text.stories.js +1 -1
- package/src/components/base/filtered_search/filtered_search.documentation.js +6 -0
- package/src/components/base/filtered_search/filtered_search.spec.js +81 -47
- package/src/components/base/filtered_search/filtered_search.stories.js +11 -1
- package/src/components/base/filtered_search/filtered_search.vue +13 -0
- package/src/components/base/filtered_search/filtered_search_suggestion.stories.js +2 -0
- package/src/components/base/filtered_search/filtered_search_suggestion_list.stories.js +2 -0
- package/src/components/base/filtered_search/filtered_search_term.documentation.js +6 -0
- package/src/components/base/filtered_search/filtered_search_term.spec.js +42 -9
- package/src/components/base/filtered_search/filtered_search_term.vue +13 -0
- package/src/components/base/filtered_search/filtered_search_token.stories.js +2 -0
- package/src/components/base/filtered_search/filtered_search_token_segment.documentation.js +6 -0
- package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +53 -0
- package/src/components/base/filtered_search/filtered_search_token_segment.stories.js +2 -0
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +12 -0
- package/src/components/base/form/form.stories.js +1 -1
- package/src/components/base/form/form_checkbox/form_checkbox.stories.js +1 -1
- package/src/components/base/form/form_group/form_group.stories.js +6 -5
- package/src/components/base/form/form_input/form_input.stories.js +1 -1
- package/src/components/base/form/form_input_group/form_input_group.stories.js +1 -1
- package/src/components/base/form/form_radio/form_radio.stories.js +1 -1
- package/src/components/base/form/form_radio_group/form_radio_group.stories.js +2 -1
- package/src/components/base/form/form_select/form_select.stories.js +1 -1
- package/src/components/base/form/form_text/form_text.vue +3 -1
- package/src/components/base/form/form_textarea/form_textarea.stories.js +1 -1
- package/src/components/base/icon/icon.stories.js +1 -1
- package/src/components/base/infinite_scroll/infinite_scroll.stories.js +1 -1
- package/src/components/base/label/label.stories.js +1 -1
- package/src/components/base/link/link.stories.js +1 -1
- package/src/components/base/loading_icon/loading_icon.stories.js +2 -1
- package/src/components/base/modal/modal.scss +5 -2
- package/src/components/base/modal/modal.stories.js +1 -1
- package/src/components/base/nav/nav.documentation.js +0 -4
- package/src/components/base/nav/nav.md +8 -5
- package/src/components/base/nav/nav.stories.js +52 -15
- package/src/components/base/navbar/navbar.stories.js +1 -1
- package/src/components/base/paginated_list/paginated_list.stories.js +1 -1
- package/src/components/base/pagination/pagination.stories.js +7 -0
- package/src/components/base/path/path.stories.js +2 -2
- package/src/components/base/popover/popover.stories.js +6 -0
- package/src/components/base/progress_bar/progress_bar.stories.js +1 -1
- package/src/components/base/search_box_by_click/search_box_by_click.documentation.js +3 -0
- package/src/components/base/search_box_by_click/search_box_by_click.spec.js +14 -3
- package/src/components/base/search_box_by_click/search_box_by_click.stories.js +1 -1
- package/src/components/base/search_box_by_click/search_box_by_click.vue +7 -0
- package/src/components/base/search_box_by_type/search_box_by_type.stories.js +1 -1
- package/src/components/base/segmented_control/segmented_control.stories.js +1 -1
- package/src/components/base/skeleton_loader/skeleton_loader.stories.js +1 -1
- package/src/components/base/skeleton_loading/skeleton_loading.stories.js +1 -1
- package/src/components/base/sorting/sorting.stories.js +1 -1
- package/src/components/base/sorting/sorting_item.stories.js +1 -1
- package/src/components/base/table/table.stories.js +6 -1
- package/src/components/base/tabs/tabs/scrollable_tabs.spec.js +0 -1
- package/src/components/base/tabs/tabs/tabs.md +2 -2
- package/src/components/base/tabs/tabs/tabs.scss +3 -115
- package/src/components/base/tabs/tabs/tabs.spec.js +8 -5
- package/src/components/base/tabs/tabs/tabs.stories.js +9 -13
- package/src/components/base/tabs/tabs/tabs.vue +2 -11
- package/src/components/base/toast/toast.stories.js +6 -4
- package/src/components/base/toggle/toggle.stories.js +1 -1
- package/src/components/base/token/token.stories.js +2 -2
- package/src/components/base/tooltip/tooltip.stories.js +2 -1
- package/src/components/charts/area/area.stories.js +1 -1
- package/src/components/charts/bar/bar.stories.js +1 -1
- package/src/components/charts/chart/chart.stories.js +2 -2
- package/src/components/charts/column/column.stories.js +1 -1
- package/src/components/charts/discrete_scatter/discrete_scatter.stories.js +1 -1
- package/src/components/charts/heatmap/heatmap.stories.js +1 -1
- package/src/components/charts/legend/legend.stories.js +1 -1
- package/src/components/charts/line/line.stories.js +1 -1
- package/src/components/charts/series_label/series_label.stories.js +1 -1
- package/src/components/charts/single_stat/single_stat.stories.js +1 -1
- package/src/components/charts/sparkline/sparkline.stories.js +1 -1
- package/src/components/charts/stacked_column/stacked_column.stories.js +1 -1
- package/src/components/charts/tooltip/tooltip.stories.js +1 -1
- package/src/components/regions/dashboard_skeleton/dashboard_skeleton.stories.js +1 -1
- package/src/components/regions/empty_state/empty_state.stories.js +1 -1
- package/src/components/utilities/friendly_wrap/friendly_wrap.stories.js +1 -1
- package/src/components/utilities/intersection_observer/intersection_observer.stories.js +1 -1
- package/src/components/utilities/intersperse/intersperse.stories.js +1 -1
- package/src/components/utilities/sprintf/sprintf.stories.js +1 -1
- package/src/components/utilities/truncate/truncate.documentation.js +0 -14
- package/src/components/utilities/truncate/truncate.md +0 -4
- package/src/components/utilities/truncate/truncate.stories.js +38 -27
- package/src/components/utilities/truncate/truncate.vue +9 -0
- package/{config.js → src/config.js} +1 -1
- package/src/directives/hover_load/hover_load.stories.js +1 -1
- package/src/directives/outside/outside.stories.js +1 -1
- package/src/directives/resize_observer/resize_observer.stories.js +1 -1
- package/src/directives/safe_html/safe_html.stories.js +1 -1
- package/src/index.js +111 -0
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/box-shadow.scss +4 -0
- package/{utils.js → src/utils.js} +1 -1
- package/charts.js +0 -19
- package/dist/components/base/nav/examples/index.js +0 -13
- package/dist/components/base/nav/examples/nav.basic.example.js +0 -38
- package/dist/components/base/nav/nav_item.documentation.js +0 -13
- package/dist/components/base/nav/nav_item_dropdown.documentation.js +0 -14
- package/dist/components/utilities/truncate/examples/index.js +0 -13
- package/dist/components/utilities/truncate/examples/truncate.basic.example.js +0 -38
- package/index.js +0 -111
- package/src/components/base/nav/examples/index.js +0 -15
- package/src/components/base/nav/examples/nav.basic.example.vue +0 -8
- package/src/components/base/nav/nav_item.documentation.js +0 -6
- package/src/components/base/nav/nav_item.md +0 -7
- package/src/components/base/nav/nav_item.stories.js +0 -23
- package/src/components/base/nav/nav_item_dropdown.documentation.js +0 -7
- package/src/components/base/nav/nav_item_dropdown.md +0 -7
- package/src/components/base/nav/nav_item_dropdown.stories.js +0 -51
- package/src/components/utilities/truncate/examples/index.js +0 -15
- package/src/components/utilities/truncate/examples/truncate.basic.example.vue +0 -5
|
@@ -6,6 +6,8 @@ const OPTIONS = [{ value: '=' }, { value: '!=' }];
|
|
|
6
6
|
describe('Filtered search token segment', () => {
|
|
7
7
|
let wrapper;
|
|
8
8
|
|
|
9
|
+
const searchInputAttributes = { 'data-qa-selector': 'foo-bar' };
|
|
10
|
+
|
|
9
11
|
beforeAll(() => {
|
|
10
12
|
if (!HTMLElement.prototype.scrollIntoView) {
|
|
11
13
|
HTMLElement.prototype.scrollIntoView = jest.fn();
|
|
@@ -251,4 +253,55 @@ describe('Filtered search token segment', () => {
|
|
|
251
253
|
});
|
|
252
254
|
});
|
|
253
255
|
});
|
|
256
|
+
|
|
257
|
+
describe('when input is active', () => {
|
|
258
|
+
it('adds `searchInputAttributes` prop to search token segment input', () => {
|
|
259
|
+
createComponent({ active: true, value: 'something', searchInputAttributes });
|
|
260
|
+
|
|
261
|
+
expect(wrapper.find('input').attributes('data-qa-selector')).toBe(
|
|
262
|
+
searchInputAttributes['data-qa-selector']
|
|
263
|
+
);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it('does not add `searchInputAttributes` prop to search token segment', () => {
|
|
267
|
+
createComponent({
|
|
268
|
+
active: true,
|
|
269
|
+
value: 'something',
|
|
270
|
+
searchInputAttributes,
|
|
271
|
+
isLastToken: true,
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
expect(wrapper.attributes('data-qa-selector')).toBe(undefined);
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
describe('when input is not active', () => {
|
|
279
|
+
describe('when `isLastToken` prop is `true`', () => {
|
|
280
|
+
it('adds `searchInputAttributes` prop to search token segment', () => {
|
|
281
|
+
createComponent({
|
|
282
|
+
active: false,
|
|
283
|
+
value: 'something',
|
|
284
|
+
searchInputAttributes,
|
|
285
|
+
isLastToken: true,
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
expect(wrapper.attributes('data-qa-selector')).toBe(
|
|
289
|
+
searchInputAttributes['data-qa-selector']
|
|
290
|
+
);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
describe('when `isLastToken` prop is `false`', () => {
|
|
295
|
+
it('does not add `searchInputAttributes` prop to search token segment', () => {
|
|
296
|
+
createComponent({
|
|
297
|
+
active: false,
|
|
298
|
+
value: 'something',
|
|
299
|
+
searchInputAttributes,
|
|
300
|
+
isLastToken: false,
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
expect(wrapper.attributes('data-qa-selector')).toBe(undefined);
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
});
|
|
254
307
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { withKnobs, boolean } from '@storybook/addon-knobs';
|
|
2
2
|
import PortalVue from 'portal-vue';
|
|
3
3
|
import Vue from 'vue';
|
|
4
|
+
import { GlFilteredSearchSuggestion } from '../../../index';
|
|
4
5
|
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
5
6
|
import { provide } from './common_story_options';
|
|
6
7
|
import readme from './filtered_search_term.md';
|
|
@@ -18,6 +19,7 @@ documentedStoriesOf('base/filtered-search/token-segment', readme)
|
|
|
18
19
|
.add('default', () => ({
|
|
19
20
|
components: {
|
|
20
21
|
GlFilteredSearchTokenSegment,
|
|
22
|
+
GlFilteredSearchSuggestion,
|
|
21
23
|
},
|
|
22
24
|
provide,
|
|
23
25
|
props: {
|
|
@@ -49,6 +49,16 @@ export default {
|
|
|
49
49
|
required: true,
|
|
50
50
|
validator: () => true,
|
|
51
51
|
},
|
|
52
|
+
searchInputAttributes: {
|
|
53
|
+
type: Object,
|
|
54
|
+
required: false,
|
|
55
|
+
default: () => ({}),
|
|
56
|
+
},
|
|
57
|
+
isLastToken: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
52
62
|
},
|
|
53
63
|
|
|
54
64
|
data() {
|
|
@@ -244,6 +254,7 @@ export default {
|
|
|
244
254
|
|
|
245
255
|
<template>
|
|
246
256
|
<div
|
|
257
|
+
v-bind="isLastToken && !active && searchInputAttributes"
|
|
247
258
|
class="gl-filtered-search-token-segment"
|
|
248
259
|
:class="{ 'gl-filtered-search-token-segment-active': active }"
|
|
249
260
|
data-testid="filtered-search-token-segment"
|
|
@@ -252,6 +263,7 @@ export default {
|
|
|
252
263
|
<template v-if="active">
|
|
253
264
|
<input
|
|
254
265
|
ref="input"
|
|
266
|
+
v-bind="searchInputAttributes"
|
|
255
267
|
v-model="inputValue"
|
|
256
268
|
class="gl-filtered-search-token-segment-input"
|
|
257
269
|
:aria-label="label"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withKnobs, text, select, boolean } from '@storybook/addon-knobs';
|
|
2
2
|
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
|
-
import { GlFormGroup } from '
|
|
3
|
+
import { GlFormGroup, GlFormInput, GlFormTextarea } from '../../../../index';
|
|
4
4
|
import { sizeOptions } from '../../../../utils/constants';
|
|
5
5
|
import readme from './form_group.md';
|
|
6
6
|
|
|
@@ -57,7 +57,7 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
57
57
|
.addDecorator(withKnobs)
|
|
58
58
|
.add('default', () => ({
|
|
59
59
|
props: generateProps(),
|
|
60
|
-
components,
|
|
60
|
+
components: { ...components, GlFormInput },
|
|
61
61
|
template: `
|
|
62
62
|
<gl-form-group
|
|
63
63
|
:id="id"
|
|
@@ -75,7 +75,7 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
75
75
|
}))
|
|
76
76
|
.add('disabled', () => ({
|
|
77
77
|
props: generateProps(),
|
|
78
|
-
components,
|
|
78
|
+
components: { ...components, GlFormInput },
|
|
79
79
|
template: `
|
|
80
80
|
<gl-form-group
|
|
81
81
|
id="group-id"
|
|
@@ -91,6 +91,7 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
91
91
|
`,
|
|
92
92
|
}))
|
|
93
93
|
.add('with textarea', () => ({
|
|
94
|
+
components: { ...components, GlFormTextarea },
|
|
94
95
|
props: generateProps({ optional: true }),
|
|
95
96
|
template: `
|
|
96
97
|
<gl-form-group
|
|
@@ -106,7 +107,7 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
106
107
|
}))
|
|
107
108
|
.add('with label description', () => ({
|
|
108
109
|
props: generateProps({ optional: true }),
|
|
109
|
-
components,
|
|
110
|
+
components: { ...components, GlFormInput },
|
|
110
111
|
template: `
|
|
111
112
|
<gl-form-group
|
|
112
113
|
:id="id"
|
|
@@ -125,7 +126,7 @@ documentedStoriesOf('base/form/form-group', readme)
|
|
|
125
126
|
}))
|
|
126
127
|
.add('with validations', () => ({
|
|
127
128
|
props: generateProps({ label: 'Name', description: 'Enter a first and last name.' }),
|
|
128
|
-
components,
|
|
129
|
+
components: { ...components, GlFormInput },
|
|
129
130
|
computed: {
|
|
130
131
|
state() {
|
|
131
132
|
return this.name.length >= 4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withKnobs, boolean, object, text } from '@storybook/addon-knobs';
|
|
2
2
|
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
|
-
import { GlFormInputGroup, GlInputGroupText } from '
|
|
3
|
+
import { GlFormInputGroup, GlInputGroupText } from '../../../../index';
|
|
4
4
|
import readme from './form_input_group.md';
|
|
5
5
|
|
|
6
6
|
const components = {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { withKnobs, object, text } from '@storybook/addon-knobs';
|
|
2
2
|
import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
|
|
3
|
-
import { GlFormRadioGroup } from '
|
|
3
|
+
import { GlFormRadioGroup, GlFormRadio } from '../../../../index';
|
|
4
4
|
import readme from './form_radio_group.md';
|
|
5
5
|
|
|
6
6
|
const components = {
|
|
7
7
|
GlFormRadioGroup,
|
|
8
|
+
GlFormRadio,
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
const defaultOptions = [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlFormSelect } from '
|
|
1
|
+
import { GlFormSelect } from '../../../../index';
|
|
2
2
|
import { sizeOptions, formStateOptions } from '../../../../utils/constants';
|
|
3
3
|
import { formSelectOptions } from './constants';
|
|
4
4
|
import readme from './form_select.md';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlLoadingIcon } from '
|
|
1
|
+
import { GlLoadingIcon } from '../../../index';
|
|
2
2
|
import { viewModeOptions, loadingIconSizes } from '../../../utils/constants';
|
|
3
3
|
import readme from './loading_icon.md';
|
|
4
4
|
|
|
@@ -23,6 +23,7 @@ const generateProps = () => ({
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const Template = (args) => ({
|
|
26
|
+
components: { GlLoadingIcon },
|
|
26
27
|
props: Object.keys(args),
|
|
27
28
|
template,
|
|
28
29
|
});
|
|
@@ -53,7 +53,8 @@ body.modal-open {
|
|
|
53
53
|
|
|
54
54
|
.modal-header {
|
|
55
55
|
@include gl-bg-white;
|
|
56
|
-
@include gl-
|
|
56
|
+
@include gl-pb-3;
|
|
57
|
+
@include gl-border-none;
|
|
57
58
|
|
|
58
59
|
.modal-title {
|
|
59
60
|
@include gl-font-lg;
|
|
@@ -68,6 +69,7 @@ body.modal-open {
|
|
|
68
69
|
@include gl-bg-white;
|
|
69
70
|
@include gl-relative;
|
|
70
71
|
@include gl-p-5;
|
|
72
|
+
@include gl-py-3;
|
|
71
73
|
@include gl-text-left;
|
|
72
74
|
@include gl-white-space-normal;
|
|
73
75
|
@include gl-font-base;
|
|
@@ -78,7 +80,8 @@ body.modal-open {
|
|
|
78
80
|
@include gl-display-flex;
|
|
79
81
|
@include gl-flex-direction-row;
|
|
80
82
|
@include gl-p-5;
|
|
81
|
-
@include gl-
|
|
83
|
+
@include gl-pt-3;
|
|
84
|
+
@include gl-border-none;
|
|
82
85
|
|
|
83
86
|
.btn {
|
|
84
87
|
@include gl-m-0;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
The navigation component is built with flexbox and provides a strong foundation for building all
|
|
2
|
+
types of navigation components.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
## `GlNavItem`
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Use `GlNavItem` to add actionable links (or router links) to your nav. `GlNavItem` wraps [`BNavItem`](https://bootstrap-vue.org/docs/components/navbar#b-nav-item).
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
## `GlNavItemDropdown`
|
|
9
|
+
|
|
10
|
+
Use `GlNavItemDropdown` to place dropdown items within your nav.
|
|
11
|
+
`GlNavItemDropdown` wraps [`BNavItemDropdown`](https://bootstrap-vue.org/docs/components/navbar#b-nav-item-dropdown).
|
|
@@ -1,23 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
|
-
import { GlNav, GlNavItem } from '../../../../index';
|
|
4
|
-
import readme from './nav.md';
|
|
5
|
-
|
|
6
|
-
const components = {
|
|
1
|
+
import {
|
|
7
2
|
GlNav,
|
|
8
3
|
GlNavItem,
|
|
9
|
-
|
|
4
|
+
GlNavItemDropdown,
|
|
5
|
+
GlDropdownItem,
|
|
6
|
+
GlDropdownDivider,
|
|
7
|
+
GlIcon,
|
|
8
|
+
} from '../../../index';
|
|
9
|
+
import readme from './nav.md';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export const Default = (_args, { argTypes }) => ({
|
|
12
|
+
props: Object.keys(argTypes),
|
|
13
|
+
components: {
|
|
14
|
+
GlNav,
|
|
15
|
+
GlNavItem,
|
|
16
|
+
GlNavItemDropdown,
|
|
17
|
+
GlDropdownItem,
|
|
18
|
+
GlDropdownDivider,
|
|
19
|
+
GlIcon,
|
|
20
|
+
},
|
|
21
|
+
template: `
|
|
22
|
+
<div style="height: 150px">
|
|
16
23
|
<gl-nav>
|
|
17
24
|
<gl-nav-item active>Active</gl-nav-item>
|
|
18
25
|
<gl-nav-item>Link</gl-nav-item>
|
|
19
|
-
<gl-nav-item
|
|
26
|
+
<gl-nav-item-dropdown text="Dropdown">
|
|
27
|
+
<gl-dropdown-item>Above divider</gl-dropdown-item>
|
|
28
|
+
<gl-dropdown-divider />
|
|
29
|
+
<gl-dropdown-item>Below divider</gl-dropdown-item>
|
|
30
|
+
</gl-nav-item-dropdown>
|
|
31
|
+
<gl-nav-item-dropdown text="Dropdown">
|
|
32
|
+
<template #button-content>
|
|
33
|
+
<gl-icon name="question" />
|
|
34
|
+
<gl-icon name="angle-down" />
|
|
35
|
+
</template>
|
|
36
|
+
<gl-dropdown-item>One</gl-dropdown-item>
|
|
37
|
+
<gl-dropdown-item>Two</gl-dropdown-item>
|
|
38
|
+
</gl-nav-item-dropdown>
|
|
20
39
|
<gl-nav-item disabled>Disabled</gl-nav-item>
|
|
21
40
|
</gl-nav>
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
</div>`,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
title: 'base/nav',
|
|
46
|
+
component: GlNav,
|
|
47
|
+
subcomponents: {
|
|
48
|
+
GlNavItem,
|
|
49
|
+
GlNavItemDropdown,
|
|
50
|
+
},
|
|
51
|
+
parameters: {
|
|
52
|
+
bootstrapComponent: 'b-nav',
|
|
53
|
+
knobs: { disable: true },
|
|
54
|
+
docs: {
|
|
55
|
+
description: {
|
|
56
|
+
component: readme,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -2,6 +2,8 @@ import { alignOptions } from '../../../utils/constants';
|
|
|
2
2
|
import readme from './pagination.md';
|
|
3
3
|
import GlPagination from './pagination.vue';
|
|
4
4
|
|
|
5
|
+
const components = { GlPagination };
|
|
6
|
+
|
|
5
7
|
const generateBaseProps = ({ prevText = 'Prev', nextText = 'Next', disabled = false } = {}) => ({
|
|
6
8
|
prevText,
|
|
7
9
|
nextText,
|
|
@@ -30,6 +32,7 @@ const defaults = {
|
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
export const Default = (args, { argTypes }) => ({
|
|
35
|
+
components,
|
|
33
36
|
props: Object.keys(argTypes),
|
|
34
37
|
...defaults,
|
|
35
38
|
template: `<gl-pagination
|
|
@@ -44,6 +47,7 @@ export const Default = (args, { argTypes }) => ({
|
|
|
44
47
|
Default.args = generateFullProps();
|
|
45
48
|
|
|
46
49
|
export const Compact = () => ({
|
|
50
|
+
components,
|
|
47
51
|
...defaults,
|
|
48
52
|
props: generateFullProps(),
|
|
49
53
|
data() {
|
|
@@ -77,6 +81,7 @@ export const Compact = () => ({
|
|
|
77
81
|
});
|
|
78
82
|
|
|
79
83
|
export const LinkBased = (args, { argTypes }) => ({
|
|
84
|
+
components,
|
|
80
85
|
props: Object.keys(argTypes),
|
|
81
86
|
...defaults,
|
|
82
87
|
methods: {
|
|
@@ -97,6 +102,7 @@ export const LinkBased = (args, { argTypes }) => ({
|
|
|
97
102
|
LinkBased.args = generateFullProps();
|
|
98
103
|
|
|
99
104
|
export const AlignCenter = (args, { argTypes }) => ({
|
|
105
|
+
components,
|
|
100
106
|
props: Object.keys(argTypes),
|
|
101
107
|
...defaults,
|
|
102
108
|
template: `<gl-pagination
|
|
@@ -112,6 +118,7 @@ export const AlignCenter = (args, { argTypes }) => ({
|
|
|
112
118
|
AlignCenter.args = generateFullProps();
|
|
113
119
|
|
|
114
120
|
export const AlignRight = (args, { argTypes }) => ({
|
|
121
|
+
components,
|
|
115
122
|
props: Object.keys(argTypes),
|
|
116
123
|
...defaults,
|
|
117
124
|
template: `<gl-pagination
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlPath } from '
|
|
1
|
+
import { GlPath, GlPopover } from '../../../index';
|
|
2
2
|
import { glThemes } from '../../../utils/constants';
|
|
3
3
|
import { mockPathItems } from './data';
|
|
4
4
|
import readme from './path.md';
|
|
@@ -28,7 +28,7 @@ export const Default = (args, { argTypes }) => ({
|
|
|
28
28
|
Default.args = generateProps();
|
|
29
29
|
|
|
30
30
|
export const WithPopovers = (args, { argTypes }) => ({
|
|
31
|
-
components: { GlPath },
|
|
31
|
+
components: { GlPath, GlPopover },
|
|
32
32
|
props: Object.keys(argTypes),
|
|
33
33
|
template: template(`
|
|
34
34
|
<template #default="{ pathItem, pathId }">
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { withKnobs, select, text } from '@storybook/addon-knobs';
|
|
2
|
+
import { GlPopover, GlButton } from '../../../index';
|
|
2
3
|
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
4
|
import { popoverPlacements } from '../../../utils/constants';
|
|
4
5
|
|
|
6
|
+
const components = { GlPopover, GlButton };
|
|
7
|
+
|
|
5
8
|
const contentString = `
|
|
6
9
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat a nisi non
|
|
7
10
|
pellentesque. Pellentesque efficitur vulputate rutrum. Fusce nisl magna, porttitor in
|
|
@@ -57,10 +60,12 @@ function generateProps({ placement = popoverPlacements.top, title = 'Popover', t
|
|
|
57
60
|
documentedStoriesOf('base/popover', '')
|
|
58
61
|
.addDecorator(withKnobs)
|
|
59
62
|
.add('default', () => ({
|
|
63
|
+
components,
|
|
60
64
|
template,
|
|
61
65
|
props: generateProps(),
|
|
62
66
|
}))
|
|
63
67
|
.add('with close button', () => ({
|
|
68
|
+
components,
|
|
64
69
|
template: `
|
|
65
70
|
<div class="gl-display-flex gl-justify-content-center gl-p-6">
|
|
66
71
|
<gl-button id="pop-with-close-button">{{placement}}</gl-button>
|
|
@@ -81,6 +86,7 @@ documentedStoriesOf('base/popover', '')
|
|
|
81
86
|
.add(
|
|
82
87
|
'on click',
|
|
83
88
|
() => ({
|
|
89
|
+
components,
|
|
84
90
|
template: scopedSlotTemplate,
|
|
85
91
|
props: generateProps(),
|
|
86
92
|
}),
|
|
@@ -52,6 +52,9 @@ export default {
|
|
|
52
52
|
additionalInfo:
|
|
53
53
|
'Container for tooltip. Valid values: DOM node, selector string or `false` for default',
|
|
54
54
|
},
|
|
55
|
+
searchButtonAttributes: {
|
|
56
|
+
additionalInfo: 'HTML attributes to add to the search button',
|
|
57
|
+
},
|
|
55
58
|
},
|
|
56
59
|
events: [
|
|
57
60
|
{
|
|
@@ -25,6 +25,7 @@ describe('search box by click component', () => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const findClearIcon = () => wrapper.findComponent(ClearIcon);
|
|
28
|
+
const findSearchButton = () => wrapper.find('[data-testid="search-button"]');
|
|
28
29
|
|
|
29
30
|
it('emits input event when input changes', async () => {
|
|
30
31
|
createComponent({ value: 'somevalue' });
|
|
@@ -125,8 +126,8 @@ describe('search box by click component', () => {
|
|
|
125
126
|
});
|
|
126
127
|
|
|
127
128
|
it('displays disabled search button', () => {
|
|
128
|
-
expect(
|
|
129
|
-
expect(
|
|
129
|
+
expect(findSearchButton().exists()).toBe(true);
|
|
130
|
+
expect(findSearchButton().attributes('disabled')).toBe('true');
|
|
130
131
|
});
|
|
131
132
|
|
|
132
133
|
it('does not render clear icon even with value', () => {
|
|
@@ -145,9 +146,19 @@ describe('search box by click component', () => {
|
|
|
145
146
|
|
|
146
147
|
it('emits submit event when search button is pressed', async () => {
|
|
147
148
|
createComponent({ value: 'some-input' });
|
|
148
|
-
|
|
149
|
+
findSearchButton().vm.$emit('click');
|
|
149
150
|
|
|
150
151
|
await wrapper.vm.$nextTick();
|
|
151
152
|
expect(wrapper.emitted().submit[0]).toEqual(['some-input']);
|
|
152
153
|
});
|
|
154
|
+
|
|
155
|
+
it('adds `searchButtonAttributes` prop to search button', () => {
|
|
156
|
+
const searchButtonAttributes = { 'data-qa-selector': 'foo-bar' };
|
|
157
|
+
|
|
158
|
+
createComponent({ searchButtonAttributes });
|
|
159
|
+
|
|
160
|
+
expect(findSearchButton().attributes('data-qa-selector')).toBe(
|
|
161
|
+
searchButtonAttributes['data-qa-selector']
|
|
162
|
+
);
|
|
163
|
+
});
|
|
153
164
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
|
|
2
2
|
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
|
-
import { GlSearchBoxByClick } from '
|
|
3
|
+
import { GlSearchBoxByClick } from '../../../index';
|
|
4
4
|
import readme from './search_box_by_click.md';
|
|
5
5
|
|
|
6
6
|
const components = {
|
|
@@ -84,6 +84,11 @@ export default {
|
|
|
84
84
|
validator: (value) =>
|
|
85
85
|
value === false || typeof value === 'string' || value instanceof HTMLElement,
|
|
86
86
|
},
|
|
87
|
+
searchButtonAttributes: {
|
|
88
|
+
type: Object,
|
|
89
|
+
required: false,
|
|
90
|
+
default: () => ({}),
|
|
91
|
+
},
|
|
87
92
|
},
|
|
88
93
|
data() {
|
|
89
94
|
return {
|
|
@@ -216,11 +221,13 @@ export default {
|
|
|
216
221
|
/>
|
|
217
222
|
<template #append class="gl-search-box-by-click-input-group-control">
|
|
218
223
|
<gl-button
|
|
224
|
+
v-bind="searchButtonAttributes"
|
|
219
225
|
ref="searchButton"
|
|
220
226
|
class="gl-search-box-by-click-search-button"
|
|
221
227
|
icon="search"
|
|
222
228
|
:disabled="disabled"
|
|
223
229
|
aria-label="Search"
|
|
230
|
+
data-testid="search-button"
|
|
224
231
|
@click="search(currentValue)"
|
|
225
232
|
/>
|
|
226
233
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
|
|
2
2
|
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
|
-
import { GlSearchBoxByType } from '
|
|
3
|
+
import { GlSearchBoxByType } from '../../../index';
|
|
4
4
|
import readme from './search_box_by_type.md';
|
|
5
5
|
|
|
6
6
|
const components = {
|