@gitlab/ui 37.3.0 → 37.4.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 +22 -0
- package/dist/components/base/filtered_search/filtered_search_term.js +6 -1
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +10 -1
- package/dist/components/base/form/form_group/form_group.documentation.js +2 -6
- package/dist/components/base/search_box_by_click/search_box_by_click.documentation.js +2 -80
- package/dist/components/base/search_box_by_click/search_box_by_click.js +60 -1
- package/dist/components/base/search_box_by_type/search_box_by_type.documentation.js +2 -20
- package/dist/components/base/search_box_by_type/search_box_by_type.js +19 -5
- package/dist/directives/hover_load/hover_load.documentation.js +1 -1
- package/dist/directives/resize_observer/resize_observer.documentation.js +2 -5
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/documentation/documented_stories.js +5 -0
- package/package.json +1 -1
- package/src/components/base/button/button.scss +5 -9
- package/src/components/base/filtered_search/filtered_search.spec.js +12 -0
- package/src/components/base/filtered_search/filtered_search_term.spec.js +8 -2
- package/src/components/base/filtered_search/filtered_search_term.vue +6 -0
- package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +46 -37
- package/src/components/base/filtered_search/filtered_search_token_segment.vue +14 -1
- package/src/components/base/form/form_group/form_group.documentation.js +0 -3
- package/src/components/base/form/form_group/form_group.md +0 -2
- package/src/components/base/form/form_group/form_group.stories.js +106 -145
- package/src/components/base/form/form_select/form_select.spec.js +8 -4
- package/src/components/base/search_box_by_click/search_box_by_click.documentation.js +0 -90
- package/src/components/base/search_box_by_click/search_box_by_click.md +0 -2
- package/src/components/base/search_box_by_click/search_box_by_click.stories.js +91 -48
- package/src/components/base/search_box_by_click/search_box_by_click.vue +50 -1
- package/src/components/base/search_box_by_type/search_box_by_type.documentation.js +0 -18
- package/src/components/base/search_box_by_type/search_box_by_type.md +0 -2
- package/src/components/base/search_box_by_type/search_box_by_type.stories.js +49 -43
- package/src/components/base/search_box_by_type/search_box_by_type.vue +16 -6
- package/src/directives/hover_load/hover_load.md +0 -2
- package/src/directives/hover_load/hover_load.stories.js +39 -34
- package/src/directives/resize_observer/resize_observer.documentation.js +0 -2
- package/src/directives/resize_observer/resize_observer.md +0 -6
- package/src/directives/resize_observer/resize_observer.stories.js +70 -51
- package/dist/components/base/form/form_group/examples/form_group/form_group.basic.example.js +0 -38
- package/dist/components/base/form/form_group/examples/form_group/form_group.disabled.example.js +0 -48
- package/dist/components/base/form/form_group/examples/form_group/form_group.textarea.example.js +0 -48
- package/dist/components/base/form/form_group/examples/form_group/form_group.validation.example.js +0 -66
- package/dist/components/base/form/form_group/examples/form_group/index.js +0 -27
- package/dist/components/base/search_box_by_click/examples/index.js +0 -22
- package/dist/components/base/search_box_by_click/examples/search_box_by_click.default.example.js +0 -48
- package/dist/components/base/search_box_by_click/examples/search_box_by_click.history.example.js +0 -51
- package/dist/components/base/search_box_by_click/examples/search_box_by_click.v_model.example.js +0 -54
- package/dist/components/base/search_box_by_type/examples/index.js +0 -17
- package/dist/components/base/search_box_by_type/examples/search_box_by_type.default.example.js +0 -48
- package/dist/components/base/search_box_by_type/examples/search_box_by_type.loading.example.js +0 -65
- package/dist/directives/resize_observer/examples/index.js +0 -12
- package/dist/directives/resize_observer/examples/resize_observer.basic.example.js +0 -62
- package/src/components/base/form/form_group/examples/form_group/form_group.basic.example.vue +0 -11
- package/src/components/base/form/form_group/examples/form_group/form_group.disabled.example.vue +0 -21
- package/src/components/base/form/form_group/examples/form_group/form_group.textarea.example.vue +0 -15
- package/src/components/base/form/form_group/examples/form_group/form_group.validation.example.vue +0 -36
- package/src/components/base/form/form_group/examples/form_group/index.js +0 -32
- package/src/components/base/search_box_by_click/examples/index.js +0 -26
- package/src/components/base/search_box_by_click/examples/search_box_by_click.default.example.vue +0 -14
- package/src/components/base/search_box_by_click/examples/search_box_by_click.history.example.vue +0 -23
- package/src/components/base/search_box_by_click/examples/search_box_by_click.v_model.example.vue +0 -23
- package/src/components/base/search_box_by_type/examples/index.js +0 -20
- package/src/components/base/search_box_by_type/examples/search_box_by_type.default.example.vue +0 -14
- package/src/components/base/search_box_by_type/examples/search_box_by_type.loading.example.vue +0 -34
- package/src/directives/resize_observer/examples/index.js +0 -14
- package/src/directives/resize_observer/examples/resize_observer.basic.example.vue +0 -21
|
@@ -1,96 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './search_box_by_click.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
followsDesignSystem: true,
|
|
6
5
|
description,
|
|
7
|
-
examples,
|
|
8
|
-
propsInfo: {
|
|
9
|
-
value: {
|
|
10
|
-
additionalInfo: 'If provided, used as value of search input',
|
|
11
|
-
},
|
|
12
|
-
historyItems: {
|
|
13
|
-
type: Array,
|
|
14
|
-
required: false,
|
|
15
|
-
additionalInfo: 'If provided, used as history items for this component',
|
|
16
|
-
},
|
|
17
|
-
placeholder: {
|
|
18
|
-
type: String,
|
|
19
|
-
required: false,
|
|
20
|
-
additionalInfo: 'If provided, used as history items for this component',
|
|
21
|
-
},
|
|
22
|
-
disabled: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
required: false,
|
|
25
|
-
additionalInfo: 'If provided and true, disables the input and controls',
|
|
26
|
-
},
|
|
27
|
-
recentSearchesHeader: {
|
|
28
|
-
type: String,
|
|
29
|
-
required: false,
|
|
30
|
-
default: 'Recent searches',
|
|
31
|
-
additionalInfo: 'i18n for recent searches title within history dropdown',
|
|
32
|
-
},
|
|
33
|
-
clearButtonTitle: {
|
|
34
|
-
type: String,
|
|
35
|
-
required: false,
|
|
36
|
-
default: 'Clear',
|
|
37
|
-
additionalInfo: 'i18n for clear button title',
|
|
38
|
-
},
|
|
39
|
-
closeButtonTitle: {
|
|
40
|
-
type: String,
|
|
41
|
-
required: false,
|
|
42
|
-
default: 'Close',
|
|
43
|
-
additionalInfo: 'i18n for close button title within history dropdown',
|
|
44
|
-
},
|
|
45
|
-
clearRecentSearchesText: {
|
|
46
|
-
type: String,
|
|
47
|
-
required: false,
|
|
48
|
-
default: 'Clear recent searches',
|
|
49
|
-
additionalInfo: 'i18n for recent searches clear text',
|
|
50
|
-
},
|
|
51
|
-
tooltipContainer: {
|
|
52
|
-
additionalInfo:
|
|
53
|
-
'Container for tooltip. Valid values: DOM node, selector string or `false` for default',
|
|
54
|
-
},
|
|
55
|
-
searchButtonAttributes: {
|
|
56
|
-
additionalInfo: 'HTML attributes to add to the search button',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
events: [
|
|
60
|
-
{
|
|
61
|
-
event: 'clear',
|
|
62
|
-
description: 'Emitted when search is cleared',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
event: 'submit',
|
|
66
|
-
args: [
|
|
67
|
-
{
|
|
68
|
-
arg: 'value',
|
|
69
|
-
description: 'Search value',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
description: 'Emitted when search is submitted',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
event: 'history-item-selected',
|
|
76
|
-
args: [
|
|
77
|
-
{
|
|
78
|
-
arg: 'value',
|
|
79
|
-
description: 'History item',
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
description: 'Emitted when item from history is selected',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
event: 'clear-history',
|
|
86
|
-
description: 'Emitted when clear history button is clicked',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
slots: [
|
|
90
|
-
{
|
|
91
|
-
name: 'history-item',
|
|
92
|
-
description:
|
|
93
|
-
'Slot to customize history item in history dropdown. Used only with history-items prop',
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
6
|
};
|
|
@@ -1,57 +1,100 @@
|
|
|
1
|
-
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { GlSearchBoxByClick } from '../../../index';
|
|
2
|
+
import { disableControls } from '../../../utils/stories_utils';
|
|
4
3
|
import readme from './search_box_by_click.md';
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const template = `
|
|
6
|
+
<gl-search-box-by-click
|
|
7
|
+
:value="value"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:placeholder="placeholder"
|
|
10
|
+
:history-items="currentHistoryItems"
|
|
11
|
+
:clearable="clearable"
|
|
12
|
+
:recent-searches-header="recentSearchesHeader"
|
|
13
|
+
:clear-button-title="clearButtonTitle"
|
|
14
|
+
:close-button-title="closeButtonTitle"
|
|
15
|
+
:clear-recent-searches-text="clearRecentSearchesText"
|
|
16
|
+
:no-recent-searches-text="noRecentSearchesText"
|
|
17
|
+
:search-button-attributes="searchButtonAttributes"
|
|
18
|
+
@clear-history="clearCurrentHistory"
|
|
19
|
+
/>
|
|
20
|
+
`;
|
|
9
21
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
const defaultValue = (prop) => GlSearchBoxByClick.props[prop].default;
|
|
23
|
+
|
|
24
|
+
const generateProps = ({
|
|
25
|
+
disabled = defaultValue('disabled'),
|
|
26
|
+
value = defaultValue('value'),
|
|
27
|
+
placeholder = defaultValue('placeholder'),
|
|
28
|
+
historyItems = defaultValue('historyItems'),
|
|
29
|
+
clearable = defaultValue('clearable'),
|
|
30
|
+
recentSearchesHeader = defaultValue('recentSearchesHeader'),
|
|
31
|
+
clearButtonTitle = defaultValue('clearButtonTitle'),
|
|
32
|
+
closeButtonTitle = defaultValue('closeButtonTitle'),
|
|
33
|
+
clearRecentSearchesText = defaultValue('clearRecentSearchesText'),
|
|
34
|
+
noRecentSearchesText = defaultValue('noRecentSearchesText'),
|
|
35
|
+
searchButtonAttributes = defaultValue('searchButtonAttributes')(),
|
|
36
|
+
} = {}) => ({
|
|
37
|
+
disabled,
|
|
38
|
+
value,
|
|
39
|
+
placeholder,
|
|
40
|
+
historyItems,
|
|
41
|
+
clearable,
|
|
42
|
+
recentSearchesHeader,
|
|
43
|
+
clearButtonTitle,
|
|
44
|
+
closeButtonTitle,
|
|
45
|
+
clearRecentSearchesText,
|
|
46
|
+
noRecentSearchesText,
|
|
47
|
+
searchButtonAttributes,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const Template = (args, { argTypes }) => ({
|
|
51
|
+
components: {
|
|
52
|
+
GlSearchBoxByClick,
|
|
53
|
+
},
|
|
54
|
+
props: Object.keys(argTypes),
|
|
55
|
+
template,
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
currentHistoryItems: this.historyItems,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
watch: {
|
|
62
|
+
historyItems(historyItems) {
|
|
63
|
+
this.currentHistoryItems = historyItems;
|
|
19
64
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
clearCurrentHistory() {
|
|
68
|
+
this.currentHistoryItems = [];
|
|
23
69
|
},
|
|
24
|
-
}
|
|
25
|
-
}
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const Default = Template.bind({});
|
|
74
|
+
Default.args = generateProps();
|
|
26
75
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
76
|
+
export const History = Template.bind({});
|
|
77
|
+
History.args = generateProps({
|
|
78
|
+
historyItems: ['author:@admin', 'assignee:@admin milestone:%12.5', 'label:~test'],
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
title: 'base/search-box-by-click',
|
|
83
|
+
component: GlSearchBoxByClick,
|
|
84
|
+
parameters: {
|
|
85
|
+
knobs: { disable: true },
|
|
86
|
+
docs: {
|
|
87
|
+
description: {
|
|
88
|
+
component: readme,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
argTypes: {
|
|
93
|
+
...disableControls(['tooltipContainer']),
|
|
94
|
+
historyItems: {
|
|
95
|
+
control: {
|
|
96
|
+
type: 'object',
|
|
46
97
|
},
|
|
47
98
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<gl-search-box-by-click
|
|
51
|
-
:value="value"
|
|
52
|
-
:disabled="disabled"
|
|
53
|
-
:placeholder="placeholder"
|
|
54
|
-
:history-items="history"
|
|
55
|
-
/>
|
|
56
|
-
`,
|
|
57
|
-
}));
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -26,6 +26,9 @@ export default {
|
|
|
26
26
|
GlTooltip: GlTooltipDirective,
|
|
27
27
|
},
|
|
28
28
|
props: {
|
|
29
|
+
/**
|
|
30
|
+
* If provided, used as value of search input
|
|
31
|
+
*/
|
|
29
32
|
value: {
|
|
30
33
|
required: false,
|
|
31
34
|
default: '',
|
|
@@ -33,11 +36,17 @@ export default {
|
|
|
33
36
|
// so we should not force any specific type for value here
|
|
34
37
|
validator: () => true,
|
|
35
38
|
},
|
|
39
|
+
/**
|
|
40
|
+
* If provided, used as history items for this component
|
|
41
|
+
*/
|
|
36
42
|
historyItems: {
|
|
37
43
|
type: Array,
|
|
38
44
|
required: false,
|
|
39
45
|
default: null,
|
|
40
46
|
},
|
|
47
|
+
/**
|
|
48
|
+
* If provided, used as a placeholder for this component
|
|
49
|
+
*/
|
|
41
50
|
placeholder: {
|
|
42
51
|
type: String,
|
|
43
52
|
required: false,
|
|
@@ -48,26 +57,41 @@ export default {
|
|
|
48
57
|
required: false,
|
|
49
58
|
default: true,
|
|
50
59
|
},
|
|
60
|
+
/**
|
|
61
|
+
* If provided and true, disables the input and controls
|
|
62
|
+
*/
|
|
51
63
|
disabled: {
|
|
52
64
|
type: Boolean,
|
|
53
65
|
required: false,
|
|
54
66
|
default: false,
|
|
55
67
|
},
|
|
68
|
+
/**
|
|
69
|
+
* i18n for recent searches title within history dropdown
|
|
70
|
+
*/
|
|
56
71
|
recentSearchesHeader: {
|
|
57
72
|
type: String,
|
|
58
73
|
required: false,
|
|
59
74
|
default: 'Recent searches',
|
|
60
75
|
},
|
|
76
|
+
/**
|
|
77
|
+
* i18n for clear button title
|
|
78
|
+
*/
|
|
61
79
|
clearButtonTitle: {
|
|
62
80
|
type: String,
|
|
63
81
|
required: false,
|
|
64
82
|
default: 'Clear',
|
|
65
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* i18n for close button title within history dropdown
|
|
86
|
+
*/
|
|
66
87
|
closeButtonTitle: {
|
|
67
88
|
type: String,
|
|
68
89
|
required: false,
|
|
69
90
|
default: 'Close',
|
|
70
91
|
},
|
|
92
|
+
/**
|
|
93
|
+
* i18n for recent searches clear text
|
|
94
|
+
*/
|
|
71
95
|
clearRecentSearchesText: {
|
|
72
96
|
type: String,
|
|
73
97
|
required: false,
|
|
@@ -78,12 +102,18 @@ export default {
|
|
|
78
102
|
required: false,
|
|
79
103
|
default: "You don't have any recent searches",
|
|
80
104
|
},
|
|
105
|
+
/**
|
|
106
|
+
* Container for tooltip. Valid values: DOM node, selector string or `false` for default
|
|
107
|
+
*/
|
|
81
108
|
tooltipContainer: {
|
|
82
109
|
required: false,
|
|
83
110
|
default: false,
|
|
84
111
|
validator: (value) =>
|
|
85
112
|
value === false || typeof value === 'string' || value instanceof HTMLElement,
|
|
86
113
|
},
|
|
114
|
+
/**
|
|
115
|
+
* HTML attributes to add to the search button
|
|
116
|
+
*/
|
|
87
117
|
searchButtonAttributes: {
|
|
88
118
|
type: Object,
|
|
89
119
|
required: false,
|
|
@@ -130,10 +160,19 @@ export default {
|
|
|
130
160
|
this.$refs.historyDropdown.hide();
|
|
131
161
|
},
|
|
132
162
|
search(value) {
|
|
163
|
+
/**
|
|
164
|
+
* Emitted when search is submitted
|
|
165
|
+
* @property {*} value Search value
|
|
166
|
+
*/
|
|
133
167
|
this.$emit('submit', value);
|
|
134
168
|
},
|
|
135
169
|
selectHistoryItem(item) {
|
|
136
170
|
this.currentValue = item;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Emitted when item from history is selected
|
|
174
|
+
* @property {*} item History item
|
|
175
|
+
*/
|
|
137
176
|
this.$emit('history-item-selected', item);
|
|
138
177
|
setTimeout(() => {
|
|
139
178
|
document.activeElement.blur();
|
|
@@ -141,11 +180,20 @@ export default {
|
|
|
141
180
|
},
|
|
142
181
|
clearInput() {
|
|
143
182
|
this.currentValue = '';
|
|
183
|
+
/**
|
|
184
|
+
* Emitted when search is cleared
|
|
185
|
+
*/
|
|
144
186
|
this.$emit('clear');
|
|
145
187
|
if (this.$refs.input) {
|
|
146
188
|
this.$refs.input.$el.focus();
|
|
147
189
|
}
|
|
148
190
|
},
|
|
191
|
+
emitClearHistory() {
|
|
192
|
+
/**
|
|
193
|
+
* Emitted when clear history button is clicked
|
|
194
|
+
*/
|
|
195
|
+
this.$emit('clear-history');
|
|
196
|
+
},
|
|
149
197
|
},
|
|
150
198
|
};
|
|
151
199
|
</script>
|
|
@@ -187,10 +235,11 @@ export default {
|
|
|
187
235
|
class="gl-search-box-by-click-history-item"
|
|
188
236
|
@click="selectHistoryItem(item)"
|
|
189
237
|
>
|
|
238
|
+
<!-- @slot Slot to customize history item in history dropdown. Used only with history-items prop -->
|
|
190
239
|
<slot name="history-item" :historyItem="item">{{ item }}</slot>
|
|
191
240
|
</gl-dropdown-item>
|
|
192
241
|
<gl-dropdown-divider />
|
|
193
|
-
<gl-dropdown-item ref="clearHistory" @click="
|
|
242
|
+
<gl-dropdown-item ref="clearHistory" @click="emitClearHistory">{{
|
|
194
243
|
clearRecentSearchesText
|
|
195
244
|
}}</gl-dropdown-item>
|
|
196
245
|
</template>
|
|
@@ -1,24 +1,6 @@
|
|
|
1
|
-
import examples from './examples';
|
|
2
1
|
import description from './search_box_by_type.md';
|
|
3
2
|
|
|
4
3
|
export default {
|
|
5
4
|
followsDesignSystem: true,
|
|
6
5
|
description,
|
|
7
|
-
propsInfo: {
|
|
8
|
-
value: {
|
|
9
|
-
additionalInfo: 'If provided, used as value of search input',
|
|
10
|
-
},
|
|
11
|
-
disabled: {
|
|
12
|
-
additionalInfo: 'If provided and true, disables the input and controls',
|
|
13
|
-
},
|
|
14
|
-
isLoading: {
|
|
15
|
-
additionalInfo: 'Puts search box into loading state, rendering spinner',
|
|
16
|
-
},
|
|
17
|
-
tooltipContainer: {
|
|
18
|
-
additionalInfo:
|
|
19
|
-
'Container for tooltip. Valid values: DOM node, selector string or `false` for default',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
examples,
|
|
23
|
-
bootstrapComponent: 'b-form-input',
|
|
24
6
|
};
|
|
@@ -1,49 +1,55 @@
|
|
|
1
|
-
import { withKnobs, boolean, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
3
1
|
import { GlSearchBoxByType } from '../../../index';
|
|
2
|
+
import { disableControls } from '../../../utils/stories_utils';
|
|
4
3
|
import readme from './search_box_by_type.md';
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const template = `
|
|
6
|
+
<gl-search-box-by-type
|
|
7
|
+
v-model="searchQuery"
|
|
8
|
+
:clear-button-title="clearButtonTitle"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:is-loading="isLoading"
|
|
11
|
+
:placeholder="placeholder"
|
|
12
|
+
/>
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const defaultValue = (prop) => GlSearchBoxByType.props[prop].default;
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
const generateProps = ({
|
|
18
|
+
clearButtonTitle = defaultValue('clearButtonTitle'),
|
|
19
|
+
disabled = defaultValue('disabled'),
|
|
13
20
|
placeholder = 'Search',
|
|
14
|
-
isLoading =
|
|
15
|
-
} = {}) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
21
|
+
isLoading = defaultValue('isLoading'),
|
|
22
|
+
} = {}) => ({
|
|
23
|
+
clearButtonTitle,
|
|
24
|
+
disabled,
|
|
25
|
+
placeholder,
|
|
26
|
+
isLoading,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const Template = (args, { argTypes }) => ({
|
|
30
|
+
components: {
|
|
31
|
+
GlSearchBoxByType,
|
|
32
|
+
},
|
|
33
|
+
props: Object.keys(argTypes),
|
|
34
|
+
data: () => ({ searchQuery: '' }),
|
|
35
|
+
template,
|
|
36
|
+
});
|
|
37
|
+
export const Default = Template.bind({});
|
|
38
|
+
Default.args = generateProps();
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
export default {
|
|
41
|
+
title: 'base/search-box-by-type',
|
|
42
|
+
component: GlSearchBoxByType,
|
|
43
|
+
parameters: {
|
|
44
|
+
knobs: { disable: true },
|
|
45
|
+
bootstrapComponent: 'b-form-input',
|
|
46
|
+
docs: {
|
|
47
|
+
description: {
|
|
48
|
+
component: readme,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
argTypes: {
|
|
53
|
+
...disableControls(['value']),
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -4,11 +4,6 @@ import GlFormInput from '../form/form_input/form_input.vue';
|
|
|
4
4
|
import GlIcon from '../icon/icon.vue';
|
|
5
5
|
import GlLoadingIcon from '../loading_icon/loading_icon.vue';
|
|
6
6
|
|
|
7
|
-
const model = {
|
|
8
|
-
prop: 'value',
|
|
9
|
-
event: 'input',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
7
|
export default {
|
|
13
8
|
components: {
|
|
14
9
|
GlClearIconButton,
|
|
@@ -17,8 +12,14 @@ export default {
|
|
|
17
12
|
GlLoadingIcon,
|
|
18
13
|
},
|
|
19
14
|
inheritAttrs: false,
|
|
20
|
-
model
|
|
15
|
+
model: {
|
|
16
|
+
prop: 'value',
|
|
17
|
+
event: 'input',
|
|
18
|
+
},
|
|
21
19
|
props: {
|
|
20
|
+
/**
|
|
21
|
+
* If provided, used as value of search input
|
|
22
|
+
*/
|
|
22
23
|
value: {
|
|
23
24
|
type: String,
|
|
24
25
|
required: false,
|
|
@@ -29,16 +30,25 @@ export default {
|
|
|
29
30
|
required: false,
|
|
30
31
|
default: 'Clear',
|
|
31
32
|
},
|
|
33
|
+
/**
|
|
34
|
+
* If provided and true, disables the input and controls
|
|
35
|
+
*/
|
|
32
36
|
disabled: {
|
|
33
37
|
type: Boolean,
|
|
34
38
|
required: false,
|
|
35
39
|
default: false,
|
|
36
40
|
},
|
|
41
|
+
/**
|
|
42
|
+
* Puts search box into loading state, rendering spinner
|
|
43
|
+
*/
|
|
37
44
|
isLoading: {
|
|
38
45
|
type: Boolean,
|
|
39
46
|
required: false,
|
|
40
47
|
default: false,
|
|
41
48
|
},
|
|
49
|
+
/**
|
|
50
|
+
* Container for tooltip. Valid values: DOM node, selector string or `false` for default
|
|
51
|
+
*/
|
|
42
52
|
tooltipContainer: {
|
|
43
53
|
required: false,
|
|
44
54
|
default: false,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { text } from '@storybook/addon-knobs';
|
|
2
|
-
import { documentedStoriesOf } from '../../../documentation/documented_stories';
|
|
3
1
|
import { GlHoverLoadDirective } from '../../index';
|
|
4
2
|
import readme from './hover_load.md';
|
|
5
3
|
|
|
@@ -8,39 +6,46 @@ const directives = {
|
|
|
8
6
|
};
|
|
9
7
|
|
|
10
8
|
// eslint-disable-next-line no-script-url
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
const generateProps = ({ endpoint = 'some/endpoint' } = {}) => ({
|
|
10
|
+
endpoint,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const Default = (_args, { argTypes }) => ({
|
|
14
|
+
props: Object.keys(argTypes),
|
|
15
|
+
directives,
|
|
16
|
+
data: () => ({
|
|
17
|
+
isPreloaded: false,
|
|
18
|
+
}),
|
|
19
|
+
methods: {
|
|
20
|
+
handlePreload() {
|
|
21
|
+
fetch(this.endpoint);
|
|
22
|
+
this.isPreloaded = true;
|
|
16
23
|
},
|
|
17
|
-
}
|
|
18
|
-
|
|
24
|
+
},
|
|
25
|
+
template: `
|
|
26
|
+
<div>
|
|
27
|
+
<a
|
|
28
|
+
:href="endpoint"
|
|
29
|
+
v-gl-hover-load="handlePreload"
|
|
30
|
+
>
|
|
31
|
+
Hover me to preload
|
|
32
|
+
</a>
|
|
33
|
+
|
|
34
|
+
<span>(Preloaded: {{isPreloaded}})</span>
|
|
35
|
+
</div>
|
|
36
|
+
`,
|
|
37
|
+
});
|
|
38
|
+
Default.args = generateProps();
|
|
19
39
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
methods: {
|
|
29
|
-
handlePreload() {
|
|
30
|
-
fetch(this.endpoint);
|
|
31
|
-
this.isPreloaded = true;
|
|
40
|
+
export default {
|
|
41
|
+
title: 'directives/hover-load-directive',
|
|
42
|
+
component: GlHoverLoadDirective,
|
|
43
|
+
parameters: {
|
|
44
|
+
storyshots: { disable: true },
|
|
45
|
+
docs: {
|
|
46
|
+
description: {
|
|
47
|
+
component: readme,
|
|
32
48
|
},
|
|
33
49
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<a
|
|
37
|
-
:href="endpoint"
|
|
38
|
-
v-gl-hover-load="handlePreload"
|
|
39
|
-
>
|
|
40
|
-
Hover me to preload
|
|
41
|
-
</a>
|
|
42
|
-
|
|
43
|
-
<span>(Preloaded: {{isPreloaded}})</span>
|
|
44
|
-
</div>
|
|
45
|
-
`,
|
|
46
|
-
}));
|
|
50
|
+
},
|
|
51
|
+
};
|