@gitlab/ui 38.1.0 → 38.3.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 +27 -0
- package/dist/components/base/dropdown/dropdown.documentation.js +1 -5
- package/dist/components/base/dropdown/dropdown_item.documentation.js +2 -3
- package/dist/components/base/filtered_search/filtered_search.js +13 -20
- package/dist/components/base/filtered_search/filtered_search_suggestion.js +1 -1
- package/dist/components/base/filtered_search/filtered_search_token.js +31 -23
- package/dist/components/base/filtered_search/filtered_search_utils.js +42 -9
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +2 -27
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +16 -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/use_mock_intersection_observer.js +2 -2
- package/documentation/components_documentation.js +0 -4
- package/documentation/documented_stories.js +4 -1
- package/package.json +12 -12
- package/src/components/base/avatar_link/avatar_link.stories.js +2 -2
- package/src/components/base/dropdown/dropdown.documentation.js +0 -3
- package/src/components/base/dropdown/dropdown.md +7 -2
- package/src/components/base/dropdown/dropdown.stories.js +487 -439
- package/src/components/base/dropdown/dropdown_item.documentation.js +0 -1
- package/src/components/base/dropdown/dropdown_item.md +0 -6
- package/src/components/base/dropdown/dropdown_item.stories.js +107 -35
- package/src/components/base/filtered_search/filtered_search.spec.js +37 -12
- package/src/components/base/filtered_search/filtered_search.stories.js +15 -7
- package/src/components/base/filtered_search/filtered_search.vue +12 -14
- package/src/components/base/filtered_search/filtered_search_suggestion.vue +1 -0
- package/src/components/base/filtered_search/filtered_search_token.spec.js +31 -1
- package/src/components/base/filtered_search/filtered_search_token.stories.js +1 -0
- package/src/components/base/filtered_search/filtered_search_token.vue +30 -21
- package/src/components/base/filtered_search/filtered_search_utils.js +38 -5
- package/src/components/base/form/form.stories.js +2 -0
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +0 -26
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.md +0 -4
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.stories.js +123 -92
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.vue +13 -1
- package/src/components/base/form/form_radio_group/form_radio_group.stories.js +2 -1
- package/src/components/base/markdown/markdown.scss +21 -0
- package/src/components/base/markdown/markdown_typescale_demo.html +17 -6
- package/src/components/base/navbar/navbar.stories.js +2 -1
- package/src/components/base/skeleton_loader/skeleton_loader.stories.js +67 -21
- package/src/components/base/tabs/tabs/tabs.stories.js +2 -2
- package/src/scss/typescale/typescale.md +0 -2
- package/src/scss/typescale/typescale.stories.js +17 -4
- package/src/scss/utilities.scss +24 -0
- package/src/scss/utility-mixins/display.scss +12 -0
- package/src/utils/use_mock_intersection_observer.js +3 -3
- package/dist/components/base/dropdown/dropdown_divider.documentation.js +0 -8
- package/dist/components/base/dropdown/dropdown_form.documentation.js +0 -17
- package/dist/components/base/dropdown/dropdown_section_header.documentation.js +0 -8
- package/dist/components/base/dropdown/dropdown_text.documentation.js +0 -8
- package/dist/components/base/dropdown/examples/dropdown.default.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.links.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_avatar_and_secondary_text.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_checked_items.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_clear_all.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_divider.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_form.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_header.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_highlighted_items.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_icons.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_right_align.example.js +0 -38
- package/dist/components/base/dropdown/examples/dropdown.with_search.example.js +0 -67
- package/dist/components/base/dropdown/examples/dropdown.with_section_headers.example.js +0 -38
- package/dist/components/base/dropdown/examples/index.js +0 -85
- package/dist/components/base/form/form_checkbox_tree/examples/form_checkbox_tree.basic.example.js +0 -103
- package/dist/components/base/form/form_checkbox_tree/examples/index.js +0 -13
- package/src/components/base/dropdown/dropdown_divider.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown_divider.md +0 -7
- package/src/components/base/dropdown/dropdown_divider.stories.js +0 -16
- package/src/components/base/dropdown/dropdown_form.documentation.js +0 -9
- package/src/components/base/dropdown/dropdown_form.md +0 -4
- package/src/components/base/dropdown/dropdown_form.stories.js +0 -17
- package/src/components/base/dropdown/dropdown_section_header.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown_section_header.stories.js +0 -17
- package/src/components/base/dropdown/dropdown_text.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown_text.stories.js +0 -16
- package/src/components/base/dropdown/examples/dropdown.default.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.links.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_avatar_and_secondary_text.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_checked_items.example.vue +0 -6
- package/src/components/base/dropdown/examples/dropdown.with_clear_all.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_divider.example.vue +0 -9
- package/src/components/base/dropdown/examples/dropdown.with_form.example.vue +0 -10
- package/src/components/base/dropdown/examples/dropdown.with_header.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_highlighted_items.example.vue +0 -9
- package/src/components/base/dropdown/examples/dropdown.with_icons.example.vue +0 -43
- package/src/components/base/dropdown/examples/dropdown.with_right_align.example.vue +0 -7
- package/src/components/base/dropdown/examples/dropdown.with_search.example.vue +0 -38
- package/src/components/base/dropdown/examples/dropdown.with_section_headers.example.vue +0 -10
- package/src/components/base/dropdown/examples/index.js +0 -99
- package/src/components/base/form/form_checkbox_tree/examples/form_checkbox_tree.basic.example.vue +0 -77
- package/src/components/base/form/form_checkbox_tree/examples/index.js +0 -15
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
1
|
+
import iconSpriteInfo from '@gitlab/svgs/dist/icons.json';
|
|
3
2
|
import {
|
|
4
3
|
GlAvatar,
|
|
5
4
|
GlIcon,
|
|
@@ -34,112 +33,60 @@ function addClass(component) {
|
|
|
34
33
|
component.$el.querySelectorAll('.btn').forEach((el) => el.classList.add('gl-button'));
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
category = GlDropdown.props.category.default,
|
|
39
|
-
variant = GlDropdown.props.variant.default,
|
|
40
|
-
size = GlDropdown.props.size.default,
|
|
41
|
-
block = false,
|
|
42
|
-
icon = '',
|
|
43
|
-
text = '',
|
|
44
|
-
textSrOnly = false,
|
|
45
|
-
loading = false,
|
|
46
|
-
headerText = '',
|
|
47
|
-
hideHeaderBorder = true,
|
|
48
|
-
showClearAll = false,
|
|
49
|
-
clearAllText = '',
|
|
50
|
-
clearAllTextClass = '',
|
|
51
|
-
showHighlightedItemsTitle = false,
|
|
52
|
-
highlightedItemsTitle = '',
|
|
53
|
-
highlightedItemsTitleClass = '',
|
|
54
|
-
} = {}) {
|
|
55
|
-
const props = {
|
|
56
|
-
category: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: select('category', buttonCategoryOptions, category),
|
|
59
|
-
},
|
|
60
|
-
variant: {
|
|
61
|
-
type: String,
|
|
62
|
-
default: select('variant', Object.values(dropdownVariantOptions), variant),
|
|
63
|
-
},
|
|
64
|
-
size: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: select('size', buttonSizeOptions, size),
|
|
67
|
-
},
|
|
68
|
-
block: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: boolean('block', block),
|
|
71
|
-
},
|
|
72
|
-
disabled: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: boolean('disabled', false),
|
|
75
|
-
},
|
|
76
|
-
text: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: textKnob('text', text),
|
|
79
|
-
},
|
|
80
|
-
textSrOnly: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
default: boolean('text sr-only', textSrOnly),
|
|
83
|
-
},
|
|
84
|
-
icon: {
|
|
85
|
-
type: String,
|
|
86
|
-
default: textKnob('icon svg name', icon),
|
|
87
|
-
},
|
|
88
|
-
split: {
|
|
89
|
-
type: Boolean,
|
|
90
|
-
default: boolean('split', false),
|
|
91
|
-
},
|
|
92
|
-
toggleClass: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: textKnob('toggle class', ''),
|
|
95
|
-
},
|
|
96
|
-
loading: {
|
|
97
|
-
type: Boolean,
|
|
98
|
-
default: boolean('loading', loading),
|
|
99
|
-
},
|
|
100
|
-
headerText: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: textKnob('header text', headerText),
|
|
103
|
-
},
|
|
104
|
-
hideHeaderBorder: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
default: boolean('no header border', hideHeaderBorder),
|
|
107
|
-
},
|
|
108
|
-
showClearAll: {
|
|
109
|
-
type: Boolean,
|
|
110
|
-
default: boolean('show clear all', showClearAll),
|
|
111
|
-
},
|
|
112
|
-
clearAllText: {
|
|
113
|
-
type: String,
|
|
114
|
-
default: textKnob('clear all text', clearAllText),
|
|
115
|
-
},
|
|
116
|
-
clearAllTextClass: {
|
|
117
|
-
type: String,
|
|
118
|
-
default: textKnob('clear all text class', clearAllTextClass),
|
|
119
|
-
},
|
|
120
|
-
showHighlightedItemsTitle: {
|
|
121
|
-
type: Boolean,
|
|
122
|
-
default: boolean('show highlighted items title', showHighlightedItemsTitle),
|
|
123
|
-
},
|
|
124
|
-
highlightedItemsTitle: {
|
|
125
|
-
type: String,
|
|
126
|
-
default: textKnob('highlighted items title', highlightedItemsTitle),
|
|
127
|
-
},
|
|
128
|
-
highlightedItemsTitleClass: {
|
|
129
|
-
type: String,
|
|
130
|
-
default: textKnob('highlighted items title class', highlightedItemsTitleClass),
|
|
131
|
-
},
|
|
132
|
-
right: {
|
|
133
|
-
type: Boolean,
|
|
134
|
-
default: boolean('right', false),
|
|
135
|
-
},
|
|
136
|
-
};
|
|
36
|
+
const defaultValue = (prop) => GlDropdown.props[prop].default;
|
|
137
37
|
|
|
138
|
-
|
|
139
|
-
|
|
38
|
+
const generateProps = ({
|
|
39
|
+
headerText = defaultValue('headerText'),
|
|
40
|
+
hideHeaderBorder = defaultValue('hideHeaderBorder'),
|
|
41
|
+
showClearAll = defaultValue('showClearAll'),
|
|
42
|
+
clearAllText = defaultValue('clearAllText'),
|
|
43
|
+
clearAllTextClass = defaultValue('clearAllTextClass'),
|
|
44
|
+
text = defaultValue('text'),
|
|
45
|
+
showHighlightedItemsTitle = defaultValue('showHighlightedItemsTitle'),
|
|
46
|
+
highlightedItemsTitle = defaultValue('highlightedItemsTitle'),
|
|
47
|
+
highlightedItemsTitleClass = defaultValue('highlightedItemsTitleClass'),
|
|
48
|
+
textSrOnly = defaultValue('textSrOnly'),
|
|
49
|
+
split = defaultValue('split'),
|
|
50
|
+
category = defaultValue('category'),
|
|
51
|
+
variant = defaultValue('variant'),
|
|
52
|
+
size = defaultValue('size'),
|
|
53
|
+
icon = defaultValue('icon'),
|
|
54
|
+
block = defaultValue('block'),
|
|
55
|
+
disabled = defaultValue('disabled'),
|
|
56
|
+
loading = defaultValue('loading'),
|
|
57
|
+
toggleClass = defaultValue('toggleClass'),
|
|
58
|
+
right = defaultValue('right'),
|
|
59
|
+
} = {}) => ({
|
|
60
|
+
headerText,
|
|
61
|
+
hideHeaderBorder,
|
|
62
|
+
showClearAll,
|
|
63
|
+
clearAllText,
|
|
64
|
+
clearAllTextClass,
|
|
65
|
+
text,
|
|
66
|
+
showHighlightedItemsTitle,
|
|
67
|
+
highlightedItemsTitle,
|
|
68
|
+
highlightedItemsTitleClass,
|
|
69
|
+
textSrOnly,
|
|
70
|
+
split,
|
|
71
|
+
category,
|
|
72
|
+
variant,
|
|
73
|
+
size,
|
|
74
|
+
icon,
|
|
75
|
+
block,
|
|
76
|
+
disabled,
|
|
77
|
+
loading,
|
|
78
|
+
toggleClass,
|
|
79
|
+
right,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const withContainer = (template, containerHeight = 150) => `
|
|
83
|
+
<div style="height: ${containerHeight}px;">
|
|
84
|
+
${template}
|
|
85
|
+
</div>`;
|
|
140
86
|
|
|
141
|
-
function wrap(
|
|
142
|
-
return
|
|
87
|
+
function wrap(template, containerHeight) {
|
|
88
|
+
return withContainer(
|
|
89
|
+
`
|
|
143
90
|
<gl-dropdown
|
|
144
91
|
ref="dropdown"
|
|
145
92
|
:category="category"
|
|
@@ -164,350 +111,451 @@ function wrap([template]) {
|
|
|
164
111
|
:right="right"
|
|
165
112
|
>
|
|
166
113
|
${template}
|
|
167
|
-
</gl-dropdown
|
|
114
|
+
</gl-dropdown>`,
|
|
115
|
+
containerHeight
|
|
116
|
+
);
|
|
168
117
|
}
|
|
169
118
|
|
|
170
119
|
function clickDropdown(component) {
|
|
171
120
|
component.$nextTick(() => component.$el.querySelector('.dropdown-toggle').click());
|
|
172
121
|
}
|
|
173
122
|
|
|
174
|
-
|
|
175
|
-
.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
<gl-dropdown-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
<gl-dropdown-item icon-right-name="star" icon-right-aria-label="Some action">
|
|
433
|
-
Normal item
|
|
434
|
-
</gl-dropdown-item>
|
|
435
|
-
<gl-dropdown-item icon-right-name="star" icon-right-aria-label="Some action">
|
|
436
|
-
<div class="gl-text-truncate">ellipsis/should/truncate/this/item</div>
|
|
437
|
-
</gl-dropdown-item>`,
|
|
438
|
-
mounted() {
|
|
439
|
-
clickDropdown(this);
|
|
440
|
-
},
|
|
441
|
-
updated() {
|
|
442
|
-
addClass(this);
|
|
443
|
-
},
|
|
444
|
-
}))
|
|
445
|
-
.add('icon only', () => ({
|
|
446
|
-
props: generateProps({ icon: 'ellipsis_v', text: 'More actions', textSrOnly: true }),
|
|
447
|
-
components,
|
|
448
|
-
template: wrap`
|
|
123
|
+
export const Default = (_args, { argTypes }) => ({
|
|
124
|
+
props: Object.keys(argTypes),
|
|
125
|
+
components,
|
|
126
|
+
template: wrap(
|
|
127
|
+
`
|
|
128
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
129
|
+
<gl-dropdown-item>Second item</gl-dropdown-item>
|
|
130
|
+
<gl-dropdown-item>Third item</gl-dropdown-item>
|
|
131
|
+
<gl-dropdown-item>Fourth item</gl-dropdown-item>
|
|
132
|
+
<gl-dropdown-item>Fifth item</gl-dropdown-item>
|
|
133
|
+
<gl-dropdown-item>Sixth item</gl-dropdown-item>
|
|
134
|
+
<gl-dropdown-item>Seventh item</gl-dropdown-item>
|
|
135
|
+
<gl-dropdown-item>Eighth item</gl-dropdown-item>
|
|
136
|
+
<gl-dropdown-item>Ninth item</gl-dropdown-item>
|
|
137
|
+
<gl-dropdown-item>Tenth item</gl-dropdown-item>
|
|
138
|
+
<gl-dropdown-item>Eleventh item</gl-dropdown-item>`,
|
|
139
|
+
340
|
|
140
|
+
),
|
|
141
|
+
mounted() {
|
|
142
|
+
clickDropdown(this);
|
|
143
|
+
},
|
|
144
|
+
updated() {
|
|
145
|
+
addClass(this);
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
Default.args = generateProps({ text: 'Some dropdown' });
|
|
149
|
+
|
|
150
|
+
export const Secondary = (_args, { argTypes }) => ({
|
|
151
|
+
props: Object.keys(argTypes),
|
|
152
|
+
components,
|
|
153
|
+
template: wrap(`
|
|
154
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
155
|
+
<gl-dropdown-item>Second item</gl-dropdown-item>
|
|
156
|
+
<gl-dropdown-item>Third item</gl-dropdown-item>`),
|
|
157
|
+
mounted() {
|
|
158
|
+
clickDropdown(this);
|
|
159
|
+
},
|
|
160
|
+
updated() {
|
|
161
|
+
addClass(this);
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
Secondary.args = generateProps({
|
|
165
|
+
text: 'Some dropdown',
|
|
166
|
+
category: buttonCategoryOptions.secondary,
|
|
167
|
+
variant: dropdownVariantOptions.confirm,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
export const WithForm = (_args, { argTypes }) => ({
|
|
171
|
+
props: Object.keys(argTypes),
|
|
172
|
+
components: { ...components, GlButton },
|
|
173
|
+
template: wrap(`
|
|
174
|
+
<gl-dropdown-form class="gl-px-4">
|
|
175
|
+
<gl-button>One</gl-button>
|
|
176
|
+
<gl-button>Two</gl-button>
|
|
177
|
+
<gl-button>Three</gl-button>
|
|
178
|
+
</gl-dropdown-form>`),
|
|
179
|
+
mounted() {
|
|
180
|
+
clickDropdown(this);
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
WithForm.args = generateProps({ text: 'Some dropdown' });
|
|
184
|
+
|
|
185
|
+
export const WithDivider = (args, { argTypes }) => ({
|
|
186
|
+
props: Object.keys(argTypes),
|
|
187
|
+
components,
|
|
188
|
+
template: wrap(
|
|
189
|
+
`
|
|
190
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
191
|
+
<gl-dropdown-item>Second item</gl-dropdown-item>
|
|
192
|
+
<gl-dropdown-divider />
|
|
193
|
+
<gl-dropdown-item>Third item</gl-dropdown-item>
|
|
194
|
+
<gl-dropdown-item>Fourth item</gl-dropdown-item>`,
|
|
195
|
+
200
|
|
196
|
+
),
|
|
197
|
+
mounted() {
|
|
198
|
+
clickDropdown(this);
|
|
199
|
+
},
|
|
200
|
+
updated() {
|
|
201
|
+
addClass(this);
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
WithDivider.args = generateProps({ text: 'Some dropdown' });
|
|
205
|
+
|
|
206
|
+
export const WithHeaderAndFooter = (args, { argTypes }) => ({
|
|
207
|
+
props: Object.keys(argTypes),
|
|
208
|
+
components: { ...components, GlSearchBoxByType },
|
|
209
|
+
template: wrap(
|
|
210
|
+
`
|
|
211
|
+
<template #header>
|
|
212
|
+
<gl-search-box-by-type />
|
|
213
|
+
</template>
|
|
214
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
215
|
+
<gl-dropdown-item>Second item</gl-dropdown-item>
|
|
216
|
+
<gl-dropdown-item>Third item</gl-dropdown-item>
|
|
217
|
+
<gl-dropdown-item>Fourth item</gl-dropdown-item>
|
|
218
|
+
<gl-dropdown-item>Fifth item</gl-dropdown-item>
|
|
219
|
+
<gl-dropdown-item>Sixth item</gl-dropdown-item>
|
|
220
|
+
<gl-dropdown-item>Seventh item</gl-dropdown-item>
|
|
221
|
+
<gl-dropdown-item>Eigth item</gl-dropdown-item>
|
|
222
|
+
<template #footer>
|
|
223
|
+
<gl-dropdown-item>First footer item</gl-dropdown-item>
|
|
224
|
+
<gl-dropdown-item>Second footer item</gl-dropdown-item>
|
|
225
|
+
</template>`,
|
|
226
|
+
340
|
|
227
|
+
),
|
|
228
|
+
mounted() {
|
|
229
|
+
clickDropdown(this);
|
|
230
|
+
},
|
|
231
|
+
updated() {
|
|
232
|
+
addClass(this);
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
WithHeaderAndFooter.args = generateProps({
|
|
236
|
+
text: 'Some dropdown',
|
|
237
|
+
headerText: 'Header',
|
|
238
|
+
hideHeaderBorder: true,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
export const WithSectionHeader = (args, { argTypes }) => ({
|
|
242
|
+
props: Object.keys(argTypes),
|
|
243
|
+
components,
|
|
244
|
+
template: wrap(
|
|
245
|
+
`
|
|
246
|
+
<gl-dropdown-section-header>Header title</gl-dropdown-section-header>
|
|
247
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
248
|
+
<gl-dropdown-item>Second item</gl-dropdown-item>
|
|
249
|
+
<gl-dropdown-section-header>I am a really long header title which should wrap</gl-dropdown-section-header>
|
|
250
|
+
<gl-dropdown-item>Third item</gl-dropdown-item>
|
|
251
|
+
<gl-dropdown-item>Fourth item</gl-dropdown-item>`,
|
|
252
|
+
300
|
|
253
|
+
),
|
|
254
|
+
mounted() {
|
|
255
|
+
clickDropdown(this);
|
|
256
|
+
},
|
|
257
|
+
updated() {
|
|
258
|
+
addClass(this);
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
WithSectionHeader.args = generateProps({ text: 'Some dropdown' });
|
|
262
|
+
|
|
263
|
+
export const WithCheckedItems = (args, { argTypes }) => ({
|
|
264
|
+
props: Object.keys(argTypes),
|
|
265
|
+
components,
|
|
266
|
+
template: wrap(`
|
|
267
|
+
<gl-dropdown-item :is-check-item="true" :is-checked="true">Checked item</gl-dropdown-item>
|
|
268
|
+
<gl-dropdown-item :is-check-item="true">Unchecked item</gl-dropdown-item>`),
|
|
269
|
+
mounted() {
|
|
270
|
+
clickDropdown(this);
|
|
271
|
+
},
|
|
272
|
+
updated() {
|
|
273
|
+
addClass(this);
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
WithCheckedItems.args = generateProps({ text: 'Some dropdown' });
|
|
277
|
+
|
|
278
|
+
export const WithAvatarAndSecondaryText = (args, { argTypes }) => ({
|
|
279
|
+
props: Object.keys(argTypes),
|
|
280
|
+
components,
|
|
281
|
+
template: wrap(`
|
|
282
|
+
<gl-dropdown-item
|
|
283
|
+
avatar-url="./img/avatar.png"
|
|
284
|
+
secondary-text="@sytses"
|
|
285
|
+
>
|
|
286
|
+
Sid Sijbrandij
|
|
287
|
+
</gl-dropdown-item>`),
|
|
288
|
+
mounted() {
|
|
289
|
+
clickDropdown(this);
|
|
290
|
+
},
|
|
291
|
+
updated() {
|
|
292
|
+
addClass(this);
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
WithAvatarAndSecondaryText.args = generateProps({ text: 'Some dropdown' });
|
|
296
|
+
|
|
297
|
+
export const WithIcons = (args, { argTypes }) => ({
|
|
298
|
+
props: Object.keys(argTypes),
|
|
299
|
+
components,
|
|
300
|
+
template: wrap(
|
|
301
|
+
`
|
|
302
|
+
<gl-dropdown-item
|
|
303
|
+
icon-color="info"
|
|
304
|
+
icon-name="status_running"
|
|
305
|
+
icon-right-name="retry"
|
|
306
|
+
icon-right-aria-label="Retry"
|
|
307
|
+
>
|
|
308
|
+
Status running
|
|
309
|
+
</gl-dropdown-item>
|
|
310
|
+
<gl-dropdown-item
|
|
311
|
+
icon-color="success"
|
|
312
|
+
icon-name="status_success"
|
|
313
|
+
icon-right-name="cancel"
|
|
314
|
+
icon-right-aria-label="Cancel"
|
|
315
|
+
>
|
|
316
|
+
Status success
|
|
317
|
+
</gl-dropdown-item>
|
|
318
|
+
<gl-dropdown-item
|
|
319
|
+
icon-color="warning"
|
|
320
|
+
icon-name="status_warning"
|
|
321
|
+
icon-right-name="cancel"
|
|
322
|
+
icon-right-aria-label="Cancel"
|
|
323
|
+
>
|
|
324
|
+
Status warning
|
|
325
|
+
</gl-dropdown-item>
|
|
326
|
+
<gl-dropdown-item
|
|
327
|
+
icon-color="danger"
|
|
328
|
+
icon-name="status_failed"
|
|
329
|
+
icon-right-name="cancel"
|
|
330
|
+
icon-right-aria-label="Cancel"
|
|
331
|
+
>
|
|
332
|
+
Status failed
|
|
333
|
+
</gl-dropdown-item>
|
|
334
|
+
<gl-dropdown-item
|
|
335
|
+
icon-name="status_manual"
|
|
336
|
+
icon-right-name="cancel"
|
|
337
|
+
icon-right-aria-label="Cancel"
|
|
338
|
+
>
|
|
339
|
+
Status manual
|
|
340
|
+
</gl-dropdown-item>`,
|
|
341
|
+
200
|
|
342
|
+
),
|
|
343
|
+
mounted() {
|
|
344
|
+
clickDropdown(this);
|
|
345
|
+
},
|
|
346
|
+
updated() {
|
|
347
|
+
addClass(this);
|
|
348
|
+
},
|
|
349
|
+
});
|
|
350
|
+
WithIcons.args = generateProps({ text: 'Some dropdown' });
|
|
351
|
+
|
|
352
|
+
export const FullWidth = (args, { argTypes }) => ({
|
|
353
|
+
props: Object.keys(argTypes),
|
|
354
|
+
components,
|
|
355
|
+
template: wrap(`
|
|
356
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
357
|
+
<gl-dropdown-item>Second item</gl-dropdown-item>
|
|
358
|
+
<gl-dropdown-item>Last item</gl-dropdown-item>`),
|
|
359
|
+
mounted() {
|
|
360
|
+
clickDropdown(this);
|
|
361
|
+
},
|
|
362
|
+
updated() {
|
|
363
|
+
addClass(this);
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
FullWidth.args = generateProps({ text: 'Some dropdown', block: true });
|
|
367
|
+
|
|
368
|
+
export const WithShortTextAndWideWidth = (args, { argTypes }) => ({
|
|
369
|
+
props: Object.keys(argTypes),
|
|
370
|
+
components,
|
|
371
|
+
template: withContainer(`
|
|
372
|
+
<gl-dropdown
|
|
373
|
+
text="Some dropdown"
|
|
374
|
+
:category="category"
|
|
375
|
+
:variant="variant"
|
|
376
|
+
:size="size"
|
|
377
|
+
:block="block"
|
|
378
|
+
:disabled="disabled"
|
|
379
|
+
style="width: 300px;"
|
|
380
|
+
>
|
|
449
381
|
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
450
|
-
<gl-dropdown-item>
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
382
|
+
<gl-dropdown-item>Last item</gl-dropdown-item>
|
|
383
|
+
</gl-dropdown>`),
|
|
384
|
+
mounted() {
|
|
385
|
+
clickDropdown(this);
|
|
386
|
+
},
|
|
387
|
+
updated() {
|
|
388
|
+
addClass(this);
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
WithShortTextAndWideWidth.args = generateProps();
|
|
392
|
+
|
|
393
|
+
export const WithLongTextAndNarrowWidth = (args, { argTypes }) => ({
|
|
394
|
+
props: Object.keys(argTypes),
|
|
395
|
+
components,
|
|
396
|
+
template: withContainer(`
|
|
397
|
+
<gl-dropdown
|
|
398
|
+
text="Truncated text dropdown"
|
|
399
|
+
:category="category"
|
|
400
|
+
:variant="variant"
|
|
401
|
+
:size="size"
|
|
402
|
+
:block="block"
|
|
403
|
+
:disabled="disabled"
|
|
404
|
+
style="width: 160px;"
|
|
405
|
+
>
|
|
463
406
|
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
464
|
-
<gl-dropdown-item>Last item</gl-dropdown-item
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
407
|
+
<gl-dropdown-item>Last item</gl-dropdown-item>
|
|
408
|
+
</gl-dropdown>`),
|
|
409
|
+
mounted() {
|
|
410
|
+
clickDropdown(this);
|
|
411
|
+
},
|
|
412
|
+
updated() {
|
|
413
|
+
addClass(this);
|
|
414
|
+
},
|
|
415
|
+
});
|
|
416
|
+
WithLongTextAndNarrowWidth.args = generateProps({ block: true });
|
|
417
|
+
|
|
418
|
+
export const WithItemTextThatDoesNotWrap = (args, { argTypes }) => ({
|
|
419
|
+
props: Object.keys(argTypes),
|
|
420
|
+
components,
|
|
421
|
+
template: wrap(`
|
|
422
|
+
<gl-dropdown-item icon-right-name="star" icon-right-aria-label="Some action">
|
|
423
|
+
Normal item
|
|
424
|
+
</gl-dropdown-item>
|
|
425
|
+
<gl-dropdown-item icon-right-name="star" icon-right-aria-label="Some action">
|
|
426
|
+
<div class="gl-text-truncate">ellipsis/should/truncate/this/item</div>
|
|
427
|
+
</gl-dropdown-item>`),
|
|
428
|
+
mounted() {
|
|
429
|
+
clickDropdown(this);
|
|
430
|
+
},
|
|
431
|
+
updated() {
|
|
432
|
+
addClass(this);
|
|
433
|
+
},
|
|
434
|
+
});
|
|
435
|
+
WithItemTextThatDoesNotWrap.args = generateProps({ text: 'Some dropdown' });
|
|
436
|
+
|
|
437
|
+
export const IconOnly = (args, { argTypes }) => ({
|
|
438
|
+
props: Object.keys(argTypes),
|
|
439
|
+
components,
|
|
440
|
+
template: wrap(`
|
|
441
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
442
|
+
<gl-dropdown-item>Second item</gl-dropdown-item>
|
|
443
|
+
<gl-dropdown-item>Last item</gl-dropdown-item>`),
|
|
444
|
+
mounted() {
|
|
445
|
+
clickDropdown(this);
|
|
446
|
+
},
|
|
447
|
+
updated() {
|
|
448
|
+
addClass(this);
|
|
449
|
+
},
|
|
450
|
+
});
|
|
451
|
+
IconOnly.args = generateProps({ icon: 'ellipsis_v', text: 'More actions', textSrOnly: true });
|
|
452
|
+
|
|
453
|
+
export const WithLoadingState = (args, { argTypes }) => ({
|
|
454
|
+
props: Object.keys(argTypes),
|
|
455
|
+
components,
|
|
456
|
+
template: wrap(`
|
|
457
|
+
<gl-dropdown-item>First item</gl-dropdown-item>
|
|
458
|
+
<gl-dropdown-item>Last item</gl-dropdown-item>`),
|
|
459
|
+
mounted() {
|
|
460
|
+
clickDropdown(this);
|
|
461
|
+
},
|
|
462
|
+
updated() {
|
|
463
|
+
addClass(this);
|
|
464
|
+
},
|
|
465
|
+
});
|
|
466
|
+
WithLoadingState.args = generateProps({ text: 'Some dropdown', loading: true });
|
|
467
|
+
|
|
468
|
+
export const WithClearAll = (args, { argTypes }) => ({
|
|
469
|
+
props: Object.keys(argTypes),
|
|
470
|
+
components,
|
|
471
|
+
template: wrap(`
|
|
472
|
+
<gl-dropdown-item :is-check-item="true" :is-checked="true">First item</gl-dropdown-item>
|
|
473
|
+
<gl-dropdown-item :is-check-item="true" :is-checked="true">Second item</gl-dropdown-item>
|
|
474
|
+
<gl-dropdown-item :is-check-item="true" :is-checked="true">Third item</gl-dropdown-item>`),
|
|
475
|
+
mounted() {
|
|
476
|
+
clickDropdown(this);
|
|
477
|
+
},
|
|
478
|
+
updated() {
|
|
479
|
+
addClass(this);
|
|
480
|
+
},
|
|
481
|
+
});
|
|
482
|
+
WithClearAll.args = generateProps({
|
|
483
|
+
text: 'Some dropdown',
|
|
484
|
+
showClearAll: true,
|
|
485
|
+
clearAllText: 'Clear all',
|
|
486
|
+
clearAllTextClass: 'gl-px-5',
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
export const WithHighlightedItems = (args, { argTypes }) => ({
|
|
490
|
+
props: Object.keys(argTypes),
|
|
491
|
+
components,
|
|
492
|
+
template: wrap(
|
|
493
|
+
`
|
|
494
|
+
<template #highlighted-items>
|
|
481
495
|
<gl-dropdown-item :is-check-item="true" :is-checked="true">First item</gl-dropdown-item>
|
|
482
496
|
<gl-dropdown-item :is-check-item="true" :is-checked="true">Second item</gl-dropdown-item>
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
497
|
+
</template>
|
|
498
|
+
<gl-dropdown-item>Third item</gl-dropdown-item>
|
|
499
|
+
<gl-dropdown-item>Fourth item</gl-dropdown-item>
|
|
500
|
+
`,
|
|
501
|
+
200
|
|
502
|
+
),
|
|
503
|
+
mounted() {
|
|
504
|
+
clickDropdown(this);
|
|
505
|
+
},
|
|
506
|
+
updated() {
|
|
507
|
+
addClass(this);
|
|
508
|
+
},
|
|
509
|
+
});
|
|
510
|
+
WithHighlightedItems.args = generateProps({
|
|
511
|
+
text: 'Some dropdown',
|
|
512
|
+
showHighlightedItemsTitle: true,
|
|
513
|
+
highlightedItemsTitle: 'Highlights',
|
|
514
|
+
highlightedItemsTitleClass: 'gl-px-5',
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
export default {
|
|
518
|
+
title: 'base/dropdown',
|
|
519
|
+
component: GlDropdown,
|
|
520
|
+
subcomponents: {
|
|
521
|
+
GlDropdownDivider,
|
|
522
|
+
GlDropdownForm,
|
|
523
|
+
GlDropdownItem,
|
|
524
|
+
GlDropdownSectionHeader,
|
|
525
|
+
GlDropdownText,
|
|
526
|
+
},
|
|
527
|
+
parameters: {
|
|
528
|
+
bootstrapComponent: 'b-dropdown',
|
|
529
|
+
docs: {
|
|
530
|
+
description: {
|
|
531
|
+
component: readme,
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
argTypes: {
|
|
536
|
+
category: {
|
|
537
|
+
options: Object.keys(buttonCategoryOptions),
|
|
538
|
+
control: {
|
|
539
|
+
type: 'select',
|
|
540
|
+
},
|
|
486
541
|
},
|
|
487
|
-
|
|
488
|
-
|
|
542
|
+
variant: {
|
|
543
|
+
options: Object.keys(dropdownVariantOptions),
|
|
544
|
+
control: {
|
|
545
|
+
type: 'select',
|
|
546
|
+
},
|
|
489
547
|
},
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
highlightedItemsTitle: 'Highlights',
|
|
496
|
-
highlightedItemsTitleClass: 'gl-px-5',
|
|
497
|
-
}),
|
|
498
|
-
components,
|
|
499
|
-
template: wrap`
|
|
500
|
-
<template #highlighted-items>
|
|
501
|
-
<gl-dropdown-item :is-check-item="true" :is-checked="true">First item</gl-dropdown-item>
|
|
502
|
-
<gl-dropdown-item :is-check-item="true" :is-checked="true">Second item</gl-dropdown-item>
|
|
503
|
-
</template>
|
|
504
|
-
<gl-dropdown-item>Third item</gl-dropdown-item>
|
|
505
|
-
<gl-dropdown-item>Fourth item</gl-dropdown-item>
|
|
506
|
-
`,
|
|
507
|
-
mounted() {
|
|
508
|
-
clickDropdown(this);
|
|
548
|
+
size: {
|
|
549
|
+
options: Object.keys(buttonSizeOptions),
|
|
550
|
+
control: {
|
|
551
|
+
type: 'select',
|
|
552
|
+
},
|
|
509
553
|
},
|
|
510
|
-
|
|
511
|
-
|
|
554
|
+
icon: {
|
|
555
|
+
options: iconSpriteInfo.icons,
|
|
556
|
+
control: {
|
|
557
|
+
type: 'select',
|
|
558
|
+
},
|
|
512
559
|
},
|
|
513
|
-
}
|
|
560
|
+
},
|
|
561
|
+
};
|