@gitlab/ui 39.3.0 → 39.4.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 +21 -0
- package/dist/components/base/modal/modal.js +14 -2
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +240 -0
- package/dist/components/base/new_dropdowns/constants.js +20 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +381 -0
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +77 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +2 -0
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/utils.js +24 -1
- package/package.json +6 -12
- package/scss_to_js/scss_variables.js +1 -0
- package/scss_to_js/scss_variables.json +5 -0
- package/src/components/base/avatar_labeled/avatar_labeled.stories.js +2 -1
- package/src/components/base/avatar_link/avatar_link.stories.js +2 -3
- package/src/components/base/breadcrumb/breadcrumb.md +1 -1
- package/src/components/base/breadcrumb/breadcrumb.stories.js +2 -1
- package/src/components/base/broadcast_message/broadcast_message.scss +1 -1
- package/src/components/base/button/button.scss +1 -1
- package/src/components/base/dropdown/dropdown.scss +10 -3
- package/src/components/base/dropdown/dropdown_item.scss +1 -0
- package/src/components/base/modal/modal.spec.js +20 -0
- package/src/components/base/modal/modal.vue +14 -1
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +171 -0
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +221 -0
- package/src/components/base/new_dropdowns/constants.js +22 -0
- package/src/components/base/new_dropdowns/listbox/listbox.md +71 -0
- package/src/components/base/new_dropdowns/listbox/listbox.spec.js +236 -0
- package/src/components/base/new_dropdowns/listbox/listbox.stories.js +276 -0
- package/src/components/base/new_dropdowns/listbox/listbox.vue +348 -0
- package/src/components/base/new_dropdowns/listbox/listbox_item.spec.js +104 -0
- package/src/components/base/new_dropdowns/listbox/listbox_item.vue +59 -0
- package/src/index.js +4 -0
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/color.scss +4 -0
- package/src/scss/variables.scss +1 -0
- package/src/utils/utils.js +18 -0
- package/src/utils/utils.spec.js +41 -1
- package/dist/components/base/accordion/accordion.documentation.js +0 -8
- package/dist/components/base/accordion/accordion_item.documentation.js +0 -7
- package/dist/components/base/alert/alert.documentation.js +0 -13
- package/dist/components/base/avatar/avatar.documentation.js +0 -8
- package/dist/components/base/avatar_labeled/avatar_labeled.documentation.js +0 -8
- package/dist/components/base/avatar_link/avatar_link.documentation.js +0 -8
- package/dist/components/base/avatars_inline/avatars_inline.documentation.js +0 -13
- package/dist/components/base/badge/badge.documentation.js +0 -8
- package/dist/components/base/banner/banner.documentation.js +0 -8
- package/dist/components/base/breadcrumb/breadcrumb.documentation.js +0 -8
- package/dist/components/base/broadcast_message/broadcast_message.documentation.js +0 -8
- package/dist/components/base/button/button.documentation.js +0 -24
- package/dist/components/base/button_group/button_group.documentation.js +0 -8
- package/dist/components/base/card/card.documentation.js +0 -13
- package/dist/components/base/carousel/carousel.documentation.js +0 -8
- package/dist/components/base/collapse/collapse.documentation.js +0 -7
- package/dist/components/base/datepicker/datepicker.documentation.js +0 -7
- package/dist/components/base/daterange_picker/daterange_picker.documentation.js +0 -8
- package/dist/components/base/drawer/drawer.documentation.js +0 -8
- package/dist/components/base/dropdown/dropdown.documentation.js +0 -8
- package/dist/components/base/dropdown/dropdown_item.documentation.js +0 -7
- package/dist/components/base/filtered_search/filtered_search.documentation.js +0 -13
- package/dist/components/base/filtered_search/filtered_search_suggestion.documentation.js +0 -7
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +0 -7
- package/dist/components/base/filtered_search/filtered_search_term.documentation.js +0 -12
- package/dist/components/base/filtered_search/filtered_search_token.documentation.js +0 -12
- package/dist/components/base/filtered_search/filtered_search_token_segment.documentation.js +0 -12
- package/dist/components/base/form/form.documentation.js +0 -7
- package/dist/components/base/form/form_checkbox/form_checkbox.documentation.js +0 -8
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +0 -12
- package/dist/components/base/form/form_combobox/form_combobox.documentation.js +0 -13
- package/dist/components/base/form/form_group/form_group.documentation.js +0 -7
- package/dist/components/base/form/form_input/form_input.documentation.js +0 -8
- package/dist/components/base/form/form_input_group/form_input_group.documentation.js +0 -8
- package/dist/components/base/form/form_radio/form_radio.documentation.js +0 -8
- package/dist/components/base/form/form_radio_group/form_radio_group.documentation.js +0 -8
- package/dist/components/base/form/form_select/form_select.documentation.js +0 -8
- package/dist/components/base/form/form_text/form_text.documentation.js +0 -14
- package/dist/components/base/form/form_textarea/form_textarea.documentation.js +0 -7
- package/dist/components/base/form/input_group_text/input_group_text.documentation.js +0 -12
- package/dist/components/base/icon/icon.documentation.js +0 -8
- package/dist/components/base/infinite_scroll/examples/index.js +0 -49
- package/dist/components/base/infinite_scroll/examples/infinite_scroll.all_items.example.js +0 -49
- package/dist/components/base/infinite_scroll/examples/infinite_scroll.basic.example.js +0 -62
- package/dist/components/base/infinite_scroll/examples/infinite_scroll.finite_total_items.example.js +0 -72
- package/dist/components/base/infinite_scroll/examples/infinite_scroll.large_fetched_items.example.js +0 -62
- package/dist/components/base/infinite_scroll/examples/infinite_scroll.reverse.example.js +0 -63
- package/dist/components/base/infinite_scroll/examples/infinite_scroll.small_fetched_items.example.js +0 -62
- package/dist/components/base/infinite_scroll/examples/infinite_scroll.two_way.example.js +0 -94
- package/dist/components/base/infinite_scroll/infinite_scroll.documentation.js +0 -8
- package/dist/components/base/keyset_pagination/keyset_pagination.documentation.js +0 -13
- package/dist/components/base/label/label.documentation.js +0 -8
- package/dist/components/base/link/link.documentation.js +0 -7
- package/dist/components/base/loading_icon/loading_icon.documentation.js +0 -8
- package/dist/components/base/markdown/markdown.documentation.js +0 -12
- package/dist/components/base/modal/modal.documentation.js +0 -8
- package/dist/components/base/nav/nav.documentation.js +0 -12
- package/dist/components/base/navbar/navbar.documentation.js +0 -12
- package/dist/components/base/paginated_list/paginated_list.documentation.js +0 -7
- package/dist/components/base/pagination/pagination.documentation.js +0 -8
- package/dist/components/base/path/path.documentation.js +0 -8
- package/dist/components/base/popover/popover.documentation.js +0 -5
- package/dist/components/base/search_box_by_click/search_box_by_click.documentation.js +0 -8
- package/dist/components/base/search_box_by_type/search_box_by_type.documentation.js +0 -8
- package/dist/components/base/segmented_control/segmented_control.documentation.js +0 -8
- package/dist/components/base/skeleton_loader/skeleton_loader.documentation.js +0 -13
- package/dist/components/base/skeleton_loading/skeleton_loading.documentation.js +0 -7
- package/dist/components/base/sorting/sorting.documentation.js +0 -7
- package/dist/components/base/sorting/sorting_item.documentation.js +0 -8
- package/dist/components/base/table/table.documentation.js +0 -8
- package/dist/components/base/table_lite/table_lite.documentation.js +0 -13
- package/dist/components/base/tabs/tabs/tabs.documentation.js +0 -8
- package/dist/components/base/toast/toast.documentation.js +0 -8
- package/dist/components/base/toggle/toggle.documentation.js +0 -13
- package/dist/components/base/token/token.documentation.js +0 -5
- package/dist/components/base/token_selector/token_selector.documentation.js +0 -12
- package/dist/components/base/tooltip/tooltip.documentation.js +0 -8
- package/dist/components/charts/area/area.documentation.js +0 -5
- package/dist/components/charts/bar/bar.documentation.js +0 -8
- package/dist/components/charts/chart/chart.documentation.js +0 -7
- package/dist/components/charts/column/column.documentation.js +0 -5
- package/dist/components/charts/discrete_scatter/discrete_scatter.documentation.js +0 -5
- package/dist/components/charts/gauge/gauge.documentation.js +0 -12
- package/dist/components/charts/heatmap/heatmap.documentation.js +0 -8
- package/dist/components/charts/line/line.documentation.js +0 -8
- package/dist/components/charts/series_label/series_label.documentation.js +0 -7
- package/dist/components/charts/single_stat/single_stat.documentation.js +0 -7
- package/dist/components/charts/sparkline/sparkline.documentation.js +0 -8
- package/dist/components/charts/stacked_column/stacked_column.documentation.js +0 -8
- package/dist/components/charts/tooltip/tooltip.documentation.js +0 -8
- package/dist/components/editors/rich_text_editor/rich_text_editor.documentation.js +0 -12
- package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.documentation.js +0 -7
- package/dist/components/regions/empty_state/empty_state.documentation.js +0 -7
- package/dist/components/utilities/animated_number/animated_number.documentation.js +0 -13
- package/dist/components/utilities/friendly_wrap/friendly_wrap.documentation.js +0 -7
- package/dist/components/utilities/intersection_observer/intersection_observer.documentation.js +0 -12
- package/dist/components/utilities/intersperse/intersperse.documentation.js +0 -8
- package/dist/components/utilities/sprintf/sprintf.documentation.js +0 -8
- package/dist/components/utilities/truncate/truncate.documentation.js +0 -7
- package/dist/directives/hover_load/hover_load.documentation.js +0 -13
- package/dist/directives/outside/outside.documentation.js +0 -13
- package/dist/directives/resize_observer/resize_observer.documentation.js +0 -8
- package/dist/directives/safe_html/safe_html.documentation.js +0 -8
- package/dist/directives/safe_link/safe_link.documentation.js +0 -8
- package/documentation/all_components.js +0 -8
- package/documentation/components/component_documentation_generator.vue +0 -321
- package/documentation/components/example_display.vue +0 -231
- package/documentation/components/example_explorer.vue +0 -63
- package/documentation/components_documentation.js +0 -111
- package/documentation/index.js +0 -8
- package/src/components/base/accordion/accordion.documentation.js +0 -6
- package/src/components/base/accordion/accordion_item.documentation.js +0 -5
- package/src/components/base/alert/alert.documentation.js +0 -6
- package/src/components/base/avatar/avatar.documentation.js +0 -6
- package/src/components/base/avatar_labeled/avatar_labeled.documentation.js +0 -6
- package/src/components/base/avatar_link/avatar_link.documentation.js +0 -6
- package/src/components/base/avatars_inline/avatars_inline.documentation.js +0 -6
- package/src/components/base/badge/badge.documentation.js +0 -6
- package/src/components/base/banner/banner.documentation.js +0 -6
- package/src/components/base/breadcrumb/breadcrumb.documentation.js +0 -6
- package/src/components/base/broadcast_message/broadcast_message.documentation.js +0 -6
- package/src/components/base/button/button.documentation.js +0 -24
- package/src/components/base/button_group/button_group.documentation.js +0 -6
- package/src/components/base/card/card.documentation.js +0 -6
- package/src/components/base/carousel/carousel.documentation.js +0 -6
- package/src/components/base/collapse/collapse.documentation.js +0 -5
- package/src/components/base/datepicker/datepicker.documentation.js +0 -5
- package/src/components/base/daterange_picker/daterange_picker.documentation.js +0 -6
- package/src/components/base/drawer/drawer.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown.documentation.js +0 -6
- package/src/components/base/dropdown/dropdown_item.documentation.js +0 -5
- package/src/components/base/filtered_search/filtered_search.documentation.js +0 -6
- package/src/components/base/filtered_search/filtered_search_suggestion.documentation.js +0 -5
- package/src/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +0 -5
- package/src/components/base/filtered_search/filtered_search_term.documentation.js +0 -5
- package/src/components/base/filtered_search/filtered_search_token.documentation.js +0 -5
- package/src/components/base/filtered_search/filtered_search_token_segment.documentation.js +0 -5
- package/src/components/base/form/form.documentation.js +0 -5
- package/src/components/base/form/form_checkbox/form_checkbox.documentation.js +0 -6
- package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +0 -5
- package/src/components/base/form/form_combobox/form_combobox.documentation.js +0 -6
- package/src/components/base/form/form_group/form_group.documentation.js +0 -5
- package/src/components/base/form/form_input/form_input.documentation.js +0 -6
- package/src/components/base/form/form_input_group/form_input_group.documentation.js +0 -6
- package/src/components/base/form/form_radio/form_radio.documentation.js +0 -6
- package/src/components/base/form/form_radio_group/form_radio_group.documentation.js +0 -6
- package/src/components/base/form/form_select/form_select.documentation.js +0 -6
- package/src/components/base/form/form_text/form_text.documentation.js +0 -7
- package/src/components/base/form/form_textarea/form_textarea.documentation.js +0 -5
- package/src/components/base/form/input_group_text/input_group_text.documentation.js +0 -5
- package/src/components/base/icon/icon.documentation.js +0 -6
- package/src/components/base/infinite_scroll/examples/index.js +0 -57
- package/src/components/base/infinite_scroll/examples/infinite_scroll.all_items.example.vue +0 -25
- package/src/components/base/infinite_scroll/examples/infinite_scroll.basic.example.vue +0 -43
- package/src/components/base/infinite_scroll/examples/infinite_scroll.finite_total_items.example.vue +0 -44
- package/src/components/base/infinite_scroll/examples/infinite_scroll.large_fetched_items.example.vue +0 -43
- package/src/components/base/infinite_scroll/examples/infinite_scroll.reverse.example.vue +0 -46
- package/src/components/base/infinite_scroll/examples/infinite_scroll.small_fetched_items.example.vue +0 -43
- package/src/components/base/infinite_scroll/examples/infinite_scroll.two_way.example.vue +0 -75
- package/src/components/base/infinite_scroll/infinite_scroll.documentation.js +0 -6
- package/src/components/base/keyset_pagination/keyset_pagination.documentation.js +0 -6
- package/src/components/base/label/label.documentation.js +0 -6
- package/src/components/base/link/link.documentation.js +0 -5
- package/src/components/base/loading_icon/loading_icon.documentation.js +0 -6
- package/src/components/base/markdown/markdown.documentation.js +0 -5
- package/src/components/base/modal/modal.documentation.js +0 -6
- package/src/components/base/nav/nav.documentation.js +0 -5
- package/src/components/base/navbar/navbar.documentation.js +0 -5
- package/src/components/base/paginated_list/paginated_list.documentation.js +0 -5
- package/src/components/base/pagination/pagination.documentation.js +0 -6
- package/src/components/base/path/path.documentation.js +0 -6
- package/src/components/base/popover/popover.documentation.js +0 -3
- package/src/components/base/search_box_by_click/search_box_by_click.documentation.js +0 -6
- package/src/components/base/search_box_by_type/search_box_by_type.documentation.js +0 -6
- package/src/components/base/segmented_control/segmented_control.documentation.js +0 -6
- package/src/components/base/skeleton_loader/skeleton_loader.documentation.js +0 -6
- package/src/components/base/skeleton_loading/skeleton_loading.documentation.js +0 -5
- package/src/components/base/sorting/sorting.documentation.js +0 -5
- package/src/components/base/sorting/sorting_item.documentation.js +0 -6
- package/src/components/base/table/table.documentation.js +0 -6
- package/src/components/base/table_lite/table_lite.documentation.js +0 -6
- package/src/components/base/tabs/tabs/tabs.documentation.js +0 -6
- package/src/components/base/toast/toast.documentation.js +0 -6
- package/src/components/base/toggle/toggle.documentation.js +0 -6
- package/src/components/base/token/token.documentation.js +0 -3
- package/src/components/base/token_selector/token_selector.documentation.js +0 -5
- package/src/components/base/tooltip/tooltip.documentation.js +0 -6
- package/src/components/charts/area/area.documentation.js +0 -3
- package/src/components/charts/bar/bar.documentation.js +0 -6
- package/src/components/charts/chart/chart.documentation.js +0 -5
- package/src/components/charts/column/column.documentation.js +0 -3
- package/src/components/charts/discrete_scatter/discrete_scatter.documentation.js +0 -3
- package/src/components/charts/gauge/gauge.documentation.js +0 -5
- package/src/components/charts/heatmap/heatmap.documentation.js +0 -6
- package/src/components/charts/line/line.documentation.js +0 -6
- package/src/components/charts/series_label/series_label.documentation.js +0 -5
- package/src/components/charts/single_stat/single_stat.documentation.js +0 -5
- package/src/components/charts/sparkline/sparkline.documentation.js +0 -6
- package/src/components/charts/stacked_column/stacked_column.documentation.js +0 -6
- package/src/components/charts/tooltip/tooltip.documentation.js +0 -6
- package/src/components/editors/rich_text_editor/rich_text_editor.documentation.js +0 -5
- package/src/components/regions/dashboard_skeleton/dashboard_skeleton.documentation.js +0 -5
- package/src/components/regions/empty_state/empty_state.documentation.js +0 -5
- package/src/components/utilities/animated_number/animated_number.documentation.js +0 -6
- package/src/components/utilities/friendly_wrap/friendly_wrap.documentation.js +0 -5
- package/src/components/utilities/intersection_observer/intersection_observer.documentation.js +0 -5
- package/src/components/utilities/intersperse/intersperse.documentation.js +0 -6
- package/src/components/utilities/sprintf/sprintf.documentation.js +0 -6
- package/src/components/utilities/truncate/truncate.documentation.js +0 -5
- package/src/directives/hover_load/hover_load.documentation.js +0 -6
- package/src/directives/outside/outside.documentation.js +0 -6
- package/src/directives/resize_observer/resize_observer.documentation.js +0 -6
- package/src/directives/safe_html/safe_html.documentation.js +0 -6
- package/src/directives/safe_link/safe_link.documentation.js +0 -6
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/* eslint-disable vue/no-v-html */
|
|
3
|
-
|
|
4
|
-
import * as Babel from '@babel/standalone';
|
|
5
|
-
import BootstrapVue from 'bootstrap-vue';
|
|
6
|
-
import copyToClipboard from 'copy-to-clipboard';
|
|
7
|
-
import hljs from 'highlight.js';
|
|
8
|
-
import { html } from 'js-beautify';
|
|
9
|
-
import Vue from 'vue';
|
|
10
|
-
import { parseComponent } from 'vue-template-compiler';
|
|
11
|
-
import 'highlight.js/styles/monokai.css';
|
|
12
|
-
import { gitlabComponents } from '../all_components';
|
|
13
|
-
import * as Documentation from '../components_documentation';
|
|
14
|
-
|
|
15
|
-
// We need to register globally all components as we don't know the components that are used in the dynamically compiled .example.vue files
|
|
16
|
-
// This is only for design.gitlab.com and shouldn't be done in our actual application
|
|
17
|
-
Vue.use(BootstrapVue);
|
|
18
|
-
Object.keys(gitlabComponents).forEach((comp) => {
|
|
19
|
-
if (!comp.includes('Directive')) {
|
|
20
|
-
Vue.component(comp, gitlabComponents[comp]);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// We need to do Directives for now manually
|
|
25
|
-
Vue.directive('gl-tooltip', gitlabComponents.GlTooltipDirective);
|
|
26
|
-
Vue.directive('gl-modal-directive', gitlabComponents.GlModalDirective);
|
|
27
|
-
Vue.directive('gl-resize-observer-directive', gitlabComponents.GlResizeObserverDirective);
|
|
28
|
-
Vue.directive('gl-safe-html-directive', gitlabComponents.GlSafeHtmlDirective);
|
|
29
|
-
Vue.directive('gl-collapse-toggle', gitlabComponents.GlCollapseToggleDirective);
|
|
30
|
-
Vue.directive('gl-outside', gitlabComponents.GlOutsideDirective);
|
|
31
|
-
Vue.directive('gl-hover-load', gitlabComponents.GlHoverLoadDirective);
|
|
32
|
-
|
|
33
|
-
function findComponentExample(exampleName) {
|
|
34
|
-
/* eslint-disable no-restricted-syntax */
|
|
35
|
-
// Doing it with a for loop to have an early return/break during iteration
|
|
36
|
-
for (const component of Object.values(Documentation)) {
|
|
37
|
-
if (component.examples) {
|
|
38
|
-
// Looking for an example in the component documentation definition that matches the exampleName
|
|
39
|
-
for (const exampleGroup of component.examples) {
|
|
40
|
-
const foundExample = exampleGroup.items.find((example) => example.id === exampleName);
|
|
41
|
-
if (foundExample) {
|
|
42
|
-
return foundExample;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/* eslint-enable no-restricted-syntax */
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const animationTimeout = 2000;
|
|
52
|
-
|
|
53
|
-
export default {
|
|
54
|
-
props: {
|
|
55
|
-
exampleName: {
|
|
56
|
-
type: String,
|
|
57
|
-
required: true,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
data() {
|
|
61
|
-
return {
|
|
62
|
-
source: '',
|
|
63
|
-
renderedHtml: '',
|
|
64
|
-
copiedSource: false,
|
|
65
|
-
copiedOutput: false,
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
computed: {
|
|
69
|
-
// Based on the set exampleName we try to look it up in the currently loaded Documentation Examples and then read it-> parse and compile it
|
|
70
|
-
currentExampleComponent() {
|
|
71
|
-
// Going through all documentation objects of all components
|
|
72
|
-
const foundExample = findComponentExample(this.exampleName);
|
|
73
|
-
|
|
74
|
-
// Live loading of .example.vue files
|
|
75
|
-
// Examples are included with webpack through raw-loader -> Results in a string
|
|
76
|
-
if (foundExample && foundExample !== undefined) {
|
|
77
|
-
const base = {
|
|
78
|
-
name: '',
|
|
79
|
-
template: '<div></div>',
|
|
80
|
-
};
|
|
81
|
-
try {
|
|
82
|
-
// At Runtime we parse it with `parseComponent` from `vue-template-compiler` (Line 64)
|
|
83
|
-
const parsed = parseComponent(foundExample.component);
|
|
84
|
-
|
|
85
|
-
let compiled = {};
|
|
86
|
-
if (parsed.script) {
|
|
87
|
-
// We parse the script part with Babel.transform (Line 68 in example_display)
|
|
88
|
-
const { code } = Babel.transform(parsed.script.content, {
|
|
89
|
-
presets: ['es2015', ['stage-2', { decoratorsBeforeExport: false }]],
|
|
90
|
-
});
|
|
91
|
-
compiled = eval(`const exports = {};${code}`); // eslint-disable-line no-eval
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Results in the original source of the template and the compiled and working Vue component
|
|
95
|
-
compiled.template = parsed.template.content;
|
|
96
|
-
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
97
|
-
this.source = compiled.template;
|
|
98
|
-
|
|
99
|
-
return { ...base, ...compiled };
|
|
100
|
-
} catch (e) {
|
|
101
|
-
// eslint-disable-next-line no-console
|
|
102
|
-
console.log('ERR : ', e);
|
|
103
|
-
return base;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
},
|
|
108
|
-
exampleHTMLOutput() {
|
|
109
|
-
return this.$refs.exampleComponent || '';
|
|
110
|
-
},
|
|
111
|
-
sourceFormatted() {
|
|
112
|
-
if (this.source) {
|
|
113
|
-
return hljs.fixMarkup(hljs.highlight('html', this.source).value);
|
|
114
|
-
}
|
|
115
|
-
return '';
|
|
116
|
-
},
|
|
117
|
-
renderedHtmlFormatted() {
|
|
118
|
-
if (this.renderedHtml) {
|
|
119
|
-
return hljs.fixMarkup(hljs.highlight('html', this.renderedHtml).value);
|
|
120
|
-
}
|
|
121
|
-
return '';
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
watch: {
|
|
125
|
-
currentExampleComponent() {
|
|
126
|
-
Vue.nextTick(() => {
|
|
127
|
-
this.setHtml();
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
created() {
|
|
132
|
-
// Converting Tabs to spaces to make display look indented
|
|
133
|
-
hljs.configure({ tabReplace: ' ', useBR: true });
|
|
134
|
-
},
|
|
135
|
-
mounted() {
|
|
136
|
-
this.setHtml();
|
|
137
|
-
},
|
|
138
|
-
methods: {
|
|
139
|
-
setHtml() {
|
|
140
|
-
if (this.$refs.compiled) {
|
|
141
|
-
const markup = this.$refs.compiled.$el.outerHTML;
|
|
142
|
-
if (markup) {
|
|
143
|
-
// Splitting lines for easier readability on the rendered output
|
|
144
|
-
const preFormattedHTML = markup.replace(/><(?!\/i|\/label|\/span|option)/g, '>\n<');
|
|
145
|
-
this.renderedHtml = html(preFormattedHTML, {
|
|
146
|
-
indent_size: 2,
|
|
147
|
-
indent_char: ' ',
|
|
148
|
-
wrap_attributes: 'auto',
|
|
149
|
-
wrap_attributes_indent_size: 2,
|
|
150
|
-
end_with_newline: false,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
copySource() {
|
|
156
|
-
copyToClipboard(this.source);
|
|
157
|
-
this.copiedSource = true;
|
|
158
|
-
setTimeout(() => {
|
|
159
|
-
this.copiedSource = false;
|
|
160
|
-
}, animationTimeout);
|
|
161
|
-
},
|
|
162
|
-
copyHtml() {
|
|
163
|
-
copyToClipboard(this.renderedHtml);
|
|
164
|
-
this.copiedOutput = true;
|
|
165
|
-
setTimeout(() => {
|
|
166
|
-
this.copiedOutput = false;
|
|
167
|
-
}, animationTimeout);
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
</script>
|
|
172
|
-
|
|
173
|
-
<template>
|
|
174
|
-
<div>
|
|
175
|
-
<div v-if="currentExampleComponent">
|
|
176
|
-
<b-card no-body>
|
|
177
|
-
<template #header>
|
|
178
|
-
<div>
|
|
179
|
-
<b-row>
|
|
180
|
-
<b-col>
|
|
181
|
-
<strong>{{ exampleName }}</strong>
|
|
182
|
-
</b-col>
|
|
183
|
-
<b-col class="text-right">
|
|
184
|
-
<b-button-group size="sm" class="mx-1">
|
|
185
|
-
<b-btn v-b-toggle.collapseSource>Source</b-btn>
|
|
186
|
-
<b-btn v-b-toggle.collapseHTML>HTML</b-btn>
|
|
187
|
-
</b-button-group>
|
|
188
|
-
</b-col>
|
|
189
|
-
</b-row>
|
|
190
|
-
</div>
|
|
191
|
-
</template>
|
|
192
|
-
<b-card-body>
|
|
193
|
-
<component :is="currentExampleComponent" ref="compiled" />
|
|
194
|
-
</b-card-body>
|
|
195
|
-
<b-list-group flush>
|
|
196
|
-
<b-collapse id="collapseSource" class="mt-2">
|
|
197
|
-
<b-list-group-item>
|
|
198
|
-
<b-row>
|
|
199
|
-
<b-col cols="8"><h6>Source</h6></b-col>
|
|
200
|
-
<b-col class="text-right">
|
|
201
|
-
<template v-if="copiedSource">Copied!</template>
|
|
202
|
-
<b-button-group size="sm">
|
|
203
|
-
<b-button :disabled="copiedSource" @click="copySource">Copy</b-button>
|
|
204
|
-
</b-button-group>
|
|
205
|
-
</b-col>
|
|
206
|
-
</b-row>
|
|
207
|
-
<code class="hljs html" v-html="sourceFormatted"></code>
|
|
208
|
-
</b-list-group-item>
|
|
209
|
-
</b-collapse>
|
|
210
|
-
<b-collapse id="collapseHTML" class="mt-2">
|
|
211
|
-
<b-list-group-item>
|
|
212
|
-
<b-row>
|
|
213
|
-
<b-col cols="8"><h6>HTML Output</h6></b-col>
|
|
214
|
-
<b-col class="text-right">
|
|
215
|
-
<template v-if="copiedOutput">Copied!</template>
|
|
216
|
-
<b-button-group size="sm">
|
|
217
|
-
<b-button :disabled="copiedOutput" @click="copyHtml">Copy</b-button>
|
|
218
|
-
</b-button-group>
|
|
219
|
-
</b-col>
|
|
220
|
-
</b-row>
|
|
221
|
-
<code class="hljs html" v-html="renderedHtmlFormatted"></code>
|
|
222
|
-
</b-list-group-item>
|
|
223
|
-
</b-collapse>
|
|
224
|
-
</b-list-group>
|
|
225
|
-
</b-card>
|
|
226
|
-
</div>
|
|
227
|
-
<b-alert v-else-if="exampleName" show variant="warning"
|
|
228
|
-
>No Example found with the name "{{ exampleName }}"</b-alert
|
|
229
|
-
>
|
|
230
|
-
</div>
|
|
231
|
-
</template>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import GlFormSelect from '../../src/components/base/form/form_select/form_select.vue';
|
|
3
|
-
import { getDocumentationFor } from '../components_documentation';
|
|
4
|
-
import GlExampleDisplay from './example_display.vue';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
components: {
|
|
8
|
-
GlExampleDisplay,
|
|
9
|
-
GlFormSelect,
|
|
10
|
-
},
|
|
11
|
-
props: {
|
|
12
|
-
componentName: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
data() {
|
|
18
|
-
return {
|
|
19
|
-
selectedExampleId: '',
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
computed: {
|
|
23
|
-
exampleGroups() {
|
|
24
|
-
return getDocumentationFor(this.componentName).examples || [];
|
|
25
|
-
},
|
|
26
|
-
firstExampleId() {
|
|
27
|
-
if (
|
|
28
|
-
this.exampleGroups &&
|
|
29
|
-
this.exampleGroups.length > 0 &&
|
|
30
|
-
this.exampleGroups[0].items &&
|
|
31
|
-
this.exampleGroups[0].items.length > 0
|
|
32
|
-
) {
|
|
33
|
-
return this.exampleGroups[0].items[0].id;
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
mounted() {
|
|
39
|
-
if (this.firstExampleId) {
|
|
40
|
-
this.selectedExampleId = this.firstExampleId;
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<div>
|
|
48
|
-
<h3>Examples</h3>
|
|
49
|
-
<gl-form-select
|
|
50
|
-
v-if="exampleGroups && exampleGroups.length > 0"
|
|
51
|
-
v-model="selectedExampleId"
|
|
52
|
-
class="mb-3"
|
|
53
|
-
>
|
|
54
|
-
<template v-for="exampleGroup in exampleGroups">
|
|
55
|
-
<optgroup :key="exampleGroup.title" :label="exampleGroup.name"></optgroup>
|
|
56
|
-
<template v-for="example in exampleGroup.items">
|
|
57
|
-
<option :key="example.id" :value="example.id">{{ example.name }}</option>
|
|
58
|
-
</template>
|
|
59
|
-
</template>
|
|
60
|
-
</gl-form-select>
|
|
61
|
-
<gl-example-display v-if="selectedExampleId" :example-name="selectedExampleId" />
|
|
62
|
-
</div>
|
|
63
|
-
</template>
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
// Component documentation
|
|
2
|
-
// ADD EXPORTS - needed for yarn generate:component. Do not remove
|
|
3
|
-
export { default as GlTableLiteDocumentation } from '../src/components/base/table_lite/table_lite.documentation';
|
|
4
|
-
export { default as GlRichTextEditorDocumentation } from '../src/components/editors/rich_text_editor/rich_text_editor.documentation';
|
|
5
|
-
export { default as GlKeysetPaginationDocumentation } from '../src/components/base/keyset_pagination/keyset_pagination.documentation';
|
|
6
|
-
export { default as GlInputGroupTextDocumentation } from '../src/components/base/form/input_group_text/input_group_text.documentation';
|
|
7
|
-
export { default as GlFormTextDocumentation } from '../src/components/base/form/form_text/form_text.documentation';
|
|
8
|
-
export { default as GlFormComboboxDocumentation } from '../src/components/base/form/form_combobox/form_combobox.documentation';
|
|
9
|
-
export { default as GlGaugeChartDocumentation } from '../src/components/charts/gauge/gauge.documentation';
|
|
10
|
-
export { default as GlTokenSelectorDocumentation } from '../src/components/base/token_selector/token_selector.documentation';
|
|
11
|
-
export { default as GlNavDocumentation } from '../src/components/base/nav/nav.documentation';
|
|
12
|
-
export { default as GlFormCheckboxTreeDocumentation } from '../src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation';
|
|
13
|
-
export { default as GlMarkdownDocumentation } from '../src/components/base/markdown/markdown.documentation';
|
|
14
|
-
export { default as GlNavbarDocumentation } from '../src/components/base/navbar/navbar.documentation';
|
|
15
|
-
export { default as GlIntersectionObserverDocumentation } from '../src/components/utilities/intersection_observer/intersection_observer.documentation';
|
|
16
|
-
export { default as GlChartDocumentation } from '../src/components/charts/chart/chart.documentation';
|
|
17
|
-
export { default as GlAreaChartDocumentation } from '../src/components/charts/area/area.documentation';
|
|
18
|
-
export { default as GlLineChartDocumentation } from '../src/components/charts/line/line.documentation';
|
|
19
|
-
export { default as GlSparklineChartDocumentation } from '../src/components/charts/sparkline/sparkline.documentation';
|
|
20
|
-
export { default as GlChartSeriesLabelDocumentation } from '../src/components/charts/series_label/series_label.documentation';
|
|
21
|
-
export { default as GlStackedColumnChartDocumentation } from '../src/components/charts/stacked_column/stacked_column.documentation';
|
|
22
|
-
export { default as GlBarChartDocumentation } from '../src/components/charts/bar/bar.documentation';
|
|
23
|
-
export { default as GlSingleStatDocumentation } from '../src/components/charts/single_stat/single_stat.documentation';
|
|
24
|
-
export { default as GlChartTooltipDocumentation } from '../src/components/charts/tooltip/tooltip.documentation';
|
|
25
|
-
export { default as GlToastDocumentation } from '../src/components/base/toast/toast.documentation';
|
|
26
|
-
export { default as GlAvatarDocumentation } from '../src/components/base/avatar/avatar.documentation';
|
|
27
|
-
export { default as GlAvatarsInlineDocumentation } from '../src/components/base/avatars_inline/avatars_inline.documentation';
|
|
28
|
-
export { default as GlAvatarLinkDocumentation } from '../src/components/base/avatar_link/avatar_link.documentation';
|
|
29
|
-
export { default as GlAvatarLabeledDocumentation } from '../src/components/base/avatar_labeled/avatar_labeled.documentation';
|
|
30
|
-
export { default as GlColumnChartDocumentation } from '../src/components/charts/column/column.documentation';
|
|
31
|
-
export { default as GlDiscreteScatterChartDocumentation } from '../src/components/charts/discrete_scatter/discrete_scatter.documentation';
|
|
32
|
-
export { default as GlSkeletonLoadingDocumentation } from '../src/components/base/skeleton_loading/skeleton_loading.documentation';
|
|
33
|
-
export { default as GlBadgeDocumentation } from '../src/components/base/badge/badge.documentation';
|
|
34
|
-
export { default as GlButtonDocumentation } from '../src/components/base/button/button.documentation';
|
|
35
|
-
export { default as GlLinkDocumentation } from '../src/components/base/link/link.documentation';
|
|
36
|
-
export { default as GlLoadingIconDocumentation } from '../src/components/base/loading_icon/loading_icon.documentation';
|
|
37
|
-
export { default as GlIconDocumentation } from '../src/components/base/icon/icon.documentation';
|
|
38
|
-
export { default as GlModalDocumentation } from '../src/components/base/modal/modal.documentation';
|
|
39
|
-
export { default as GlPaginationDocumentation } from '../src/components/base/pagination/pagination.documentation';
|
|
40
|
-
export { default as GlPaginatedListDocumentation } from '../src/components/base/paginated_list/paginated_list.documentation';
|
|
41
|
-
export { default as GlPathDocumentation } from '../src/components/base/path/path.documentation';
|
|
42
|
-
export { default as GlPopoverDocumentation } from '../src/components/base/popover/popover.documentation';
|
|
43
|
-
export { default as GlTooltipDocumentation } from '../src/components/base/tooltip/tooltip.documentation';
|
|
44
|
-
export { default as GlDashboardSkeletonDocumentation } from '../src/components/regions/dashboard_skeleton/dashboard_skeleton.documentation';
|
|
45
|
-
export { default as GlEmptyStateDocumentation } from '../src/components/regions/empty_state/empty_state.documentation';
|
|
46
|
-
export { default as GlFormDocumentation } from '../src/components/base/form/form.documentation';
|
|
47
|
-
export { default as GlFormInputDocumentation } from '../src/components/base/form/form_input/form_input.documentation';
|
|
48
|
-
export { default as GlFormInputGroupDocumentation } from '../src/components/base/form/form_input_group/form_input_group.documentation';
|
|
49
|
-
export { default as GlFormTextareaDocumentation } from '../src/components/base/form/form_textarea/form_textarea.documentation';
|
|
50
|
-
export { default as GlFormGroupDocumentation } from '../src/components/base/form/form_group/form_group.documentation';
|
|
51
|
-
export { default as GlFormRadioDocumentation } from '../src/components/base/form/form_radio/form_radio.documentation';
|
|
52
|
-
export { default as GlFormRadioGroupDocumentation } from '../src/components/base/form/form_radio_group/form_radio_group.documentation';
|
|
53
|
-
export { default as GlFormSelectDocumentation } from '../src/components/base/form/form_select/form_select.documentation';
|
|
54
|
-
export { default as GlSearchBoxByTypeDocumentation } from '../src/components/base/search_box_by_type/search_box_by_type.documentation';
|
|
55
|
-
export { default as GlSearchBoxByClickDocumentation } from '../src/components/base/search_box_by_click/search_box_by_click.documentation';
|
|
56
|
-
export { default as GlDropdownDocumentation } from '../src/components/base/dropdown/dropdown.documentation';
|
|
57
|
-
export { default as GlDropdownItemDocumentation } from '../src/components/base/dropdown/dropdown_item.documentation';
|
|
58
|
-
export { default as GlTableDocumentation } from '../src/components/base/table/table.documentation';
|
|
59
|
-
export { default as GlBreadcrumbDocumentation } from '../src/components/base/breadcrumb/breadcrumb.documentation';
|
|
60
|
-
export { default as GlHeatmapDocumentation } from '../src/components/charts/heatmap/heatmap.documentation';
|
|
61
|
-
export { default as GlTabsDocumentation } from '../src/components/base/tabs/tabs/tabs.documentation';
|
|
62
|
-
export { default as GlButtonGroupDocumentation } from '../src/components/base/button_group/button_group.documentation';
|
|
63
|
-
export { default as GlFormCheckboxDocumentation } from '../src/components/base/form/form_checkbox/form_checkbox.documentation';
|
|
64
|
-
export { default as GlLabelDocumentation } from '../src/components/base/label/label.documentation';
|
|
65
|
-
export { default as GlDatepickerDocumentation } from '../src/components/base/datepicker/datepicker.documentation';
|
|
66
|
-
export { default as GlTokenDocumentation } from '../src/components/base/token/token.documentation';
|
|
67
|
-
export { default as GlToggleDocumentation } from '../src/components/base/toggle/toggle.documentation';
|
|
68
|
-
export { default as GlDaterangePickerDocumentation } from '../src/components/base/daterange_picker/daterange_picker.documentation';
|
|
69
|
-
export { default as GlSortingDocumentation } from '../src/components/base/sorting/sorting.documentation';
|
|
70
|
-
export { default as GlSortingItemDocumentation } from '../src/components/base/sorting/sorting_item.documentation';
|
|
71
|
-
export { default as GlInfiniteScrollDocumentation } from '../src/components/base/infinite_scroll/infinite_scroll.documentation';
|
|
72
|
-
export { default as GlAlertDocumentation } from '../src/components/base/alert/alert.documentation';
|
|
73
|
-
export { default as GlSegmentedControlDocumentation } from '../src/components/base/segmented_control/segmented_control.documentation';
|
|
74
|
-
export { default as GlSkeletonLoaderDocumentation } from '../src/components/base/skeleton_loader/skeleton_loader.documentation';
|
|
75
|
-
export { default as GlDrawerDocumentation } from '../src/components/base/drawer/drawer.documentation';
|
|
76
|
-
export { default as GlCardDocumentation } from '../src/components/base/card/card.documentation';
|
|
77
|
-
export { default as GlOutsideDirectiveDocumentation } from '../src/directives/outside/outside.documentation';
|
|
78
|
-
export { default as GlResizeObserverDirectiveDocumentation } from '../src/directives/resize_observer/resize_observer.documentation';
|
|
79
|
-
export { default as GlBannerDocumentation } from '../src/components/base/banner/banner.documentation';
|
|
80
|
-
export { default as GlFilteredSearchSuggestionDocumentation } from '../src/components/base/filtered_search/filtered_search_suggestion.documentation';
|
|
81
|
-
export { default as GlFilteredSearchSuggestionListDocumentation } from '../src/components/base/filtered_search/filtered_search_suggestion_list.documentation';
|
|
82
|
-
export { default as GlFilteredSearchTermDocumentation } from '../src/components/base/filtered_search/filtered_search_term.documentation';
|
|
83
|
-
export { default as GlFilteredSearchTokenDocumentation } from '../src/components/base/filtered_search/filtered_search_token.documentation';
|
|
84
|
-
export { default as GlFilteredSearchTokenSegmentDocumentation } from '../src/components/base/filtered_search/filtered_search_token_segment.documentation';
|
|
85
|
-
export { default as GlFilteredSearchDocumentation } from '../src/components/base/filtered_search/filtered_search.documentation';
|
|
86
|
-
export { default as GlBroadcastMessageDocumentation } from '../src/components/base/broadcast_message/broadcast_message.documentation';
|
|
87
|
-
export { default as GlCollapseDocumentation } from '../src/components/base/collapse/collapse.documentation';
|
|
88
|
-
export { default as GlAccordionDocumentation } from '../src/components/base/accordion/accordion.documentation';
|
|
89
|
-
export { default as GlAccordionItemDocumentation } from '../src/components/base/accordion/accordion_item.documentation';
|
|
90
|
-
export { default as GlCarouselDocumentation } from '../src/components/base/carousel/carousel.documentation';
|
|
91
|
-
export { default as GlSafeLinkDirectiveDocumentation } from '../src/directives/safe_link/safe_link.documentation';
|
|
92
|
-
export { default as GlSafeHtmlDirectiveDocumentation } from '../src/directives/safe_html/safe_html.documentation';
|
|
93
|
-
export { default as GlAnimatedNumberDocumentation } from '../src/components/utilities/animated_number/animated_number.documentation';
|
|
94
|
-
export { default as GlFriendlyWrapDocumentation } from '../src/components/utilities/friendly_wrap/friendly_wrap.documentation';
|
|
95
|
-
export { default as GlIntersperseDocumentation } from '../src/components/utilities/intersperse/intersperse.documentation';
|
|
96
|
-
export { default as GlSprintfDocumentation } from '../src/components/utilities/sprintf/sprintf.documentation';
|
|
97
|
-
export { default as GlTruncateDocumentation } from '../src/components/utilities/truncate/truncate.documentation';
|
|
98
|
-
export { default as GlHoverLoadDirectiveDocumentation } from '../src/directives/hover_load/hover_load.documentation';
|
|
99
|
-
|
|
100
|
-
const componentList = Object.getPrototypeOf(module).exports;
|
|
101
|
-
|
|
102
|
-
export const getDocumentationFor = (componentName) => {
|
|
103
|
-
const documentationKey = `${componentName}Documentation`;
|
|
104
|
-
const documentationObject = componentList[documentationKey];
|
|
105
|
-
if (!documentationObject) {
|
|
106
|
-
throw new Error(
|
|
107
|
-
`Could not find ${documentationKey} in documentation/components_documentation.js!`
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return documentationObject;
|
|
111
|
-
};
|
package/documentation/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as ComponentDocumentations from './components_documentation';
|
|
2
|
-
|
|
3
|
-
export { ComponentDocumentations };
|
|
4
|
-
|
|
5
|
-
export { default as GlComponentDocumentation } from './components/component_documentation_generator.vue';
|
|
6
|
-
|
|
7
|
-
export { default as GlExampleExplorer } from './components/example_explorer.vue';
|
|
8
|
-
export { default as GlExampleDisplay } from './components/example_display.vue';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import description from './button.md';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
description,
|
|
5
|
-
followsDesignSystem: true,
|
|
6
|
-
bootstrapComponent: 'b-button',
|
|
7
|
-
bootstrapPropsInfo: {
|
|
8
|
-
category: {
|
|
9
|
-
enum: 'buttonCategoryOptions',
|
|
10
|
-
},
|
|
11
|
-
variant: {
|
|
12
|
-
enum: 'buttonVariantOptions',
|
|
13
|
-
},
|
|
14
|
-
size: {
|
|
15
|
-
enum: 'buttonSizeOptions',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
events: [
|
|
19
|
-
{
|
|
20
|
-
event: 'click',
|
|
21
|
-
description: 'Emitted when clicked on button',
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
};
|